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

372 lines
971 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[80,5,6,7,17],{"+NIl":function(lt,$e,re){(function(ne){ne(re("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function($,D){"use strict";function Y(w,C){w.cmdState.push(C)}function F(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function R(w){var C=w.cmdState.pop();C&&C.closeBracket()}function W(w){for(var C=w.cmdState,E=C.length-1;E>=0;E--){var d=C[E];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function B(w,C,E){return function(){this.name=w,this.bracketNo=0,this.style=C,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=B("importmodule","tag",["string","builtin"]),P.documentclass=B("documentclass","tag",["","atom"]),P.usepackage=B("usepackage","tag",["atom"]),P.begin=B("begin","tag",["atom"]),P.end=B("end","tag",["atom"]),P.label=B("label","tag",["atom"]),P.ref=B("ref","tag",["atom"]),P.eqref=B("eqref","tag",["atom"]),P.cite=B("cite","tag",["atom"]),P.bibitem=B("bibitem","tag",["atom"]),P.Bibitem=B("Bibitem","tag",["atom"]),P.RBibitem=B("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(w,C){w.f=C}function f(w,C){var E;if(w.match(/^\\[a-zA-Z@]+/)){var d=w.current().slice(1);return E=P.hasOwnProperty(d)?P[d]:P.DEFAULT,E=new E,Y(C,E),A(C,M),E.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return A(C,function(s,h){return x(s,h,"\\]")}),"keyword";if(w.match("\\("))return A(C,function(s,h){return x(s,h,"\\)")}),"keyword";if(w.match("$$"))return A(C,function(s,h){return x(s,h,"$$")}),"keyword";if(w.match("$"))return A(C,function(s,h){return x(s,h,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(E=F(C),E)E.closeBracket(a),A(C,M);else return"error";return"bracket"}else return a=="{"||a=="["?(E=P.DEFAULT,E=new E,Y(C,E),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),E=W(C),E.name=="begin"&&(E.argument=w.current()),E.styleIdentifier())}function x(w,C,E){if(w.eatSpace())return null;if(E&&w.match(E))return A(C,f),"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 M(w,C){var E=w.peek(),d;return E=="{"||E=="["?(d=F(C),d.openBracket(E),w.eat(E),A(C,f),"bracket"):/[ \t\r]/.test(E)?(w.eat(E),null):(A(C,f),R(C),f(w,C))}return{startState:function(){var w=D.inMathMode?function(C,E){return x(C,E)}:f;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,C){return C.f(w,C)},blankLine:function(w){w.f=f,w.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(lt,$e,re){(function(ne){ne(re("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(B,P,A){var f=A&&A!=ne.Init;if(P&&!f)B.on("blur",F),B.on("change",R),B.on("swapDoc",R),ne.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Y(B)}),R(B);else if(!P&&f){B.off("blur",F),B.off("change",R),B.off("swapDoc",R),ne.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),$(B);var x=B.getWrapperElement();x.className=x.className.replace(" CodeMirror-empty","")}P&&!B.hasFocus()&&F(B)});function $(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function D(B){$(B);var P=B.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=B.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var A=B.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),P.appendChild(A),B.display.lineSpace.insertBefore(P,B.display.lineSpace.firstChild)}function Y(B){setTimeout(function(){var P=!1,A=B.getInputField();A.nodeName=="TEXTAREA"?P=!A.value:B.lineCount()==1&&(P=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),P?D(B):$(B)},20)}function F(B){W(B)&&D(B)}function R(B){var P=B.getWrapperElement(),A=W(B);P.className=P.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?D(B):$(B)}function W(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(lt,$e,re){(function(ne){ne(re("VrN/"))})(function(ne){"use strict";var $={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(Y,F){var R=Y.indentUnit,W={},B=F.htmlMode?$:D;for(var P in B)W[P]=B[P];for(var P in F)W[P]=F[P];var A,f;function x(o,T){function S(U){return T.tokenize=U,U(o,T)}var m=o.next();if(m=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?S(C("atom","]]>")):null:o.match("--")?S(C("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),S(E(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),T.tokenize=C("meta","?>"),"meta"):(A=o.eat("/")?"closeTag":"openTag",T.tokenize=M,"tag bracket");if(m=="&"){var O;return o.eat("#")?o.eat("x")?O=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):O=o.eatWhile(/[\d]/)&&o.eat(";"):O=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),O?"atom":"error"}else return o.eatWhile(/[^&<]/),null}x.isInText=!0;function M(o,T){var S=o.next();if(S==">"||S=="/"&&o.eat(">"))return T.tokenize=x,A=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return A="equals",null;if(S=="<"){T.tokenize=x,T.state=h,T.tagName=T.tagStart=null;var m=T.tokenize(o,T);return m?m+" tag error":"tag error"}else return/[\'\"]/.test(S)?(T.tokenize=w(S),T.stringStartCol=o.column(),T.tokenize(o,T)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var T=function(S,m){for(;!S.eol();)if(S.next()==o){m.tokenize=M;break}return"string"};return T.isInAttribute=!0,T}function C(o,T){return function(S,m){for(;!S.eol();){if(S.match(T)){m.tokenize=x;break}S.next()}return o}}function E(o){return function(T,S){for(var m;(m=T.next())!=null;){if(m=="<")return S.tokenize=E(o+1),S.tokenize(T,S);if(m==">")if(o==1){S.tokenize=x;break}else return S.tokenize=E(o-1),S.tokenize(T,S)}return"meta"}}function d(o,T,S){this.prev=o.context,this.tagName=T,this.indent=o.indented,this.startOfLine=S,(W.doNotIndent.hasOwnProperty(T)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,T){for(var S;;){if(!o.context)return;if(S=o.context.tagName,!W.contextGrabbers.hasOwnProperty(S)||!W.contextGrabbers[S].hasOwnProperty(T))return;a(o)}}function h(o,T,S){return o=="openTag"?(S.tagStart=T.column(),L):o=="closeTag"?p:h}function L(o,T,S){return o=="word"?(S.tagName=T.current(),f="tag",b):W.allowMissingTagName&&o=="endTag"?(f="tag bracket",b(o,T,S)):(f="error",L)}function p(o,T,S){if(o=="word"){var m=T.current();return S.context&&S.context.tagName!=m&&W.implicitlyClosed.hasOwnProperty(S.context.tagName)&&a(S),S.context&&S.context.tagName==m||W.matchClosing===!1?(f="tag",v):(f="tag error",k)}else return W.allowMissingTagName&&o=="endTag"?(f="tag bracket",v(o,T,S)):(f="error",k)}function v(o,T,S){return o!="endTag"?(f="error",v):(a(S),h)}function k(o,T,S){return f="error",v(o,T,S)}function b(o,T,S){if(o=="word")return f="attribute",g;if(o=="endTag"||o=="selfcloseTag"){var m=S.tagName,O=S.tagStart;return S.tagName=S.tagStart=null,o=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(m)?s(S,m):(s(S,m),S.context=new d(S,m,O==S.indented)),h}return f="error",b}function g(o,T,S){return o=="equals"?c:(W.allowMissing||(f="error"),b(o,T,S))}function c(o,T,S){return o=="string"?u:o=="word"&&W.allowUnquoted?(f="string",b):(f="error",b(o,T,S))}function u(o,T,S){return o=="string"?u:b(o,T,S)}return{startState:function(o){var T={tokenize:x,state:h,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(T.baseIndent=o),T},token:function(o,T){if(!T.tagName&&o.sol()&&(T.indented=o.indentation()),o.eatSpace())return null;A=null;var S=T.tokenize(o,T);return(S||A)&&S!="comment"&&(f=null,T.state=T.state(A||S,o,T),f&&(S=f=="error"?S+" error":f)),S},indent:function(o,T,S){var m=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+R;if(m&&m.noIndent)return ne.Pass;if(o.tokenize!=M&&o.tokenize!=x)return S?S.match(/^(\s*)/)[0].length:0;if(o.tagName)return W.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+R*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(T))return 0;var O=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(O&&O[1])for(;m;)if(m.tagName==O[2]){m=m.prev;break}else if(W.implicitlyClosed.hasOwnProperty(m.tagName))m=m.prev;else break;else if(O)for(;m;){var U=W.contextGrabbers[m.tagName];if(U&&U.hasOwnProperty(O[2]))m=m.prev;else break}for(;m&&m.prev&&!m.startOfLine;)m=m.prev;return m?m.indent+R:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(o){o.state==c&&(o.state=b)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var T=[],S=o.context;S;S=S.prev)S.tagName&&T.push(S.tagName);return T.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(lt,$e,re){"use strict";re.d($e,"a",function(){return p});var ne=re("+L6B"),$=re("2/Rp"),D=re("2qtc"),Y=re("kLXV"),F=re("9og8"),R=re("k1fw"),W=re("miYZ"),B=re("tsqr"),P=re("oBTY"),A=re("tJVT"),f=re("DZo9"),x=re("8z0m"),M=re("WmNS"),w=re.n(M),C=re("q1tI"),E=re.n(C),d=re("m3rI"),a=re("wzkS"),s=re("y5JW"),h=re("LtfV"),L=x.a.Dragger;function p(v){var k=[];return v&&v.length>0&&(k=v.map(function(b){return{uid:b.id,id:b.id,name:b.title+s.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),k}$e.b=function(v){var k=v.value,b=v.onChange,g=v.action,c=v.className,u=v.maxSize,o=u===void 0?150:u,T=v.title,S=T===void 0?"\u4E0A\u4F20\u9644\u4EF6":T,m=v.showRemoveModal,O=m===void 0?!1:m,U=v.accept,j=U===void 0?"":U,K=v.additionalText,I=v.isDragger,N=v.number,X=N===void 0?1e3:N,q=v.aloneClear,se=q===void 0?!1:q,he=v.restrict,Ae=he===void 0?!0:he,be=Object(C.useState)(!1),Te=Object(A.a)(be,2),Ce=Te[0],Se=Te[1],pe=Object(C.useState)(k||[]),ue=Object(A.a)(pe,2),te=ue[0],fe=ue[1];Object(C.useEffect)(function(){k&&(fe(Object(P.a)(k)),X===(k==null?void 0:k.length)&&Se(!0))},[k]);var ae=function(){setTimeout(function(){te.pop(),fe(Object(P.a)(te))},500)},_e={multiple:!0,disabled:Ce,accept:j,withCredentials:!0,fileList:te,beforeUpload:function(Oe,Ie){var Ue=Oe.size/1024/1024;return te.concat(Ie).length>X?(te.pop(),fe(Object(P.a)(te)),B.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(X,"\u4E2A\u6587\u4EF6")),se?Promise.reject():(ae(),!1)):Ue<o?!0:(B.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(o,"MB).")),se?Promise.reject():(ae(),!1))},action:g||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Oe){var Ie=Object(P.a)(Oe.fileList);Ie.length>=X?Se(!0):Se(!1),fe(Object(P.a)(Ie)),Ie=Ie.map(function(Ue){var We;if(Ue!=null&&(We=Ue.response)!==null&&We!==void 0&&We.id){var Be;Ue.url="/api/attachments/".concat(Ue==null||((Be=Ue.response)===null||Be===void 0)?void 0:Be.id)}return Ue.name.indexOf(s.c)===-1&&(Ue.name="".concat(Ue.name).concat(s.c).concat(Object(s.a)(Ue.size))),Object(R.a)({},Ue)}),console.log("info:",Oe),b(Ie)},onRemove:function(){var xe=Object(F.a)(w.a.mark(function Ie(Ue){var We;return w.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(We=function(){var it=Object(F.a)(w.a.mark(function et(){var qe,Qe;return w.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(qe=Ue.response?Ue.response.id:Ue.id,!qe){Ze.next=8;break}return Ze.next=4,Object(a.d)(Ue.response?Ue.response.id:Ue.uid);case 4:return Qe=Ze.sent,Ze.abrupt("return",Qe);case 8:return Ze.abrupt("return",!0);case 9:case"end":return Ze.stop()}},et)}));return function(){return it.apply(this,arguments)}}(),!O){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(it,et){Y.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:E.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var qe=Object(F.a)(w.a.mark(function ot(){var Ze;return w.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Pe.next=2,We();case 2:Ze=Pe.sent,B.b.success("\u5220\u9664\u6210\u529F"),it(!0);case 5:case"end":return Pe.stop()}},ot)}));function Qe(){return qe.apply(this,arguments)}return Qe}(),onCancel:function(){return it(!1)}})}));case 5:return Fe.next=7,We();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Ie)}));function Oe(Ie){return xe.apply(this,arguments)}return Oe}()};function De(xe){xe.preventDefault(),xe.stopPropagation()}return E.a.createElement("div",{className:"multi-upload ".concat(c||"")},I&&E.a.createElement(L,_e,E.a.createElement("p",{className:"ant-upload-drag-icon"},E.a.createElement(h.a,null)),E.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",E.a.createElement("br",null),E.a.createElement("span",{style:{display:Ae?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",o,"MB) ")),K),!I&&E.a.createElement(x.a,_e,E.a.createElement($.a,{disabled:Ce},S),E.a.createElement("span",{onClick:De,style:{marginLeft:10,color:"#FA6400",display:Ae?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",o,"MB) ")))}},"55Ip":function(lt,$e,re){"use strict";re.d($e,"a",function(){return s}),re.d($e,"b",function(){return b});var ne=re("Ty5D"),$=re("dI71"),D=re("q1tI"),Y=re.n(D),F=re("YS25"),R=re("17x9"),W=re.n(R),B=re("wx14"),P=re("zLVn"),A=re("9R94"),f=function(c){Object($.a)(u,c);function u(){for(var T,S=arguments.length,m=new Array(S),O=0;O<S;O++)m[O]=arguments[O];return T=c.call.apply(c,[this].concat(m))||this,T.history=Object(F.a)(T.props),T}var o=u.prototype;return o.render=function(){return Y.a.createElement(ne.c,{history:this.history,children:this.props.children})},u}(Y.a.Component),x=function(c){Object($.a)(u,c);function u(){for(var T,S=arguments.length,m=new Array(S),O=0;O<S;O++)m[O]=arguments[O];return T=c.call.apply(c,[this].concat(m))||this,T.history=Object(F.b)(T.props),T}var o=u.prototype;return o.render=function(){return Y.a.createElement(ne.c,{history:this.history,children:this.props.children})},u}(Y.a.Component),M=function(u,o){return typeof u=="function"?u(o):u},w=function(u,o){return typeof u=="string"?Object(F.c)(u,null,null,o):u},C=function(u){return u},E=Y.a.forwardRef;typeof E=="undefined"&&(E=C);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var a=E(function(c,u){var o=c.innerRef,T=c.navigate,S=c.onClick,m=Object(P.a)(c,["innerRef","navigate","onClick"]),O=m.target,U=Object(B.a)({},m,{onClick:function(K){try{S&&S(K)}catch(I){throw K.preventDefault(),I}!K.defaultPrevented&&K.button===0&&(!O||O==="_self")&&!d(K)&&(K.preventDefault(),T())}});return C!==E?U.ref=u||o:U.ref=o,Y.a.createElement("a",U)}),s=E(function(c,u){var o=c.component,T=o===void 0?a:o,S=c.replace,m=c.to,O=c.innerRef,U=Object(P.a)(c,["component","replace","to","innerRef"]);return Y.a.createElement(ne.e.Consumer,null,function(j){j||Object(A.a)(!1);var K=j.history,I=w(M(m,j.location),j.location),N=I?K.createHref(I):"",X=Object(B.a)({},U,{href:N,navigate:function(){var se=M(m,j.location),he=S?K.replace:K.push;he(se)}});return C!==E?X.ref=u||O:X.innerRef=O,Y.a.createElement(T,X)})});if(!1)var h,L;var p=function(u){return u},v=Y.a.forwardRef;typeof v=="undefined"&&(v=p);function k(){for(var c=arguments.length,u=new Array(c),o=0;o<c;o++)u[o]=arguments[o];return u.filter(function(T){return T}).join(" ")}var b=v(function(c,u){var o=c["aria-current"],T=o===void 0?"page":o,S=c.activeClassName,m=S===void 0?"active":S,O=c.activeStyle,U=c.className,j=c.exact,K=c.isActive,I=c.location,N=c.sensitive,X=c.strict,q=c.style,se=c.to,he=c.innerRef,Ae=Object(P.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Y.a.createElement(ne.e.Consumer,null,function(be){be||Object(A.a)(!1);var Te=I||be.location,Ce=w(M(se,Te),Te),Se=Ce.pathname,pe=Se&&Se.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=pe?Object(ne.f)(Te.pathname,{path:pe,exact:j,sensitive:N,strict:X}):null,te=!!(K?K(ue,Te):ue),fe=te?k(U,m):U,ae=te?Object(B.a)({},q,{},O):q,_e=Object(B.a)({"aria-current":te&&T||null,className:fe,style:ae,to:Ce},Ae);return p!==v?_e.ref=u||he:_e.innerRef=he,Y.a.createElement(s,_e)})});if(!1)var g},"7Cbv":function(lt,$e,re){"use strict";var ne=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function D(){if(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne($)}var Y=/^(?:[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(M){return typeof M=="string"&&Y.test(M)}for(var R=F,W=[],B=0;B<256;++B)W.push((B+256).toString(16).substr(1));function P(M){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(W[M[w+0]]+W[M[w+1]]+W[M[w+2]]+W[M[w+3]]+"-"+W[M[w+4]]+W[M[w+5]]+"-"+W[M[w+6]]+W[M[w+7]]+"-"+W[M[w+8]]+W[M[w+9]]+"-"+W[M[w+10]]+W[M[w+11]]+W[M[w+12]]+W[M[w+13]]+W[M[w+14]]+W[M[w+15]]).toLowerCase();if(!R(C))throw TypeError("Stringified UUID is invalid");return C}var A=P;function f(M,w,C){M=M||{};var E=M.random||(M.rng||D)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,w){C=C||0;for(var d=0;d<16;++d)w[C+d]=E[d];return w}return A(E)}var x=$e.a=f},"7ahc":function(lt,$e,re){"use strict";re.d($e,"a",function(){return L});var ne=re("k1fw"),$=re("0Owb"),D=re("+L6B"),Y=re("2/Rp"),F=re("y8nQ"),R=re("Vl3Y"),W=re("tJVT"),B=re("OaEy"),P=re("2fM7"),A=re("q1tI"),f=re.n(A),x=re("VrN/"),M=re.n(x),w=re("p77/"),C=re.n(w),E=re("c5Ni"),d=re.n(E),a=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};$e.b=function(p){var v=p.callback,k=p.onCancel,b=Object(A.useState)("python"),g=Object(W.a)(b,2),c=g[0],u=g[1];function o(S){u(h[S][1])}function T(S){v(S)}return f.a.createElement(R.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),f.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},f.a.createElement(P.a,{onChange:o},Object.keys(h).map(function(S){return f.a.createElement(a,{key:S,value:S},h[S][0])}))),f.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},f.a.createElement(L,{mode:c})),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(Y.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function L(p){var v=p.value,k=p.onChange,b=p.mode,g=p.options,c=g===void 0?{}:g,u=Object(A.useRef)(),o=Object(A.useState)(),T=Object(W.a)(o,2),S=T[0],m=T[1];return Object(A.useEffect)(function(){if(S){function O(U){var j=U.getValue();k&&k(j)}return S.on("change",O),function(){S.off("change",O)}}},[S,k]),Object(A.useEffect)(function(){S&&S.setOption("mode",b)},[S,b]),Object(A.useEffect)(function(){S&&((v!==S.getValue()||v==="")&&setTimeout(function(){S.setValue(v||" ")},300))},[S,v]),Object(A.useEffect)(function(){if(u.current&&!S){var O=M.a.fromTextArea(u.current,Object(ne.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));m(O)}},[u.current,S]),f.a.createElement("div",{className:"my-codemirror-container"},f.a.createElement("textarea",{ref:u}))}},"8EBN":function(lt,$e,re){(function(ne){ne(re("VrN/"))})(function(ne){"use strict";ne.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 $=0;$<ne.modeInfo.length;$++){var D=ne.modeInfo[$];D.mimes&&(D.mime=D.mimes[0])}ne.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.mime==Y)return R;if(R.mimes){for(var W=0;W<R.mimes.length;W++)if(R.mimes[W]==Y)return R}}if(/\+xml$/.test(Y))return ne.findModeByMIME("application/xml");if(/\+json$/.test(Y))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.ext){for(var W=0;W<R.ext.length;W++)if(R.ext[W]==Y)return R}}},ne.findModeByFileName=function(Y){for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.file&&R.file.test(Y))return R}var W=Y.lastIndexOf("."),B=W>-1&&Y.substring(W+1,Y.length);if(B)return ne.findModeByExtension(B)},ne.findModeByName=function(Y){Y=Y.toLowerCase();for(var F=0;F<ne.modeInfo.length;F++){var R=ne.modeInfo[F];if(R.name.toLowerCase()==Y)return R;if(R.alias){for(var W=0;W<R.alias.length;W++)if(R.alias[W].toLowerCase()==Y)return R}}}})},"8hTe":function(lt,$e,re){lt.exports={button:"button___1wy9m"}},"9Bee":function(lt,$e,re){"use strict";var ne=re("DYRE"),$=re("zeV3"),D=re("+L6B"),Y=re("2/Rp"),F=re("k1fw"),R=re("9og8"),W=re("tJVT"),B=re("WmNS"),P=re.n(B),A=re("q1tI"),f=re.n(A),x=re("vg9a"),M=re("DlQD"),w=re.n(M),C=re("rUJ1");function E(V,l){var y=V.match(/^(\s+)(?:```)/);if(y===null)return l;var z=y[1];return l.split(`
`).map(function(Z){var G=Z.match(/^\s+/);if(G===null)return Z;var ve=Object(W.a)(G,1),He=ve[0];return He.length>=z.length?Z.slice(z.length):Z}).join(`
`)}var d=[],a=["<ul>"],s=new w.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){d.length=0,a=["<ul>"]}var p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(V,l,y,z){if(l>=V.length||V[l].level<=y)return l;var Z=V[l];z.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),l++;var G=[];return l=v(V,l,Z.level,G),G.length>0&&(z.push("<ul>"),G.forEach(function(ve){z.push(ve)}),z.push("</ul>")),z.push("</li>"),l=v(V,l,y,z),l}function k(){return v(d,0,0,a),a.push("</ul>"),a.join("")}var b={heading:function(l){var y=h.exec(l);if(y)return{type:"heading",raw:y[0],depth:y[1].length,text:y[2]}},fences:function(l){var y=this.rules.block.fences.exec(l);if(y){var z=y[0],Z=E(z,y[3]||""),G=y[2]?y[2].trim():y[2];if(["latex","katex","math"].indexOf(G)>=0){var ve=u(),He=Z;Z=ve,o[ve]={type:"block",expression:He}}return{type:"code",raw:z,lang:G,text:Z}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},o={};function T(){return o}function S(){c=0,o={}}function m(V){return V=V.replace(g,function(l,y){var z=u();return o[z]={type:"inline",expression:y},z}),V}var O=s.listitem;s.listitem=function(V){return O(m(V))};var U=s.paragraph;s.paragraph=function(V){return U(m(V))};var j=s.tablecell;s.tablecell=function(V,l){return j(m(V),l)},s.code=function(V,l,y){var z=(l||"").match(/\S*/)[0];return z?["latex","katex","math"].indexOf(z)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(y?V:Object(C.escape)(V,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(y?V:Object(C.escape)(V,!0))+"</code></pre>"},s.heading=function(V,l,y){var z=this.options.headerPrefix+y.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:z,level:l,text:V}),"<h"+l+' id="'+z+'">'+V+"</h"+l+">"},w.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),w.a.use({tokenizer:b,renderer:s});var K=w.a,I=re("SJMd"),N=re("ulZh"),X=re.n(N),q=re("m3rI"),se=re("Oy/b"),he=re("p5ED"),Ae=re("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var be=function(V,l){return(be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,z){y.__proto__=z}||function(y,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(y[Z]=z[Z])})(V,l)};function Te(V,l){function y(){this.constructor=V}be(V,l),V.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}function Ce(V,l,y,z){return new(y||(y=Promise))(function(Z,G){function ve(ct){try{Re(z.next(ct))}catch(ze){G(ze)}}function He(ct){try{Re(z.throw(ct))}catch(ze){G(ze)}}function Re(ct){var ze;ct.done?Z(ct.value):(ze=ct.value,ze instanceof y?ze:new y(function(Ct){Ct(ze)})).then(ve,He)}Re((z=z.apply(V,l||[])).next())})}function Se(V,l){var y,z,Z,G,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function He(Re){return function(ct){return function(ze){if(y)throw new TypeError("Generator is already executing.");for(;ve;)try{if(y=1,z&&(Z=2&ze[0]?z.return:ze[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,ze[1])).done)return Z;switch(z=0,Z&&(ze=[2&ze[0],Z.value]),ze[0]){case 0:case 1:Z=ze;break;case 4:return ve.label++,{value:ze[1],done:!1};case 5:ve.label++,z=ze[1],ze=[0];continue;case 7:ze=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||ze[0]!==6&&ze[0]!==2)){ve=0;continue}if(ze[0]===3&&(!Z||ze[1]>Z[0]&&ze[1]<Z[3])){ve.label=ze[1];break}if(ze[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=ze;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(ze);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}ze=l.call(V,ve)}catch(Ct){ze=[6,Ct],z=0}finally{y=Z=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Re,ct])}}}function pe(){for(var V=0,l=0,y=arguments.length;l<y;l++)V+=arguments[l].length;var z=Array(V),Z=0;for(l=0;l<y;l++)for(var G=arguments[l],ve=0,He=G.length;ve<He;ve++,Z++)z[Z]=G[ve];return z}var ue=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(l,y){for(var z=0,Z=y;z<Z.length;z++){var G=Z[z],ve=G[0],He=G[1];l.setAttribute(ve,He)}},V.createRect=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",l.toString()),Z.setAttribute("height",y.toString()),z&&V.setAttributes(Z,z),Z},V.createLine=function(l,y,z,Z,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",y.toString()),ve.setAttribute("x2",z.toString()),ve.setAttribute("y2",Z.toString()),G&&V.setAttributes(ve,G),ve},V.createPolygon=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",l),y&&V.setAttributes(z,y),z},V.createCircle=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(l/2).toString()),z.setAttribute("cy",(l/2).toString()),z.setAttribute("r",l.toString()),y&&V.setAttributes(z,y),z},V.createEllipse=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(l/2).toString()),Z.setAttribute("cy",(y/2).toString()),Z.setAttribute("rx",(l/2).toString()),Z.setAttribute("ry",(y/2).toString()),z&&V.setAttributes(Z,z),Z},V.createGroup=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&V.setAttributes(y,l),y},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(l,y,z,Z,G,ve,He){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(Re,[["id",l],["orient",y],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",ve.toString()]]),Re.appendChild(He),Re},V.createText=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),l&&V.setAttributes(y,l),y},V.createTSpan=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=l,y&&V.setAttributes(z,y),z},V.createImage=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&V.setAttributes(y,l),y},V.createPoint=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=l,z.y=y,z},V.createPath=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",l),y&&V.setAttributes(z,y),z},V}(),te=function(){function V(){}return V.addKey=function(l){V.key=l},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),fe=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return V.prototype.rasterize=function(l,y,z){var Z=this;return new Promise(function(G){var ve=z!==void 0?z:document.createElement("canvas");l===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",y.width.baseVal.valueAsString),He.setAttribute("height",y.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+y.viewBox.baseVal.width.toString()+" "+y.viewBox.baseVal.height.toString()),He.innerHTML=y.innerHTML,Z.naturalSize===!0?(He.width.baseVal.value=l.naturalWidth,He.height.baseVal.value=l.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(He.width.baseVal.value=Z.width,He.height.baseVal.value=Z.height),ve.width=He.width.baseVal.value,ve.height=He.height.baseVal.value;var Re=He.outerHTML,ct=ve.getContext("2d");Z.markersOnly!==!0&&ct.drawImage(l,0,0,ve.width,ve.height);var ze=window.URL,Ct=new Image(ve.width,ve.height);Ct.setAttribute("crossOrigin","anonymous");var Mt=new Blob([Re],{type:"image/svg+xml"}),Wt=ze.createObjectURL(Mt);Ct.onload=function(){ct.drawImage(Ct,0,0),ze.revokeObjectURL(Wt);var Fr=ve.toDataURL(Z.imageType,Z.imageQuality);G(Fr)},Ct.src=Wt})},V}(),ae=function(){},_e=function(){function V(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},V.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new De("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new De("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new De("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new xe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new xe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),De=function(V,l){this.selector=V,this.style=l},xe=function(V,l){this.localName=V,this.style=l},Oe=function(){function V(l,y,z,Z,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=y,this.markerItems=z,this.uiStyleSettings=Z,this.styles=G,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return V.prototype.show=function(l){var y=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var z=document.createElement("div");z.className=this.toolbarBlockStyleClass.name,z.style.whiteSpace="nowrap",this.uiContainer.appendChild(z),this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(G){var ve=document.createElement("div");ve.className=""+y.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",G.typeName),ve.innerHTML=G.icon,ve.addEventListener("click",function(){y.markerToolbarButtonClicked(ve,G)}),y.buttons.push(ve),y.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Z,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},V.prototype.addButtonClickListener=function(l){this.buttonClickListeners.push(l)},V.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},V.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},V.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var y=0;y<this.markerButtons.length;y++)y<l||y===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[y]):(y===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[y]))}},V.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},V.prototype.resetButtonStyles=function(){var l=this;this.buttons.forEach(function(y){y.className=y.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),y.className=y.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),y.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},V.prototype.addActionButton=function(l,y,z){var Z=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=y,G.setAttribute("data-action",z),G.addEventListener("click",function(){Z.actionToolbarButtonClicked(G,z)}),z){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(G),this.buttons.push(G)},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new xe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new xe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new De("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new De("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},V.prototype.markerToolbarButtonClicked=function(l,y){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("marker",y)}),this.markerButtonOverflowBlock.style.display="none"},V.prototype.actionToolbarButtonClicked=function(l,y){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("action",y)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},V.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},V.prototype.setActiveMarkerButton=function(l){var y=this.markerButtons.find(function(z){return z.getAttribute("data-type-name")===l});y&&this.setActiveButton(y)},V.prototype.setCurrentMarker=function(l){var y=this;this.currentMarker=l,this.buttons.filter(function(z){return/delete|notes/.test(z.getAttribute("data-action"))}).forEach(function(z){y.currentMarker===void 0?(z.style.fillOpacity="0.4",z.style.pointerEvents="none"):(z.style.fillOpacity="1",z.style.pointerEvents="all")})},V}(),Ie=function(){function V(l,y,z,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=y,this.uiStyleSettings=z,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return V.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new xe("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new xe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new xe("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
padding: `+y+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new De("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new De("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},V.prototype.show=function(l){var y;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((y=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},V.prototype.setPanelButtons=function(l){var y,z,Z=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((y=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((z=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&z!==void 0?z:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var ve;G.uiStyleSettings=Z.uiStyleSettings;var He=document.createElement("div");He.className=Z.toolboxButtonStyleClass.name+" "+((ve=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:Z.toolboxButtonStyleColorsClass.name),He.innerHTML=G.icon,He.title=G.title,He.addEventListener("click",function(){Z.panelButtonClick(G)}),Z.panelButtons.push(He),Z.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},V.prototype.panelButtonClick=function(l){var y=this,z=-1;if(l!==this.activePanel){z=this.panels.indexOf(l),this.panelRow.innerHTML="";var Z=l.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){y.displayMode==="inline"?y.panelRow.style.display="none":y.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,ve){var He,Re;G.className=y.toolboxButtonStyleClass.name+" "+(ve===z?""+((He=y.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:y.toolboxActiveButtonStyleColorsClass.name):""+((Re=y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Re!==void 0?Re:y.toolboxButtonStyleColorsClass.name))})},V}(),Ue=function(V,l){this.title=V,this.icon=l},We=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=z,ve.currentColor=Z,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var G=y.getColorBox(Z);z.appendChild(G),y.colorBoxes.push(G)}),z},l.prototype.getColorBox=function(y){var z=this,Z=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-Z,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=G-2+"px",ve.style.height=G-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(G+2)/2+"px",ve.style.borderColor=y===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){z.setCurrentColor(y,ve)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=G-2+"px",He.style.height=G-2+"px",He.style.backgroundColor=y,He.style.borderRadius=G/2+"px",y==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),ve.appendChild(He),ve},l.prototype.setCurrentColor=function(y,z){var Z=this;this.currentColor=y,this.colorBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(y)},l}(Ue),Be=function(){function V(l,y,z){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=y,this.globalSettings=z,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(V.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),V.prototype.ownsTarget=function(l){return!1},Object.defineProperty(V.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),V.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},V.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},V.prototype.pointerDown=function(l,y){},V.prototype.dblClick=function(l,y){},V.prototype.manipulate=function(l){},V.prototype.pointerUp=function(l){this.stateChanged()},V.prototype.dispose=function(){},V.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},V.prototype.getState=function(){return{typeName:V.typeName,state:this.state,notes:this.notes}},V.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},V.prototype.scale=function(l,y){},V.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},V.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},V.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},V.typeName="MarkerBase",V}(),Fe=function(){function V(){this.findGripByVisual=this.findGripByVisual.bind(this)}return V.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},V}(),it=function(){function V(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},V}(),et=function(){function V(){}return V.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},V.toSVGMatrix=function(l,y){return l.a=y.a,l.b=y.b,l.c=y.c,l.d=y.d,l.e=y.e,l.f=y.f,l},V}(),qe=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(ue.createTransform()),G.setupControlBox(),G}return Te(l,V),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(y){this._visual=y;var z=ue.createTransform();this._visual.transform.baseVal.appendItem(z)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(y){return!!V.prototype.ownsTarget.call(this,y)||!!(this.controlGrips.findGripByVisual(y)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(y))},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.left=y.x,this.top=y.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Z=this.unrotatePoint(y);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(z),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(z)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},l.prototype.pointerUp=function(y){var z=this.state;V.prototype.pointerUp.call(this,y),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(y),this._state="select",z==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(y){this.visual.style.transform="translate("+y.x+"px, "+y.y+"px)"},l.prototype.manipulate=function(y){var z=this.unrotatePoint(y);this.state==="creating"?this.resize(y):this.state==="move"?(this.left=this.manipulationStartLeft+(z.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(z.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(z):this.state==="rotate"&&this.rotate(y)},l.prototype.resize=function(y){var z=this.manipulationStartLeft,Z=this.manipulationStartWidth,G=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:z=this.manipulationStartLeft+y.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-z;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+y.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+y.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+y.y-this.manipulationStartY}Z>=0?(this.left=z,this.width=Z):(this.left=z+Z,this.width=-Z),ve>=0?(this.top=G,this.height=ve):(this.top=G+ve,this.height=-ve),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(y){if(Math.abs(y.x-this.centerX)>.1){var z=Math.sign(y.x-this.centerX);this.rotationAngle=180*Math.atan((y.y-this.centerY)/(y.x-this.centerX))/Math.PI+90*z,this.applyRotation()}},l.prototype.applyRotation=function(){var y=this.container.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(y,0)},l.prototype.rotatePoint=function(y){if(this.rotationAngle===0)return y;var z=this.container.getCTM(),Z=ue.createPoint(y.x,y.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},l.prototype.unrotatePoint=function(y){if(this.rotationAngle===0)return y;var z=this.container.getCTM();z=z.inverse();var Z=ue.createPoint(y.x,y.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},l.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var y=ue.createTransform();y.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(y),this.container.appendChild(this.controlBox),this.controlRect=ue.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=ue.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Fe,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var y=this.controlBox.transform.baseVal.getItem(0);y.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(y,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},l.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},l.prototype.createGrip=function(){var y=new it;return y.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(y.visual),y},l.prototype.positionGrips=function(){var y=this.controlGrips.topLeft.GRIP_SIZE,z=-y/2,Z=z,G=(this.width+this.CB_DISTANCE)/2-y/2,ve=(this.height+this.CB_DISTANCE)/2-y/2,He=this.height+this.CB_DISTANCE-y/2,Re=this.width+this.CB_DISTANCE-y/2;this.positionGrip(this.controlGrips.topLeft.visual,z,Z),this.positionGrip(this.controlGrips.topCenter.visual,G,Z),this.positionGrip(this.controlGrips.topRight.visual,Re,Z),this.positionGrip(this.controlGrips.centerLeft.visual,z,ve),this.positionGrip(this.controlGrips.centerRight.visual,Re,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,z,He),this.positionGrip(this.controlGrips.bottomCenter.visual,G,He),this.positionGrip(this.controlGrips.bottomRight.visual,Re,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,Z-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(y,z,Z){var G=y.transform.baseVal.getItem(0);G.setTranslate(z,Z),y.transform.baseVal.replaceItem(G,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:et.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:et.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.left=z.left,this.top=z.top,this.width=z.width,this.height=z.height,this.rotationAngle=z.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,z.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,z.containerTransformMatrix))},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z);var Z=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:Z.x*y,y:Z.y*z});this.left=G.x,this.top=G.y,this.width=this.width*y,this.height=this.height*z,this.adjustControlBox()},l}(Be),Qe=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual)},l.prototype.createVisual=function(){this.visual=ue.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.setSize()},l.prototype.setSize=function(){V.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(y){V.prototype.pointerUp.call(this,y),this.setSize()},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},l.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){var z=y;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize()},l.title="Rectangle marker",l}(qe),ot=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=z,ve.currentWidth=Z,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.widths.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===y.currentWidth?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentWidth(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.innerText=Z.toString(),ve.style.marginRight="5px",G.appendChild(ve);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var Re=document.createElement("hr");Re.style.minWidth="20px",Re.style.border="0px",Re.style.borderTop=Z+"px solid "+y.uiStyleSettings.toolboxColor,Re.style.flexGrow="2",He.appendChild(Re),G.appendChild(He),y.widthBoxes.push(G)}),z},l.prototype.setCurrentWidth=function(y,z){var Z=this;this.currentWidth=y,this.widthBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(Ue),Ze=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=z,ve.currentStyle=Z,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.styles.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/y.styles.length-5+"%",G.style.borderColor=Z===y.currentStyle?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentStyle(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+y.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
</svg>`;ve.innerHTML=He,G.appendChild(ve),y.styleBoxes.push(G)}),z},l.prototype.setCurrentStyle=function(y,z){var Z=this;this.currentStyle=y,this.styleBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(Ue),at=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ot("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Te(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(Qe),Pe=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},dt=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Te(l,V),l.prototype.ownsTarget=function(y){return!!V.prototype.ownsTarget.call(this,y)||!(!this.grip1.ownsTarget(y)&&!this.grip2.ownsTarget(y))},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.manipulationStartX=y.x,this.manipulationStartY=y.y,this.state==="new"&&(this.x1=y.x,this.y1=y.y,this.x2=y.x,this.y2=y.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(z)?this.activeGrip=this.grip1:this.grip2.ownsTarget(z)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},l.prototype.pointerUp=function(y){var z=this.state;V.prototype.pointerUp.call(this,y),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(y),this._state="select",z==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(y){this.state==="creating"?this.resize(y):this.state==="move"?(this.x1=this.manipulationStartX1+y.x-this.manipulationStartX,this.y1=this.manipulationStartY1+y.y-this.manipulationStartY,this.x2=this.manipulationStartX2+y.x-this.manipulationStartX,this.y2=this.manipulationStartY2+y.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(y)},l.prototype.resize=function(y){switch(this.activeGrip){case this.grip1:this.x1=y.x,this.y1=y.y;break;case this.grip2:case void 0:this.x2=y.x,this.y2=y.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var y=new it;return y.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(y.visual),y},l.prototype.positionGrips=function(){var y=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-y/2,this.y1-y/2),this.positionGrip(this.grip2.visual,this.x2-y/2,this.y2-y/2)},l.prototype.positionGrip=function(y,z,Z){var G=y.transform.baseVal.getItem(0);G.setTranslate(z,Z),y.transform.baseVal.replaceItem(G,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},V.prototype.getState.call(this))},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.x1=z.x1,this.y1=z.y1,this.x2=z.x2,this.y2=z.y2},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.x1=this.x1*y,this.y1=this.y1*z,this.x2=this.x2*y,this.y2=this.y2*z,this.adjustVisual(),this.adjustControlBox()},l}(Be),st=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ot("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorLine&&y!==this.visibleLine)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(dt),Ne=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=z,ve.currentFont=Z,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.flexGrow="2",this.fonts.forEach(function(Z){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/y.fonts.length-5+"%",G.style.borderColor=Z===y.currentFont?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentFont(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=Z,ve.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(He),G.appendChild(ve),y.fontBoxes.push(G)}),z},l.prototype.setCurrentFont=function(y,z){var Z=this;this.currentFont=y,this.fontBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(Ue),Ve=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=Z.defaultColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Ne("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Te(l,V),l.prototype.ownsTarget=function(y){if(V.prototype.ownsTarget.call(this,y)||y===this.visual||y===this.textElement||y===this.bgRectangle)return!0;var z=!1;return this.textElement.childNodes.forEach(function(Z){Z===y&&(z=!0)}),z},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.isMoved=!1,this.pointerDownPoint=y,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.renderText=function(){var y=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(z){y.textElement.appendChild(ue.createTSpan(z.trim()===""?" ":z.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var y=this.textElement.getBBox(),z=1;if(y.width>0&&y.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/y.width,G=(1*this.height-this.height*this.padding*2/100)/y.height;z=Math.min(Z,G)}return z},l.prototype.getTextPosition=function(y){var z=this.textElement.getBBox(),Z=0,G=0;return z.width>0&&z.height>0&&(Z=(this.width-z.width*y)/2,G=this.height/2-z.height*y/2),{x:Z,y:G}},l.prototype.sizeText=function(){var y=this.textElement.getBBox(),z=this.getTextScale(),Z=this.getTextPosition(z);Z.y-=y.y*z,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+z+", "+z+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(z,z))},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(y.x-this.pointerDownPoint.x)>5||Math.abs(y.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){V.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},l.prototype.pointerUp=function(y){var z=this.state;z==="creating"&&(this._suppressMarkerCreateEvent=!0),V.prototype.pointerUp.call(this,y),this.setSize(),(z==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var y=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(z){z.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var z=Number.parseFloat(y.textEditor.style.fontSize);y.textEditor.clientWidth>=Number.parseInt(y.textEditor.style.maxWidth)&&z>.9;)z-=.1,y.textEditor.style.fontSize=Math.max(z,.9)+"em"}),this.textEditor.addEventListener("keyup",function(z){z.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(z){if(z.clipboardData){var Z=z.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(Z)),z.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){y.textEditDivClicked(y.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var y=this.getTextScale(),z=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),G={x:Z.width*y,y:Z.height*y};z.x-=G.x/2,z.y-=G.y/2,this.textEditor.style.top=z.y+"px",this.textEditor.style.left=z.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-z.x+"px",this.textEditor.style.fontSize=Math.max(16*y,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(y){this.text=y.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){V.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),V.prototype.deselect.call(this)},l.prototype.dblClick=function(y,z){V.prototype.dblClick.call(this,y,z),this.showTextEditor()},l.prototype.setColor=function(y){this.textElement&&ue.setAttributes(this.textElement,[["fill",y]]),this.color=y,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(y)},l.prototype.setFont=function(y){this.textElement&&ue.setAttributes(this.textElement,[["font-family",y]]),this.fontFamily=y,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.color=z.color,this.fontFamily=z.fontFamily,this.padding=z.padding,this.text=z.text,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',l}(qe),Ee=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=Z.defaultColor,G.lineWidth=Z.defaultStrokeWidth,G.pixelRatio=Z.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new We("Color",Z.defaultColorSet,Z.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new ot("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var y=ue.createTransform();this.visual.transform.baseVal.appendItem(y),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(y.x,y.y),this.drawing=!0):V.prototype.pointerDown.call(this,y,z)},l.prototype.manipulate=function(y){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(y.x,y.y),this.canvasContext.stroke()):V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(y){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):V.prototype.pointerUp.call(this,y)},l.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),V.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),V.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var y=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),z=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=z[0],G=z[1],ve=z[2],He=z[3],Re=!1,ct=0;ct<this.canvasElement.height;ct++)for(var ze=0;ze<this.canvasElement.width;ze++)y.data[ct*this.canvasElement.width*4+4*ze+3]>0&&(Re=!0,ct<G&&(G=ct),ze<Z&&(Z=ze),ct>He&&(He=ct),ze>ve&&(ve=ze));if(Re){this.left=Z/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(ve-Z)/this.pixelRatio,this.height=(He-G)/this.pixelRatio;var Ct=document.createElement("canvas");Ct.width=ve-Z,Ct.height=He-G,Ct.getContext("2d").putImageData(this.canvasContext.getImageData(Z,G,ve-Z,He-G),0,0),this.drawingImgUrl=Ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},l.prototype.setColor=function(y){this.color=y,this.colorChanged(y)},l.prototype.setLineWidth=function(y){this.lineWidth=y},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({drawingImgUrl:this.drawingImgUrl},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){this.createVisual(),V.prototype.restoreState.call(this,y),this.drawingImgUrl=y.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',l}(qe),ge=function(V){function l(y,z,Z){var G=V.call(this,y,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=z,G.setCurrentType=G.setCurrentType.bind(G),G}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2";for(var Z=function(He){var Re="both";switch(He){case 0:Re="both";break;case 1:Re="start";break;case 2:Re="end";break;case 3:Re="none"}var ct=document.createElement("div");if(ct.style.display="flex",ct.style.flexGrow="2",ct.style.alignItems="center",ct.style.justifyContent="space-between",ct.style.padding="5px",ct.style.borderWidth="2px",ct.style.borderStyle="solid",ct.style.borderColor=Re===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",ct.addEventListener("click",function(){y.setCurrentType(Re,ct)}),z.appendChild(ct),Re==="both"||Re==="start"){var ze=document.createElement("div");ze.style.display="flex",ze.style.alignItems="center",ze.style.minHeight="20px",ze.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ze.style.marginLeft="5px",ct.appendChild(ze)}var Ct=document.createElement("div");Ct.style.display="flex",Ct.style.alignItems="center",Ct.style.minHeight="20px",Ct.style.flexGrow="2";var Mt=document.createElement("hr");if(Mt.style.minWidth="20px",Mt.style.border="0px",Mt.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),Mt.style.flexGrow="2",Ct.appendChild(Mt),ct.appendChild(Ct),Re==="both"||Re==="end"){var Wt=document.createElement("div");Wt.style.display="flex",Wt.style.alignItems="center",Wt.style.minHeight="20px",Wt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Wt.style.marginRight="5px",ct.appendChild(Wt)}G.typeBoxes.push(ct)},G=this,ve=0;ve<4;ve++)Z(ve);return z},l.prototype.setCurrentType=function(y,z){var Z=this;this.currentType=y,this.typeBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(Ue),ye=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new ge("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.arrow1&&y!==this.arrow2)},l.prototype.getArrowPoints=function(y,z){var Z=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return y-Z/2+","+(z+G/2)+" "+y+","+(z-G/2)+" "+(y+Z/2)+","+(z+G/2)},l.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(V.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var y=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.arrow1.transform.baseVal.getItem(0);z.setRotate(y,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(z,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(y+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},l.prototype.setArrowType=function(y){this.arrowType=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({arrowType:this.arrowType},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.arrowType=z.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(st),ie=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor=Z.defaultFillColor,G.strokeWidth=0,G.fillPanel=new We("Color",Z.defaultColorSet,Z.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Te(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(Qe),oe=function(V){function l(y,z,Z,G){var ve=V.call(this,y,G||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=z,ve.currentOpacity=Z,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Te(l,V),l.prototype.getUi=function(){var y=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",z.style.justifyContent="space-between",this.opacities.forEach(function(Z){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=Z===y.currentOpacity?y.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){y.setCurrentOpacity(Z,G)}),z.appendChild(G);var ve=document.createElement("div");ve.innerText=100*Z+"%",G.appendChild(ve),y.opacityBoxes.push(G)}),z},l.prototype.setCurrentOpacity=function(y,z){var Z=this;this.currentOpacity=y,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(Ue),le=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=Z.defaultHighlightColor,G.strokeWidth=0,G.opacity=Z.defaultHighlightOpacity,G.fillPanel=new We("Color",Z.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new oe("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Te(l,V),l.prototype.setOpacity=function(y){this.opacity=y,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="HighlightMarker",l.title="Highlight marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',l}(ie),de='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Le=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=Z.defaultStrokeColor,G.bgColor=Z.defaultFillColor,G.fontFamily=Z.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new We("Text color",Z.defaultColorSet,G.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new We("Fill color",Z.defaultColorSet,G.bgColor,de),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Ne("Font",Z.defaultFontFamilies,Z.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new it,G.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Te(l,V),l.prototype.ownsTarget=function(y){return V.prototype.ownsTarget.call(this,y)||this.tipGrip.ownsTarget(y)||this.tip===y},l.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},l.prototype.pointerDown=function(y,z){this.state==="new"&&V.prototype.pointerDown.call(this,y,z),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(z)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):V.prototype.pointerDown.call(this,y,z)},l.prototype.pointerUp=function(y){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,V.prototype.pointerUp.call(this,y);else{var z=this.state==="creating";V.prototype.pointerUp.call(this,y),this.setTipPoints(z),this.positionTip()}},l.prototype.manipulate=function(y){if(this.tipMoving){var z=this.unrotatePoint(y);this.tipPosition={x:z.x-this.manipulationStartLeft,y:z.y-this.manipulationStartTop},this.positionTip()}else V.prototype.manipulate.call(this,y)},l.prototype.setBgColor=function(y){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",y]]),ue.setAttributes(this.tip,[["fill",y]])),this.bgColor=y,this.fillColorChanged(y)},l.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},l.prototype.setTipPoints=function(y){y===void 0&&(y=!1);var z=Math.min(this.height/2,15),Z=this.height/5;y&&(this.tipPosition={x:z+Z/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:0},this.tipBase2Position={x:z+Z,y:0}):(this.tipBase1Position={x:0,y:z},this.tipBase2Position={x:0,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:0},this.tipBase2Position={x:this.width-z,y:0}):(this.tipBase1Position={x:this.width,y:z},this.tipBase2Position={x:this.width,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:this.height},this.tipBase2Position={x:this.width-z,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-z-Z},this.tipBase2Position={x:this.width,y:this.height-z}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:this.height},this.tipBase2Position={x:z+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-z},this.tipBase2Position={x:0,y:this.height-z-Z})},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.positionTip()},l.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var y=this.tipGrip.visual.transform.baseVal.getItem(0);y.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(y,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),V.prototype.select.call(this)},l.prototype.getState=function(){var y=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.bgColor=z.bgColor,this.tipPosition=z.tipPosition,V.prototype.restoreState.call(this,y),this.createTip(),this.setTipPoints()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.tipPosition={x:this.tipPosition.x*y,y:this.tipPosition.y*z},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',l}(Ve),Me=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.fillColor=Z.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new We("Line color",pe(Z.defaultColorSet,["transparent"]),Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new We("Fill color",pe(Z.defaultColorSet,["transparent"]),G.fillColor,de),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new ot("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new oe("Opacity",Z.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual)},l.prototype.createVisual=function(){this.visual=ue.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},l.prototype.manipulate=function(y){V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){V.prototype.resize.call(this,y),this.setSize()},l.prototype.setSize=function(){V.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},l.prototype.pointerUp=function(y){V.prototype.pointerUp.call(this,y),this.setSize()},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},l.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(y),this.stateChanged()},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(y){this.opacity=y,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){var z=y;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),V.prototype.restoreState.call(this,y),this.setSize()},l.prototype.scale=function(y,z){V.prototype.scale.call(this,y,z),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(qe),Ye=function(V){function l(y,z,Z){return V.call(this,y,z,Z)||this}return Te(l,V),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.tip1&&y!==this.tip2)},l.prototype.createTips=function(){this.tip1=ue.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip2)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(V.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var y=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.tip1.transform.baseVal.getItem(0);z.setRotate(y,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(z,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(y+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',l}(st),yt=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokePanel.colors=Z.defaultColorSet,G.fillColor="transparent",G}return Te(l,V),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=V.prototype.getState.call(this);return y.typeName=l.typeName,y},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',l}(Me),At=function(){function V(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),V.prototype.addUndoStep=function(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},V.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},V.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},V.prototype.undo=function(){if(this.undoStack.length>1){var l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},V.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},V}(),Ge=function(V){function l(y,z,Z){var G=V.call(this,y,z,Z)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=Z.defaultColor,G.strokeWidth=Z.defaultStrokeWidth,G.strokeDasharray=Z.defaultStrokeDasharray,G.strokePanel=new We("Line color",Z.defaultColorSet,Z.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ot("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new Ze("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Te(l,V),l.prototype.ownsTarget=function(y){return!(!V.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorCurve&&y!==this.visibleCurve&&!this.curveGrip.ownsTarget(y))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(y,z){V.prototype.pointerDown.call(this,y,z),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=y.x,this.curveY=y.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(z)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setupControlBox=function(){V.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,V.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){V.prototype.positionGrips.call(this);var y=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-y/2,this.curveY-y/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},l.prototype.manipulate=function(y){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+y.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+y.y-this.manipulationStartY),V.prototype.manipulate.call(this,y)},l.prototype.resize=function(y){this.activeGrip===this.curveGrip&&(this.curveX=y.x,this.curveY=y.y),V.prototype.resize.call(this,y),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},l.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},l.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual()},l.prototype.scale=function(y,z){this.curveX=this.curveX*y,this.curveY=this.curveY*z,V.prototype.scale.call(this,y,z)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},V.prototype.getState.call(this));return y.typeName=l.typeName,y},l.prototype.restoreState=function(y){V.prototype.restoreState.call(this,y);var z=y;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.curveX=z.curveX,this.curveY=z.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',l}(dt),xt=function(){function V(l,y){y===void 0&&(y=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=y}return Object.defineProperty(V.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),V.prototype.preventDefault=function(){this._defaultPrevented=!0},V}(),mt=function(V){function l(y,z,Z){var G=V.call(this,y,!1)||this;return G.dataUrl=z,G.state=Z,G}return Te(l,V),l}(xt),nt=function(V){function l(y,z,Z){Z===void 0&&(Z=!1);var G=V.call(this,y,Z)||this;return G.marker=z,G}return Te(l,V),l}(xt),Rt=function(){function V(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return V.prototype.addEventListener=function(l,y){this[l].push(y)},V.prototype.removeEventListener=function(l,y){var z=this[l].indexOf(y);z>-1&&this[l].splice(z,1)},V}(),Lt=function(){function V(l){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Pe,this._isOpen=!1,this.undoRedoManager=new At,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=V.instanceCounter++,this.styles=new _e(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(V.prototype,"ALL_MARKER_TYPES",{get:function(){return[at,Ee,ye,Ve,yt,Me,le,Le,Ye,ie,st,Ge]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[at,Ee,ye,Ve,Me,le,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"BASIC_MARKER_TYPES",{get:function(){return[at,Ee,ye,Ve,le]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var y=this;this._availableMarkerTypes.splice(0),l.forEach(function(z){if(typeof z=="string"){var Z=y.ALL_MARKER_TYPES.find(function(G){return G.typeName===z});Z!==void 0&&y._availableMarkerTypes.push(Z)}else y._availableMarkerTypes.push(z)})},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(l){this._zoomLevel=l,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),V.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},V.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(y){return y(new xt(l))})},V.prototype.render=function(){return Ce(this,void 0,void 0,function(){var l;return Se(this,function(y){switch(y.label){case 0:return this.setCurrentMarker(),(l=new fe).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return y.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,y.sent()]}})})},V.prototype.close=function(l){var y=this;if(l===void 0&&(l=!1),this.isOpen){var z=!1;l||this.eventListeners.beforeclose.forEach(function(Z){var G=new xt(y,!0);Z(G),G.defaultPrevented&&(z=!0)}),z||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Z){return Z(new xt(y))}),this.detachEvents(),this._isOpen=!1)}},V.prototype.addMarkersToToolbar=function(){for(var l,y=[],z=0;z<arguments.length;z++)y[z]=arguments[z];(l=this._availableMarkerTypes).push.apply(l,y)},V.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(y){l(y.dataUrl,y.state)})},V.prototype.removeRenderEventListener=function(l){},V.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},V.prototype.removeCloseEventListener=function(l){},V.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,y=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,z=y<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(y,z)},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.resize=function(l,y){this._isResizing=!0;var z=l/this.imageWidth,Z=y/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(y),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(z,Z),this._isResizing=!1},V.prototype.scaleMarkers=function(l,y){var z,Z=this;this._currentMarker&&this._currentMarker instanceof Ve?this._currentMarker.scale(l,y):(z=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==Z._currentMarker&&G.scale(l,y)}),z!==void 0&&this.setCurrentMarker(z)},V.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},V.prototype.setTopLeft=function(){var l=this.editingTarget.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=l.left-y.left,this.top=l.top-y.top},V.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},V.prototype.addDefs=function(){for(var l,y=[],z=0;z<arguments.length;z++)y[z]=arguments[z];this.defs=ue.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,y)},V.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},V.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},V.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},V.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},V.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},V.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},V.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},V.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},V.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},V.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Oe(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ie(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},V.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.removeMarker=function(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.dispose()},V.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},V.prototype.toolbarButtonClicked=function(l,y){if(l==="marker"&&y!==void 0)this.createNewMarker(y);else if(l==="action")switch(y){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},V.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var y=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var G=new nt(l,l._currentMarker,!0);Z(G),G.defaultPrevented&&(y=!0)}),!y){var z=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Z){return Z(new nt(l,z))})}}},V.prototype.clear=function(){var l=this,y=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var He=new nt(l,void 0,!0);ve(He),He.defaultPrevented&&(y=!0)}),!y)){this.setCurrentMarker();for(var z=function(ve){var He=Z.markers[ve];Z.setCurrentMarker(Z.markers[ve]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(Re){return Re(new nt(l,He))})},Z=this,G=this.markers.length-1;G>=0;G--)z(G);this.addUndoStep()}},Object.defineProperty(V.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),V.prototype.showNotesEditor=function(){var l;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},V.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},V.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},V.prototype.addUndoStep=function(){var l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var y=this.getState(),z=this.undoRedoManager.getLastUndoStep();if(!z||z.width===y.width&&z.height===y.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(y),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new xt(l))})}else this.undoRedoManager.replaceLastUndoStep(y),this.eventListeners.statechange.forEach(function(G){return G(new xt(l))})}},V.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},V.prototype.undoStep=function(){var l=this,y=this.undoRedoManager.undo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new xt(l))}))},V.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},V.prototype.redoStep=function(){var l=this,y=this.undoRedoManager.redo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new xt(l))}))},V.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},V.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},V.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var l,y,z=this;return Se(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return l=Z.sent(),y=this.getState(),this.eventListeners.render.forEach(function(G){return G(new mt(z,l,y))}),this.close(!0),[2]}})})},V.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var y={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(z){return y.markers.push(z.getState())}),y},V.prototype.restoreState=function(l){var y=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(z){var Z=y._availableMarkerTypes.find(function(ve){return ve.typeName===z.typeName});if(Z!==void 0){var G=y.addNewMarker(Z);G.restoreState(z),y.markers.push(G)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(z){return z(new xt(y))})},V.prototype.addNewMarker=function(l){var y=ue.createGroup();return this.markerImage.appendChild(y),new l(y,this.overlayContainer,this.settings)},V.prototype.createNewMarker=function(l){var y,z=this;(y=typeof l=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(y),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(y.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new nt(z,z._currentMarker))}))},V.prototype.markerCreated=function(l){var y=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(z){return z(new nt(y,y._currentMarker))})},V.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},V.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},V.prototype.markerStateChanged=function(l){var y=this;this.eventListeners.markerchange.forEach(function(z){return z(new nt(y,l))})},V.prototype.setCurrentMarker=function(l){var y=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(z){return z(new nt(y,y._currentMarker))})),this._currentMarker=l,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(z){return z(new nt(y,y._currentMarker))}))},V.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var y=this.markers.find(function(z){return z.ownsTarget(l.target)});y!==void 0?(this.setCurrentMarker(y),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},V.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var y=this.markers.find(function(z){return z.ownsTarget(l.target)});y!==void 0&&y!==this._currentMarker&&this.setCurrentMarker(y),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},V.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},V.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},V.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},V.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.markerImage.getBoundingClientRect();return{x:(l-z.left)/this.zoomLevel,y:(y-z.top)/this.zoomLevel}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},V.prototype.addLicenseKey=function(l){te.addKey(l)},V.prototype.addEventListener=function(l,y){this.eventListeners.addEventListener(l,y)},V.prototype.removeEventListener=function(l,y){this.eventListeners.removeEventListener(l,y)},V.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(V.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),V.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(y){return y(new xt(l))}))},V.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(y){return y(new xt(l))}))},V.instanceCounter=0,V}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Kt=function(V,l){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,z){y.__proto__=z}||function(y,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(y[Z]=z[Z])})(V,l)};function Bt(V,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function y(){this.constructor=V}Kt(V,l),V.prototype=l===null?Object.create(l):(y.prototype=l.prototype,new y)}function wt(V,l,y,z){return new(y||(y=Promise))(function(Z,G){function ve(ct){try{Re(z.next(ct))}catch(ze){G(ze)}}function He(ct){try{Re(z.throw(ct))}catch(ze){G(ze)}}function Re(ct){var ze;ct.done?Z(ct.value):(ze=ct.value,ze instanceof y?ze:new y(function(Ct){Ct(ze)})).then(ve,He)}Re((z=z.apply(V,l||[])).next())})}function yr(V,l){var y,z,Z,G,ve={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return G={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function He(Re){return function(ct){return function(ze){if(y)throw new TypeError("Generator is already executing.");for(;ve;)try{if(y=1,z&&(Z=2&ze[0]?z.return:ze[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,ze[1])).done)return Z;switch(z=0,Z&&(ze=[2&ze[0],Z.value]),ze[0]){case 0:case 1:Z=ze;break;case 4:return ve.label++,{value:ze[1],done:!1};case 5:ve.label++,z=ze[1],ze=[0];continue;case 7:ze=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Z=ve.trys,(Z=Z.length>0&&Z[Z.length-1])||ze[0]!==6&&ze[0]!==2)){ve=0;continue}if(ze[0]===3&&(!Z||ze[1]>Z[0]&&ze[1]<Z[3])){ve.label=ze[1];break}if(ze[0]===6&&ve.label<Z[1]){ve.label=Z[1],Z=ze;break}if(Z&&ve.label<Z[2]){ve.label=Z[2],ve.ops.push(ze);break}Z[2]&&ve.ops.pop(),ve.trys.pop();continue}ze=l.call(V,ve)}catch(Ct){ze=[6,Ct],z=0}finally{y=Z=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Re,ct])}}}var ir=function(){function V(){}return V.addKey=function(l){V.key=l},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),gt=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(l,y){for(var z=0,Z=y;z<Z.length;z++){var G=Z[z],ve=G[0],He=G[1];l.setAttribute(ve,He)}},V.createRect=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",l.toString()),Z.setAttribute("height",y.toString()),z&&V.setAttributes(Z,z),Z},V.createLine=function(l,y,z,Z,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",y.toString()),ve.setAttribute("x2",z.toString()),ve.setAttribute("y2",Z.toString()),G&&V.setAttributes(ve,G),ve},V.createPolygon=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",l),y&&V.setAttributes(z,y),z},V.createCircle=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(l/2).toString()),z.setAttribute("cy",(l/2).toString()),z.setAttribute("r",l.toString()),y&&V.setAttributes(z,y),z},V.createEllipse=function(l,y,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(l/2).toString()),Z.setAttribute("cy",(y/2).toString()),Z.setAttribute("rx",(l/2).toString()),Z.setAttribute("ry",(y/2).toString()),z&&V.setAttributes(Z,z),Z},V.createGroup=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&V.setAttributes(y,l),y},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(l,y,z,Z,G,ve,He){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(Re,[["id",l],["orient",y],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",G.toString()],["refY",ve.toString()]]),Re.appendChild(He),Re},V.createText=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),l&&V.setAttributes(y,l),y},V.createTSpan=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=l,y&&V.setAttributes(z,y),z},V.createImage=function(l){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&V.setAttributes(y,l),y},V.createPoint=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=l,z.y=y,z},V.createPath=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",l),y&&V.setAttributes(z,y),z},V.createElement=function(l,y){var z=document.createElementNS("http://www.w3.org/2000/svg",l);return y&&V.setAttributes(z,y),z},V.getHollowRectanglePath=function(l,y,z,Z,G,ve,He,Re){return"M"+l+","+y+"V"+(y+Z)+"H"+(l+z)+"V"+y+"H"+G+"V"+ve+"H"+(G+He)+"V"+(ve+Re)+"H"+G+"V"+y+"Z"},V}(),Gr=function(){function V(l){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},V.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new br("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new br("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new fr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new fr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},V.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),br=function(V,l){this.selector=V,this.style=l},fr=function(V,l){this.localName=V,this.style=l},Tr=function(){function V(){this.blocks=[],this.display=""}return V.prototype.addButtonBlock=function(l){l.className=this.blockClassName,l.buttonClassName=this.buttonClassName,l.buttonColorsClassName=this.buttonColorsClassName,l.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(l)},V.prototype.addElementBlock=function(l){l.className===void 0&&(l.className=this.blockClassName),this.blocks.push(l)},V.prototype.getUI=function(){var l=document.createElement("div");return l.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,l.style.display=this.display,this.blocks.forEach(function(y){return l.appendChild(y.getUI())}),l},V}(),si=function(){function V(){}return V.prototype.getUI=function(){var l=document.createElement("div");if(l.className=this.className,this.minWidth!==void 0&&(l.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"end":l.style.justifyContent="flex-end"}return l.style.whiteSpace="nowrap",l},V}(),Kr=function(V){function l(){var y=V!==null&&V.apply(this,arguments)||this;return y.buttons=[],y}return Bt(l,V),l.prototype.addButton=function(y){y.className=this.buttonClassName,y.colorsClassName=this.buttonColorsClassName,y.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(y)},l.prototype.getUI=function(){var y=V.prototype.getUI.call(this);return this.buttons.forEach(function(z){return y.appendChild(z.getUI())}),y},l}(si),It=function(){function V(l,y){this._isActive=!1,this._isHidden=!1,this._icon=l,this.title=y,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(V.prototype,"icon",{get:function(){return this._icon},set:function(l){this._icon=l,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isActive",{get:function(){return this._isActive},set:function(l){this._isActive=l,this.adjustClassName()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){var l=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return l.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},V.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},V.prototype.hide=function(){this._isHidden=!0},V}(),ft=function(V){function l(){var y=V!==null&&V.apply(this,arguments)||this;return y.elements=[],y}return Bt(l,V),l.prototype.addElement=function(y){this.elements.push(y)},l.prototype.getUI=function(){var y=V.prototype.getUI.call(this);return this.elements.forEach(function(z){return y.appendChild(z)}),y},l}(si),Ur=function(){function V(l,y){this.horizontal=l,this.vertical=y}return Object.defineProperty(V.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),V.prototype.getVerticalLength=function(l){return l/this.ratio},V.prototype.getHorizontalLength=function(l){return l*this.ratio},V}(),li=function(){function V(){}return V.getIcon=function(l,y){if(l>0&&y>0){var z=new Ur(l,y),Z=z.ratio>=1?20:z.getHorizontalLength(20),G=z.ratio<1?20:z.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var He=gt.createDefs();ve.appendChild(He);var Re=gt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(Re);var ct=gt.createPath(gt.getHollowRectanglePath((24-Z)/2,(24-G)/2,Z,G,(24-Z)/2+2,(24-G)/2+2,Z-4,G-4));ve.appendChild(ct);var ze=gt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild(gt.createTSpan(l+":"+y)),ve.appendChild(ze);var Ct=ze.getBBox();gt.setAttributes(ze,[["x",((24-Ct.width)/2).toString()],["y",((24-Ct.height)/2-Ct.y).toString()]]);var Mt=gt.createPath(gt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ct.width))/2,(24-Math.ceil(Ct.height))/2,Math.ceil(Ct.width),Math.ceil(Ct.height)));return Re.appendChild(Mt),gt.setAttributes(ct,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},V}(),wr=function(V){function l(y,z,Z){var G=V.call(this,y,z)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=Z,G}return Bt(l,V),l.prototype.setupDropdown=function(){var y=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(z){z.className=y.className,z.colorsClassName=y.colorsClassName,y.dropdownBlock.appendChild(z.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},l.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},l.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},l.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},l.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},l.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},l}(It),Ot=function(){function V(l,y){this.GRIP_SIZE=10,this.color=l,this.fillColor=y,this.visual=gt.createGroup(),this.visual.appendChild(gt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(gt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},V.prototype.setCenter=function(l,y){this.visual.childNodes.forEach(function(z){return gt.setAttributes(z,[["cx",l.toString()],["cy",y.toString()]])})},V}(),Vr=function(){function V(l,y,z,Z){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=l,this.canvasHeight=y,this.margin=z,this.container=Z,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(V.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(l){this._aspectRatio=l,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.gridContainer&&gt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(l){this._zoomFactor=l,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),V.prototype.open=function(){var l=this;this.cropShadeElement=gt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=gt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var y=0;y<this.numberOfGridLines;y++)this.horizontalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(gt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(z){return l.gridContainer.appendChild(z)}),this.verticalGridLines.forEach(function(z){return l.gridContainer.appendChild(z)}),this.cropRectElement=gt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},V.prototype.setCropRectangle=function(l){this.cropRect=l;var y=Object.assign({},this.cropRect);this.zoomFactor!==1&&(y.width=this.cropRect.width*this.zoomFactor,y.height=this.cropRect.height*this.zoomFactor,y.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-y.width/2,y.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-y.height/2),gt.setAttributes(this.cropRectElement,[["x",y.x.toString()],["y",y.y.toString()],["width",y.width.toString()],["height",y.height.toString()]]);var z=y.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,ve){var He=y.y+z*(ve+1);gt.setAttributes(G,[["x1",""+y.x],["y1",""+He],["x2",""+(y.x+y.width)],["y2",""+He]])});var Z=y.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,ve){var He=y.x+Z*(ve+1);gt.setAttributes(G,[["x1",""+He],["y1",""+y.y],["x2",""+He],["y2",""+(y.y+y.height)]])}),gt.setAttributes(this.cropShadeElement,[["d",gt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,y.x,y.y,y.width,y.height)]]),this.topLeftGrip.setCenter(y.x,y.y),this.topRightGrip.setCenter(y.x+y.width,y.y),this.bottomLeftGrip.setCenter(y.x,y.y+y.height),this.bottomRightGrip.setCenter(y.x+y.width,y.y+y.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},V.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.container.getBoundingClientRect();return{x:l-z.left+this.margin,y:y-z.top+this.margin}},V.prototype.onPointerDown=function(l){this.container.setPointerCapture(l.pointerId),this.previousPoint=this.clientToLocalCoordinates(l.clientX,l.clientY),this.cropRectElement===l.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(l.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(l.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(l.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(l.target)&&(this.activeGrip=this.bottomRightGrip)},V.prototype.onPointerMove=function(l){if(this.isMoving)this.move(this.clientToLocalCoordinates(l.clientX,l.clientY));else if(this.activeGrip){var y=this.clientToLocalCoordinates(l.clientX,l.clientY);this.resize(y)}l.preventDefault()},V.prototype.onPointerUp=function(l){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(l.pointerId)},V.prototype.move=function(l){var y=l.x-this.previousPoint.x,z=l.y-this.previousPoint.y;this.zoomFactor!==1&&(y=-y/this.zoomFactor,z=-z/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+y),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+z),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=l},V.prototype.resize=function(l){var y=Object.assign({},this.cropRect),z=l.x-this.previousPoint.x,Z=l.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:y.x+z<this.margin&&(z=this.margin-y.x),y.x+=z,y.width=this.cropRect.x+this.cropRect.width-y.x;break;case this.bottomRightGrip:case this.topRightGrip:y.width+z>this.canvasWidth*this.zoomFactor&&(z=this.canvasWidth*this.zoomFactor-y.width),y.width+=z}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(y.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(z),y.height=this.aspectRatio.getVerticalLength(y.width)):(y.y+=Z,y.height=this.cropRect.y+this.cropRect.height-y.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?y.height=this.aspectRatio.getVerticalLength(y.width):y.height+=Z}y.width<10&&(y.x=this.cropRect.x,y.width=10),y.height<10&&(y.y=this.cropRect.y,y.height=10),this.previousPoint=l,y.x>=this.margin&&y.y>=this.margin&&y.x-this.margin+y.width<=this.canvasWidth&&y.y-this.margin+y.height<=this.canvasHeight&&(this.cropRect=y,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},V.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var l=this.cropRect.x+this.cropRect.width/2,y=this.cropRect.y+this.cropRect.height/2,z=this.aspectRatio.getHorizontalLength(this.cropRect.height),Z=this.aspectRatio.getVerticalLength(this.cropRect.width);z/this.canvasWidth<Z/this.canvasHeight?this.cropRect.width=z:this.cropRect.height=Z,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=l-this.cropRect.width/2,this.cropRect.y=y-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},V.prototype.getRescaledRect=function(l,y,z,Z,G,ve){var He=z/l,Re=Z/y;return{x:(G.x-ve)*He+ve,y:(G.y-ve)*Re+ve,width:G.width*He,height:G.height*Re}},V.prototype.scaleCanvas=function(l,y){var z=this.getRescaledRect(this.canvasWidth,this.canvasHeight,l,y,this.cropRect,this.margin);this.canvasWidth=l,this.canvasHeight=y,this.onCropChange&&this.onCropChange(z),this.setCropRectangle(z)},V}(),ui=function(){function V(l){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=l,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(V.prototype,"angle",{get:function(){return this._angle},set:function(l){this._angle=l,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},V.prototype.onPointerDown=function(l){this.controlContainer.setPointerCapture(l.pointerId),this.isDragging=!0,this.previousPoint={x:l.clientX,y:l.clientY}},V.prototype.onPointerMove=function(l){this.isDragging&&(this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.previousPoint.x=l.clientX)},V.prototype.onPointerUp=function(l){this.isDragging&&this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(l.pointerId)},V.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var l=this.angleLabelText.getBBox();gt.setAttributes(this.angleLabelElement,[["x",((this.width-l.width)/2).toString()],["y",(this.height/2).toString()]])}},V.prototype.positionScaleShape=function(){if(this.scaleShape){var l=this.scaleShape.transform.baseVal.getItem(0);l.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(l,0)}},V.prototype.getVisual=function(){var l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("width",this.width+"px"),l.setAttribute("height",this.height+"px"),l.setAttribute("viewBox","0 0 "+this.width+" "+this.height),l.style.flexShrink="0",document.body.appendChild(l);for(var y="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,z=1;z<=this.width/5+10;z++){var Z=z%5==0?this.height/3:this.height/6;y+="h4v"+-Z+"h1v"+Z}y+="v1H0Z",this.scaleShape=gt.createPath(y);var G=gt.createTransform();this.scaleShape.transform.baseVal.appendItem(G),l.appendChild(this.scaleShape),this.angleLabelElement=gt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=gt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=gt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),l.appendChild(this.angleLabelElement),document.body.removeChild(l),l},V}(),gi=function(){function V(){this.naturalSize=!1,this.imageType="image/png"}return V.prototype.rasterize=function(l,y,z,Z,G,ve,He){var Re=this;return new Promise(function(ct){var ze=document.createElement("canvas");ze.width=l.width.baseVal.value-2*Z,ze.height=l.height.baseVal.value-2*Z;var Ct=1,Mt=1;Re.naturalSize===!0?(Ct=y.naturalWidth/(l.width.baseVal.value-2*Z)/ve,Mt=y.naturalHeight/(l.height.baseVal.value-2*Z)/He,ze.width=y.naturalWidth/ve,ze.height=y.naturalHeight/He):Re.width!==void 0&&Re.height!==void 0&&(Ct=Re.width/z.width,Mt=Re.height/z.height,ze.width*=Ct,ze.height*=Mt);var Wt=ze.getContext("2d");Wt.translate(ze.width/2,ze.height/2),Wt.rotate(G*Math.PI/180),Wt.scale(ve,He),Wt.translate(-ze.width/2,-ze.height/2),Wt.drawImage(y,0,0,ze.width,ze.height);var Fr=document.createElement("canvas");Fr.width=z.width*Ct,Fr.height=z.height*Mt,Fr.getContext("2d").putImageData(Wt.getImageData((z.x-Z)*Ct,(z.y-Z)*Mt,z.width*Ct,z.height*Mt),0,0),ct(Fr.toDataURL(Re.imageType,Re.imageQuality))})},V}(),Xe=function(){function V(l){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=V.instanceCounter++,this.styles=new Gr(this.instanceNo),this.target=l,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(l){this._zoomToCropEnabled=l,l?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"gridLines",{get:function(){return this._gridLines},set:function(l){this._gridLines=l,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(l){this._rotationAngle=l,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"aspectRatio",{get:function(){var l;return(l=this._aspectRatio)!==null&&l!==void 0?l:this.aspectRatios[0]},set:function(l){this._aspectRatio=l},enumerable:!1,configurable:!0}),V.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},V.prototype.show=function(){this.showUI(),this.open()},V.prototype.close=function(l){l===void 0&&(l=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),l||this.closeEventListeners.forEach(function(y){return y()}),this._isOpen=!1)},V.prototype.addRenderEventListener=function(l){this.renderEventListeners.push(l)},V.prototype.removeRenderEventListener=function(l){this.renderEventListeners.indexOf(l)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(l),1)},V.prototype.addCloseEventListener=function(l){this.closeEventListeners.push(l)},V.prototype.removeCloseEventListener=function(l){this.closeEventListeners.indexOf(l)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(l),1)},V.prototype.setupResizeObserver=function(){var l=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var l=1*this.target.clientWidth/this.target.clientHeight,y=this.contentDiv.clientWidth/l>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*l:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,z=y+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/l;this.resize(y,z)}},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",gt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},V.prototype.resize=function(l,y){this.imageWidth=Math.round(l),this.imageHeight=Math.round(y),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},V.prototype.setEditingTarget=function(){var l=document.createElement("canvas");l.width=this.target.naturalWidth,l.height=this.target.naturalHeight,l.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var y=l.toDataURL();gt.setAttributes(this.editingTarget,[["href",y]]),this.setEditingTargetSize()},V.prototype.setTopLeft=function(){var l=this.target.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=l.left-y.left-this.CANVAS_MARGIN,this.top=l.top-y.top-this.CANVAS_MARGIN},V.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=gt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=gt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=gt.createGroup(),this.editingTargetRotationScaleContainer=gt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var l=gt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(l);var y=gt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(y),this.editingTargetContainer=gt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},V.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},V.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=gt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Vr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},V.prototype.zoomToCrop=function(){if(this.cropRect){var l=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,y=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=l+"px "+y+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-l+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-y+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},V.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},V.prototype.cropRectChanged=function(l){this.cropRect=l,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},V.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},V.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var l=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,y=this.target.offsetTop>l+this.CANVAS_MARGIN?this.target.offsetTop-(l+this.CANVAS_MARGIN):0;this.coverDiv.style.top=y+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},V.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},V.prototype.addTopToolbar=function(){var l=this;this.topToolbar=new Tr,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var y=new Kr;y.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(y);var z=[];this.aspectRatios.forEach(function(Mt){var Wt=new It(li.getIcon(Mt.horizontal,Mt.vertical),Mt.horizontal===0&&Mt.vertical===0?"FREE":Mt.horizontal+":"+Mt.vertical);Wt.onClick=function(){return l.ratioButtonClicked(Mt)},z.push(Wt)}),this.aspectRatioButton=new wr(li.getIcon(0,0),"Aspect ratio",z),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,y.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Z=new It('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Z.isActive=this.isGridVisible,Z.onClick=function(){l.isGridVisible=!l.isGridVisible,Z.isActive=l.isGridVisible},y.addButton(Z);var G=new It('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(G.isActive=this.zoomToCropEnabled,G.onClick=function(){l.zoomToCropEnabled=!l.zoomToCropEnabled,G.isActive=l.zoomToCropEnabled},y.addButton(G),!ir.isLicensed){var ve=new ft;this.topToolbar.addElementBlock(ve);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Re=document.createElement("a");Re.style.color="currentColor",Re.href="https://markerjs.com/products/cropro",Re.target="_blank",Re.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',He.appendChild(Re),ve.addElement(He)}var ct=new Kr;ct.minWidth=3*this.toolbarHeight+"px",ct.contentAlign="end",this.topToolbar.addButtonBlock(ct);var ze=new It('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");ze.onClick=this.startRenderAndClose,ct.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ct=new It('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Ct.onClick=this.close,ct.addButton(Ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},V.prototype.addBottomToolbar=function(){var l=this;this.bottomToolbar=new Tr,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var y=new Kr;y.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(y);var z=new It('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");z.onClick=this.rotateLeftButtonClicked,y.addButton(z);var Z=new It('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Z.onClick=this.rotateRightButtonClicked,y.addButton(Z);var G=new ft;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new ui("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(ct){l.rotateBy(ct),l.straightener.angle=l.rotationAngle},G.addElement(this.straightener.getUI());var ve=new Kr;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var He=new It('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");He.onClick=this.flipHorizontallyButtonClicked,ve.addButton(He);var Re=new It('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Re.onClick=this.flipVerticallyButtonClicked,ve.addButton(Re)},V.prototype.ratioButtonClicked=function(l){this.aspectRatio=l,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},V.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},V.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},V.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},V.prototype.restoreState=function(l){if(l){var y=this.cropLayer.getRescaledRect(l.width,l.height,this.imageWidth,this.imageHeight,l.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(y),this.cropRectChanged(y),this.flippedHorizontally=l.flippedHorizontally,this.flippedVertically=l.flippedVertically,this.applyFlip(),this.rotationAngle=l.rotationAngle,this.applyRotation()}},V.prototype.clientToLocalCoordinates=function(l,y){var z=this.cropImage.getBoundingClientRect();return{x:l-z.left,y:y-z.top}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var l=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=l+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},V.prototype.rotateLeftButtonClicked=function(){var l=this.rotationAngle-90;this.rotationAngle%90!=0&&(l+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(l)},V.prototype.rotateRightButtonClicked=function(){var l=this.rotationAngle+90;this.rotationAngle%90!=0&&(l-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(l)},V.prototype.rotateTo=function(l){l=(l=l>180?l-360:l)<=-180?l+360:l,this.rotationAngle=l,this.applyRotation()},V.prototype.rotateBy=function(l){this.rotateTo((this.rotationAngle+l)%360)},V.prototype.applyRotation=function(){var l=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var y=this.editingTargetRotationContainer.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(y,0);var z=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/z.width,this.imageHeight/z.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=l},V.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},V.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},V.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},V.prototype.startRenderAndClose=function(){return wt(this,void 0,void 0,function(){var l,y;return yr(this,function(z){switch(z.label){case 0:return[4,this.render()];case 1:return l=z.sent(),y=this.getState(),this.renderEventListeners.forEach(function(Z){return Z(l,y)}),this.close(!0),[2]}})})},V.prototype.render=function(){return wt(this,void 0,void 0,function(){var l;return yr(this,function(y){switch(y.label){case 0:return(l=new gi).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.width=this.renderWidth,l.height=this.renderHeight,this.unzoomFromCrop(),gt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,l.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return y.sent(),[4,l.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,y.sent()]}})})},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new fr("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new fr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new fr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var l=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new fr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*l)+`px;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new fr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new fr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new br("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new fr("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new fr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new fr("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new fr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new fr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},V.instanceCounter=0,V}(),St=re("8hTe"),ei=re.n(St),hi=/<pre[^>]*>/g;function di(V){var l=document.createElement("div");return l.innerHTML=V,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var Di=$e.a=function(V){var l=V.value,y=l===void 0?"":l,z=V.edit,Z=z===void 0?!1:z,G=V.className,ve=V.showTextOnly,He=V.showLines,Re=V.replaces,ct=V.zoomImg,ze=V.hasMask,Ct=V.style,Mt=Ct===void 0?{}:Ct,Wt=V.stylesPrev,Fr=Wt===void 0?{}:Wt,jr=String(y),sr=Object(A.useRef)(),Xr=Object(A.useRef)(),Ki=Object(A.useState)(""),Ar=Object(W.a)(Ki,2),_r=Ar[0],ti=Ar[1],vi=Object(A.useState)("office"),$r=Object(W.a)(vi,2),ri=$r[0],Wr=$r[1],fn=function(){var Ut=new Xe(Xr.current);Ut.displayMode="popup",Ut.addRenderEventListener(function(){var pr=Object(R.a)(P.a.mark(function Ft(mr){var Xt;return P.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:return sr.current.style.display="none",nr.next=3,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr}});case 3:Xt=nr.sent,Xt!=null&&Xt.id&&Re(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 5:case"end":return nr.stop()}},Ft)}));return function(Ft){return pr.apply(this,arguments)}}()),Ut.show()},Vi=function(){var Ut=new Lt(Xr.current);Ut.settings.displayMode="popup",Ut.addEventListener("render",function(){var pr=Object(R.a)(P.a.mark(function Ft(mr){var Xt;return P.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:if(sr.current.style.display="none",!Xr.current){nr.next=6;break}return nr.next=4,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr.dataUrl}});case 4:Xt=nr.sent,Xt!=null&&Xt.id&&Re(Xr.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Xt==null?void 0:Xt.id,"?type=").concat(Xt.content_type));case 6:case"end":return nr.stop()}},Ft)}));return function(Ft){return pr.apply(this,arguments)}}()),Ut.show(),window.markerArea=Ut},Pr=Object(A.useMemo)(function(){try{var qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ut=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;jr=jr.replace(qt,"("+q.a.API_SERVER+"/api/attachments/").replace(Ut,'"'+q.a.API_SERVER+"/api/attachments/").replace(pr,'"'+q.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,`
`),jr=jr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(yi){}var Ft=K(jr),mr=T();if(jr.match(/\[TOC\]/)&&(Ft=Ft.replace("<p>[TOC]</p>",k()),L()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(yi,nr){var ar=mr[nr],ii=ar.type,bi=ar.expression;return Object(se.renderToString)(di(bi)||"",{displayMode:ii==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),S(),ve){var Xt=document.createElement("div");return Xt.innerHTML=Ft,Xt.innerText}return setTimeout(function(){return Oi()},500),Ft},[jr]),Mr=Object(A.useRef)();p.WebkitLineClamp=He,He&&(Mt=Object(F.a)(Object(F.a)({},Mt),p));function Ri(qt){var Ut=qt.target;if(Ut.tagName.toUpperCase()==="IMG"){if(ct){var pr=Ut.getAttribute("src");ti(pr),Wr("image")}}else if(Ut.tagName.toUpperCase()==="A"){var Ft=Ut.getAttribute("href");if(Ft.indexOf("office")>-1)qt.preventDefault(),ti(Ft),Wr("office");else if(Ft.indexOf("application/pdf")>-1)qt.preventDefault(),ti(Ft),Wr("pdf");else if(Ft.indexOf("type=text")>-1)qt.preventDefault(),ti(Ft),Wr("html");else if(Ft.startsWith("#")){qt.preventDefault();var mr=document.getElementById(Ft.replace("#",""));mr&&mr.scrollIntoView(!0)}}}var Oi=function(){var Ut,pr=(Ut=Mr.current)===null||Ut===void 0?void 0:Ut.querySelectorAll("video");pr==null||pr.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var mr=new X.a;mr.loadSource(Ft.src),mr.attachMedia(Ft)}}})};Object(A.useEffect)(function(){if(Mr.current&&Pr&&(Pr.match(hi)&&window.PR.prettyPrint()),Mr.current)return Mr.current.addEventListener("click",Ri),function(){Mr.current.removeEventListener("click",Ri),S(),L()}},[Pr,Mr.current,Ri]);var Pi=function(Ut){if(!Z)return;Ut.target.nodeName==="IMG"?(sr.current.style.display="flex",sr.current.style.width=Ut.target.clientWidth+"px",sr.current.style.height=Ut.target.clientHeight+"px",sr.current.style.top=Ut.target.offsetTop+"px",sr.current.style.left=Ut.target.offsetLeft+"px",Xr.current.src=Ut.target.getAttribute("src")):sr.current.style.display="none"};return f.a.createElement("div",{style:{position:"relative"}},f.a.createElement("div",{ref:Mr,style:Object(F.a)({},Mt),className:"".concat(G||""," markdown-body ").concat(ei.a.mdBody),onMouseOver:Pi,dangerouslySetInnerHTML:{__html:Pr}}),f.a.createElement("div",{ref:sr,className:ei.a.button},f.a.createElement($.a,null,f.a.createElement(Y.a,{onClick:function(){return fn()}},"\u88C1\u526A"),f.a.createElement(Y.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),f.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),f.a.createElement(he.a,{close:!0,data:_r,hasMask:ze,type:_r!=null&&_r.length?ri:"",style:Object(F.a)({},Fr),onClose:function(){return ti("")}}))}},"9VGf":function(lt,$e,re){"use strict";re.d($e,"a",function(){return D});var ne=re("q1tI"),$=re.n(ne);function D(Y,F){var R=Object(ne.useRef)();Object(ne.useEffect)(function(){R.current=Y}),Object(ne.useEffect)(function(){function W(){R.current()}if(F!==null){var B=setInterval(W,F);return function(){return clearInterval(B)}}},[F])}},BU3w:function(lt,$e,re){"use strict";re.d($e,"a",function(){return R});var ne=re("MNnm"),$="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var B=document.querySelector("head");return B||document.body}function Y(W){var B,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var A=document.createElement("style");if((B=P.csp)===null||B===void 0?void 0:B.nonce){var f;A.nonce=(f=P.csp)===null||f===void 0?void 0:f.nonce}A.innerHTML=W;var x=D(P),M=x.firstChild;return P.prepend&&x.prepend?x.prepend(A):P.prepend&&M?x.insertBefore(A,M):x.appendChild(A),A}var F=new Map;function R(W,B){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=D(P);if(!F.has(A)){var f=Y("",P),x=f.parentNode;F.set(A,x),x.removeChild(f)}var M=Array.from(F.get(A).children).find(function(a){return a.tagName==="STYLE"&&a[$]===B});if(M){var w,C;if(((w=P.csp)===null||w===void 0?void 0:w.nonce)&&M.nonce!==((C=P.csp)===null||C===void 0?void 0:C.nonce)){var E;M.nonce=(E=P.csp)===null||E===void 0?void 0:E.nonce}return M.innerHTML!==W&&(M.innerHTML=W),M}var d=Y(W,P);return d[$]=B,d}},Bd2K:function(lt,$e,re){(function(ne){ne(re("VrN/"),re("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(P,A,f){if(f!=ne.Init&&f&&P.removeKeyMap("autoCloseTags"),!A)return;var x={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(x["'/'"]=function(M){return R(M)}),(typeof A!="object"||A.whenOpening!==!1)&&(x["'>'"]=function(M){return Y(M)}),P.addKeyMap(x)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 Y(P){if(P.getOption("disableInput"))return ne.Pass;for(var A=P.listSelections(),f=[],x=P.getOption("autoCloseTags"),M=0;M<A.length;M++){if(!A[M].empty())return ne.Pass;var w=A[M].head,C=P.getTokenAt(w),E=ne.innerMode(P.getMode(),C.state),d=E.state,a=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(d),s=a&&a.name;if(!s)return ne.Pass;var h=E.mode.configuration=="html",L=typeof x=="object"&&x.dontCloseTags||h&&$,p=typeof x=="object"&&x.indentTags||h&&D;C.end>w.ch&&(s=s.slice(0,s.length-C.end+w.ch));var v=s.toLowerCase();if(!s||C.type=="string"&&(C.end!=w.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&a.close||C.string.indexOf("/")==w.ch-C.start-1||L&&W(L,v)>-1||B(P,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(d)||[],s,w,!0))return ne.Pass;var k=typeof x=="object"&&x.emptyTags;if(k&&W(k,s)>-1){f[M]={text:"/>",newPos:ne.Pos(w.line,w.ch+2)};continue}var b=p&&W(p,v)>-1;f[M]={indent:b,text:">"+(b?`
`:"")+"</"+s+">",newPos:b?ne.Pos(w.line+1,0):ne.Pos(w.line,w.ch+1)}}for(var g=typeof x=="object"&&x.dontIndentOnAutoClose,M=A.length-1;M>=0;M--){var c=f[M];P.replaceRange(c.text,A[M].head,A[M].anchor,"+insert");var u=P.listSelections().slice(0);u[M]={head:c.newPos,anchor:c.newPos},P.setSelections(u),!g&&c.indent&&(P.indentLine(c.newPos.line,null,!0),P.indentLine(c.newPos.line+1,null,!0))}}function F(P,A){for(var f=P.listSelections(),x=[],M=A?"/":"</",w=P.getOption("autoCloseTags"),C=typeof w=="object"&&w.dontIndentOnSlash,E=0;E<f.length;E++){if(!f[E].empty())return ne.Pass;var d=f[E].head,a=P.getTokenAt(d),s=ne.innerMode(P.getMode(),a.state),h=s.state;if(A&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=d.ch-1))return ne.Pass;var L,p=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(p&&s.mode.name=="javascript")L=M+"script";else if(p&&s.mode.name=="css")L=M+"style";else{var v=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(h);if(!v||v.length&&B(P,v,v[v.length-1],d))return ne.Pass;L=M+v[v.length-1]}P.getLine(d.line).charAt(a.end)!=">"&&(L+=">"),x[E]=L}if(P.replaceSelections(x),f=P.listSelections(),!C)for(var E=0;E<f.length;E++)(E==f.length-1||f[E].head.line<f[E+1].head.line)&&P.indentLine(f[E].head.line)}function R(P){return P.getOption("disableInput")?ne.Pass:F(P,!0)}ne.commands.closeTag=function(P){return F(P)};function W(P,A){if(P.indexOf)return P.indexOf(A);for(var f=0,x=P.length;f<x;++f)if(P[f]==A)return f;return-1}function B(P,A,f,x,M){if(!ne.scanForClosingTag)return!1;var w=Math.min(P.lastLine()+1,x.line+500),C=ne.scanForClosingTag(P,x,null,w);if(!C||C.tag!=f)return!1;for(var E=M?1:0,d=A.length-1;d>=0&&A[d]==f;d--)++E;x=C.to;for(var d=1;d<E;d++){var a=ne.scanForClosingTag(P,x,null,w);if(!a||a.tag!=f)return!1;x=a.to}return!0}})},BjJ7:function(lt,$e,re){"use strict";re.d($e,"d",function(){return $}),re.d($e,"c",function(){return D}),re.d($e,"e",function(){return Y}),re.d($e,"b",function(){return F}),re.d($e,"a",function(){return W});var ne=re("m3rI");function $(B){var P=!0;if(B.length>0){for(var A=0;A<B.length;A++)if(B[A].compile_success==0||!B[A].compile_success){P=!1;break}}else P=!1;return P}function D(B){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],f=0;f<B.length;f++){var x=B[f],M=P?"".concat(P,"/").concat(x.name):"".concat(x.name);A.push({title:x.name,isLeaf:!(x.type==="tree"),key:M})}return A}function Y(B,P,A){for(var f=0;f<B.length;f++){var x=B[f];if(x.key===P){x.children=A;break}x.children&&Y(x.children,P,A)}return B}function F(B,P,A){var f;return function(){var x=this,M=arguments,w=function(){f=null,A||B.apply(x,M)},C=A&&!f;clearTimeout(f),f=setTimeout(w,P),C&&B.apply(x,M)}}var R=!0,W=ne.a.API_SERVER},"C+DQ":function(lt,$e,re){},D1Df:function(lt,$e,re){"use strict";function ne(m){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(U){return typeof U}:ne=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},ne(m)}function $(){return $=Object.assign||function(m){for(var O=1;O<arguments.length;O++){var U=arguments[O];for(var j in U)Object.prototype.hasOwnProperty.call(U,j)&&(m[j]=U[j])}return m},$.apply(this,arguments)}function D(m,O){var U=Object.keys(m);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(m);O&&(j=j.filter(function(K){return Object.getOwnPropertyDescriptor(m,K).enumerable})),U.push.apply(U,j)}return U}function Y(m){for(var O=1;O<arguments.length;O++){var U=arguments[O]!=null?arguments[O]:{};O%2?D(U,!0).forEach(function(j){C(m,j,U[j])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(U)):D(U).forEach(function(j){Object.defineProperty(m,j,Object.getOwnPropertyDescriptor(U,j))})}return m}function F(m,O){if(m==null)return{};var U=R(m,O),j,K;if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(m);for(K=0;K<I.length;K++){if(j=I[K],O.indexOf(j)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(m,j))continue;U[j]=m[j]}}return U}function R(m,O){if(m==null)return{};var U={},j=Object.keys(m),K,I;for(I=0;I<j.length;I++){if(K=j[I],O.indexOf(K)>=0)continue;U[K]=m[K]}return U}function W(m,O){if(!(m instanceof O))throw new TypeError("Cannot call a class as a function")}function B(m,O){for(var U=0;U<O.length;U++){var j=O[U];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(m,j.key,j)}}function P(m,O,U){return O&&B(m.prototype,O),U&&B(m,U),m}function A(m,O){return O&&(ne(O)==="object"||typeof O=="function")?O:x(m)}function f(m){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},f(m)}function x(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function M(m,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(O&&O.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),O&&w(m,O)}function w(m,O){return w=Object.setPrototypeOf||function(j,K){return j.__proto__=K,j},w(m,O)}function C(m,O,U){return O in m?Object.defineProperty(m,O,{value:U,enumerable:!0,configurable:!0,writable:!0}):m[O]=U,m}var E=re("q1tI"),d=re("17x9"),a=re("H38U"),s=re("aRTE");function h(m){for(var O="",U=0;U<m.length;U++){var j=m.charCodeAt(U);j<128?O+=String.fromCharCode(j):j<2048?(O+=String.fromCharCode(192|j>>6),O+=String.fromCharCode(128|j&63)):j<55296||j>=57344?(O+=String.fromCharCode(224|j>>12),O+=String.fromCharCode(128|j>>6&63),O+=String.fromCharCode(128|j&63)):(U++,j=65536+((j&1023)<<10|m.charCodeAt(U)&1023),O+=String.fromCharCode(240|j>>18),O+=String.fromCharCode(128|j>>12&63),O+=String.fromCharCode(128|j>>6&63),O+=String.fromCharCode(128|j&63))}return O}var L={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},p={},v=4,k=.1;function b(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return m.forEach(function(j,K){var I=null;j.forEach(function(N,X){if(!N&&I!==null){U.push("M".concat(I+O," ").concat(K+O,"h").concat(X-I,"v1H").concat(I+O,"z")),I=null;return}if(X===j.length-1){if(!N)return;I===null?U.push("M".concat(X+O,",").concat(K+O," h1v1H").concat(X+O,"z")):U.push("M".concat(I+O,",").concat(K+O," h").concat(X+1-I,"v1H").concat(I+O,"z"));return}N&&I===null&&(I=X)})}),U.join("")}function g(m,O){return m.slice().map(function(U,j){return j<O.y||j>=O.y+O.h?U:U.map(function(K,I){return I<O.x||I>=O.x+O.w?K:!1})})}function c(m,O){var U=m.imageSettings,j=m.size,K=m.includeMargin;if(U==null)return null;var I=K?v:0,N=O.length+I*2,X=Math.floor(j*k),q=N/j,se=(U.width||X)*q,he=(U.height||X)*q,Ae=U.x==null?O.length/2-se/2:U.x*q,be=U.y==null?O.length/2-he/2:U.y*q,Te=null;if(U.excavate){var Ce=Math.floor(Ae),Se=Math.floor(be),pe=Math.ceil(se+Ae-Ce),ue=Math.ceil(he+be-Se);Te={x:Ce,y:Se,w:pe,h:ue}}return{x:Ae,y:be,h:he,w:se,excavation:Te}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(m){return!1}return!0}(),o=function(m){M(O,m);function O(){var U,j;W(this,O);for(var K=arguments.length,I=new Array(K),N=0;N<K;N++)I[N]=arguments[N];return j=A(this,(U=f(O)).call.apply(U,[this].concat(I))),C(x(j),"_canvas",void 0),C(x(j),"_image",void 0),C(x(j),"state",{imgLoaded:!1}),C(x(j),"handleImageLoad",function(){j.setState({imgLoaded:!0})}),j}return P(O,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var j=this.props,K=j.value,I=j.size,N=j.level,X=j.bgColor,q=j.fgColor,se=j.includeMargin,he=j.imageSettings,Ae=new a(-1,s[N]);if(Ae.addData(h(K)),Ae.make(),this._canvas!=null){var be=this._canvas,Te=be.getContext("2d");if(!Te)return;var Ce=Ae.modules;if(Ce===null)return;var Se=se?v:0,pe=Ce.length+Se*2,ue=c(this.props,Ce);he!=null&&ue!=null&&(ue.excavation!=null&&(Ce=g(Ce,ue.excavation)));var te=window.devicePixelRatio||1;be.height=be.width=I*te;var fe=I/pe*te;Te.scale(fe,fe),Te.fillStyle=X,Te.fillRect(0,0,pe,pe),Te.fillStyle=q,u?Te.fill(new Path2D(b(Ce,Se))):Ce.forEach(function(ae,_e){ae.forEach(function(De,xe){De&&Te.fillRect(xe+Se,_e+Se,1,1)})}),this.state.imgLoaded&&this._image&&ue!=null&&Te.drawImage(this._image,ue.x+Se,ue.y+Se,ue.w,ue.h)}}},{key:"render",value:function(){var j=this,K=this.props,I=K.value,N=K.size,X=K.level,q=K.bgColor,se=K.fgColor,he=K.style,Ae=K.includeMargin,be=K.imageSettings,Te=F(K,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Ce=Y({height:N,width:N},he),Se=null,pe=be&&be.src;return be!=null&&pe!=null&&(Se=E.createElement("img",{src:pe,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(te){return j._image=te}})),E.createElement(E.Fragment,null,E.createElement("canvas",$({style:Ce,height:N,width:N,ref:function(te){return j._canvas=te}},Te)),Se)}}]),O}(E.PureComponent);C(o,"defaultProps",L);var T=function(m){M(O,m);function O(){return W(this,O),A(this,f(O).apply(this,arguments))}return P(O,[{key:"render",value:function(){var j=this.props,K=j.value,I=j.size,N=j.level,X=j.bgColor,q=j.fgColor,se=j.includeMargin,he=j.imageSettings,Ae=F(j,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),be=new a(-1,s[N]);be.addData(h(K)),be.make();var Te=be.modules;if(Te===null)return null;var Ce=se?v:0,Se=Te.length+Ce*2,pe=c(this.props,Te),ue=null;he!=null&&pe!=null&&(pe.excavation!=null&&(Te=g(Te,pe.excavation)),ue=E.createElement("image",{xlinkHref:he.src,height:pe.h,width:pe.w,x:pe.x+Ce,y:pe.y+Ce,preserveAspectRatio:"none"}));var te=b(Te,Ce);return E.createElement("svg",$({shapeRendering:"crispEdges",height:I,width:I,viewBox:"0 0 ".concat(Se," ").concat(Se)},Ae),E.createElement("path",{fill:X,d:"M0,0 h".concat(Se,"v").concat(Se,"H0z")}),E.createElement("path",{fill:q,d:te}),ue)}}]),O}(E.PureComponent);C(T,"defaultProps",L);var S=function(O){var U=O.renderAs,j=F(O,["renderAs"]),K=U==="svg"?T:o;return E.createElement(K,j)};S.defaultProps=Y({renderAs:"canvas"},L),lt.exports=S},DlQD:function(lt,$e,re){(function(ne,$){lt.exports=$()})(this,function(){"use strict";function ne(Ee,ge){for(var ye=0;ye<ge.length;ye++){var ie=ge[ye];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(Ee,ie.key,ie)}}function $(Ee,ge,ye){return ge&&ne(Ee.prototype,ge),ye&&ne(Ee,ye),Ee}function D(Ee,ge){if(!Ee)return;if(typeof Ee=="string")return Y(Ee,ge);var ye=Object.prototype.toString.call(Ee).slice(8,-1);if(ye==="Object"&&Ee.constructor&&(ye=Ee.constructor.name),ye==="Map"||ye==="Set")return Array.from(Ee);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return Y(Ee,ge)}function Y(Ee,ge){(ge==null||ge>Ee.length)&&(ge=Ee.length);for(var ye=0,ie=new Array(ge);ye<ge;ye++)ie[ye]=Ee[ye];return ie}function F(Ee,ge){var ye;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(ye=D(Ee))||ge&&Ee&&typeof Ee.length=="number"){ye&&(Ee=ye);var ie=0;return function(){return ie>=Ee.length?{done:!0}:{done:!1,value:Ee[ie++]}}}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 ye=Ee[Symbol.iterator](),ye.next.bind(ye)}function R(Ee,ge){return ge={exports:{}},Ee(ge,ge.exports),ge.exports}var W=R(function(Ee){function ge(){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 ye(ie){Ee.exports.defaults=ie}Ee.exports={defaults:ge(),getDefaults:ge,changeDefaults:ye}}),B=W.defaults,P=W.getDefaults,A=W.changeDefaults,f=/[&<>"']/,x=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,C={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=function(ge){return C[ge]};function d(Ee,ge){if(ge){if(f.test(Ee))return Ee.replace(x,E)}else if(M.test(Ee))return Ee.replace(w,E);return Ee}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ee){return Ee.replace(a,function(ge,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var h=/(^|[^\[])\^/g;function L(Ee,ge){Ee=Ee.source||Ee,ge=ge||"";var ye={replace:function(oe,le){return le=le.source||le,le=le.replace(h,"$1"),Ee=Ee.replace(oe,le),ye},getRegex:function(){return new RegExp(Ee,ge)}};return ye}var p=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(Ee,ge,ye){if(Ee){var ie;try{ie=decodeURIComponent(s(ye)).replace(p,"").toLowerCase()}catch(oe){return null}if(ie.indexOf("javascript:")===0||ie.indexOf("vbscript:")===0||ie.indexOf("data:")===0)return null}ge&&!v.test(ye)&&(ye=o(ge,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(oe){return null}return ye}var b={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Ee,ge){b[" "+Ee]||(g.test(Ee)?b[" "+Ee]=Ee+"/":b[" "+Ee]=O(Ee,"/",!0)),Ee=b[" "+Ee];var ye=Ee.indexOf(":")===-1;return ge.substring(0,2)==="//"?ye?ge:Ee.replace(c,"$1")+ge:ge.charAt(0)==="/"?ye?ge:Ee.replace(u,"$1")+ge:Ee+ge}var T={exec:function(){}};function S(Ee){for(var ge=1,ye,ie;ge<arguments.length;ge++){ye=arguments[ge];for(ie in ye)Object.prototype.hasOwnProperty.call(ye,ie)&&(Ee[ie]=ye[ie])}return Ee}function m(Ee,ge){var ye=Ee.replace(/\|/g,function(le,de,Le){for(var Me=!1,Ye=de;--Ye>=0&&Le[Ye]==="\\";)Me=!Me;return Me?"|":" |"}),ie=ye.split(/ \|/),oe=0;if(ie.length>ge)ie.splice(ge);else for(;ie.length<ge;)ie.push("");for(;oe<ie.length;oe++)ie[oe]=ie[oe].trim().replace(/\\\|/g,"|");return ie}function O(Ee,ge,ye){var ie=Ee.length;if(ie===0)return"";for(var oe=0;oe<ie;){var le=Ee.charAt(ie-oe-1);if(le===ge&&!ye)oe++;else if(le!==ge&&ye)oe++;else break}return Ee.substr(0,ie-oe)}function U(Ee,ge){if(Ee.indexOf(ge[1])===-1)return-1;for(var ye=Ee.length,ie=0,oe=0;oe<ye;oe++)if(Ee[oe]==="\\")oe++;else if(Ee[oe]===ge[0])ie++;else if(Ee[oe]===ge[1]&&(ie--,ie<0))return oe;return-1}function j(Ee){Ee&&Ee.sanitize&&!Ee.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 K={escape:d,unescape:s,edit:L,cleanUrl:k,resolveUrl:o,noopTest:T,merge:S,splitCells:m,rtrim:O,findClosingBracket:U,checkSanitizeDeprecation:j},I=W.defaults,N=K.rtrim,X=K.splitCells,q=K.escape,se=K.findClosingBracket;function he(Ee,ge,ye){var ie=ge.href,oe=ge.title?q(ge.title):null,le=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:ye,href:ie,title:oe,text:le}:{type:"image",raw:ye,href:ie,title:oe,text:q(le)}}function Ae(Ee,ge){var ye=Ee.match(/^(\s+)(?:```)/);if(ye===null)return ge;var ie=ye[1];return ge.split(`
`).map(function(oe){var le=oe.match(/^\s+/);if(le===null)return oe;var de=le[0];return de.length>=ie.length?oe.slice(ie.length):oe}).join(`
`)}var be=function(){function Ee(ye){this.options=ye||I}var ge=Ee.prototype;return ge.space=function(ie){var oe=this.rules.block.newline.exec(ie);if(oe)return oe[0].length>1?{type:"space",raw:oe[0]}:{raw:`
`}},ge.code=function(ie,oe){var le=this.rules.block.code.exec(ie);if(le){var de=oe[oe.length-1];if(de&&de.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var Le=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?Le:N(Le,`
`)}}},ge.fences=function(ie){var oe=this.rules.block.fences.exec(ie);if(oe){var le=oe[0],de=Ae(le,oe[3]||"");return{type:"code",raw:le,lang:oe[2]?oe[2].trim():oe[2],text:de}}},ge.heading=function(ie){var oe=this.rules.block.heading.exec(ie);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},ge.nptable=function(ie){var oe=this.rules.block.nptable.exec(ie);if(oe){var le={type:"table",header:X(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[],raw:oe[0]};if(le.header.length===le.align.length){var de=le.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(le.align[Le])?le.align[Le]="right":/^ *:-+: *$/.test(le.align[Le])?le.align[Le]="center":/^ *:-+ *$/.test(le.align[Le])?le.align[Le]="left":le.align[Le]=null;for(de=le.cells.length,Le=0;Le<de;Le++)le.cells[Le]=X(le.cells[Le],le.header.length);return le}}},ge.hr=function(ie){var oe=this.rules.block.hr.exec(ie);if(oe)return{type:"hr",raw:oe[0]}},ge.blockquote=function(ie){var oe=this.rules.block.blockquote.exec(ie);if(oe){var le=oe[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:oe[0],text:le}}},ge.list=function(ie){var oe=this.rules.block.list.exec(ie);if(oe){for(var le=oe[0],de=oe[2],Le=de.length>1,Me=de[de.length-1]===")",Ye={type:"list",raw:le,ordered:Le,start:Le?+de.slice(0,-1):"",loose:!1,items:[]},yt=oe[0].match(this.rules.block.item),At=!1,Ge,xt,mt,nt,Rt,Lt,Kt,Bt=yt.length,wt=0;wt<Bt;wt++)Ge=yt[wt],le=Ge,xt=Ge.length,Ge=Ge.replace(/^ *([*+-]|\d+[.)]) */,""),~Ge.indexOf(`
`)&&(xt-=Ge.length,Ge=this.options.pedantic?Ge.replace(/^ {1,4}/gm,""):Ge.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),wt!==Bt-1&&(mt=this.rules.block.bullet.exec(yt[wt+1])[0],(Le?mt.length===1||!Me&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==de)&&(nt=yt.slice(wt+1).join(`
`),Ye.raw=Ye.raw.substring(0,Ye.raw.length-nt.length),wt=Bt-1)),Rt=At||/\n\n(?!\s*$)/.test(Ge),wt!==Bt-1&&(At=Ge.charAt(Ge.length-1)===`
`,Rt||(Rt=At)),Rt&&(Ye.loose=!0),Lt=/^\[[ xX]\] /.test(Ge),Kt=void 0,Lt&&(Kt=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),Ye.items.push({type:"list_item",raw:le,task:Lt,checked:Kt,loose:Rt,text:Ge});return Ye}},ge.html=function(ie){var oe=this.rules.block.html.exec(ie);if(oe)return{type:this.options.sanitize?"paragraph":"html",raw:oe[0],pre:!this.options.sanitizer&&(oe[1]==="pre"||oe[1]==="script"||oe[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):q(oe[0]):oe[0]}},ge.def=function(ie){var oe=this.rules.block.def.exec(ie);if(oe){oe[3]&&(oe[3]=oe[3].substring(1,oe[3].length-1));var le=oe[1].toLowerCase().replace(/\s+/g," ");return{tag:le,raw:oe[0],href:oe[2],title:oe[3]}}},ge.table=function(ie){var oe=this.rules.block.table.exec(ie);if(oe){var le={type:"table",header:X(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[]};if(le.header.length===le.align.length){le.raw=oe[0];var de=le.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(le.align[Le])?le.align[Le]="right":/^ *:-+: *$/.test(le.align[Le])?le.align[Le]="center":/^ *:-+ *$/.test(le.align[Le])?le.align[Le]="left":le.align[Le]=null;for(de=le.cells.length,Le=0;Le<de;Le++)le.cells[Le]=X(le.cells[Le].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},ge.lheading=function(ie){var oe=this.rules.block.lheading.exec(ie);if(oe)return{type:"heading",raw:oe[0],depth:oe[2].charAt(0)==="="?1:2,text:oe[1]}},ge.paragraph=function(ie){var oe=this.rules.block.paragraph.exec(ie);if(oe)return{type:"paragraph",raw:oe[0],text:oe[1].charAt(oe[1].length-1)===`
`?oe[1].slice(0,-1):oe[1]}},ge.text=function(ie,oe){var le=this.rules.block.text.exec(ie);if(le){var de=oe[oe.length-1];return de&&de.type==="text"?{raw:le[0],text:le[0]}:{type:"text",raw:le[0],text:le[0]}}},ge.escape=function(ie){var oe=this.rules.inline.escape.exec(ie);if(oe)return{type:"escape",raw:oe[0],text:q(oe[1])}},ge.tag=function(ie,oe,le){var de=this.rules.inline.tag.exec(ie);if(de)return!oe&&/^<a /i.test(de[0])?oe=!0:oe&&/^<\/a>/i.test(de[0])&&(oe=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:oe,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):q(de[0]):de[0]}},ge.link=function(ie){var oe=this.rules.inline.link.exec(ie);if(oe){var le=se(oe[2],"()");if(le>-1){var de=oe[0].indexOf("!")===0?5:4,Le=de+oe[1].length+le;oe[2]=oe[2].substring(0,le),oe[0]=oe[0].substring(0,Le).trim(),oe[3]=""}var Me=oe[2],Ye="";if(this.options.pedantic){var yt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);yt?(Me=yt[1],Ye=yt[3]):Ye=""}else Ye=oe[3]?oe[3].slice(1,-1):"";Me=Me.trim().replace(/^<([\s\S]*)>$/,"$1");var At=he(oe,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:Ye&&Ye.replace(this.rules.inline._escapes,"$1")},oe[0]);return At}},ge.reflink=function(ie,oe){var le;if((le=this.rules.inline.reflink.exec(ie))||(le=this.rules.inline.nolink.exec(ie))){var de=(le[2]||le[1]).replace(/\s+/g," ");if(de=oe[de.toLowerCase()],!de||!de.href){var Le=le[0].charAt(0);return{type:"text",raw:Le,text:Le}}var Me=he(le,de,le[0]);return Me}},ge.strong=function(ie,oe,le){le===void 0&&(le="");var de=this.rules.inline.strong.start.exec(ie);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){oe=oe.slice(-1*ie.length);var Le=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Le.lastIndex=0;for(var Me;(de=Le.exec(oe))!=null;)if(Me=this.rules.inline.strong.middle.exec(oe.slice(0,de.index+3)),Me)return{type:"strong",raw:ie.slice(0,Me[0].length),text:ie.slice(2,Me[0].length-2)}}},ge.em=function(ie,oe,le){le===void 0&&(le="");var de=this.rules.inline.em.start.exec(ie);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){oe=oe.slice(-1*ie.length);var Le=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Le.lastIndex=0;for(var Me;(de=Le.exec(oe))!=null;)if(Me=this.rules.inline.em.middle.exec(oe.slice(0,de.index+2)),Me)return{type:"em",raw:ie.slice(0,Me[0].length),text:ie.slice(1,Me[0].length-1)}}},ge.codespan=function(ie){var oe=this.rules.inline.code.exec(ie);if(oe){var le=oe[2].replace(/\n/g," "),de=/[^ ]/.test(le),Le=le.startsWith(" ")&&le.endsWith(" ");return de&&Le&&(le=le.substring(1,le.length-1)),le=q(le,!0),{type:"codespan",raw:oe[0],text:le}}},ge.br=function(ie){var oe=this.rules.inline.br.exec(ie);if(oe)return{type:"br",raw:oe[0]}},ge.del=function(ie){var oe=this.rules.inline.del.exec(ie);if(oe)return{type:"del",raw:oe[0],text:oe[1]}},ge.autolink=function(ie,oe){var le=this.rules.inline.autolink.exec(ie);if(le){var de,Le;return le[2]==="@"?(de=q(this.options.mangle?oe(le[1]):le[1]),Le="mailto:"+de):(de=q(le[1]),Le=de),{type:"link",raw:le[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},ge.url=function(ie,oe){var le;if(le=this.rules.inline.url.exec(ie)){var de,Le;if(le[2]==="@")de=q(this.options.mangle?oe(le[0]):le[0]),Le="mailto:"+de;else{var Me;do Me=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Me!==le[0]);de=q(le[0]),le[1]==="www."?Le="http://"+de:Le=de}return{type:"link",raw:le[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},ge.inlineText=function(ie,oe,le){var de=this.rules.inline.text.exec(ie);if(de){var Le;return oe?Le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):q(de[0]):de[0]:Le=q(this.options.smartypants?le(de[0]):de[0]),{type:"text",raw:de[0],text:Le}}},Ee}(),Te=K.noopTest,Ce=K.edit,Se=K.merge,pe={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:Te,table:Te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Ce(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Ce(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Ce(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._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",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Ce(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Ce(pe._paragraph).replace("hr",pe.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",pe._tag).getRegex(),pe.blockquote=Ce(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=Se({},pe),pe.gfm=Se({},pe.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*|$)"}),pe.gfm.nptable=Ce(pe.gfm.nptable).replace("hr",pe.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",pe._tag).getRegex(),pe.gfm.table=Ce(pe.gfm.table).replace("hr",pe.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",pe._tag).getRegex(),pe.pedantic=Se({},pe.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._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:Te,paragraph:Ce(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Ce(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Ce(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Ce(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Ce(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Ce(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Ce(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Ce(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Ce(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Ce(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Ce(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Ce(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=Ce(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=Ce(ue.tag).replace("comment",pe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Ce(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Ce(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Ce(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Se({},ue),ue.pedantic=Se({},ue.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:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Se({},ue.normal,{escape:Ce(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=Ce(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Se({},ue.gfm,{br:Ce(ue.br).replace("{2,}","*").getRegex(),text:Ce(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:pe,inline:ue},fe=W.defaults,ae=te.block,_e=te.inline;function De(Ee){return Ee.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 xe(Ee){var ge="",ye,ie,oe=Ee.length;for(ye=0;ye<oe;ye++)ie=Ee.charCodeAt(ye),Math.random()>.5&&(ie="x"+ie.toString(16)),ge+="&#"+ie+";";return ge}var Oe=function(){function Ee(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||fe,this.options.tokenizer=this.options.tokenizer||new be,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ie={block:ae.normal,inline:_e.normal};this.options.pedantic?(ie.block=ae.pedantic,ie.inline=_e.pedantic):this.options.gfm&&(ie.block=ae.gfm,this.options.breaks?ie.inline=_e.breaks:ie.inline=_e.gfm),this.tokenizer.rules=ie}Ee.lex=function(ie,oe){var le=new Ee(oe);return le.lex(ie)};var ge=Ee.prototype;return ge.lex=function(ie){return ie=ie.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ie,this.tokens,!0),this.inline(this.tokens),this.tokens},ge.blockTokens=function(ie,oe,le){oe===void 0&&(oe=[]),le===void 0&&(le=!0),ie=ie.replace(/^ +$/gm,"");for(var de,Le,Me,Ye;ie;){if(de=this.tokenizer.space(ie)){ie=ie.substring(de.raw.length),de.type&&oe.push(de);continue}if(de=this.tokenizer.code(ie,oe)){ie=ie.substring(de.raw.length),de.type?oe.push(de):(Ye=oe[oe.length-1],Ye.raw+=`
`+de.raw,Ye.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.heading(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.nptable(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.hr(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.blockquote(ie)){ie=ie.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],le),oe.push(de);continue}if(de=this.tokenizer.list(ie)){for(ie=ie.substring(de.raw.length),Me=de.items.length,Le=0;Le<Me;Le++)de.items[Le].tokens=this.blockTokens(de.items[Le].text,[],!1);oe.push(de);continue}if(de=this.tokenizer.html(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(le&&(de=this.tokenizer.def(ie))){ie=ie.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.lheading(ie)){ie=ie.substring(de.raw.length),oe.push(de);continue}if(le&&(de=this.tokenizer.paragraph(ie))){ie=ie.substring(de.raw.length),oe.push(de);continue}if(de=this.tokenizer.text(ie,oe)){ie=ie.substring(de.raw.length),de.type?oe.push(de):(Ye=oe[oe.length-1],Ye.raw+=`
`+de.raw,Ye.text+=`
`+de.text);continue}if(ie){var yt="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return oe},ge.inline=function(ie){var oe,le,de,Le,Me,Ye,yt=ie.length;for(oe=0;oe<yt;oe++){Ye=ie[oe];switch(Ye.type){case"paragraph":case"text":case"heading":{Ye.tokens=[],this.inlineTokens(Ye.text,Ye.tokens);break}case"table":{for(Ye.tokens={header:[],cells:[]},Le=Ye.header.length,le=0;le<Le;le++)Ye.tokens.header[le]=[],this.inlineTokens(Ye.header[le],Ye.tokens.header[le]);for(Le=Ye.cells.length,le=0;le<Le;le++)for(Me=Ye.cells[le],Ye.tokens.cells[le]=[],de=0;de<Me.length;de++)Ye.tokens.cells[le][de]=[],this.inlineTokens(Me[de],Ye.tokens.cells[le][de]);break}case"blockquote":{this.inline(Ye.tokens);break}case"list":{for(Le=Ye.items.length,le=0;le<Le;le++)this.inline(Ye.items[le].tokens);break}}}return ie},ge.inlineTokens=function(ie,oe,le,de,Le){oe===void 0&&(oe=[]),le===void 0&&(le=!1),de===void 0&&(de=!1),Le===void 0&&(Le="");var Me,Ye=ie,yt;if(this.tokens.links){var At=Object.keys(this.tokens.links);if(At.length>0)for(;(yt=this.tokenizer.rules.inline.reflinkSearch.exec(Ye))!=null;)At.includes(yt[0].slice(yt[0].lastIndexOf("[")+1,-1))&&(Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(yt=this.tokenizer.rules.inline.blockSkip.exec(Ye))!=null;)Ye=Ye.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ie;){if(Me=this.tokenizer.escape(ie)){ie=ie.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.tag(ie,le,de)){ie=ie.substring(Me.raw.length),le=Me.inLink,de=Me.inRawBlock,oe.push(Me);continue}if(Me=this.tokenizer.link(ie)){ie=ie.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,de)),oe.push(Me);continue}if(Me=this.tokenizer.reflink(ie,this.tokens.links)){ie=ie.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,de)),oe.push(Me);continue}if(Me=this.tokenizer.strong(ie,Ye,Le)){ie=ie.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.em(ie,Ye,Le)){ie=ie.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.codespan(ie)){ie=ie.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.br(ie)){ie=ie.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.del(ie)){ie=ie.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],le,de),oe.push(Me);continue}if(Me=this.tokenizer.autolink(ie,xe)){ie=ie.substring(Me.raw.length),oe.push(Me);continue}if(!le&&(Me=this.tokenizer.url(ie,xe))){ie=ie.substring(Me.raw.length),oe.push(Me);continue}if(Me=this.tokenizer.inlineText(ie,de,De)){ie=ie.substring(Me.raw.length),Le=Me.raw.slice(-1),oe.push(Me);continue}if(ie){var Ge="Infinite loop on byte: "+ie.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return oe},$(Ee,null,[{key:"rules",get:function(){return{block:ae,inline:_e}}}]),Ee}(),Ie=W.defaults,Ue=K.cleanUrl,We=K.escape,Be=function(){function Ee(ye){this.options=ye||Ie}var ge=Ee.prototype;return ge.code=function(ie,oe,le){var de=(oe||"").match(/\S*/)[0];if(this.options.highlight){var Le=this.options.highlight(ie,de);Le!=null&&Le!==ie&&(le=!0,ie=Le)}return de?'<pre><code class="'+this.options.langPrefix+We(de,!0)+'">'+(le?ie:We(ie,!0))+`</code></pre>
`:"<pre><code>"+(le?ie:We(ie,!0))+`</code></pre>
`},ge.blockquote=function(ie){return`<blockquote>
`+ie+`</blockquote>
`},ge.html=function(ie){return ie},ge.heading=function(ie,oe,le,de){return this.options.headerIds?"<h"+oe+' id="'+this.options.headerPrefix+de.slug(le)+'">'+ie+"</h"+oe+`>
`:"<h"+oe+">"+ie+"</h"+oe+`>
`},ge.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ge.list=function(ie,oe,le){var de=oe?"ol":"ul",Le=oe&&le!==1?' start="'+le+'"':"";return"<"+de+Le+`>
`+ie+"</"+de+`>
`},ge.listitem=function(ie){return"<li>"+ie+`</li>
`},ge.checkbox=function(ie){return"<input "+(ie?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(ie){return"<p>"+ie+`</p>
`},ge.table=function(ie,oe){return oe&&(oe="<tbody>"+oe+"</tbody>"),`<table>
<thead>
`+ie+`</thead>
`+oe+`</table>
`},ge.tablerow=function(ie){return`<tr>
`+ie+`</tr>
`},ge.tablecell=function(ie,oe){var le=oe.header?"th":"td",de=oe.align?"<"+le+' align="'+oe.align+'">':"<"+le+">";return de+ie+"</"+le+`>
`},ge.strong=function(ie){return"<strong>"+ie+"</strong>"},ge.em=function(ie){return"<em>"+ie+"</em>"},ge.codespan=function(ie){return"<code>"+ie+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(ie){return"<del>"+ie+"</del>"},ge.link=function(ie,oe,le){if(ie=Ue(this.options.sanitize,this.options.baseUrl,ie),ie===null)return le;var de='<a href="'+We(ie)+'"';return oe&&(de+=' title="'+oe+'"'),de+=">"+le+"</a>",de},ge.image=function(ie,oe,le){if(ie=Ue(this.options.sanitize,this.options.baseUrl,ie),ie===null)return le;var de='<img src="'+ie+'" alt="'+le+'"';return oe&&(de+=' title="'+oe+'"'),de+=this.options.xhtml?"/>":">",de},ge.text=function(ie){return ie},Ee}(),Fe=function(){function Ee(){}var ge=Ee.prototype;return ge.strong=function(ie){return ie},ge.em=function(ie){return ie},ge.codespan=function(ie){return ie},ge.del=function(ie){return ie},ge.html=function(ie){return ie},ge.text=function(ie){return ie},ge.link=function(ie,oe,le){return""+le},ge.image=function(ie,oe,le){return""+le},ge.br=function(){return""},Ee}(),it=function(){function Ee(){this.seen={}}var ge=Ee.prototype;return ge.slug=function(ie){var oe=ie.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(oe)){var le=oe;do this.seen[le]++,oe=le+"-"+this.seen[le];while(this.seen.hasOwnProperty(oe))}return this.seen[oe]=0,oe},Ee}(),et=W.defaults,qe=K.unescape,Qe=function(){function Ee(ye){this.options=ye||et,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new it}Ee.parse=function(ie,oe){var le=new Ee(oe);return le.parse(ie)};var ge=Ee.prototype;return ge.parse=function(ie,oe){oe===void 0&&(oe=!0);var le="",de,Le,Me,Ye,yt,At,Ge,xt,mt,nt,Rt,Lt,Kt,Bt,wt,yr,ir,gt,Gr=ie.length;for(de=0;de<Gr;de++){nt=ie[de];switch(nt.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(nt.tokens),nt.depth,qe(this.parseInline(nt.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(nt.text,nt.lang,nt.escaped);continue}case"table":{for(xt="",Ge="",Ye=nt.header.length,Le=0;Le<Ye;Le++)Ge+=this.renderer.tablecell(this.parseInline(nt.tokens.header[Le]),{header:!0,align:nt.align[Le]});for(xt+=this.renderer.tablerow(Ge),mt="",Ye=nt.cells.length,Le=0;Le<Ye;Le++){for(At=nt.tokens.cells[Le],Ge="",yt=At.length,Me=0;Me<yt;Me++)Ge+=this.renderer.tablecell(this.parseInline(At[Me]),{header:!1,align:nt.align[Me]});mt+=this.renderer.tablerow(Ge)}le+=this.renderer.table(xt,mt);continue}case"blockquote":{mt=this.parse(nt.tokens),le+=this.renderer.blockquote(mt);continue}case"list":{for(Rt=nt.ordered,Lt=nt.start,Kt=nt.loose,Ye=nt.items.length,mt="",Le=0;Le<Ye;Le++)wt=nt.items[Le],yr=wt.checked,ir=wt.task,Bt="",wt.task&&(gt=this.renderer.checkbox(yr),Kt?wt.tokens.length>0&&wt.tokens[0].type==="text"?(wt.tokens[0].text=gt+" "+wt.tokens[0].text,wt.tokens[0].tokens&&wt.tokens[0].tokens.length>0&&wt.tokens[0].tokens[0].type==="text"&&(wt.tokens[0].tokens[0].text=gt+" "+wt.tokens[0].tokens[0].text)):wt.tokens.unshift({type:"text",text:gt}):Bt+=gt),Bt+=this.parse(wt.tokens,Kt),mt+=this.renderer.listitem(Bt,ir,yr);le+=this.renderer.list(mt,Rt,Lt);continue}case"html":{le+=this.renderer.html(nt.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(nt.tokens));continue}case"text":{for(mt=nt.tokens?this.parseInline(nt.tokens):nt.text;de+1<Gr&&ie[de+1].type==="text";)nt=ie[++de],mt+=`
`+(nt.tokens?this.parseInline(nt.tokens):nt.text);le+=oe?this.renderer.paragraph(mt):mt;continue}default:{var br='Token with "'+nt.type+'" type was not found.';if(this.options.silent){console.error(br);return}else throw new Error(br)}}}return le},ge.parseInline=function(ie,oe){oe=oe||this.renderer;var le="",de,Le,Me=ie.length;for(de=0;de<Me;de++){Le=ie[de];switch(Le.type){case"escape":{le+=oe.text(Le.text);break}case"html":{le+=oe.html(Le.text);break}case"link":{le+=oe.link(Le.href,Le.title,this.parseInline(Le.tokens,oe));break}case"image":{le+=oe.image(Le.href,Le.title,Le.text);break}case"strong":{le+=oe.strong(this.parseInline(Le.tokens,oe));break}case"em":{le+=oe.em(this.parseInline(Le.tokens,oe));break}case"codespan":{le+=oe.codespan(Le.text);break}case"br":{le+=oe.br();break}case"del":{le+=oe.del(this.parseInline(Le.tokens,oe));break}case"text":{le+=oe.text(Le.text);break}default:{var Ye='Token with "'+Le.type+'" type was not found.';if(this.options.silent){console.error(Ye);return}else throw new Error(Ye)}}}return le},Ee}(),ot=K.merge,Ze=K.checkSanitizeDeprecation,at=K.escape,Pe=W.getDefaults,dt=W.changeDefaults,st=W.defaults;function Ne(Ee,ge,ye){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof ge=="function"&&(ye=ge,ge=null),ge=ot({},Ne.defaults,ge||{}),Ze(ge),ye){var ie=ge.highlight,oe;try{oe=Oe.lex(Ee,ge)}catch(Me){return ye(Me)}var le=function(Ye){var yt;if(!Ye)try{yt=Qe.parse(oe,ge)}catch(At){Ye=At}return ge.highlight=ie,Ye?ye(Ye):ye(null,yt)};if(!ie||ie.length<3)return le();if(delete ge.highlight,!oe.length)return le();var de=0;Ne.walkTokens(oe,function(Me){Me.type==="code"&&(de++,setTimeout(function(){ie(Me.text,Me.lang,function(Ye,yt){if(Ye)return le(Ye);yt!=null&&yt!==Me.text&&(Me.text=yt,Me.escaped=!0),de--,de===0&&le()})},0))}),de===0&&le();return}try{var Le=Oe.lex(Ee,ge);return ge.walkTokens&&Ne.walkTokens(Le,ge.walkTokens),Qe.parse(Le,ge)}catch(Me){if(Me.message+=`
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+at(Me.message+"",!0)+"</pre>";throw Me}}Ne.options=Ne.setOptions=function(Ee){return ot(Ne.defaults,Ee),dt(Ne.defaults),Ne},Ne.getDefaults=Pe,Ne.defaults=st,Ne.use=function(Ee){var ge=ot({},Ee);if(Ee.renderer&&function(){var ie=Ne.defaults.renderer||new Be,oe=function(Le){var Me=ie[Le];ie[Le]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var Ge=Ee.renderer[Le].apply(ie,yt);return Ge===!1&&(Ge=Me.apply(ie,yt)),Ge}};for(var le in Ee.renderer)oe(le);ge.renderer=ie}(),Ee.tokenizer&&function(){var ie=Ne.defaults.tokenizer||new be,oe=function(Le){var Me=ie[Le];ie[Le]=function(){for(var Ye=arguments.length,yt=new Array(Ye),At=0;At<Ye;At++)yt[At]=arguments[At];var Ge=Ee.tokenizer[Le].apply(ie,yt);return Ge===!1&&(Ge=Me.apply(ie,yt)),Ge}};for(var le in Ee.tokenizer)oe(le);ge.tokenizer=ie}(),Ee.walkTokens){var ye=Ne.defaults.walkTokens;ge.walkTokens=function(ie){Ee.walkTokens(ie),ye&&ye(ie)}}Ne.setOptions(ge)},Ne.walkTokens=function(Ee,ge){for(var ye=F(Ee),ie;!(ie=ye()).done;){var oe=ie.value;ge(oe);switch(oe.type){case"table":{for(var le=F(oe.tokens.header),de;!(de=le()).done;){var Le=de.value;Ne.walkTokens(Le,ge)}for(var Me=F(oe.tokens.cells),Ye;!(Ye=Me()).done;)for(var yt=Ye.value,At=F(yt),Ge;!(Ge=At()).done;){var xt=Ge.value;Ne.walkTokens(xt,ge)}break}case"list":{Ne.walkTokens(oe.items,ge);break}default:oe.tokens&&Ne.walkTokens(oe.tokens,ge)}}},Ne.Parser=Qe,Ne.parser=Qe.parse,Ne.Renderer=Be,Ne.TextRenderer=Fe,Ne.Lexer=Oe,Ne.lexer=Oe.lex,Ne.Tokenizer=be,Ne.Slugger=it,Ne.parse=Ne;var Ve=Ne;return Ve})},ELLl:function(lt,$e,re){(function(ne){ne(re("VrN/"))})(function(ne){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(C,E,d){d&&d!=ne.Init&&(C.removeKeyMap(F),C.state.closeBrackets=null),E&&(R(Y(E,"pairs")),C.state.closeBrackets=E,C.addKeyMap(F))});function Y(C,E){return E=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[E]!=null?C[E]:$[E]}var F={Backspace:P,Enter:A};function R(C){for(var E=0;E<C.length;E++){var d=C.charAt(E),a="'"+d+"'";F[a]||(F[a]=W(d))}}R($.pairs+"`");function W(C){return function(E){return x(E,C)}}function B(C){var E=C.state.closeBrackets;if(!E||E.override)return E;var d=C.getModeAt(C.getCursor());return d.closeBrackets||E}function P(C){var E=B(C);if(!E||C.getOption("disableInput"))return ne.Pass;for(var d=Y(E,"pairs"),a=C.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var h=M(C,a[s].head);if(!h||d.indexOf(h)%2!=0)return ne.Pass}for(var s=a.length-1;s>=0;s--){var L=a[s].head;C.replaceRange("",D(L.line,L.ch-1),D(L.line,L.ch+1),"+delete")}}function A(C){var E=B(C),d=E&&Y(E,"explode");if(!d||C.getOption("disableInput"))return ne.Pass;for(var a=C.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var h=M(C,a[s].head);if(!h||d.indexOf(h)%2!=0)return ne.Pass}C.operation(function(){var L=C.lineSeparator()||`
`;C.replaceSelection(L+L,null),C.execCommand("goCharLeft"),a=C.listSelections();for(var p=0;p<a.length;p++){var v=a[p].head.line;C.indentLine(v,null,!0),C.indentLine(v+1,null,!0)}})}function f(C){var E=ne.cmpPos(C.anchor,C.head)>0;return{anchor:new D(C.anchor.line,C.anchor.ch+(E?-1:1)),head:new D(C.head.line,C.head.ch+(E?1:-1))}}function x(C,E){var d=B(C);if(!d||C.getOption("disableInput"))return ne.Pass;var a=Y(d,"pairs"),s=a.indexOf(E);if(s==-1)return ne.Pass;for(var h=Y(d,"closeBefore"),L=Y(d,"triples"),p=a.charAt(s+1)==E,v=C.listSelections(),k=s%2==0,b,g=0;g<v.length;g++){var c=v[g],u=c.head,o,T=C.getRange(u,D(u.line,u.ch+1));if(k&&!c.empty())o="surround";else if((p||!k)&&T==E)p&&w(C,u)?o="both":L.indexOf(E)>=0&&C.getRange(u,D(u.line,u.ch+3))==E+E+E?o="skipThree":o="skip";else if(p&&u.ch>1&&L.indexOf(E)>=0&&C.getRange(D(u.line,u.ch-2),u)==E+E){if(u.ch>2&&/\bstring/.test(C.getTokenTypeAt(D(u.line,u.ch-2))))return ne.Pass;o="addFour"}else if(p){var S=u.ch==0?" ":C.getRange(D(u.line,u.ch-1),u);if(!ne.isWordChar(T)&&S!=E&&!ne.isWordChar(S))o="both";else return ne.Pass}else if(k&&(T.length===0||/\s/.test(T)||h.indexOf(T)>-1))o="both";else return ne.Pass;if(!b)b=o;else if(b!=o)return ne.Pass}var m=s%2?a.charAt(s-1):E,O=s%2?E:a.charAt(s+1);C.operation(function(){if(b=="skip")C.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)C.execCommand("goCharRight");else if(b=="surround"){for(var j=C.getSelections(),U=0;U<j.length;U++)j[U]=m+j[U]+O;C.replaceSelections(j,"around"),j=C.listSelections().slice();for(var U=0;U<j.length;U++)j[U]=f(j[U]);C.setSelections(j)}else b=="both"?(C.replaceSelection(m+O,null),C.triggerElectric(m+O),C.execCommand("goCharLeft")):b=="addFour"&&(C.replaceSelection(m+m+m+m,"before"),C.execCommand("goCharRight"))})}function M(C,E){var d=C.getRange(D(E.line,E.ch-1),D(E.line,E.ch+1));return d.length==2?d:null}function w(C,E){var d=C.getTokenAt(D(E.line,E.ch+1));return/\bstring/.test(d.type)&&d.start==E.ch&&(E.ch==0||!/\bstring/.test(C.getTokenTypeAt(E)))}})},GfqC:function(lt,$e,re){"use strict";var ne=re("q1tI"),$=re.n(ne),D=re("TSYQ"),Y=re.n(D);function F(K,I){var N="cannot "+K.method+" "+K.action+" "+I.status+"'",X=new Error(N);return X.status=I.status,X.method=K.method,X.url=K.action,X}function R(K){var I=K.responseText||K.response;if(!I)return I;try{return JSON.parse(I)}catch(N){return I}}function W(K){var I=new XMLHttpRequest;K.onProgress&&I.upload&&(I.upload.onprogress=function(se){se.total>0&&(se.percent=se.loaded/se.total*100),K.onProgress(se)});var N=new FormData;K.data&&Object.keys(K.data).forEach(function(q){var se=K.data[q];if(Array.isArray(se)){se.forEach(function(he){N.append(q+"[]",he)});return}N.append(q,K.data[q])}),K.file instanceof Blob?N.append(K.filename,K.file,K.file.name):N.append(K.filename,K.file),I.onerror=function(se){K.onError(se)},I.onload=function(){return I.status<200||I.status>=300?K.onError(F(K,I),R(I)):K.onSuccess(R(I),I)},I.open(K.method,K.action,!0),K.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var X=K.headers||{};return X["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(q){X[q]!==null&&I.setRequestHeader(q,X[q])}),I.send(N),{abort:function(){I.abort()}}}var B=+new Date,P=0;function A(){return"rc-upload-"+B+"-"+ ++P}function f(K,I){return K.indexOf(I,K.length-I.length)!==-1}var x=function(K,I){if(K&&I){var N=Array.isArray(I)?I:I.split(","),X=K.name||"",q=K.type||"",se=q.replace(/\/.*$/,"");return N.some(function(he){var Ae=he.trim();return Ae.charAt(0)==="."?f(X.toLowerCase(),Ae.toLowerCase()):/\/\*$/.test(Ae)?se===Ae.replace(/\/.*$/,""):q===Ae})}return!0};function M(K,I){var N=K.createReader(),X=[];function q(){N.readEntries(function(se){var he=Array.prototype.slice.apply(se);X=X.concat(he);var Ae=!he.length;Ae?I(X):q()})}q()}var w=function(I,N,X){var q=function se(he,Ae){Ae=Ae||"",he.isFile?he.file(function(be){X(be)&&(he.fullPath&&!be.webkitRelativePath&&(Object.defineProperties(be,{webkitRelativePath:{writable:!0}}),be.webkitRelativePath=he.fullPath.replace(/^\//,""),Object.defineProperties(be,{webkitRelativePath:{writable:!1}})),N([be]))}):he.isDirectory&&M(he,function(be){be.forEach(function(Te){se(Te,""+Ae+he.name+"/")})})};I.forEach(function(se){q(se.webkitGetAsEntry())})},C=w,E=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(K[X]=N[X])}return K},d=function(){function K(I,N){var X=[],q=!0,se=!1,he=void 0;try{for(var Ae=I[Symbol.iterator](),be;!(q=(be=Ae.next()).done)&&!(X.push(be.value),N&&X.length===N);q=!0);}catch(Te){se=!0,he=Te}finally{try{!q&&Ae.return&&Ae.return()}finally{if(se)throw he}}return X}return function(I,N){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return K(I,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function K(I,N){for(var X=0;X<N.length;X++){var q=N[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,X){return N&&K(I.prototype,N),X&&K(I,X),I}}();function s(K,I,N){return I in K?Object.defineProperty(K,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):K[I]=N,K}function h(K,I){var N={};for(var X in K){if(I.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(K,X))continue;N[X]=K[X]}return N}function L(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function p(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function v(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}var k=function(I){return Object.keys(I).reduce(function(N,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(N[X]=I[X]),N},{})},b=function(K){v(I,K);function I(){var N,X,q,se;L(this,I);for(var he=arguments.length,Ae=Array(he),be=0;be<he;be++)Ae[be]=arguments[be];return se=(X=(q=p(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ae))),q),q.state={uid:A()},q.reqs={},q.onChange=function(Te){var Ce=Te.target.files;q.uploadFiles(Ce),q.reset()},q.onClick=function(Te){var Ce=q.fileInput;if(!Ce)return;var Se=q.props,pe=Se.children,ue=Se.onClick;pe&&pe.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),ue&&ue(Te)},q.onKeyDown=function(Te){Te.key==="Enter"&&q.onClick()},q.onFileDrop=function(Te){var Ce=q.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(q.props.directory)C(Array.prototype.slice.call(Te.dataTransfer.items),q.uploadFiles,function(pe){return x(pe,q.props.accept)});else{var Se=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(pe){return x(pe,q.props.accept)});Ce===!1&&(Se=Se.slice(0,1)),q.uploadFiles(Se)}},q.uploadFiles=function(Te){var Ce=Array.prototype.slice.call(Te);Ce.map(function(Se){return Se.uid=A(),Se}).forEach(function(Se){q.upload(Se,Ce)})},q.saveFileInput=function(Te){q.fileInput=Te},X),p(q,se)}return a(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(X,q){var se=this,he=this.props;if(!he.beforeUpload)return setTimeout(function(){return se.post(X)},0);var Ae=he.beforeUpload(X,q);Ae&&Ae.then?Ae.then(function(be){var Te=Object.prototype.toString.call(be);return Te==="[object File]"||Te==="[object Blob]"?se.post(be):se.post(X)}).catch(function(be){console.log(be)}):Ae!==!1&&setTimeout(function(){return se.post(X)},0);return}},{key:"post",value:function(X){var q=this;if(!this._isMounted)return;var se=this.props,he=se.onStart,Ae=se.onProgress,be=se.transformFile,Te=be===void 0?function(Ce){return Ce}:be;new Promise(function(Ce){var Se=se.action;return typeof Se=="function"&&(Se=Se(X)),Ce(Se)}).then(function(Ce){var Se=X.uid,pe=se.customRequest||W,ue=Promise.resolve(Te(X)).then(function(te){var fe=se.data;return typeof fe=="function"&&(fe=fe(te)),Promise.all([te,fe])}).catch(function(te){console.error(te)});ue.then(function(te){var fe=d(te,2),ae=fe[0],_e=fe[1],De={action:Ce,filename:se.name,data:_e,file:ae,headers:se.headers,withCredentials:se.withCredentials,method:se.method||"post",onProgress:Ae?function(xe){Ae(xe,X)}:null,onSuccess:function(Oe,Ie){delete q.reqs[Se],se.onSuccess(Oe,X,Ie)},onError:function(Oe,Ie){delete q.reqs[Se],se.onError(Oe,Ie,X)}};he(X),q.reqs[Se]=pe(De)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(X){var q=this.reqs;if(X){var se=X;X&&X.uid&&(se=X.uid),q[se]&&q[se].abort&&q[se].abort(),delete q[se]}else Object.keys(q).forEach(function(he){q[he]&&q[he].abort&&q[he].abort(),delete q[he]})}},{key:"render",value:function(){var X,q=this.props,se=q.component,he=q.prefixCls,Ae=q.className,be=q.disabled,Te=q.id,Ce=q.style,Se=q.multiple,pe=q.accept,ue=q.children,te=q.directory,fe=q.openFileDialogOnClick,ae=q.onMouseEnter,_e=q.onMouseLeave,De=h(q,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=Y()((X={},s(X,he,!0),s(X,he+"-disabled",be),s(X,Ae,Ae),X)),Oe=be?{}:{onClick:fe?this.onClick:function(){},onKeyDown:fe?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:_e,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(se,E({},Oe,{className:xe,role:"button",style:Ce}),$.a.createElement("input",E({},k(De),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(Ue){return Ue.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:pe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Se,onChange:this.onChange})),ue)}}]),I}(ne.Component),g=b,c=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(K[X]=N[X])}return K},u=function(){function K(I,N){for(var X=0;X<N.length;X++){var q=N[X];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(I,q.key,q)}}return function(I,N,X){return N&&K(I.prototype,N),X&&K(I,X),I}}();function o(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function T(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function S(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}function m(){}var O=function(K){S(I,K);function I(){var N,X,q,se;o(this,I);for(var he=arguments.length,Ae=Array(he),be=0;be<he;be++)Ae[be]=arguments[be];return se=(X=(q=T(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(Ae))),q),q.saveUploader=function(Te){q.uploader=Te},X),T(q,se)}return u(I,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return $.a.createElement(g,c({},this.props,{ref:this.saveUploader}))}}]),I}(ne.Component);O.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:m,onError:m,onSuccess:m,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=O,j=$e.a=U},H38U:function(lt,$e,re){var ne=re("f4xo"),$=re("rcnY"),D=re("wU8J"),Y=re("Iq15"),F=re("dWSS");function R(B,P){this.typeNumber=B,this.errorCorrectLevel=P,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var W=R.prototype;W.addData=function(B){var P=new ne(B);this.dataList.push(P),this.dataCache=null},W.isDark=function(B,P){if(B<0||this.moduleCount<=B||P<0||this.moduleCount<=P)throw new Error(B+","+P);return this.modules[B][P]},W.getModuleCount=function(){return this.moduleCount},W.make=function(){if(this.typeNumber<1){var B=1;for(B=1;B<40;B++){for(var P=$.getRSBlocks(B,this.errorCorrectLevel),A=new D,f=0,x=0;x<P.length;x++)f+=P[x].dataCount;for(var x=0;x<this.dataList.length;x++){var M=this.dataList[x];A.put(M.mode,4),A.put(M.getLength(),Y.getLengthInBits(M.mode,B)),M.write(A)}if(A.getLengthInBits()<=f*8)break}this.typeNumber=B}this.makeImpl(!1,this.getBestMaskPattern())},W.makeImpl=function(B,P){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var A=0;A<this.moduleCount;A++){this.modules[A]=new Array(this.moduleCount);for(var f=0;f<this.moduleCount;f++)this.modules[A][f]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(B,P),this.typeNumber>=7&&this.setupTypeNumber(B),this.dataCache==null&&(this.dataCache=R.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,P)},W.setupPositionProbePattern=function(B,P){for(var A=-1;A<=7;A++){if(B+A<=-1||this.moduleCount<=B+A)continue;for(var f=-1;f<=7;f++){if(P+f<=-1||this.moduleCount<=P+f)continue;0<=A&&A<=6&&(f==0||f==6)||0<=f&&f<=6&&(A==0||A==6)||2<=A&&A<=4&&2<=f&&f<=4?this.modules[B+A][P+f]=!0:this.modules[B+A][P+f]=!1}}},W.getBestMaskPattern=function(){for(var B=0,P=0,A=0;A<8;A++){this.makeImpl(!0,A);var f=Y.getLostPoint(this);(A==0||B>f)&&(B=f,P=A)}return P},W.createMovieClip=function(B,P,A){var f=B.createEmptyMovieClip(P,A),x=1;this.make();for(var M=0;M<this.modules.length;M++)for(var w=M*x,C=0;C<this.modules[M].length;C++){var E=C*x,d=this.modules[M][C];d&&(f.beginFill(0,100),f.moveTo(E,w),f.lineTo(E+x,w),f.lineTo(E+x,w+x),f.lineTo(E,w+x),f.endFill())}return f},W.setupTimingPattern=function(){for(var B=8;B<this.moduleCount-8;B++){if(this.modules[B][6]!=null)continue;this.modules[B][6]=B%2==0}for(var P=8;P<this.moduleCount-8;P++){if(this.modules[6][P]!=null)continue;this.modules[6][P]=P%2==0}},W.setupPositionAdjustPattern=function(){for(var B=Y.getPatternPosition(this.typeNumber),P=0;P<B.length;P++)for(var A=0;A<B.length;A++){var f=B[P],x=B[A];if(this.modules[f][x]!=null)continue;for(var M=-2;M<=2;M++)for(var w=-2;w<=2;w++)M==-2||M==2||w==-2||w==2||M==0&&w==0?this.modules[f+M][x+w]=!0:this.modules[f+M][x+w]=!1}},W.setupTypeNumber=function(B){for(var P=Y.getBCHTypeNumber(this.typeNumber),A=0;A<18;A++){var f=!B&&(P>>A&1)==1;this.modules[Math.floor(A/3)][A%3+this.moduleCount-8-3]=f}for(var A=0;A<18;A++){var f=!B&&(P>>A&1)==1;this.modules[A%3+this.moduleCount-8-3][Math.floor(A/3)]=f}},W.setupTypeInfo=function(B,P){for(var A=this.errorCorrectLevel<<3|P,f=Y.getBCHTypeInfo(A),x=0;x<15;x++){var M=!B&&(f>>x&1)==1;x<6?this.modules[x][8]=M:x<8?this.modules[x+1][8]=M:this.modules[this.moduleCount-15+x][8]=M}for(var x=0;x<15;x++){var M=!B&&(f>>x&1)==1;x<8?this.modules[8][this.moduleCount-x-1]=M:x<9?this.modules[8][15-x-1+1]=M:this.modules[8][15-x-1]=M}this.modules[this.moduleCount-8][8]=!B},W.mapData=function(B,P){for(var A=-1,f=this.moduleCount-1,x=7,M=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var C=0;C<2;C++)if(this.modules[f][w-C]==null){var E=!1;M<B.length&&(E=(B[M]>>>x&1)==1);var d=Y.getMask(P,f,w-C);d&&(E=!E),this.modules[f][w-C]=E,x--,x==-1&&(M++,x=7)}if(f+=A,f<0||this.moduleCount<=f){f-=A,A=-A;break}}},R.PAD0=236,R.PAD1=17,R.createData=function(B,P,A){for(var f=$.getRSBlocks(B,P),x=new D,M=0;M<A.length;M++){var w=A[M];x.put(w.mode,4),x.put(w.getLength(),Y.getLengthInBits(w.mode,B)),w.write(x)}for(var C=0,M=0;M<f.length;M++)C+=f[M].dataCount;if(x.getLengthInBits()>C*8)throw new Error("code length overflow. ("+x.getLengthInBits()+">"+C*8+")");for(x.getLengthInBits()+4<=C*8&&x.put(0,4);x.getLengthInBits()%8!=0;)x.putBit(!1);for(;!(x.getLengthInBits()>=C*8);){if(x.put(R.PAD0,8),x.getLengthInBits()>=C*8)break;x.put(R.PAD1,8)}return R.createBytes(x,f)},R.createBytes=function(B,P){for(var A=0,f=0,x=0,M=new Array(P.length),w=new Array(P.length),C=0;C<P.length;C++){var E=P[C].dataCount,d=P[C].totalCount-E;f=Math.max(f,E),x=Math.max(x,d),M[C]=new Array(E);for(var a=0;a<M[C].length;a++)M[C][a]=255&B.buffer[a+A];A+=E;var s=Y.getErrorCorrectPolynomial(d),h=new F(M[C],s.getLength()-1),L=h.mod(s);w[C]=new Array(s.getLength()-1);for(var a=0;a<w[C].length;a++){var p=a+L.getLength()-w[C].length;w[C][a]=p>=0?L.get(p):0}}for(var v=0,a=0;a<P.length;a++)v+=P[a].totalCount;for(var k=new Array(v),b=0,a=0;a<f;a++)for(var C=0;C<P.length;C++)a<M[C].length&&(k[b++]=M[C][a]);for(var a=0;a<x;a++)for(var C=0;C<P.length;C++)a<w[C].length&&(k[b++]=w[C][a]);return k},lt.exports=R},HmJG:function(lt,$e,re){},Iq15:function(lt,$e,re){var ne=re("nVVt"),$=re("dWSS"),D=re("dQei"),Y={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(R){for(var W=R<<10;F.getBCHDigit(W)-F.getBCHDigit(F.G15)>=0;)W^=F.G15<<F.getBCHDigit(W)-F.getBCHDigit(F.G15);return(R<<10|W)^F.G15_MASK},getBCHTypeNumber:function(R){for(var W=R<<12;F.getBCHDigit(W)-F.getBCHDigit(F.G18)>=0;)W^=F.G18<<F.getBCHDigit(W)-F.getBCHDigit(F.G18);return R<<12|W},getBCHDigit:function(R){for(var W=0;R!=0;)W++,R>>>=1;return W},getPatternPosition:function(R){return F.PATTERN_POSITION_TABLE[R-1]},getMask:function(R,W,B){switch(R){case Y.PATTERN000:return(W+B)%2==0;case Y.PATTERN001:return W%2==0;case Y.PATTERN010:return B%3==0;case Y.PATTERN011:return(W+B)%3==0;case Y.PATTERN100:return(Math.floor(W/2)+Math.floor(B/3))%2==0;case Y.PATTERN101:return W*B%2+W*B%3==0;case Y.PATTERN110:return(W*B%2+W*B%3)%2==0;case Y.PATTERN111:return(W*B%3+(W+B)%2)%2==0;default:throw new Error("bad maskPattern:"+R)}},getErrorCorrectPolynomial:function(R){for(var W=new $([1],0),B=0;B<R;B++)W=W.multiply(new $([1,D.gexp(B)],0));return W},getLengthInBits:function(R,W){if(1<=W&&W<10)switch(R){case ne.MODE_NUMBER:return 10;case ne.MODE_ALPHA_NUM:return 9;case ne.MODE_8BIT_BYTE:return 8;case ne.MODE_KANJI:return 8;default:throw new Error("mode:"+R)}else if(W<27)switch(R){case ne.MODE_NUMBER:return 12;case ne.MODE_ALPHA_NUM:return 11;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 10;default:throw new Error("mode:"+R)}else if(W<41)switch(R){case ne.MODE_NUMBER:return 14;case ne.MODE_ALPHA_NUM:return 13;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 12;default:throw new Error("mode:"+R)}else throw new Error("type:"+W)},getLostPoint:function(R){for(var W=R.getModuleCount(),B=0,P=0;P<W;P++)for(var A=0;A<W;A++){for(var f=0,x=R.isDark(P,A),M=-1;M<=1;M++){if(P+M<0||W<=P+M)continue;for(var w=-1;w<=1;w++){if(A+w<0||W<=A+w)continue;if(M==0&&w==0)continue;x==R.isDark(P+M,A+w)&&f++}}f>5&&(B+=3+f-5)}for(var P=0;P<W-1;P++)for(var A=0;A<W-1;A++){var C=0;R.isDark(P,A)&&C++,R.isDark(P+1,A)&&C++,R.isDark(P,A+1)&&C++,R.isDark(P+1,A+1)&&C++,(C==0||C==4)&&(B+=3)}for(var P=0;P<W;P++)for(var A=0;A<W-6;A++)R.isDark(P,A)&&!R.isDark(P,A+1)&&R.isDark(P,A+2)&&R.isDark(P,A+3)&&R.isDark(P,A+4)&&!R.isDark(P,A+5)&&R.isDark(P,A+6)&&(B+=40);for(var A=0;A<W;A++)for(var P=0;P<W-6;P++)R.isDark(P,A)&&!R.isDark(P+1,A)&&R.isDark(P+2,A)&&R.isDark(P+3,A)&&R.isDark(P+4,A)&&!R.isDark(P+5,A)&&R.isDark(P+6,A)&&(B+=40);for(var E=0,A=0;A<W;A++)for(var P=0;P<W;P++)R.isDark(P,A)&&E++;var d=Math.abs(100*E/W/W-50)/5;return B+=d*10,B}};lt.exports=F},LdHM:function(lt,$e,re){"use strict";re.d($e,"b",function(){return h}),re.d($e,"a",function(){return p});var ne=re("1OyB"),$=re("vuIU"),D=re("Ji7U"),Y=re("LK+K"),F=re("q1tI"),R=re("rePB"),W=re("Ff2n"),B=re("ODXe"),P=re("4IlW"),A=re("bX4T"),f=re("YrtM"),x=re("TSYQ"),M=re.n(x),w=re("+nKL"),C=re("8OUc"),E=function(X,q){var se=X.prefixCls,he=X.id,Ae=X.flattenOptions,be=X.childrenAsData,Te=X.values,Ce=X.searchValue,Se=X.multiple,pe=X.defaultActiveFirstOption,ue=X.height,te=X.itemHeight,fe=X.notFoundContent,ae=X.open,_e=X.menuItemSelectedIcon,De=X.virtual,xe=X.onSelect,Oe=X.onToggleOpen,Ie=X.onActiveValue,Ue=X.onScroll,We=X.onMouseEnter,Be="".concat(se,"-item"),Fe=Object(f.a)(function(){return Ae},[ae,Ae],function(Ve,Ee){return Ee[0]&&Ve[1]!==Ee[1]}),it=F.useRef(null),et=function(Ee){Ee.preventDefault()},qe=function(Ee){it.current&&it.current.scrollTo({index:Ee})},Qe=function(Ee){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ye=Fe.length,ie=0;ie<ye;ie+=1){var oe=(Ee+ie*ge+ye)%ye,le=Fe[oe],de=le.group,Le=le.data;if(!de&&!Le.disabled)return oe}return-1},ot=F.useState(function(){return Qe(0)}),Ze=Object(B.a)(ot,2),at=Ze[0],Pe=Ze[1],dt=function(Ee){Pe(Ee);var ge=Fe[Ee];if(!ge){Ie(null,-1);return}Ie(ge.data.value,Ee)};F.useEffect(function(){dt(pe!==!1?Qe(0):-1)},[Fe.length,Ce]),F.useEffect(function(){var Ve=setTimeout(function(){if(!Se&&ae&&Te.size===1){var Ee=Array.from(Te)[0],ge=Fe.findIndex(function(ye){var ie=ye.data;return ie.value===Ee});dt(ge),qe(ge)}});return function(){return clearTimeout(Ve)}},[ae]);var st=function(Ee){Ee!==void 0&&xe(Ee,{selected:!Te.has(Ee)}),Se||Oe(!1)};if(F.useImperativeHandle(q,function(){return{onKeyDown:function(Ee){var ge=Ee.which;switch(ge){case P.a.UP:case P.a.DOWN:{var ye=0;if(ge===P.a.UP?ye=-1:ge===P.a.DOWN&&(ye=1),ye!==0){var ie=Qe(at+ye,ye);qe(ie),dt(ie)}break}case P.a.ENTER:{var oe=Fe[at];oe&&!oe.data.disabled?st(oe.data.value):st(void 0),ae&&Ee.preventDefault();break}case P.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(Ee){qe(Ee)}}}),Fe.length===0)return F.createElement("div",{role:"listbox",id:"".concat(he,"_list"),className:"".concat(Be,"-empty"),onMouseDown:et},fe);function Ne(Ve){var Ee=Fe[Ve];if(!Ee)return null;var ge=Ee.data||{},ye=ge.value,ie=ge.label,oe=ge.children,le=Object(A.a)(ge,!0),de=be?oe:ie;return Ee?F.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},le,{key:Ve,role:"option",id:"".concat(he,"_list_").concat(Ve),"aria-selected":Te.has(ye)}),ye):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(he,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ne(at-1),Ne(at),Ne(at+1)),F.createElement(w.a,{itemKey:"key",ref:it,data:Fe,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:et,onScroll:Ue,virtual:De,onMouseEnter:We},function(Ve,Ee){var ge,ye=Ve.group,ie=Ve.groupOption,oe=Ve.data,le=oe.label,de=oe.key;if(ye)return F.createElement("div",{className:M()(Be,"".concat(Be,"-group"))},le!==void 0?le:de);var Le=oe.disabled,Me=oe.value,Ye=oe.title,yt=oe.children,At=oe.style,Ge=oe.className,xt=Object(W.a)(oe,["disabled","value","title","children","style","className"]),mt=Te.has(Me),nt="".concat(Be,"-option"),Rt=M()(Be,nt,Ge,(ge={},Object(R.a)(ge,"".concat(nt,"-grouped"),ie),Object(R.a)(ge,"".concat(nt,"-active"),at===Ee&&!Le),Object(R.a)(ge,"".concat(nt,"-disabled"),Le),Object(R.a)(ge,"".concat(nt,"-selected"),mt),ge)),Lt=be?yt:le,Kt=!_e||typeof _e=="function"||mt;return F.createElement("div",Object.assign({},xt,{"aria-selected":mt,className:Rt,title:Ye,onMouseMove:function(){if(at===Ee||Le)return;dt(Ee)},onClick:function(){Le||st(Me)},style:At}),F.createElement("div",{className:"".concat(nt,"-content")},Lt||Me),F.isValidElement(_e)||mt,Kt&&F.createElement(C.a,{className:"".concat(Be,"-option-state"),customizeIcon:_e,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=F.forwardRef(E);d.displayName="OptionList";var a=d,s=function(){return null};s.isSelectOption=!0;var h=s,L=function(){return null};L.isSelectOptGroup=!0;var p=L,v=re("VTBJ"),k=re("Zm9Q");function b(N){var X=N.key,q=N.props,se=q.children,he=q.value,Ae=Object(W.a)(q,["children","value"]);return Object(v.a)({key:X,value:he!==void 0?he:X,children:se},Ae)}function g(N){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(N).map(function(q,se){if(!F.isValidElement(q)||!q.type)return null;var he=q.type.isSelectOptGroup,Ae=q.key,be=q.props,Te=be.children,Ce=Object(W.a)(be,["children"]);return X||!he?b(q):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Ae===null?se:Ae,"__"),label:Ae},Ce),{},{options:g(Te)})}).filter(function(q){return q})}var c=re("2Qr1"),u=re("qNPg"),o=re("U8pU"),T=re("Kwbf"),S=re("WKfj");function m(N){var X=N.mode,q=N.options,se=N.children,he=N.backfill,Ae=N.allowClear,be=N.placeholder,Te=N.getInputElement,Ce=N.showSearch,Se=N.onSearch,pe=N.defaultOpen,ue=N.autoFocus,te=N.labelInValue,fe=N.value,ae=N.inputValue,_e=N.optionLabelProp,De=X==="multiple"||X==="tags",xe=Ce!==void 0?Ce:De||X==="combobox",Oe=q||g(se);if(Object(T.a)(X!=="tags"||Oe.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Ie=Oe.some(function(Be){return Be.options?Be.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(T.a)(!Ie,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)(X!=="combobox"||!_e,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)(X==="combobox"||!he,"`backfill` only works with `combobox` mode."),Object(T.a)(X==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(T.b)(X!=="combobox"||!Te||!Ae||!be,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!xe&&X!=="combobox"&&X!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!pe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),fe!=null){var Ue=Object(S.d)(fe);Object(T.a)(!te||Ue.every(function(Be){return Object(o.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!De||Array.isArray(fe),"`value` should be array when `mode` is `multiple` or `tags`")}if(se){var We=null;Object(k.a)(se).some(function(Be){if(!F.isValidElement(Be)||!Be.type)return!1;var Fe=Be.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var it=Object(k.a)(Be.props.children).every(function(et){return!F.isValidElement(et)||!Be.type||et.type.isSelectOption?!0:(We=et.type,!1)});return!it}return We=Fe,!0}),We&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(We.displayName||We.name||We,"`.")),Object(T.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var O=m,U=Object(u.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:g,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:O,fillOptionsWithMissingValue:c.a}),j=function(N){Object(D.a)(q,N);var X=Object(Y.a)(q);function q(){var se;return Object(ne.a)(this,q),se=X.apply(this,arguments),se.selectRef=F.createRef(),se.focus=function(){se.selectRef.current.focus()},se.blur=function(){se.selectRef.current.blur()},se}return Object($.a)(q,[{key:"render",value:function(){return F.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),q}(F.Component);j.Option=h,j.OptGroup=p;var K=j,I=$e.c=K},M8RZ:function(lt,$e,re){"use strict";re.d($e,"a",function(){return P});var ne=re("fWQN"),$=re("mtLc"),D=re("yKVA"),Y=re("879j"),F=re("q1tI"),R=re.n(F),W=re("i8i4"),B=re.n(W),P=function(A){Object(D.a)(x,A);var f=Object(Y.a)(x);function x(M){var w;Object(ne.a)(this,x),w=f.call(this,M);var C=window.document;return w.node=C.createElement("div"),C.body.appendChild(w.node),w}return Object($.a)(x,[{key:"render",value:function(){var w=this.props.children;return Object(W.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),x}(R.a.Component)},Ot1p:function(lt,$e,re){"use strict";var ne=re("2qtc"),$=re("kLXV"),D=re("rAM+"),Y=re("miYZ"),F=re("tsqr"),R=re("9og8"),W=re("tJVT"),B=re("jrin"),P=re("WmNS"),A=re.n(P),f=re("q1tI"),x=re.n(f),M=re("VrN/"),w=re.n(M),C=re("bdgK"),E=re("p77/"),d=re("Bd2K"),a=re("ELLl"),s=re("19Vz"),h=re("lZu9"),L=re("+NIl"),p=re("kSUc"),v=re("9Bee"),k=function(Ge){var xt=Ge.value,mt=xt===void 0?"":xt,nt=Ge.className,Rt=Ge.showTextOnly,Lt=Ge.showLines,Kt=Ge.style,Bt=Kt===void 0?{}:Kt,wt=Object(f.useMemo)(function(){return""},[mt]);return x.a.createElement(x.a.Fragment,null,x.a.createElement("div",{dangerouslySetInnerHTML:{__html:wt}}))},b=re("Q9mQ"),g=re("diRs"),c=re("0Owb"),u=re("dejd"),o=re("C+DQ"),T=re("D1Df"),S=re.n(T),m=re("1vsH"),O=re("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 j(Ge){var xt=Ge.onActionCallback,mt=Ge.title,nt=Ge.icon,Rt=Ge.actionName,Lt=Ge.className,Kt=Lt===void 0?"":Lt,Bt=Ge.children;function wt(){xt(Rt)}return x.a.createElement("a",{title:mt,className:Kt,onClick:wt},x.a.createElement("i",{className:"md-iconfont ".concat(nt)}),Bt)}var K=function(Ge){var xt=Ge.watch,mt=Ge.showNullButton,nt=Ge.onActionCallback,Rt=Ge.fullScreen,Lt=Ge.insertTemp,Kt=Ge.hidetoolBar,Bt=Ge.uuid,wt=Ge.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(m.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.E)("_educoder_session"),"&key=").concat(Bt,"&api=").concat(encodeURIComponent(O.a.PROXY_SERVER)));var yr=[].concat(U,[{title:"".concat(xt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(xt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return x.a.createElement("ul",{className:"markdown-toolbar-container"},!Kt&&yr.map(function(ir,gt){return x.a.createElement("li",{key:gt},ir.actionName?x.a.createElement(j,Object(c.a)({},ir,{onActionCallback:nt})):x.a.createElement("span",{className:"v-line"}))}),mt?x.a.createElement("li",null,x.a.createElement(j,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:nt},x.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Lt&&x.a.createElement("li",null,x.a.createElement(j,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Lt),onActionCallback:nt},x.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),x.a.createElement("li",null,x.a.createElement(g.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:x.a.createElement("div",null,x.a.createElement(S.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(m.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(m.E)("_educoder_session"),"&key=").concat(Bt,"&api=").concat(encodeURIComponent(O.a.PROXY_SERVER))}))},x.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return wt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),x.a.createElement("li",{className:"btn-full-screen"},x.a.createElement(j,{icon:"".concat(Rt?"icon-shrink":"icon-enlarge"),title:Rt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:nt})))},I=re("M8RZ"),N=re("+L6B"),X=re("2/Rp"),q=re("y8nQ"),se=re("Vl3Y"),he=re("5NDa"),Ae=re("5rEg"),be={labelCol:{span:4},wrapperCol:{span:20}},Te=function(Ge){var xt=Ge.callback,mt=Ge.onCancel;function nt(Rt){xt(Rt)}return x.a.createElement(se.a,Object(c.a)({},be,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:nt}),x.a.createElement(se.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},x.a.createElement(Ae.a,null)),x.a.createElement(se.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},x.a.createElement(Ae.a,null)),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},Ce=re("7ahc"),Se=re("k1fw"),pe=re("HmJG"),ue=re("BjJ7"),te=se.a.useForm,fe={width:280,marginRight:10},ae={labelCol:{span:5},wrapperCol:{span:19}},_e=function(Ge){var xt=Ge.callback,mt=Ge.onCancel,nt=te(),Rt=Object(W.a)(nt,1),Lt=Rt[0],Kt=Object(f.useRef)();function Bt(ir){xt(Object(Se.a)(Object(Se.a)({},ir),{},{name:Kt.current}))}function wt(ir,gt){Lt.setFieldsValue({src:"/api/attachments/".concat(ir.id,"?type=").concat(ir.content_type),type:gt.type})}function yr(ir){var gt=ir.target.files[0];Kt.current=gt.name,xe(gt,wt)}return x.a.createElement(se.a,Object(c.a)({form:Lt},ae,{className:"upload-image-panel",onFinish:Bt}),x.a.createElement(se.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},x.a.createElement("div",{className:"flex-container"},x.a.createElement(se.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},x.a.createElement(Ae.a,{style:fe})),x.a.createElement(De,{onFileChange:yr}))),x.a.createElement(se.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},x.a.createElement(Ae.a,{style:{width:264}})),x.a.createElement(se.a.Item,{style:{textAlign:"right"}},x.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))};function De(Ge){var xt=Ge.onFileChange;return x.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",x.a.createElement("input",{type:"file",onChange:xt}))}function xe(Ge,xt){if(!Ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var mt=new FormData;mt.append("editormd-image-file",Ge),mt.append("file_param_name","editormd-image-file"),mt.append("byxhr","true");var nt=new window.XMLHttpRequest;nt.withCredentials=!0,nt.addEventListener("load",function(Rt){xt(JSON.parse(Rt.target.responseText),Ge)},!1),nt.addEventListener("error",function(Rt){console.error(Rt)},!1),nt.open("POST","".concat(ue.a,"/api/attachments.json")),nt.send(mt)}var Oe=re("giR+"),Ie=re("fyUT"),Ue=re("7Kak"),We=re("9yH6"),Be=We.a.Group,Fe={margin:"0 8px"},it=function(Ge){var xt=Ge.callback,mt=Ge.onCancel;function nt(Rt){xt(Rt)}return x.a.createElement(se.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:nt},x.a.createElement("div",{className:"flex-container"},x.a.createElement("span",{style:Fe},"\u5355\u5143\u683C\u6570\uFF1A"),x.a.createElement("span",{style:Fe},"\u884C\u6570"),x.a.createElement(se.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},x.a.createElement(Ie.a,null)),x.a.createElement("span",{style:Fe},"\u5217\u6570"),x.a.createElement(se.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},x.a.createElement(Ie.a,null))),x.a.createElement("div",{className:"flex-container",style:{marginTop:12}},x.a.createElement("span",{style:Fe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),x.a.createElement(se.a.Item,{name:"align"},x.a.createElement(Be,null,x.a.createElement(We.a,{value:"default"},x.a.createElement("i",{className:"fa fa-align-justify"})),x.a.createElement(We.a,{value:"left"},x.a.createElement("i",{className:"fa fa-align-left"})),x.a.createElement(We.a,{value:"center"},x.a.createElement("i",{className:"fa fa-align-center"})),x.a.createElement(We.a,{value:"right"},x.a.createElement("i",{className:"fa fa-align-right"}))))),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(X.a,{type:"ghost",onClick:mt},"\u53D6\u6D88")))},et=re("ErOA"),qe=re("7Cbv"),Qe="link",ot="upload-image",Ze="code-block",at="add-table",Pe="------------",dt={default:Pe,left:":".concat(Pe),center:":".concat(Pe,":"),right:"".concat(Pe,":")},st=re("9VGf"),Ne,Ve;function Ee(){}var ge=0,ye=1e4,ie="\u2581",oe=`
**\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 le(Ge){return/^\d+$/.test(Ge)?"".concat(Ge,"px"):Ge}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,Le=de?"Cmd":"Ctrl",Me=["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"],Ye=(Ne={},Object(B.a)(Ne,Le+"-B","bold"),Object(B.a)(Ne,Le+"-I","italic"),Ne),yt=(Ve={},Object(B.a)(Ve,Qe,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(Ve,Ze,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(Ve,ot,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(Ve,at,"\u6DFB\u52A0\u8868\u683C"),Ve),At=$e.a=function(Ge){var xt=Ge.defaultValue,mt=xt===void 0?"":xt,nt=Ge.onChange,Rt=Ge.width,Lt=Rt===void 0?"100%":Rt,Kt=Ge.height,Bt=Kt===void 0?400:Kt,wt=Ge.miniToolbar,yr=wt===void 0?!1:wt,ir=Ge.isFocus,gt=ir===void 0?!1:ir,Gr=Ge.watch,br=Ge.insertTemp,fr=Ge.mode,Tr=fr===void 0?"markdown":fr,si=Ge.id,Kr=si===void 0?"markdown-editor-id":si,It=Ge.showResizeBar,ft=It===void 0?!1:It,Ur=Ge.noStorage,li=Ur===void 0?!1:Ur,wr=Ge.showNullButton,Ot=wr===void 0?!1:wr,Vr=Ge.hidetoolBar,ui=Vr===void 0?!1:Vr,gi=Ge.fullScreen,Xe=gi===void 0?!1:gi,St=Ge.onBlur,ei=Ge.onCMBeforeChange,hi=Ge.onFullScreen,di=Ge.className,Di=di===void 0?"":di,V=Ge.disablePaste,l=V===void 0?!1:V,y=Ge.placeholder,z=y===void 0?"":y,Z=Ge.values,G=Z===void 0?"":Z,ve=Object(f.useState)(null),He=Object(W.a)(ve,2),Re=He[0],ct=He[1],ze=Object(f.useState)(mt),Ct=Object(W.a)(ze,2),Mt=Ct[0],Wt=Ct[1],Fr=Object(f.useState)(Gr),jr=Object(W.a)(Fr,2),sr=jr[0],Xr=jr[1],Ki=Object(f.useState)(Xe),Ar=Object(W.a)(Ki,2),_r=Ar[0],ti=Ar[1],vi=Object(f.useState)(""),$r=Object(W.a)(vi,2),ri=$r[0],Wr=$r[1],fn=Object(f.useState)(0),Vi=Object(W.a)(fn,2),Pr=Vi[0],Mr=Vi[1],Ri=Object(f.useState)(Bt),Oi=Object(W.a)(Ri,2),Pi=Oi[0],qt=Oi[1],Ut=Object(f.useState)(!1),pr=Object(W.a)(Ut,2),Ft=pr[0],mr=pr[1],Xt=Object(f.useRef)(Object(qe.a)()),yi=Object(f.useRef)(!1),nr=Object(f.useRef)(),ar=Object(f.useRef)(),ii=Object(f.useRef)(),bi=Object(f.useRef)(),xi=Object(f.useRef)(),Fn=function(){var pt=Object(R.a)(A.a.mark(function Tt(){var bt,kt;return A.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(et.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Xt.current}});case 2:kt=Ht.sent,kt!=null&&(bt=kt.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",Re,ar),kt.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?Re.replaceSelection("![,](/api/attachments/".concat(Pt.id,"?type=").concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?Re.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Pt.content_type.indexOf("pdf")>-1?Re.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):Re.replaceSelection("[".concat(Pt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return Ht.stop()}},Tt)}));return function(){return pt.apply(this,arguments)}}();Object(f.useEffect)(function(){Wt(G),Re==null||Re.setValue(G)},[G]),Object(f.useEffect)(function(){hi==null||hi(_r)},[_r]),Object(f.useEffect)(function(){if(ar.current){var pt=w.a.fromTextArea(ar.current,{mode:Tr,lineNumbers:!yr,lineWrapping:!0,value:mt,autoCloseTags:!0,autoCloseBrackets:!0});gt&&pt.focus();function Tt(bt,kt){if(l){kt.preventDefault();return}var Nt=kt.clipboardData;if(Nt){var Ht=Nt.types.toString(),Pt=Nt.items;if(Ht==="Files"||Nt.types.indexOf("Files")>-1){if(kt.preventDefault(),Tr=="stex")return;try{var Qt,lr=Pt[1];((Qt=Pt[0])===null||Qt===void 0?void 0:Qt.kind)==="file"&&(lr=Pt[0]);var Dt=lr.getAsFile(),Mi=Dt.name.split(".").pop();xe(Dt,function(zt){if(zt.id){var gr,Vt,Yr;(Dt==null||((gr=Dt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?pt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Dt==null||((Vt=Dt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Dt==null||((Yr=Dt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Dt.type,'&disposition=inline" target="_blank">').concat(Dt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Dt.name,"</a>")):pt.replaceSelection("[".concat(Dt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return pt.on("paste",Tt),pt.on("dragleave",function(bt,kt){ii.current.classList.remove("mouse-hover-md")}),pt.on("dragover",function(bt,kt){ii.current.classList.add("mouse-hover-md")}),pt.on("drop",function(bt,kt){ii.current.classList.add("mouse-hover-md");var Nt;if(Nt=kt.dataTransfer.files,Nt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Ht=function(lr){var Dt=Nt[lr],Mi=Dt.name.split(".").pop();xe(Dt,function(zt){if(zt.id){var gr,Vt,Yr;(Dt==null||((gr=Dt.type)===null||gr===void 0)?void 0:gr.indexOf("image"))>-1?pt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Dt==null||((Vt=Dt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?pt.replaceSelection('<video width="100%" controls src="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Dt==null||((Yr=Dt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Dt.type,'&disposition=inline" target="_blank">').concat(Dt.name,"</a>")):Me.includes(Mi)?pt.replaceSelection('<a href="'.concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Dt.name,"</a>")):pt.replaceSelection("[".concat(Dt.name,"](").concat(O.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt<Nt.length;Pt++)Ht(Pt)}}),ct(pt),function(){pt.off("paste",Tt)}}},[]);var Qr=Object(f.useCallback)(function(){if(ii.current)try{}catch(pt){console.log(pt,"---- to set md editor body height")}},[Pi,ii,_r]);Object(f.useEffect)(function(){function pt(){var bt=new C.default(function(kt){var Nt=Object(D.a)(kt),Ht;try{for(Nt.s();!(Ht=Nt.n()).done;){var Pt=Ht.value;(Pt.target.offsetHeight>0||Pt.target.offsetWidth>0)&&(Qr(),Re.setSize("100%","100%"),Re.refresh())}}catch(Qt){Nt.e(Qt)}finally{Nt.f()}});return bt.observe(ar.current.parentElement),bt}if(Re){var Tt=pt();return function(){Tt.unobserve(ar.current.parentElement)}}},[Re,Qr]),Object(f.useEffect)(function(){if(Re){for(var pt=[],Tt=function(){var Pt=kt[bt];Nt=Object(W.a)(Pt,2);var Qt=Nt[0],lr=Nt[1],Dt=Object(B.a)({},Qt,function(){Xi(lr)});pt.push(Dt),Re.addKeyMap(Dt)},bt=0,kt=Object.entries(Ye);bt<kt.length;bt++){var Nt;Tt()}return nr.current=setInterval(function(){yi.current&&Fn()},4e3),function(){clearInterval(nr.current);var Ht=Object(D.a)(pt),Pt;try{for(Ht.s();!(Pt=Ht.n()).done;){var Qt=Pt.value;Re.removeKeyMap(Qt)}}catch(lr){Ht.e(lr)}finally{Ht.f()}}}},[Re]),Object(f.useEffect)(function(){Xe!==_r&&ti(Xe)},[Xe]),Object(st.a)(function(){if(!li&&Pr>0){var pt=new Date().getTime(),Tt=window.sessionStorage.getItem(Kr);pt>=Pr+ye&&(!Tt||Tt!==Mt)&&(window.sessionStorage.setItem(Kr,Mt),mr(!0))}},ye),Object(f.useEffect)(function(){Xr(Gr)},[Re,Gr]),Object(f.useEffect)(function(){Re&&(gt&&Re.focus())},[Re,gt]),Object(f.useEffect)(function(){if(sr&&Re){var pt=Re.getScrollerElement();function Tt(bt){var kt=bt.target;if(xi.current){var Nt=kt.scrollTop/kt.scrollHeight;xi.current.scrollTop=xi.current.scrollHeight*Nt}}return pt.addEventListener("scroll",Tt),function(){pt.removeEventListener("scroll",Tt)}}},[Re,sr]),Object(f.useEffect)(function(){if(Re&&ei){function pt(Tt,bt){ei(Tt,bt)}return Re.on("beforeChange",pt),function(){Re.off("beforeChange",pt)}}},[Re,ei]),Object(f.useEffect)(function(){if(Re&&St){function pt(){St(Re.getValue())}return Re.on("blur",pt),function(){Re.off("blur",pt)}}},[Re,St]),Object(f.useEffect)(function(){if(Re){function pt(Tt){var bt=Tt.getValue();Wt(bt),Mr(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),nt&&nt(bt)}return Re.on("change",pt),function(){Re.off("change",pt)}}},[Re,nt]),Object(f.useEffect)(function(){Re&&(mt==null?(Re.setValue(""),Wt("")):mt!==Re.getValue()&&(Re.setValue(mt),Wt(mt),Re.setCursor(Re.lineCount(),0)))},[Re,mt]);var Xi=Object(f.useCallback)(function(pt){var Tt=Re.getCursor(),bt=Re.getSelection(),kt=bt.split(`
`);switch(pt){case"bold":return Re.replaceSelection("**"+bt+"**"),bt===""&&Re.setCursor(Tt.line,Tt.ch+2),Re.focus();case"italic":return Re.replaceSelection("*"+bt+"*"),bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.focus();case"code":return Re.replaceSelection("`"+bt+"`"),bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.focus();case"inline-latex":return Re.replaceSelection("`$$"+bt+"$$`"),bt===""&&Re.setCursor(Tt.line,Tt.ch+3),Re.focus();case"latex":return Re.replaceSelection("```latex\n"+bt+"\n```"),Re.setCursor(Tt.line+1,bt.length+1),Re.focus();case"line-break":return Re.replaceSelection(`<br/>
`),Re.focus();case"list-ul":return bt===""?Re.replaceSelection("- "+bt):Re.replaceSelection(kt.map(function(Nt){return Nt===""?"":"- ".concat(Nt)}).join(`
`)),Re.focus();case"list-ol":return bt===""?Re.replaceSelection("1. "+bt):Re.replaceSelection(kt.map(function(Nt,Ht){return Nt===""?"":"".concat(Ht+1,". ").concat(Nt)}).join(`
`)),Re.focus();case"add-null-ch":return bt===""&&Re.setCursor(Tt.line,Tt.ch+1),Re.replaceSelection(ie),Re.focus();case"inster-template-1":return bt===""&&Re.setCursor(Tt.line,Tt.ch),Re.replaceSelection(oe),Re.focus();case"eraser":return Re.setValue(""),Re.focus();case"trigger-watch":return Xr(!sr),Re.focus();case"trigger-full-screen":return ti(!_r),Re.focus();case Qe:Wr(Qe);return;case Ze:Wr(Ze);return;case ot:Wr(ot);return;case at:Wr(at);return;default:throw new Error}},[Re,sr,_r]),Ir=Object(f.useCallback)(function(pt){Wr("");switch(ri){case Qe:var Tt=pt.title,bt=pt.link;return Re.replaceSelection("[".concat(Tt,"](").concat(bt,")")),Re.focus();case Ze:var kt=pt.language,Nt=pt.content;return Re.replaceSelection(["```"+kt,Nt,"```"].join(`
`)),Re.focus();case ot:var Ht=pt.src,Pt=pt.alt,Qt=pt.name;return Ht.indexOf("type=image")>-1?Re.replaceSelection("![ ".concat(Pt||""," ]( ").concat(Ht,' "').concat(Pt||"",'" )')):Ht.indexOf("type=application/pdf")>-1?Re.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(Qt,"</a>")):Re.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(Qt,"</a>")),Re.focus();case at:for(var lr=pt.row,Dt=pt.col,Mi=pt.align,zt=`
`,gr=0;gr<lr;gr++){for(var Vt=[],Yr=[],pn=0;pn<Dt;pn++)gr===1&&Yr.push(dt[Mi]),Vt.push(" ");gr===1&&(zt+="| ".concat(Yr.join(" | "),` |
`)),zt+="| ".concat(Vt.join(Dt===1?"":" | "),` |
`)}return Re.replaceSelection(zt+`
`),Re.focus();default:throw new Error}},[Re,ri]),Yi=Object(f.useMemo)(function(){switch(ri){case Qe:return x.a.createElement(Te,{callback:Ir,onCancel:ci});case Ze:return x.a.createElement(Ce.b,{callback:Ir,onCancel:ci});case ot:return x.a.createElement(_e,{callback:Ir,onCancel:ci});case at:return x.a.createElement(it,{callback:Ir,onCancel:ci});default:return null}},[ri]);function ci(){Wr("")}Object(f.useEffect)(function(){if(bi.current){var pt=bi.current,Tt=!1,bt=0;function kt(Pt){Tt=!0,bt=Pt.pageY}function Nt(){Tt=!1}function Ht(Pt){if(Tt){var Qt=Pt.pageY-bt;Qt<0&&(Qt=0),Qt>300&&(Qt=300);var lr=Bt+Qt+"px";qt(lr)}}return pt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Nt),function(){pt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Nt)}}},[Re,bi]),Object(f.useEffect)(function(){qt(Bt)},[Bt]);var Ei=le(Lt),ua=le(Pi),ha={width:Ei,height:ua},Qa=Object(f.useMemo)(function(){if(Pr){var pt=new Date(Pr),Tt=pt.getHours(),bt=pt.getMinutes(),kt=pt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,bt=bt<10?"0"+bt:bt,kt=kt<10?"0"+kt:kt,"".concat(Tt,":").concat(bt,":").concat(kt)}return 0},[Pr]);function Ja(){window.sessionStorage.removeItem(Kr),mr(!1),Mr(0)}function da(){mr(!1),Mr(0),Re.setValue(window.sessionStorage.getItem(Kr))}function jn(pt,Tt){var bt=Re.getValue();bt=bt.replace(pt,Tt),Wt(bt),Re==null||Re.setValue(bt)}return x.a.createElement(f.Fragment,null,x.a.createElement("div",{className:"markdown-editor-wrapper",ref:ii},x.a.createElement("div",{className:"markdown-editor-container ".concat(Di," ").concat(sr?"on-preview":""," ").concat(yr?"mini":""," ").concat(_r?"full-screen":""),style:ha},x.a.createElement(K,{insertTemp:br,watch:sr,fullScreen:_r,showNullButton:Ot,onActionCallback:Xi,hidetoolBar:ui,uuid:Xt.current,setOpenPhones:function(){yi.current=!0}}),x.a.createElement("div",{className:"markdown-editor-body"},x.a.createElement("div",{className:"codemirror-container"},x.a.createElement("textarea",{ref:ar,placeholder:z})),sr?x.a.createElement("div",{ref:xi,className:"preview-container"},Tr==="stex"&&x.a.createElement(k,{value:Mt}),Tr!=="stex"&&x.a.createElement(v.a,{edit:!0,value:Mt,replaces:jn})):null))),ft?x.a.createElement("a",{ref:bi,className:"editor-resize"}):null,x.a.createElement(I.a,null,yt[ri]?x.a.createElement($.a,{centered:!0,title:yt[ri],visible:!0,onCancel:ci,footer:null},Yi):null))}},SJMd:function(lt,$e){/**
* @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 re,ne,$,D=!1,Y,F;window.PR_SHOULD_USE_CONTINUATION=!0;var R,W;(function(){var B=window,P=["break,continue,do,else,for,if,return,while"],A=[P,"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"],f=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[f,"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"],M=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[f,"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"],C="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",E=[f,"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",a=[P,"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"],s=[P,"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"],h=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[x,w,M,E,d,a,s,h],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",k="kwd",b="com",g="typ",c="lit",u="pun",o="pln",T="tag",S="dec",m="src",O="atn",U="atv",j="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(xe){for(var Oe=0,Ie=!1,Ue=!1,We=0,Be=xe.length;We<Be;++We){var Fe=xe[We];if(Fe.ignoreCase)Ue=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ie=!0,Ue=!1;break}}var it={b:8,t:9,n:10,v:11,f:12,r:13};function et(at){var Pe=at.charCodeAt(0);if(Pe!==92)return Pe;var dt=at.charAt(1);return Pe=it[dt],Pe||("0"<=dt&&dt<="7"?parseInt(at.substring(1),8):dt==="u"||dt==="x"?parseInt(at.substring(2),16):at.charCodeAt(1))}function qe(at){if(at<32)return(at<16?"\\x0":"\\x")+at.toString(16);var Pe=String.fromCharCode(at);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function Qe(at){var Pe=at.substring(1,at.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")),dt=[],st=Pe[0]==="^",Ne=["["];st&&Ne.push("^");for(var Ve=st?1:0,Ee=Pe.length;Ve<Ee;++Ve){var ge=Pe[Ve];if(/\\[bdsw]/i.test(ge))Ne.push(ge);else{var ye=et(ge),ie;Ve+2<Ee&&Pe[Ve+1]==="-"?(ie=et(Pe[Ve+2]),Ve+=2):ie=ye,dt.push([ye,ie]),ie<65||ye>122||(ie<65||ye>90||dt.push([Math.max(65,ye)|32,Math.min(ie,90)|32]),ie<97||ye>122||dt.push([Math.max(97,ye)&~32,Math.min(ie,122)&~32]))}}dt.sort(function(Le,Me){return Le[0]-Me[0]||Me[1]-Le[1]});for(var oe=[],le=[],Ve=0;Ve<dt.length;++Ve){var de=dt[Ve];de[0]<=le[1]+1?le[1]=Math.max(le[1],de[1]):oe.push(le=de)}for(var Ve=0;Ve<oe.length;++Ve){var de=oe[Ve];Ne.push(qe(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Ne.push("-"),Ne.push(qe(de[1])))}return Ne.push("]"),Ne.join("")}function ot(at){for(var Pe=at.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")),dt=Pe.length,st=[],Ne=0,Ve=0;Ne<dt;++Ne){var Ee=Pe[Ne];if(Ee==="(")++Ve;else if(Ee.charAt(0)==="\\"){var ge=+Ee.substring(1);ge&&(ge<=Ve?st[ge]=-1:Pe[Ne]=qe(ge))}}for(var Ne=1;Ne<st.length;++Ne)st[Ne]===-1&&(st[Ne]=++Oe);for(var Ne=0,Ve=0;Ne<dt;++Ne){var Ee=Pe[Ne];if(Ee==="(")++Ve,st[Ve]||(Pe[Ne]="(?:");else if(Ee.charAt(0)==="\\"){var ge=+Ee.substring(1);ge&&ge<=Ve&&(Pe[Ne]="\\"+st[ge])}}for(var Ne=0;Ne<dt;++Ne)Pe[Ne]==="^"&&Pe[Ne+1]!=="^"&&(Pe[Ne]="");if(at.ignoreCase&&Ie)for(var Ne=0;Ne<dt;++Ne){var Ee=Pe[Ne],ye=Ee.charAt(0);Ee.length>=2&&ye==="["?Pe[Ne]=Qe(Ee):ye!=="\\"&&(Pe[Ne]=Ee.replace(/[a-zA-Z]/g,function(le){var de=le.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return Pe.join("")}for(var Ze=[],We=0,Be=xe.length;We<Be;++We){var Fe=xe[We];if(Fe.global||Fe.multiline)throw new Error(""+Fe);Ze.push("(?:"+ot(Fe)+")")}return new RegExp(Ze.join("|"),Ue?"gi":"g")}function N(xe,Oe){var Ie=/(?:^|\s)nocode(?:\s|$)/,Ue=[],We=0,Be=[],Fe=0;function it(et){var qe=et.nodeType;if(qe==1){if(Ie.test(et.className))return;for(var Qe=et.firstChild;Qe;Qe=Qe.nextSibling)it(Qe);var ot=et.nodeName.toLowerCase();(ot==="br"||ot==="li")&&(Ue[Fe]=`
`,Be[Fe<<1]=We++,Be[Fe++<<1|1]=et)}else if(qe==3||qe==4){var Ze=et.nodeValue;Ze.length&&(Oe?Ze=Ze.replace(/\r\n?/g,`
`):Ze=Ze.replace(/[ \t\r\n]+/g," "),Ue[Fe]=Ze,Be[Fe<<1]=We,We+=Ze.length,Be[Fe++<<1|1]=et)}}return it(xe),{sourceCode:Ue.join("").replace(/\n$/,""),spans:Be}}function X(xe,Oe,Ie,Ue,We){if(!Ie)return;var Be={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Ie,spans:null,basePos:Oe,decorations:null};Ue(Be),We.push.apply(We,Be.decorations)}var q=/\S/;function se(xe){for(var Oe=void 0,Ie=xe.firstChild;Ie;Ie=Ie.nextSibling){var Ue=Ie.nodeType;Oe=Ue===1?Oe?xe:Ie:Ue===3&&q.test(Ie.nodeValue)?xe:Oe}return Oe===xe?void 0:Oe}function he(xe,Oe){var Ie={},Ue;(function(){for(var Fe=xe.concat(Oe),it=[],et={},qe=0,Qe=Fe.length;qe<Qe;++qe){var ot=Fe[qe],Ze=ot[3];if(Ze)for(var at=Ze.length;--at>=0;)Ie[Ze.charAt(at)]=ot;var Pe=ot[1],dt=""+Pe;et.hasOwnProperty(dt)||(it.push(Pe),et[dt]=null)}it.push(/[\0-\uffff]/),Ue=I(it)})();var We=Oe.length,Be=function(Fe){for(var it=Fe.sourceCode,et=Fe.basePos,qe=Fe.sourceNode,Qe=[et,o],ot=0,Ze=it.match(Ue)||[],at={},Pe=0,dt=Ze.length;Pe<dt;++Pe){var st=Ze[Pe],Ne=at[st],Ve=void 0,Ee;if(typeof Ne=="string")Ee=!1;else{var ge=Ie[st.charAt(0)];if(ge)Ve=st.match(ge[1]),Ne=ge[0];else{for(var ye=0;ye<We;++ye)if(ge=Oe[ye],Ve=st.match(ge[1]),Ve){Ne=ge[0];break}Ve||(Ne=o)}Ee=Ne.length>=5&&Ne.substring(0,5)==="lang-",Ee&&!(Ve&&typeof Ve[1]=="string")&&(Ee=!1,Ne=m),Ee||(at[st]=Ne)}var ie=ot;if(ot+=st.length,!Ee)Qe.push(et+ie,Ne);else{var oe=Ve[1],le=st.indexOf(oe),de=le+oe.length;Ve[2]&&(de=st.length-Ve[2].length,le=de-oe.length);var Le=Ne.substring(5);X(qe,et+ie,st.substring(0,le),Be,Qe),X(qe,et+ie+le,oe,ue(Le,oe),Qe),X(qe,et+ie+de,st.substring(de),Be,Qe)}}Fe.decorations=Qe};return Be}function Ae(xe){var Oe=[],Ie=[];xe.tripleQuotedStrings?Oe.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?Oe.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Ie.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ue=xe.hashComments;Ue&&(xe.cStyleComments?(Ue>1?Oe.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ie.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([b,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Ie.push([b,/^\/\/[^\r\n]*/,null]),Ie.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var We=xe.regexLiterals;if(We){var Be=We>1?"":`
\r`,Fe=Be?".":"[\\S\\s]",it="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Ie.push(["lang-regex",RegExp("^"+K+"("+it+")")])}var et=xe.types;et&&Ie.push([g,et]);var qe=(""+xe.keywords).replace(/^ | $/g,"");qe.length&&Ie.push([k,new RegExp("^(?:"+qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([o,/^\s+/,null,` \r
\xA0`]);var Qe="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Qe+="(?!s*/)"),Ie.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[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"],[o,/^\\[\s\S]?/,null],[u,new RegExp(Qe),null]),he(Oe,Ie)}var be=Ae({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(xe,Oe,Ie){for(var Ue=/(?:^|\s)nocode(?:\s|$)/,We=/\r\n?|\n/,Be=xe.ownerDocument,Fe=Be.createElement("li");xe.firstChild;)Fe.appendChild(xe.firstChild);var it=[Fe];function et(Pe){var dt=Pe.nodeType;if(dt==1&&!Ue.test(Pe.className))if(Pe.nodeName==="br")qe(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var st=Pe.firstChild;st;st=st.nextSibling)et(st);else if((dt==3||dt==4)&&Ie){var Ne=Pe.nodeValue,Ve=Ne.match(We);if(Ve){var Ee=Ne.substring(0,Ve.index);Pe.nodeValue=Ee;var ge=Ne.substring(Ve.index+Ve[0].length);if(ge){var ye=Pe.parentNode;ye.insertBefore(Be.createTextNode(ge),Pe.nextSibling)}qe(Pe),Ee||Pe.parentNode.removeChild(Pe)}}}function qe(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function dt(Ve,Ee){var ge=Ee?Ve.cloneNode(!1):Ve,ye=Ve.parentNode;if(ye){var ie=dt(ye,1),oe=Ve.nextSibling;ie.appendChild(ge);for(var le=oe;le;le=oe)oe=le.nextSibling,ie.appendChild(le)}return ge}for(var st=dt(Pe.nextSibling,0),Ne;(Ne=st.parentNode)&&Ne.nodeType===1;)st=Ne;it.push(st)}for(var Qe=0;Qe<it.length;++Qe)et(it[Qe]);Oe===(Oe|0)&&it[0].setAttribute("value",Oe);var ot=Be.createElement("ol");ot.className="linenums";for(var Ze=Math.max(0,Oe-1|0)||0,Qe=0,at=it.length;Qe<at;++Qe)Fe=it[Qe],Fe.className="L"+(Qe+Ze)%10,Fe.firstChild||Fe.appendChild(Be.createTextNode("\xA0")),ot.appendChild(Fe);xe.appendChild(ot)}function Ce(xe){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Ie=/\n/g,Ue=xe.sourceCode,We=Ue.length,Be=0,Fe=xe.spans,it=Fe.length,et=0,qe=xe.decorations,Qe=qe.length,ot=0;qe[Qe]=We;var Ze,at;for(at=Ze=0;at<Qe;)qe[at]!==qe[at+2]?(qe[Ze++]=qe[at++],qe[Ze++]=qe[at++]):at+=2;for(Qe=Ze,at=Ze=0;at<Qe;){for(var Pe=qe[at],dt=qe[at+1],st=at+2;st+2<=Qe&&qe[st+1]===dt;)st+=2;qe[Ze++]=Pe,qe[Ze++]=dt,at=st}Qe=qe.length=Ze;var Ne=xe.sourceNode,Ve="";Ne&&(Ve=Ne.style.display,Ne.style.display="none");try{for(var Ee=null;et<it;){var ge=Fe[et],ye=Fe[et+2]||We,ie=qe[ot+2]||We,st=Math.min(ye,ie),oe=Fe[et+1],le;if(oe.nodeType!==1&&(le=Ue.substring(Be,st))){Oe&&(le=le.replace(Ie,"\r")),oe.nodeValue=le;var de=oe.ownerDocument,Le=de.createElement("span");Le.className=qe[ot+1];var Me=oe.parentNode;Me.replaceChild(Le,oe),Le.appendChild(oe),Be<ye&&(Fe[et+1]=oe=de.createTextNode(Ue.substring(st,ye)),Me.insertBefore(oe,Le.nextSibling))}Be=st,Be>=ye&&(et+=2),Be>=ie&&(ot+=2)}}finally{Ne&&(Ne.style.display=Ve)}}var Se={};function pe(xe,Oe){for(var Ie=Oe.length;--Ie>=0;){var Ue=Oe[Ie];Se.hasOwnProperty(Ue)?B.console&&console.warn("cannot override language handler %s",Ue):Se[Ue]=xe}}function ue(xe,Oe){return xe&&Se.hasOwnProperty(xe)||(xe=/^\s*</.test(Oe)?"default-markup":"default-code"),Se[xe]}pe(be,["default-code"]),pe(he([],[[o,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["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"]),pe(he([[o,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[O,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["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"]),pe(he([],[[U,/^[\s\S]+/]]),["uq.val"]),pe(Ae({keywords:x,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),pe(Ae({keywords:"null,true,false"}),["json"]),pe(Ae({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),pe(Ae({keywords:M,cStyleComments:!0}),["java"]),pe(Ae({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(Ae({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(Ae({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(Ae({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(Ae({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(Ae({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(he([],[[v,/^[\s\S]+/]]),["regex"]);function te(xe){var Oe=xe.langExtension;try{var Ie=N(xe.sourceNode,xe.pre),Ue=Ie.sourceCode;xe.sourceCode=Ue,xe.spans=Ie.spans,xe.basePos=0,ue(Oe,Ue)(xe),Ce(xe)}catch(We){B.console&&console.log(We&&We.stack||We)}}function fe(xe,Oe,Ie){var Ue=Ie||!1,We=Oe||null,Be=document.createElement("div");Be.innerHTML="<pre>"+xe+"</pre>",Be=Be.firstChild,Ue&&Te(Be,Ue,!0);var Fe={langExtension:We,numberLines:Ue,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Fe),Be.innerHTML}function ae(xe,Oe){var Ie=Oe||document.body,Ue=Ie.ownerDocument||document;function We(ge){return Ie.getElementsByTagName(ge)}for(var Be=[We("pre"),We("code"),We("xmp")],Fe=[],it=0;it<Be.length;++it)for(var et=0,qe=Be[it].length;et<qe;++et)Fe.push(Be[it][et]);Be=null;var Qe=Date;Qe.now||(Qe={now:function(){return+new Date}});var ot=0,Ze=/\blang(?:uage)?-([\w.]+)(?!\S)/,at=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,dt=/pre|xmp/i,st=/^code$/i,Ne=/^(?:pre|code|xmp)$/i,Ve={};function Ee(){for(var ge=B.PR_SHOULD_USE_CONTINUATION?Qe.now()+250:Infinity;ot<Fe.length&&Qe.now()<ge;ot++){for(var ye=Fe[ot],ie=Ve,oe=ye;oe=oe.previousSibling;){var le=oe.nodeType,de=(le===7||le===8)&&oe.nodeValue;if(de?!/^\??prettify\b/.test(de):le!==3||/\S/.test(oe.nodeValue))break;if(de){ie={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Bt,wt,yr){ie[wt]=yr});break}}var Le=ye.className;if((ie!==Ve||at.test(Le))&&!Pe.test(Le)){for(var Me=!1,Ye=ye.parentNode;Ye;Ye=Ye.parentNode){var yt=Ye.tagName;if(Ne.test(yt)&&Ye.className&&at.test(Ye.className)){Me=!0;break}}if(!Me){ye.className+=" prettyprinted";var At=ie.lang;if(!At){At=Le.match(Ze);var Ge;!At&&(Ge=se(ye))&&st.test(Ge.tagName)&&(At=Ge.className.match(Ze)),At&&(At=At[1])}var xt;if(dt.test(ye.tagName))xt=1;else{var mt=ye.currentStyle,nt=Ue.defaultView,Rt=mt?mt.whiteSpace:nt&&nt.getComputedStyle?nt.getComputedStyle(ye,null).getPropertyValue("white-space"):0;xt=Rt&&Rt.substring(0,3)==="pre"}var Lt=ie.linenums;(Lt=Lt==="true"||+Lt)||(Lt=Le.match(/\blinenums\b(?::(\d+))?/),Lt=Lt?Lt[1]&&Lt[1].length?+Lt[1]:!0:!1),Lt&&Te(ye,Lt,xt);var Kt={langExtension:At,sourceNode:ye,numberLines:Lt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}ot<Fe.length?B.setTimeout(Ee,250):typeof xe=="function"&&xe()}Ee()}var _e=B.PR={createSimpleLexer:he,registerLangHandler:pe,sourceDecorator:Ae,PR_ATTRIB_NAME:O,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:S,PR_KEYWORD:k,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:o,PR_PUNCTUATION:u,PR_SOURCE:m,PR_STRING:v,PR_TAG:T,PR_TYPE:g,prettyPrintOne:D?B.prettyPrintOne=fe:R=fe,prettyPrint:W=D?B.prettyPrint=ae:W=ae},De=B.define;typeof De=="function"&&De.amd&&De("google-code-prettify",[],function(){return _e})})()},"VrN/":function(lt,$e,re){(function(ne,$){lt.exports=$()})(this,function(){"use strict";var ne=navigator.userAgent,$=navigator.platform,D=/gecko\/\d/i.test(ne),Y=/MSIE \d/.test(ne),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),R=/Edge\/(\d+)/.exec(ne),W=Y||F||R,B=W&&(Y?document.documentMode||6:+(R||F)[1]),P=!R&&/WebKit\//.test(ne),A=P&&/Qt\/\d+\.\d+/.test(ne),f=!R&&/Chrome\//.test(ne),x=/Opera\//.test(ne),M=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),C=/PhantomJS/.test(ne),E=!R&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),d=/Android/.test(ne),a=E||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=E||/Mac/.test($),h=/\bCrOS\b/.test(ne),L=/win/i.test($),p=x&&ne.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(x=!1,P=!0);var v=s&&(A||x&&(p==null||p<12.11)),k=D||W&&B>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var i=e.className,r=b(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return c(e).appendChild(t)}function o(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var _=0;_<t.length;++_)n.appendChild(t[_]);return n}function T(e,t,i,r){var n=o(e,t,i,r);return n.setAttribute("role","presentation"),n}var S;document.createRange?S=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:S=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function m(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 O(){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 i=e.className;b(t).test(i)||(e.className+=(i?" ":"")+t)}function j(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!b(i[r]).test(t)&&(t+=" "+i[r]);return t}var K=function(e){e.select()};E?K=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(K=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function X(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var _=r||0,H=n||0;;){var Q=e.indexOf(" ",_);if(Q<0||Q>=t)return H+(t-_);H+=Q-_,H+=i-H%i,_=Q+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function se(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var he=50,Ae={toString:function(){return"CodeMirror.Pass"}},be={scroll:!1},Te={origin:"*mouse"},Ce={origin:"+move"};function Se(e,t,i){for(var r=0,n=0;;){var _=e.indexOf(" ",r);_==-1&&(_=e.length);var H=_-r;if(_==e.length||n+H>=t)return r+Math.min(H,t-n);if(n+=_-r,n+=i-n%i,r=_+1,n>=t)return r}}var pe=[""];function ue(e){for(;pe.length<=e;)pe.push(te(pe)+" ");return pe[e]}function te(e){return e[e.length-1]}function fe(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ae(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function _e(){}function De(e,t){var i;return Object.create?i=Object.create(e):(_e.prototype=e,i=new _e),t&&N(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Ie(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function Ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var We=/[\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 Be(e){return e.charCodeAt(0)>=768&&We.test(e)}function Fe(e,t,i){for(;(i<0?t>0:t<e.length)&&Be(e.charAt(t));)t+=i;return t}function it(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,_=r<0?Math.ceil(n):Math.floor(n);if(_==t)return e(_)?t:i;e(_)?i=_:t=_+r}}function et(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,_=0;_<e.length;++_){var H=e[_];(H.from<i&&H.to>t||t==i&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,i),H.level==1?"rtl":"ltr",_),n=!0)}n||r(t,i,"ltr")}var qe=null;function Qe(e,t,i){var r;qe=null;for(var n=0;n<e.length;++n){var _=e[n];if(_.from<t&&_.to>t)return n;_.to==t&&(_.from!=_.to&&i=="before"?r=n:qe=n),_.from==t&&(_.from!=_.to&&i!="before"?r=n:qe=n)}return r!=null?r:qe}var ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,_=/[LRr]/,H=/[Lb1n]/,Q=/[1n]/;function J(ee,ce,me){this.level=ee,this.from=ce,this.to=me}return function(ee,ce){var me=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!r.test(ee))return!1;for(var ke=ee.length,we=[],je=0;je<ke;++je)we.push(i(ee.charCodeAt(je)));for(var Ke=0,Je=me;Ke<ke;++Ke){var tt=we[Ke];tt=="m"?we[Ke]=Je:Je=tt}for(var ut=0,rt=me;ut<ke;++ut){var ht=we[ut];ht=="1"&&rt=="r"?we[ut]="n":_.test(ht)&&(rt=ht,ht=="r"&&(we[ut]="R"))}for(var Et=1,vt=we[0];Et<ke-1;++Et){var _t=we[Et];_t=="+"&&vt=="1"&&we[Et+1]=="1"?we[Et]="1":_t==","&&vt==we[Et+1]&&(vt=="1"||vt=="n")&&(we[Et]=vt),vt=_t}for(var Yt=0;Yt<ke;++Yt){var dr=we[Yt];if(dr==",")we[Yt]="N";else if(dr=="%"){var Jt=void 0;for(Jt=Yt+1;Jt<ke&&we[Jt]=="%";++Jt);for(var Br=Yt&&we[Yt-1]=="!"||Jt<ke&&we[Jt]=="1"?"1":"N",Dr=Yt;Dr<Jt;++Dr)we[Dr]=Br;Yt=Jt-1}}for(var tr=0,Rr=me;tr<ke;++tr){var vr=we[tr];Rr=="L"&&vr=="1"?we[tr]="L":_.test(vr)&&(Rr=vr)}for(var or=0;or<ke;++or)if(n.test(we[or])){var rr=void 0;for(rr=or+1;rr<ke&&n.test(we[rr]);++rr);for(var Zt=(or?we[or-1]:me)=="L",Or=(rr<ke?we[rr]:me)=="L",dn=Zt==Or?Zt?"L":"R":me,ki=or;ki<rr;++ki)we[ki]=dn;or=rr-1}for(var Er=[],oi,cr=0;cr<ke;)if(H.test(we[cr])){var Ya=cr;for(++cr;cr<ke&&H.test(we[cr]);++cr);Er.push(new J(0,Ya,cr))}else{var mi=cr,zi=Er.length,Gi=ce=="rtl"?1:0;for(++cr;cr<ke&&we[cr]!="L";++cr);for(var Cr=mi;Cr<cr;)if(Q.test(we[Cr])){mi<Cr&&(Er.splice(zi,0,new J(1,mi,Cr)),zi+=Gi);var cn=Cr;for(++Cr;Cr<cr&&Q.test(we[Cr]);++Cr);Er.splice(zi,0,new J(2,cn,Cr)),zi+=Gi,mi=Cr}else++Cr;mi<cr&&Er.splice(zi,0,new J(1,mi,cr))}return ce=="ltr"&&(Er[0].level==1&&(oi=ee.match(/^\s+/))&&(Er[0].from=oi[0].length,Er.unshift(new J(0,0,oi[0].length))),te(Er).level==1&&(oi=ee.match(/\s+$/))&&(te(Er).to-=oi[0].length,Er.push(new J(0,ke-oi[0].length,ke)))),ce=="rtl"?Er.reverse():Er}}();function Ze(e,t){var i=e.order;return i==null&&(i=e.order=ot(e.text,t)),i}var at=[],Pe=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||at).concat(i)}};function dt(e,t){return e._handlers&&e._handlers[t]||at}function st(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var _=se(n,i);_>-1&&(r[t]=n.slice(0,_).concat(n.slice(_+1)))}}}function Ne(e,t){var i=dt(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function Ve(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ne(e,i||t.type,e,t),le(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)se(i,t[r])==-1&&i.push(t[r])}function ge(e,t){return dt(e,t).length>0}function ye(e){e.prototype.on=function(t,i){Pe(this,t,i)},e.prototype.off=function(t,i){st(this,t,i)}}function ie(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function le(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){ie(e),oe(e)}function Le(e){return e.target||e.srcElement}function Me(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Ye=function(){if(W&&B<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),yt;function At(e){if(yt==null){var t=o("span","\u200B");u(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(yt=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&B<8))}var i=yt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ge;function xt(e){if(Ge!=null)return Ge;var t=u(e,document.createTextNode("A\u062EA")),i=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:Ge=r.right-i.right<3}var mt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var _=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),H=_.indexOf("\r");H!=-1?(i.push(_.slice(0,H)),t+=H+1):(i.push(_),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},nt=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Rt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Lt=null;function Kt(e){if(Lt!=null)return Lt;var t=u(e,o("span","x")),i=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return Lt=Math.abs(i.left-r.left)>1}var Bt={},wt={};function yr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Bt[e]=t}function ir(e,t){wt[e]=t}function gt(e){if(typeof e=="string"&&wt.hasOwnProperty(e))e=wt[e];else if(e&&typeof e.name=="string"&&wt.hasOwnProperty(e.name)){var t=wt[e.name];typeof t=="string"&&(t={name:t}),e=De(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return gt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return gt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gr(e,t){t=gt(t);var i=Bt[t.name];if(!i)return Gr(e,"text/plain");var r=i(e,t);if(br.hasOwnProperty(t.name)){var n=br[t.name];for(var _ in n){if(!n.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=n[_]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)r[H]=t.modeProps[H];return r}var br={};function fr(e,t){var i=br.hasOwnProperty(e)?br[e]:br[e]={};N(t,i)}function Tr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function si(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Kr(e,t,i){return e.startState?e.startState(t,i):!0}var It=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(H){return i?H.toLowerCase():H},n=this.string.substr(this.pos,e.length);if(r(n)==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),_)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ft(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 i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],_=n.chunkSize();if(t<_){i=n;break}t-=_}return i.lines[t]}function Ur(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(_){var H=_.text;n==i.line&&(H=H.slice(0,i.ch)),n==t.line&&(H=H.slice(t.ch)),r.push(H),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function wr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,i=se(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Vr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],_=n.height;if(t<_){e=n;continue e}t-=_,i+=n.chunkSize()}return i}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Q=e.lines[H],J=Q.height;if(t<J)break;t-=J}return i+H}function ui(e,t){return t>=e.first&&t<e.first+e.size}function gi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Xe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Xe))return new Xe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function St(e,t){return e.line-t.line||e.ch-t.ch}function ei(e,t){return e.sticky==t.sticky&&St(e,t)==0}function hi(e){return Xe(e.line,e.ch)}function di(e,t){return St(e,t)<0?t:e}function Di(e,t){return St(e,t)<0?e:t}function V(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function l(e,t){if(t.line<e.first)return Xe(e.first,0);var i=e.first+e.size-1;return t.line>i?Xe(i,ft(e,i).text.length):y(t,ft(e,t.line).text.length)}function y(e,t){var i=e.ch;return i==null||i>t?Xe(e.line,t):i<0?Xe(e.line,0):e}function z(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=l(e,t[r]);return i}var Z=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.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}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,i){return t instanceof Z?new G(e,Tr(e.mode,t.state),i,t.lookAhead):new G(e,Tr(e.mode,t),i)},G.prototype.save=function(e){var t=e!==!1?Tr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],_={};jr(e,t.text,e.doc.mode,i,function(ee,ce){return n.push(ee,ce)},_,r);for(var H=i.state,Q=function(ee){i.baseTokens=n;var ce=e.state.overlays[ee],me=1,ke=0;i.state=!0,jr(e,t.text,ce.mode,i,function(we,je){for(var Ke=me;ke<we;){var Je=n[me];Je>we&&n.splice(me,1,we,n[me+1],Je),me+=2,ke=Math.min(we,Je)}if(!je)return;if(ce.opaque)n.splice(Ke,me-Ke,we,"overlay "+je),me=Ke+2;else for(;Ke<me;Ke+=2){var tt=n[Ke+1];n[Ke+1]=(tt?tt+" ":"")+"overlay "+je}},_),i.state=H,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Q(J);return{styles:n,classes:_.bgClass||_.textClass?_:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Re(e,Ot(t)),n=t.text.length>e.options.maxHighlightLength&&Tr(e.doc.mode,r.state),_=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=_.styles,_.classes?t.styleClasses=_.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Re(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new G(r,!0,t);var _=sr(e,t,i),H=_>r.first&&ft(r,_-1).stateAfter,Q=H?G.fromSaved(r,H,_):new G(r,Kr(r.mode),_);return r.iter(_,t,function(J){ct(e,J.text,Q);var ee=Q.line;J.stateAfter=ee==t-1||ee%5==0||ee>=n.viewFrom&&ee<n.viewTo?Q.save():null,Q.nextLine()}),i&&(r.modeFrontier=Q.line),Q}function ct(e,t,i,r){var n=e.doc.mode,_=new It(t,e.options.tabSize,i);for(_.start=_.pos=r||0,t==""&&ze(n,i.state);!_.eol();)Ct(n,_,i.state),_.start=_.pos}function ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=si(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Ct(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=si(e,i).mode);var _=e.token(t,i);if(t.pos>t.start)return _}throw new Error("Mode "+e.name+" failed to advance stream.")}var Mt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Wt(e,t,i,r){var n=e.doc,_=n.mode,H;t=l(n,t);var Q=ft(n,t.line),J=Re(e,t.line,i),ee=new It(Q.text,e.options.tabSize,J),ce;for(r&&(ce=[]);(r||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,H=Ct(_,ee,J.state),r&&ce.push(new Mt(ee,H,Tr(n.mode,J.state)));return r?ce:new Mt(ee,H,J.state)}function Fr(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function jr(e,t,i,r,n,_,H){var Q=i.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var J=0,ee=null,ce=new It(t,e.options.tabSize,r),me,ke=e.options.addModeClass&&[null];for(t==""&&Fr(ze(i,r.state),_);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Q=!1,H&&ct(e,t,r,ce.pos),ce.pos=t.length,me=null):me=Fr(Ct(i,ce,r.state,ke),_),ke){var we=ke[0].name;we&&(me="m-"+(me?we+" "+me:we))}if(!Q||ee!=me){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),n(J,ee);ee=me}ce.start=ce.pos}for(;J<ce.pos;){var je=Math.min(ce.pos,J+5e3);n(je,ee),J=je}}function sr(e,t,i){for(var r,n,_=e.doc,H=i?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>H;--Q){if(Q<=_.first)return _.first;var J=ft(_,Q-1),ee=J.stateAfter;if(ee&&(!i||Q+(ee instanceof Z?ee.lookAhead:0)<=_.modeFrontier))return Q;var ce=X(J.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Q-1,r=ce)}return n}function Xr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=ft(e,r).stateAfter;if(n&&(!(n instanceof Z)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ki=!1,Ar=!1;function _r(){Ki=!0}function ti(){Ar=!0}function vi(e,t,i){this.marker=e,this.from=t,this.to=i}function $r(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ri(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function Wr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function fn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var _=e[n],H=_.marker,Q=_.from==null||(H.inclusiveLeft?_.from<=t:_.from<t);if(Q||_.from==t&&H.type=="bookmark"&&(!i||!_.marker.insertLeft)){var J=_.to==null||(H.inclusiveRight?_.to>=t:_.to>t);(r||(r=[])).push(new vi(H,_.from,J?null:_.to))}}return r}function Vi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var _=e[n],H=_.marker,Q=_.to==null||(H.inclusiveRight?_.to>=t:_.to>t);if(Q||_.from==t&&H.type=="bookmark"&&(!i||_.marker.insertLeft)){var J=_.from==null||(H.inclusiveLeft?_.from<=t:_.from<t);(r||(r=[])).push(new vi(H,J?null:_.from-t,_.to==null?null:_.to-t))}}return r}function Pr(e,t){if(t.full)return null;var i=ui(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=ui(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,_=t.to.ch,H=St(t.from,t.to)==0,Q=fn(i,n,H),J=Vi(r,_,H),ee=t.text.length==1,ce=te(t.text).length+(ee?n:0);if(Q)for(var me=0;me<Q.length;++me){var ke=Q[me];if(ke.to==null){var we=$r(J,ke.marker);we?ee&&(ke.to=we.to==null?null:we.to+ce):ke.to=n}}if(J)for(var je=0;je<J.length;++je){var Ke=J[je];if(Ke.to!=null&&(Ke.to+=ce),Ke.from==null){var Je=$r(Q,Ke.marker);Je||(Ke.from=ce,ee&&(Q||(Q=[])).push(Ke))}else Ke.from+=ce,ee&&(Q||(Q=[])).push(Ke)}Q&&(Q=Mr(Q)),J&&J!=Q&&(J=Mr(J));var tt=[Q];if(!ee){var ut=t.text.length-2,rt;if(ut>0&&Q)for(var ht=0;ht<Q.length;++ht)Q[ht].to==null&&(rt||(rt=[])).push(new vi(Q[ht].marker,null,null));for(var Et=0;Et<ut;++Et)tt.push(rt);tt.push(J)}return tt}function Mr(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ri(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(we){if(we.markedSpans)for(var je=0;je<we.markedSpans.length;++je){var Ke=we.markedSpans[je].marker;Ke.readOnly&&(!r||se(r,Ke)==-1)&&(r||(r=[])).push(Ke)}}),!r)return null;for(var n=[{from:t,to:i}],_=0;_<r.length;++_)for(var H=r[_],Q=H.find(0),J=0;J<n.length;++J){var ee=n[J];if(St(ee.to,Q.from)<0||St(ee.from,Q.to)>0)continue;var ce=[J,1],me=St(ee.from,Q.from),ke=St(ee.to,Q.to);(me<0||!H.inclusiveLeft&&!me)&&ce.push({from:ee.from,to:Q.from}),(ke>0||!H.inclusiveRight&&!ke)&&ce.push({from:Q.to,to:ee.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function Oi(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function Pi(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function qt(e){return e.inclusiveLeft?-1:0}function Ut(e){return e.inclusiveRight?1:0}function pr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),_=St(r.from,n.from)||qt(e)-qt(t);if(_)return-_;var H=St(r.to,n.to)||Ut(e)-Ut(t);return H||t.id-e.id}function Ft(e,t){var i=Ar&&e.markedSpans,r;if(i)for(var n=void 0,_=0;_<i.length;++_)n=i[_],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||pr(r,n.marker)<0)&&(r=n.marker);return r}function mr(e){return Ft(e,!0)}function Xt(e){return Ft(e,!1)}function yi(e,t){var i=Ar&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var _=i[n];_.marker.collapsed&&(_.from==null||_.from<t)&&(_.to==null||_.to>t)&&(!r||pr(r,_.marker)<0)&&(r=_.marker)}return r}function nr(e,t,i,r,n){var _=ft(e,t),H=Ar&&_.markedSpans;if(H)for(var Q=0;Q<H.length;++Q){var J=H[Q];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),ce=St(ee.from,i)||qt(J.marker)-qt(n),me=St(ee.to,r)||Ut(J.marker)-Ut(n);if(ce>=0&&me<=0||ce<=0&&me>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.to,i)>=0:St(ee.to,i)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?St(ee.from,r)<=0:St(ee.from,r)<0))return!0}}function ar(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function ii(e){for(var t;t=Xt(e);)e=t.find(1,!0).line;return e}function bi(e){for(var t,i;t=Xt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function xi(e,t){var i=ft(e,t),r=ar(i);return i==r?t:Ot(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=ft(e,t),r;if(!Qr(e,i))return t;for(;r=Xt(i);)i=r.find(1,!0).line;return Ot(i)+1}function Qr(e,t){var i=Ar&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Xi(e,t,r))return!0}}function Xi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Xi(e,r.line,$r(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,_=0;_<t.markedSpans.length;++_)if(n=t.markedSpans[_],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Xi(e,t,n))return!0}function Ir(e){e=ar(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var _=i.parent;_;i=_,_=i.parent)for(var H=0;H<_.children.length;++H){var Q=_.children[H];if(Q==i)break;t+=Q.height}return t}function Yi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=mr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Xt(r);){var _=i.find(0,!0);t-=r.text.length-_.from.ch,r=_.to.line,t+=r.text.length-_.to.ch}return t}function ci(e){var t=e.display,i=e.doc;t.maxLine=ft(i,i.first),t.maxLineLength=Yi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Yi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ei=function(e,t,i){this.text=e,Pi(this,t),this.height=i?i(this):1};Ei.prototype.lineNo=function(){return Ot(this)},ye(Ei);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Oi(e),Pi(e,i);var n=r?r(e):1;n!=e.height&&wr(e,n)}function ha(e){e.parent=null,Oi(e)}var Qa={},Ja={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ja:Qa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var i=T("span",null,null,P?"padding-right: .1px":null),r={pre:T("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var _=n?t.rest[n-1]:t.line,H=void 0;r.pos=0,r.addToken=Tt,xt(e.display.measure)&&(H=Ze(_,e.doc.direction))&&(r.addToken=kt(r.addToken,H)),r.map=[];var Q=t!=e.display.externalMeasured&&Ot(_);Ht(_,r,He(e,_,Q)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=j(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=j(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(At(e.display.measure))),n==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(P){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ne(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function pt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Tt(e,t,i,r,n,_,H){if(!t)return;var Q=e.splitSpaces?bt(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,ce),W&&B<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var me=0;;){J.lastIndex=me;var ke=J.exec(t),we=ke?ke.index-me:t.length-me;if(we){var je=document.createTextNode(Q.slice(me,me+we));W&&B<9?ce.appendChild(o("span",[je])):ce.appendChild(je),e.map.push(e.pos,e.pos+we,je),e.col+=we,e.pos+=we}if(!ke)break;me+=we+1;var Ke=void 0;if(ke[0]==" "){var Je=e.cm.options.tabSize,tt=Je-e.col%Je;Ke=ce.appendChild(o("span",ue(tt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=tt}else ke[0]=="\r"||ke[0]==`
`?(Ke=ce.appendChild(o("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",ke[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(ke[0]),Ke.setAttribute("cm-text",ke[0]),W&&B<9?ce.appendChild(o("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,i||r||n||ee||_||H){var ut=i||"";r&&(ut+=r),n&&(ut+=n);var rt=o("span",[ce],ut,_);if(H)for(var ht in H)H.hasOwnProperty(ht)&&ht!="style"&&ht!="class"&&rt.setAttribute(ht,H[ht]);return e.content.appendChild(rt)}e.content.appendChild(ce)}function bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var _=e.charAt(n);_==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(_="\xA0"),r+=_,i=_==" "}return r}function kt(e,t){return function(i,r,n,_,H,Q,J){n=n?n+" cm-force-border":"cm-force-border";for(var ee=i.pos,ce=ee+r.length;;){for(var me=void 0,ke=0;ke<t.length&&!(me=t[ke],me.to>ee&&me.from<=ee);ke++);if(me.to>=ce)return e(i,r,n,_,H,Q,J);e(i,r.slice(0,me.to-ee),n,_,null,Q,J),_=null,r=r.slice(me.to-ee),ee=me.to}}}function Nt(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Ht(e,t,i){var r=e.markedSpans,n=e.text,_=0;if(!r){for(var H=1;H<i.length;H+=2)t.addToken(t,n.slice(_,_=i[H]),da(i[H+1],t.cm.options));return}for(var Q=n.length,J=0,ee=1,ce="",me,ke,we=0,je,Ke,Je,tt,ut;;){if(we==J){je=Ke=Je=ke="",ut=null,tt=null,we=Infinity;for(var rt=[],ht=void 0,Et=0;Et<r.length;++Et){var vt=r[Et],_t=vt.marker;if(_t.type=="bookmark"&&vt.from==J&&_t.widgetNode)rt.push(_t);else if(vt.from<=J&&(vt.to==null||vt.to>J||_t.collapsed&&vt.to==J&&vt.from==J)){if(vt.to!=null&&vt.to!=J&&we>vt.to&&(we=vt.to,Ke=""),_t.className&&(je+=" "+_t.className),_t.css&&(ke=(ke?ke+";":"")+_t.css),_t.startStyle&&vt.from==J&&(Je+=" "+_t.startStyle),_t.endStyle&&vt.to==we&&(ht||(ht=[])).push(_t.endStyle,vt.to),_t.title&&((ut||(ut={})).title=_t.title),_t.attributes)for(var Yt in _t.attributes)(ut||(ut={}))[Yt]=_t.attributes[Yt];_t.collapsed&&(!tt||pr(tt.marker,_t)<0)&&(tt=vt)}else vt.from>J&&we>vt.from&&(we=vt.from)}if(ht)for(var dr=0;dr<ht.length;dr+=2)ht[dr+1]==we&&(Ke+=" "+ht[dr]);if(!tt||tt.from==J)for(var Jt=0;Jt<rt.length;++Jt)Nt(t,0,rt[Jt]);if(tt&&(tt.from||0)==J){if(Nt(t,(tt.to==null?Q+1:tt.to)-J,tt.marker,tt.from==null),tt.to==null)return;tt.to==J&&(tt=!1)}}if(J>=Q)break;for(var Br=Math.min(Q,we);;){if(ce){var Dr=J+ce.length;if(!tt){var tr=Dr>Br?ce.slice(0,Br-J):ce;t.addToken(t,tr,me?me+je:je,Je,J+tr.length==we?Ke:"",ke,ut)}if(Dr>=Br){ce=ce.slice(Br-J),J=Br;break}J=Dr,Je=""}ce=n.slice(_,_=i[ee++]),me=da(i[ee++],t.cm.options)}}}function Pt(e,t,i){this.line=t,this.rest=bi(t),this.size=this.rest?Ot(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Qr(e,t)}function Qt(e,t,i){for(var r=[],n,_=t;_<i;_=n){var H=new Pt(e.doc,ft(e.doc,_),_);n=_+H.size,r.push(H)}return r}var lr=null;function Dt(e){lr?lr.ops.push(e):e.ownsGroup=lr={ops:[e],delayedCallbacks:[]}}function Mi(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function zt(e,t){var i=e.ownsGroup;if(!i)return;try{Mi(i)}finally{lr=null,t(i)}}var gr=null;function Vt(e,t){var i=dt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;lr?n=lr.delayedCallbacks:gr?n=gr:(n=gr=[],setTimeout(Yr,0));for(var _=function(Q){n.push(function(){return i[Q].apply(null,r)})},H=0;H<i.length;++H)_(H)}function Yr(){var e=gr;gr=null;for(var t=0;t<e.length;++t)e[t]()}function pn(e,t,i,r){for(var n=0;n<t.changes.length;n++){var _=t.changes[n];_=="text"?Ms(e,t):_=="gutter"?qa(e,t,i,r):_=="class"?ca(e,t):_=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&B<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=mn(t);t.background=r.insertBefore(o("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):jn(e,t)}function Ms(e,t){var i=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)):i&&(t.text.className=i)}function ca(e,t){Ps(e,t),t.line.wrapClass?mn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function qa(e,t,i,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 n=mn(t);t.gutterBackground=o("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),n.insertBefore(t.gutterBackground,t.text)}var _=t.line.gutterMarkers;if(e.options.lineNumbers||_){var H=mn(t),Q=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),H.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(o("div",gi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),_)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,ce=_.hasOwnProperty(ee)&&_[ee];ce&&Q.appendChild(o("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[ee]+"px; width: "+r.gutterWidth[ee]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),n=t.node.firstChild,_=void 0;n;n=_)_=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);eo(e,t,i)}function Ns(e,t,i,r){var n=Za(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ca(e,t),qa(e,t,i,r),eo(e,t,r),t.node}function eo(e,t,i){if(to(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,i,!1)}function to(e,t,i,r,n){if(!t.widgets)return;for(var _=mn(i),H=0,Q=t.widgets;H<Q.length;++H){var J=Q[H],ee=o("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Bs(J,ee,i,r),e.display.input.setUneditable(ee),n&&J.above?_.insertBefore(ee,i.gutter||i.text):_.appendChild(ee),Vt(J,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!m(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,o("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=Le(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Wn(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=u(e.measure,o("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ni(e){return he-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function pa(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Ii(e);if(!t.measure.heights||r&&t.measure.width!=n){var _=t.measure.heights=[];if(r){t.measure.width=n;for(var H=t.text.firstChild.getClientRects(),Q=0;Q<H.length-1;Q++){var J=H[Q],ee=H[Q+1];Math.abs(J.bottom-ee.bottom)>2&&_.push((J.bottom+ee.top)/2-i.top)}}_.push(i.bottom-i.top)}}function io(e,t,i){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 n=0;n<e.rest.length;n++)if(Ot(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=ar(t);var i=Ot(t),r=e.display.externalMeasured=new Pt(e.doc,t,i);r.lineN=i;var n=r.built=jn(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function no(e,t,i,r){return ai(e,$i(e,t),i,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ui(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function $i(e,t){var i=Ot(t),r=ma(e,i);r&&!r.text?r=null:r&&r.changes&&(pn(e,r,i,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=io(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ai(e,t,i,r,n){t.before&&(i=-1);var _=i+(r||""),H;return t.cache.hasOwnProperty(_)?H=t.cache[_]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,i,r),H.bogus||(t.cache[_]=H)),{left:H.left,right:H.right,top:n?H.rtop:H.top,bottom:n?H.rbottom:H.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,i){for(var r,n,_,H,Q,J,ee=0;ee<e.length;ee+=3)if(Q=e[ee],J=e[ee+1],t<Q?(n=0,_=1,H="left"):t<J?(n=t-Q,_=n+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(_=J-Q,n=_-1,t>=J&&(H="right")),n!=null){if(r=e[ee+2],Q==J&&i==(r.insertLeft?"left":"right")&&(H=i),i=="left"&&n==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)r=e[(ee-=3)+2],H="left";if(i=="right"&&n==J-Q)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)r=e[(ee+=3)+2],H="right";break}return{node:r,start:n,end:_,collapse:H,coverStart:Q,coverEnd:J}}function js(e,t){var i=ao;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=oo(t.map,i,r),_=n.node,H=n.start,Q=n.end,J=n.collapse,ee;if(_.nodeType==3){for(var ce=0;ce<4;ce++){for(;H&&Be(t.line.text.charAt(n.coverStart+H));)--H;for(;n.coverStart+Q<n.coverEnd&&Be(t.line.text.charAt(n.coverStart+Q));)++Q;if(W&&B<9&&H==0&&Q==n.coverEnd-n.coverStart?ee=_.parentNode.getBoundingClientRect():ee=js(S(_,H,Q).getClientRects(),r),ee.left||ee.right||H==0)break;Q=H,H=H-1,J="right"}W&&B<11&&(ee=Hs(e.display.measure,ee))}else{H>0&&(J=r="right");var me;e.options.lineWrapping&&(me=_.getClientRects()).length>1?ee=me[r=="right"?me.length-1:0]:ee=_.getBoundingClientRect()}if(W&&B<9&&!H&&(!ee||!ee.left&&!ee.right)){var ke=_.parentNode.getClientRects()[0];ke?ee={left:ke.left,right:ke.left+Ji(e.display),top:ke.top,bottom:ke.bottom}:ee=ao}for(var we=ee.top-t.rect.top,je=ee.bottom-t.rect.top,Ke=(we+je)/2,Je=t.view.measure.heights,tt=0;tt<Je.length-1&&!(Ke<Je[tt]);tt++);var ut=tt?Je[tt-1]:0,rt=Je[tt],ht={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:ut,bottom:rt};return!ee.left&&!ee.right&&(ht.bogus=!0),e.options.singleCursorHeightPerLine||(ht.rtop=we,ht.rbottom=je),ht}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Kt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,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 vn(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 f&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ho(){return f&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ga(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function Hn(e,t,i,r,n){if(!n){var _=ga(t);i.top+=_,i.bottom+=_}if(r=="line")return i;r||(r="local");var H=Ir(t);if(r=="local"?H+=Wn(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Q=e.display.lineSpace.getBoundingClientRect();H+=Q.top+(r=="window"?0:ho());var J=Q.left+(r=="window"?0:uo());i.left+=J,i.right+=J}return i.top+=H,i.bottom+=H,i}function co(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=uo(),n-=ho();else if(i=="local"||!i){var _=e.display.sizer.getBoundingClientRect();r+=_.left,n+=_.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:n-H.top}}function va(e,t,i,r,n){return r||(r=ft(e.doc,t.line)),Hn(e,r,no(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,_){r=r||ft(e.doc,t.line),n||(n=$i(e,r));function H(je,Ke){var Je=ai(e,n,je,Ke?"right":"left",_);return Ke?Je.left=Je.right:Je.right=Je.left,Hn(e,r,Je,i)}var Q=Ze(r,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=r.text.length?(J=r.text.length,ee="before"):J<=0&&(J=0,ee="after"),!Q)return H(ee=="before"?J-1:J,ee=="before");function ce(je,Ke,Je){var tt=Q[Ke],ut=tt.level==1;return H(Je?je-1:je,ut!=Je)}var me=Qe(Q,J,ee),ke=qe,we=ce(J,me,ee=="before");return ke!=null&&(we.other=ce(J,ke,ee!="before")),we}function fo(e,t){var i=0;t=l(e.doc,t),e.options.lineWrapping||(i=Ji(e.display)*t.ch);var r=ft(e.doc,t.line),n=Ir(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ya(e,t,i,r,n){var _=Xe(e,t,i);return _.xRel=n,r&&(_.outside=r),_}function ba(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ya(r.first,0,null,-1,-1);var n=Vr(r,i),_=r.first+r.size-1;if(n>_)return ya(r.first+r.size-1,ft(r,_).text.length,null,1,1);t<0&&(t=0);for(var H=ft(r,n);;){var Q=zs(e,H,n,t,i),J=yi(H,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!J)return Q;var ee=J.find(1);if(ee.line==n)return ee;H=ft(r,n=ee.line)}}function po(e,t,i,r){r-=ga(t);var n=t.text.length,_=it(function(H){return ai(e,i,H-1).bottom<=r},n,0);return n=it(function(H){return ai(e,i,H).top>r},_,n),{begin:_,end:n}}function mo(e,t,i,r){i||(i=$i(e,t));var n=Hn(e,t,ai(e,i,r),"line").top;return po(e,t,i,n)}function xa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zs(e,t,i,r,n){n-=Ir(t);var _=$i(e,t),H=ga(t),Q=0,J=t.text.length,ee=!0,ce=Ze(t,e.doc.direction);if(ce){var me=(e.options.lineWrapping?Ks:Gs)(e,t,i,_,ce,r,n);ee=me.level!=1,Q=ee?me.from:me.to-1,J=ee?me.to:me.from-1}var ke=null,we=null,je=it(function(Et){var vt=ai(e,_,Et);return vt.top+=H,vt.bottom+=H,xa(vt,r,n,!1)?(vt.top<=n&&vt.left<=r&&(ke=Et,we=vt),!0):!1},Q,J),Ke,Je,tt=!1;if(we){var ut=r-we.left<we.right-r,rt=ut==ee;je=ke+(rt?0:1),Je=rt?"after":"before",Ke=ut?we.left:we.right}else{!ee&&(je==J||je==Q)&&je++,Je=je==0?"after":je==t.text.length?"before":ai(e,_,je-(ee?1:0)).bottom+H<=n==ee?"after":"before";var ht=Jr(e,Xe(i,je,Je),"line",t,_);Ke=ht.left,tt=n<ht.top?-1:n>=ht.bottom?1:0}return je=Fe(t.text,je,1),ya(i,je,Je,tt,r-Ke)}function Gs(e,t,i,r,n,_,H){var Q=it(function(me){var ke=n[me],we=ke.level!=1;return xa(Jr(e,Xe(i,we?ke.to:ke.from,we?"before":"after"),"line",t,r),_,H,!0)},0,n.length-1),J=n[Q];if(Q>0){var ee=J.level!=1,ce=Jr(e,Xe(i,ee?J.from:J.to,ee?"after":"before"),"line",t,r);xa(ce,_,H,!0)&&ce.top>H&&(J=n[Q-1])}return J}function Ks(e,t,i,r,n,_,H){var Q=po(e,t,r,H),J=Q.begin,ee=Q.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,me=null,ke=0;ke<n.length;ke++){var we=n[ke];if(we.from>=ee||we.to<=J)continue;var je=we.level!=1,Ke=ai(e,r,je?Math.min(ee,we.to)-1:Math.max(J,we.from)).right,Je=Ke<_?_-Ke+1e9:Ke-_;(!ce||me>Je)&&(ce=we,me=Je)}return ce||(ce=n[n.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>ee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Ni;function Qi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ni==null){Ni=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ni.appendChild(document.createTextNode("x")),Ni.appendChild(o("br"));Ni.appendChild(document.createTextNode("x"))}u(e.measure,Ni);var i=Ni.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function Ji(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),i=o("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,_=t.gutters.firstChild,H=0;_;_=_.nextSibling,++H){var Q=e.display.gutterSpecs[H].className;i[Q]=_.offsetLeft+_.clientLeft+n,r[Q]=_.clientWidth}return{fixedPos:Sa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Qi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Ji(e.display)-3);return function(n){if(Qr(e.doc,n))return 0;var _=0;if(n.widgets)for(var H=0;H<n.widgets.length;H++)n.widgets[H].height&&(_+=n.widgets[H].height);return i?_+(Math.ceil(n.text.length/r)||1)*t:_+t}}function Ca(e){var t=e.doc,i=go(e);t.iter(function(r){var n=i(r);n!=r.height&&wr(r,n)})}function Bi(e,t,i,r){var n=e.display;if(!i&&Le(t).getAttribute("cm-not-content")=="true")return null;var _,H,Q=n.lineSpace.getBoundingClientRect();try{_=t.clientX-Q.left,H=t.clientY-Q.top}catch(me){return null}var J=ba(e,_,H),ee;if(r&&J.xRel>0&&(ee=ft(e.doc,J.line).text).length==J.ch){var ce=X(ee,ee.length,e.options.tabSize)-ee.length;J=Xe(J.line,Math.max(0,Math.round((_-ro(e.display).left)/Ji(e.display))-ce))}return J}function Ui(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Lr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Ar&&xi(e.doc,t)<n.viewTo&&Ci(e);else if(i<=n.viewFrom)Ar&&Fn(e.doc,i+r)>n.viewFrom?Ci(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ci(e);else if(t<=n.viewFrom){var _=zn(e,i,i+r,1);_?(n.view=n.view.slice(_.index),n.viewFrom=_.lineN,n.viewTo+=r):Ci(e)}else if(i>=n.viewTo){var H=zn(e,t,t,-1);H?(n.view=n.view.slice(0,H.index),n.viewTo=H.lineN):Ci(e)}else{var Q=zn(e,t,t,-1),J=zn(e,i,i+r,1);Q&&J?(n.view=n.view.slice(0,Q.index).concat(Qt(e,Q.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):Ci(e)}var ee=n.externalMeasured;ee&&(i<ee.lineN?ee.lineN+=r:t<ee.lineN+ee.size&&(n.externalMeasured=null))}function Si(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var _=r.view[Ui(e,t)];if(_.node==null)return;var H=_.changes||(_.changes=[]);se(H,i)==-1&&H.push(i)}function Ci(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Ui(e,t),_,H=e.display.view;if(!Ar||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Q=e.display.viewFrom,J=0;J<n;J++)Q+=H[J].size;if(Q!=t){if(r>0){if(n==H.length-1)return null;_=Q+H[n].size-t,n++}else _=Q-t;t+=_,i+=_}for(;xi(e.doc,i)!=i;){if(n==(r<0?0:H.length-1))return null;i+=r*H[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Qt(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Qt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ui(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Qt(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ui(e,i)))),r.viewTo=i}function vo(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),_=r.selection=document.createDocumentFragment(),H=0;H<i.sel.ranges.length;H++){if(!t&&H==i.sel.primIndex)continue;var Q=i.sel.ranges[H];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var J=Q.empty();(J||e.options.showCursorWhenSelecting)&&bo(e,Q.head,n),J||Xs(e,Q,_)}return r}function bo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(o("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var _=i.appendChild(o("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 Gn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,_=document.createDocumentFragment(),H=ro(e.display),Q=H.left,J=Math.max(r.sizerWidth,Ii(e)-r.sizer.offsetLeft)-H.right,ee=n.direction=="ltr";function ce(rt,ht,Et,vt){ht<0&&(ht=0),ht=Math.round(ht),vt=Math.round(vt),_.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
top: `+ht+"px; width: "+(Et==null?J-rt:Et)+`px;
height: `+(vt-ht)+"px"))}function me(rt,ht,Et){var vt=ft(n,rt),_t=vt.text.length,Yt,dr;function Jt(tr,Rr){return va(e,Xe(rt,tr),"div",vt,Rr)}function Br(tr,Rr,vr){var or=mo(e,vt,null,tr),rr=Rr=="ltr"==(vr=="after")?"left":"right",Zt=vr=="after"?or.begin:or.end-(/\s/.test(vt.text.charAt(or.end-1))?2:1);return Jt(Zt,rr)[rr]}var Dr=Ze(vt,n.direction);return et(Dr,ht||0,Et==null?_t:Et,function(tr,Rr,vr,or){var rr=vr=="ltr",Zt=Jt(tr,rr?"left":"right"),Or=Jt(Rr-1,rr?"right":"left"),dn=ht==null&&tr==0,ki=Et==null&&Rr==_t,Er=or==0,oi=!Dr||or==Dr.length-1;if(Or.top-Zt.top<=3){var cr=(ee?dn:ki)&&Er,Ya=(ee?ki:dn)&&oi,mi=cr?Q:(rr?Zt:Or).left,zi=Ya?J:(rr?Or:Zt).right;ce(mi,Zt.top,zi-mi,Zt.bottom)}else{var Gi,Cr,cn,$a;rr?(Gi=ee&&dn&&Er?Q:Zt.left,Cr=ee?J:Br(tr,vr,"before"),cn=ee?Q:Br(Rr,vr,"after"),$a=ee&&ki&&oi?J:Or.right):(Gi=ee?Br(tr,vr,"before"):Q,Cr=!ee&&dn&&Er?J:Zt.right,cn=!ee&&ki&&oi?Q:Or.left,$a=ee?Br(Rr,vr,"after"):J),ce(Gi,Zt.top,Cr-Gi,Zt.bottom),Zt.bottom<Or.top&&ce(Q,Zt.bottom,null,Or.top),ce(cn,Or.top,$a-cn,Or.bottom)}(!Yt||Gn(Zt,Yt)<0)&&(Yt=Zt),Gn(Or,Yt)<0&&(Yt=Or),(!dr||Gn(Zt,dr)<0)&&(dr=Zt),Gn(Or,dr)<0&&(dr=Or)}),{start:Yt,end:dr}}var ke=t.from(),we=t.to();if(ke.line==we.line)me(ke.line,ke.ch,we.ch);else{var je=ft(n,ke.line),Ke=ft(n,we.line),Je=ar(je)==ar(Ke),tt=me(ke.line,ke.ch,Je?je.text.length+1:null).end,ut=me(we.line,Je?0:null,we.ch).start;Je&&(tt.top<ut.top-2?(ce(tt.right,tt.top,null,tt.bottom),ce(Q,ut.top,ut.left,ut.bottom)):ce(tt.right,tt.top,ut.left-tt.right,tt.bottom)),tt.bottom<ut.top&&ce(Q,tt.bottom,null,ut.top)}i.appendChild(_)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function xo(e){e.state.focused||(e.display.input.focus(),wa(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ne(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(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ne(e,"blur",e,t),e.state.focused=!1,g(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],_=e.options.lineWrapping,H=void 0,Q=0;if(n.hidden)continue;if(W&&B<8){var J=n.node.offsetTop+n.node.offsetHeight;H=J-i,i=J}else{var ee=n.node.getBoundingClientRect();H=ee.bottom-ee.top,!_&&n.text.firstChild&&(Q=n.text.firstChild.getBoundingClientRect().right-ee.left-1)}var ce=n.line.height-H;if((ce>.005||ce<-.005)&&(wr(n.line,H),So(n.line),n.rest))for(var me=0;me<n.rest.length;me++)So(n.rest[me]);if(Q>e.display.sizerWidth){var ke=Math.ceil(Q/Ji(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function So(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,_=Vr(t,r),H=Vr(t,n);if(i&&i.ensure){var Q=i.ensure.from.line,J=i.ensure.to.line;Q<_?(_=Q,H=Vr(t,Ir(ft(t,Q))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=H&&(_=Vr(t,Ir(ft(t,J))-e.wrapper.clientHeight),H=J)}return{from:_,to:Math.max(H,_+1)}}function Ys(e,t){if(Ve(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!C){var _=o("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(n),e.display.lineSpace.removeChild(_)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Xe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Xe(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var H=!1,Q=Jr(e,t),J=!i||i==t?Q:Jr(e,i);n={left:Math.min(Q.left,J.left),top:Math.min(Q.top,J.top)-r,right:Math.max(Q.left,J.left),bottom:Math.max(Q.bottom,J.bottom)+r};var ee=Aa(e,n),ce=e.doc.scrollTop,me=e.doc.scrollLeft;if(ee.scrollTop!=null&&(xn(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(H=!0)),ee.scrollLeft!=null&&(Fi(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(H=!0)),!H)break}return n}function Qs(e,t){var i=Aa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Fi(e,i.scrollLeft)}function Aa(e,t){var i=e.display,r=Qi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,_=pa(e),H={};t.bottom-t.top>_&&(t.bottom=t.top+_);var Q=e.doc.height+fa(i),J=t.top<r,ee=t.bottom>Q-r;if(t.top<n)H.scrollTop=J?0:t.top;else if(t.bottom>n+_){var ce=Math.min(t.top,(ee?Q:t.bottom)-_);ce!=n&&(H.scrollTop=ce)}var me=e.options.fixedGutter?0:i.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-me,we=Ii(e)-i.gutters.offsetWidth,je=t.right-t.left>we;return je&&(t.right=t.left+we),t.left<10?H.scrollLeft=0:t.left<ke?H.scrollLeft=Math.max(0,t.left+me-(je?0:10)):t.right>we+ke-3&&(H.scrollLeft=t.right+(je?0:10)-we),H}function _a(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qi(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,i){(t!=null||i!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=fo(e,t.from),r=fo(e,t.to);Co(e,i,r,t.margin)}}function Co(e,t,i,r){var n=Aa(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bn(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||ka(e,{top:t}),To(e,t,!0),D&&ka(e),Cn(e,100)}function To(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Fi(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,ko(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function En(e){var t=e.display,i=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?i:0,docHeight:r,scrollHeight:r+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ji=function(e,t,i){this.cm=i;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Pe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Pe(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ji.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var _=e.viewWidth-e.barLeft-(i?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:i?r:0,bottom:t?r:0}},ji.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ji.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ji.prototype.zeroWidthHack=function(){var e=s&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new q,this.disableVert=new q},ji.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),_=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);_!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ji.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sn=function(){};Sn.prototype.update=function(){return{bottom:0,right:0}},Sn.prototype.setScrollLeft=function(){},Sn.prototype.setScrollTop=function(){},Sn.prototype.clear=function(){};function en(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),wo(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function wo(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Ao={native:ji,null:Sn};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Fi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Wi(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},Dt(e.curOp)}function Hi(e){var t=e.curOp;t&&zt(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var _=0;_<t.length;_++)il(t[_]);for(var H=0;H<t.length;H++)nl(t[H])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&ci(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ii(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&en(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&xo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&To(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,l(r,e.scrollToPos.from),l(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var _=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(_)for(var Q=0;Q<_.length;++Q)_[Q].lines.length||Ne(_[Q],"hide");if(H)for(var J=0;J<H.length;++J)H[J].lines.length&&Ne(H[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ne(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Nr(e,t){if(e.curOp)return t();Wi(e);try{return t()}finally{Hi(e)}}function ur(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);Wi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function hr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Wi(t);try{return e.apply(this,arguments)}finally{Hi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Re(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(_){if(r.line>=e.display.viewFrom){var H=_.styles,Q=_.text.length>e.options.maxHighlightLength?Tr(t.mode,r.state):null,J=ve(e,_,r,!0);Q&&(r.state=Q),_.styles=J.styles;var ee=_.styleClasses,ce=J.classes;ce?_.styleClasses=ce:ee&&(_.styleClasses=null);for(var me=!H||H.length!=_.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),ke=0;!me&&ke<H.length;++ke)me=H[ke]!=_.styles[ke];me&&n.push(r.line),_.stateAfter=r.save(),r.nextLine()}else _.text.length<=e.options.maxHighlightLength&&ct(e,_.text,r),_.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Nr(e,function(){for(var _=0;_<n.length;_++)Si(e,n[_],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ii(e),this.force=i,this.dims=Ea(e),this.events=[]};Yn.prototype.signal=function(e,t){ge(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ne.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=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=O();if(!t||!m(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&m(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==O())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&m(document.body,e.anchorNode)&&m(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ci(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&vo(e)==0)return!1;Do(e)&&(Ci(e),t.dims=Ea(e));var n=r.first+r.size,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<_&&_-i.viewFrom<20&&(_=Math.max(r.first,i.viewFrom)),i.viewTo>H&&i.viewTo-H<20&&(H=Math.min(n,i.viewTo)),Ar&&(_=xi(e.doc,_),H=Fn(e.doc,H));var Q=_!=i.viewFrom||H!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,_,H),i.viewOffset=Ir(ft(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=vo(e);if(!Q&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var ee=sl(e);return J>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),J>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(ee),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Q&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function Lo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Ii(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+fa(e.display)-pa(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!La(e,t))break;Kn(e);var n=En(e);yn(e),en(e,n),Ra(e,n),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 ka(e,t){var i=new Yn(e,t);if(La(e,i)){Kn(e),Lo(e,i);var r=En(e);yn(e),en(e,r),Ra(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,_=r.lineDiv,H=_.firstChild;function Q(je){var Ke=je.nextSibling;return P&&s&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ke}for(var J=r.view,ee=r.viewFrom,ce=0;ce<J.length;ce++){var me=J[ce];if(!me.hidden)if(!me.node||me.node.parentNode!=_){var ke=Ns(e,me,ee,i);_.insertBefore(ke,H)}else{for(;H!=me.node;)H=Q(H);var we=n&&t!=null&&t<=ee&&me.lineNumber;me.changes&&(se(me.changes,"gutter")>-1&&(we=!1),pn(e,me,ee,i)),we&&(c(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(gi(e.options,ee)))),H=me.node.nextSibling}ee+=me.size}for(;H;)H=Q(H)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+ni(e)+"px"}function ko(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Sa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,_=r+"px",H=0;H<i.length;H++)if(!i[H].hidden){e.options.fixedGutter&&(i[H].gutter&&(i[H].gutter.style.left=_),i[H].gutterBackground&&(i[H].gutterBackground.style.left=_));var Q=i[H].alignable;if(Q)for(var J=0;J<Q.length;J++)Q[J].style.left=_}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Do(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=gi(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(o("div",[o("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=n.firstChild.offsetWidth,H=n.offsetWidth-_;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(_,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Oa(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var _=e[n],H=null;if(typeof _!="string"&&(H=_.style,_=_.className),_=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:_,style:H})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Ro(e){var t=e.gutters,i=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],_=n.className,H=n.style,Q=t.appendChild(o("div",null,"CodeMirror-gutter "+_));H&&(Q.style.cssText=H),_=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Da(e)}function Tn(e){Ro(e.display),Lr(e),ko(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=T("div",null,"CodeMirror-code"),n.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=o("div",null,"CodeMirror-cursors"),n.measure=o("div",null,"CodeMirror-measure"),n.lineMeasure=o("div",null,"CodeMirror-measure"),n.lineSpace=T("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var _=T("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[_],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+he+"px; width: 1px;"),n.gutters=o("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=o("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=o("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),W&&B<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!P&&!(D&&a)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Oa(r.gutters,r.lineNumbers),Ro(n),i.init(n)}var $n=0,Hr=null;W?Hr=-.53:D?Hr=15:f?Hr=-.7:M&&(Hr=-1/3);function Oo(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function dl(e){var t=Oo(e);return t.x*=Hr,t.y*=Hr,t}function Po(e,t){var i=Oo(t),r=i.x,n=i.y,_=e.display,H=_.scroller,Q=H.scrollWidth>H.clientWidth,J=H.scrollHeight>H.clientHeight;if(!(r&&Q||n&&J))return;if(n&&s&&P){e:for(var ee=t.target,ce=_.view;ee!=H;ee=ee.parentNode)for(var me=0;me<ce.length;me++)if(ce[me].node==ee){e.display.currentWheelTarget=ee;break e}}if(r&&!D&&!x&&Hr!=null){n&&J&&xn(e,Math.max(0,H.scrollTop+n*Hr)),Fi(e,Math.max(0,H.scrollLeft+r*Hr)),(!n||n&&J)&&ie(t),_.wheelStartX=null;return}if(n&&Hr!=null){var ke=n*Hr,we=e.doc.scrollTop,je=we+_.wrapper.clientHeight;ke<0?we=Math.max(0,we+ke-50):je=Math.min(e.doc.height,je+ke+50),ka(e,{top:we,bottom:je})}$n<20&&(_.wheelStartX==null?(_.wheelStartX=H.scrollLeft,_.wheelStartY=H.scrollTop,_.wheelDX=r,_.wheelDY=n,setTimeout(function(){if(_.wheelStartX==null)return;var Ke=H.scrollLeft-_.wheelStartX,Je=H.scrollTop-_.wheelStartY,tt=Je&&_.wheelDY&&Je/_.wheelDY||Ke&&_.wheelDX&&Ke/_.wheelDX;if(_.wheelStartX=_.wheelStartY=null,!tt)return;Hr=(Hr*$n+tt)/($n+1),++$n},200)):(_.wheelDX+=r,_.wheelDY+=n))}var zr=function(e,t){this.ranges=e,this.primIndex=t};zr.prototype.primary=function(){return this.ranges[this.primIndex]},zr.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 i=this.ranges[t],r=e.ranges[t];if(!ei(i.anchor,r.anchor)||!ei(i.head,r.head))return!1}return!0},zr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(hi(this.ranges[t].anchor),hi(this.ranges[t].head));return new zr(e,this.primIndex)},zr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},zr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(St(t,r.from())>=0&&St(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return Di(this.anchor,this.head)},jt.prototype.to=function(){return di(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Zr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(ke,we){return St(ke.from(),we.from())}),i=se(t,n);for(var _=1;_<t.length;_++){var H=t[_],Q=t[_-1],J=St(Q.to(),H.from());if(r&&!H.empty()?J>0:J>=0){var ee=Di(Q.from(),H.from()),ce=di(Q.to(),H.to()),me=Q.empty()?H.from()==H.head:Q.from()==Q.head;_<=i&&--i,t.splice(--_,2,new jt(me?ce:ee,me?ee:ce))}}return new zr(t,i)}function Ti(e,t){return new zr([new jt(e,t||e)],0)}function wi(e){return e.text?Xe(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return wi(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=wi(t).ch-t.to.ch),Xe(i,r)}function Pa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Mo(n.anchor,t),Mo(n.head,t)))}return Zr(e.cm,i,e.sel.primIndex)}function Io(e,t,i){return e.line==t.line?Xe(i.line,e.ch-t.ch+i.ch):Xe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Xe(e.first,0),_=n,H=0;H<t.length;H++){var Q=t[H],J=Io(Q.from,n,_),ee=Io(wi(Q),n,_);if(n=Q.to,_=ee,i=="around"){var ce=e.sel.ranges[H],me=St(ce.head,ce.anchor)<0;r[H]=new jt(me?ee:J,me?J:ee)}else r[H]=new jt(J,J)}return new zr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Gr(e.options,e.doc.modeOption),wn(e)}function wn(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,Cn(e,100),e.state.modeGen++,e.curOp&&Lr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ia(e,t,i,r){function n(ut){return i?i[ut]:null}function _(ut,rt,ht){ua(ut,rt,ht,r),Vt(ut,"change",ut,t)}function H(ut,rt){for(var ht=[],Et=ut;Et<rt;++Et)ht.push(new Ei(ee[Et],n(Et),r));return ht}var Q=t.from,J=t.to,ee=t.text,ce=ft(e,Q.line),me=ft(e,J.line),ke=te(ee),we=n(ee.length-1),je=J.line-Q.line;if(t.full)e.insert(0,H(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(No(e,t)){var Ke=H(0,ee.length-1);_(me,me.text,we),je&&e.remove(Q.line,je),Ke.length&&e.insert(Q.line,Ke)}else if(ce==me)if(ee.length==1)_(ce,ce.text.slice(0,Q.ch)+ke+ce.text.slice(J.ch),we);else{var Je=H(1,ee.length-1);Je.push(new Ei(ke+ce.text.slice(J.ch),we,r)),_(ce,ce.text.slice(0,Q.ch)+ee[0],n(0)),e.insert(Q.line+1,Je)}else if(ee.length==1)_(ce,ce.text.slice(0,Q.ch)+ee[0]+me.text.slice(J.ch),n(0)),e.remove(Q.line+1,je);else{_(ce,ce.text.slice(0,Q.ch)+ee[0],n(0)),_(me,ke+me.text.slice(J.ch),we);var tt=H(1,ee.length-1);je>1&&e.remove(Q.line+1,je-1),e.insert(Q.line+1,tt)}Vt(e,"change",e,t)}function Ai(e,t,i){function r(n,_,H){if(n.linked)for(var Q=0;Q<n.linked.length;++Q){var J=n.linked[Q];if(J.doc==_)continue;var ee=H&&J.sharedHist;if(i&&!ee)continue;t(J.doc,ee),r(J.doc,n,ee)}}r(e,null,!0)}function Bo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Ma(e),Uo(e),e.options.lineWrapping||ci(e),e.options.mode=t.modeOption,Lr(e)}function Uo(e){(e.doc.direction=="rtl"?U:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Nr(e,function(){Uo(e),Lr(e)})}function Qn(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 Na(e,t){var i={from:hi(t.from),to:wi(t),text:Ur(e,t.from,t.to)};return Wo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Wo(r,i,t.from.line,t.to.line+1)},!0),i}function Fo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function jo(e,t,i,r){var n=e.history;n.undone.length=0;var _=+new Date,H,Q;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(n,n.lastOp==r)))Q=te(H.changes),St(t.from,t.to)==0&&St(t.from,Q.to)==0?Q.to=wi(t):H.changes.push(Na(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Jn(e.sel,n.done),H={changes:[Na(e,t)],generation:n.generation},n.done.push(H);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=_,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Q||Ne(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,_=r&&r.origin;i==n.lastSelOp||_&&n.lastSelOrigin==_&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==_||ml(e,_,te(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=_,n.lastSelOp=i,r&&r.clearRedo!==!1&&Fo(n.undone)}function Jn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Wo(e,t,i,r){var n=t["spans_"+e.id],_=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((n||(n=t["spans_"+e.id]={}))[_]=H.markedSpans),++_})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Ho(e,t){var i=yl(e,t),r=Pr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var _=i[n],H=r[n];if(_&&H){e:for(var Q=0;Q<H.length;++Q){for(var J=H[Q],ee=0;ee<_.length;++ee)if(_[ee].marker==J.marker)continue e;_.push(J)}}else H&&(i[n]=H)}return i}function tn(e,t,i){for(var r=[],n=0;n<e.length;++n){var _=e[n];if(_.ranges){r.push(i?zr.prototype.deepCopy.call(_):_);continue}var H=_.changes,Q=[];r.push({changes:Q});for(var J=0;J<H.length;++J){var ee=H[J],ce=void 0;if(Q.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var me in ee)(ce=me.match(/^spans_(\d+)$/))&&(se(t,Number(ce[1]))>-1&&(te(Q)[me]=ee[me],delete ee[me]))}}return r}function Ba(e,t,i,r){if(r){var n=e.anchor;if(i){var _=St(t,n)<0;_!=St(i,n)<0?(n=t,t=i):_!=St(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function Zn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),xr(e,new zr([Ba(e.sel.primary(),t,i,n)],0),r)}function zo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),_=0;_<e.sel.ranges.length;_++)r[_]=Ba(e.sel.ranges[_],t[_],null,n);var H=Zr(e.cm,r,e.sel.primIndex);xr(e,H,i)}function Ua(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,xr(e,Zr(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){xr(e,Ti(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var _=0;_<n.length;_++)this.ranges[_]=new jt(l(e,n[_].anchor),l(e,n[_].head))},origin:i&&i.origin};return Ne(e,"beforeSelectionChange",e,r),e.cm&&Ne(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Zr(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):xr(e,t,i)}function xr(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(ge(e,"beforeSelectionChange")||e.cm&&ge(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&qi(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,Ee(e.cm)),Vt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,i,r){for(var n,_=0;_<t.ranges.length;_++){var H=t.ranges[_],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[_],J=ea(e,H.anchor,Q&&Q.anchor,i,r),ee=ea(e,H.head,Q&&Q.head,i,r);(n||J!=H.anchor||ee!=H.head)&&(n||(n=t.ranges.slice(0,_)),n[_]=new jt(J,ee))}return n?Zr(e.cm,n,t.primIndex):t}function rn(e,t,i,r,n){var _=ft(e,t.line);if(_.markedSpans)for(var H=0;H<_.markedSpans.length;++H){var Q=_.markedSpans[H],J=Q.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Q.from==null||(ee?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(ce?Q.to>=t.ch:Q.to>t.ch))){if(n&&(Ne(J,"beforeCursorEnter"),J.explicitlyCleared))if(_.markedSpans){--H;continue}else break;if(!J.atomic)continue;if(i){var me=J.find(r<0?1:-1),ke=void 0;if((r<0?ce:ee)&&(me=$o(e,me,-r,me&&me.line==t.line?_:null)),me&&me.line==t.line&&(ke=St(me,i))&&(r<0?ke<0:ke>0))return rn(e,me,t,r,n)}var we=J.find(r<0?-1:1);return(r<0?ee:ce)&&(we=$o(e,we,r,we.line==t.line?_:null)),we?rn(e,we,t,r,n):null}}return t}function ea(e,t,i,r,n){var _=r||1,H=rn(e,t,i,_,n)||!n&&rn(e,t,i,_,!0)||rn(e,t,i,-_,n)||!n&&rn(e,t,i,-_,!0);return H||(e.cantEdit=!0,Xe(e.first,0))}function $o(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?l(e,Xe(t.line-1)):null:i>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?Xe(t.line+1,0):null:new Xe(t.line,t.ch+i)}function Qo(e){e.setSelection(Xe(e.firstLine(),0),Xe(e.lastLine()),be)}function Jo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,_,H,Q){n&&(r.from=l(e,n)),_&&(r.to=l(e,_)),H&&(r.text=H),Q!==void 0&&(r.origin=Q)}),Ne(e,"beforeChange",e,r),e.cm&&Ne(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 nn(e,t,i){if(e.cm){if(!e.cm.curOp)return ur(e.cm,nn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ki&&!i&&Ri(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Zo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&St(t.from,t.to)==0)return;var i=Pa(e,t);jo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Pr(e,t));var r=[];Ai(e,function(n,_){!_&&se(r,n.history)==-1&&(rs(n.history,t),r.push(n.history)),An(n,t,null,Pr(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,_,H=e.sel,Q=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,ee=0;ee<Q.length&&!(_=Q[ee],i?_.ranges&&!_.equals(e.sel):!_.ranges);ee++);if(ee==Q.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(_=Q.pop(),_.ranges){if(Jn(_,J),i&&!_.equals(e.sel)){xr(e,_,{clearRedo:!1});return}H=_}else if(r){Q.push(_);return}else break;var ce=[];Jn(H,J),J.push({changes:ce,generation:n.generation}),n.generation=_.generation||++n.maxGeneration;for(var me=ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"),ke=function(Ke){var Je=_.changes[Ke];if(Je.origin=t,me&&!Jo(e,Je,!1))return Q.length=0,{};ce.push(Na(e,Je));var tt=Ke?Pa(e,Je):te(Q);An(e,Je,tt,Ho(e,Je)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Je.from,to:wi(Je)});var ut=[];Ai(e,function(rt,ht){!ht&&se(ut,rt.history)==-1&&(rs(rt.history,Je),ut.push(rt.history)),An(rt,Je,null,Ho(rt,Je))})},we=_.changes.length-1;we>=0;--we){var je=ke(we);if(je)return je.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new zr(fe(e.sel.ranges,function(n){return new jt(Xe(n.anchor.line+t,n.anchor.ch),Xe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Lr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Si(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return ur(e.cm,An)(e,t,i,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 n=t.text.length-1-(e.first-t.from.line);qo(e,n),t={from:Xe(e.first,0),to:Xe(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var _=e.lastLine();t.to.line>_&&(t={from:t.from,to:Xe(_,ft(e,_).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ur(e,t.from,t.to),i||(i=Pa(e,t)),e.cm?xl(e.cm,t,r):Ia(e,t,r),qn(e,i,be),e.cantEdit&&ea(e,Xe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,_=t.from,H=t.to,Q=!1,J=_.line;e.options.lineWrapping||(J=Ot(ar(ft(r,_.line))),r.iter(J,H.line+1,function(we){if(we==n.maxLine)return Q=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ee(e),Ia(r,t,i,go(e)),e.options.lineWrapping||(r.iter(J,_.line+t.text.length,function(we){var je=Yi(we);je>n.maxLineLength&&(n.maxLine=we,n.maxLineLength=je,n.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Xr(r,_.line),Cn(e,400);var ee=t.text.length-(H.line-_.line)-1;t.full?Lr(e):_.line==H.line&&t.text.length==1&&!No(e.doc,t)?Si(e,_.line,"text"):Lr(e,_.line,H.line+1,ee);var ce=ge(e,"changes"),me=ge(e,"change");if(me||ce){var ke={from:_,to:H,text:t.text,removed:t.removed,origin:t.origin};me&&Vt(e,"change",e,ke),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function an(e,t,i,r,n){var _;r||(r=i),St(r,i)<0&&(_=[r,i],i=_[0],r=_[1]),typeof t=="string"&&(t=e.splitLines(t)),nn(e,{from:i,to:r,text:t,origin:n})}function es(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,i,r){for(var n=0;n<e.length;++n){var _=e[n],H=!0;if(_.ranges){_.copied||(_=e[n]=_.deepCopy(),_.copied=!0);for(var Q=0;Q<_.ranges.length;Q++)es(_.ranges[Q].anchor,t,i,r),es(_.ranges[Q].head,t,i,r);continue}for(var J=0;J<_.changes.length;++J){var ee=_.changes[J];if(i<ee.from.line)ee.from=Xe(ee.from.line+r,ee.from.ch),ee.to=Xe(ee.to.line+r,ee.to.ch);else if(t<=ee.to.line){H=!1;break}}H||(e.splice(0,n+1),n=0)}}function rs(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;ts(e.done,i,r,n),ts(e.undone,i,r,n)}function _n(e,t,i,r){var n=t,_=t;return typeof t=="number"?_=ft(e,V(e,t)):n=Ot(t),n==null?null:(r(_,n)&&e.cm&&Si(e.cm,n,i),_)}function Ln(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ln.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,ha(n),Vt(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function kn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}kn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var _=Math.min(t,n-e),H=r.height;if(r.removeInner(e,_),this.height-=H-r.height,n==_&&(this.children.splice(i--,1),r.parent=null),(t-=_)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var Q=[];this.collapse(Q),this.children=[new Ln(Q)],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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],_=n.chunkSize();if(e<=_){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var H=n.lines.length%25+25,Q=H;Q<n.lines.length;){var J=new Ln(n.lines.slice(Q,Q+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,H),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),i=new kn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=se(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new kn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],_=n.chunkSize();if(e<_){var H=Math.min(t,_-e);if(n.iterN(e,H,i))return!0;if((t-=H)==0)break;e=0}else e-=_}}};var Dn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Dn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Ot(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var _=gn(this);wr(i,Math.max(0,i.height-_)),e&&(Nr(e,function(){is(e,i,-_),Si(e,r,"widget")}),Vt(e,"lineWidgetCleared",e,this,r))},Dn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=gn(this)-t;if(!n)return;Qr(this.doc,r)||wr(r,r.height+n),i&&Nr(i,function(){i.curOp.forceUpdate=!0,is(i,r,n),Vt(i,"lineWidgetChanged",i,e,Ot(r))})},ye(Dn);function is(e,t,i){Ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&_a(e,i)}function El(e,t,i,r){var n=new Dn(e,i,r),_=e.cm;return _&&n.noHScroll&&(_.display.alignWidgets=!0),_n(e,t,"widget",function(H){var Q=H.widgets||(H.widgets=[]);if(n.insertAt==null?Q.push(n):Q.splice(Math.min(Q.length-1,Math.max(0,n.insertAt)),0,n),n.line=H,_&&!Qr(e,H)){var J=Ir(H)<e.scrollTop;wr(H,H.height+gn(n)),J&&_a(_,n.height),_.curOp.forceUpdate=!0}return!0}),_&&Vt(_,"lineWidgetAdded",_,n,typeof t=="number"?t:Ot(t)),n}var ns=0,_i=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};_i.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wi(e),ge(this,"clear")){var i=this.find();i&&Vt(this,"clear",i.from,i.to)}for(var r=null,n=null,_=0;_<this.lines.length;++_){var H=this.lines[_],Q=$r(H.markedSpans,this);e&&!this.collapsed?Si(e,Ot(H),"text"):e&&(Q.to!=null&&(n=Ot(H)),Q.from!=null&&(r=Ot(H))),H.markedSpans=ri(H.markedSpans,Q),Q.from==null&&this.collapsed&&!Qr(this.doc,H)&&e&&wr(H,Qi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=ar(this.lines[J]),ce=Yi(ee);ce>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Lr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Vt(e,"markerCleared",e,this,r,n),t&&Hi(e),this.parent&&this.parent.clear()},_i.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var _=this.lines[n],H=$r(_.markedSpans,this);if(H.from!=null&&(i=Xe(t?_:Ot(_),H.from),e==-1))return i;if(H.to!=null&&(r=Xe(t?_:Ot(_),H.to),e==1))return r}return i&&{from:i,to:r}},_i.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Nr(r,function(){var n=t.line,_=Ot(t.line),H=ma(r,_);if(H&&(so(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Qr(i.doc,n)&&i.height!=null){var Q=i.height;i.height=null;var J=gn(i)-Q;J&&wr(n,n.height+J)}Vt(r,"markerChanged",r,e)})},_i.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||se(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},_i.prototype.detachLine=function(e){if(this.lines.splice(se(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(_i);function on(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return ur(e.cm,on)(e,t,i,r,n);var _=new _i(e,n),H=St(t,i);if(r&&N(r,_,!1),H>0||H==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(nr(e,t.line,t,i,_)||t.line!=i.line&&nr(e,i.line,t,i,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");ti()}_.addToHistory&&jo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Q=t.line,J=e.cm,ee;if(e.iter(Q,i.line+1,function(me){J&&_.collapsed&&!J.options.lineWrapping&&ar(me)==J.display.maxLine&&(ee=!0),_.collapsed&&Q!=t.line&&wr(me,0),Wr(me,new vi(_,Q==t.line?t.ch:null,Q==i.line?i.ch:null)),++Q}),_.collapsed&&e.iter(t.line,i.line+1,function(me){Qr(e,me)&&wr(me,0)}),_.clearOnEnter&&Pe(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(_r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++ns,_.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),_.collapsed)Lr(J,t.line,i.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var ce=t.line;ce<=i.line;ce++)Si(J,ce,"text");_.atomic&&Xo(J.doc),Vt(J,"markerAdded",J,_)}return _}var Rn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Rn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Vt(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Rn);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var _=[on(e,t,i,r,n)],H=_[0],Q=r.widgetNode;return Ai(e,function(J){Q&&(r.widgetNode=Q.cloneNode(!0)),_.push(on(J,l(J,t),l(J,i),r,n));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;H=te(_)}),new Rn(_,H)}function as(e){return e.findMarks(Xe(e.first,0),e.clipPos(Xe(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),_=e.clipPos(n.from),H=e.clipPos(n.to);if(St(_,H)){var Q=on(e,_,H,r.primary,r.primary.type);r.markers.push(Q),Q.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],_=[n.primary.doc];Ai(n.primary.doc,function(J){return _.push(J)});for(var H=0;H<n.markers.length;H++){var Q=n.markers[H];se(_,Q.doc)==-1&&(Q.parent=null,n.markers.splice(H--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,kr=function(e,t,i,r,n){if(!(this instanceof kr))return new kr(e,t,i,r,n);i==null&&(i=0),kn.call(this,[new Ln([new Ei("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var _=Xe(i,0);this.sel=Ti(_),this.history=new Qn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ia(this,{from:_,to:_,text:e}),xr(this,Ti(_),be)};kr.prototype=De(kn.prototype,{constructor:kr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=li(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:hr(function(e){var t=Xe(this.first,0),i=this.first+this.size-1;nn(this,{from:t,to:Xe(i,ft(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),xr(this,Ti(t),be)}),replaceRange:function(e,t,i,r){t=l(this,t),i=i?l(this,i):t,an(this,e,t,i,r)},getRange:function(e,t,i){var r=Ur(this,l(this,e),l(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ui(this,e))return ft(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),ar(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return l(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:hr(function(e,t,i){Go(this,l(this,typeof e=="number"?Xe(e,t||0):e),null,i)}),setSelection:hr(function(e,t,i){Go(this,l(this,e),l(this,t||e),i)}),extendSelection:hr(function(e,t,i){Zn(this,l(this,e),t&&l(this,t),i)}),extendSelections:hr(function(e,t){zo(this,z(this,e),t)}),extendSelectionsBy:hr(function(e,t){var i=fe(this.sel.ranges,e);zo(this,z(this,i),t)}),setSelections:hr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(l(this,e[n].anchor),l(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),xr(this,Zr(this.cm,r,t),i)}),addSelection:hr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(l(this,e),l(this,t||e))),xr(this,Zr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Ur(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Ur(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:hr(function(e,t,i){for(var r=[],n=this.sel,_=0;_<n.ranges.length;_++){var H=n.ranges[_];r[_]={from:H.from(),to:H.to(),text:this.splitLines(e[_]),origin:i}}for(var Q=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)nn(this,r[J]);Q?Ko(this,Q):this.cm&&qi(this.cm)}),undo:hr(function(){ta(this,"undo")}),redo:hr(function(){ta(this,"redo")}),undoSelection:hr(function(){ta(this,"undo",!0)}),redoSelection:hr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ai(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:tn(this.history.done),undone:tn(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=tn(e.done.slice(0),null,!0),t.undone=tn(e.undone.slice(0),null,!0)},setGutterMarker:hr(function(e,t,i){return _n(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Ue(n)&&(r.gutterMarkers=null),!0})}),clearGutter:hr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&_n(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ue(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ui(this,e))return null;if(t=e,e=ft(this,e),!e)return null}else if(t=Ot(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:hr(function(e,t,i){return _n(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(b(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:hr(function(e,t,i){return _n(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",_=r[n];if(_)if(i==null)r[n]=null;else{var H=_.match(b(i));if(!H)return!1;var Q=H.index+H[0].length;r[n]=_.slice(0,H.index)+(!H.index||Q==_.length?"":" ")+_.slice(Q)||null}else return!1;return!0})}),addLineWidget:hr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return on(this,l(this,e),l(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=l(this,e),on(this,e,e,i,"bookmark")},findMarksAt:function(e){e=l(this,e);var t=[],i=ft(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=l(this,e),t=l(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(_){var H=_.markedSpans;if(H)for(var Q=0;Q<H.length;Q++){var J=H[Q];!(J.to!=null&&n==e.line&&e.ch>=J.to||J.from==null&&n!=e.line||J.from!=null&&n==t.line&&J.from>=t.ch)&&(!i||i(J.marker))&&r.push(J.marker.parent||J.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var _=n.text.length+r;if(_>e)return t=e,!0;e-=_,++i}),l(this,Xe(i,t))},indexFromPos:function(e){e=l(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new kr(li(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new kr(li(this,t,i),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}],Cl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof $t&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(as(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Qn(null),e.history.done=tn(this.history.done,r),e.history.undone=tn(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:hr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),kr.prototype.eachLine=kr.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),Ve(t,e)||fi(t.display,e))return;ie(e),W&&(os=+new Date);var i=Bi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,_=Array(n),H=0,Q=function(){++H==n&&ur(t,function(){i=l(t.doc,i);var we={from:i,to:i,text:t.doc.splitLines(_.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};nn(t.doc,we),Ko(t.doc,Ti(l(t.doc,i),l(t.doc,wi(we))))})()},J=function(we,je){if(t.options.allowDropFileTypes&&se(t.options.allowDropFileTypes,we.type)==-1){Q();return}var Ke=new FileReader;Ke.onerror=function(){return Q()},Ke.onload=function(){var Je=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Je)){Q();return}_[je]=Je,Q()},Ke.readAsText(we)},ee=0;ee<r.length;ee++)J(r[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var me;if(t.state.draggingText&&!t.state.draggingText.copy&&(me=t.listSelections()),qn(t.doc,Ti(i,i)),me)for(var ke=0;ke<me.length;++ke)an(t.doc,"",me[ke].anchor,me[ke].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(we){}}}function _l(e,t){if(W&&(!e.state.draggingText||+new Date-os<100)){de(t);return}if(Ve(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var i=o("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",x&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),x&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Bi(e,t);if(!i)return;var r=document.createDocumentFragment();bo(e,i,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(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"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var _=0;_<i.length;_++)e(i[_])})}var us=!1;function kl(){if(us)return;Dl(),us=!0}function Dl(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),Pe(window,"blur",function(){return ls(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Li={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"},On=0;On<10;On++)Li[On+48]=Li[On+96]=String(On);for(var ra=65;ra<=90;ra++)Li[ra]=String.fromCharCode(ra);for(var Pn=1;Pn<=12;Pn++)Li[Pn+111]=Li[Pn+63235]="F"+Pn;var pi={};pi.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"},pi.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"},pi.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"},pi.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"]},pi.default=s?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,_,H=0;H<t.length-1;H++){var Q=t[H];if(/^(cmd|meta|m)$/i.test(Q))_=!0;else if(/^a(lt)?$/i.test(Q))i=!0;else if(/^(c|ctrl|control)$/i.test(Q))r=!0;else if(/^s(hift)?$/i.test(Q))n=!0;else throw new Error("Unrecognized modifier name: "+Q)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),_&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=fe(i.split(" "),Ol),_=0;_<n.length;_++){var H=void 0,Q=void 0;_==n.length-1?(Q=n.join(" "),H=r):(Q=n.slice(0,_+1).join(" "),H="...");var J=t[Q];if(!J)t[Q]=H;else if(J!=H)throw new Error("Inconsistent bindings for "+Q)}delete e[i]}for(var ee in t)e[ee]=t[ee];return e}function sn(e,t,i,r){t=ia(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return sn(e,t.fallthrough,i,r);for(var _=0;_<t.fallthrough.length;_++){var H=sn(e,t.fallthrough[_],i,r);if(H)return H}}}function hs(e){var t=typeof e=="string"?e:Li[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(v?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(v?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(x&&e.keyCode==34&&e.char)return!1;var i=Li[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function ia(e){return typeof e=="string"?pi[e]:e}function ln(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var _=t(i[n]);r.length&&St(_.from,te(r).to)<=0;){var H=r.pop();if(St(H.from,_.from)<0){_.from=H.from;break}}r.push(_)}Nr(e,function(){for(var Q=r.length-1;Q>=0;Q--)an(e.doc,"",r[Q].from,r[Q].to,"+delete");qi(e)})}function Fa(e,t,i){var r=Fe(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ja(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new Xe(t.line,r,i<0?"after":"before")}function Wa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var _=Ze(i,t.doc.direction);if(_){var H=n<0?te(_):_[0],Q=n<0==(H.level==1),J=Q?"after":"before",ee;if(H.level>0||t.doc.direction=="rtl"){var ce=$i(t,i);ee=n<0?i.text.length-1:0;var me=ai(t,ce,ee).top;ee=it(function(ke){return ai(t,ce,ke).top==me},n<0==(H.level==1)?H.from:H.to-1,ee),J=="before"&&(ee=Fa(i,ee,1))}else ee=n<0?H.to:H.from;return new Xe(r,ee,J)}}return new Xe(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Ze(t,e.doc.direction);if(!n)return ja(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var _=Qe(n,i.ch,i.sticky),H=n[_];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>i.ch:H.from<i.ch))return ja(t,i,r);var Q=function(tt,ut){return Fa(t,tt instanceof Xe?tt.ch:tt,ut)},J,ee=function(tt){return e.options.lineWrapping?(J=J||$i(e,t),mo(e,t,J,tt)):{begin:0,end:t.text.length}},ce=ee(i.sticky=="before"?Q(i,-1):i.ch);if(e.doc.direction=="rtl"||H.level==1){var me=H.level==1==r<0,ke=Q(i,me?1:-1);if(ke!=null&&(me?ke<=H.to&&ke<=ce.end:ke>=H.from&&ke>=ce.begin)){var we=me?"before":"after";return new Xe(i.line,ke,we)}}var je=function(tt,ut,rt){for(var ht=function(Yt,dr){return dr?new Xe(i.line,Q(Yt,1),"before"):new Xe(i.line,Yt,"after")};tt>=0&&tt<n.length;tt+=ut){var Et=n[tt],vt=ut>0==(Et.level!=1),_t=vt?rt.begin:Q(rt.end,-1);if(Et.from<=_t&&_t<Et.to)return ht(_t,vt);if(_t=vt?Et.from:Q(Et.to,-1),rt.begin<=_t&&_t<rt.end)return ht(_t,vt)}},Ke=je(_+r,r,ce);if(Ke)return Ke;var Je=r>0?ce.end:Q(ce.begin,-1);return Je!=null&&!(r>0&&Je==t.text.length)&&(Ke=je(r>0?0:n.length-1,r,ee(Je)),Ke)?Ke:null}var Mn={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),be)},killLine:function(e){return ln(e,function(t){if(t.empty()){var i=ft(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Xe(t.head.line+1,0)}:{from:t.head,to:Xe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:l(e.doc,Xe(t.to().line+1,0))}})},delLineLeft:function(e){return ln(e,function(t){return{from:Xe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ln(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ln(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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(Xe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Xe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(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 i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Ce)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?ps(e,t.head):r},Ce)},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=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var _=i[n].from(),H=X(e.getLine(_.line),_.ch,r);t.push(ue(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Nr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,_=ft(e.doc,n.line).text;if(_){if(n.ch==_.length&&(n=new Xe(n.line,n.ch-1)),n.ch>0)n=new Xe(n.line,n.ch+1),e.replaceRange(_.charAt(n.ch-1)+_.charAt(n.ch-2),Xe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var H=ft(e.doc,n.line-1).text;H&&(n=new Xe(n.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Xe(n.line-1,H.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Nr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);qi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fs(e,t){var i=ft(e.doc,t),r=ar(i);return r!=i&&(t=Ot(r)),Wa(!0,e,r,t,1)}function Il(e,t){var i=ft(e.doc,t),r=ii(i);return r!=i&&(t=Ot(r)),Wa(!0,e,i,t,-1)}function ps(e,t){var i=fs(e,t.line),r=ft(e.doc,i.line),n=Ze(r,e.doc.direction);if(!n||n[0].level==0){var _=Math.max(i.ch,r.text.search(/\S/)),H=t.line==i.line&&t.ch<=_&&t.ch;return Xe(i.line,H?0:_,i.sticky)}return i}function na(e,t,i){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Ae}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=sn(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&sn(t,e.options.extraKeys,i,e)||sn(t,e.options.keyMap,i,e)}var Bl=new q;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(hs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),ms(e,n+" "+t,i,r))return!0}return ms(e,t,i,r)}function ms(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Vt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(ie(i),Ta(e)),!!n}function gs(e,t){var i=cs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):In(e,i,t,function(r){return na(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return na(e,r,!0)})}var Ha=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=O(),Ve(t,e))return;W&&B<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=gs(t,e);x&&(Ha=r?i:null,!r&&i==88&&!Rt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!s&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),st(document,"keyup",i),st(document,"mouseover",i))}Pe(document,"keyup",i),Pe(document,"mouseover",i)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ve(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||Ve(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(x&&i==Ha){Ha=null,ie(e);return}if(x&&(!e.which||e.which<10)&&gs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Ul(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,za=function(e,t,i){this.time=e,this.pos=t,this.button=i};za.prototype.compare=function(e,t,i){return this.time+jl>e&&St(t,this.pos)==0&&i==this.button};var Nn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Nn=Bn=null,"triple"):Nn&&Nn.compare(i,e,t)?(Bn=new za(i,e,t),Nn=null,"double"):(Nn=new za(i,e,t),Bn=null,"single")}function xs(e){var t=this,i=t.display;if(Ve(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){P||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Bi(t,e),n=Me(e),_=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,_,e))return;n==1?r?Gl(t,r,_,e):Le(e)==i.scroller&&ie(e):n==2?(r&&Zn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(k?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,i,r,n){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,In(e,ds(_,n),n,function(H){if(typeof H=="string"&&(H=Mn[H]),!H)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=H(e,i)!=Ae}finally{e.state.suppressEdits=!1}return Q})}function zl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var _=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=_?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function Gl(e,t,i,r){W?setTimeout(I(xo,e),0):e.curOp.focus=O();var n=zl(e,i,r),_=e.doc.sel,H;e.options.dragDrop&&Ye&&!e.isReadOnly()&&i=="single"&&(H=_.contains(t))>-1&&(St((H=_.ranges[H]).from(),t)<0||t.xRel>0)&&(St(H.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,_=!1,H=ur(e,function(ee){P&&(n.scroller.draggable=!1),e.state.draggingText=!1,st(n.wrapper.ownerDocument,"mouseup",H),st(n.wrapper.ownerDocument,"mousemove",Q),st(n.scroller,"dragstart",J),st(n.scroller,"drop",H),_||(ie(ee),r.addNew||Zn(e.doc,i,null,null,r.extend),P&&!M||W&&B==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Q=function(ee){_=_||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return _=!0};P&&(n.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Pe(n.wrapper.ownerDocument,"mouseup",H),Pe(n.wrapper.ownerDocument,"mousemove",Q),Pe(n.scroller,"dragstart",J),Pe(n.scroller,"drop",H),Eo(e),setTimeout(function(){return n.input.focus()},20)}function Es(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Xe(t.line,0),l(e.doc,Xe(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,_=e.doc;ie(t);var H,Q,J=_.sel,ee=J.ranges;if(r.addNew&&!r.extend?(Q=_.sel.contains(i),Q>-1?H=ee[Q]:H=new jt(i,i)):(H=_.sel.primary(),Q=_.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new jt(i,i)),i=Bi(e,t,!0,!0),Q=-1;else{var ce=Es(e,i,r.unit);r.extend?H=Ba(H,ce.anchor,ce.head,r.extend):H=ce}r.addNew?Q==-1?(Q=ee.length,xr(_,Zr(e,ee.concat([H]),Q),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Q].empty()&&r.unit=="char"&&!r.extend?(xr(_,Zr(e,ee.slice(0,Q).concat(ee.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),J=_.sel):Ua(_,Q,H,Te):(Q=0,xr(_,new zr([H],0),Te),J=_.sel);var me=i;function ke(rt){if(St(me,rt)==0)return;if(me=rt,r.unit=="rectangle"){for(var ht=[],Et=e.options.tabSize,vt=X(ft(_,i.line).text,i.ch,Et),_t=X(ft(_,rt.line).text,rt.ch,Et),Yt=Math.min(vt,_t),dr=Math.max(vt,_t),Jt=Math.min(i.line,rt.line),Br=Math.min(e.lastLine(),Math.max(i.line,rt.line));Jt<=Br;Jt++){var Dr=ft(_,Jt).text,tr=Se(Dr,Yt,Et);Yt==dr?ht.push(new jt(Xe(Jt,tr),Xe(Jt,tr))):Dr.length>tr&&ht.push(new jt(Xe(Jt,tr),Xe(Jt,Se(Dr,dr,Et))))}ht.length||ht.push(new jt(i,i)),xr(_,Zr(e,J.ranges.slice(0,Q).concat(ht),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var Rr=H,vr=Es(e,rt,r.unit),or=Rr.anchor,rr;St(vr.anchor,or)>0?(rr=vr.head,or=Di(Rr.from(),vr.anchor)):(rr=vr.anchor,or=di(Rr.to(),vr.head));var Zt=J.ranges.slice(0);Zt[Q]=Xl(e,new jt(l(_,or),rr)),xr(_,Zr(e,Zt,Q),Te)}}var we=n.wrapper.getBoundingClientRect(),je=0;function Ke(rt){var ht=++je,Et=Bi(e,rt,!0,r.unit=="rectangle");if(!Et)return;if(St(Et,me)!=0){e.curOp.focus=O(),ke(Et);var vt=Vn(n,_);(Et.line>=vt.to||Et.line<vt.from)&&setTimeout(ur(e,function(){je==ht&&Ke(rt)}),150)}else{var _t=rt.clientY<we.top?-20:rt.clientY>we.bottom?20:0;_t&&setTimeout(ur(e,function(){if(je!=ht)return;n.scroller.scrollTop+=_t,Ke(rt)}),50)}}function Je(rt){e.state.selectingText=!1,je=Infinity,rt&&(ie(rt),n.input.focus()),st(n.wrapper.ownerDocument,"mousemove",tt),st(n.wrapper.ownerDocument,"mouseup",ut),_.history.lastSelOrigin=null}var tt=ur(e,function(rt){rt.buttons===0||!Me(rt)?Je(rt):Ke(rt)}),ut=ur(e,Je);e.state.selectingText=ut,Pe(n.wrapper.ownerDocument,"mousemove",tt),Pe(n.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var i=t.anchor,r=t.head,n=ft(e.doc,i.line);if(St(i,r)==0&&i.sticky==r.sticky)return t;var _=Ze(n);if(!_)return t;var H=Qe(_,i.ch,i.sticky),Q=_[H];if(Q.from!=i.ch&&Q.to!=i.ch)return t;var J=H+(Q.from==i.ch==(Q.level!=1)?0:1);if(J==0||J==_.length)return t;var ee;if(r.line!=i.line)ee=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Qe(_,r.ch,r.sticky),me=ce-H||(r.ch-i.ch)*(Q.level==1?-1:1);ce==J-1||ce==J?ee=me<0:ee=me>0}var ke=_[J+(ee?-1:0)],we=ee==(ke.level==1),je=we?ke.from:ke.to,Ke=we?"after":"before";return i.ch==je&&i.sticky==Ke?t:new jt(new Xe(i.line,je,Ke),r)}function Ss(e,t,i,r){var n,_;if(t.touches)n=t.touches[0].clientX,_=t.touches[0].clientY;else try{n=t.clientX,_=t.clientY}catch(ke){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ie(t);var H=e.display,Q=H.lineDiv.getBoundingClientRect();if(_>Q.bottom||!ge(e,i))return le(t);_-=Q.top-H.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=H.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=n){var ce=Vr(e.doc,_),me=e.display.gutterSpecs[J];return Ne(e,i,e,ce,me.className,t),le(t)}}}function Ga(e,t){return Ss(e,t,"gutterClick",!0)}function Cs(e,t){if(fi(e.display,t)||Yl(e,t))return;if(Ve(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return ge(e,"gutterContextMenu")?Ss(e,t,"gutterContextMenu",!1):!1}function Ts(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}var un={toString:function(){return"CodeMirror.Init"}},ws={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,_,H){e.defaults[r]=n,_&&(t[r]=H?function(Q,J,ee){ee!=un&&_(Q,J,ee)}:_)}e.defineOption=i,e.Init=un,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ma(r)},!0),i("indentUnit",2,Ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Lr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var _=[],H=r.doc.first;r.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(n,ee);if(ce==-1)break;ee=ce+n.length,_.push(Xe(H,ce))}H++});for(var Q=_.length-1;Q>=0;Q--)an(r.doc,n,_[Q],Xe(_[Q].line,_[Q].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,_){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),_!=un&&r.refresh()}),i("specialCharPlaceholder",pt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!L),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Tn(r)},!0),i("keyMap","default",function(r,n,_){var H=ia(n),Q=_!=un&&ia(_);Q&&Q.detach&&Q.detach(r,H),H.attach&&H.attach(r,Q||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Oa(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Sa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return en(r)},!0),i("scrollbarStyle","native",function(r){_o(r),en(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Oa(r.options.gutters,n),Tn(r)},!0),i("firstLineNumber",1,Tn,!0),i("lineNumberFormatter",function(r){return r},Tn,!0),i("showCursorWhenSelecting",!1,yn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Ql),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yn,!0),i("singleCursorHeightPerLine",!0,yn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,wn,!0),i("addModeClass",!1,wn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,wn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Ql(e,t,i){var r=i&&i!=un;if(!t!=!r){var n=e.display.dragFunctions,_=t?Pe:st;_(e.display.scroller,"dragstart",n.start),_(e.display.scroller,"dragenter",n.enter),_(e.display.scroller,"dragover",n.over),_(e.display.scroller,"dragleave",n.leave),_(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),ci(e)),Ca(e),Lr(e),vn(e),setTimeout(function(){return en(e)},100)}function $t(e,t){var i=this;if(!(this instanceof $t))return new $t(e,t);this.options=t=t?N(t):{},N(ws,t,!1);var r=t.value;typeof r=="string"?r=new kr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new $t.inputStyles[t.inputStyle](this),_=this.display=new hl(e,r,n,t);_.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(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 q,keySeq:null,specialChars:null},t.autofocus&&!a&&_.input.focus(),W&&B<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Zl(this),kl(),Wi(this),this.curOp.forceUpdate=!0,Bo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&wa(i)},20):Zi(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],un);Do(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Ka.length;++Q)Ka[Q](this);Hi(this),P&&t.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}$t.defaults=ws,$t.optionHandlers=aa;function Zl(e){var t=e.display;Pe(t.scroller,"mousedown",ur(e,xs)),W&&B<11?Pe(t.scroller,"dblclick",ur(e,function(J){if(Ve(e,J))return;var ee=Bi(e,J);if(!ee||Ga(e,J)||fi(e.display,J))return;ie(J);var ce=e.findWordAt(ee);Zn(e.doc,ce.anchor,ce.head)})):Pe(t.scroller,"dblclick",function(J){return Ve(e,J)||ie(J)}),Pe(t.scroller,"contextmenu",function(J){return Cs(e,J)}),Pe(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Cs(e,J)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function _(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function H(J,ee){if(ee.left==null)return!0;var ce=ee.left-J.left,me=ee.top-J.top;return ce*ce+me*me>20*20}Pe(t.scroller,"touchstart",function(J){if(!Ve(e,J)&&!_(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(i);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!fi(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),me;!ee.prev||H(ee,ee.prev)?me=new jt(ce,ce):!ee.prev.prev||H(ee,ee.prev.prev)?me=e.findWordAt(ce):me=new jt(Xe(ce.line,0),l(e.doc,Xe(ce.line+1,0))),e.setSelection(me.anchor,me.head),e.focus(),ie(J)}n()}),Pe(t.scroller,"touchcancel",n),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),Ne(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(J){return Po(e,J)}),Pe(t.scroller,"DOMMouseScroll",function(J){return Po(e,J)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ve(e,J)||de(J)},over:function(J){Ve(e,J)||(Ll(e,J),de(J))},start:function(J){return _l(e,J)},drop:ur(e,Al),leave:function(J){Ve(e,J)||ss(e)}};var Q=t.input.getField();Pe(Q,"keyup",function(J){return ys.call(e,J)}),Pe(Q,"keydown",ur(e,vs)),Pe(Q,"keypress",ur(e,bs)),Pe(Q,"focus",function(J){return wa(e,J)}),Pe(Q,"blur",function(J){return Zi(e,J)})}var Ka=[];$t.defineInitHook=function(e){return Ka.push(e)};function Un(e,t,i,r){var n=e.doc,_;i==null&&(i="add"),i=="smart"&&(n.mode.indent?_=Re(e,t).state:i="prev");var H=e.options.tabSize,Q=ft(n,t),J=X(Q.text,null,H);Q.stateAfter&&(Q.stateAfter=null);var ee=Q.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(Q.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(_,Q.text.slice(ee.length),Q.text),ce==Ae||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=X(ft(n,t-1).text,null,H):ce=0:i=="add"?ce=J+e.options.indentUnit:i=="subtract"?ce=J-e.options.indentUnit:typeof i=="number"&&(ce=J+i),ce=Math.max(0,ce);var me="",ke=0;if(e.options.indentWithTabs)for(var we=Math.floor(ce/H);we;--we)ke+=H,me+=" ";if(ke<ce&&(me+=ue(ce-ke)),me!=ee)return an(n,me,Xe(t,0),Xe(t,ee.length),"+input"),Q.stateAfter=null,!0;for(var je=0;je<n.sel.ranges.length;je++){var Ke=n.sel.ranges[je];if(Ke.head.line==t&&Ke.head.ch<ee.length){var Je=Xe(t,ee.length);Ua(n,je,new jt(Je,Je));break}}}var qr=null;function oa(e){qr=e}function Va(e,t,i,r,n){var _=e.doc;e.display.shift=!1,r||(r=_.sel);var H=+new Date-200,Q=n=="paste"||e.state.pasteIncoming>H,J=mt(t),ee=null;if(Q&&r.ranges.length>1)if(qr&&qr.text.join(`
`)==t){if(r.ranges.length%qr.text.length==0){ee=[];for(var ce=0;ce<qr.text.length;ce++)ee.push(_.splitLines(qr.text[ce]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(ee=fe(J,function(tt){return[tt]}));for(var me=e.curOp.updateInput,ke=r.ranges.length-1;ke>=0;ke--){var we=r.ranges[ke],je=we.from(),Ke=we.to();we.empty()&&(i&&i>0?je=Xe(je.line,je.ch-i):e.state.overwrite&&!Q?Ke=Xe(Ke.line,Math.min(ft(_,Ke.line).text.length,Ke.ch+te(J).length)):Q&&qr&&qr.lineWise&&qr.text.join(`
`)==J.join(`
`)&&(je=Ke=Xe(je.line,0)));var Je={from:je,to:Ke,text:ee?ee[ke%ee.length]:J,origin:n||(Q?"paste":e.state.cutIncoming>H?"cut":"+input")};nn(e.doc,Je),Vt(e,"inputRead",e,Je)}t&&!Q&&_s(e,t),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Nr(t,function(){return Va(t,i,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var _=e.getModeAt(n.head),H=!1;if(_.electricChars){for(var Q=0;Q<_.electricChars.length;Q++)if(t.indexOf(_.electricChars.charAt(Q))>-1){H=Un(e,n.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(ft(e.doc,n.head.line).text.slice(0,n.head.ch))&&(H=Un(e,n.head.line,"smart")));H&&Vt(e,"electricInput",e,n.head.line)}}function Ls(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,_={anchor:Xe(n,0),head:Xe(n+1,0)};i.push(_),t.push(e.getRange(_.anchor,_.head))}return{text:t,ranges:i}}function ks(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ds(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),ks(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var _=this.options,H=_[r];if(_[r]==n&&r!="mode")return;_[r]=n,t.hasOwnProperty(r)&&ur(this,t[r])(this,n,H),Ne(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,_=0;_<n.length;++_)if(n[_]==r||n[_].name==r)return n.splice(_,1),!0},addOverlay:Sr(function(r,n){var _=r.token?r:e.getMode(this.options,r);if(_.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:_,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(H){return H.priority}),this.state.modeGen++,Lr(this)}),removeOverlay:Sr(function(r){for(var n=this.state.overlays,_=0;_<n.length;++_){var H=n[_].modeSpec;if(H==r||typeof r=="string"&&H.name==r){n.splice(_,1),this.state.modeGen++,Lr(this);return}}}),indentLine:Sr(function(r,n,_){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),ui(this.doc,r)&&Un(this,r,n,_)}),indentSelection:Sr(function(r){for(var n=this.doc.sel.ranges,_=-1,H=0;H<n.length;H++){var Q=n[H];if(Q.empty())Q.head.line>_&&(Un(this,Q.head.line,r,!0),_=Q.head.line,H==this.doc.sel.primIndex&&qi(this));else{var J=Q.from(),ee=Q.to(),ce=Math.max(_,J.line);_=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var me=ce;me<_;++me)Un(this,me,r);var ke=this.doc.sel.ranges;J.ch==0&&n.length==ke.length&&ke[H].from().ch>0&&Ua(this.doc,H,new jt(J,ke[H].to()),be)}}}),getTokenAt:function(r,n){return Wt(this,r,n)},getLineTokens:function(r,n){return Wt(this,Xe(r),n,!0)},getTokenTypeAt:function(r){r=l(this.doc,r);var n=He(this,ft(this.doc,r.line)),_=0,H=(n.length-1)/2,Q=r.ch,J;if(Q==0)J=n[2];else for(;;){var ee=_+H>>1;if((ee?n[ee*2-1]:0)>=Q)H=ee;else if(n[ee*2+1]<Q)_=ee+1;else{J=n[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var _=[];if(!i.hasOwnProperty(n))return _;var H=i[n],Q=this.getModeAt(r);if(typeof Q[n]=="string")H[Q[n]]&&_.push(H[Q[n]]);else if(Q[n])for(var J=0;J<Q[n].length;J++){var ee=H[Q[n][J]];ee&&_.push(ee)}else Q.helperType&&H[Q.helperType]?_.push(H[Q.helperType]):H[Q.name]&&_.push(H[Q.name]);for(var ce=0;ce<H._global.length;ce++){var me=H._global[ce];me.pred(Q,this)&&se(_,me.val)==-1&&_.push(me.val)}return _},getStateAfter:function(r,n){var _=this.doc;return r=V(_,r==null?_.first+_.size-1:r),Re(this,r+1,n).state},cursorCoords:function(r,n){var _,H=this.doc.sel.primary();return r==null?_=H.head:typeof r=="object"?_=l(this.doc,r):_=r?H.from():H.to(),Jr(this,_,n||"page")},charCoords:function(r,n){return va(this,l(this.doc,r),n||"page")},coordsChar:function(r,n){return r=co(this,r,n||"page"),ba(this,r.left,r.top)},lineAtHeight:function(r,n){return r=co(this,{top:r,left:0},n||"page").top,Vr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,_){var H=!1,Q;if(typeof r=="number"){var J=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>J&&(r=J,H=!0),Q=ft(this.doc,r)}else Q=r;return Hn(this,Q,{top:0,left:0},n||"page",_||H).top+(H?this.doc.height-Ir(Q):0)},defaultTextHeight:function(){return Qi(this.display)},defaultCharWidth:function(){return Ji(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,_,H,Q){var J=this.display;r=Jr(this,l(this.doc,r));var ee=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),J.sizer.appendChild(n),H=="over")ee=r.top;else if(H=="above"||H=="near"){var me=Math.max(J.wrapper.clientHeight,this.doc.height),ke=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(H=="above"||r.bottom+n.offsetHeight>me)&&r.top>n.offsetHeight?ee=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=me&&(ee=r.bottom),ce+n.offsetWidth>ke&&(ce=ke-n.offsetWidth)}n.style.top=ee+"px",n.style.left=n.style.right="",Q=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Q=="left"?ce=0:Q=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),_&&Qs(this,{left:ce,top:ee,right:ce+n.offsetWidth,bottom:ee+n.offsetHeight})},triggerOnKeyDown:Sr(vs),triggerOnKeyPress:Sr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:Sr(xs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:Sr(function(r){_s(this,r)}),findPosH:function(r,n,_,H){var Q=1;n<0&&(Q=-1,n=-n);for(var J=l(this.doc,r),ee=0;ee<n&&!(J=Xa(this.doc,J,Q,_,H),J.hitSide);++ee);return J},moveH:Sr(function(r,n){var _=this;this.extendSelectionsBy(function(H){return _.display.shift||_.doc.extend||H.empty()?Xa(_.doc,H.head,r,n,_.options.rtlMoveVisually):r<0?H.from():H.to()},Ce)}),deleteH:Sr(function(r,n){var _=this.doc.sel,H=this.doc;_.somethingSelected()?H.replaceSelection("",null,"+delete"):ln(this,function(Q){var J=Xa(H,Q.head,r,n,!1);return r<0?{from:J,to:Q.head}:{from:Q.head,to:J}})}),findPosV:function(r,n,_,H){var Q=1,J=H;n<0&&(Q=-1,n=-n);for(var ee=l(this.doc,r),ce=0;ce<n;++ce){var me=Jr(this,ee,"div");if(J==null?J=me.left:me.left=J,ee=Rs(this,me,Q,_),ee.hitSide)break}return ee},moveV:Sr(function(r,n){var _=this,H=this.doc,Q=[],J=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(ce){if(J)return r<0?ce.from():ce.to();var me=Jr(_,ce.head,"div");ce.goalColumn!=null&&(me.left=ce.goalColumn),Q.push(me.left);var ke=Rs(_,me,r,n);return n=="page"&&ce==H.sel.primary()&&_a(_,va(_,ke,"div").top-me.top),ke},Ce),Q.length)for(var ee=0;ee<H.sel.ranges.length;ee++)H.sel.ranges[ee].goalColumn=Q[ee]}),findWordAt:function(r){var n=this.doc,_=ft(n,r.line).text,H=r.ch,Q=r.ch;if(_){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Q==_.length)&&H?--H:++Q;for(var ee=_.charAt(H),ce=Ie(ee,J)?function(me){return Ie(me,J)}:/\s/.test(ee)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!Ie(me)};H>0&&ce(_.charAt(H-1));)--H;for(;Q<_.length&&ce(_.charAt(Q));)++Q}return new jt(Xe(r.line,H),Xe(r.line,Q))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Ne(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:pa(this),clientWidth:Ii(this)}},scrollIntoView:Sr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Xe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Sr(function(r,n){var _=this,H=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=H(r)),n!=null&&(this.display.wrapper.style.height=H(n)),this.options.lineWrapping&&lo(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){Si(_,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,Ne(this,"refresh",this)}),operation:function(r){return Nr(this,r)},startOperation:function(){return Wi(this)},endOperation:function(){return Hi(this)},refresh:Sr(function(){var r=this.display.cachedTextHeight;Lr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-Qi(this.display))>.5||this.options.lineWrapping)&&Ca(this),Ne(this,"refresh",this)}),swapDoc:Sr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Vt(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[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}},ye(e),e.registerHelper=function(r,n,_){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=_},e.registerGlobalHelper=function(r,n,_,H){e.registerHelper(r,n,H),i[r]._global.push({pred:_,val:H})}}function Xa(e,t,i,r,n){var _=t,H=i,Q=ft(e,t.line),J=n&&e.direction=="rtl"?-i:i;function ee(){var ut=t.line+J;return ut<e.first||ut>=e.first+e.size?!1:(t=new Xe(ut,t.ch,t.sticky),Q=ft(e,ut))}function ce(ut){var rt;if(r=="codepoint"){var ht=Q.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ht)?rt=null:rt=new Xe(t.line,Math.max(0,Math.min(Q.text.length,t.ch+i*(ht>=55296&&ht<56320?2:1))),-i)}else n?rt=Ml(e.cm,Q,t,i):rt=ja(Q,t,i);if(rt==null)if(!ut&&ee())t=Wa(n,e.cm,Q,t.line,J);else return!1;else t=rt;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var me=null,ke=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(i<0&&!ce(!je));je=!1){var Ke=Q.text.charAt(t.ch)||`
`,Je=Ie(Ke,we)?"w":ke&&Ke==`
`?"n":!ke||/\s/.test(Ke)?null:"p";if(ke&&!je&&!Je&&(Je="s"),me&&me!=Je){i<0&&(i=1,ce(),t.sticky="after");break}if(Je&&(me=Je),i>0&&!ce(!je))break}var tt=ea(e,t,_,H,!0);return ei(_,tt)&&(tt.hitSide=!0),tt}function Rs(e,t,i,r){var n=e.doc,_=t.left,H;if(r=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Q-.5*Qi(e.display),3);H=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(H=i>0?t.bottom+3:t.top-3);for(var ee;!(ee=ba(e,_,H),!ee.outside);){if(i<0?H<=0:H>=n.height){ee.hitSide=!0;break}H+=i*5}return ee}var Gt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Gt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;ks(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function _(Q){for(var J=Q.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Pe(n,"paste",function(Q){if(!_(Q)||Ve(r,Q)||As(Q,r))return;B<=11&&setTimeout(ur(r,function(){return t.updateFromDOM()}),20)}),Pe(n,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Pe(n,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Pe(n,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(n,"touchstart",function(){return i.forceCompositionEnd()}),Pe(n,"input",function(){t.composing||t.readFromDOMSoon()});function H(Q){if(!_(Q)||Ve(r,Q))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),Q.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=Ls(r);oa({lineWise:!0,text:J.text}),Q.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,be),r.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var ee=qr.text.join(`
`);if(Q.clipboardData.setData("Text",ee),Q.clipboardData.getData("Text")==ee){Q.preventDefault();return}}var ce=Ds(),me=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),me.value=qr.text.join(`
`);var ke=document.activeElement;K(me),setTimeout(function(){r.display.lineSpace.removeChild(ce),ke.focus(),ke==n&&i.showPrimarySelection()},50)}Pe(n,"copy",H),Pe(n,"cut",H)},Gt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Gt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Gt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Gt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var _=sa(t,e.anchorNode,e.anchorOffset),H=sa(t,e.focusNode,e.focusOffset);if(_&&!_.bad&&H&&!H.bad&&St(Di(_,H),r)==0&&St(di(_,H),n)==0)return;var Q=t.display.view,J=r.line>=t.display.viewFrom&&Os(t,r)||{node:Q[0].measure.map[2],offset:0},ee=n.line<t.display.viewTo&&Os(t,n);if(!ee){var ce=Q[Q.length-1].measure,me=ce.maps?ce.maps[ce.maps.length-1]:ce.map;ee={node:me[me.length-1],offset:me[me.length-2]-me[me.length-3]}}if(!J||!ee){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),we;try{we=S(J.node,J.offset,ee.offset,ee.node)}catch(je){}we&&(!D&&t.state.focused?(e.collapse(J.node,J.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),ke&&e.anchorNode==null?e.addRange(ke):D&&this.startGracePeriod()),this.rememberSelection()},Gt.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)},Gt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Gt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Gt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return m(this.div,t)},Gt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Gt.prototype.blur=function(){this.div.blur()},Gt.prototype.getField=function(){return this.div},Gt.prototype.supportsTouch=function(){return!0},Gt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Nr(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)},Gt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Gt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&f&&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 i=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Nr(t,function(){xr(t.doc,Ti(i,r),be),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Gt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Xe(r.line-1,ft(e.doc,r.line-1).length)),n.ch==ft(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Xe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var _,H,Q;r.line==t.viewFrom||(_=Ui(e,r.line))==0?(H=Ot(t.view[0].line),Q=t.view[0].node):(H=Ot(t.view[_].line),Q=t.view[_-1].node.nextSibling);var J=Ui(e,n.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=Ot(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!Q)return!1;for(var me=e.doc.splitLines(tu(e,Q,ce,H,ee)),ke=Ur(e.doc,Xe(H,0),Xe(ee,ft(e.doc,ee).text.length));me.length>1&&ke.length>1;)if(te(me)==te(ke))me.pop(),ke.pop(),ee--;else if(me[0]==ke[0])me.shift(),ke.shift(),H++;else break;for(var we=0,je=0,Ke=me[0],Je=ke[0],tt=Math.min(Ke.length,Je.length);we<tt&&Ke.charCodeAt(we)==Je.charCodeAt(we);)++we;for(var ut=te(me),rt=te(ke),ht=Math.min(ut.length-(me.length==1?we:0),rt.length-(ke.length==1?we:0));je<ht&&ut.charCodeAt(ut.length-je-1)==rt.charCodeAt(rt.length-je-1);)++je;if(me.length==1&&ke.length==1&&H==r.line)for(;we&&we>r.ch&&ut.charCodeAt(ut.length-je-1)==rt.charCodeAt(rt.length-je-1);)we--,je++;me[me.length-1]=ut.slice(0,ut.length-je).replace(/^\u200b+/,""),me[0]=me[0].slice(we).replace(/\u200b+$/,"");var Et=Xe(H,we),vt=Xe(ee,ke.length?te(ke).length-je:0);if(me.length>1||me[0]||St(Et,vt))return an(e.doc,me,Et,vt,"+input"),!0},Gt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Gt.prototype.reset=function(){this.forceCompositionEnd()},Gt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Gt.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)},Gt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Nr(this.cm,function(){return Lr(e.cm)})},Gt.prototype.setUneditable=function(e){e.contentEditable="false"},Gt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||ur(this.cm,Va)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Gt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Gt.prototype.onContextMenu=function(){},Gt.prototype.resetPosition=function(){},Gt.prototype.needsContentAttribute=!0;function Os(e,t){var i=ma(e,t.line);if(!i||i.hidden)return null;var r=ft(e.doc,t.line),n=io(i,r,t.line),_=Ze(r,e.doc.direction),H="left";if(_){var Q=Qe(_,t.ch);H=Q%2?"right":"left"}var J=oo(n.map,t.ch,H);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function hn(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var _="",H=!1,Q=e.doc.lineSeparator(),J=!1;function ee(we){return function(je){return je.id==we}}function ce(){H&&(_+=Q,J&&(_+=Q),H=J=!1)}function me(we){we&&(ce(),_+=we)}function ke(we){if(we.nodeType==1){var je=we.getAttribute("cm-text");if(je){me(je);return}var Ke=we.getAttribute("cm-marker"),Je;if(Ke){var tt=e.findMarks(Xe(r,0),Xe(n+1,0),ee(+Ke));tt.length&&(Je=tt[0].find(0))&&me(Ur(e.doc,Je.from,Je.to).join(Q));return}if(we.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;ut&&ce();for(var rt=0;rt<we.childNodes.length;rt++)ke(we.childNodes[rt]);/^(pre|p)$/i.test(we.nodeName)&&(J=!0),ut&&(H=!0)}else we.nodeType==3&&me(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==i);)t=t.nextSibling,J=!1;return _}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return hn(e.clipPos(Xe(e.display.viewTo-1)),!0);t=null,i=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 n=0;n<e.display.view.length;n++){var _=e.display.view[n];if(_.node==r)return ru(_,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!m(r,t))return hn(Xe(Ot(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var _=e.rest?te(e.rest):e.line;return hn(Xe(Ot(_),_.text.length),n)}var H=t.nodeType==3?t:null,Q=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,i&&(i=H.nodeValue.length));Q.parentNode!=r;)Q=Q.parentNode;var J=e.measure,ee=J.maps;function ce(Je,tt,ut){for(var rt=-1;rt<(ee?ee.length:0);rt++)for(var ht=rt<0?J.map:ee[rt],Et=0;Et<ht.length;Et+=3){var vt=ht[Et+2];if(vt==Je||vt==tt){var _t=Ot(rt<0?e.line:e.rest[rt]),Yt=ht[Et]+ut;return(ut<0||vt!=Je)&&(Yt=ht[Et+(ut?1:0)]),Xe(_t,Yt)}}}var me=ce(H,Q,i);if(me)return hn(me,n);for(var ke=Q.nextSibling,we=H?H.nodeValue.length-i:0;ke;ke=ke.nextSibling){if(me=ce(ke,ke.firstChild,0),me)return hn(Xe(me.line,me.ch-we),n);we+=ke.textContent.length}for(var je=Q.previousSibling,Ke=i;je;je=je.previousSibling){if(me=ce(je,je.firstChild,-1),me)return hn(Xe(me.line,me.ch+Ke),n);Ke+=je.textContent.length}}var er=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};er.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),E&&(n.style.width="0px"),Pe(n,"input",function(){W&&B>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Pe(n,"paste",function(H){if(Ve(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function _(H){if(Ve(r,H))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Q=Ls(r);oa({lineWise:!0,text:Q.text}),H.type=="cut"?r.setSelections(Q.ranges,null,be):(i.prevInput="",n.value=Q.text.join(`
`),K(n))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Pe(n,"cut",_),Pe(n,"copy",_),Pe(e.scroller,"paste",function(H){if(fi(e,H)||Ve(r,H))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Q=new Event("paste");Q.clipboardData=H.clipboardData,n.dispatchEvent(Q)}),Pe(e.lineSpace,"selectstart",function(H){fi(e,H)||ie(H)}),Pe(n,"compositionstart",function(){var H=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Pe(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},er.prototype.createField=function(e){this.wrapper=Ds(),this.textarea=this.wrapper.firstChild},er.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},er.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),_=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+H.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+H.left-_.left))}return r},er.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},er.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&K(this.textarea),W&&B>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",W&&B>=9&&(this.hasSelection=null))},er.prototype.getField=function(){return this.textarea},er.prototype.supportsTouch=function(){return!1},er.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},er.prototype.blur=function(){this.textarea.blur()},er.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},er.prototype.receivedFocus=function(){this.slowPoll()},er.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()})},er.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},er.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||nt(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(W&&B>=9&&this.hasSelection===n||s&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=n.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Q=Math.min(r.length,n.length);H<Q&&r.charCodeAt(H)==n.charCodeAt(H);)++H;return Nr(t,function(){Va(t,n.slice(H),r.length-H,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},er.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},er.prototype.onKeyPress=function(){W&&B>=9&&(this.hasSelection=null),this.fastPoll()},er.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var _=Bi(i,e),H=r.scroller.scrollTop;if(!_||x)return;var Q=i.options.resetSelectionOnContextMenu;Q&&i.doc.sel.contains(_)==-1&&ur(i,xr)(i.doc,Ti(_),be);var J=n.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var me;P&&(me=window.scrollY),r.input.focus(),P&&window.scrollTo(null,me),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function ke(){if(n.selectionStart!=null){var Ke=i.somethingSelected(),Je="\u200B"+(Ke?n.value:"");n.value="\u21DA",n.value=Je,t.prevInput=Ke?"":"\u200B",n.selectionStart=1,n.selectionEnd=Je.length,r.selForContextMenu=i.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,n.style.cssText=J,W&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),n.selectionStart!=null){(!W||W&&B<9)&&ke();var Ke=0,Je=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?ur(i,Qo)(i):Ke++<10?r.detectingSelectAll=setTimeout(Je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Je,200)}}if(W&&B>=9&&ke(),k){de(e);var je=function(){st(window,"mouseup",je),setTimeout(we,20)};Pe(window,"mouseup",je)}else setTimeout(we,50)},er.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},er.prototype.setUneditable=function(){},er.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?N(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 i=O();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Q.getValue()}var n;if(e.form&&(Pe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;n=_.submit;try{var H=_.submit=function(){r(),_.submit=n,_.submit(),_.submit=H}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(st(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Q=$t(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Q}function nu(e){e.off=st,e.on=Pe,e.wheelEventPixels=dl,e.Doc=kr,e.splitLines=mt,e.countColumn=X,e.findColumn=Se,e.isWordChar=Oe,e.Pass=Ae,e.signal=Ne,e.Line=Ei,e.changeEnd=wi,e.scrollbarModel=Ao,e.Pos=Xe,e.cmpPos=St,e.modes=Bt,e.mimeModes=wt,e.resolveMode=gt,e.getMode=Gr,e.modeExtensions=br,e.extendMode=fr,e.copyState=Tr,e.startState=Kr,e.innerMode=si,e.commands=Mn,e.keyMap=pi,e.keyName=cs,e.isModifierKey=hs,e.lookupKey=sn,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=Rn,e.TextMarker=_i,e.LineWidget=Dn,e.e_preventDefault=ie,e.e_stopPropagation=oe,e.e_stop=de,e.addClass=U,e.contains=m,e.rmClass=g,e.keyNames=Li}$l($t),ql($t);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in kr.prototype)kr.prototype.hasOwnProperty(la)&&se(au,la)<0&&($t.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(kr.prototype[la]));return ye(kr),$t.inputStyles={textarea:er,contenteditable:Gt},$t.defineMode=function(e){!$t.defaults.mode&&e!="null"&&($t.defaults.mode=e),yr.apply(this,arguments)},$t.defineMIME=ir,$t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$t.defineMIME("text/plain","null"),$t.defineExtension=function(e,t){$t.prototype[e]=t},$t.defineDocExtension=function(e,t){kr.prototype[e]=t},$t.fromTextArea=iu,nu($t),$t.version="5.58.2",$t})},Y1PL:function(lt,$e,re){"use strict";re.r($e),re.d($e,"ResizableTextArea",function(){return se});var ne=re("wx14"),$=re("1OyB"),D=re("vuIU"),Y=re("Ji7U"),F=re("LK+K"),R=re("q1tI"),W=re("VTBJ"),B=re("rePB"),P=re("Zm9Q"),A=re("Kwbf"),f=re("c+Xe"),x=re("m+aA"),M=re("bdgK"),w=new Map;function C(be){be.forEach(function(Te){var Ce,Se=Te.target;(Ce=w.get(Se))===null||Ce===void 0||Ce.forEach(function(pe){return pe(Se)})})}var E=new M.default(C),d=null,a=null;function s(be,Te){w.has(be)||(w.set(be,new Set),E.observe(be)),w.get(be).add(Te)}function h(be,Te){w.has(be)&&(w.get(be).delete(Te),w.get(be).size||(E.unobserve(be),w.delete(be)))}var L=function(be){Object(Y.a)(Ce,be);var Te=Object(F.a)(Ce);function Ce(){return Object($.a)(this,Ce),Te.apply(this,arguments)}return Object(D.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(R.Component),p=R.createContext(null);function v(be){var Te=be.children,Ce=be.onBatchResize,Se=R.useRef(0),pe=R.useRef([]),ue=R.useContext(p),te=R.useCallback(function(fe,ae,_e){Se.current+=1;var De=Se.current;pe.current.push({size:fe,element:ae,data:_e}),Promise.resolve().then(function(){De===Se.current&&(Ce==null||Ce(pe.current),pe.current=[])}),ue==null||ue(fe,ae,_e)},[Ce,ue]);return R.createElement(p.Provider,{value:te},Te)}function k(be){var Te=be.children,Ce=be.disabled,Se=R.useRef(null),pe=R.useRef(null),ue=R.useContext(p),te=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),fe=R.isValidElement(Te)&&Object(f.c)(Te),ae=fe?Te.ref:null,_e=R.useMemo(function(){return Object(f.a)(ae,Se)},[ae,Se]),De=R.useRef(be);De.current=be;var xe=R.useCallback(function(Oe){var Ie=De.current,Ue=Ie.onResize,We=Ie.data,Be=Oe.getBoundingClientRect(),Fe=Be.width,it=Be.height,et=Oe.offsetWidth,qe=Oe.offsetHeight,Qe=Math.floor(Fe),ot=Math.floor(it);if(te.current.width!==Qe||te.current.height!==ot||te.current.offsetWidth!==et||te.current.offsetHeight!==qe){var Ze={width:Qe,height:ot,offsetWidth:et,offsetHeight:qe};te.current=Ze;var at=et===Math.round(Fe)?Fe:et,Pe=qe===Math.round(it)?it:qe,dt=Object(W.a)(Object(W.a)({},Ze),{},{offsetWidth:at,offsetHeight:Pe});ue==null||ue(dt,Oe,We),Ue&&Promise.resolve().then(function(){Ue(dt,Oe)})}},[]);return R.useEffect(function(){var Oe=Object(x.a)(Se.current)||Object(x.a)(pe.current);return Oe&&!Ce&&s(Oe,xe),function(){return h(Oe,xe)}},[Se.current,Ce]),R.createElement(L,{ref:pe},fe?R.cloneElement(Te,{ref:_e}):Te)}var b="rc-observer-key";function g(be){var Te=be.children,Ce=Object(P.a)(Te);return Ce.map(function(Se,pe){var ue=(Se==null?void 0:Se.key)||"".concat(b,"-").concat(pe);return R.createElement(k,Object(ne.a)({},be,{key:ue}),Se)})}g.Collection=v;var c=g,u=re("bT9E"),o=re("TSYQ"),T=re.n(o),S=`
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
`,m=["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"],O={},U;function j(be){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=be.getAttribute("id")||be.getAttribute("data-reactid")||be.getAttribute("name");if(Te&&O[Ce])return O[Ce];var Se=window.getComputedStyle(be),pe=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),te=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),fe=m.map(function(_e){return"".concat(_e,":").concat(Se.getPropertyValue(_e))}).join(";"),ae={sizingStyle:fe,paddingSize:ue,borderSize:te,boxSizing:pe};return Te&&Ce&&(O[Ce]=ae),ae}function K(be){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=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)),be.getAttribute("wrap")?U.setAttribute("wrap",be.getAttribute("wrap")):U.removeAttribute("wrap");var pe=j(be,Te),ue=pe.paddingSize,te=pe.borderSize,fe=pe.boxSizing,ae=pe.sizingStyle;U.setAttribute("style","".concat(ae,";").concat(S)),U.value=be.value||be.placeholder||"";var _e=Number.MIN_SAFE_INTEGER,De=Number.MAX_SAFE_INTEGER,xe=U.scrollHeight,Oe;if(fe==="border-box"?xe+=te:fe==="content-box"&&(xe-=ue),Ce!==null||Se!==null){U.value=" ";var Ie=U.scrollHeight-ue;Ce!==null&&(_e=Ie*Ce,fe==="border-box"&&(_e=_e+ue+te),xe=Math.max(_e,xe)),Se!==null&&(De=Ie*Se,fe==="border-box"&&(De=De+ue+te),Oe=xe>De?"":"hidden",xe=Math.min(De,xe))}return{height:xe,minHeight:_e,maxHeight:De,overflowY:Oe,resize:"none"}}var I=re("Gytx"),N=re.n(I),X;(function(be){be[be.NONE=0]="NONE",be[be.RESIZING=1]="RESIZING",be[be.RESIZED=2]="RESIZED"})(X||(X={}));var q=function(be){Object(Y.a)(Ce,be);var Te=Object(F.a)(Ce);function Ce(Se){var pe;return Object($.a)(this,Ce),pe=Te.call(this,Se),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(ue){pe.textArea=ue},pe.handleResize=function(ue){var te=pe.state.resizeStatus,fe=pe.props,ae=fe.autoSize,_e=fe.onResize;if(te!==X.NONE)return;typeof _e=="function"&&_e(ue),ae&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var ue=pe.props.autoSize;if(!ue||!pe.textArea)return;var te=ue.minRows,fe=ue.maxRows,ae=K(pe.textArea,!1,te,fe);pe.setState({textareaStyles:ae,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:X.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:X.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var ue=pe.props,te=ue.prefixCls,fe=te===void 0?"rc-textarea":te,ae=ue.autoSize,_e=ue.onResize,De=ue.className,xe=ue.disabled,Oe=pe.state,Ie=Oe.textareaStyles,Ue=Oe.resizeStatus,We=Object(u.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=T()(fe,De,Object(B.a)({},"".concat(fe,"-disabled"),xe));"value"in We&&(We.value=We.value||"");var Fe=Object(W.a)(Object(W.a)(Object(W.a)({},pe.props.style),Ie),Ue===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:pe.handleResize,disabled:!(ae||_e)},R.createElement("textarea",Object(ne.a)({},We,{className:Be,style:Fe,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:X.NONE},pe}return Object(D.a)(Ce,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!N()(pe.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 pe=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,ue)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(R.Component),se=q,he=function(be){Object(Y.a)(Ce,be);var Te=Object(F.a)(Ce);function Ce(Se){var pe;Object($.a)(this,Ce),pe=Te.call(this,Se),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(te){pe.resizableTextArea=te},pe.handleChange=function(te){var fe=pe.props.onChange;pe.setValue(te.target.value,function(){pe.resizableTextArea.resizeTextarea()}),fe&&fe(te)},pe.handleKeyDown=function(te){var fe=pe.props,ae=fe.onPressEnter,_e=fe.onKeyDown;te.keyCode===13&&ae&&ae(te),_e&&_e(te)};var ue=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return pe.state={value:ue},pe}return Object(D.a)(Ce,[{key:"setValue",value:function(pe,ue){"value"in this.props||this.setState({value:pe},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(se,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Ce}(R.Component),Ae=$e.default=he},ZW9T:function(lt,$e,re){"use strict";re.d($e,"a",function(){return L});var ne=re("k1fw"),$=re("miYZ"),D=re("tsqr"),Y=re("rAM+"),F=re("tJVT"),R=re("PpiC"),W=re("q1tI"),B=re.n(W),P=re("bdgK");function A(p,v,k,b,g){var c=v.getWordUntilPosition(k),u={startLineNumber:k.lineNumber,endLineNumber:k.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},o=b.map(function(T){return{label:T,kind:p.languages.CompletionItemKind.Keyword,insertText:T,insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return g.map(function(T){o.push(Object(ne.a)(Object(ne.a)({},T),{},{range:u}))}),o}var f=function(p){var v={label:"ifelse",kind:p.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},k=["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"];p.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(u,o){var T=A(p,u,o,k,[v]);return{suggestions:T}}});var b=["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"];p.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(u,o){var T=[{label:"print",kind:p.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],S=A(p,u,o,b,T);return{suggestions:S}}});var g=["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"];p.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(u,o){var T=[v,{label:"main",kind:p.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:p.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],S=A(p,u,o,g,T);return{suggestions:S}}})},x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=re("LvDl");function w(p){return/^\d+$/.test(p)?"".concat(p,"px"):p}function C(){}var E=!1,d={"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 a(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=p;if(Array.isArray(p)){for(var k=0;k<p.length;k++){var b=d[p[k]];if(b)return b}return v[0]}return d[v]||v}var s=null,h=$e.b=function(p){var v=p.width,k=v===void 0?"100%":v,b=p.height,g=b===void 0?"100%":b,c=p.value,u=p.language,o=u===void 0?"javascript":u,T=p.style,S=T===void 0?{}:T,m=p.options,O=m===void 0?{}:m,U=p.overrideServices,j=U===void 0?{}:U,K=p.theme,I=K===void 0?"vs-dark":K,N=p.onEditBlur,X=p.onSave,q=p.autoHeight,se=q===void 0?!1:q,he=p.forbidCopy,Ae=he===void 0?!1:he,be=p.onChange,Te=be===void 0?C:be,Ce=p.editorDidMount,Se=Ce===void 0?C:Ce,pe=p.onFocus,ue=pe===void 0?C:pe,te=p.filename,fe=te===void 0?"educoder.txt":te,ae=Object(R.a)(p,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),_e=Object(W.useRef)(),De=Object(W.useRef)({}),xe=Object(W.useRef)(),Oe=Object(W.useRef)(!1),Ie=Object(W.useRef)(),Ue=Object(W.useState)(!1),We=Object(F.a)(Ue,2),Be=We[0],Fe=We[1];function it(){var le;return _e.current&&(le=new P.default(function(de){var Le=Object(Y.a)(de),Me;try{for(Le.s();!(Me=Le.n()).done;){var Ye=Me.value;(Ye.target.offsetHeight>0||Ye.target.offsetWidth>0)&&De.current.instance.layout()}}catch(yt){Le.e(yt)}finally{Le.f()}}),le.observe(_e.current)),le}function et(){D.b.warn(decodeURIComponent(x))}var qe=function(){var de=De.current.instance;if(c!=null&&de&&Be){var Le=de.getModel();Le&&c!==Le.getValue()&&(E=!0,Le.setValue(c),de.layout(),E=!1)}};Object(W.useEffect)(function(){xe.current&&clearTimeout(xe.current),xe.current=setTimeout(function(){qe()},500)},[c,Be,De.current]);function Qe(){var le=De.current.instance;if(le){var de=le.getSelection(),Le=De.current.pastePos||{},Me=new s.Range(Le.startLineNumber||de.endLineNumber,Le.startColumn||de.endColumn,Le.endLineNumber||de.endLineNumber,Le.endColumn||de.endColumn);setTimeout(function(){le.executeEdits("",[{range:Me,text:""}])},300)}}function ot(le){(window.navigator.platform.match("Mac")?le.metaKey:le.ctrlKey)&&le.keyCode==83&&(le.preventDefault(),X())}var Ze=function(){if(se&&De.current.instance){var de=De.current.instance.getContentHeight();ie(de<g?g:de)}else ie(g)};function at(le){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),le.dispatchEvent(de)}function Pe(le,de){var Le=window.URL||window.webkitURL||window,Me=new Blob([de]),Ye=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ye.href=Le.createObjectURL(Me),Ye.download=le,at(Ye)}Object(W.useEffect)(function(){Ze()},[Ze]),Object(W.useEffect)(function(){_e.current&&!Be&&re.e(27).then(re.t.bind(null,"M/lh",7)).then(function(le){try{s=le,De.current.instance=s.editor.create(_e.current,{value:c,language:a(o),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var de=De.current.instance;if(Se(de,s),setTimeout(function(){Ze(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Pe(fe||"educoder.txt",de.getValue())}})},500),De.current.subscription=de.onDidChangeModelContent(function(Me){Oe.current?clearTimeout(Ie.current):(Ze(),Te(de.getValue(),Me)),Ie.current=setTimeout(function(){Oe.current=!1},500)}),window.Monaco||f(s),Ae&&(de.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return et(),null}),de.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return et(),null})),window.Monaco=s,N&&de.onDidBlurEditorWidget(function(){N(de.getValue())}),ue&&de.onDidFocusEditorText(function(){ue(de.getValue())}),Ae){de.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return et(),null}),de.onDidPaste(function(Me){De.current.pastePos=Me});try{window.addEventListener("paste",Qe)}catch(Me){}}var Le=it();return Fe(!0),function(){var Me=De.current.instance;Me.dispose();var Ye=Me.getModel();Ye&&Ye.dispose(),De.current.subscription&&De.current.subscription.dispose(),Ae&&window.removeEventListener("paste",Qe),Le.unobserve(_e.current)}}catch(Me){}})},[]),Object(W.useEffect)(function(){var le=De.current.instance;if(le&&Be)return document.addEventListener("keydown",ot,!1),function(){document.removeEventListener("keydown",ot)}},[X,Be]),Object(W.useEffect)(function(){var le=De.current.instance;if(le&&Be){var de=a(o);s.editor.setModelLanguage(le.getModel(),de),console.log("language:",o,le.getModel(),de)}},[o,Be]),Object(W.useEffect)(function(){var le=De.current.instance;le&&Be&&s.editor.setTheme(I)},[I,Be]),Object(W.useEffect)(function(){var le=De.current.instance;le&&Be&&(le.updateOptions(Object(ne.a)({},O)),setTimeout(function(){le.getModel().updateOptions(Object(ne.a)({},O))},200))},[JSON.stringify(O),Be]),Object(W.useEffect)(function(){var le=De.current.instance;le&&Be&&le.layout()},[k,g,Be]);var dt=Object(W.useState)(w(k)),st=Object(F.a)(dt,2),Ne=st[0],Ve=st[1],Ee=Object(W.useState)(w(g)),ge=Object(F.a)(Ee,2),ye=ge[0],ie=ge[1],oe=Object(ne.a)(Object(ne.a)({},S),{},{width:Ne,height:ye});return B.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:oe})};function L(p){var v=p.width,k=v===void 0?"100%":v,b=p.height,g=b===void 0?"100%":b,c=p.original,u=p.modified,o=p.language,T=p.options,S=T===void 0?{}:T,m=Object(W.useRef)(),O=Object(W.useState)(null),U=Object(F.a)(O,2),j=U[0],K=U[1];function I(se){var he;return m.current&&(he=new P.default(function(Ae){var be=Object(Y.a)(Ae),Te;try{for(be.s();!(Te=be.n()).done;){var Ce=Te.value;(Ce.target.offsetHeight>0||Ce.target.offsetWidth>0)&&se.layout()}}catch(Se){be.e(Se)}finally{be.f()}}),he.observe(m.current)),he}Object(W.useEffect)(function(){m.current&&re.e(27).then(re.t.bind(null,"M/lh",7)).then(function(se){s=se;var he=s.editor.createDiffEditor(m.current,Object(ne.a)(Object(ne.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},S),{},{wordWrap:!0}));K(he);var Ae=I(he);return function(){he.dispose();var be=he.getModel();be&&be.dispose(),Ae.unobserve(m.current)}})},[]),Object(W.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,o),modified:s.editor.createModel(u,o)})},[c,u,o,j]);var N=w(k),X=w(g),q={width:N,height:X};return B.a.createElement("div",{className:"my-diff-editor",ref:m,style:q})}},ZpRC:function(lt,$e,re){"use strict";function ne(f){return typeof f=="object"&&f!=null&&f.nodeType===1}function $(f,x){return(!x||f!=="hidden")&&f!=="visible"&&f!=="clip"}function D(f,x){if(f.clientHeight<f.scrollHeight||f.clientWidth<f.scrollWidth){var M=getComputedStyle(f,null);return $(M.overflowY,x)||$(M.overflowX,x)||function(w){var C=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(d){return null}}(w);return!!C&&(C.clientHeight<w.scrollHeight||C.clientWidth<w.scrollWidth)}(f)}return!1}function Y(f,x,M,w,C,E,d,a){return E<f&&d>x||E>f&&d<x?0:E<=f&&a<=M||d>=x&&a>=M?E-f-w:d>x&&a<M||E<f&&a>M?d-x+C:0}var F=function(f,x){var M=window,w=x.scrollMode,C=x.block,E=x.inline,d=x.boundary,a=x.skipOverflowHiddenElements,s=typeof d=="function"?d:function(Ie){return Ie!==d};if(!ne(f))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,L=[],p=f;ne(p)&&s(p);){if((p=p.parentElement)===h){L.push(p);break}p!=null&&p===document.body&&D(p)&&!D(document.documentElement)||p!=null&&D(p,a)&&L.push(p)}for(var v=M.visualViewport?M.visualViewport.width:innerWidth,k=M.visualViewport?M.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,c=f.getBoundingClientRect(),u=c.height,o=c.width,T=c.top,S=c.right,m=c.bottom,O=c.left,U=C==="start"||C==="nearest"?T:C==="end"?m:T+u/2,j=E==="center"?O+o/2:E==="end"?S:O,K=[],I=0;I<L.length;I++){var N=L[I],X=N.getBoundingClientRect(),q=X.height,se=X.width,he=X.top,Ae=X.right,be=X.bottom,Te=X.left;if(w==="if-needed"&&T>=0&&O>=0&&m<=k&&S<=v&&T>=he&&m<=be&&O>=Te&&S<=Ae)return K;var Ce=getComputedStyle(N),Se=parseInt(Ce.borderLeftWidth,10),pe=parseInt(Ce.borderTopWidth,10),ue=parseInt(Ce.borderRightWidth,10),te=parseInt(Ce.borderBottomWidth,10),fe=0,ae=0,_e="offsetWidth"in N?N.offsetWidth-N.clientWidth-Se-ue:0,De="offsetHeight"in N?N.offsetHeight-N.clientHeight-pe-te:0;if(h===N)fe=C==="start"?U:C==="end"?U-k:C==="nearest"?Y(g,g+k,k,pe,te,g+U,g+U+u,u):U-k/2,ae=E==="start"?j:E==="center"?j-v/2:E==="end"?j-v:Y(b,b+v,v,Se,ue,b+j,b+j+o,o),fe=Math.max(0,fe+g),ae=Math.max(0,ae+b);else{fe=C==="start"?U-he-pe:C==="end"?U-be+te+De:C==="nearest"?Y(he,be,q,pe,te+De,U,U+u,u):U-(he+q/2)+De/2,ae=E==="start"?j-Te-Se:E==="center"?j-(Te+se/2)+_e/2:E==="end"?j-Ae+ue+_e:Y(Te,Ae,se,Se,ue+_e,j,j+o,o);var xe=N.scrollLeft,Oe=N.scrollTop;U+=Oe-(fe=Math.max(0,Math.min(Oe+fe,N.scrollHeight-q+De))),j+=xe-(ae=Math.max(0,Math.min(xe+ae,N.scrollWidth-se+_e)))}K.push({el:N,top:fe,left:ae})}return K};function R(f){return f===Object(f)&&Object.keys(f).length!==0}function W(f,x){x===void 0&&(x="auto");var M="scrollBehavior"in document.body.style;f.forEach(function(w){var C=w.el,E=w.top,d=w.left;C.scroll&&M?C.scroll({top:E,left:d,behavior:x}):(C.scrollTop=E,C.scrollLeft=d)})}function B(f){return f===!1?{block:"end",inline:"nearest"}:R(f)?f:{block:"start",inline:"nearest"}}function P(f,x){var M=!f.ownerDocument.documentElement.contains(f);if(R(x)&&typeof x.behavior=="function")return x.behavior(M?[]:F(f,x));if(M)return;var w=B(x);return W(F(f,w),w.behavior)}var A=$e.a=P},Zss7:function(lt,$e,re){var ne;(function($){var D=/^\s+/,Y=/\s+$/,F=0,R=$.round,W=$.min,B=$.max,P=$.random;function A(te,fe){if(te=te||"",fe=fe||{},te instanceof A)return te;if(!(this instanceof A))return new A(te,fe);var ae=f(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=R(100*this._a)/100,this._format=fe.format||ae.format,this._gradientType=fe.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=ae.ok,this._tc_id=F++}A.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 te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),fe,ae,_e,De,xe,Oe;return fe=te.r/255,ae=te.g/255,_e=te.b/255,fe<=.03928?De=fe/12.92:De=$.pow((fe+.055)/1.055,2.4),ae<=.03928?xe=ae/12.92:xe=$.pow((ae+.055)/1.055,2.4),_e<=.03928?Oe=_e/12.92:Oe=$.pow((_e+.055)/1.055,2.4),.2126*De+.7152*xe+.0722*Oe},setAlpha:function(te){return this._a=K(te),this._roundA=R(100*this._a)/100,this},toHsv:function(){var te=C(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=C(this._r,this._g,this._b),fe=R(te.h*360),ae=R(te.s*100),_e=R(te.v*100);return this._a==1?"hsv("+fe+", "+ae+"%, "+_e+"%)":"hsva("+fe+", "+ae+"%, "+_e+"%, "+this._roundA+")"},toHsl:function(){var te=M(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=M(this._r,this._g,this._b),fe=R(te.h*360),ae=R(te.s*100),_e=R(te.l*100);return this._a==1?"hsl("+fe+", "+ae+"%, "+_e+"%)":"hsla("+fe+", "+ae+"%, "+_e+"%, "+this._roundA+")"},toHex:function(te){return d(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(I(this._r,255)*100)+"%",g:R(I(this._g,255)*100)+"%",b:R(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(I(this._r,255)*100)+"%, "+R(I(this._g,255)*100)+"%, "+R(I(this._b,255)*100)+"%)":"rgba("+R(I(this._r,255)*100)+"%, "+R(I(this._g,255)*100)+"%, "+R(I(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(te){var fe="#"+s(this._r,this._g,this._b,this._a),ae=fe,_e=this._gradientType?"GradientType = 1, ":"";if(te){var De=A(te);ae="#"+s(De._r,De._g,De._b,De._a)}return"progid:DXImageTransform.Microsoft.gradient("+_e+"startColorstr="+fe+",endColorstr="+ae+")"},toString:function(te){var fe=!!te;te=te||this._format;var ae=!1,_e=this._a<1&&this._a>=0,De=!fe&&_e&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return De?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(te,fe){var ae=te.apply(null,[this].concat([].slice.call(fe)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(te,fe){return te.apply(null,[this].concat([].slice.call(fe)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(m,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},A.fromRatio=function(te,fe){if(typeof te=="object"){var ae={};for(var _e in te)te.hasOwnProperty(_e)&&(_e==="a"?ae[_e]=te[_e]:ae[_e]=Ae(te[_e]));te=ae}return A(te,fe)};function f(te){var fe={r:0,g:0,b:0},ae=1,_e=null,De=null,xe=null,Oe=!1,Ie=!1;return typeof te=="string"&&(te=pe(te)),typeof te=="object"&&(Se(te.r)&&Se(te.g)&&Se(te.b)?(fe=x(te.r,te.g,te.b),Oe=!0,Ie=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Se(te.h)&&Se(te.s)&&Se(te.v)?(_e=Ae(te.s),De=Ae(te.v),fe=E(te.h,_e,De),Oe=!0,Ie="hsv"):Se(te.h)&&Se(te.s)&&Se(te.l)&&(_e=Ae(te.s),xe=Ae(te.l),fe=w(te.h,_e,xe),Oe=!0,Ie="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=K(ae),{ok:Oe,format:te.format||Ie,r:W(255,B(fe.r,0)),g:W(255,B(fe.g,0)),b:W(255,B(fe.b,0)),a:ae}}function x(te,fe,ae){return{r:I(te,255)*255,g:I(fe,255)*255,b:I(ae,255)*255}}function M(te,fe,ae){te=I(te,255),fe=I(fe,255),ae=I(ae,255);var _e=B(te,fe,ae),De=W(te,fe,ae),xe,Oe,Ie=(_e+De)/2;if(_e==De)xe=Oe=0;else{var Ue=_e-De;Oe=Ie>.5?Ue/(2-_e-De):Ue/(_e+De);switch(_e){case te:xe=(fe-ae)/Ue+(fe<ae?6:0);break;case fe:xe=(ae-te)/Ue+2;break;case ae:xe=(te-fe)/Ue+4;break}xe/=6}return{h:xe,s:Oe,l:Ie}}function w(te,fe,ae){var _e,De,xe;te=I(te,360),fe=I(fe,100),ae=I(ae,100);function Oe(We,Be,Fe){return Fe<0&&(Fe+=1),Fe>1&&(Fe-=1),Fe<1/6?We+(Be-We)*6*Fe:Fe<1/2?Be:Fe<2/3?We+(Be-We)*(2/3-Fe)*6:We}if(fe===0)_e=De=xe=ae;else{var Ie=ae<.5?ae*(1+fe):ae+fe-ae*fe,Ue=2*ae-Ie;_e=Oe(Ue,Ie,te+1/3),De=Oe(Ue,Ie,te),xe=Oe(Ue,Ie,te-1/3)}return{r:_e*255,g:De*255,b:xe*255}}function C(te,fe,ae){te=I(te,255),fe=I(fe,255),ae=I(ae,255);var _e=B(te,fe,ae),De=W(te,fe,ae),xe,Oe,Ie=_e,Ue=_e-De;if(Oe=_e===0?0:Ue/_e,_e==De)xe=0;else{switch(_e){case te:xe=(fe-ae)/Ue+(fe<ae?6:0);break;case fe:xe=(ae-te)/Ue+2;break;case ae:xe=(te-fe)/Ue+4;break}xe/=6}return{h:xe,s:Oe,v:Ie}}function E(te,fe,ae){te=I(te,360)*6,fe=I(fe,100),ae=I(ae,100);var _e=$.floor(te),De=te-_e,xe=ae*(1-fe),Oe=ae*(1-De*fe),Ie=ae*(1-(1-De)*fe),Ue=_e%6,We=[ae,Oe,xe,xe,Ie,ae][Ue],Be=[Ie,ae,ae,Oe,xe,xe][Ue],Fe=[xe,xe,Ie,ae,ae,Oe][Ue];return{r:We*255,g:Be*255,b:Fe*255}}function d(te,fe,ae,_e){var De=[he(R(te).toString(16)),he(R(fe).toString(16)),he(R(ae).toString(16))];return _e&&De[0].charAt(0)==De[0].charAt(1)&&De[1].charAt(0)==De[1].charAt(1)&&De[2].charAt(0)==De[2].charAt(1)?De[0].charAt(0)+De[1].charAt(0)+De[2].charAt(0):De.join("")}function a(te,fe,ae,_e,De){var xe=[he(R(te).toString(16)),he(R(fe).toString(16)),he(R(ae).toString(16)),he(be(_e))];return De&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function s(te,fe,ae,_e){var De=[he(be(_e)),he(R(te).toString(16)),he(R(fe).toString(16)),he(R(ae).toString(16))];return De.join("")}A.equals=function(te,fe){return!te||!fe?!1:A(te).toRgbString()==A(fe).toRgbString()},A.random=function(){return A.fromRatio({r:P(),g:P(),b:P()})};function h(te,fe){fe=fe===0?0:fe||10;var ae=A(te).toHsl();return ae.s-=fe/100,ae.s=N(ae.s),A(ae)}function L(te,fe){fe=fe===0?0:fe||10;var ae=A(te).toHsl();return ae.s+=fe/100,ae.s=N(ae.s),A(ae)}function p(te){return A(te).desaturate(100)}function v(te,fe){fe=fe===0?0:fe||10;var ae=A(te).toHsl();return ae.l+=fe/100,ae.l=N(ae.l),A(ae)}function k(te,fe){fe=fe===0?0:fe||10;var ae=A(te).toRgb();return ae.r=B(0,W(255,ae.r-R(255*-(fe/100)))),ae.g=B(0,W(255,ae.g-R(255*-(fe/100)))),ae.b=B(0,W(255,ae.b-R(255*-(fe/100)))),A(ae)}function b(te,fe){fe=fe===0?0:fe||10;var ae=A(te).toHsl();return ae.l-=fe/100,ae.l=N(ae.l),A(ae)}function g(te,fe){var ae=A(te).toHsl(),_e=(ae.h+fe)%360;return ae.h=_e<0?360+_e:_e,A(ae)}function c(te){var fe=A(te).toHsl();return fe.h=(fe.h+180)%360,A(fe)}function u(te){var fe=A(te).toHsl(),ae=fe.h;return[A(te),A({h:(ae+120)%360,s:fe.s,l:fe.l}),A({h:(ae+240)%360,s:fe.s,l:fe.l})]}function o(te){var fe=A(te).toHsl(),ae=fe.h;return[A(te),A({h:(ae+90)%360,s:fe.s,l:fe.l}),A({h:(ae+180)%360,s:fe.s,l:fe.l}),A({h:(ae+270)%360,s:fe.s,l:fe.l})]}function T(te){var fe=A(te).toHsl(),ae=fe.h;return[A(te),A({h:(ae+72)%360,s:fe.s,l:fe.l}),A({h:(ae+216)%360,s:fe.s,l:fe.l})]}function S(te,fe,ae){fe=fe||6,ae=ae||30;var _e=A(te).toHsl(),De=360/ae,xe=[A(te)];for(_e.h=(_e.h-(De*fe>>1)+720)%360;--fe;)_e.h=(_e.h+De)%360,xe.push(A(_e));return xe}function m(te,fe){fe=fe||6;for(var ae=A(te).toHsv(),_e=ae.h,De=ae.s,xe=ae.v,Oe=[],Ie=1/fe;fe--;)Oe.push(A({h:_e,s:De,v:xe})),xe=(xe+Ie)%1;return Oe}A.mix=function(te,fe,ae){ae=ae===0?0:ae||50;var _e=A(te).toRgb(),De=A(fe).toRgb(),xe=ae/100,Oe={r:(De.r-_e.r)*xe+_e.r,g:(De.g-_e.g)*xe+_e.g,b:(De.b-_e.b)*xe+_e.b,a:(De.a-_e.a)*xe+_e.a};return A(Oe)},A.readability=function(te,fe){var ae=A(te),_e=A(fe);return($.max(ae.getLuminance(),_e.getLuminance())+.05)/($.min(ae.getLuminance(),_e.getLuminance())+.05)},A.isReadable=function(te,fe,ae){var _e=A.readability(te,fe),De,xe;xe=!1,De=ue(ae);switch(De.level+De.size){case"AAsmall":case"AAAlarge":xe=_e>=4.5;break;case"AAlarge":xe=_e>=3;break;case"AAAsmall":xe=_e>=7;break}return xe},A.mostReadable=function(te,fe,ae){var _e=null,De=0,xe,Oe,Ie,Ue;ae=ae||{},Oe=ae.includeFallbackColors,Ie=ae.level,Ue=ae.size;for(var We=0;We<fe.length;We++)xe=A.readability(te,fe[We]),xe>De&&(De=xe,_e=A(fe[We]));return A.isReadable(te,_e,{level:Ie,size:Ue})||!Oe?_e:(ae.includeFallbackColors=!1,A.mostReadable(te,["#fff","#000"],ae))};var O=A.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=A.hexNames=j(O);function j(te){var fe={};for(var ae in te)te.hasOwnProperty(ae)&&(fe[te[ae]]=ae);return fe}function K(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,fe){q(te)&&(te="100%");var ae=se(te);return te=W(fe,B(0,parseFloat(te))),ae&&(te=parseInt(te*fe,10)/100),$.abs(te-fe)<1e-6?1:te%fe/parseFloat(fe)}function N(te){return W(1,B(0,te))}function X(te){return parseInt(te,16)}function q(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function se(te){return typeof te=="string"&&te.indexOf("%")!=-1}function he(te){return te.length==1?"0"+te:""+te}function Ae(te){return te<=1&&(te=te*100+"%"),te}function be(te){return $.round(parseFloat(te)*255).toString(16)}function Te(te){return X(te)/255}var Ce=function(){var te="[-\\+]?\\d+%?",fe="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+fe+")|(?:"+te+")",_e="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",De="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+_e),rgba:new RegExp("rgba"+De),hsl:new RegExp("hsl"+_e),hsla:new RegExp("hsla"+De),hsv:new RegExp("hsv"+_e),hsva:new RegExp("hsva"+De),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 Se(te){return!!Ce.CSS_UNIT.exec(te)}function pe(te){te=te.replace(D,"").replace(Y,"").toLowerCase();var fe=!1;if(O[te])te=O[te],fe=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Ce.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Ce.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Ce.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Ce.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Ce.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Ce.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Ce.hex8.exec(te))?{r:X(ae[1]),g:X(ae[2]),b:X(ae[3]),a:Te(ae[4]),format:fe?"name":"hex8"}:(ae=Ce.hex6.exec(te))?{r:X(ae[1]),g:X(ae[2]),b:X(ae[3]),format:fe?"name":"hex"}:(ae=Ce.hex4.exec(te))?{r:X(ae[1]+""+ae[1]),g:X(ae[2]+""+ae[2]),b:X(ae[3]+""+ae[3]),a:Te(ae[4]+""+ae[4]),format:fe?"name":"hex8"}:(ae=Ce.hex3.exec(te))?{r:X(ae[1]+""+ae[1]),g:X(ae[2]+""+ae[2]),b:X(ae[3]+""+ae[3]),format:fe?"name":"hex"}:!1}function ue(te){var fe,ae;return te=te||{level:"AA",size:"small"},fe=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),fe!=="AA"&&fe!=="AAA"&&(fe="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:fe,size:ae}}lt.exports?lt.exports=A:!(ne=function(){return A}.call($e,re,$e,lt),ne!==void 0&&(lt.exports=ne))})(Math)},aRTE:function(lt,$e){lt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(lt,$e,re){"use strict";re.d($e,"a",function(){return $});var ne=re("VTBJ");function $(D,Y){var F=Object(ne.a)({},D);return Array.isArray(Y)&&Y.forEach(function(R){delete F[R]}),F}},c5Ni:function(lt,$e,re){},dQei:function(lt,$e){for(var re={glog:function($){if($<1)throw new Error("glog("+$+")");return re.LOG_TABLE[$]},gexp:function($){for(;$<0;)$+=255;for(;$>=256;)$-=255;return re.EXP_TABLE[$]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},ne=0;ne<8;ne++)re.EXP_TABLE[ne]=1<<ne;for(var ne=8;ne<256;ne++)re.EXP_TABLE[ne]=re.EXP_TABLE[ne-4]^re.EXP_TABLE[ne-5]^re.EXP_TABLE[ne-6]^re.EXP_TABLE[ne-8];for(var ne=0;ne<255;ne++)re.LOG_TABLE[re.EXP_TABLE[ne]]=ne;lt.exports=re},dWSS:function(lt,$e,re){var ne=re("dQei");function $(D,Y){if(D.length==null)throw new Error(D.length+"/"+Y);for(var F=0;F<D.length&&D[F]==0;)F++;this.num=new Array(D.length-F+Y);for(var R=0;R<D.length-F;R++)this.num[R]=D[R+F]}$.prototype={get:function(D){return this.num[D]},getLength:function(){return this.num.length},multiply:function(D){for(var Y=new Array(this.getLength()+D.getLength()-1),F=0;F<this.getLength();F++)for(var R=0;R<D.getLength();R++)Y[F+R]^=ne.gexp(ne.glog(this.get(F))+ne.glog(D.get(R)));return new $(Y,0)},mod:function(D){if(this.getLength()-D.getLength()<0)return this;for(var Y=ne.glog(this.get(0))-ne.glog(D.get(0)),F=new Array(this.getLength()),R=0;R<this.getLength();R++)F[R]=this.get(R);for(var R=0;R<D.getLength();R++)F[R]^=ne.gexp(ne.glog(D.get(R))+Y);return new $(F,0).mod(D)}},lt.exports=$},dejd:function(lt,$e,re){},dmUQ:function(lt,$e,re){"use strict";var ne=re("Ff2n"),$=re("rePB"),D=re("1OyB"),Y=re("vuIU"),F=re("Ji7U"),R=re("md7G"),W=re("foSv"),B=re("q1tI"),P=re.n(B),A=re("TSYQ"),f=re.n(A),x=re("4IlW");function M(u,o){var T=Object.keys(u);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);o&&(S=S.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),T.push.apply(T,S)}return T}function w(u){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?M(Object(T),!0).forEach(function(S){Object($.a)(u,S,T[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(T)):M(Object(T)).forEach(function(S){Object.defineProperty(u,S,Object.getOwnPropertyDescriptor(T,S))})}return u}function C(u){var o=E();return function(){var S=Object(W.a)(u),m;if(o){var O=Object(W.a)(this).constructor;m=Reflect.construct(S,arguments,O)}else m=S.apply(this,arguments);return Object(R.a)(this,m)}}function E(){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(u){return!1}}function d(){}function a(u){u.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},h=200,L=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,v=function(o){return o!=null},k=function(o,T){return T===o||typeof T=="number"&&typeof o=="number"&&isNaN(T)&&isNaN(o)},b=function(u){Object(F.a)(T,u);var o=C(T);function T(S){var m;Object(D.a)(this,T),m=o.call(this,S),m.onKeyDown=function(j){var K=m.props,I=K.onKeyDown,N=K.onPressEnter;if(j.keyCode===x.a.UP){var X=m.getRatio(j);m.up(j,X,null),m.stop()}else if(j.keyCode===x.a.DOWN){var q=m.getRatio(j);m.down(j,q,null),m.stop()}else j.keyCode===x.a.ENTER&&N&&N(j);if(m.recordCursorPosition(),m.lastKeyCode=j.keyCode,I){for(var se=arguments.length,he=new Array(se>1?se-1:0),Ae=1;Ae<se;Ae++)he[Ae-1]=arguments[Ae];I.apply(void 0,[j].concat(he))}},m.onKeyUp=function(j){var K=m.props.onKeyUp;if(m.stop(),m.recordCursorPosition(),K){for(var I=arguments.length,N=new Array(I>1?I-1:0),X=1;X<I;X++)N[X-1]=arguments[X];K.apply(void 0,[j].concat(N))}},m.onChange=function(j){var K=m.props.onChange;m.state.focused&&(m.inputting=!0),m.rawInput=m.props.parser(m.getValueFromEvent(j)),m.setState({inputValue:m.rawInput}),K(m.toNumber(m.rawInput))},m.onMouseUp=function(){var j=m.props.onMouseUp;m.recordCursorPosition(),j&&j.apply(void 0,arguments)},m.onFocus=function(){var j;m.setState({focused:!0}),(j=m.props).onFocus.apply(j,arguments)},m.onBlur=function(){var j=m.props.onBlur;m.inputting=!1,m.setState({focused:!1});var K=m.getCurrentValidValue(m.state.inputValue),I=m.setValue(K,d);if(j){var N=m.input.value,X=m.getInputDisplayValue({focus:!1,value:I});m.input.value=X&&Number(X),j.apply(void 0,arguments),m.input.value=N}},m.getRatio=function(j){var K=1;return j.metaKey||j.ctrlKey?K=.1:j.shiftKey&&(K=10),K},m.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},m.getPrecision=function(j){if(v(m.props.precision))return m.props.precision;var K=String(j);if(K.indexOf("e-")>=0)return parseInt(K.slice(K.indexOf("e-")+2),10);var I=0;return K.indexOf(".")>=0&&(I=K.length-K.indexOf(".")-1),I},m.getInputDisplayValue=function(j){var K=j||m.state,I=K.focused,N=K.inputValue,X=K.value,q;I?q=N:q=m.toPrecisionAsStep(X),q==null&&(q="");var se=m.formatWrapper(q);return v(m.props.decimalSeparator)&&(se=se.toString().replace(".",m.props.decimalSeparator)),se},m.recordCursorPosition=function(){try{m.cursorStart=m.input.selectionStart,m.cursorEnd=m.input.selectionEnd,m.currentValue=m.input.value,m.cursorBefore=m.input.value.substring(0,m.cursorStart),m.cursorAfter=m.input.value.substring(m.cursorEnd)}catch(j){}},m.restoreByAfter=function(j){if(j===void 0)return!1;var K=m.input.value,I=K.lastIndexOf(j);if(I===-1)return!1;var N=m.cursorBefore.length;return m.lastKeyCode===x.a.DELETE&&m.cursorBefore.charAt(N-1)===j[0]?(m.fixCaret(N,N),!0):I+j.length===K.length?(m.fixCaret(I,I),!0):!1},m.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(K,I){var N=j.substring(I);return m.restoreByAfter(N)})},m.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},m.stop=function(){m.autoStepTimer&&clearTimeout(m.autoStepTimer)},m.down=function(j,K,I){m.pressingUpOrDown=!0,m.step("down",j,K,I)},m.up=function(j,K,I){m.pressingUpOrDown=!0,m.step("up",j,K,I)},m.saveInput=function(j){m.input=j};var O=S.value;O===void 0&&(O=S.defaultValue),m.state={focused:S.autoFocus};var U=m.getValidValue(m.toNumber(O));return m.state=w(w({},m.state),{},{inputValue:m.toPrecisionAsStep(U),value:U}),m}return Object(Y.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(m){var O=this.props,U=O.value,j=O.onChange,K=O.max,I=O.min,N=this.state.focused;if(m){if(!k(m.value,U)||!k(m.max,K)||!k(m.min,I)){var X=N?U:this.getValidValue(U),q;this.pressingUpOrDown?q=X:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:q})}var se="value"in this.props?U:this.state.value;"max"in this.props&&m.max!==K&&typeof se=="number"&&se>K&&j&&j(K),"min"in this.props&&m.min!==I&&typeof se=="number"&&se<I&&j&&j(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var he=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===x.a.BACKSPACE?he=this.cursorStart-1:this.lastKeyCode===x.a.DELETE&&(he=this.cursorStart):he=this.input.value.length,this.fixCaret(he,he)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case x.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case x.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ae){}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(m){var O=m;return O===""?O="":this.isNotCompleteNumber(parseFloat(O))?O=this.state.value:O=this.getValidValue(O),this.toNumber(O)}},{key:"getValueFromEvent",value:function(m){var O=m.target.value.trim().replace(/。/g,".");return v(this.props.decimalSeparator)&&(O=O.replace(this.props.decimalSeparator,".")),O}},{key:"getValidValue",value:function(m){var O=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,j=parseFloat(m);return isNaN(j)?m:(j<O&&(j=O),j>U&&(j=U),j)}},{key:"setValue",value:function(m,O){var U=this.props.precision,j=this.isNotCompleteNumber(parseFloat(m))?null:parseFloat(m),K=this.state.value,I=K===void 0?null:K,N=this.state.inputValue,X=N===void 0?null:N,q=typeof j=="number"?j.toFixed(U):"".concat(j),se=j!==I||q!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},O)):this.setState({value:j,inputValue:this.toPrecisionAsStep(m)},O),se&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,j=U.precision,K=U.step;if(v(j))return j;var I=this.getPrecision(O),N=this.getPrecision(K),X=this.getPrecision(m);return m?Math.max(X,I+N):I+N}},{key:"getPrecisionFactor",value:function(m){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(m,O);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(m){return this.props.formatter?this.props.formatter(m):m}},{key:"toPrecisionAsStep",value:function(m){if(this.isNotCompleteNumber(m)||m==="")return m;var O=Math.abs(this.getMaxPrecision(m));return isNaN(O)?m.toString():Number(m).toFixed(O)}},{key:"toNumber",value:function(m){var O=this.props.precision,U=this.state.focused,j=m&&m.length>16&&U;return this.isNotCompleteNumber(m)||j?m:v(O)?Math.round(m*Math.pow(10,O))/Math.pow(10,O):Number(m)}},{key:"upStep",value:function(m,O){var U=this.props.step,j=this.getPrecisionFactor(m,O),K=Math.abs(this.getMaxPrecision(m,O)),I=((j*m+j*U*O)/j).toFixed(K);return this.toNumber(I)}},{key:"downStep",value:function(m,O){var U=this.props.step,j=this.getPrecisionFactor(m,O),K=Math.abs(this.getMaxPrecision(m,O)),I=((j*m-j*U*O)/j).toFixed(K);return this.toNumber(I)}},{key:"step",value:function(m,O){var U=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,K=arguments.length>3?arguments[3]:void 0;this.stop(),O&&(O.persist(),O.preventDefault());var I=this.props;if(I.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var X=this["".concat(m,"Step")](N,j),q=X>I.max||X<I.min;if(X>I.max?X=I.max:X<I.min&&(X=I.min),this.setValue(X,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){U[m](O,j,!0)},K?h:L)}},{key:"fixCaret",value:function(m,O){if(m===void 0||O===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,j=this.input.selectionEnd;(m!==U||O!==j)&&this.input.setSelectionRange(m,O)}catch(K){}}},{key:"render",value:function(){var m,O=this.props,U=O.prefixCls,j=O.disabled,K=O.readOnly,I=O.useTouch,N=O.autoComplete,X=O.upHandler,q=O.downHandler,se=O.className,he=O.max,Ae=O.min,be=O.style,Te=O.title,Ce=O.onMouseEnter,Se=O.onMouseLeave,pe=O.onMouseOver,ue=O.onMouseOut,te=O.required,fe=O.onClick,ae=O.tabIndex,_e=O.type,De=O.placeholder,xe=O.id,Oe=O.inputMode,Ie=O.pattern,Ue=O.step,We=O.maxLength,Be=O.autoFocus,Fe=O.name,it=O.onPaste,et=O.onInput,qe=Object(ne.a)(O,["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"]),Qe=this.state,ot=Qe.value,Ze=Qe.focused,at=f()(U,(m={},Object($.a)(m,se,!!se),Object($.a)(m,"".concat(U,"-disabled"),j),Object($.a)(m,"".concat(U,"-focused"),Ze),m)),Pe={};Object.keys(qe).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(Pe[de]=qe[de])});var dt=!K&&!j,st=this.getInputDisplayValue(null),Ne=(ot||ot===0)&&(isNaN(ot)||Number(ot)>=he),Ve=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=Ae),Ee=Ne||j||K,ge=Ve||j||K,ye=f()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object($.a)({},"".concat(U,"-handler-up-disabled"),Ee)),ie=f()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object($.a)({},"".concat(U,"-handler-down-disabled"),ge)),oe=I?{onTouchStart:Ee?d:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},le=I?{onTouchStart:ge?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:at,style:be,title:Te,onMouseEnter:Ce,onMouseLeave:Se,onMouseOver:pe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(U,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:ye}),X||P.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:a})),P.a.createElement("span",Object.assign({unselectable:"on"},le,{role:"button","aria-label":"Decrease Value","aria-disabled":ge,className:ie}),q||P.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:a}))),P.a.createElement("div",{className:"".concat(U,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ae,"aria-valuemax":he,"aria-valuenow":ot,required:te,type:_e,placeholder:De,onPaste:it,onClick:fe,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ae,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:dt?this.onKeyDown:d,onKeyUp:dt?this.onKeyUp:d,autoFocus:Be,maxLength:We,readOnly:K,disabled:j,max:he,min:Ae,step:Ue,name:Fe,title:Te,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(st),pattern:Ie,inputMode:Oe,onInput:et},Pe))))}}]),T}(P.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var g=b,c=$e.a=g},f4xo:function(lt,$e,re){var ne=re("nVVt");function $(D){this.mode=ne.MODE_8BIT_BYTE,this.data=D}$.prototype={getLength:function(D){return this.data.length},write:function(D){for(var Y=0;Y<this.data.length;Y++)D.put(this.data.charCodeAt(Y),8)}},lt.exports=$},h78n:function(lt,$e,re){"use strict";re.d($e,"a",function(){return m});var ne=re("q1tI"),$=re.n(ne),D=re("TSYQ"),Y=re.n(D),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var K=j.map(function(){return Object(ne.useRef)()}),I=Object(ne.useRef)();return Object(ne.useEffect)(function(){var N=Date.now(),X=!1;Object.keys(K).forEach(function(q){var se=K[q].current;if(!se)return;X=!0;var he=se.style;he.transitionDuration=".3s, .3s, .3s, .06s",I.current&&N-I.current<100&&(he.transitionDuration="0s, 0s")}),X&&(I.current=Date.now())}),[K]};function W(){return W=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var K=arguments[j];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(U[I]=K[I])}return U},W.apply(this,arguments)}function B(U,j){return M(U)||x(U,j)||A(U,j)||P()}function P(){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 A(U,j){if(!U)return;if(typeof U=="string")return f(U,j);var K=Object.prototype.toString.call(U).slice(8,-1);if(K==="Object"&&U.constructor&&(K=U.constructor.name),K==="Map"||K==="Set")return Array.from(U);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return f(U,j)}function f(U,j){(j==null||j>U.length)&&(j=U.length);for(var K=0,I=new Array(j);K<j;K++)I[K]=U[K];return I}function x(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var K=[],I=!0,N=!1,X=void 0;try{for(var q=U[Symbol.iterator](),se;!(I=(se=q.next()).done)&&!(K.push(se.value),j&&K.length===j);I=!0);}catch(he){N=!0,X=he}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw X}}return K}function M(U){if(Array.isArray(U))return U}function w(U,j){if(U==null)return{};var K=C(U,j),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(U);for(N=0;N<X.length;N++){if(I=X[N],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,I))continue;K[I]=U[I]}}return K}function C(U,j){if(U==null)return{};var K={},I=Object.keys(U),N,X;for(X=0;X<I.length;X++){if(N=I[X],j.indexOf(N)>=0)continue;K[N]=U[N]}return K}var E=function(j){var K=j.className,I=j.percent,N=j.prefixCls,X=j.strokeColor,q=j.strokeLinecap,se=j.strokeWidth,he=j.style,Ae=j.trailColor,be=j.trailWidth,Te=j.transition,Ce=w(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var Se=Array.isArray(I)?I:[I],pe=Array.isArray(X)?X:[X],ue=R(Se),te=B(ue,1),fe=te[0],ae=se/2,_e=100-se/2,De="M ".concat(q==="round"?ae:0,",").concat(ae,`
L `).concat(q==="round"?_e:100,",").concat(ae),xe="0 0 100 ".concat(se),Oe=0;return $.a.createElement("svg",W({className:Y()("".concat(N,"-line"),K),viewBox:xe,preserveAspectRatio:"none",style:he},Ce),$.a.createElement("path",{className:"".concat(N,"-line-trail"),d:De,strokeLinecap:q,stroke:Ae,strokeWidth:be||se,fillOpacity:"0"}),Se.map(function(Ie,Ue){var We={strokeDasharray:"".concat(Ie,"px, 100px"),strokeDashoffset:"-".concat(Oe,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Be=pe[Ue]||pe[pe.length-1];return Oe+=Ie,$.a.createElement("path",{key:Ue,className:"".concat(N,"-line-path"),d:De,strokeLinecap:q,stroke:Be,strokeWidth:se,fillOpacity:"0",ref:fe[Ue],style:We})}))};E.defaultProps=F;var d=E;function a(){return a=Object.assign||function(U){for(var j=1;j<arguments.length;j++){var K=arguments[j];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(U[I]=K[I])}return U},a.apply(this,arguments)}function s(U,j){return k(U)||v(U,j)||L(U,j)||h()}function h(){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 L(U,j){if(!U)return;if(typeof U=="string")return p(U,j);var K=Object.prototype.toString.call(U).slice(8,-1);if(K==="Object"&&U.constructor&&(K=U.constructor.name),K==="Map"||K==="Set")return Array.from(U);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return p(U,j)}function p(U,j){(j==null||j>U.length)&&(j=U.length);for(var K=0,I=new Array(j);K<j;K++)I[K]=U[K];return I}function v(U,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var K=[],I=!0,N=!1,X=void 0;try{for(var q=U[Symbol.iterator](),se;!(I=(se=q.next()).done)&&!(K.push(se.value),j&&K.length===j);I=!0);}catch(he){N=!0,X=he}finally{try{!I&&q.return!=null&&q.return()}finally{if(N)throw X}}return K}function k(U){if(Array.isArray(U))return U}function b(U,j){if(U==null)return{};var K=g(U,j),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(U);for(N=0;N<X.length;N++){if(I=X[N],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,I))continue;K[I]=U[I]}}return K}function g(U,j){if(U==null)return{};var K={},I=Object.keys(U),N,X;for(X=0;X<I.length;X++){if(N=I[X],j.indexOf(N)>=0)continue;K[N]=U[N]}return K}var c=0;function u(U){return+U.replace("%","")}function o(U){return Array.isArray(U)?U:[U]}function T(U,j,K,I){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,q=50-I/2,se=0,he=-q,Ae=0,be=-2*q;switch(X){case"left":se=-q,he=0,Ae=2*q,be=0;break;case"right":se=q,he=0,Ae=-2*q,be=0;break;case"bottom":he=q,be=2*q;break;default:}var Te="M 50,50 m ".concat(se,",").concat(he,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(Ae,",").concat(-be,`
a `).concat(q,",").concat(q," 0 1 1 ").concat(-Ae,",").concat(be),Ce=Math.PI*2*q,Se={stroke:K,strokeDasharray:"".concat(j/100*(Ce-N),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(N/2+U/100*(Ce-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:Se}}var S=function(j){var K=j.prefixCls,I=j.strokeWidth,N=j.trailWidth,X=j.gapDegree,q=j.gapPosition,se=j.trailColor,he=j.strokeLinecap,Ae=j.style,be=j.className,Te=j.strokeColor,Ce=j.percent,Se=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(ne.useMemo)(function(){return c+=1,c},[]),ue=T(0,100,se,I,X,q),te=ue.pathString,fe=ue.pathStyle,ae=o(Ce),_e=o(Te),De=_e.find(function(We){return Object.prototype.toString.call(We)==="[object Object]"}),xe=R(ae),Oe=s(xe,1),Ie=Oe[0],Ue=function(){var Be=0;return ae.map(function(Fe,it){var et=_e[it]||_e[_e.length-1],qe=Object.prototype.toString.call(et)==="[object Object]"?"url(#".concat(K,"-gradient-").concat(pe,")"):"",Qe=T(Be,Fe,et,I,X,q);return Be+=Fe,$.a.createElement("path",{key:it,className:"".concat(K,"-circle-path"),d:Qe.pathString,stroke:qe,strokeLinecap:he,strokeWidth:I,opacity:Fe===0?0:1,fillOpacity:"0",style:Qe.pathStyle,ref:Ie[it]})})};return $.a.createElement("svg",a({className:Y()("".concat(K,"-circle"),be),viewBox:"0 0 100 100",style:Ae},Se),De&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(K,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(De).sort(function(We,Be){return u(We)-u(Be)}).map(function(We,Be){return $.a.createElement("stop",{key:Be,offset:We,stopColor:De[We]})}))),$.a.createElement("path",{className:"".concat(K,"-circle-trail"),d:te,stroke:se,strokeLinecap:he,strokeWidth:N||I,fillOpacity:"0",style:fe}),Ue().reverse())};S.defaultProps=F;var m=S,O={Line:d,Circle:m}},kSUc:function(lt,$e,re){},lLeG:function(lt,$e,re){lt.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(lt,$e,re){(function(ne){ne(re("VrN/"),re("1eCo"),re("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function($,D){var Y=ne.getMode($,"text/html"),F=Y.name=="null";function R(I){if(ne.findModeByName){var N=ne.findModeByName(I);N&&(I=N.mime||N.mimes[0])}var X=ne.getMode($,I);return X.name=="null"?null:X}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var W={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 B in W)W.hasOwnProperty(B)&&D.tokenTypeOverrides[B]&&(W[B]=D.tokenTypeOverrides[B]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,f=/^\[(x| )\](?=\s)/i,x=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\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]/,a=" ";function s(I,N,X){return N.f=N.inline=X,X(I,N)}function h(I,N,X){return N.f=N.block=X,X(I,N)}function L(I){return!I||!/\S/.test(I.string)}function p(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==k){var N=F;if(!N){var X=ne.innerMode(Y,I.htmlState);N=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}N&&(I.f=u,I.block=v,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function v(I,N){var X=I.column()===N.indentation,q=L(N.prevLine.stream),se=N.indentedCode,he=N.prevLine.hr,Ae=N.list!==!1,be=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Te=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Ae)){for(N.list=null;Te<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Te-N.listStack[N.listStack.length-1])}var Ce=!q&&!he&&!N.prevLine.header&&(!Ae||!se)&&!N.prevLine.fencedCodeEnd,Se=(N.list===!1||he||q)&&N.indentation<=be&&I.match(P),pe=null;if(N.indentationDiff>=4&&(se||N.prevLine.fencedCodeEnd||N.prevLine.header||q))return I.skipToEnd(),N.indentedCode=!0,W.code;if(I.eatSpace())return null;if(X&&N.indentation<=be&&(pe=I.match(x))&&pe[1].length<=6)return N.quote=0,N.header=pe[1].length,N.thisLine.header=!0,D.highlightFormatting&&(N.formatting="header"),N.f=N.inline,g(N);if(N.indentation<=be&&I.eat(">"))return N.quote=X?1:N.quote+1,D.highlightFormatting&&(N.formatting="quote"),I.eatSpace(),g(N);if(!Se&&!N.setext&&X&&N.indentation<=be&&(pe=I.match(A))){var ue=pe[1]?"ol":"ul";return N.indentation=Te+I.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,D.taskLists&&I.match(f,!1)&&(N.taskList=!0),N.f=N.inline,D.highlightFormatting&&(N.formatting=["list","list-"+ue]),g(N)}else{if(X&&N.indentation<=be&&(pe=I.match(C,!0)))return N.quote=0,N.fencedEndRE=new RegExp(pe[1]+"+ *$"),N.localMode=D.fencedCodeBlockHighlighting&&R(pe[2]||D.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ne.startState(N.localMode)),N.f=N.block=b,D.highlightFormatting&&(N.formatting="code-block"),N.code=-1,g(N);if(N.setext||(!Ce||!Ae)&&!N.quote&&N.list===!1&&!N.code&&!Se&&!E.test(I.string)&&(pe=I.lookAhead(1))&&(pe=pe.match(M)))return N.setext?(N.header=N.setext,N.setext=0,I.skipToEnd(),D.highlightFormatting&&(N.formatting="header")):(N.header=pe[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,g(N);if(Se)return I.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,W.hr;if(I.peek()==="[")return s(I,N,O)}return s(I,N,N.inline)}function k(I,N){var X=Y.token(I,N.htmlState);if(!F){var q=ne.innerMode(Y,N.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||N.md_inside&&I.current().indexOf(">")>-1)&&(N.f=u,N.block=v,N.htmlState=null)}return X}function b(I,N){var X=N.listStack[N.listStack.length-1]||0,q=N.indentation<X,se=X+3;if(N.fencedEndRE&&N.indentation<=se&&(q||I.match(N.fencedEndRE))){D.highlightFormatting&&(N.formatting="code-block");var he;return q||(he=g(N)),N.localMode=N.localState=null,N.block=v,N.f=u,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,q?h(I,N,N.block):he}else return N.localMode?N.localMode.token(I,N.localState):(I.skipToEnd(),W.code)}function g(I){var N=[];if(I.formatting){N.push(W.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var X=0;X<I.formatting.length;X++)N.push(W.formatting+"-"+I.formatting[X]),I.formatting[X]==="header"&&N.push(W.formatting+"-"+I.formatting[X]+"-"+I.header),I.formatting[X]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=I.quote?N.push(W.formatting+"-"+I.formatting[X]+"-"+I.quote):N.push("error"))}if(I.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(I.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(I.linkHref?N.push(W.linkHref,"url"):(I.strong&&N.push(W.strong),I.em&&N.push(W.em),I.strikethrough&&N.push(W.strikethrough),I.emoji&&N.push(W.emoji),I.linkText&&N.push(W.linkText),I.code&&N.push(W.code),I.image&&N.push(W.image),I.imageAltText&&N.push(W.imageAltText,"link"),I.imageMarker&&N.push(W.imageMarker)),I.header&&N.push(W.header,W.header+"-"+I.header),I.quote&&(N.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=I.quote?N.push(W.quote+"-"+I.quote):N.push(W.quote+"-"+D.maxBlockquoteDepth)),I.list!==!1){var q=(I.listStack.length-1)%3;q?q===1?N.push(W.list2):N.push(W.list3):N.push(W.list1)}return I.trailingSpaceNewLine?N.push("trailing-space-new-line"):I.trailingSpace&&N.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function c(I,N){return I.match(w,!0)?g(N):void 0}function u(I,N){var X=N.text(I,N);if(typeof X!="undefined")return X;if(N.list)return N.list=null,g(N);if(N.taskList){var q=I.match(f,!0)[1]===" ";return q?N.taskOpen=!0:N.taskClosed=!0,D.highlightFormatting&&(N.formatting="task"),N.taskList=!1,g(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&I.match(/^#+$/,!0))return D.highlightFormatting&&(N.formatting="header"),g(N);var se=I.next();if(N.linkTitle){N.linkTitle=!1;var he=se;se==="("&&(he=")"),he=(he+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ae="^\\s*(?:[^"+he+"\\\\]+|\\\\\\\\|\\\\.)"+he;if(I.match(new RegExp(Ae),!0))return W.linkHref}if(se==="`"){var be=N.formatting;D.highlightFormatting&&(N.formatting="code"),I.eatWhile("`");var Te=I.current().length;if(N.code==0&&(!N.quote||Te==1))return N.code=Te,g(N);if(Te==N.code){var Ce=g(N);return N.code=0,Ce}else return N.formatting=be,g(N)}else if(N.code)return g(N);if(se==="\\"&&(I.next(),D.highlightFormatting)){var Se=g(N),pe=W.formatting+"-escape";return Se?Se+" "+pe:pe}if(se==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,D.highlightFormatting&&(N.formatting="image"),g(N);if(se==="["&&N.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,D.highlightFormatting&&(N.formatting="image"),g(N);if(se==="]"&&N.imageAltText){D.highlightFormatting&&(N.formatting="image");var Se=g(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=T,Se}if(se==="["&&!N.image)return N.linkText&&I.match(/^.*?\]/)||(N.linkText=!0,D.highlightFormatting&&(N.formatting="link")),g(N);if(se==="]"&&N.linkText){D.highlightFormatting&&(N.formatting="link");var Se=g(N);return N.linkText=!1,N.inline=N.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?T:u,Se}if(se==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,D.highlightFormatting&&(N.formatting="link");var Se=g(N);return Se?Se+=" ":Se="",Se+W.linkInline}if(se==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,D.highlightFormatting&&(N.formatting="link");var Se=g(N);return Se?Se+=" ":Se="",Se+W.linkEmail}if(D.xml&&se==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var te=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(N.md_inside=!0)}return I.backUp(1),N.htmlState=ne.startState(Y),h(I,N,k)}if(D.xml&&se==="<"&&I.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(se==="*"||se==="_"){for(var fe=1,ae=I.pos==1?" ":I.string.charAt(I.pos-2);fe<3&&I.eat(se);)fe++;var _e=I.peek()||" ",De=!/\s/.test(_e)&&(!d.test(_e)||/\s/.test(ae)||d.test(ae)),xe=!/\s/.test(ae)&&(!d.test(ae)||/\s/.test(_e)||d.test(_e)),Oe=null,Ie=null;if(fe%2&&(!N.em&&De&&(se==="*"||!xe||d.test(ae))?Oe=!0:N.em==se&&xe&&(se==="*"||!De||d.test(_e))&&(Oe=!1)),fe>1&&(!N.strong&&De&&(se==="*"||!xe||d.test(ae))?Ie=!0:N.strong==se&&xe&&(se==="*"||!De||d.test(_e))&&(Ie=!1)),Ie!=null||Oe!=null){D.highlightFormatting&&(N.formatting=Oe==null?"strong":Ie==null?"em":"strong em"),Oe===!0&&(N.em=se),Ie===!0&&(N.strong=se);var Ce=g(N);return Oe===!1&&(N.em=!1),Ie===!1&&(N.strong=!1),Ce}}else if(se===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return g(N);I.backUp(1)}if(D.strikethrough){if(se==="~"&&I.eatWhile(se)){if(N.strikethrough){D.highlightFormatting&&(N.formatting="strikethrough");var Ce=g(N);return N.strikethrough=!1,Ce}else if(I.match(/^[^\s]/,!1))return N.strikethrough=!0,D.highlightFormatting&&(N.formatting="strikethrough"),g(N)}else if(se===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return g(N);I.backUp(2)}}if(D.emoji&&se===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,D.highlightFormatting&&(N.formatting="emoji");var Ue=g(N);return N.emoji=!1,Ue}return se===" "&&(I.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),g(N)}function o(I,N){var X=I.next();if(X===">"){N.f=N.inline=u,D.highlightFormatting&&(N.formatting="link");var q=g(N);return q?q+=" ":q="",q+W.linkInline}return I.match(/^[^>]+/,!0),W.linkInline}function T(I,N){if(I.eatSpace())return null;var X=I.next();return X==="("||X==="["?(N.f=N.inline=m(X==="("?")":"]"),D.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,g(N)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function m(I){return function(N,X){var q=N.next();if(q===I){X.f=X.inline=u,D.highlightFormatting&&(X.formatting="link-string");var se=g(X);return X.linkHref=!1,se}return N.match(S[I]),X.linkHref=!0,g(X)}}function O(I,N){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=U,I.next(),D.highlightFormatting&&(N.formatting="link"),N.linkText=!0,g(N)):s(I,N,u)}function U(I,N){if(I.match(/^\]:/,!0)){N.f=N.inline=j,D.highlightFormatting&&(N.formatting="link");var X=g(N);return N.linkText=!1,X}return I.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function j(I,N){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?N.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=u,W.linkHref+" url")}var K={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:u,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ne.copyState(Y,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ne.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,N){if(N.formatting=!1,I!=N.thisLine.stream){if(N.header=0,N.hr=!1,I.match(/^\s*$/,!0))return p(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:I},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=k)){var X=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(N.indentation=X,N.indentationDiff=null,X>0)return null}}return N.f(I,N)},innerMode:function(I){return I.block==k?{state:I.htmlState,mode:Y}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:K}},indent:function(I,N,X){return I.block==k&&Y.indent?Y.indent(I.htmlState,N,X):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,N,X):ne.Pass},blankLine:p,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return K},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},nVVt:function(lt,$e){lt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(lt,$e,re){(function(ne){ne(re("VrN/"))})(function(ne){"use strict";var $=ne.Pos;function D(d,a){return d.line-a.line||d.ch-a.ch}var Y="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=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+Y+"]["+F+"]*)","g");function W(d,a,s,h){this.line=a,this.ch=s,this.cm=d,this.text=d.getLine(a),this.min=h?Math.max(h.from,d.firstLine()):d.firstLine(),this.max=h?Math.min(h.to-1,d.lastLine()):d.lastLine()}function B(d,a){var s=d.cm.getTokenTypeAt($(d.line,a));return s&&/\btag\b/.test(s)}function P(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function A(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function f(d){for(;;){var a=d.text.indexOf(">",d.ch);if(a==-1){if(P(d))continue;return}if(!B(d,a+1)){d.ch=a+1;continue}var s=d.text.lastIndexOf("/",a),h=s>-1&&!/\S/.test(d.text.slice(s+1,a));return d.ch=a+1,h?"selfClose":"regular"}}function x(d){for(;;){var a=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(a==-1){if(A(d))continue;return}if(!B(d,a+1)){d.ch=a;continue}R.lastIndex=a,d.ch=a;var s=R.exec(d.text);if(s&&s.index==a)return s}}function M(d){for(;;){R.lastIndex=d.ch;var a=R.exec(d.text);if(!a){if(P(d))continue;return}if(!B(d,a.index+1)){d.ch=a.index+1;continue}return d.ch=a.index+a[0].length,a}}function w(d){for(;;){var a=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(a==-1){if(A(d))continue;return}if(!B(d,a+1)){d.ch=a;continue}var s=d.text.lastIndexOf("/",a),h=s>-1&&!/\S/.test(d.text.slice(s+1,a));return d.ch=a+1,h?"selfClose":"regular"}}function C(d,a){for(var s=[];;){var h=M(d),L,p=d.line,v=d.ch-(h?h[0].length:0);if(!h||!(L=f(d)))return;if(L=="selfClose")continue;if(h[1]){for(var k=s.length-1;k>=0;--k)if(s[k]==h[2]){s.length=k;break}if(k<0&&(!a||a==h[2]))return{tag:h[2],from:$(p,v),to:$(d.line,d.ch)}}else s.push(h[2])}}function E(d,a){for(var s=[];;){var h=w(d);if(!h)return;if(h=="selfClose"){x(d);continue}var L=d.line,p=d.ch,v=x(d);if(!v)return;if(v[1])s.push(v[2]);else{for(var k=s.length-1;k>=0;--k)if(s[k]==v[2]){s.length=k;break}if(k<0&&(!a||a==v[2]))return{tag:v[2],from:$(d.line,d.ch),to:$(L,p)}}}}ne.registerHelper("fold","xml",function(d,a){for(var s=new W(d,a.line,0);;){var h=M(s);if(!h||s.line!=a.line)return;var L=f(s);if(!L)return;if(!h[1]&&L!="selfClose"){var p=$(s.line,s.ch),v=C(s,h[2]);return v&&D(v.from,p)>0?{from:p,to:v.from}:null}}}),ne.findMatchingTag=function(d,a,s){var h=new W(d,a.line,a.ch,s);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var L=f(h),p=L&&$(h.line,h.ch),v=L&&x(h);if(!L||!v||D(h,a)>0)return;var k={from:$(h.line,h.ch),to:p,tag:v[2]};return L=="selfClose"?{open:k,close:null,at:"open"}:v[1]?{open:E(h,v[2]),close:k,at:"close"}:(h=new W(d,p.line,p.ch,s),{open:k,close:C(h,v[2]),at:"open"})},ne.findEnclosingTag=function(d,a,s,h){for(var L=new W(d,a.line,a.ch,s);;){var p=E(L,h);if(!p)break;var v=new W(d,a.line,a.ch,s),k=C(v,p.tag);if(k)return{open:p,close:k}}},ne.scanForClosingTag=function(d,a,s,h){var L=new W(d,a.line,a.ch,h?{from:0,to:h}:null);return C(L,s)}})},p5ED:function(lt,$e,re){"use strict";var ne=re("+L6B"),$=re("2/Rp"),D=re("5Dmo"),Y=re("3S7+"),F=re("k1fw"),R=re("tJVT"),W=re("q1tI"),B=re.n(W),P=re("vHTk"),A=re.n(P),f=re("yEEn"),x=re("ZW9T"),M=re("1vsH");$e.a=function(w){var C=w.name,E=w.data,d=w.theme,a=w.type,s=w.filename,h=w.monacoEditor,L=w.className,p=w.style,v=w.close,k=w.onClose,b=w.hasMask,g=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(g,2),u=c[0],o=c[1],T=Object(W.useState)(""),S=Object(R.a)(T,2),m=S[0],O=S[1],U=Object(W.useRef)();s&&(h.filename=s),Object(W.useEffect)(function(){var I,N,X=(I=document.cookie)===null||I===void 0||((N=I.replace(/\s/g,""))===null||N===void 0)?void 0:N.split(";");X==null||X.map(function(q){var se=q.split("=");se[0]==="_educoder_session"&&O(se[1])})},[]);var j=function(){if(E.startsWith("http")||E.startsWith("/")){K();return}Object(M.x)(s||"educoder",E,s)},K=function(){Object(M.v)(s||C,E)};return console.log("data:",E,"fileanme:",s," name:",C),B.a.createElement("div",{style:Object(F.a)({},p||{}),className:"".concat(b&&A.a.bgBlack," ").concat(a?A.a.wrp:"hide")},v&&B.a.createElement("div",{className:A.a.close,ref:U},B.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},B.a.createElement("span",{onClick:K},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},B.a.createElement("span",{className:"",onClick:k},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(A.a[L]," ").concat(L," ").concat(A.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&B.a.createElement(x.b,h)),a==="audio"&&B.a.createElement("audio",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?E:"data:audio/mp3;base64,").concat(E),autoPlay:!0}),a==="video"&&B.a.createElement(B.a.Fragment,null,E!=null&&E.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(E),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(E),autoPlay:!0})),a==="html"&&B.a.createElement("iframe",{src:E+"&disposition=inline"}),a==="pdf"&&B.a.createElement("embed",{className:A.a.embed,src:E}),a==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(E!=null&&E.startsWith("/")||(E==null?void 0:E.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(E)})),a==="other"&&B.a.createElement("div",null,B.a.createElement($.a,{type:"primary",size:"large",onClick:j},B.a.createElement(f.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&B.a.createElement($.a,{type:"primary",size:"large",onClick:j},B.a.createElement(f.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(lt,$e,re){},"rAM+":function(lt,$e,re){"use strict";re.d($e,"a",function(){return $});var ne=re("Qw5x");function $(D,Y){var F;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(F=Object(ne.a)(D))||Y&&D&&typeof D.length=="number"){F&&(D=F);var R=0,W=function(){};return{s:W,n:function(){return R>=D.length?{done:!0}:{done:!1,value:D[R++]}},e:function(x){throw x},f:W}}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 B=!0,P=!1,A;return{s:function(){F=D[Symbol.iterator]()},n:function(){var x=F.next();return B=x.done,x},e:function(x){P=!0,A=x},f:function(){try{!B&&F.return!=null&&F.return()}finally{if(P)throw A}}}}},rUJ1:function(lt,$e){const re=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=b=>Y[b];function R(b,g){if(g){if(re.test(b))return b.replace(ne,F)}else if($.test(b))return b.replace(D,F);return b}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(b){return b.replace(W,(g,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 P=/(^|[^\[])\^/g;function A(b,g){b=b.source||b,g=g||"";const c={replace:(u,o)=>(o=o.source||o,o=o.replace(P,"$1"),b=b.replace(u,o),c),getRegex:()=>new RegExp(b,g)};return c}const f=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(b,g,c){if(b){let u;try{u=decodeURIComponent(B(c)).replace(f,"").toLowerCase()}catch(o){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}g&&!x.test(c)&&(c=a(g,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const w={},C=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(b,g){w[" "+b]||(C.test(b)?w[" "+b]=b+"/":w[" "+b]=p(b,"/",!0)),b=w[" "+b];const c=b.indexOf(":")===-1;return g.substring(0,2)==="//"?c?g:b.replace(E,"$1")+g:g.charAt(0)==="/"?c?g:b.replace(d,"$1")+g:b+g}const s={exec:function(){}};function h(b){let g=1,c,u;for(;g<arguments.length;g++){c=arguments[g];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(b[u]=c[u])}return b}function L(b,g){const c=b.replace(/\|/g,(T,S,m)=>{let O=!1,U=S;for(;--U>=0&&m[U]==="\\";)O=!O;return O?"|":" |"}),u=c.split(/ \|/);let o=0;if(u.length>g)u.splice(g);else for(;u.length<g;)u.push("");for(;o<u.length;o++)u[o]=u[o].trim().replace(/\\\|/g,"|");return u}function p(b,g,c){const u=b.length;if(u===0)return"";let o=0;for(;o<u;){const T=b.charAt(u-o-1);if(T===g&&!c)o++;else if(T!==g&&c)o++;else break}return b.substr(0,u-o)}function v(b,g){if(b.indexOf(g[1])===-1)return-1;const c=b.length;let u=0,o=0;for(;o<c;o++)if(b[o]==="\\")o++;else if(b[o]===g[0])u++;else if(b[o]===g[1]&&(u--,u<0))return o;return-1}function k(b){b&&b.sanitize&&!b.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")}lt.exports={escape:R,unescape:B,edit:A,cleanUrl:M,resolveUrl:a,noopTest:s,merge:h,splitCells:L,rtrim:p,findClosingBracket:v,checkSanitizeDeprecation:k}},rcnY:function(lt,$e,re){var ne=re("aRTE");function $(D,Y){this.totalCount=D,this.dataCount=Y}$.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]],$.getRSBlocks=function(D,Y){var F=$.getRsBlockTable(D,Y);if(F==null)throw new Error("bad rs block @ typeNumber:"+D+"/errorCorrectLevel:"+Y);for(var R=F.length/3,W=new Array,B=0;B<R;B++)for(var P=F[B*3+0],A=F[B*3+1],f=F[B*3+2],x=0;x<P;x++)W.push(new $(A,f));return W},$.getRsBlockTable=function(D,Y){switch(Y){case ne.L:return $.RS_BLOCK_TABLE[(D-1)*4+0];case ne.M:return $.RS_BLOCK_TABLE[(D-1)*4+1];case ne.Q:return $.RS_BLOCK_TABLE[(D-1)*4+2];case ne.H:return $.RS_BLOCK_TABLE[(D-1)*4+3];default:return}},lt.exports=$},tt94:function(lt,$e,re){"use strict";re.r($e);var ne=re("+L6B"),$=re("2/Rp"),D=re("sRBo"),Y=re("kaz8"),F=re("14J3"),R=re("BMrR"),W=re("jCWc"),B=re("kPKH"),P=re("giR+"),A=re("fyUT"),f=re("5NDa"),x=re("5rEg"),M=re("sPJy"),w=re("bE4q"),C=re("k1fw"),E=re("miYZ"),d=re("tsqr"),a=re("9og8"),s=re("y8nQ"),h=re("Vl3Y"),L=re("tJVT"),p=re("WmNS"),v=re.n(p),k=re("q1tI"),b=re.n(k),g=re("9kvl"),c=re("55Ip"),u=re("1vsH"),o=re("Ot1p"),T=re("XYT7"),S=re("lLeG"),m=re.n(S),O=re("500L"),U=function(K){var I,N=K.shixunHomeworks,X=K.newCourse,q=K.globalSetting,se=K.loading,he=K.dispatch,Ae=K.match,be=h.a.useForm(),Te=Object(L.a)(be,1),Ce=Te[0],Se=Object(k.useState)({}),pe=Object(L.a)(Se,2),ue=pe[0],te=pe[1],fe=Object(k.useRef)(),ae=N.commonHomeWorkAddDefaultData;Object(k.useEffect)(function(){setTimeout(function(){document.body.scrollIntoView()},300);var De=Ae.params,xe=De.coursesId,Oe=De.categoryId;he({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:Oe,coursesId:xe,type:3}})},[]);var _e=function(){var De=Object(a.a)(v.a.mark(function xe(Oe){var Ie,Ue,We,Be,Fe,it,et;return v.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:if(!(ue.min_num>ue.max_num)){Qe.next=3;break}return d.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),Qe.abrupt("return");case 3:return Ie=Object(C.a)({},ue),Ie.attachment_ids&&(Ie.attachment_ids=Ie==null||((Ue=Ie.attachment_ids)===null||Ue===void 0)?void 0:Ue.map(function(ot){return ot.response.id})),Ie.reference_attachment_ids&&(Ie.reference_attachment_ids=Ie==null||((We=Ie.reference_attachment_ids)===null||We===void 0)?void 0:We.map(function(ot){return ot.response.id})),Be=Ae.params,Fe=Be.coursesId,it=Be.categoryId,Qe.next=9,Object(T.a)(Object(C.a)(Object(C.a)({coursesId:Fe,category:it},Ie),{},{type:3}));case 9:et=Qe.sent,et.status===0&&(Object(u.ab)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),g.d.push("/classrooms/".concat(Fe,"/group_homework/").concat(et.homework_id,"/detail")));case 11:case"end":return Qe.stop()}},xe)}));return function(Oe){return De.apply(this,arguments)}}();return b.a.createElement("section",{className:m.a.bg},ae.course_name&&b.a.createElement("section",{className:"animated fadeIn"},b.a.createElement("aside",{className:"mt10"},ae.category&&b.a.createElement(w.a,{separator:">"},b.a.createElement(w.a.Item,null,b.a.createElement(c.a,{to:"/classrooms/".concat(ae.course_id,"/group_homework")},ae.course_name)),b.a.createElement(w.a.Item,null,b.a.createElement(c.a,{to:"/classrooms/".concat(ae.course_id,"/group_homework")},ae.category.category_name)),b.a.createElement(w.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),b.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),b.a.createElement(h.a,{form:Ce,className:m.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){te(Object(C.a)({},Ce.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:_e},b.a.createElement("div",{className:m.a.fieldWrap},b.a.createElement(h.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},b.a.createElement(x.a,{maxLength:60,suffix:"".concat(((I=ue.name)===null||I===void 0?void 0:I.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),b.a.createElement("div",{className:m.a.mdWrap},b.a.createElement(h.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"}]},b.a.createElement(o.a,{watch:!0,defaultValue:ue.intro})),b.a.createElement("div",null,b.a.createElement(h.a.Item,{name:"attachment_ids"},b.a.createElement(O.b,null))),b.a.createElement(R.a,{gutter:[20,20]},b.a.createElement(B.a,{flex:"230px"},b.a.createElement(h.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},b.a.createElement(A.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),b.a.createElement(B.a,{flex:"230px"},b.a.createElement(h.a.Item,{name:"max_num",label:b.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},b.a.createElement(A.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),b.a.createElement(B.a,null,b.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"))),b.a.createElement(R.a,null,b.a.createElement(B.a,null,b.a.createElement(h.a.Item,{name:"base_on_project",valuePropName:"checked"},b.a.createElement(Y.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),b.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")))),b.a.createElement("div",{className:m.a.mdWrap},b.a.createElement(h.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},b.a.createElement(o.a,{watch:!0,defaultValue:ue.notice})),b.a.createElement("div",null,b.a.createElement(h.a.Item,{name:"reference_attachment_ids"},b.a.createElement(O.b,null)))),b.a.createElement("div",{className:m.a.backgroundFa},b.a.createElement("div",{className:"pt40 mb30"},b.a.createElement(h.a.Item,null,b.a.createElement($.a,{size:"large",type:"primary",className:"".concat(m.a.button," mr20"),htmlType:"submit",loading:se["newCourse/editCourse"]||se["newCourse/submitCourse"]},"\u63D0\u4EA4"),b.a.createElement($.a,{size:"large",type:"primary",ghost:!0,className:m.a.button,onClick:function(){return g.d.push("/classrooms/".concat(Ae.params.coursesId,"/group_homework"))}},"\u53D6\u6D88"))))))};$e.default=Object(g.a)(function(j){var K=j.shixunHomeworks,I=j.newCourse,N=j.loading,X=j.globalSetting;return{shixunHomeworks:K,newCourse:I,globalSetting:X,loading:N.effects}})(U)},ulZh:function(lt,$e,re){typeof window!="undefined"&&function($,D){lt.exports=D()}(this,function(){return function(ne){var $={};function D(Y){if($[Y])return $[Y].exports;var F=$[Y]={i:Y,l:!1,exports:{}};return ne[Y].call(F.exports,F,F.exports,D),F.l=!0,F.exports}return D.m=ne,D.c=$,D.d=function(Y,F,R){D.o(Y,F)||Object.defineProperty(Y,F,{enumerable:!0,get:R})},D.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},D.t=function(Y,F){if(F&1&&(Y=D(Y)),F&8)return Y;if(F&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var R=Object.create(null);if(D.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:Y}),F&2&&typeof Y!="string")for(var W in Y)D.d(R,W,function(B){return Y[B]}.bind(null,W));return R},D.n=function(Y){var F=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return D.d(F,"a",F),F},D.o=function(Y,F){return Object.prototype.hasOwnProperty.call(Y,F)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,$,D){"use strict";var Y=Object.prototype.hasOwnProperty,F="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(F=!1));function W(f,x,M){this.fn=f,this.context=x,this.once=M||!1}function B(f,x,M,w,C){if(typeof M!="function")throw new TypeError("The listener must be a function");var E=new W(M,w||f,C),d=F?F+x:x;return f._events[d]?f._events[d].fn?f._events[d]=[f._events[d],E]:f._events[d].push(E):(f._events[d]=E,f._eventsCount++),f}function P(f,x){--f._eventsCount===0?f._events=new R:delete f._events[x]}function A(){this._events=new R,this._eventsCount=0}A.prototype.eventNames=function(){var x=[],M,w;if(this._eventsCount===0)return x;for(w in M=this._events)Y.call(M,w)&&x.push(F?w.slice(1):w);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(M)):x},A.prototype.listeners=function(x){var M=F?F+x:x,w=this._events[M];if(!w)return[];if(w.fn)return[w.fn];for(var C=0,E=w.length,d=new Array(E);C<E;C++)d[C]=w[C].fn;return d},A.prototype.listenerCount=function(x){var M=F?F+x:x,w=this._events[M];return w?w.fn?1:w.length:0},A.prototype.emit=function(x,M,w,C,E,d){var a=F?F+x:x;if(!this._events[a])return!1;var s=this._events[a],h=arguments.length,L,p;if(s.fn){s.once&&this.removeListener(x,s.fn,void 0,!0);switch(h){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,M),!0;case 3:return s.fn.call(s.context,M,w),!0;case 4:return s.fn.call(s.context,M,w,C),!0;case 5:return s.fn.call(s.context,M,w,C,E),!0;case 6:return s.fn.call(s.context,M,w,C,E,d),!0}for(p=1,L=new Array(h-1);p<h;p++)L[p-1]=arguments[p];s.fn.apply(s.context,L)}else{var v=s.length,k;for(p=0;p<v;p++){s[p].once&&this.removeListener(x,s[p].fn,void 0,!0);switch(h){case 1:s[p].fn.call(s[p].context);break;case 2:s[p].fn.call(s[p].context,M);break;case 3:s[p].fn.call(s[p].context,M,w);break;case 4:s[p].fn.call(s[p].context,M,w,C);break;default:if(!L)for(k=1,L=new Array(h-1);k<h;k++)L[k-1]=arguments[k];s[p].fn.apply(s[p].context,L)}}}return!0},A.prototype.on=function(x,M,w){return B(this,x,M,w,!1)},A.prototype.once=function(x,M,w){return B(this,x,M,w,!0)},A.prototype.removeListener=function(x,M,w,C){var E=F?F+x:x;if(!this._events[E])return this;if(!M)return P(this,E),this;var d=this._events[E];if(d.fn)d.fn===M&&(!C||d.once)&&(!w||d.context===w)&&P(this,E);else{for(var a=0,s=[],h=d.length;a<h;a++)(d[a].fn!==M||C&&!d[a].once||w&&d[a].context!==w)&&s.push(d[a]);s.length?this._events[E]=s.length===1?s[0]:s:P(this,E)}return this},A.prototype.removeAllListeners=function(x){var M;return x?(M=F?F+x:x,this._events[M]&&P(this,M)):(this._events=new R,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=F,A.EventEmitter=A,ne.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,$,D){(function(Y){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(A,f,x){if(x=x||{},A=A.trim(),f=f.trim(),!f){if(!x.alwaysNormalize)return A;var M=P.parseURL(A);if(!M)throw new Error("Error trying to parse base URL.");return M.path=P.normalizePath(M.path),P.buildURLFromParts(M)}var w=P.parseURL(f);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return x.alwaysNormalize?(w.path=P.normalizePath(w.path),P.buildURLFromParts(w)):f;var C=P.parseURL(A);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var E=R.exec(C.path);C.netLoc=E[1],C.path=E[2]}C.netLoc&&!C.path&&(C.path="/");var d={scheme:C.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(d.netLoc=C.netLoc,w.path[0]!=="/"))if(!w.path)d.path=C.path,w.params||(d.params=C.params,w.query||(d.query=C.query));else{var a=C.path,s=a.substring(0,a.lastIndexOf("/")+1)+w.path;d.path=P.normalizePath(s)}return d.path===null&&(d.path=x.alwaysNormalize?P.normalizePath(w.path):w.path),P.buildURLFromParts(d)},parseURL:function(A){var f=F.exec(A);return f?{scheme:f[1]||"",netLoc:f[2]||"",path:f[3]||"",params:f[4]||"",query:f[5]||"",fragment:f[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(W,"");A.length!==(A=A.replace(B,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};ne.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,$,D){function Y(x){var M={};function w(E){if(M[E])return M[E].exports;var d=M[E]={i:E,l:!1,exports:{}};return x[E].call(d.exports,d,d.exports,w),d.l=!0,d.exports}w.m=x,w.c=M,w.i=function(E){return E},w.d=function(E,d,a){w.o(E,d)||Object.defineProperty(E,d,{configurable:!1,enumerable:!0,get:a})},w.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},w.n=function(E){var d=E&&E.__esModule?function(){return E.default}:function(){return E};return w.d(d,"a",d),d},w.o=function(E,d){return Object.prototype.hasOwnProperty.call(E,d)},w.p="/",w.oe=function(E){throw console.error(E),E};var C=w(w.s=ENTRY_MODULE);return C.default||C}var F="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function W(x){return(x+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(x){return!isNaN(1*x)}function P(x,M,w){var C={};C[w]=[];var E=M.toString(),d=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return C;for(var a=d[1],s=new RegExp("(\\\\n|\\W)"+W(a)+R,"g"),h;h=s.exec(E);){if(h[3]==="dll-reference")continue;C[w].push(h[3])}for(s=new RegExp("\\("+W(a)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+R,"g");h=s.exec(E);)x[h[2]]||(C[w].push(h[1]),x[h[2]]=D(h[1]).m),C[h[2]]=C[h[2]]||[],C[h[2]].push(h[4]);for(var L=Object.keys(C),p=0;p<L.length;p++)for(var v=0;v<C[L[p]].length;v++)B(C[L[p]][v])&&(C[L[p]][v]=1*C[L[p]][v]);return C}function A(x){var M=Object.keys(x);return M.reduce(function(w,C){return w||x[C].length>0},!1)}function f(x,M){for(var w={main:[M]},C={main:[]},E={main:{}};A(w);)for(var d=Object.keys(w),a=0;a<d.length;a++){var s=d[a],h=w[s],L=h.pop();if(E[s]=E[s]||{},E[s][L]||!x[s][L])continue;E[s][L]=!0,C[s]=C[s]||[],C[s].push(L);for(var p=P(x,x[s][L],s),v=Object.keys(p),k=0;k<v.length;k++)w[v[k]]=w[v[k]]||[],w[v[k]]=w[v[k]].concat(p[v[k]])}return C}ne.exports=function(x,M){M=M||{};var w={main:D.m},C=M.all?{main:Object.keys(w.main)}:f(w,x),E="";Object.keys(C).filter(function(L){return L!=="main"}).forEach(function(L){for(var p=0;C[L][p];)p++;C[L].push(p),w[L][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+L+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+C[L].map(function(v){return""+JSON.stringify(v)+": "+w[L][v].toString()}).join(",")+`});
`}),E=E+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+C.main.map(function(L){return""+JSON.stringify(L)+": "+w.main[L].toString()}).join(",")+"}))(self);";var d=new window.Blob([E],{type:"text/javascript"});if(M.bare)return d;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(d),h=new window.Worker(s);return h.objectURL=s,h}},"./src/config.ts":function(ne,$,D){"use strict";D.r($),D.d($,"hlsDefaultConfig",function(){return k}),D.d($,"mergeConfig",function(){return g}),D.d($,"enableStreamingMode",function(){return c});var Y=D("./src/controller/abr-controller.ts"),F=D("./src/controller/audio-stream-controller.ts"),R=D("./src/controller/audio-track-controller.ts"),W=D("./src/controller/subtitle-stream-controller.ts"),B=D("./src/controller/subtitle-track-controller.ts"),P=D("./src/controller/buffer-controller.ts"),A=D("./src/controller/timeline-controller.ts"),f=D("./src/controller/cap-level-controller.ts"),x=D("./src/controller/fps-controller.ts"),M=D("./src/controller/eme-controller.ts"),w=D("./src/controller/cmcd-controller.ts"),C=D("./src/utils/xhr-loader.ts"),E=D("./src/utils/fetch-loader.ts"),d=D("./src/utils/cues.ts"),a=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(u){for(var o=1;o<arguments.length;o++){var T=arguments[o];for(var S in T)Object.prototype.hasOwnProperty.call(T,S)&&(u[S]=T[S])}return u},h.apply(this,arguments)}function L(u,o){var T=Object.keys(u);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(u);o&&(S=S.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),T.push.apply(T,S)}return T}function p(u){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?L(Object(T),!0).forEach(function(S){v(u,S,T[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(T)):L(Object(T)).forEach(function(S){Object.defineProperty(u,S,Object.getOwnPropertyDescriptor(T,S))})}return u}function v(u,o,T){return o in u?Object.defineProperty(u,o,{value:T,enumerable:!0,configurable:!0,writable:!0}):u[o]=T,u}var k=p(p({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:C.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:P.default,capLevelController:f.default,fpsController:x.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:B.default,timelineController:A.TimelineController,audioStreamController:F.default,audioTrackController:R.default,emeController:M.default,cmcdController:w.default});function b(){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 g(u,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},u,o)}function c(u){var o=u.loader;if(o!==E.default&&o!==C.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var T=Object(E.fetchSupported)();T&&(u.loader=E.default,u.progressive=!0,u.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/ewma-bandwidth-estimator.ts"),R=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),P=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts");function f(w,C){for(var E=0;E<C.length;E++){var d=C[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function x(w,C,E){return C&&f(w.prototype,C),E&&f(w,E),w}var M=function(){function w(E){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=E;var d=E.config;this.bwEstimator=new F.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var C=w.prototype;return C.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(d,a){var s=a.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=s,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},C.onLevelLoaded=function(d,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},C._abandonRulesCheck=function(){var d=this.fragCurrent,a=this.partCurrent,s=this.hls,h=s.autoLevelEnabled,L=s.config,p=s.media;if(!d||!p)return;var v=a?a.stats:d.stats,k=a?a.duration:d.duration;if(v.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-v.loading.start,g=Math.abs(p.playbackRate);if(b<=500*k/g)return;var c=s.levels,u=s.minAutoLevel,o=c[d.level],T=v.total||Math.max(v.loaded,Math.round(k*o.maxBitrate/8)),S=Math.max(1,v.bwEstimate?v.bwEstimate/8:v.loaded*1e3/b),m=(T-v.loaded)/S,O=p.currentTime,U=(W.BufferHelper.bufferInfo(p,O,L.maxBufferHole).end-O)/g;if(U>=2*k/g||m<=U)return;var j=Number.POSITIVE_INFINITY,K;for(K=d.level-1;K>u;K--){var I=c[K].maxBitrate;if(j=k*I/(8*.8*S),j<U)break}if(j>=m)return;var N=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+d.sn+(a?" part "+a.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+K+`
Current BW estimate: `+(Object(Y.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+m.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),s.nextLoadLevel=K,this.bwEstimator.sample(b,v.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:a,stats:v})},C.onFragLoaded=function(d,a){var s=a.frag,h=a.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(s.sn)){var L=h?h.stats:s.stats,p=h?h.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[s.level],k=(v.loaded?v.loaded.bytes:0)+L.loaded,b=(v.loaded?v.loaded.duration:0)+p;v.loaded={bytes:k,duration:b},v.realBitrate=Math.round(8*k/b)}if(s.bitrateTest){var g={stats:L,frag:s,part:h,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,g),s.bitrateTest=!1}}},C.onFragBuffered=function(d,a){var s=a.frag,h=a.part,L=h?h.stats:s.stats;if(L.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var p=L.parsing.end-L.loading.start;this.bwEstimator.sample(p,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},C.onError=function(d,a){switch(a.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var d=this.fragCurrent,a=this.partCurrent,s=this.hls,h=s.maxAutoLevel,L=s.config,p=s.minAutoLevel,v=s.media,k=a?a.duration:d?d.duration:0,b=v?v.currentTime:0,g=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,u=(W.BufferHelper.bufferInfo(v,b,L.maxBufferHole).end-b)/g,o=this.findBestLevel(c,p,h,u,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(o>=0)return o;A.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=k?Math.min(k,L.maxStarvationDelay):L.maxStarvationDelay,S=L.abrBandWidthFactor,m=L.abrBandWidthUpFactor;if(!u){var O=this.bitrateTestDelay;if(O){var U=k?Math.min(k,L.maxLoadingDelay):L.maxLoadingDelay;T=U-O,A.logger.trace("bitrate test took "+Math.round(1e3*O)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),S=m=1}}return o=this.findBestLevel(c,p,h,u+T,S,m),Math.max(o,0)},C.findBestLevel=function(d,a,s,h,L,p){for(var v,k=this.fragCurrent,b=this.partCurrent,g=this.lastLoadedFragLevel,c=this.hls.levels,u=c[g],o=!!(u!=null&&(v=u.details)!==null&&v!==void 0&&v.live),T=u==null?void 0:u.codecSet,S=b?b.duration:k?k.duration:0,m=s;m>=a;m--){var O=c[m];if(!O||T&&O.codecSet!==T)continue;var U=O.details,j=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||S,K=void 0;m<=g?K=L*d:K=p*d;var I=c[m].maxBitrate,N=I*j/K;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(K)+"/"+I+"/"+j+"/"+h+"/"+N),K>I&&(!N||o&&!this.bitrateTestDelay||N<h))return m}return-1},x(w,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,a=this.bwEstimator;if(d!==-1&&(!a||!a.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),w}();$.default=M},"./src/controller/audio-stream-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),F=D("./src/controller/base-stream-controller.ts"),R=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),B=D("./src/controller/fragment-tracker.ts"),P=D("./src/types/level.ts"),A=D("./src/types/loader.ts"),f=D("./src/loader/fragment.ts"),x=D("./src/demux/chunk-cache.ts"),M=D("./src/demux/transmuxer-interface.ts"),w=D("./src/types/transmuxer.ts"),C=D("./src/controller/fragment-finders.ts"),E=D("./src/utils/discontinuities.ts"),d=D("./src/errors.ts"),a=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(k){for(var b=1;b<arguments.length;b++){var g=arguments[b];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(k[c]=g[c])}return k},s.apply(this,arguments)}function h(k,b){k.prototype=Object.create(b.prototype),k.prototype.constructor=k,L(k,b)}function L(k,b){return L=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},L(k,b)}var p=100,v=function(k){h(b,k);function b(c,u){var o;return o=k.call(this,c,u,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var g=b.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var u=this.hls;u.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(R.Events.ERROR,this.onError,this),u.on(R.Events.BUFFER_RESET,this.onBufferReset,this),u.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var u=this.hls;u.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(R.Events.ERROR,this.onError,this),u.off(R.Events.BUFFER_RESET,this.onBufferReset,this),u.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(u,o){var T=o.frag,S=o.id,m=o.initPTS;if(S==="main"){var O=T.cc;this.initPTS[T.cc]=m,this.log("InitPTS for cc: "+O+" found from main: "+m),this.videoTrackCC=O,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=F.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,o>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},g.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var u,o=this.levels,T=this.trackId,S=o==null||((u=o[T])===null||u===void 0)?void 0:u.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var m,O=performance.now(),U=this.retryDate;(!U||O>=U||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var K=j.frag,I=j.part,N=j.cache,X=j.complete;if(this.initPTS[K.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var q=N.flush(),se={frag:K,part:I,payload:q,networkDetails:null};this._handleFragmentLoadProgress(se),X&&k.prototype._handleFragmentLoadComplete.call(this,se)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+K.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var he=this.getLoadPosition(),Ae=W.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),be=Object(C.fragmentWithinToleranceTest)(Ae.end,this.config.maxFragLookUpTolerance,K);be<0&&(a.logger.log("Waiting fragment cc ("+K.cc+") @ "+K.start+" cancelled because another fragment at "+Ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},g.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:u,T=o.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},g.doTickIdle=function(){var u,o,T=this.hls,S=this.levels,m=this.media,O=this.trackId,U=T.config;if(!S||!S[O])return;if(!m&&(this.startFragRequested||!U.startFragPrefetch))return;var j=S[O],K=j.details;if(!K||K.live&&this.levelLastLoaded!==O||this.waitForCdnTuneIn(K)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,f.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(),q=this.audioSwitch;if(N>=X&&!q)return;if(!q&&this._streamEnded(I,K)){T.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var se=K.fragments,he=se[0].start,Ae=I.end;if(q){var be=this.getLoadPosition();Ae=be,K.PTSKnown&&be<he&&((I.end>he||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),m.currentTime=he+.05))}var Te=this.getNextFragment(Ae,K);if(!Te){this.bufferFlushed=!0;return}((u=Te.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((o=Te.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Te,K):this.loadFragment(Te,K,Ae)},g.getMaxBufferLength=function(){var u=k.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return o===null?u:Math.max(u,o.len)},g.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(u,o){var T=o.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(S){return new P.Level(S)})},g.onAudioTrackSwitching=function(u,o){var T=!!o.url;this.trackId=o.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(p):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(u,o){this.mainDetails=o.details},g.onAudioTrackLoaded=function(u,o){var T,S=this.levels,m=o.details,O=o.id;if(!S){this.warn("Audio tracks were reset while loading level "+O);return}this.log("Track "+O+" loaded ["+m.startSN+","+m.endSN+"],duration:"+m.totalduration);var U=S[O],j=0;if(m.live||(T=U.details)!==null&&T!==void 0&&T.live){var K=this.mainDetails;if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed||!K)return;!U.details&&m.hasProgramDateTime&&K.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(m,K),j=m.fragments[0].start):j=this.alignPlaylists(m,U.details)}U.details=m,this.levelLastLoaded=O,!this.startFragRequested&&(this.mainDetails||!m.live)&&this.setStartPosition(U.details,j),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(m)&&(this.state=F.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(u){var o,T=u.frag,S=u.part,m=u.payload,O=this.config,U=this.trackId,j=this.levels;if(!j){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 K=j[U];console.assert(K,"Audio track is defined on fragment load progress");var I=K.details;console.assert(I,"Audio track details are defined on fragment load progress");var N=O.defaultAudioCodec||K.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new M.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[T.cc],se=(o=T.initSegment)===null||o===void 0?void 0:o.data;if(q!==void 0){var he=!1,Ae=S?S.index:-1,be=Ae!==-1,Te=new w.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,m.byteLength,Ae,be);X.push(m,se,N,"",T,S,I.totalduration,he,Te,q)}else{a.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+U);var Ce=this.waitingData=this.waitingData||{frag:T,part:S,cache:new x.default,complete:!1},Se=Ce.cache;Se.push(new Uint8Array(m)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,u)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(u,o){var T=o.tracks.audio;T&&(this.mediaBuffer=T.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},g.onFragBuffered=function(u,o){var T=o.frag,S=o.part;if(T.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(S?" p: "+S.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(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,S)},g.onError=function(u,o){switch(o.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(A.PlaylistLevelType.AUDIO,o);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=o.fatal?F.State.ERROR:F.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var T=!0,S=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);S&&S.len>.5&&(T=!this.reduceMaxBufferLength(S.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(u,o){var T=o.type;T===f.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(u){var o,T="audio",S=this.hls,m=u.remuxResult,O=u.chunkMeta,U=this.getCurrentContext(O);if(!U){this.warn("The loading context changed while buffering fragment "+O.sn+" of level "+O.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(O.level);return}var j=U.frag,K=U.part,I=m.audio,N=m.text,X=m.id3,q=m.initSegment;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,j,O),S.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:T,tracks:q.tracks})),I){var se=I.startPTS,he=I.endPTS,Ae=I.startDTS,be=I.endDTS;K&&(K.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:he,startDTS:Ae,endDTS:be}),j.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,se,he,Ae,be),this.bufferFragmentData(I,j,K,O)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var Te=s({frag:j,id:T},X);S.trigger(R.Events.FRAG_PARSING_METADATA,Te)}if(N){var Ce=s({frag:j,id:T},N);S.trigger(R.Events.FRAG_PARSING_USERDATA,Ce)}},g._bufferInitSegment=function(u,o,T){if(this.state!==F.State.PARSING)return;u.video&&delete u.video;var S=u.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,u);var m=S.initSegment;if(m!=null&&m.byteLength){var O={type:"audio",frag:o,part:null,chunkMeta:T,parent:o.type,data:m};this.hls.trigger(R.Events.BUFFER_APPENDING,O)}this.tick()},g.loadFragment=function(u,o,T){var S=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||S===B.FragmentState.NOT_LOADED||S===B.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):o.live&&!Object(Y.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,u,o,T)))},g.completeAudioSwitch=function(){var u=this.hls,o=this.media,T=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:T})},b}(F.default);$.default=v},"./src/controller/audio-track-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),F=D("./src/errors.ts"),R=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function B(M,w){for(var C=0;C<w.length;C++){var E=w[C];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(M,E.key,E)}}function P(M,w,C){return w&&B(M.prototype,w),C&&B(M,C),M}function A(M,w){M.prototype=Object.create(w.prototype),M.prototype.constructor=M,f(M,w)}function f(M,w){return f=Object.setPrototypeOf||function(E,d){return E.__proto__=d,E},f(M,w)}var x=function(M){A(w,M);function w(E){var d;return d=M.call(this,E,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var C=w.prototype;return C.registerListeners=function(){var d=this.hls;d.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(Y.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var d=this.hls;d.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(Y.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(d,a){this.tracks=a.audioTracks||[]},C.onAudioTrackLoaded=function(d,a){var s=a.id,h=a.details,L=this.tracksInGroup[s];if(!L){this.warn("Invalid audio track id "+s);return}var p=L.details;L.details=a.details,this.log("audioTrack "+s+" loaded ["+h.startSN+"-"+h.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,p))},C.onLevelLoading=function(d,a){this.switchLevel(a.level)},C.onLevelSwitching=function(d,a){this.switchLevel(a.level)},C.switchLevel=function(d){var a=this.hls.levels[d];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var h=this.tracks.filter(function(p){return!s||p.groupId===s});this.selectDefaultTrack&&!h.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var L={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},C.onError=function(d,a){if(M.prototype.onError.call(this,d,a),a.fatal||!a.context)return;a.context.type===W.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},C.setAudioTrack=function(d){var a=this.tracksInGroup;if(d<0||d>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+d);var h=a[d],L=h.id,p=h.groupId,v=p===void 0?"":p,k=h.name,b=h.type,g=h.url;if(this.trackId=d,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:v,name:k,type:b,url:g}),h.details&&!h.details.live)return;var c=this.switchParams(h.url,s==null?void 0:s.details);this.loadPlaylist(c)},C.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.findTrackId=function(d){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var h=a[s];if((!this.selectDefaultTrack||h.default)&&(!d||d===h.name))return h.id}return-1},C.loadPlaylist=function(d){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,h=a.groupId,L=a.url;if(d)try{L=d.addDirectives(L)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:L,id:s,groupId:h,deliveryDirectives:d||null})}},P(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}(R.default);$.default=x},"./src/controller/base-playlist-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return P});var Y=D("./src/polyfills/number.ts"),F=D("./src/types/level.ts"),R=D("./src/controller/level-helper.ts"),W=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),P=function(){function A(x,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,M+":"),this.warn=W.logger.warn.bind(W.logger,M+":"),this.hls=x}var f=A.prototype;return f.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},f.onError=function(M,w){w.fatal&&w.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},f.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},f.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},f.stopLoad=function(){this.canLoad=!1,this.clearTimer()},f.switchParams=function(M,w){var C=w==null?void 0:w.renditionReports;if(C)for(var E=0;E<C.length;E++){var d=C[E],a=""+d.URI;if(a===M.substr(-a.length)){var s=parseInt(d["LAST-MSN"]),h=parseInt(d["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var L=Math.min(w.age-w.partTarget,w.targetduration);h!==void 0&&L>w.partTarget&&(h+=1)}if(Object(Y.isFiniteNumber)(s))return new F.HlsUrlParameters(s,Object(Y.isFiniteNumber)(h)?h:void 0,F.HlsSkip.No)}}},f.loadPlaylist=function(M){},f.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},f.playlistLoaded=function(M,w,C){var E=this,d=w.details,a=w.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||C!=null&&C.live){if(d.reloaded(C),C&&this.log("live playlist "+M+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),C&&d.fragments.length>0&&Object(R.mergeDetails)(C,d),!this.canLoad||!d.live)return;var h,L=void 0,p=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var v=this.hls.config.lowLatencyMode,k=d.lastPartSn,b=d.endSN,g=d.lastPartIndex,c=g!==-1,u=k===b,o=v?0:g;c?(L=u?b+1:k,p=u?o:g+1):L=b+1;var T=d.age,S=T+d.ageHeader,m=Math.min(S-d.partTarget,d.targetduration*1.5);if(m>0){if(C&&m>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+m+" with playlist age: "+d.age),m=0;else{var O=Math.floor(m/d.targetduration);if(L+=O,p!==void 0){var U=Math.round(m%d.targetduration/d.partTarget);p+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+m+" skip sn "+O+" to part "+p)}d.tuneInGoal=m}if(h=this.getDeliveryDirectives(d,w.deliveryDirectives,L,p),v||!u){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(d,w.deliveryDirectives,L,p);var j=Object(R.computeReloadInterval)(d,a);L!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(h)},j)}else this.clearTimer()},f.getDeliveryDirectives=function(M,w,C,E){var d=Object(F.getSkipValue)(M,C);return w!=null&&w.skip&&M.deltaUpdateFailed&&(C=w.msn,E=w.part,d=F.HlsSkip.No),new F.HlsUrlParameters(C,E,d)},f.retryLoadingOrFail=function(M){var w=this,C=this.hls.config,E=this.retryCount<C.levelLoadingMaxRetry;if(E){var d;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(d=M.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return E},A}()},"./src/controller/base-stream-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"State",function(){return b}),D.d($,"default",function(){return g});var Y=D("./src/polyfills/number.ts"),F=D("./src/task-loop.ts"),R=D("./src/controller/fragment-tracker.ts"),W=D("./src/utils/buffer-helper.ts"),B=D("./src/utils/logger.ts"),P=D("./src/events.ts"),A=D("./src/errors.ts"),f=D("./src/types/transmuxer.ts"),x=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/discontinuities.ts"),w=D("./src/controller/fragment-finders.ts"),C=D("./src/controller/level-helper.ts"),E=D("./src/loader/fragment-loader.ts"),d=D("./src/crypt/decrypter.ts"),a=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function h(c,u){for(var o=0;o<u.length;o++){var T=u[o];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(c,T.key,T)}}function L(c,u,o){return u&&h(c.prototype,u),o&&h(c,o),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function v(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,k(c,u)}function k(c,u){return k=Object.setPrototypeOf||function(T,S){return T.__proto__=S,T},k(c,u)}var b={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"},g=function(c){v(u,c);function u(T,S,m){var O;return O=c.call(this)||this,O.hls=void 0,O.fragPrevious=null,O.fragCurrent=null,O.fragmentTracker=void 0,O.transmuxer=null,O._state=b.STOPPED,O.media=void 0,O.mediaBuffer=void 0,O.config=void 0,O.bitrateTest=!1,O.lastCurrentTime=0,O.nextLoadPosition=0,O.startPosition=0,O.loadedmetadata=!1,O.fragLoadError=0,O.retryDate=0,O.levels=null,O.fragmentLoader=void 0,O.levelLastLoaded=null,O.startFragRequested=!1,O.decrypter=void 0,O.initPTS=[],O.onvseeking=null,O.onvended=null,O.logPrefix="",O.log=void 0,O.warn=void 0,O.logPrefix=m,O.log=B.logger.log.bind(B.logger,m+":"),O.warn=B.logger.warn.bind(B.logger,m+":"),O.hls=T,O.fragmentLoader=new E.default(T.config),O.fragmentTracker=S,O.config=T.config,O.decrypter=new d.default(T,T.config),T.on(P.Events.KEY_LOADED,O.onKeyLoaded,p(O)),O}var o=u.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(S){},o.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},o._streamEnded=function(S,m){var O=this.fragCurrent,U=this.fragmentTracker;if(!m.live&&O&&O.sn===m.endSN&&!S.nextStart){var j=U.getState(O);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},o.onMediaAttached=function(S,m){var O=this.media=this.mediaBuffer=m.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),O.addEventListener("seeking",this.onvseeking),O.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.startPosition)},o.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var S=this.config,m=this.fragCurrent,O=this.media,U=this.mediaBuffer,j=this.state,K=O?O.currentTime:0,I=W.BufferHelper.bufferInfo(U||O,K,S.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(K)?K.toFixed(3):K)+", state: "+j),j===b.ENDED)this.resetLoadingState();else if(m&&!I.len){var N=S.maxFragLookUpTolerance,X=m.start-N,q=m.start+m.duration+N,se=K>q;(K<X||se)&&(se&&m.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),m.loader.abort()),this.resetLoadingState())}O&&(this.lastCurrentTime=K),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=K),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(S,m){if(this.state!==b.KEY_LOADING||m.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var O=this.levels[m.frag.level].details;O&&this.loadFragment(m.frag,O,m.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(P.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)},o.loadKey=function(S,m){this.log("Loading key for "+S.sn+" of ["+m.startSN+"-"+m.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=b.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(P.Events.KEY_LOADING,{frag:S})},o.loadFragment=function(S,m,O){this._loadFragForPlayback(S,m,O)},o._loadFragForPlayback=function(S,m,O){var U=this,j=function(I){if(U.fragContextChanged(S)){U.warn("Fragment "+S.sn+(I.part?" p: "+I.part.index:"")+" of level "+S.level+" was dropped during download."),U.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,U._handleFragmentLoadProgress(I)};this._doFragLoad(S,m,O,j).then(function(K){if(!K)return;U.fragLoadError=0;var I=U.state;if(U.fragContextChanged(S)){(I===b.FRAG_LOADING||I===b.BACKTRACKING||!U.fragCurrent&&I===b.PARSING)&&(U.fragmentTracker.removeFragment(S),U.state=b.IDLE);return}if("payload"in K&&(U.log("Loaded fragment "+S.sn+" of level "+S.level),U.hls.trigger(P.Events.FRAG_LOADED,K),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(S,K),U.resetFragmentLoading(S);return}U._handleFragmentLoadComplete(K)}).catch(function(K){U.warn(K),U.resetFragmentLoading(S)})},o.flushMainBuffer=function(S,m,O){if(O===void 0&&(O=null),!(S-m))return;var U={startOffset:S,endOffset:m,type:O};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,U)},o._loadInitSegment=function(S){var m=this;this._doFragLoad(S).then(function(O){if(!O||m.fragContextChanged(S)||!m.levels)throw new Error("init load aborted");return O}).then(function(O){var U=m.hls,j=O.payload,K=S.decryptdata;if(j&&j.byteLength>0&&K&&K.key&&K.iv&&K.method==="AES-128"){var I=self.performance.now();return m.decrypter.webCryptoDecrypt(new Uint8Array(j),K.key.buffer,K.iv.buffer).then(function(N){var X=self.performance.now();return U.trigger(P.Events.FRAG_DECRYPTED,{frag:S,payload:N,stats:{tstart:I,tdecrypt:X}}),O.payload=N,O})}return O}).then(function(O){var U=m.fragCurrent,j=m.hls,K=m.levels;if(!K)throw new Error("init load aborted, missing levels");var I=K[S.level].details;console.assert(I,"Level details are defined when init segment is loaded");var N=S.stats;m.state=b.IDLE,m.fragLoadError=0,S.data=new Uint8Array(O.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),O.frag===U&&j.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:U,part:null,id:S.type}),m.tick()}).catch(function(O){m.warn(O),m.resetFragmentLoading(S)})},o.fragContextChanged=function(S){var m=this.fragCurrent;return!S||!m||S.level!==m.level||S.sn!==m.sn||S.urlId!==m.urlId},o.fragBufferedComplete=function(S,m){var O=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(m?" part: "+m.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+a.default.toString(W.BufferHelper.getBuffered(O))),this.state=b.IDLE,this.tick()},o._handleFragmentLoadComplete=function(S){var m=this.transmuxer;if(!m)return;var O=S.frag,U=S.part,j=S.partsLoaded,K=!j||j.length===0||j.some(function(N){return!N}),I=new f.ChunkMetadata(O.level,O.sn,O.stats.chunkCount+1,0,U?U.index:-1,!K);m.flush(I)},o._handleFragmentLoadProgress=function(S){},o._doFragLoad=function(S,m,O,U){var j=this;if(O===void 0&&(O=null),!this.levels)throw new Error("frag load aborted, missing levels");if(O=Math.max(S.start,O||0),this.config.lowLatencyMode&&m){var K=m.partList;if(K&&U){O>S.end&&m.fragmentHint&&(S=m.fragmentHint);var I=this.getNextPart(K,S,O);if(I>-1){var N=K[I];return this.log("Loading part sn: "+S.sn+" p: "+N.index+" cc: "+S.cc+" of playlist ["+m.startSN+"-"+m.endSN+"] parts [0-"+I+"-"+(K.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(O.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=b.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,part:K[I],targetBufferTime:O}),this.doFragPartsLoad(S,K,I,U).catch(function(X){return j.handleFragLoadError(X)})}else if(!S.url||this.loadedEndOfParts(K,O))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(m?"of ["+m.startSN+"-"+m.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(O.toFixed(3))),Object(Y.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=b.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:S,targetBufferTime:O}),this.fragmentLoader.load(S,U).catch(function(X){return j.handleFragLoadError(X)})},o.doFragPartsLoad=function(S,m,O,U){var j=this;return new Promise(function(K,I){var N=[],X=function q(se){var he=m[se];j.fragmentLoader.loadPart(S,he,U).then(function(Ae){N[he.index]=Ae;var be=Ae.part;j.hls.trigger(P.Events.FRAG_LOADED,Ae);var Te=m[se+1];if(Te&&Te.fragment===S)q(se+1);else return K({frag:S,part:be,partsLoaded:N})}).catch(I)};X(O)})},o.handleFragLoadError=function(S){var m=S.data;return m&&m.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(m.frag,m.part):this.hls.trigger(P.Events.ERROR,m),null},o._handleTransmuxerFlush=function(S){var m=this.getCurrentContext(S);if(!m||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var O=m.frag,U=m.part,j=m.level,K=self.performance.now();O.stats.parsing.end=K,U&&(U.stats.parsing.end=K),this.updateLevelTiming(O,U,j,S.partial)},o.getCurrentContext=function(S){var m=this.levels,O=S.level,U=S.sn,j=S.part;if(!m||!m[O])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+O+". The current chunk will not be buffered."),null;var K=m[O],I=j>-1?Object(C.getPartWith)(K,U,j):null,N=I?I.fragment:Object(C.getFragmentWithSN)(K,U,this.fragCurrent);return N?{frag:N,part:I,level:K}:null},o.bufferFragmentData=function(S,m,O,U){if(!S||this.state!==b.PARSING)return;var j=S.data1,K=S.data2,I=j;if(j&&K&&(I=Object(x.appendUint8Array)(j,K)),!I||!I.length)return;var N={type:S.type,frag:m,part:O,chunkMeta:U,parent:m.type,data:I};this.hls.trigger(P.Events.BUFFER_APPENDING,N),S.dropped&&S.independent&&!O&&this.flushBufferGap(m)},o.flushBufferGap=function(S){var m=this.media;if(!m)return;if(!W.BufferHelper.isBuffered(m,m.currentTime)){this.flushMainBuffer(0,S.start);return}var O=m.currentTime,U=W.BufferHelper.bufferInfo(m,O,0),j=S.duration,K=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),I=Math.max(Math.min(S.start-K,U.end-K),O+K);S.start-I>K&&this.flushMainBuffer(I,S.start)},o.getFwdBufferInfo=function(S,m){var O=this.config,U=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(U))return null;var j=W.BufferHelper.bufferInfo(S,U,O.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var K=this.fragmentTracker.getBufferedFrag(U,m);if(K&&j.nextStart<K.end)return W.BufferHelper.bufferInfo(S,U,Math.max(j.nextStart,O.maxBufferHole))}return j},o.getMaxBufferLength=function(S){var m=this.config,O;return S?O=Math.max(8*m.maxBufferSize/S,m.maxBufferLength):O=m.maxBufferLength,Math.min(O,m.maxMaxBufferLength)},o.reduceMaxBufferLength=function(S){var m=this.config,O=S||m.maxBufferLength;return m.maxMaxBufferLength>=O?(m.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+m.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(S,m){var O,U,j=m.fragments,K=j.length;if(!K)return null;var I=this.config,N=j[0].start,X;if(m.live){var q=I.initialLiveManifestSize;if(K<q)return this.warn("Not enough fragments to start playback (have: "+K+", need: "+q+")"),null;!m.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(m,j),this.startPosition=X?this.hls.liveSyncPosition||X.start:S)}else S<=N&&(X=j[0]);if(!X){var se=I.lowLatencyMode?m.partEnd:m.fragmentEnd;X=this.getFragmentAtPosition(S,se,m)}return(O=X)!==null&&O!==void 0&&O.initSegment&&!((U=X)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(S,m,O){for(var U=-1,j=!1,K=!0,I=0,N=S.length;I<N;I++){var X=S[I];if(K=K&&!X.independent,U>-1&&O<X.start)break;var q=X.loaded;!q&&(j||X.independent||K)&&X.fragment===m&&(U=I),j=q}return U},o.loadedEndOfParts=function(S,m){var O=S[S.length-1];return O&&m>O.start&&O.loaded},o.getInitialLiveFragment=function(S,m){var O=this.fragPrevious,U=null;if(O){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+O.programDateTime),U=Object(w.findFragmentByPDT)(m,O.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var j=O.sn+1;if(j>=S.startSN&&j<=S.endSN){var K=m[j-S.startSN];O.cc===K.cc&&(U=K,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(w.findFragWithCC)(m,O.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(U=this.getFragmentAtPosition(I,this.bitrateTest?S.fragmentEnd:S.edge,S))}return U},o.getFragmentAtPosition=function(S,m,O){var U=this.config,j=this.fragPrevious,K=O.fragments,I=O.endSN,N=O.fragmentHint,X=U.maxFragLookUpTolerance,q=!!(U.lowLatencyMode&&O.partList&&N);q&&N&&!this.bitrateTest&&(K=K.concat(N),I=N.sn);var se;if(S<m){var he=S>m-X?0:X;se=Object(w.findFragmentByPTS)(j,K,S,he)}else se=K[K.length-1];if(se){var Ae=se.sn-O.startSN,be=j&&se.level===j.level,Te=K[Ae+1],Ce=this.fragmentTracker.getState(se);if(Ce===R.FragmentState.BACKTRACKED){se=null;for(var Se=Ae;K[Se]&&this.fragmentTracker.getState(K[Se])===R.FragmentState.BACKTRACKED;)j?se=K[Se--]:se=K[--Se];se||(se=Te)}else j&&se.sn===j.sn&&!q&&(be&&(se.sn<I&&this.fragmentTracker.getState(Te)!==R.FragmentState.OK?(this.log("SN "+se.sn+" just loaded, load next one: "+Te.sn),se=Te):se=null))}return se},o.synchronizeToLiveEdge=function(S){var m=this.config,O=this.media;if(!O)return;var U=this.hls.liveSyncPosition,j=O.currentTime,K=S.fragments[0].start,I=S.edge,N=j>=K-m.maxFragLookUpTolerance&&j<=I;if(U!==null&&O.duration>U&&(j<U||!N)){var X=m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:m.liveMaxLatencyDurationCount*S.targetduration;(!N&&O.readyState<4||j<I-X)&&(this.loadedmetadata||(this.nextLoadPosition=U),O.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+U.toFixed(3)),O.currentTime=U))}},o.alignPlaylists=function(S,m){var O=this.levels,U=this.levelLastLoaded,j=this.fragPrevious,K=U!==null?O[U]:null,I=S.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var N=S.fragments[0].start,X=!m,q=S.alignedSliding&&Object(Y.isFiniteNumber)(N);if(X||!q&&!N){Object(M.alignStream)(j,K,S);var se=S.fragments[0].start;return this.log("Live playlist sliding: "+se.toFixed(2)+" start-sn: "+(m?m.startSN:"na")+"->"+S.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+I),se}return N},o.waitForCdnTuneIn=function(S){var m=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*m)},o.setStartPosition=function(S,m){var O=this.startPosition;if(O<m&&(O=-1),O===-1||this.lastCurrentTime===-1){var U=S.startTimeOffset;Object(Y.isFiniteNumber)(U)?(O=m+U,U<0&&(O+=S.totalduration),O=Math.min(Math.max(m,O),m+S.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+O),this.startPosition=O):S.live?O=this.hls.liveSyncPosition||m:this.startPosition=O=0,this.lastCurrentTime=O}this.nextLoadPosition=O},o.getLoadPosition=function(){var S=this.media,m=0;return this.loadedmetadata&&S?m=S.currentTime:this.nextLoadPosition&&(m=this.nextLoadPosition),m},o.handleFragLoadAborted=function(S,m){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(m?" part"+m.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},o.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=b.IDLE)},o.onFragmentOrKeyLoadError=function(S,m){if(m.fatal)return;var O=m.frag;if(!O||O.type!==S)return;var U=this.fragCurrent;console.assert(U&&O.sn===U.sn&&O.level===U.level&&O.urlId===U.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(O.level))return;var K=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+O.sn+" of "+S+" "+O.level+" failed to load, retrying in "+K+"ms"),this.retryDate=self.performance.now()+K,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else m.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(B.logger.error(m.details+" reaches max retry, redispatch as fatal ..."),m.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},o.afterBufferFlushed=function(S,m,O){if(!S)return;var U=W.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(m,U,O),this.state===b.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},o.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var m=this.levels?this.levels[S].details:null;if(m!=null&&m.live)return this.startPosition=-1,this.setStartPosition(m,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(S,m,O,U){var j=this,K=O.details;console.assert(!!K,"level.details must be defined");var I=Object.keys(S.elementaryStreams).reduce(function(N,X){var q=S.elementaryStreams[X];if(q){var se=q.endPTS-q.startPTS;if(se<=0)return j.warn("Could not parse fragment "+S.sn+" "+X+" duration reliably ("+se+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),N||!1;var he=U?0:Object(C.updateFragPTSDTS)(K,S,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return j.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:K,level:O,drift:he,type:X,frag:S,start:q.startPTS,end:q.endPTS}),!0}return N},!1);I?(this.state=b.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:S,part:m})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(u,[{key:"state",get:function(){return this._state},set:function(S){var m=this._state;m!==S&&(this._state=S,this.log(m+"->"+S))}}]),u}(F.default)},"./src/controller/buffer-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),R=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),B=D("./src/utils/buffer-helper.ts"),P=D("./src/utils/mediasource-helper.ts"),A=D("./src/loader/fragment.ts"),f=D("./src/controller/buffer-operation-queue.ts"),x=Object(P.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function C(d){var a=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 s=a.hls,h=a.media,L=a.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),s.trigger(F.Events.MEDIA_ATTACHED,{media:h})),L&&L.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var E=C.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(F.Events.BUFFER_RESET,this.onBufferReset,this),a.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(F.Events.BUFFER_EOS,this.onBufferEos,this),a.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(F.Events.FRAG_PARSED,this.onFragParsed,this),a.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(F.Events.BUFFER_RESET,this.onBufferReset,this),a.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(F.Events.BUFFER_EOS,this.onBufferEos,this),a.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(F.Events.FRAG_PARSED,this.onFragParsed,this),a.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new f.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(a,s){var h=2;(s.audio&&!s.video||!s.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(a,s){var h=this.media=s.media;if(h&&x){var L=this.mediaSource=new x;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(L),this._objectUrl=h.src}},E.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,h=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(L){R.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):R.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)},E.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var h=a.sourceBuffer[s];try{h&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[s]=void 0)}catch(L){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",L)}}),this._initSourceBuffer()},E.onBufferCodecs=function(a,s){var h=this,L=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(p){if(L){var v=h.tracks[p];if(v&&typeof v.buffer.changeType=="function"){var k=s[p],b=k.codec,g=k.levelCodec,c=k.container,u=(v.levelCodec||v.codec).replace(M,"$1"),o=(g||b).replace(M,"$1");if(u!==o){var T=c+";codecs="+(g||b);h.appendChangeType(p,T)}}}else h.pendingTracks[p]=s[p]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(a,s){var h=this,L=this.operationQueue,p={execute:function(){var k=h.sourceBuffer[a];k&&(R.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),k.changeType(s)),L.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(k){R.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",k)}};L.append(p,a)},E.onBufferAppending=function(a,s){var h=this,L=this.hls,p=this.operationQueue,v=this.tracks,k=s.data,b=s.type,g=s.frag,c=s.part,u=s.chunkMeta,o=u.buffering[b],T=self.performance.now();o.start=T;var S=g.stats.buffering,m=c?c.stats.buffering:null;S.start===0&&(S.start=T),m&&m.start===0&&(m.start=T);var O=v.audio,U=b==="audio"&&u.id===1&&(O==null?void 0:O.container)==="audio/mpeg",j={execute:function(){if(o.executeStart=self.performance.now(),U){var I=h.sourceBuffer[b];if(I){var N=g.start-I.timestampOffset;Math.abs(N)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+N+") sn: "+g.sn+")"),I.timestampOffset=g.start)}}h.appendExecutor(k,b)},onStart:function(){},onComplete:function(){var I=self.performance.now();o.executeEnd=o.end=I,S.first===0&&(S.first=I),m&&m.first===0&&(m.first=I);var N=h.sourceBuffer,X={};for(var q in N)X[q]=B.BufferHelper.getBuffered(N[q]);h.appendError=0,h.hls.trigger(F.Events.BUFFER_APPENDED,{type:b,frag:g,part:c,chunkMeta:u,parent:g.type,timeRanges:X})},onError:function(I){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",I);var N={type:W.ErrorTypes.MEDIA_ERROR,parent:g.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=W.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,N.details=W.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>L.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),L.trigger(F.Events.ERROR,N)}};p.append(j,b)},E.onBufferFlushing=function(a,s){var h=this,L=this.operationQueue,p=function(k){return{execute:h.removeExecutor.bind(h,k,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(F.Events.BUFFER_FLUSHED,{type:k})},onError:function(g){R.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",g)}}};s.type?L.append(p(s.type),s.type):this.getSourceBufferTypes().forEach(function(v){L.append(p(v),v)})},E.onFragParsed=function(a,s){var h=this,L=s.frag,p=s.part,v=[],k=p?p.elementaryStreams:L.elementaryStreams;k[A.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(k[A.ElementaryStreamTypes.AUDIO]&&v.push("audio"),k[A.ElementaryStreamTypes.VIDEO]&&v.push("video"));var b=function(){var c=self.performance.now();L.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var u=p?p.stats:L.stats;h.hls.trigger(F.Events.FRAG_BUFFERED,{frag:L,part:p,stats:u,id:L.type})};v.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(b,v)},E.onFragChanged=function(a,s){this.flushBackBuffer()},E.onBufferEos=function(a,s){var h=this,L=this.getSourceBufferTypes().reduce(function(p,v){var k=h.sourceBuffer[v];return(!s.type||s.type===v)&&(k&&!k.ended&&(k.ended=!0,R.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),p&&!!(!k||k.ended)},!0);L&&this.blockBuffers(function(){var p=h.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},E.onLevelUpdated=function(a,s){var h=s.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var a=this.hls,s=this.details,h=this.media,L=this.sourceBuffer;if(!h||s===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var v=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Y.isFiniteNumber)(v)||v<0)return;var k=h.currentTime,b=s.levelTargetDuration,g=Math.max(v,b),c=Math.floor(k/b)*b-g;p.forEach(function(u){var o=L[u];if(o){var T=B.BufferHelper.getBuffered(o);T.length>0&&c>T.start(0)&&(a.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&a.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),a.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,h=this.media,L=this.mediaSource,p=a.fragments[0].start+a.totalduration,v=h.duration,k=Object(Y.isFiniteNumber)(L.duration)?L.duration:0;a.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(a)):(p>k&&p>v||!Object(Y.isFiniteNumber)(v))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),L.duration=p)},E.updateSeekableRange=function(a){var s=this.mediaSource,h=a.fragments,L=h.length;if(L&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var p=Math.max(0,h[0].start),v=Math.max(p,p+a.totalduration);s.setLiveSeekableRange(p,v)}},E.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,h=this.pendingTracks,L=Object.keys(h).length;if(L&&!a||L===2){this.createSourceBuffers(h),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(v){s.executeNext(v)})}},E.createSourceBuffers=function(a){var s=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var p in a)if(!s[p]){var v=a[p];if(!v)throw Error("source buffer exists for track "+p+", however track does not");var k=v.levelCodec||v.codec,b=v.container+";codecs="+k;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var g=s[p]=h.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:g,codec:k,container:v.container,levelCodec:v.levelCodec,id:v.id},L++}catch(u){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:b})}}L&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(a){var s=this.operationQueue,h=s.current(a);h.onStart()},E._onSBUpdateEnd=function(a){var s=this.operationQueue,h=s.current(a);h.onComplete(),s.shiftAndExecuteNext(a)},E._onSBUpdateError=function(a,s){R.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(s)},E.removeExecutor=function(a,s,h){var L=this.media,p=this.mediaSource,v=this.operationQueue,k=this.sourceBuffer,b=k[a];if(!L||!p||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(a);return}var g=Object(Y.isFiniteNumber)(L.duration)?L.duration:Infinity,c=Object(Y.isFiniteNumber)(p.duration)?p.duration:Infinity,u=Math.max(0,s),o=Math.min(h,g,c);o>u?(R.logger.log("[buffer-controller]: Removing ["+u+","+o+"] from the "+a+" SourceBuffer"),console.assert(!b.updating,a+" sourceBuffer must not be updating"),b.remove(u,o)):v.shiftAndExecuteNext(a)},E.appendExecutor=function(a,s){var h=this.operationQueue,L=this.sourceBuffer,p=L[s];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(s);return}p.ended=!1,console.assert(!p.updating,s+" sourceBuffer must not be updating"),p.appendBuffer(a)},E.blockBuffers=function(a,s){var h=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var L=this.operationQueue,p=s.map(function(v){return L.appendBlocker(v)});Promise.all(p).then(function(){a(),s.forEach(function(v){var k=h.sourceBuffer[v];(!k||!k.updating)&&L.shiftAndExecuteNext(v)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(a,s,h){var L=this.sourceBuffer[a];if(!L)return;var p=h.bind(this,a);this.listeners[a].push({event:s,listener:p}),L.addEventListener(s,p)},E.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(h){s.removeEventListener(h.event,h.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return F});var Y=D("./src/utils/logger.ts"),F=function(){function R(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var W=R.prototype;return W.append=function(P,A){var f=this.queues[A];f.push(P),f.length===1&&this.buffers[A]&&this.executeNext(A)},W.insertAbort=function(P,A){var f=this.queues[A];f.unshift(P),this.executeNext(A)},W.appendBlocker=function(P){var A,f=new Promise(function(M){A=M}),x={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(x,P),f},W.executeNext=function(P){var A=this.buffers,f=this.queues,x=A[P],M=f[P];if(M.length){var w=M[0];try{w.execute()}catch(C){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(C),(!x||!x.updating)&&(M.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},R}()},"./src/controller/cap-level-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/events.ts");function F(B,P){for(var A=0;A<P.length;A++){var f=P[A];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(B,f.key,f)}}function R(B,P,A){return P&&F(B.prototype,P),A&&F(B,A),B}var W=function(){function B(A){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=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=B.prototype;return P.setStreamController=function(f){this.streamController=f},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var f=this.hls;f.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var f=this.hls;f.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(f,x){B.isLevelAllowed(x.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(x.droppedLevel)},P.onMediaAttaching=function(f,x){this.media=x.media instanceof HTMLVideoElement?x.media:null},P.onManifestParsed=function(f,x){var M=this.hls;this.restrictedLevels=[],this.firstLevel=x.firstLevel,M.config.capLevelToPlayerSize&&x.video&&this.startCapping()},P.onBufferCodecs=function(f,x){var M=this.hls;M.config.capLevelToPlayerSize&&x.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var f=this.hls.levels;if(f.length){var x=this.hls;x.autoLevelCapping=this.getMaxLevel(f.length-1),x.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=x.autoLevelCapping}}},P.getMaxLevel=function(f){var x=this,M=this.hls.levels;if(!M.length)return-1;var w=M.filter(function(C,E){return B.isLevelAllowed(E,x.restrictedLevels)&&E<=f});return this.clientRect=null,B.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var f=this.media,x={width:0,height:0};if(f){var M=f.getBoundingClientRect();x.width=M.width,x.height=M.height,!x.width&&!x.height&&(x.width=M.right-M.left||f.width||0,x.height=M.bottom-M.top||f.height||0)}return this.clientRect=x,x},B.isLevelAllowed=function(f,x){return x===void 0&&(x=[]),x.indexOf(f)===-1},B.getMaxLevelByMediaSize=function(f,x,M){if(!f||!f.length)return-1;for(var w=function(s,h){return h?s.width!==h.width||s.height!==h.height:!0},C=f.length-1,E=0;E<f.length;E+=1){var d=f[E];if((d.width>=x||d.height>=M)&&w(d,f[E+1])){C=E;break}}return C},R(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var f=1;try{f=self.devicePixelRatio}catch(x){}return f}}]),B}();$.default=W},"./src/controller/cmcd-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./src/events.ts"),F=D("./src/types/cmcd.ts"),R=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts");function B(C,E){for(var d=0;d<E.length;d++){var a=E[d];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(C,a.key,a)}}function P(C,E,d){return E&&B(C.prototype,E),d&&B(C,d),C}function A(C,E){var d=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(d)return(d=d.call(C)).next.bind(d);if(Array.isArray(C)||(d=f(C))||E&&C&&typeof C.length=="number"){d&&(C=d);var a=0;return function(){return a>=C.length?{done:!0}:{done:!1,value:C[a++]}}}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 f(C,E){if(!C)return;if(typeof C=="string")return x(C,E);var d=Object.prototype.toString.call(C).slice(8,-1);if(d==="Object"&&C.constructor&&(d=C.constructor.name),d==="Map"||d==="Set")return Array.from(C);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return x(C,E)}function x(C,E){(E==null||E>C.length)&&(E=C.length);for(var d=0,a=new Array(E);d<E;d++)a[d]=C[d];return a}function M(){return M=Object.assign||function(C){for(var E=1;E<arguments.length;E++){var d=arguments[E];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(C[a]=d[a])}return C},M.apply(this,arguments)}var w=function(){function C(d){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(L){try{a.apply(L,{ot:F.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(p){W.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(L){try{var p=L.frag,v=a.hls.levels[p.level],k=a.getObjectType(p),b={d:p.duration*1e3,ot:k};(k===F.CMCDObjectType.VIDEO||k===F.CMCDObjectType.AUDIO||k==F.CMCDObjectType.MUXED)&&(b.br=v.bitrate/1e3,b.tb=a.getTopBandwidth(k),b.bl=a.getBufferLength(k)),a.apply(L,b)}catch(g){W.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=d;var s=this.config=d.config,h=s.cmcd;h!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||C.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var E=C.prototype;return E.registerListeners=function(){var a=this.hls;a.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var a=this.hls;a.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(a,s){var h,L;this.audioBuffer=(h=s.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(L=s.tracks.video)===null||L===void 0?void 0:L.buffer},E.createData=function(){var a;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},E.apply=function(a,s){s===void 0&&(s={}),M(s,this.createData());var h=s.ot===F.CMCDObjectType.INIT||s.ot===F.CMCDObjectType.VIDEO||s.ot===F.CMCDObjectType.MUXED;if(this.starved&&h&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var L=C.toHeaders(s);if(!Object.keys(L).length)return;a.headers||(a.headers={}),M(a.headers,L)}else{var p=C.toQuery(s);if(!p)return;a.url=C.appendQueryToUri(a.url,p)}},E.getObjectType=function(a){var s=a.type;return s==="subtitle"?F.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?F.CMCDObjectType.INIT:s==="audio"?F.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(a){for(var s=0,h=a===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=A(h),p;!(p=L()).done;){var v=p.value;v.bitrate>s&&(s=v.bitrate)}return s>0?s:NaN},E.getBufferLength=function(a){var s=this.hls.media,h=a===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!s)return NaN;var L=R.BufferHelper.bufferInfo(h,s.currentTime,this.config.maxBufferHole);return L.len*1e3},E.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,h=a||this.config.loader;return function(){function L(v){this.loader=void 0,this.loader=new h(v)}var p=L.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(k,b,g){s(k),this.loader.load(k,b,g)},P(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},E.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,h=a||this.config.loader;return function(){function L(v){this.loader=void 0,this.loader=new h(v)}var p=L.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(k,b,g){s(k),this.loader.load(k,b,g)},P(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},C.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},C.serialize=function(a){for(var s=[],h=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},L=function(U){return Math.round(U)},p=function(U){return L(U/100)*100},v=function(U){return encodeURIComponent(U)},k={br:L,d:L,bl:p,dl:p,mtp:p,nor:v,rtp:p,tb:L},b=Object.keys(a||{}).sort(),g=A(b),c;!(c=g()).done;){var u=c.value,o=a[u];if(!h(o))continue;if(u==="v"&&o===1)continue;if(u=="pr"&&o===1)continue;var T=k[u];T&&(o=T(o));var S=typeof o,m=void 0;u==="ot"||u==="sf"||u==="st"?m=u+"="+o:S==="boolean"?m=u:S==="number"?m=u+"="+o:m=u+"="+JSON.stringify(o),s.push(m)}return s.join(",")},C.toHeaders=function(a){for(var s=Object.keys(a),h={},L=["Object","Request","Session","Status"],p=[{},{},{},{}],v={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},k=0,b=s;k<b.length;k++){var g=b[k],c=v[g]!=null?v[g]:1;p[c][g]=a[g]}for(var u=0;u<p.length;u++){var o=C.serialize(p[u]);o&&(h["CMCD-"+L[u]]=o)}return h},C.toQuery=function(a){return"CMCD="+encodeURIComponent(C.serialize(a))},C.appendQueryToUri=function(a,s){if(!s)return a;var h=a.includes("?")?"&":"?";return""+a+h+s},C}()},"./src/controller/eme-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),F=D("./src/errors.ts"),R=D("./src/utils/logger.ts"),W=D("./src/utils/mediakeys-helper.ts");function B(w,C){for(var E=0;E<C.length;E++){var d=C[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function P(w,C,E){return C&&B(w.prototype,C),E&&B(w,E),w}var A=3,f=function(C,E,d){var a={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),E.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[a]},x=function(C,E,d,a){switch(C){case W.KeySystems.WIDEVINE:return f(E,d,a);default:throw new Error("Unknown key-system: "+C)}},M=function(){function w(E){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=E,this._config=E.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 C=w.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C.getLicenseServerUrl=function(d){switch(d){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},C._attemptKeySystemAccess=function(d,a,s){var h=this,L=x(d,a,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(d,L);this.mediaKeysPromise=p.then(function(v){return h._onMediaKeySystemAccessObtained(d,v)}),p.catch(function(v){R.logger.error('Failed to obtain key-system "'+d+'" access:',v)})},C._onMediaKeySystemAccessObtained=function(d,a){var s=this;R.logger.log('Access for key-system "'+d+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:d};this._mediaKeysList.push(h);var L=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(p){return h.mediaKeys=p,R.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),p});return L.catch(function(p){R.logger.error("Failed to create media-keys:",p)}),L},C._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),d._onNewMediaKeySession(a.mediaKeysSession))})},C._onNewMediaKeySession=function(d){var a=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){a._onKeySessionMessage(d,s.message)},!1)},C._onKeySessionMessage=function(d,a){R.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},C.onMediaEncrypted=function(d){var a=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(L){if(!a._media)return;a._attemptSetMediaKeys(L),a._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},C._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(d,a){var s=this,h=this._mediaKeysList[0];if(!h){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var L=h.mediaKeysSession;if(!L){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),h.mediaKeysSessionInitialized=!0,L.generateRequest(d,a).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(p){R.logger.error("Error generating key-session request:",p),s.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(d,a,s){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,d,a,s);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,h,d),L=void 0}catch(p){R.logger.error(p)}try{h.readyState||h.open("POST",d,!0),L&&L.call(this.hls,h,d)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return h},C._onLicenseRequestReadyStageChange=function(d,a,s,h){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var L=d.response,p=this._licenseResponseCallback;if(p)try{L=p.call(this.hls,d,a)}catch(k){R.logger.error(k)}h(L)}else{if(R.logger.error("License Request XHR failed ("+a+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=A-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(s,h)}break}},C._generateLicenseRequestChallenge=function(d,a){switch(d.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},C._requestLicense=function(d,a){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(s.mediaKeySystemDomain),L=this._createLicenseXhr(h,d,a);R.logger.log("Sending license request to URL: "+h);var p=this._generateLicenseRequestChallenge(s,d);L.send(p)}catch(v){R.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(d,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},C.onMediaDetached=function(){var d=this._media,a=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},C.onManifestParsed=function(d,a){if(!this._emeEnabled)return;var s=a.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),h=a.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,h)},P(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();$.default=M},"./src/controller/fps-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),F=D("./src/utils/logger.ts"),R=function(){function W(P){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=P,this.registerListeners()}var B=W.prototype;return B.setStreamController=function(A){this.streamController=A},B.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(A,f){var x=this.hls.config;if(x.capLevelOnFPSDrop){var M=f.media instanceof self.HTMLVideoElement?f.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),x.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(A,f,x){var M=performance.now();if(f){if(this.lastTime){var w=M-this.lastTime,C=x-this.lastDroppedFrames,E=f-this.lastDecodedFrames,d=1e3*C/w,a=this.hls;if(a.trigger(Y.Events.FPS_DROP,{currentDropped:C,currentDecoded:E,totalDroppedFrames:x}),d>0&&C>a.config.fpsDroppedMonitoringThreshold*E){var s=a.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=x,this.lastDecodedFrames=f}},B.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var f=A.getVideoPlaybackQuality();this.checkFPS(A,f.totalVideoFrames,f.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},W}();$.default=R},"./src/controller/fragment-finders.ts":function(ne,$,D){"use strict";D.r($),D.d($,"findFragmentByPDT",function(){return R}),D.d($,"findFragmentByPTS",function(){return W}),D.d($,"fragmentWithinToleranceTest",function(){return B}),D.d($,"pdtWithinToleranceTest",function(){return P}),D.d($,"findFragWithCC",function(){return A});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/binary-search.ts");function R(f,x,M){if(x===null||!Array.isArray(f)||!f.length||!Object(Y.isFiniteNumber)(x))return null;var w=f[0].programDateTime;if(x<(w||0))return null;var C=f[f.length-1].endProgramDateTime;if(x>=(C||0))return null;M=M||0;for(var E=0;E<f.length;++E){var d=f[E];if(P(x,M,d))return d}return null}function W(f,x,M,w){M===void 0&&(M=0),w===void 0&&(w=0);var C=null;if(f?C=x[f.sn-x[0].sn+1]||null:M===0&&x[0].start===0&&(C=x[0]),C&&B(M,w,C)===0)return C;var E=F.default.search(x,B.bind(null,M,w));return E||C}function B(f,x,M){f===void 0&&(f=0),x===void 0&&(x=0);var w=Math.min(x,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-w<=f?1:M.start-w>f&&M.start?-1:0}function P(f,x,M){var w=Math.min(x,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,C=M.endProgramDateTime||0;return C-w>f}function A(f,x){return F.default.search(f,function(M){return M.cc<x?1:M.cc>x?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,$,D){"use strict";D.r($),D.d($,"FragmentState",function(){return R}),D.d($,"FragmentTracker",function(){return W});var Y=D("./src/events.ts"),F=D("./src/types/loader.ts"),R;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(R||(R={}));var W=function(){function A(x){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=x,this._registerListeners()}var f=A.prototype;return f._registerListeners=function(){var M=this.hls;M.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},f._unregisterListeners=function(){var M=this.hls;M.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},f.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},f.getAppendedFrag=function(M,w){if(w===F.PlaylistLevelType.MAIN){var C=this.activeFragment,E=this.activeParts;if(!C)return null;if(E)for(var d=E.length;d--;){var a=E[d],s=a?a.end:C.appendedPTS;if(a.start<=M&&s!==void 0&&M<=s)return d>9&&(this.activeParts=E.slice(d-9)),a}else if(C.start<=M&&C.appendedPTS!==void 0&&M<=C.appendedPTS)return C}return this.getBufferedFrag(M,w)},f.getBufferedFrag=function(M,w){for(var C=this.fragments,E=Object.keys(C),d=E.length;d--;){var a=C[E[d]];if((a==null?void 0:a.body.type)===w&&a.buffered){var s=a.body;if(s.start<=M&&M<=s.end)return s}}return null},f.detectEvictedFragments=function(M,w,C){var E=this;Object.keys(this.fragments).forEach(function(d){var a=E.fragments[d];if(!a)return;if(!a.buffered){a.body.type===C&&E.removeFragment(a.body);return}var s=a.range[M];if(!s)return;s.time.some(function(h){var L=!E.isTimeBuffered(h.startPTS,h.endPTS,w);return L&&E.removeFragment(a.body),L})})},f.detectPartialFragments=function(M){var w=this,C=this.timeRanges,E=M.frag,d=M.part;if(!C||E.sn==="initSegment")return;var a=P(E),s=this.fragments[a];if(!s)return;Object.keys(C).forEach(function(h){var L=E.elementaryStreams[h];if(!L)return;var p=C[h],v=d!==null||L.partial===!0;s.range[h]=w.getBufferedTimes(E,d,v,p)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},f.fragBuffered=function(M){var w=P(M),C=this.fragments[w];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},f.getBufferedTimes=function(M,w,C,E){for(var d={time:[],partial:C},a=w?w.start:M.start,s=w?w.end:M.end,h=M.minEndPTS||s,L=M.maxStartPTS||a,p=0;p<E.length;p++){var v=E.start(p)-this.bufferPadding,k=E.end(p)+this.bufferPadding;if(L>=v&&h<=k){d.time.push({startPTS:Math.max(a,E.start(p)),endPTS:Math.min(s,E.end(p))});break}else if(a<k&&s>v)d.partial=!0,d.time.push({startPTS:Math.max(a,E.start(p)),endPTS:Math.min(s,E.end(p))});else if(s<=v)break}return d},f.getPartialFragment=function(M){var w=null,C,E,d,a=0,s=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(L){var p=h[L];if(!p)return;B(p)&&(E=p.body.start-s,d=p.body.end+s,M>=E&&M<=d&&(C=Math.min(M-E,d-M),a<=C&&(w=p.body,a=C)))}),w},f.getState=function(M){var w=P(M),C=this.fragments[w];return C?C.buffered?B(C)?R.PARTIAL:R.OK:C.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},f.backtrack=function(M,w){var C=P(M),E=this.fragments[C];if(!E||E.backtrack)return null;var d=E.backtrack=w||E.loaded;return E.loaded=null,d},f.getBacktrackData=function(M){var w=P(M),C=this.fragments[w];if(C){var E,d=C.backtrack;if(d!=null&&(E=d.payload)!==null&&E!==void 0&&E.byteLength)return d;this.removeFragment(M)}return null},f.isTimeBuffered=function(M,w,C){for(var E,d,a=0;a<C.length;a++){if(E=C.start(a)-this.bufferPadding,d=C.end(a)+this.bufferPadding,M>=E&&w<=d)return!0;if(w<=E)return!1}return!1},f.onFragLoaded=function(M,w){var C=w.frag,E=w.part;if(C.sn==="initSegment"||C.bitrateTest||E)return;var d=P(C);this.fragments[d]={body:C,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},f.onBufferAppended=function(M,w){var C=this,E=w.frag,d=w.part,a=w.timeRanges;if(E.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=E,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var L=a[h];if(C.detectEvictedFragments(h,L),!d)for(var p=0;p<L.length;p++)E.appendedPTS=Math.max(L.end(p),E.appendedPTS||0)})},f.onFragBuffered=function(M,w){this.detectPartialFragments(w)},f.hasFragment=function(M){var w=P(M);return!!this.fragments[w]},f.removeFragmentsInRange=function(M,w,C){var E=this;Object.keys(this.fragments).forEach(function(d){var a=E.fragments[d];if(!a)return;if(a.buffered){var s=a.body;s.type===C&&s.start<w&&s.end>M&&E.removeFragment(s)}})},f.removeFragment=function(M){var w=P(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[w]},f.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function B(A){var f,x;return A.buffered&&(((f=A.range.video)===null||f===void 0?void 0:f.partial)||((x=A.range.audio)===null||x===void 0?void 0:x.partial))}function P(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"STALL_MINIMUM_DURATION_MS",function(){return B}),D.d($,"MAX_START_GAP_JUMP",function(){return P}),D.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),D.d($,"SKIP_BUFFER_RANGE_START",function(){return f}),D.d($,"default",function(){return x});var Y=D("./src/utils/buffer-helper.ts"),F=D("./src/errors.ts"),R=D("./src/events.ts"),W=D("./src/utils/logger.ts"),B=250,P=2,A=.1,f=.05,x=function(){function M(C,E,d,a){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=C,this.media=E,this.fragmentTracker=d,this.hls=a}var w=M.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(E){var d=this.config,a=this.media,s=this.stalled,h=a.currentTime,L=a.seeking,p=this.seeking&&!L,v=!this.seeking&&L;if(this.seeking=L,h!==E){if(this.moved=!0,s!==null){if(this.stallReported){var k=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||p)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Y.BufferHelper.getBuffered(a).length)return;var b=Y.BufferHelper.bufferInfo(a,h,0),g=b.len>0,c=b.nextStart||0;if(!g&&!c)return;if(L){var u=b.len>P,o=!c||c-h>P&&!this.fragmentTracker.getPartialFragment(h);if(u||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,S=Math.max(c,b.start||0)-h,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,O=m==null||((T=m.details)===null||T===void 0)?void 0:T.live,U=O?m.details.targetduration*2:P;if(S>0&&S<=U){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var K=j-s;!L&&K>=B&&this._reportStall(b.len);var I=Y.BufferHelper.bufferInfo(a,h,d.maxBufferHole);this._tryFixBufferStall(I,K)},w._tryFixBufferStall=function(E,d){var a=this.config,s=this.fragmentTracker,h=this.media,L=h.currentTime,p=s.getPartialFragment(L);if(p){var v=this._trySkipBufferHole(p);if(v)return}E.len>a.maxBufferHole&&d>a.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(E){var d=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+E+")"),d.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},w._trySkipBufferHole=function(E){for(var d=this.config,a=this.hls,s=this.media,h=s.currentTime,L=0,p=Y.BufferHelper.getBuffered(s),v=0;v<p.length;v++){var k=p.start(v);if(h+d.maxBufferHole>=L&&h<k){var b=Math.max(k+f,s.currentTime+A);return W.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+b),this.moved=!0,this.stalled=null,s.currentTime=b,E&&a.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+b,frag:E}),b}L=p.end(v)}return 0},w._tryNudgeBuffer=function(){var E=this.config,d=this.hls,a=this.media,s=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<E.nudgeMaxRetry){var L=s+h*E.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+L),a.currentTime=L,d.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+E.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),F=D("./src/utils/texttrack-utils.ts"),R=D("./src/demux/id3.ts"),W=.25,B=function(){function P(f){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=f,this._registerListeners()}var A=P.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var x=this.hls;x.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var x=this.hls;x.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(x,M){this.media=M.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(x){if(!this.media)return;for(var M=0;M<x.length;M++){var w=x[M];if(w.kind==="metadata"&&w.label==="id3")return Object(F.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(x,M){if(!this.media)return;var w=M.frag,C=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<C.length;d++){var a=R.getID3Frames(C[d].data);if(a){var s=C[d].pts,h=d<C.length-1?C[d+1].pts:w.end,L=h-s;L<=0&&(h=s+W);for(var p=0;p<a.length;p++){var v=a[p];if(!R.isTimeStampFrame(v)){var k=new E(s,h,"");k.value=v,this.id3Track.addCue(k)}}}}},A.onBufferFlushing=function(x,M){var w=M.startOffset,C=M.endOffset,E=M.type;if(!E||E==="audio"){var d=this.id3Track;d&&Object(F.removeCuesInRange)(d,w,C)}},P}();$.default=B},"./src/controller/latency-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return P});var Y=D("./src/errors.ts"),F=D("./src/events.ts"),R=D("./src/utils/logger.ts");function W(A,f){for(var x=0;x<f.length;x++){var M=f[x];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(A,M.key,M)}}function B(A,f,x){return f&&W(A.prototype,f),x&&W(A,x),A}var P=function(){function A(x){var M=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 M.timeupdate()},this.hls=x,this.config=x.config,this.registerListeners()}var f=A.prototype;return f.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},f.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)},f.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)},f.onMediaAttached=function(M,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},f.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},f.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},f.onLevelUpdated=function(M,w){var C=w.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},f.onError=function(M,w){if(w.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},f.timeupdate=function(){var M=this.media,w=this.levelDetails;if(!M||!w)return;this.currentTime=M.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var E=this.config,d=E.lowLatencyMode,a=E.maxLiveSyncPlaybackRate;if(!d||a===1)return;var s=this.targetLatency;if(s===null)return;var h=C-s,L=Math.min(this.maxLatency,s+w.targetduration),p=h<L;if(w.live&&p&&h>.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,a)),k=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;M.playbackRate=Math.min(v,Math.max(1,k))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},f.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},f.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},B(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,w=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:w?M.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var w=M.holdBack,C=M.partHoldBack,E=M.targetduration,d=this.config,a=d.liveSyncDuration,s=d.liveSyncDurationCount,h=d.lowLatencyMode,L=this.hls.userConfig,p=h&&C||w;(L.liveSyncDuration||L.liveSyncDurationCount||p===0)&&(p=a!==void 0?a:s*E);var v=E,k=1;return p+Math.min(this.stallCount*k,v)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),w=this.targetLatency,C=this.levelDetails;if(M===null||w===null||C===null)return null;var E=C.edge,d=M-w-this.edgeStalled,a=E-C.totalduration,s=E-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(a,d),s)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var w=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-w,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,w=this.levelDetails;if(!M||!w)return 0;var C=M.buffered.length;return C?M.buffered.end(C-1):w.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return d});var Y=D("./src/types/level.ts"),F=D("./src/events.ts"),R=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),B=D("./src/controller/level-helper.ts"),P=D("./src/controller/base-playlist-controller.ts"),A=D("./src/types/loader.ts");function f(){return f=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var h=arguments[s];for(var L in h)Object.prototype.hasOwnProperty.call(h,L)&&(a[L]=h[L])}return a},f.apply(this,arguments)}function x(a,s){for(var h=0;h<s.length;h++){var L=s[h];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function M(a,s,h){return s&&x(a.prototype,s),h&&x(a,h),a}function w(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,C(a,s)}function C(a,s){return C=Object.setPrototypeOf||function(L,p){return L.__proto__=p,L},C(a,s)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(a){w(s,a);function s(L){var p;return p=a.call(this,L,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var h=s.prototype;return h._registerListeners=function(){var p=this.hls;p.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(F.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var p=this.hls;p.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(F.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},h.startLoad=function(){var p=this._levels;p.forEach(function(v){v.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(p,v){var k=[],b=[],g=[],c,u={},o,T=!1,S=!1,m=!1;if(v.levels.forEach(function(K){var I=K.attrs;T=T||!!(K.width&&K.height),S=S||!!K.videoCodec,m=m||!!K.audioCodec,E&&K.audioCodec&&K.audioCodec.indexOf("mp4a.40.34")!==-1&&(K.audioCodec=void 0);var N=K.bitrate+"-"+K.attrs.RESOLUTION+"-"+K.attrs.CODECS;o=u[N],o?o.url.push(K.url):(o=new Y.Level(K),u[N]=o,k.push(o)),I&&(I.AUDIO&&Object(B.addGroupId)(o,"audio",I.AUDIO),I.SUBTITLES&&Object(B.addGroupId)(o,"text",I.SUBTITLES))}),(T||S)&&m&&(k=k.filter(function(K){var I=K.videoCodec,N=K.width,X=K.height;return!!I||!!(N&&X)})),k=k.filter(function(K){var I=K.audioCodec,N=K.videoCodec;return(!I||Object(W.isCodecSupportedInMp4)(I,"audio"))&&(!N||Object(W.isCodecSupportedInMp4)(N,"video"))}),v.audioTracks&&(b=v.audioTracks.filter(function(K){return!K.audioCodec||Object(W.isCodecSupportedInMp4)(K.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(b)),v.subtitles&&(g=v.subtitles,Object(B.assignTrackIdsByGroup)(g)),k.length>0){c=k[0].bitrate,k.sort(function(K,I){return K.bitrate-I.bitrate}),this._levels=k;for(var O=0;O<k.length;O++)if(k[O].bitrate===c){this._firstLevel=O,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+c);break}var U=m&&!S,j={levels:k,audioTracks:b,subtitleTracks:g,firstLevel:this._firstLevel,stats:v.stats,audio:m,video:S,altAudio:!U&&b.some(function(K){return!!K.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:v.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(p,v){if(a.prototype.onError.call(this,p,v),v.fatal)return;var k=v.context,b=this._levels[this.currentLevelIndex];if(k&&(k.type===A.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&k.groupId===b.audioGroupIds[b.urlId]||k.type===A.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&k.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,c=!0,u;switch(v.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(v.frag){var o=this._levels[v.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=v.frag.level)):u=v.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(c=!1),u=k.level),g=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:u=v.level,g=!0;break}u!==void 0&&this.recoverLevel(v,u,g,c)},h.recoverLevel=function(p,v,k,b){var g=p.details,c=this._levels[v];if(c.loadError++,k){var u=this.retryLoadingOrFail(p);if(u)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var o=c.url.length;if(o>1&&c.loadError<o)p.levelRetry=!0,this.redundantFailover(v);else if(this.manualLevelIndex===-1){var T=v===0?this._levels.length-1:v-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(g+": switch to "+T),p.levelRetry=!0,this.hls.nextAutoLevel=T)}}},h.redundantFailover=function(p){var v=this._levels[p],k=v.url.length;if(k>1){var b=(v.urlId+1)%k;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(g){g.urlId=b}),this.level=p}},h.onFragLoaded=function(p,v){var k=v.frag;if(k!==void 0&&k.type===A.PlaylistLevelType.MAIN){var b=this._levels[k.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},h.onLevelLoaded=function(p,v){var k,b=v.level,g=v.details,c=this._levels[b];if(!c){var u;this.warn("Invalid level index "+b),(u=v.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(g.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,v,c.details)):(k=v.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(g.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(p,v){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var b=-1,g=this.hls.audioTracks[v.id].groupId,c=0;c<k.audioGroupIds.length;c++)if(k.audioGroupIds[c]===g){b=c;break}b!==k.urlId&&(k.urlId=b,this.startLoad())}},h.loadPlaylist=function(p){var v=this.currentLevelIndex,k=this._levels[v];if(this.canLoad&&k&&k.url.length>0){var b=k.urlId,g=k.url[b];if(p)try{g=p.addDirectives(g)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+v+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+g),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:g,level:v,id:b,deliveryDirectives:p||null})}},h.removeLevel=function(p,v){var k=function(c,u){return u!==v},b=this._levels.filter(function(g,c){return c!==p?!0:g.url.length>1&&v!==void 0?(g.url=g.url.filter(k),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(k)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(k)),g.urlId=0,!0):!1}).map(function(g,c){var u=g.details;return u!=null&&u.fragments&&u.fragments.forEach(function(o){o.level=c}),g});this._levels=b,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:b})},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var v,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===p&&(v=k[p])!==null&&v!==void 0&&v.details)return;if(p<0||p>=k.length){var b=p<0;if(this.hls.trigger(F.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,k.length-1)}this.clearTimer();var g=this.currentLevelIndex,c=k[g],u=k[p];this.log("switching to level "+p+" from "+g),this.currentLevelIndex=p;var o=f({},u,{level:p,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete o._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,o);var T=u.details;if(!T||T.live){var S=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(ne,$,D){"use strict";D.r($),D.d($,"addGroupId",function(){return R}),D.d($,"assignTrackIdsByGroup",function(){return W}),D.d($,"updatePTS",function(){return B}),D.d($,"updateFragPTSDTS",function(){return A}),D.d($,"mergeDetails",function(){return f}),D.d($,"mapPartIntersection",function(){return x}),D.d($,"mapFragmentIntersection",function(){return M}),D.d($,"adjustSliding",function(){return w}),D.d($,"addSliding",function(){return C}),D.d($,"computeReloadInterval",function(){return E}),D.d($,"getFragmentWithSN",function(){return d}),D.d($,"getPartWith",function(){return a});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts");function R(s,h,L){switch(h){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(L);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(L);break}}function W(s){var h={};s.forEach(function(L){var p=L.groupId||"";L.id=h[p]=h[p]||0,h[p]++})}function B(s,h,L){var p=s[h],v=s[L];P(p,v)}function P(s,h){var L=h.startPTS;if(Object(Y.isFiniteNumber)(L)){var p=0,v;h.sn>s.sn?(p=L-s.start,v=s):(p=s.start-L,v=h),v.duration!==p&&(v.duration=p)}else if(h.sn>s.sn){var k=s.cc===h.cc;k&&s.minEndPTS?h.start=s.start+(s.minEndPTS-s.start):h.start=s.start+s.duration}else h.start=Math.max(s.start-h.duration,0)}function A(s,h,L,p,v,k){var b=p-L;b<=0&&(F.logger.warn("Fragment should have a positive duration",h),p=L+h.duration,k=v+h.duration);var g=L,c=p,u=h.startPTS,o=h.endPTS;if(Object(Y.isFiniteNumber)(u)){var T=Math.abs(u-L);Object(Y.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(T,h.deltaPTS):h.deltaPTS=T,g=Math.max(L,u),L=Math.min(L,u),v=Math.min(v,h.startDTS),c=Math.min(p,o),p=Math.max(p,o),k=Math.max(k,h.endDTS)}h.duration=p-L;var S=L-h.start;h.appendedPTS=p,h.start=h.startPTS=L,h.maxStartPTS=g,h.startDTS=v,h.endPTS=p,h.minEndPTS=c,h.endDTS=k;var m=h.sn;if(!s||m<s.startSN||m>s.endSN)return 0;var O,U=m-s.startSN,j=s.fragments;for(j[U]=h,O=U;O>0;O--)P(j[O],j[O-1]);for(O=U;O<j.length-1;O++)P(j[O],j[O+1]);return s.fragmentHint&&P(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function f(s,h){for(var L=null,p=s.fragments,v=p.length-1;v>=0;v--){var k=p[v].initSegment;if(k){L=k;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var b=0,g;if(M(s,h,function(O,U){O.relurl&&(b=O.cc-U.cc),Object(Y.isFiniteNumber)(O.startPTS)&&Object(Y.isFiniteNumber)(O.endPTS)&&(U.start=U.startPTS=O.startPTS,U.startDTS=O.startDTS,U.appendedPTS=O.appendedPTS,U.maxStartPTS=O.maxStartPTS,U.endPTS=O.endPTS,U.endDTS=O.endDTS,U.minEndPTS=O.minEndPTS,U.duration=O.endPTS-O.startPTS,U.duration&&(g=U),h.PTSKnown=h.alignedSliding=!0),U.elementaryStreams=O.elementaryStreams,U.loader=O.loader,U.stats=O.stats,U.urlId=O.urlId,O.initSegment&&(U.initSegment=O.initSegment,L=O.initSegment)}),L){var c=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;c.forEach(function(O){var U;(!O.initSegment||O.initSegment.relurl===((U=L)===null||U===void 0?void 0:U.relurl))&&(O.initSegment=L)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(O){return!O}),h.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=h.skippedSegments;u--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var o=h.fragments;if(b){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<o.length;T++)o[T].cc+=b}h.skippedSegments&&(h.startCC=h.fragments[0].cc),x(s.partList,h.partList,function(O,U){U.elementaryStreams=O.elementaryStreams,U.stats=O.stats}),g?A(h,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):w(s,h),o.length&&(h.totalduration=h.edge-o[0].start),h.driftStartTime=s.driftStartTime,h.driftStart=s.driftStart;var S=h.advancedDateTime;if(h.advanced&&S){var m=h.edge;h.driftStart||(h.driftStartTime=S,h.driftStart=m),h.driftEndTime=S,h.driftEnd=m}else h.driftEndTime=s.driftEndTime,h.driftEnd=s.driftEnd,h.advancedDateTime=s.advancedDateTime}function x(s,h,L){if(s&&h)for(var p=0,v=0,k=s.length;v<=k;v++){var b=s[v],g=h[v+p];b&&g&&b.index===g.index&&b.fragment.sn===g.fragment.sn?L(b,g):p--}}function M(s,h,L){for(var p=h.skippedSegments,v=Math.max(s.startSN,h.startSN)-h.startSN,k=(s.fragmentHint?1:0)+(p?h.endSN:Math.min(s.endSN,h.endSN))-h.startSN,b=h.startSN-s.startSN,g=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,u=v;u<=k;u++){var o=c[b+u],T=g[u];p&&!T&&u<p&&(T=h.fragments[u]=o),o&&T&&L(o,T)}}function w(s,h){var L=h.startSN+h.skippedSegments-s.startSN,p=s.fragments;if(L<0||L>=p.length)return;C(h,p[L].start)}function C(s,h){if(h){for(var L=s.fragments,p=s.skippedSegments;p<L.length;p++)L[p].start+=h;s.fragmentHint&&(s.fragmentHint.start+=h)}}function E(s,h){var L=1e3*s.levelTargetDuration,p=L/2,v=s.age,k=v>0&&v<L*3,b=h.loading.end-h.loading.start,g,c=s.availabilityDelay;if(s.updated===!1)if(k){var u=333*s.misses;g=Math.max(Math.min(p,b*2),u),s.availabilityDelay=(s.availabilityDelay||0)+g}else g=p;else k?(c=Math.min(c||L/2,v),s.availabilityDelay=c,g=c+L-v):g=L-b;return Math.round(g)}function d(s,h,L){if(!s||!s.details)return null;var p=s.details,v=p.fragments[h-p.startSN];return v||(v=p.fragmentHint,v&&v.sn===h?v:h<p.startSN&&L&&L.sn===h?L:null)}function a(s,h,L){if(!s||!s.details)return null;var p=s.details.partList;if(p)for(var v=p.length;v--;){var k=p[v];if(k.index===L&&k.fragment.sn===h)return k}return null}},"./src/controller/stream-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return p});var Y=D("./src/polyfills/number.ts"),F=D("./src/controller/base-stream-controller.ts"),R=D("./src/is-supported.ts"),W=D("./src/events.ts"),B=D("./src/utils/buffer-helper.ts"),P=D("./src/controller/fragment-tracker.ts"),A=D("./src/types/loader.ts"),f=D("./src/loader/fragment.ts"),x=D("./src/demux/transmuxer-interface.ts"),M=D("./src/types/transmuxer.ts"),w=D("./src/controller/gap-controller.ts"),C=D("./src/errors.ts"),E=D("./src/utils/logger.ts");function d(v,k){for(var b=0;b<k.length;b++){var g=k[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(v,g.key,g)}}function a(v,k,b){return k&&d(v.prototype,k),b&&d(v,b),v}function s(v,k){v.prototype=Object.create(k.prototype),v.prototype.constructor=v,h(v,k)}function h(v,k){return h=Object.setPrototypeOf||function(g,c){return g.__proto__=c,g},h(v,k)}var L=100,p=function(v){s(k,v);function k(g,c){var u;return u=v.call(this,g,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var b=k.prototype;return b._registerListeners=function(){var c=this.hls;c.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(W.Events.ERROR,this.onError,this),c.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(W.Events.ERROR,this.onError,this),c.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=o.startLevel;T===-1&&(o.config.testBandwidth?(T=0,this.bitrateTest=!0):T=o.nextAutoLevel),this.level=o.nextLoadLevel=T,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var c,u=this.levels,o=this.level,T=u==null||((c=u[o])===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 S,m=self.performance.now(),O=this.retryDate;(!O||m>=O||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,u,o=this.hls,T=this.levelLastLoaded,S=this.levels,m=this.media,O=o.config,U=o.nextLoadLevel;if(T===null||!m&&(this.startFragRequested||!O.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[U])return;var j=S[U];this.level=o.nextLoadLevel=U;var K=j.details;if(!K||this.state===F.State.WAITING_LEVEL||K.live&&this.levelLastLoaded!==U){this.state=F.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:m,A.PlaylistLevelType.MAIN);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(j.maxBitrate);if(N>=X)return;if(this._streamEnded(I,K)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,q),this.state=F.State.ENDED;return}var se=I.end,he=this.getNextFragment(se,K);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var Ae=he.sn-K.startSN;Ae>1&&(he=K.fragments[Ae-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===P.FragmentState.OK&&this.nextLoadPosition>se){var be=this.audioOnly&&!this.altAudio?f.ElementaryStreamTypes.AUDIO:f.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(m,be,A.PlaylistLevelType.MAIN),he=this.getNextFragment(this.nextLoadPosition,K)}if(!he)return;he.initSegment&&!he.initSegment.data&&!this.bitrateTest&&(he=he.initSegment),((c=he.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=he.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(he,K):this.loadFragment(he,K,se)},b.loadFragment=function(c,u,o){var T,S=this.fragmentTracker.getState(c);if(this.fragCurrent=c,S===P.FragmentState.BACKTRACKED){var m=this.fragmentTracker.getBacktrackData(c);if(m){this._handleFragmentLoadProgress(m),this._handleFragmentLoadComplete(m);return}else S=P.FragmentState.NOT_LOADED}S===P.FragmentState.NOT_LOADED||S===P.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,v.prototype.loadFragment.call(this,c,u,o)):S===P.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()},b.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,A.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,A.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var o,T=this.getAppendedFrag(u.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!u.paused&&c){var S=this.hls.nextLoadLevel,m=c[S],O=this.fragLastKbps;O&&this.fragCurrent?o=this.fragCurrent.duration*m.maxBitrate/(1e3*O)+1:o=0}else o=0;var U=this.getBufferedFrag(u.currentTime+o);if(U){var j=this.followingBufferedFrag(U);if(j){this.abortCurrentFrag();var K=j.maxStartPTS?j.maxStartPTS:j.start,I=j.duration,N=Math.max(U.end,K+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},b.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()},b.flushMainBuffer=function(c,u){v.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},b.onMediaAttached=function(c,u){v.prototype.onMediaAttached.call(this,c,u);var o=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,this.fragmentTracker,this.hls)},b.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),v.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(Y.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,u){var o=!1,T=!1,S;u.levels.forEach(function(m){S=m.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(o=!0),S.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=o&&T&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,u){var o=this.levels;if(!o||this.state!==F.State.IDLE)return;var T=o[u.level];(!T.details||T.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(T.details))&&(this.state=F.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,u){var o,T=this.levels,S=u.level,m=u.details,O=m.totalduration;if(!T){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+m.startSN+","+m.endSN+"], cc ["+m.startCC+", "+m.endCC+"] duration:"+O);var U=this.fragCurrent;U&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==u.level&&U.loader&&(this.state=F.State.IDLE,U.loader.abort()));var j=T[S],K=0;if(m.live||(o=j.details)!==null&&o!==void 0&&o.live){if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed)return;K=this.alignPlaylists(m,j.details)}if(j.details=m,this.levelLastLoaded=S,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:m,level:S}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(m))return;this.state=F.State.IDLE}this.startFragRequested?m.live&&this.synchronizeToLiveEdge(m):this.setStartPosition(m,K),this.tick()},b._handleFragmentLoadProgress=function(c){var u,o=c.frag,T=c.part,S=c.payload,m=this.levels;if(!m){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var O=m[o.level],U=O.details;if(!U){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var j=O.videoCodec,K=U.PTSKnown||!U.live,I=(u=o.initSegment)===null||u===void 0?void 0:u.data,N=this._getAudioCodec(O),X=this.transmuxer=this.transmuxer||new x.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=T?T.index:-1,se=q!==-1,he=new M.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,S.byteLength,q,se),Ae=this.initPTS[o.cc];X.push(S,I,N,j,o,T,U.totalduration,K,he,Ae)},b.onAudioTrackSwitching=function(c,u){var o=this.altAudio,T=!!u.url,S=u.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 m=this.fragCurrent;m!=null&&m.loader&&(this.log("Switching to main audio track, cancel main fragment load"),m.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var O=this.hls;o&&O.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),O.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:S})}},b.onAudioTrackSwitched=function(c,u){var o=u.id,T=!!this.hls.audioTracks[o].url;if(T){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=T,this.tick()},b.onBufferCreated=function(c,u){var o=u.tracks,T,S,m=!1;for(var O in o){var U=o[O];if(U.id==="main"){if(S=O,T=U,O==="video"){var j=o[O];j&&(this.videoBuffer=j.buffer)}}else m=!0}m&&T?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,u){var o=u.frag,T=u.part;if(o&&o.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(T?" p: "+T.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var S=T?T.stats:o.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,T)},b.onError=function(c,u){switch(u.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,u);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=F.State.ERROR):!u.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case C.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var o=!0,T=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);T&&T.len>.5&&(o=!this.reduceMaxBufferLength(T.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var o=B.BufferHelper.getBuffered(c);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,u){var o=u.type;if(o!==f.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(o===f.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,o,A.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,u){this.levels=u.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,u=c.currentTime,o=this.startPosition;if(o>=0&&u<o){if(c.seeking){E.logger.log("could not seek to "+o+", already seeking at "+u);return}var T=B.BufferHelper.getBuffered(c),S=T.length?T.start(0):0,m=S-o;m>0&&(m<this.config.maxBufferHole||m<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+m+" to match buffer start"),o+=m,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+u),c.currentTime=o}},b._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},b._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(o){var T=u.hls;if(!o||T.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=F.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var S=c.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),T.trigger(W.Events.FRAG_LOADED,o)})},b._handleTransmuxComplete=function(c){var u,o="main",T=this.hls,S=c.remuxResult,m=c.chunkMeta,O=this.getCurrentContext(m);if(!O){this.warn("The loading context changed while buffering fragment "+m.sn+" of level "+m.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(m.level);return}var U=O.frag,j=O.part,K=O.level,I=S.video,N=S.text,X=S.id3,q=S.initSegment,se=this.altAudio?void 0:S.audio;if(this.fragContextChanged(U))return;if(this.state=F.State.PARSING,q){q.tracks&&(this._bufferInitSegment(K,q.tracks,U,m),T.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:o,tracks:q.tracks}));var he=q.initPTS,Ae=q.timescale;Object(Y.isFiniteNumber)(he)&&(this.initPTS[U.cc]=he,T.trigger(W.Events.INIT_PTS_FOUND,{frag:U,id:o,initPTS:he,timescale:Ae}))}if(I&&S.independent!==!1){if(K.details){var be=I.startPTS,Te=I.endPTS,Ce=I.startDTS,Se=I.endDTS;if(j)j.elementaryStreams[I.type]={startPTS:be,endPTS:Te,startDTS:Ce,endDTS:Se};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<be){this.backtrack(U);return}U.setElementaryStreamInfo(I.type,U.start,Te,U.start,Se,!0)}U.setElementaryStreamInfo(I.type,be,Te,Ce,Se),this.bufferFragmentData(I,U,j,m)}}else if(S.independent===!1){this.backtrack(U);return}if(se){var ue=se.startPTS,te=se.endPTS,fe=se.startDTS,ae=se.endDTS;j&&(j.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:fe,endDTS:ae}),U.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,ue,te,fe,ae),this.bufferFragmentData(se,U,j,m)}if(X!=null&&(u=X.samples)!==null&&u!==void 0&&u.length){var _e={frag:U,id:o,samples:X.samples};T.trigger(W.Events.FRAG_PARSING_METADATA,_e)}if(N){var De={frag:U,id:o,samples:N.samples};T.trigger(W.Events.FRAG_PARSING_USERDATA,De)}},b._bufferInitSegment=function(c,u,o,T){var S=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var m=u.audio,O=u.video,U=u.audiovideo;if(m){var j=c.audioCodec,K=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),m.metadata.channelCount!==1&&K.indexOf("firefox")===-1&&(j="mp4a.40.5")),K.indexOf("android")!==-1&&m.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),m.levelCodec=j,m.id="main",this.log("Init audio buffer, container:"+m.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+m.codec+"]")}O&&(O.levelCodec=c.videoCodec,O.id="main",this.log("Init video buffer, container:"+O.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+O.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(I){var N=u[I],X=N.initSegment;X!=null&&X.byteLength&&S.hls.trigger(W.Events.BUFFER_APPENDING,{type:I,data:X,frag:o,part:null,chunkMeta:T,parent:o.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=F.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var o=c.currentTime;if(B.BufferHelper.isBuffered(c,o)?u=this.getAppendedFrag(o):B.BufferHelper.isBuffered(c,o+.1)&&(u=this.getAppendedFrag(o+.1)),u){var T=this.fragPlaying,S=u.level;(!T||u.sn!==T.sn||T.level!==S||u.urlId!==T.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:u}),(!T||T.level!==S)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=u)}}},a(k,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"SubtitleStreamController",function(){return s});var Y=D("./src/events.ts"),F=D("./src/utils/logger.ts"),R=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-finders.ts"),B=D("./src/utils/discontinuities.ts"),P=D("./src/controller/level-helper.ts"),A=D("./src/controller/fragment-tracker.ts"),f=D("./src/controller/base-stream-controller.ts"),x=D("./src/types/loader.ts"),M=D("./src/types/level.ts");function w(h,L){for(var p=0;p<L.length;p++){var v=L[p];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(h,v.key,v)}}function C(h,L,p){return L&&w(h.prototype,L),p&&w(h,p),h}function E(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,d(h,L)}function d(h,L){return d=Object.setPrototypeOf||function(v,k){return v.__proto__=k,v},d(h,L)}var a=500,s=function(h){E(L,h);function L(v,k){var b;return b=h.call(this,v,k,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=L.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var k=this.hls;k.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(Y.Events.ERROR,this.onError,this),k.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var k=this.hls;k.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(Y.Events.ERROR,this.onError,this),k.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=f.State.IDLE,this.setInterval(a),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(k,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(k,b){var g=b.frag,c=b.success;if(this.fragPrevious=g,this.state=f.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var o,T=g.start,S=0;S<u.length;S++)if(T>=u[S].start&&T<=u[S].end){o=u[S];break}var m=g.start+g.duration;o?o.end=m:(o={start:T,end:m},u.push(o)),this.fragmentTracker.fragBuffered(g)},p.onBufferFlushing=function(k,b){var g=b.startOffset,c=b.endOffset;if(g===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,o=this.levels;if(!o.length||!o[u]||!o[u].details)return;var T=o[u].details,S=T.targetduration,m=c-S;if(m<=0)return;b.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(O){for(var U=0;U<O.length;){if(O[U].end<=m){O.shift();continue}else if(O[U].start<m)O[U].start=m;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(g,m,x.PlaylistLevelType.SUBTITLE)}},p.onError=function(k,b){var g,c=b.frag;if(!c||c.type!==x.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=f.State.IDLE},p.onSubtitleTracksUpdated=function(k,b){var g=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new M.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){g.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(k,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(a)},p.onSubtitleTrackLoaded=function(k,b){var g,c=b.details,u=b.id,o=this.currentTrackId,T=this.levels;if(!T.length)return;var S=T[o];if(u>=T.length||u!==o||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(g=S.details)!==null&&g!==void 0&&g.live){var m=this.mainDetails;if(c.deltaUpdateFailed||!m)return;var O=m.fragments[0];if(!S.details)c.hasProgramDateTime&&m.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(c,m):O&&Object(P.addSliding)(c,O.start);else{var U=this.alignPlaylists(c,S.details);U===0&&O&&Object(P.addSliding)(c,O.start)}}if(S.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===f.State.IDLE){var j=Object(W.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},p._handleFragmentLoadComplete=function(k){var b=k.frag,g=k.payload,c=b.decryptdata,u=this.hls;if(this.fragContextChanged(b))return;if(g&&g.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),c.key.buffer,c.iv.buffer).then(function(T){var S=performance.now();u.trigger(Y.Events.FRAG_DECRYPTED,{frag:b,payload:T,stats:{tstart:o,tdecrypt:S}})})}},p.doTick=function(){if(!this.media){this.state=f.State.IDLE;return}if(this.state===f.State.IDLE){var k,b=this.currentTrackId,g=this.levels;if(!g.length||!g[b]||!g[b].details)return;var c=g[b].details,u=c.targetduration,o=this.config,T=this.media,S=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-u,o.maxBufferHole),m=S.end,O=S.len,U=this.getMaxBufferLength()+u;if(O>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,K=j.length,I=c.edge,N,X=this.fragPrevious;if(m<I){var q=o.maxFragLookUpTolerance;X&&c.hasProgramDateTime&&(N=Object(W.findFragmentByPDT)(j,X.endProgramDateTime,q)),N||(N=Object(W.findFragmentByPTS)(X,j,m,q),!N&&X&&X.start<j[0].start&&(N=j[0]))}else N=j[K-1];(k=N)!==null&&k!==void 0&&k.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=f.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===A.FragmentState.NOT_LOADED&&this.loadFragment(N,c,m)}},p.loadFragment=function(k,b,g){this.fragCurrent=k,h.prototype.loadFragment.call(this,k,b,g)},C(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(f.default)},"./src/controller/subtitle-track-controller.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),F=D("./src/utils/texttrack-utils.ts"),R=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function B(w,C){for(var E=0;E<C.length;E++){var d=C[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function P(w,C,E){return C&&B(w.prototype,C),E&&B(w,E),w}function A(w,C){w.prototype=Object.create(C.prototype),w.prototype.constructor=w,f(w,C)}function f(w,C){return f=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},f(w,C)}var x=function(w){A(C,w);function C(d){var a;return a=w.call(this,d,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var E=C.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},E.registerListeners=function(){var a=this.hls;a.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Y.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var a=this.hls;a.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Y.Events.ERROR,this.onError,this)},E.onMediaAttached=function(a,s){if(this.media=s.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)},E.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},E.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 a=M(this.media.textTracks);a.forEach(function(s){Object(F.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},E.onSubtitleTrackLoaded=function(a,s){var h=s.id,L=s.details,p=this.trackId,v=this.tracksInGroup[p];if(!v){this.warn("Invalid subtitle track id "+h);return}var k=v.details;v.details=s.details,this.log("subtitle track "+h+" loaded ["+L.startSN+"-"+L.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,s,k))},E.onLevelLoading=function(a,s){this.switchLevel(s.level)},E.onLevelSwitching=function(a,s){this.switchLevel(s.level)},E.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var h=s.textGroupIds[s.urlId];if(this.groupId!==h){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!h||b.groupId===h});this.tracksInGroup=p;var v=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=h;var k={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,k),v!==-1&&this.setSubtitleTrack(v,L)}},E.findTrackId=function(a){for(var s=this.tracksInGroup,h=0;h<s.length;h++){var L=s[h];if((!this.selectDefaultTrack||L.default)&&(!a||a===L.name))return L.id}return-1},E.onError=function(a,s){if(w.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},E.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var h=s.id,L=s.groupId,p=s.url;if(a)try{p=a.addDirectives(p)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:p,id:h,groupId:L,deliveryDirectives:a||null})}},E.toggleTrackModes=function(a){var s=this,h=this.media,L=this.subtitleDisplay,p=this.trackId;if(!h)return;var v=M(h.textTracks),k=v.filter(function(c){return c.groupId===s.groupId});if(a===-1)[].slice.call(v).forEach(function(c){c.mode="disabled"});else{var b=k[p];b&&(b.mode="disabled")}var g=k[a];g&&(g.mode=L?"showing":"hidden")},E.setSubtitleTrack=function(a,s){var h,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=L[a])!==null&&h!==void 0&&h.details)||a<-1||a>=L.length)return;this.clearTimer();var p=L[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,p){var v=p.id,k=p.groupId,b=k===void 0?"":k,g=p.name,c=p.type,u=p.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:b,name:g,type:c,url:u});var o=this.switchParams(p.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:a})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=M(this.media.textTracks),h=0;h<s.length;h++)if(s[h].mode==="hidden")a=h;else if(s[h].mode==="showing"){a=h;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},P(C,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),C}(R.default);function M(w){for(var C=[],E=0;E<w.length;E++){var d=w[E];d.kind==="subtitles"&&d.label&&C.push(w[E])}return C}$.default=x},"./src/controller/timeline-controller.ts":function(ne,$,D){"use strict";D.r($),D.d($,"TimelineController",function(){return M});var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),R=D("./src/utils/cea-608-parser.ts"),W=D("./src/utils/output-filter.ts"),B=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),A=D("./src/utils/imsc1-ttml-parser.ts"),f=D("./src/types/loader.ts"),x=D("./src/utils/logger.ts"),M=function(){function d(s){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=E(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.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 h=new W.default(this,"textTrack1"),L=new W.default(this,"textTrack2"),p=new W.default(this,"textTrack3"),v=new W.default(this,"textTrack4");this.cea608Parser1=new R.default(1,h,L),this.cea608Parser2=new R.default(3,p,v)}s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(F.Events.FRAG_LOADING,this.onFragLoading,this),s.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=d.prototype;return a.destroy=function(){var h=this.hls;h.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(F.Events.FRAG_LOADING,this.onFragLoading,this),h.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(h,L,p,v,k){for(var b=!1,g=k.length;g--;){var c=k[g],u=C(c[0],c[1],L,p);if(u>=0&&(c[0]=Math.min(c[0],L),c[1]=Math.max(c[1],p),b=!0,u/(p-L)>.5))return}if(b||k.push([L,p]),this.config.renderTextTracksNatively){var o=this.captionsTracks[h];this.Cues.newCue(o,L,p,v)}else{var T=this.Cues.newCue(null,L,p,v);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:T,track:h})}},a.onInitPtsFound=function(h,L){var p=this,v=L.frag,k=L.id,b=L.initPTS,g=L.timescale,c=this.unparsedVttFrags;k==="main"&&(this.initPTS[v.cc]=b,this.timescale[v.cc]=g),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){p.onFragLoaded(F.Events.FRAG_LOADED,u)}))},a.getExistingTrack=function(h){var L=this.media;if(L)for(var p=0;p<L.textTracks.length;p++){var v=L.textTracks[p];if(v[h])return v}return null},a.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},a.createNativeTrack=function(h){if(this.captionsTracks[h])return;var L=this.captionsProperties,p=this.captionsTracks,v=this.media,k=L[h],b=k.label,g=k.languageCode,c=this.getExistingTrack(h);if(c)p[h]=c,Object(P.clearCurrentCues)(p[h]),Object(P.sendAddTrackEvent)(p[h],v);else{var u=this.createTextTrack("captions",b,g);u&&(u[h]=!0,p[h]=u)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var L=this.captionsProperties[h];if(!L)return;var p=L.label,v={_id:h,label:p,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[h]=v,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[v]})},a.createTextTrack=function(h,L,p){var v=this.media;return v?v.addTextTrack(h,L,p):void 0},a.onMediaAttaching=function(h,L){this.media=L.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(L){Object(P.clearCurrentCues)(h[L]),delete h[L]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),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())},a._cleanTracks=function(){var h=this.media;if(!h)return;var L=h.textTracks;if(L)for(var p=0;p<L.length;p++)Object(P.clearCurrentCues)(L[p])},a.onSubtitleTracksUpdated=function(h,L){var p=this;this.textTracks=[];var v=L.subtitleTracks||[],k=v.some(function(u){return u.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var b=this.tracks&&v&&this.tracks.length===v.length;if(this.tracks=v||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,o){var T;if(o<g.length){for(var S=null,m=0;m<g.length;m++)if(w(g[m],u)){S=g[m];break}S&&(T=S)}T?Object(P.clearCurrentCues)(T):(T=p.createTextTrack("subtitles",u.name,u.lang),T&&(T.mode="disabled")),T&&(T.groupId=u.groupId,p.textTracks.push(T))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},a.onManifestLoaded=function(h,L){var p=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(v){var k=/(?:CC|SERVICE)([1-4])/.exec(v.instreamId);if(!k)return;var b="textTrack"+k[1],g=p.captionsProperties[b];if(!g)return;g.label=v.name,v.lang&&(g.languageCode=v.lang),g.media=v})},a.onFragLoading=function(h,L){var p=this.cea608Parser1,v=this.cea608Parser2,k=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&v))return;if(L.frag.type===f.PlaylistLevelType.MAIN){var g,c,u=L.frag.sn,o=(g=L==null||((c=L.part)===null||c===void 0)?void 0:c.index)!=null?g:-1;u===k+1||u===k&&o===b+1||(p.reset(),v.reset()),this.lastSn=u,this.lastPartIndex=o}},a.onFragLoaded=function(h,L){var p=L.frag,v=L.payload,k=this.initPTS,b=this.unparsedVttFrags;if(p.type===f.PlaylistLevelType.SUBTITLE)if(v.byteLength){if(!Object(Y.isFiniteNumber)(k[p.cc])){b.push(L),k.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var g=p.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var c=this.tracks[p.level],u=this.vttCCs;u[p.cc]||(u[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===A.IMSC1_CODEC?this._parseIMSC1(p,v):this._parseVTTs(p,v,u)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,L){var p=this,v=this.hls;Object(A.parseIMSC1)(L,this.initPTS[h.cc],this.timescale[h.cc],function(k){p._appendCues(k,h.level),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(k){x.logger.log("Failed to parse IMSC1: "+k),v.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:k})})},a._parseVTTs=function(h,L,p){var v=this,k=this.hls;Object(B.parseWebVTT)(L,this.initPTS[h.cc],this.timescale[h.cc],p,h.cc,h.start,function(b){v._appendCues(b,h.level),k.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(b){v._fallbackToIMSC1(h,L),x.logger.log("Failed to parse VTT cue: "+b),k.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:b})})},a._fallbackToIMSC1=function(h,L){var p=this,v=this.tracks[h.level];v.textCodec||Object(A.parseIMSC1)(L,this.initPTS[h.cc],this.timescale[h.cc],function(){v.textCodec=A.IMSC1_CODEC,p._parseIMSC1(h,L)},function(){v.textCodec="wvtt"})},a._appendCues=function(h,L){var p=this.hls;if(this.config.renderTextTracksNatively){var v=this.textTracks[L];if(v.mode==="disabled")return;h.forEach(function(g){return Object(P.addCueToTrack)(v,g)})}else{var k=this.tracks[L],b=k.default?"default":"subtitles"+L;p.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:h,track:b})}},a.onFragDecrypted=function(h,L){var p=L.frag;if(p.type===f.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(F.Events.FRAG_LOADED,L)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,L){var p=this.cea608Parser1,v=this.cea608Parser2;if(!this.enabled||!(p&&v))return;for(var k=0;k<L.samples.length;k++){var b=L.samples[k].bytes;if(b){var g=this.extractCea608Data(b);p.addData(L.samples[k].pts,g[0]),v.addData(L.samples[k].pts,g[1])}}},a.onBufferFlushing=function(h,L){var p=L.startOffset,v=L.endOffset,k=L.endOffsetSubtitles,b=L.type,g=this.media;if(!g||g.currentTime<v)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(o){return Object(P.removeCuesInRange)(c[o],p,v)})}if(this.config.renderTextTracksNatively&&(p===0&&k!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(o){return Object(P.removeCuesInRange)(u[o],p,k)})}},a.extractCea608Data=function(h){for(var L=h[0]&31,p=2,v=[[],[]],k=0;k<L;k++){var b=h[p++],g=127&h[p++],c=127&h[p++],u=(4&b)!==0,o=3&b;if(g===0&&c===0)continue;u&&((o===0||o===1)&&(v[o].push(g),v[o].push(c)))}return v},d}();function w(d,a){return d&&d.label===a.name&&!(d.textTrack1||d.textTrack2)}function C(d,a,s,h){return Math.min(a,h)-Math.max(d,s)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function F(W,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=B}var R=F.prototype;return R.decrypt=function(B,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,B)},F}()},"./src/crypt/aes-decryptor.ts":function(ne,$,D){"use strict";D.r($),D.d($,"removePadding",function(){return F}),D.d($,"default",function(){return R});var Y=D("./src/utils/typed-array.ts");function F(W){var B=W.byteLength,P=B&&new DataView(W.buffer).getUint8(B-1);return P?Object(Y.sliceUint8)(W,0,B-P):W}var R=function(){function W(){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 B=W.prototype;return B.uint8ArrayToUint32Array_=function(A){for(var f=new DataView(A),x=new Uint32Array(4),M=0;M<4;M++)x[M]=f.getUint32(M*4);return x},B.initTable=function(){var A=this.sBox,f=this.invSBox,x=this.subMix,M=x[0],w=x[1],C=x[2],E=x[3],d=this.invSubMix,a=d[0],s=d[1],h=d[2],L=d[3],p=new Uint32Array(256),v=0,k=0,b=0;for(b=0;b<256;b++)b<128?p[b]=b<<1:p[b]=b<<1^283;for(b=0;b<256;b++){var g=k^k<<1^k<<2^k<<3^k<<4;g=g>>>8^g&255^99,A[v]=g,f[g]=v;var c=p[v],u=p[c],o=p[u],T=p[g]*257^g*16843008;M[v]=T<<24|T>>>8,w[v]=T<<16|T>>>16,C[v]=T<<8|T>>>24,E[v]=T,T=o*16843009^u*65537^c*257^v*16843008,a[g]=T<<24|T>>>8,s[g]=T<<16|T>>>16,h[g]=T<<8|T>>>24,L[g]=T,v?(v=c^p[p[p[o^c]]],k^=p[p[k]]):v=k=1}},B.expandKey=function(A){for(var f=this.uint8ArrayToUint32Array_(A),x=!0,M=0;M<f.length&&x;)x=f[M]===this.key[M],M++;if(x)return;this.key=f;var w=this.keySize=f.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var C=this.ksRows=(w+6+1)*4,E,d,a=this.keySchedule=new Uint32Array(C),s=this.invKeySchedule=new Uint32Array(C),h=this.sBox,L=this.rcon,p=this.invSubMix,v=p[0],k=p[1],b=p[2],g=p[3],c,u;for(E=0;E<C;E++){if(E<w){c=a[E]=f[E];continue}u=c,E%w===0?(u=u<<8|u>>>24,u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255],u^=L[E/w|0]<<24):w>6&&E%w===4&&(u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255]),a[E]=c=(a[E-w]^u)>>>0}for(d=0;d<C;d++)E=C-d,d&3?u=a[E]:u=a[E-4],d<4||E<=4?s[d]=u:s[d]=v[h[u>>>24]]^k[h[u>>>16&255]]^b[h[u>>>8&255]]^g[h[u&255]],s[d]=s[d]>>>0},B.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},B.decrypt=function(A,f,x){for(var M=this.keySize+6,w=this.invKeySchedule,C=this.invSBox,E=this.invSubMix,d=E[0],a=E[1],s=E[2],h=E[3],L=this.uint8ArrayToUint32Array_(x),p=L[0],v=L[1],k=L[2],b=L[3],g=new Int32Array(A),c=new Int32Array(g.length),u,o,T,S,m,O,U,j,K,I,N,X,q,se,he=this.networkToHostOrderSwap;f<g.length;){for(K=he(g[f]),I=he(g[f+1]),N=he(g[f+2]),X=he(g[f+3]),m=K^w[0],O=X^w[1],U=N^w[2],j=I^w[3],q=4,se=1;se<M;se++)u=d[m>>>24]^a[O>>16&255]^s[U>>8&255]^h[j&255]^w[q],o=d[O>>>24]^a[U>>16&255]^s[j>>8&255]^h[m&255]^w[q+1],T=d[U>>>24]^a[j>>16&255]^s[m>>8&255]^h[O&255]^w[q+2],S=d[j>>>24]^a[m>>16&255]^s[O>>8&255]^h[U&255]^w[q+3],m=u,O=o,U=T,j=S,q=q+4;u=C[m>>>24]<<24^C[O>>16&255]<<16^C[U>>8&255]<<8^C[j&255]^w[q],o=C[O>>>24]<<24^C[U>>16&255]<<16^C[j>>8&255]<<8^C[m&255]^w[q+1],T=C[U>>>24]<<24^C[j>>16&255]<<16^C[m>>8&255]<<8^C[O&255]^w[q+2],S=C[j>>>24]<<24^C[m>>16&255]<<16^C[O>>8&255]<<8^C[U&255]^w[q+3],c[f]=he(u^p),c[f+1]=he(S^v),c[f+2]=he(T^k),c[f+3]=he(o^b),p=K,v=I,k=N,b=X,f=f+4}return c.buffer},W}()},"./src/crypt/decrypter.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return f});var Y=D("./src/crypt/aes-crypto.ts"),F=D("./src/crypt/fast-aes-key.ts"),R=D("./src/crypt/aes-decryptor.ts"),W=D("./src/utils/logger.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/utils/typed-array.ts"),A=16,f=function(){function x(w,C,E){var d=E===void 0?{}:E,a=d.removePKCS7Padding,s=a===void 0?!0:a;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=C,this.removePKCS7Padding=s,s)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=x.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var E=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(E):E},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(C,E,d,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),E,d);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),E,d).then(a)},M.softwareDecrypt=function(C,E,d){var a=this.currentIV,s=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(C=Object(B.appendUint8Array)(h,C),this.remainderData=null);var L=this.getValidChunk(C);if(!L.length)return null;a&&(d=a);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new R.default),p.expandKey(E);var v=s;return this.currentResult=p.decrypt(L.buffer,0,d),this.currentIV=Object(P.sliceUint8)(L,-16).buffer,v||null},M.webCryptoDecrypt=function(C,E,d){var a=this,s=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new F.default(s,E)),this.fastAesKey.expandKey().then(function(h){if(!s)return Promise.reject(new Error("web crypto not initialized"));var L=new Y.default(s,d);return L.decrypt(C.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,C,E,d)})},M.onWebCryptoError=function(C,E,d,a){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,d,a)},M.getValidChunk=function(C){var E=C,d=C.length-C.length%A;return d!==C.length&&(E=Object(P.sliceUint8)(C,0,d),this.remainderData=Object(P.sliceUint8)(C,d)),E},M.logOnce=function(C){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},x}()},"./src/crypt/fast-aes-key.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function F(W,B){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=B}var R=F.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/adts.ts"),R=D("./src/utils/logger.ts"),W=D("./src/demux/id3.ts");function B(f,x){f.prototype=Object.create(x.prototype),f.prototype.constructor=f,P(f,x)}function P(f,x){return P=Object.setPrototypeOf||function(w,C){return w.__proto__=C,w},P(f,x)}var A=function(f){B(x,f);function x(w,C){var E;return E=f.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=w,E.config=C,E}var M=x.prototype;return M.resetInitSegment=function(C,E,d){f.prototype.resetInitSegment.call(this,C,E,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:d,inputTimeScale:9e4,dropped:0}},x.probe=function(C){if(!C)return!1;for(var E=W.getID3Data(C,0)||[],d=E.length,a=C.length;d<a;d++)if(F.probe(C,d))return R.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(C,E){return F.canParse(C,E)},M.appendFrame=function(C,E,d){F.initTrackConfig(C,this.observer,E,d,C.manifestCodec);var a=F.appendFrame(C,E,d,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},x}(Y.default);A.minProbeByteLength=9,$.default=A},"./src/demux/adts.ts":function(ne,$,D){"use strict";D.r($),D.d($,"getAudioConfig",function(){return W}),D.d($,"isHeaderPattern",function(){return B}),D.d($,"getHeaderLength",function(){return P}),D.d($,"getFullFrameLength",function(){return A}),D.d($,"canGetFrameLength",function(){return f}),D.d($,"isHeader",function(){return x}),D.d($,"canParse",function(){return M}),D.d($,"probe",function(){return w}),D.d($,"initTrackConfig",function(){return C}),D.d($,"getFrameDuration",function(){return E}),D.d($,"parseFrameHeader",function(){return d}),D.d($,"appendFrame",function(){return a});var Y=D("./src/utils/logger.ts"),F=D("./src/errors.ts"),R=D("./src/events.ts");function W(s,h,L,p){var v,k,b,g,c=navigator.userAgent.toLowerCase(),u=p,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];v=((h[L+2]&192)>>>6)+1;var T=(h[L+2]&60)>>>2;if(T>o.length-1){s.trigger(R.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return b=(h[L+2]&1)<<2,b|=(h[L+3]&192)>>>6,Y.logger.log("manifest codec:"+p+", ADTS type:"+v+", samplingIndex:"+T),/firefox/i.test(c)?T>=6?(v=5,g=new Array(4),k=T-3):(v=2,g=new Array(2),k=T):c.indexOf("android")!==-1?(v=2,g=new Array(2),k=T):(v=5,g=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&T>=6?k=T-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(T>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(v=2,g=new Array(2)),k=T)),g[0]=v<<3,g[0]|=(T&14)>>1,g[1]|=(T&1)<<7,g[1]|=b<<3,v===5&&(g[1]|=(k&14)>>1,g[2]=(k&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:o[T],channelCount:b,codec:"mp4a.40."+v,manifestCodec:u}}function B(s,h){return s[h]===255&&(s[h+1]&246)===240}function P(s,h){return s[h+1]&1?7:9}function A(s,h){return(s[h+3]&3)<<11|s[h+4]<<3|(s[h+5]&224)>>>5}function f(s,h){return h+5<s.length}function x(s,h){return h+1<s.length&&B(s,h)}function M(s,h){return f(s,h)&&B(s,h)&&A(s,h)<=s.length-h}function w(s,h){if(x(s,h)){var L=P(s,h);if(h+L>=s.length)return!1;var p=A(s,h);if(p<=L)return!1;var v=h+p;return v===s.length||x(s,v)}return!1}function C(s,h,L,p,v){if(!s.samplerate){var k=W(h,L,p,v);if(!k)return;s.config=k.config,s.samplerate=k.samplerate,s.channelCount=k.channelCount,s.codec=k.codec,s.manifestCodec=k.manifestCodec,Y.logger.log("parsed codec:"+s.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function E(s){return 1024*9e4/s}function d(s,h,L,p,v){var k=P(s,h),b=A(s,h);if(b-=k,b>0){var g=L+p*v;return{headerLength:k,frameLength:b,stamp:g}}}function a(s,h,L,p,v){var k=E(s.samplerate),b=d(h,L,p,v,k);if(b){var g=b.frameLength,c=b.headerLength,u=b.stamp,o=c+g,T=Math.max(0,L+o-h.length),S;T?(S=new Uint8Array(o-c),S.set(h.subarray(L+c,h.length),0)):S=h.subarray(L+c,L+o);var m={unit:S,pts:u};return T||s.samples.push(m),{sample:m,length:o,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(ne,$,D){"use strict";D.r($),D.d($,"initPTSFn",function(){return A});var Y=D("./src/polyfills/number.ts"),F=D("./src/demux/id3.ts"),R=D("./src/demux/dummy-demuxed-track.ts"),W=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/typed-array.ts"),P=function(){function f(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var x=f.prototype;return x.resetInitSegment=function(w,C,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},x.resetTimeStamp=function(){},x.resetContiguity=function(){},x.canParse=function(w,C){return!1},x.appendFrame=function(w,C,E){},x.demux=function(w,C){this.cachedData&&(w=Object(W.appendUint8Array)(this.cachedData,w),this.cachedData=null);var E=F.getID3Data(w,0),d=E?E.length:0,a,s,h=this._audioTrack,L=this._id3Track,p=E?F.getTimeStamp(E):void 0,v=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(p,C)),E&&E.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),s=this.initPTS;d<v;){if(this.canParse(w,d)){var k=this.appendFrame(h,w,d);k?(this.frameIndex++,s=k.sample.pts,d+=k.length,a=d):d=v}else F.canParse(w,d)?(E=F.getID3Data(w,d),L.samples.push({pts:s,dts:s,data:E}),d+=E.length,a=d):d++;if(d===v&&a!==v){var b=Object(B.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:h,avcTrack:Object(R.dummyTrack)(),id3Track:L,textTrack:Object(R.dummyTrack)()}},x.demuxSampleAes=function(w,C,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},x.flush=function(w){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},x.destroy=function(){},f}(),A=function(x,M){return Object(Y.isFiniteNumber)(x)?x*90:M*9e4};$.default=P},"./src/demux/chunk-cache.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function R(){this.chunks=[],this.dataLength=0}var W=R.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,A=this.dataLength,f;if(P.length)P.length===1?f=P[0]:f=F(P,A);else return new Uint8Array(0);return this.reset(),f},W.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function F(R,W){for(var B=new Uint8Array(W),P=0,A=0;A<R.length;A++){var f=R[A];B.set(f,P),P+=f.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ne,$,D){"use strict";D.r($),D.d($,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/utils/logger.ts"),F=function(){function R(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var W=R.prototype;return W.loadWord=function(){var P=this.data,A=this.bytesAvailable,f=P.byteLength-A,x=new Uint8Array(4),M=Math.min(4,A);if(M===0)throw new Error("no bytes available");x.set(P.subarray(f,f+M)),this.word=new DataView(x.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},W.skipBits=function(P){var A;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,A=P>>3,P-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var A=Math.min(this.bitsAvailable,P),f=this.word>>>32-A;return P>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=P-A,A>0&&this.bitsAvailable?f<<A|this.readBits(A):f},W.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(P){for(var A=8,f=8,x,M=0;M<P;M++)f!==0&&(x=this.readEG(),f=(A+x+256)%256),A=f===0?A:f},W.readSPS=function(){var P=0,A=0,f=0,x=0,M,w,C,E=this.readUByte.bind(this),d=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),h=this.skipBits.bind(this),L=this.skipEG.bind(this),p=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);E();var k=E();if(d(5),h(3),E(),p(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var b=a();if(b===3&&h(1),p(),p(),h(1),s())for(w=b!==3?8:12,C=0;C<w;C++)s()&&(C<6?v(16):v(64))}p();var g=a();if(g===0)a();else if(g===1)for(h(1),L(),L(),M=a(),C=0;C<M;C++)L();p(),h(1);var c=a(),u=a(),o=d(1);o===0&&h(1),h(1),s()&&(P=a(),A=a(),f=a(),x=a());var T=[1,1];if(s()&&s()){var S=E();switch(S){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=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((c+1)*16-P*2-A*2),height:(2-o)*(u+1)*16-(o?2:4)*(f+x),pixelRatio:T}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();$.default=F},"./src/demux/id3.ts":function(ne,$,D){"use strict";D.r($),D.d($,"isHeader",function(){return Y}),D.d($,"isFooter",function(){return F}),D.d($,"getID3Data",function(){return R}),D.d($,"canParse",function(){return B}),D.d($,"getTimeStamp",function(){return P}),D.d($,"isTimeStampFrame",function(){return A}),D.d($,"getID3Frames",function(){return x}),D.d($,"decodeFrame",function(){return M}),D.d($,"utf8ArrayToStr",function(){return a}),D.d($,"testables",function(){return s});var Y=function(v,k){return k+10<=v.length&&(v[k]===73&&v[k+1]===68&&v[k+2]===51&&(v[k+3]<255&&v[k+4]<255&&(v[k+6]<128&&v[k+7]<128&&v[k+8]<128&&v[k+9]<128)))},F=function(v,k){return k+10<=v.length&&(v[k]===51&&v[k+1]===68&&v[k+2]===73&&(v[k+3]<255&&v[k+4]<255&&(v[k+6]<128&&v[k+7]<128&&v[k+8]<128&&v[k+9]<128)))},R=function(v,k){for(var b=k,g=0;Y(v,k);){g+=10;var c=W(v,k+6);g+=c,F(v,k+10)&&(g+=10),k+=g}return g>0?v.subarray(b,b+g):void 0},W=function(v,k){var b=0;return b=(v[k]&127)<<21,b|=(v[k+1]&127)<<14,b|=(v[k+2]&127)<<7,b|=v[k+3]&127,b},B=function(v,k){return Y(v,k)&&W(v,k+6)+10<=v.length-k},P=function(v){for(var k=x(v),b=0;b<k.length;b++){var g=k[b];if(A(g))return d(g)}return},A=function(v){return v&&v.key==="PRIV"&&v.info==="com.apple.streaming.transportStreamTimestamp"},f=function(v){var k=String.fromCharCode(v[0],v[1],v[2],v[3]),b=W(v,4),g=10;return{type:k,size:b,data:v.subarray(g,g+b)}},x=function(v){for(var k=0,b=[];Y(v,k);){var g=W(v,k+6);k+=10;for(var c=k+g;k+8<c;){var u=f(v.subarray(k)),o=M(u);o&&b.push(o),k+=u.size+10}F(v,k)&&(k+=10)}return b},M=function(v){return v.type==="PRIV"?w(v):v.type[0]==="W"?E(v):C(v)},w=function(v){if(v.size<2)return;var k=a(v.data,!0),b=new Uint8Array(v.data.subarray(k.length+1));return{key:v.type,info:k,data:b.buffer}},C=function(v){if(v.size<2)return;if(v.type==="TXXX"){var k=1,b=a(v.data.subarray(k),!0);k+=b.length+1;var g=a(v.data.subarray(k));return{key:v.type,info:b,data:g}}var c=a(v.data.subarray(1));return{key:v.type,data:c}},E=function(v){if(v.type==="WXXX"){if(v.size<2)return;var k=1,b=a(v.data.subarray(k),!0);k+=b.length+1;var g=a(v.data.subarray(k));return{key:v.type,info:b,data:g}}var c=a(v.data);return{key:v.type,data:c}},d=function(v){if(v.data.byteLength===8){var k=new Uint8Array(v.data),b=k[3]&1,g=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return g/=45,b&&(g+=4772185884e-2),Math.round(g)}return},a=function(v,k){k===void 0&&(k=!1);var b=L();if(b){var g=b.decode(v);if(k){var c=g.indexOf("\0");return c!==-1?g.substring(0,c):g}return g.replace(/\0/g,"")}for(var u=v.length,o,T,S,m="",O=0;O<u;){if(o=v[O++],o===0&&k)return m;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:m+=String.fromCharCode(o);break;case 12:case 13:T=v[O++],m+=String.fromCharCode((o&31)<<6|T&63);break;case 14:T=v[O++],S=v[O++],m+=String.fromCharCode((o&15)<<12|(T&63)<<6|(S&63)<<0);break;default:}}return m},s={decodeTextFrame:C},h;function L(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/id3.ts"),R=D("./src/utils/logger.ts"),W=D("./src/demux/mpegaudio.ts");function B(f,x){f.prototype=Object.create(x.prototype),f.prototype.constructor=f,P(f,x)}function P(f,x){return P=Object.setPrototypeOf||function(w,C){return w.__proto__=C,w},P(f,x)}var A=function(f){B(x,f);function x(){return f.apply(this,arguments)||this}var M=x.prototype;return M.resetInitSegment=function(C,E,d){f.prototype.resetInitSegment.call(this,C,E,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:d,inputTimeScale:9e4,dropped:0}},x.probe=function(C){if(!C)return!1;for(var E=F.getID3Data(C,0)||[],d=E.length,a=C.length;d<a;d++)if(W.probe(C,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(C,E){return W.canParse(C,E)},M.appendFrame=function(C,E,d){return this.initPTS===null?void 0:W.appendFrame(C,E,d,this.initPTS,this.frameIndex)},x}(Y.default);A.minProbeByteLength=4,$.default=A},"./src/demux/mp4demuxer.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/utils/mp4-tools.ts"),F=D("./src/demux/dummy-demuxed-track.ts"),R=function(){function W(P,A){this.remainderData=null,this.config=void 0,this.config=A}var B=W.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},W.probe=function(A){return Object(Y.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},B.demux=function(A){var f=A,x=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(f=Object(Y.appendUint8Array)(this.remainderData,A));var M=Object(Y.segmentValidRange)(f);this.remainderData=M.remainder,x.samples=M.valid||new Uint8Array}else x.samples=f;return{audioTrack:Object(F.dummyTrack)(),avcTrack:x,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.flush=function(){var A=Object(F.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:A,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.demuxSampleAes=function(A,f,x){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},W}();R.minProbeByteLength=1024,$.default=R},"./src/demux/mpegaudio.ts":function(ne,$,D){"use strict";D.r($),D.d($,"appendFrame",function(){return P}),D.d($,"parseHeader",function(){return A}),D.d($,"isHeaderPattern",function(){return f}),D.d($,"isHeader",function(){return x}),D.d($,"canParse",function(){return M}),D.d($,"probe",function(){return w});var Y=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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function P(C,E,d,a,s){if(d+24>E.length)return;var h=A(E,d);if(h&&d+h.frameLength<=E.length){var L=h.samplesPerFrame*9e4/h.sampleRate,p=a+s*L,v={unit:E.subarray(d,d+h.frameLength),pts:p,dts:p};return C.config=[],C.channelCount=h.channelCount,C.samplerate=h.sampleRate,C.samples.push(v),{sample:v,length:h.frameLength,missing:0}}}function A(C,E){var d=C[E+1]>>3&3,a=C[E+1]>>1&3,s=C[E+2]>>4&15,h=C[E+2]>>2&3;if(d!==1&&s!==0&&s!==15&&h!==3){var L=C[E+2]>>1&1,p=C[E+3]>>6,v=d===3?3-a:a===3?3:4,k=F[v*14+s-1]*1e3,b=d===3?0:d===2?1:2,g=R[b*3+h],c=p===3?1:2,u=W[d][a],o=B[a],T=u*8*o,S=Math.floor(u*k/g+L)*o;if(Y===null){var m=navigator.userAgent||"",O=m.match(/Chrome\/(\d+)/i);Y=O?parseInt(O[1]):0}var U=!!Y&&Y<=87;return U&&a===2&&k>=224e3&&p===0&&(C[E+3]=C[E+3]|128),{sampleRate:g,channelCount:c,frameLength:S,samplesPerFrame:T}}}function f(C,E){return C[E]===255&&(C[E+1]&224)===224&&(C[E+1]&6)!==0}function x(C,E){return E+1<C.length&&f(C,E)}function M(C,E){var d=4;return f(C,E)&&d<=C.length-E}function w(C,E){if(E+1<C.length&&f(C,E)){var d=4,a=A(C,E),s=d;a!=null&&a.frameLength&&(s=a.frameLength);var h=E+s;return h===C.length||x(C,h)}return!1}},"./src/demux/sample-aes.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/crypt/decrypter.ts"),F=D("./src/demux/tsdemuxer.ts"),R=function(){function W(P,A,f){this.keyData=void 0,this.decrypter=void 0,this.keyData=f,this.decrypter=new Y.default(P,A,{removePKCS7Padding:!1})}var B=W.prototype;return B.decryptBuffer=function(A,f){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,f)},B.decryptAacSample=function(A,f,x,M){var w=A[f].unit,C=w.subarray(16,w.length-w.length%16),E=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),d=this;this.decryptBuffer(E,function(a){var s=new Uint8Array(a);w.set(s,16),M||d.decryptAacSamples(A,f+1,x)})},B.decryptAacSamples=function(A,f,x){for(;;f++){if(f>=A.length){x();return}if(A[f].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(A,f,x,M),!M)return}},B.getAvcEncryptedData=function(A){for(var f=Math.floor((A.length-48)/160)*16+16,x=new Int8Array(f),M=0,w=32;w<=A.length-16;w+=160,M+=16)x.set(A.subarray(w,w+16),M);return x},B.getAvcDecryptedUnit=function(A,f){for(var x=new Uint8Array(f),M=0,w=32;w<=A.length-16;w+=160,M+=16)A.set(x.subarray(M,M+16),w);return A},B.decryptAvcSample=function(A,f,x,M,w,C){var E=Object(F.discardEPB)(w.data),d=this.getAvcEncryptedData(E),a=this;this.decryptBuffer(d.buffer,function(s){w.data=a.getAvcDecryptedUnit(E,s),C||a.decryptAvcSamples(A,f,x+1,M)})},B.decryptAvcSamples=function(A,f,x,M){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;f++,x=0){if(f>=A.length){M();return}for(var w=A[f].units;!(x>=w.length);x++){var C=w[x];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(A,f,x,M,C,E),!E)return}}},W}();$.default=R},"./src/demux/transmuxer-interface.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./node_modules/webworkify-webpack/index.js"),F=D.n(Y),R=D("./src/events.ts"),W=D("./src/demux/transmuxer.ts"),B=D("./src/utils/logger.ts"),P=D("./src/errors.ts"),A=D("./src/utils/mediasource-helper.ts"),f=D("./node_modules/eventemitter3/index.js"),x=D.n(f),M=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function C(d,a,s,h){var L=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=a,this.onTransmuxComplete=s,this.onFlush=h;var p=d.config,v=function(u,o){o=o||{},o.frag=L.frag,o.id=L.id,d.trigger(u,o)};this.observer=new f.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,v),this.observer.on(R.Events.ERROR,v);var k={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var g;try{g=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(c){d.trigger(R.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},g.postMessage({cmd:"init",typeSupported:k,vendor:b,id:a,config:JSON.stringify(p)})}catch(c){B.logger.warn("Error in worker:",c),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new W.default(this.observer,k,p,b,a),this.worker=null}}else this.transmuxer=new W.default(this.observer,k,p,b,a)}var E=C.prototype;return E.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},E.push=function(a,s,h,L,p,v,k,b,g,c){var u=this;g.transmuxing.start=self.performance.now();var o=this.transmuxer,T=this.worker,S=v?v.start:p.start,m=p.decryptdata,O=this.frag,U=!(O&&p.cc===O.cc),j=!(O&&g.level===O.level),K=O?g.sn-O.sn:-1,I=this.part?g.part-this.part.index:1,N=!j&&(K===1||K===0&&I===1),X=self.performance.now();(j||K||p.stats.parsing.start===0)&&(p.stats.parsing.start=X),v&&(I||!N)&&(v.stats.parsing.start=X);var q=new W.TransmuxState(U,N,b,j,S);if(!N||U){B.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
discontinuity: `+U+`
trackSwitch: `+j+`
contiguous: `+N+`
accurateTimeOffset: `+b+`
timeOffset: `+S);var se=new W.TransmuxConfig(h,L,s,k,c);this.configureTransmuxer(se)}if(this.frag=p,this.part=v,T)T.postMessage({cmd:"demux",data:a,decryptdata:m,chunkMeta:g,state:q},a instanceof ArrayBuffer?[a]:[]);else if(o){var he=o.push(a,m,g,q);Object(W.isPromise)(he)?he.then(function(Ae){u.handleTransmuxComplete(Ae)}):this.handleTransmuxComplete(he)}},E.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:a});else if(h){var p=h.flush(a);Object(W.isPromise)(p)?p.then(function(v){s.handleFlushResult(v,a)}):this.handleFlushResult(p,a)}},E.handleFlushResult=function(a,s){var h=this;a.forEach(function(L){h.handleTransmuxComplete(L)}),this.onFlush(s)},E.onWorkerMessage=function(a){var s=a.data,h=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,h.trigger(s.event,s.data);break}}},E.configureTransmuxer=function(a){var s=this.worker,h=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},E.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},C}()},"./src/demux/transmuxer-worker.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return P});var Y=D("./src/demux/transmuxer.ts"),F=D("./src/events.ts"),R=D("./src/utils/logger.ts"),W=D("./node_modules/eventemitter3/index.js"),B=D.n(W);function P(w){var C=new W.EventEmitter,E=function(a,s){w.postMessage({event:a,data:s})};C.on(F.Events.FRAG_DECRYPTED,E),C.on(F.Events.ERROR,E),w.addEventListener("message",function(d){var a=d.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);w.transmuxer=new Y.default(C,a.typeSupported,s,a.vendor,a.id),Object(R.enableLogs)(s.debug),E("init",null);break}case"configure":{w.transmuxer.configure(a.config);break}case"demux":{var h=w.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Y.isPromise)(h)?h.then(function(v){A(w,v)}):A(w,h);break}case"flush":{var L=a.chunkMeta,p=w.transmuxer.flush(L);Object(Y.isPromise)(p)?p.then(function(v){x(w,v,L)}):x(w,p,L);break}default:break}})}function A(w,C){if(M(C.remuxResult))return;var E=[],d=C.remuxResult,a=d.audio,s=d.video;a&&f(E,a),s&&f(E,s),w.postMessage({event:"transmuxComplete",data:C},E)}function f(w,C){C.data1&&w.push(C.data1.buffer),C.data2&&w.push(C.data2.buffer)}function x(w,C,E){C.forEach(function(d){A(w,d)}),w.postMessage({event:"flush",data:E})}function M(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return s}),D.d($,"isPromise",function(){return p}),D.d($,"TransmuxConfig",function(){return v}),D.d($,"TransmuxState",function(){return k});var Y=D("./src/events.ts"),F=D("./src/errors.ts"),R=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),B=D("./src/demux/mp4demuxer.ts"),P=D("./src/demux/tsdemuxer.ts"),A=D("./src/demux/mp3demuxer.ts"),f=D("./src/remux/mp4-remuxer.ts"),x=D("./src/remux/passthrough-remuxer.ts"),M=D("./src/demux/chunk-cache.ts"),w=D("./src/utils/mp4-tools.ts"),C=D("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(b){C.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var d=[{demux:P.default,remux:f.default},{demux:B.default,remux:x.default},{demux:W.default,remux:f.default},{demux:A.default,remux:f.default}],a=1024;d.forEach(function(b){var g=b.demux;a=Math.max(a,g.minProbeByteLength)});var s=function(){function b(c,u,o,T,S){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 M.default,this.observer=c,this.typeSupported=u,this.config=o,this.vendor=T,this.id=S}var g=b.prototype;return g.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},g.push=function(u,o,T,S){var m=this,O=T.transmuxing;O.executeStart=E();var U=new Uint8Array(u),j=this.cache,K=this.config,I=this.currentTransmuxState,N=this.transmuxConfig;S&&(this.currentTransmuxState=S);var X=h(U,o);if(X&&X.method==="AES-128"){var q=this.getDecrypter();if(K.enableSoftwareAES){var se=q.softwareDecrypt(U,X.key.buffer,X.iv.buffer);if(!se)return O.executeEnd=E(),L(T);U=new Uint8Array(se)}else return this.decryptionPromise=q.webCryptoDecrypt(U,X.key.buffer,X.iv.buffer).then(function(Oe){var Ie=m.push(Oe,null,T);return m.decryptionPromise=null,Ie}),this.decryptionPromise}var he=S||I,Ae=he.contiguous,be=he.discontinuity,Te=he.trackSwitch,Ce=he.accurateTimeOffset,Se=he.timeOffset,pe=N.audioCodec,ue=N.videoCodec,te=N.defaultInitPts,fe=N.duration,ae=N.initSegmentData;if((be||Te)&&this.resetInitSegment(ae,pe,ue,fe),be&&this.resetInitialTimestamp(te),Ae||this.resetContiguity(),this.needsProbing(U,be,Te)){if(j.dataLength){var _e=j.flush();U=Object(w.appendUint8Array)(_e,U)}this.configureTransmuxer(U,N)}var De=this.transmux(U,X,Se,Ce,T),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,O.executeEnd=E(),De},g.flush=function(u){var o=this,T=u.transmuxing;T.executeStart=E();var S=this.decrypter,m=this.cache,O=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return o.flush(u)});var j=[],K=O.timeOffset;if(S){var I=S.flush();I&&j.push(this.push(I,null,u))}var N=m.dataLength;m.reset();var X=this.demuxer,q=this.remuxer;if(!X||!q)return N>=a&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=E(),[L(u)];var se=X.flush(K);return p(se)?se.then(function(he){return o.flushRemux(j,he,u),j}):(this.flushRemux(j,se,u),j)},g.flushRemux=function(u,o,T){var S=o.audioTrack,m=o.avcTrack,O=o.id3Track,U=o.textTrack,j=this.currentTransmuxState,K=j.accurateTimeOffset,I=j.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var N=this.remuxer.remux(S,m,O,U,I,K,!0,this.id);u.push({remuxResult:N,chunkMeta:T}),T.transmuxing.executeEnd=E()},g.resetInitialTimestamp=function(u){var o=this.demuxer,T=this.remuxer;if(!o||!T)return;o.resetTimeStamp(u),T.resetTimeStamp(u)},g.resetContiguity=function(){var u=this.demuxer,o=this.remuxer;if(!u||!o)return;u.resetContiguity(),o.resetNextTimestamp()},g.resetInitSegment=function(u,o,T,S){var m=this.demuxer,O=this.remuxer;if(!m||!O)return;m.resetInitSegment(o,T,S),O.resetInitSegment(u,o,T)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(u,o,T,S,m){var O;return o&&o.method==="SAMPLE-AES"?O=this.transmuxSampleAes(u,o,T,S,m):O=this.transmuxUnencrypted(u,T,S,m),O},g.transmuxUnencrypted=function(u,o,T,S){var m=this.demuxer.demux(u,o,!1,!this.config.progressive),O=m.audioTrack,U=m.avcTrack,j=m.id3Track,K=m.textTrack,I=this.remuxer.remux(O,U,j,K,o,T,!1,this.id);return{remuxResult:I,chunkMeta:S}},g.transmuxSampleAes=function(u,o,T,S,m){var O=this;return this.demuxer.demuxSampleAes(u,o,T).then(function(U){var j=O.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,T,S,!1,O.id);return{remuxResult:j,chunkMeta:m}})},g.configureTransmuxer=function(u,o){for(var T=this.config,S=this.observer,m=this.typeSupported,O=this.vendor,U=o.audioCodec,j=o.defaultInitPts,K=o.duration,I=o.initSegmentData,N=o.videoCodec,X,q=0,se=d.length;q<se;q++)if(d[q].demux.probe(u)){X=d[q];break}X||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:B.default,remux:x.default});var he=this.demuxer,Ae=this.remuxer,be=X.remux,Te=X.demux;(!Ae||!(Ae instanceof be))&&(this.remuxer=new be(S,T,m,O)),(!he||!(he instanceof Te))&&(this.demuxer=new Te(S,T,m),this.probe=Te.probe),this.resetInitSegment(I,U,N,K),this.resetInitialTimestamp(j)},g.needsProbing=function(u,o,T){return!this.demuxer||!this.remuxer||o||T},g.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new R.default(this.observer,this.config)),u},b}();function h(b,g){var c=null;return b.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(c=g),c}var L=function(g){return{remuxResult:{},chunkMeta:g}};function p(b){return"then"in b&&b.then instanceof Function}var v=function(g,c,u,o,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=c,this.initSegmentData=u,this.duration=o,this.defaultInitPts=T},k=function(g,c,u,o,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=o,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(ne,$,D){"use strict";D.r($),D.d($,"discardEPB",function(){return L});var Y=D("./src/demux/adts.ts"),F=D("./src/demux/mpegaudio.ts"),R=D("./src/demux/exp-golomb.ts"),W=D("./src/demux/id3.ts"),B=D("./src/demux/sample-aes.ts"),P=D("./src/events.ts"),A=D("./src/utils/mp4-tools.ts"),f=D("./src/utils/logger.ts"),x=D("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},w=function(){function p(k,b,g){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=k,this.config=b,this.typeSupported=g}p.probe=function(b){var g=p.syncOffset(b);return g<0?!1:(g&&f.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var g=Math.min(1e3,b.length-3*188),c=0;c<g;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,g){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:M[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?g:void 0}};var v=p.prototype;return v.resetInitSegment=function(b,g,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",c),this._audioTrack=p.createTrack("audio",c),this._id3Track=p.createTrack("id3",c),this._txtTrack=p.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=g,this._duration=c},v.resetTimeStamp=function(){},v.resetContiguity=function(){var b=this._audioTrack,g=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),g&&(g.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},v.demux=function(b,g,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var o,T=this._avcTrack,S=this._audioTrack,m=this._id3Track,O=T.pid,U=T.pesData,j=S.pid,K=m.pid,I=S.pesData,N=m.pesData,X=!1,q=this.pmtParsed,se=this._pmtId,he=b.length;if(this.remainderData&&(b=Object(A.appendUint8Array)(this.remainderData,b),he=b.length,this.remainderData=null),he<188&&!u)return this.remainderData=b,{audioTrack:S,avcTrack:T,id3Track:m,textTrack:this._txtTrack};var Ae=Math.max(0,p.syncOffset(b));he-=(he+Ae)%188,he<b.byteLength&&!u&&(this.remainderData=new Uint8Array(b.buffer,he,b.buffer.byteLength-he));for(var be=Ae;be<he;be+=188)if(b[be]===71){var Te=!!(b[be+1]&64),Ce=((b[be+1]&31)<<8)+b[be+2],Se=(b[be+3]&48)>>4,pe=void 0;if(Se>1){if(pe=be+5+b[be+4],pe===be+188)continue}else pe=be+4;switch(Ce){case O:Te&&(U&&(o=a(U))&&this.parseAVCPES(o,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(pe,be+188)),U.size+=be+188-pe);break;case j:Te&&(I&&(o=a(I))&&(S.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),I={data:[],size:0}),I&&(I.data.push(b.subarray(pe,be+188)),I.size+=be+188-pe);break;case K:Te&&(N&&(o=a(N))&&this.parseID3PES(o),N={data:[],size:0}),N&&(N.data.push(b.subarray(pe,be+188)),N.size+=be+188-pe);break;case 0:Te&&(pe+=b[pe]+1),se=this._pmtId=E(b,pe);break;case se:{Te&&(pe+=b[pe]+1);var ue=d(b,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);O=ue.avc,O>0&&(T.pid=O),j=ue.audio,j>0&&(S.pid=j,S.isAAC=ue.isAAC),K=ue.id3,K>0&&(m.pid=K),X&&!q&&(f.logger.log("reparse from beginning"),X=!1,be=Ae-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=U,S.pesData=I,m.pesData=N;var te={audioTrack:S,avcTrack:T,id3Track:m,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(te),te},v.flush=function(){var b=this.remainderData;this.remainderData=null;var g;return b?g=this.demux(b,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},v.extractRemainingSamples=function(b){var g=b.audioTrack,c=b.avcTrack,u=b.id3Track,o=c.pesData,T=g.pesData,S=u.pesData,m;o&&(m=a(o))?(this.parseAVCPES(m,!0),c.pesData=null):c.pesData=o,T&&(m=a(T))?(g.isAAC?this.parseAACPES(m):this.parseMPEGPES(m),g.pesData=null):(T!=null&&T.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=T),S&&(m=a(S))?(this.parseID3PES(m),u.pesData=null):u.pesData=S},v.demuxSampleAes=function(b,g,c){var u=this.demux(b,c,!0,!this.config.progressive),o=this.sampleAes=new B.default(this.observer,this.config,g);return this.decrypt(u,o)},v.decrypt=function(b,g){return new Promise(function(c){var u=b.audioTrack,o=b.avcTrack;u.samples&&u.isAAC?g.decryptAacSamples(u.samples,0,function(){o.samples?g.decryptAvcSamples(o.samples,0,0,function(){c(b)}):c(b)}):o.samples&&g.decryptAvcSamples(o.samples,0,0,function(){c(b)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(b,g){var c=this,u=this._avcTrack,o=this.parseAVCNALu(b.data),T=!1,S=this.avcSample,m,O=!1;b.data=null,S&&o.length&&!u.audFound&&(s(S,u),S=this.avcSample=C(!1,b.pts,b.dts,"")),o.forEach(function(U){switch(U.type){case 1:{m=!0,S||(S=c.avcSample=C(!0,b.pts,b.dts,"")),T&&(S.debug+="NDR "),S.frame=!0;var j=U.data;if(O&&j.length>4){var K=new R.default(j).readSliceType();(K===2||K===4||K===7||K===9)&&(S.key=!0)}break}case 5:m=!0,S||(S=c.avcSample=C(!0,b.pts,b.dts,"")),T&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{m=!0,T&&S&&(S.debug+="SEI ");var I=new R.default(L(U.data));I.readUByte();for(var N=0,X=0,q=!1,se=0;!q&&I.bytesAvailable>1;){N=0;do se=I.readUByte(),N+=se;while(se===255);X=0;do se=I.readUByte(),X+=se;while(se===255);if(N===4&&I.bytesAvailable!==0){q=!0;var he=I.readUByte();if(he===181){var Ae=I.readUShort();if(Ae===49){var be=I.readUInt();if(be===1195456820){var Te=I.readUByte();if(Te===3){for(var Ce=I.readUByte(),Se=I.readUByte(),pe=31&Ce,ue=[Ce,Se],te=0;te<pe;te++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());h(c._txtTrack.samples,{type:3,pts:b.pts,bytes:ue})}}}}}else if(N===5&&I.bytesAvailable!==0){if(q=!0,X>16){for(var fe=[],ae=0;ae<16;ae++)fe.push(I.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&fe.push("-");for(var _e=X-16,De=new Uint8Array(_e),xe=0;xe<_e;xe++)De[xe]=I.readUByte();h(c._txtTrack.samples,{pts:b.pts,payloadType:N,uuid:fe.join(""),userData:Object(W.utf8ArrayToStr)(De),userDataBytes:De})}}else if(X<I.bytesAvailable)for(var Oe=0;Oe<X;Oe++)I.readUByte()}break}case 7:if(m=!0,O=!0,T&&S&&(S.debug+="SPS "),!u.sps){var Ie=new R.default(U.data),Ue=Ie.readSPS();u.width=Ue.width,u.height=Ue.height,u.pixelRatio=Ue.pixelRatio,u.sps=[U.data],u.duration=c._duration;for(var We=U.data.subarray(1,4),Be="avc1.",Fe=0;Fe<3;Fe++){var it=We[Fe].toString(16);it.length<2&&(it="0"+it),Be+=it}u.codec=Be}break;case 8:m=!0,T&&S&&(S.debug+="PPS "),u.pps||(u.pps=[U.data]);break;case 9:m=!1,u.audFound=!0,S&&s(S,u),S=c.avcSample=C(!1,b.pts,b.dts,T?"AUD ":"");break;case 12:m=!1;break;default:m=!1,S&&(S.debug+="unknown NAL "+U.type+" ");break}if(S&&m){var et=S.units;et.push(U)}}),g&&S&&(s(S,u),this.avcSample=null)},v.getLastNalUnit=function(){var b,g=this.avcSample,c;if(!g||g.units.length===0){var u=this._avcTrack.samples;g=u[u.length-1]}if((b=g)!==null&&b!==void 0&&b.units){var o=g.units;c=o[o.length-1]}return c},v.parseAVCNALu=function(b){var g=b.byteLength,c=this._avcTrack,u=c.naluState||0,o=u,T=[],S=0,m,O,U,j=-1,K=0;for(u===-1&&(j=0,K=b[0]&31,u=0,S=1);S<g;){if(m=b[S++],!u){u=m?0:1;continue}if(u===1){u=m?0:2;continue}if(!m)u=3;else if(m===1){if(j>=0){var I={data:b.subarray(j,S-u-1),type:K};T.push(I)}else{var N=this.getLastNalUnit();if(N&&(o&&S<=4-o&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-o))),O=S-u-1,O>0)){var X=new Uint8Array(N.data.byteLength+O);X.set(N.data,0),X.set(b.subarray(0,O),N.data.byteLength),N.data=X,N.state=0}}S<g?(U=b[S]&31,j=S,K=U,u=0):u=-1}else u=0}if(j>=0&&u>=0){var q={data:b.subarray(j,g),type:K,state:u};T.push(q)}if(T.length===0){var se=this.getLastNalUnit();if(se){var he=new Uint8Array(se.data.byteLength+b.byteLength);he.set(se.data,0),he.set(b,se.data.byteLength),se.data=he}}return c.naluState=u,T},v.parseAACPES=function(b){var g=0,c=this._audioTrack,u=this.aacOverFlow,o=b.data;if(u){this.aacOverFlow=null;var T=u.sample.unit.byteLength,S=Math.min(u.missing,T),m=T-S;u.sample.unit.set(o.subarray(0,S),m),c.samples.push(u.sample),g=u.missing}var O,U;for(O=g,U=o.length;O<U-1&&!Y.isHeader(o,O);O++);if(O!==g){var j,K;if(O<U-1?(j="AAC PES did not start with ADTS header,offset:"+O,K=!1):(j="no ADTS header found in AAC PES",K=!0),f.logger.warn("parsing error:"+j),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:K,reason:j}),K)return}Y.initTrackConfig(c,this.observer,o,O,this.audioCodec);var I;if(b.pts!==void 0)I=b.pts;else if(u){var N=Y.getFrameDuration(c.samplerate);I=u.sample.pts+N}else{f.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;O<U;)if(Y.isHeader(o,O)){if(O+5<U){var q=Y.appendFrame(c,o,O,I,X);if(q)if(q.missing)this.aacOverFlow=q;else{O+=q.length,X++;continue}}break}else O++},v.parseMPEGPES=function(b){var g=b.data,c=g.length,u=0,o=0,T=b.pts;if(T===void 0){f.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<c;)if(F.isHeader(g,o)){var S=F.appendFrame(this._audioTrack,g,o,T,u);if(S)o+=S.length,u++;else break}else o++},v.parseID3PES=function(b){if(b.pts===void 0){f.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();w.minProbeByteLength=188;function C(p,v,k,b){return{key:p,frame:!1,pts:v,dts:k,units:[],debug:b,length:0}}function E(p,v){return(p[v+10]&31)<<8|p[v+11]}function d(p,v,k,b){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[v+1]&15)<<8|p[v+2],u=v+3+c-4,o=(p[v+10]&15)<<8|p[v+11];for(v+=12+o;v<u;){var T=(p[v+1]&31)<<8|p[v+2];switch(p[v]){case 207:if(!b){f.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=T);break;case 21:g.id3===-1&&(g.id3=T);break;case 219:if(!b){f.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=T);break;case 3:case 4:k?g.audio===-1&&(g.audio=T,g.isAAC=!1):f.logger.log("MPEG audio found, not supported in this browser");break;case 36:f.logger.warn("Unsupported HEVC stream type found");break;default:break}v+=((p[v+3]&15)<<8|p[v+4])+5}return g}function a(p){var v=0,k,b,g,c,u,o=p.data;if(!p||p.size===0)return null;for(;o[0].length<19&&o.length>1;){var T=new Uint8Array(o[0].length+o[1].length);T.set(o[0]),T.set(o[1],o[0].length),o[0]=T,o.splice(1,1)}k=o[0];var S=(k[0]<<16)+(k[1]<<8)+k[2];if(S===1){if(b=(k[4]<<8)+k[5],b&&b>p.size-6)return null;var m=k[7];m&192&&(c=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,m&64?(u=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,c-u>60*9e4&&(f.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),g=k[8];var O=g+9;if(p.size<=O)return null;p.size-=O;for(var U=new Uint8Array(p.size),j=0,K=o.length;j<K;j++){k=o[j];var I=k.byteLength;if(O)if(O>I){O-=I;continue}else k=k.subarray(O),I-=O,O=0;U.set(k,v),v+=I}return b&&(b-=g+3),{data:U,pts:c,dts:u,len:b}}return null}function s(p,v){if(p.units.length&&p.frame){if(p.pts===void 0){var k=v.samples,b=k.length;if(b){var g=k[b-1];p.pts=g.pts,p.dts=g.dts}else{v.dropped++;return}}v.samples.push(p)}p.debug.length&&f.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function h(p,v){var k=p.length;if(k>0){if(v.pts>=p[k-1].pts)p.push(v);else for(var b=k-1;b>=0;b--)if(v.pts<p[b].pts){p.splice(b,0,v);break}}else p.push(v)}function L(p){for(var v=p.byteLength,k=[],b=1;b<v-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(k.push(b+2),b+=2):b++;if(k.length===0)return p;var g=v-k.length,c=new Uint8Array(g),u=0;for(b=0;b<g;u++,b++)u===k[0]&&(u++,k.shift()),c[b]=p[u];return c}$.default=w},"./src/errors.ts":function(ne,$,D){"use strict";D.r($),D.d($,"ErrorTypes",function(){return Y}),D.d($,"ErrorDetails",function(){return F});var Y;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(Y||(Y={}));var F;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(ne,$,D){"use strict";D.r($),D.d($,"Events",function(){return Y});var Y;(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"})(Y||(Y={}))},"./src/hls.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return p});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(Y),R=D("./src/loader/playlist-loader.ts"),W=D("./src/loader/key-loader.ts"),B=D("./src/controller/id3-track-controller.ts"),P=D("./src/controller/latency-controller.ts"),A=D("./src/controller/level-controller.ts"),f=D("./src/controller/fragment-tracker.ts"),x=D("./src/controller/stream-controller.ts"),M=D("./src/is-supported.ts"),w=D("./src/utils/logger.ts"),C=D("./src/config.ts"),E=D("./node_modules/eventemitter3/index.js"),d=D.n(E),a=D("./src/events.ts"),s=D("./src/errors.ts");function h(v,k){for(var b=0;b<k.length;b++){var g=k[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(v,g.key,g)}}function L(v,k,b){return k&&h(v.prototype,k),b&&h(v,b),v}var p=function(){v.isSupported=function(){return Object(M.isSupported)()};function v(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.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 g=this.config=Object(C.mergeConfig)(v.DefaultConfig,b);this.userConfig=b,Object(w.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(C.enableStreamingMode)(g);var c=g.abrController,u=g.bufferController,o=g.capLevelController,T=g.fpsController,S=this.abrController=new c(this),m=this.bufferController=new u(this),O=this.capLevelController=new o(this),U=new T(this),j=new R.default(this),K=new W.default(this),I=new B.default(this),N=this.levelController=new A.default(this),X=new f.FragmentTracker(this),q=this.streamController=new x.default(this,X);O.setStreamController(q),U.setStreamController(q);var se=[N,q];this.networkControllers=se;var he=[j,K,S,m,O,U,I,X];this.audioTrackController=this.createController(g.audioTrackController,null,se),this.createController(g.audioStreamController,X,se),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,se),this.createController(g.subtitleStreamController,X,se),this.createController(g.timelineController,null,he),this.emeController=this.createController(g.emeController,null,he),this.cmcdController=this.createController(g.cmcdController,null,he),this.latencyController=this.createController(P.default,null,he),this.coreComponents=he}var k=v.prototype;return k.createController=function(g,c,u){if(g){var o=c?new g(this,c):new g(this);return u&&u.push(o),o}return null},k.on=function(g,c,u){u===void 0&&(u=this),this._emitter.on(g,c,u)},k.once=function(g,c,u){u===void 0&&(u=this),this._emitter.once(g,c,u)},k.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},k.off=function(g,c,u,o){u===void 0&&(u=this),this._emitter.off(g,c,u,o)},k.listeners=function(g){return this._emitter.listeners(g)},k.emit=function(g,c,u){return this._emitter.emit(g,c,u)},k.trigger=function(g,c){if(this.config.debug)return this.emit(g,g,c);try{return this.emit(g,g,c)}catch(u){w.logger.error("An internal error happened while handling event "+g+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:u})}return!1},k.listenerCount=function(g){return this._emitter.listenerCount(g)},k.destroy=function(){w.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},k.attachMedia=function(g){w.logger.log("attachMedia"),this._media=g,this.trigger(a.Events.MEDIA_ATTACHING,{media:g})},k.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(g){this.stopLoad();var c=this.media,u=this.url,o=this.url=Y.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),c&&u&&u!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(a.Events.MANIFEST_LOADING,{url:g})},k.startLoad=function(g){g===void 0&&(g=-1),w.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(c){c.startLoad(g)})},k.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},k.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){w.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},k.removeLevel=function(g,c){c===void 0&&(c=0),this.levelController.removeLevel(g,c)},L(v,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){w.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){w.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){w.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){w.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){w.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var c=!!g;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(g){this._autoLevelCapping!==g&&(w.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,c=this.config.minAutoBitrate;if(!g)return 0;for(var u=g.length,o=0;o<u;o++)if(g[o].maxBitrate>c)return o;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,c=this.autoLevelCapping,u;return c===-1&&g&&g.length?u=g.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var c=this.audioTrackController;c&&(c.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{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 a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:C.hlsDefaultConfig},set:function(g){v.defaultConfig=g}}]),v}();p.defaultConfig=void 0},"./src/is-supported.ts":function(ne,$,D){"use strict";D.r($),D.d($,"isSupported",function(){return R}),D.d($,"changeTypeSupported",function(){return W});var Y=D("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var B=Object(Y.getMediaSource)();if(!B)return!1;var P=F(),A=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),f=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!A&&!!f}function W(){var B,P=F();return typeof(P==null||((B=P.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return w}),D.d($,"LoadError",function(){return E});var Y=D("./src/polyfills/number.ts"),F=D("./src/errors.ts");function R(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,f(d,a)}function W(d){var a=typeof Map=="function"?new Map:void 0;return W=function(h){if(h===null||!A(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,L)}function L(){return B(h,arguments,x(this).constructor)}return L.prototype=Object.create(h.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),f(L,h)},W(d)}function B(d,a,s){return P()?B=Reflect.construct:B=function(L,p,v){var k=[null];k.push.apply(k,p);var b=Function.bind.apply(L,k),g=new b;return v&&f(g,v.prototype),g},B.apply(null,arguments)}function P(){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 A(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function f(d,a){return f=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},f(d,a)}function x(d){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},x(d)}var M=Math.pow(2,17),w=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=d.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,L){var p=this,v=h.url;if(!v)return Promise.reject(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var k=this.config,b=k.fLoader,g=k.loader;return new Promise(function(c,u){p.loader&&p.loader.destroy();var o=p.loader=h.loader=b?new b(k):new g(k),T=C(h),S={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:M};h.stats=o.stats,o.load(T,S,{onSuccess:function(O,U,j,K){p.resetLoader(h,o),c({frag:h,part:null,payload:O.data,networkDetails:K})},onError:function(O,U,j){p.resetLoader(h,o),u(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:O,networkDetails:j}))},onAbort:function(O,U,j){p.resetLoader(h,o),u(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:j}))},onTimeout:function(O,U,j){p.resetLoader(h,o),u(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:j}))},onProgress:function(O,U,j,K){L&&L({frag:h,part:null,payload:j,networkDetails:K})}})})},a.loadPart=function(h,L,p){var v=this;this.abort();var k=this.config,b=k.fLoader,g=k.loader;return new Promise(function(c,u){v.loader&&v.loader.destroy();var o=v.loader=h.loader=b?new b(k):new g(k),T=C(h,L),S={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:M};L.stats=o.stats,o.load(T,S,{onSuccess:function(O,U,j,K){v.resetLoader(h,o),v.updateStatsFromPart(h,L);var I={frag:h,part:L,payload:O.data,networkDetails:K};p(I),c(I)},onError:function(O,U,j){v.resetLoader(h,o),u(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:L,response:O,networkDetails:j}))},onAbort:function(O,U,j){h.stats.aborted=L.stats.aborted,v.resetLoader(h,o),u(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:L,networkDetails:j}))},onTimeout:function(O,U,j){v.resetLoader(h,o),u(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:L,networkDetails:j}))}})})},a.updateStatsFromPart=function(h,L){var p=h.stats,v=L.stats,k=v.total;if(p.loaded+=v.loaded,k){var b=Math.round(h.duration/L.duration),g=Math.min(Math.round(p.loaded/k),b),c=b-g,u=c*Math.round(p.loaded/g);p.total=p.loaded+u}else p.total=Math.max(p.loaded,p.total);var o=p.loading,T=v.loading;o.start?o.first+=T.first-T.start:(o.start=T.start,o.first=T.first),o.end=T.end},a.resetLoader=function(h,L){h.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},d}();function C(d,a){a===void 0&&(a=null);var s=a||d,h={frag:d,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},L=s.byteRangeStartOffset,p=s.byteRangeEndOffset;return Object(Y.isFiniteNumber)(L)&&Object(Y.isFiniteNumber)(p)&&(h.rangeStart=L,h.rangeEnd=p),h}var E=function(d){R(a,d);function a(s){for(var h,L=arguments.length,p=new Array(L>1?L-1:0),v=1;v<L;v++)p[v-1]=arguments[v];return h=d.call.apply(d,[this].concat(p))||this,h.data=void 0,h.data=s,h}return a}(W(Error))},"./src/loader/fragment.ts":function(ne,$,D){"use strict";D.r($),D.d($,"ElementaryStreamTypes",function(){return w}),D.d($,"BaseSegment",function(){return C}),D.d($,"Fragment",function(){return E}),D.d($,"Part",function(){return d});var Y=D("./src/polyfills/number.ts"),F=D("./node_modules/url-toolkit/src/url-toolkit.js"),R=D.n(F),W=D("./src/utils/logger.ts"),B=D("./src/loader/level-key.ts"),P=D("./src/loader/load-stats.ts");function A(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,f(a,s)}function f(a,s){return f=Object.setPrototypeOf||function(L,p){return L.__proto__=p,L},f(a,s)}function x(a,s){for(var h=0;h<s.length;h++){var L=s[h];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function M(a,s,h){return s&&x(a.prototype,s),h&&x(a,h),a}var w;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(w||(w={}));var C=function(){function a(h){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[w.AUDIO]=null,L[w.VIDEO]=null,L[w.AUDIOVIDEO]=null,L),this.baseurl=h}var s=a.prototype;return s.setByteRange=function(L,p){var v=L.split("@",2),k=[];v.length===1?k[0]=p?p.byteRangeEndOffset:0:k[0]=parseInt(v[1]),k[1]=parseInt(v[0])+k[0],this._byteRange=k},M(a,[{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(L){this._url=L}}]),a}(),E=function(a){A(s,a);function s(L,p){var v;return v=a.call(this,p)||this,v._decryptdata=null,v.rawProgramDateTime=null,v.programDateTime=null,v.tagList=[],v.duration=0,v.sn=0,v.levelkey=void 0,v.type=void 0,v.loader=null,v.level=-1,v.cc=0,v.startPTS=void 0,v.endPTS=void 0,v.appendedPTS=void 0,v.startDTS=void 0,v.endDTS=void 0,v.start=0,v.deltaPTS=void 0,v.maxStartPTS=void 0,v.minEndPTS=void 0,v.stats=new P.LoadStats,v.urlId=0,v.data=void 0,v.bitrateTest=!1,v.title=null,v.initSegment=null,v.type=L,v}var h=s.prototype;return h.createInitializationVector=function(p){for(var v=new Uint8Array(16),k=12;k<16;k++)v[k]=p>>8*(15-k)&255;return v},h.setDecryptDataFromLevelKey=function(p,v){var k=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(k=B.LevelKey.fromURI(p.uri),k.method=p.method,k.iv=this.createInitializationVector(v),k.keyFormat="identity"),k},h.setElementaryStreamInfo=function(p,v,k,b,g,c){c===void 0&&(c=!1);var u=this.elementaryStreams,o=u[p];if(!o){u[p]={startPTS:v,endPTS:k,startDTS:b,endDTS:g,partial:c};return}o.startPTS=Math.min(o.startPTS,v),o.endPTS=Math.max(o.endPTS,k),o.startDTS=Math.min(o.startDTS,b),o.endDTS=Math.max(o.endDTS,g)},h.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[w.AUDIO]=null,p[w.VIDEO]=null,p[w.AUDIOVIDEO]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var p=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),s}(C),d=function(a){A(s,a);function s(h,L,p,v,k){var b;b=a.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new P.LoadStats,b.duration=h.decimalFloatingPoint("DURATION"),b.gap=h.bool("GAP"),b.independent=h.bool("INDEPENDENT"),b.relurl=h.enumeratedString("URI"),b.fragment=L,b.index=v;var g=h.enumeratedString("BYTERANGE");return g&&b.setByteRange(g,k),k&&(b.fragOffset=k.fragOffset+k.duration),b}return M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),s}(C)},"./src/loader/key-loader.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return W});var Y=D("./src/events.ts"),F=D("./src/errors.ts"),R=D("./src/utils/logger.ts"),W=function(){function B(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var P=B.prototype;return P._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var f in this.loaders){var x=this.loaders[f];x&&x.destroy()}this.loaders={}},P.onKeyLoading=function(f,x){var M=x.frag,w=M.type,C=this.loaders[w];if(!M.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=M.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(C&&(R.logger.warn("abort previous key loader for type:"+w),C.abort()),!E){R.logger.warn("key uri is falsy");return}var a=d.loader,s=M.loader=this.loaders[w]=new a(d);this.decrypturl=E,this.decryptkey=null;var h={url:E,frag:M,responseType:"arraybuffer"},L={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(h,L,p)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:M}))},P.loadsuccess=function(f,x,M){var w=M.frag;if(!w.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(f.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:w})},P.loaderror=function(f,x){var M=x.frag,w=M.loader;w&&w.abort(),delete this.loaders[M.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:f})},P.loadtimeout=function(f,x){var M=x.frag,w=M.loader;w&&w.abort(),delete this.loaders[M.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},B}()},"./src/loader/level-details.ts":function(ne,$,D){"use strict";D.r($),D.d($,"LevelDetails",function(){return B});var Y=D("./src/polyfills/number.ts");function F(P,A){for(var f=0;f<A.length;f++){var x=A[f];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(P,x.key,x)}}function R(P,A,f){return A&&F(P.prototype,A),f&&F(P,f),P}var W=10,B=function(){function P(f){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=f}var A=P.prototype;return A.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-x.lastPartSn,w=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!w||!!M,this.advanced=this.endSN>x.endSN||M>0||M===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},R(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var M=this.driftEnd-this.driftStart;return M*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ne,$,D){"use strict";D.r($),D.d($,"LevelKey",function(){return B});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(Y);function R(P,A){for(var f=0;f<A.length;f++){var x=A[f];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(P,x.key,x)}}function W(P,A,f){return A&&R(P.prototype,A),f&&R(P,f),P}var B=function(){P.fromURL=function(f,x){return new P(f,x)},P.fromURI=function(f){return new P(f)};function P(A,f){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,f?this._uri=Object(Y.buildAbsoluteURL)(A,f,{alwaysNormalize:!0}):this._uri=A}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ne,$,D){"use strict";D.r($),D.d($,"LoadStats",function(){return Y});var Y=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(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return s});var Y=D("./src/polyfills/number.ts"),F=D("./node_modules/url-toolkit/src/url-toolkit.js"),R=D.n(F),W=D("./src/loader/fragment.ts"),B=D("./src/loader/level-details.ts"),P=D("./src/loader/level-key.ts"),A=D("./src/utils/attr-list.ts"),f=D("./src/utils/logger.ts"),x=D("./src/utils/codecs.ts"),M=/#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,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=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 a(k){var b,g;return d.test((b=(g=F.parseURL(k))===null||g===void 0?void 0:g.path)!=null?b:"")}var s=function(){function k(){}return k.findGroup=function(g,c){for(var u=0;u<g.length;u++){var o=g[u];if(o.id===c)return o}},k.convertAVC1ToAVCOTI=function(g){var c=g.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return g},k.resolve=function(g,c){return F.buildAbsoluteURL(c,g,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(g,c){var u=[],o={},T=!1;M.lastIndex=0;for(var S;(S=M.exec(g))!=null;)if(S[1]){var m=new A.AttrList(S[1]),O={attrs:m,bitrate:m.decimalInteger("AVERAGE-BANDWIDTH")||m.decimalInteger("BANDWIDTH"),name:m.NAME,url:k.resolve(S[2],c)},U=m.decimalResolution("RESOLUTION");U&&(O.width=U.width,O.height=U.height),h((m.CODECS||"").split(/[ ,]+/).filter(function(K){return K}),O),O.videoCodec&&O.videoCodec.indexOf("avc1")!==-1&&(O.videoCodec=k.convertAVC1ToAVCOTI(O.videoCodec)),u.push(O)}else if(S[3]){var j=new A.AttrList(S[3]);j["DATA-ID"]&&(T=!0,o[j["DATA-ID"]]=j)}return{levels:u,sessionData:T?o:null}},k.parseMasterPlaylistMedia=function(g,c,u,o){o===void 0&&(o=[]);var T,S=[],m=0;for(w.lastIndex=0;(T=w.exec(g))!==null;){var O=new A.AttrList(T[1]);if(O.TYPE===u){var U={attrs:O,bitrate:0,id:m++,groupId:O["GROUP-ID"],instreamId:O["INSTREAM-ID"],name:O.NAME||O.LANGUAGE||"",type:u,default:O.bool("DEFAULT"),autoselect:O.bool("AUTOSELECT"),forced:O.bool("FORCED"),lang:O.LANGUAGE,url:O.URI?k.resolve(O.URI,c):""};if(o.length){var j=k.findGroup(o,U.groupId)||o[0];L(U,j,"audioCodec"),L(U,j,"textCodec")}S.push(U)}}return S},k.parseLevelPlaylist=function(g,c,u,o,T){var S=new B.LevelDetails(c),m=S.fragments,O=null,U=0,j=0,K=0,I=0,N=null,X=new W.Fragment(o,c),q,se,he,Ae=-1,be=!1;for(C.lastIndex=0,S.m3u8=g;(q=C.exec(g))!==null;){be&&(be=!1,X=new W.Fragment(o,c),X.start=K,X.sn=U,X.cc=I,X.level=u,O&&(X.initSegment=O,X.rawProgramDateTime=O.rawProgramDateTime));var Te=q[1];if(Te){X.duration=parseFloat(Te);var Ce=(" "+q[2]).slice(1);X.title=Ce||null,X.tagList.push(Ce?["INF",Te,Ce]:["INF",Te])}else if(q[3])Object(Y.isFiniteNumber)(X.duration)&&(X.start=K,he&&(X.levelkey=he),X.sn=U,X.level=u,X.cc=I,X.urlId=T,m.push(X),X.relurl=(" "+q[3]).slice(1),v(X,N),N=X,K+=X.duration,U++,j=0,be=!0);else if(q[4]){var Se=(" "+q[4]).slice(1);N?X.setByteRange(Se,N):X.setByteRange(Se)}else if(q[5])X.rawProgramDateTime=(" "+q[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Ae===-1&&(Ae=m.length);else{if(q=q[0].match(E),!q){f.logger.warn("No matches on slow regex match for level playlist!");continue}for(se=1;se<q.length&&!(typeof q[se]!="undefined");se++);var pe=(" "+q[se]).slice(1),ue=(" "+q[se+1]).slice(1),te=q[se+2]?(" "+q[se+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":S.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":U=S.startSN=parseInt(ue);break;case"SKIP":{var fe=new A.AttrList(ue),ae=fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(ae)){S.skippedSegments=ae;for(var _e=ae;_e--;)m.unshift(null);U+=ae}var De=fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");De&&(S.recentlyRemovedDateranges=De.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(ue);break;case"VERSION":S.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(ue||te)&&X.tagList.push(te?[ue,te]:[ue]);break;case"DIS":I++;case"GAP":X.tagList.push([pe]);break;case"BITRATE":X.tagList.push([pe,ue]);break;case"DISCONTINUITY-SEQ":I=parseInt(ue);break;case"KEY":{var xe,Oe=new A.AttrList(ue),Ie=Oe.enumeratedString("METHOD"),Ue=Oe.URI,We=Oe.hexadecimalInteger("IV"),Be=Oe.enumeratedString("KEYFORMATVERSIONS"),Fe=Oe.enumeratedString("KEYID"),it=(xe=Oe.enumeratedString("KEYFORMAT"))!=null?xe:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf(it)>-1){f.logger.warn("Keyformat "+it+" is not supported from the manifest");continue}else if(it!=="identity")continue;Ie&&(he=P.LevelKey.fromURL(c,Ue),Ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ie)>=0&&(he.method=Ie,he.keyFormat=it,Fe&&(he.keyID=Fe),Be&&(he.keyFormatVersions=Be),he.iv=We));break}case"START":{var qe=new A.AttrList(ue),Qe=qe.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Qe)&&(S.startTimeOffset=Qe);break}case"MAP":{var ot=new A.AttrList(ue);X.relurl=ot.URI,ot.BYTERANGE&&X.setByteRange(ot.BYTERANGE),X.level=u,X.sn="initSegment",he&&(X.levelkey=he),X.initSegment=null,O=X,be=!0;break}case"SERVER-CONTROL":{var Ze=new A.AttrList(ue);S.canBlockReload=Ze.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=Ze.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&Ze.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=Ze.optionalFloat("PART-HOLD-BACK",0),S.holdBack=Ze.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var at=new A.AttrList(ue);S.partTarget=at.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=S.partList;Pe||(Pe=S.partList=[]);var dt=j>0?Pe[Pe.length-1]:void 0,st=j++,Ne=new W.Part(new A.AttrList(ue),X,c,st,dt);Pe.push(Ne),X.duration+=Ne.duration;break}case"PRELOAD-HINT":{var Ve=new A.AttrList(ue);S.preloadHint=Ve;break}case"RENDITION-REPORT":{var Ee=new A.AttrList(ue);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Ee);break}default:f.logger.warn("line parsed but not handled: "+q);break}}}N&&!N.relurl?(m.pop(),K-=N.duration,S.partList&&(S.fragmentHint=N)):S.partList&&(v(X,N),X.cc=I,S.fragmentHint=X);var ge=m.length,ye=m[0],ie=m[ge-1];if(K+=S.skippedSegments*S.targetduration,K>0&&ge&&ie){S.averagetargetduration=K/ge;var oe=ie.sn;S.endSN=oe!=="initSegment"?oe:0,ye&&(S.startCC=ye.cc,ye.initSegment||S.fragments.every(function(le){return le.relurl&&a(le.relurl)})&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new W.Fragment(o,c),X.relurl=ie.relurl,X.level=u,X.sn="initSegment",ye.initSegment=X,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(K+=S.fragmentHint.duration),S.totalduration=K,S.endCC=I,Ae>0&&p(m,Ae),S},k}();function h(k,b){["video","audio","text"].forEach(function(g){var c=k.filter(function(o){return Object(x.isCodecType)(o,g)});if(c.length){var u=c.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});b[g+"Codec"]=u.length>0?u[0]:c[0],k=k.filter(function(o){return c.indexOf(o)===-1})}}),b.unknownCodecs=k}function L(k,b,g){var c=b[g];c&&(k[g]=c)}function p(k,b){for(var g=k[b],c=b;c--;){var u=k[c];if(!u)return;u.programDateTime=g.programDateTime-u.duration*1e3,g=u}}function v(k,b){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):b!=null&&b.programDateTime&&(k.programDateTime=b.endProgramDateTime),Object(Y.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),R=D("./src/errors.ts"),W=D("./src/utils/logger.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/m3u8-parser.ts"),A=D("./src/types/loader.ts"),f=D("./src/utils/attr-list.ts");function x(C){var E=C.type;switch(E){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function M(C,E){var d=C.url;return(d===void 0||d.indexOf("data:")===0)&&(d=E.url),d}var w=function(){function C(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var E=C.prototype;return E.registerListeners=function(){var a=this.hls;a.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(a){var s=this.hls.config,h=s.pLoader,L=s.loader,p=h||L,v=new p(s);return a.loader=v,this.loaders[a.type]=v,v},E.getInternalLoader=function(a){return this.loaders[a.type]},E.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},E.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(a,s){var h=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},E.onLevelLoading=function(a,s){var h=s.id,L=s.level,p=s.url,v=s.deliveryDirectives;this.load({id:h,groupId:null,level:L,responseType:"text",type:A.PlaylistContextType.LEVEL,url:p,deliveryDirectives:v})},E.onAudioTrackLoading=function(a,s){var h=s.id,L=s.groupId,p=s.url,v=s.deliveryDirectives;this.load({id:h,groupId:L,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:v})},E.onSubtitleTrackLoading=function(a,s){var h=s.id,L=s.groupId,p=s.url,v=s.deliveryDirectives;this.load({id:h,groupId:L,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:v})},E.load=function(a){var s,h=this.hls.config,L=this.getInternalLoader(a);if(L){var p=L.context;if(p&&p.url===a.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),L.abort()}var v,k,b,g;switch(a.type){case A.PlaylistContextType.MANIFEST:v=h.manifestLoadingMaxRetry,k=h.manifestLoadingTimeOut,b=h.manifestLoadingRetryDelay,g=h.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:v=0,k=h.levelLoadingTimeOut;break;default:v=h.levelLoadingMaxRetry,k=h.levelLoadingTimeOut,b=h.levelLoadingRetryDelay,g=h.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(a.type===A.PlaylistContextType.LEVEL&&a.level!==null?c=this.hls.levels[a.level].details:a.type===A.PlaylistContextType.AUDIO_TRACK&&a.id!==null?c=this.hls.audioTracks[a.id].details:a.type===A.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(c=this.hls.subtitleTracks[a.id].details),c){var u=c.partTarget,o=c.targetduration;u&&o&&(k=Math.min(Math.max(u*3,o*.8)*1e3,k))}}var T={timeout:k,maxRetry:v,retryDelay:b,maxRetryDelay:g,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(a,T,S)},E.loadsuccess=function(a,s,h,L){if(L===void 0&&(L=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,s,h,L);return}this.resetInternalLoader(h.type);var p=a.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",L);return}s.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,h,L):this.handleMasterPlaylist(a,s,h,L)},E.loaderror=function(a,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!1,a)},E.loadtimeout=function(a,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!0)},E.handleMasterPlaylist=function(a,s,h,L){var p=this.hls,v=a.data,k=M(a,h),b=P.default.parseMasterPlaylist(v,k),g=b.levels,c=b.sessionData;if(!g.length){this.handleManifestParsingError(a,h,"no level found in manifest",L);return}var u=g.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),o=g.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),T=P.default.parseMasterPlaylistMedia(v,k,"AUDIO",u),S=P.default.parseMasterPlaylistMedia(v,k,"SUBTITLES",o),m=P.default.parseMasterPlaylistMedia(v,k,"CLOSED-CAPTIONS");if(T.length){var O=T.some(function(U){return!U.url});!O&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(W.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 f.AttrList({}),bitrate:0,url:""}))}p.trigger(F.Events.MANIFEST_LOADED,{levels:g,audioTracks:T,subtitles:S,captions:m,url:k,stats:s,networkDetails:L,sessionData:c})},E.handleTrackOrLevelPlaylist=function(a,s,h,L){var p=this.hls,v=h.id,k=h.level,b=h.type,g=M(a,h),c=Object(Y.isFiniteNumber)(v)?v:0,u=Object(Y.isFiniteNumber)(k)?k:c,o=x(h),T=P.default.parseLevelPlaylist(a.data,g,u,o,c);if(!T.fragments.length){p.trigger(F.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(b===A.PlaylistContextType.MANIFEST){var S={attrs:new f.AttrList({}),bitrate:0,details:T,name:"",url:g};p.trigger(F.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:g,stats:s,networkDetails:L,sessionData:null})}if(s.parsing.end=performance.now(),T.needSidxRanges){var m,O=(m=T.fragments[0].initSegment)===null||m===void 0?void 0:m.url;this.load({url:O,isSidxRequest:!0,type:b,level:k,levelDetails:T,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=T,this.handlePlaylistLoaded(a,s,h,L)},E.handleSidxRequest=function(a,s){var h=Object(B.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var L=h.references,p=s.levelDetails;L.forEach(function(v,k){var b=v.info,g=p.fragments[k];g.byteRange.length===0&&g.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),g.initSegment&&g.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(a,s,h,L){this.hls.trigger(F.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:s,networkDetails:L})},E.handleNetworkError=function(a,s,h,L){h===void 0&&(h=!1),W.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var p=R.ErrorDetails.UNKNOWN,v=!1,k=this.getInternalLoader(a);switch(a.type){case A.PlaylistContextType.MANIFEST:p=h?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case A.PlaylistContextType.LEVEL:p=h?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case A.PlaylistContextType.AUDIO_TRACK:p=h?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:p=h?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}k&&this.resetInternalLoader(a.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:v,url:a.url,loader:k,context:a,networkDetails:s};L&&(b.response=L),this.hls.trigger(F.Events.ERROR,b)},E.handlePlaylistLoaded=function(a,s,h,L){var p=h.type,v=h.level,k=h.id,b=h.groupId,g=h.loader,c=h.levelDetails,u=h.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",L);return}if(!g)return;c.live&&(g.getCacheAge&&(c.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:c,level:v||0,id:k||0,stats:s,networkDetails:L,deliveryDirectives:u});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:c,id:k||0,groupId:b||"",stats:s,networkDetails:L,deliveryDirectives:u});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:c,id:k||0,groupId:b||"",stats:s,networkDetails:L,deliveryDirectives:u});break}},C}();$.default=w},"./src/polyfills/number.ts":function(ne,$,D){"use strict";D.r($),D.d($,"isFiniteNumber",function(){return Y}),D.d($,"MAX_SAFE_INTEGER",function(){return F});var Y=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,$,D){"use strict";D.r($);var Y=function(){function F(){}return F.getSilentFrame=function(W,B){switch(W){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===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}();$.default=Y},"./src/remux/mp4-generator.ts":function(ne,$,D){"use strict";D.r($);var Y=Math.pow(2,32)-1,F=function(){function R(){}return R.init=function(){R.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 B;for(B in R.types)R.types.hasOwnProperty(B)&&(R.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var P=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]),A=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]);R.HDLR_TYPES={video:P,audio:A};var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=x,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,M,C,M,w),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,f))},R.box=function(B){for(var P=8,A=arguments.length,f=new Array(A>1?A-1:0),x=1;x<A;x++)f[x-1]=arguments[x];for(var M=f.length,w=M;M--;)P+=f[M].byteLength;var C=new Uint8Array(P);for(C[0]=P>>24&255,C[1]=P>>16&255,C[2]=P>>8&255,C[3]=P&255,C.set(B,4),M=0,P=8;M<w;M++)C.set(f[M],P),P+=f[M].byteLength;return C},R.hdlr=function(B){return R.box(R.types.hdlr,R.HDLR_TYPES[B])},R.mdat=function(B){return R.box(R.types.mdat,B)},R.mdhd=function(B,P){P*=B;var A=Math.floor(P/(Y+1)),f=Math.floor(P%(Y+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&255,85,196,0,0]))},R.mdia=function(B){return R.box(R.types.mdia,R.mdhd(B.timescale,B.duration),R.hdlr(B.type),R.minf(B))},R.mfhd=function(B){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},R.minf=function(B){return B.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(B)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(B))},R.moof=function(B,P,A){return R.box(R.types.moof,R.mfhd(B),R.traf(A,P))},R.moov=function(B){for(var P=B.length,A=[];P--;)A[P]=R.trak(B[P]);return R.box.apply(null,[R.types.moov,R.mvhd(B[0].timescale,B[0].duration)].concat(A).concat(R.mvex(B)))},R.mvex=function(B){for(var P=B.length,A=[];P--;)A[P]=R.trex(B[P]);return R.box.apply(null,[R.types.mvex].concat(A))},R.mvhd=function(B,P){P*=B;var A=Math.floor(P/(Y+1)),f=Math.floor(P%(Y+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&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 R.box(R.types.mvhd,x)},R.sdtp=function(B){var P=B.samples||[],A=new Uint8Array(4+P.length),f,x;for(f=0;f<P.length;f++)x=P[f].flags,A[f+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return R.box(R.types.sdtp,A)},R.stbl=function(B){return R.box(R.types.stbl,R.stsd(B),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(B){var P=[],A=[],f,x,M;for(f=0;f<B.sps.length;f++)x=B.sps[f],M=x.byteLength,P.push(M>>>8&255),P.push(M&255),P=P.concat(Array.prototype.slice.call(x));for(f=0;f<B.pps.length;f++)x=B.pps[f],M=x.byteLength,A.push(M>>>8&255),A.push(M&255),A=A.concat(Array.prototype.slice.call(x));var w=R.box(R.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|B.sps.length].concat(P).concat([B.pps.length]).concat(A))),C=B.width,E=B.height,d=B.pixelRatio[0],a=B.pixelRatio[1];return R.box(R.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,C>>8&255,C&255,E>>8&255,E&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,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,a>>24,a>>16&255,a>>8&255,a&255])))},R.esds=function(B){var P=B.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(B.config).concat([6,1,2]))},R.mp4a=function(B){var P=B.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),R.box(R.types.esds,R.esds(B)))},R.mp3=function(B){var P=B.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},R.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(B)):R.box(R.types.stsd,R.STSD,R.mp4a(B)):R.box(R.types.stsd,R.STSD,R.avc1(B))},R.tkhd=function(B){var P=B.id,A=B.duration*B.timescale,f=B.width,x=B.height,M=Math.floor(A/(Y+1)),w=Math.floor(A%(Y+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&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,f>>8&255,f&255,0,0,x>>8&255,x&255,0,0]))},R.traf=function(B,P){var A=R.sdtp(B),f=B.id,x=Math.floor(P/(Y+1)),M=Math.floor(P%(Y+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,M>>24,M>>16&255,M>>8&255,M&255])),R.trun(B,A.length+16+20+8+16+8+8),A)},R.trak=function(B){return B.duration=B.duration||4294967295,R.box(R.types.trak,R.tkhd(B),R.mdia(B))},R.trex=function(B){var P=B.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(B,P){var A=B.samples||[],f=A.length,x=12+16*f,M=new Uint8Array(x),w,C,E,d,a,s;for(P+=8+x,M.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),w=0;w<f;w++)C=A[w],E=C.duration,d=C.size,a=C.flags,s=C.cts,M.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*w);return R.box(R.types.trun,M)},R.initSegment=function(B){R.types||R.init();var P=R.moov(B),A=new Uint8Array(R.FTYP.byteLength+P.byteLength);return A.set(R.FTYP),A.set(P,R.FTYP.byteLength),A},R}();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,$.default=F},"./src/remux/mp4-remuxer.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return s}),D.d($,"normalizePts",function(){return h});var Y=D("./src/polyfills/number.ts"),F=D("./src/remux/aac-helper.ts"),R=D("./src/remux/mp4-generator.ts"),W=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),A=D("./src/types/loader.ts"),f=D("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign||function(k){for(var b=1;b<arguments.length;b++){var g=arguments[b];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(k[c]=g[c])}return k},x.apply(this,arguments)}var M=10*1e3,w=1024,C=1152,E=null,d=null,a=!1,s=function(){function k(g,c,u,o){if(o===void 0&&(o=""),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=g,this.config=c,this.typeSupported=u,this.ISGenerated=!1,E===null){var T=navigator.userAgent||"",S=T.match(/Chrome\/(\d+)/i);E=S?parseInt(S[1]):0}if(d===null){var m=navigator.userAgent.match(/Safari\/(\d+)/i);d=m?parseInt(m[1]):0}a=!!E&&E<75||!!d&&d<600}var b=k.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var u=!1,o=c.reduce(function(T,S){var m=S.pts-T;return m<-4294967296?(u=!0,h(T,S.pts)):m>0?T:S.pts},c[0].pts);return u&&P.logger.debug("PTS rollover detected"),o},b.remux=function(c,u,o,T,S,m,O,U){var j,K,I,N,X,q,se=S,he=S,Ae=c.pid>-1,be=u.pid>-1,Te=u.samples.length,Ce=c.samples.length>0,Se=Te>1,pe=(!Ae||Ce)&&(!be||Se)||this.ISGenerated||O;if(pe){this.ISGenerated||(I=this.generateIS(c,u,S));var ue=this.isVideoContiguous,te=-1;if(Se&&(te=L(u.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,te>0){P.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Te+" video samples due to a missing keyframe");var fe=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(te),u.dropped+=te,he+=(u.samples[0].pts-fe)/(u.timescale||9e4)}else te===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),q=!1);if(this.ISGenerated){if(Ce&&Se){var ae=this.getVideoStartPts(u.samples),_e=h(c.samples[0].pts,ae)-ae,De=_e/u.inputTimeScale;se+=Math.max(0,De),he+=Math.max(0,-De)}if(Ce){if(c.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(c,u,S)),K=this.remuxAudio(c,se,this.isAudioContiguous,m,be||Se||U===A.PlaylistLevelType.AUDIO?he:void 0),Se){var xe=K?K.endPTS-K.startPTS:0;u.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(c,u,S)),j=this.remuxVideo(u,he,ue,xe)}}else Se&&(j=this.remuxVideo(u,he,ue,0));j&&(j.firstKeyFrame=te,j.independent=te!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,S)),T.samples.length&&(N=this.remuxText(T,S))),{audio:K,video:j,initSegment:I,independent:q,text:N,id3:X}},b.generateIS=function(c,u,o){var T=c.samples,S=u.samples,m=this.typeSupported,O={},U=!Object(Y.isFiniteNumber)(this._initPTS),j="audio/mp4",K,I,N;if(U&&(K=I=Infinity),c.config&&T.length&&(c.timescale=c.samplerate,c.isAAC||(m.mpeg?(j="audio/mpeg",c.codec=""):m.mp3&&(c.codec="mp3")),O.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&m.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(N=c.inputTimeScale,K=I=T[0].pts-Math.round(N*o))),u.sps&&u.pps&&S.length&&(u.timescale=u.inputTimeScale,O.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:R.default.initSegment([u]),metadata:{width:u.width,height:u.height}},U)){N=u.inputTimeScale;var X=this.getVideoStartPts(S),q=Math.round(N*o);I=Math.min(I,h(S[0].dts,X)-q),K=Math.min(K,X-q)}if(Object.keys(O).length)return this.ISGenerated=!0,U&&(this._initPTS=K,this._initDTS=I),{tracks:O,initPTS:K,timescale:N}},b.remuxVideo=function(c,u,o,T){var S=c.inputTimeScale,m=c.samples,O=[],U=m.length,j=this._initPTS,K=this.nextAvcDts,I=8,N,X,q,se=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,Ae=0,be=!1;if(!o||K===null){var Te=u*S,Ce=m[0].pts-h(m[0].dts,m[0].pts);K=Te-Ce}for(var Se=0;Se<U;Se++){var pe=m[Se];if(pe.pts=h(pe.pts-j,K),pe.dts=h(pe.dts-j,K),pe.dts>pe.pts){var ue=9e4*.2;Ae=Math.max(Math.min(Ae,pe.pts-pe.dts),-1*ue)}pe.dts<m[Se>0?Se-1:Se].dts&&(be=!0)}be&&m.sort(function(xt,mt){var nt=xt.dts-mt.dts,Rt=xt.pts-mt.pts;return nt||Rt}),X=m[0].dts,q=m[m.length-1].dts;var te=Math.round((q-X)/(U-1));if(Ae<0){if(Ae<te*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(f.toMsFromMpegTsClock)(-te,!0)+" ms");for(var fe=Ae,ae=0;ae<U;ae++)m[ae].dts=fe=Math.max(fe,m[ae].pts-te),m[ae].pts=Math.max(fe,m[ae].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(f.toMsFromMpegTsClock)(Ae,!0)+" ms to overcome this issue");for(var _e=0;_e<U;_e++)m[_e].dts=m[_e].dts+Ae}X=m[0].dts}if(o){var De=X-K,xe=De>te,Oe=De<-1;if(xe||Oe){xe?P.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(De,!0)+" ms ("+De+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(-De,!0)+" ms ("+De+"dts) overlapping between fragments detected"),X=K;var Ie=m[0].pts-De;m[0].dts=X,m[0].pts=Ie,P.logger.log("Video: First PTS/DTS adjusted: "+Object(f.toMsFromMpegTsClock)(Ie,!0)+"/"+Object(f.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(f.toMsFromMpegTsClock)(De,!0)+" ms")}}a&&(X=Math.max(0,X));for(var Ue=0,We=0,Be=0;Be<U;Be++){for(var Fe=m[Be],it=Fe.units,et=it.length,qe=0,Qe=0;Qe<et;Qe++)qe+=it[Qe].data.length;We+=qe,Ue+=et,Fe.length=qe,Fe.dts=Math.max(Fe.dts,X),Fe.pts=Math.max(Fe.pts,Fe.dts,0),se=Math.min(Fe.pts,se),he=Math.max(Fe.pts,he)}q=m[U-1].dts;var ot=We+4*Ue+8,Ze;try{Ze=new Uint8Array(ot)}catch(xt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ot,reason:"fail allocating video mdat "+ot});return}var at=new DataView(Ze.buffer);at.setUint32(0,ot),Ze.set(R.default.types.mdat,4);for(var Pe=0;Pe<U;Pe++){for(var dt=m[Pe],st=dt.units,Ne=0,Ve=0,Ee=st.length;Ve<Ee;Ve++){var ge=st[Ve],ye=ge.data,ie=ge.data.byteLength;at.setUint32(I,ie),I+=4,Ze.set(ye,I),I+=ie,Ne+=4+ie}if(Pe<U-1)N=m[Pe+1].dts-dt.dts;else{var oe=this.config,le=dt.dts-m[Pe>0?Pe-1:Pe].dts;if(oe.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(oe.maxBufferHole*S),Le=(T?se+T*S:this.nextAudioPts)-dt.pts;Le>de?(N=Le-le,N<0&&(N=le),P.logger.log("[mp4-remuxer]: It is approximately "+Le/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=le}else N=le}var Me=Math.round(dt.pts-dt.dts);O.push(new p(dt.key,N,Ne,Me))}if(O.length&&E&&E<70){var Ye=O[0].flags;Ye.dependsOn=2,Ye.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=K=q+N,this.isVideoContiguous=!0;var yt=R.default.moof(c.sequenceNumber++,X,x({},c,{samples:O})),At="video",Ge={data1:yt,data2:Ze,startPTS:se/S,endPTS:(he+N)/S,startDTS:X/S,endDTS:K/S,type:At,hasAudio:!1,hasVideo:!0,nb:O.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ze.length,"MDAT length must not be zero"),Ge},b.remuxAudio=function(c,u,o,T,S){var m=c.inputTimeScale,O=c.samplerate?c.samplerate:m,U=m/O,j=c.isAAC?w:C,K=j*U,I=this._initPTS,N=!c.isAAC&&this.typeSupported.mpeg,X=[],q=c.samples,se=N?0:8,he=this.nextAudioPts||-1,Ae=u*m;if(this.isAudioContiguous=o=o||q.length&&he>0&&(T&&Math.abs(Ae-he)<9e3||Math.abs(h(q[0].pts-I,Ae)-he)<20*K),q.forEach(function(ye){ye.pts=h(ye.pts-I,Ae)}),!o||he<0){if(q=q.filter(function(ye){return ye.pts>=0}),!q.length)return;S===0?he=0:T?he=Math.max(0,Ae):he=q[0].pts}if(c.isAAC)for(var be=S!==void 0,Te=this.config.maxAudioFramesDrift,Ce=0,Se=he;Ce<q.length;Ce++){var pe=q[Ce],ue=pe.pts,te=ue-Se,fe=Math.abs(1e3*te/m);if(te<=-Te*K&&be)Ce===0&&(P.logger.warn("Audio frame @ "+(ue/m).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/m)+" ms."),this.nextAudioPts=he=Se=ue);else if(te>=Te*K&&fe<M&&be){var ae=Math.round(te/K);Se=ue-ae*K,Se<0&&(ae--,Se+=K),Ce===0&&(this.nextAudioPts=he=Se),P.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(Se/m).toFixed(3)+"s due to "+Math.round(1e3*te/m)+" ms gap.");for(var _e=0;_e<ae;_e++){var De=Math.max(Se,0),xe=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);xe||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=pe.unit.subarray()),q.splice(Ce,0,{unit:xe,pts:De}),Se+=K,Ce++}}pe.pts=Se,Se+=K}for(var Oe=null,Ie=null,Ue,We=0,Be=q.length;Be--;)We+=q[Be].unit.byteLength;for(var Fe=0,it=q.length;Fe<it;Fe++){var et=q[Fe],qe=et.unit,Qe=et.pts;if(Ie!==null){var ot=X[Fe-1];ot.duration=Math.round((Qe-Ie)/U)}else if(o&&c.isAAC&&(Qe=he),Oe=Qe,We>0){We+=se;try{Ue=new Uint8Array(We)}catch(ye){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating audio mdat "+We});return}if(!N){var Ze=new DataView(Ue.buffer);Ze.setUint32(0,We),Ue.set(R.default.types.mdat,4)}}else return;Ue.set(qe,se);var at=qe.byteLength;se+=at,X.push(new p(!0,j,at,0)),Ie=Qe}var Pe=X.length;if(!Pe)return;var dt=X[X.length-1];this.nextAudioPts=he=Ie+U*dt.duration;var st=N?new Uint8Array(0):R.default.moof(c.sequenceNumber++,Oe/U,x({},c,{samples:X}));c.samples=[];var Ne=Oe/m,Ve=he/m,Ee="audio",ge={data1:st,data2:Ue,startPTS:Ne,endPTS:Ve,startDTS:Ne,endDTS:Ve,type:Ee,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(Ue.length,"MDAT length must not be zero"),ge},b.remuxEmptyAudio=function(c,u,o,T){var S=c.inputTimeScale,m=c.samplerate?c.samplerate:S,O=S/m,U=this.nextAudioPts,j=(U!==null?U:T.startDTS*S)+this._initDTS,K=T.endDTS*S+this._initDTS,I=O*w,N=Math.ceil((K-j)/I),X=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],se=0;se<N;se++){var he=j+se*I;q.push({unit:X,pts:he,dts:he})}return c.samples=q,this.remuxAudio(c,u,o,!1)},b.remuxID3=function(c,u){var o=c.samples.length;if(!o)return;for(var T=c.inputTimeScale,S=this._initPTS,m=this._initDTS,O=0;O<o;O++){var U=c.samples[O];U.pts=h(U.pts-S,u*T)/T,U.dts=h(U.dts-m,u*T)/T}var j=c.samples;return c.samples=[],{samples:j}},b.remuxText=function(c,u){var o=c.samples.length;if(!o)return;for(var T=c.inputTimeScale,S=this._initPTS,m=0;m<o;m++){var O=c.samples[m];O.pts=h(O.pts-S,u*T)/T}c.samples.sort(function(j,K){return j.pts-K.pts});var U=c.samples;return c.samples=[],{samples:U}},k}();function h(k,b){var g;if(b===null)return k;for(b<k?g=-8589934592:g=8589934592;Math.abs(k-b)>4294967296;)k+=g;return k}function L(k){for(var b=0;b<k.length;b++)if(k[b].key)return b;return-1}var p=function(b,g,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=c,this.cts=u,this.flags=new v(b)},v=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/mp4-tools.ts"),R=D("./src/loader/fragment.ts"),W=D("./src/utils/logger.ts"),B=function(){function f(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var x=f.prototype;return x.destroy=function(){},x.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},x.resetNextTimestamp=function(){this.lastEndDTS=null},x.resetInitSegment=function(w,C,E){this.audioCodec=C,this.videoCodec=E,this.generateInitSegment(w),this.emitInitSegment=!0},x.generateInitSegment=function(w){var C=this.audioCodec,E=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(F.parseInitSegment)(w);C||(C=A(d.audio,R.ElementaryStreamTypes.AUDIO)),E||(E=A(d.video,R.ElementaryStreamTypes.VIDEO));var a={};d.audio&&d.video?a.audiovideo={container:"video/mp4",codec:C+","+E,initSegment:w,id:"main"}:d.audio?a.audio={container:"audio/mp4",codec:C,initSegment:w,id:"audio"}:d.video?a.video={container:"video/mp4",codec:E,initSegment:w,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},x.remux=function(w,C,E,d,a){var s=this.initPTS,h=this.lastEndDTS,L={audio:void 0,video:void 0,text:d,id3:E,initSegment:void 0};Object(Y.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var p=C.samples;if(!p||!p.length)return L;var v={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(p),k=this.initData),!k||!k.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(s)||(this.initPTS=v.initPTS=s=P(k,p,h));var b=Object(F.getDuration)(p,k),g=h,c=b+g;Object(F.offsetStartDTS)(k,p,s),b>0?this.lastEndDTS=c:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!k.audio,o=!!k.video,T="";u&&(T+="audio"),o&&(T+="video");var S={data1:p,startPTS:g,startDTS:g,endPTS:c,endDTS:c,type:T,hasAudio:u,hasVideo:o,nb:1,dropped:0};return L.audio=S.type==="audio"?S:void 0,L.video=S.type!=="audio"?S:void 0,L.text=d,L.id3=E,L.initSegment=v,L},f}(),P=function(x,M,w){return Object(F.getStartDTS)(x,M)-w};function A(f,x){var M=f==null?void 0:f.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||x===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=B},"./src/task-loop.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=F.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ne,$,D){"use strict";D.r($),D.d($,"CMCDVersion",function(){return Y}),D.d($,"CMCDObjectType",function(){return F}),D.d($,"CMCDStreamingFormat",function(){return R}),D.d($,"CMCDStreamType",function(){return W});var Y=1,F;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(F||(F={}));var R;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(R||(R={}));var W;(function(B){B.VOD="v",B.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ne,$,D){"use strict";D.r($),D.d($,"HlsSkip",function(){return R}),D.d($,"getSkipValue",function(){return W}),D.d($,"HlsUrlParameters",function(){return B}),D.d($,"Level",function(){return P});function Y(A,f){for(var x=0;x<f.length;x++){var M=f[x];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(A,M.key,M)}}function F(A,f,x){return f&&Y(A.prototype,f),x&&Y(A,x),A}var R;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(R||(R={}));function W(A,f){var x=A.canSkipUntil,M=A.canSkipDateRanges,w=A.endSN,C=f!==void 0?f-w:0;return x&&C<x?M?R.v2:R.Yes:R.No}var B=function(){function A(x,M,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=M,this.skip=w}var f=A.prototype;return f.addDirectives=function(M){var w=new self.URL(M);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()},A}(),P=function(){function A(f){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=[f.url],this.attrs=f.attrs,this.bitrate=f.bitrate,f.details&&(this.details=f.details),this.id=f.id||0,this.name=f.name,this.width=f.width||0,this.height=f.height||0,this.audioCodec=f.audioCodec,this.videoCodec=f.videoCodec,this.unknownCodecs=f.unknownCodecs,this.codecSet=[f.videoCodec,f.audioCodec].filter(function(x){return x}).join(",").replace(/\.[^.,]+/g,"")}return F(A,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(x){var M=x%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),A}()},"./src/types/loader.ts":function(ne,$,D){"use strict";D.r($),D.d($,"PlaylistContextType",function(){return Y}),D.d($,"PlaylistLevelType",function(){return F});var Y;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var F;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ne,$,D){"use strict";D.r($),D.d($,"ChunkMetadata",function(){return Y});var Y=function(W,B,P,A,f,x){A===void 0&&(A=0),f===void 0&&(f=-1),x===void 0&&(x=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=W,this.sn=B,this.id=P,this.size=A,this.part=f,this.partial=x};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,$,D){"use strict";D.r($),D.d($,"AttrList",function(){return R});var Y=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var A in P)P.hasOwnProperty(A)&&(this[A]=P[A])}var B=W.prototype;return B.decimalInteger=function(A){var f=parseInt(this[A],10);return f>Number.MAX_SAFE_INTEGER?Infinity:f},B.hexadecimalInteger=function(A){if(this[A]){var f=(this[A]||"0x").slice(2);f=(f.length&1?"0":"")+f;for(var x=new Uint8Array(f.length/2),M=0;M<f.length/2;M++)x[M]=parseInt(f.slice(M*2,M*2+2),16);return x}else return null},B.hexadecimalIntegerAsNumber=function(A){var f=parseInt(this[A],16);return f>Number.MAX_SAFE_INTEGER?Infinity:f},B.decimalFloatingPoint=function(A){return parseFloat(this[A])},B.optionalFloat=function(A,f){var x=this[A];return x?parseFloat(x):f},B.enumeratedString=function(A){return this[A]},B.bool=function(A){return this[A]==="YES"},B.decimalResolution=function(A){var f=Y.exec(this[A]);return f===null?void 0:{width:parseInt(f[1],10),height:parseInt(f[2],10)}},W.parseAttrList=function(A){var f,x={},M='"';for(F.lastIndex=0;(f=F.exec(A))!==null;){var w=f[2];w.indexOf(M)===0&&w.lastIndexOf(M)===w.length-1&&(w=w.slice(1,-1)),x[f[1]]=w}return x},W}()},"./src/utils/binary-search.ts":function(ne,$,D){"use strict";D.r($);var Y={search:function(R,W){for(var B=0,P=R.length-1,A=null,f=null;B<=P;){A=(B+P)/2|0,f=R[A];var x=W(f);if(x>0)B=A+1;else if(x<0)P=A-1;else return f}return null}};$.default=Y},"./src/utils/buffer-helper.ts":function(ne,$,D){"use strict";D.r($),D.d($,"BufferHelper",function(){return R});var Y=D("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function W(){}return W.isBuffered=function(P,A){try{if(P){for(var f=W.getBuffered(P),x=0;x<f.length;x++)if(A>=f.start(x)&&A<=f.end(x))return!0}}catch(M){}return!1},W.bufferInfo=function(P,A,f){try{if(P){var x=W.getBuffered(P),M=[],w;for(w=0;w<x.length;w++)M.push({start:x.start(w),end:x.end(w)});return this.bufferedInfo(M,A,f)}}catch(C){}return{len:0,start:A,end:A,nextStart:void 0}},W.bufferedInfo=function(P,A,f){A=Math.max(0,A),P.sort(function(v,k){var b=v.start-k.start;return b||k.end-v.end});var x=[];if(f)for(var M=0;M<P.length;M++){var w=x.length;if(w){var C=x[w-1].end;P[M].start-C<f?P[M].end>C&&(x[w-1].end=P[M].end):x.push(P[M])}else x.push(P[M])}else x=P;for(var E=0,d,a=A,s=A,h=0;h<x.length;h++){var L=x[h].start,p=x[h].end;if(A+f>=L&&A<p)a=L,s=p,E=s-A;else if(A+f<L){d=L;break}}return{len:E,start:a||0,end:s||0,nextStart:d}},W.getBuffered=function(P){try{return P.buffered}catch(A){return Y.logger.log("failed to get media.buffered",A),F}},W}()},"./src/utils/cea-608-parser.ts":function(ne,$,D){"use strict";D.r($),D.d($,"Row",function(){return s}),D.d($,"CaptionScreen",function(){return h});var Y=D("./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},R=function(c){var u=c;return F.hasOwnProperty(c)&&(u=F[c]),String.fromCharCode(u)},W=15,B=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},f={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},x={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(w||(w={}));var C=function(){function g(){this.time=null,this.verboseLevel=w.ERROR}var c=g.prototype;return c.log=function(o,T){this.verboseLevel>=o&&Y.logger.log(this.time+" ["+o+"] "+T)},g}(),E=function(c){for(var u=[],o=0;o<c.length;o++)u.push(c[o].toString(16));return u},d=function(){function g(u,o,T,S,m){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=o||!1,this.italics=T||!1,this.background=S||"black",this.flash=m||!1}var c=g.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(o){for(var T=["foreground","underline","italics","background","flash"],S=0;S<T.length;S++){var m=T[S];o.hasOwnProperty(m)&&(this[m]=o[m])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},c.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),a=function(){function g(u,o,T,S,m,O){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(o,T,S,m,O)}var c=g.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(o,T){this.uchar=o,this.penState.copy(T)},c.setPenState=function(o){this.penState.copy(o)},c.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},c.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),s=function(){function g(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<B;o++)this.chars.push(new a);this.logger=u,this.pos=0,this.currPenState=new d}var c=g.prototype;return c.equals=function(o){for(var T=!0,S=0;S<B;S++)if(!this.chars[S].equals(o.chars[S])){T=!1;break}return T},c.copy=function(o){for(var T=0;T<B;T++)this.chars[T].copy(o.chars[T])},c.isEmpty=function(){for(var o=!0,T=0;T<B;T++)if(!this.chars[T].isEmpty()){o=!1;break}return o},c.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},c.moveCursor=function(o){var T=this.pos+o;if(o>1)for(var S=this.pos+1;S<T+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(T)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(o){o>=144&&this.backSpace();var T=R(o);if(this.pos>=B){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(o){var T;for(T=o;T<B;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 o=[],T=!0,S=0;S<B;S++){var m=this.chars[S].uchar;m!==" "&&(T=!1),o.push(m)}return T?"":o.join("")},c.setPenStyles=function(o){this.currPenState.setStyles(o);var T=this.chars[this.pos];T.setPenState(this.currPenState)},g}(),h=function(){function g(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<W;o++)this.rows.push(new s(u));this.logger=u,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=g.prototype;return c.reset=function(){for(var o=0;o<W;o++)this.rows[o].clear();this.currRow=W-1},c.equals=function(o){for(var T=!0,S=0;S<W;S++)if(!this.rows[S].equals(o.rows[S])){T=!1;break}return T},c.copy=function(o){for(var T=0;T<W;T++)this.rows[T].copy(o.rows[T])},c.isEmpty=function(){for(var o=!0,T=0;T<W;T++)if(!this.rows[T].isEmpty()){o=!1;break}return o},c.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},c.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},c.insertChar=function(o){var T=this.rows[this.currRow];T.insertChar(o)},c.setPen=function(o){var T=this.rows[this.currRow];T.setPenStyles(o)},c.moveCursor=function(o){var T=this.rows[this.currRow];T.moveCursor(o)},c.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var T=this.rows[this.currRow];T.setCursor(o)},c.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var T=o.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var S=0;S<W;S++)this.rows[S].clear();var m=this.currRow+1-this.nrRollUpRows,O=this.lastOutputScreen;if(O){var U=O.rows[m].cueStartTime,j=this.logger.time;if(U&&j!==null&&U<j)for(var K=0;K<this.nrRollUpRows;K++)this.rows[T-this.nrRollUpRows+K+1].copy(O.rows[m+K])}}this.currRow=T;var I=this.rows[this.currRow];if(o.indent!==null){var N=o.indent,X=Math.max(N-1,0);I.setCursor(o.indent),o.color=I.chars[X].penState.foreground}var q={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(q)},c.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},c.setRollUpRows=function(o){this.nrRollUpRows=o},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 o=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(o,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(w.INFO,"Rolling up")},c.getDisplayText=function(o){o=o||!1;for(var T=[],S="",m=-1,O=0;O<W;O++){var U=this.rows[O].getTextString();U&&(m=O+1,o?T.push("Row "+m+": '"+U+"'"):T.push(U.trim()))}return T.length>0&&(o?S="["+T.join(" | ")+"]":S=T.join(`
`)),S},c.getTextAndFormat=function(){return this.rows},g}(),L=function(){function g(u,o,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=u,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new h(T),this.nonDisplayedMemory=new h(T),this.lastOutputScreen=new h(T),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var c=g.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[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(o){this.outputFilter=o},c.setPAC=function(o){this.writeScreen.setPAC(o)},c.setBkgData=function(o){this.writeScreen.setBkgData(o)},c.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),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=o},c.insertChars=function(o){for(var T=0;T<o.length;T++)this.writeScreen.insertChar(o[T]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,S+": "+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(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},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 o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},c.ccMIDROW=function(o){var T={flash:!1};if(T.underline=o%2===1,T.italics=o>=46,T.italics)T.foreground="white";else{var S=Math.floor(o/2)-16,m=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=m[S]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},c.outputDataUpdate=function(o){o===void 0&&(o=!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),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},g}(),p=function(){function g(u,o,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new C;this.channels=[null,new L(u,o,S),new L(u+1,T,S)],this.cmdHistory=b(),this.logger=S}var c=g.prototype;return c.getHandler=function(o){return this.channels[o].getHandler()},c.setHandler=function(o,T){this.channels[o].setHandler(T)},c.addData=function(o,T){var S,m,O,U=!1;this.logger.time=o;for(var j=0;j<T.length;j+=2){if(m=T[j]&127,O=T[j+1]&127,m===0&&O===0)continue;if(this.logger.log(w.DATA,"["+E([T[j],T[j+1]])+"] -> ("+E([m,O])+")"),S=this.parseCmd(m,O),S||(S=this.parseMidrow(m,O)),S||(S=this.parsePAC(m,O)),S||(S=this.parseBackgroundAttributes(m,O)),!S&&(U=this.parseChars(m,O),U)){var K=this.currentChannel;if(K&&K>0){var I=this.channels[K];I.insertChars(U)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!U&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+E([m,O])+" orig: "+E([T[j],T[j+1]]))}},c.parseCmd=function(o,T){var S=this.cmdHistory,m=(o===20||o===28||o===21||o===29)&&T>=32&&T<=47,O=(o===23||o===31)&&T>=33&&T<=35;if(!(m||O))return!1;if(k(o,T,S))return v(null,null,S),this.logger.log(w.DEBUG,"Repeated command ("+E([o,T])+") is dropped"),!0;var U=o===20||o===21||o===23?1:2,j=this.channels[U];return o===20||o===21||o===28||o===29?T===32?j.ccRCL():T===33?j.ccBS():T===34?j.ccAOF():T===35?j.ccAON():T===36?j.ccDER():T===37?j.ccRU(2):T===38?j.ccRU(3):T===39?j.ccRU(4):T===40?j.ccFON():T===41?j.ccRDC():T===42?j.ccTR():T===43?j.ccRTD():T===44?j.ccEDM():T===45?j.ccCR():T===46?j.ccENM():T===47&&j.ccEOC():j.ccTO(T-32),v(o,T,S),this.currentChannel=U,!0},c.parseMidrow=function(o,T){var S=0;if((o===17||o===25)&&T>=32&&T<=47){if(o===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var m=this.channels[S];return m?(m.ccMIDROW(T),this.logger.log(w.DEBUG,"MIDROW ("+E([o,T])+")"),!0):!1}return!1},c.parsePAC=function(o,T){var S,m=this.cmdHistory,O=(o>=17&&o<=23||o>=25&&o<=31)&&T>=64&&T<=127,U=(o===16||o===24)&&T>=64&&T<=95;if(!(O||U))return!1;if(k(o,T,m))return v(null,null,m),!0;var j=o<=23?1:2;T>=64&&T<=95?S=j===1?P[o]:f[o]:S=j===1?A[o]:x[o];var K=this.channels[j];return K?(K.setPAC(this.interpretPAC(S,T)),v(o,T,m),this.currentChannel=j,!0):!1},c.interpretPAC=function(o,T){var S,m={color:null,italics:!1,indent:null,underline:!1,row:o};return T>95?S=T-96:S=T-64,m.underline=(S&1)===1,S<=13?m.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(m.italics=!0,m.color="white"):m.indent=Math.floor((S-16)/2)*4,m},c.parseChars=function(o,T){var S,m=null,O=null;if(o>=25?(S=2,O=o-8):(S=1,O=o),O>=17&&O<=19){var U;O===17?U=T+80:O===18?U=T+112:U=T+144,this.logger.log(w.INFO,"Special char '"+R(U)+"' in channel "+S),m=[U]}else o>=32&&o<=127&&(m=T===0?[o]:[o,T]);if(m){var j=E(m);this.logger.log(w.DEBUG,"Char codes = "+j.join(",")),v(o,T,this.cmdHistory)}return m},c.parseBackgroundAttributes=function(o,T){var S=(o===16||o===24)&&T>=32&&T<=47,m=(o===23||o===31)&&T>=45&&T<=47;if(!(S||m))return!1;var O,U={};o===16||o===24?(O=Math.floor((T-32)/2),U.background=M[O],T%2===1&&(U.background=U.background+"_semi")):T===45?U.background="transparent":(U.foreground="black",T===47&&(U.underline=!0));var j=o<=23?1:2,K=this.channels[j];return K.setBkgData(U),v(o,T,this.cmdHistory),!0},c.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var T=this.channels[o];T&&T.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(o){for(var T=0;T<this.channels.length;T++){var S=this.channels[T];S&&S.cueSplitAtTime(o)}},g}();function v(g,c,u){u.a=g,u.b=c}function k(g,c,u){return u.a===g&&u.b===c}function b(){return{a:null,b:null}}$.default=p},"./src/utils/codecs.ts":function(ne,$,D){"use strict";D.r($),D.d($,"isCodecType",function(){return F}),D.d($,"isCodecSupportedInMp4",function(){return R});var Y={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(W,B){var P=Y[B];return!!P&&P[W.slice(0,4)]===!0}function R(W,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/utils/vttparser.ts"),F=D("./src/utils/webvtt-parser.ts"),R=D("./src/utils/texttrack-utils.ts"),W=/\s/,B={newCue:function(A,f,x,M){for(var w=[],C,E,d,a,s,h=self.VTTCue||self.TextTrackCue,L=0;L<M.rows.length;L++)if(C=M.rows[L],d=!0,a=0,s="",!C.isEmpty()){for(var p=0;p<C.chars.length;p++)W.test(C.chars[p].uchar)&&d?a++:(s+=C.chars[p].uchar,d=!1);C.cueStartTime=f,f===x&&(x+=1e-4),a>=16?a--:a++;var v=Object(Y.fixLineBreaks)(s.trim()),k=Object(F.generateCueId)(f,x,v);(!A||!A.cues||!A.cues.getCueById(k))&&(E=new h(f,x,v),E.id=k,E.line=L+1,E.align="left",E.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(E))}return A&&w.length&&(w.sort(function(b,g){return b.line==="auto"||g.line==="auto"?0:b.line>8&&g.line>8?g.line-b.line:b.line-g.line}),w.forEach(function(b){return Object(R.addCueToTrack)(A,b)})),w}};$.default=B},"./src/utils/discontinuities.ts":function(ne,$,D){"use strict";D.r($),D.d($,"findFirstFragWithCC",function(){return W}),D.d($,"shouldAlignOnDiscontinuities",function(){return B}),D.d($,"findDiscontinuousReferenceFrag",function(){return P}),D.d($,"adjustSlidingStart",function(){return f}),D.d($,"alignStream",function(){return x}),D.d($,"alignPDT",function(){return w}),D.d($,"alignFragmentByPDTDelta",function(){return C}),D.d($,"alignMediaPlaylistByPDT",function(){return E});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts"),R=D("./src/controller/level-helper.ts");function W(d,a){for(var s=null,h=0,L=d.length;h<L;h++){var p=d[h];if(p&&p.cc===a){s=p;break}}return s}function B(d,a,s){return!!(a.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function P(d,a){var s=d.fragments,h=a.fragments;if(!h.length||!s.length){F.logger.log("No fragments to align");return}var L=W(s,h[0].cc);if(!L||L&&!L.startPTS){F.logger.log("No frag in previous level to align on");return}return L}function A(d,a){if(d){var s=d.start+a;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function f(d,a){for(var s=a.fragments,h=0,L=s.length;h<L;h++)A(s[h],d);a.fragmentHint&&A(a.fragmentHint,d),a.alignedSliding=!0}function x(d,a,s){if(!a)return;M(d,s,a),!s.alignedSliding&&a.details&&w(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(R.adjustSliding)(a.details,s)}function M(d,a,s){if(B(d,s,a)){var h=P(s.details,a);h&&Object(Y.isFiniteNumber)(h.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),f(h.start,a))}}function w(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,h=d.fragments[0].programDateTime,L=(h-s)/1e3+a.fragments[0].start;L&&Object(Y.isFiniteNumber)(L)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(h-s)+"ms, sliding:"+L.toFixed(3)+" "+d.url+" "),f(L,d))}function C(d,a){var s=d.programDateTime;if(!s)return;var h=(s-a)/1e3;d.start=d.startPTS=h,d.endPTS=h+d.duration}function E(d,a){if(!a.fragments.length||!d.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,h=a.fragments[0].start,L=s-h*1e3;d.fragments.forEach(function(p){C(p,L)}),d.fragmentHint&&C(d.fragmentHint,L),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/utils/ewma.ts"),F=function(){function R(B,P,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(B),this.fast_=new Y.default(P)}var W=R.prototype;return W.update=function(P,A){var f=this.slow_,x=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new Y.default(P,f.getEstimate(),f.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new Y.default(A,x.getEstimate(),x.getTotalWeight()))},W.sample=function(P,A){P=Math.max(P,this.minDelayMs_);var f=8*A,x=P/1e3,M=f/x;this.fast_.sample(x,M),this.slow_.sample(x,M)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},R}();$.default=F},"./src/utils/ewma.ts":function(ne,$,D){"use strict";D.r($);var Y=function(){function F(W,B,P){B===void 0&&(B=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=B,this.totalWeight_=P}var R=F.prototype;return R.sample=function(B,P){var A=Math.pow(this.alpha_,B);this.estimate_=P*(1-A)+A*this.estimate_,this.totalWeight_+=B},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},F}();$.default=Y},"./src/utils/fetch-loader.ts":function(ne,$,D){"use strict";D.r($),D.d($,"fetchSupported",function(){return C});var Y=D("./src/polyfills/number.ts"),F=D("./src/loader/load-stats.ts"),R=D("./src/demux/chunk-cache.ts");function W(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,x(h,L)}function B(h){var L=typeof Map=="function"?new Map:void 0;return B=function(v){if(v===null||!f(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(v))return L.get(v);L.set(v,k)}function k(){return P(v,arguments,M(this).constructor)}return k.prototype=Object.create(v.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),x(k,v)},B(h)}function P(h,L,p){return A()?P=Reflect.construct:P=function(k,b,g){var c=[null];c.push.apply(c,b);var u=Function.bind.apply(k,c),o=new u;return g&&x(o,g.prototype),o},P.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function f(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,L){return x=Object.setPrototypeOf||function(v,k){return v.__proto__=k,v},x(h,L)}function M(h){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},M(h)}function w(){return w=Object.assign||function(h){for(var L=1;L<arguments.length;L++){var p=arguments[L];for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&(h[v]=p[v])}return h},w.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var E=function(){function h(p){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=p.fetchSetup||a,this.controller=new self.AbortController,this.stats=new F.LoadStats}var L=h.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var v=this.response;(!v||!v.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(v,k,b){var g=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=d(v,this.controller.signal),o=b.onProgress,T=v.responseType==="arraybuffer",S=T?"byteLength":"length";this.context=v,this.config=k,this.callbacks=b,this.request=this.fetchSetup(v,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),b.onTimeout(c,v,g.response)},k.timeout),self.fetch(this.request).then(function(m){if(g.response=g.loader=m,!m.ok){var O=m.status,U=m.statusText;throw new s(U||"fetch, bad network response",O,m)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(m.headers.get("Content-Length")||"0"),o&&Object(Y.isFiniteNumber)(k.highWaterMark)?g.loadProgressively(m,c,v,k.highWaterMark,o):T?m.arrayBuffer():m.text()}).then(function(m){var O=g.response;self.clearTimeout(g.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=m[S];var U={url:O.url,data:m};o&&!Object(Y.isFiniteNumber)(k.highWaterMark)&&o(c,v,m,O),b.onSuccess(U,c,v,O)}).catch(function(m){if(self.clearTimeout(g.requestTimeout),c.aborted)return;var O=m.code||0;b.onError({code:O,text:m.message},v,m.details)})},L.getCacheAge=function(){var v=null;if(this.response){var k=this.response.headers.get("age");v=k?parseFloat(k):null}return v},L.loadProgressively=function(v,k,b,g,c){g===void 0&&(g=0);var u=new R.default,o=v.body.getReader(),T=function S(){return o.read().then(function(m){if(m.done)return u.dataLength&&c(k,b,u.flush(),v),Promise.resolve(new ArrayBuffer(0));var O=m.value,U=O.length;return k.loaded+=U,U<g||u.dataLength?(u.push(O),u.dataLength>=g&&c(k,b,u.flush(),v)):c(k,b,O,v),S()}).catch(function(){return Promise.reject()})};return T()},h}();function d(h,L){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(w({},h.headers))};return h.rangeEnd&&p.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),p}function a(h,L){return new self.Request(h.url,L)}var s=function(h){W(L,h);function L(p,v,k){var b;return b=h.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=v,b.details=k,b}return L}(B(Error));$.default=E},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,D){"use strict";D.r($),D.d($,"IMSC1_CODEC",function(){return f}),D.d($,"parseIMSC1",function(){return C});var Y=D("./src/utils/mp4-tools.ts"),F=D("./src/utils/vttparser.ts"),R=D("./src/utils/vttcue.ts"),W=D("./src/demux/id3.ts"),B=D("./src/utils/timescale-conversion.ts"),P=D("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(g){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(g[o]=u[o])}return g},A.apply(this,arguments)}var f="stpp.ttml.im1t",x=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(g,c,u,o,T){var S=Object(Y.findBox)(new Uint8Array(g),["mdat"]);if(S.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var m=S[0],O=Object(W.utf8ArrayToStr)(new Uint8Array(g,m.start,m.end-m.start)),U=Object(B.toTimescaleFromScale)(c,1,u);try{o(E(O,U))}catch(j){T(j)}}function E(g,c){var u=new DOMParser,o=u.parseFromString(g,"text/xml"),T=o.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(S).reduce(function(I,N){return I[N]=T.getAttribute("ttp:"+N)||S[N],I},{}),O=T.getAttribute("xml:space")!=="preserve",U=a(d(T,"styling","style")),j=a(d(T,"layout","region")),K=d(T,"body","[begin]");return[].map.call(K,function(I){var N=s(I,O);if(!N||!I.hasAttribute("begin"))return null;var X=v(I.getAttribute("begin"),m),q=v(I.getAttribute("dur"),m),se=v(I.getAttribute("end"),m);if(X===null)throw p(I);if(se===null){if(q===null)throw p(I);se=X+q}var he=new R.default(X-c,se-c,N);he.id=Object(P.generateCueId)(he.startTime,he.endTime,he.text);var Ae=j[I.getAttribute("region")],be=U[I.getAttribute("style")];he.position=10,he.size=80;var Te=h(Ae,be),Ce=Te.textAlign;if(Ce){var Se=w[Ce];Se&&(he.lineAlign=Se),he.align=Ce}return A(he,Te),he}).filter(function(I){return I!==null})}function d(g,c,u){var o=g.getElementsByTagName(c)[0];return o?[].slice.call(o.querySelectorAll(u)):[]}function a(g){return g.reduce(function(c,u){var o=u.getAttribute("xml:id");return o&&(c[o]=u),c},{})}function s(g,c){return[].slice.call(g.childNodes).reduce(function(u,o,T){var S;return o.nodeName==="br"&&T?u+`
`:(S=o.childNodes)!==null&&S!==void 0&&S.length?s(o,c):c?u+o.textContent.trim().replace(/\s+/g," "):u+o.textContent},"")}function h(g,c){var u="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(T,S){var m=L(c,u,S)||L(g,u,S);return m&&(T[S]=m),T},{})}function L(g,c,u){return g.hasAttributeNS(c,u)?g.getAttributeNS(c,u):null}function p(g){return new Error("Could not parse ttml timestamp "+g)}function v(g,c){if(!g)return null;var u=Object(F.parseTimeStamp)(g);return u===null&&(x.test(g)?u=k(g,c):M.test(g)&&(u=b(g,c))),u}function k(g,c){var u=x.exec(g),o=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+o/c.frameRate}function b(g,c){var u=M.exec(g),o=Number(u[1]),T=u[2];switch(T){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/c.frameRate;case"t":return o/c.tickRate}return o}},"./src/utils/logger.ts":function(ne,$,D){"use strict";D.r($),D.d($,"enableLogs",function(){return P}),D.d($,"logger",function(){return A});var Y=function(){},F={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},R=F;function W(f){var x=self.console[f];return x?x.bind(self.console,"["+f+"] >"):Y}function B(f){for(var x=arguments.length,M=new Array(x>1?x-1:0),w=1;w<x;w++)M[w-1]=arguments[w];M.forEach(function(C){R[C]=f[C]?f[C].bind(f):W(C)})}function P(f){if(self.console&&f===!0||typeof f=="object"){B(f,"debug","log","info","warn","error");try{R.log()}catch(x){R=F}}else R=F}var A=R},"./src/utils/mediakeys-helper.ts":function(ne,$,D){"use strict";D.r($),D.d($,"KeySystems",function(){return Y}),D.d($,"requestMediaKeySystemAccess",function(){return F});var Y;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));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(ne,$,D){"use strict";D.r($),D.d($,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,$,D){"use strict";D.r($),D.d($,"bin2str",function(){return B}),D.d($,"readUint16",function(){return P}),D.d($,"readUint32",function(){return A}),D.d($,"writeUint32",function(){return f}),D.d($,"findBox",function(){return x}),D.d($,"parseSegmentIndex",function(){return M}),D.d($,"parseInitSegment",function(){return w}),D.d($,"getStartDTS",function(){return C}),D.d($,"getDuration",function(){return E}),D.d($,"computeRawDurationFromSamples",function(){return d}),D.d($,"offsetStartDTS",function(){return a}),D.d($,"segmentValidRange",function(){return s}),D.d($,"appendUint8Array",function(){return h});var Y=D("./src/utils/typed-array.ts"),F=D("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,W=[].push;function B(L){return String.fromCharCode.apply(null,L)}function P(L,p){"data"in L&&(p+=L.start,L=L.data);var v=L[p]<<8|L[p+1];return v<0?65536+v:v}function A(L,p){"data"in L&&(p+=L.start,L=L.data);var v=L[p]<<24|L[p+1]<<16|L[p+2]<<8|L[p+3];return v<0?4294967296+v:v}function f(L,p,v){"data"in L&&(p+=L.start,L=L.data),L[p]=v>>24,L[p+1]=v>>16&255,L[p+2]=v>>8&255,L[p+3]=v&255}function x(L,p){var v=[];if(!p.length)return v;var k,b,g;"data"in L?(k=L.data,b=L.start,g=L.end):(k=L,b=0,g=k.byteLength);for(var c=b;c<g;){var u=A(k,c),o=B(k.subarray(c+4,c+8)),T=u>1?c+u:g;if(o===p[0])if(p.length===1)v.push({data:k,start:c+8,end:T});else{var S=x({data:k,start:c+8,end:T},p.slice(1));S.length&&W.apply(v,S)}c=T}return v}function M(L){var p=x(L,["moov"]),v=p[0],k=v?v.end:null,b=x(L,["sidx"]);if(!b||!b[0])return null;var g=[],c=b[0],u=c.data[0],o=u===0?8:16,T=A(c,o);o+=4;var S=0,m=0;u===0?o+=8:o+=16,o+=2;var O=c.end+m,U=P(c,o);o+=2;for(var j=0;j<U;j++){var K=o,I=A(c,K);K+=4;var N=I&2147483647,X=(I&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=A(c,K);K+=4,g.push({referenceSize:N,subsegmentDuration:q,info:{duration:q/T,start:O,end:O+N-1}}),O+=N,K+=4,o=K}return{earliestPresentationTime:S,timescale:T,version:u,referencesCount:U,references:g,moovEndOffset:k}}function w(L){for(var p=[],v=x(L,["moov","trak"]),k=0;k<v.length;k++){var b=v[k],g=x(b,["tkhd"])[0];if(g){var c=g.data[g.start],u=c===0?12:20,o=A(g,u),T=x(b,["mdia","mdhd"])[0];if(T){c=T.data[T.start],u=c===0?12:20;var S=A(T,u),m=x(b,["mdia","hdlr"])[0];if(m){var O=B(m.data.subarray(m.start+8,m.start+12)),U={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[O];if(U){var j=x(b,["mdia","minf","stbl","stsd"])[0],K=void 0;j&&(K=B(j.data.subarray(j.start+12,j.start+16))),p[o]={timescale:S,type:U},p[U]={timescale:S,id:o,codec:K}}}}}}var I=x(L,["moov","mvex","trex"]);return I.forEach(function(N){var X=A(N,4),q=p[X];q&&(q.default={duration:A(N,12),flags:A(N,20)})}),p}function C(L,p){return x(p,["moof","traf"]).reduce(function(v,k){var b=x(k,["tfdt"])[0],g=b.data[b.start],c=x(k,["tfhd"]).reduce(function(u,o){var T=A(o,4),S=L[T];if(S){var m=A(b,4);g===1&&(m*=Math.pow(2,32),m+=A(b,8));var O=S.timescale||9e4,U=m/O;if(isFinite(U)&&(u===null||U<u))return U}return u},null);return c!==null&&isFinite(c)&&(v===null||c<v)?c:v},null)||0}function E(L,p){for(var v=0,k=0,b=0,g=x(L,["moof","traf"]),c=0;c<g.length;c++){var u=g[c],o=x(u,["tfhd"])[0],T=A(o,4),S=p[T];if(!S)continue;var m=S.default,O=A(o,0)|(m==null?void 0:m.flags),U=m==null?void 0:m.duration;O&8&&(O&2?U=A(o,12):U=A(o,8));for(var j=S.timescale||9e4,K=x(u,["trun"]),I=0;I<K.length;I++){if(U){var N=A(K[I],4);v=U*N}else v=d(K[I]);S.type===F.ElementaryStreamTypes.VIDEO?k+=v/j:S.type===F.ElementaryStreamTypes.AUDIO&&(b+=v/j)}}if(k===0&&b===0){var X=M(L);if(X!=null&&X.references)return X.references.reduce(function(q,se){return q+se.info.duration||0},0)}return k||b}function d(L){var p=A(L,0),v=8;p&1&&(v+=4),p&4&&(v+=4);for(var k=0,b=A(L,4),g=0;g<b;g++){if(p&256){var c=A(L,v);k+=c,v+=4}p&512&&(v+=4),p&1024&&(v+=4),p&2048&&(v+=4)}return k}function a(L,p,v){x(p,["moof","traf"]).forEach(function(k){x(k,["tfhd"]).forEach(function(b){var g=A(b,4),c=L[g];if(!c)return;var u=c.timescale||9e4;x(k,["tfdt"]).forEach(function(o){var T=o.data[o.start],S=A(o,4);if(T===0)f(o,4,S-v*u);else{S*=Math.pow(2,32),S+=A(o,8),S-=v*u,S=Math.max(S,0);var m=Math.floor(S/(R+1)),O=Math.floor(S%(R+1));f(o,4,m),f(o,8,O)}})})})}function s(L){var p={valid:null,remainder:null},v=x(L,["moof"]);if(v){if(v.length<2)return p.remainder=L,p}else return p;var k=v[v.length-1];return p.valid=Object(Y.sliceUint8)(L,0,k.start-8),p.remainder=Object(Y.sliceUint8)(L,k.start-8),p}function h(L,p){var v=new Uint8Array(L.length+p.length);return v.set(L),v.set(p,L.length),v}},"./src/utils/output-filter.ts":function(ne,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function F(W,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=B}var R=F.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(B,P,A){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=P,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ne,$,D){"use strict";D.r($),D.d($,"sendAddTrackEvent",function(){return F}),D.d($,"addCueToTrack",function(){return R}),D.d($,"clearCurrentCues",function(){return W}),D.d($,"removeCuesInRange",function(){return B}),D.d($,"getCuesInRange",function(){return A});var Y=D("./src/utils/logger.ts");function F(f,x){var M;try{M=new Event("addtrack")}catch(w){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=f,x.dispatchEvent(M)}function R(f,x){var M=f.mode;if(M==="disabled"&&(f.mode="hidden"),f.cues&&!f.cues.getCueById(x.id))try{if(f.addCue(x),!f.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(C){Y.logger.debug("[texttrack-utils]: "+C);var w=new self.TextTrackCue(x.startTime,x.endTime,x.text);w.id=x.id,f.addCue(w)}M==="disabled"&&(f.mode=M)}function W(f){var x=f.mode;if(x==="disabled"&&(f.mode="hidden"),f.cues)for(var M=f.cues.length;M--;)f.removeCue(f.cues[M]);x==="disabled"&&(f.mode=x)}function B(f,x,M){var w=f.mode;if(w==="disabled"&&(f.mode="hidden"),f.cues&&f.cues.length>0)for(var C=A(f.cues,x,M),E=0;E<C.length;E++)f.removeCue(C[E]);w==="disabled"&&(f.mode=w)}function P(f,x){if(x<f[0].startTime)return 0;var M=f.length-1;if(x>f[M].endTime)return-1;for(var w=0,C=M;w<=C;){var E=Math.floor((C+w)/2);if(x<f[E].startTime)C=E-1;else if(x>f[E].startTime&&w<M)w=E+1;else return E}return f[w].startTime-x<x-f[C].startTime?w:C}function A(f,x,M){var w=[],C=P(f,x);if(C>-1)for(var E=C,d=f.length;E<d;E++){var a=f[E];if(a.startTime>=x&&a.endTime<=M)w.push(a);else if(a.startTime>M)return w}return w}},"./src/utils/time-ranges.ts":function(ne,$,D){"use strict";D.r($);var Y={toString:function(R){for(var W="",B=R.length,P=0;P<B;P++)W+="["+R.start(P).toFixed(3)+","+R.end(P).toFixed(3)+"]";return W}};$.default=Y},"./src/utils/timescale-conversion.ts":function(ne,$,D){"use strict";D.r($),D.d($,"toTimescaleFromBase",function(){return F}),D.d($,"toTimescaleFromScale",function(){return R}),D.d($,"toMsFromMpegTsClock",function(){return W}),D.d($,"toMpegTsClockFromTimescale",function(){return B});var Y=9e4;function F(P,A,f,x){f===void 0&&(f=1),x===void 0&&(x=!1);var M=P*A*f;return x?Math.round(M):M}function R(P,A,f,x){return f===void 0&&(f=1),x===void 0&&(x=!1),F(P,A,1/f,x)}function W(P,A){return A===void 0&&(A=!1),F(P,1e3,1/Y,A)}function B(P,A){return A===void 0&&(A=1),F(P,Y,1/A)}},"./src/utils/typed-array.ts":function(ne,$,D){"use strict";D.r($),D.d($,"sliceUint8",function(){return Y});function Y(F,R,W){return Uint8Array.prototype.slice?F.slice(R,W):new Uint8Array(Array.prototype.slice.call(F,R,W))}},"./src/utils/vttcue.ts":function(ne,$,D){"use strict";D.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],F=["start","middle","end","left","right"];function R(f,x){if(typeof x!="string")return!1;if(!Array.isArray(f))return!1;var M=x.toLowerCase();return~f.indexOf(M)?M:!1}function W(f){return R(Y,f)}function B(f){return R(F,f)}function P(f){for(var x=arguments.length,M=new Array(x>1?x-1:0),w=1;w<x;w++)M[w-1]=arguments[w];for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var d in E)f[d]=E[d]}return f}function A(f,x,M){var w=this,C={enumerable:!0};w.hasBeenReset=!1;var E="",d=!1,a=f,s=x,h=M,L=null,p="",v=!0,k="auto",b="start",g=50,c="middle",u=50,o="middle";Object.defineProperty(w,"id",P({},C,{get:function(){return E},set:function(S){E=""+S}})),Object.defineProperty(w,"pauseOnExit",P({},C,{get:function(){return d},set:function(S){d=!!S}})),Object.defineProperty(w,"startTime",P({},C,{get:function(){return a},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");a=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",P({},C,{get:function(){return s},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");s=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",P({},C,{get:function(){return h},set:function(S){h=""+S,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",P({},C,{get:function(){return L},set:function(S){L=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",P({},C,{get:function(){return p},set:function(S){var m=W(S);if(m===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",P({},C,{get:function(){return v},set:function(S){v=!!S,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",P({},C,{get:function(){return k},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",P({},C,{get:function(){return b},set:function(S){var m=B(S);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");b=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",P({},C,{get:function(){return g},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");g=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",P({},C,{get:function(){return c},set:function(S){var m=B(S);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",P({},C,{get:function(){return u},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");u=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",P({},C,{get:function(){return o},set:function(S){var m=B(S);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");o=m,this.hasBeenReset=!0}})),w.displayState=void 0}return A.prototype.getCueAsHTML=function(){var f=self.WebVTT;return f.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ne,$,D){"use strict";D.r($),D.d($,"parseTimeStamp",function(){return R}),D.d($,"fixLineBreaks",function(){return x}),D.d($,"VTTParser",function(){return M});var Y=D("./src/utils/vttcue.ts"),F=function(){function w(){}var C=w.prototype;return C.decode=function(d,a){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},w}();function R(w){function C(d,a,s,h){return(d|0)*3600+(a|0)*60+(s|0)+parseFloat(h||0)}var E=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?C(E[2],E[3],0,E[4]):C(E[1],E[2],E[3],E[4]):null}var W=function(){function w(){this.values=Object.create(null)}var C=w.prototype;return C.set=function(d,a){!this.get(d)&&a!==""&&(this.values[d]=a)},C.get=function(d,a,s){return s?this.has(d)?this.values[d]:a[s]:this.has(d)?this.values[d]:a},C.has=function(d){return d in this.values},C.alt=function(d,a,s){for(var h=0;h<s.length;++h)if(a===s[h]){this.set(d,a);break}},C.integer=function(d,a){/^-?\d+$/.test(a)&&this.set(d,parseInt(a,10))},C.percent=function(d,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},w}();function B(w,C,E,d){var a=d?w.split(d):[w];for(var s in a){if(typeof a[s]!="string")continue;var h=a[s].split(E);if(h.length!==2)continue;var L=h[0],p=h[1];C(L,p)}}var P=new Y.default(0,0,""),A=P.align==="middle"?"middle":"center";function f(w,C,E){var d=w;function a(){var L=R(w);if(L===null)throw new Error("Malformed timestamp: "+d);return w=w.replace(/^[^\sa-zA-Z-]+/,""),L}function s(L,p){var v=new W;B(L,function(g,c){var u;switch(g){case"region":for(var o=E.length-1;o>=0;o--)if(E[o].id===c){v.set(g,E[o].region);break}break;case"vertical":v.alt(g,c,["rl","lr"]);break;case"line":u=c.split(","),v.integer(g,u[0]),v.percent(g,u[0])&&v.set("snapToLines",!1),v.alt(g,u[0],["auto"]),u.length===2&&v.alt("lineAlign",u[1],["start",A,"end"]);break;case"position":u=c.split(","),v.percent(g,u[0]),u.length===2&&v.alt("positionAlign",u[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":v.percent(g,c);break;case"align":v.alt(g,c,["start",A,"end","left","right"]);break}},/:/,/\s/),p.region=v.get("region",null),p.vertical=v.get("vertical","");var k=v.get("line","auto");k==="auto"&&P.line===-1&&(k=-1),p.line=k,p.lineAlign=v.get("lineAlign","start"),p.snapToLines=v.get("snapToLines",!0),p.size=v.get("size",100),p.align=v.get("align",A);var b=v.get("position","auto");b==="auto"&&P.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function h(){w=w.replace(/^\s+/,"")}if(h(),C.startTime=a(),h(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);w=w.substr(3),h(),C.endTime=a(),h(),s(w,C)}function x(w){return w.replace(/<br(?: \/)?>/gi,`
`)}var M=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 C=w.prototype;return C.parse=function(d){var a=this;d&&(a.buffer+=a.decoder.decode(d,{stream:!0}));function s(){var b=a.buffer,g=0;for(b=x(b);g<b.length&&b[g]!=="\r"&&b[g]!==`
`;)++g;var c=b.substr(0,g);return b[g]==="\r"&&++g,b[g]===`
`&&++g,a.buffer=b.substr(g),c}function h(b){B(b,function(g,c){},/:/)}try{var L="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;L=s();var p=L.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var v=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;v?v=!1:L=s();switch(a.state){case"HEADER":/:/.test(L)?h(L):L||(a.state="ID");continue;case"NOTE":L||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){a.state="NOTE";break}if(!L)continue;if(a.cue=new Y.default(0,0,""),a.state="CUE",L.indexOf("-->")===-1){a.cue.id=L;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{f(L,a.cue,a.regionList)}catch(b){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var k=L.indexOf("-->")!==-1;if(!L||k&&(v=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=L}continue;case"BADCUE":L||(a.state="ID")}}}catch(b){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},C.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(a){d.onparsingerror&&d.onparsingerror(a)}return d.onflush&&d.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(ne,$,D){"use strict";D.r($),D.d($,"generateCueId",function(){return M}),D.d($,"parseWebVTT",function(){return C});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/vttparser.ts"),R=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),B=D("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,A=function(d,a,s){return s===void 0&&(s=0),d.substr(s,a.length)===a},f=function(d){var a=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),h=parseInt(d.substr(-9,2)),L=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(a)||!Object(Y.isFiniteNumber)(s)||!Object(Y.isFiniteNumber)(h)||!Object(Y.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return a+=1e3*s,a+=60*1e3*h,a+=60*60*1e3*L,a},x=function(d){for(var a=5381,s=d.length;s;)a=a*33^d.charCodeAt(--s);return(a>>>0).toString()};function M(E,d,a){return x(E.toString())+x(d.toString())+x(a)}var w=function(d,a,s){var h=d[a],L=d[h.prevCC];if(!L||!L.new&&h.new){d.ccOffset=d.presentationOffset=h.start,h.new=!1;return}for(;(p=L)!==null&&p!==void 0&&p.new;){var p;d.ccOffset+=h.start-L.start,h.new=!1,h=L,L=d[h.prevCC]}d.presentationOffset=s};function C(E,d,a,s,h,L,p,v){var k=new F.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(P,`
`).split(`
`),g=[],c=Object(W.toMpegTsClockFromTimescale)(d,a),u="00:00.000",o=0,T=0,S,m=!0,O=!1;k.oncue=function(U){var j=s[h],K=s.ccOffset,I=(o-c)/9e4;if(j!=null&&j.new&&(T!==void 0?K=s.ccOffset=j.start:w(s,h,I)),I&&(K=I-s.presentationOffset),O){var N=U.endTime-U.startTime,X=Object(B.normalizePts)((U.startTime+K-T)*9e4,L*9e4)/9e4;U.startTime=X,U.endTime=X+N}var q=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(q)),U.id||(U.id=M(U.startTime,U.endTime,q)),U.endTime>0&&g.push(U)},k.onparsingerror=function(U){S=U},k.onflush=function(){if(S){v(S);return}p(g)},b.forEach(function(U){if(m)if(A(U,"X-TIMESTAMP-MAP=")){m=!1,O=!0,U.substr(16).split(",").forEach(function(j){A(j,"LOCAL:")?u=j.substr(6):A(j,"MPEGTS:")&&(o=parseInt(j.substr(7)))});try{T=f(u)/1e3}catch(j){O=!1,S=j}return}else U===""&&(m=!1);k.parse(U+`
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(ne,$,D){"use strict";D.r($);var Y=D("./src/utils/logger.ts"),F=D("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,W=function(){function B(A){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=A?A.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var P=B.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var f=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),f&&(f.onreadystatechange=null,f.onprogress=null,f.readyState!==4&&(this.stats.aborted=!0,f.abort()))},P.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(f,x,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=f,this.config=x,this.callbacks=M,this.retryDelay=x.retryDelay,this.loadInternal()},P.loadInternal=function(){var f=this.config,x=this.context;if(!f)return;var M=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var C=this.xhrSetup;try{if(C)try{C(M,x.url)}catch(a){M.open("GET",x.url,!0),C(M,x.url)}M.readyState||M.open("GET",x.url,!0);var E=this.context.headers;if(E)for(var d in E)M.setRequestHeader(d,E[d])}catch(a){this.callbacks.onError({code:M.status,text:a.message},x,M);return}x.rangeEnd&&M.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout),M.send()},P.readystatechange=function(){var f=this.context,x=this.loader,M=this.stats;if(!f||!x)return;var w=x.readyState,C=this.config;if(M.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),w===4){x.onreadystatechange=null,x.onprogress=null;var E=x.status;if(E>=200&&E<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var d,a;if(f.responseType==="arraybuffer"?(d=x.response,a=d.byteLength):(d=x.responseText,a=d.length),M.loaded=M.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(M,f,d,x),!this.callbacks)return;var h={url:x.responseURL,data:d};this.callbacks.onSuccess(h,M,f,x)}else M.retry>=C.maxRetry||E>=400&&E<499?(Y.logger.error(E+" while loading "+f.url),this.callbacks.onError({code:E,text:x.statusText},f,x)):(Y.logger.warn(E+" while loading "+f.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,C.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.timeout)},P.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var f=this.callbacks;f&&(this.abortInternal(),f.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(f){var x=this.stats;x.loaded=f.loaded,f.lengthComputable&&(x.total=f.total)},P.getCacheAge=function(){var f=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");f=x?parseFloat(x):null}return f},B}();$.default=W}}).default})},vHTk:function(lt,$e,re){lt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(lt,$e){function re(){this.buffer=new Array,this.length=0}re.prototype={get:function(ne){var $=Math.floor(ne/8);return(this.buffer[$]>>>7-ne%8&1)==1},put:function(ne,$){for(var D=0;D<$;D++)this.putBit((ne>>>$-D-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(ne){var $=Math.floor(this.length/8);this.buffer.length<=$&&this.buffer.push(0),ne&&(this.buffer[$]|=128>>>this.length%8),this.length++}},lt.exports=re},wzkS:function(lt,$e,re){"use strict";re.d($e,"c",function(){return F}),re.d($e,"b",function(){return R}),re.d($e,"d",function(){return W}),re.d($e,"a",function(){return P}),re.d($e,"e",function(){return A});var ne=re("9og8"),$=re("WmNS"),D=re.n($),Y=re("ErOA");function F(f){return Object(Y.c)("libraries/".concat(f,".json"))}function R(){return Object(Y.c)("library_tags.json")}function W(f){return B.apply(this,arguments)}function B(){return B=Object(ne.a)(D.a.mark(function f(x){var M;return D.a.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return C.next=2,Object(Y.b)("attachments/".concat(x,".json"));case 2:return M=C.sent,C.abrupt("return",M.status===0);case 4:case"end":return C.stop()}},f)})),B.apply(this,arguments)}function P(f){return Object(Y.f)("libraries.json",f)}function A(f,x){return Object(Y.g)("libraries/".concat(f,".json"),x)}},y5JW:function(lt,$e,re){"use strict";re.d($e,"c",function(){return E}),re.d($e,"a",function(){return d});var ne=re("DZo9"),$=re("8z0m"),D=re("+L6B"),Y=re("2/Rp"),F=re("9og8"),R=re("k1fw"),W=re("oBTY"),B=re("miYZ"),P=re("tsqr"),A=re("WmNS"),f=re.n(A),x=re("q1tI"),M=re.n(x),w=re("m3rI"),C=re("wzkS"),E="\u3000\u3000";function d(a){var s=["Bytes","KB","MB","GB","TB"];if(a==0)return"0 Byte";var h=parseInt(""+Math.floor(Math.log(a)/Math.log(1024)),10);return(a/Math.pow(1024,h)).toFixed(1)+" "+s[h]}$e.b=function(a){var s=a.value,h=s===void 0?[]:s,L=a.action,p=a.onChange,v=a.className,k=a.maxSize,b=k===void 0?150:k,g=a.title,c=g===void 0?"\u6587\u4EF6\u4E0A\u4F20":g,u=a.accept,o=u===void 0?null:u,T={multiple:!1,fileList:h,accept:o,withCredentials:!0,beforeUpload:function(O){var U=O.size/1024/1024;return U<b?!0:(P.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(b,"MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20")),Promise.reject())},action:"".concat(w.a.API_SERVER,"/api/attachments.json"),onChange:function(O){var U=Object(W.a)(O.fileList);U=U.map(function(j){return j.name.indexOf(E)===-1&&(j.name="".concat(j.name).concat(E).concat(d(j.size))),Object(R.a)({},j)}),p(U)},onRemove:function(){var m=Object(F.a)(f.a.mark(function U(j){var K,I,N;return f.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(K=j.size/1024/1024,!(j.status==="uploading")){q.next=3;break}return q.abrupt("return",!0);case 3:if(K<b){q.next=7;break}return q.abrupt("return",!0);case 7:if(I=j.response?j.response.id:j.uid,!I){q.next=15;break}return q.next=11,Object(C.d)(j.response?j.response.id:j.id);case 11:return N=q.sent,q.abrupt("return",N);case 15:return q.abrupt("return",!0);case 16:case"end":return q.stop()}},U)}));function O(U){return m.apply(this,arguments)}return O}()};function S(m){m.preventDefault(),m.stopPropagation()}return M.a.createElement("div",{className:"single-upload ".concat(v||"")},M.a.createElement($.a,T,M.a.createElement(Y.a,{type:"primary",title:h.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:h.length>0,ghost:!0},c),M.a.createElement("span",{onClick:S,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M) ")))}}}]);