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__Forums__New.e43cefc1.asy...

372 lines
951 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[146,5,6,7],{"+NIl":function(bt,qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(Q,D){"use strict";function Z(_,w){_.cmdState.push(w)}function B(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function P(_){var w=_.cmdState.pop();w&&w.closeBracket()}function G(_){for(var w=_.cmdState,S=w.length-1;S>=0;S--){var h=w[S];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function j(_,w,S){return function(){this.name=_,this.bracketNo=0,this.style=w,this.styles=S,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var I={};I.importmodule=j("importmodule","tag",["string","builtin"]),I.documentclass=j("documentclass","tag",["","atom"]),I.usepackage=j("usepackage","tag",["atom"]),I.begin=j("begin","tag",["atom"]),I.end=j("end","tag",["atom"]),I.label=j("label","tag",["atom"]),I.ref=j("ref","tag",["atom"]),I.eqref=j("eqref","tag",["atom"]),I.cite=j("cite","tag",["atom"]),I.bibitem=j("bibitem","tag",["atom"]),I.Bibitem=j("Bibitem","tag",["atom"]),I.RBibitem=j("RBibitem","tag",["atom"]),I.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function k(_,w){_.f=w}function v(_,w){var S;if(_.match(/^\\[a-zA-Z@]+/)){var h=_.current().slice(1);return S=I.hasOwnProperty(h)?I[h]:I.DEFAULT,S=new S,Z(w,S),k(w,R),S.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return k(w,function(l,u){return T(l,u,"\\]")}),"keyword";if(_.match("\\("))return k(w,function(l,u){return T(l,u,"\\)")}),"keyword";if(_.match("$$"))return k(w,function(l,u){return T(l,u,"$$")}),"keyword";if(_.match("$"))return k(w,function(l,u){return T(l,u,"$")}),"keyword";var o=_.next();if(o=="%")return _.skipToEnd(),"comment";if(o=="}"||o=="]"){if(S=B(w),S)S.closeBracket(o),k(w,R);else return"error";return"bracket"}else return o=="{"||o=="["?(S=I.DEFAULT,S=new S,Z(w,S),"bracket"):/\d/.test(o)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),S=G(w),S.name=="begin"&&(S.argument=_.current()),S.styleIdentifier())}function T(_,w,S){if(_.eatSpace())return null;if(S&&_.match(S))return k(w,v),"keyword";if(_.match(/^\\[a-zA-Z@]+/))return"tag";if(_.match(/^[a-zA-Z]+/))return"variable-2";if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/]/))return"tag";if(_.match(/^[\^_&]/))return"tag";if(_.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(_.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=_.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(_.skipToEnd(),"comment"):"error"}function R(_,w){var S=_.peek(),h;return S=="{"||S=="["?(h=B(w),h.openBracket(S),_.eat(S),k(w,v),"bracket"):/[ \t\r]/.test(S)?(_.eat(S),null):(k(w,v),P(w),v(_,w))}return{startState:function(){var _=D.inMathMode?function(w,S){return T(w,S)}:v;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,w){return w.f(_,w)},blankLine:function(_){_.f=v,_.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"19Vz":function(bt,qe,ie){(function(le){le(ie("VrN/"))})(function(le){le.defineOption("placeholder","",function(j,I,k){var v=k&&k!=le.Init;if(I&&!v)j.on("blur",B),j.on("change",P),j.on("swapDoc",P),le.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){Z(j)}),P(j);else if(!I&&v){j.off("blur",B),j.off("change",P),j.off("swapDoc",P),le.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),Q(j);var T=j.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}I&&!j.hasFocus()&&B(j)});function Q(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function D(j){Q(j);var I=j.state.placeholder=document.createElement("pre");I.style.cssText="height: 0; overflow: visible",I.style.direction=j.getOption("direction"),I.className="CodeMirror-placeholder CodeMirror-line-like";var k=j.getOption("placeholder");typeof k=="string"&&(k=document.createTextNode(k)),I.appendChild(k),j.display.lineSpace.insertBefore(I,j.display.lineSpace.firstChild)}function Z(j){setTimeout(function(){var I=!1,k=j.getInputField();k.nodeName=="TEXTAREA"?I=!k.value:j.lineCount()==1&&(I=!/[^\u200b]/.test(k.querySelector(".CodeMirror-line").textContent)),I?D(j):Q(j)},20)}function B(j){G(j)&&D(j)}function P(j){var I=j.getWrapperElement(),k=G(j);I.className=I.className.replace(" CodeMirror-empty","")+(k?" CodeMirror-empty":""),k?D(j):Q(j)}function G(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(bt,qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";var Q={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};le.defineMode("xml",function(Z,B){var P=Z.indentUnit,G={},j=B.htmlMode?Q:D;for(var I in j)G[I]=j[I];for(var I in B)G[I]=B[I];var k,v;function T(a,x){function y(U){return x.tokenize=U,U(a,x)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(w("atom","]]>")):null:a.match("--")?y(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(S(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=w("meta","?>"),"meta"):(k=a.eat("/")?"closeTag":"openTag",x.tokenize=R,"tag bracket");if(E=="&"){var N;return a.eat("#")?a.eat("x")?N=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):N=a.eatWhile(/[\d]/)&&a.eat(";"):N=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),N?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function R(a,x){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return x.tokenize=T,k=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return k="equals",null;if(y=="<"){x.tokenize=T,x.state=u,x.tagName=x.tagStart=null;var E=x.tokenize(a,x);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=_(y),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(a){var x=function(y,E){for(;!y.eol();)if(y.next()==a){E.tokenize=R;break}return"string"};return x.isInAttribute=!0,x}function w(a,x){return function(y,E){for(;!y.eol();){if(y.match(x)){E.tokenize=T;break}y.next()}return a}}function S(a){return function(x,y){for(var E;(E=x.next())!=null;){if(E=="<")return y.tokenize=S(a+1),y.tokenize(x,y);if(E==">")if(a==1){y.tokenize=T;break}else return y.tokenize=S(a-1),y.tokenize(x,y)}return"meta"}}function h(a,x,y){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=y,(G.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!G.contextGrabbers.hasOwnProperty(y)||!G.contextGrabbers[y].hasOwnProperty(x))return;o(a)}}function u(a,x,y){return a=="openTag"?(y.tagStart=x.column(),A):a=="closeTag"?p:u}function A(a,x,y){return a=="word"?(y.tagName=x.current(),v="tag",b):G.allowMissingTagName&&a=="endTag"?(v="tag bracket",b(a,x,y)):(v="error",A)}function p(a,x,y){if(a=="word"){var E=x.current();return y.context&&y.context.tagName!=E&&G.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==E||G.matchClosing===!1?(v="tag",f):(v="tag error",L)}else return G.allowMissingTagName&&a=="endTag"?(v="tag bracket",f(a,x,y)):(v="error",L)}function f(a,x,y){return a!="endTag"?(v="error",f):(o(y),u)}function L(a,x,y){return v="error",f(a,x,y)}function b(a,x,y){if(a=="word")return v="attribute",m;if(a=="endTag"||a=="selfcloseTag"){var E=y.tagName,N=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(E)?l(y,E):(l(y,E),y.context=new h(y,E,N==y.indented)),u}return v="error",b}function m(a,x,y){return a=="equals"?c:(G.allowMissing||(v="error"),b(a,x,y))}function c(a,x,y){return a=="string"?d:a=="word"&&G.allowUnquoted?(v="string",b):(v="error",b(a,x,y))}function d(a,x,y){return a=="string"?d:b(a,x,y)}return{startState:function(a){var x={tokenize:T,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;k=null;var y=x.tokenize(a,x);return(y||k)&&y!="comment"&&(v=null,x.state=x.state(k||y,a,x),v&&(y=v=="error"?y+" error":v)),y},indent:function(a,x,y){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(E&&E.noIndent)return le.Pass;if(a.tokenize!=R&&a.tokenize!=T)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var N=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(N&&N[1])for(;E;)if(E.tagName==N[2]){E=E.prev;break}else if(G.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(N)for(;E;){var U=G.contextGrabbers[E.tagName];if(U&&U.hasOwnProperty(N[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],y=a.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return p});var le=ie("+L6B"),Q=ie("2/Rp"),D=ie("2qtc"),Z=ie("kLXV"),B=ie("9og8"),P=ie("k1fw"),G=ie("miYZ"),j=ie("tsqr"),I=ie("oBTY"),k=ie("tJVT"),v=ie("DZo9"),T=ie("8z0m"),R=ie("WmNS"),_=ie.n(R),w=ie("q1tI"),S=ie.n(w),h=ie("m3rI"),o=ie("wzkS"),l=ie("y5JW"),u=ie("LtfV"),A=T.a.Dragger;function p(f){var L=[];return f&&f.length>0&&(L=f.map(function(b){return{uid:b.id,id:b.id,name:b.title+l.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),L}qe.b=function(f){var L=f.value,b=f.onChange,m=f.action,c=f.className,d=f.maxSize,a=d===void 0?150:d,x=f.title,y=x===void 0?"\u4E0A\u4F20\u9644\u4EF6":x,E=f.showRemoveModal,N=E===void 0?!1:E,U=f.accept,K=U===void 0?"":U,V=f.additionalText,O=f.isDragger,M=f.number,$=M===void 0?1e3:M,ee=f.aloneClear,oe=ee===void 0?!1:ee,fe=f.restrict,Re=fe===void 0?!0:fe,Ee=Object(w.useState)(!1),Ce=Object(k.a)(Ee,2),we=Ce[0],Te=Ce[1],ge=Object(w.useState)(L||[]),ue=Object(k.a)(ge,2),te=ue[0],he=ue[1];Object(w.useEffect)(function(){L&&(he(Object(I.a)(L)),$===(L==null?void 0:L.length)&&Te(!0))},[L]);var ae=function(){setTimeout(function(){te.pop(),he(Object(I.a)(te))},500)},_e={multiple:!0,disabled:we,accept:K,withCredentials:!0,fileList:te,beforeUpload:function(Pe,Me){var Ne=Pe.size/1024/1024;return te.concat(Me).length>$?(te.pop(),he(Object(I.a)(te)),j.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat($,"\u4E2A\u6587\u4EF6")),oe?Promise.reject():(ae(),!1)):Ne<a?!0:(j.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(a,"MB).")),oe?Promise.reject():(ae(),!1))},action:m||"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(Pe){var Me=Object(I.a)(Pe.fileList);Me.length>=$?Te(!0):Te(!1),he(Object(I.a)(Me)),Me=Me.map(function(Ne){var Fe;if(Ne!=null&&(Fe=Ne.response)!==null&&Fe!==void 0&&Fe.id){var Ue;Ne.url="/api/attachments/".concat(Ne==null||((Ue=Ne.response)===null||Ue===void 0)?void 0:Ue.id)}return Ne.name.indexOf(l.c)===-1&&(Ne.name="".concat(Ne.name).concat(l.c).concat(Object(l.a)(Ne.size))),Object(P.a)({},Ne)}),console.log("info:",Pe),b(Me)},onRemove:function(){var ye=Object(B.a)(_.a.mark(function Me(Ne){var Fe;return _.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(Fe=function(){var tt=Object(B.a)(_.a.mark(function et(){var Ye,$e;return _.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(Ye=Ne.response?Ne.response.id:Ne.id,!Ye){Ze.next=8;break}return Ze.next=4,Object(o.d)(Ne.response?Ne.response.id:Ne.uid);case 4:return $e=Ze.sent,Ze.abrupt("return",$e);case 8:return Ze.abrupt("return",!0);case 9:case"end":return Ze.stop()}},et)}));return function(){return tt.apply(this,arguments)}}(),!N){Be.next=5;break}return Be.abrupt("return",new Promise(function(tt,et){Z.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:S.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ye=Object(B.a)(_.a.mark(function lt(){var Ze;return _.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return ke.next=2,Fe();case 2:Ze=ke.sent,j.b.success("\u5220\u9664\u6210\u529F"),tt(!0);case 5:case"end":return ke.stop()}},lt)}));function $e(){return Ye.apply(this,arguments)}return $e}(),onCancel:function(){return tt(!1)}})}));case 5:return Be.next=7,Fe();case 7:return Be.abrupt("return",Be.sent);case 8:case"end":return Be.stop()}},Me)}));function Pe(Me){return ye.apply(this,arguments)}return Pe}()};function Oe(ye){ye.preventDefault(),ye.stopPropagation()}return S.a.createElement("div",{className:"multi-upload ".concat(c||"")},O&&S.a.createElement(A,_e,S.a.createElement("p",{className:"ant-upload-drag-icon"},S.a.createElement(u.a,null)),S.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",S.a.createElement("br",null),S.a.createElement("span",{style:{display:Re?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB) ")),V),!O&&S.a.createElement(T.a,_e,S.a.createElement(Q.a,{disabled:we},y),S.a.createElement("span",{onClick:Oe,style:{marginLeft:10,color:"#FA6400",display:Re?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB) ")))}},"55Ip":function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return l}),ie.d(qe,"b",function(){return b});var le=ie("Ty5D"),Q=ie("dI71"),D=ie("q1tI"),Z=ie.n(D),B=ie("YS25"),P=ie("17x9"),G=ie.n(P),j=ie("wx14"),I=ie("zLVn"),k=ie("9R94"),v=function(c){Object(Q.a)(d,c);function d(){for(var x,y=arguments.length,E=new Array(y),N=0;N<y;N++)E[N]=arguments[N];return x=c.call.apply(c,[this].concat(E))||this,x.history=Object(B.a)(x.props),x}var a=d.prototype;return a.render=function(){return Z.a.createElement(le.c,{history:this.history,children:this.props.children})},d}(Z.a.Component),T=function(c){Object(Q.a)(d,c);function d(){for(var x,y=arguments.length,E=new Array(y),N=0;N<y;N++)E[N]=arguments[N];return x=c.call.apply(c,[this].concat(E))||this,x.history=Object(B.b)(x.props),x}var a=d.prototype;return a.render=function(){return Z.a.createElement(le.c,{history:this.history,children:this.props.children})},d}(Z.a.Component),R=function(d,a){return typeof d=="function"?d(a):d},_=function(d,a){return typeof d=="string"?Object(B.c)(d,null,null,a):d},w=function(d){return d},S=Z.a.forwardRef;typeof S=="undefined"&&(S=w);function h(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=S(function(c,d){var a=c.innerRef,x=c.navigate,y=c.onClick,E=Object(I.a)(c,["innerRef","navigate","onClick"]),N=E.target,U=Object(j.a)({},E,{onClick:function(V){try{y&&y(V)}catch(O){throw V.preventDefault(),O}!V.defaultPrevented&&V.button===0&&(!N||N==="_self")&&!h(V)&&(V.preventDefault(),x())}});return w!==S?U.ref=d||a:U.ref=a,Z.a.createElement("a",U)}),l=S(function(c,d){var a=c.component,x=a===void 0?o:a,y=c.replace,E=c.to,N=c.innerRef,U=Object(I.a)(c,["component","replace","to","innerRef"]);return Z.a.createElement(le.e.Consumer,null,function(K){K||Object(k.a)(!1);var V=K.history,O=_(R(E,K.location),K.location),M=O?V.createHref(O):"",$=Object(j.a)({},U,{href:M,navigate:function(){var oe=R(E,K.location),fe=y?V.replace:V.push;fe(oe)}});return w!==S?$.ref=d||N:$.innerRef=N,Z.a.createElement(x,$)})});if(!1)var u,A;var p=function(d){return d},f=Z.a.forwardRef;typeof f=="undefined"&&(f=p);function L(){for(var c=arguments.length,d=new Array(c),a=0;a<c;a++)d[a]=arguments[a];return d.filter(function(x){return x}).join(" ")}var b=f(function(c,d){var a=c["aria-current"],x=a===void 0?"page":a,y=c.activeClassName,E=y===void 0?"active":y,N=c.activeStyle,U=c.className,K=c.exact,V=c.isActive,O=c.location,M=c.sensitive,$=c.strict,ee=c.style,oe=c.to,fe=c.innerRef,Re=Object(I.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Z.a.createElement(le.e.Consumer,null,function(Ee){Ee||Object(k.a)(!1);var Ce=O||Ee.location,we=_(R(oe,Ce),Ce),Te=we.pathname,ge=Te&&Te.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=ge?Object(le.f)(Ce.pathname,{path:ge,exact:K,sensitive:M,strict:$}):null,te=!!(V?V(ue,Ce):ue),he=te?L(U,E):U,ae=te?Object(j.a)({},ee,{},N):ee,_e=Object(j.a)({"aria-current":te&&x||null,className:he,style:ae,to:we},Re);return p!==f?_e.ref=d||fe:_e.innerRef=fe,Z.a.createElement(l,_e)})});if(!1)var m},"7/Dv":function(bt,qe,ie){bt.exports={bg:"bg___2rJyo",flexRow:"flexRow___2xuIa",flexJustifyCenter:"flexJustifyCenter___Z3bJt",flexAlignEnd:"flexAlignEnd___v7Ww-",flexAlignCenter:"flexAlignCenter___223DA",flexColumn:"flexColumn___3CNqR",formWrap:"formWrap___2b6uL",titleWrap:"titleWrap___1CMQA",fieldWrap:"fieldWrap___2BRrD",mdWrap:"mdWrap___3UYzt",backgroundFa:"backgroundFa___32wpj",button:"button___MHDAn"}},"7Cbv":function(bt,qe,ie){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Q=new Uint8Array(16);function D(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(Q)}var Z=/^(?:[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 B(R){return typeof R=="string"&&Z.test(R)}for(var P=B,G=[],j=0;j<256;++j)G.push((j+256).toString(16).substr(1));function I(R){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(G[R[_+0]]+G[R[_+1]]+G[R[_+2]]+G[R[_+3]]+"-"+G[R[_+4]]+G[R[_+5]]+"-"+G[R[_+6]]+G[R[_+7]]+"-"+G[R[_+8]]+G[R[_+9]]+"-"+G[R[_+10]]+G[R[_+11]]+G[R[_+12]]+G[R[_+13]]+G[R[_+14]]+G[R[_+15]]).toLowerCase();if(!P(w))throw TypeError("Stringified UUID is invalid");return w}var k=I;function v(R,_,w){R=R||{};var S=R.random||(R.rng||D)();if(S[6]=S[6]&15|64,S[8]=S[8]&63|128,_){w=w||0;for(var h=0;h<16;++h)_[w+h]=S[h];return _}return k(S)}var T=qe.a=v},"7ahc":function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return A});var le=ie("k1fw"),Q=ie("0Owb"),D=ie("+L6B"),Z=ie("2/Rp"),B=ie("y8nQ"),P=ie("Vl3Y"),G=ie("tJVT"),j=ie("OaEy"),I=ie("2fM7"),k=ie("q1tI"),v=ie.n(k),T=ie("VrN/"),R=ie.n(T),_=ie("p77/"),w=ie.n(_),S=ie("c5Ni"),h=ie.n(S),o=I.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={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"]};qe.b=function(p){var f=p.callback,L=p.onCancel,b=Object(k.useState)("python"),m=Object(G.a)(b,2),c=m[0],d=m[1];function a(y){d(u[y][1])}function x(y){f(y)}return v.a.createElement(P.a,Object(Q.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),v.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(I.a,{onChange:a},Object.keys(u).map(function(y){return v.a.createElement(o,{key:y,value:y},u[y][0])}))),v.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(A,{mode:c})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(Z.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function A(p){var f=p.value,L=p.onChange,b=p.mode,m=p.options,c=m===void 0?{}:m,d=Object(k.useRef)(),a=Object(k.useState)(),x=Object(G.a)(a,2),y=x[0],E=x[1];return Object(k.useEffect)(function(){if(y){function N(U){var K=U.getValue();L&&L(K)}return y.on("change",N),function(){y.off("change",N)}}},[y,L]),Object(k.useEffect)(function(){y&&y.setOption("mode",b)},[y,b]),Object(k.useEffect)(function(){y&&((f!==y.getValue()||f==="")&&setTimeout(function(){y.setValue(f||" ")},300))},[y,f]),Object(k.useEffect)(function(){if(d.current&&!y){var N=R.a.fromTextArea(d.current,Object(le.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(N)}},[d.current,y]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:d}))}},"8EBN":function(bt,qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";le.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 Q=0;Q<le.modeInfo.length;Q++){var D=le.modeInfo[Q];D.mimes&&(D.mime=D.mimes[0])}le.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.mime==Z)return P;if(P.mimes){for(var G=0;G<P.mimes.length;G++)if(P.mimes[G]==Z)return P}}if(/\+xml$/.test(Z))return le.findModeByMIME("application/xml");if(/\+json$/.test(Z))return le.findModeByMIME("application/json")},le.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.ext){for(var G=0;G<P.ext.length;G++)if(P.ext[G]==Z)return P}}},le.findModeByFileName=function(Z){for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.file&&P.file.test(Z))return P}var G=Z.lastIndexOf("."),j=G>-1&&Z.substring(G+1,Z.length);if(j)return le.findModeByExtension(j)},le.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B<le.modeInfo.length;B++){var P=le.modeInfo[B];if(P.name.toLowerCase()==Z)return P;if(P.alias){for(var G=0;G<P.alias.length;G++)if(P.alias[G].toLowerCase()==Z)return P}}}})},"8hTe":function(bt,qe,ie){bt.exports={button:"button___1wy9m"}},"9Bee":function(bt,qe,ie){"use strict";var le=ie("DYRE"),Q=ie("zeV3"),D=ie("+L6B"),Z=ie("2/Rp"),B=ie("k1fw"),P=ie("9og8"),G=ie("tJVT"),j=ie("WmNS"),I=ie.n(j),k=ie("q1tI"),v=ie.n(k),T=ie("vg9a"),R=ie("DlQD"),_=ie.n(R),w=ie("rUJ1");function S(z,s){var g=z.match(/^(\s+)(?:```)/);if(g===null)return s;var W=g[1];return s.split(`
`).map(function(X){var H=X.match(/^\s+/);if(H===null)return X;var ve=Object(G.a)(H,1),Ge=ve[0];return Ge.length>=W.length?X.slice(W.length):X}).join(`
`)}var h=[],o=["<ul>"],l=new _.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){h.length=0,o=["<ul>"]}var p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function f(z,s,g,W){if(s>=z.length||z[s].level<=g)return s;var X=z[s];W.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),s++;var H=[];return s=f(z,s,X.level,H),H.length>0&&(W.push("<ul>"),H.forEach(function(ve){W.push(ve)}),W.push("</ul>")),W.push("</li>"),s=f(z,s,g,W),s}function L(){return f(h,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(s){var g=u.exec(s);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(s){var g=this.rules.block.fences.exec(s);if(g){var W=g[0],X=S(W,g[3]||""),H=g[2]?g[2].trim():g[2];if(["latex","katex","math"].indexOf(H)>=0){var ve=d(),Ge=X;X=ve,a[ve]={type:"block",expression:Ge}}return{type:"code",raw:W,lang:H,text:X}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,d=function(){return"__special_katext_id_".concat(c++,"__")},a={};function x(){return a}function y(){c=0,a={}}function E(z){return z=z.replace(m,function(s,g){var W=d();return a[W]={type:"inline",expression:g},W}),z}var N=l.listitem;l.listitem=function(z){return N(E(z))};var U=l.paragraph;l.paragraph=function(z){return U(E(z))};var K=l.tablecell;l.tablecell=function(z,s){return K(E(z),s)},l.code=function(z,s,g){var W=(s||"").match(/\S*/)[0];return W?["latex","katex","math"].indexOf(W)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(g?z:Object(w.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(g?z:Object(w.escape)(z,!0))+"</code></pre>"},l.heading=function(z,s,g){var W=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:W,level:s,text:z}),"<h"+s+' id="'+W+'">'+z+"</h"+s+">"},_.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),_.a.use({tokenizer:b,renderer:l});var V=_.a,O=ie("SJMd"),M=ie("ulZh"),$=ie.n(M),ee=ie("m3rI"),oe=ie("Oy/b"),fe=ie("p5ED"),Re=ie("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 Ee=function(z,s){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,W){g.__proto__=W}||function(g,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(g[X]=W[X])})(z,s)};function Ce(z,s){function g(){this.constructor=z}Ee(z,s),z.prototype=s===null?Object.create(s):(g.prototype=s.prototype,new g)}function we(z,s,g,W){return new(g||(g=Promise))(function(X,H){function ve(dt){try{Qe(W.next(dt))}catch(ze){H(ze)}}function Ge(dt){try{Qe(W.throw(dt))}catch(ze){H(ze)}}function Qe(dt){var ze;dt.done?X(dt.value):(ze=dt.value,ze instanceof g?ze:new g(function(Et){Et(ze)})).then(ve,Ge)}Qe((W=W.apply(z,s||[])).next())})}function Te(z,s){var g,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function Ge(Qe){return function(dt){return function(ze){if(g)throw new TypeError("Generator is already executing.");for(;ve;)try{if(g=1,W&&(X=2&ze[0]?W.return:ze[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,ze[1])).done)return X;switch(W=0,X&&(ze=[2&ze[0],X.value]),ze[0]){case 0:case 1:X=ze;break;case 4:return ve.label++,{value:ze[1],done:!1};case 5:ve.label++,W=ze[1],ze=[0];continue;case 7:ze=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||ze[0]!==6&&ze[0]!==2)){ve=0;continue}if(ze[0]===3&&(!X||ze[1]>X[0]&&ze[1]<X[3])){ve.label=ze[1];break}if(ze[0]===6&&ve.label<X[1]){ve.label=X[1],X=ze;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(ze);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}ze=s.call(z,ve)}catch(Et){ze=[6,Et],W=0}finally{g=X=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Qe,dt])}}}function ge(){for(var z=0,s=0,g=arguments.length;s<g;s++)z+=arguments[s].length;var W=Array(z),X=0;for(s=0;s<g;s++)for(var H=arguments[s],ve=0,Ge=H.length;ve<Ge;ve++,X++)W[X]=H[ve];return W}var ue=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,g){for(var W=0,X=g;W<X.length;W++){var H=X[W],ve=H[0],Ge=H[1];s.setAttribute(ve,Ge)}},z.createRect=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",g.toString()),W&&z.setAttributes(X,W),X},z.createLine=function(s,g,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",g.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&z.setAttributes(ve,H),ve},z.createPolygon=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),g&&z.setAttributes(W,g),W},z.createCircle=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),g&&z.setAttributes(W,g),W},z.createEllipse=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(g/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(g/2).toString()),W&&z.setAttributes(X,W),X},z.createGroup=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(g,s),g},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,g,W,X,H,ve,Ge){var Qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Qe,[["id",s],["orient",g],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),Qe.appendChild(Ge),Qe},z.createText=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),s&&z.setAttributes(g,s),g},z.createTSpan=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,g&&z.setAttributes(W,g),W},z.createImage=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(g,s),g},z.createPoint=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=g,W},z.createPath=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),g&&z.setAttributes(W,g),W},z}(),te=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),he=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,g,W){var X=this;return new Promise(function(H){var ve=W!==void 0?W:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var Ge=document.createElementNS("http://www.w3.org/2000/svg","svg");Ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ge.setAttribute("width",g.width.baseVal.valueAsString),Ge.setAttribute("height",g.height.baseVal.valueAsString),Ge.setAttribute("viewBox","0 0 "+g.viewBox.baseVal.width.toString()+" "+g.viewBox.baseVal.height.toString()),Ge.innerHTML=g.innerHTML,X.naturalSize===!0?(Ge.width.baseVal.value=s.naturalWidth,Ge.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(Ge.width.baseVal.value=X.width,Ge.height.baseVal.value=X.height),ve.width=Ge.width.baseVal.value,ve.height=Ge.height.baseVal.value;var Qe=Ge.outerHTML,dt=ve.getContext("2d");X.markersOnly!==!0&&dt.drawImage(s,0,0,ve.width,ve.height);var ze=window.URL,Et=new Image(ve.width,ve.height);Et.setAttribute("crossOrigin","anonymous");var Dt=new Blob([Qe],{type:"image/svg+xml"}),Vt=ze.createObjectURL(Dt);Et.onload=function(){dt.drawImage(Et,0,0),ze.revokeObjectURL(Vt);var Ir=ve.toDataURL(X.imageType,X.imageQuality);H(Ir)},Et.src=Vt})},z}(),ae=function(){},_e=function(){function z(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new Oe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Oe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Oe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ye("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ye("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Oe=function(z,s){this.selector=z,this.style=s},ye=function(z,s){this.localName=z,this.style=s},Pe=function(){function z(s,g,W,X,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=g,this.markerItems=W,this.uiStyleSettings=X,this.styles=H,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(s){var g=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(H){var ve=document.createElement("div");ve.className=""+g.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",H.typeName),ve.innerHTML=H.icon,ve.addEventListener("click",function(){g.markerToolbarButtonClicked(ve,H)}),g.buttons.push(ve),g.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 X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<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(X,'<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()},z.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},z.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var g=0;g<this.markerButtons.length;g++)g<s||g===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[g]):(g===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[g]))}},z.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")},z.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(g){g.className=g.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),g.className=g.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),g.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,g,W){var X=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=g,H.setAttribute("data-action",W),H.addEventListener("click",function(){X.actionToolbarButtonClicked(H,W)}),W){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(H),this.buttons.push(H)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ye("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 ye("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ye("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ye("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 ye("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ye("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Oe("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Oe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(s,g){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(s){var g=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===s});g&&this.setActiveButton(g)},z.prototype.setCurrentMarker=function(s){var g=this;this.currentMarker=s,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){g.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},z}(),Me=function(){function z(s,g,W,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=g,this.uiStyleSettings=W,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new ye("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 ye("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ye("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ye("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ye("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 ye("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ye("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
padding: `+g+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Oe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Oe("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(s){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var g,W,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var ve;H.uiStyleSettings=X.uiStyleSettings;var Ge=document.createElement("div");Ge.className=X.toolboxButtonStyleClass.name+" "+((ve=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:X.toolboxButtonStyleColorsClass.name),Ge.innerHTML=H.icon,Ge.title=H.title,Ge.addEventListener("click",function(){X.panelButtonClick(H)}),X.panelButtons.push(Ge),X.buttonRow.appendChild(Ge)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var g=this,W=-1;if(s!==this.activePanel){W=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,ve){var Ge,Qe;H.className=g.toolboxButtonStyleClass.name+" "+(ve===W?""+((Ge=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ge!==void 0?Ge:g.toolboxActiveButtonStyleColorsClass.name):""+((Qe=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Qe!==void 0?Qe:g.toolboxButtonStyleColorsClass.name))})},z}(),Ne=function(z,s){this.title=z,this.icon=s},Fe=function(z){function s(g,W,X,H){var ve=z.call(this,g,H||'<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=W,ve.currentColor=X,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ce(s,z),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(X){var H=g.getColorBox(X);W.appendChild(H),g.colorBoxes.push(H)}),W},s.prototype.getColorBox=function(g){var W=this,X=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-X,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=H-2+"px",ve.style.height=H-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=(H+2)/2+"px",ve.style.borderColor=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){W.setCurrentColor(g,ve)});var Ge=document.createElement("div");return Ge.style.display="inline-block",Ge.style.width=H-2+"px",Ge.style.height=H-2+"px",Ge.style.backgroundColor=g,Ge.style.borderRadius=H/2+"px",g==="transparent"&&(Ge.style.fill=this.uiStyleSettings.toolboxAccentColor,Ge.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(Ge),ve},s.prototype.setCurrentColor=function(g,W){var X=this;this.currentColor=g,this.colorBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},s}(Ne),Ue=function(){function z(s,g,W){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=g,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(s){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(s,g){},z.prototype.dblClick=function(s,g){},z.prototype.manipulate=function(s){},z.prototype.pointerUp=function(s){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},z.prototype.scale=function(s,g){},z.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},z.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Be=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),tt=function(){function z(){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 z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z}(),et=function(){function z(){}return z.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},z.toSVGMatrix=function(s,g){return s.a=g.a,s.b=g.b,s.c=g.c,s.d=g.d,s.e=g.e,s.f=g.f,s},z}(),Ye=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(ue.createTransform()),H.setupControlBox(),H}return Ce(s,z),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(g){this._visual=g;var W=ue.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(g){return!!z.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(g);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.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"},s.prototype.pointerUp=function(g){var W=this.state;z.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},s.prototype.manipulate=function(g){var W=this.unrotatePoint(g);this.state==="creating"?this.resize(g):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(g)},s.prototype.resize=function(g){var W=this.manipulationStartLeft,X=this.manipulationStartWidth,H=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+g.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+g.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+g.y-this.manipulationStartY}X>=0?(this.left=W,this.width=X):(this.left=W+X,this.width=-X),ve>=0?(this.top=H,this.height=ve):(this.top=H+ve,this.height=-ve),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var W=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},s.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},s.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var W=this.container.getCTM(),X=ue.createPoint(g.x,g.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var W=this.container.getCTM();W=W.inverse();var X=ue.createPoint(g.x,g.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var g=ue.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),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 Be,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,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()},s.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()},s.prototype.createGrip=function(){var g=new tt;return g.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(g.visual),g},s.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,W=-g/2,X=W,H=(this.width+this.CB_DISTANCE)/2-g/2,ve=(this.height+this.CB_DISTANCE)/2-g/2,Ge=this.height+this.CB_DISTANCE-g/2,Qe=this.width+this.CB_DISTANCE-g/2;this.positionGrip(this.controlGrips.topLeft.visual,W,X),this.positionGrip(this.controlGrips.topCenter.visual,H,X),this.positionGrip(this.controlGrips.topRight.visual,Qe,X),this.positionGrip(this.controlGrips.centerLeft.visual,W,ve),this.positionGrip(this.controlGrips.centerRight.visual,Qe,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,W,Ge),this.positionGrip(this.controlGrips.bottomCenter.visual,H,Ge),this.positionGrip(this.controlGrips.bottomRight.visual,Qe,Ge),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(g,W,X){var H=g.transform.baseVal.getItem(0);H.setTranslate(W,X),g.transform.baseVal.replaceItem(H,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.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)},z.prototype.getState.call(this))},s.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var W=g;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W);var X=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:X.x*g,y:X.y*W});this.left=H.x,this.top=H.y,this.width=this.width*g,this.height=this.height*W,this.adjustControlBox()},s}(Ue),$e=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual)},s.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)},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){z.prototype.resize.call(this,g),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(g){z.prototype.pointerUp.call(this,g),this.setSize()},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},s.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},s.prototype.restoreState=function(g){var W=g;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W),this.setSize()},s.title="Rectangle marker",s}(Ye),lt=function(z){function s(g,W,X,H){var ve=z.call(this,g,H||'<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=W,ve.currentWidth=X,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ce(s,z),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentWidth(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=X.toString(),ve.style.marginRight="5px",H.appendChild(ve);var Ge=document.createElement("div");Ge.style.minHeight="20px",Ge.style.flexGrow="2",Ge.style.display="flex",Ge.style.alignItems="center";var Qe=document.createElement("hr");Qe.style.minWidth="20px",Qe.style.border="0px",Qe.style.borderTop=X+"px solid "+g.uiStyleSettings.toolboxColor,Qe.style.flexGrow="2",Ge.appendChild(Qe),H.appendChild(Ge),g.widthBoxes.push(H)}),W},s.prototype.setCurrentWidth=function(g,W){var X=this;this.currentWidth=g,this.widthBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Ne),Ze=function(z){function s(g,W,X,H){var ve=z.call(this,g,H||'<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=W,ve.currentStyle=X,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ce(s,z),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/g.styles.length-5+"%",H.style.borderColor=X===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentStyle(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var Ge=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+g.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;ve.innerHTML=Ge,H.appendChild(ve),g.styleBoxes.push(H)}),W},s.prototype.setCurrentStyle=function(g,W){var X=this;this.currentStyle=g,this.styleBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Ne),ot=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new Fe("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new lt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ce(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}($e),ke=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},nt=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!!z.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.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(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(g){var W=this.state;z.prototype.pointerUp.call(this,g),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(g),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},s.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var g=new tt;return g.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(g.visual),g},s.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},s.prototype.positionGrip=function(g,W,X){var H=g.transform.baseVal.getItem(0);H.setTranslate(W,X),g.transform.baseVal.replaceItem(H,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var W=g;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W),this.x1=this.x1*g,this.y1=this.y1*W,this.x2=this.x2*g,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},s}(Ue),Je=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new Fe("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new lt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==this.visibleLine)},s.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)},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()]]))},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var W=g;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(nt),Ie=function(z){function s(g,W,X,H){var ve=z.call(this,g,H||'<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=W,ve.currentFont=X,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ce(s,z),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(X){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/g.fonts.length-5+"%",H.style.borderColor=X===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentFont(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=X,ve.style.overflow="hidden";var Ge=document.createElement("div");Ge.style.whiteSpace="nowrap",Ge.style.overflow="hidden",Ge.style.textOverflow="ellipsis",Ge.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(Ge),H.appendChild(ve),g.fontBoxes.push(H)}),W},s.prototype.setCurrentFont=function(g,W){var X=this;this.currentFont=g,this.fontBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Ne),He=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=X.defaultColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new Fe("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Ie("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return Ce(s,z),s.prototype.ownsTarget=function(g){if(z.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(X){X===g&&(W=!0)}),W},s.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()},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.renderText=function(){var g=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(W){g.textElement.appendChild(ue.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var g=this.textElement.getBBox(),W=1;if(g.width>0&&g.height>0){var X=(1*this.width-this.width*this.padding*2/100)/g.width,H=(1*this.height-this.height*this.padding*2/100)/g.height;W=Math.min(X,H)}return W},s.prototype.getTextPosition=function(g){var W=this.textElement.getBBox(),X=0,H=0;return W.width>0&&W.height>0&&(X=(this.width-W.width*g)/2,H=this.height/2-W.height*g/2),{x:X,y:H}},s.prototype.sizeText=function(){var g=this.textElement.getBBox(),W=this.getTextScale(),X=this.getTextPosition(W);X.y-=g.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},s.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(g){z.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.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()]]))},s.prototype.pointerUp=function(g){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,g),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var g=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(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&W>.9;)W-=.1,g.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var X=W.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(X)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){g.textEditDivClicked(g.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var g=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),H={x:X.width*g,y:X.height*g};W.x-=H.x/2,W.y-=H.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*g,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},s.prototype.dblClick=function(g,W){z.prototype.dblClick.call(this,g,W),this.showTextEditor()},s.prototype.setColor=function(g){this.textElement&&ue.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},s.prototype.setFont=function(g){this.textElement&&ue.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var W=g;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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>',s}(Ye),xe=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=X.defaultColor,H.lineWidth=X.defaultStrokeWidth,H.pixelRatio=X.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new Fe("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new lt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var g=ue.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(g,W){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(g.x,g.y),this.drawing=!0):z.prototype.pointerDown.call(this,g,W)},s.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){z.prototype.resize.call(this,g),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,g)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var g=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=W[0],H=W[1],ve=W[2],Ge=W[3],Qe=!1,dt=0;dt<this.canvasElement.height;dt++)for(var ze=0;ze<this.canvasElement.width;ze++)g.data[dt*this.canvasElement.width*4+4*ze+3]>0&&(Qe=!0,dt<H&&(H=dt),ze<X&&(X=ze),dt>Ge&&(Ge=dt),ze>ve&&(ve=ze));if(Qe){this.left=X/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(ve-X)/this.pixelRatio,this.height=(Ge-H)/this.pixelRatio;var Et=document.createElement("canvas");Et.width=ve-X,Et.height=Ge-H,Et.getContext("2d").putImageData(this.canvasContext.getImageData(X,H,ve-X,Ge-H),0,0),this.drawingImgUrl=Et.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.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})},s.prototype.setColor=function(g){this.color=g,this.colorChanged(g)},s.prototype.setLineWidth=function(g){this.lineWidth=g},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){this.createVisual(),z.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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>',s}(Ye),pe=function(z){function s(g,W,X){var H=z.call(this,g,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=W,H.setCurrentType=H.setCurrentType.bind(H),H}return Ce(s,z),s.prototype.getUi=function(){var g=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var X=function(Ge){var Qe="both";switch(Ge){case 0:Qe="both";break;case 1:Qe="start";break;case 2:Qe="end";break;case 3:Qe="none"}var dt=document.createElement("div");if(dt.style.display="flex",dt.style.flexGrow="2",dt.style.alignItems="center",dt.style.justifyContent="space-between",dt.style.padding="5px",dt.style.borderWidth="2px",dt.style.borderStyle="solid",dt.style.borderColor=Qe===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",dt.addEventListener("click",function(){g.setCurrentType(Qe,dt)}),W.appendChild(dt),Qe==="both"||Qe==="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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ze.style.marginLeft="5px",dt.appendChild(ze)}var Et=document.createElement("div");Et.style.display="flex",Et.style.alignItems="center",Et.style.minHeight="20px",Et.style.flexGrow="2";var Dt=document.createElement("hr");if(Dt.style.minWidth="20px",Dt.style.border="0px",Dt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),Dt.style.flexGrow="2",Et.appendChild(Dt),dt.appendChild(Et),Qe==="both"||Qe==="end"){var Vt=document.createElement("div");Vt.style.display="flex",Vt.style.alignItems="center",Vt.style.minHeight="20px",Vt.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="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Vt.style.marginRight="5px",dt.appendChild(Vt)}H.typeBoxes.push(dt)},H=this,ve=0;ve<4;ve++)X(ve);return W},s.prototype.setCurrentType=function(g,W){var X=this;this.currentType=g,this.typeBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Ne),be=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new pe("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},s.prototype.getArrowPoints=function(g,W){var X=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return g-X/2+","+(W+H/2)+" "+g+","+(W-H/2)+" "+(g+X/2)+","+(W+H/2)},s.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)},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.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 g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(g){this.arrowType=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var W=g;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(Je),re=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.fillColor=X.defaultFillColor,H.strokeWidth=0,H.fillPanel=new Fe("Color",X.defaultColorSet,X.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return Ce(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}($e),ne=function(z){function s(g,W,X,H){var ve=z.call(this,g,H||'<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=W,ve.currentOpacity=X,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ce(s,z),s.prototype.getUi=function(){var g=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentOpacity(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=100*X+"%",H.appendChild(ve),g.opacityBoxes.push(H)}),W},s.prototype.setCurrentOpacity=function(g,W){var X=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Ne),se=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=X.defaultHighlightColor,H.strokeWidth=0,H.opacity=X.defaultHighlightOpacity,H.fillPanel=new Fe("Color",X.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ne("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Ce(s,z),s.prototype.setOpacity=function(g){this.opacity=g,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(re),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(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=X.defaultStrokeColor,H.bgColor=X.defaultFillColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new Fe("Text color",X.defaultColorSet,H.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>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new Fe("Fill color",X.defaultColorSet,H.bgColor,de),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Ie("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new tt,H.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return Ce(s,z),s.prototype.ownsTarget=function(g){return z.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},s.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)},s.prototype.pointerDown=function(g,W){this.state==="new"&&z.prototype.pointerDown.call(this,g,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,g,W)},s.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,g);else{var W=this.state==="creating";z.prototype.pointerUp.call(this,g),this.setTipPoints(W),this.positionTip()}},s.prototype.manipulate=function(g){if(this.tipMoving){var W=this.unrotatePoint(g);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,g)},s.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",g]]),ue.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},s.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},s.prototype.setTipPoints=function(g){g===void 0&&(g=!1);var W=Math.min(this.height/2,15),X=this.height/5;g&&(this.tipPosition={x:W+X/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+X,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-X},this.tipBase2Position={x:this.width,y:this.height-W}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-X})},s.prototype.resize=function(g){z.prototype.resize.call(this,g),this.positionTip()},s.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var g=this.tipGrip.visual.transform.baseVal.getItem(0);g.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(g,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},s.prototype.getState=function(){var g=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var W=g;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,z.prototype.restoreState.call(this,g),this.createTip(),this.setTipPoints()},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W),this.tipPosition={x:this.tipPosition.x*g,y:this.tipPosition.y*W},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(He),Se=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.fillColor=X.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new Fe("Line color",ge(X.defaultColorSet,["transparent"]),X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new Fe("Fill color",ge(X.defaultColorSet,["transparent"]),H.fillColor,de),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new lt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ne("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual)},s.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)},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){z.prototype.resize.call(this,g),this.setSize()},s.prototype.setSize=function(){z.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()]])},s.prototype.pointerUp=function(g){z.prototype.pointerUp.call(this,g),this.setSize()},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},s.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(g),this.stateChanged()},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(g){this.opacity=g,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var W=g;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,W){z.prototype.scale.call(this,g,W),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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>',s}(Ye),We=function(z){function s(g,W,X){return z.call(this,g,W,X)||this}return Ce(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.tip1&&g!==this.tip2)},s.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)},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.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 g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(g+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(Je),at=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.strokePanel.colors=X.defaultColorSet,H.fillColor="transparent",H}return Ce(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}(Se),ft=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),ut=function(z){function s(g,W,X){var H=z.call(this,g,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new Fe("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new lt("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ze("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ce(s,z),s.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.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)},s.prototype.pointerDown=function(g,W){z.prototype.pointerDown.call(this,g,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.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()]]))},s.prototype.setupControlBox=function(){z.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/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()))},s.prototype.manipulate=function(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),z.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),z.prototype.resize.call(this,g),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},s.prototype.scale=function(g,W){this.curveX=this.curveX*g,this.curveY=this.curveY*W,z.prototype.scale.call(this,g,W)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var W=g;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(nt),wt=function(){function z(s,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=g}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),St=function(z){function s(g,W,X){var H=z.call(this,g,!1)||this;return H.dataUrl=W,H.state=X,H}return Ce(s,z),s}(wt),ct=function(z){function s(g,W,X){X===void 0&&(X=!1);var H=z.call(this,g,X)||this;return H.marker=W,H}return Ce(s,z),s}(wt),zt=function(){function z(){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 z.prototype.addEventListener=function(s,g){this[s].push(g)},z.prototype.removeEventListener=function(s,g){var W=this[s].indexOf(g);W>-1&&this[s].splice(W,1)},z}(),It=function(){function z(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ke,this._isOpen=!1,this.undoRedoManager=new ft,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 zt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new _e(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[ot,xe,be,He,at,Se,se,Le,We,re,Je,ut]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ot,xe,be,He,Se,se,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ot,xe,be,He,se]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var g=this;this._availableMarkerTypes.splice(0),s.forEach(function(W){if(typeof W=="string"){var X=g.ALL_MARKER_TYPES.find(function(H){return H.typeName===W});X!==void 0&&g._availableMarkerTypes.push(X)}else g._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){var s=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(g){return g(new wt(s))})},z.prototype.render=function(){return we(this,void 0,void 0,function(){var s;return Te(this,function(g){switch(g.label){case 0:return this.setCurrentMarker(),(s=new he).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return g.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},z.prototype.close=function(s){var g=this;if(s===void 0&&(s=!1),this.isOpen){var W=!1;s||this.eventListeners.beforeclose.forEach(function(X){var H=new wt(g,!0);X(H),H.defaultPrevented&&(W=!0)}),W||(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(X){return X(new wt(g))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,g=[],W=0;W<arguments.length;W++)g[W]=arguments[W];(s=this._availableMarkerTypes).push.apply(s,g)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(g){s(g.dataUrl,g.state)})},z.prototype.removeRenderEventListener=function(s){},z.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},z.prototype.removeCloseEventListener=function(s){},z.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,g=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,W=g<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(g,W)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,g){this._isResizing=!0;var W=s/this.imageWidth,X=g/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(g),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(W,X),this._isResizing=!1},z.prototype.scaleMarkers=function(s,g){var W,X=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(s,g):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==X._currentMarker&&H.scale(s,g)}),W!==void 0&&this.setCurrentMarker(W)},z.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"},z.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=s.left-g.left,this.top=s.top-g.top},z.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)},z.prototype.addDefs=function(){for(var s,g=[],W=0;W<arguments.length;W++)g[W]=arguments[W];this.defs=ue.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,g)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.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)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.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)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.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)},z.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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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 Pe(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 Me(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(s,g){if(s==="marker"&&g!==void 0)this.createNewMarker(g);else if(s==="action")switch(g){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()}},z.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var H=new ct(s,s._currentMarker,!0);X(H),H.defaultPrevented&&(g=!0)}),!g){var W=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(X){return X(new ct(s,W))})}}},z.prototype.clear=function(){var s=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var Ge=new ct(s,void 0,!0);ve(Ge),Ge.defaultPrevented&&(g=!0)}),!g)){this.setCurrentMarker();for(var W=function(ve){var Ge=X.markers[ve];X.setCurrentMarker(X.markers[ve]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(Qe){return Qe(new ct(s,Ge))})},X=this,H=this.markers.length-1;H>=0;H--)W(H);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===g.width&&W.height===g.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}else this.undoRedoManager.replaceLastUndoStep(g),this.eventListeners.statechange.forEach(function(H){return H(new wt(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,g=this.undoRedoManager.undo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new wt(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,g=this.undoRedoManager.redo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new wt(s))}))},z.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},z.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},z.prototype.startRenderAndClose=function(){return we(this,void 0,void 0,function(){var s,g,W=this;return Te(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),g=this.getState(),this.eventListeners.render.forEach(function(H){return H(new St(W,s,g))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var g={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return g.markers.push(W.getState())}),g},z.prototype.restoreState=function(s){var g=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(W){var X=g._availableMarkerTypes.find(function(ve){return ve.typeName===W.typeName});if(X!==void 0){var H=g.addNewMarker(X);H.restoreState(W),g.markers.push(H)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(W){return W(new wt(g))})},z.prototype.addNewMarker=function(s){var g=ue.createGroup();return this.markerImage.appendChild(g),new s(g,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var g,W=this;(g=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(g),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(g.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new ct(W,W._currentMarker))}))},z.prototype.markerCreated=function(s){var g=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new ct(g,g._currentMarker))})},z.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},z.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},z.prototype.markerStateChanged=function(s){var g=this;this.eventListeners.markerchange.forEach(function(W){return W(new ct(g,s))})},z.prototype.setCurrentMarker=function(s){var g=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new ct(g,g._currentMarker))})),this._currentMarker=s,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(W){return W(new ct(g,g._currentMarker))}))},z.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var g=this.markers.find(function(W){return W.ownsTarget(s.target)});g!==void 0?(this.setCurrentMarker(g),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},z.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var g=this.markers.find(function(W){return W.ownsTarget(s.target)});g!==void 0&&g!==this._currentMarker&&this.setCurrentMarker(g),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},z.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(s,g){var W=this.markerImage.getBoundingClientRect();return{x:(s-W.left)/this.zoomLevel,y:(g-W.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},z.prototype.addLicenseKey=function(s){te.addKey(s)},z.prototype.addEventListener=function(s,g){this.eventListeners.addEventListener(s,g)},z.prototype.removeEventListener=function(s,g){this.eventListeners.removeEventListener(s,g)},z.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(g){return g(new wt(s))}))},z.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new wt(s))}))},z.instanceCounter=0,z}();/* **********************************
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(z,s){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,W){g.__proto__=W}||function(g,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(g[X]=W[X])})(z,s)};function Wt(z,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function g(){this.constructor=z}Kt(z,s),z.prototype=s===null?Object.create(s):(g.prototype=s.prototype,new g)}function _t(z,s,g,W){return new(g||(g=Promise))(function(X,H){function ve(dt){try{Qe(W.next(dt))}catch(ze){H(ze)}}function Ge(dt){try{Qe(W.throw(dt))}catch(ze){H(ze)}}function Qe(dt){var ze;dt.done?X(dt.value):(ze=dt.value,ze instanceof g?ze:new g(function(Et){Et(ze)})).then(ve,Ge)}Qe((W=W.apply(z,s||[])).next())})}function Wr(z,s){var g,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:Ge(0),throw:Ge(1),return:Ge(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function Ge(Qe){return function(dt){return function(ze){if(g)throw new TypeError("Generator is already executing.");for(;ve;)try{if(g=1,W&&(X=2&ze[0]?W.return:ze[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,ze[1])).done)return X;switch(W=0,X&&(ze=[2&ze[0],X.value]),ze[0]){case 0:case 1:X=ze;break;case 4:return ve.label++,{value:ze[1],done:!1};case 5:ve.label++,W=ze[1],ze=[0];continue;case 7:ze=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||ze[0]!==6&&ze[0]!==2)){ve=0;continue}if(ze[0]===3&&(!X||ze[1]>X[0]&&ze[1]<X[3])){ve.label=ze[1];break}if(ze[0]===6&&ve.label<X[1]){ve.label=X[1],X=ze;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(ze);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}ze=s.call(z,ve)}catch(Et){ze=[6,Et],W=0}finally{g=X=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Qe,dt])}}}var ai=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),vt=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,g){for(var W=0,X=g;W<X.length;W++){var H=X[W],ve=H[0],Ge=H[1];s.setAttribute(ve,Ge)}},z.createRect=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",g.toString()),W&&z.setAttributes(X,W),X},z.createLine=function(s,g,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",g.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&z.setAttributes(ve,H),ve},z.createPolygon=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),g&&z.setAttributes(W,g),W},z.createCircle=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),g&&z.setAttributes(W,g),W},z.createEllipse=function(s,g,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(g/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(g/2).toString()),W&&z.setAttributes(X,W),X},z.createGroup=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(g,s),g},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,g,W,X,H,ve,Ge){var Qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Qe,[["id",s],["orient",g],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),Qe.appendChild(Ge),Qe},z.createText=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),s&&z.setAttributes(g,s),g},z.createTSpan=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,g&&z.setAttributes(W,g),W},z.createImage=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(g,s),g},z.createPoint=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=g,W},z.createPath=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),g&&z.setAttributes(W,g),W},z.createElement=function(s,g){var W=document.createElementNS("http://www.w3.org/2000/svg",s);return g&&z.setAttributes(W,g),W},z.getHollowRectanglePath=function(s,g,W,X,H,ve,Ge,Qe){return"M"+s+","+g+"V"+(g+X)+"H"+(s+W)+"V"+g+"H"+H+"V"+ve+"H"+(H+Ge)+"V"+(ve+Qe)+"H"+H+"V"+g+"Z"},z}(),Vr=function(){function z(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new nr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new cr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new cr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),nr=function(z,s){this.selector=z,this.style=s},cr=function(z,s){this.localName=z,this.style=s},Hr=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},z.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},z.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(g){return s.appendChild(g.getUI())}),s},z}(),oi=function(){function z(){}return z.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},z}(),si=function(z){function s(){var g=z!==null&&z.apply(this,arguments)||this;return g.buttons=[],g}return Wt(s,z),s.prototype.addButton=function(g){g.className=this.buttonClassName,g.colorsClassName=this.buttonColorsClassName,g.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(g)},s.prototype.getUI=function(){var g=z.prototype.getUI.call(this);return this.buttons.forEach(function(W){return g.appendChild(W.getUI())}),g},s}(oi),Pt=function(){function z(s,g){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=g,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.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,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),pt=function(z){function s(){var g=z!==null&&z.apply(this,arguments)||this;return g.elements=[],g}return Wt(s,z),s.prototype.addElement=function(g){this.elements.push(g)},s.prototype.getUI=function(){var g=z.prototype.getUI.call(this);return this.elements.forEach(function(W){return g.appendChild(W)}),g},s}(oi),Pr=function(){function z(s,g){this.horizontal=s,this.vertical=g}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(s){return s/this.ratio},z.prototype.getHorizontalLength=function(s){return s*this.ratio},z}(),li=function(){function z(){}return z.getIcon=function(s,g){if(s>0&&g>0){var W=new Pr(s,g),X=W.ratio>=1?20:W.getHorizontalLength(20),H=W.ratio<1?20:W.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 Ge=vt.createDefs();ve.appendChild(Ge);var Qe=vt.createElement("clipPath",[["id","text-bg-clip"]]);Ge.appendChild(Qe);var dt=vt.createPath(vt.getHollowRectanglePath((24-X)/2,(24-H)/2,X,H,(24-X)/2+2,(24-H)/2+2,X-4,H-4));ve.appendChild(dt);var ze=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild(vt.createTSpan(s+":"+g)),ve.appendChild(ze);var Et=ze.getBBox();vt.setAttributes(ze,[["x",((24-Et.width)/2).toString()],["y",((24-Et.height)/2-Et.y).toString()]]);var Dt=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Et.width))/2,(24-Math.ceil(Et.height))/2,Math.ceil(Et.width),Math.ceil(Et.height)));return Qe.appendChild(Dt),vt.setAttributes(dt,[["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>'},z}(),xr=function(z){function s(g,W,X){var H=z.call(this,g,W)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=X,H}return Wt(s,z),s.prototype.setupDropdown=function(){var g=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(W){W.className=g.className,W.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(W.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(Pt),Lt=function(){function z(s,g){this.GRIP_SIZE=10,this.color=s,this.fillColor=g,this.visual=vt.createGroup(),this.visual.appendChild(vt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(vt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z.prototype.setCenter=function(s,g){this.visual.childNodes.forEach(function(W){return vt.setAttributes(W,[["cx",s.toString()],["cy",g.toString()]])})},z}(),Mr=function(){function z(s,g,W,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=g,this.margin=W,this.container=X,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var s=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var g=0;g<this.numberOfGridLines;g++)this.horizontalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.verticalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.cropRectElement=vt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Lt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(s){this.cropRect=s;var g=Object.assign({},this.cropRect);this.zoomFactor!==1&&(g.width=this.cropRect.width*this.zoomFactor,g.height=this.cropRect.height*this.zoomFactor,g.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-g.width/2,g.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),vt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var W=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,ve){var Ge=g.y+W*(ve+1);vt.setAttributes(H,[["x1",""+g.x],["y1",""+Ge],["x2",""+(g.x+g.width)],["y2",""+Ge]])});var X=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,ve){var Ge=g.x+X*(ve+1);vt.setAttributes(H,[["x1",""+Ge],["y1",""+g.y],["x2",""+Ge],["y2",""+(g.y+g.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(s,g){var W=this.container.getBoundingClientRect();return{x:s-W.left+this.margin,y:g-W.top+this.margin}},z.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(g)}s.preventDefault()},z.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},z.prototype.move=function(s){var g=s.x-this.previousPoint.x,W=s.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,W=-W/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+W),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},z.prototype.resize=function(s){var g=Object.assign({},this.cropRect),W=s.x-this.previousPoint.x,X=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+W<this.margin&&(W=this.margin-g.x),g.x+=W,g.width=this.cropRect.x+this.cropRect.width-g.x;break;case this.bottomRightGrip:case this.topRightGrip:g.width+W>this.canvasWidth*this.zoomFactor&&(W=this.canvasWidth*this.zoomFactor-g.width),g.width+=W}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(W),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=X,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=X}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=s,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,g=this.cropRect.y+this.cropRect.height/2,W=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);W/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=W:this.cropRect.height=X,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=s-this.cropRect.width/2,this.cropRect.y=g-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)}},z.prototype.getRescaledRect=function(s,g,W,X,H,ve){var Ge=W/s,Qe=X/g;return{x:(H.x-ve)*Ge+ve,y:(H.y-ve)*Qe+ve,width:H.width*Ge,height:H.height*Qe}},z.prototype.scaleCanvas=function(s,g){var W=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,g,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=g,this.onCropChange&&this.onCropChange(W),this.setCropRectangle(W)},z}(),Xr=function(){function z(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(z.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},z.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},z.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},z.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var g="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,W=1;W<=this.width/5+10;W++){var X=W%5==0?this.height/3:this.height/6;g+="h4v"+-X+"h1v"+X}g+="v1H0Z",this.scaleShape=vt.createPath(g);var H=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),s.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=vt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},z}(),ui=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(s,g,W,X,H,ve,Ge){var Qe=this;return new Promise(function(dt){var ze=document.createElement("canvas");ze.width=s.width.baseVal.value-2*X,ze.height=s.height.baseVal.value-2*X;var Et=1,Dt=1;Qe.naturalSize===!0?(Et=g.naturalWidth/(s.width.baseVal.value-2*X)/ve,Dt=g.naturalHeight/(s.height.baseVal.value-2*X)/Ge,ze.width=g.naturalWidth/ve,ze.height=g.naturalHeight/Ge):Qe.width!==void 0&&Qe.height!==void 0&&(Et=Qe.width/W.width,Dt=Qe.height/W.height,ze.width*=Et,ze.height*=Dt);var Vt=ze.getContext("2d");Vt.translate(ze.width/2,ze.height/2),Vt.rotate(H*Math.PI/180),Vt.scale(ve,Ge),Vt.translate(-ze.width/2,-ze.height/2),Vt.drawImage(g,0,0,ze.width,ze.height);var Ir=document.createElement("canvas");Ir.width=W.width*Et,Ir.height=W.height*Dt,Ir.getContext("2d").putImageData(Vt.getImageData((W.x-X)*Et,(W.y-X)*Dt,W.width*Et,W.height*Dt),0,0),dt(Ir.toDataURL(Qe.imageType,Qe.imageQuality))})},z}(),Ve=function(){function z(s){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=z.instanceCounter++,this.styles=new Vr(this.instanceNo),this.target=s,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(g){return g()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},z.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},z.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},z.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},z.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,W=g+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(g,W)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.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",vt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(s,g){this.imageWidth=Math.round(s),this.imageHeight=Math.round(g),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()},z.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var g=s.toDataURL();vt.setAttributes(this.editingTarget,[["href",g]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=s.left-g.left-this.CANVAS_MARGIN,this.top=s.top-g.top-this.CANVAS_MARGIN},z.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=vt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=vt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=vt.createGroup(),this.editingTargetRotationScaleContainer=vt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=vt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var g=vt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(g),this.editingTargetContainer=vt.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)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=vt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Mr(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()},z.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,g=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=s+"px "+g+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-g+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.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)},z.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,g=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Hr,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 g=new si;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var W=[];this.aspectRatios.forEach(function(Dt){var Vt=new Pt(li.getIcon(Dt.horizontal,Dt.vertical),Dt.horizontal===0&&Dt.vertical===0?"FREE":Dt.horizontal+":"+Dt.vertical);Vt.onClick=function(){return s.ratioButtonClicked(Dt)},W.push(Vt)}),this.aspectRatioButton=new xr(li.getIcon(0,0),"Aspect ratio",W),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,g.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Pt('<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");X.isActive=this.isGridVisible,X.onClick=function(){s.isGridVisible=!s.isGridVisible,X.isActive=s.isGridVisible},g.addButton(X);var H=new Pt('<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(H.isActive=this.zoomToCropEnabled,H.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,H.isActive=s.zoomToCropEnabled},g.addButton(H),!ai.isLicensed){var ve=new pt;this.topToolbar.addElementBlock(ve);var Ge=document.createElement("div");Ge.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Qe=document.createElement("a");Qe.style.color="currentColor",Qe.href="https://markerjs.com/products/cropro",Qe.target="_blank",Qe.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>',Ge.appendChild(Qe),ve.addElement(Ge)}var dt=new si;dt.minWidth=3*this.toolbarHeight+"px",dt.contentAlign="end",this.topToolbar.addButtonBlock(dt);var ze=new Pt('<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,dt.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Et=new Pt('<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");Et.onClick=this.close,dt.addButton(Et),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Et.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Hr,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 g=new si;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);var W=new Pt('<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");W.onClick=this.rotateLeftButtonClicked,g.addButton(W);var X=new Pt('<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");X.onClick=this.rotateRightButtonClicked,g.addButton(X);var H=new pt;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new Xr("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(dt){s.rotateBy(dt),s.straightener.angle=s.rotationAngle},H.addElement(this.straightener.getUI());var ve=new si;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var Ge=new Pt('<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");Ge.onClick=this.flipHorizontallyButtonClicked,ve.addButton(Ge);var Qe=new Pt('<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");Qe.onClick=this.flipVerticallyButtonClicked,ve.addButton(Qe)},z.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Pr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(s){if(s){var g=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(s,g){var W=this.cropImage.getBoundingClientRect();return{x:s-W.left,y:g-W.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},z.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},z.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},z.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,0);var W=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/W.width,this.imageHeight/W.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return _t(this,void 0,void 0,function(){var s,g;return Wr(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return s=W.sent(),g=this.getState(),this.renderEventListeners.forEach(function(X){return X(s,g)}),this.close(!0),[2]}})})},z.prototype.render=function(){return _t(this,void 0,void 0,function(){var s;return Wr(this,function(g){switch(g.label){case 0:return(s=new ui).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 g.sent(),[4,s.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,g.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new cr("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 cr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new cr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new cr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new cr("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 cr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new cr("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 cr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new cr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),Tt=ie("8hTe"),di=ie.n(Tt),_i=/<pre[^>]*>/g;function hi(z){var s=document.createElement("div");return s.innerHTML=z,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Li=qe.a=function(z){var s=z.value,g=s===void 0?"":s,W=z.edit,X=W===void 0?!1:W,H=z.className,ve=z.showTextOnly,Ge=z.showLines,Qe=z.replaces,dt=z.zoomImg,ze=z.hasMask,Et=z.style,Dt=Et===void 0?{}:Et,Vt=z.stylesPrev,Ir=Vt===void 0?{}:Vt,Nr=String(g),ar=Object(k.useRef)(),Gr=Object(k.useRef)(),Hi=Object(k.useState)(""),Er=Object(G.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(k.useState)("office"),Yr=Object(G.a)(gi,2),ci=Yr[0],ei=Yr[1],hn=function(){var Nt=new Ve(Gr.current);Nt.displayMode="popup",Nt.addRenderEventListener(function(){var fr=Object(P.a)(I.a.mark(function Mt(er){var Ft;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return ar.current.style.display="none",Qt.next=3,Object(Re.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er}});case 3:Ft=Qt.sent,Ft!=null&&Ft.id&&Qe(Gr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ft==null?void 0:Ft.id,"?type=").concat(Ft.content_type));case 5:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show()},Gi=function(){var Nt=new It(Gr.current);Nt.settings.displayMode="popup",Nt.addEventListener("render",function(){var fr=Object(P.a)(I.a.mark(function Mt(er){var Ft;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(ar.current.style.display="none",!Gr.current){Qt.next=6;break}return Qt.next=4,Object(Re.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er.dataUrl}});case 4:Ft=Qt.sent,Ft!=null&&Ft.id&&Qe(Gr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ft==null?void 0:Ft.id,"?type=").concat(Ft.content_type));case 6:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show(),window.markerArea=Nt},$r=Object(k.useMemo)(function(){try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Nt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Nr=Nr.replace(Zt,"("+ee.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(fr,'"'+ee.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,`
`),Nr=Nr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ti){}var Mt=V(Nr),er=x();if(Nr.match(/\[TOC\]/)&&(Mt=Mt.replace("<p>[TOC]</p>",L()),A()),Mt=Mt.replace(/(__special_katext_id_\d+__)/g,function(ti,Qt){var Sr=er[Qt],zi=Sr.type,Ki=Sr.expression;return Object(oe.renderToString)(hi(Ki)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),Mt=Mt.replace(/▁/g,"\u2581\u2581\u2581"),y(),ve){var Ft=document.createElement("div");return Ft.innerHTML=Mt,Ft.innerText}return setTimeout(function(){return Di()},500),Mt},[Nr]),Ur=Object(k.useRef)();p.WebkitLineClamp=Ge,Ge&&(Dt=Object(B.a)(Object(B.a)({},Dt),p));function ki(Zt){var Nt=Zt.target;if(Nt.tagName.toUpperCase()==="IMG"){if(dt){var fr=Nt.getAttribute("src");kr(fr),ei("image")}}else if(Nt.tagName.toUpperCase()==="A"){var Mt=Nt.getAttribute("href");if(Mt.indexOf("office")>-1)Zt.preventDefault(),kr(Mt),ei("office");else if(Mt.indexOf("application/pdf")>-1)Zt.preventDefault(),kr(Mt),ei("pdf");else if(Mt.indexOf("type=text")>-1)Zt.preventDefault(),kr(Mt),ei("html");else if(Mt.startsWith("#")){Zt.preventDefault();var er=document.getElementById(Mt.replace("#",""));er&&er.scrollIntoView(!0)}}}var Di=function(){var Nt,fr=(Nt=Ur.current)===null||Nt===void 0?void 0:Nt.querySelectorAll("video");fr==null||fr.forEach(function(Mt){if(Mt.oncontextmenu=function(){return!1},Mt.src.indexOf(".m3u8")>-1&&!Mt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var er=new $.a;er.loadSource(Mt.src),er.attachMedia(Mt)}}})};Object(k.useEffect)(function(){if(Ur.current&&$r&&($r.match(_i)&&window.PR.prettyPrint()),Ur.current)return Ur.current.addEventListener("click",ki),function(){Ur.current.removeEventListener("click",ki),y(),A()}},[$r,Ur.current,ki]);var cn=function(Nt){if(!X)return;Nt.target.nodeName==="IMG"?(ar.current.style.display="flex",ar.current.style.width=Nt.target.clientWidth+"px",ar.current.style.height=Nt.target.clientHeight+"px",ar.current.style.top=Nt.target.offsetTop+"px",ar.current.style.left=Nt.target.offsetLeft+"px",Gr.current.src=Nt.target.getAttribute("src")):ar.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:Ur,style:Object(B.a)({},Dt),className:"".concat(H||""," markdown-body ").concat(di.a.mdBody),onMouseOver:cn,dangerouslySetInnerHTML:{__html:$r}}),v.a.createElement("div",{ref:ar,className:di.a.button},v.a.createElement(Q.a,null,v.a.createElement(Z.a,{onClick:function(){return hn()}},"\u88C1\u526A"),v.a.createElement(Z.a,{onClick:function(){return Gi()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:Gr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(fe.a,{close:!0,data:Br,hasMask:ze,type:Br!=null&&Br.length?ci:"",style:Object(B.a)({},Ir),onClose:function(){return kr("")}}))}},"9VGf":function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return D});var le=ie("q1tI"),Q=ie.n(le);function D(Z,B){var P=Object(le.useRef)();Object(le.useEffect)(function(){P.current=Z}),Object(le.useEffect)(function(){function G(){P.current()}if(B!==null){var j=setInterval(G,B);return function(){return clearInterval(j)}}},[B])}},BU3w:function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return P});var le=ie("MNnm"),Q="rc-util-key";function D(G){if(G.attachTo)return G.attachTo;var j=document.querySelector("head");return j||document.body}function Z(G){var j,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var k=document.createElement("style");if((j=I.csp)===null||j===void 0?void 0:j.nonce){var v;k.nonce=(v=I.csp)===null||v===void 0?void 0:v.nonce}k.innerHTML=G;var T=D(I),R=T.firstChild;return I.prepend&&T.prepend?T.prepend(k):I.prepend&&R?T.insertBefore(k,R):T.appendChild(k),k}var B=new Map;function P(G,j){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=D(I);if(!B.has(k)){var v=Z("",I),T=v.parentNode;B.set(k,T),T.removeChild(v)}var R=Array.from(B.get(k).children).find(function(o){return o.tagName==="STYLE"&&o[Q]===j});if(R){var _,w;if(((_=I.csp)===null||_===void 0?void 0:_.nonce)&&R.nonce!==((w=I.csp)===null||w===void 0?void 0:w.nonce)){var S;R.nonce=(S=I.csp)===null||S===void 0?void 0:S.nonce}return R.innerHTML!==G&&(R.innerHTML=G),R}var h=Z(G,I);return h[Q]=j,h}},Bd2K:function(bt,qe,ie){(function(le){le(ie("VrN/"),ie("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(I,k,v){if(v!=le.Init&&v&&I.removeKeyMap("autoCloseTags"),!k)return;var T={name:"autoCloseTags"};(typeof k!="object"||k.whenClosing!==!1)&&(T["'/'"]=function(R){return P(R)}),(typeof k!="object"||k.whenOpening!==!1)&&(T["'>'"]=function(R){return Z(R)}),I.addKeyMap(T)});var Q=["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 Z(I){if(I.getOption("disableInput"))return le.Pass;for(var k=I.listSelections(),v=[],T=I.getOption("autoCloseTags"),R=0;R<k.length;R++){if(!k[R].empty())return le.Pass;var _=k[R].head,w=I.getTokenAt(_),S=le.innerMode(I.getMode(),w.state),h=S.state,o=S.mode.xmlCurrentTag&&S.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return le.Pass;var u=S.mode.configuration=="html",A=typeof T=="object"&&T.dontCloseTags||u&&Q,p=typeof T=="object"&&T.indentTags||u&&D;w.end>_.ch&&(l=l.slice(0,l.length-w.end+_.ch));var f=l.toLowerCase();if(!l||w.type=="string"&&(w.end!=_.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==_.ch-w.start-1||A&&G(A,f)>-1||j(I,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(h)||[],l,_,!0))return le.Pass;var L=typeof T=="object"&&T.emptyTags;if(L&&G(L,l)>-1){v[R]={text:"/>",newPos:le.Pos(_.line,_.ch+2)};continue}var b=p&&G(p,f)>-1;v[R]={indent:b,text:">"+(b?`
`:"")+"</"+l+">",newPos:b?le.Pos(_.line+1,0):le.Pos(_.line,_.ch+1)}}for(var m=typeof T=="object"&&T.dontIndentOnAutoClose,R=k.length-1;R>=0;R--){var c=v[R];I.replaceRange(c.text,k[R].head,k[R].anchor,"+insert");var d=I.listSelections().slice(0);d[R]={head:c.newPos,anchor:c.newPos},I.setSelections(d),!m&&c.indent&&(I.indentLine(c.newPos.line,null,!0),I.indentLine(c.newPos.line+1,null,!0))}}function B(I,k){for(var v=I.listSelections(),T=[],R=k?"/":"</",_=I.getOption("autoCloseTags"),w=typeof _=="object"&&_.dontIndentOnSlash,S=0;S<v.length;S++){if(!v[S].empty())return le.Pass;var h=v[S].head,o=I.getTokenAt(h),l=le.innerMode(I.getMode(),o.state),u=l.state;if(k&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return le.Pass;var A,p=l.mode.name!="xml"&&I.getMode().name=="htmlmixed";if(p&&l.mode.name=="javascript")A=R+"script";else if(p&&l.mode.name=="css")A=R+"style";else{var f=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!f||f.length&&j(I,f,f[f.length-1],h))return le.Pass;A=R+f[f.length-1]}I.getLine(h.line).charAt(o.end)!=">"&&(A+=">"),T[S]=A}if(I.replaceSelections(T),v=I.listSelections(),!w)for(var S=0;S<v.length;S++)(S==v.length-1||v[S].head.line<v[S+1].head.line)&&I.indentLine(v[S].head.line)}function P(I){return I.getOption("disableInput")?le.Pass:B(I,!0)}le.commands.closeTag=function(I){return B(I)};function G(I,k){if(I.indexOf)return I.indexOf(k);for(var v=0,T=I.length;v<T;++v)if(I[v]==k)return v;return-1}function j(I,k,v,T,R){if(!le.scanForClosingTag)return!1;var _=Math.min(I.lastLine()+1,T.line+500),w=le.scanForClosingTag(I,T,null,_);if(!w||w.tag!=v)return!1;for(var S=R?1:0,h=k.length-1;h>=0&&k[h]==v;h--)++S;T=w.to;for(var h=1;h<S;h++){var o=le.scanForClosingTag(I,T,null,_);if(!o||o.tag!=v)return!1;T=o.to}return!0}})},BjJ7:function(bt,qe,ie){"use strict";ie.d(qe,"d",function(){return Q}),ie.d(qe,"c",function(){return D}),ie.d(qe,"e",function(){return Z}),ie.d(qe,"b",function(){return B}),ie.d(qe,"a",function(){return G});var le=ie("m3rI");function Q(j){var I=!0;if(j.length>0){for(var k=0;k<j.length;k++)if(j[k].compile_success==0||!j[k].compile_success){I=!1;break}}else I=!1;return I}function D(j){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",k=[],v=0;v<j.length;v++){var T=j[v],R=I?"".concat(I,"/").concat(T.name):"".concat(T.name);k.push({title:T.name,isLeaf:!(T.type==="tree"),key:R})}return k}function Z(j,I,k){for(var v=0;v<j.length;v++){var T=j[v];if(T.key===I){T.children=k;break}T.children&&Z(T.children,I,k)}return j}function B(j,I,k){var v;return function(){var T=this,R=arguments,_=function(){v=null,k||j.apply(T,R)},w=k&&!v;clearTimeout(v),v=setTimeout(_,I),w&&j.apply(T,R)}}var P=!0,G=le.a.API_SERVER},"C+DQ":function(bt,qe,ie){},CKgm:function(bt,qe,ie){"use strict";ie.r(qe);var le=ie("+L6B"),Q=ie("2/Rp"),D=ie("5NDa"),Z=ie("5rEg"),B=ie("sPJy"),P=ie("bE4q"),G=ie("miYZ"),j=ie("tsqr"),I=ie("9og8"),k=ie("k1fw"),v=ie("y8nQ"),T=ie("Vl3Y"),R=ie("tJVT"),_=ie("PpiC"),w=ie("OaEy"),S=ie("2fM7"),h=ie("WmNS"),o=ie.n(h),l=ie("q1tI"),u=ie.n(l),A=ie("Ty5D"),p=ie("9kvl"),f=ie("55Ip"),L=ie("Ot1p"),b=ie("500L"),m=ie("h+Ho"),c=ie("7/Dv"),d=ie.n(c),a=S.a.Option,x=function(E){var N,U,K,V=E.forumsDetail,O=E.globalSetting,M=E.loading,$=E.dispatch,ee=Object(_.a)(E,["forumsDetail","globalSetting","loading","dispatch"]),oe=Object(A.i)(),fe=T.a.useForm(),Re=Object(R.a)(fe,1),Ee=Re[0],Ce=Object(l.useState)({}),we=Object(R.a)(Ce,2),Te=we[0],ge=we[1],ue=Object(l.useState)(0),te=Object(R.a)(ue,2),he=te[0],ae=te[1],_e=Object(l.useState)(!1),Oe=Object(R.a)(_e,2),ye=Oe[0],Pe=Oe[1],Me=Object(l.useState)({}),Ne=Object(R.a)(Me,2),Fe=Ne[0],Ue=Ne[1],Be=Object(l.useState)(1),tt=Object(R.a)(Be,2),et=tt[0],Ye=tt[1];Object(l.useEffect)(function(){if($e(),oe.memoId)Pe(!0),lt();else{Pe(!1);var ke={forum_id:5};ge(Object(k.a)({},ke)),Ee.setFieldsValue(Object(k.a)({},ke))}},[oe.memoId]);var $e=function(){var ke=Object(I.a)(o.a.mark(function nt(){var Je;return o.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:return He.next=2,Object(m.f)({});case 2:Je=He.sent,Ue(Je||{});case 4:case"end":return He.stop()}},nt)}));return function(){return ke.apply(this,arguments)}}(),lt=function(){var ke=Object(I.a)(o.a.mark(function nt(){var Je,Ie,He;return o.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:return pe.next=2,Object(m.e)({id:oe.memoId});case 2:if(pe.t0=pe.sent,pe.t0){pe.next=5;break}pe.t0={};case 5:Ie=pe.t0,He={subject:Ie.subject,content:Ie.content,attachments:Object(b.a)(Ie.attachments),forum_id:Ie.forum_id,memo_tags:(Je=Ie.memo_tags)===null||Je===void 0?void 0:Je.map(function(be){return be.id})},ge(Object(k.a)({},He)),Ee.setFieldsValue(Object(k.a)({},He));case 9:case"end":return pe.stop()}},nt)}));return function(){return ke.apply(this,arguments)}}(),Ze=function(){var ke=Object(I.a)(o.a.mark(function nt(Je){var Ie,He,xe,pe;return o.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:if(xe=Object(k.a)(Object(k.a)({id:ye?oe.memoId:null},Te),{},{attachment_ids:(Ie=Te.attachments)===null||Ie===void 0||((He=Ie.filter(function(ne){var se;return(se=ne.response)===null||se===void 0?void 0:se.id}))===null||He===void 0)?void 0:He.map(function(ne){var se;return(se=ne.response)===null||se===void 0?void 0:se.id}),tags:Te.memo_tags}),!ye){re.next=7;break}return re.next=4,Object(m.n)(xe);case 4:re.t0=re.sent,re.next=10;break;case 7:return re.next=9,Object(m.j)(xe);case 9:re.t0=re.sent;case 10:pe=re.t0,ae(0),(pe==null?void 0:pe.status)===0&&(j.b.success(pe==null?void 0:pe.message),et===1?p.d.push("/forums/".concat(ye?oe==null?void 0:oe.memoId:pe==null?void 0:pe.memo_id)):p.d.push("/forums/".concat(ye?oe==null?void 0:oe.memoId:pe==null?void 0:pe.memo_id,"/edit")));case 13:case"end":return re.stop()}},nt)}));return function(Je){return ke.apply(this,arguments)}}(),ot=function(){document.body.scrollIntoView(),window.location.href.includes("new")?p.d.goBack():p.d.push("/forums/".concat(oe.memoId))};return u.a.createElement("section",{className:d.a.bg},u.a.createElement("section",{className:"animated fadeIn mb10"},u.a.createElement("aside",{className:"mt10"},u.a.createElement(P.a,{separator:"/"},u.a.createElement(P.a.Item,null,u.a.createElement(f.a,{to:"/forums"},"\u4EA4\u6D41\u95EE\u7B54")),u.a.createElement(P.a.Item,null,"\u8BE6\u60C5")))),u.a.createElement("aside",{className:"bg-white font16 pt20 pb20 pl20"},ye?"\u7F16\u8F91\u8BDD\u9898":"\u53D1\u5E03\u8BDD\u9898"),u.a.createElement(T.a,{form:Ee,className:d.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(nt,Je){console.log(Je,"values"),ge(Object(k.a)(Object(k.a)({},Te),nt))},onFinish:Ze,onFinishFailed:function(){ae(0)}},u.a.createElement("div",{className:d.a.fieldWrap},u.a.createElement(T.a.Item,{name:"subject",label:u.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u540D\u79F0: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u540D\u79F0"}]},u.a.createElement(Z.a,{maxLength:50,suffix:"".concat(((N=Te.subject)===null||N===void 0?void 0:N.length)||0,"/50")}))),u.a.createElement("div",{className:d.a.mdWrap},u.a.createElement(T.a.Item,{name:"content",label:u.a.createElement("span",{className:"font16"},"\u5185\u5BB9: "),rules:[{required:!0,message:"\u8BF7\u5148\u8F93\u5165\u8BDD\u9898\u5185\u5BB9"}]},u.a.createElement(L.a,{height:600,id:"forums-new-content",watch:!0,defaultValue:Te.content})),u.a.createElement("div",null,u.a.createElement(T.a.Item,{name:"attachments",style:{width:350}},u.a.createElement(b.b,{showRemoveModal:!0})))),u.a.createElement("div",{className:d.a.mdWrap},u.a.createElement(T.a.Item,{name:"forum_id",label:u.a.createElement("span",{className:"font16"},"\u8BDD\u9898\u7C7B\u578B: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u8BDD\u9898\u7C7B\u578B"}]},u.a.createElement(S.a,{style:{width:300}},Fe==null||((U=Fe.forums)===null||U===void 0)?void 0:U.map(function(ke){return u.a.createElement(a,{key:ke.id,value:ke.id},ke.name)})))),Te.forum_id===5&&u.a.createElement("div",{className:d.a.mdWrap},u.a.createElement(T.a.Item,{name:"memo_tags",label:u.a.createElement("span",{className:"font16"},"\u6280\u672F\u6807\u7B7E: "),rules:[{required:!0,message:"\u8BF7\u5148\u9009\u62E9\u6280\u672F\u6807\u7B7E"}]},u.a.createElement(S.a,{style:{width:300},placeholder:"\u8BF7\u9009\u62E9\u6280\u672F\u6807\u7B7E",mode:"multiple",tokenSeparators:[";"],filterOption:function(nt,Je){return Je.props.children.toLocaleLowerCase().indexOf(nt.toLocaleLowerCase())!=-1}},Fe==null||((K=Fe.tag_list)===null||K===void 0)?void 0:K.map(function(ke){return u.a.createElement(a,{key:ke.id,value:ke.id},ke.name)})))),u.a.createElement("div",{className:d.a.backgroundFa},u.a.createElement("div",{className:"pt40 mb30"},u.a.createElement(T.a.Item,null,u.a.createElement(Q.a,{size:"large",type:"primary",className:"".concat(d.a.button," mr20"),htmlType:"submit",loading:he===1,onClick:function(){Ye(1),ae(1)}},"\u63D0\u4EA4"),u.a.createElement(Q.a,{size:"large",type:"primary",className:"".concat(d.a.button," mr20"),htmlType:"submit",loading:he===2,onClick:function(){Ye(2),ae(2)}},"\u4FDD\u5B58"),u.a.createElement(Q.a,{size:"large",type:"primary",ghost:!0,className:"".concat(d.a.button," mr20"),onClick:ot},"\u53D6\u6D88"))))))};qe.default=Object(p.a)(function(y){var E=y.forumsDetail,N=y.loading,U=y.globalSetting;return{forumsDetail:E,globalSetting:U,loading:N.models.forumsDetail}})(x)},DlQD:function(bt,qe,ie){(function(le,Q){bt.exports=Q()})(this,function(){"use strict";function le(xe,pe){for(var be=0;be<pe.length;be++){var re=pe[be];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(xe,re.key,re)}}function Q(xe,pe,be){return pe&&le(xe.prototype,pe),be&&le(xe,be),xe}function D(xe,pe){if(!xe)return;if(typeof xe=="string")return Z(xe,pe);var be=Object.prototype.toString.call(xe).slice(8,-1);if(be==="Object"&&xe.constructor&&(be=xe.constructor.name),be==="Map"||be==="Set")return Array.from(xe);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Z(xe,pe)}function Z(xe,pe){(pe==null||pe>xe.length)&&(pe=xe.length);for(var be=0,re=new Array(pe);be<pe;be++)re[be]=xe[be];return re}function B(xe,pe){var be;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(be=D(xe))||pe&&xe&&typeof xe.length=="number"){be&&(xe=be);var re=0;return function(){return re>=xe.length?{done:!0}:{done:!1,value:xe[re++]}}}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 be=xe[Symbol.iterator](),be.next.bind(be)}function P(xe,pe){return pe={exports:{}},xe(pe,pe.exports),pe.exports}var G=P(function(xe){function pe(){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 be(re){xe.exports.defaults=re}xe.exports={defaults:pe(),getDefaults:pe,changeDefaults:be}}),j=G.defaults,I=G.getDefaults,k=G.changeDefaults,v=/[&<>"']/,T=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,w={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},S=function(pe){return w[pe]};function h(xe,pe){if(pe){if(v.test(xe))return xe.replace(T,S)}else if(R.test(xe))return xe.replace(_,S);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(xe){return xe.replace(o,function(pe,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var u=/(^|[^\[])\^/g;function A(xe,pe){xe=xe.source||xe,pe=pe||"";var be={replace:function(ne,se){return se=se.source||se,se=se.replace(u,"$1"),xe=xe.replace(ne,se),be},getRegex:function(){return new RegExp(xe,pe)}};return be}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(xe,pe,be){if(xe){var re;try{re=decodeURIComponent(l(be)).replace(p,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}pe&&!f.test(be)&&(be=a(pe,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ne){return null}return be}var b={},m=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,pe){b[" "+xe]||(m.test(xe)?b[" "+xe]=xe+"/":b[" "+xe]=N(xe,"/",!0)),xe=b[" "+xe];var be=xe.indexOf(":")===-1;return pe.substring(0,2)==="//"?be?pe:xe.replace(c,"$1")+pe:pe.charAt(0)==="/"?be?pe:xe.replace(d,"$1")+pe:xe+pe}var x={exec:function(){}};function y(xe){for(var pe=1,be,re;pe<arguments.length;pe++){be=arguments[pe];for(re in be)Object.prototype.hasOwnProperty.call(be,re)&&(xe[re]=be[re])}return xe}function E(xe,pe){var be=xe.replace(/\|/g,function(se,de,Le){for(var Se=!1,We=de;--We>=0&&Le[We]==="\\";)Se=!Se;return Se?"|":" |"}),re=be.split(/ \|/),ne=0;if(re.length>pe)re.splice(pe);else for(;re.length<pe;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function N(xe,pe,be){var re=xe.length;if(re===0)return"";for(var ne=0;ne<re;){var se=xe.charAt(re-ne-1);if(se===pe&&!be)ne++;else if(se!==pe&&be)ne++;else break}return xe.substr(0,re-ne)}function U(xe,pe){if(xe.indexOf(pe[1])===-1)return-1;for(var be=xe.length,re=0,ne=0;ne<be;ne++)if(xe[ne]==="\\")ne++;else if(xe[ne]===pe[0])re++;else if(xe[ne]===pe[1]&&(re--,re<0))return ne;return-1}function K(xe){xe&&xe.sanitize&&!xe.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 V={escape:h,unescape:l,edit:A,cleanUrl:L,resolveUrl:a,noopTest:x,merge:y,splitCells:E,rtrim:N,findClosingBracket:U,checkSanitizeDeprecation:K},O=G.defaults,M=V.rtrim,$=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function fe(xe,pe,be){var re=pe.href,ne=pe.title?ee(pe.title):null,se=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:be,href:re,title:ne,text:se}:{type:"image",raw:be,href:re,title:ne,text:ee(se)}}function Re(xe,pe){var be=xe.match(/^(\s+)(?:```)/);if(be===null)return pe;var re=be[1];return pe.split(`
`).map(function(ne){var se=ne.match(/^\s+/);if(se===null)return ne;var de=se[0];return de.length>=re.length?ne.slice(re.length):ne}).join(`
`)}var Ee=function(){function xe(be){this.options=be||O}var pe=xe.prototype;return pe.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},pe.code=function(re,ne){var se=this.rules.block.code.exec(re);if(se){var de=ne[ne.length-1];if(de&&de.type==="paragraph")return{raw:se[0],text:se[0].trimRight()};var Le=se[0].replace(/^ {4}/gm,"");return{type:"code",raw:se[0],codeBlockStyle:"indented",text:this.options.pedantic?Le:M(Le,`
`)}}},pe.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var se=ne[0],de=Re(se,ne[3]||"");return{type:"code",raw:se,lang:ne[2]?ne[2].trim():ne[2],text:de}}},pe.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},pe.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var se={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(se.header.length===se.align.length){var de=se.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(se.align[Le])?se.align[Le]="right":/^ *:-+: *$/.test(se.align[Le])?se.align[Le]="center":/^ *:-+ *$/.test(se.align[Le])?se.align[Le]="left":se.align[Le]=null;for(de=se.cells.length,Le=0;Le<de;Le++)se.cells[Le]=$(se.cells[Le],se.header.length);return se}}},pe.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},pe.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var se=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:se}}},pe.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var se=ne[0],de=ne[2],Le=de.length>1,Se=de[de.length-1]===")",We={type:"list",raw:se,ordered:Le,start:Le?+de.slice(0,-1):"",loose:!1,items:[]},at=ne[0].match(this.rules.block.item),ft=!1,ut,wt,St,ct,zt,It,Kt,Wt=at.length,_t=0;_t<Wt;_t++)ut=at[_t],se=ut,wt=ut.length,ut=ut.replace(/^ *([*+-]|\d+[.)]) */,""),~ut.indexOf(`
`)&&(wt-=ut.length,ut=this.options.pedantic?ut.replace(/^ {1,4}/gm,""):ut.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),_t!==Wt-1&&(St=this.rules.block.bullet.exec(at[_t+1])[0],(Le?St.length===1||!Se&&St[St.length-1]===")":St.length>1||this.options.smartLists&&St!==de)&&(ct=at.slice(_t+1).join(`
`),We.raw=We.raw.substring(0,We.raw.length-ct.length),_t=Wt-1)),zt=ft||/\n\n(?!\s*$)/.test(ut),_t!==Wt-1&&(ft=ut.charAt(ut.length-1)===`
`,zt||(zt=ft)),zt&&(We.loose=!0),It=/^\[[ xX]\] /.test(ut),Kt=void 0,It&&(Kt=ut[1]!==" ",ut=ut.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:se,task:It,checked:Kt,loose:zt,text:ut});return We}},pe.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ee(ne[0]):ne[0]}},pe.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var se=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:se,raw:ne[0],href:ne[2],title:ne[3]}}},pe.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var se={type:"table",header:$(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(se.header.length===se.align.length){se.raw=ne[0];var de=se.align.length,Le;for(Le=0;Le<de;Le++)/^ *-+: *$/.test(se.align[Le])?se.align[Le]="right":/^ *:-+: *$/.test(se.align[Le])?se.align[Le]="center":/^ *:-+ *$/.test(se.align[Le])?se.align[Le]="left":se.align[Le]=null;for(de=se.cells.length,Le=0;Le<de;Le++)se.cells[Le]=$(se.cells[Le].replace(/^ *\| *| *\| *$/g,""),se.header.length);return se}}},pe.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},pe.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},pe.text=function(re,ne){var se=this.rules.block.text.exec(re);if(se){var de=ne[ne.length-1];return de&&de.type==="text"?{raw:se[0],text:se[0]}:{type:"text",raw:se[0],text:se[0]}}},pe.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:ee(ne[1])}},pe.tag=function(re,ne,se){var de=this.rules.inline.tag.exec(re);if(de)return!ne&&/^<a /i.test(de[0])?ne=!0:ne&&/^<\/a>/i.test(de[0])&&(ne=!1),!se&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?se=!0:se&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(se=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:ne,inRawBlock:se,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]}},pe.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var se=oe(ne[2],"()");if(se>-1){var de=ne[0].indexOf("!")===0?5:4,Le=de+ne[1].length+se;ne[2]=ne[2].substring(0,se),ne[0]=ne[0].substring(0,Le).trim(),ne[3]=""}var Se=ne[2],We="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);at?(Se=at[1],We=at[3]):We=""}else We=ne[3]?ne[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=fe(ne,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ne[0]);return ft}},pe.reflink=function(re,ne){var se;if((se=this.rules.inline.reflink.exec(re))||(se=this.rules.inline.nolink.exec(re))){var de=(se[2]||se[1]).replace(/\s+/g," ");if(de=ne[de.toLowerCase()],!de||!de.href){var Le=se[0].charAt(0);return{type:"text",raw:Le,text:Le}}var Se=fe(se,de,se[0]);return Se}},pe.strong=function(re,ne,se){se===void 0&&(se="");var de=this.rules.inline.strong.start.exec(re);if(de&&(!de[1]||de[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ne=ne.slice(-1*re.length);var Le=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Le.lastIndex=0;for(var Se;(de=Le.exec(ne))!=null;)if(Se=this.rules.inline.strong.middle.exec(ne.slice(0,de.index+3)),Se)return{type:"strong",raw:re.slice(0,Se[0].length),text:re.slice(2,Se[0].length-2)}}},pe.em=function(re,ne,se){se===void 0&&(se="");var de=this.rules.inline.em.start.exec(re);if(de&&(!de[1]||de[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ne=ne.slice(-1*re.length);var Le=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Le.lastIndex=0;for(var Se;(de=Le.exec(ne))!=null;)if(Se=this.rules.inline.em.middle.exec(ne.slice(0,de.index+2)),Se)return{type:"em",raw:re.slice(0,Se[0].length),text:re.slice(1,Se[0].length-1)}}},pe.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var se=ne[2].replace(/\n/g," "),de=/[^ ]/.test(se),Le=se.startsWith(" ")&&se.endsWith(" ");return de&&Le&&(se=se.substring(1,se.length-1)),se=ee(se,!0),{type:"codespan",raw:ne[0],text:se}}},pe.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},pe.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},pe.autolink=function(re,ne){var se=this.rules.inline.autolink.exec(re);if(se){var de,Le;return se[2]==="@"?(de=ee(this.options.mangle?ne(se[1]):se[1]),Le="mailto:"+de):(de=ee(se[1]),Le=de),{type:"link",raw:se[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},pe.url=function(re,ne){var se;if(se=this.rules.inline.url.exec(re)){var de,Le;if(se[2]==="@")de=ee(this.options.mangle?ne(se[0]):se[0]),Le="mailto:"+de;else{var Se;do Se=se[0],se[0]=this.rules.inline._backpedal.exec(se[0])[0];while(Se!==se[0]);de=ee(se[0]),se[1]==="www."?Le="http://"+de:Le=de}return{type:"link",raw:se[0],text:de,href:Le,tokens:[{type:"text",raw:de,text:de}]}}},pe.inlineText=function(re,ne,se){var de=this.rules.inline.text.exec(re);if(de){var Le;return ne?Le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]:Le=ee(this.options.smartypants?se(de[0]):de[0]),{type:"text",raw:de[0],text:Le}}},xe}(),Ce=V.noopTest,we=V.edit,Te=V.merge,ge={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:Ce,table:Ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=we(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=we(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=we(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._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",ge._comment=/<!--(?!-?>)[\s\S]*?-->/,ge.html=we(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=we(ge._paragraph).replace("hr",ge.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",ge._tag).getRegex(),ge.blockquote=we(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=Te({},ge),ge.gfm=Te({},ge.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*|$)"}),ge.gfm.nptable=we(ge.gfm.nptable).replace("hr",ge.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",ge._tag).getRegex(),ge.gfm.table=we(ge.gfm.table).replace("hr",ge.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",ge._tag).getRegex(),ge.pedantic=Te({},ge.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._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:Ce,paragraph:we(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=we(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=we(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=we(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=we(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=we(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=we(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=we(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=we(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=we(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=we(ue._blockSkip,"g").getRegex(),ue.overlapSkip=we(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=we(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=we(ue.tag).replace("comment",ge._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=we(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=we(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=we(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Te({},ue),ue.pedantic=Te({},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:we(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Te({},ue.normal,{escape:we(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=we(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Te({},ue.gfm,{br:we(ue.br).replace("{2,}","*").getRegex(),text:we(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:ge,inline:ue},he=G.defaults,ae=te.block,_e=te.inline;function Oe(xe){return xe.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 ye(xe){var pe="",be,re,ne=xe.length;for(be=0;be<ne;be++)re=xe.charCodeAt(be),Math.random()>.5&&(re="x"+re.toString(16)),pe+="&#"+re+";";return pe}var Pe=function(){function xe(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||he,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ae.normal,inline:_e.normal};this.options.pedantic?(re.block=ae.pedantic,re.inline=_e.pedantic):this.options.gfm&&(re.block=ae.gfm,this.options.breaks?re.inline=_e.breaks:re.inline=_e.gfm),this.tokenizer.rules=re}xe.lex=function(re,ne){var se=new xe(ne);return se.lex(re)};var pe=xe.prototype;return pe.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},pe.blockTokens=function(re,ne,se){ne===void 0&&(ne=[]),se===void 0&&(se=!0),re=re.replace(/^ +$/gm,"");for(var de,Le,Se,We;re;){if(de=this.tokenizer.space(re)){re=re.substring(de.raw.length),de.type&&ne.push(de);continue}if(de=this.tokenizer.code(re,ne)){re=re.substring(de.raw.length),de.type?ne.push(de):(We=ne[ne.length-1],We.raw+=`
`+de.raw,We.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.heading(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.nptable(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.hr(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.blockquote(re)){re=re.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],se),ne.push(de);continue}if(de=this.tokenizer.list(re)){for(re=re.substring(de.raw.length),Se=de.items.length,Le=0;Le<Se;Le++)de.items[Le].tokens=this.blockTokens(de.items[Le].text,[],!1);ne.push(de);continue}if(de=this.tokenizer.html(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(se&&(de=this.tokenizer.def(re))){re=re.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(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.lheading(re)){re=re.substring(de.raw.length),ne.push(de);continue}if(se&&(de=this.tokenizer.paragraph(re))){re=re.substring(de.raw.length),ne.push(de);continue}if(de=this.tokenizer.text(re,ne)){re=re.substring(de.raw.length),de.type?ne.push(de):(We=ne[ne.length-1],We.raw+=`
`+de.raw,We.text+=`
`+de.text);continue}if(re){var at="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return ne},pe.inline=function(re){var ne,se,de,Le,Se,We,at=re.length;for(ne=0;ne<at;ne++){We=re[ne];switch(We.type){case"paragraph":case"text":case"heading":{We.tokens=[],this.inlineTokens(We.text,We.tokens);break}case"table":{for(We.tokens={header:[],cells:[]},Le=We.header.length,se=0;se<Le;se++)We.tokens.header[se]=[],this.inlineTokens(We.header[se],We.tokens.header[se]);for(Le=We.cells.length,se=0;se<Le;se++)for(Se=We.cells[se],We.tokens.cells[se]=[],de=0;de<Se.length;de++)We.tokens.cells[se][de]=[],this.inlineTokens(Se[de],We.tokens.cells[se][de]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(Le=We.items.length,se=0;se<Le;se++)this.inline(We.items[se].tokens);break}}}return re},pe.inlineTokens=function(re,ne,se,de,Le){ne===void 0&&(ne=[]),se===void 0&&(se=!1),de===void 0&&(de=!1),Le===void 0&&(Le="");var Se,We=re,at;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)ft.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Se=this.tokenizer.escape(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.tag(re,se,de)){re=re.substring(Se.raw.length),se=Se.inLink,de=Se.inRawBlock,ne.push(Se);continue}if(Se=this.tokenizer.link(re)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,de)),ne.push(Se);continue}if(Se=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,de)),ne.push(Se);continue}if(Se=this.tokenizer.strong(re,We,Le)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,de),ne.push(Se);continue}if(Se=this.tokenizer.em(re,We,Le)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,de),ne.push(Se);continue}if(Se=this.tokenizer.codespan(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.br(re)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.del(re)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],se,de),ne.push(Se);continue}if(Se=this.tokenizer.autolink(re,ye)){re=re.substring(Se.raw.length),ne.push(Se);continue}if(!se&&(Se=this.tokenizer.url(re,ye))){re=re.substring(Se.raw.length),ne.push(Se);continue}if(Se=this.tokenizer.inlineText(re,de,Oe)){re=re.substring(Se.raw.length),Le=Se.raw.slice(-1),ne.push(Se);continue}if(re){var ut="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return ne},Q(xe,null,[{key:"rules",get:function(){return{block:ae,inline:_e}}}]),xe}(),Me=G.defaults,Ne=V.cleanUrl,Fe=V.escape,Ue=function(){function xe(be){this.options=be||Me}var pe=xe.prototype;return pe.code=function(re,ne,se){var de=(ne||"").match(/\S*/)[0];if(this.options.highlight){var Le=this.options.highlight(re,de);Le!=null&&Le!==re&&(se=!0,re=Le)}return de?'<pre><code class="'+this.options.langPrefix+Fe(de,!0)+'">'+(se?re:Fe(re,!0))+`</code></pre>
`:"<pre><code>"+(se?re:Fe(re,!0))+`</code></pre>
`},pe.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},pe.html=function(re){return re},pe.heading=function(re,ne,se,de){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+de.slug(se)+'">'+re+"</h"+ne+`>
`:"<h"+ne+">"+re+"</h"+ne+`>
`},pe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},pe.list=function(re,ne,se){var de=ne?"ol":"ul",Le=ne&&se!==1?' start="'+se+'"':"";return"<"+de+Le+`>
`+re+"</"+de+`>
`},pe.listitem=function(re){return"<li>"+re+`</li>
`},pe.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},pe.paragraph=function(re){return"<p>"+re+`</p>
`},pe.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ne+`</table>
`},pe.tablerow=function(re){return`<tr>
`+re+`</tr>
`},pe.tablecell=function(re,ne){var se=ne.header?"th":"td",de=ne.align?"<"+se+' align="'+ne.align+'">':"<"+se+">";return de+re+"</"+se+`>
`},pe.strong=function(re){return"<strong>"+re+"</strong>"},pe.em=function(re){return"<em>"+re+"</em>"},pe.codespan=function(re){return"<code>"+re+"</code>"},pe.br=function(){return this.options.xhtml?"<br/>":"<br>"},pe.del=function(re){return"<del>"+re+"</del>"},pe.link=function(re,ne,se){if(re=Ne(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var de='<a href="'+Fe(re)+'"';return ne&&(de+=' title="'+ne+'"'),de+=">"+se+"</a>",de},pe.image=function(re,ne,se){if(re=Ne(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var de='<img src="'+re+'" alt="'+se+'"';return ne&&(de+=' title="'+ne+'"'),de+=this.options.xhtml?"/>":">",de},pe.text=function(re){return re},xe}(),Be=function(){function xe(){}var pe=xe.prototype;return pe.strong=function(re){return re},pe.em=function(re){return re},pe.codespan=function(re){return re},pe.del=function(re){return re},pe.html=function(re){return re},pe.text=function(re){return re},pe.link=function(re,ne,se){return""+se},pe.image=function(re,ne,se){return""+se},pe.br=function(){return""},xe}(),tt=function(){function xe(){this.seen={}}var pe=xe.prototype;return pe.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var se=ne;do this.seen[se]++,ne=se+"-"+this.seen[se];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},xe}(),et=G.defaults,Ye=V.unescape,$e=function(){function xe(be){this.options=be||et,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new tt}xe.parse=function(re,ne){var se=new xe(ne);return se.parse(re)};var pe=xe.prototype;return pe.parse=function(re,ne){ne===void 0&&(ne=!0);var se="",de,Le,Se,We,at,ft,ut,wt,St,ct,zt,It,Kt,Wt,_t,Wr,ai,vt,Vr=re.length;for(de=0;de<Vr;de++){ct=re[de];switch(ct.type){case"space":continue;case"hr":{se+=this.renderer.hr();continue}case"heading":{se+=this.renderer.heading(this.parseInline(ct.tokens),ct.depth,Ye(this.parseInline(ct.tokens,this.textRenderer)),this.slugger);continue}case"code":{se+=this.renderer.code(ct.text,ct.lang,ct.escaped);continue}case"table":{for(wt="",ut="",We=ct.header.length,Le=0;Le<We;Le++)ut+=this.renderer.tablecell(this.parseInline(ct.tokens.header[Le]),{header:!0,align:ct.align[Le]});for(wt+=this.renderer.tablerow(ut),St="",We=ct.cells.length,Le=0;Le<We;Le++){for(ft=ct.tokens.cells[Le],ut="",at=ft.length,Se=0;Se<at;Se++)ut+=this.renderer.tablecell(this.parseInline(ft[Se]),{header:!1,align:ct.align[Se]});St+=this.renderer.tablerow(ut)}se+=this.renderer.table(wt,St);continue}case"blockquote":{St=this.parse(ct.tokens),se+=this.renderer.blockquote(St);continue}case"list":{for(zt=ct.ordered,It=ct.start,Kt=ct.loose,We=ct.items.length,St="",Le=0;Le<We;Le++)_t=ct.items[Le],Wr=_t.checked,ai=_t.task,Wt="",_t.task&&(vt=this.renderer.checkbox(Wr),Kt?_t.tokens.length>0&&_t.tokens[0].type==="text"?(_t.tokens[0].text=vt+" "+_t.tokens[0].text,_t.tokens[0].tokens&&_t.tokens[0].tokens.length>0&&_t.tokens[0].tokens[0].type==="text"&&(_t.tokens[0].tokens[0].text=vt+" "+_t.tokens[0].tokens[0].text)):_t.tokens.unshift({type:"text",text:vt}):Wt+=vt),Wt+=this.parse(_t.tokens,Kt),St+=this.renderer.listitem(Wt,ai,Wr);se+=this.renderer.list(St,zt,It);continue}case"html":{se+=this.renderer.html(ct.text);continue}case"paragraph":{se+=this.renderer.paragraph(this.parseInline(ct.tokens));continue}case"text":{for(St=ct.tokens?this.parseInline(ct.tokens):ct.text;de+1<Vr&&re[de+1].type==="text";)ct=re[++de],St+=`
`+(ct.tokens?this.parseInline(ct.tokens):ct.text);se+=ne?this.renderer.paragraph(St):St;continue}default:{var nr='Token with "'+ct.type+'" type was not found.';if(this.options.silent){console.error(nr);return}else throw new Error(nr)}}}return se},pe.parseInline=function(re,ne){ne=ne||this.renderer;var se="",de,Le,Se=re.length;for(de=0;de<Se;de++){Le=re[de];switch(Le.type){case"escape":{se+=ne.text(Le.text);break}case"html":{se+=ne.html(Le.text);break}case"link":{se+=ne.link(Le.href,Le.title,this.parseInline(Le.tokens,ne));break}case"image":{se+=ne.image(Le.href,Le.title,Le.text);break}case"strong":{se+=ne.strong(this.parseInline(Le.tokens,ne));break}case"em":{se+=ne.em(this.parseInline(Le.tokens,ne));break}case"codespan":{se+=ne.codespan(Le.text);break}case"br":{se+=ne.br();break}case"del":{se+=ne.del(this.parseInline(Le.tokens,ne));break}case"text":{se+=ne.text(Le.text);break}default:{var We='Token with "'+Le.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return se},xe}(),lt=V.merge,Ze=V.checkSanitizeDeprecation,ot=V.escape,ke=G.getDefaults,nt=G.changeDefaults,Je=G.defaults;function Ie(xe,pe,be){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof pe=="function"&&(be=pe,pe=null),pe=lt({},Ie.defaults,pe||{}),Ze(pe),be){var re=pe.highlight,ne;try{ne=Pe.lex(xe,pe)}catch(Se){return be(Se)}var se=function(We){var at;if(!We)try{at=$e.parse(ne,pe)}catch(ft){We=ft}return pe.highlight=re,We?be(We):be(null,at)};if(!re||re.length<3)return se();if(delete pe.highlight,!ne.length)return se();var de=0;Ie.walkTokens(ne,function(Se){Se.type==="code"&&(de++,setTimeout(function(){re(Se.text,Se.lang,function(We,at){if(We)return se(We);at!=null&&at!==Se.text&&(Se.text=at,Se.escaped=!0),de--,de===0&&se()})},0))}),de===0&&se();return}try{var Le=Pe.lex(xe,pe);return pe.walkTokens&&Ie.walkTokens(Le,pe.walkTokens),$e.parse(Le,pe)}catch(Se){if(Se.message+=`
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+ot(Se.message+"",!0)+"</pre>";throw Se}}Ie.options=Ie.setOptions=function(xe){return lt(Ie.defaults,xe),nt(Ie.defaults),Ie},Ie.getDefaults=ke,Ie.defaults=Je,Ie.use=function(xe){var pe=lt({},xe);if(xe.renderer&&function(){var re=Ie.defaults.renderer||new Ue,ne=function(Le){var Se=re[Le];re[Le]=function(){for(var We=arguments.length,at=new Array(We),ft=0;ft<We;ft++)at[ft]=arguments[ft];var ut=xe.renderer[Le].apply(re,at);return ut===!1&&(ut=Se.apply(re,at)),ut}};for(var se in xe.renderer)ne(se);pe.renderer=re}(),xe.tokenizer&&function(){var re=Ie.defaults.tokenizer||new Ee,ne=function(Le){var Se=re[Le];re[Le]=function(){for(var We=arguments.length,at=new Array(We),ft=0;ft<We;ft++)at[ft]=arguments[ft];var ut=xe.tokenizer[Le].apply(re,at);return ut===!1&&(ut=Se.apply(re,at)),ut}};for(var se in xe.tokenizer)ne(se);pe.tokenizer=re}(),xe.walkTokens){var be=Ie.defaults.walkTokens;pe.walkTokens=function(re){xe.walkTokens(re),be&&be(re)}}Ie.setOptions(pe)},Ie.walkTokens=function(xe,pe){for(var be=B(xe),re;!(re=be()).done;){var ne=re.value;pe(ne);switch(ne.type){case"table":{for(var se=B(ne.tokens.header),de;!(de=se()).done;){var Le=de.value;Ie.walkTokens(Le,pe)}for(var Se=B(ne.tokens.cells),We;!(We=Se()).done;)for(var at=We.value,ft=B(at),ut;!(ut=ft()).done;){var wt=ut.value;Ie.walkTokens(wt,pe)}break}case"list":{Ie.walkTokens(ne.items,pe);break}default:ne.tokens&&Ie.walkTokens(ne.tokens,pe)}}},Ie.Parser=$e,Ie.parser=$e.parse,Ie.Renderer=Ue,Ie.TextRenderer=Be,Ie.Lexer=Pe,Ie.lexer=Pe.lex,Ie.Tokenizer=Ee,Ie.Slugger=tt,Ie.parse=Ie;var He=Ie;return He})},ELLl:function(bt,qe,ie){(function(le){le(ie("VrN/"))})(function(le){var Q={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=le.Pos;le.defineOption("autoCloseBrackets",!1,function(w,S,h){h&&h!=le.Init&&(w.removeKeyMap(B),w.state.closeBrackets=null),S&&(P(Z(S,"pairs")),w.state.closeBrackets=S,w.addKeyMap(B))});function Z(w,S){return S=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[S]!=null?w[S]:Q[S]}var B={Backspace:I,Enter:k};function P(w){for(var S=0;S<w.length;S++){var h=w.charAt(S),o="'"+h+"'";B[o]||(B[o]=G(h))}}P(Q.pairs+"`");function G(w){return function(S){return T(S,w)}}function j(w){var S=w.state.closeBrackets;if(!S||S.override)return S;var h=w.getModeAt(w.getCursor());return h.closeBrackets||S}function I(w){var S=j(w);if(!S||w.getOption("disableInput"))return le.Pass;for(var h=Z(S,"pairs"),o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return le.Pass;var u=R(w,o[l].head);if(!u||h.indexOf(u)%2!=0)return le.Pass}for(var l=o.length-1;l>=0;l--){var A=o[l].head;w.replaceRange("",D(A.line,A.ch-1),D(A.line,A.ch+1),"+delete")}}function k(w){var S=j(w),h=S&&Z(S,"explode");if(!h||w.getOption("disableInput"))return le.Pass;for(var o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return le.Pass;var u=R(w,o[l].head);if(!u||h.indexOf(u)%2!=0)return le.Pass}w.operation(function(){var A=w.lineSeparator()||`
`;w.replaceSelection(A+A,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var p=0;p<o.length;p++){var f=o[p].head.line;w.indentLine(f,null,!0),w.indentLine(f+1,null,!0)}})}function v(w){var S=le.cmpPos(w.anchor,w.head)>0;return{anchor:new D(w.anchor.line,w.anchor.ch+(S?-1:1)),head:new D(w.head.line,w.head.ch+(S?1:-1))}}function T(w,S){var h=j(w);if(!h||w.getOption("disableInput"))return le.Pass;var o=Z(h,"pairs"),l=o.indexOf(S);if(l==-1)return le.Pass;for(var u=Z(h,"closeBefore"),A=Z(h,"triples"),p=o.charAt(l+1)==S,f=w.listSelections(),L=l%2==0,b,m=0;m<f.length;m++){var c=f[m],d=c.head,a,x=w.getRange(d,D(d.line,d.ch+1));if(L&&!c.empty())a="surround";else if((p||!L)&&x==S)p&&_(w,d)?a="both":A.indexOf(S)>=0&&w.getRange(d,D(d.line,d.ch+3))==S+S+S?a="skipThree":a="skip";else if(p&&d.ch>1&&A.indexOf(S)>=0&&w.getRange(D(d.line,d.ch-2),d)==S+S){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(D(d.line,d.ch-2))))return le.Pass;a="addFour"}else if(p){var y=d.ch==0?" ":w.getRange(D(d.line,d.ch-1),d);if(!le.isWordChar(x)&&y!=S&&!le.isWordChar(y))a="both";else return le.Pass}else if(L&&(x.length===0||/\s/.test(x)||u.indexOf(x)>-1))a="both";else return le.Pass;if(!b)b=a;else if(b!=a)return le.Pass}var E=l%2?o.charAt(l-1):S,N=l%2?S:o.charAt(l+1);w.operation(function(){if(b=="skip")w.execCommand("goCharRight");else if(b=="skipThree")for(var U=0;U<3;U++)w.execCommand("goCharRight");else if(b=="surround"){for(var K=w.getSelections(),U=0;U<K.length;U++)K[U]=E+K[U]+N;w.replaceSelections(K,"around"),K=w.listSelections().slice();for(var U=0;U<K.length;U++)K[U]=v(K[U]);w.setSelections(K)}else b=="both"?(w.replaceSelection(E+N,null),w.triggerElectric(E+N),w.execCommand("goCharLeft")):b=="addFour"&&(w.replaceSelection(E+E+E+E,"before"),w.execCommand("goCharRight"))})}function R(w,S){var h=w.getRange(D(S.line,S.ch-1),D(S.line,S.ch+1));return h.length==2?h:null}function _(w,S){var h=w.getTokenAt(D(S.line,S.ch+1));return/\bstring/.test(h.type)&&h.start==S.ch&&(S.ch==0||!/\bstring/.test(w.getTokenTypeAt(S)))}})},GfqC:function(bt,qe,ie){"use strict";var le=ie("q1tI"),Q=ie.n(le),D=ie("TSYQ"),Z=ie.n(D);function B(V,O){var M="cannot "+V.method+" "+V.action+" "+O.status+"'",$=new Error(M);return $.status=O.status,$.method=V.method,$.url=V.action,$}function P(V){var O=V.responseText||V.response;if(!O)return O;try{return JSON.parse(O)}catch(M){return O}}function G(V){var O=new XMLHttpRequest;V.onProgress&&O.upload&&(O.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var M=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(fe){M.append(ee+"[]",fe)});return}M.append(ee,V.data[ee])}),V.file instanceof Blob?M.append(V.filename,V.file,V.file.name):M.append(V.filename,V.file),O.onerror=function(oe){V.onError(oe)},O.onload=function(){return O.status<200||O.status>=300?V.onError(B(V,O),P(O)):V.onSuccess(P(O),O)},O.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ee){$[ee]!==null&&O.setRequestHeader(ee,$[ee])}),O.send(M),{abort:function(){O.abort()}}}var j=+new Date,I=0;function k(){return"rc-upload-"+j+"-"+ ++I}function v(V,O){return V.indexOf(O,V.length-O.length)!==-1}var T=function(V,O){if(V&&O){var M=Array.isArray(O)?O:O.split(","),$=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return M.some(function(fe){var Re=fe.trim();return Re.charAt(0)==="."?v($.toLowerCase(),Re.toLowerCase()):/\/\*$/.test(Re)?oe===Re.replace(/\/.*$/,""):ee===Re})}return!0};function R(V,O){var M=V.createReader(),$=[];function ee(){M.readEntries(function(oe){var fe=Array.prototype.slice.apply(oe);$=$.concat(fe);var Re=!fe.length;Re?O($):ee()})}ee()}var _=function(O,M,$){var ee=function oe(fe,Re){Re=Re||"",fe.isFile?fe.file(function(Ee){$(Ee)&&(fe.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),M([Ee]))}):fe.isDirectory&&R(fe,function(Ee){Ee.forEach(function(Ce){oe(Ce,""+Re+fe.name+"/")})})};O.forEach(function(oe){ee(oe.webkitGetAsEntry())})},w=_,S=Object.assign||function(V){for(var O=1;O<arguments.length;O++){var M=arguments[O];for(var $ in M)Object.prototype.hasOwnProperty.call(M,$)&&(V[$]=M[$])}return V},h=function(){function V(O,M){var $=[],ee=!0,oe=!1,fe=void 0;try{for(var Re=O[Symbol.iterator](),Ee;!(ee=(Ee=Re.next()).done)&&!($.push(Ee.value),M&&$.length===M);ee=!0);}catch(Ce){oe=!0,fe=Ce}finally{try{!ee&&Re.return&&Re.return()}finally{if(oe)throw fe}}return $}return function(O,M){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return V(O,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(O,M){for(var $=0;$<M.length;$++){var ee=M[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(O,ee.key,ee)}}return function(O,M,$){return M&&V(O.prototype,M),$&&V(O,$),O}}();function l(V,O,M){return O in V?Object.defineProperty(V,O,{value:M,enumerable:!0,configurable:!0,writable:!0}):V[O]=M,V}function u(V,O){var M={};for(var $ in V){if(O.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;M[$]=V[$]}return M}function A(V,O){if(!(V instanceof O))throw new TypeError("Cannot call a class as a function")}function p(V,O){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:V}function f(V,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);V.prototype=Object.create(O&&O.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(V,O):V.__proto__=O)}var L=function(O){return Object.keys(O).reduce(function(M,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(M[$]=O[$]),M},{})},b=function(V){f(O,V);function O(){var M,$,ee,oe;A(this,O);for(var fe=arguments.length,Re=Array(fe),Ee=0;Ee<fe;Ee++)Re[Ee]=arguments[Ee];return oe=($=(ee=p(this,(M=O.__proto__||Object.getPrototypeOf(O)).call.apply(M,[this].concat(Re))),ee),ee.state={uid:k()},ee.reqs={},ee.onChange=function(Ce){var we=Ce.target.files;ee.uploadFiles(we),ee.reset()},ee.onClick=function(Ce){var we=ee.fileInput;if(!we)return;var Te=ee.props,ge=Te.children,ue=Te.onClick;ge&&ge.type==="button"&&(we.parentNode.focus(),we.parentNode.querySelector("button").blur()),we.click(),ue&&ue(Ce)},ee.onKeyDown=function(Ce){Ce.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Ce){var we=ee.props.multiple;if(Ce.preventDefault(),Ce.type==="dragover")return;if(ee.props.directory)w(Array.prototype.slice.call(Ce.dataTransfer.items),ee.uploadFiles,function(ge){return T(ge,ee.props.accept)});else{var Te=Array.prototype.slice.call(Ce.dataTransfer.files).filter(function(ge){return T(ge,ee.props.accept)});we===!1&&(Te=Te.slice(0,1)),ee.uploadFiles(Te)}},ee.uploadFiles=function(Ce){var we=Array.prototype.slice.call(Ce);we.map(function(Te){return Te.uid=k(),Te}).forEach(function(Te){ee.upload(Te,we)})},ee.saveFileInput=function(Ce){ee.fileInput=Ce},$),p(ee,oe)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ee){var oe=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return oe.post($)},0);var Re=fe.beforeUpload($,ee);Re&&Re.then?Re.then(function(Ee){var Ce=Object.prototype.toString.call(Ee);return Ce==="[object File]"||Ce==="[object Blob]"?oe.post(Ee):oe.post($)}).catch(function(Ee){console.log(Ee)}):Re!==!1&&setTimeout(function(){return oe.post($)},0);return}},{key:"post",value:function($){var ee=this;if(!this._isMounted)return;var oe=this.props,fe=oe.onStart,Re=oe.onProgress,Ee=oe.transformFile,Ce=Ee===void 0?function(we){return we}:Ee;new Promise(function(we){var Te=oe.action;return typeof Te=="function"&&(Te=Te($)),we(Te)}).then(function(we){var Te=$.uid,ge=oe.customRequest||G,ue=Promise.resolve(Ce($)).then(function(te){var he=oe.data;return typeof he=="function"&&(he=he(te)),Promise.all([te,he])}).catch(function(te){console.error(te)});ue.then(function(te){var he=h(te,2),ae=he[0],_e=he[1],Oe={action:we,filename:oe.name,data:_e,file:ae,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:Re?function(ye){Re(ye,$)}:null,onSuccess:function(Pe,Me){delete ee.reqs[Te],oe.onSuccess(Pe,$,Me)},onError:function(Pe,Me){delete ee.reqs[Te],oe.onError(Pe,Me,$)}};fe($),ee.reqs[Te]=ge(Oe)})})}},{key:"reset",value:function(){this.setState({uid:k()})}},{key:"abort",value:function($){var ee=this.reqs;if($){var oe=$;$&&$.uid&&(oe=$.uid),ee[oe]&&ee[oe].abort&&ee[oe].abort(),delete ee[oe]}else Object.keys(ee).forEach(function(fe){ee[fe]&&ee[fe].abort&&ee[fe].abort(),delete ee[fe]})}},{key:"render",value:function(){var $,ee=this.props,oe=ee.component,fe=ee.prefixCls,Re=ee.className,Ee=ee.disabled,Ce=ee.id,we=ee.style,Te=ee.multiple,ge=ee.accept,ue=ee.children,te=ee.directory,he=ee.openFileDialogOnClick,ae=ee.onMouseEnter,_e=ee.onMouseLeave,Oe=u(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=Z()(($={},l($,fe,!0),l($,fe+"-disabled",Ee),l($,Re,Re),$)),Pe=Ee?{}:{onClick:he?this.onClick:function(){},onKeyDown:he?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:_e,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Q.a.createElement(oe,S({},Pe,{className:ye,role:"button",style:we}),Q.a.createElement("input",S({},L(Oe),{id:Ce,type:"file",ref:this.saveFileInput,onClick:function(Ne){return Ne.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ge,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Te,onChange:this.onChange})),ue)}}]),O}(le.Component),m=b,c=Object.assign||function(V){for(var O=1;O<arguments.length;O++){var M=arguments[O];for(var $ in M)Object.prototype.hasOwnProperty.call(M,$)&&(V[$]=M[$])}return V},d=function(){function V(O,M){for(var $=0;$<M.length;$++){var ee=M[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(O,ee.key,ee)}}return function(O,M,$){return M&&V(O.prototype,M),$&&V(O,$),O}}();function a(V,O){if(!(V instanceof O))throw new TypeError("Cannot call a class as a function")}function x(V,O){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:V}function y(V,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);V.prototype=Object.create(O&&O.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(V,O):V.__proto__=O)}function E(){}var N=function(V){y(O,V);function O(){var M,$,ee,oe;a(this,O);for(var fe=arguments.length,Re=Array(fe),Ee=0;Ee<fe;Ee++)Re[Ee]=arguments[Ee];return oe=($=(ee=x(this,(M=O.__proto__||Object.getPrototypeOf(O)).call.apply(M,[this].concat(Re))),ee),ee.saveUploader=function(Ce){ee.uploader=Ce},$),x(ee,oe)}return d(O,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Q.a.createElement(m,c({},this.props,{ref:this.saveUploader}))}}]),O}(le.Component);N.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=N,K=qe.a=U},HmJG:function(bt,qe,ie){},LdHM:function(bt,qe,ie){"use strict";ie.d(qe,"b",function(){return u}),ie.d(qe,"a",function(){return p});var le=ie("1OyB"),Q=ie("vuIU"),D=ie("Ji7U"),Z=ie("LK+K"),B=ie("q1tI"),P=ie("rePB"),G=ie("Ff2n"),j=ie("ODXe"),I=ie("4IlW"),k=ie("bX4T"),v=ie("YrtM"),T=ie("TSYQ"),R=ie.n(T),_=ie("+nKL"),w=ie("8OUc"),S=function($,ee){var oe=$.prefixCls,fe=$.id,Re=$.flattenOptions,Ee=$.childrenAsData,Ce=$.values,we=$.searchValue,Te=$.multiple,ge=$.defaultActiveFirstOption,ue=$.height,te=$.itemHeight,he=$.notFoundContent,ae=$.open,_e=$.menuItemSelectedIcon,Oe=$.virtual,ye=$.onSelect,Pe=$.onToggleOpen,Me=$.onActiveValue,Ne=$.onScroll,Fe=$.onMouseEnter,Ue="".concat(oe,"-item"),Be=Object(v.a)(function(){return Re},[ae,Re],function(He,xe){return xe[0]&&He[1]!==xe[1]}),tt=B.useRef(null),et=function(xe){xe.preventDefault()},Ye=function(xe){tt.current&&tt.current.scrollTo({index:xe})},$e=function(xe){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Be.length,re=0;re<be;re+=1){var ne=(xe+re*pe+be)%be,se=Be[ne],de=se.group,Le=se.data;if(!de&&!Le.disabled)return ne}return-1},lt=B.useState(function(){return $e(0)}),Ze=Object(j.a)(lt,2),ot=Ze[0],ke=Ze[1],nt=function(xe){ke(xe);var pe=Be[xe];if(!pe){Me(null,-1);return}Me(pe.data.value,xe)};B.useEffect(function(){nt(ge!==!1?$e(0):-1)},[Be.length,we]),B.useEffect(function(){var He=setTimeout(function(){if(!Te&&ae&&Ce.size===1){var xe=Array.from(Ce)[0],pe=Be.findIndex(function(be){var re=be.data;return re.value===xe});nt(pe),Ye(pe)}});return function(){return clearTimeout(He)}},[ae]);var Je=function(xe){xe!==void 0&&ye(xe,{selected:!Ce.has(xe)}),Te||Pe(!1)};if(B.useImperativeHandle(ee,function(){return{onKeyDown:function(xe){var pe=xe.which;switch(pe){case I.a.UP:case I.a.DOWN:{var be=0;if(pe===I.a.UP?be=-1:pe===I.a.DOWN&&(be=1),be!==0){var re=$e(ot+be,be);Ye(re),nt(re)}break}case I.a.ENTER:{var ne=Be[ot];ne&&!ne.data.disabled?Je(ne.data.value):Je(void 0),ae&&xe.preventDefault();break}case I.a.ESC:Pe(!1)}},onKeyUp:function(){},scrollTo:function(xe){Ye(xe)}}}),Be.length===0)return B.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:et},he);function Ie(He){var xe=Be[He];if(!xe)return null;var pe=xe.data||{},be=pe.value,re=pe.label,ne=pe.children,se=Object(k.a)(pe,!0),de=Ee?ne:re;return xe?B.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},se,{key:He,role:"option",id:"".concat(fe,"_list_").concat(He),"aria-selected":Ce.has(be)}),be):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ie(ot-1),Ie(ot),Ie(ot+1)),B.createElement(_.a,{itemKey:"key",ref:tt,data:Be,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:et,onScroll:Ne,virtual:Oe,onMouseEnter:Fe},function(He,xe){var pe,be=He.group,re=He.groupOption,ne=He.data,se=ne.label,de=ne.key;if(be)return B.createElement("div",{className:R()(Ue,"".concat(Ue,"-group"))},se!==void 0?se:de);var Le=ne.disabled,Se=ne.value,We=ne.title,at=ne.children,ft=ne.style,ut=ne.className,wt=Object(G.a)(ne,["disabled","value","title","children","style","className"]),St=Ce.has(Se),ct="".concat(Ue,"-option"),zt=R()(Ue,ct,ut,(pe={},Object(P.a)(pe,"".concat(ct,"-grouped"),re),Object(P.a)(pe,"".concat(ct,"-active"),ot===xe&&!Le),Object(P.a)(pe,"".concat(ct,"-disabled"),Le),Object(P.a)(pe,"".concat(ct,"-selected"),St),pe)),It=Ee?at:se,Kt=!_e||typeof _e=="function"||St;return B.createElement("div",Object.assign({},wt,{"aria-selected":St,className:zt,title:We,onMouseMove:function(){if(ot===xe||Le)return;nt(xe)},onClick:function(){Le||Je(Se)},style:ft}),B.createElement("div",{className:"".concat(ct,"-content")},It||Se),B.isValidElement(_e)||St,Kt&&B.createElement(w.a,{className:"".concat(Ue,"-option-state"),customizeIcon:_e,customizeIconProps:{isSelected:St}},St?"\u2713":null))}))},h=B.forwardRef(S);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var u=l,A=function(){return null};A.isSelectOptGroup=!0;var p=A,f=ie("VTBJ"),L=ie("Zm9Q");function b(M){var $=M.key,ee=M.props,oe=ee.children,fe=ee.value,Re=Object(G.a)(ee,["children","value"]);return Object(f.a)({key:$,value:fe!==void 0?fe:$,children:oe},Re)}function m(M){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(M).map(function(ee,oe){if(!B.isValidElement(ee)||!ee.type)return null;var fe=ee.type.isSelectOptGroup,Re=ee.key,Ee=ee.props,Ce=Ee.children,we=Object(G.a)(Ee,["children"]);return $||!fe?b(ee):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(Re===null?oe:Re,"__"),label:Re},we),{},{options:m(Ce)})}).filter(function(ee){return ee})}var c=ie("2Qr1"),d=ie("qNPg"),a=ie("U8pU"),x=ie("Kwbf"),y=ie("WKfj");function E(M){var $=M.mode,ee=M.options,oe=M.children,fe=M.backfill,Re=M.allowClear,Ee=M.placeholder,Ce=M.getInputElement,we=M.showSearch,Te=M.onSearch,ge=M.defaultOpen,ue=M.autoFocus,te=M.labelInValue,he=M.value,ae=M.inputValue,_e=M.optionLabelProp,Oe=$==="multiple"||$==="tags",ye=we!==void 0?we:Oe||$==="combobox",Pe=ee||m(oe);if(Object(x.a)($!=="tags"||Pe.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Me=Pe.some(function(Ue){return Ue.options?Ue.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(x.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)($!=="combobox"||!_e,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)($==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(x.a)($==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(x.b)($!=="combobox"||!Ce||!Re||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Te&&!ye&&$!=="combobox"&&$!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ge||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var Ne=Object(y.d)(he);Object(x.a)(!te||Ne.every(function(Ue){return Object(a.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Oe||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var Fe=null;Object(L.a)(oe).some(function(Ue){if(!B.isValidElement(Ue)||!Ue.type)return!1;var Be=Ue.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var tt=Object(L.a)(Ue.props.children).every(function(et){return!B.isValidElement(et)||!Ue.type||et.type.isSelectOption?!0:(Fe=et.type,!1)});return!tt}return Fe=Be,!0}),Fe&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(x.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=E,U=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:m,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:N,fillOptionsWithMissingValue:c.a}),K=function(M){Object(D.a)(ee,M);var $=Object(Z.a)(ee);function ee(){var oe;return Object(le.a)(this,ee),oe=$.apply(this,arguments),oe.selectRef=B.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(Q.a)(ee,[{key:"render",value:function(){return B.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),ee}(B.Component);K.Option=u,K.OptGroup=p;var V=K,O=qe.c=V},M8RZ:function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return I});var le=ie("fWQN"),Q=ie("mtLc"),D=ie("yKVA"),Z=ie("879j"),B=ie("q1tI"),P=ie.n(B),G=ie("i8i4"),j=ie.n(G),I=function(k){Object(D.a)(T,k);var v=Object(Z.a)(T);function T(R){var _;Object(le.a)(this,T),_=v.call(this,R);var w=window.document;return _.node=w.createElement("div"),w.body.appendChild(_.node),_}return Object(Q.a)(T,[{key:"render",value:function(){var _=this.props.children;return Object(G.createPortal)(_,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(P.a.Component)},Ot1p:function(bt,qe,ie){"use strict";var le=ie("2qtc"),Q=ie("kLXV"),D=ie("rAM+"),Z=ie("miYZ"),B=ie("tsqr"),P=ie("9og8"),G=ie("tJVT"),j=ie("jrin"),I=ie("WmNS"),k=ie.n(I),v=ie("q1tI"),T=ie.n(v),R=ie("VrN/"),_=ie.n(R),w=ie("bdgK"),S=ie("p77/"),h=ie("Bd2K"),o=ie("ELLl"),l=ie("19Vz"),u=ie("lZu9"),A=ie("+NIl"),p=ie("kSUc"),f=ie("9Bee"),L=function(Se){var We=Se.value,at=We===void 0?"":We,ft=Se.className,ut=Se.showTextOnly,wt=Se.showLines,St=Se.style,ct=St===void 0?{}:St,zt=Object(v.useMemo)(function(){return""},[at]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:zt}}))},b=ie("0Owb"),m=ie("dejd"),c=ie("C+DQ"),d=ie("1vsH"),a=ie("m3rI"),x=[{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 y(Se){var We=Se.onActionCallback,at=Se.title,ft=Se.icon,ut=Se.actionName,wt=Se.className,St=wt===void 0?"":wt,ct=Se.children;function zt(){We(ut)}return T.a.createElement("a",{title:at,className:St,onClick:zt},T.a.createElement("i",{className:"md-iconfont ".concat(ft)}),ct)}var E=function(Se){var We=Se.watch,at=Se.showNullButton,ft=Se.onActionCallback,ut=Se.fullScreen,wt=Se.insertTemp,St=Se.hidetoolBar,ct=Se.uuid,zt=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.E)("_educoder_session"),"&key=").concat(ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var It=[].concat(x,[{title:"".concat(We?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(We?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return T.a.createElement("ul",{className:"markdown-toolbar-container"},!St&&It.map(function(Kt,Wt){return T.a.createElement("li",{key:Wt},Kt.actionName?T.a.createElement(y,Object(b.a)({},Kt,{onActionCallback:ft})):T.a.createElement("span",{className:"v-line"}))}),at?T.a.createElement("li",null,T.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ft},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,wt&&T.a.createElement("li",null,T.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(wt),onActionCallback:ft},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(y,{icon:"".concat(ut?"icon-shrink":"icon-enlarge"),title:ut?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ft})))},N=ie("M8RZ"),U=ie("+L6B"),K=ie("2/Rp"),V=ie("y8nQ"),O=ie("Vl3Y"),M=ie("5NDa"),$=ie("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(Se){var We=Se.callback,at=Se.onCancel;function ft(ut){We(ut)}return T.a.createElement(O.a,Object(b.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ft}),T.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement($.a,null)),T.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement($.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},fe=ie("7ahc"),Re=ie("k1fw"),Ee=ie("HmJG"),Ce=ie("BjJ7"),we=O.a.useForm,Te={width:280,marginRight:10},ge={labelCol:{span:5},wrapperCol:{span:19}},ue=function(Se){var We=Se.callback,at=Se.onCancel,ft=we(),ut=Object(G.a)(ft,1),wt=ut[0],St=Object(v.useRef)();function ct(Kt){We(Object(Re.a)(Object(Re.a)({},Kt),{},{name:St.current}))}function zt(Kt,Wt){wt.setFieldsValue({src:"/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type),type:Wt.type})}function It(Kt){var Wt=Kt.target.files[0];St.current=Wt.name,he(Wt,zt)}return T.a.createElement(O.a,Object(b.a)({form:wt},ge,{className:"upload-image-panel",onFinish:ct}),T.a.createElement(O.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(O.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},T.a.createElement($.a,{style:Te})),T.a.createElement(te,{onFileChange:It}))),T.a.createElement(O.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},T.a.createElement($.a,{style:{width:264}})),T.a.createElement(O.a.Item,{style:{textAlign:"right"}},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function te(Se){var We=Se.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:We}))}function he(Se,We){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Se),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var ft=new window.XMLHttpRequest;ft.withCredentials=!0,ft.addEventListener("load",function(ut){We(JSON.parse(ut.target.responseText),Se)},!1),ft.addEventListener("error",function(ut){console.error(ut)},!1),ft.open("POST","".concat(Ce.a,"/api/attachments.json")),ft.send(at)}var ae=ie("giR+"),_e=ie("fyUT"),Oe=ie("7Kak"),ye=ie("9yH6"),Pe=ye.a.Group,Me={margin:"0 8px"},Ne=function(Se){var We=Se.callback,at=Se.onCancel;function ft(ut){We(ut)}return T.a.createElement(O.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ft},T.a.createElement("div",{className:"flex-container"},T.a.createElement("span",{style:Me},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:Me},"\u884C\u6570"),T.a.createElement(O.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(_e.a,null)),T.a.createElement("span",{style:Me},"\u5217\u6570"),T.a.createElement(O.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(_e.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12}},T.a.createElement("span",{style:Me},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(O.a.Item,{name:"align"},T.a.createElement(Pe,null,T.a.createElement(ye.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(ye.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(ye.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(ye.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},Fe=ie("ErOA"),Ue=ie("7Cbv"),Be="link",tt="upload-image",et="code-block",Ye="add-table",$e="------------",lt={default:$e,left:":".concat($e),center:":".concat($e,":"),right:"".concat($e,":")},Ze=ie("9VGf"),ot,ke;function nt(){}var Je=0,Ie=1e4,He="\u2581",xe=`
**\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 pe(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var be=navigator.platform.toUpperCase().indexOf("MAC")>=0,re=be?"Cmd":"Ctrl",ne=["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"],se=(ot={},Object(j.a)(ot,re+"-B","bold"),Object(j.a)(ot,re+"-I","italic"),ot),de=(ke={},Object(j.a)(ke,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(ke,et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(ke,tt,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(ke,Ye,"\u6DFB\u52A0\u8868\u683C"),ke),Le=qe.a=function(Se){var We=Se.defaultValue,at=We===void 0?"":We,ft=Se.onChange,ut=Se.width,wt=ut===void 0?"100%":ut,St=Se.height,ct=St===void 0?400:St,zt=Se.miniToolbar,It=zt===void 0?!1:zt,Kt=Se.isFocus,Wt=Kt===void 0?!1:Kt,_t=Se.watch,Wr=Se.insertTemp,ai=Se.mode,vt=ai===void 0?"markdown":ai,Vr=Se.id,nr=Vr===void 0?"markdown-editor-id":Vr,cr=Se.showResizeBar,Hr=cr===void 0?!1:cr,oi=Se.noStorage,si=oi===void 0?!1:oi,Pt=Se.showNullButton,pt=Pt===void 0?!1:Pt,Pr=Se.hidetoolBar,li=Pr===void 0?!1:Pr,xr=Se.fullScreen,Lt=xr===void 0?!1:xr,Mr=Se.onBlur,Xr=Se.onCMBeforeChange,ui=Se.onFullScreen,Ve=Se.className,Tt=Ve===void 0?"":Ve,di=Se.disablePaste,_i=di===void 0?!1:di,hi=Se.placeholder,Li=hi===void 0?"":hi,z=Se.values,s=z===void 0?"":z,g=Object(v.useState)(null),W=Object(G.a)(g,2),X=W[0],H=W[1],ve=Object(v.useState)(at),Ge=Object(G.a)(ve,2),Qe=Ge[0],dt=Ge[1],ze=Object(v.useState)(_t),Et=Object(G.a)(ze,2),Dt=Et[0],Vt=Et[1],Ir=Object(v.useState)(Lt),Nr=Object(G.a)(Ir,2),ar=Nr[0],Gr=Nr[1],Hi=Object(v.useState)(""),Er=Object(G.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(v.useState)(0),Yr=Object(G.a)(gi,2),ci=Yr[0],ei=Yr[1],hn=Object(v.useState)(ct),Gi=Object(G.a)(hn,2),$r=Gi[0],Ur=Gi[1],ki=Object(v.useState)(!1),Di=Object(G.a)(ki,2),cn=Di[0],Zt=Di[1],Nt=Object(v.useRef)(Object(Ue.a)()),fr=Object(v.useRef)(!1),Mt=Object(v.useRef)(),er=Object(v.useRef)(),Ft=Object(v.useRef)(),ti=Object(v.useRef)(),Qt=Object(v.useRef)(),Sr=function(){var mt=Object(P.a)(k.a.mark(function Ct(){var yt,kt;return k.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(Fe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Nt.current}});case 2:kt=Ht.sent,kt!=null&&(yt=kt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",X,er),kt.attachments.map(function(Ot){Ot.content_type.indexOf("image")>-1?X.replaceSelection("![,](/api/attachments/".concat(Ot.id,"?type=").concat(Ot.content_type,")")):Ot.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ot.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):X.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,")"))}));case 4:case"end":return Ht.stop()}},Ct)}));return function(){return mt.apply(this,arguments)}}();Object(v.useEffect)(function(){dt(s),X==null||X.setValue(s)},[s]),Object(v.useEffect)(function(){ui==null||ui(ar)},[ar]),Object(v.useEffect)(function(){if(er.current){var mt=_.a.fromTextArea(er.current,{mode:vt,lineNumbers:!It,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Wt&&mt.focus();function Ct(yt,kt){if(_i){kt.preventDefault();return}var Bt=kt.clipboardData;if(Bt){var Ht=Bt.types.toString(),Ot=Bt.items;if(Ht==="Files"||Bt.types.indexOf("Files")>-1){if(kt.preventDefault(),vt=="stex")return;try{var tr,Tr=Ot[1];((tr=Ot[0])===null||tr===void 0?void 0:tr.kind)==="file"&&(Tr=Ot[0]);var Rt=Tr.getAsFile(),yi=Rt.name.split(".").pop();he(Rt,function(Ut){if(Ut.id){var sr,zr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ne.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})}catch(Ut){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return mt.on("paste",Ct),mt.on("dragleave",function(yt,kt){Ft.current.classList.remove("mouse-hover-md")}),mt.on("dragover",function(yt,kt){Ft.current.classList.add("mouse-hover-md")}),mt.on("drop",function(yt,kt){Ft.current.classList.add("mouse-hover-md");var Bt;if(Bt=kt.dataTransfer.files,Bt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Ht=function(Tr){var Rt=Bt[Tr],yi=Rt.name.split(".").pop();he(Rt,function(Ut){if(Ut.id){var sr,zr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):ne.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}else(Ut==null?void 0:Ut.status)===401&&(document.location.href="/user/login")})},Ot=0;Ot<Bt.length;Ot++)Ht(Ot)}}),H(mt),function(){mt.off("paste",Ct)}}},[]);var zi=Object(v.useCallback)(function(){if(Ft.current)try{}catch(mt){console.log(mt,"---- to set md editor body height")}},[$r,Ft,ar]);Object(v.useEffect)(function(){function mt(){var yt=new w.default(function(kt){var Bt=Object(D.a)(kt),Ht;try{for(Bt.s();!(Ht=Bt.n()).done;){var Ot=Ht.value;(Ot.target.offsetHeight>0||Ot.target.offsetWidth>0)&&(zi(),X.setSize("100%","100%"),X.refresh())}}catch(tr){Bt.e(tr)}finally{Bt.f()}});return yt.observe(er.current.parentElement),yt}if(X){var Ct=mt();return function(){Ct.unobserve(er.current.parentElement)}}},[X,zi]),Object(v.useEffect)(function(){if(X){for(var mt=[],Ct=function(){var Ot=kt[yt];Bt=Object(G.a)(Ot,2);var tr=Bt[0],Tr=Bt[1],Rt=Object(j.a)({},tr,function(){Ki(Tr)});mt.push(Rt),X.addKeyMap(Rt)},yt=0,kt=Object.entries(se);yt<kt.length;yt++){var Bt;Ct()}return Mt.current=setInterval(function(){fr.current&&Sr()},4e3),function(){clearInterval(Mt.current);var Ht=Object(D.a)(mt),Ot;try{for(Ht.s();!(Ot=Ht.n()).done;){var tr=Ot.value;X.removeKeyMap(tr)}}catch(Tr){Ht.e(Tr)}finally{Ht.f()}}}},[X]),Object(v.useEffect)(function(){Lt!==ar&&Gr(Lt)},[Lt]),Object(Ze.a)(function(){if(!si&&ci>0){var mt=new Date().getTime(),Ct=window.sessionStorage.getItem(nr);mt>=ci+Ie&&(!Ct||Ct!==Qe)&&(window.sessionStorage.setItem(nr,Qe),Zt(!0))}},Ie),Object(v.useEffect)(function(){Vt(_t)},[X,_t]),Object(v.useEffect)(function(){X&&(Wt&&X.focus())},[X,Wt]),Object(v.useEffect)(function(){if(Dt&&X){var mt=X.getScrollerElement();function Ct(yt){var kt=yt.target;if(Qt.current){var Bt=kt.scrollTop/kt.scrollHeight;Qt.current.scrollTop=Qt.current.scrollHeight*Bt}}return mt.addEventListener("scroll",Ct),function(){mt.removeEventListener("scroll",Ct)}}},[X,Dt]),Object(v.useEffect)(function(){if(X&&Xr){function mt(Ct,yt){Xr(Ct,yt)}return X.on("beforeChange",mt),function(){X.off("beforeChange",mt)}}},[X,Xr]),Object(v.useEffect)(function(){if(X&&Mr){function mt(){Mr(X.getValue())}return X.on("blur",mt),function(){X.off("blur",mt)}}},[X,Mr]),Object(v.useEffect)(function(){if(X){function mt(Ct){var yt=Ct.getValue();dt(yt),ei(new Date().getTime()),Ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ft&&ft(yt)}return X.on("change",mt),function(){X.off("change",mt)}}},[X,ft]),Object(v.useEffect)(function(){X&&(at==null?(X.setValue(""),dt("")):at!==X.getValue()&&(X.setValue(at),dt(at),X.setCursor(X.lineCount(),0)))},[X,at]);var Ki=Object(v.useCallback)(function(mt){var Ct=X.getCursor(),yt=X.getSelection(),kt=yt.split(`
`);switch(mt){case"bold":return X.replaceSelection("**"+yt+"**"),yt===""&&X.setCursor(Ct.line,Ct.ch+2),X.focus();case"italic":return X.replaceSelection("*"+yt+"*"),yt===""&&X.setCursor(Ct.line,Ct.ch+1),X.focus();case"code":return X.replaceSelection("`"+yt+"`"),yt===""&&X.setCursor(Ct.line,Ct.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+yt+"$$`"),yt===""&&X.setCursor(Ct.line,Ct.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+yt+"\n```"),X.setCursor(Ct.line+1,yt.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
`),X.focus();case"list-ul":return yt===""?X.replaceSelection("- "+yt):X.replaceSelection(kt.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(`
`)),X.focus();case"list-ol":return yt===""?X.replaceSelection("1. "+yt):X.replaceSelection(kt.map(function(Bt,Ht){return Bt===""?"":"".concat(Ht+1,". ").concat(Bt)}).join(`
`)),X.focus();case"add-null-ch":return yt===""&&X.setCursor(Ct.line,Ct.ch+1),X.replaceSelection(He),X.focus();case"inster-template-1":return yt===""&&X.setCursor(Ct.line,Ct.ch),X.replaceSelection(xe),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return Vt(!Dt),X.focus();case"trigger-full-screen":return Gr(!ar),X.focus();case Be:kr(Be);return;case et:kr(et);return;case tt:kr(tt);return;case Ye:kr(Ye);return;default:throw new Error}},[X,Dt,ar]),vi=Object(v.useCallback)(function(mt){kr("");switch(Br){case Be:var Ct=mt.title,yt=mt.link;return X.replaceSelection("[".concat(Ct,"](").concat(yt,")")),X.focus();case et:var kt=mt.language,Bt=mt.content;return X.replaceSelection(["```"+kt,Bt,"```"].join(`
`)),X.focus();case tt:var Ht=mt.src,Ot=mt.alt,tr=mt.name;return Ht.indexOf("type=image")>-1?X.replaceSelection("![ ".concat(Ot||""," ]( ").concat(Ht,' "').concat(Ot||"",'" )')):Ht.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(tr,"</a>")):X.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(tr,"</a>")),X.focus();case Ye:for(var Tr=mt.row,Rt=mt.col,yi=mt.align,Ut=`
`,sr=0;sr<Tr;sr++){for(var zr=[],Kr=[],Wn=0;Wn<Rt;Wn++)sr===1&&Kr.push(lt[yi]),zr.push(" ");sr===1&&(Ut+="| ".concat(Kr.join(" | "),` |
`)),Ut+="| ".concat(zr.join(Rt===1?"":" | "),` |
`)}return X.replaceSelection(Ut+`
`),X.focus();default:throw new Error}},[X,Br]),Fn=Object(v.useMemo)(function(){switch(Br){case Be:return T.a.createElement(oe,{callback:vi,onCancel:Dr});case et:return T.a.createElement(fe.b,{callback:vi,onCancel:Dr});case tt:return T.a.createElement(ue,{callback:vi,onCancel:Dr});case Ye:return T.a.createElement(Ne,{callback:vi,onCancel:Dr});default:return null}},[Br]);function Dr(){kr("")}Object(v.useEffect)(function(){if(ti.current){var mt=ti.current,Ct=!1,yt=0;function kt(Ot){Ct=!0,yt=Ot.pageY}function Bt(){Ct=!1}function Ht(Ot){if(Ct){var tr=Ot.pageY-yt;tr<0&&(tr=0),tr>300&&(tr=300);var Tr=ct+tr+"px";Ur(Tr)}}return mt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Bt),function(){mt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Bt)}}},[X,ti]),Object(v.useEffect)(function(){Ur(ct)},[ct]);var fn=pe(wt),Zr=pe($r),Vi={width:fn,height:Zr},jn=Object(v.useMemo)(function(){if(ci){var mt=new Date(ci),Ct=mt.getHours(),yt=mt.getMinutes(),kt=mt.getSeconds();return Ct=Ct<10?"0"+Ct:Ct,yt=yt<10?"0"+yt:yt,kt=kt<10?"0"+kt:kt,"".concat(Ct,":").concat(yt,":").concat(kt)}return 0},[ci]);function Ri(){window.sessionStorage.removeItem(nr),Zt(!1),ei(0)}function $a(){Zt(!1),ei(0),X.setValue(window.sessionStorage.getItem(nr))}function da(mt,Ct){var yt=X.getValue();yt=yt.replace(mt,Ct),dt(yt),X==null||X.setValue(yt)}return T.a.createElement(v.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ft},T.a.createElement("div",{className:"markdown-editor-container ".concat(Tt," ").concat(Dt?"on-preview":""," ").concat(It?"mini":""," ").concat(ar?"full-screen":""),style:Vi},T.a.createElement(E,{insertTemp:Wr,watch:Dt,fullScreen:ar,showNullButton:pt,onActionCallback:Ki,hidetoolBar:li,uuid:Nt.current,setOpenPhones:function(){fr.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:er,placeholder:Li})),Dt?T.a.createElement("div",{ref:Qt,className:"preview-container"},vt==="stex"&&T.a.createElement(L,{value:Qe}),vt!=="stex"&&T.a.createElement(f.a,{edit:!0,value:Qe,replaces:da})):null))),Hr?T.a.createElement("a",{ref:ti,className:"editor-resize"}):null,T.a.createElement(N.a,null,de[Br]?T.a.createElement(Q.a,{centered:!0,title:de[Br],visible:!0,onCancel:Dr,footer:null},Fn):null))}},SJMd:function(bt,qe){/**
* @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 ie,le,Q,D=!1,Z,B;window.PR_SHOULD_USE_CONTINUATION=!0;var P,G;(function(){var j=window,I=["break,continue,do,else,for,if,return,while"],k=[I,"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"],v=[k,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[v,"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"],R=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[v,"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"],w="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",S=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[I,"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"],l=[I,"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"],u=[I,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],A=[T,_,R,S,h,o,l,u],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",L="kwd",b="com",m="typ",c="lit",d="pun",a="pln",x="tag",y="dec",E="src",N="atn",U="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(ye){for(var Pe=0,Me=!1,Ne=!1,Fe=0,Ue=ye.length;Fe<Ue;++Fe){var Be=ye[Fe];if(Be.ignoreCase)Ne=!0;else if(/[a-z]/i.test(Be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,Ne=!1;break}}var tt={b:8,t:9,n:10,v:11,f:12,r:13};function et(ot){var ke=ot.charCodeAt(0);if(ke!==92)return ke;var nt=ot.charAt(1);return ke=tt[nt],ke||("0"<=nt&&nt<="7"?parseInt(ot.substring(1),8):nt==="u"||nt==="x"?parseInt(ot.substring(2),16):ot.charCodeAt(1))}function Ye(ot){if(ot<32)return(ot<16?"\\x0":"\\x")+ot.toString(16);var ke=String.fromCharCode(ot);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function $e(ot){var ke=ot.substring(1,ot.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")),nt=[],Je=ke[0]==="^",Ie=["["];Je&&Ie.push("^");for(var He=Je?1:0,xe=ke.length;He<xe;++He){var pe=ke[He];if(/\\[bdsw]/i.test(pe))Ie.push(pe);else{var be=et(pe),re;He+2<xe&&ke[He+1]==="-"?(re=et(ke[He+2]),He+=2):re=be,nt.push([be,re]),re<65||be>122||(re<65||be>90||nt.push([Math.max(65,be)|32,Math.min(re,90)|32]),re<97||be>122||nt.push([Math.max(97,be)&~32,Math.min(re,122)&~32]))}}nt.sort(function(Le,Se){return Le[0]-Se[0]||Se[1]-Le[1]});for(var ne=[],se=[],He=0;He<nt.length;++He){var de=nt[He];de[0]<=se[1]+1?se[1]=Math.max(se[1],de[1]):ne.push(se=de)}for(var He=0;He<ne.length;++He){var de=ne[He];Ie.push(Ye(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Ie.push("-"),Ie.push(Ye(de[1])))}return Ie.push("]"),Ie.join("")}function lt(ot){for(var ke=ot.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")),nt=ke.length,Je=[],Ie=0,He=0;Ie<nt;++Ie){var xe=ke[Ie];if(xe==="(")++He;else if(xe.charAt(0)==="\\"){var pe=+xe.substring(1);pe&&(pe<=He?Je[pe]=-1:ke[Ie]=Ye(pe))}}for(var Ie=1;Ie<Je.length;++Ie)Je[Ie]===-1&&(Je[Ie]=++Pe);for(var Ie=0,He=0;Ie<nt;++Ie){var xe=ke[Ie];if(xe==="(")++He,Je[He]||(ke[Ie]="(?:");else if(xe.charAt(0)==="\\"){var pe=+xe.substring(1);pe&&pe<=He&&(ke[Ie]="\\"+Je[pe])}}for(var Ie=0;Ie<nt;++Ie)ke[Ie]==="^"&&ke[Ie+1]!=="^"&&(ke[Ie]="");if(ot.ignoreCase&&Me)for(var Ie=0;Ie<nt;++Ie){var xe=ke[Ie],be=xe.charAt(0);xe.length>=2&&be==="["?ke[Ie]=$e(xe):be!=="\\"&&(ke[Ie]=xe.replace(/[a-zA-Z]/g,function(se){var de=se.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return ke.join("")}for(var Ze=[],Fe=0,Ue=ye.length;Fe<Ue;++Fe){var Be=ye[Fe];if(Be.global||Be.multiline)throw new Error(""+Be);Ze.push("(?:"+lt(Be)+")")}return new RegExp(Ze.join("|"),Ne?"gi":"g")}function M(ye,Pe){var Me=/(?:^|\s)nocode(?:\s|$)/,Ne=[],Fe=0,Ue=[],Be=0;function tt(et){var Ye=et.nodeType;if(Ye==1){if(Me.test(et.className))return;for(var $e=et.firstChild;$e;$e=$e.nextSibling)tt($e);var lt=et.nodeName.toLowerCase();(lt==="br"||lt==="li")&&(Ne[Be]=`
`,Ue[Be<<1]=Fe++,Ue[Be++<<1|1]=et)}else if(Ye==3||Ye==4){var Ze=et.nodeValue;Ze.length&&(Pe?Ze=Ze.replace(/\r\n?/g,`
`):Ze=Ze.replace(/[ \t\r\n]+/g," "),Ne[Be]=Ze,Ue[Be<<1]=Fe,Fe+=Ze.length,Ue[Be++<<1|1]=et)}}return tt(ye),{sourceCode:Ne.join("").replace(/\n$/,""),spans:Ue}}function $(ye,Pe,Me,Ne,Fe){if(!Me)return;var Ue={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:Pe,decorations:null};Ne(Ue),Fe.push.apply(Fe,Ue.decorations)}var ee=/\S/;function oe(ye){for(var Pe=void 0,Me=ye.firstChild;Me;Me=Me.nextSibling){var Ne=Me.nodeType;Pe=Ne===1?Pe?ye:Me:Ne===3&&ee.test(Me.nodeValue)?ye:Pe}return Pe===ye?void 0:Pe}function fe(ye,Pe){var Me={},Ne;(function(){for(var Be=ye.concat(Pe),tt=[],et={},Ye=0,$e=Be.length;Ye<$e;++Ye){var lt=Be[Ye],Ze=lt[3];if(Ze)for(var ot=Ze.length;--ot>=0;)Me[Ze.charAt(ot)]=lt;var ke=lt[1],nt=""+ke;et.hasOwnProperty(nt)||(tt.push(ke),et[nt]=null)}tt.push(/[\0-\uffff]/),Ne=O(tt)})();var Fe=Pe.length,Ue=function(Be){for(var tt=Be.sourceCode,et=Be.basePos,Ye=Be.sourceNode,$e=[et,a],lt=0,Ze=tt.match(Ne)||[],ot={},ke=0,nt=Ze.length;ke<nt;++ke){var Je=Ze[ke],Ie=ot[Je],He=void 0,xe;if(typeof Ie=="string")xe=!1;else{var pe=Me[Je.charAt(0)];if(pe)He=Je.match(pe[1]),Ie=pe[0];else{for(var be=0;be<Fe;++be)if(pe=Pe[be],He=Je.match(pe[1]),He){Ie=pe[0];break}He||(Ie=a)}xe=Ie.length>=5&&Ie.substring(0,5)==="lang-",xe&&!(He&&typeof He[1]=="string")&&(xe=!1,Ie=E),xe||(ot[Je]=Ie)}var re=lt;if(lt+=Je.length,!xe)$e.push(et+re,Ie);else{var ne=He[1],se=Je.indexOf(ne),de=se+ne.length;He[2]&&(de=Je.length-He[2].length,se=de-ne.length);var Le=Ie.substring(5);$(Ye,et+re,Je.substring(0,se),Ue,$e),$(Ye,et+re+se,ne,ue(Le,ne),$e),$(Ye,et+re+de,Je.substring(de),Ue,$e)}}Be.decorations=$e};return Ue}function Re(ye){var Pe=[],Me=[];ye.tripleQuotedStrings?Pe.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?Pe.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Pe.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Me.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ne=ye.hashComments;Ne&&(ye.cStyleComments?(Ne>1?Pe.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Pe.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([b,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Me.push([b,/^\/\/[^\r\n]*/,null]),Me.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=ye.regexLiterals;if(Fe){var Ue=Fe>1?"":`
\r`,Be=Ue?".":"[\\S\\s]",tt="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+V+"("+tt+")")])}var et=ye.types;et&&Me.push([m,et]);var Ye=(""+ye.keywords).replace(/^ | $/g,"");Ye.length&&Me.push([L,new RegExp("^(?:"+Ye.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([a,/^\s+/,null,` \r
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&($e+="(?!s*/)"),Me.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp($e),null]),fe(Pe,Me)}var Ee=Re({keywords:A,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(ye,Pe,Me){for(var Ne=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ue=ye.ownerDocument,Be=Ue.createElement("li");ye.firstChild;)Be.appendChild(ye.firstChild);var tt=[Be];function et(ke){var nt=ke.nodeType;if(nt==1&&!Ne.test(ke.className))if(ke.nodeName==="br")Ye(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var Je=ke.firstChild;Je;Je=Je.nextSibling)et(Je);else if((nt==3||nt==4)&&Me){var Ie=ke.nodeValue,He=Ie.match(Fe);if(He){var xe=Ie.substring(0,He.index);ke.nodeValue=xe;var pe=Ie.substring(He.index+He[0].length);if(pe){var be=ke.parentNode;be.insertBefore(Ue.createTextNode(pe),ke.nextSibling)}Ye(ke),xe||ke.parentNode.removeChild(ke)}}}function Ye(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function nt(He,xe){var pe=xe?He.cloneNode(!1):He,be=He.parentNode;if(be){var re=nt(be,1),ne=He.nextSibling;re.appendChild(pe);for(var se=ne;se;se=ne)ne=se.nextSibling,re.appendChild(se)}return pe}for(var Je=nt(ke.nextSibling,0),Ie;(Ie=Je.parentNode)&&Ie.nodeType===1;)Je=Ie;tt.push(Je)}for(var $e=0;$e<tt.length;++$e)et(tt[$e]);Pe===(Pe|0)&&tt[0].setAttribute("value",Pe);var lt=Ue.createElement("ol");lt.className="linenums";for(var Ze=Math.max(0,Pe-1|0)||0,$e=0,ot=tt.length;$e<ot;++$e)Be=tt[$e],Be.className="L"+($e+Ze)%10,Be.firstChild||Be.appendChild(Ue.createTextNode("\xA0")),lt.appendChild(Be);ye.appendChild(lt)}function we(ye){var Pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Pe=Pe&&+Pe[1]<=8;var Me=/\n/g,Ne=ye.sourceCode,Fe=Ne.length,Ue=0,Be=ye.spans,tt=Be.length,et=0,Ye=ye.decorations,$e=Ye.length,lt=0;Ye[$e]=Fe;var Ze,ot;for(ot=Ze=0;ot<$e;)Ye[ot]!==Ye[ot+2]?(Ye[Ze++]=Ye[ot++],Ye[Ze++]=Ye[ot++]):ot+=2;for($e=Ze,ot=Ze=0;ot<$e;){for(var ke=Ye[ot],nt=Ye[ot+1],Je=ot+2;Je+2<=$e&&Ye[Je+1]===nt;)Je+=2;Ye[Ze++]=ke,Ye[Ze++]=nt,ot=Je}$e=Ye.length=Ze;var Ie=ye.sourceNode,He="";Ie&&(He=Ie.style.display,Ie.style.display="none");try{for(var xe=null;et<tt;){var pe=Be[et],be=Be[et+2]||Fe,re=Ye[lt+2]||Fe,Je=Math.min(be,re),ne=Be[et+1],se;if(ne.nodeType!==1&&(se=Ne.substring(Ue,Je))){Pe&&(se=se.replace(Me,"\r")),ne.nodeValue=se;var de=ne.ownerDocument,Le=de.createElement("span");Le.className=Ye[lt+1];var Se=ne.parentNode;Se.replaceChild(Le,ne),Le.appendChild(ne),Ue<be&&(Be[et+1]=ne=de.createTextNode(Ne.substring(Je,be)),Se.insertBefore(ne,Le.nextSibling))}Ue=Je,Ue>=be&&(et+=2),Ue>=re&&(lt+=2)}}finally{Ie&&(Ie.style.display=He)}}var Te={};function ge(ye,Pe){for(var Me=Pe.length;--Me>=0;){var Ne=Pe[Me];Te.hasOwnProperty(Ne)?j.console&&console.warn("cannot override language handler %s",Ne):Te[Ne]=ye}}function ue(ye,Pe){return ye&&Te.hasOwnProperty(ye)||(ye=/^\s*</.test(Pe)?"default-markup":"default-code"),Te[ye]}ge(Ee,["default-code"]),ge(fe([],[[a,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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"]),ge(fe([[a,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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"]),ge(fe([],[[U,/^[\s\S]+/]]),["uq.val"]),ge(Re({keywords:T,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ge(Re({keywords:"null,true,false"}),["json"]),ge(Re({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ge(Re({keywords:R,cStyleComments:!0}),["java"]),ge(Re({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(Re({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(Re({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(Re({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(Re({keywords:S,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(Re({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(fe([],[[f,/^[\s\S]+/]]),["regex"]);function te(ye){var Pe=ye.langExtension;try{var Me=M(ye.sourceNode,ye.pre),Ne=Me.sourceCode;ye.sourceCode=Ne,ye.spans=Me.spans,ye.basePos=0,ue(Pe,Ne)(ye),we(ye)}catch(Fe){j.console&&console.log(Fe&&Fe.stack||Fe)}}function he(ye,Pe,Me){var Ne=Me||!1,Fe=Pe||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+ye+"</pre>",Ue=Ue.firstChild,Ne&&Ce(Ue,Ne,!0);var Be={langExtension:Fe,numberLines:Ne,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Be),Ue.innerHTML}function ae(ye,Pe){var Me=Pe||document.body,Ne=Me.ownerDocument||document;function Fe(pe){return Me.getElementsByTagName(pe)}for(var Ue=[Fe("pre"),Fe("code"),Fe("xmp")],Be=[],tt=0;tt<Ue.length;++tt)for(var et=0,Ye=Ue[tt].length;et<Ye;++et)Be.push(Ue[tt][et]);Ue=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var lt=0,Ze=/\blang(?:uage)?-([\w.]+)(?!\S)/,ot=/\bprettyprint\b/,ke=/\bprettyprinted\b/,nt=/pre|xmp/i,Je=/^code$/i,Ie=/^(?:pre|code|xmp)$/i,He={};function xe(){for(var pe=j.PR_SHOULD_USE_CONTINUATION?$e.now()+250:Infinity;lt<Be.length&&$e.now()<pe;lt++){for(var be=Be[lt],re=He,ne=be;ne=ne.previousSibling;){var se=ne.nodeType,de=(se===7||se===8)&&ne.nodeValue;if(de?!/^\??prettify\b/.test(de):se!==3||/\S/.test(ne.nodeValue))break;if(de){re={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,_t,Wr){re[_t]=Wr});break}}var Le=be.className;if((re!==He||ot.test(Le))&&!ke.test(Le)){for(var Se=!1,We=be.parentNode;We;We=We.parentNode){var at=We.tagName;if(Ie.test(at)&&We.className&&ot.test(We.className)){Se=!0;break}}if(!Se){be.className+=" prettyprinted";var ft=re.lang;if(!ft){ft=Le.match(Ze);var ut;!ft&&(ut=oe(be))&&Je.test(ut.tagName)&&(ft=ut.className.match(Ze)),ft&&(ft=ft[1])}var wt;if(nt.test(be.tagName))wt=1;else{var St=be.currentStyle,ct=Ne.defaultView,zt=St?St.whiteSpace:ct&&ct.getComputedStyle?ct.getComputedStyle(be,null).getPropertyValue("white-space"):0;wt=zt&&zt.substring(0,3)==="pre"}var It=re.linenums;(It=It==="true"||+It)||(It=Le.match(/\blinenums\b(?::(\d+))?/),It=It?It[1]&&It[1].length?+It[1]:!0:!1),It&&Ce(be,It,wt);var Kt={langExtension:ft,sourceNode:be,numberLines:It,pre:wt,sourceCode:null,basePos:null,spans:null,decorations:null};te(Kt)}}}lt<Be.length?j.setTimeout(xe,250):typeof ye=="function"&&ye()}xe()}var _e=j.PR={createSimpleLexer:fe,registerLangHandler:ge,sourceDecorator:Re,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:U,PR_COMMENT:b,PR_DECLARATION:y,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:E,PR_STRING:f,PR_TAG:x,PR_TYPE:m,prettyPrintOne:D?j.prettyPrintOne=he:P=he,prettyPrint:G=D?j.prettyPrint=ae:G=ae},Oe=j.define;typeof Oe=="function"&&Oe.amd&&Oe("google-code-prettify",[],function(){return _e})})()},"VrN/":function(bt,qe,ie){(function(le,Q){bt.exports=Q()})(this,function(){"use strict";var le=navigator.userAgent,Q=navigator.platform,D=/gecko\/\d/i.test(le),Z=/MSIE \d/.test(le),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),P=/Edge\/(\d+)/.exec(le),G=Z||B||P,j=G&&(Z?document.documentMode||6:+(P||B)[1]),I=!P&&/WebKit\//.test(le),k=I&&/Qt\/\d+\.\d+/.test(le),v=!P&&/Chrome\//.test(le),T=/Opera\//.test(le),R=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),w=/PhantomJS/.test(le),S=!P&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),h=/Android/.test(le),o=S||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),l=S||/Mac/.test(Q),u=/\bCrOS\b/.test(le),A=/win/i.test(Q),p=T&&le.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(T=!1,I=!0);var f=l&&(k||T&&(p==null||p<12.11)),L=D||G&&j>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=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 d(e,t){return c(e).appendChild(t)}function a(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 C=0;C<t.length;++C)n.appendChild(t[C]);return n}function x(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var y;document.createRange?y=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:y=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 E(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 N(){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 K(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 V=function(e){e.select()};S?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(V=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function M(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 $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var C=r||0,F=n||0;;){var Y=e.indexOf(" ",C);if(Y<0||Y>=t)return F+(t-C);F+=Y-C,F+=i-F%i,C=Y+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.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 oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var fe=50,Re={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},Ce={origin:"*mouse"},we={origin:"+move"};function Te(e,t,i){for(var r=0,n=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var F=C-r;if(C==e.length||n+F>=t)return r+Math.min(F,t-n);if(n+=C-r,n+=i-n%i,r=C+1,n>=t)return r}}var ge=[""];function ue(e){for(;ge.length<=e;)ge.push(te(ge)+" ");return ge[e]}function te(e){return e[e.length-1]}function he(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 Oe(e,t){var i;return Object.create?i=Object.create(e):(_e.prototype=e,i=new _e),t&&M(t,i),i}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Pe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&Pe(e)?!0:t.test(e):Pe(e)}function Ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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 Ue(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Be(e,t,i){for(;(i<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=i;return t}function tt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,C=r<0?Math.ceil(n):Math.floor(n);if(C==t)return e(C)?t:i;e(C)?i=C:t=C+r}}function et(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,C=0;C<e.length;++C){var F=e[C];(F.from<i&&F.to>t||t==i&&F.to==t)&&(r(Math.max(F.from,t),Math.min(F.to,i),F.level==1?"rtl":"ltr",C),n=!0)}n||r(t,i,"ltr")}var Ye=null;function $e(e,t,i){var r;Ye=null;for(var n=0;n<e.length;++n){var C=e[n];if(C.from<t&&C.to>t)return n;C.to==t&&(C.from!=C.to&&i=="before"?r=n:Ye=n),C.from==t&&(C.from!=C.to&&i!="before"?r=n:Ye=n)}return r!=null?r:Ye}var lt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,C=/[LRr]/,F=/[Lb1n]/,Y=/[1n]/;function J(q,ce,me){this.level=q,this.from=ce,this.to=me}return function(q,ce){var me=ce=="ltr"?"L":"R";if(q.length==0||ce=="ltr"&&!r.test(q))return!1;for(var De=q.length,Ae=[],je=0;je<De;++je)Ae.push(i(q.charCodeAt(je)));for(var Ke=0,Xe=me;Ke<De;++Ke){var rt=Ae[Ke];rt=="m"?Ae[Ke]=Xe:Xe=rt}for(var st=0,it=me;st<De;++st){var ht=Ae[st];ht=="1"&&it=="r"?Ae[st]="n":C.test(ht)&&(it=ht,ht=="r"&&(Ae[st]="R"))}for(var xt=1,gt=Ae[0];xt<De-1;++xt){var At=Ae[xt];At=="+"&&gt=="1"&&Ae[xt+1]=="1"?Ae[xt]="1":At==","&&gt==Ae[xt+1]&&(gt=="1"||gt=="n")&&(Ae[xt]=gt),gt=At}for(var Xt=0;Xt<De;++Xt){var dr=Ae[Xt];if(dr==",")Ae[Xt]="N";else if(dr=="%"){var $t=void 0;for($t=Xt+1;$t<De&&Ae[$t]=="%";++$t);for(var Or=Xt&&Ae[Xt-1]=="!"||$t<De&&Ae[$t]=="1"?"1":"N",Ar=Xt;Ar<$t;++Ar)Ae[Ar]=Or;Xt=$t-1}}for(var rr=0,_r=me;rr<De;++rr){var mr=Ae[rr];_r=="L"&&mr=="1"?Ae[rr]="L":C.test(mr)&&(_r=mr)}for(var or=0;or<De;++or)if(n.test(Ae[or])){var ir=void 0;for(ir=or+1;ir<De&&n.test(Ae[ir]);++ir);for(var Jt=(or?Ae[or-1]:me)=="L",Lr=(ir<De?Ae[ir]:me)=="L",un=Jt==Lr?Jt?"L":"R":me,Ai=or;Ai<ir;++Ai)Ae[Ai]=un;or=ir-1}for(var vr=[],ni,hr=0;hr<De;)if(F.test(Ae[hr])){var Xa=hr;for(++hr;hr<De&&F.test(Ae[hr]);++hr);vr.push(new J(0,Xa,hr))}else{var mi=hr,ji=vr.length,Wi=ce=="rtl"?1:0;for(++hr;hr<De&&Ae[hr]!="L";++hr);for(var br=mi;br<hr;)if(Y.test(Ae[br])){mi<br&&(vr.splice(ji,0,new J(1,mi,br)),ji+=Wi);var dn=br;for(++br;br<hr&&Y.test(Ae[br]);++br);vr.splice(ji,0,new J(2,dn,br)),ji+=Wi,mi=br}else++br;mi<hr&&vr.splice(ji,0,new J(1,mi,hr))}return ce=="ltr"&&(vr[0].level==1&&(ni=q.match(/^\s+/))&&(vr[0].from=ni[0].length,vr.unshift(new J(0,0,ni[0].length))),te(vr).level==1&&(ni=q.match(/\s+$/))&&(te(vr).to-=ni[0].length,vr.push(new J(0,De-ni[0].length,De)))),ce=="rtl"?vr.reverse():vr}}();function Ze(e,t){var i=e.order;return i==null&&(i=e.order=lt(e.text,t)),i}var ot=[],ke=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]||ot).concat(i)}};function nt(e,t){return e._handlers&&e._handlers[t]||ot}function Je(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 C=oe(n,i);C>-1&&(r[t]=n.slice(0,C).concat(n.slice(C+1)))}}}function Ie(e,t){var i=nt(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 He(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ie(e,i||t.type,e,t),se(t)||t.codemirrorIgnore}function xe(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)oe(i,t[r])==-1&&i.push(t[r])}function pe(e,t){return nt(e,t).length>0}function be(e){e.prototype.on=function(t,i){ke(this,t,i)},e.prototype.off=function(t,i){Je(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){re(e),ne(e)}function Le(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(G&&j<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),at;function ft(e){if(at==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(at=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&j<8))}var i=at?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ut;function wt(e){if(ut!=null)return ut;var t=d(e,document.createTextNode("A\u062EA")),i=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:ut=r.right-i.right<3}var St=`
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 C=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),F=C.indexOf("\r");F!=-1?(i.push(C.slice(0,F)),t+=F+1):(i.push(C),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},ct=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},zt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),It=null;function Kt(e){if(It!=null)return It;var t=d(e,a("span","x")),i=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return It=Math.abs(i.left-r.left)>1}var Wt={},_t={};function Wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function ai(e,t){_t[e]=t}function vt(e){if(typeof e=="string"&&_t.hasOwnProperty(e))e=_t[e];else if(e&&typeof e.name=="string"&&_t.hasOwnProperty(e.name)){var t=_t[e.name];typeof t=="string"&&(t={name:t}),e=Oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Vr(e,t){t=vt(t);var i=Wt[t.name];if(!i)return Vr(e,"text/plain");var r=i(e,t);if(nr.hasOwnProperty(t.name)){var n=nr[t.name];for(var C in n){if(!n.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=n[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)r[F]=t.modeProps[F];return r}var nr={};function cr(e,t){var i=nr.hasOwnProperty(e)?nr[e]:nr[e]={};M(t,i)}function Hr(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 oi(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 si(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=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};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.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},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(F){return i?F.toLowerCase():F},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(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],C=n.chunkSize();if(t<C){i=n;break}t-=C}return i.lines[t]}function Pr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(C){var F=C.text;n==i.line&&(F=F.slice(0,i.ch)),n==t.line&&(F=F.slice(t.ch)),r.push(F),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function xr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Lt(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(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 Mr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],C=n.height;if(t<C){e=n;continue e}t-=C,i+=n.chunkSize()}return i}while(!e.lines);for(var F=0;F<e.lines.length;++F){var Y=e.lines[F],J=Y.height;if(t<J)break;t-=J}return i+F}function Xr(e,t){return t>=e.first&&t<e.first+e.size}function ui(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ve))return new Ve(e,t,i);this.line=e,this.ch=t,this.sticky=i}function Tt(e,t){return e.line-t.line||e.ch-t.ch}function di(e,t){return e.sticky==t.sticky&&Tt(e,t)==0}function _i(e){return Ve(e.line,e.ch)}function hi(e,t){return Tt(e,t)<0?t:e}function Li(e,t){return Tt(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Ve(e.first,0);var i=e.first+e.size-1;return t.line>i?Ve(i,pt(e,i).text.length):g(t,pt(e,t.line).text.length)}function g(e,t){var i=e.ch;return i==null||i>t?Ve(e.line,t):i<0?Ve(e.line,0):e}function W(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var X=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.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}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,i){return t instanceof X?new H(e,Hr(e.mode,t.state),i,t.lookAhead):new H(e,Hr(e.mode,t),i)},H.prototype.save=function(e){var t=e!==!1?Hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],C={};Nr(e,t.text,e.doc.mode,i,function(q,ce){return n.push(q,ce)},C,r);for(var F=i.state,Y=function(q){i.baseTokens=n;var ce=e.state.overlays[q],me=1,De=0;i.state=!0,Nr(e,t.text,ce.mode,i,function(Ae,je){for(var Ke=me;De<Ae;){var Xe=n[me];Xe>Ae&&n.splice(me,1,Ae,n[me+1],Xe),me+=2,De=Math.min(Ae,Xe)}if(!je)return;if(ce.opaque)n.splice(Ke,me-Ke,Ae,"overlay "+je),me=Ke+2;else for(;Ke<me;Ke+=2){var rt=n[Ke+1];n[Ke+1]=(rt?rt+" ":"")+"overlay "+je}},C),i.state=F,i.baseTokens=null,i.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)Y(J);return{styles:n,classes:C.bgClass||C.textClass?C:null}}function Ge(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Qe(e,Lt(t)),n=t.text.length>e.options.maxHighlightLength&&Hr(e.doc.mode,r.state),C=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=C.styles,C.classes?t.styleClasses=C.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 Qe(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new H(r,!0,t);var C=ar(e,t,i),F=C>r.first&&pt(r,C-1).stateAfter,Y=F?H.fromSaved(r,F,C):new H(r,si(r.mode),C);return r.iter(C,t,function(J){dt(e,J.text,Y);var q=Y.line;J.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function dt(e,t,i,r){var n=e.doc.mode,C=new Pt(t,e.options.tabSize,i);for(C.start=C.pos=r||0,t==""&&ze(n,i.state);!C.eol();)Et(n,C,i.state),C.start=C.pos}function ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=oi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Et(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=oi(e,i).mode);var C=e.token(t,i);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var Dt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vt(e,t,i,r){var n=e.doc,C=n.mode,F;t=s(n,t);var Y=pt(n,t.line),J=Qe(e,t.line,i),q=new Pt(Y.text,e.options.tabSize,J),ce;for(r&&(ce=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,F=Et(C,q,J.state),r&&ce.push(new Dt(q,F,Hr(n.mode,J.state)));return r?ce:new Dt(q,F,J.state)}function Ir(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 Nr(e,t,i,r,n,C,F){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var J=0,q=null,ce=new Pt(t,e.options.tabSize,r),me,De=e.options.addModeClass&&[null];for(t==""&&Ir(ze(i,r.state),C);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Y=!1,F&&dt(e,t,r,ce.pos),ce.pos=t.length,me=null):me=Ir(Et(i,ce,r.state,De),C),De){var Ae=De[0].name;Ae&&(me="m-"+(me?Ae+" "+me:Ae))}if(!Y||q!=me){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),n(J,q);q=me}ce.start=ce.pos}for(;J<ce.pos;){var je=Math.min(ce.pos,J+5e3);n(je,q),J=je}}function ar(e,t,i){for(var r,n,C=e.doc,F=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>F;--Y){if(Y<=C.first)return C.first;var J=pt(C,Y-1),q=J.stateAfter;if(q&&(!i||Y+(q instanceof X?q.lookAhead:0)<=C.modeFrontier))return Y;var ce=$(J.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Y-1,r=ce)}return n}function Gr(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=pt(e,r).stateAfter;if(n&&(!(n instanceof X)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Hi=!1,Er=!1;function Br(){Hi=!0}function kr(){Er=!0}function gi(e,t,i){this.marker=e,this.from=t,this.to=i}function Yr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ci(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ei(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function hn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var C=e[n],F=C.marker,Y=C.from==null||(F.inclusiveLeft?C.from<=t:C.from<t);if(Y||C.from==t&&F.type=="bookmark"&&(!i||!C.marker.insertLeft)){var J=C.to==null||(F.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new gi(F,C.from,J?null:C.to))}}return r}function Gi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var C=e[n],F=C.marker,Y=C.to==null||(F.inclusiveRight?C.to>=t:C.to>t);if(Y||C.from==t&&F.type=="bookmark"&&(!i||C.marker.insertLeft)){var J=C.from==null||(F.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new gi(F,J?null:C.from-t,C.to==null?null:C.to-t))}}return r}function $r(e,t){if(t.full)return null;var i=Xr(e,t.from.line)&&pt(e,t.from.line).markedSpans,r=Xr(e,t.to.line)&&pt(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,C=t.to.ch,F=Tt(t.from,t.to)==0,Y=hn(i,n,F),J=Gi(r,C,F),q=t.text.length==1,ce=te(t.text).length+(q?n:0);if(Y)for(var me=0;me<Y.length;++me){var De=Y[me];if(De.to==null){var Ae=Yr(J,De.marker);Ae?q&&(De.to=Ae.to==null?null:Ae.to+ce):De.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 Xe=Yr(Y,Ke.marker);Xe||(Ke.from=ce,q&&(Y||(Y=[])).push(Ke))}else Ke.from+=ce,q&&(Y||(Y=[])).push(Ke)}Y&&(Y=Ur(Y)),J&&J!=Y&&(J=Ur(J));var rt=[Y];if(!q){var st=t.text.length-2,it;if(st>0&&Y)for(var ht=0;ht<Y.length;++ht)Y[ht].to==null&&(it||(it=[])).push(new gi(Y[ht].marker,null,null));for(var xt=0;xt<st;++xt)rt.push(it);rt.push(J)}return rt}function Ur(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 ki(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ae){if(Ae.markedSpans)for(var je=0;je<Ae.markedSpans.length;++je){var Ke=Ae.markedSpans[je].marker;Ke.readOnly&&(!r||oe(r,Ke)==-1)&&(r||(r=[])).push(Ke)}}),!r)return null;for(var n=[{from:t,to:i}],C=0;C<r.length;++C)for(var F=r[C],Y=F.find(0),J=0;J<n.length;++J){var q=n[J];if(Tt(q.to,Y.from)<0||Tt(q.from,Y.to)>0)continue;var ce=[J,1],me=Tt(q.from,Y.from),De=Tt(q.to,Y.to);(me<0||!F.inclusiveLeft&&!me)&&ce.push({from:q.from,to:Y.from}),(De>0||!F.inclusiveRight&&!De)&&ce.push({from:Y.to,to:q.to}),n.splice.apply(n,ce),J+=ce.length-3}return n}function Di(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 cn(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Zt(e){return e.inclusiveLeft?-1:0}function Nt(e){return e.inclusiveRight?1:0}function fr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),C=Tt(r.from,n.from)||Zt(e)-Zt(t);if(C)return-C;var F=Tt(r.to,n.to)||Nt(e)-Nt(t);return F||t.id-e.id}function Mt(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=void 0,C=0;C<i.length;++C)n=i[C],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||fr(r,n.marker)<0)&&(r=n.marker);return r}function er(e){return Mt(e,!0)}function Ft(e){return Mt(e,!1)}function ti(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var C=i[n];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||fr(r,C.marker)<0)&&(r=C.marker)}return r}function Qt(e,t,i,r,n){var C=pt(e,t),F=Er&&C.markedSpans;if(F)for(var Y=0;Y<F.length;++Y){var J=F[Y];if(!J.marker.collapsed)continue;var q=J.marker.find(0),ce=Tt(q.from,i)||Zt(J.marker)-Zt(n),me=Tt(q.to,r)||Nt(J.marker)-Nt(n);if(ce>=0&&me<=0||ce<=0&&me>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.to,i)>=0:Tt(q.to,i)>0)||ce>=0&&(J.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.from,r)<=0:Tt(q.from,r)<0))return!0}}function Sr(e){for(var t;t=er(e);)e=t.find(-1,!0).line;return e}function zi(e){for(var t;t=Ft(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=Ft(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vi(e,t){var i=pt(e,t),r=Sr(i);return i==r?t:Lt(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=pt(e,t),r;if(!Dr(e,i))return t;for(;r=Ft(i);)i=r.find(1,!0).line;return Lt(i)+1}function Dr(e,t){var i=Er&&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&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Yr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,C=0;C<t.markedSpans.length;++C)if(n=t.markedSpans[C],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function Zr(e){e=Sr(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 C=i.parent;C;i=C,C=i.parent)for(var F=0;F<C.children.length;++F){var Y=C.children[F];if(Y==i)break;t+=Y.height}return t}function Vi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=er(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ft(r);){var C=i.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=pt(i,i.first),t.maxLineLength=Vi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Vi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ri=function(e,t,i){this.text=e,cn(this,t),this.height=i?i(this):1};Ri.prototype.lineNo=function(){return Lt(this)},be(Ri);function $a(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Di(e),cn(e,i);var n=r?r(e):1;n!=e.height&&xr(e,n)}function da(e){e.parent=null,Di(e)}var mt={},Ct={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ct:mt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function kt(e,t){var i=x("span",null,null,I?"padding-right: .1px":null),r={pre:x("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 C=n?t.rest[n-1]:t.line,F=void 0;r.pos=0,r.addToken=Ht,wt(e.display.measure)&&(F=Ze(C,e.doc.direction))&&(r.addToken=tr(r.addToken,F)),r.map=[];var Y=t!=e.display.externalMeasured&&Lt(C);Rt(C,r,Ge(e,C,Y)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=K(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=K(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ft(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(I){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 Ie(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Bt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ht(e,t,i,r,n,C,F){if(!t)return;var Y=e.splitSpaces?Ot(t,e.trailingSpace):t,J=e.cm.state.specialChars,q=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,ce),G&&j<9&&(q=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var me=0;;){J.lastIndex=me;var De=J.exec(t),Ae=De?De.index-me:t.length-me;if(Ae){var je=document.createTextNode(Y.slice(me,me+Ae));G&&j<9?ce.appendChild(a("span",[je])):ce.appendChild(je),e.map.push(e.pos,e.pos+Ae,je),e.col+=Ae,e.pos+=Ae}if(!De)break;me+=Ae+1;var Ke=void 0;if(De[0]==" "){var Xe=e.cm.options.tabSize,rt=Xe-e.col%Xe;Ke=ce.appendChild(a("span",ue(rt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=rt}else De[0]=="\r"||De[0]==`
`?(Ke=ce.appendChild(a("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",De[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(De[0]),Ke.setAttribute("cm-text",De[0]),G&&j<9?ce.appendChild(a("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||q||C||F){var st=i||"";r&&(st+=r),n&&(st+=n);var it=a("span",[ce],st,C);if(F)for(var ht in F)F.hasOwnProperty(ht)&&ht!="style"&&ht!="class"&&it.setAttribute(ht,F[ht]);return e.content.appendChild(it)}e.content.appendChild(ce)}function Ot(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var C=e.charAt(n);C==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(C="\xA0"),r+=C,i=C==" "}return r}function tr(e,t){return function(i,r,n,C,F,Y,J){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,ce=q+r.length;;){for(var me=void 0,De=0;De<t.length&&!(me=t[De],me.to>q&&me.from<=q);De++);if(me.to>=ce)return e(i,r,n,C,F,Y,J);e(i,r.slice(0,me.to-q),n,C,null,Y,J),C=null,r=r.slice(me.to-q),q=me.to}}}function Tr(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 Rt(e,t,i){var r=e.markedSpans,n=e.text,C=0;if(!r){for(var F=1;F<i.length;F+=2)t.addToken(t,n.slice(C,C=i[F]),yt(i[F+1],t.cm.options));return}for(var Y=n.length,J=0,q=1,ce="",me,De,Ae=0,je,Ke,Xe,rt,st;;){if(Ae==J){je=Ke=Xe=De="",st=null,rt=null,Ae=Infinity;for(var it=[],ht=void 0,xt=0;xt<r.length;++xt){var gt=r[xt],At=gt.marker;if(At.type=="bookmark"&&gt.from==J&&At.widgetNode)it.push(At);else if(gt.from<=J&&(gt.to==null||gt.to>J||At.collapsed&&gt.to==J&&gt.from==J)){if(gt.to!=null&&gt.to!=J&&Ae>gt.to&&(Ae=gt.to,Ke=""),At.className&&(je+=" "+At.className),At.css&&(De=(De?De+";":"")+At.css),At.startStyle&&gt.from==J&&(Xe+=" "+At.startStyle),At.endStyle&&gt.to==Ae&&(ht||(ht=[])).push(At.endStyle,gt.to),At.title&&((st||(st={})).title=At.title),At.attributes)for(var Xt in At.attributes)(st||(st={}))[Xt]=At.attributes[Xt];At.collapsed&&(!rt||fr(rt.marker,At)<0)&&(rt=gt)}else gt.from>J&&Ae>gt.from&&(Ae=gt.from)}if(ht)for(var dr=0;dr<ht.length;dr+=2)ht[dr+1]==Ae&&(Ke+=" "+ht[dr]);if(!rt||rt.from==J)for(var $t=0;$t<it.length;++$t)Tr(t,0,it[$t]);if(rt&&(rt.from||0)==J){if(Tr(t,(rt.to==null?Y+1:rt.to)-J,rt.marker,rt.from==null),rt.to==null)return;rt.to==J&&(rt=!1)}}if(J>=Y)break;for(var Or=Math.min(Y,Ae);;){if(ce){var Ar=J+ce.length;if(!rt){var rr=Ar>Or?ce.slice(0,Or-J):ce;t.addToken(t,rr,me?me+je:je,Xe,J+rr.length==Ae?Ke:"",De,st)}if(Ar>=Or){ce=ce.slice(Or-J),J=Or;break}J=Ar,Xe=""}ce=n.slice(C,C=i[q++]),me=yt(i[q++],t.cm.options)}}}function yi(e,t,i){this.line=t,this.rest=Ki(t),this.size=this.rest?Lt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Dr(e,t)}function Ut(e,t,i){for(var r=[],n,C=t;C<i;C=n){var F=new yi(e.doc,pt(e.doc,C),C);n=C+F.size,r.push(F)}return r}var sr=null;function zr(e){sr?sr.ops.push(e):e.ownsGroup=sr={ops:[e],delayedCallbacks:[]}}function Kr(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 Wn(e,t){var i=e.ownsGroup;if(!i)return;try{Kr(i)}finally{sr=null,t(i)}}var pn=null;function pr(e,t){var i=nt(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;sr?n=sr.delayedCallbacks:pn?n=pn:(n=pn=[],setTimeout(Os,0));for(var C=function(Y){n.push(function(){return i[Y].apply(null,r)})},F=0;F<i.length;++F)C(F)}function Os(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function Za(e,t,i,r){for(var n=0;n<t.changes.length;n++){var C=t.changes[n];C=="text"?Ms(e,t):C=="gutter"?Qa(e,t,i,r):C=="class"?ha(e,t):C=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&j<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(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Ja(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):kt(e,t)}function Ms(e,t){var i=t.text.className,r=Ja(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,ha(e,t)):i&&(t.text.className=i)}function ha(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=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var F=mn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),F.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",ui(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var J=0;J<e.display.gutterSpecs.length;++J){var q=e.display.gutterSpecs[J].className,ce=C.hasOwnProperty(q)&&C[q];ce&&Y.appendChild(a("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),n=t.node.firstChild,C=void 0;n;n=C)C=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);qa(e,t,i)}function Ns(e,t,i,r){var n=Ja(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ha(e,t),Qa(e,t,i,r),qa(e,t,r),t.node}function qa(e,t,i){if(eo(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,i,!1)}function eo(e,t,i,r,n){if(!t.widgets)return;for(var C=mn(i),F=0,Y=t.widgets;F<Y.length;++F){var J=Y[F],q=a("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Bs(J,q,i,r),e.display.input.setUneditable(q),n&&J.above?C.insertBefore(q,i.gutter||i.text):C.appendChild(q),pr(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(!E(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;"),d(t.display.measure,a("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 Hn(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("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 ri(e){return fe-e.display.nativeBarWidth}function Oi(e){return e.display.scroller.clientWidth-ri(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-ri(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Oi(e);if(!t.measure.heights||r&&t.measure.width!=n){var C=t.measure.heights=[];if(r){t.measure.width=n;for(var F=t.text.firstChild.getClientRects(),Y=0;Y<F.length-1;Y++){var J=F[Y],q=F[Y+1];Math.abs(J.bottom-q.bottom)>2&&C.push((J.bottom+q.top)/2-i.top)}}C.push(i.bottom-i.top)}}function ro(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(Lt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=Sr(t);var i=Lt(t),r=e.display.externalMeasured=new yi(e.doc,t,i);r.lineN=i;var n=r.built=kt(e,r);return r.text=n.pre,d(e.display.lineMeasure,n.pre),r}function io(e,t,i,r){return ii(e,Xi(e,t),i,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ii(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Lt(t),r=pa(e,i);r&&!r.text?r=null:r&&r.changes&&(Za(e,r,i,xa(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=ro(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ii(e,t,i,r,n){t.before&&(i=-1);var C=i+(r||""),F;return t.cache.hasOwnProperty(C)?F=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),F=Ws(e,t,i,r),F.bogus||(t.cache[C]=F)),{left:F.left,right:F.right,top:n?F.rtop:F.top,bottom:n?F.rbottom:F.bottom}}var no={left:0,right:0,top:0,bottom:0};function ao(e,t,i){for(var r,n,C,F,Y,J,q=0;q<e.length;q+=3)if(Y=e[q],J=e[q+1],t<Y?(n=0,C=1,F="left"):t<J?(n=t-Y,C=n+1):(q==e.length-3||t==J&&e[q+3]>t)&&(C=J-Y,n=C-1,t>=J&&(F="right")),n!=null){if(r=e[q+2],Y==J&&i==(r.insertLeft?"left":"right")&&(F=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],F="left";if(i=="right"&&n==J-Y)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],F="right";break}return{node:r,start:n,end:C,collapse:F,coverStart:Y,coverEnd:J}}function js(e,t){var i=no;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=ao(t.map,i,r),C=n.node,F=n.start,Y=n.end,J=n.collapse,q;if(C.nodeType==3){for(var ce=0;ce<4;ce++){for(;F&&Ue(t.line.text.charAt(n.coverStart+F));)--F;for(;n.coverStart+Y<n.coverEnd&&Ue(t.line.text.charAt(n.coverStart+Y));)++Y;if(G&&j<9&&F==0&&Y==n.coverEnd-n.coverStart?q=C.parentNode.getBoundingClientRect():q=js(y(C,F,Y).getClientRects(),r),q.left||q.right||F==0)break;Y=F,F=F-1,J="right"}G&&j<11&&(q=Hs(e.display.measure,q))}else{F>0&&(J=r="right");var me;e.options.lineWrapping&&(me=C.getClientRects()).length>1?q=me[r=="right"?me.length-1:0]:q=C.getBoundingClientRect()}if(G&&j<9&&!F&&(!q||!q.left&&!q.right)){var De=C.parentNode.getClientRects()[0];De?q={left:De.left,right:De.left+$i(e.display),top:De.top,bottom:De.bottom}:q=no}for(var Ae=q.top-t.rect.top,je=q.bottom-t.rect.top,Ke=(Ae+je)/2,Xe=t.view.measure.heights,rt=0;rt<Xe.length-1&&!(Ke<Xe[rt]);rt++);var st=rt?Xe[rt-1]:0,it=Xe[rt],ht={left:(J=="right"?q.right:q.left)-t.rect.left,right:(J=="left"?q.left:q.right)-t.rect.left,top:st,bottom:it};return!q.left&&!q.right&&(ht.bogus=!0),e.options.singleCursorHeightPerLine||(ht.rtop=Ae,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 oo(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 so(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vn(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return v&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return v&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(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 Gn(e,t,i,r,n){if(!n){var C=ma(t);i.top+=C,i.bottom+=C}if(r=="line")return i;r||(r="local");var F=Zr(t);if(r=="local"?F+=Hn(e.display):F-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();F+=Y.top+(r=="window"?0:uo());var J=Y.left+(r=="window"?0:lo());i.left+=J,i.right+=J}return i.top+=F,i.bottom+=F,i}function ho(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=lo(),n-=uo();else if(i=="local"||!i){var C=e.display.sizer.getBoundingClientRect();r+=C.left,n+=C.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:r-F.left,top:n-F.top}}function ga(e,t,i,r,n){return r||(r=pt(e.doc,t.line)),Gn(e,r,io(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,C){r=r||pt(e.doc,t.line),n||(n=Xi(e,r));function F(je,Ke){var Xe=ii(e,n,je,Ke?"right":"left",C);return Ke?Xe.left=Xe.right:Xe.right=Xe.left,Gn(e,r,Xe,i)}var Y=Ze(r,e.doc.direction),J=t.ch,q=t.sticky;if(J>=r.text.length?(J=r.text.length,q="before"):J<=0&&(J=0,q="after"),!Y)return F(q=="before"?J-1:J,q=="before");function ce(je,Ke,Xe){var rt=Y[Ke],st=rt.level==1;return F(Xe?je-1:je,st!=Xe)}var me=$e(Y,J,q),De=Ye,Ae=ce(J,me,q=="before");return De!=null&&(Ae.other=ce(J,De,q!="before")),Ae}function co(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=pt(e.doc,t.line),n=Zr(r)+Hn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function va(e,t,i,r,n){var C=Ve(e,t,i);return C.xRel=n,r&&(C.outside=r),C}function ya(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return va(r.first,0,null,-1,-1);var n=Mr(r,i),C=r.first+r.size-1;if(n>C)return va(r.first+r.size-1,pt(r,C).text.length,null,1,1);t<0&&(t=0);for(var F=pt(r,n);;){var Y=Gs(e,F,n,t,i),J=ti(F,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var q=J.find(1);if(q.line==n)return q;F=pt(r,n=q.line)}}function fo(e,t,i,r){r-=ma(t);var n=t.text.length,C=tt(function(F){return ii(e,i,F-1).bottom<=r},n,0);return n=tt(function(F){return ii(e,i,F).top>r},C,n),{begin:C,end:n}}function po(e,t,i,r){i||(i=Xi(e,t));var n=Gn(e,t,ii(e,i,r),"line").top;return fo(e,t,i,n)}function ba(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Zr(t);var C=Xi(e,t),F=ma(t),Y=0,J=t.text.length,q=!0,ce=Ze(t,e.doc.direction);if(ce){var me=(e.options.lineWrapping?Ks:zs)(e,t,i,C,ce,r,n);q=me.level!=1,Y=q?me.from:me.to-1,J=q?me.to:me.from-1}var De=null,Ae=null,je=tt(function(xt){var gt=ii(e,C,xt);return gt.top+=F,gt.bottom+=F,ba(gt,r,n,!1)?(gt.top<=n&&gt.left<=r&&(De=xt,Ae=gt),!0):!1},Y,J),Ke,Xe,rt=!1;if(Ae){var st=r-Ae.left<Ae.right-r,it=st==q;je=De+(it?0:1),Xe=it?"after":"before",Ke=st?Ae.left:Ae.right}else{!q&&(je==J||je==Y)&&je++,Xe=je==0?"after":je==t.text.length?"before":ii(e,C,je-(q?1:0)).bottom+F<=n==q?"after":"before";var ht=Jr(e,Ve(i,je,Xe),"line",t,C);Ke=ht.left,rt=n<ht.top?-1:n>=ht.bottom?1:0}return je=Be(t.text,je,1),va(i,je,Xe,rt,r-Ke)}function zs(e,t,i,r,n,C,F){var Y=tt(function(me){var De=n[me],Ae=De.level!=1;return ba(Jr(e,Ve(i,Ae?De.to:De.from,Ae?"before":"after"),"line",t,r),C,F,!0)},0,n.length-1),J=n[Y];if(Y>0){var q=J.level!=1,ce=Jr(e,Ve(i,q?J.from:J.to,q?"after":"before"),"line",t,r);ba(ce,C,F,!0)&&ce.top>F&&(J=n[Y-1])}return J}function Ks(e,t,i,r,n,C,F){var Y=fo(e,t,r,F),J=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var ce=null,me=null,De=0;De<n.length;De++){var Ae=n[De];if(Ae.from>=q||Ae.to<=J)continue;var je=Ae.level!=1,Ke=ii(e,r,je?Math.min(q,Ae.to)-1:Math.max(J,Ae.from)).right,Xe=Ke<C?C-Ke+1e9:Ke-C;(!ce||me>Xe)&&(ce=Ae,me=Xe)}return ce||(ce=n[n.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>q&&(ce={from:ce.from,to:q,level:ce.level}),ce}var Pi;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pi==null){Pi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pi.appendChild(document.createTextNode("x")),Pi.appendChild(a("br"));Pi.appendChild(document.createTextNode("x"))}d(e.measure,Pi);var i=Pi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function $i(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");d(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function xa(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,C=t.gutters.firstChild,F=0;C;C=C.nextSibling,++F){var Y=e.display.gutterSpecs[F].className;i[Y]=C.offsetLeft+C.clientLeft+n,r[Y]=C.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(Dr(e.doc,n))return 0;var C=0;if(n.widgets)for(var F=0;F<n.widgets.length;F++)n.widgets[F].height&&(C+=n.widgets[F].height);return i?C+(Math.ceil(n.text.length/r)||1)*t:C+t}}function Sa(e){var t=e.doc,i=mo(e);t.iter(function(r){var n=i(r);n!=r.height&&xr(r,n)})}function Mi(e,t,i,r){var n=e.display;if(!i&&Le(t).getAttribute("cm-not-content")=="true")return null;var C,F,Y=n.lineSpace.getBoundingClientRect();try{C=t.clientX-Y.left,F=t.clientY-Y.top}catch(me){return null}var J=ya(e,C,F),q;if(r&&J.xRel>0&&(q=pt(e.doc,J.line).text).length==J.ch){var ce=$(q,q.length,e.options.tabSize)-q.length;J=Ve(J.line,Math.max(0,Math.round((C-to(e.display).left)/$i(e.display))-ce))}return J}function Ii(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 Cr(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)Er&&vi(e.doc,t)<n.viewTo&&xi(e);else if(i<=n.viewFrom)Er&&Fn(e.doc,i+r)>n.viewFrom?xi(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)xi(e);else if(t<=n.viewFrom){var C=zn(e,i,i+r,1);C?(n.view=n.view.slice(C.index),n.viewFrom=C.lineN,n.viewTo+=r):xi(e)}else if(i>=n.viewTo){var F=zn(e,t,t,-1);F?(n.view=n.view.slice(0,F.index),n.viewTo=F.lineN):xi(e)}else{var Y=zn(e,t,t,-1),J=zn(e,i,i+r,1);Y&&J?(n.view=n.view.slice(0,Y.index).concat(Ut(e,Y.lineN,J.lineN)).concat(n.view.slice(J.index)),n.viewTo+=r):xi(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function bi(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 C=r.view[Ii(e,t)];if(C.node==null)return;var F=C.changes||(C.changes=[]);oe(F,i)==-1&&F.push(i)}function xi(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=Ii(e,t),C,F=e.display.view;if(!Er||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,J=0;J<n;J++)Y+=F[J].size;if(Y!=t){if(r>0){if(n==F.length-1)return null;C=Y+F[n].size-t,n++}else C=Y-t;t+=C,i+=C}for(;vi(e.doc,i)!=i;){if(n==(r<0?0:F.length-1))return null;i+=r*F[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=Ut(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Ut(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ii(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Ut(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ii(e,i)))),r.viewTo=i}function go(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 vo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),F=0;F<i.sel.ranges.length;F++){if(!t&&F==i.sel.primIndex)continue;var Y=i.sel.ranges[F];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var J=Y.empty();(J||e.options.showCursorWhenSelecting)&&yo(e,Y.head,n),J||Xs(e,Y,C)}return r}function yo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("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 C=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Kn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,C=document.createDocumentFragment(),F=to(e.display),Y=F.left,J=Math.max(r.sizerWidth,Oi(e)-r.sizer.offsetLeft)-F.right,q=n.direction=="ltr";function ce(it,ht,xt,gt){ht<0&&(ht=0),ht=Math.round(ht),gt=Math.round(gt),C.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+it+`px;
top: `+ht+"px; width: "+(xt==null?J-it:xt)+`px;
height: `+(gt-ht)+"px"))}function me(it,ht,xt){var gt=pt(n,it),At=gt.text.length,Xt,dr;function $t(rr,_r){return ga(e,Ve(it,rr),"div",gt,_r)}function Or(rr,_r,mr){var or=po(e,gt,null,rr),ir=_r=="ltr"==(mr=="after")?"left":"right",Jt=mr=="after"?or.begin:or.end-(/\s/.test(gt.text.charAt(or.end-1))?2:1);return $t(Jt,ir)[ir]}var Ar=Ze(gt,n.direction);return et(Ar,ht||0,xt==null?At:xt,function(rr,_r,mr,or){var ir=mr=="ltr",Jt=$t(rr,ir?"left":"right"),Lr=$t(_r-1,ir?"right":"left"),un=ht==null&&rr==0,Ai=xt==null&&_r==At,vr=or==0,ni=!Ar||or==Ar.length-1;if(Lr.top-Jt.top<=3){var hr=(q?un:Ai)&&vr,Xa=(q?Ai:un)&&ni,mi=hr?Y:(ir?Jt:Lr).left,ji=Xa?J:(ir?Lr:Jt).right;ce(mi,Jt.top,ji-mi,Jt.bottom)}else{var Wi,br,dn,Ya;ir?(Wi=q&&un&&vr?Y:Jt.left,br=q?J:Or(rr,mr,"before"),dn=q?Y:Or(_r,mr,"after"),Ya=q&&Ai&&ni?J:Lr.right):(Wi=q?Or(rr,mr,"before"):Y,br=!q&&un&&vr?J:Jt.right,dn=!q&&Ai&&ni?Y:Lr.left,Ya=q?Or(_r,mr,"after"):J),ce(Wi,Jt.top,br-Wi,Jt.bottom),Jt.bottom<Lr.top&&ce(Y,Jt.bottom,null,Lr.top),ce(dn,Lr.top,Ya-dn,Lr.bottom)}(!Xt||Kn(Jt,Xt)<0)&&(Xt=Jt),Kn(Lr,Xt)<0&&(Xt=Lr),(!dr||Kn(Jt,dr)<0)&&(dr=Jt),Kn(Lr,dr)<0&&(dr=Lr)}),{start:Xt,end:dr}}var De=t.from(),Ae=t.to();if(De.line==Ae.line)me(De.line,De.ch,Ae.ch);else{var je=pt(n,De.line),Ke=pt(n,Ae.line),Xe=Sr(je)==Sr(Ke),rt=me(De.line,De.ch,Xe?je.text.length+1:null).end,st=me(Ae.line,Xe?0:null,Ae.ch).start;Xe&&(rt.top<st.top-2?(ce(rt.right,rt.top,null,rt.bottom),ce(Y,st.top,st.left,st.bottom)):ce(rt.right,rt.top,st.left-rt.right,rt.bottom)),rt.bottom<st.top&&ce(Y,rt.bottom,null,st.top)}i.appendChild(C)}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 bo(e){e.state.focused||(e.display.input.focus(),Ca(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ie(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(),I&&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&&(Ie(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],C=e.options.lineWrapping,F=void 0,Y=0;if(n.hidden)continue;if(G&&j<8){var J=n.node.offsetTop+n.node.offsetHeight;F=J-i,i=J}else{var q=n.node.getBoundingClientRect();F=q.bottom-q.top,!C&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var ce=n.line.height-F;if((ce>.005||ce<-.005)&&(xr(n.line,F),Eo(n.line),n.rest))for(var me=0;me<n.rest.length;me++)Eo(n.rest[me]);if(Y>e.display.sizerWidth){var De=Math.ceil(Y/$i(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function Eo(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 Xn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Hn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,C=Mr(t,r),F=Mr(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,J=i.ensure.to.line;Y<C?(C=Y,F=Mr(t,Zr(pt(t,Y))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=F&&(C=Mr(t,Zr(pt(t,J))-e.wrapper.clientHeight),F=J)}return{from:C,to:Math.max(F,C+1)}}function Ys(e,t){if(He(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&&!w){var C=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Hn(e.display))+`px;
height: `+(t.bottom-t.top+ri(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(n),e.display.lineSpace.removeChild(C)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var C=0;C<5;C++){var F=!1,Y=Jr(e,t),J=!i||i==t?Y:Jr(e,i);n={left:Math.min(Y.left,J.left),top:Math.min(Y.top,J.top)-r,right:Math.max(Y.left,J.left),bottom:Math.max(Y.bottom,J.bottom)+r};var q=wa(e,n),ce=e.doc.scrollTop,me=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(F=!0)),q.scrollLeft!=null&&(Ni(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(F=!0)),!F)break}return n}function Zs(e,t){var i=wa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Ni(e,i.scrollLeft)}function wa(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,C=fa(e),F={};t.bottom-t.top>C&&(t.bottom=t.top+C);var Y=e.doc.height+ca(i),J=t.top<r,q=t.bottom>Y-r;if(t.top<n)F.scrollTop=J?0:t.top;else if(t.bottom>n+C){var ce=Math.min(t.top,(q?Y:t.bottom)-C);ce!=n&&(F.scrollTop=ce)}var me=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-me,Ae=Oi(e)-i.gutters.offsetWidth,je=t.right-t.left>Ae;return je&&(t.right=t.left+Ae),t.left<10?F.scrollLeft=0:t.left<De?F.scrollLeft=Math.max(0,t.left+me-(je?0:10)):t.right>Ae+De-3&&(F.scrollLeft=t.right+(je?0:10)-Ae),F}function Aa(e,t){if(t==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ji(e){Yn(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)&&Yn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=co(e,t.from),r=co(e,t.to);So(e,i,r,t.margin)}}function So(e,t,i,r){var n=wa(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||La(e,{top:t}),To(e,t,!0),D&&La(e),Tn(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 Ni(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,Lo(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+ca(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+ri(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Bi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ke(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ke(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bi.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 C=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"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}},Bi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bi.prototype.zeroWidthHack=function(){var e=l&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Bi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),C=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bi.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 Qi(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),Co(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function Co(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 wo={native:Bi,null:Sn};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(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"?Ni(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Ui(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:++Qs},zr(e.curOp)}function Fi(e){var t=e.curOp;t&&Wn(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 C=0;C<t.length;C++)il(t[C]);for(var F=0;F<t.length;F++)nl(t[F])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(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 $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+ri(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Oi(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&&Ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&bo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&_o(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&&Ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var C=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(C)for(var Y=0;Y<C.length;++Y)C[Y].lines.length||Ie(C[Y],"hide");if(F)for(var J=0;J<F.length;++J)F[J].lines.length&&Ie(F[J],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ie(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Rr(e,t){if(e.curOp)return t();Ui(e);try{return t()}finally{Fi(e)}}function lr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ui(e);try{return t.apply(e,arguments)}finally{Fi(e)}}}function yr(e){return function(){if(this.curOp)return e.apply(this,arguments);Ui(this);try{return e.apply(this,arguments)}finally{Fi(this)}}}function ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ui(t);try{return e.apply(this,arguments)}finally{Fi(t)}}}function Tn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Qe(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var F=C.styles,Y=C.text.length>e.options.maxHighlightLength?Hr(t.mode,r.state):null,J=ve(e,C,r,!0);Y&&(r.state=Y),C.styles=J.styles;var q=C.styleClasses,ce=J.classes;ce?C.styleClasses=ce:q&&(C.styleClasses=null);for(var me=!F||F.length!=C.styles.length||q!=ce&&(!q||!ce||q.bgClass!=ce.bgClass||q.textClass!=ce.textClass),De=0;!me&&De<F.length;++De)me=F[De]!=C.styles[De];me&&n.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&dt(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Tn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Rr(e,function(){for(var C=0;C<n.length;C++)bi(e,n[C],"text")})}var $n=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Xn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Oi(e),this.force=i,this.dims=xa(e),this.events=[]};$n.prototype.signal=function(e,t){pe(e,t)&&this.events.push(arguments)},$n.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ie.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=ri(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ri(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=N();if(!t||!E(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(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==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(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 _a(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return xi(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&&go(e)==0)return!1;ko(e)&&(xi(e),t.dims=xa(e));var n=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),F=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<C&&C-i.viewFrom<20&&(C=Math.max(r.first,i.viewFrom)),i.viewTo>F&&i.viewTo-F<20&&(F=Math.min(n,i.viewTo)),Er&&(C=vi(e.doc,C),F=Fn(e.doc,F));var Y=C!=i.viewFrom||F!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,C,F),i.viewOffset=Zr(pt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var J=go(e);if(!Y&&J==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var q=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(q),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Tn(e,400)),i.updateLineNumbers=null,!0}function _o(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Oi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ca(e.display)-fa(e),i.top)}),t.visible=Xn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xn(e.display,e.doc,i));if(!_a(e,t))break;Vn(e);var n=En(e);yn(e),Qi(e,n),Da(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 La(e,t){var i=new $n(e,t);if(_a(e,i)){Vn(e),_o(e,i);var r=En(e);yn(e),Qi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,C=r.lineDiv,F=C.firstChild;function Y(je){var Ke=je.nextSibling;return I&&l&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ke}for(var J=r.view,q=r.viewFrom,ce=0;ce<J.length;ce++){var me=J[ce];if(!me.hidden)if(!me.node||me.node.parentNode!=C){var De=Ns(e,me,q,i);C.insertBefore(De,F)}else{for(;F!=me.node;)F=Y(F);var Ae=n&&t!=null&&t<=q&&me.lineNumber;me.changes&&(oe(me.changes,"gutter")>-1&&(Ae=!1),Za(e,me,q,i)),Ae&&(c(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(ui(e.options,q)))),F=me.node.nextSibling}q+=me.size}for(;F;)F=Y(F)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+ri(e)+"px"}function Lo(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,C=r+"px",F=0;F<i.length;F++)if(!i[F].hidden){e.options.fixedGutter&&(i[F].gutter&&(i[F].gutter.style.left=C),i[F].gutterBackground&&(i[F].gutterBackground.style.left=C));var Y=i[F].alignable;if(Y)for(var J=0;J<Y.length;J++)Y[J].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=ui(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=n.firstChild.offsetWidth,F=n.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-F)+1,r.lineNumWidth=r.lineNumInnerWidth+F,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var C=e[n],F=null;if(typeof C!="string"&&(F=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:C,style:F})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Do(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],C=n.className,F=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+C));F&&(Y.style.cssText=F),C=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function Cn(e){Do(e.display),Cr(e),Lo(e)}function dl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=x("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var C=x("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[C],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&j<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!I&&!(D&&o)&&(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=Ra(r.gutters,r.lineNumbers),Do(n),i.init(n)}var Zn=0,Fr=null;G?Fr=-.53:D?Fr=15:v?Fr=-.7:R&&(Fr=-1/3);function Ro(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 hl(e){var t=Ro(e);return t.x*=Fr,t.y*=Fr,t}function Oo(e,t){var i=Ro(t),r=i.x,n=i.y,C=e.display,F=C.scroller,Y=F.scrollWidth>F.clientWidth,J=F.scrollHeight>F.clientHeight;if(!(r&&Y||n&&J))return;if(n&&l&&I){e:for(var q=t.target,ce=C.view;q!=F;q=q.parentNode)for(var me=0;me<ce.length;me++)if(ce[me].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!D&&!T&&Fr!=null){n&&J&&xn(e,Math.max(0,F.scrollTop+n*Fr)),Ni(e,Math.max(0,F.scrollLeft+r*Fr)),(!n||n&&J)&&re(t),C.wheelStartX=null;return}if(n&&Fr!=null){var De=n*Fr,Ae=e.doc.scrollTop,je=Ae+C.wrapper.clientHeight;De<0?Ae=Math.max(0,Ae+De-50):je=Math.min(e.doc.height,je+De+50),La(e,{top:Ae,bottom:je})}Zn<20&&(C.wheelStartX==null?(C.wheelStartX=F.scrollLeft,C.wheelStartY=F.scrollTop,C.wheelDX=r,C.wheelDY=n,setTimeout(function(){if(C.wheelStartX==null)return;var Ke=F.scrollLeft-C.wheelStartX,Xe=F.scrollTop-C.wheelStartY,rt=Xe&&C.wheelDY&&Xe/C.wheelDY||Ke&&C.wheelDX&&Ke/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!rt)return;Fr=(Fr*Zn+rt)/(Zn+1),++Zn},200)):(C.wheelDX+=r,C.wheelDY+=n))}var jr=function(e,t){this.ranges=e,this.primIndex=t};jr.prototype.primary=function(){return this.ranges[this.primIndex]},jr.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(!di(i.anchor,r.anchor)||!di(i.head,r.head))return!1}return!0},jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(_i(this.ranges[t].anchor),_i(this.ranges[t].head));return new jr(e,this.primIndex)},jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},jr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(Tt(t,r.from())>=0&&Tt(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return Li(this.anchor,this.head)},jt.prototype.to=function(){return hi(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,Ae){return Tt(De.from(),Ae.from())}),i=oe(t,n);for(var C=1;C<t.length;C++){var F=t[C],Y=t[C-1],J=Tt(Y.to(),F.from());if(r&&!F.empty()?J>0:J>=0){var q=Li(Y.from(),F.from()),ce=hi(Y.to(),F.to()),me=Y.empty()?F.from()==F.head:Y.from()==Y.head;C<=i&&--i,t.splice(--C,2,new jt(me?ce:q,me?q:ce))}}return new jr(t,i)}function Ei(e,t){return new jr([new jt(e,t||e)],0)}function Si(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Si(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+=Si(t).ch-t.to.ch),Ve(i,r)}function Oa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Po(n.anchor,t),Po(n.head,t)))}return Qr(e.cm,i,e.sel.primIndex)}function Mo(e,t,i){return e.line==t.line?Ve(i.line,e.ch-t.ch+i.ch):Ve(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ve(e.first,0),C=n,F=0;F<t.length;F++){var Y=t[F],J=Mo(Y.from,n,C),q=Mo(Si(Y),n,C);if(n=Y.to,C=q,i=="around"){var ce=e.sel.ranges[F],me=Tt(ce.head,ce.anchor)<0;r[F]=new jt(me?q:J,me?J:q)}else r[F]=new jt(J,J)}return new jr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Vr(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,Tn(e,100),e.state.modeGen++,e.curOp&&Cr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,i,r){function n(st){return i?i[st]:null}function C(st,it,ht){$a(st,it,ht,r),pr(st,"change",st,t)}function F(st,it){for(var ht=[],xt=st;xt<it;++xt)ht.push(new Ri(q[xt],n(xt),r));return ht}var Y=t.from,J=t.to,q=t.text,ce=pt(e,Y.line),me=pt(e,J.line),De=te(q),Ae=n(q.length-1),je=J.line-Y.line;if(t.full)e.insert(0,F(0,q.length)),e.remove(q.length,e.size-q.length);else if(Io(e,t)){var Ke=F(0,q.length-1);C(me,me.text,Ae),je&&e.remove(Y.line,je),Ke.length&&e.insert(Y.line,Ke)}else if(ce==me)if(q.length==1)C(ce,ce.text.slice(0,Y.ch)+De+ce.text.slice(J.ch),Ae);else{var Xe=F(1,q.length-1);Xe.push(new Ri(De+ce.text.slice(J.ch),Ae,r)),C(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,Xe)}else if(q.length==1)C(ce,ce.text.slice(0,Y.ch)+q[0]+me.text.slice(J.ch),n(0)),e.remove(Y.line+1,je);else{C(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),C(me,De+me.text.slice(J.ch),Ae);var rt=F(1,q.length-1);je>1&&e.remove(Y.line+1,je-1),e.insert(Y.line+1,rt)}pr(e,"change",e,t)}function Ti(e,t,i){function r(n,C,F){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var J=n.linked[Y];if(J.doc==C)continue;var q=F&&J.sharedHist;if(i&&!q)continue;t(J.doc,q),r(J.doc,n,q)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Sa(e),Pa(e),Bo(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Cr(e)}function Bo(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Rr(e,function(){Bo(e),Cr(e)})}function Jn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var i={from:_i(t.from),to:Si(t),text:Pr(e,t.from,t.to)};return jo(e,i,t.from.line,t.to.line+1),Ti(e,function(r){return jo(r,i,t.from.line,t.to.line+1)},!0),i}function Uo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(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 Fo(e,t,i,r){var n=e.history;n.undone.length=0;var C=+new Date,F,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=pl(n,n.lastOp==r)))Y=te(F.changes),Tt(t.from,t.to)==0&&Tt(t.from,Y.to)==0?Y.to=Si(t):F.changes.push(Ia(e,t));else{var J=te(n.done);for((!J||!J.ranges)&&Qn(e.sel,n.done),F={changes:[Ia(e,t)],generation:n.generation},n.done.push(F);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=C,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Ie(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,C=r&&r.origin;i==n.lastSelOp||C&&n.lastSelOrigin==C&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==C||ml(e,C,te(n.done),t))?n.done[n.done.length-1]=t:Qn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=C,n.lastSelOp=i,r&&r.clearRedo!==!1&&Uo(n.undone)}function Qn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function jo(e,t,i,r){var n=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(F){F.markedSpans&&((n||(n=t["spans_"+e.id]={}))[C]=F.markedSpans),++C})}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 Wo(e,t){var i=yl(e,t),r=$r(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var C=i[n],F=r[n];if(C&&F){e:for(var Y=0;Y<F.length;++Y){for(var J=F[Y],q=0;q<C.length;++q)if(C[q].marker==J.marker)continue e;C.push(J)}}else F&&(i[n]=F)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var C=e[n];if(C.ranges){r.push(i?jr.prototype.deepCopy.call(C):C);continue}var F=C.changes,Y=[];r.push({changes:Y});for(var J=0;J<F.length;++J){var q=F[J],ce=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var me in q)(ce=me.match(/^spans_(\d+)$/))&&(oe(t,Number(ce[1]))>-1&&(te(Y)[me]=q[me],delete q[me]))}}return r}function Na(e,t,i,r){if(r){var n=e.anchor;if(i){var C=Tt(t,n)<0;C!=Tt(i,n)<0?(n=t,t=i):C!=Tt(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),gr(e,new jr([Na(e.sel.primary(),t,i,n)],0),r)}function Ho(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=Na(e.sel.ranges[C],t[C],null,n);var F=Qr(e.cm,r,e.sel.primIndex);gr(e,F,i)}function Ba(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,gr(e,Qr(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){gr(e,Ei(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var C=0;C<n.length;C++)this.ranges[C]=new jt(s(e,n[C].anchor),s(e,n[C].head))},origin:i&&i.origin};return Ie(e,"beforeSelectionChange",e,r),e.cm&&Ie(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Qr(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,ea(e,t,i)):gr(e,t,i)}function gr(e,t,i){ea(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function ea(e,t,i){(pe(e,"beforeSelectionChange")||e.cm&&pe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(Tt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Ji(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),pr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,i,r){for(var n,C=0;C<t.ranges.length;C++){var F=t.ranges[C],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],J=ta(e,F.anchor,Y&&Y.anchor,i,r),q=ta(e,F.head,Y&&Y.head,i,r);(n||J!=F.anchor||q!=F.head)&&(n||(n=t.ranges.slice(0,C)),n[C]=new jt(J,q))}return n?Qr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var C=pt(e,t.line);if(C.markedSpans)for(var F=0;F<C.markedSpans.length;++F){var Y=C.markedSpans[F],J=Y.marker,q="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(ce?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Ie(J,"beforeCursorEnter"),J.explicitlyCleared))if(C.markedSpans){--F;continue}else break;if(!J.atomic)continue;if(i){var me=J.find(r<0?1:-1),De=void 0;if((r<0?ce:q)&&(me=Yo(e,me,-r,me&&me.line==t.line?C:null)),me&&me.line==t.line&&(De=Tt(me,i))&&(r<0?De<0:De>0))return en(e,me,t,r,n)}var Ae=J.find(r<0?-1:1);return(r<0?q:ce)&&(Ae=Yo(e,Ae,r,Ae.line==t.line?C:null)),Ae?en(e,Ae,t,r,n):null}}return t}function ta(e,t,i,r,n){var C=r||1,F=en(e,t,i,C,n)||!n&&en(e,t,i,C,!0)||en(e,t,i,-C,n)||!n&&en(e,t,i,-C,!0);return F||(e.cantEdit=!0,Ve(e.first,0))}function Yo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Ve(t.line-1)):null:i>0&&t.ch==(r||pt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+i)}function $o(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),Ee)}function Zo(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,C,F,Y){n&&(r.from=s(e,n)),C&&(r.to=s(e,C)),F&&(r.text=F),Y!==void 0&&(r.origin=Y)}),Ie(e,"beforeChange",e,r),e.cm&&Ie(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 tn(e,t,i){if(e.cm){if(!e.cm.curOp)return lr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"))&&(t=Zo(e,t,!0),!t))return;var r=Hi&&!i&&ki(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Jo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Jo(e,t)}function Jo(e,t){if(t.text.length==1&&t.text[0]==""&&Tt(t.from,t.to)==0)return;var i=Oa(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,$r(e,t));var r=[];Ti(e,function(n,C){!C&&oe(r,n.history)==-1&&(ts(n.history,t),r.push(n.history)),An(n,t,null,$r(n,t))})}function ra(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,C,F=e.sel,Y=t=="undo"?n.done:n.undone,J=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(C=Y[q],i?C.ranges&&!C.equals(e.sel):!C.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(C=Y.pop(),C.ranges){if(Qn(C,J),i&&!C.equals(e.sel)){gr(e,C,{clearRedo:!1});return}F=C}else if(r){Y.push(C);return}else break;var ce=[];Qn(F,J),J.push({changes:ce,generation:n.generation}),n.generation=C.generation||++n.maxGeneration;for(var me=pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"),De=function(Ke){var Xe=C.changes[Ke];if(Xe.origin=t,me&&!Zo(e,Xe,!1))return Y.length=0,{};ce.push(Ia(e,Xe));var rt=Ke?Oa(e,Xe):te(Y);An(e,Xe,rt,Wo(e,Xe)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Xe.from,to:Si(Xe)});var st=[];Ti(e,function(it,ht){!ht&&oe(st,it.history)==-1&&(ts(it.history,Xe),st.push(it.history)),An(it,Xe,null,Wo(it,Xe))})},Ae=C.changes.length-1;Ae>=0;--Ae){var je=De(Ae);if(je)return je.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new jr(he(e.sel.ranges,function(n){return new jt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Cr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)bi(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return lr(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:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Ve(C,pt(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),i||(i=Oa(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),ea(e,i,Ee),e.cantEdit&&ta(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,C=t.from,F=t.to,Y=!1,J=C.line;e.options.lineWrapping||(J=Lt(Sr(pt(r,C.line))),r.iter(J,F.line+1,function(Ae){if(Ae==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&xe(e),Ma(r,t,i,mo(e)),e.options.lineWrapping||(r.iter(J,C.line+t.text.length,function(Ae){var je=Vi(Ae);je>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=je,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Gr(r,C.line),Tn(e,400);var q=t.text.length-(F.line-C.line)-1;t.full?Cr(e):C.line==F.line&&t.text.length==1&&!Io(e.doc,t)?bi(e,C.line,"text"):Cr(e,C.line,F.line+1,q);var ce=pe(e,"changes"),me=pe(e,"change");if(me||ce){var De={from:C,to:F,text:t.text,removed:t.removed,origin:t.origin};me&&pr(e,"change",e,De),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var C;r||(r=i),Tt(r,i)<0&&(C=[r,i],i=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function qo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,i,r){for(var n=0;n<e.length;++n){var C=e[n],F=!0;if(C.ranges){C.copied||(C=e[n]=C.deepCopy(),C.copied=!0);for(var Y=0;Y<C.ranges.length;Y++)qo(C.ranges[Y].anchor,t,i,r),qo(C.ranges[Y].head,t,i,r);continue}for(var J=0;J<C.changes.length;++J){var q=C.changes[J];if(i<q.from.line)q.from=Ve(q.from.line+r,q.from.ch),q.to=Ve(q.to.line+r,q.to.ch);else if(t<=q.to.line){F=!1;break}}F||(e.splice(0,n+1),n=0)}}function ts(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;es(e.done,i,r,n),es(e.undone,i,r,n)}function _n(e,t,i,r){var n=t,C=t;return typeof t=="number"?C=pt(e,z(e,t)):n=Lt(t),n==null?null:(r(C,n)&&e.cm&&bi(e.cm,n,i),C)}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,da(n),pr(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 C=Math.min(t,n-e),F=r.height;if(r.removeInner(e,C),this.height-=F-r.height,n==C&&(this.children.splice(i--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var Y=[];this.collapse(Y),this.children=[new Ln(Y)],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],C=n.chunkSize();if(e<=C){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var F=n.lines.length%25+25,Y=F;Y<n.lines.length;){var J=new Ln(n.lines.slice(Y,Y+=25));n.height-=J.height,this.children.splice(++r,0,J),J.parent=this}n.lines=n.lines.slice(0,F),this.maybeSpill()}break}e-=C}},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=oe(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],C=n.chunkSize();if(e<C){var F=Math.min(t,C-e);if(n.iterN(e,F,i))return!0;if((t-=F)==0)break;e=0}else e-=C}}};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=Lt(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 C=gn(this);xr(i,Math.max(0,i.height-C)),e&&(Rr(e,function(){rs(e,i,-C),bi(e,r,"widget")}),pr(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;Dr(this.doc,r)||xr(r,r.height+n),i&&Rr(i,function(){i.curOp.forceUpdate=!0,rs(i,r,n),pr(i,"lineWidgetChanged",i,e,Lt(r))})},be(Dn);function rs(e,t,i){Zr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,i)}function El(e,t,i,r){var n=new Dn(e,i,r),C=e.cm;return C&&n.noHScroll&&(C.display.alignWidgets=!0),_n(e,t,"widget",function(F){var Y=F.widgets||(F.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=F,C&&!Dr(e,F)){var J=Zr(F)<e.scrollTop;xr(F,F.height+gn(n)),J&&Aa(C,n.height),C.curOp.forceUpdate=!0}return!0}),C&&pr(C,"lineWidgetAdded",C,n,typeof t=="number"?t:Lt(t)),n}var is=0,Ci=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Ci.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ui(e),pe(this,"clear")){var i=this.find();i&&pr(this,"clear",i.from,i.to)}for(var r=null,n=null,C=0;C<this.lines.length;++C){var F=this.lines[C],Y=Yr(F.markedSpans,this);e&&!this.collapsed?bi(e,Lt(F),"text"):e&&(Y.to!=null&&(n=Lt(F)),Y.from!=null&&(r=Lt(F))),F.markedSpans=ci(F.markedSpans,Y),Y.from==null&&this.collapsed&&!Dr(this.doc,F)&&e&&xr(F,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var q=Sr(this.lines[J]),ce=Vi(q);ce>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Cr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&pr(e,"markerCleared",e,this,r,n),t&&Fi(e),this.parent&&this.parent.clear()},Ci.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var C=this.lines[n],F=Yr(C.markedSpans,this);if(F.from!=null&&(i=Ve(t?C:Lt(C),F.from),e==-1))return i;if(F.to!=null&&(r=Ve(t?C:Lt(C),F.to),e==1))return r}return i&&{from:i,to:r}},Ci.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Rr(r,function(){var n=t.line,C=Lt(t.line),F=pa(r,C);if(F&&(oo(F),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Dr(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var J=gn(i)-Y;J&&xr(n,n.height+J)}pr(r,"markerChanged",r,e)})},Ci.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ci.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(Ci);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return lr(e.cm,nn)(e,t,i,r,n);var C=new Ci(e,n),F=Tt(t,i);if(r&&M(r,C,!1),F>0||F==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=x("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(Qt(e,t.line,t,i,C)||t.line!=i.line&&Qt(e,i.line,t,i,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");kr()}C.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,q;if(e.iter(Y,i.line+1,function(me){J&&C.collapsed&&!J.options.lineWrapping&&Sr(me)==J.display.maxLine&&(q=!0),C.collapsed&&Y!=t.line&&xr(me,0),ei(me,new gi(C,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),C.collapsed&&e.iter(t.line,i.line+1,function(me){Dr(e,me)&&xr(me,0)}),C.clearOnEnter&&ke(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&(Br(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++is,C.atomic=!0),J){if(q&&(J.curOp.updateMaxLine=!0),C.collapsed)Cr(J,t.line,i.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var ce=t.line;ce<=i.line;ce++)bi(J,ce,"text");C.atomic&&Vo(J.doc),pr(J,"markerAdded",J,C)}return C}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();pr(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},be(Rn);function Sl(e,t,i,r,n){r=M(r),r.shared=!1;var C=[nn(e,t,i,r,n)],F=C[0],Y=r.widgetNode;return Ti(e,function(J){Y&&(r.widgetNode=Y.cloneNode(!0)),C.push(nn(J,s(J,t),s(J,i),r,n));for(var q=0;q<J.linked.length;++q)if(J.linked[q].isParent)return;F=te(C)}),new Rn(C,F)}function ns(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),C=e.clipPos(n.from),F=e.clipPos(n.to);if(Tt(C,F)){var Y=nn(e,C,F,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Cl(e){for(var t=function(r){var n=e[r],C=[n.primary.doc];Ti(n.primary.doc,function(J){return C.push(J)});for(var F=0;F<n.markers.length;F++){var Y=n.markers[F];oe(C,Y.doc)==-1&&(Y.parent=null,n.markers.splice(F--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,wr=function(e,t,i,r,n){if(!(this instanceof wr))return new wr(e,t,i,r,n);i==null&&(i=0),kn.call(this,[new Ln([new Ri("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var C=Ve(i,0);this.sel=Ei(C),this.history=new Jn(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)),Ma(this,{from:C,to:C,text:e}),gr(this,Ei(C),Ee)};wr.prototype=Oe(kn.prototype,{constructor:wr,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:ur(function(e){var t=Ve(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ve(i,pt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),gr(this,Ei(t),Ee)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Pr(this,s(this,e),s(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(Xr(this,e))return pt(this,e)},getLineNumber:function(e){return Lt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),Sr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(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:ur(function(e,t,i){Go(this,s(this,typeof e=="number"?Ve(e,t||0):e),null,i)}),setSelection:ur(function(e,t,i){Go(this,s(this,e),s(this,t||e),i)}),extendSelection:ur(function(e,t,i){qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:ur(function(e,t){Ho(this,W(this,e),t)}),extendSelectionsBy:ur(function(e,t){var i=he(this.sel.ranges,e);Ho(this,W(this,i),t)}),setSelections:ur(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),gr(this,Qr(this.cm,r,t),i)}),addSelection:ur(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),gr(this,Qr(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=Pr(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=Pr(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:ur(function(e,t,i){for(var r=[],n=this.sel,C=0;C<n.ranges.length;C++){var F=n.ranges[C];r[C]={from:F.from(),to:F.to(),text:this.splitLines(e[C]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),J=r.length-1;J>=0;J--)tn(this,r[J]);Y?zo(this,Y):this.cm&&Ji(this.cm)}),undo:ur(function(){ra(this,"undo")}),redo:ur(function(){ra(this,"redo")}),undoSelection:ur(function(){ra(this,"undo",!0)}),redoSelection:ur(function(){ra(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 Jn(this.history.maxGeneration),Ti(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:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Jn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:ur(function(e,t,i){return _n(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Ne(n)&&(r.gutterMarkers=null),!0})}),clearGutter:ur(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&_n(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ne(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xr(this,e))return null;if(t=e,e=pt(this,e),!e)return null}else if(t=Lt(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:ur(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:ur(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",C=r[n];if(C)if(i==null)r[n]=null;else{var F=C.match(b(i));if(!F)return!1;var Y=F.index+F[0].length;r[n]=C.slice(0,F.index)+(!F.index||Y==C.length?"":" ")+C.slice(Y)||null}else return!1;return!0})}),addLineWidget:ur(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(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=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=pt(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=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(C){var F=C.markedSpans;if(F)for(var Y=0;Y<F.length;Y++){var J=F[Y];!(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 C=n.text.length+r;if(C>e)return t=e,!0;e-=C,++i}),s(this,Ve(i,t))},indexFromPos:function(e){e=s(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 wr(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 wr(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}],Tl(r,ns(this)),r},unlinkDoc:function(e){if(e instanceof Yt&&(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),Cl(ns(this));break}if(e.history==this.history){var r=[e.id];Ti(e,function(n){return r.push(n.id)},!0),e.history=new Jn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ti(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):St(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:ur(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)})}),wr.prototype.eachLine=wr.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),He(t,e)||fi(t.display,e))return;re(e),G&&(as=+new Date);var i=Mi(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,C=Array(n),F=0,Y=function(){++F==n&&lr(t,function(){i=s(t.doc,i);var Ae={from:i,to:i,text:t.doc.splitLines(C.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Ae),zo(t.doc,Ei(s(t.doc,i),s(t.doc,Si(Ae))))})()},J=function(Ae,je){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,Ae.type)==-1){Y();return}var Ke=new FileReader;Ke.onerror=function(){return Y()},Ke.onload=function(){var Xe=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Xe)){Y();return}C[je]=Xe,Y()},Ke.readAsText(Ae)},q=0;q<r.length;q++)J(r[q],q);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()),ea(t.doc,Ei(i,i)),me)for(var De=0;De<me.length;++De)rn(t.doc,"",me[De].anchor,me[De].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function _l(e,t){if(G&&(!e.state.draggingText||+new Date-as<100)){de(t);return}if(He(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),T&&i.parentNode.removeChild(i)}}function Ll(e,t){var i=Mi(e,t);if(!i)return;var r=document.createDocumentFragment();yo(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(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 C=0;C<i.length;C++)e(i[C])})}var ls=!1;function kl(){if(ls)return;Dl(),ls=!0}function Dl(){var e;ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Rl)},100))}),ke(window,"blur",function(){return ss(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wi={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++)wi[On+48]=wi[On+96]=String(On);for(var ia=65;ia<=90;ia++)wi[ia]=String.fromCharCode(ia);for(var Pn=1;Pn<=12;Pn++)wi[Pn+111]=wi[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=l?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,C,F=0;F<t.length-1;F++){var Y=t[F];if(/^(cmd|meta|m)$/i.test(Y))C=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),C&&(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=he(i.split(" "),Ol),C=0;C<n.length;C++){var F=void 0,Y=void 0;C==n.length-1?(Y=n.join(" "),F=r):(Y=n.slice(0,C+1).join(" "),F="...");var J=t[Y];if(!J)t[Y]=F;else if(J!=F)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var q in t)e[q]=t[q];return e}function an(e,t,i,r){t=na(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 an(e,t.fallthrough,i,r);for(var C=0;C<t.fallthrough.length;C++){var F=an(e,t.fallthrough[C],i,r);if(F)return F}}}function us(e){var t=typeof e=="string"?e:wi[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),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(T&&e.keyCode==34&&e.char)return!1;var i=wi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function na(e){return typeof e=="string"?pi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var C=t(i[n]);r.length&&Tt(C.from,te(r).to)<=0;){var F=r.pop();if(Tt(F.from,C.from)<0){C.from=F.from;break}}r.push(C)}Rr(e,function(){for(var Y=r.length-1;Y>=0;Y--)rn(e.doc,"",r[Y].from,r[Y].to,"+delete");Ji(e)})}function Ua(e,t,i){var r=Be(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Ve(t.line,r,i<0?"after":"before")}function ja(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var C=Ze(i,t.doc.direction);if(C){var F=n<0?te(C):C[0],Y=n<0==(F.level==1),J=Y?"after":"before",q;if(F.level>0||t.doc.direction=="rtl"){var ce=Xi(t,i);q=n<0?i.text.length-1:0;var me=ii(t,ce,q).top;q=tt(function(De){return ii(t,ce,De).top==me},n<0==(F.level==1)?F.from:F.to-1,q),J=="before"&&(q=Ua(i,q,1))}else q=n<0?F.to:F.from;return new Ve(r,q,J)}}return new Ve(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 Fa(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 C=$e(n,i.ch,i.sticky),F=n[C];if(e.doc.direction=="ltr"&&F.level%2==0&&(r>0?F.to>i.ch:F.from<i.ch))return Fa(t,i,r);var Y=function(rt,st){return Ua(t,rt instanceof Ve?rt.ch:rt,st)},J,q=function(rt){return e.options.lineWrapping?(J=J||Xi(e,t),po(e,t,J,rt)):{begin:0,end:t.text.length}},ce=q(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||F.level==1){var me=F.level==1==r<0,De=Y(i,me?1:-1);if(De!=null&&(me?De<=F.to&&De<=ce.end:De>=F.from&&De>=ce.begin)){var Ae=me?"before":"after";return new Ve(i.line,De,Ae)}}var je=function(rt,st,it){for(var ht=function(Xt,dr){return dr?new Ve(i.line,Y(Xt,1),"before"):new Ve(i.line,Xt,"after")};rt>=0&&rt<n.length;rt+=st){var xt=n[rt],gt=st>0==(xt.level!=1),At=gt?it.begin:Y(it.end,-1);if(xt.from<=At&&At<xt.to)return ht(At,gt);if(At=gt?xt.from:Y(xt.to,-1),it.begin<=At&&At<it.end)return ht(At,gt)}},Ke=je(C+r,r,ce);if(Ke)return Ke;var Xe=r>0?ce.end:Y(ce.begin,-1);return Xe!=null&&!(r>0&&Xe==t.text.length)&&(Ke=je(r>0?0:n.length-1,r,q(Xe)),Ke)?Ke:null}var Mn={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=pt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:s(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(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 on(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(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(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")},we)},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")},we)},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/)?fs(e,t.head):r},we)},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 C=i[n].from(),F=$(e.getLine(C.line),C.ch,r);t.push(ue(r-F%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Rr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,C=pt(e.doc,n.line).text;if(C){if(n.ch==C.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(C.charAt(n.ch-1)+C.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var F=pt(e.doc,n.line-1).text;F&&(n=new Ve(n.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Ve(n.line-1,F.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Rr(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);Ji(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var i=pt(e.doc,t),r=Sr(i);return r!=i&&(t=Lt(r)),ja(!0,e,r,t,1)}function Il(e,t){var i=pt(e.doc,t),r=zi(i);return r!=i&&(t=Lt(r)),ja(!0,e,i,t,-1)}function fs(e,t){var i=cs(e,t.line),r=pt(e.doc,i.line),n=Ze(r,e.doc.direction);if(!n||n[0].level==0){var C=Math.max(i.ch,r.text.search(/\S/)),F=t.line==i.line&&t.ch<=C&&t.ch;return Ve(i.line,F?0:C,i.sticky)}return i}function aa(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)!=Re}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=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Bl=new ee;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(us(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())}),ps(e,n+" "+t,i,r))return!0}return ps(e,t,i,r)}function ps(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&pr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ta(e)),!!n}function ms(e,t){var i=hs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return aa(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):In(e,i,t,function(r){return aa(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),He(t,e))return;G&&j<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=ms(t,e);T&&(Wa=r?i:null,!r&&i==88&&!zt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!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)&&(m(t,"CodeMirror-crosshair"),Je(document,"keyup",i),Je(document,"mouseover",i))}ke(document,"keyup",i),ke(document,"mouseover",i)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),He(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||He(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(T&&i==Wa){Wa=null,re(e);return}if(T&&(!e.which||e.which<10)&&ms(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,Ha=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ha.prototype.compare=function(e,t,i){return this.time+jl>e&&Tt(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 Ha(i,e,t),Nn=null,"double"):(Nn=new Ha(i,e,t),Bn=null,"single")}function bs(e){var t=this,i=t.display;if(He(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){I||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Mi(t,e),n=Se(e),C=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,C,e))return;n==1?r?zl(t,r,C,e):Le(e)==i.scroller&&re(e):n==2?(r&&qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,i,r,n){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,In(e,ds(C,n),n,function(F){if(typeof F=="string"&&(F=Mn[F]),!F)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=F(e,i)!=Re}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var C=u?i.shiftKey&&i.metaKey:i.altKey;n.unit=C?"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=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(O(bo,e),0):e.curOp.focus=N();var n=Gl(e,i,r),C=e.doc.sel,F;e.options.dragDrop&&We&&!e.isReadOnly()&&i=="single"&&(F=C.contains(t))>-1&&(Tt((F=C.ranges[F]).from(),t)<0||t.xRel>0)&&(Tt(F.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,C=!1,F=lr(e,function(q){I&&(n.scroller.draggable=!1),e.state.draggingText=!1,Je(n.wrapper.ownerDocument,"mouseup",F),Je(n.wrapper.ownerDocument,"mousemove",Y),Je(n.scroller,"dragstart",J),Je(n.scroller,"drop",F),C||(re(q),r.addNew||qn(e.doc,i,null,null,r.extend),I&&!R||G&&j==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){C=C||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},J=function(){return C=!0};I&&(n.scroller.draggable=!0),e.state.draggingText=F,F.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),ke(n.wrapper.ownerDocument,"mouseup",F),ke(n.wrapper.ownerDocument,"mousemove",Y),ke(n.scroller,"dragstart",J),ke(n.scroller,"drop",F),xo(e),setTimeout(function(){return n.input.focus()},20)}function xs(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Ve(t.line,0),s(e.doc,Ve(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,C=e.doc;re(t);var F,Y,J=C.sel,q=J.ranges;if(r.addNew&&!r.extend?(Y=C.sel.contains(i),Y>-1?F=q[Y]:F=new jt(i,i)):(F=C.sel.primary(),Y=C.sel.primIndex),r.unit=="rectangle")r.addNew||(F=new jt(i,i)),i=Mi(e,t,!0,!0),Y=-1;else{var ce=xs(e,i,r.unit);r.extend?F=Na(F,ce.anchor,ce.head,r.extend):F=ce}r.addNew?Y==-1?(Y=q.length,gr(C,Qr(e,q.concat([F]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(gr(C,Qr(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=C.sel):Ba(C,Y,F,Ce):(Y=0,gr(C,new jr([F],0),Ce),J=C.sel);var me=i;function De(it){if(Tt(me,it)==0)return;if(me=it,r.unit=="rectangle"){for(var ht=[],xt=e.options.tabSize,gt=$(pt(C,i.line).text,i.ch,xt),At=$(pt(C,it.line).text,it.ch,xt),Xt=Math.min(gt,At),dr=Math.max(gt,At),$t=Math.min(i.line,it.line),Or=Math.min(e.lastLine(),Math.max(i.line,it.line));$t<=Or;$t++){var Ar=pt(C,$t).text,rr=Te(Ar,Xt,xt);Xt==dr?ht.push(new jt(Ve($t,rr),Ve($t,rr))):Ar.length>rr&&ht.push(new jt(Ve($t,rr),Ve($t,Te(Ar,dr,xt))))}ht.length||ht.push(new jt(i,i)),gr(C,Qr(e,J.ranges.slice(0,Y).concat(ht),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(it)}else{var _r=F,mr=xs(e,it,r.unit),or=_r.anchor,ir;Tt(mr.anchor,or)>0?(ir=mr.head,or=Li(_r.from(),mr.anchor)):(ir=mr.anchor,or=hi(_r.to(),mr.head));var Jt=J.ranges.slice(0);Jt[Y]=Xl(e,new jt(s(C,or),ir)),gr(C,Qr(e,Jt,Y),Ce)}}var Ae=n.wrapper.getBoundingClientRect(),je=0;function Ke(it){var ht=++je,xt=Mi(e,it,!0,r.unit=="rectangle");if(!xt)return;if(Tt(xt,me)!=0){e.curOp.focus=N(),De(xt);var gt=Xn(n,C);(xt.line>=gt.to||xt.line<gt.from)&&setTimeout(lr(e,function(){je==ht&&Ke(it)}),150)}else{var At=it.clientY<Ae.top?-20:it.clientY>Ae.bottom?20:0;At&&setTimeout(lr(e,function(){if(je!=ht)return;n.scroller.scrollTop+=At,Ke(it)}),50)}}function Xe(it){e.state.selectingText=!1,je=Infinity,it&&(re(it),n.input.focus()),Je(n.wrapper.ownerDocument,"mousemove",rt),Je(n.wrapper.ownerDocument,"mouseup",st),C.history.lastSelOrigin=null}var rt=lr(e,function(it){it.buttons===0||!Se(it)?Xe(it):Ke(it)}),st=lr(e,Xe);e.state.selectingText=st,ke(n.wrapper.ownerDocument,"mousemove",rt),ke(n.wrapper.ownerDocument,"mouseup",st)}function Xl(e,t){var i=t.anchor,r=t.head,n=pt(e.doc,i.line);if(Tt(i,r)==0&&i.sticky==r.sticky)return t;var C=Ze(n);if(!C)return t;var F=$e(C,i.ch,i.sticky),Y=C[F];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var J=F+(Y.from==i.ch==(Y.level!=1)?0:1);if(J==0||J==C.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=$e(C,r.ch,r.sticky),me=ce-F||(r.ch-i.ch)*(Y.level==1?-1:1);ce==J-1||ce==J?q=me<0:q=me>0}var De=C[J+(q?-1:0)],Ae=q==(De.level==1),je=Ae?De.from:De.to,Ke=Ae?"after":"before";return i.ch==je&&i.sticky==Ke?t:new jt(new Ve(i.line,je,Ke),r)}function Es(e,t,i,r){var n,C;if(t.touches)n=t.touches[0].clientX,C=t.touches[0].clientY;else try{n=t.clientX,C=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var F=e.display,Y=F.lineDiv.getBoundingClientRect();if(C>Y.bottom||!pe(e,i))return se(t);C-=Y.top-F.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var q=F.gutters.childNodes[J];if(q&&q.getBoundingClientRect().right>=n){var ce=Mr(e.doc,C),me=e.display.gutterSpecs[J];return Ie(e,i,e,ce,me.className,t),se(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Ss(e,t){if(fi(e.display,t)||Yl(e,t))return;if(He(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return pe(e,"gutterContextMenu")?Es(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 sn={toString:function(){return"CodeMirror.Init"}},Cs={},oa={};function $l(e){var t=e.optionHandlers;function i(r,n,C,F){e.defaults[r]=n,C&&(t[r]=F?function(Y,J,q){q!=sn&&C(Y,J,q)}:C)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Pa(r)},!0),i("indentUnit",2,Pa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Cr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var C=[],F=r.doc.first;r.doc.iter(function(J){for(var q=0;;){var ce=J.text.indexOf(n,q);if(ce==-1)break;q=ce+n.length,C.push(Ve(F,ce))}F++});for(var Y=C.length-1;Y>=0;Y--)rn(r.doc,n,C[Y],Ve(C[Y].line,C[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,C){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),C!=sn&&r.refresh()}),i("specialCharPlaceholder",Bt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"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",!A),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Cn(r)},!0),i("keyMap","default",function(r,n,C){var F=na(n),Y=C!=sn&&na(C);Y&&Y.detach&&Y.detach(r,F),F.attach&&F.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),Cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){Ao(r),Qi(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=Ra(r.options.gutters,n),Cn(r)},!0),i("firstLineNumber",1,Cn,!0),i("lineNumberFormatter",function(r){return r},Cn,!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,Zl),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 Zl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,C=t?ke:Je;C(e.display.scroller,"dragstart",n.start),C(e.display.scroller,"dragenter",n.enter),C(e.display.scroller,"dragover",n.over),C(e.display.scroller,"dragleave",n.leave),C(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):(m(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Sa(e),Cr(e),vn(e),setTimeout(function(){return Qi(e)},100)}function Yt(e,t){var i=this;if(!(this instanceof Yt))return new Yt(e,t);this.options=t=t?M(t):{},M(Cs,t,!1);var r=t.value;typeof r=="string"?r=new wr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Yt.inputStyles[t.inputStyle](this),C=this.display=new dl(e,r,n,t);C.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!o&&C.input.focus(),G&&j<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),Ui(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ca(i)},20):Zi(this);for(var F in oa)oa.hasOwnProperty(F)&&oa[F](this,t[F],sn);ko(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<za.length;++Y)za[Y](this);Fi(this),I&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}Yt.defaults=Cs,Yt.optionHandlers=oa;function Ql(e){var t=e.display;ke(t.scroller,"mousedown",lr(e,bs)),G&&j<11?ke(t.scroller,"dblclick",lr(e,function(J){if(He(e,J))return;var q=Mi(e,J);if(!q||Ga(e,J)||fi(e.display,J))return;re(J);var ce=e.findWordAt(q);qn(e.doc,ce.anchor,ce.head)})):ke(t.scroller,"dblclick",function(J){return He(e,J)||re(J)}),ke(t.scroller,"contextmenu",function(J){return Ss(e,J)}),ke(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Ss(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 C(J){if(J.touches.length!=1)return!1;var q=J.touches[0];return q.radiusX<=1&&q.radiusY<=1}function F(J,q){if(q.left==null)return!0;var ce=q.left-J.left,me=q.top-J.top;return ce*ce+me*me>20*20}ke(t.scroller,"touchstart",function(J){if(!He(e,J)&&!C(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(i);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function(J){var q=t.activeTouch;if(q&&!fi(t,J)&&q.left!=null&&!q.moved&&new Date-q.start<300){var ce=e.coordsChar(t.activeTouch,"page"),me;!q.prev||F(q,q.prev)?me=new jt(ce,ce):!q.prev.prev||F(q,q.prev.prev)?me=e.findWordAt(ce):me=new jt(Ve(ce.line,0),s(e.doc,Ve(ce.line+1,0))),e.setSelection(me.anchor,me.head),e.focus(),re(J)}n()}),ke(t.scroller,"touchcancel",n),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),Ie(e,"scroll",e))}),ke(t.scroller,"mousewheel",function(J){return Oo(e,J)}),ke(t.scroller,"DOMMouseScroll",function(J){return Oo(e,J)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){He(e,J)||de(J)},over:function(J){He(e,J)||(Ll(e,J),de(J))},start:function(J){return _l(e,J)},drop:lr(e,Al),leave:function(J){He(e,J)||os(e)}};var Y=t.input.getField();ke(Y,"keyup",function(J){return vs.call(e,J)}),ke(Y,"keydown",lr(e,gs)),ke(Y,"keypress",lr(e,ys)),ke(Y,"focus",function(J){return Ca(e,J)}),ke(Y,"blur",function(J){return Zi(e,J)})}var za=[];Yt.defineInitHook=function(e){return za.push(e)};function Un(e,t,i,r){var n=e.doc,C;i==null&&(i="add"),i=="smart"&&(n.mode.indent?C=Qe(e,t).state:i="prev");var F=e.options.tabSize,Y=pt(n,t),J=$(Y.text,null,F);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(Y.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(C,Y.text.slice(q.length),Y.text),ce==Re||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=$(pt(n,t-1).text,null,F):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="",De=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(ce/F);Ae;--Ae)De+=F,me+=" ";if(De<ce&&(me+=ue(ce-De)),me!=q)return rn(n,me,Ve(t,0),Ve(t,q.length),"+input"),Y.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<q.length){var Xe=Ve(t,q.length);Ba(n,je,new jt(Xe,Xe));break}}}var qr=null;function sa(e){qr=e}function Ka(e,t,i,r,n){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var F=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>F,J=St(t),q=null;if(Y&&r.ranges.length>1)if(qr&&qr.text.join(`
`)==t){if(r.ranges.length%qr.text.length==0){q=[];for(var ce=0;ce<qr.text.length;ce++)q.push(C.splitLines(qr.text[ce]))}}else J.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=he(J,function(rt){return[rt]}));for(var me=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var Ae=r.ranges[De],je=Ae.from(),Ke=Ae.to();Ae.empty()&&(i&&i>0?je=Ve(je.line,je.ch-i):e.state.overwrite&&!Y?Ke=Ve(Ke.line,Math.min(pt(C,Ke.line).text.length,Ke.ch+te(J).length)):Y&&qr&&qr.lineWise&&qr.text.join(`
`)==J.join(`
`)&&(je=Ke=Ve(je.line,0)));var Xe={from:je,to:Ke,text:q?q[De%q.length]:J,origin:n||(Y?"paste":e.state.cutIncoming>F?"cut":"+input")};tn(e.doc,Xe),pr(e,"inputRead",e,Xe)}t&&!Y&&As(e,t),Ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Rr(t,function(){return Ka(t,i,0,null,"paste")}),!0}function As(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 C=e.getModeAt(n.head),F=!1;if(C.electricChars){for(var Y=0;Y<C.electricChars.length;Y++)if(t.indexOf(C.electricChars.charAt(Y))>-1){F=Un(e,n.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(pt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(F=Un(e,n.head.line,"smart")));F&&pr(e,"electricInput",e,n.head.line)}}function _s(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,C={anchor:Ve(n,0),head:Ve(n+1,0)};i.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:i}}function Ls(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return I?e.style.width="1000px":e.setAttribute("wrap","off"),S&&(e.style.border="1px solid black"),Ls(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 C=this.options,F=C[r];if(C[r]==n&&r!="mode")return;C[r]=n,t.hasOwnProperty(r)&&lr(this,t[r])(this,n,F),Ie(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"](na(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,C=0;C<n.length;++C)if(n[C]==r||n[C].name==r)return n.splice(C,1),!0},addOverlay:yr(function(r,n){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:C,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(F){return F.priority}),this.state.modeGen++,Cr(this)}),removeOverlay:yr(function(r){for(var n=this.state.overlays,C=0;C<n.length;++C){var F=n[C].modeSpec;if(F==r||typeof r=="string"&&F.name==r){n.splice(C,1),this.state.modeGen++,Cr(this);return}}}),indentLine:yr(function(r,n,C){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Xr(this.doc,r)&&Un(this,r,n,C)}),indentSelection:yr(function(r){for(var n=this.doc.sel.ranges,C=-1,F=0;F<n.length;F++){var Y=n[F];if(Y.empty())Y.head.line>C&&(Un(this,Y.head.line,r,!0),C=Y.head.line,F==this.doc.sel.primIndex&&Ji(this));else{var J=Y.from(),q=Y.to(),ce=Math.max(C,J.line);C=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var me=ce;me<C;++me)Un(this,me,r);var De=this.doc.sel.ranges;J.ch==0&&n.length==De.length&&De[F].from().ch>0&&Ba(this.doc,F,new jt(J,De[F].to()),Ee)}}}),getTokenAt:function(r,n){return Vt(this,r,n)},getLineTokens:function(r,n){return Vt(this,Ve(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=Ge(this,pt(this.doc,r.line)),C=0,F=(n.length-1)/2,Y=r.ch,J;if(Y==0)J=n[2];else for(;;){var q=C+F>>1;if((q?n[q*2-1]:0)>=Y)F=q;else if(n[q*2+1]<Y)C=q+1;else{J=n[q*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 C=[];if(!i.hasOwnProperty(n))return C;var F=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")F[Y[n]]&&C.push(F[Y[n]]);else if(Y[n])for(var J=0;J<Y[n].length;J++){var q=F[Y[n][J]];q&&C.push(q)}else Y.helperType&&F[Y.helperType]?C.push(F[Y.helperType]):F[Y.name]&&C.push(F[Y.name]);for(var ce=0;ce<F._global.length;ce++){var me=F._global[ce];me.pred(Y,this)&&oe(C,me.val)==-1&&C.push(me.val)}return C},getStateAfter:function(r,n){var C=this.doc;return r=z(C,r==null?C.first+C.size-1:r),Qe(this,r+1,n).state},cursorCoords:function(r,n){var C,F=this.doc.sel.primary();return r==null?C=F.head:typeof r=="object"?C=s(this.doc,r):C=r?F.from():F.to(),Jr(this,C,n||"page")},charCoords:function(r,n){return ga(this,s(this.doc,r),n||"page")},coordsChar:function(r,n){return r=ho(this,r,n||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,n){return r=ho(this,{top:r,left:0},n||"page").top,Mr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,C){var F=!1,Y;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,F=!0),Y=pt(this.doc,r)}else Y=r;return Gn(this,Y,{top:0,left:0},n||"page",C||F).top+(F?this.doc.height-Zr(Y):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,C,F,Y){var J=this.display;r=Jr(this,s(this.doc,r));var q=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),F=="over")q=r.top;else if(F=="above"||F=="near"){var me=Math.max(J.wrapper.clientHeight,this.doc.height),De=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(F=="above"||r.bottom+n.offsetHeight>me)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=me&&(q=r.bottom),ce+n.offsetWidth>De&&(ce=De-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",Y=="right"?(ce=J.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?ce=0:Y=="middle"&&(ce=(J.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),C&&Zs(this,{left:ce,top:q,right:ce+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:yr(gs),triggerOnKeyPress:yr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:yr(bs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:yr(function(r){As(this,r)}),findPosH:function(r,n,C,F){var Y=1;n<0&&(Y=-1,n=-n);for(var J=s(this.doc,r),q=0;q<n&&!(J=Va(this.doc,J,Y,C,F),J.hitSide);++q);return J},moveH:yr(function(r,n){var C=this;this.extendSelectionsBy(function(F){return C.display.shift||C.doc.extend||F.empty()?Va(C.doc,F.head,r,n,C.options.rtlMoveVisually):r<0?F.from():F.to()},we)}),deleteH:yr(function(r,n){var C=this.doc.sel,F=this.doc;C.somethingSelected()?F.replaceSelection("",null,"+delete"):on(this,function(Y){var J=Va(F,Y.head,r,n,!1);return r<0?{from:J,to:Y.head}:{from:Y.head,to:J}})}),findPosV:function(r,n,C,F){var Y=1,J=F;n<0&&(Y=-1,n=-n);for(var q=s(this.doc,r),ce=0;ce<n;++ce){var me=Jr(this,q,"div");if(J==null?J=me.left:me.left=J,q=Ds(this,me,Y,C),q.hitSide)break}return q},moveV:yr(function(r,n){var C=this,F=this.doc,Y=[],J=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(ce){if(J)return r<0?ce.from():ce.to();var me=Jr(C,ce.head,"div");ce.goalColumn!=null&&(me.left=ce.goalColumn),Y.push(me.left);var De=Ds(C,me,r,n);return n=="page"&&ce==F.sel.primary()&&Aa(C,ga(C,De,"div").top-me.top),De},we),Y.length)for(var q=0;q<F.sel.ranges.length;q++)F.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(r){var n=this.doc,C=pt(n,r.line).text,F=r.ch,Y=r.ch;if(C){var J=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==C.length)&&F?--F:++Y;for(var q=C.charAt(F),ce=Me(q,J)?function(me){return Me(me,J)}:/\s/.test(q)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!Me(me)};F>0&&ce(C.charAt(F-1));)--F;for(;Y<C.length&&ce(C.charAt(Y));)++Y}return new jt(Ve(r.line,F),Ve(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),Ie(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:yr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ri(this)-this.display.barHeight,width:r.scrollWidth-ri(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Oi(this)}},scrollIntoView:yr(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:Ve(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):So(this,r.from,r.to,r.margin)}),setSize:yr(function(r,n){var C=this,F=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};r!=null&&(this.display.wrapper.style.width=F(r)),n!=null&&(this.display.wrapper.style.height=F(n)),this.options.lineWrapping&&so(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(J){if(J.widgets){for(var q=0;q<J.widgets.length;q++)if(J.widgets[q].noHScroll){bi(C,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Ie(this,"refresh",this)}),operation:function(r){return Rr(this,r)},startOperation:function(){return Ui(this)},endOperation:function(){return Fi(this)},refresh:yr(function(){var r=this.display.cachedTextHeight;Cr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&Sa(this),Ie(this,"refresh",this)}),swapDoc:yr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,pr(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}},be(e),e.registerHelper=function(r,n,C){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=C},e.registerGlobalHelper=function(r,n,C,F){e.registerHelper(r,n,F),i[r]._global.push({pred:C,val:F})}}function Va(e,t,i,r,n){var C=t,F=i,Y=pt(e,t.line),J=n&&e.direction=="rtl"?-i:i;function q(){var st=t.line+J;return st<e.first||st>=e.first+e.size?!1:(t=new Ve(st,t.ch,t.sticky),Y=pt(e,st))}function ce(st){var it;if(r=="codepoint"){var ht=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ht)?it=null:it=new Ve(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(ht>=55296&&ht<56320?2:1))),-i)}else n?it=Ml(e.cm,Y,t,i):it=Fa(Y,t,i);if(it==null)if(!st&&q())t=ja(n,e.cm,Y,t.line,J);else return!1;else t=it;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var me=null,De=r=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(i<0&&!ce(!je));je=!1){var Ke=Y.text.charAt(t.ch)||`
`,Xe=Me(Ke,Ae)?"w":De&&Ke==`
`?"n":!De||/\s/.test(Ke)?null:"p";if(De&&!je&&!Xe&&(Xe="s"),me&&me!=Xe){i<0&&(i=1,ce(),t.sticky="after");break}if(Xe&&(me=Xe),i>0&&!ce(!je))break}var rt=ta(e,t,C,F,!0);return di(C,rt)&&(rt.hitSide=!0),rt}function Ds(e,t,i,r){var n=e.doc,C=t.left,F;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Y-.5*Yi(e.display),3);F=(i>0?t.bottom:t.top)+i*J}else r=="line"&&(F=i>0?t.bottom+3:t.top-3);for(var q;!(q=ya(e,C,F),!q.outside);){if(i<0?F<=0:F>=n.height){q.hitSide=!0;break}F+=i*5}return q}var Gt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,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;Ls(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(Y){for(var J=Y.target;J;J=J.parentNode){if(J==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}ke(n,"paste",function(Y){if(!C(Y)||He(r,Y)||ws(Y,r))return;j<=11&&setTimeout(lr(r,function(){return t.updateFromDOM()}),20)}),ke(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),ke(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),ke(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(n,"touchstart",function(){return i.forceCompositionEnd()}),ke(n,"input",function(){t.composing||t.readFromDOMSoon()});function F(Y){if(!C(Y)||He(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=_s(r);sa({lineWise:!0,text:J.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,Ee),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=qr.text.join(`
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var ce=ks(),me=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),me.value=qr.text.join(`
`);var De=document.activeElement;V(me),setTimeout(function(){r.display.lineSpace.removeChild(ce),De.focus(),De==n&&i.showPrimarySelection()},50)}ke(n,"copy",F),ke(n,"cut",F)},Gt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=vo(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 C=la(t,e.anchorNode,e.anchorOffset),F=la(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&F&&!F.bad&&Tt(Li(C,F),r)==0&&Tt(hi(C,F),n)==0)return;var Y=t.display.view,J=r.line>=t.display.viewFrom&&Rs(t,r)||{node:Y[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&Rs(t,n);if(!q){var ce=Y[Y.length-1].measure,me=ce.maps?ce.maps[ce.maps.length-1]:ce.map;q={node:me[me.length-1],offset:me[me.length-2]-me[me.length-3]}}if(!J||!q){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=y(J.node,J.offset,q.offset,q.node)}catch(je){}Ae&&(!D&&t.state.focused?(e.collapse(J.node,J.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),De&&e.anchorNode==null?e.addRange(De):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){d(this.cm.display.cursorDiv,e.cursors),d(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 E(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():Rr(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(h&&v&&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=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);i&&r&&Rr(t,function(){gr(t.doc,Ei(i,r),Ee),(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=Ve(r.line-1,pt(e.doc,r.line-1).length)),n.ch==pt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var C,F,Y;r.line==t.viewFrom||(C=Ii(e,r.line))==0?(F=Lt(t.view[0].line),Y=t.view[0].node):(F=Lt(t.view[C].line),Y=t.view[C-1].node.nextSibling);var J=Ii(e,n.line),q,ce;if(J==t.view.length-1?(q=t.viewTo-1,ce=t.lineDiv.lastChild):(q=Lt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!Y)return!1;for(var me=e.doc.splitLines(tu(e,Y,ce,F,q)),De=Pr(e.doc,Ve(F,0),Ve(q,pt(e.doc,q).text.length));me.length>1&&De.length>1;)if(te(me)==te(De))me.pop(),De.pop(),q--;else if(me[0]==De[0])me.shift(),De.shift(),F++;else break;for(var Ae=0,je=0,Ke=me[0],Xe=De[0],rt=Math.min(Ke.length,Xe.length);Ae<rt&&Ke.charCodeAt(Ae)==Xe.charCodeAt(Ae);)++Ae;for(var st=te(me),it=te(De),ht=Math.min(st.length-(me.length==1?Ae:0),it.length-(De.length==1?Ae:0));je<ht&&st.charCodeAt(st.length-je-1)==it.charCodeAt(it.length-je-1);)++je;if(me.length==1&&De.length==1&&F==r.line)for(;Ae&&Ae>r.ch&&st.charCodeAt(st.length-je-1)==it.charCodeAt(it.length-je-1);)Ae--,je++;me[me.length-1]=st.slice(0,st.length-je).replace(/^\u200b+/,""),me[0]=me[0].slice(Ae).replace(/\u200b+$/,"");var xt=Ve(F,Ae),gt=Ve(q,De.length?te(De).length-je:0);if(me.length>1||me[0]||Tt(xt,gt))return rn(e.doc,me,xt,gt,"+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())&&Rr(this.cm,function(){return Cr(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()||lr(this.cm,Ka)(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 Rs(e,t){var i=pa(e,t.line);if(!i||i.hidden)return null;var r=pt(e.doc,t.line),n=ro(i,r,t.line),C=Ze(r,e.doc.direction),F="left";if(C){var Y=$e(C,t.ch);F=Y%2?"right":"left"}var J=ao(n.map,t.ch,F);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 ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var C="",F=!1,Y=e.doc.lineSeparator(),J=!1;function q(Ae){return function(je){return je.id==Ae}}function ce(){F&&(C+=Y,J&&(C+=Y),F=J=!1)}function me(Ae){Ae&&(ce(),C+=Ae)}function De(Ae){if(Ae.nodeType==1){var je=Ae.getAttribute("cm-text");if(je){me(je);return}var Ke=Ae.getAttribute("cm-marker"),Xe;if(Ke){var rt=e.findMarks(Ve(r,0),Ve(n+1,0),q(+Ke));rt.length&&(Xe=rt[0].find(0))&&me(Pr(e.doc,Xe.from,Xe.to).join(Y));return}if(Ae.getAttribute("contenteditable")=="false")return;var st=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;st&&ce();for(var it=0;it<Ae.childNodes.length;it++)De(Ae.childNodes[it]);/^(pre|p)$/i.test(Ae.nodeName)&&(J=!0),st&&(F=!0)}else Ae.nodeType==3&&me(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,J=!1;return C}function la(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ve(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 C=e.display.view[n];if(C.node==r)return ru(C,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!E(r,t))return ln(Ve(Lt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var C=e.rest?te(e.rest):e.line;return ln(Ve(Lt(C),C.text.length),n)}var F=t.nodeType==3?t:null,Y=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,i&&(i=F.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var J=e.measure,q=J.maps;function ce(Xe,rt,st){for(var it=-1;it<(q?q.length:0);it++)for(var ht=it<0?J.map:q[it],xt=0;xt<ht.length;xt+=3){var gt=ht[xt+2];if(gt==Xe||gt==rt){var At=Lt(it<0?e.line:e.rest[it]),Xt=ht[xt]+st;return(st<0||gt!=Xe)&&(Xt=ht[xt+(st?1:0)]),Ve(At,Xt)}}}var me=ce(F,Y,i);if(me)return ln(me,n);for(var De=Y.nextSibling,Ae=F?F.nodeValue.length-i:0;De;De=De.nextSibling){if(me=ce(De,De.firstChild,0),me)return ln(Ve(me.line,me.ch-Ae),n);Ae+=De.textContent.length}for(var je=Y.previousSibling,Ke=i;je;je=je.previousSibling){if(me=ce(je,je.firstChild,-1),me)return ln(Ve(me.line,me.ch+Ke),n);Ke+=je.textContent.length}}var qt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};qt.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),S&&(n.style.width="0px"),ke(n,"input",function(){G&&j>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ke(n,"paste",function(F){if(He(r,F)||ws(F,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function C(F){if(He(r,F))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=_s(r);sa({lineWise:!0,text:Y.text}),F.type=="cut"?r.setSelections(Y.ranges,null,Ee):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;F.type=="cut"&&(r.state.cutIncoming=+new Date)}ke(n,"cut",C),ke(n,"copy",C),ke(e.scroller,"paste",function(F){if(fi(e,F)||He(r,F))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=F.clipboardData,n.dispatchEvent(Y)}),ke(e.lineSpace,"selectstart",function(F){fi(e,F)||re(F)}),ke(n,"compositionstart",function(){var F=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:F,range:r.markText(F,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ke(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},qt.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},qt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+F.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+F.left-C.left))}return r},qt.prototype.showSelection=function(e){var t=this.cm,i=t.display;d(i.cursorDiv,e.cursors),d(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qt.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&&V(this.textarea),G&&j>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&j>=9&&(this.hasSelection=null))},qt.prototype.getField=function(){return this.textarea},qt.prototype.supportsTouch=function(){return!1},qt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},qt.prototype.blur=function(){this.textarea.blur()},qt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qt.prototype.receivedFocus=function(){this.slowPoll()},qt.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()})},qt.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)},qt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ct(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(G&&j>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=n.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,Y=Math.min(r.length,n.length);F<Y&&r.charCodeAt(F)==n.charCodeAt(F);)++F;return Rr(t,function(){Ka(t,n.slice(F),r.length-F,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},qt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qt.prototype.onKeyPress=function(){G&&j>=9&&(this.hasSelection=null),this.fastPoll()},qt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=Mi(i,e),F=r.scroller.scrollTop;if(!C||T)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(C)==-1&&lr(i,gr)(i.doc,Ei(C),Ee);var J=n.style.cssText,q=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: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var me;I&&(me=window.scrollY),r.input.focus(),I&&window.scrollTo(null,me),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var Ke=i.somethingSelected(),Xe="\u200B"+(Ke?n.value:"");n.value="\u21DA",n.value=Xe,t.prevInput=Ke?"":"\u200B",n.selectionStart=1,n.selectionEnd=Xe.length,r.selForContextMenu=i.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=J,G&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=F),n.selectionStart!=null){(!G||G&&j<9)&&De();var Ke=0,Xe=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?lr(i,$o)(i):Ke++<10?r.detectingSelectAll=setTimeout(Xe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Xe,200)}}if(G&&j>=9&&De(),L){de(e);var je=function(){Je(window,"mouseup",je),setTimeout(Ae,20)};ke(window,"mouseup",je)}else setTimeout(Ae,50)},qt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qt.prototype.setUneditable=function(){},qt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?M(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=N();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(ke(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var C=e.form;n=C.submit;try{var F=C.submit=function(){r(),C.submit=n,C.submit(),C.submit=F}}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&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Yt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function nu(e){e.off=Je,e.on=ke,e.wheelEventPixels=hl,e.Doc=wr,e.splitLines=St,e.countColumn=$,e.findColumn=Te,e.isWordChar=Pe,e.Pass=Re,e.signal=Ie,e.Line=Ri,e.changeEnd=Si,e.scrollbarModel=wo,e.Pos=Ve,e.cmpPos=Tt,e.modes=Wt,e.mimeModes=_t,e.resolveMode=vt,e.getMode=Vr,e.modeExtensions=nr,e.extendMode=cr,e.copyState=Hr,e.startState=si,e.innerMode=oi,e.commands=Mn,e.keyMap=pi,e.keyName=hs,e.isModifierKey=us,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=Rn,e.TextMarker=Ci,e.LineWidget=Dn,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=de,e.addClass=U,e.contains=E,e.rmClass=m,e.keyNames=wi}$l(Yt),ql(Yt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in wr.prototype)wr.prototype.hasOwnProperty(ua)&&oe(au,ua)<0&&(Yt.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(wr.prototype[ua]));return be(wr),Yt.inputStyles={textarea:qt,contenteditable:Gt},Yt.defineMode=function(e){!Yt.defaults.mode&&e!="null"&&(Yt.defaults.mode=e),Wr.apply(this,arguments)},Yt.defineMIME=ai,Yt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yt.defineMIME("text/plain","null"),Yt.defineExtension=function(e,t){Yt.prototype[e]=t},Yt.defineDocExtension=function(e,t){wr.prototype[e]=t},Yt.fromTextArea=iu,nu(Yt),Yt.version="5.58.2",Yt})},Y1PL:function(bt,qe,ie){"use strict";ie.r(qe),ie.d(qe,"ResizableTextArea",function(){return oe});var le=ie("wx14"),Q=ie("1OyB"),D=ie("vuIU"),Z=ie("Ji7U"),B=ie("LK+K"),P=ie("q1tI"),G=ie("VTBJ"),j=ie("rePB"),I=ie("Zm9Q"),k=ie("Kwbf"),v=ie("c+Xe"),T=ie("m+aA"),R=ie("bdgK"),_=new Map;function w(Ee){Ee.forEach(function(Ce){var we,Te=Ce.target;(we=_.get(Te))===null||we===void 0||we.forEach(function(ge){return ge(Te)})})}var S=new R.default(w),h=null,o=null;function l(Ee,Ce){_.has(Ee)||(_.set(Ee,new Set),S.observe(Ee)),_.get(Ee).add(Ce)}function u(Ee,Ce){_.has(Ee)&&(_.get(Ee).delete(Ce),_.get(Ee).size||(S.unobserve(Ee),_.delete(Ee)))}var A=function(Ee){Object(Z.a)(we,Ee);var Ce=Object(B.a)(we);function we(){return Object(Q.a)(this,we),Ce.apply(this,arguments)}return Object(D.a)(we,[{key:"render",value:function(){return this.props.children}}]),we}(P.Component),p=P.createContext(null);function f(Ee){var Ce=Ee.children,we=Ee.onBatchResize,Te=P.useRef(0),ge=P.useRef([]),ue=P.useContext(p),te=P.useCallback(function(he,ae,_e){Te.current+=1;var Oe=Te.current;ge.current.push({size:he,element:ae,data:_e}),Promise.resolve().then(function(){Oe===Te.current&&(we==null||we(ge.current),ge.current=[])}),ue==null||ue(he,ae,_e)},[we,ue]);return P.createElement(p.Provider,{value:te},Ce)}function L(Ee){var Ce=Ee.children,we=Ee.disabled,Te=P.useRef(null),ge=P.useRef(null),ue=P.useContext(p),te=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=P.isValidElement(Ce)&&Object(v.c)(Ce),ae=he?Ce.ref:null,_e=P.useMemo(function(){return Object(v.a)(ae,Te)},[ae,Te]),Oe=P.useRef(Ee);Oe.current=Ee;var ye=P.useCallback(function(Pe){var Me=Oe.current,Ne=Me.onResize,Fe=Me.data,Ue=Pe.getBoundingClientRect(),Be=Ue.width,tt=Ue.height,et=Pe.offsetWidth,Ye=Pe.offsetHeight,$e=Math.floor(Be),lt=Math.floor(tt);if(te.current.width!==$e||te.current.height!==lt||te.current.offsetWidth!==et||te.current.offsetHeight!==Ye){var Ze={width:$e,height:lt,offsetWidth:et,offsetHeight:Ye};te.current=Ze;var ot=et===Math.round(Be)?Be:et,ke=Ye===Math.round(tt)?tt:Ye,nt=Object(G.a)(Object(G.a)({},Ze),{},{offsetWidth:ot,offsetHeight:ke});ue==null||ue(nt,Pe,Fe),Ne&&Promise.resolve().then(function(){Ne(nt,Pe)})}},[]);return P.useEffect(function(){var Pe=Object(T.a)(Te.current)||Object(T.a)(ge.current);return Pe&&!we&&l(Pe,ye),function(){return u(Pe,ye)}},[Te.current,we]),P.createElement(A,{ref:ge},he?P.cloneElement(Ce,{ref:_e}):Ce)}var b="rc-observer-key";function m(Ee){var Ce=Ee.children,we=Object(I.a)(Ce);return we.map(function(Te,ge){var ue=(Te==null?void 0:Te.key)||"".concat(b,"-").concat(ge);return P.createElement(L,Object(le.a)({},Ee,{key:ue}),Te)})}m.Collection=f;var c=m,d=ie("bT9E"),a=ie("TSYQ"),x=ie.n(a),y=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,E=["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"],N={},U;function K(Ee){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(Ce&&N[we])return N[we];var Te=window.getComputedStyle(Ee),ge=Te.getPropertyValue("box-sizing")||Te.getPropertyValue("-moz-box-sizing")||Te.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Te.getPropertyValue("padding-bottom"))+parseFloat(Te.getPropertyValue("padding-top")),te=parseFloat(Te.getPropertyValue("border-bottom-width"))+parseFloat(Te.getPropertyValue("border-top-width")),he=E.map(function(_e){return"".concat(_e,":").concat(Te.getPropertyValue(_e))}).join(";"),ae={sizingStyle:he,paddingSize:ue,borderSize:te,boxSizing:ge};return Ce&&we&&(N[we]=ae),ae}function V(Ee){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Te=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)),Ee.getAttribute("wrap")?U.setAttribute("wrap",Ee.getAttribute("wrap")):U.removeAttribute("wrap");var ge=K(Ee,Ce),ue=ge.paddingSize,te=ge.borderSize,he=ge.boxSizing,ae=ge.sizingStyle;U.setAttribute("style","".concat(ae,";").concat(y)),U.value=Ee.value||Ee.placeholder||"";var _e=Number.MIN_SAFE_INTEGER,Oe=Number.MAX_SAFE_INTEGER,ye=U.scrollHeight,Pe;if(he==="border-box"?ye+=te:he==="content-box"&&(ye-=ue),we!==null||Te!==null){U.value=" ";var Me=U.scrollHeight-ue;we!==null&&(_e=Me*we,he==="border-box"&&(_e=_e+ue+te),ye=Math.max(_e,ye)),Te!==null&&(Oe=Me*Te,he==="border-box"&&(Oe=Oe+ue+te),Pe=ye>Oe?"":"hidden",ye=Math.min(Oe,ye))}return{height:ye,minHeight:_e,maxHeight:Oe,overflowY:Pe,resize:"none"}}var O=ie("Gytx"),M=ie.n(O),$;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})($||($={}));var ee=function(Ee){Object(Z.a)(we,Ee);var Ce=Object(B.a)(we);function we(Te){var ge;return Object(Q.a)(this,we),ge=Ce.call(this,Te),ge.nextFrameActionId=void 0,ge.resizeFrameId=void 0,ge.textArea=void 0,ge.saveTextArea=function(ue){ge.textArea=ue},ge.handleResize=function(ue){var te=ge.state.resizeStatus,he=ge.props,ae=he.autoSize,_e=he.onResize;if(te!==$.NONE)return;typeof _e=="function"&&_e(ue),ae&&ge.resizeOnNextFrame()},ge.resizeOnNextFrame=function(){cancelAnimationFrame(ge.nextFrameActionId),ge.nextFrameActionId=requestAnimationFrame(ge.resizeTextarea)},ge.resizeTextarea=function(){var ue=ge.props.autoSize;if(!ue||!ge.textArea)return;var te=ue.minRows,he=ue.maxRows,ae=V(ge.textArea,!1,te,he);ge.setState({textareaStyles:ae,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ge.resizeFrameId),ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:$.RESIZED},function(){ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:$.NONE}),ge.fixFirefoxAutoScroll()})})})})},ge.renderTextArea=function(){var ue=ge.props,te=ue.prefixCls,he=te===void 0?"rc-textarea":te,ae=ue.autoSize,_e=ue.onResize,Oe=ue.className,ye=ue.disabled,Pe=ge.state,Me=Pe.textareaStyles,Ne=Pe.resizeStatus,Fe=Object(d.a)(ge.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=x()(he,Oe,Object(j.a)({},"".concat(he,"-disabled"),ye));"value"in Fe&&(Fe.value=Fe.value||"");var Be=Object(G.a)(Object(G.a)(Object(G.a)({},ge.props.style),Me),Ne===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(c,{onResize:ge.handleResize,disabled:!(ae||_e)},P.createElement("textarea",Object(le.a)({},Fe,{className:Ue,style:Be,ref:ge.saveTextArea})))},ge.state={textareaStyles:{},resizeStatus:$.NONE},ge}return Object(D.a)(we,[{key:"componentDidUpdate",value:function(ge){(ge.value!==this.props.value||!M()(ge.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 ge=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(ge,ue)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),we}(P.Component),oe=ee,fe=function(Ee){Object(Z.a)(we,Ee);var Ce=Object(B.a)(we);function we(Te){var ge;Object(Q.a)(this,we),ge=Ce.call(this,Te),ge.resizableTextArea=void 0,ge.focus=function(){ge.resizableTextArea.textArea.focus()},ge.saveTextArea=function(te){ge.resizableTextArea=te},ge.handleChange=function(te){var he=ge.props.onChange;ge.setValue(te.target.value,function(){ge.resizableTextArea.resizeTextarea()}),he&&he(te)},ge.handleKeyDown=function(te){var he=ge.props,ae=he.onPressEnter,_e=he.onKeyDown;te.keyCode===13&&ae&&ae(te),_e&&_e(te)};var ue=typeof Te.value=="undefined"||Te.value===null?Te.defaultValue:Te.value;return ge.state={value:ue},ge}return Object(D.a)(we,[{key:"setValue",value:function(ge,ue){"value"in this.props||this.setState({value:ge},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(oe,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ge){return"value"in ge?{value:ge.value}:null}}]),we}(P.Component),Re=qe.default=fe},ZW9T:function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return A});var le=ie("k1fw"),Q=ie("miYZ"),D=ie("tsqr"),Z=ie("rAM+"),B=ie("tJVT"),P=ie("PpiC"),G=ie("q1tI"),j=ie.n(G),I=ie("bdgK");function k(p,f,L,b,m){var c=f.getWordUntilPosition(L),d={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=b.map(function(x){return{label:x,kind:p.languages.CompletionItemKind.Keyword,insertText:x,insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:d}});return m.map(function(x){a.push(Object(le.a)(Object(le.a)({},x),{},{range:d}))}),a}var v=function(p){var f={label:"ifelse",kind:p.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["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(d,a){var x=k(p,d,a,L,[f]);return{suggestions:x}}});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(d,a){var x=[{label:"print",kind:p.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:p.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=k(p,d,a,b,x);return{suggestions:y}}});var m=["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(d,a){var x=[f,{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}],y=k(p,d,a,m,x);return{suggestions:y}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",R=ie("LvDl");function _(p){return/^\d+$/.test(p)?"".concat(p,"px"):p}function w(){}var S=!1,h={"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 o(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],f=p;if(Array.isArray(p)){for(var L=0;L<p.length;L++){var b=h[p[L]];if(b)return b}return f[0]}return h[f]||f}var l=null,u=qe.b=function(p){var f=p.width,L=f===void 0?"100%":f,b=p.height,m=b===void 0?"100%":b,c=p.value,d=p.language,a=d===void 0?"javascript":d,x=p.style,y=x===void 0?{}:x,E=p.options,N=E===void 0?{}:E,U=p.overrideServices,K=U===void 0?{}:U,V=p.theme,O=V===void 0?"vs-dark":V,M=p.onEditBlur,$=p.onSave,ee=p.autoHeight,oe=ee===void 0?!1:ee,fe=p.forbidCopy,Re=fe===void 0?!1:fe,Ee=p.onChange,Ce=Ee===void 0?w:Ee,we=p.editorDidMount,Te=we===void 0?w:we,ge=p.onFocus,ue=ge===void 0?w:ge,te=p.filename,he=te===void 0?"educoder.txt":te,ae=Object(P.a)(p,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),_e=Object(G.useRef)(),Oe=Object(G.useRef)({}),ye=Object(G.useRef)(),Pe=Object(G.useRef)(!1),Me=Object(G.useRef)(),Ne=Object(G.useState)(!1),Fe=Object(B.a)(Ne,2),Ue=Fe[0],Be=Fe[1];function tt(){var se;return _e.current&&(se=new I.default(function(de){var Le=Object(Z.a)(de),Se;try{for(Le.s();!(Se=Le.n()).done;){var We=Se.value;(We.target.offsetHeight>0||We.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(at){Le.e(at)}finally{Le.f()}}),se.observe(_e.current)),se}function et(){D.b.warn(decodeURIComponent(T))}var Ye=function(){var de=Oe.current.instance;if(c!=null&&de&&Ue){var Le=de.getModel();Le&&c!==Le.getValue()&&(S=!0,Le.setValue(c),de.layout(),S=!1)}};Object(G.useEffect)(function(){ye.current&&clearTimeout(ye.current),ye.current=setTimeout(function(){Ye()},500)},[c,Ue,Oe.current]);function $e(){var se=Oe.current.instance;if(se){var de=se.getSelection(),Le=Oe.current.pastePos||{},Se=new l.Range(Le.startLineNumber||de.endLineNumber,Le.startColumn||de.endColumn,Le.endLineNumber||de.endLineNumber,Le.endColumn||de.endColumn);setTimeout(function(){se.executeEdits("",[{range:Se,text:""}])},300)}}function lt(se){(window.navigator.platform.match("Mac")?se.metaKey:se.ctrlKey)&&se.keyCode==83&&(se.preventDefault(),$())}var Ze=function(){if(oe&&Oe.current.instance){var de=Oe.current.instance.getContentHeight();re(de<m?m:de)}else re(m)};function ot(se){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),se.dispatchEvent(de)}function ke(se,de){var Le=window.URL||window.webkitURL||window,Se=new Blob([de]),We=document.createElementNS("http://www.w3.org/1999/xhtml","a");We.href=Le.createObjectURL(Se),We.download=se,ot(We)}Object(G.useEffect)(function(){Ze()},[Ze]),Object(G.useEffect)(function(){_e.current&&!Ue&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(se){try{l=se,Oe.current.instance=l.editor.create(_e.current,{value:c,language:o(a),theme:O,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},K);var de=Oe.current.instance;if(Te(de,l),setTimeout(function(){Ze(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ke(he||"educoder.txt",de.getValue())}})},500),Oe.current.subscription=de.onDidChangeModelContent(function(Se){Pe.current?clearTimeout(Me.current):(Ze(),Ce(de.getValue(),Se)),Me.current=setTimeout(function(){Pe.current=!1},500)}),window.Monaco||v(l),Re&&(de.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return et(),null}),de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return et(),null})),window.Monaco=l,M&&de.onDidBlurEditorWidget(function(){M(de.getValue())}),ue&&de.onDidFocusEditorText(function(){ue(de.getValue())}),Re){de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return et(),null}),de.onDidPaste(function(Se){Oe.current.pastePos=Se});try{window.addEventListener("paste",$e)}catch(Se){}}var Le=tt();return Be(!0),function(){var Se=Oe.current.instance;Se.dispose();var We=Se.getModel();We&&We.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),Re&&window.removeEventListener("paste",$e),Le.unobserve(_e.current)}}catch(Se){}})},[]),Object(G.useEffect)(function(){var se=Oe.current.instance;if(se&&Ue)return document.addEventListener("keydown",lt,!1),function(){document.removeEventListener("keydown",lt)}},[$,Ue]),Object(G.useEffect)(function(){var se=Oe.current.instance;if(se&&Ue){var de=o(a);l.editor.setModelLanguage(se.getModel(),de),console.log("language:",a,se.getModel(),de)}},[a,Ue]),Object(G.useEffect)(function(){var se=Oe.current.instance;se&&Ue&&l.editor.setTheme(O)},[O,Ue]),Object(G.useEffect)(function(){var se=Oe.current.instance;se&&Ue&&(se.updateOptions(Object(le.a)({},N)),setTimeout(function(){se.getModel().updateOptions(Object(le.a)({},N))},200))},[JSON.stringify(N),Ue]),Object(G.useEffect)(function(){var se=Oe.current.instance;se&&Ue&&se.layout()},[L,m,Ue]);var nt=Object(G.useState)(_(L)),Je=Object(B.a)(nt,2),Ie=Je[0],He=Je[1],xe=Object(G.useState)(_(m)),pe=Object(B.a)(xe,2),be=pe[0],re=pe[1],ne=Object(le.a)(Object(le.a)({},y),{},{width:Ie,height:be});return j.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:ne})};function A(p){var f=p.width,L=f===void 0?"100%":f,b=p.height,m=b===void 0?"100%":b,c=p.original,d=p.modified,a=p.language,x=p.options,y=x===void 0?{}:x,E=Object(G.useRef)(),N=Object(G.useState)(null),U=Object(B.a)(N,2),K=U[0],V=U[1];function O(oe){var fe;return E.current&&(fe=new I.default(function(Re){var Ee=Object(Z.a)(Re),Ce;try{for(Ee.s();!(Ce=Ee.n()).done;){var we=Ce.value;(we.target.offsetHeight>0||we.target.offsetWidth>0)&&oe.layout()}}catch(Te){Ee.e(Te)}finally{Ee.f()}}),fe.observe(E.current)),fe}Object(G.useEffect)(function(){E.current&&ie.e(27).then(ie.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var fe=l.editor.createDiffEditor(E.current,Object(le.a)(Object(le.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},y),{},{wordWrap:!0}));V(fe);var Re=O(fe);return function(){fe.dispose();var Ee=fe.getModel();Ee&&Ee.dispose(),Re.unobserve(E.current)}})},[]),Object(G.useEffect)(function(){K&&K.setModel({original:l.editor.createModel(c,a),modified:l.editor.createModel(d,a)})},[c,d,a,K]);var M=_(L),$=_(m),ee={width:M,height:$};return j.a.createElement("div",{className:"my-diff-editor",ref:E,style:ee})}},ZpRC:function(bt,qe,ie){"use strict";function le(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function Q(v,T){return(!T||v!=="hidden")&&v!=="visible"&&v!=="clip"}function D(v,T){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var R=getComputedStyle(v,null);return Q(R.overflowY,T)||Q(R.overflowX,T)||function(_){var w=function(S){if(!S.ownerDocument||!S.ownerDocument.defaultView)return null;try{return S.ownerDocument.defaultView.frameElement}catch(h){return null}}(_);return!!w&&(w.clientHeight<_.scrollHeight||w.clientWidth<_.scrollWidth)}(v)}return!1}function Z(v,T,R,_,w,S,h,o){return S<v&&h>T||S>v&&h<T?0:S<=v&&o<=R||h>=T&&o>=R?S-v-_:h>T&&o<R||S<v&&o>R?h-T+w:0}var B=function(v,T){var R=window,_=T.scrollMode,w=T.block,S=T.inline,h=T.boundary,o=T.skipOverflowHiddenElements,l=typeof h=="function"?h:function(Me){return Me!==h};if(!le(v))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,A=[],p=v;le(p)&&l(p);){if((p=p.parentElement)===u){A.push(p);break}p!=null&&p===document.body&&D(p)&&!D(document.documentElement)||p!=null&&D(p,o)&&A.push(p)}for(var f=R.visualViewport?R.visualViewport.width:innerWidth,L=R.visualViewport?R.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,c=v.getBoundingClientRect(),d=c.height,a=c.width,x=c.top,y=c.right,E=c.bottom,N=c.left,U=w==="start"||w==="nearest"?x:w==="end"?E:x+d/2,K=S==="center"?N+a/2:S==="end"?y:N,V=[],O=0;O<A.length;O++){var M=A[O],$=M.getBoundingClientRect(),ee=$.height,oe=$.width,fe=$.top,Re=$.right,Ee=$.bottom,Ce=$.left;if(_==="if-needed"&&x>=0&&N>=0&&E<=L&&y<=f&&x>=fe&&E<=Ee&&N>=Ce&&y<=Re)return V;var we=getComputedStyle(M),Te=parseInt(we.borderLeftWidth,10),ge=parseInt(we.borderTopWidth,10),ue=parseInt(we.borderRightWidth,10),te=parseInt(we.borderBottomWidth,10),he=0,ae=0,_e="offsetWidth"in M?M.offsetWidth-M.clientWidth-Te-ue:0,Oe="offsetHeight"in M?M.offsetHeight-M.clientHeight-ge-te:0;if(u===M)he=w==="start"?U:w==="end"?U-L:w==="nearest"?Z(m,m+L,L,ge,te,m+U,m+U+d,d):U-L/2,ae=S==="start"?K:S==="center"?K-f/2:S==="end"?K-f:Z(b,b+f,f,Te,ue,b+K,b+K+a,a),he=Math.max(0,he+m),ae=Math.max(0,ae+b);else{he=w==="start"?U-fe-ge:w==="end"?U-Ee+te+Oe:w==="nearest"?Z(fe,Ee,ee,ge,te+Oe,U,U+d,d):U-(fe+ee/2)+Oe/2,ae=S==="start"?K-Ce-Te:S==="center"?K-(Ce+oe/2)+_e/2:S==="end"?K-Re+ue+_e:Z(Ce,Re,oe,Te,ue+_e,K,K+a,a);var ye=M.scrollLeft,Pe=M.scrollTop;U+=Pe-(he=Math.max(0,Math.min(Pe+he,M.scrollHeight-ee+Oe))),K+=ye-(ae=Math.max(0,Math.min(ye+ae,M.scrollWidth-oe+_e)))}V.push({el:M,top:he,left:ae})}return V};function P(v){return v===Object(v)&&Object.keys(v).length!==0}function G(v,T){T===void 0&&(T="auto");var R="scrollBehavior"in document.body.style;v.forEach(function(_){var w=_.el,S=_.top,h=_.left;w.scroll&&R?w.scroll({top:S,left:h,behavior:T}):(w.scrollTop=S,w.scrollLeft=h)})}function j(v){return v===!1?{block:"end",inline:"nearest"}:P(v)?v:{block:"start",inline:"nearest"}}function I(v,T){var R=!v.ownerDocument.documentElement.contains(v);if(P(T)&&typeof T.behavior=="function")return T.behavior(R?[]:B(v,T));if(R)return;var _=j(T);return G(B(v,_),_.behavior)}var k=qe.a=I},Zss7:function(bt,qe,ie){var le;(function(Q){var D=/^\s+/,Z=/\s+$/,B=0,P=Q.round,G=Q.min,j=Q.max,I=Q.random;function k(te,he){if(te=te||"",he=he||{},te instanceof k)return te;if(!(this instanceof k))return new k(te,he);var ae=v(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=P(100*this._a)/100,this._format=he.format||ae.format,this._gradientType=he.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=ae.ok,this._tc_id=B++}k.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(),he,ae,_e,Oe,ye,Pe;return he=te.r/255,ae=te.g/255,_e=te.b/255,he<=.03928?Oe=he/12.92:Oe=Q.pow((he+.055)/1.055,2.4),ae<=.03928?ye=ae/12.92:ye=Q.pow((ae+.055)/1.055,2.4),_e<=.03928?Pe=_e/12.92:Pe=Q.pow((_e+.055)/1.055,2.4),.2126*Oe+.7152*ye+.0722*Pe},setAlpha:function(te){return this._a=V(te),this._roundA=P(100*this._a)/100,this},toHsv:function(){var te=w(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=w(this._r,this._g,this._b),he=P(te.h*360),ae=P(te.s*100),_e=P(te.v*100);return this._a==1?"hsv("+he+", "+ae+"%, "+_e+"%)":"hsva("+he+", "+ae+"%, "+_e+"%, "+this._roundA+")"},toHsl:function(){var te=R(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=R(this._r,this._g,this._b),he=P(te.h*360),ae=P(te.s*100),_e=P(te.l*100);return this._a==1?"hsl("+he+", "+ae+"%, "+_e+"%)":"hsla("+he+", "+ae+"%, "+_e+"%, "+this._roundA+")"},toHex:function(te){return h(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(O(this._r,255)*100)+"%",g:P(O(this._g,255)*100)+"%",b:P(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+P(O(this._r,255)*100)+"%, "+P(O(this._g,255)*100)+"%, "+P(O(this._b,255)*100)+"%)":"rgba("+P(O(this._r,255)*100)+"%, "+P(O(this._g,255)*100)+"%, "+P(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var he="#"+l(this._r,this._g,this._b,this._a),ae=he,_e=this._gradientType?"GradientType = 1, ":"";if(te){var Oe=k(te);ae="#"+l(Oe._r,Oe._g,Oe._b,Oe._a)}return"progid:DXImageTransform.Microsoft.gradient("+_e+"startColorstr="+he+",endColorstr="+ae+")"},toString:function(te){var he=!!te;te=te||this._format;var ae=!1,_e=this._a<1&&this._a>=0,Oe=!he&&_e&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Oe?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 k(this.toString())},_applyModification:function(te,he){var ae=te.apply(null,[this].concat([].slice.call(he)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(A,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(te,he){return te.apply(null,[this].concat([].slice.call(he)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},k.fromRatio=function(te,he){if(typeof te=="object"){var ae={};for(var _e in te)te.hasOwnProperty(_e)&&(_e==="a"?ae[_e]=te[_e]:ae[_e]=Re(te[_e]));te=ae}return k(te,he)};function v(te){var he={r:0,g:0,b:0},ae=1,_e=null,Oe=null,ye=null,Pe=!1,Me=!1;return typeof te=="string"&&(te=ge(te)),typeof te=="object"&&(Te(te.r)&&Te(te.g)&&Te(te.b)?(he=T(te.r,te.g,te.b),Pe=!0,Me=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Te(te.h)&&Te(te.s)&&Te(te.v)?(_e=Re(te.s),Oe=Re(te.v),he=S(te.h,_e,Oe),Pe=!0,Me="hsv"):Te(te.h)&&Te(te.s)&&Te(te.l)&&(_e=Re(te.s),ye=Re(te.l),he=_(te.h,_e,ye),Pe=!0,Me="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=V(ae),{ok:Pe,format:te.format||Me,r:G(255,j(he.r,0)),g:G(255,j(he.g,0)),b:G(255,j(he.b,0)),a:ae}}function T(te,he,ae){return{r:O(te,255)*255,g:O(he,255)*255,b:O(ae,255)*255}}function R(te,he,ae){te=O(te,255),he=O(he,255),ae=O(ae,255);var _e=j(te,he,ae),Oe=G(te,he,ae),ye,Pe,Me=(_e+Oe)/2;if(_e==Oe)ye=Pe=0;else{var Ne=_e-Oe;Pe=Me>.5?Ne/(2-_e-Oe):Ne/(_e+Oe);switch(_e){case te:ye=(he-ae)/Ne+(he<ae?6:0);break;case he:ye=(ae-te)/Ne+2;break;case ae:ye=(te-he)/Ne+4;break}ye/=6}return{h:ye,s:Pe,l:Me}}function _(te,he,ae){var _e,Oe,ye;te=O(te,360),he=O(he,100),ae=O(ae,100);function Pe(Fe,Ue,Be){return Be<0&&(Be+=1),Be>1&&(Be-=1),Be<1/6?Fe+(Ue-Fe)*6*Be:Be<1/2?Ue:Be<2/3?Fe+(Ue-Fe)*(2/3-Be)*6:Fe}if(he===0)_e=Oe=ye=ae;else{var Me=ae<.5?ae*(1+he):ae+he-ae*he,Ne=2*ae-Me;_e=Pe(Ne,Me,te+1/3),Oe=Pe(Ne,Me,te),ye=Pe(Ne,Me,te-1/3)}return{r:_e*255,g:Oe*255,b:ye*255}}function w(te,he,ae){te=O(te,255),he=O(he,255),ae=O(ae,255);var _e=j(te,he,ae),Oe=G(te,he,ae),ye,Pe,Me=_e,Ne=_e-Oe;if(Pe=_e===0?0:Ne/_e,_e==Oe)ye=0;else{switch(_e){case te:ye=(he-ae)/Ne+(he<ae?6:0);break;case he:ye=(ae-te)/Ne+2;break;case ae:ye=(te-he)/Ne+4;break}ye/=6}return{h:ye,s:Pe,v:Me}}function S(te,he,ae){te=O(te,360)*6,he=O(he,100),ae=O(ae,100);var _e=Q.floor(te),Oe=te-_e,ye=ae*(1-he),Pe=ae*(1-Oe*he),Me=ae*(1-(1-Oe)*he),Ne=_e%6,Fe=[ae,Pe,ye,ye,Me,ae][Ne],Ue=[Me,ae,ae,Pe,ye,ye][Ne],Be=[ye,ye,Me,ae,ae,Pe][Ne];return{r:Fe*255,g:Ue*255,b:Be*255}}function h(te,he,ae,_e){var Oe=[fe(P(te).toString(16)),fe(P(he).toString(16)),fe(P(ae).toString(16))];return _e&&Oe[0].charAt(0)==Oe[0].charAt(1)&&Oe[1].charAt(0)==Oe[1].charAt(1)&&Oe[2].charAt(0)==Oe[2].charAt(1)?Oe[0].charAt(0)+Oe[1].charAt(0)+Oe[2].charAt(0):Oe.join("")}function o(te,he,ae,_e,Oe){var ye=[fe(P(te).toString(16)),fe(P(he).toString(16)),fe(P(ae).toString(16)),fe(Ee(_e))];return Oe&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l(te,he,ae,_e){var Oe=[fe(Ee(_e)),fe(P(te).toString(16)),fe(P(he).toString(16)),fe(P(ae).toString(16))];return Oe.join("")}k.equals=function(te,he){return!te||!he?!1:k(te).toRgbString()==k(he).toRgbString()},k.random=function(){return k.fromRatio({r:I(),g:I(),b:I()})};function u(te,he){he=he===0?0:he||10;var ae=k(te).toHsl();return ae.s-=he/100,ae.s=M(ae.s),k(ae)}function A(te,he){he=he===0?0:he||10;var ae=k(te).toHsl();return ae.s+=he/100,ae.s=M(ae.s),k(ae)}function p(te){return k(te).desaturate(100)}function f(te,he){he=he===0?0:he||10;var ae=k(te).toHsl();return ae.l+=he/100,ae.l=M(ae.l),k(ae)}function L(te,he){he=he===0?0:he||10;var ae=k(te).toRgb();return ae.r=j(0,G(255,ae.r-P(255*-(he/100)))),ae.g=j(0,G(255,ae.g-P(255*-(he/100)))),ae.b=j(0,G(255,ae.b-P(255*-(he/100)))),k(ae)}function b(te,he){he=he===0?0:he||10;var ae=k(te).toHsl();return ae.l-=he/100,ae.l=M(ae.l),k(ae)}function m(te,he){var ae=k(te).toHsl(),_e=(ae.h+he)%360;return ae.h=_e<0?360+_e:_e,k(ae)}function c(te){var he=k(te).toHsl();return he.h=(he.h+180)%360,k(he)}function d(te){var he=k(te).toHsl(),ae=he.h;return[k(te),k({h:(ae+120)%360,s:he.s,l:he.l}),k({h:(ae+240)%360,s:he.s,l:he.l})]}function a(te){var he=k(te).toHsl(),ae=he.h;return[k(te),k({h:(ae+90)%360,s:he.s,l:he.l}),k({h:(ae+180)%360,s:he.s,l:he.l}),k({h:(ae+270)%360,s:he.s,l:he.l})]}function x(te){var he=k(te).toHsl(),ae=he.h;return[k(te),k({h:(ae+72)%360,s:he.s,l:he.l}),k({h:(ae+216)%360,s:he.s,l:he.l})]}function y(te,he,ae){he=he||6,ae=ae||30;var _e=k(te).toHsl(),Oe=360/ae,ye=[k(te)];for(_e.h=(_e.h-(Oe*he>>1)+720)%360;--he;)_e.h=(_e.h+Oe)%360,ye.push(k(_e));return ye}function E(te,he){he=he||6;for(var ae=k(te).toHsv(),_e=ae.h,Oe=ae.s,ye=ae.v,Pe=[],Me=1/he;he--;)Pe.push(k({h:_e,s:Oe,v:ye})),ye=(ye+Me)%1;return Pe}k.mix=function(te,he,ae){ae=ae===0?0:ae||50;var _e=k(te).toRgb(),Oe=k(he).toRgb(),ye=ae/100,Pe={r:(Oe.r-_e.r)*ye+_e.r,g:(Oe.g-_e.g)*ye+_e.g,b:(Oe.b-_e.b)*ye+_e.b,a:(Oe.a-_e.a)*ye+_e.a};return k(Pe)},k.readability=function(te,he){var ae=k(te),_e=k(he);return(Q.max(ae.getLuminance(),_e.getLuminance())+.05)/(Q.min(ae.getLuminance(),_e.getLuminance())+.05)},k.isReadable=function(te,he,ae){var _e=k.readability(te,he),Oe,ye;ye=!1,Oe=ue(ae);switch(Oe.level+Oe.size){case"AAsmall":case"AAAlarge":ye=_e>=4.5;break;case"AAlarge":ye=_e>=3;break;case"AAAsmall":ye=_e>=7;break}return ye},k.mostReadable=function(te,he,ae){var _e=null,Oe=0,ye,Pe,Me,Ne;ae=ae||{},Pe=ae.includeFallbackColors,Me=ae.level,Ne=ae.size;for(var Fe=0;Fe<he.length;Fe++)ye=k.readability(te,he[Fe]),ye>Oe&&(Oe=ye,_e=k(he[Fe]));return k.isReadable(te,_e,{level:Me,size:Ne})||!Pe?_e:(ae.includeFallbackColors=!1,k.mostReadable(te,["#fff","#000"],ae))};var N=k.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=k.hexNames=K(N);function K(te){var he={};for(var ae in te)te.hasOwnProperty(ae)&&(he[te[ae]]=ae);return he}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function O(te,he){ee(te)&&(te="100%");var ae=oe(te);return te=G(he,j(0,parseFloat(te))),ae&&(te=parseInt(te*he,10)/100),Q.abs(te-he)<1e-6?1:te%he/parseFloat(he)}function M(te){return G(1,j(0,te))}function $(te){return parseInt(te,16)}function ee(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function fe(te){return te.length==1?"0"+te:""+te}function Re(te){return te<=1&&(te=te*100+"%"),te}function Ee(te){return Q.round(parseFloat(te)*255).toString(16)}function Ce(te){return $(te)/255}var we=function(){var te="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+he+")|(?:"+te+")",_e="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Oe="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+_e),rgba:new RegExp("rgba"+Oe),hsl:new RegExp("hsl"+_e),hsla:new RegExp("hsla"+Oe),hsv:new RegExp("hsv"+_e),hsva:new RegExp("hsva"+Oe),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 Te(te){return!!we.CSS_UNIT.exec(te)}function ge(te){te=te.replace(D,"").replace(Z,"").toLowerCase();var he=!1;if(N[te])te=N[te],he=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=we.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=we.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=we.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=we.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=we.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=we.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=we.hex8.exec(te))?{r:$(ae[1]),g:$(ae[2]),b:$(ae[3]),a:Ce(ae[4]),format:he?"name":"hex8"}:(ae=we.hex6.exec(te))?{r:$(ae[1]),g:$(ae[2]),b:$(ae[3]),format:he?"name":"hex"}:(ae=we.hex4.exec(te))?{r:$(ae[1]+""+ae[1]),g:$(ae[2]+""+ae[2]),b:$(ae[3]+""+ae[3]),a:Ce(ae[4]+""+ae[4]),format:he?"name":"hex8"}:(ae=we.hex3.exec(te))?{r:$(ae[1]+""+ae[1]),g:$(ae[2]+""+ae[2]),b:$(ae[3]+""+ae[3]),format:he?"name":"hex"}:!1}function ue(te){var he,ae;return te=te||{level:"AA",size:"small"},he=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:he,size:ae}}bt.exports?bt.exports=k:!(le=function(){return k}.call(qe,ie,qe,bt),le!==void 0&&(bt.exports=le))})(Math)},bT9E:function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return Q});var le=ie("VTBJ");function Q(D,Z){var B=Object(le.a)({},D);return Array.isArray(Z)&&Z.forEach(function(P){delete B[P]}),B}},c5Ni:function(bt,qe,ie){},dejd:function(bt,qe,ie){},dmUQ:function(bt,qe,ie){"use strict";var le=ie("Ff2n"),Q=ie("rePB"),D=ie("1OyB"),Z=ie("vuIU"),B=ie("Ji7U"),P=ie("md7G"),G=ie("foSv"),j=ie("q1tI"),I=ie.n(j),k=ie("TSYQ"),v=ie.n(k),T=ie("4IlW");function R(d,a){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);a&&(y=y.filter(function(E){return Object.getOwnPropertyDescriptor(d,E).enumerable})),x.push.apply(x,y)}return x}function _(d){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?R(Object(x),!0).forEach(function(y){Object(Q.a)(d,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):R(Object(x)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(x,y))})}return d}function w(d){var a=S();return function(){var y=Object(G.a)(d),E;if(a){var N=Object(G.a)(this).constructor;E=Reflect.construct(y,arguments,N)}else E=y.apply(this,arguments);return Object(P.a)(this,E)}}function S(){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(d){return!1}}function h(){}function o(d){d.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,A=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},L=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},b=function(d){Object(B.a)(x,d);var a=w(x);function x(y){var E;Object(D.a)(this,x),E=a.call(this,y),E.onKeyDown=function(K){var V=E.props,O=V.onKeyDown,M=V.onPressEnter;if(K.keyCode===T.a.UP){var $=E.getRatio(K);E.up(K,$,null),E.stop()}else if(K.keyCode===T.a.DOWN){var ee=E.getRatio(K);E.down(K,ee,null),E.stop()}else K.keyCode===T.a.ENTER&&M&&M(K);if(E.recordCursorPosition(),E.lastKeyCode=K.keyCode,O){for(var oe=arguments.length,fe=new Array(oe>1?oe-1:0),Re=1;Re<oe;Re++)fe[Re-1]=arguments[Re];O.apply(void 0,[K].concat(fe))}},E.onKeyUp=function(K){var V=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),V){for(var O=arguments.length,M=new Array(O>1?O-1:0),$=1;$<O;$++)M[$-1]=arguments[$];V.apply(void 0,[K].concat(M))}},E.onChange=function(K){var V=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(K)),E.setState({inputValue:E.rawInput}),V(E.toNumber(E.rawInput))},E.onMouseUp=function(){var K=E.props.onMouseUp;E.recordCursorPosition(),K&&K.apply(void 0,arguments)},E.onFocus=function(){var K;E.setState({focused:!0}),(K=E.props).onFocus.apply(K,arguments)},E.onBlur=function(){var K=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var V=E.getCurrentValidValue(E.state.inputValue),O=E.setValue(V,h);if(K){var M=E.input.value,$=E.getInputDisplayValue({focus:!1,value:O});E.input.value=$&&Number($),K.apply(void 0,arguments),E.input.value=M}},E.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},E.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},E.getPrecision=function(K){if(f(E.props.precision))return E.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var O=0;return V.indexOf(".")>=0&&(O=V.length-V.indexOf(".")-1),O},E.getInputDisplayValue=function(K){var V=K||E.state,O=V.focused,M=V.inputValue,$=V.value,ee;O?ee=M:ee=E.toPrecisionAsStep($),ee==null&&(ee="");var oe=E.formatWrapper(ee);return f(E.props.decimalSeparator)&&(oe=oe.toString().replace(".",E.props.decimalSeparator)),oe},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(K){}},E.restoreByAfter=function(K){if(K===void 0)return!1;var V=E.input.value,O=V.lastIndexOf(K);if(O===-1)return!1;var M=E.cursorBefore.length;return E.lastKeyCode===T.a.DELETE&&E.cursorBefore.charAt(M-1)===K[0]?(E.fixCaret(M,M),!0):O+K.length===V.length?(E.fixCaret(O,O),!0):!1},E.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,O){var M=K.substring(O);return E.restoreByAfter(M)})},E.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(K,V,O){E.pressingUpOrDown=!0,E.step("down",K,V,O)},E.up=function(K,V,O){E.pressingUpOrDown=!0,E.step("up",K,V,O)},E.saveInput=function(K){E.input=K};var N=y.value;N===void 0&&(N=y.defaultValue),E.state={focused:y.autoFocus};var U=E.getValidValue(E.toNumber(N));return E.state=_(_({},E.state),{},{inputValue:E.toPrecisionAsStep(U),value:U}),E}return Object(Z.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var N=this.props,U=N.value,K=N.onChange,V=N.max,O=N.min,M=this.state.focused;if(E){if(!L(E.value,U)||!L(E.max,V)||!L(E.min,O)){var $=M?U:this.getValidValue(U),ee;this.pressingUpOrDown?ee=$:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ee})}var oe="value"in this.props?U:this.state.value;"max"in this.props&&E.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&E.min!==O&&typeof oe=="number"&&oe<O&&K&&K(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var fe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(fe=this.cursorStart):fe=this.input.value.length,this.fixCaret(fe,fe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Re){}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(E){var N=E;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(E){var N=E.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(E){var N=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,K=parseFloat(E);return isNaN(K)?E:(K<N&&(K=N),K>U&&(K=U),K)}},{key:"setValue",value:function(E,N){var U=this.props.precision,K=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),V=this.state.value,O=V===void 0?null:V,M=this.state.inputValue,$=M===void 0?null:M,ee=typeof K=="number"?K.toFixed(U):"".concat(K),oe=K!==O||ee!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},N)):this.setState({value:K,inputValue:this.toPrecisionAsStep(E)},N),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,K=U.precision,V=U.step;if(f(K))return K;var O=this.getPrecision(N),M=this.getPrecision(V),$=this.getPrecision(E);return E?Math.max($,O+M):O+M}},{key:"getPrecisionFactor",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(E,N);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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var N=Math.abs(this.getMaxPrecision(E));return isNaN(N)?E.toString():Number(E).toFixed(N)}},{key:"toNumber",value:function(E){var N=this.props.precision,U=this.state.focused,K=E&&E.length>16&&U;return this.isNotCompleteNumber(E)||K?E:f(N)?Math.round(E*Math.pow(10,N))/Math.pow(10,N):Number(E)}},{key:"upStep",value:function(E,N){var U=this.props.step,K=this.getPrecisionFactor(E,N),V=Math.abs(this.getMaxPrecision(E,N)),O=((K*E+K*U*N)/K).toFixed(V);return this.toNumber(O)}},{key:"downStep",value:function(E,N){var U=this.props.step,K=this.getPrecisionFactor(E,N),V=Math.abs(this.getMaxPrecision(E,N)),O=((K*E-K*U*N)/K).toFixed(V);return this.toNumber(O)}},{key:"step",value:function(E,N){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var O=this.props;if(O.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var $=this["".concat(E,"Step")](M,K),ee=$>O.max||$<O.min;if($>O.max?$=O.max:$<O.min&&($=O.min),this.setValue($,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){U[E](N,K,!0)},V?u:A)}},{key:"fixCaret",value:function(E,N){if(E===void 0||N===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,K=this.input.selectionEnd;(E!==U||N!==K)&&this.input.setSelectionRange(E,N)}catch(V){}}},{key:"render",value:function(){var E,N=this.props,U=N.prefixCls,K=N.disabled,V=N.readOnly,O=N.useTouch,M=N.autoComplete,$=N.upHandler,ee=N.downHandler,oe=N.className,fe=N.max,Re=N.min,Ee=N.style,Ce=N.title,we=N.onMouseEnter,Te=N.onMouseLeave,ge=N.onMouseOver,ue=N.onMouseOut,te=N.required,he=N.onClick,ae=N.tabIndex,_e=N.type,Oe=N.placeholder,ye=N.id,Pe=N.inputMode,Me=N.pattern,Ne=N.step,Fe=N.maxLength,Ue=N.autoFocus,Be=N.name,tt=N.onPaste,et=N.onInput,Ye=Object(le.a)(N,["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"]),$e=this.state,lt=$e.value,Ze=$e.focused,ot=v()(U,(E={},Object(Q.a)(E,oe,!!oe),Object(Q.a)(E,"".concat(U,"-disabled"),K),Object(Q.a)(E,"".concat(U,"-focused"),Ze),E)),ke={};Object.keys(Ye).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(ke[de]=Ye[de])});var nt=!V&&!K,Je=this.getInputDisplayValue(null),Ie=(lt||lt===0)&&(isNaN(lt)||Number(lt)>=fe),He=(lt||lt===0)&&(isNaN(lt)||Number(lt)<=Re),xe=Ie||K||V,pe=He||K||V,be=v()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(Q.a)({},"".concat(U,"-handler-up-disabled"),xe)),re=v()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(Q.a)({},"".concat(U,"-handler-down-disabled"),pe)),ne=O?{onTouchStart:xe?h:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},se=O?{onTouchStart:pe?h:this.down,onTouchEnd:this.stop}:{onMouseDown:pe?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return I.a.createElement("div",{className:ot,style:Ee,title:Ce,onMouseEnter:we,onMouseLeave:Te,onMouseOver:ge,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},I.a.createElement("div",{className:"".concat(U,"-handler-wrap")},I.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:be}),$||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),I.a.createElement("span",Object.assign({unselectable:"on"},se,{role:"button","aria-label":"Decrease Value","aria-disabled":pe,className:re}),ee||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),I.a.createElement("div",{className:"".concat(U,"-input-wrap")},I.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Re,"aria-valuemax":fe,"aria-valuenow":lt,required:te,type:_e,placeholder:Oe,onPaste:tt,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ae,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:nt?this.onKeyDown:h,onKeyUp:nt?this.onKeyUp:h,autoFocus:Ue,maxLength:Fe,readOnly:V,disabled:K,max:fe,min:Re,step:Ne,name:Be,title:Ce,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:Me,inputMode:Pe,onInput:et},ke))))}}]),x}(I.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var m=b,c=qe.a=m},h78n:function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return E});var le=ie("q1tI"),Q=ie.n(le),D=ie("TSYQ"),Z=ie.n(D),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},P=function(K){var V=K.map(function(){return Object(le.useRef)()}),O=Object(le.useRef)();return Object(le.useEffect)(function(){var M=Date.now(),$=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;$=!0;var fe=oe.style;fe.transitionDuration=".3s, .3s, .3s, .06s",O.current&&M-O.current<100&&(fe.transitionDuration="0s, 0s")}),$&&(O.current=Date.now())}),[V]};function G(){return G=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var O in V)Object.prototype.hasOwnProperty.call(V,O)&&(U[O]=V[O])}return U},G.apply(this,arguments)}function j(U,K){return R(U)||T(U,K)||k(U,K)||I()}function I(){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 k(U,K){if(!U)return;if(typeof U=="string")return v(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(U,K)}function v(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,O=new Array(K);V<K;V++)O[V]=U[V];return O}function T(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],O=!0,M=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(O=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);O=!0);}catch(fe){M=!0,$=fe}finally{try{!O&&ee.return!=null&&ee.return()}finally{if(M)throw $}}return V}function R(U){if(Array.isArray(U))return U}function _(U,K){if(U==null)return{};var V=w(U,K),O,M;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(M=0;M<$.length;M++){if(O=$[M],K.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;V[O]=U[O]}}return V}function w(U,K){if(U==null)return{};var V={},O=Object.keys(U),M,$;for($=0;$<O.length;$++){if(M=O[$],K.indexOf(M)>=0)continue;V[M]=U[M]}return V}var S=function(K){var V=K.className,O=K.percent,M=K.prefixCls,$=K.strokeColor,ee=K.strokeLinecap,oe=K.strokeWidth,fe=K.style,Re=K.trailColor,Ee=K.trailWidth,Ce=K.transition,we=_(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete we.gapPosition;var Te=Array.isArray(O)?O:[O],ge=Array.isArray($)?$:[$],ue=P(Te),te=j(ue,1),he=te[0],ae=oe/2,_e=100-oe/2,Oe="M ".concat(ee==="round"?ae:0,",").concat(ae,`
L `).concat(ee==="round"?_e:100,",").concat(ae),ye="0 0 100 ".concat(oe),Pe=0;return Q.a.createElement("svg",G({className:Z()("".concat(M,"-line"),V),viewBox:ye,preserveAspectRatio:"none",style:fe},we),Q.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Oe,strokeLinecap:ee,stroke:Re,strokeWidth:Ee||oe,fillOpacity:"0"}),Te.map(function(Me,Ne){var Fe={strokeDasharray:"".concat(Me,"px, 100px"),strokeDashoffset:"-".concat(Pe,"px"),transition:Ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=ge[Ne]||ge[ge.length-1];return Pe+=Me,Q.a.createElement("path",{key:Ne,className:"".concat(M,"-line-path"),d:Oe,strokeLinecap:ee,stroke:Ue,strokeWidth:oe,fillOpacity:"0",ref:he[Ne],style:Fe})}))};S.defaultProps=B;var h=S;function o(){return o=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var O in V)Object.prototype.hasOwnProperty.call(V,O)&&(U[O]=V[O])}return U},o.apply(this,arguments)}function l(U,K){return L(U)||f(U,K)||A(U,K)||u()}function u(){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,K){if(!U)return;if(typeof U=="string")return p(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return p(U,K)}function p(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,O=new Array(K);V<K;V++)O[V]=U[V];return O}function f(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],O=!0,M=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(O=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);O=!0);}catch(fe){M=!0,$=fe}finally{try{!O&&ee.return!=null&&ee.return()}finally{if(M)throw $}}return V}function L(U){if(Array.isArray(U))return U}function b(U,K){if(U==null)return{};var V=m(U,K),O,M;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(M=0;M<$.length;M++){if(O=$[M],K.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;V[O]=U[O]}}return V}function m(U,K){if(U==null)return{};var V={},O=Object.keys(U),M,$;for($=0;$<O.length;$++){if(M=O[$],K.indexOf(M)>=0)continue;V[M]=U[M]}return V}var c=0;function d(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function x(U,K,V,O){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ee=50-O/2,oe=0,fe=-ee,Re=0,Ee=-2*ee;switch($){case"left":oe=-ee,fe=0,Re=2*ee,Ee=0;break;case"right":oe=ee,fe=0,Re=-2*ee,Ee=0;break;case"bottom":fe=ee,Ee=2*ee;break;default:}var Ce="M 50,50 m ".concat(oe,",").concat(fe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Re,",").concat(-Ee,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Re,",").concat(Ee),we=Math.PI*2*ee,Te={stroke:V,strokeDasharray:"".concat(K/100*(we-M),"px ").concat(we,"px"),strokeDashoffset:"-".concat(M/2+U/100*(we-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ce,pathStyle:Te}}var y=function(K){var V=K.prefixCls,O=K.strokeWidth,M=K.trailWidth,$=K.gapDegree,ee=K.gapPosition,oe=K.trailColor,fe=K.strokeLinecap,Re=K.style,Ee=K.className,Ce=K.strokeColor,we=K.percent,Te=b(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ge=Object(le.useMemo)(function(){return c+=1,c},[]),ue=x(0,100,oe,O,$,ee),te=ue.pathString,he=ue.pathStyle,ae=a(we),_e=a(Ce),Oe=_e.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),ye=P(ae),Pe=l(ye,1),Me=Pe[0],Ne=function(){var Ue=0;return ae.map(function(Be,tt){var et=_e[tt]||_e[_e.length-1],Ye=Object.prototype.toString.call(et)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ge,")"):"",$e=x(Ue,Be,et,O,$,ee);return Ue+=Be,Q.a.createElement("path",{key:tt,className:"".concat(V,"-circle-path"),d:$e.pathString,stroke:Ye,strokeLinecap:fe,strokeWidth:O,opacity:Be===0?0:1,fillOpacity:"0",style:$e.pathStyle,ref:Me[tt]})})};return Q.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),Ee),viewBox:"0 0 100 100",style:Re},Te),Oe&&Q.a.createElement("defs",null,Q.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ge),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Oe).sort(function(Fe,Ue){return d(Fe)-d(Ue)}).map(function(Fe,Ue){return Q.a.createElement("stop",{key:Ue,offset:Fe,stopColor:Oe[Fe]})}))),Q.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:fe,strokeWidth:M||O,fillOpacity:"0",style:he}),Ne().reverse())};y.defaultProps=B;var E=y,N={Line:h,Circle:E}},kSUc:function(bt,qe,ie){},lZu9:function(bt,qe,ie){(function(le){le(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(Q,D){var Z=le.getMode(Q,"text/html"),B=Z.name=="null";function P(O){if(le.findModeByName){var M=le.findModeByName(O);M&&(O=M.mime||M.mimes[0])}var $=le.getMode(Q,O);return $.name=="null"?null:$}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 G={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 j in G)G.hasOwnProperty(j)&&D.tokenTypeOverrides[j]&&(G[j]=D.tokenTypeOverrides[j]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,k=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,T=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,S=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(O,M,$){return M.f=M.inline=$,$(O,M)}function u(O,M,$){return M.f=M.block=$,$(O,M)}function A(O){return!O||!/\S/.test(O.string)}function p(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==L){var M=B;if(!M){var $=le.innerMode(Z,O.htmlState);M=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}M&&(O.f=d,O.block=f,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function f(O,M){var $=O.column()===M.indentation,ee=A(M.prevLine.stream),oe=M.indentedCode,fe=M.prevLine.hr,Re=M.list!==!1,Ee=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var Ce=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,Re)){for(M.list=null;Ce<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=Ce-M.listStack[M.listStack.length-1])}var we=!ee&&!fe&&!M.prevLine.header&&(!Re||!oe)&&!M.prevLine.fencedCodeEnd,Te=(M.list===!1||fe||ee)&&M.indentation<=Ee&&O.match(I),ge=null;if(M.indentationDiff>=4&&(oe||M.prevLine.fencedCodeEnd||M.prevLine.header||ee))return O.skipToEnd(),M.indentedCode=!0,G.code;if(O.eatSpace())return null;if($&&M.indentation<=Ee&&(ge=O.match(T))&&ge[1].length<=6)return M.quote=0,M.header=ge[1].length,M.thisLine.header=!0,D.highlightFormatting&&(M.formatting="header"),M.f=M.inline,m(M);if(M.indentation<=Ee&&O.eat(">"))return M.quote=$?1:M.quote+1,D.highlightFormatting&&(M.formatting="quote"),O.eatSpace(),m(M);if(!Te&&!M.setext&&$&&M.indentation<=Ee&&(ge=O.match(k))){var ue=ge[1]?"ol":"ul";return M.indentation=Ce+O.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,D.taskLists&&O.match(v,!1)&&(M.taskList=!0),M.f=M.inline,D.highlightFormatting&&(M.formatting=["list","list-"+ue]),m(M)}else{if($&&M.indentation<=Ee&&(ge=O.match(w,!0)))return M.quote=0,M.fencedEndRE=new RegExp(ge[1]+"+ *$"),M.localMode=D.fencedCodeBlockHighlighting&&P(ge[2]||D.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=le.startState(M.localMode)),M.f=M.block=b,D.highlightFormatting&&(M.formatting="code-block"),M.code=-1,m(M);if(M.setext||(!we||!Re)&&!M.quote&&M.list===!1&&!M.code&&!Te&&!S.test(O.string)&&(ge=O.lookAhead(1))&&(ge=ge.match(R)))return M.setext?(M.header=M.setext,M.setext=0,O.skipToEnd(),D.highlightFormatting&&(M.formatting="header")):(M.header=ge[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,m(M);if(Te)return O.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,G.hr;if(O.peek()==="[")return l(O,M,N)}return l(O,M,M.inline)}function L(O,M){var $=Z.token(O,M.htmlState);if(!B){var ee=le.innerMode(Z,M.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||M.md_inside&&O.current().indexOf(">")>-1)&&(M.f=d,M.block=f,M.htmlState=null)}return $}function b(O,M){var $=M.listStack[M.listStack.length-1]||0,ee=M.indentation<$,oe=$+3;if(M.fencedEndRE&&M.indentation<=oe&&(ee||O.match(M.fencedEndRE))){D.highlightFormatting&&(M.formatting="code-block");var fe;return ee||(fe=m(M)),M.localMode=M.localState=null,M.block=f,M.f=d,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,ee?u(O,M,M.block):fe}else return M.localMode?M.localMode.token(O,M.localState):(O.skipToEnd(),G.code)}function m(O){var M=[];if(O.formatting){M.push(G.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var $=0;$<O.formatting.length;$++)M.push(G.formatting+"-"+O.formatting[$]),O.formatting[$]==="header"&&M.push(G.formatting+"-"+O.formatting[$]+"-"+O.header),O.formatting[$]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=O.quote?M.push(G.formatting+"-"+O.formatting[$]+"-"+O.quote):M.push("error"))}if(O.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(O.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(O.linkHref?M.push(G.linkHref,"url"):(O.strong&&M.push(G.strong),O.em&&M.push(G.em),O.strikethrough&&M.push(G.strikethrough),O.emoji&&M.push(G.emoji),O.linkText&&M.push(G.linkText),O.code&&M.push(G.code),O.image&&M.push(G.image),O.imageAltText&&M.push(G.imageAltText,"link"),O.imageMarker&&M.push(G.imageMarker)),O.header&&M.push(G.header,G.header+"-"+O.header),O.quote&&(M.push(G.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=O.quote?M.push(G.quote+"-"+O.quote):M.push(G.quote+"-"+D.maxBlockquoteDepth)),O.list!==!1){var ee=(O.listStack.length-1)%3;ee?ee===1?M.push(G.list2):M.push(G.list3):M.push(G.list1)}return O.trailingSpaceNewLine?M.push("trailing-space-new-line"):O.trailingSpace&&M.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function c(O,M){return O.match(_,!0)?m(M):void 0}function d(O,M){var $=M.text(O,M);if(typeof $!="undefined")return $;if(M.list)return M.list=null,m(M);if(M.taskList){var ee=O.match(v,!0)[1]===" ";return ee?M.taskOpen=!0:M.taskClosed=!0,D.highlightFormatting&&(M.formatting="task"),M.taskList=!1,m(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&O.match(/^#+$/,!0))return D.highlightFormatting&&(M.formatting="header"),m(M);var oe=O.next();if(M.linkTitle){M.linkTitle=!1;var fe=oe;oe==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Re="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(O.match(new RegExp(Re),!0))return G.linkHref}if(oe==="`"){var Ee=M.formatting;D.highlightFormatting&&(M.formatting="code"),O.eatWhile("`");var Ce=O.current().length;if(M.code==0&&(!M.quote||Ce==1))return M.code=Ce,m(M);if(Ce==M.code){var we=m(M);return M.code=0,we}else return M.formatting=Ee,m(M)}else if(M.code)return m(M);if(oe==="\\"&&(O.next(),D.highlightFormatting)){var Te=m(M),ge=G.formatting+"-escape";return Te?Te+" "+ge:ge}if(oe==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(oe==="["&&M.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(oe==="]"&&M.imageAltText){D.highlightFormatting&&(M.formatting="image");var Te=m(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=x,Te}if(oe==="["&&!M.image)return M.linkText&&O.match(/^.*?\]/)||(M.linkText=!0,D.highlightFormatting&&(M.formatting="link")),m(M);if(oe==="]"&&M.linkText){D.highlightFormatting&&(M.formatting="link");var Te=m(M);return M.linkText=!1,M.inline=M.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?x:d,Te}if(oe==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var Te=m(M);return Te?Te+=" ":Te="",Te+G.linkInline}if(oe==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var Te=m(M);return Te?Te+=" ":Te="",Te+G.linkEmail}if(D.xml&&oe==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=O.string.indexOf(">",O.pos);if(ue!=-1){var te=O.string.substring(O.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(M.md_inside=!0)}return O.backUp(1),M.htmlState=le.startState(Z),u(O,M,L)}if(D.xml&&oe==="<"&&O.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var he=1,ae=O.pos==1?" ":O.string.charAt(O.pos-2);he<3&&O.eat(oe);)he++;var _e=O.peek()||" ",Oe=!/\s/.test(_e)&&(!h.test(_e)||/\s/.test(ae)||h.test(ae)),ye=!/\s/.test(ae)&&(!h.test(ae)||/\s/.test(_e)||h.test(_e)),Pe=null,Me=null;if(he%2&&(!M.em&&Oe&&(oe==="*"||!ye||h.test(ae))?Pe=!0:M.em==oe&&ye&&(oe==="*"||!Oe||h.test(_e))&&(Pe=!1)),he>1&&(!M.strong&&Oe&&(oe==="*"||!ye||h.test(ae))?Me=!0:M.strong==oe&&ye&&(oe==="*"||!Oe||h.test(_e))&&(Me=!1)),Me!=null||Pe!=null){D.highlightFormatting&&(M.formatting=Pe==null?"strong":Me==null?"em":"strong em"),Pe===!0&&(M.em=oe),Me===!0&&(M.strong=oe);var we=m(M);return Pe===!1&&(M.em=!1),Me===!1&&(M.strong=!1),we}}else if(oe===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return m(M);O.backUp(1)}if(D.strikethrough){if(oe==="~"&&O.eatWhile(oe)){if(M.strikethrough){D.highlightFormatting&&(M.formatting="strikethrough");var we=m(M);return M.strikethrough=!1,we}else if(O.match(/^[^\s]/,!1))return M.strikethrough=!0,D.highlightFormatting&&(M.formatting="strikethrough"),m(M)}else if(oe===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return m(M);O.backUp(2)}}if(D.emoji&&oe===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,D.highlightFormatting&&(M.formatting="emoji");var Ne=m(M);return M.emoji=!1,Ne}return oe===" "&&(O.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),m(M)}function a(O,M){var $=O.next();if($===">"){M.f=M.inline=d,D.highlightFormatting&&(M.formatting="link");var ee=m(M);return ee?ee+=" ":ee="",ee+G.linkInline}return O.match(/^[^>]+/,!0),G.linkInline}function x(O,M){if(O.eatSpace())return null;var $=O.next();return $==="("||$==="["?(M.f=M.inline=E($==="("?")":"]"),D.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,m(M)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(O){return function(M,$){var ee=M.next();if(ee===O){$.f=$.inline=d,D.highlightFormatting&&($.formatting="link-string");var oe=m($);return $.linkHref=!1,oe}return M.match(y[O]),$.linkHref=!0,m($)}}function N(O,M){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=U,O.next(),D.highlightFormatting&&(M.formatting="link"),M.linkText=!0,m(M)):l(O,M,d)}function U(O,M){if(O.match(/^\]:/,!0)){M.f=M.inline=K,D.highlightFormatting&&(M.formatting="link");var $=m(M);return M.linkText=!1,$}return O.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function K(O,M){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?M.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=d,G.linkHref+" url")}var V={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:d,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(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&le.copyState(Z,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?le.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,M){if(M.formatting=!1,O!=M.thisLine.stream){if(M.header=0,M.hr=!1,O.match(/^\s*$/,!0))return p(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:O},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=L)){var $=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(M.indentation=$,M.indentationDiff=null,$>0)return null}}return M.f(O,M)},innerMode:function(O){return O.block==L?{state:O.htmlState,mode:Z}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:V}},indent:function(O,M,$){return O.block==L&&Z.indent?Z.indent(O.htmlState,M,$):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,M,$):le.Pass},blankLine:p,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},osHv:function(bt,qe,ie){(function(le){le(ie("VrN/"))})(function(le){"use strict";var Q=le.Pos;function D(h,o){return h.line-o.line||h.ch-o.ch}var Z="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",B=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+Z+"]["+B+"]*)","g");function G(h,o,l,u){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=u?Math.max(u.from,h.firstLine()):h.firstLine(),this.max=u?Math.min(u.to-1,h.lastLine()):h.lastLine()}function j(h,o){var l=h.cm.getTokenTypeAt(Q(h.line,o));return l&&/\btag\b/.test(l)}function I(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function k(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function v(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(I(h))continue;return}if(!j(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,u?"selfClose":"regular"}}function T(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(k(h))continue;return}if(!j(h,o+1)){h.ch=o;continue}P.lastIndex=o,h.ch=o;var l=P.exec(h.text);if(l&&l.index==o)return l}}function R(h){for(;;){P.lastIndex=h.ch;var o=P.exec(h.text);if(!o){if(I(h))continue;return}if(!j(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function _(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(k(h))continue;return}if(!j(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,u?"selfClose":"regular"}}function w(h,o){for(var l=[];;){var u=R(h),A,p=h.line,f=h.ch-(u?u[0].length:0);if(!u||!(A=v(h)))return;if(A=="selfClose")continue;if(u[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==u[2]){l.length=L;break}if(L<0&&(!o||o==u[2]))return{tag:u[2],from:Q(p,f),to:Q(h.line,h.ch)}}else l.push(u[2])}}function S(h,o){for(var l=[];;){var u=_(h);if(!u)return;if(u=="selfClose"){T(h);continue}var A=h.line,p=h.ch,f=T(h);if(!f)return;if(f[1])l.push(f[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==f[2]){l.length=L;break}if(L<0&&(!o||o==f[2]))return{tag:f[2],from:Q(h.line,h.ch),to:Q(A,p)}}}}le.registerHelper("fold","xml",function(h,o){for(var l=new G(h,o.line,0);;){var u=R(l);if(!u||l.line!=o.line)return;var A=v(l);if(!A)return;if(!u[1]&&A!="selfClose"){var p=Q(l.line,l.ch),f=w(l,u[2]);return f&&D(f.from,p)>0?{from:p,to:f.from}:null}}}),le.findMatchingTag=function(h,o,l){var u=new G(h,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var A=v(u),p=A&&Q(u.line,u.ch),f=A&&T(u);if(!A||!f||D(u,o)>0)return;var L={from:Q(u.line,u.ch),to:p,tag:f[2]};return A=="selfClose"?{open:L,close:null,at:"open"}:f[1]?{open:S(u,f[2]),close:L,at:"close"}:(u=new G(h,p.line,p.ch,l),{open:L,close:w(u,f[2]),at:"open"})},le.findEnclosingTag=function(h,o,l,u){for(var A=new G(h,o.line,o.ch,l);;){var p=S(A,u);if(!p)break;var f=new G(h,o.line,o.ch,l),L=w(f,p.tag);if(L)return{open:p,close:L}}},le.scanForClosingTag=function(h,o,l,u){var A=new G(h,o.line,o.ch,u?{from:0,to:u}:null);return w(A,l)}})},p5ED:function(bt,qe,ie){"use strict";var le=ie("+L6B"),Q=ie("2/Rp"),D=ie("5Dmo"),Z=ie("3S7+"),B=ie("k1fw"),P=ie("9og8"),G=ie("tJVT"),j=ie("WmNS"),I=ie.n(j),k=ie("q1tI"),v=ie.n(k),T=ie("vHTk"),R=ie.n(T),_=ie("yEEn"),w=ie("ZW9T"),S=ie("1vsH"),h=ie("V0Rq"),o=ie("m3rI"),l=function(A){var p=A.name,f=A.data,L=A.theme,b=A.type,m=A.filename,c=A.monacoEditor,d=A.className,a=A.style,x=A.close,y=A.onClose,E=A.hasMask,N=A.otherData,U=N===void 0?{}:N,K=Object(k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=Object(G.a)(K,2),O=V[0],M=V[1],$=Object(k.useState)(""),ee=Object(G.a)($,2),oe=ee[0],fe=ee[1],Re=Object(k.useState)(),Ee=Object(G.a)(Re,2),Ce=Ee[0],we=Ee[1],Te=window.ENV==="build"?"/react/build/office.html":"/office.html",ge,ue=1024*1024,te=10*ue,he=Object(k.useRef)();b==="office"&&(ge=Object(S.R)(f).filesize,ge>te&&(b="other")),m&&(c.filename=m),Object(k.useEffect)(function(){var ye,Pe,Me=(ye=document.cookie)===null||ye===void 0||((Pe=ye.replace(/\s/g,""))===null||Pe===void 0)?void 0:Pe.split(";");Me==null||Me.map(function(Ne){var Fe=Ne.split("=");Fe[0]==="_educoder_session"&&fe(Fe[1])})},[]),Object(k.useEffect)(function(){b==="office"&&ae()},[b]);var ae=function(){var ye=Object(P.a)(I.a.mark(function Pe(){var Me,Ne,Fe;return I.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:return console.log("data:",f),Me=f,f.startsWith("http")||(Me=location.origin+Me),Ne=new URL(Me).pathname.split("/").pop(),Be.next=6,Object(h.U)({attachment_id:Ne});case 6:Fe=Be.sent,we(Fe);case 8:case"end":return Be.stop()}},Pe)}));return function(){return ye.apply(this,arguments)}}(),_e=function(){if(f.startsWith("http")||f.startsWith("/api")||f.startsWith("blob:")){Oe();return}Object(S.x)(m||"educoder",f,m||"educoder")},Oe=function(){Object(S.v)(m||"educoder",decodeURIComponent(f))};return v.a.createElement("div",{style:Object(B.a)({},a||{}),className:"".concat(E&&R.a.bgBlack," ").concat(b?R.a.wrp:"hide")},x&&v.a.createElement("div",{className:R.a.close,ref:he},v.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return he.current}},v.a.createElement("span",{onClick:Oe},v.a.createElement("i",{className:"icon-quxiaozhiding"}))),v.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return he.current}},v.a.createElement("span",{className:"",onClick:function(){y(),we(null)}},v.a.createElement("i",{className:"icon-guanbi1"})))),v.a.createElement("div",{className:"".concat(R.a[d]," ").concat(d," ").concat(R.a.monaco," ").concat(b==="txt"?"show":"hide")},b==="txt"&&v.a.createElement(w.b,c)),b==="audio"&&v.a.createElement("audio",{src:"".concat((f==null?void 0:f.indexOf("http://"))>-1||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(f),autoPlay:!0}),b==="video"&&v.a.createElement(v.a.Fragment,null,(f==null?void 0:f.indexOf("/api"))>-1?v.a.createElement("video",{controls:!0,src:"".concat(f),autoPlay:!0}):v.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(f),autoPlay:!0})),b==="office"&&Ce&&v.a.createElement("iframe",{src:"".concat(Te,"?key=").concat(Ce.key,"&url=").concat(o.a.API_SERVER+Ce.url,"&callbackUrl=").concat(o.a.API_SERVER+Ce.callbackUrl,"&fileType=").concat(Ce.fileType,"&title=").concat(Ce.title,"&model=view")}),(b==="xlsx"||b==="doc"||b==="pptx"||b==="docx")&&v.a.createElement("iframe",{src:"".concat(Te,"?key=").concat(U.key,"&url=").concat(o.a.API_SERVER+U.url,"&callbackUrl=").concat(o.a.API_SERVER+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(U.model)}),b==="html"&&v.a.createElement("iframe",{src:f+"&disposition=inline"}),b==="pdf"&&v.a.createElement("embed",{className:R.a.embed,src:f,type:"application/pdf"}),b==="image"&&v.a.createElement("img",{src:"".concat((f==null?void 0:f.indexOf("http://"))>-1||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(f)}),b==="other"&&v.a.createElement("div",null,v.a.createElement(Q.a,{type:"primary",size:"large",onClick:_e},v.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),b==="download"&&v.a.createElement(Q.a,{type:"primary",size:"large",onClick:_e},v.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};qe.a=l},"p77/":function(bt,qe,ie){},"rAM+":function(bt,qe,ie){"use strict";ie.d(qe,"a",function(){return Q});var le=ie("Qw5x");function Q(D,Z){var B;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(B=Object(le.a)(D))||Z&&D&&typeof D.length=="number"){B&&(D=B);var P=0,G=function(){};return{s:G,n:function(){return P>=D.length?{done:!0}:{done:!1,value:D[P++]}},e:function(T){throw T},f:G}}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 j=!0,I=!1,k;return{s:function(){B=D[Symbol.iterator]()},n:function(){var T=B.next();return j=T.done,T},e:function(T){I=!0,k=T},f:function(){try{!j&&B.return!=null&&B.return()}finally{if(I)throw k}}}}},rUJ1:function(bt,qe){const ie=/[&<>"']/,le=/[&<>"']/g,Q=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=b=>Z[b];function P(b,m){if(m){if(ie.test(b))return b.replace(le,B)}else if(Q.test(b))return b.replace(D,B);return b}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(b){return b.replace(G,(m,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 I=/(^|[^\[])\^/g;function k(b,m){b=b.source||b,m=m||"";const c={replace:(d,a)=>(a=a.source||a,a=a.replace(I,"$1"),b=b.replace(d,a),c),getRegex:()=>new RegExp(b,m)};return c}const v=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(b,m,c){if(b){let d;try{d=decodeURIComponent(j(c)).replace(v,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}m&&!T.test(c)&&(c=o(m,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(d){return null}return c}const _={},w=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,m){_[" "+b]||(w.test(b)?_[" "+b]=b+"/":_[" "+b]=p(b,"/",!0)),b=_[" "+b];const c=b.indexOf(":")===-1;return m.substring(0,2)==="//"?c?m:b.replace(S,"$1")+m:m.charAt(0)==="/"?c?m:b.replace(h,"$1")+m:b+m}const l={exec:function(){}};function u(b){let m=1,c,d;for(;m<arguments.length;m++){c=arguments[m];for(d in c)Object.prototype.hasOwnProperty.call(c,d)&&(b[d]=c[d])}return b}function A(b,m){const c=b.replace(/\|/g,(x,y,E)=>{let N=!1,U=y;for(;--U>=0&&E[U]==="\\";)N=!N;return N?"|":" |"}),d=c.split(/ \|/);let a=0;if(d.length>m)d.splice(m);else for(;d.length<m;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function p(b,m,c){const d=b.length;if(d===0)return"";let a=0;for(;a<d;){const x=b.charAt(d-a-1);if(x===m&&!c)a++;else if(x!==m&&c)a++;else break}return b.substr(0,d-a)}function f(b,m){if(b.indexOf(m[1])===-1)return-1;const c=b.length;let d=0,a=0;for(;a<c;a++)if(b[a]==="\\")a++;else if(b[a]===m[0])d++;else if(b[a]===m[1]&&(d--,d<0))return a;return-1}function L(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")}bt.exports={escape:P,unescape:j,edit:k,cleanUrl:R,resolveUrl:o,noopTest:l,merge:u,splitCells:A,rtrim:p,findClosingBracket:f,checkSanitizeDeprecation:L}},ulZh:function(bt,qe,ie){typeof window!="undefined"&&function(Q,D){bt.exports=D()}(this,function(){return function(le){var Q={};function D(Z){if(Q[Z])return Q[Z].exports;var B=Q[Z]={i:Z,l:!1,exports:{}};return le[Z].call(B.exports,B,B.exports,D),B.l=!0,B.exports}return D.m=le,D.c=Q,D.d=function(Z,B,P){D.o(Z,B)||Object.defineProperty(Z,B,{enumerable:!0,get:P})},D.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},D.t=function(Z,B){if(B&1&&(Z=D(Z)),B&8)return Z;if(B&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:Z}),B&2&&typeof Z!="string")for(var G in Z)D.d(P,G,function(j){return Z[j]}.bind(null,G));return P},D.n=function(Z){var B=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return D.d(B,"a",B),B},D.o=function(Z,B){return Object.prototype.hasOwnProperty.call(Z,B)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,Q,D){"use strict";var Z=Object.prototype.hasOwnProperty,B="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(B=!1));function G(v,T,R){this.fn=v,this.context=T,this.once=R||!1}function j(v,T,R,_,w){if(typeof R!="function")throw new TypeError("The listener must be a function");var S=new G(R,_||v,w),h=B?B+T:T;return v._events[h]?v._events[h].fn?v._events[h]=[v._events[h],S]:v._events[h].push(S):(v._events[h]=S,v._eventsCount++),v}function I(v,T){--v._eventsCount===0?v._events=new P:delete v._events[T]}function k(){this._events=new P,this._eventsCount=0}k.prototype.eventNames=function(){var T=[],R,_;if(this._eventsCount===0)return T;for(_ in R=this._events)Z.call(R,_)&&T.push(B?_.slice(1):_);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(R)):T},k.prototype.listeners=function(T){var R=B?B+T:T,_=this._events[R];if(!_)return[];if(_.fn)return[_.fn];for(var w=0,S=_.length,h=new Array(S);w<S;w++)h[w]=_[w].fn;return h},k.prototype.listenerCount=function(T){var R=B?B+T:T,_=this._events[R];return _?_.fn?1:_.length:0},k.prototype.emit=function(T,R,_,w,S,h){var o=B?B+T:T;if(!this._events[o])return!1;var l=this._events[o],u=arguments.length,A,p;if(l.fn){l.once&&this.removeListener(T,l.fn,void 0,!0);switch(u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,R),!0;case 3:return l.fn.call(l.context,R,_),!0;case 4:return l.fn.call(l.context,R,_,w),!0;case 5:return l.fn.call(l.context,R,_,w,S),!0;case 6:return l.fn.call(l.context,R,_,w,S,h),!0}for(p=1,A=new Array(u-1);p<u;p++)A[p-1]=arguments[p];l.fn.apply(l.context,A)}else{var f=l.length,L;for(p=0;p<f;p++){l[p].once&&this.removeListener(T,l[p].fn,void 0,!0);switch(u){case 1:l[p].fn.call(l[p].context);break;case 2:l[p].fn.call(l[p].context,R);break;case 3:l[p].fn.call(l[p].context,R,_);break;case 4:l[p].fn.call(l[p].context,R,_,w);break;default:if(!A)for(L=1,A=new Array(u-1);L<u;L++)A[L-1]=arguments[L];l[p].fn.apply(l[p].context,A)}}}return!0},k.prototype.on=function(T,R,_){return j(this,T,R,_,!1)},k.prototype.once=function(T,R,_){return j(this,T,R,_,!0)},k.prototype.removeListener=function(T,R,_,w){var S=B?B+T:T;if(!this._events[S])return this;if(!R)return I(this,S),this;var h=this._events[S];if(h.fn)h.fn===R&&(!w||h.once)&&(!_||h.context===_)&&I(this,S);else{for(var o=0,l=[],u=h.length;o<u;o++)(h[o].fn!==R||w&&!h[o].once||_&&h[o].context!==_)&&l.push(h[o]);l.length?this._events[S]=l.length===1?l[0]:l:I(this,S)}return this},k.prototype.removeAllListeners=function(T){var R;return T?(R=B?B+T:T,this._events[R]&&I(this,R)):(this._events=new P,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=B,k.EventEmitter=k,le.exports=k},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,Q,D){(function(Z){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,j=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,I={buildAbsoluteURL:function(k,v,T){if(T=T||{},k=k.trim(),v=v.trim(),!v){if(!T.alwaysNormalize)return k;var R=I.parseURL(k);if(!R)throw new Error("Error trying to parse base URL.");return R.path=I.normalizePath(R.path),I.buildURLFromParts(R)}var _=I.parseURL(v);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return T.alwaysNormalize?(_.path=I.normalizePath(_.path),I.buildURLFromParts(_)):v;var w=I.parseURL(k);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var S=P.exec(w.path);w.netLoc=S[1],w.path=S[2]}w.netLoc&&!w.path&&(w.path="/");var h={scheme:w.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(h.netLoc=w.netLoc,_.path[0]!=="/"))if(!_.path)h.path=w.path,_.params||(h.params=w.params,_.query||(h.query=w.query));else{var o=w.path,l=o.substring(0,o.lastIndexOf("/")+1)+_.path;h.path=I.normalizePath(l)}return h.path===null&&(h.path=T.alwaysNormalize?I.normalizePath(_.path):_.path),I.buildURLFromParts(h)},parseURL:function(k){var v=B.exec(k);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(k){for(k=k.split("").reverse().join("").replace(G,"");k.length!==(k=k.replace(j,"")).length;);return k.split("").reverse().join("")},buildURLFromParts:function(k){return k.scheme+k.netLoc+k.path+k.params+k.query+k.fragment}};le.exports=I})(this)},"./node_modules/webworkify-webpack/index.js":function(le,Q,D){function Z(T){var R={};function _(S){if(R[S])return R[S].exports;var h=R[S]={i:S,l:!1,exports:{}};return T[S].call(h.exports,h,h.exports,_),h.l=!0,h.exports}_.m=T,_.c=R,_.i=function(S){return S},_.d=function(S,h,o){_.o(S,h)||Object.defineProperty(S,h,{configurable:!1,enumerable:!0,get:o})},_.r=function(S){Object.defineProperty(S,"__esModule",{value:!0})},_.n=function(S){var h=S&&S.__esModule?function(){return S.default}:function(){return S};return _.d(h,"a",h),h},_.o=function(S,h){return Object.prototype.hasOwnProperty.call(S,h)},_.p="/",_.oe=function(S){throw console.error(S),S};var w=_(_.s=ENTRY_MODULE);return w.default||w}var B="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function G(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function j(T){return!isNaN(1*T)}function I(T,R,_){var w={};w[_]=[];var S=R.toString(),h=S.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return w;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+G(o)+P,"g"),u;u=l.exec(S);){if(u[3]==="dll-reference")continue;w[_].push(u[3])}for(l=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+P,"g");u=l.exec(S);)T[u[2]]||(w[_].push(u[1]),T[u[2]]=D(u[1]).m),w[u[2]]=w[u[2]]||[],w[u[2]].push(u[4]);for(var A=Object.keys(w),p=0;p<A.length;p++)for(var f=0;f<w[A[p]].length;f++)j(w[A[p]][f])&&(w[A[p]][f]=1*w[A[p]][f]);return w}function k(T){var R=Object.keys(T);return R.reduce(function(_,w){return _||T[w].length>0},!1)}function v(T,R){for(var _={main:[R]},w={main:[]},S={main:{}};k(_);)for(var h=Object.keys(_),o=0;o<h.length;o++){var l=h[o],u=_[l],A=u.pop();if(S[l]=S[l]||{},S[l][A]||!T[l][A])continue;S[l][A]=!0,w[l]=w[l]||[],w[l].push(A);for(var p=I(T,T[l][A],l),f=Object.keys(p),L=0;L<f.length;L++)_[f[L]]=_[f[L]]||[],_[f[L]]=_[f[L]].concat(p[f[L]])}return w}le.exports=function(T,R){R=R||{};var _={main:D.m},w=R.all?{main:Object.keys(_.main)}:v(_,T),S="";Object.keys(w).filter(function(A){return A!=="main"}).forEach(function(A){for(var p=0;w[A][p];)p++;w[A].push(p),_[A][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",S=S+"var "+A+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+w[A].map(function(f){return""+JSON.stringify(f)+": "+_[A][f].toString()}).join(",")+`});
`}),S=S+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+w.main.map(function(A){return""+JSON.stringify(A)+": "+_.main[A].toString()}).join(",")+"}))(self);";var h=new window.Blob([S],{type:"text/javascript"});if(R.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"hlsDefaultConfig",function(){return L}),D.d(Q,"mergeConfig",function(){return m}),D.d(Q,"enableStreamingMode",function(){return c});var Z=D("./src/controller/abr-controller.ts"),B=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),G=D("./src/controller/subtitle-stream-controller.ts"),j=D("./src/controller/subtitle-track-controller.ts"),I=D("./src/controller/buffer-controller.ts"),k=D("./src/controller/timeline-controller.ts"),v=D("./src/controller/cap-level-controller.ts"),T=D("./src/controller/fps-controller.ts"),R=D("./src/controller/eme-controller.ts"),_=D("./src/controller/cmcd-controller.ts"),w=D("./src/utils/xhr-loader.ts"),S=D("./src/utils/fetch-loader.ts"),h=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(d[y]=x[y])}return d},u.apply(this,arguments)}function A(d,a){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);a&&(y=y.filter(function(E){return Object.getOwnPropertyDescriptor(d,E).enumerable})),x.push.apply(x,y)}return x}function p(d){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?A(Object(x),!0).forEach(function(y){f(d,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):A(Object(x)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(x,y))})}return d}function f(d,a,x){return a in d?Object.defineProperty(d,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):d[a]=x,d}var L=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:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:I.default,capLevelController:v.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:j.default,timelineController:k.TimelineController,audioStreamController:B.default,audioTrackController:P.default,emeController:R.default,cmcdController:_.default});function b(){return{cueHandler:h.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 m(d,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},d,a)}function c(d){var a=d.loader;if(a!==S.default&&a!==w.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var x=Object(S.fetchSupported)();x&&(d.loader=S.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),I=D("./src/types/loader.ts"),k=D("./src/utils/logger.ts");function v(_,w){for(var S=0;S<w.length;S++){var h=w[S];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(_,h.key,h)}}function T(_,w,S){return w&&v(_.prototype,w),S&&v(_,S),_}var R=function(){function _(S){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=S;var h=S.config;this.bwEstimator=new B.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var w=_.prototype;return w.registerListeners=function(){var h=this.hls;h.on(P.Events.FRAG_LOADING,this.onFragLoading,this),h.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(P.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var h=this.hls;h.off(P.Events.FRAG_LOADING,this.onFragLoading,this),h.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(P.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(h,o){var l=o.frag;if(l.type===I.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=l,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(h,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,A=l.config,p=l.media;if(!h||!p)return;var f=o?o.stats:h.stats,L=o?o.duration:h.duration;if(f.aborted){k.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||p.paused||!p.playbackRate||!p.readyState)return;var b=performance.now()-f.loading.start,m=Math.abs(p.playbackRate);if(b<=500*L/m)return;var c=l.levels,d=l.minAutoLevel,a=c[h.level],x=f.total||Math.max(f.loaded,Math.round(L*a.maxBitrate/8)),y=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/b),E=(x-f.loaded)/y,N=p.currentTime,U=(G.BufferHelper.bufferInfo(p,N,A.maxBufferHole).end-N)/m;if(U>=2*L/m||E<=U)return;var K=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>d;V--){var O=c[V].maxBitrate;if(K=L*O/(8*.8*y),K<U)break}if(K>=E)return;var M=this.bwEstimator.getEstimate();k.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Z.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:f})},w.onFragLoaded=function(h,o){var l=o.frag,u=o.part;if(l.type===I.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var A=u?u.stats:l.stats,p=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],L=(f.loaded?f.loaded.bytes:0)+A.loaded,b=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:L,duration:b},f.realBitrate=Math.round(8*L/b)}if(l.bitrateTest){var m={stats:A,frag:l,part:u,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},w.onFragBuffered=function(h,o){var l=o.frag,u=o.part,A=u?u.stats:l.stats;if(A.aborted)return;if(l.type!==I.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var p=A.parsing.end-A.loading.start;this.bwEstimator.sample(p,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},w.onError=function(h,o){switch(o.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,A=l.config,p=l.minAutoLevel,f=l.media,L=o?o.duration:h?h.duration:0,b=f?f.currentTime:0,m=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,d=(G.BufferHelper.bufferInfo(f,b,A.maxBufferHole).end-b)/m,a=this.findBestLevel(c,p,u,d,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(a>=0)return a;k.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=L?Math.min(L,A.maxStarvationDelay):A.maxStarvationDelay,y=A.abrBandWidthFactor,E=A.abrBandWidthUpFactor;if(!d){var N=this.bitrateTestDelay;if(N){var U=L?Math.min(L,A.maxLoadingDelay):A.maxLoadingDelay;x=U-N,k.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=E=1}}return a=this.findBestLevel(c,p,u,d+x,y,E),Math.max(a,0)},w.findBestLevel=function(h,o,l,u,A,p){for(var f,L=this.fragCurrent,b=this.partCurrent,m=this.lastLoadedFragLevel,c=this.hls.levels,d=c[m],a=!!(d!=null&&(f=d.details)!==null&&f!==void 0&&f.live),x=d==null?void 0:d.codecSet,y=b?b.duration:L?L.duration:0,E=l;E>=o;E--){var N=c[E];if(!N||x&&N.codecSet!==x)continue;var U=N.details,K=(b?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||y,V=void 0;E<=m?V=A*h:V=p*h;var O=c[E].maxBitrate,M=O*K/V;if(k.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(V)+"/"+O+"/"+K+"/"+u+"/"+M),V>O&&(!M||a&&!this.bitrateTestDelay||M<u))return E}return-1},T(_,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),_}();Q.default=R},"./src/controller/audio-stream-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/level.ts"),k=D("./src/types/loader.ts"),v=D("./src/loader/fragment.ts"),T=D("./src/demux/chunk-cache.ts"),R=D("./src/demux/transmuxer-interface.ts"),_=D("./src/types/transmuxer.ts"),w=D("./src/controller/fragment-finders.ts"),S=D("./src/utils/discontinuities.ts"),h=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var m=arguments[b];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},l.apply(this,arguments)}function u(L,b){L.prototype=Object.create(b.prototype),L.prototype.constructor=L,A(L,b)}function A(L,b){return A=Object.setPrototypeOf||function(c,d){return c.__proto__=d,c},A(L,b)}var p=100,f=function(L){u(b,L);function b(c,d){var a;return a=L.call(this,c,d,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var m=b.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var d=this.hls;d.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(P.Events.ERROR,this.onError,this),d.on(P.Events.BUFFER_RESET,this.onBufferReset,this),d.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var d=this.hls;d.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(P.Events.ERROR,this.onError,this),d.off(P.Events.BUFFER_RESET,this.onBufferReset,this),d.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(d,a){var x=a.frag,y=a.id,E=a.initPTS;if(y==="main"){var N=x.cc;this.initPTS[x.cc]=E,this.log("InitPTS for cc: "+N+" found from main: "+E),this.videoTrackCC=N,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=B.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},m.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var d,a=this.levels,x=this.trackId,y=a==null||((d=a[x])===null||d===void 0)?void 0:d.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var E,N=performance.now(),U=this.retryDate;(!U||N>=U||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,O=K.part,M=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var ee=M.flush(),oe={frag:V,part:O,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),$&&L.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),Re=G.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),Ee=Object(w.fragmentWithinToleranceTest)(Re.end,this.config.maxFragLookUpTolerance,V);Ee<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Re.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},m.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},m.doTickIdle=function(){var d,a,x=this.hls,y=this.levels,E=this.media,N=this.trackId,U=x.config;if(!y||!y[N])return;if(!E&&(this.startFragRequested||!U.startFragPrefetch))return;var K=y[N],V=K.details;if(!V||V.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(V)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,k.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,k.PlaylistLevelType.AUDIO);if(O===null)return;var M=O.len,$=this.getMaxBufferLength(),ee=this.audioSwitch;if(M>=$&&!ee)return;if(!ee&&this._streamEnded(O,V)){x.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var oe=V.fragments,fe=oe[0].start,Re=O.end;if(ee){var Ee=this.getLoadPosition();Re=Ee,V.PTSKnown&&Ee<fe&&((O.end>fe||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=fe+.05))}var Ce=this.getNextFragment(Re,V);if(!Ce){this.bufferFlushed=!0;return}((d=Ce.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Ce.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ce,V):this.loadFragment(Ce,V,Re)},m.getMaxBufferLength=function(){var d=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,k.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},m.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(d,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new I.Level(y)})},m.onAudioTrackSwitching=function(d,a){var x=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(p):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(d,a){this.mainDetails=a.details},m.onAudioTrackLoaded=function(d,a){var x,y=this.levels,E=a.details,N=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var U=y[N],K=0;if(E.live||(x=U.details)!==null&&x!==void 0&&x.live){var V=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!V)return;!U.details&&E.hasProgramDateTime&&V.hasProgramDateTime?(Object(S.alignMediaPlaylistByPDT)(E,V),K=E.fragments[0].start):K=this.alignPlaylists(E,U.details)}U.details=E,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(U.details,K),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=B.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(d){var a,x=d.frag,y=d.part,E=d.payload,N=this.config,U=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var V=K[U];console.assert(V,"Audio track is defined on fragment load progress");var O=V.details;console.assert(O,"Audio track details are defined on fragment load progress");var M=N.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new R.default(this.hls,k.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[x.cc],oe=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var fe=!1,Re=y?y.index:-1,Ee=Re!==-1,Ce=new _.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,E.byteLength,Re,Ee);$.push(E,oe,M,"",x,y,O.totalduration,fe,Ce,ee)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+U);var we=this.waitingData=this.waitingData||{frag:x,part:y,cache:new T.default,complete:!1},Te=we.cache;Te.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,d)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(d,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},m.onFragBuffered=function(d,a){var x=a.frag,y=a.part;if(x.type!==k.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},m.onError=function(d,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=a.fatal?B.State.ERROR:B.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,k.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(d,a){var x=a.type;x===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(d){var a,x="audio",y=this.hls,E=d.remuxResult,N=d.chunkMeta,U=this.getCurrentContext(N);if(!U){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var K=U.frag,V=U.part,O=E.audio,M=E.text,$=E.id3,ee=E.initSegment;if(this.fragContextChanged(K))return;if(this.state=B.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,N),y.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:x,tracks:ee.tracks})),O){var oe=O.startPTS,fe=O.endPTS,Re=O.startDTS,Ee=O.endDTS;V&&(V.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:fe,startDTS:Re,endDTS:Ee}),K.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,oe,fe,Re,Ee),this.bufferFragmentData(O,K,V,N)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Ce=l({frag:K,id:x},$);y.trigger(P.Events.FRAG_PARSING_METADATA,Ce)}if(M){var we=l({frag:K,id:x},M);y.trigger(P.Events.FRAG_PARSING_USERDATA,we)}},m._bufferInitSegment=function(d,a,x){if(this.state!==B.State.PARSING)return;d.video&&delete d.video;var y=d.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,d);var E=y.initSegment;if(E!=null&&E.byteLength){var N={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:E};this.hls.trigger(P.Events.BUFFER_APPENDING,N)}this.tick()},m.loadFragment=function(d,a,x){var y=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||y===j.FragmentState.NOT_LOADED||y===j.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(Z.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,d,a,x)))},m.completeAudioSwitch=function(){var d=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:x})},b}(B.default);Q.default=f},"./src/controller/audio-track-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function j(R,_){for(var w=0;w<_.length;w++){var S=_[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(R,S.key,S)}}function I(R,_,w){return _&&j(R.prototype,_),w&&j(R,w),R}function k(R,_){R.prototype=Object.create(_.prototype),R.prototype.constructor=R,v(R,_)}function v(R,_){return v=Object.setPrototypeOf||function(S,h){return S.__proto__=h,S},v(R,_)}var T=function(R){k(_,R);function _(S){var h;return h=R.call(this,S,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var w=_.prototype;return w.registerListeners=function(){var h=this.hls;h.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Z.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var h=this.hls;h.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Z.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(h,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(h,o){var l=o.id,u=o.details,A=this.tracksInGroup[l];if(!A){this.warn("Invalid audio track id "+l);return}var p=A.details;A.details=o.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,p))},w.onLevelLoading=function(h,o){this.switchLevel(o.level)},w.onLevelSwitching=function(h,o){this.switchLevel(o.level)},w.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(p){return!l||p.groupId===l});this.selectDefaultTrack&&!u.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var A={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,A),this.selectInitialTrack()}},w.onError=function(h,o){if(R.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var u=o[h],A=u.id,p=u.groupId,f=p===void 0?"":p,L=u.name,b=u.type,m=u.url;if(this.trackId=h,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:A,groupId:f,name:L,type:b,url:m}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(c)},w.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var u=o[l];if((!this.selectDefaultTrack||u.default)&&(!h||h===u.name))return u.id}return-1},w.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,u=o.groupId,A=o.url;if(h)try{A=h.addDirectives(A)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:A,id:l,groupId:u,deliveryDirectives:h||null})}},I(_,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),_}(P.default);Q.default=T},"./src/controller/base-playlist-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/polyfills/number.ts"),B=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),G=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),I=function(){function k(T,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,R+":"),this.warn=G.logger.warn.bind(G.logger,R+":"),this.hls=T}var v=k.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(R,_){_.fatal&&_.type===j.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(R,_){var w=_==null?void 0:_.renditionReports;if(w)for(var S=0;S<w.length;S++){var h=w[S],o=""+h.URI;if(o===R.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),u=parseInt(h["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var A=Math.min(_.age-_.partTarget,_.targetduration);u!==void 0&&A>_.partTarget&&(u+=1)}if(Object(Z.isFiniteNumber)(l))return new B.HlsUrlParameters(l,Object(Z.isFiniteNumber)(u)?u:void 0,B.HlsSkip.No)}}},v.loadPlaylist=function(R){},v.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},v.playlistLoaded=function(R,_,w){var S=this,h=_.details,o=_.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||w!=null&&w.live){if(h.reloaded(w),w&&this.log("live playlist "+R+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),w&&h.fragments.length>0&&Object(P.mergeDetails)(w,h),!this.canLoad||!h.live)return;var u,A=void 0,p=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var f=this.hls.config.lowLatencyMode,L=h.lastPartSn,b=h.endSN,m=h.lastPartIndex,c=m!==-1,d=L===b,a=f?0:m;c?(A=d?b+1:L,p=d?a:m+1):A=b+1;var x=h.age,y=x+h.ageHeader,E=Math.min(y-h.partTarget,h.targetduration*1.5);if(E>0){if(w&&E>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+E+" with playlist age: "+h.age),E=0;else{var N=Math.floor(E/h.targetduration);if(A+=N,p!==void 0){var U=Math.round(E%h.targetduration/h.partTarget);p+=U}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+E+" skip sn "+N+" to part "+p)}h.tuneInGoal=E}if(u=this.getDeliveryDirectives(h,_.deliveryDirectives,A,p),f||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(h,_.deliveryDirectives,A,p);var K=Object(P.computeReloadInterval)(h,o);A!==void 0&&h.canBlockReload&&(K-=h.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return S.loadPlaylist(u)},K)}else this.clearTimer()},v.getDeliveryDirectives=function(R,_,w,S){var h=Object(B.getSkipValue)(R,w);return _!=null&&_.skip&&R.deltaUpdateFailed&&(w=_.msn,S=_.part,h=B.HlsSkip.No),new B.HlsUrlParameters(w,S,h)},v.retryLoadingOrFail=function(R){var _=this,w=this.hls.config,S=this.retryCount<w.levelLoadingMaxRetry;if(S){var h;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(h=R.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return _.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return S},k}()},"./src/controller/base-stream-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"State",function(){return b}),D.d(Q,"default",function(){return m});var Z=D("./src/polyfills/number.ts"),B=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/utils/logger.ts"),I=D("./src/events.ts"),k=D("./src/errors.ts"),v=D("./src/types/transmuxer.ts"),T=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/discontinuities.ts"),_=D("./src/controller/fragment-finders.ts"),w=D("./src/controller/level-helper.ts"),S=D("./src/loader/fragment-loader.ts"),h=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function u(c,d){for(var a=0;a<d.length;a++){var x=d[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function A(c,d,a){return d&&u(c.prototype,d),a&&u(c,a),c}function p(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,d){c.prototype=Object.create(d.prototype),c.prototype.constructor=c,L(c,d)}function L(c,d){return L=Object.setPrototypeOf||function(x,y){return x.__proto__=y,x},L(c,d)}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"},m=function(c){f(d,c);function d(x,y,E){var N;return N=c.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=b.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=E,N.log=j.logger.log.bind(j.logger,E+":"),N.warn=j.logger.warn.bind(j.logger,E+":"),N.hls=x,N.fragmentLoader=new S.default(x.config),N.fragmentTracker=y,N.config=x.config,N.decrypter=new h.default(x,x.config),x.on(I.Events.KEY_LOADED,N.onKeyLoaded,p(N)),N}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(y){},a.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(y,E){var N=this.fragCurrent,U=this.fragmentTracker;if(!E.live&&N&&N.sn===E.endSN&&!y.nextStart){var K=U.getState(N);return K===P.FragmentState.PARTIAL||K===P.FragmentState.OK}return!1},a.onMediaAttached=function(y,E){var N=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var y=this.config,E=this.fragCurrent,N=this.media,U=this.mediaBuffer,K=this.state,V=N?N.currentTime:0,O=G.BufferHelper.bufferInfo(U||N,V,y.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===b.ENDED)this.resetLoadingState();else if(E&&!O.len){var M=y.maxFragLookUpTolerance,$=E.start-M,ee=E.start+E.duration+M,oe=V>ee;(V<$||oe)&&(oe&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=V),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(y,E){if(this.state!==b.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var N=this.levels[E.frag.level].details;N&&this.loadFragment(E.frag,N,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(I.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(y,E){this.log("Loading key for "+y.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=b.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(I.Events.KEY_LOADING,{frag:y})},a.loadFragment=function(y,E,N){this._loadFragForPlayback(y,E,N)},a._loadFragForPlayback=function(y,E,N){var U=this,K=function(O){if(U.fragContextChanged(y)){U.warn("Fragment "+y.sn+(O.part?" p: "+O.part.index:"")+" of level "+y.level+" was dropped during download."),U.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,U._handleFragmentLoadProgress(O)};this._doFragLoad(y,E,N,K).then(function(V){if(!V)return;U.fragLoadError=0;var O=U.state;if(U.fragContextChanged(y)){(O===b.FRAG_LOADING||O===b.BACKTRACKING||!U.fragCurrent&&O===b.PARSING)&&(U.fragmentTracker.removeFragment(y),U.state=b.IDLE);return}if("payload"in V&&(U.log("Loaded fragment "+y.sn+" of level "+y.level),U.hls.trigger(I.Events.FRAG_LOADED,V),U.state===b.BACKTRACKING)){U.fragmentTracker.backtrack(y,V),U.resetFragmentLoading(y);return}U._handleFragmentLoadComplete(V)}).catch(function(V){U.warn(V),U.resetFragmentLoading(y)})},a.flushMainBuffer=function(y,E,N){if(N===void 0&&(N=null),!(y-E))return;var U={startOffset:y,endOffset:E,type:N};this.fragLoadError=0,this.hls.trigger(I.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(y){var E=this;this._doFragLoad(y).then(function(N){if(!N||E.fragContextChanged(y)||!E.levels)throw new Error("init load aborted");return N}).then(function(N){var U=E.hls,K=N.payload,V=y.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var O=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(M){var $=self.performance.now();return U.trigger(I.Events.FRAG_DECRYPTED,{frag:y,payload:M,stats:{tstart:O,tdecrypt:$}}),N.payload=M,N})}return N}).then(function(N){var U=E.fragCurrent,K=E.hls,V=E.levels;if(!V)throw new Error("init load aborted, missing levels");var O=V[y.level].details;console.assert(O,"Level details are defined when init segment is loaded");var M=y.stats;E.state=b.IDLE,E.fragLoadError=0,y.data=new Uint8Array(N.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),N.frag===U&&K.trigger(I.Events.FRAG_BUFFERED,{stats:M,frag:U,part:null,id:y.type}),E.tick()}).catch(function(N){E.warn(N),E.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var E=this.fragCurrent;return!y||!E||y.level!==E.level||y.sn!==E.sn||y.urlId!==E.urlId},a.fragBufferedComplete=function(y,E){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(G.BufferHelper.getBuffered(N))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var E=this.transmuxer;if(!E)return;var N=y.frag,U=y.part,K=y.partsLoaded,V=!K||K.length===0||K.some(function(M){return!M}),O=new v.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,U?U.index:-1,!V);E.flush(O)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,E,N,U){var K=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(y.start,N||0),this.config.lowLatencyMode&&E){var V=E.partList;if(V&&U){N>y.end&&E.fragmentHint&&(y=E.fragmentHint);var O=this.getNextPart(V,y,N);if(O>-1){var M=V[O];return this.log("Loading part sn: "+y.sn+" p: "+M.index+" cc: "+y.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+O+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=b.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:y,part:V[O],targetBufferTime:N}),this.doFragPartsLoad(y,V,O,U).catch(function($){return K.handleFragLoadError($)})}else if(!y.url||this.loadedEndOfParts(V,N))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(N.toFixed(3))),Object(Z.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=b.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:y,targetBufferTime:N}),this.fragmentLoader.load(y,U).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(y,E,N,U){var K=this;return new Promise(function(V,O){var M=[],$=function ee(oe){var fe=E[oe];K.fragmentLoader.loadPart(y,fe,U).then(function(Re){M[fe.index]=Re;var Ee=Re.part;K.hls.trigger(I.Events.FRAG_LOADED,Re);var Ce=E[oe+1];if(Ce&&Ce.fragment===y)ee(oe+1);else return V({frag:y,part:Ee,partsLoaded:M})}).catch(O)};$(N)})},a.handleFragLoadError=function(y){var E=y.data;return E&&E.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(I.Events.ERROR,E),null},a._handleTransmuxerFlush=function(y){var E=this.getCurrentContext(y);if(!E||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var N=E.frag,U=E.part,K=E.level,V=self.performance.now();N.stats.parsing.end=V,U&&(U.stats.parsing.end=V),this.updateLevelTiming(N,U,K,y.partial)},a.getCurrentContext=function(y){var E=this.levels,N=y.level,U=y.sn,K=y.part;if(!E||!E[N])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+N+". The current chunk will not be buffered."),null;var V=E[N],O=K>-1?Object(w.getPartWith)(V,U,K):null,M=O?O.fragment:Object(w.getFragmentWithSN)(V,U,this.fragCurrent);return M?{frag:M,part:O,level:V}:null},a.bufferFragmentData=function(y,E,N,U){if(!y||this.state!==b.PARSING)return;var K=y.data1,V=y.data2,O=K;if(K&&V&&(O=Object(T.appendUint8Array)(K,V)),!O||!O.length)return;var M={type:y.type,frag:E,part:N,chunkMeta:U,parent:E.type,data:O};this.hls.trigger(I.Events.BUFFER_APPENDING,M),y.dropped&&y.independent&&!N&&this.flushBufferGap(E)},a.flushBufferGap=function(y){var E=this.media;if(!E)return;if(!G.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,y.start);return}var N=E.currentTime,U=G.BufferHelper.bufferInfo(E,N,0),K=y.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),O=Math.max(Math.min(y.start-V,U.end-V),N+V);y.start-O>V&&this.flushMainBuffer(O,y.start)},a.getFwdBufferInfo=function(y,E){var N=this.config,U=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(U))return null;var K=G.BufferHelper.bufferInfo(y,U,N.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(U,E);if(V&&K.nextStart<V.end)return G.BufferHelper.bufferInfo(y,U,Math.max(K.nextStart,N.maxBufferHole))}return K},a.getMaxBufferLength=function(y){var E=this.config,N;return y?N=Math.max(8*E.maxBufferSize/y,E.maxBufferLength):N=E.maxBufferLength,Math.min(N,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(y){var E=this.config,N=y||E.maxBufferLength;return E.maxMaxBufferLength>=N?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,E){var N,U,K=E.fragments,V=K.length;if(!V)return null;var O=this.config,M=K[0].start,$;if(E.live){var ee=O.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(E,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:y)}else y<=M&&($=K[0]);if(!$){var oe=O.lowLatencyMode?E.partEnd:E.fragmentEnd;$=this.getFragmentAtPosition(y,oe,E)}return(N=$)!==null&&N!==void 0&&N.initSegment&&!((U=$)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(y,E,N){for(var U=-1,K=!1,V=!0,O=0,M=y.length;O<M;O++){var $=y[O];if(V=V&&!$.independent,U>-1&&N<$.start)break;var ee=$.loaded;!ee&&(K||$.independent||V)&&$.fragment===E&&(U=O),K=ee}return U},a.loadedEndOfParts=function(y,E){var N=y[y.length-1];return N&&E>N.start&&N.loaded},a.getInitialLiveFragment=function(y,E){var N=this.fragPrevious,U=null;if(N){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),U=Object(_.findFragmentByPDT)(E,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var K=N.sn+1;if(K>=y.startSN&&K<=y.endSN){var V=E[K-y.startSN];N.cc===V.cc&&(U=V,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(_.findFragWithCC)(E,N.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(U=this.getFragmentAtPosition(O,this.bitrateTest?y.fragmentEnd:y.edge,y))}return U},a.getFragmentAtPosition=function(y,E,N){var U=this.config,K=this.fragPrevious,V=N.fragments,O=N.endSN,M=N.fragmentHint,$=U.maxFragLookUpTolerance,ee=!!(U.lowLatencyMode&&N.partList&&M);ee&&M&&!this.bitrateTest&&(V=V.concat(M),O=M.sn);var oe;if(y<E){var fe=y>E-$?0:$;oe=Object(_.findFragmentByPTS)(K,V,y,fe)}else oe=V[V.length-1];if(oe){var Re=oe.sn-N.startSN,Ee=K&&oe.level===K.level,Ce=V[Re+1],we=this.fragmentTracker.getState(oe);if(we===P.FragmentState.BACKTRACKED){oe=null;for(var Te=Re;V[Te]&&this.fragmentTracker.getState(V[Te])===P.FragmentState.BACKTRACKED;)K?oe=V[Te--]:oe=V[--Te];oe||(oe=Ce)}else K&&oe.sn===K.sn&&!ee&&(Ee&&(oe.sn<O&&this.fragmentTracker.getState(Ce)!==P.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Ce.sn),oe=Ce):oe=null))}return oe},a.synchronizeToLiveEdge=function(y){var E=this.config,N=this.media;if(!N)return;var U=this.hls.liveSyncPosition,K=N.currentTime,V=y.fragments[0].start,O=y.edge,M=K>=V-E.maxFragLookUpTolerance&&K<=O;if(U!==null&&N.duration>U&&(K<U||!M)){var $=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*y.targetduration;(!M&&N.readyState<4||K<O-$)&&(this.loadedmetadata||(this.nextLoadPosition=U),N.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+U.toFixed(3)),N.currentTime=U))}},a.alignPlaylists=function(y,E){var N=this.levels,U=this.levelLastLoaded,K=this.fragPrevious,V=U!==null?N[U]:null,O=y.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var M=y.fragments[0].start,$=!E,ee=y.alignedSliding&&Object(Z.isFiniteNumber)(M);if($||!ee&&!M){Object(R.alignStream)(K,V,y);var oe=y.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+y.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+O),oe}return M},a.waitForCdnTuneIn=function(y){var E=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*E)},a.setStartPosition=function(y,E){var N=this.startPosition;if(N<E&&(N=-1),N===-1||this.lastCurrentTime===-1){var U=y.startTimeOffset;Object(Z.isFiniteNumber)(U)?(N=E+U,U<0&&(N+=y.totalduration),N=Math.min(Math.max(E,N),E+y.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+N),this.startPosition=N):y.live?N=this.hls.liveSyncPosition||E:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},a.getLoadPosition=function(){var y=this.media,E=0;return this.loadedmetadata&&y?E=y.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(y,E){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(E?" part"+E.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},a.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(y,E){if(E.fatal)return;var N=E.frag;if(!N||N.type!==y)return;var U=this.fragCurrent;console.assert(U&&N.sn===U.sn&&N.level===U.level&&N.urlId===U.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+y+" "+N.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(y===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(j.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(y,E,N){if(!y)return;var U=G.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(E,U,N),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[y].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(y,E,N,U){var K=this,V=N.details;console.assert(!!V,"level.details must be defined");var O=Object.keys(y.elementaryStreams).reduce(function(M,$){var ee=y.elementaryStreams[$];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+y.sn+" "+$+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),M||!1;var fe=U?0:Object(w.updateFragPTSDTS)(V,y,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(I.Events.LEVEL_PTS_UPDATED,{details:V,level:N,drift:fe,type:$,frag:y,start:ee.startPTS,end:ee.endPTS}),!0}return M},!1);O?(this.state=b.PARSED,this.hls.trigger(I.Events.FRAG_PARSED,{frag:y,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},A(d,[{key:"state",get:function(){return this._state},set:function(y){var E=this._state;E!==y&&(this._state=y,this.log(E+"->"+y))}}]),d}(B.default)},"./src/controller/buffer-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts"),G=D("./src/errors.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/mediasource-helper.ts"),k=D("./src/loader/fragment.ts"),v=D("./src/controller/buffer-operation-queue.ts"),T=Object(I.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,_=function(){function w(h){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,A=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(B.Events.MEDIA_ATTACHED,{media:u})),A&&A.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var S=w.prototype;return S.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},S.destroy=function(){this.unregisterListeners(),this.details=null},S.registerListeners=function(){var o=this.hls;o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(B.Events.BUFFER_RESET,this.onBufferReset,this),o.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(B.Events.BUFFER_EOS,this.onBufferEos,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(B.Events.FRAG_PARSED,this.onFragParsed,this),o.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},S.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(B.Events.BUFFER_RESET,this.onBufferReset,this),o.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(B.Events.BUFFER_EOS,this.onBufferEos,this),o.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(B.Events.FRAG_PARSED,this.onFragParsed,this),o.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},S._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},S.onManifestParsed=function(o,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},S.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&T){var A=this.mediaSource=new T;A.addEventListener("sourceopen",this._onMediaSourceOpen),A.addEventListener("sourceended",this._onMediaSourceEnded),A.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(A),this._objectUrl=u.src}},S.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(A){P.logger.warn("[buffer-controller]: onMediaDetaching: "+A.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):P.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(B.Events.MEDIA_DETACHED,void 0)},S.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var u=o.sourceBuffer[l];try{u&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[l]=void 0)}catch(A){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",A)}}),this._initSourceBuffer()},S.onBufferCodecs=function(o,l){var u=this,A=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(p){if(A){var f=u.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var L=l[p],b=L.codec,m=L.levelCodec,c=L.container,d=(f.levelCodec||f.codec).replace(R,"$1"),a=(m||b).replace(R,"$1");if(d!==a){var x=c+";codecs="+(m||b);u.appendChangeType(p,x)}}}else u.pendingTracks[p]=l[p]}),A)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},S.appendChangeType=function(o,l){var u=this,A=this.operationQueue,p={execute:function(){var L=u.sourceBuffer[o];L&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),A.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};A.append(p,o)},S.onBufferAppending=function(o,l){var u=this,A=this.hls,p=this.operationQueue,f=this.tracks,L=l.data,b=l.type,m=l.frag,c=l.part,d=l.chunkMeta,a=d.buffering[b],x=self.performance.now();a.start=x;var y=m.stats.buffering,E=c?c.stats.buffering:null;y.start===0&&(y.start=x),E&&E.start===0&&(E.start=x);var N=f.audio,U=b==="audio"&&d.id===1&&(N==null?void 0:N.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),U){var O=u.sourceBuffer[b];if(O){var M=m.start-O.timestampOffset;Math.abs(M)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+M+") sn: "+m.sn+")"),O.timestampOffset=m.start)}}u.appendExecutor(L,b)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,y.first===0&&(y.first=O),E&&E.first===0&&(E.first=O);var M=u.sourceBuffer,$={};for(var ee in M)$[ee]=j.BufferHelper.getBuffered(M[ee]);u.appendError=0,u.hls.trigger(B.Events.BUFFER_APPENDED,{type:b,frag:m,part:c,chunkMeta:d,parent:m.type,timeRanges:$})},onError:function(O){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",O);var M={type:G.ErrorTypes.MEDIA_ERROR,parent:m.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=G.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,M.details=G.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>A.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+A.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),A.trigger(B.Events.ERROR,M)}};p.append(K,b)},S.onBufferFlushing=function(o,l){var u=this,A=this.operationQueue,p=function(L){return{execute:u.removeExecutor.bind(u,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(B.Events.BUFFER_FLUSHED,{type:L})},onError:function(m){P.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",m)}}};l.type?A.append(p(l.type),l.type):this.getSourceBufferTypes().forEach(function(f){A.append(p(f),f)})},S.onFragParsed=function(o,l){var u=this,A=l.frag,p=l.part,f=[],L=p?p.elementaryStreams:A.elementaryStreams;L[k.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(L[k.ElementaryStreamTypes.AUDIO]&&f.push("audio"),L[k.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var c=self.performance.now();A.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var d=p?p.stats:A.stats;u.hls.trigger(B.Events.FRAG_BUFFERED,{frag:A,part:p,stats:d,id:A.type})};f.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+A.type+" level: "+A.level+" sn: "+A.sn),this.blockBuffers(b,f)},S.onFragChanged=function(o,l){this.flushBackBuffer()},S.onBufferEos=function(o,l){var u=this,A=this.getSourceBufferTypes().reduce(function(p,f){var L=u.sourceBuffer[f];return(!l.type||l.type===f)&&(L&&!L.ended&&(L.ended=!0,P.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!L||L.ended)},!0);A&&this.blockBuffers(function(){var p=u.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},S.onLevelUpdated=function(o,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},S.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,A=this.sourceBuffer;if(!u||l===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(f)||f<0)return;var L=u.currentTime,b=l.levelTargetDuration,m=Math.max(f,b),c=Math.floor(L/b)*b-m;p.forEach(function(d){var a=A[d];if(a){var x=j.BufferHelper.getBuffered(a);x.length>0&&c>x.start(0)&&(o.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:d}))}})},S.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,A=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=u.duration,L=Object(Z.isFiniteNumber)(A.duration)?A.duration:0;o.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),A.duration=Infinity,this.updateSeekableRange(o)):(p>L&&p>f||!Object(Z.isFiniteNumber)(f))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),A.duration=p)},S.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,A=u.length;if(A&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var p=Math.max(0,u[0].start),f=Math.max(p,p+o.totalduration);l.setLiveSeekableRange(p,f)}},S.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,A=Object.keys(u).length;if(A&&!o||A===2){this.createSourceBuffers(u),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){l.executeNext(f)})}},S.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var A=0;for(var p in o)if(!l[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var L=f.levelCodec||f.codec,b=f.container+";codecs="+L;P.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var m=l[p]=u.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:m,codec:L,container:f.container,levelCodec:f.levelCodec,id:f.id},A++}catch(d){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:b})}}A&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},S._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},S._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},S._onSBUpdateError=function(o,l){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(l)},S.removeExecutor=function(o,l,u){var A=this.media,p=this.mediaSource,f=this.operationQueue,L=this.sourceBuffer,b=L[o];if(!A||!p||!b){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var m=Object(Z.isFiniteNumber)(A.duration)?A.duration:Infinity,c=Object(Z.isFiniteNumber)(p.duration)?p.duration:Infinity,d=Math.max(0,l),a=Math.min(u,m,c);a>d?(P.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(d,a)):f.shiftAndExecuteNext(o)},S.appendExecutor=function(o,l){var u=this.operationQueue,A=this.sourceBuffer,p=A[l];if(!p){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}p.ended=!1,console.assert(!p.updating,l+" sourceBuffer must not be updating"),p.appendBuffer(o)},S.blockBuffers=function(o,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var A=this.operationQueue,p=l.map(function(f){return A.appendBlocker(f)});Promise.all(p).then(function(){o(),l.forEach(function(f){var L=u.sourceBuffer[f];(!L||!L.updating)&&A.shiftAndExecuteNext(f)})})},S.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},S.addBufferListener=function(o,l,u){var A=this.sourceBuffer[o];if(!A)return;var p=u.bind(this,o);this.listeners[o].push({event:l,listener:p}),A.addEventListener(l,p)},S.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(u){l.removeEventListener(u.event,u.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return B});var Z=D("./src/utils/logger.ts"),B=function(){function P(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var G=P.prototype;return G.append=function(I,k){var v=this.queues[k];v.push(I),v.length===1&&this.buffers[k]&&this.executeNext(k)},G.insertAbort=function(I,k){var v=this.queues[k];v.unshift(I),this.executeNext(k)},G.appendBlocker=function(I){var k,v=new Promise(function(R){k=R}),T={execute:k,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,I),v},G.executeNext=function(I){var k=this.buffers,v=this.queues,T=k[I],R=v[I];if(R.length){var _=R[0];try{_.execute()}catch(w){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),_.onError(w),(!T||!T.updating)&&(R.shift(),this.executeNext(I))}}},G.shiftAndExecuteNext=function(I){this.queues[I].shift(),this.executeNext(I)},G.current=function(I){return this.queues[I][0]},P}()},"./src/controller/cap-level-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts");function B(j,I){for(var k=0;k<I.length;k++){var v=I[k];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(j,v.key,v)}}function P(j,I,k){return I&&B(j.prototype,I),k&&B(j,k),j}var G=function(){function j(k){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=k,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var I=j.prototype;return I.setStreamController=function(v){this.streamController=v},I.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},I.registerListeners=function(){var v=this.hls;v.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.unregisterListener=function(){var v=this.hls;v.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.onFpsDropLevelCapping=function(v,T){j.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},I.onMediaAttaching=function(v,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},I.onManifestParsed=function(v,T){var R=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,R.config.capLevelToPlayerSize&&T.video&&this.startCapping()},I.onBufferCodecs=function(v,T){var R=this.hls;R.config.capLevelToPlayerSize&&T.video&&this.startCapping()},I.onMediaDetaching=function(){this.stopCapping()},I.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(v.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},I.getMaxLevel=function(v){var T=this,R=this.hls.levels;if(!R.length)return-1;var _=R.filter(function(w,S){return j.isLevelAllowed(S,T.restrictedLevels)&&S<=v});return this.clientRect=null,j.getMaxLevelByMediaSize(_,this.mediaWidth,this.mediaHeight)},I.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()},I.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},I.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,T={width:0,height:0};if(v){var R=v.getBoundingClientRect();T.width=R.width,T.height=R.height,!T.width&&!T.height&&(T.width=R.right-R.left||v.width||0,T.height=R.bottom-R.top||v.height||0)}return this.clientRect=T,T},j.isLevelAllowed=function(v,T){return T===void 0&&(T=[]),T.indexOf(v)===-1},j.getMaxLevelByMediaSize=function(v,T,R){if(!v||!v.length)return-1;for(var _=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},w=v.length-1,S=0;S<v.length;S+=1){var h=v[S];if((h.width>=T||h.height>=R)&&_(h,v[S+1])){w=S;break}}return w},P(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(T){}return v}}]),j}();Q.default=G},"./src/controller/cmcd-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./src/events.ts"),B=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),G=D("./src/utils/logger.ts");function j(w,S){for(var h=0;h<S.length;h++){var o=S[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function I(w,S,h){return S&&j(w.prototype,S),h&&j(w,h),w}function k(w,S){var h=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(h)return(h=h.call(w)).next.bind(h);if(Array.isArray(w)||(h=v(w))||S&&w&&typeof w.length=="number"){h&&(w=h);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(w,S){if(!w)return;if(typeof w=="string")return T(w,S);var h=Object.prototype.toString.call(w).slice(8,-1);if(h==="Object"&&w.constructor&&(h=w.constructor.name),h==="Map"||h==="Set")return Array.from(w);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return T(w,S)}function T(w,S){(S==null||S>w.length)&&(S=w.length);for(var h=0,o=new Array(S);h<S;h++)o[h]=w[h];return o}function R(){return R=Object.assign||function(w){for(var S=1;S<arguments.length;S++){var h=arguments[S];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(w[o]=h[o])}return w},R.apply(this,arguments)}var _=function(){function w(h){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(A){try{o.apply(A,{ot:B.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){G.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(A){try{var p=A.frag,f=o.hls.levels[p.level],L=o.getObjectType(p),b={d:p.duration*1e3,ot:L};(L===B.CMCDObjectType.VIDEO||L===B.CMCDObjectType.AUDIO||L==B.CMCDObjectType.MUXED)&&(b.br=f.bitrate/1e3,b.tb=o.getTopBandwidth(L),b.bl=o.getBufferLength(L)),o.apply(A,b)}catch(m){G.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=h;var l=this.config=h.config,u=l.cmcd;u!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||w.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var S=w.prototype;return S.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},S.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},S.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},S.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},S.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},S.onBufferCreated=function(o,l){var u,A;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(A=l.tracks.video)===null||A===void 0?void 0:A.buffer},S.createData=function(){var o;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},S.apply=function(o,l){l===void 0&&(l={}),R(l,this.createData());var u=l.ot===B.CMCDObjectType.INIT||l.ot===B.CMCDObjectType.VIDEO||l.ot===B.CMCDObjectType.MUXED;if(this.starved&&u&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var A=w.toHeaders(l);if(!Object.keys(A).length)return;o.headers||(o.headers={}),R(o.headers,A)}else{var p=w.toQuery(l);if(!p)return;o.url=w.appendQueryToUri(o.url,p)}},S.getObjectType=function(o){var l=o.type;return l==="subtitle"?B.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?B.CMCDObjectType.INIT:l==="audio"?B.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},S.getTopBandwidth=function(o){for(var l=0,u=o===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,A=k(u),p;!(p=A()).done;){var f=p.value;f.bitrate>l&&(l=f.bitrate)}return l>0?l:NaN},S.getBufferLength=function(o){var l=this.hls.media,u=o===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var A=P.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return A.len*1e3},S.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function A(f){this.loader=void 0,this.loader=new u(f)}var p=A.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,b,m){l(L),this.loader.load(L,b,m)},I(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},S.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function A(f){this.loader=void 0,this.loader=new u(f)}var p=A.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,b,m){l(L),this.loader.load(L,b,m)},I(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},w.serialize=function(o){for(var l=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},A=function(U){return Math.round(U)},p=function(U){return A(U/100)*100},f=function(U){return encodeURIComponent(U)},L={br:A,d:A,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:A},b=Object.keys(o||{}).sort(),m=k(b),c;!(c=m()).done;){var d=c.value,a=o[d];if(!u(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var x=L[d];x&&(a=x(a));var y=typeof a,E=void 0;d==="ot"||d==="sf"||d==="st"?E=d+"="+a:y==="boolean"?E=d:y==="number"?E=d+"="+a:E=d+"="+JSON.stringify(a),l.push(E)}return l.join(",")},w.toHeaders=function(o){for(var l=Object.keys(o),u={},A=["Object","Request","Session","Status"],p=[{},{},{},{}],f={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,b=l;L<b.length;L++){var m=b[L],c=f[m]!=null?f[m]:1;p[c][m]=o[m]}for(var d=0;d<p.length;d++){var a=w.serialize(p[d]);a&&(u["CMCD-"+A[d]]=a)}return u},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,l){if(!l)return o;var u=o.includes("?")?"&":"?";return""+o+u+l},w}()},"./src/controller/eme-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),G=D("./src/utils/mediakeys-helper.ts");function j(_,w){for(var S=0;S<w.length;S++){var h=w[S];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(_,h.key,h)}}function I(_,w,S){return w&&j(_.prototype,w),S&&j(_,S),_}var k=3,v=function(w,S,h){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),S.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},T=function(w,S,h,o){switch(w){case G.KeySystems.WIDEVINE:return v(S,h,o);default:throw new Error("Unknown key-system: "+w)}},R=function(){function _(S){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=S,this._config=S.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 w=_.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(h){switch(h){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},w._attemptKeySystemAccess=function(h,o,l){var u=this,A=T(h,o,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(h,A);this.mediaKeysPromise=p.then(function(f){return u._onMediaKeySystemAccessObtained(h,f)}),p.catch(function(f){P.logger.error('Failed to obtain key-system "'+h+'" access:',f)})},w._onMediaKeySystemAccessObtained=function(h,o){var l=this;P.logger.log('Access for key-system "'+h+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(u);var A=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return u.mediaKeys=p,P.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),p});return A.catch(function(p){P.logger.error("Failed to create media-keys:",p)}),A},w._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(h){var o=this;P.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},w._onKeySessionMessage=function(h,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},w.onMediaEncrypted=function(h){var o=this;if(P.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(A){if(!o._media)return;o._attemptSetMediaKeys(A),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},w._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(h,o){var l=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var A=u.mediaKeysSession;if(!A){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+h+'" init data type'),u.mediaKeysSessionInitialized=!0,A.generateRequest(h,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(p){P.logger.error("Error generating key-session request:",p),l.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(h,o,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,h,o,l);var A=this._licenseXhrSetup;if(A)try{A.call(this.hls,u,h),A=void 0}catch(p){P.logger.error(p)}try{u.readyState||u.open("POST",h,!0),A&&A.call(this.hls,u,h)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return u},w._onLicenseRequestReadyStageChange=function(h,o,l,u){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var A=h.response,p=this._licenseResponseCallback;if(p)try{A=p.call(this.hls,h,o)}catch(L){P.logger.error(L)}u(A)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>k){this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=k-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(l,u)}break}},w._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},w._requestLicense=function(h,o){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),A=this._createLicenseXhr(u,h,o);P.logger.log("Sending license request to URL: "+u);var p=this._generateLicenseRequestChallenge(l,h);A.send(p)}catch(f){P.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(A){return A.audioCodec}).filter(function(A){return!!A}),u=o.levels.map(function(A){return A.videoCodec}).filter(function(A){return!!A});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,u)},I(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();Q.default=R},"./src/controller/fps-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),P=function(){function G(I){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=I,this.registerListeners()}var j=G.prototype;return j.setStreamController=function(k){this.streamController=k},j.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(k,v){var T=this.hls.config;if(T.capLevelOnFPSDrop){var R=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(k,v,T){var R=performance.now();if(v){if(this.lastTime){var _=R-this.lastTime,w=T-this.lastDroppedFrames,S=v-this.lastDecodedFrames,h=1e3*w/_,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:w,currentDecoded:S,totalDroppedFrames:T}),h>0&&w>o.config.fpsDroppedMonitoringThreshold*S){var l=o.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=T,this.lastDecodedFrames=v}},j.checkFPSInterval=function(){var k=this.media;if(k)if(this.isVideoPlaybackQualityAvailable){var v=k.getVideoPlaybackQuality();this.checkFPS(k,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(k,k.webkitDecodedFrameCount,k.webkitDroppedFrameCount)},G}();Q.default=P},"./src/controller/fragment-finders.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"findFragmentByPDT",function(){return P}),D.d(Q,"findFragmentByPTS",function(){return G}),D.d(Q,"fragmentWithinToleranceTest",function(){return j}),D.d(Q,"pdtWithinToleranceTest",function(){return I}),D.d(Q,"findFragWithCC",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/binary-search.ts");function P(v,T,R){if(T===null||!Array.isArray(v)||!v.length||!Object(Z.isFiniteNumber)(T))return null;var _=v[0].programDateTime;if(T<(_||0))return null;var w=v[v.length-1].endProgramDateTime;if(T>=(w||0))return null;R=R||0;for(var S=0;S<v.length;++S){var h=v[S];if(I(T,R,h))return h}return null}function G(v,T,R,_){R===void 0&&(R=0),_===void 0&&(_=0);var w=null;if(v?w=T[v.sn-T[0].sn+1]||null:R===0&&T[0].start===0&&(w=T[0]),w&&j(R,_,w)===0)return w;var S=B.default.search(T,j.bind(null,R,_));return S||w}function j(v,T,R){v===void 0&&(v=0),T===void 0&&(T=0);var _=Math.min(T,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-_<=v?1:R.start-_>v&&R.start?-1:0}function I(v,T,R){var _=Math.min(T,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,w=R.endProgramDateTime||0;return w-_>v}function k(v,T){return B.default.search(v,function(R){return R.cc<T?1:R.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"FragmentState",function(){return P}),D.d(Q,"FragmentTracker",function(){return G});var Z=D("./src/events.ts"),B=D("./src/types/loader.ts"),P;(function(k){k.NOT_LOADED="NOT_LOADED",k.BACKTRACKED="BACKTRACKED",k.APPENDING="APPENDING",k.PARTIAL="PARTIAL",k.OK="OK"})(P||(P={}));var G=function(){function k(T){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=T,this._registerListeners()}var v=k.prototype;return v._registerListeners=function(){var R=this.hls;R.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var R=this.hls;R.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(R,_){if(_===B.PlaylistLevelType.MAIN){var w=this.activeFragment,S=this.activeParts;if(!w)return null;if(S)for(var h=S.length;h--;){var o=S[h],l=o?o.end:w.appendedPTS;if(o.start<=R&&l!==void 0&&R<=l)return h>9&&(this.activeParts=S.slice(h-9)),o}else if(w.start<=R&&w.appendedPTS!==void 0&&R<=w.appendedPTS)return w}return this.getBufferedFrag(R,_)},v.getBufferedFrag=function(R,_){for(var w=this.fragments,S=Object.keys(w),h=S.length;h--;){var o=w[S[h]];if((o==null?void 0:o.body.type)===_&&o.buffered){var l=o.body;if(l.start<=R&&R<=l.end)return l}}return null},v.detectEvictedFragments=function(R,_,w){var S=this;Object.keys(this.fragments).forEach(function(h){var o=S.fragments[h];if(!o)return;if(!o.buffered){o.body.type===w&&S.removeFragment(o.body);return}var l=o.range[R];if(!l)return;l.time.some(function(u){var A=!S.isTimeBuffered(u.startPTS,u.endPTS,_);return A&&S.removeFragment(o.body),A})})},v.detectPartialFragments=function(R){var _=this,w=this.timeRanges,S=R.frag,h=R.part;if(!w||S.sn==="initSegment")return;var o=I(S),l=this.fragments[o];if(!l)return;Object.keys(w).forEach(function(u){var A=S.elementaryStreams[u];if(!A)return;var p=w[u],f=h!==null||A.partial===!0;l.range[u]=_.getBufferedTimes(S,h,f,p)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},v.fragBuffered=function(R){var _=I(R),w=this.fragments[_];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},v.getBufferedTimes=function(R,_,w,S){for(var h={time:[],partial:w},o=_?_.start:R.start,l=_?_.end:R.end,u=R.minEndPTS||l,A=R.maxStartPTS||o,p=0;p<S.length;p++){var f=S.start(p)-this.bufferPadding,L=S.end(p)+this.bufferPadding;if(A>=f&&u<=L){h.time.push({startPTS:Math.max(o,S.start(p)),endPTS:Math.min(l,S.end(p))});break}else if(o<L&&l>f)h.partial=!0,h.time.push({startPTS:Math.max(o,S.start(p)),endPTS:Math.min(l,S.end(p))});else if(l<=f)break}return h},v.getPartialFragment=function(R){var _=null,w,S,h,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(A){var p=u[A];if(!p)return;j(p)&&(S=p.body.start-l,h=p.body.end+l,R>=S&&R<=h&&(w=Math.min(R-S,h-R),o<=w&&(_=p.body,o=w)))}),_},v.getState=function(R){var _=I(R),w=this.fragments[_];return w?w.buffered?j(w)?P.PARTIAL:P.OK:w.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},v.backtrack=function(R,_){var w=I(R),S=this.fragments[w];if(!S||S.backtrack)return null;var h=S.backtrack=_||S.loaded;return S.loaded=null,h},v.getBacktrackData=function(R){var _=I(R),w=this.fragments[_];if(w){var S,h=w.backtrack;if(h!=null&&(S=h.payload)!==null&&S!==void 0&&S.byteLength)return h;this.removeFragment(R)}return null},v.isTimeBuffered=function(R,_,w){for(var S,h,o=0;o<w.length;o++){if(S=w.start(o)-this.bufferPadding,h=w.end(o)+this.bufferPadding,R>=S&&_<=h)return!0;if(_<=S)return!1}return!1},v.onFragLoaded=function(R,_){var w=_.frag,S=_.part;if(w.sn==="initSegment"||w.bitrateTest||S)return;var h=I(w);this.fragments[h]={body:w,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(R,_){var w=this,S=_.frag,h=_.part,o=_.timeRanges;if(S.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=S,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var A=o[u];if(w.detectEvictedFragments(u,A),!h)for(var p=0;p<A.length;p++)S.appendedPTS=Math.max(A.end(p),S.appendedPTS||0)})},v.onFragBuffered=function(R,_){this.detectPartialFragments(_)},v.hasFragment=function(R){var _=I(R);return!!this.fragments[_]},v.removeFragmentsInRange=function(R,_,w){var S=this;Object.keys(this.fragments).forEach(function(h){var o=S.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===w&&l.start<_&&l.end>R&&S.removeFragment(l)}})},v.removeFragment=function(R){var _=I(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[_]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},k}();function j(k){var v,T;return k.buffered&&(((v=k.range.video)===null||v===void 0?void 0:v.partial)||((T=k.range.audio)===null||T===void 0?void 0:T.partial))}function I(k){return k.type+"_"+k.level+"_"+k.urlId+"_"+k.sn}},"./src/controller/gap-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"STALL_MINIMUM_DURATION_MS",function(){return j}),D.d(Q,"MAX_START_GAP_JUMP",function(){return I}),D.d(Q,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return k}),D.d(Q,"SKIP_BUFFER_RANGE_START",function(){return v}),D.d(Q,"default",function(){return T});var Z=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),P=D("./src/events.ts"),G=D("./src/utils/logger.ts"),j=250,I=2,k=.1,v=.05,T=function(){function R(w,S,h,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=S,this.fragmentTracker=h,this.hls=o}var _=R.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(S){var h=this.config,o=this.media,l=this.stalled,u=o.currentTime,A=o.seeking,p=this.seeking&&!A,f=!this.seeking&&A;if(this.seeking=A,u!==S){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var b=Z.BufferHelper.bufferInfo(o,u,0),m=b.len>0,c=b.nextStart||0;if(!m&&!c)return;if(A){var d=b.len>I,a=!c||c-u>I&&!this.fragmentTracker.getPartialFragment(u);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(c,b.start||0)-u,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=E==null||((x=E.details)===null||x===void 0)?void 0:x.live,U=N?E.details.targetduration*2:I;if(y>0&&y<=U){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!A&&V>=j&&this._reportStall(b.len);var O=Z.BufferHelper.bufferInfo(o,u,h.maxBufferHole);this._tryFixBufferStall(O,V)},_._tryFixBufferStall=function(S,h){var o=this.config,l=this.fragmentTracker,u=this.media,A=u.currentTime,p=l.getPartialFragment(A);if(p){var f=this._trySkipBufferHole(p);if(f)return}S.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(S){var h=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+S+")"),h.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:S}))},_._trySkipBufferHole=function(S){for(var h=this.config,o=this.hls,l=this.media,u=l.currentTime,A=0,p=Z.BufferHelper.getBuffered(l),f=0;f<p.length;f++){var L=p.start(f);if(u+h.maxBufferHole>=A&&u<L){var b=Math.max(L+v,l.currentTime+k);return G.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+b),this.moved=!0,this.stalled=null,l.currentTime=b,S&&o.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+b,frag:S}),b}A=p.end(f)}return 0},_._tryNudgeBuffer=function(){var S=this.config,h=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<S.nudgeMaxRetry){var A=l+u*S.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+A),o.currentTime=A,h.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+S.nudgeMaxRetry+" nudges"),h.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),G=.25,j=function(){function I(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var k=I.prototype;return k.destroy=function(){this._unregisterListeners()},k._registerListeners=function(){var T=this.hls;T.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k._unregisterListeners=function(){var T=this.hls;T.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k.onMediaAttached=function(T,R){this.media=R.media},k.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},k.getID3Track=function(T){if(!this.media)return;for(var R=0;R<T.length;R++){var _=T[R];if(_.kind==="metadata"&&_.label==="id3")return Object(B.sendAddTrackEvent)(_,this.media),_}return this.media.addTextTrack("metadata","id3")},k.onFragParsingMetadata=function(T,R){if(!this.media)return;var _=R.frag,w=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var S=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<w.length;h++){var o=P.getID3Frames(w[h].data);if(o){var l=w[h].pts,u=h<w.length-1?w[h+1].pts:_.end,A=u-l;A<=0&&(u=l+G);for(var p=0;p<o.length;p++){var f=o[p];if(!P.isTimeStampFrame(f)){var L=new S(l,u,"");L.value=f,this.id3Track.addCue(L)}}}}},k.onBufferFlushing=function(T,R){var _=R.startOffset,w=R.endOffset,S=R.type;if(!S||S==="audio"){var h=this.id3Track;h&&Object(B.removeCuesInRange)(h,_,w)}},I}();Q.default=j},"./src/controller/latency-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/errors.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts");function G(k,v){for(var T=0;T<v.length;T++){var R=v[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(k,R.key,R)}}function j(k,v,T){return v&&G(k.prototype,v),T&&G(k,T),k}var I=function(){function k(T){var R=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 R.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var v=k.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},v.onMediaAttached=function(R,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(R,_){var w=_.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(R,_){if(_.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var R=this.media,_=this.levelDetails;if(!R||!_)return;this.currentTime=R.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var S=this.config,h=S.lowLatencyMode,o=S.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var u=w-l,A=Math.min(this.maxLatency,l+_.targetduration),p=u<A;if(_.live&&p&&u>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;R.playbackRate=Math.min(f,Math.max(1,L))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},v.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},v.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},j(k,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,_=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:_?R.liveMaxLatencyDurationCount*_.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var _=R.holdBack,w=R.partHoldBack,S=R.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,u=h.lowLatencyMode,A=this.hls.userConfig,p=u&&w||_;(A.liveSyncDuration||A.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:l*S);var f=S,L=1;return p+Math.min(this.stallCount*L,f)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),_=this.targetLatency,w=this.levelDetails;if(R===null||_===null||w===null)return null;var S=w.edge,h=R-_-this.edgeStalled,o=S-w.totalduration,l=S-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,h),l)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var _=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-_,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,_=this.levelDetails;if(!R||!_)return 0;var w=R.buffered.length;return w?R.buffered.end(w-1):_.edge-this.currentTime}}]),k}()},"./src/controller/level-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return h});var Z=D("./src/types/level.ts"),B=D("./src/events.ts"),P=D("./src/errors.ts"),G=D("./src/utils/codecs.ts"),j=D("./src/controller/level-helper.ts"),I=D("./src/controller/base-playlist-controller.ts"),k=D("./src/types/loader.ts");function v(){return v=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var A in u)Object.prototype.hasOwnProperty.call(u,A)&&(o[A]=u[A])}return o},v.apply(this,arguments)}function T(o,l){for(var u=0;u<l.length;u++){var A=l[u];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(o,A.key,A)}}function R(o,l,u){return l&&T(o.prototype,l),u&&T(o,u),o}function _(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,w(o,l)}function w(o,l){return w=Object.setPrototypeOf||function(A,p){return A.__proto__=p,A},w(o,l)}var S=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){_(l,o);function l(A){var p;return p=o.call(this,A,"[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 u=l.prototype;return u._registerListeners=function(){var p=this.hls;p.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(B.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var p=this.hls;p.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(B.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var p=this._levels;p.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(p,f){var L=[],b=[],m=[],c,d={},a,x=!1,y=!1,E=!1;if(f.levels.forEach(function(V){var O=V.attrs;x=x||!!(V.width&&V.height),y=y||!!V.videoCodec,E=E||!!V.audioCodec,S&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var M=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=d[M],a?a.url.push(V.url):(a=new Z.Level(V),d[M]=a,L.push(a)),O&&(O.AUDIO&&Object(j.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(j.addGroupId)(a,"text",O.SUBTITLES))}),(x||y)&&E&&(L=L.filter(function(V){var O=V.videoCodec,M=V.width,$=V.height;return!!O||!!(M&&$)})),L=L.filter(function(V){var O=V.audioCodec,M=V.videoCodec;return(!O||Object(G.isCodecSupportedInMp4)(O,"audio"))&&(!M||Object(G.isCodecSupportedInMp4)(M,"video"))}),f.audioTracks&&(b=f.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(j.assignTrackIdsByGroup)(b)),f.subtitles&&(m=f.subtitles,Object(j.assignTrackIdsByGroup)(m)),L.length>0){c=L[0].bitrate,L.sort(function(V,O){return V.bitrate-O.bitrate}),this._levels=L;for(var N=0;N<L.length;N++)if(L[N].bitrate===c){this._firstLevel=N,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var U=E&&!y,K={levels:L,audioTracks:b,subtitleTracks:m,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:y,altAudio:!U&&b.some(function(V){return!!V.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var L=f.context,b=this._levels[this.currentLevelIndex];if(L&&(L.type===k.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&L.groupId===b.audioGroupIds[b.urlId]||L.type===k.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&L.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,c=!0,d;switch(f.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=f.frag.level)):d=f.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),d=L.level),m=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:d=f.level,m=!0;break}d!==void 0&&this.recoverLevel(f,d,m,c)},u.recoverLevel=function(p,f,L,b){var m=p.details,c=this._levels[f];if(c.loadError++,L){var d=this.retryLoadingOrFail(p);if(d)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError<a)p.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var x=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(m+": switch to "+x),p.levelRetry=!0,this.hls.nextAutoLevel=x)}}},u.redundantFailover=function(p){var f=this._levels[p],L=f.url.length;if(L>1){var b=(f.urlId+1)%L;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(m){m.urlId=b}),this.level=p}},u.onFragLoaded=function(p,f){var L=f.frag;if(L!==void 0&&L.type===k.PlaylistLevelType.MAIN){var b=this._levels[L.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},u.onLevelLoaded=function(p,f){var L,b=f.level,m=f.details,c=this._levels[b];if(!c){var d;this.warn("Invalid level index "+b),(d=f.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(m.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,c.details)):(L=f.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(m.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(p,f){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var b=-1,m=this.hls.audioTracks[f.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===m){b=c;break}b!==L.urlId&&(L.urlId=b,this.startLoad())}},u.loadPlaylist=function(p){var f=this.currentLevelIndex,L=this._levels[f];if(this.canLoad&&L&&L.url.length>0){var b=L.urlId,m=L.url[b];if(p)try{m=p.addDirectives(m)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+m),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:m,level:f,id:b,deliveryDirectives:p||null})}},u.removeLevel=function(p,f){var L=function(c,d){return d!==f},b=this._levels.filter(function(m,c){return c!==p?!0:m.url.length>1&&f!==void 0?(m.url=m.url.filter(L),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(L)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(L)),m.urlId=0,!0):!1}).map(function(m,c){var d=m.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=c}),m});this._levels=b,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:b})},R(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===p&&(f=L[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=L.length){var b=p<0;if(this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,L.length-1)}this.clearTimer();var m=this.currentLevelIndex,c=L[m],d=L[p];this.log("switching to level "+p+" from "+m),this.currentLevelIndex=p;var a=v({},d,{level:p,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,a);var x=d.details;if(!x||x.live){var y=this.switchParams(d.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{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)}}]),l}(I.default)},"./src/controller/level-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"addGroupId",function(){return P}),D.d(Q,"assignTrackIdsByGroup",function(){return G}),D.d(Q,"updatePTS",function(){return j}),D.d(Q,"updateFragPTSDTS",function(){return k}),D.d(Q,"mergeDetails",function(){return v}),D.d(Q,"mapPartIntersection",function(){return T}),D.d(Q,"mapFragmentIntersection",function(){return R}),D.d(Q,"adjustSliding",function(){return _}),D.d(Q,"addSliding",function(){return w}),D.d(Q,"computeReloadInterval",function(){return S}),D.d(Q,"getFragmentWithSN",function(){return h}),D.d(Q,"getPartWith",function(){return o});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts");function P(l,u,A){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(A);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(A);break}}function G(l){var u={};l.forEach(function(A){var p=A.groupId||"";A.id=u[p]=u[p]||0,u[p]++})}function j(l,u,A){var p=l[u],f=l[A];I(p,f)}function I(l,u){var A=u.startPTS;if(Object(Z.isFiniteNumber)(A)){var p=0,f;u.sn>l.sn?(p=A-l.start,f=l):(p=l.start-A,f=u),f.duration!==p&&(f.duration=p)}else if(u.sn>l.sn){var L=l.cc===u.cc;L&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function k(l,u,A,p,f,L){var b=p-A;b<=0&&(B.logger.warn("Fragment should have a positive duration",u),p=A+u.duration,L=f+u.duration);var m=A,c=p,d=u.startPTS,a=u.endPTS;if(Object(Z.isFiniteNumber)(d)){var x=Math.abs(d-A);Object(Z.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(x,u.deltaPTS):u.deltaPTS=x,m=Math.max(A,d),A=Math.min(A,d),f=Math.min(f,u.startDTS),c=Math.min(p,a),p=Math.max(p,a),L=Math.max(L,u.endDTS)}u.duration=p-A;var y=A-u.start;u.appendedPTS=p,u.start=u.startPTS=A,u.maxStartPTS=m,u.startDTS=f,u.endPTS=p,u.minEndPTS=c,u.endDTS=L;var E=u.sn;if(!l||E<l.startSN||E>l.endSN)return 0;var N,U=E-l.startSN,K=l.fragments;for(K[U]=u,N=U;N>0;N--)I(K[N],K[N-1]);for(N=U;N<K.length-1;N++)I(K[N],K[N+1]);return l.fragmentHint&&I(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,y}function v(l,u){for(var A=null,p=l.fragments,f=p.length-1;f>=0;f--){var L=p[f].initSegment;if(L){A=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var b=0,m;if(R(l,u,function(N,U){N.relurl&&(b=N.cc-U.cc),Object(Z.isFiniteNumber)(N.startPTS)&&Object(Z.isFiniteNumber)(N.endPTS)&&(U.start=U.startPTS=N.startPTS,U.startDTS=N.startDTS,U.appendedPTS=N.appendedPTS,U.maxStartPTS=N.maxStartPTS,U.endPTS=N.endPTS,U.endDTS=N.endDTS,U.minEndPTS=N.minEndPTS,U.duration=N.endPTS-N.startPTS,U.duration&&(m=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=N.elementaryStreams,U.loader=N.loader,U.stats=N.stats,U.urlId=N.urlId,N.initSegment&&(U.initSegment=N.initSegment,A=N.initSegment)}),A){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(N){var U;(!N.initSegment||N.initSegment.relurl===((U=A)===null||U===void 0?void 0:U.relurl))&&(N.initSegment=A)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(N){return!N}),u.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(b){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=b}u.skippedSegments&&(u.startCC=u.fragments[0].cc),T(l.partList,u.partList,function(N,U){U.elementaryStreams=N.elementaryStreams,U.stats=N.stats}),m?k(u,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):_(l,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=l.driftStartTime,u.driftStart=l.driftStart;var y=u.advancedDateTime;if(u.advanced&&y){var E=u.edge;u.driftStart||(u.driftStartTime=y,u.driftStart=E),u.driftEndTime=y,u.driftEnd=E}else u.driftEndTime=l.driftEndTime,u.driftEnd=l.driftEnd,u.advancedDateTime=l.advancedDateTime}function T(l,u,A){if(l&&u)for(var p=0,f=0,L=l.length;f<=L;f++){var b=l[f],m=u[f+p];b&&m&&b.index===m.index&&b.fragment.sn===m.fragment.sn?A(b,m):p--}}function R(l,u,A){for(var p=u.skippedSegments,f=Math.max(l.startSN,u.startSN)-u.startSN,L=(l.fragmentHint?1:0)+(p?u.endSN:Math.min(l.endSN,u.endSN))-u.startSN,b=u.startSN-l.startSN,m=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=f;d<=L;d++){var a=c[b+d],x=m[d];p&&!x&&d<p&&(x=u.fragments[d]=a),a&&x&&A(a,x)}}function _(l,u){var A=u.startSN+u.skippedSegments-l.startSN,p=l.fragments;if(A<0||A>=p.length)return;w(u,p[A].start)}function w(l,u){if(u){for(var A=l.fragments,p=l.skippedSegments;p<A.length;p++)A[p].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function S(l,u){var A=1e3*l.levelTargetDuration,p=A/2,f=l.age,L=f>0&&f<A*3,b=u.loading.end-u.loading.start,m,c=l.availabilityDelay;if(l.updated===!1)if(L){var d=333*l.misses;m=Math.max(Math.min(p,b*2),d),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=p;else L?(c=Math.min(c||A/2,f),l.availabilityDelay=c,m=c+A-f):m=A-b;return Math.round(m)}function h(l,u,A){if(!l||!l.details)return null;var p=l.details,f=p.fragments[u-p.startSN];return f||(f=p.fragmentHint,f&&f.sn===u?f:u<p.startSN&&A&&A.sn===u?A:null)}function o(l,u,A){if(!l||!l.details)return null;var p=l.details.partList;if(p)for(var f=p.length;f--;){var L=p[f];if(L.index===A&&L.fragment.sn===u)return L}return null}},"./src/controller/stream-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return p});var Z=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),G=D("./src/events.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),k=D("./src/types/loader.ts"),v=D("./src/loader/fragment.ts"),T=D("./src/demux/transmuxer-interface.ts"),R=D("./src/types/transmuxer.ts"),_=D("./src/controller/gap-controller.ts"),w=D("./src/errors.ts"),S=D("./src/utils/logger.ts");function h(f,L){for(var b=0;b<L.length;b++){var m=L[b];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function o(f,L,b){return L&&h(f.prototype,L),b&&h(f,b),f}function l(f,L){f.prototype=Object.create(L.prototype),f.prototype.constructor=f,u(f,L)}function u(f,L){return u=Object.setPrototypeOf||function(m,c){return m.__proto__=c,m},u(f,L)}var A=100,p=function(f){l(L,f);function L(m,c){var d;return d=f.call(this,m,c,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var b=L.prototype;return b._registerListeners=function(){var c=this.hls;c.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(G.Events.ERROR,this.onError,this),c.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var c=this.hls;c.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(G.Events.ERROR,this.onError,this),c.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(c){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(A),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}d>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),c=d),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var c,d=this.levels,a=this.level,x=d==null||((c=d[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var y,E=self.performance.now(),N=this.retryDate;(!N||E>=N||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,d,a=this.hls,x=this.levelLastLoaded,y=this.levels,E=this.media,N=a.config,U=a.nextLoadLevel;if(x===null||!E&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[U])return;var K=y[U];this.level=a.nextLoadLevel=U;var V=K.details;if(!V||this.state===B.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==U){this.state=B.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,k.PlaylistLevelType.MAIN);if(O===null)return;var M=O.len,$=this.getMaxBufferLength(K.maxBitrate);if(M>=$)return;if(this._streamEnded(O,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ee),this.state=B.State.ENDED;return}var oe=O.end,fe=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var Re=fe.sn-V.startSN;Re>1&&(fe=V.fragments[Re-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===I.FragmentState.OK&&this.nextLoadPosition>oe){var Ee=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,Ee,k.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,V)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((c=fe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((d=fe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(fe,V):this.loadFragment(fe,V,oe)},b.loadFragment=function(c,d,a){var x,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===I.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else y=I.FragmentState.NOT_LOADED}y===I.FragmentState.NOT_LOADED||y===I.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,d,a)):y===I.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var d=this.fragmentTracker.getAppendedFrag(c,k.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,k.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,d=this.media;if(d!=null&&d.readyState){var a,x=this.getAppendedFrag(d.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!d.paused&&c){var y=this.hls.nextLoadLevel,E=c[y],N=this.fragLastKbps;N&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*N)+1:a=0}else a=0;var U=this.getBufferedFrag(d.currentTime+a);if(U){var K=this.followingBufferedFrag(U);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,O=K.duration,M=Math.max(U.end,V+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,d){f.prototype.flushMainBuffer.call(this,c,d,this.altAudio?"video":null)},b.onMediaAttached=function(c,d){f.prototype.onMediaAttached.call(this,c,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new _.default(this.config,a,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),f.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,d=c?c.currentTime:null;Object(Z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.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,d){var a=!1,x=!1,y;d.levels.forEach(function(E){y=E.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,d){var a=this.levels;if(!a||this.state!==B.State.IDLE)return;var x=a[d.level];(!x.details||x.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(x.details))&&(this.state=B.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,d){var a,x=this.levels,y=d.level,E=d.details,N=E.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+N);var U=this.fragCurrent;U&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==d.level&&U.loader&&(this.state=B.State.IDLE,U.loader.abort()));var K=x[y],V=0;if(E.live||(a=K.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;V=this.alignPlaylists(E,K.details)}if(K.details=E,this.levelLastLoaded=y,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:E,level:y}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=B.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,V),this.tick()},b._handleFragmentLoadProgress=function(c){var d,a=c.frag,x=c.part,y=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var N=E[a.level],U=N.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=N.videoCodec,V=U.PTSKnown||!U.live,O=(d=a.initSegment)===null||d===void 0?void 0:d.data,M=this._getAudioCodec(N),$=this.transmuxer=this.transmuxer||new T.default(this.hls,k.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=x?x.index:-1,oe=ee!==-1,fe=new R.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,ee,oe),Re=this.initPTS[a.cc];$.push(y,O,M,K,a,x,U.totalduration,V,fe,Re)},b.onAudioTrackSwitching=function(c,d){var a=this.altAudio,x=!!d.url,y=d.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;a&&N.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:y})}},b.onAudioTrackSwitched=function(c,d){var a=d.id,x=!!this.hls.audioTracks[a].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},b.onBufferCreated=function(c,d){var a=d.tracks,x,y,E=!1;for(var N in a){var U=a[N];if(U.id==="main"){if(y=N,x=U,N==="video"){var K=a[N];K&&(this.videoBuffer=K.buffer)}}else E=!0}E&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,d){var a=d.frag,x=d.part;if(a&&a.type!==k.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var y=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},b.onError=function(c,d){switch(d.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.MAIN,d);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=B.State.ERROR):!d.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,k.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(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,d=this.gapController;if(!c||!d||!c.readyState)return;var a=j.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,d){var a=d.type;if(a!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,k.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,d){this.levels=d.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,d=c.currentTime,a=this.startPosition;if(a>=0&&d<a){if(c.seeking){S.logger.log("could not seek to "+a+", already seeking at "+d);return}var x=j.BufferHelper.getBuffered(c),y=x.length?x.start(0):0,E=y-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(S.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),c.currentTime=a}},b._getAudioCodec=function(c){var d=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},b._loadBitrateTestFrag=function(c){var d=this;this._doFragLoad(c).then(function(a){var x=d.hls;if(!a||x.nextLoadLevel||d.fragContextChanged(c))return;d.fragLoadError=0,d.state=B.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),x.trigger(G.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(c){var d,a="main",x=this.hls,y=c.remuxResult,E=c.chunkMeta,N=this.getCurrentContext(E);if(!N){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var U=N.frag,K=N.part,V=N.level,O=y.video,M=y.text,$=y.id3,ee=y.initSegment,oe=this.altAudio?void 0:y.audio;if(this.fragContextChanged(U))return;if(this.state=B.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,U,E),x.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:ee.tracks}));var fe=ee.initPTS,Re=ee.timescale;Object(Z.isFiniteNumber)(fe)&&(this.initPTS[U.cc]=fe,x.trigger(G.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:fe,timescale:Re}))}if(O&&y.independent!==!1){if(V.details){var Ee=O.startPTS,Ce=O.endPTS,we=O.startDTS,Te=O.endDTS;if(K)K.elementaryStreams[O.type]={startPTS:Ee,endPTS:Ce,startDTS:we,endDTS:Te};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var ge=this.getLoadPosition()+this.config.maxBufferHole;if(ge<Ee){this.backtrack(U);return}U.setElementaryStreamInfo(O.type,U.start,Ce,U.start,Te,!0)}U.setElementaryStreamInfo(O.type,Ee,Ce,we,Te),this.bufferFragmentData(O,U,K,E)}}else if(y.independent===!1){this.backtrack(U);return}if(oe){var ue=oe.startPTS,te=oe.endPTS,he=oe.startDTS,ae=oe.endDTS;K&&(K.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:he,endDTS:ae}),U.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,ue,te,he,ae),this.bufferFragmentData(oe,U,K,E)}if($!=null&&(d=$.samples)!==null&&d!==void 0&&d.length){var _e={frag:U,id:a,samples:$.samples};x.trigger(G.Events.FRAG_PARSING_METADATA,_e)}if(M){var Oe={frag:U,id:a,samples:M.samples};x.trigger(G.Events.FRAG_PARSING_USERDATA,Oe)}},b._bufferInitSegment=function(c,d,a,x){var y=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var E=d.audio,N=d.video,U=d.audiovideo;if(E){var K=c.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),E.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),c.audioCodec&&c.audioCodec!==K&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+K+'"'),E.levelCodec=K,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(c.audioCodec||"")+"/"+E.codec+"]")}N&&(N.levelCodec=c.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+N.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(O){var M=d[O],$=M.initSegment;$!=null&&$.byteLength&&y.hls.trigger(G.Events.BUFFER_APPENDING,{type:O,data:$,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},b.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var d=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,d?this.resetFragmentLoading(c):this.state=B.State.BACKTRACKING},b.checkFragmentChanged=function(){var c=this.media,d=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(j.BufferHelper.isBuffered(c,a)?d=this.getAppendedFrag(a):j.BufferHelper.isBuffered(c,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var x=this.fragPlaying,y=d.level;(!x||d.sn!==x.sn||x.level!==y||d.urlId!==x.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:d}),(!x||x.level!==y)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=d)}}},o(L,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var d=this.getAppendedFrag(c.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var d=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"SubtitleStreamController",function(){return l});var Z=D("./src/events.ts"),B=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),G=D("./src/controller/fragment-finders.ts"),j=D("./src/utils/discontinuities.ts"),I=D("./src/controller/level-helper.ts"),k=D("./src/controller/fragment-tracker.ts"),v=D("./src/controller/base-stream-controller.ts"),T=D("./src/types/loader.ts"),R=D("./src/types/level.ts");function _(u,A){for(var p=0;p<A.length;p++){var f=A[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(u,f.key,f)}}function w(u,A,p){return A&&_(u.prototype,A),p&&_(u,p),u}function S(u,A){u.prototype=Object.create(A.prototype),u.prototype.constructor=u,h(u,A)}function h(u,A){return h=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},h(u,A)}var o=500,l=function(u){S(A,u);function A(f,L){var b;return b=u.call(this,f,L,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var p=A.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var L=this.hls;L.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(Z.Events.ERROR,this.onError,this),L.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var L=this.hls;L.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(Z.Events.ERROR,this.onError,this),L.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(L,b){this.mainDetails=b.details},p.onSubtitleFragProcessed=function(L,b){var m=b.frag,c=b.success;if(this.fragPrevious=m,this.state=v.State.IDLE,!c)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,x=m.start,y=0;y<d.length;y++)if(x>=d[y].start&&x<=d[y].end){a=d[y];break}var E=m.start+m.duration;a?a.end=E:(a={start:x,end:E},d.push(a)),this.fragmentTracker.fragBuffered(m)},p.onBufferFlushing=function(L,b){var m=b.startOffset,c=b.endOffset;if(m===0&&c!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var x=a[d].details,y=x.targetduration,E=c-y;if(E<=0)return;b.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(N){for(var U=0;U<N.length;){if(N[U].end<=E){N.shift();continue}else if(N[U].start<E)N[U].start=E;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,E,T.PlaylistLevelType.SUBTITLE)}},p.onError=function(L,b){var m,c=b.frag;if(!c||c.type!==T.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},p.onSubtitleTracksUpdated=function(L,b){var m=this,c=b.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(d){return new R.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){m.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(L,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(L,b){var m,c=b.details,d=b.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var y=x[a];if(d>=x.length||d!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(m=y.details)!==null&&m!==void 0&&m.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var N=E.fragments[0];if(!y.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(c,E):N&&Object(I.addSliding)(c,N.start);else{var U=this.alignPlaylists(c,y.details);U===0&&N&&Object(I.addSliding)(c,N.start)}}if(y.details=c,this.levelLastLoaded=d,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var K=Object(G.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},p._handleFragmentLoadComplete=function(L){var b=L.frag,m=L.payload,c=b.decryptdata,d=this.hls;if(this.fragContextChanged(b))return;if(m&&m.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),c.key.buffer,c.iv.buffer).then(function(x){var y=performance.now();d.trigger(Z.Events.FRAG_DECRYPTED,{frag:b,payload:x,stats:{tstart:a,tdecrypt:y}})})}},p.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var L,b=this.currentTrackId,m=this.levels;if(!m.length||!m[b]||!m[b].details)return;var c=m[b].details,d=c.targetduration,a=this.config,x=this.media,y=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-d,a.maxBufferHole),E=y.end,N=y.len,U=this.getMaxBufferLength()+d;if(N>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var K=c.fragments,V=K.length,O=c.edge,M,$=this.fragPrevious;if(E<O){var ee=a.maxFragLookUpTolerance;$&&c.hasProgramDateTime&&(M=Object(G.findFragmentByPDT)(K,$.endProgramDateTime,ee)),M||(M=Object(G.findFragmentByPTS)($,K,E,ee),!M&&$&&$.start<K[0].start&&(M=K[0]))}else M=K[V-1];(L=M)!==null&&L!==void 0&&L.encrypted?(B.logger.log("Loading key for "+M.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===k.FragmentState.NOT_LOADED&&this.loadFragment(M,c,E)}},p.loadFragment=function(L,b,m){this.fragCurrent=L,u.prototype.loadFragment.call(this,L,b,m)},w(A,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),A}(v.default)},"./src/controller/subtitle-track-controller.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function j(_,w){for(var S=0;S<w.length;S++){var h=w[S];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(_,h.key,h)}}function I(_,w,S){return w&&j(_.prototype,w),S&&j(_,S),_}function k(_,w){_.prototype=Object.create(w.prototype),_.prototype.constructor=_,v(_,w)}function v(_,w){return v=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},v(_,w)}var T=function(_){k(w,_);function w(h){var o;return o=_.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var S=w.prototype;return S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},S.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Z.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Z.Events.ERROR,this.onError,this)},S.onMediaAttached=function(o,l){if(this.media=l.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)},S.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},S.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=R(this.media.textTracks);o.forEach(function(l){Object(B.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},S.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},S.onSubtitleTrackLoaded=function(o,l){var u=l.id,A=l.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+u);return}var L=f.details;f.details=l.details,this.log("subtitle track "+u+" loaded ["+A.startSN+"-"+A.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,L))},S.onLevelLoading=function(o,l){this.switchLevel(l.level)},S.onLevelSwitching=function(o,l){this.switchLevel(l.level)},S.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var A=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!u||b.groupId===u});this.tracksInGroup=p;var f=this.findTrackId(A==null?void 0:A.name)||this.findTrackId();this.groupId=u;var L={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,L),f!==-1&&this.setSubtitleTrack(f,A)}},S.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var A=l[u];if((!this.selectDefaultTrack||A.default)&&(!o||o===A.name))return A.id}return-1},S.onError=function(o,l){if(_.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},S.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,A=l.groupId,p=l.url;if(o)try{p=o.addDirectives(p)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:u,groupId:A,deliveryDirectives:o||null})}},S.toggleTrackModes=function(o){var l=this,u=this.media,A=this.subtitleDisplay,p=this.trackId;if(!u)return;var f=R(u.textTracks),L=f.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var b=L[p];b&&(b.mode="disabled")}var m=L[o];m&&(m.mode=A?"showing":"hidden")},S.setSubtitleTrack=function(o,l){var u,A=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=A[o])!==null&&u!==void 0&&u.details)||o<-1||o>=A.length)return;this.clearTimer();var p=A[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,L=p.groupId,b=L===void 0?"":L,m=p.name,c=p.type,d=p.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:m,type:c,url:d});var a=this.switchParams(p.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},S.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=R(this.media.textTracks),u=0;u<l.length;u++)if(l[u].mode==="hidden")o=u;else if(l[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},I(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),w}(P.default);function R(_){for(var w=[],S=0;S<_.length;S++){var h=_[S];h.kind==="subtitles"&&h.label&&w.push(_[S])}return w}Q.default=T},"./src/controller/timeline-controller.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"TimelineController",function(){return R});var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),G=D("./src/utils/output-filter.ts"),j=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),k=D("./src/utils/imsc1-ttml-parser.ts"),v=D("./src/types/loader.ts"),T=D("./src/utils/logger.ts"),R=function(){function h(l){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=S(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.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 u=new G.default(this,"textTrack1"),A=new G.default(this,"textTrack2"),p=new G.default(this,"textTrack3"),f=new G.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,A),this.cea608Parser2=new P.default(3,p,f)}l.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(B.Events.FRAG_LOADING,this.onFragLoading,this),l.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var u=this.hls;u.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(B.Events.FRAG_LOADING,this.onFragLoading,this),u.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,A,p,f,L){for(var b=!1,m=L.length;m--;){var c=L[m],d=w(c[0],c[1],A,p);if(d>=0&&(c[0]=Math.min(c[0],A),c[1]=Math.max(c[1],p),b=!0,d/(p-A)>.5))return}if(b||L.push([A,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,A,p,f)}else{var x=this.Cues.newCue(null,A,p,f);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:x,track:u})}},o.onInitPtsFound=function(u,A){var p=this,f=A.frag,L=A.id,b=A.initPTS,m=A.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=m),c.length&&(this.unparsedVttFrags=[],c.forEach(function(d){p.onFragLoaded(B.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(u){var A=this.media;if(A)for(var p=0;p<A.textTracks.length;p++){var f=A.textTracks[p];if(f[u])return f}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var A=this.captionsProperties,p=this.captionsTracks,f=this.media,L=A[u],b=L.label,m=L.languageCode,c=this.getExistingTrack(u);if(c)p[u]=c,Object(I.clearCurrentCues)(p[u]),Object(I.sendAddTrackEvent)(p[u],f);else{var d=this.createTextTrack("captions",b,m);d&&(d[u]=!0,p[u]=d)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var A=this.captionsProperties[u];if(!A)return;var p=A.label,f={_id:u,label:p,kind:"captions",default:A.media?!!A.media.default:!1,closedCaptions:A.media};this.nonNativeCaptionsTracks[u]=f,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(u,A,p){var f=this.media;return f?f.addTextTrack(u,A,p):void 0},o.onMediaAttaching=function(u,A){this.media=A.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(A){Object(I.clearCurrentCues)(u[A]),delete u[A]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=S(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var A=u.textTracks;if(A)for(var p=0;p<A.length;p++)Object(I.clearCurrentCues)(A[p])},o.onSubtitleTracksUpdated=function(u,A){var p=this;this.textTracks=[];var f=A.subtitleTracks||[],L=f.some(function(d){return d.textCodec===k.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var b=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var x;if(a<m.length){for(var y=null,E=0;E<m.length;E++)if(_(m[E],d)){y=m[E];break}y&&(x=y)}x?Object(I.clearCurrentCues)(x):(x=p.createTextTrack("subtitles",d.name,d.lang),x&&(x.mode="disabled")),x&&(x.groupId=d.groupId,p.textTracks.push(x))})}else if(!b&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,A){var p=this;this.config.enableCEA708Captions&&A.captions&&A.captions.forEach(function(f){var L=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!L)return;var b="textTrack"+L[1],m=p.captionsProperties[b];if(!m)return;m.label=f.name,f.lang&&(m.languageCode=f.lang),m.media=f})},o.onFragLoading=function(u,A){var p=this.cea608Parser1,f=this.cea608Parser2,L=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(p&&f))return;if(A.frag.type===v.PlaylistLevelType.MAIN){var m,c,d=A.frag.sn,a=(m=A==null||((c=A.part)===null||c===void 0)?void 0:c.index)!=null?m:-1;d===L+1||d===L&&a===b+1||(p.reset(),f.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(u,A){var p=A.frag,f=A.payload,L=this.initPTS,b=this.unparsedVttFrags;if(p.type===v.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(Z.isFiniteNumber)(L[p.cc])){b.push(A),L.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var m=p.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var c=this.tracks[p.level],d=this.vttCCs;d[p.cc]||(d[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),c&&c.textCodec===k.IMSC1_CODEC?this._parseIMSC1(p,f):this._parseVTTs(p,f,d)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,A){var p=this,f=this.hls;Object(k.parseIMSC1)(A,this.initPTS[u.cc],this.timescale[u.cc],function(L){p._appendCues(L,u.level),f.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(L){T.logger.log("Failed to parse IMSC1: "+L),f.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:L})})},o._parseVTTs=function(u,A,p){var f=this,L=this.hls;Object(j.parseWebVTT)(A,this.initPTS[u.cc],this.timescale[u.cc],p,u.cc,u.start,function(b){f._appendCues(b,u.level),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(b){f._fallbackToIMSC1(u,A),T.logger.log("Failed to parse VTT cue: "+b),L.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:b})})},o._fallbackToIMSC1=function(u,A){var p=this,f=this.tracks[u.level];f.textCodec||Object(k.parseIMSC1)(A,this.initPTS[u.cc],this.timescale[u.cc],function(){f.textCodec=k.IMSC1_CODEC,p._parseIMSC1(u,A)},function(){f.textCodec="wvtt"})},o._appendCues=function(u,A){var p=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[A];if(f.mode==="disabled")return;u.forEach(function(m){return Object(I.addCueToTrack)(f,m)})}else{var L=this.tracks[A],b=L.default?"default":"subtitles"+A;p.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:u,track:b})}},o.onFragDecrypted=function(u,A){var p=A.frag;if(p.type===v.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(A);return}this.onFragLoaded(B.Events.FRAG_LOADED,A)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,A){var p=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(p&&f))return;for(var L=0;L<A.samples.length;L++){var b=A.samples[L].bytes;if(b){var m=this.extractCea608Data(b);p.addData(A.samples[L].pts,m[0]),f.addData(A.samples[L].pts,m[1])}}},o.onBufferFlushing=function(u,A){var p=A.startOffset,f=A.endOffset,L=A.endOffsetSubtitles,b=A.type,m=this.media;if(!m||m.currentTime<f)return;if(!b||b==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(I.removeCuesInRange)(c[a],p,f)})}if(this.config.renderTextTracksNatively&&(p===0&&L!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(I.removeCuesInRange)(d[a],p,L)})}},o.extractCea608Data=function(u){for(var A=u[0]&31,p=2,f=[[],[]],L=0;L<A;L++){var b=u[p++],m=127&u[p++],c=127&u[p++],d=(4&b)!==0,a=3&b;if(m===0&&c===0)continue;d&&((a===0||a===1)&&(f[a].push(m),f[a].push(c)))}return f},h}();function _(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function w(h,o,l,u){return Math.min(o,u)-Math.max(h,l)}function S(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(G,j){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=j}var P=B.prototype;return P.decrypt=function(j,I){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},I,j)},B}()},"./src/crypt/aes-decryptor.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"removePadding",function(){return B}),D.d(Q,"default",function(){return P});var Z=D("./src/utils/typed-array.ts");function B(G){var j=G.byteLength,I=j&&new DataView(G.buffer).getUint8(j-1);return I?Object(Z.sliceUint8)(G,0,j-I):G}var P=function(){function G(){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 j=G.prototype;return j.uint8ArrayToUint32Array_=function(k){for(var v=new DataView(k),T=new Uint32Array(4),R=0;R<4;R++)T[R]=v.getUint32(R*4);return T},j.initTable=function(){var k=this.sBox,v=this.invSBox,T=this.subMix,R=T[0],_=T[1],w=T[2],S=T[3],h=this.invSubMix,o=h[0],l=h[1],u=h[2],A=h[3],p=new Uint32Array(256),f=0,L=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 m=L^L<<1^L<<2^L<<3^L<<4;m=m>>>8^m&255^99,k[f]=m,v[m]=f;var c=p[f],d=p[c],a=p[d],x=p[m]*257^m*16843008;R[f]=x<<24|x>>>8,_[f]=x<<16|x>>>16,w[f]=x<<8|x>>>24,S[f]=x,x=a*16843009^d*65537^c*257^f*16843008,o[m]=x<<24|x>>>8,l[m]=x<<16|x>>>16,u[m]=x<<8|x>>>24,A[m]=x,f?(f=c^p[p[p[a^c]]],L^=p[p[L]]):f=L=1}},j.expandKey=function(k){for(var v=this.uint8ArrayToUint32Array_(k),T=!0,R=0;R<v.length&&T;)T=v[R]===this.key[R],R++;if(T)return;this.key=v;var _=this.keySize=v.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var w=this.ksRows=(_+6+1)*4,S,h,o=this.keySchedule=new Uint32Array(w),l=this.invKeySchedule=new Uint32Array(w),u=this.sBox,A=this.rcon,p=this.invSubMix,f=p[0],L=p[1],b=p[2],m=p[3],c,d;for(S=0;S<w;S++){if(S<_){c=o[S]=v[S];continue}d=c,S%_===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=A[S/_|0]<<24):_>6&&S%_===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),o[S]=c=(o[S-_]^d)>>>0}for(h=0;h<w;h++)S=w-h,h&3?d=o[S]:d=o[S-4],h<4||S<=4?l[h]=d:l[h]=f[u[d>>>24]]^L[u[d>>>16&255]]^b[u[d>>>8&255]]^m[u[d&255]],l[h]=l[h]>>>0},j.networkToHostOrderSwap=function(k){return k<<24|(k&65280)<<8|(k&16711680)>>8|k>>>24},j.decrypt=function(k,v,T){for(var R=this.keySize+6,_=this.invKeySchedule,w=this.invSBox,S=this.invSubMix,h=S[0],o=S[1],l=S[2],u=S[3],A=this.uint8ArrayToUint32Array_(T),p=A[0],f=A[1],L=A[2],b=A[3],m=new Int32Array(k),c=new Int32Array(m.length),d,a,x,y,E,N,U,K,V,O,M,$,ee,oe,fe=this.networkToHostOrderSwap;v<m.length;){for(V=fe(m[v]),O=fe(m[v+1]),M=fe(m[v+2]),$=fe(m[v+3]),E=V^_[0],N=$^_[1],U=M^_[2],K=O^_[3],ee=4,oe=1;oe<R;oe++)d=h[E>>>24]^o[N>>16&255]^l[U>>8&255]^u[K&255]^_[ee],a=h[N>>>24]^o[U>>16&255]^l[K>>8&255]^u[E&255]^_[ee+1],x=h[U>>>24]^o[K>>16&255]^l[E>>8&255]^u[N&255]^_[ee+2],y=h[K>>>24]^o[E>>16&255]^l[N>>8&255]^u[U&255]^_[ee+3],E=d,N=a,U=x,K=y,ee=ee+4;d=w[E>>>24]<<24^w[N>>16&255]<<16^w[U>>8&255]<<8^w[K&255]^_[ee],a=w[N>>>24]<<24^w[U>>16&255]<<16^w[K>>8&255]<<8^w[E&255]^_[ee+1],x=w[U>>>24]<<24^w[K>>16&255]<<16^w[E>>8&255]<<8^w[N&255]^_[ee+2],y=w[K>>>24]<<24^w[E>>16&255]<<16^w[N>>8&255]<<8^w[U&255]^_[ee+3],c[v]=fe(d^p),c[v+1]=fe(y^f),c[v+2]=fe(x^L),c[v+3]=fe(a^b),p=V,f=O,L=M,b=$,v=v+4}return c.buffer},G}()},"./src/crypt/decrypter.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return v});var Z=D("./src/crypt/aes-crypto.ts"),B=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),G=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),k=16,v=function(){function T(_,w,S){var h=S===void 0?{}:S,o=h.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=_,this.config=w,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(A){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=T.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var S=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(S):S},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(w,S,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),S,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),S,h).then(o)},R.softwareDecrypt=function(w,S,h){var o=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(w=Object(j.appendUint8Array)(u,w),this.remainderData=null);var A=this.getValidChunk(w);if(!A.length)return null;o&&(h=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new P.default),p.expandKey(S);var f=l;return this.currentResult=p.decrypt(A.buffer,0,h),this.currentIV=Object(I.sliceUint8)(A,-16).buffer,f||null},R.webCryptoDecrypt=function(w,S,h){var o=this,l=this.subtle;return(this.key!==S||!this.fastAesKey)&&(this.key=S,this.fastAesKey=new B.default(l,S)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var A=new Z.default(l,h);return A.decrypt(w.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,w,S,h)})},R.onWebCryptoError=function(w,S,h,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(S,h,o)},R.getValidChunk=function(w){var S=w,h=w.length-w.length%k;return h!==w.length&&(S=Object(I.sliceUint8)(w,0,h),this.remainderData=Object(I.sliceUint8)(w,h)),S},R.logOnce=function(w){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(G,j){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=j}var P=B.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),G=D("./src/demux/id3.ts");function j(v,T){v.prototype=Object.create(T.prototype),v.prototype.constructor=v,I(v,T)}function I(v,T){return I=Object.setPrototypeOf||function(_,w){return _.__proto__=w,_},I(v,T)}var k=function(v){j(T,v);function T(_,w){var S;return S=v.call(this)||this,S.observer=void 0,S.config=void 0,S.observer=_,S.config=w,S}var R=T.prototype;return R.resetInitSegment=function(w,S,h){v.prototype.resetInitSegment.call(this,w,S,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var S=G.getID3Data(w,0)||[],h=S.length,o=w.length;h<o;h++)if(B.probe(w,h))return P.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(w,S){return B.canParse(w,S)},R.appendFrame=function(w,S,h){B.initTrackConfig(w,this.observer,S,h,w.manifestCodec);var o=B.appendFrame(w,S,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(Z.default);k.minProbeByteLength=9,Q.default=k},"./src/demux/adts.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"getAudioConfig",function(){return G}),D.d(Q,"isHeaderPattern",function(){return j}),D.d(Q,"getHeaderLength",function(){return I}),D.d(Q,"getFullFrameLength",function(){return k}),D.d(Q,"canGetFrameLength",function(){return v}),D.d(Q,"isHeader",function(){return T}),D.d(Q,"canParse",function(){return R}),D.d(Q,"probe",function(){return _}),D.d(Q,"initTrackConfig",function(){return w}),D.d(Q,"getFrameDuration",function(){return S}),D.d(Q,"parseFrameHeader",function(){return h}),D.d(Q,"appendFrame",function(){return o});var Z=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),P=D("./src/events.ts");function G(l,u,A,p){var f,L,b,m,c=navigator.userAgent.toLowerCase(),d=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((u[A+2]&192)>>>6)+1;var x=(u[A+2]&60)>>>2;if(x>a.length-1){l.trigger(P.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return b=(u[A+2]&1)<<2,b|=(u[A+3]&192)>>>6,Z.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(f=5,m=new Array(4),L=x-3):(f=2,m=new Array(2),L=x):c.indexOf("android")!==-1?(f=2,m=new Array(2),L=x):(f=5,m=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&x>=6?L=x-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(x>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(f=2,m=new Array(2)),L=x)),m[0]=f<<3,m[0]|=(x&14)>>1,m[1]|=(x&1)<<7,m[1]|=b<<3,f===5&&(m[1]|=(L&14)>>1,m[2]=(L&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:a[x],channelCount:b,codec:"mp4a.40."+f,manifestCodec:d}}function j(l,u){return l[u]===255&&(l[u+1]&246)===240}function I(l,u){return l[u+1]&1?7:9}function k(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function v(l,u){return u+5<l.length}function T(l,u){return u+1<l.length&&j(l,u)}function R(l,u){return v(l,u)&&j(l,u)&&k(l,u)<=l.length-u}function _(l,u){if(T(l,u)){var A=I(l,u);if(u+A>=l.length)return!1;var p=k(l,u);if(p<=A)return!1;var f=u+p;return f===l.length||T(l,f)}return!1}function w(l,u,A,p,f){if(!l.samplerate){var L=G(u,A,p,f);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,Z.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function S(l){return 1024*9e4/l}function h(l,u,A,p,f){var L=I(l,u),b=k(l,u);if(b-=L,b>0){var m=A+p*f;return{headerLength:L,frameLength:b,stamp:m}}}function o(l,u,A,p,f){var L=S(l.samplerate),b=h(u,A,p,f,L);if(b){var m=b.frameLength,c=b.headerLength,d=b.stamp,a=c+m,x=Math.max(0,A+a-u.length),y;x?(y=new Uint8Array(a-c),y.set(u.subarray(A+c,u.length),0)):y=u.subarray(A+c,A+a);var E={unit:y,pts:d};return x||l.samples.push(E),{sample:E,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"initPTSFn",function(){return k});var Z=D("./src/polyfills/number.ts"),B=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),G=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/typed-array.ts"),I=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=v.prototype;return T.resetInitSegment=function(_,w,S){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(_,w){return!1},T.appendFrame=function(_,w,S){},T.demux=function(_,w){this.cachedData&&(_=Object(G.appendUint8Array)(this.cachedData,_),this.cachedData=null);var S=B.getID3Data(_,0),h=S?S.length:0,o,l,u=this._audioTrack,A=this._id3Track,p=S?B.getTimeStamp(S):void 0,f=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=k(p,w)),S&&S.length>0&&A.samples.push({pts:this.initPTS,dts:this.initPTS,data:S}),l=this.initPTS;h<f;){if(this.canParse(_,h)){var L=this.appendFrame(u,_,h);L?(this.frameIndex++,l=L.sample.pts,h+=L.length,o=h):h=f}else B.canParse(_,h)?(S=B.getID3Data(_,h),A.samples.push({pts:l,dts:l,data:S}),h+=S.length,o=h):h++;if(h===f&&o!==f){var b=Object(j.sliceUint8)(_,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:A,textTrack:Object(P.dummyTrack)()}},T.demuxSampleAes=function(_,w,S){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(_){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},T.destroy=function(){},v}(),k=function(T,R){return Object(Z.isFiniteNumber)(T)?T*90:R*9e4};Q.default=I},"./src/demux/chunk-cache.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function P(){this.chunks=[],this.dataLength=0}var G=P.prototype;return G.push=function(I){this.chunks.push(I),this.dataLength+=I.length},G.flush=function(){var I=this.chunks,k=this.dataLength,v;if(I.length)I.length===1?v=I[0]:v=B(I,k);else return new Uint8Array(0);return this.reset(),v},G.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function B(P,G){for(var j=new Uint8Array(G),I=0,k=0;k<P.length;k++){var v=P[k];j.set(v,I),I+=v.length}return j}},"./src/demux/dummy-demuxed-track.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/logger.ts"),B=function(){function P(j){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=j,this.bytesAvailable=j.byteLength,this.word=0,this.bitsAvailable=0}var G=P.prototype;return G.loadWord=function(){var I=this.data,k=this.bytesAvailable,v=I.byteLength-k,T=new Uint8Array(4),R=Math.min(4,k);if(R===0)throw new Error("no bytes available");T.set(I.subarray(v,v+R)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},G.skipBits=function(I){var k;this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,k=I>>3,I-=k>>3,this.bytesAvailable-=k,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},G.readBits=function(I){var k=Math.min(this.bitsAvailable,I),v=this.word>>>32-k;return I>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=k,this.bitsAvailable>0?this.word<<=k:this.bytesAvailable>0&&this.loadWord(),k=I-k,k>0&&this.bitsAvailable?v<<k|this.readBits(k):v},G.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!==0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},G.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(I){for(var k=8,v=8,T,R=0;R<I;R++)v!==0&&(T=this.readEG(),v=(k+T+256)%256),k=v===0?k:v},G.readSPS=function(){var I=0,k=0,v=0,T=0,R,_,w,S=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),A=this.skipEG.bind(this),p=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);S();var L=S();if(h(5),u(3),S(),p(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var b=o();if(b===3&&u(1),p(),p(),u(1),l())for(_=b!==3?8:12,w=0;w<_;w++)l()&&(w<6?f(16):f(64))}p();var m=o();if(m===0)o();else if(m===1)for(u(1),A(),A(),R=o(),w=0;w<R;w++)A();p(),u(1);var c=o(),d=o(),a=h(1);a===0&&u(1),u(1),l()&&(I=o(),k=o(),v=o(),T=o());var x=[1,1];if(l()&&l()){var y=S();switch(y){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[S()<<8|S(),S()<<8|S()];break}}}return{width:Math.ceil((c+1)*16-I*2-k*2),height:(2-a)*(d+1)*16-(a?2:4)*(v+T),pixelRatio:x}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();Q.default=B},"./src/demux/id3.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isHeader",function(){return Z}),D.d(Q,"isFooter",function(){return B}),D.d(Q,"getID3Data",function(){return P}),D.d(Q,"canParse",function(){return j}),D.d(Q,"getTimeStamp",function(){return I}),D.d(Q,"isTimeStampFrame",function(){return k}),D.d(Q,"getID3Frames",function(){return T}),D.d(Q,"decodeFrame",function(){return R}),D.d(Q,"utf8ArrayToStr",function(){return o}),D.d(Q,"testables",function(){return l});var Z=function(f,L){return L+10<=f.length&&(f[L]===73&&f[L+1]===68&&f[L+2]===51&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},B=function(f,L){return L+10<=f.length&&(f[L]===51&&f[L+1]===68&&f[L+2]===73&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},P=function(f,L){for(var b=L,m=0;Z(f,L);){m+=10;var c=G(f,L+6);m+=c,B(f,L+10)&&(m+=10),L+=m}return m>0?f.subarray(b,b+m):void 0},G=function(f,L){var b=0;return b=(f[L]&127)<<21,b|=(f[L+1]&127)<<14,b|=(f[L+2]&127)<<7,b|=f[L+3]&127,b},j=function(f,L){return Z(f,L)&&G(f,L+6)+10<=f.length-L},I=function(f){for(var L=T(f),b=0;b<L.length;b++){var m=L[b];if(k(m))return h(m)}return},k=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},v=function(f){var L=String.fromCharCode(f[0],f[1],f[2],f[3]),b=G(f,4),m=10;return{type:L,size:b,data:f.subarray(m,m+b)}},T=function(f){for(var L=0,b=[];Z(f,L);){var m=G(f,L+6);L+=10;for(var c=L+m;L+8<c;){var d=v(f.subarray(L)),a=R(d);a&&b.push(a),L+=d.size+10}B(f,L)&&(L+=10)}return b},R=function(f){return f.type==="PRIV"?_(f):f.type[0]==="W"?S(f):w(f)},_=function(f){if(f.size<2)return;var L=o(f.data,!0),b=new Uint8Array(f.data.subarray(L.length+1));return{key:f.type,info:L,data:b.buffer}},w=function(f){if(f.size<2)return;if(f.type==="TXXX"){var L=1,b=o(f.data.subarray(L),!0);L+=b.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:b,data:m}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},S=function(f){if(f.type==="WXXX"){if(f.size<2)return;var L=1,b=o(f.data.subarray(L),!0);L+=b.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:b,data:m}}var c=o(f.data);return{key:f.type,data:c}},h=function(f){if(f.data.byteLength===8){var L=new Uint8Array(f.data),b=L[3]&1,m=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return m/=45,b&&(m+=4772185884e-2),Math.round(m)}return},o=function(f,L){L===void 0&&(L=!1);var b=A();if(b){var m=b.decode(f);if(L){var c=m.indexOf("\0");return c!==-1?m.substring(0,c):m}return m.replace(/\0/g,"")}for(var d=f.length,a,x,y,E="",N=0;N<d;){if(a=f[N++],a===0&&L)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:x=f[N++],E+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=f[N++],y=f[N++],E+=String.fromCharCode((a&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return E},l={decodeTextFrame:w},u;function A(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),G=D("./src/demux/mpegaudio.ts");function j(v,T){v.prototype=Object.create(T.prototype),v.prototype.constructor=v,I(v,T)}function I(v,T){return I=Object.setPrototypeOf||function(_,w){return _.__proto__=w,_},I(v,T)}var k=function(v){j(T,v);function T(){return v.apply(this,arguments)||this}var R=T.prototype;return R.resetInitSegment=function(w,S,h){v.prototype.resetInitSegment.call(this,w,S,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var S=B.getID3Data(w,0)||[],h=S.length,o=w.length;h<o;h++)if(G.probe(w,h))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(w,S){return G.canParse(w,S)},R.appendFrame=function(w,S,h){return this.initPTS===null?void 0:G.appendFrame(w,S,h,this.initPTS,this.frameIndex)},T}(Z.default);k.minProbeByteLength=4,Q.default=k},"./src/demux/mp4demuxer.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function G(I,k){this.remainderData=null,this.config=void 0,this.config=k}var j=G.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(){},j.resetContiguity=function(){},G.probe=function(k){return Object(Z.findBox)({data:k,start:0,end:Math.min(k.length,16384)},["moof"]).length>0},j.demux=function(k){var v=k,T=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(Z.appendUint8Array)(this.remainderData,k));var R=Object(Z.segmentValidRange)(v);this.remainderData=R.remainder,T.samples=R.valid||new Uint8Array}else T.samples=v;return{audioTrack:Object(B.dummyTrack)(),avcTrack:T,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.flush=function(){var k=Object(B.dummyTrack)();return k.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:k,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.demuxSampleAes=function(k,v,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},G}();P.minProbeByteLength=1024,Q.default=P},"./src/demux/mpegaudio.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"appendFrame",function(){return I}),D.d(Q,"parseHeader",function(){return k}),D.d(Q,"isHeaderPattern",function(){return v}),D.d(Q,"isHeader",function(){return T}),D.d(Q,"canParse",function(){return R}),D.d(Q,"probe",function(){return _});var Z=null,B=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function I(w,S,h,o,l){if(h+24>S.length)return;var u=k(S,h);if(u&&h+u.frameLength<=S.length){var A=u.samplesPerFrame*9e4/u.sampleRate,p=o+l*A,f={unit:S.subarray(h,h+u.frameLength),pts:p,dts:p};return w.config=[],w.channelCount=u.channelCount,w.samplerate=u.sampleRate,w.samples.push(f),{sample:f,length:u.frameLength,missing:0}}}function k(w,S){var h=w[S+1]>>3&3,o=w[S+1]>>1&3,l=w[S+2]>>4&15,u=w[S+2]>>2&3;if(h!==1&&l!==0&&l!==15&&u!==3){var A=w[S+2]>>1&1,p=w[S+3]>>6,f=h===3?3-o:o===3?3:4,L=B[f*14+l-1]*1e3,b=h===3?0:h===2?1:2,m=P[b*3+u],c=p===3?1:2,d=G[h][o],a=j[o],x=d*8*a,y=Math.floor(d*L/m+A)*a;if(Z===null){var E=navigator.userAgent||"",N=E.match(/Chrome\/(\d+)/i);Z=N?parseInt(N[1]):0}var U=!!Z&&Z<=87;return U&&o===2&&L>=224e3&&p===0&&(w[S+3]=w[S+3]|128),{sampleRate:m,channelCount:c,frameLength:y,samplesPerFrame:x}}}function v(w,S){return w[S]===255&&(w[S+1]&224)===224&&(w[S+1]&6)!==0}function T(w,S){return S+1<w.length&&v(w,S)}function R(w,S){var h=4;return v(w,S)&&h<=w.length-S}function _(w,S){if(S+1<w.length&&v(w,S)){var h=4,o=k(w,S),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var u=S+l;return u===w.length||T(w,u)}return!1}},"./src/demux/sample-aes.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/crypt/decrypter.ts"),B=D("./src/demux/tsdemuxer.ts"),P=function(){function G(I,k,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new Z.default(I,k,{removePKCS7Padding:!1})}var j=G.prototype;return j.decryptBuffer=function(k,v){this.decrypter.decrypt(k,this.keyData.key.buffer,this.keyData.iv.buffer,v)},j.decryptAacSample=function(k,v,T,R){var _=k[v].unit,w=_.subarray(16,_.length-_.length%16),S=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),h=this;this.decryptBuffer(S,function(o){var l=new Uint8Array(o);_.set(l,16),R||h.decryptAacSamples(k,v+1,T)})},j.decryptAacSamples=function(k,v,T){for(;;v++){if(v>=k.length){T();return}if(k[v].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(k,v,T,R),!R)return}},j.getAvcEncryptedData=function(k){for(var v=Math.floor((k.length-48)/160)*16+16,T=new Int8Array(v),R=0,_=32;_<=k.length-16;_+=160,R+=16)T.set(k.subarray(_,_+16),R);return T},j.getAvcDecryptedUnit=function(k,v){for(var T=new Uint8Array(v),R=0,_=32;_<=k.length-16;_+=160,R+=16)k.set(T.subarray(R,R+16),_);return k},j.decryptAvcSample=function(k,v,T,R,_,w){var S=Object(B.discardEPB)(_.data),h=this.getAvcEncryptedData(S),o=this;this.decryptBuffer(h.buffer,function(l){_.data=o.getAvcDecryptedUnit(S,l),w||o.decryptAvcSamples(k,v,T+1,R)})},j.decryptAvcSamples=function(k,v,T,R){if(k instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,T=0){if(v>=k.length){R();return}for(var _=k[v].units;!(T>=_.length);T++){var w=_[T];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var S=this.decrypter.isSync();if(this.decryptAvcSample(k,v,T,R,w,S),!S)return}}},G}();Q.default=P},"./src/demux/transmuxer-interface.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _});var Z=D("./node_modules/webworkify-webpack/index.js"),B=D.n(Z),P=D("./src/events.ts"),G=D("./src/demux/transmuxer.ts"),j=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),k=D("./src/utils/mediasource-helper.ts"),v=D("./node_modules/eventemitter3/index.js"),T=D.n(v),R=Object(k.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function w(h,o,l,u){var A=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=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var p=h.config,f=function(d,a){a=a||{},a.frag=A.frag,a.id=A.id,h.trigger(d,a)};this.observer=new v.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,f),this.observer.on(P.Events.ERROR,f);var L={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var m;try{m=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(c){h.trigger(P.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},m.postMessage({cmd:"init",typeSupported:L,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){j.logger.warn("Error in worker:",c),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new G.default(this.observer,L,p,b,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,L,p,b,o)}var S=w.prototype;return S.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},S.push=function(o,l,u,A,p,f,L,b,m,c){var d=this;m.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,y=f?f.start:p.start,E=p.decryptdata,N=this.frag,U=!(N&&p.cc===N.cc),K=!(N&&m.level===N.level),V=N?m.sn-N.sn:-1,O=this.part?m.part-this.part.index:1,M=!K&&(V===1||V===0&&O===1),$=self.performance.now();(K||V||p.stats.parsing.start===0)&&(p.stats.parsing.start=$),f&&(O||!M)&&(f.stats.parsing.start=$);var ee=new G.TransmuxState(U,M,b,K,y);if(!M||U){j.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
discontinuity: `+U+`
trackSwitch: `+K+`
contiguous: `+M+`
accurateTimeOffset: `+b+`
timeOffset: `+y);var oe=new G.TransmuxConfig(u,A,l,L,c);this.configureTransmuxer(oe)}if(this.frag=p,this.part=f,x)x.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:m,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var fe=a.push(o,E,m,ee);Object(G.isPromise)(fe)?fe.then(function(Re){d.handleTransmuxComplete(Re)}):this.handleTransmuxComplete(fe)}},S.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,A=this.worker;if(A)A.postMessage({cmd:"flush",chunkMeta:o});else if(u){var p=u.flush(o);Object(G.isPromise)(p)?p.then(function(f){l.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},S.handleFlushResult=function(o,l){var u=this;o.forEach(function(A){u.handleTransmuxComplete(A)}),this.onFlush(l)},S.onWorkerMessage=function(o){var l=o.data,u=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,u.trigger(l.event,l.data);break}}},S.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},S.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return I});var Z=D("./src/demux/transmuxer.ts"),B=D("./src/events.ts"),P=D("./src/utils/logger.ts"),G=D("./node_modules/eventemitter3/index.js"),j=D.n(G);function I(_){var w=new G.EventEmitter,S=function(o,l){_.postMessage({event:o,data:l})};w.on(B.Events.FRAG_DECRYPTED,S),w.on(B.Events.ERROR,S),_.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);_.transmuxer=new Z.default(w,o.typeSupported,l,o.vendor,o.id),Object(P.enableLogs)(l.debug),S("init",null);break}case"configure":{_.transmuxer.configure(o.config);break}case"demux":{var u=_.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(u)?u.then(function(f){k(_,f)}):k(_,u);break}case"flush":{var A=o.chunkMeta,p=_.transmuxer.flush(A);Object(Z.isPromise)(p)?p.then(function(f){T(_,f,A)}):T(_,p,A);break}default:break}})}function k(_,w){if(R(w.remuxResult))return;var S=[],h=w.remuxResult,o=h.audio,l=h.video;o&&v(S,o),l&&v(S,l),_.postMessage({event:"transmuxComplete",data:w},S)}function v(_,w){w.data1&&_.push(w.data1.buffer),w.data2&&_.push(w.data2.buffer)}function T(_,w,S){w.forEach(function(h){k(_,h)}),_.postMessage({event:"flush",data:S})}function R(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l}),D.d(Q,"isPromise",function(){return p}),D.d(Q,"TransmuxConfig",function(){return f}),D.d(Q,"TransmuxState",function(){return L});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),G=D("./src/demux/aacdemuxer.ts"),j=D("./src/demux/mp4demuxer.ts"),I=D("./src/demux/tsdemuxer.ts"),k=D("./src/demux/mp3demuxer.ts"),v=D("./src/remux/mp4-remuxer.ts"),T=D("./src/remux/passthrough-remuxer.ts"),R=D("./src/demux/chunk-cache.ts"),_=D("./src/utils/mp4-tools.ts"),w=D("./src/utils/logger.ts"),S;try{S=self.performance.now.bind(self.performance)}catch(b){w.logger.debug("Unable to use Performance API on this environment"),S=self.Date.now}var h=[{demux:I.default,remux:v.default},{demux:j.default,remux:T.default},{demux:G.default,remux:v.default},{demux:k.default,remux:v.default}],o=1024;h.forEach(function(b){var m=b.demux;o=Math.max(o,m.minProbeByteLength)});var l=function(){function b(c,d,a,x,y){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new R.default,this.observer=c,this.typeSupported=d,this.config=a,this.vendor=x,this.id=y}var m=b.prototype;return m.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},m.push=function(d,a,x,y){var E=this,N=x.transmuxing;N.executeStart=S();var U=new Uint8Array(d),K=this.cache,V=this.config,O=this.currentTransmuxState,M=this.transmuxConfig;y&&(this.currentTransmuxState=y);var $=u(U,a);if($&&$.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(U,$.key.buffer,$.iv.buffer);if(!oe)return N.executeEnd=S(),A(x);U=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(U,$.key.buffer,$.iv.buffer).then(function(Pe){var Me=E.push(Pe,null,x);return E.decryptionPromise=null,Me}),this.decryptionPromise}var fe=y||O,Re=fe.contiguous,Ee=fe.discontinuity,Ce=fe.trackSwitch,we=fe.accurateTimeOffset,Te=fe.timeOffset,ge=M.audioCodec,ue=M.videoCodec,te=M.defaultInitPts,he=M.duration,ae=M.initSegmentData;if((Ee||Ce)&&this.resetInitSegment(ae,ge,ue,he),Ee&&this.resetInitialTimestamp(te),Re||this.resetContiguity(),this.needsProbing(U,Ee,Ce)){if(K.dataLength){var _e=K.flush();U=Object(_.appendUint8Array)(_e,U)}this.configureTransmuxer(U,M)}var Oe=this.transmux(U,$,Te,we,x),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,N.executeEnd=S(),Oe},m.flush=function(d){var a=this,x=d.transmuxing;x.executeStart=S();var y=this.decrypter,E=this.cache,N=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(d)});var K=[],V=N.timeOffset;if(y){var O=y.flush();O&&K.push(this.push(O,null,d))}var M=E.dataLength;E.reset();var $=this.demuxer,ee=this.remuxer;if(!$||!ee)return M>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=S(),[A(d)];var oe=$.flush(V);return p(oe)?oe.then(function(fe){return a.flushRemux(K,fe,d),K}):(this.flushRemux(K,oe,d),K)},m.flushRemux=function(d,a,x){var y=a.audioTrack,E=a.avcTrack,N=a.id3Track,U=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,O=K.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var M=this.remuxer.remux(y,E,N,U,O,V,!0,this.id);d.push({remuxResult:M,chunkMeta:x}),x.transmuxing.executeEnd=S()},m.resetInitialTimestamp=function(d){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(d),x.resetTimeStamp(d)},m.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},m.resetInitSegment=function(d,a,x,y){var E=this.demuxer,N=this.remuxer;if(!E||!N)return;E.resetInitSegment(a,x,y),N.resetInitSegment(d,a,x)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(d,a,x,y,E){var N;return a&&a.method==="SAMPLE-AES"?N=this.transmuxSampleAes(d,a,x,y,E):N=this.transmuxUnencrypted(d,x,y,E),N},m.transmuxUnencrypted=function(d,a,x,y){var E=this.demuxer.demux(d,a,!1,!this.config.progressive),N=E.audioTrack,U=E.avcTrack,K=E.id3Track,V=E.textTrack,O=this.remuxer.remux(N,U,K,V,a,x,!1,this.id);return{remuxResult:O,chunkMeta:y}},m.transmuxSampleAes=function(d,a,x,y,E){var N=this;return this.demuxer.demuxSampleAes(d,a,x).then(function(U){var K=N.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,x,y,!1,N.id);return{remuxResult:K,chunkMeta:E}})},m.configureTransmuxer=function(d,a){for(var x=this.config,y=this.observer,E=this.typeSupported,N=this.vendor,U=a.audioCodec,K=a.defaultInitPts,V=a.duration,O=a.initSegmentData,M=a.videoCodec,$,ee=0,oe=h.length;ee<oe;ee++)if(h[ee].demux.probe(d)){$=h[ee];break}$||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:j.default,remux:T.default});var fe=this.demuxer,Re=this.remuxer,Ee=$.remux,Ce=$.demux;(!Re||!(Re instanceof Ee))&&(this.remuxer=new Ee(y,x,E,N)),(!fe||!(fe instanceof Ce))&&(this.demuxer=new Ce(y,x,E),this.probe=Ce.probe),this.resetInitSegment(O,U,M,V),this.resetInitialTimestamp(K)},m.needsProbing=function(d,a,x){return!this.demuxer||!this.remuxer||a||x},m.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new P.default(this.observer,this.config)),d},b}();function u(b,m){var c=null;return b.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(c=m),c}var A=function(m){return{remuxResult:{},chunkMeta:m}};function p(b){return"then"in b&&b.then instanceof Function}var f=function(m,c,d,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=c,this.initSegmentData=d,this.duration=a,this.defaultInitPts=x},L=function(m,c,d,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=c,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"discardEPB",function(){return A});var Z=D("./src/demux/adts.ts"),B=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),G=D("./src/demux/id3.ts"),j=D("./src/demux/sample-aes.ts"),I=D("./src/events.ts"),k=D("./src/utils/mp4-tools.ts"),v=D("./src/utils/logger.ts"),T=D("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},_=function(){function p(L,b,m){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=L,this.config=b,this.typeSupported=m}p.probe=function(b){var m=p.syncOffset(b);return m<0?!1:(m&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var m=Math.min(1e3,b.length-3*188),c=0;c<m;){if(b[c]===71&&b[c+188]===71&&b[c+2*188]===71)return c;c++}return-1},p.createTrack=function(b,m){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:R[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?m:void 0}};var f=p.prototype;return f.resetInitSegment=function(b,m,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=m,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var b=this._audioTrack,m=this._avcTrack,c=this._id3Track;b&&(b.pesData=null),m&&(m.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(b,m,c,d){c===void 0&&(c=!1),d===void 0&&(d=!1),c||(this.sampleAes=null);var a,x=this._avcTrack,y=this._audioTrack,E=this._id3Track,N=x.pid,U=x.pesData,K=y.pid,V=E.pid,O=y.pesData,M=E.pesData,$=!1,ee=this.pmtParsed,oe=this._pmtId,fe=b.length;if(this.remainderData&&(b=Object(k.appendUint8Array)(this.remainderData,b),fe=b.length,this.remainderData=null),fe<188&&!d)return this.remainderData=b,{audioTrack:y,avcTrack:x,id3Track:E,textTrack:this._txtTrack};var Re=Math.max(0,p.syncOffset(b));fe-=(fe+Re)%188,fe<b.byteLength&&!d&&(this.remainderData=new Uint8Array(b.buffer,fe,b.buffer.byteLength-fe));for(var Ee=Re;Ee<fe;Ee+=188)if(b[Ee]===71){var Ce=!!(b[Ee+1]&64),we=((b[Ee+1]&31)<<8)+b[Ee+2],Te=(b[Ee+3]&48)>>4,ge=void 0;if(Te>1){if(ge=Ee+5+b[Ee+4],ge===Ee+188)continue}else ge=Ee+4;switch(we){case N:Ce&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(b.subarray(ge,Ee+188)),U.size+=Ee+188-ge);break;case K:Ce&&(O&&(a=o(O))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(b.subarray(ge,Ee+188)),O.size+=Ee+188-ge);break;case V:Ce&&(M&&(a=o(M))&&this.parseID3PES(a),M={data:[],size:0}),M&&(M.data.push(b.subarray(ge,Ee+188)),M.size+=Ee+188-ge);break;case 0:Ce&&(ge+=b[ge]+1),oe=this._pmtId=S(b,ge);break;case oe:{Ce&&(ge+=b[ge]+1);var ue=h(b,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);N=ue.avc,N>0&&(x.pid=N),K=ue.audio,K>0&&(y.pid=K,y.isAAC=ue.isAAC),V=ue.id3,V>0&&(E.pid=V),$&&!ee&&(v.logger.log("reparse from beginning"),$=!1,Ee=Re-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=U,y.pesData=O,E.pesData=M;var te={audioTrack:y,avcTrack:x,id3Track:E,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(te),te},f.flush=function(){var b=this.remainderData;this.remainderData=null;var m;return b?m=this.demux(b,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},f.extractRemainingSamples=function(b){var m=b.audioTrack,c=b.avcTrack,d=b.id3Track,a=c.pesData,x=m.pesData,y=d.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,x&&(E=o(x))?(m.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),m.pesData=null):(x!=null&&x.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=x),y&&(E=o(y))?(this.parseID3PES(E),d.pesData=null):d.pesData=y},f.demuxSampleAes=function(b,m,c){var d=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new j.default(this.observer,this.config,m);return this.decrypt(d,a)},f.decrypt=function(b,m){return new Promise(function(c){var d=b.audioTrack,a=b.avcTrack;d.samples&&d.isAAC?m.decryptAacSamples(d.samples,0,function(){a.samples?m.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&m.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,m){var c=this,d=this._avcTrack,a=this.parseAVCNALu(b.data),x=!1,y=this.avcSample,E,N=!1;b.data=null,y&&a.length&&!d.audFound&&(l(y,d),y=this.avcSample=w(!1,b.pts,b.dts,"")),a.forEach(function(U){switch(U.type){case 1:{E=!0,y||(y=c.avcSample=w(!0,b.pts,b.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var K=U.data;if(N&&K.length>4){var V=new P.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(y.key=!0)}break}case 5:E=!0,y||(y=c.avcSample=w(!0,b.pts,b.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{E=!0,x&&y&&(y.debug+="SEI ");var O=new P.default(A(U.data));O.readUByte();for(var M=0,$=0,ee=!1,oe=0;!ee&&O.bytesAvailable>1;){M=0;do oe=O.readUByte(),M+=oe;while(oe===255);$=0;do oe=O.readUByte(),$+=oe;while(oe===255);if(M===4&&O.bytesAvailable!==0){ee=!0;var fe=O.readUByte();if(fe===181){var Re=O.readUShort();if(Re===49){var Ee=O.readUInt();if(Ee===1195456820){var Ce=O.readUByte();if(Ce===3){for(var we=O.readUByte(),Te=O.readUByte(),ge=31&we,ue=[we,Te],te=0;te<ge;te++)ue.push(O.readUByte()),ue.push(O.readUByte()),ue.push(O.readUByte());u(c._txtTrack.samples,{type:3,pts:b.pts,bytes:ue})}}}}}else if(M===5&&O.bytesAvailable!==0){if(ee=!0,$>16){for(var he=[],ae=0;ae<16;ae++)he.push(O.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&he.push("-");for(var _e=$-16,Oe=new Uint8Array(_e),ye=0;ye<_e;ye++)Oe[ye]=O.readUByte();u(c._txtTrack.samples,{pts:b.pts,payloadType:M,uuid:he.join(""),userData:Object(G.utf8ArrayToStr)(Oe),userDataBytes:Oe})}}else if($<O.bytesAvailable)for(var Pe=0;Pe<$;Pe++)O.readUByte()}break}case 7:if(E=!0,N=!0,x&&y&&(y.debug+="SPS "),!d.sps){var Me=new P.default(U.data),Ne=Me.readSPS();d.width=Ne.width,d.height=Ne.height,d.pixelRatio=Ne.pixelRatio,d.sps=[U.data],d.duration=c._duration;for(var Fe=U.data.subarray(1,4),Ue="avc1.",Be=0;Be<3;Be++){var tt=Fe[Be].toString(16);tt.length<2&&(tt="0"+tt),Ue+=tt}d.codec=Ue}break;case 8:E=!0,x&&y&&(y.debug+="PPS "),d.pps||(d.pps=[U.data]);break;case 9:E=!1,d.audFound=!0,y&&l(y,d),y=c.avcSample=w(!1,b.pts,b.dts,x?"AUD ":"");break;case 12:E=!1;break;default:E=!1,y&&(y.debug+="unknown NAL "+U.type+" ");break}if(y&&E){var et=y.units;et.push(U)}}),m&&y&&(l(y,d),this.avcSample=null)},f.getLastNalUnit=function(){var b,m=this.avcSample,c;if(!m||m.units.length===0){var d=this._avcTrack.samples;m=d[d.length-1]}if((b=m)!==null&&b!==void 0&&b.units){var a=m.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(b){var m=b.byteLength,c=this._avcTrack,d=c.naluState||0,a=d,x=[],y=0,E,N,U,K=-1,V=0;for(d===-1&&(K=0,V=b[0]&31,d=0,y=1);y<m;){if(E=b[y++],!d){d=E?0:1;continue}if(d===1){d=E?0:2;continue}if(!E)d=3;else if(E===1){if(K>=0){var O={data:b.subarray(K,y-d-1),type:V};x.push(O)}else{var M=this.getLastNalUnit();if(M&&(a&&y<=4-a&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-a))),N=y-d-1,N>0)){var $=new Uint8Array(M.data.byteLength+N);$.set(M.data,0),$.set(b.subarray(0,N),M.data.byteLength),M.data=$,M.state=0}}y<m?(U=b[y]&31,K=y,V=U,d=0):d=-1}else d=0}if(K>=0&&d>=0){var ee={data:b.subarray(K,m),type:V,state:d};x.push(ee)}if(x.length===0){var oe=this.getLastNalUnit();if(oe){var fe=new Uint8Array(oe.data.byteLength+b.byteLength);fe.set(oe.data,0),fe.set(b,oe.data.byteLength),oe.data=fe}}return c.naluState=d,x},f.parseAACPES=function(b){var m=0,c=this._audioTrack,d=this.aacOverFlow,a=b.data;if(d){this.aacOverFlow=null;var x=d.sample.unit.byteLength,y=Math.min(d.missing,x),E=x-y;d.sample.unit.set(a.subarray(0,y),E),c.samples.push(d.sample),m=d.missing}var N,U;for(N=m,U=a.length;N<U-1&&!Z.isHeader(a,N);N++);if(N!==m){var K,V;if(N<U-1?(K="AAC PES did not start with ADTS header,offset:"+N,V=!1):(K="no ADTS header found in AAC PES",V=!0),v.logger.warn("parsing error:"+K),this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}Z.initTrackConfig(c,this.observer,a,N,this.audioCodec);var O;if(b.pts!==void 0)O=b.pts;else if(d){var M=Z.getFrameDuration(c.samplerate);O=d.sample.pts+M}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;N<U;)if(Z.isHeader(a,N)){if(N+5<U){var ee=Z.appendFrame(c,a,N,O,$);if(ee)if(ee.missing)this.aacOverFlow=ee;else{N+=ee.length,$++;continue}}break}else N++},f.parseMPEGPES=function(b){var m=b.data,c=m.length,d=0,a=0,x=b.pts;if(x===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(B.isHeader(m,a)){var y=B.appendFrame(this._audioTrack,m,a,x,d);if(y)a+=y.length,d++;else break}else a++},f.parseID3PES=function(b){if(b.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},p}();_.minProbeByteLength=188;function w(p,f,L,b){return{key:p,frame:!1,pts:f,dts:L,units:[],debug:b,length:0}}function S(p,f){return(p[f+10]&31)<<8|p[f+11]}function h(p,f,L,b){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(p[f+1]&15)<<8|p[f+2],d=f+3+c-4,a=(p[f+10]&15)<<8|p[f+11];for(f+=12+a;f<d;){var x=(p[f+1]&31)<<8|p[f+2];switch(p[f]){case 207:if(!b){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=x);break;case 21:m.id3===-1&&(m.id3=x);break;case 219:if(!b){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=x);break;case 3:case 4:L?m.audio===-1&&(m.audio=x,m.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((p[f+3]&15)<<8|p[f+4])+5}return m}function o(p){var f=0,L,b,m,c,d,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}L=a[0];var y=(L[0]<<16)+(L[1]<<8)+L[2];if(y===1){if(b=(L[4]<<8)+L[5],b&&b>p.size-6)return null;var E=L[7];E&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,E&64?(d=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-d>60*9e4&&(v.logger.warn(Math.round((c-d)/9e4)+"s delta between PTS and DTS, align them"),c=d)):d=c),m=L[8];var N=m+9;if(p.size<=N)return null;p.size-=N;for(var U=new Uint8Array(p.size),K=0,V=a.length;K<V;K++){L=a[K];var O=L.byteLength;if(N)if(N>O){N-=O;continue}else L=L.subarray(N),O-=N,N=0;U.set(L,f),f+=O}return b&&(b-=m+3),{data:U,pts:c,dts:d,len:b}}return null}function l(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var L=f.samples,b=L.length;if(b){var m=L[b-1];p.pts=m.pts,p.dts=m.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&v.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function u(p,f){var L=p.length;if(L>0){if(f.pts>=p[L-1].pts)p.push(f);else for(var b=L-1;b>=0;b--)if(f.pts<p[b].pts){p.splice(b,0,f);break}}else p.push(f)}function A(p){for(var f=p.byteLength,L=[],b=1;b<f-2;)p[b]===0&&p[b+1]===0&&p[b+2]===3?(L.push(b+2),b+=2):b++;if(L.length===0)return p;var m=f-L.length,c=new Uint8Array(m),d=0;for(b=0;b<m;d++,b++)d===L[0]&&(d++,L.shift()),c[b]=p[d];return c}Q.default=_},"./src/errors.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"ErrorTypes",function(){return Z}),D.d(Q,"ErrorDetails",function(){return B});var Z;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(Z||(Z={}));var B;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"Events",function(){return Z});var Z;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return p});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z),P=D("./src/loader/playlist-loader.ts"),G=D("./src/loader/key-loader.ts"),j=D("./src/controller/id3-track-controller.ts"),I=D("./src/controller/latency-controller.ts"),k=D("./src/controller/level-controller.ts"),v=D("./src/controller/fragment-tracker.ts"),T=D("./src/controller/stream-controller.ts"),R=D("./src/is-supported.ts"),_=D("./src/utils/logger.ts"),w=D("./src/config.ts"),S=D("./node_modules/eventemitter3/index.js"),h=D.n(S),o=D("./src/events.ts"),l=D("./src/errors.ts");function u(f,L){for(var b=0;b<L.length;b++){var m=L[b];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function A(f,L,b){return L&&u(f.prototype,L),b&&u(f,b),f}var p=function(){f.isSupported=function(){return Object(R.isSupported)()};function f(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new S.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 m=this.config=Object(w.mergeConfig)(f.DefaultConfig,b);this.userConfig=b,Object(_.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(w.enableStreamingMode)(m);var c=m.abrController,d=m.bufferController,a=m.capLevelController,x=m.fpsController,y=this.abrController=new c(this),E=this.bufferController=new d(this),N=this.capLevelController=new a(this),U=new x(this),K=new P.default(this),V=new G.default(this),O=new j.default(this),M=this.levelController=new k.default(this),$=new v.FragmentTracker(this),ee=this.streamController=new T.default(this,$);N.setStreamController(ee),U.setStreamController(ee);var oe=[M,ee];this.networkControllers=oe;var fe=[K,V,y,E,N,U,O,$];this.audioTrackController=this.createController(m.audioTrackController,null,oe),this.createController(m.audioStreamController,$,oe),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,oe),this.createController(m.subtitleStreamController,$,oe),this.createController(m.timelineController,null,fe),this.emeController=this.createController(m.emeController,null,fe),this.cmcdController=this.createController(m.cmcdController,null,fe),this.latencyController=this.createController(I.default,null,fe),this.coreComponents=fe}var L=f.prototype;return L.createController=function(m,c,d){if(m){var a=c?new m(this,c):new m(this);return d&&d.push(a),a}return null},L.on=function(m,c,d){d===void 0&&(d=this),this._emitter.on(m,c,d)},L.once=function(m,c,d){d===void 0&&(d=this),this._emitter.once(m,c,d)},L.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},L.off=function(m,c,d,a){d===void 0&&(d=this),this._emitter.off(m,c,d,a)},L.listeners=function(m){return this._emitter.listeners(m)},L.emit=function(m,c,d){return this._emitter.emit(m,c,d)},L.trigger=function(m,c){if(this.config.debug)return this.emit(m,m,c);try{return this.emit(m,m,c)}catch(d){_.logger.error("An internal error happened while handling event "+m+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:d})}return!1},L.listenerCount=function(m){return this._emitter.listenerCount(m)},L.destroy=function(){_.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},L.attachMedia=function(m){_.logger.log("attachMedia"),this._media=m,this.trigger(o.Events.MEDIA_ATTACHING,{media:m})},L.detachMedia=function(){_.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(m){this.stopLoad();var c=this.media,d=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});_.logger.log("loadSource:"+a),c&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:m})},L.startLoad=function(m){m===void 0&&(m=-1),_.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(c){c.startLoad(m)})},L.stopLoad=function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},L.swapAudioCodec=function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){_.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},L.removeLevel=function(m,c){c===void 0&&(c=0),this.levelController.removeLevel(m,c)},A(f,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){_.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){_.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){_.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){_.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){_.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var c=!!m;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(m){this._autoLevelCapping!==m&&(_.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,c=this.config.minAutoBitrate;if(!m)return 0;for(var d=m.length,a=0;a<d;a++)if(m[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,c=this.autoLevelCapping,d;return c===-1&&m&&m.length?d=m.length-1:d=c,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var c=this.audioTrackController;c&&(c.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:w.hlsDefaultConfig},set:function(m){f.defaultConfig=m}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isSupported",function(){return P}),D.d(Q,"changeTypeSupported",function(){return G});var Z=D("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var j=Object(Z.getMediaSource)();if(!j)return!1;var I=B(),k=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!I||I.prototype&&typeof I.prototype.appendBuffer=="function"&&typeof I.prototype.remove=="function";return!!k&&!!v}function G(){var j,I=B();return typeof(I==null||((j=I.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return _}),D.d(Q,"LoadError",function(){return S});var Z=D("./src/polyfills/number.ts"),B=D("./src/errors.ts");function P(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,v(h,o)}function G(h){var o=typeof Map=="function"?new Map:void 0;return G=function(u){if(u===null||!k(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,A)}function A(){return j(u,arguments,T(this).constructor)}return A.prototype=Object.create(u.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),v(A,u)},G(h)}function j(h,o,l){return I()?j=Reflect.construct:j=function(A,p,f){var L=[null];L.push.apply(L,p);var b=Function.bind.apply(A,L),m=new b;return f&&v(m,f.prototype),m},j.apply(null,arguments)}function I(){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 k(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function v(h,o){return v=Object.setPrototypeOf||function(u,A){return u.__proto__=A,u},v(h,o)}function T(h){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},T(h)}var R=Math.pow(2,17),_=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,A){var p=this,f=u.url;if(!f)return Promise.reject(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var L=this.config,b=L.fLoader,m=L.loader;return new Promise(function(c,d){p.loader&&p.loader.destroy();var a=p.loader=u.loader=b?new b(L):new m(L),x=w(u),y={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:R};u.stats=a.stats,a.load(x,y,{onSuccess:function(N,U,K,V){p.resetLoader(u,a),c({frag:u,part:null,payload:N.data,networkDetails:V})},onError:function(N,U,K){p.resetLoader(u,a),d(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:N,networkDetails:K}))},onAbort:function(N,U,K){p.resetLoader(u,a),d(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:K}))},onTimeout:function(N,U,K){p.resetLoader(u,a),d(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:K}))},onProgress:function(N,U,K,V){A&&A({frag:u,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(u,A,p){var f=this;this.abort();var L=this.config,b=L.fLoader,m=L.loader;return new Promise(function(c,d){f.loader&&f.loader.destroy();var a=f.loader=u.loader=b?new b(L):new m(L),x=w(u,A),y={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:R};A.stats=a.stats,a.load(x,y,{onSuccess:function(N,U,K,V){f.resetLoader(u,a),f.updateStatsFromPart(u,A);var O={frag:u,part:A,payload:N.data,networkDetails:V};p(O),c(O)},onError:function(N,U,K){f.resetLoader(u,a),d(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:A,response:N,networkDetails:K}))},onAbort:function(N,U,K){u.stats.aborted=A.stats.aborted,f.resetLoader(u,a),d(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:A,networkDetails:K}))},onTimeout:function(N,U,K){f.resetLoader(u,a),d(new S({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:A,networkDetails:K}))}})})},o.updateStatsFromPart=function(u,A){var p=u.stats,f=A.stats,L=f.total;if(p.loaded+=f.loaded,L){var b=Math.round(u.duration/A.duration),m=Math.min(Math.round(p.loaded/L),b),c=b-m,d=c*Math.round(p.loaded/m);p.total=p.loaded+d}else p.total=Math.max(p.loaded,p.total);var a=p.loading,x=f.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(u,A){u.loader=null,this.loader===A&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),A.destroy()},h}();function w(h,o){o===void 0&&(o=null);var l=o||h,u={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},A=l.byteRangeStartOffset,p=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(A)&&Object(Z.isFiniteNumber)(p)&&(u.rangeStart=A,u.rangeEnd=p),u}var S=function(h){P(o,h);function o(l){for(var u,A=arguments.length,p=new Array(A>1?A-1:0),f=1;f<A;f++)p[f-1]=arguments[f];return u=h.call.apply(h,[this].concat(p))||this,u.data=void 0,u.data=l,u}return o}(G(Error))},"./src/loader/fragment.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"ElementaryStreamTypes",function(){return _}),D.d(Q,"BaseSegment",function(){return w}),D.d(Q,"Fragment",function(){return S}),D.d(Q,"Part",function(){return h});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(B),G=D("./src/utils/logger.ts"),j=D("./src/loader/level-key.ts"),I=D("./src/loader/load-stats.ts");function k(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,v(o,l)}function v(o,l){return v=Object.setPrototypeOf||function(A,p){return A.__proto__=p,A},v(o,l)}function T(o,l){for(var u=0;u<l.length;u++){var A=l[u];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(o,A.key,A)}}function R(o,l,u){return l&&T(o.prototype,l),u&&T(o,u),o}var _;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(_||(_={}));var w=function(){function o(u){var A;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(A={},A[_.AUDIO]=null,A[_.VIDEO]=null,A[_.AUDIOVIDEO]=null,A),this.baseurl=u}var l=o.prototype;return l.setByteRange=function(A,p){var f=A.split("@",2),L=[];f.length===1?L[0]=p?p.byteRangeEndOffset:0:L[0]=parseInt(f[1]),L[1]=parseInt(f[0])+L[0],this._byteRange=L},R(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(A){this._url=A}}]),o}(),S=function(o){k(l,o);function l(A,p){var f;return f=o.call(this,p)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new I.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=A,f}var u=l.prototype;return u.createInitializationVector=function(p){for(var f=new Uint8Array(16),L=12;L<16;L++)f[L]=p>>8*(15-L)&255;return f},u.setDecryptDataFromLevelKey=function(p,f){var L=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(L=j.LevelKey.fromURI(p.uri),L.method=p.method,L.iv=this.createInitializationVector(f),L.keyFormat="identity"),L},u.setElementaryStreamInfo=function(p,f,L,b,m,c){c===void 0&&(c=!1);var d=this.elementaryStreams,a=d[p];if(!a){d[p]={startPTS:f,endPTS:L,startDTS:b,endDTS:m,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,m)},u.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[_.AUDIO]=null,p[_.VIDEO]=null,p[_.AUDIOVIDEO]=null},R(l,[{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&&G.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(Z.isFiniteNumber)(this.programDateTime))return null;var p=Object(Z.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)}}]),l}(w),h=function(o){k(l,o);function l(u,A,p,f,L){var b;b=o.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 I.LoadStats,b.duration=u.decimalFloatingPoint("DURATION"),b.gap=u.bool("GAP"),b.independent=u.bool("INDEPENDENT"),b.relurl=u.enumeratedString("URI"),b.fragment=A,b.index=f;var m=u.enumeratedString("BYTERANGE");return m&&b.setByteRange(m,L),L&&(b.fragOffset=L.fragOffset+L.duration),b}return R(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var A=this.elementaryStreams;return!!(A.audio||A.video||A.audiovideo)}}]),l}(w)},"./src/loader/key-loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return G});var Z=D("./src/events.ts"),B=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),G=function(){function j(k){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=k,this._registerListeners()}var I=j.prototype;return I._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},I._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},I.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var T=this.loaders[v];T&&T.destroy()}this.loaders={}},I.onKeyLoading=function(v,T){var R=T.frag,_=R.type,w=this.loaders[_];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var S=R.decryptdata.uri;if(S!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(w&&(P.logger.warn("abort previous key loader for type:"+_),w.abort()),!S){P.logger.warn("key uri is falsy");return}var o=h.loader,l=R.loader=this.loaders[_]=new o(h);this.decrypturl=S,this.decryptkey=null;var u={url:S,frag:R,responseType:"arraybuffer"},A={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,A,p)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:R}))},I.loadsuccess=function(v,T,R){var _=R.frag;if(!_.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(v.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:_})},I.loaderror=function(v,T){var R=T.frag,_=R.loader;_&&_.abort(),delete this.loaders[R.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:v})},I.loadtimeout=function(v,T){var R=T.frag,_=R.loader;_&&_.abort(),delete this.loaders[R.type],this.hls.trigger(Z.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},j}()},"./src/loader/level-details.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"LevelDetails",function(){return j});var Z=D("./src/polyfills/number.ts");function B(I,k){for(var v=0;v<k.length;v++){var T=k[v];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(I,T.key,T)}}function P(I,k,v){return k&&B(I.prototype,k),v&&B(I,v),I}var G=10,j=function(){function I(v){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=v}var k=I.prototype;return k.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-T.lastPartSn,_=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!_||!!R,this.advanced=this.endSN>T.endSN||R>0||R===0&&_>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},P(I,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var R=this.driftEnd-this.driftStart;return R*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),I}()},"./src/loader/level-key.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"LevelKey",function(){return j});var Z=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Z);function P(I,k){for(var v=0;v<k.length;v++){var T=k[v];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(I,T.key,T)}}function G(I,k,v){return k&&P(I.prototype,k),v&&P(I,v),I}var j=function(){I.fromURL=function(v,T){return new I(v,T)},I.fromURI=function(v){return new I(v)};function I(k,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(Z.buildAbsoluteURL)(k,v,{alwaysNormalize:!0}):this._uri=k}return G(I,[{key:"uri",get:function(){return this._uri}}]),I}()},"./src/loader/load-stats.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"LoadStats",function(){return Z});var Z=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(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l});var Z=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(B),G=D("./src/loader/fragment.ts"),j=D("./src/loader/level-details.ts"),I=D("./src/loader/level-key.ts"),k=D("./src/utils/attr-list.ts"),v=D("./src/utils/logger.ts"),T=D("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,_=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),S=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("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var b,m;return h.test((b=(m=B.parseURL(L))===null||m===void 0?void 0:m.path)!=null?b:"")}var l=function(){function L(){}return L.findGroup=function(m,c){for(var d=0;d<m.length;d++){var a=m[d];if(a.id===c)return a}},L.convertAVC1ToAVCOTI=function(m){var c=m.split(".");if(c.length>2){var d=c.shift()+".";return d+=parseInt(c.shift()).toString(16),d+=("000"+parseInt(c.shift()).toString(16)).substr(-4),d}return m},L.resolve=function(m,c){return B.buildAbsoluteURL(c,m,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(m,c){var d=[],a={},x=!1;R.lastIndex=0;for(var y;(y=R.exec(m))!=null;)if(y[1]){var E=new k.AttrList(y[1]),N={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:L.resolve(y[2],c)},U=E.decimalResolution("RESOLUTION");U&&(N.width=U.width,N.height=U.height),u((E.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=L.convertAVC1ToAVCOTI(N.videoCodec)),d.push(N)}else if(y[3]){var K=new k.AttrList(y[3]);K["DATA-ID"]&&(x=!0,a[K["DATA-ID"]]=K)}return{levels:d,sessionData:x?a:null}},L.parseMasterPlaylistMedia=function(m,c,d,a){a===void 0&&(a=[]);var x,y=[],E=0;for(_.lastIndex=0;(x=_.exec(m))!==null;){var N=new k.AttrList(x[1]);if(N.TYPE===d){var U={attrs:N,bitrate:0,id:E++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:d,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?L.resolve(N.URI,c):""};if(a.length){var K=L.findGroup(a,U.groupId)||a[0];A(U,K,"audioCodec"),A(U,K,"textCodec")}y.push(U)}}return y},L.parseLevelPlaylist=function(m,c,d,a,x){var y=new j.LevelDetails(c),E=y.fragments,N=null,U=0,K=0,V=0,O=0,M=null,$=new G.Fragment(a,c),ee,oe,fe,Re=-1,Ee=!1;for(w.lastIndex=0,y.m3u8=m;(ee=w.exec(m))!==null;){Ee&&(Ee=!1,$=new G.Fragment(a,c),$.start=V,$.sn=U,$.cc=O,$.level=d,N&&($.initSegment=N,$.rawProgramDateTime=N.rawProgramDateTime));var Ce=ee[1];if(Ce){$.duration=parseFloat(Ce);var we=(" "+ee[2]).slice(1);$.title=we||null,$.tagList.push(we?["INF",Ce,we]:["INF",Ce])}else if(ee[3])Object(Z.isFiniteNumber)($.duration)&&($.start=V,fe&&($.levelkey=fe),$.sn=U,$.level=d,$.cc=O,$.urlId=x,E.push($),$.relurl=(" "+ee[3]).slice(1),f($,M),M=$,V+=$.duration,U++,K=0,Ee=!0);else if(ee[4]){var Te=(" "+ee[4]).slice(1);M?$.setByteRange(Te,M):$.setByteRange(Te)}else if(ee[5])$.rawProgramDateTime=(" "+ee[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Re===-1&&(Re=E.length);else{if(ee=ee[0].match(S),!ee){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var ge=(" "+ee[oe]).slice(1),ue=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(ge){case"PLAYLIST-TYPE":y.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":U=y.startSN=parseInt(ue);break;case"SKIP":{var he=new k.AttrList(ue),ae=he.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(ae)){y.skippedSegments=ae;for(var _e=ae;_e--;)E.unshift(null);U+=ae}var Oe=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");Oe&&(y.recentlyRemovedDateranges=Oe.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(ue);break;case"VERSION":y.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(ue||te)&&$.tagList.push(te?[ue,te]:[ue]);break;case"DIS":O++;case"GAP":$.tagList.push([ge]);break;case"BITRATE":$.tagList.push([ge,ue]);break;case"DISCONTINUITY-SEQ":O=parseInt(ue);break;case"KEY":{var ye,Pe=new k.AttrList(ue),Me=Pe.enumeratedString("METHOD"),Ne=Pe.URI,Fe=Pe.hexadecimalInteger("IV"),Ue=Pe.enumeratedString("KEYFORMATVERSIONS"),Be=Pe.enumeratedString("KEYID"),tt=(ye=Pe.enumeratedString("KEYFORMAT"))!=null?ye:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf(tt)>-1){v.logger.warn("Keyformat "+tt+" is not supported from the manifest");continue}else if(tt!=="identity")continue;Me&&(fe=I.LevelKey.fromURL(c,Ne),Ne&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(fe.method=Me,fe.keyFormat=tt,Be&&(fe.keyID=Be),Ue&&(fe.keyFormatVersions=Ue),fe.iv=Fe));break}case"START":{var Ye=new k.AttrList(ue),$e=Ye.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)($e)&&(y.startTimeOffset=$e);break}case"MAP":{var lt=new k.AttrList(ue);$.relurl=lt.URI,lt.BYTERANGE&&$.setByteRange(lt.BYTERANGE),$.level=d,$.sn="initSegment",fe&&($.levelkey=fe),$.initSegment=null,N=$,Ee=!0;break}case"SERVER-CONTROL":{var Ze=new k.AttrList(ue);y.canBlockReload=Ze.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Ze.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Ze.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Ze.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Ze.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ot=new k.AttrList(ue);y.partTarget=ot.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=y.partList;ke||(ke=y.partList=[]);var nt=K>0?ke[ke.length-1]:void 0,Je=K++,Ie=new G.Part(new k.AttrList(ue),$,c,Je,nt);ke.push(Ie),$.duration+=Ie.duration;break}case"PRELOAD-HINT":{var He=new k.AttrList(ue);y.preloadHint=He;break}case"RENDITION-REPORT":{var xe=new k.AttrList(ue);y.renditionReports=y.renditionReports||[],y.renditionReports.push(xe);break}default:v.logger.warn("line parsed but not handled: "+ee);break}}}M&&!M.relurl?(E.pop(),V-=M.duration,y.partList&&(y.fragmentHint=M)):y.partList&&(f($,M),$.cc=O,y.fragmentHint=$);var pe=E.length,be=E[0],re=E[pe-1];if(V+=y.skippedSegments*y.targetduration,V>0&&pe&&re){y.averagetargetduration=V/pe;var ne=re.sn;y.endSN=ne!=="initSegment"?ne:0,be&&(y.startCC=be.cc,be.initSegment||y.fragments.every(function(se){return se.relurl&&o(se.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,c),$.relurl=re.relurl,$.level=d,$.sn="initSegment",be.initSegment=$,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(V+=y.fragmentHint.duration),y.totalduration=V,y.endCC=O,Re>0&&p(E,Re),y},L}();function u(L,b){["video","audio","text"].forEach(function(m){var c=L.filter(function(a){return Object(T.isCodecType)(a,m)});if(c.length){var d=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[m+"Codec"]=d.length>0?d[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=L}function A(L,b,m){var c=b[m];c&&(L[m]=c)}function p(L,b){for(var m=L[b],c=b;c--;){var d=L[c];if(!d)return;d.programDateTime=m.programDateTime-d.duration*1e3,m=d}}function f(L,b){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):b!=null&&b.programDateTime&&(L.programDateTime=b.endProgramDateTime),Object(Z.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),P=D("./src/errors.ts"),G=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/m3u8-parser.ts"),k=D("./src/types/loader.ts"),v=D("./src/utils/attr-list.ts");function T(w){var S=w.type;switch(S){case k.PlaylistContextType.AUDIO_TRACK:return k.PlaylistLevelType.AUDIO;case k.PlaylistContextType.SUBTITLE_TRACK:return k.PlaylistLevelType.SUBTITLE;default:return k.PlaylistLevelType.MAIN}}function R(w,S){var h=w.url;return(h===void 0||h.indexOf("data:")===0)&&(h=S.url),h}var _=function(){function w(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var S=w.prototype;return S.registerListeners=function(){var o=this.hls;o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,A=l.loader,p=u||A,f=new p(l);return o.loader=f,this.loaders[o.type]=f,f},S.getInternalLoader=function(o){return this.loaders[o.type]},S.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},S.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},S.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},S.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:k.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},S.onLevelLoading=function(o,l){var u=l.id,A=l.level,p=l.url,f=l.deliveryDirectives;this.load({id:u,groupId:null,level:A,responseType:"text",type:k.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},S.onAudioTrackLoading=function(o,l){var u=l.id,A=l.groupId,p=l.url,f=l.deliveryDirectives;this.load({id:u,groupId:A,level:null,responseType:"text",type:k.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},S.onSubtitleTrackLoading=function(o,l){var u=l.id,A=l.groupId,p=l.url,f=l.deliveryDirectives;this.load({id:u,groupId:A,level:null,responseType:"text",type:k.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},S.load=function(o){var l,u=this.hls.config,A=this.getInternalLoader(o);if(A){var p=A.context;if(p&&p.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),A.abort()}var f,L,b,m;switch(o.type){case k.PlaylistContextType.MANIFEST:f=u.manifestLoadingMaxRetry,L=u.manifestLoadingTimeOut,b=u.manifestLoadingRetryDelay,m=u.manifestLoadingMaxRetryTimeout;break;case k.PlaylistContextType.LEVEL:case k.PlaylistContextType.AUDIO_TRACK:case k.PlaylistContextType.SUBTITLE_TRACK:f=0,L=u.levelLoadingTimeOut;break;default:f=u.levelLoadingMaxRetry,L=u.levelLoadingTimeOut,b=u.levelLoadingRetryDelay,m=u.levelLoadingMaxRetryTimeout;break}if(A=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===k.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===k.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===k.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var d=c.partTarget,a=c.targetduration;d&&a&&(L=Math.min(Math.max(d*3,a*.8)*1e3,L))}}var x={timeout:L,maxRetry:f,retryDelay:b,maxRetryDelay:m,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};A.load(o,x,y)},S.loadsuccess=function(o,l,u,A){if(A===void 0&&(A=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,A);return}this.resetInternalLoader(u.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",A);return}l.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,A):this.handleMasterPlaylist(o,l,u,A)},S.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},S.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},S.handleMasterPlaylist=function(o,l,u,A){var p=this.hls,f=o.data,L=R(o,u),b=I.default.parseMasterPlaylist(f,L),m=b.levels,c=b.sessionData;if(!m.length){this.handleManifestParsingError(o,u,"no level found in manifest",A);return}var d=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),x=I.default.parseMasterPlaylistMedia(f,L,"AUDIO",d),y=I.default.parseMasterPlaylistMedia(f,L,"SUBTITLES",a),E=I.default.parseMasterPlaylistMedia(f,L,"CLOSED-CAPTIONS");if(x.length){var N=x.some(function(U){return!U.url});!N&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}p.trigger(B.Events.MANIFEST_LOADED,{levels:m,audioTracks:x,subtitles:y,captions:E,url:L,stats:l,networkDetails:A,sessionData:c})},S.handleTrackOrLevelPlaylist=function(o,l,u,A){var p=this.hls,f=u.id,L=u.level,b=u.type,m=R(o,u),c=Object(Z.isFiniteNumber)(f)?f:0,d=Object(Z.isFiniteNumber)(L)?L:c,a=T(u),x=I.default.parseLevelPlaylist(o.data,m,d,a,c);if(!x.fragments.length){p.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(b===k.PlaylistContextType.MANIFEST){var y={attrs:new v.AttrList({}),bitrate:0,details:x,name:"",url:m};p.trigger(B.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:m,stats:l,networkDetails:A,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var E,N=(E=x.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:N,isSidxRequest:!0,type:b,level:L,levelDetails:x,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=x,this.handlePlaylistLoaded(o,l,u,A)},S.handleSidxRequest=function(o,l){var u=Object(j.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var A=u.references,p=l.levelDetails;A.forEach(function(f,L){var b=f.info,m=p.fragments[L];m.byteRange.length===0&&m.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),m.initSegment&&m.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},S.handleManifestParsingError=function(o,l,u,A){this.hls.trigger(B.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===k.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:A})},S.handleNetworkError=function(o,l,u,A){u===void 0&&(u=!1),G.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=P.ErrorDetails.UNKNOWN,f=!1,L=this.getInternalLoader(o);switch(o.type){case k.PlaylistContextType.MANIFEST:p=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case k.PlaylistContextType.LEVEL:p=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case k.PlaylistContextType.AUDIO_TRACK:p=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case k.PlaylistContextType.SUBTITLE_TRACK:p=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}L&&this.resetInternalLoader(o.type);var b={type:P.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:L,context:o,networkDetails:l};A&&(b.response=A),this.hls.trigger(B.Events.ERROR,b)},S.handlePlaylistLoaded=function(o,l,u,A){var p=u.type,f=u.level,L=u.id,b=u.groupId,m=u.loader,c=u.levelDetails,d=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",A);return}if(!m)return;c.live&&(m.getCacheAge&&(c.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case k.PlaylistContextType.MANIFEST:case k.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:c,level:f||0,id:L||0,stats:l,networkDetails:A,deliveryDirectives:d});break;case k.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:b||"",stats:l,networkDetails:A,deliveryDirectives:d});break;case k.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:b||"",stats:l,networkDetails:A,deliveryDirectives:d});break}},w}();Q.default=_},"./src/polyfills/number.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isFiniteNumber",function(){return Z}),D.d(Q,"MAX_SAFE_INTEGER",function(){return B});var Z=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,Q,D){"use strict";D.r(Q);var Z=function(){function B(){}return B.getSilentFrame=function(G,j){switch(G){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},B}();Q.default=Z},"./src/remux/mp4-generator.ts":function(le,Q,D){"use strict";D.r(Q);var Z=Math.pow(2,32)-1,B=function(){function P(){}return P.init=function(){P.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 j;for(j in P.types)P.types.hasOwnProperty(j)&&(P.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.charCodeAt(3)]);var I=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]),k=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]);P.HDLR_TYPES={video:I,audio:k};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=T,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,w,R,_),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,v))},P.box=function(j){for(var I=8,k=arguments.length,v=new Array(k>1?k-1:0),T=1;T<k;T++)v[T-1]=arguments[T];for(var R=v.length,_=R;R--;)I+=v[R].byteLength;var w=new Uint8Array(I);for(w[0]=I>>24&255,w[1]=I>>16&255,w[2]=I>>8&255,w[3]=I&255,w.set(j,4),R=0,I=8;R<_;R++)w.set(v[R],I),I+=v[R].byteLength;return w},P.hdlr=function(j){return P.box(P.types.hdlr,P.HDLR_TYPES[j])},P.mdat=function(j){return P.box(P.types.mdat,j)},P.mdhd=function(j,I){I*=j;var k=Math.floor(I/(Z+1)),v=Math.floor(I%(Z+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,k>>24,k>>16&255,k>>8&255,k&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},P.mdia=function(j){return P.box(P.types.mdia,P.mdhd(j.timescale,j.duration),P.hdlr(j.type),P.minf(j))},P.mfhd=function(j){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},P.minf=function(j){return j.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(j)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(j))},P.moof=function(j,I,k){return P.box(P.types.moof,P.mfhd(j),P.traf(k,I))},P.moov=function(j){for(var I=j.length,k=[];I--;)k[I]=P.trak(j[I]);return P.box.apply(null,[P.types.moov,P.mvhd(j[0].timescale,j[0].duration)].concat(k).concat(P.mvex(j)))},P.mvex=function(j){for(var I=j.length,k=[];I--;)k[I]=P.trex(j[I]);return P.box.apply(null,[P.types.mvex].concat(k))},P.mvhd=function(j,I){I*=j;var k=Math.floor(I/(Z+1)),v=Math.floor(I%(Z+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,k>>24,k>>16&255,k>>8&255,k&255,v>>24,v>>16&255,v>>8&255,v&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 P.box(P.types.mvhd,T)},P.sdtp=function(j){var I=j.samples||[],k=new Uint8Array(4+I.length),v,T;for(v=0;v<I.length;v++)T=I[v].flags,k[v+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return P.box(P.types.sdtp,k)},P.stbl=function(j){return P.box(P.types.stbl,P.stsd(j),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(j){var I=[],k=[],v,T,R;for(v=0;v<j.sps.length;v++)T=j.sps[v],R=T.byteLength,I.push(R>>>8&255),I.push(R&255),I=I.concat(Array.prototype.slice.call(T));for(v=0;v<j.pps.length;v++)T=j.pps[v],R=T.byteLength,k.push(R>>>8&255),k.push(R&255),k=k.concat(Array.prototype.slice.call(T));var _=P.box(P.types.avcC,new Uint8Array([1,I[3],I[4],I[5],252|3,224|j.sps.length].concat(I).concat([j.pps.length]).concat(k))),w=j.width,S=j.height,h=j.pixelRatio[0],o=j.pixelRatio[1];return P.box(P.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,w>>8&255,w&255,S>>8&255,S&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]),_,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(j){var I=j.config.length;return new Uint8Array([0,0,0,0,3,23+I,0,1,0,4,15+I,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([I]).concat(j.config).concat([6,1,2]))},P.mp4a=function(j){var I=j.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]),P.box(P.types.esds,P.esds(j)))},P.mp3=function(j){var I=j.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]))},P.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(j)):P.box(P.types.stsd,P.STSD,P.mp4a(j)):P.box(P.types.stsd,P.STSD,P.avc1(j))},P.tkhd=function(j){var I=j.id,k=j.duration*j.timescale,v=j.width,T=j.height,R=Math.floor(k/(Z+1)),_=Math.floor(k%(Z+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,_>>24,_>>16&255,_>>8&255,_&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,v>>8&255,v&255,0,0,T>>8&255,T&255,0,0]))},P.traf=function(j,I){var k=P.sdtp(j),v=j.id,T=Math.floor(I/(Z+1)),R=Math.floor(I%(Z+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(j,k.length+16+20+8+16+8+8),k)},P.trak=function(j){return j.duration=j.duration||4294967295,P.box(P.types.trak,P.tkhd(j),P.mdia(j))},P.trex=function(j){var I=j.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(j,I){var k=j.samples||[],v=k.length,T=12+16*v,R=new Uint8Array(T),_,w,S,h,o,l;for(I+=8+T,R.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255],0),_=0;_<v;_++)w=k[_],S=w.duration,h=w.size,o=w.flags,l=w.cts,R.set([S>>>24&255,S>>>16&255,S>>>8&255,S&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*_);return P.box(P.types.trun,R)},P.initSegment=function(j){P.types||P.init();var I=P.moov(j),k=new Uint8Array(P.FTYP.byteLength+I.byteLength);return k.set(P.FTYP),k.set(I,P.FTYP.byteLength),k},P}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Q.default=B},"./src/remux/mp4-remuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return l}),D.d(Q,"normalizePts",function(){return u});var Z=D("./src/polyfills/number.ts"),B=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),G=D("./src/events.ts"),j=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),k=D("./src/types/loader.ts"),v=D("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(L){for(var b=1;b<arguments.length;b++){var m=arguments[b];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},T.apply(this,arguments)}var R=10*1e3,_=1024,w=1152,S=null,h=null,o=!1,l=function(){function L(m,c,d,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=m,this.config=c,this.typeSupported=d,this.ISGenerated=!1,S===null){var x=navigator.userAgent||"",y=x.match(/Chrome\/(\d+)/i);S=y?parseInt(y[1]):0}if(h===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);h=E?parseInt(E[1]):0}o=!!S&&S<75||!!h&&h<600}var b=L.prototype;return b.destroy=function(){},b.resetTimeStamp=function(c){I.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},b.resetNextTimestamp=function(){I.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){I.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(c){var d=!1,a=c.reduce(function(x,y){var E=y.pts-x;return E<-4294967296?(d=!0,u(x,y.pts)):E>0?x:y.pts},c[0].pts);return d&&I.logger.debug("PTS rollover detected"),a},b.remux=function(c,d,a,x,y,E,N,U){var K,V,O,M,$,ee,oe=y,fe=y,Re=c.pid>-1,Ee=d.pid>-1,Ce=d.samples.length,we=c.samples.length>0,Te=Ce>1,ge=(!Re||we)&&(!Ee||Te)||this.ISGenerated||N;if(ge){this.ISGenerated||(O=this.generateIS(c,d,y));var ue=this.isVideoContiguous,te=-1;if(Te&&(te=A(d.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){I.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Ce+" video samples due to a missing keyframe");var he=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(te),d.dropped+=te,fe+=(d.samples[0].pts-he)/(d.timescale||9e4)}else te===-1&&(I.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),ee=!1);if(this.ISGenerated){if(we&&Te){var ae=this.getVideoStartPts(d.samples),_e=u(c.samples[0].pts,ae)-ae,Oe=_e/d.inputTimeScale;oe+=Math.max(0,Oe),fe+=Math.max(0,-Oe)}if(we){if(c.samplerate||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(c,d,y)),V=this.remuxAudio(c,oe,this.isAudioContiguous,E,Ee||Te||U===k.PlaylistLevelType.AUDIO?fe:void 0),Te){var ye=V?V.endPTS-V.startPTS:0;d.inputTimeScale||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(c,d,y)),K=this.remuxVideo(d,fe,ue,ye)}}else Te&&(K=this.remuxVideo(d,fe,ue,0));K&&(K.firstKeyFrame=te,K.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,y)),x.samples.length&&(M=this.remuxText(x,y))),{audio:V,video:K,initSegment:O,independent:ee,text:M,id3:$}},b.generateIS=function(c,d,a){var x=c.samples,y=d.samples,E=this.typeSupported,N={},U=!Object(Z.isFiniteNumber)(this._initPTS),K="audio/mp4",V,O,M;if(U&&(V=O=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(K="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),N.audio={id:"audio",container:K,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):P.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(M=c.inputTimeScale,V=O=x[0].pts-Math.round(M*a))),d.sps&&d.pps&&y.length&&(d.timescale=d.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:P.default.initSegment([d]),metadata:{width:d.width,height:d.height}},U)){M=d.inputTimeScale;var $=this.getVideoStartPts(y),ee=Math.round(M*a);O=Math.min(O,u(y[0].dts,$)-ee),V=Math.min(V,$-ee)}if(Object.keys(N).length)return this.ISGenerated=!0,U&&(this._initPTS=V,this._initDTS=O),{tracks:N,initPTS:V,timescale:M}},b.remuxVideo=function(c,d,a,x){var y=c.inputTimeScale,E=c.samples,N=[],U=E.length,K=this._initPTS,V=this.nextAvcDts,O=8,M,$,ee,oe=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,Re=0,Ee=!1;if(!a||V===null){var Ce=d*y,we=E[0].pts-u(E[0].dts,E[0].pts);V=Ce-we}for(var Te=0;Te<U;Te++){var ge=E[Te];if(ge.pts=u(ge.pts-K,V),ge.dts=u(ge.dts-K,V),ge.dts>ge.pts){var ue=9e4*.2;Re=Math.max(Math.min(Re,ge.pts-ge.dts),-1*ue)}ge.dts<E[Te>0?Te-1:Te].dts&&(Ee=!0)}Ee&&E.sort(function(wt,St){var ct=wt.dts-St.dts,zt=wt.pts-St.pts;return ct||zt}),$=E[0].dts,ee=E[E.length-1].dts;var te=Math.round((ee-$)/(U-1));if(Re<0){if(Re<te*-2){I.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-te,!0)+" ms");for(var he=Re,ae=0;ae<U;ae++)E[ae].dts=he=Math.max(he,E[ae].pts-te),E[ae].pts=Math.max(he,E[ae].pts)}else{I.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(Re,!0)+" ms to overcome this issue");for(var _e=0;_e<U;_e++)E[_e].dts=E[_e].dts+Re}$=E[0].dts}if(a){var Oe=$-V,ye=Oe>te,Pe=Oe<-1;if(ye||Pe){ye?I.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(Oe,!0)+" ms ("+Oe+"dts) hole between fragments detected, filling it"):I.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-Oe,!0)+" ms ("+Oe+"dts) overlapping between fragments detected"),$=V;var Me=E[0].pts-Oe;E[0].dts=$,E[0].pts=Me,I.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(Me,!0)+"/"+Object(v.toMsFromMpegTsClock)($,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(Oe,!0)+" ms")}}o&&($=Math.max(0,$));for(var Ne=0,Fe=0,Ue=0;Ue<U;Ue++){for(var Be=E[Ue],tt=Be.units,et=tt.length,Ye=0,$e=0;$e<et;$e++)Ye+=tt[$e].data.length;Fe+=Ye,Ne+=et,Be.length=Ye,Be.dts=Math.max(Be.dts,$),Be.pts=Math.max(Be.pts,Be.dts,0),oe=Math.min(Be.pts,oe),fe=Math.max(Be.pts,fe)}ee=E[U-1].dts;var lt=Fe+4*Ne+8,Ze;try{Ze=new Uint8Array(lt)}catch(wt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:lt,reason:"fail allocating video mdat "+lt});return}var ot=new DataView(Ze.buffer);ot.setUint32(0,lt),Ze.set(P.default.types.mdat,4);for(var ke=0;ke<U;ke++){for(var nt=E[ke],Je=nt.units,Ie=0,He=0,xe=Je.length;He<xe;He++){var pe=Je[He],be=pe.data,re=pe.data.byteLength;ot.setUint32(O,re),O+=4,Ze.set(be,O),O+=re,Ie+=4+re}if(ke<U-1)M=E[ke+1].dts-nt.dts;else{var ne=this.config,se=nt.dts-E[ke>0?ke-1:ke].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(ne.maxBufferHole*y),Le=(x?oe+x*y:this.nextAudioPts)-nt.pts;Le>de?(M=Le-se,M<0&&(M=se),I.logger.log("[mp4-remuxer]: It is approximately "+Le/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=se}else M=se}var Se=Math.round(nt.pts-nt.dts);N.push(new p(nt.key,M,Ie,Se))}if(N.length&&S&&S<70){var We=N[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+M,this.isVideoContiguous=!0;var at=P.default.moof(c.sequenceNumber++,$,T({},c,{samples:N})),ft="video",ut={data1:at,data2:Ze,startPTS:oe/y,endPTS:(fe+M)/y,startDTS:$/y,endDTS:V/y,type:ft,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Ze.length,"MDAT length must not be zero"),ut},b.remuxAudio=function(c,d,a,x,y){var E=c.inputTimeScale,N=c.samplerate?c.samplerate:E,U=E/N,K=c.isAAC?_:w,V=K*U,O=this._initPTS,M=!c.isAAC&&this.typeSupported.mpeg,$=[],ee=c.samples,oe=M?0:8,fe=this.nextAudioPts||-1,Re=d*E;if(this.isAudioContiguous=a=a||ee.length&&fe>0&&(x&&Math.abs(Re-fe)<9e3||Math.abs(u(ee[0].pts-O,Re)-fe)<20*V),ee.forEach(function(be){be.pts=u(be.pts-O,Re)}),!a||fe<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;y===0?fe=0:x?fe=Math.max(0,Re):fe=ee[0].pts}if(c.isAAC)for(var Ee=y!==void 0,Ce=this.config.maxAudioFramesDrift,we=0,Te=fe;we<ee.length;we++){var ge=ee[we],ue=ge.pts,te=ue-Te,he=Math.abs(1e3*te/E);if(te<=-Ce*V&&Ee)we===0&&(I.logger.warn("Audio frame @ "+(ue/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/E)+" ms."),this.nextAudioPts=fe=Te=ue);else if(te>=Ce*V&&he<R&&Ee){var ae=Math.round(te/V);Te=ue-ae*V,Te<0&&(ae--,Te+=V),we===0&&(this.nextAudioPts=fe=Te),I.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(Te/E).toFixed(3)+"s due to "+Math.round(1e3*te/E)+" ms gap.");for(var _e=0;_e<ae;_e++){var Oe=Math.max(Te,0),ye=B.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(I.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ge.unit.subarray()),ee.splice(we,0,{unit:ye,pts:Oe}),Te+=V,we++}}ge.pts=Te,Te+=V}for(var Pe=null,Me=null,Ne,Fe=0,Ue=ee.length;Ue--;)Fe+=ee[Ue].unit.byteLength;for(var Be=0,tt=ee.length;Be<tt;Be++){var et=ee[Be],Ye=et.unit,$e=et.pts;if(Me!==null){var lt=$[Be-1];lt.duration=Math.round(($e-Me)/U)}else if(a&&c.isAAC&&($e=fe),Pe=$e,Fe>0){Fe+=oe;try{Ne=new Uint8Array(Fe)}catch(be){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!M){var Ze=new DataView(Ne.buffer);Ze.setUint32(0,Fe),Ne.set(P.default.types.mdat,4)}}else return;Ne.set(Ye,oe);var ot=Ye.byteLength;oe+=ot,$.push(new p(!0,K,ot,0)),Me=$e}var ke=$.length;if(!ke)return;var nt=$[$.length-1];this.nextAudioPts=fe=Me+U*nt.duration;var Je=M?new Uint8Array(0):P.default.moof(c.sequenceNumber++,Pe/U,T({},c,{samples:$}));c.samples=[];var Ie=Pe/E,He=fe/E,xe="audio",pe={data1:Je,data2:Ne,startPTS:Ie,endPTS:He,startDTS:Ie,endDTS:He,type:xe,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(Ne.length,"MDAT length must not be zero"),pe},b.remuxEmptyAudio=function(c,d,a,x){var y=c.inputTimeScale,E=c.samplerate?c.samplerate:y,N=y/E,U=this.nextAudioPts,K=(U!==null?U:x.startDTS*y)+this._initDTS,V=x.endDTS*y+this._initDTS,O=N*_,M=Math.ceil((V-K)/O),$=B.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(I.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){I.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<M;oe++){var fe=K+oe*O;ee.push({unit:$,pts:fe,dts:fe})}return c.samples=ee,this.remuxAudio(c,d,a,!1)},b.remuxID3=function(c,d){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,E=this._initDTS,N=0;N<a;N++){var U=c.samples[N];U.pts=u(U.pts-y,d*x)/x,U.dts=u(U.dts-E,d*x)/x}var K=c.samples;return c.samples=[],{samples:K}},b.remuxText=function(c,d){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,y=this._initPTS,E=0;E<a;E++){var N=c.samples[E];N.pts=u(N.pts-y,d*x)/x}c.samples.sort(function(K,V){return K.pts-V.pts});var U=c.samples;return c.samples=[],{samples:U}},L}();function u(L,b){var m;if(b===null)return L;for(b<L?m=-8589934592:m=8589934592;Math.abs(L-b)>4294967296;)L+=m;return L}function A(L){for(var b=0;b<L.length;b++)if(L[b].key)return b;return-1}var p=function(b,m,c,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=c,this.cts=d,this.flags=new f(b)},f=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(le,Q,D){"use strict";D.r(Q);var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),G=D("./src/utils/logger.ts"),j=function(){function v(){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 T=v.prototype;return T.destroy=function(){},T.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(_,w,S){this.audioCodec=w,this.videoCodec=S,this.generateInitSegment(_),this.emitInitSegment=!0},T.generateInitSegment=function(_){var w=this.audioCodec,S=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(B.parseInitSegment)(_);w||(w=k(h.audio,P.ElementaryStreamTypes.AUDIO)),S||(S=k(h.video,P.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:w+","+S,initSegment:_,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:w,initSegment:_,id:"audio"}:h.video?o.video={container:"video/mp4",codec:S,initSegment:_,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(_,w,S,h,o){var l=this.initPTS,u=this.lastEndDTS,A={audio:void 0,video:void 0,text:h,id3:S,initSegment:void 0};Object(Z.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var p=w.samples;if(!p||!p.length)return A;var f={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(p),L=this.initData),!L||!L.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=f.initPTS=l=I(L,p,u));var b=Object(B.getDuration)(p,L),m=u,c=b+m;Object(B.offsetStartDTS)(L,p,l),b>0?this.lastEndDTS=c:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!L.audio,a=!!L.video,x="";d&&(x+="audio"),a&&(x+="video");var y={data1:p,startPTS:m,startDTS:m,endPTS:c,endDTS:c,type:x,hasAudio:d,hasVideo:a,nb:1,dropped:0};return A.audio=y.type==="audio"?y:void 0,A.video=y.type!=="audio"?y:void 0,A.text=h,A.id3=S,A.initSegment=f,A},v}(),I=function(T,R,_){return Object(B.getStartDTS)(T,R)-_};function k(v,T){var R=v==null?void 0:v.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||T===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Q.default=j},"./src/task-loop.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=B.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},B}()},"./src/types/cmcd.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"CMCDVersion",function(){return Z}),D.d(Q,"CMCDObjectType",function(){return B}),D.d(Q,"CMCDStreamingFormat",function(){return P}),D.d(Q,"CMCDStreamType",function(){return G});var Z=1,B;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(B||(B={}));var P;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(P||(P={}));var G;(function(j){j.VOD="v",j.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"HlsSkip",function(){return P}),D.d(Q,"getSkipValue",function(){return G}),D.d(Q,"HlsUrlParameters",function(){return j}),D.d(Q,"Level",function(){return I});function Z(k,v){for(var T=0;T<v.length;T++){var R=v[T];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(k,R.key,R)}}function B(k,v,T){return v&&Z(k.prototype,v),T&&Z(k,T),k}var P;(function(k){k.No="",k.Yes="YES",k.v2="v2"})(P||(P={}));function G(k,v){var T=k.canSkipUntil,R=k.canSkipDateRanges,_=k.endSN,w=v!==void 0?v-_:0;return T&&w<T?R?P.v2:P.Yes:P.No}var j=function(){function k(T,R,_){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=R,this.skip=_}var v=k.prototype;return v.addDirectives=function(R){var _=new self.URL(R);return this.msn!==void 0&&_.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&_.searchParams.set("_HLS_part",this.part.toString()),this.skip&&_.searchParams.set("_HLS_skip",this.skip),_.toString()},k}(),I=function(){function k(v){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=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return B(k,[{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(T){var R=T%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),k}()},"./src/types/loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"PlaylistContextType",function(){return Z}),D.d(Q,"PlaylistLevelType",function(){return B});var Z;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var B;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"ChunkMetadata",function(){return Z});var Z=function(G,j,I,k,v,T){k===void 0&&(k=0),v===void 0&&(v=-1),T===void 0&&(T=!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=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=G,this.sn=j,this.id=I,this.size=k,this.part=v,this.partial=T};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"AttrList",function(){return P});var Z=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function G(I){typeof I=="string"&&(I=G.parseAttrList(I));for(var k in I)I.hasOwnProperty(k)&&(this[k]=I[k])}var j=G.prototype;return j.decimalInteger=function(k){var v=parseInt(this[k],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},j.hexadecimalInteger=function(k){if(this[k]){var v=(this[k]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var T=new Uint8Array(v.length/2),R=0;R<v.length/2;R++)T[R]=parseInt(v.slice(R*2,R*2+2),16);return T}else return null},j.hexadecimalIntegerAsNumber=function(k){var v=parseInt(this[k],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},j.decimalFloatingPoint=function(k){return parseFloat(this[k])},j.optionalFloat=function(k,v){var T=this[k];return T?parseFloat(T):v},j.enumeratedString=function(k){return this[k]},j.bool=function(k){return this[k]==="YES"},j.decimalResolution=function(k){var v=Z.exec(this[k]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},G.parseAttrList=function(k){var v,T={},R='"';for(B.lastIndex=0;(v=B.exec(k))!==null;){var _=v[2];_.indexOf(R)===0&&_.lastIndexOf(R)===_.length-1&&(_=_.slice(1,-1)),T[v[1]]=_}return T},G}()},"./src/utils/binary-search.ts":function(le,Q,D){"use strict";D.r(Q);var Z={search:function(P,G){for(var j=0,I=P.length-1,k=null,v=null;j<=I;){k=(j+I)/2|0,v=P[k];var T=G(v);if(T>0)j=k+1;else if(T<0)I=k-1;else return v}return null}};Q.default=Z},"./src/utils/buffer-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"BufferHelper",function(){return P});var Z=D("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function G(){}return G.isBuffered=function(I,k){try{if(I){for(var v=G.getBuffered(I),T=0;T<v.length;T++)if(k>=v.start(T)&&k<=v.end(T))return!0}}catch(R){}return!1},G.bufferInfo=function(I,k,v){try{if(I){var T=G.getBuffered(I),R=[],_;for(_=0;_<T.length;_++)R.push({start:T.start(_),end:T.end(_)});return this.bufferedInfo(R,k,v)}}catch(w){}return{len:0,start:k,end:k,nextStart:void 0}},G.bufferedInfo=function(I,k,v){k=Math.max(0,k),I.sort(function(f,L){var b=f.start-L.start;return b||L.end-f.end});var T=[];if(v)for(var R=0;R<I.length;R++){var _=T.length;if(_){var w=T[_-1].end;I[R].start-w<v?I[R].end>w&&(T[_-1].end=I[R].end):T.push(I[R])}else T.push(I[R])}else T=I;for(var S=0,h,o=k,l=k,u=0;u<T.length;u++){var A=T[u].start,p=T[u].end;if(k+v>=A&&k<p)o=A,l=p,S=l-k;else if(k+v<A){h=A;break}}return{len:S,start:o||0,end:l||0,nextStart:h}},G.getBuffered=function(I){try{return I.buffered}catch(k){return Z.logger.log("failed to get media.buffered",k),B}},G}()},"./src/utils/cea-608-parser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"Row",function(){return l}),D.d(Q,"CaptionScreen",function(){return u});var Z=D("./src/utils/logger.ts"),B={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},P=function(c){var d=c;return B.hasOwnProperty(c)&&(d=B[c]),String.fromCharCode(d)},G=15,j=100,I={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},k={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(_||(_={}));var w=function(){function m(){this.time=null,this.verboseLevel=_.ERROR}var c=m.prototype;return c.log=function(a,x){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+x)},m}(),S=function(c){for(var d=[],a=0;a<c.length;a++)d.push(c[a].toString(16));return d},h=function(){function m(d,a,x,y,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=x||!1,this.background=y||"black",this.flash=E||!1}var c=m.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],y=0;y<x.length;y++){var E=x[y];a.hasOwnProperty(E)&&(this[E]=a[E])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),o=function(){function m(d,a,x,y,E,N){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new h(a,x,y,E,N)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),l=function(){function m(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<j;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new h}var c=m.prototype;return c.equals=function(a){for(var x=!0,y=0;y<j;y++)if(!this.chars[y].equals(a.chars[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<j;x++)this.chars[x].copy(a.chars[x])},c.isEmpty=function(){for(var a=!0,x=0;x<j;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(_.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>j&&(this.logger.log(_.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var y=this.pos+1;y<x+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var x=P(a);if(this.pos>=j){this.logger.log(_.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x<j;x++)this.chars[x].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],x=!0,y=0;y<j;y++){var E=this.chars[y].uchar;E!==" "&&(x=!1),a.push(E)}return x?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},m}(),u=function(){function m(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<G;a++)this.rows.push(new l(d));this.logger=d,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},c.equals=function(a){for(var x=!0,y=0;y<G;y++)if(!this.rows[y].equals(a.rows[y])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<G;x++)this.rows[x].copy(a.rows[x])},c.isEmpty=function(){for(var a=!0,x=0;x<G;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},c.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},c.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},c.setCursor=function(a){this.logger.log(_.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},c.setPAC=function(a){this.logger.log(_.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var y=0;y<G;y++)this.rows[y].clear();var E=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var U=N.rows[E].cueStartTime,K=this.logger.time;if(U&&K!==null&&U<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[x-this.nrRollUpRows+V+1].copy(N.rows[E+V])}}this.currRow=x;var O=this.rows[this.currRow];if(a.indent!==null){var M=a.indent,$=Math.max(M-1,0);O.setCursor(a.indent),a.color=O.chars[$].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},c.setBkgData=function(a){this.logger.log(_.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(_.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(_.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(_.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var x=[],y="",E=-1,N=0;N<G;N++){var U=this.rows[N].getTextString();U&&(E=N+1,a?x.push("Row "+E+": '"+U+"'"):x.push(U.trim()))}return x.length>0&&(a?y="["+x.join(" | ")+"]":y=x.join(`
`)),y},c.getTextAndFormat=function(){return this.rows},m}(),A=function(){function m(d,a,x){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=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(x),this.nonDisplayedMemory=new u(x),this.lastOutputScreen=new u(x),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=m.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[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(_.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(_.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(_.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(_.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(_.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(_.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(_.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(_.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(_.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(_.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(_.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(_.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(_.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(_.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(_.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(_.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var y=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=E[y]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},m}(),p=function(){function m(d,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new w;this.channels=[null,new A(d,a,y),new A(d+1,x,y)],this.cmdHistory=b(),this.logger=y}var c=m.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var y,E,N,U=!1;this.logger.time=a;for(var K=0;K<x.length;K+=2){if(E=x[K]&127,N=x[K+1]&127,E===0&&N===0)continue;if(this.logger.log(_.DATA,"["+S([x[K],x[K+1]])+"] -> ("+S([E,N])+")"),y=this.parseCmd(E,N),y||(y=this.parseMidrow(E,N)),y||(y=this.parsePAC(E,N)),y||(y=this.parseBackgroundAttributes(E,N)),!y&&(U=this.parseChars(E,N),U)){var V=this.currentChannel;if(V&&V>0){var O=this.channels[V];O.insertChars(U)}else this.logger.log(_.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!U&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+S([E,N])+" orig: "+S([x[K],x[K+1]]))}},c.parseCmd=function(a,x){var y=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,N=(a===23||a===31)&&x>=33&&x<=35;if(!(E||N))return!1;if(L(a,x,y))return f(null,null,y),this.logger.log(_.DEBUG,"Repeated command ("+S([a,x])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,K=this.channels[U];return a===20||a===21||a===28||a===29?x===32?K.ccRCL():x===33?K.ccBS():x===34?K.ccAOF():x===35?K.ccAON():x===36?K.ccDER():x===37?K.ccRU(2):x===38?K.ccRU(3):x===39?K.ccRU(4):x===40?K.ccFON():x===41?K.ccRDC():x===42?K.ccTR():x===43?K.ccRTD():x===44?K.ccEDM():x===45?K.ccCR():x===46?K.ccENM():x===47&&K.ccEOC():K.ccTO(x-32),f(a,x,y),this.currentChannel=U,!0},c.parseMidrow=function(a,x){var y=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[y];return E?(E.ccMIDROW(x),this.logger.log(_.DEBUG,"MIDROW ("+S([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var y,E=this.cmdHistory,N=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,U=(a===16||a===24)&&x>=64&&x<=95;if(!(N||U))return!1;if(L(a,x,E))return f(null,null,E),!0;var K=a<=23?1:2;x>=64&&x<=95?y=K===1?I[a]:v[a]:y=K===1?k[a]:T[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(y,x)),f(a,x,E),this.currentChannel=K,!0):!1},c.interpretPAC=function(a,x){var y,E={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?y=x-96:y=x-64,E.underline=(y&1)===1,y<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((y-16)/2)*4,E},c.parseChars=function(a,x){var y,E=null,N=null;if(a>=25?(y=2,N=a-8):(y=1,N=a),N>=17&&N<=19){var U;N===17?U=x+80:N===18?U=x+112:U=x+144,this.logger.log(_.INFO,"Special char '"+P(U)+"' in channel "+y),E=[U]}else a>=32&&a<=127&&(E=x===0?[a]:[a,x]);if(E){var K=S(E);this.logger.log(_.DEBUG,"Char codes = "+K.join(",")),f(a,x,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,x){var y=(a===16||a===24)&&x>=32&&x<=47,E=(a===23||a===31)&&x>=45&&x<=47;if(!(y||E))return!1;var N,U={};a===16||a===24?(N=Math.floor((x-32)/2),U.background=R[N],x%2===1&&(U.background=U.background+"_semi")):x===45?U.background="transparent":(U.foreground="black",x===47&&(U.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(U),f(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=b()},c.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var y=this.channels[x];y&&y.cueSplitAtTime(a)}},m}();function f(m,c,d){d.a=m,d.b=c}function L(m,c,d){return d.a===m&&d.b===c}function b(){return{a:null,b:null}}Q.default=p},"./src/utils/codecs.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"isCodecType",function(){return B}),D.d(Q,"isCodecSupportedInMp4",function(){return P});var Z={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 B(G,j){var I=Z[j];return!!I&&I[G.slice(0,4)]===!0}function P(G,j){return MediaSource.isTypeSupported((j||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/vttparser.ts"),B=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),G=/\s/,j={newCue:function(k,v,T,R){for(var _=[],w,S,h,o,l,u=self.VTTCue||self.TextTrackCue,A=0;A<R.rows.length;A++)if(w=R.rows[A],h=!0,o=0,l="",!w.isEmpty()){for(var p=0;p<w.chars.length;p++)G.test(w.chars[p].uchar)&&h?o++:(l+=w.chars[p].uchar,h=!1);w.cueStartTime=v,v===T&&(T+=1e-4),o>=16?o--:o++;var f=Object(Z.fixLineBreaks)(l.trim()),L=Object(B.generateCueId)(v,T,f);(!k||!k.cues||!k.cues.getCueById(L))&&(S=new u(v,T,f),S.id=L,S.line=A+1,S.align="left",S.position=10+Math.min(80,Math.floor(o*8/32)*10),_.push(S))}return k&&_.length&&(_.sort(function(b,m){return b.line==="auto"||m.line==="auto"?0:b.line>8&&m.line>8?m.line-b.line:b.line-m.line}),_.forEach(function(b){return Object(P.addCueToTrack)(k,b)})),_}};Q.default=j},"./src/utils/discontinuities.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"findFirstFragWithCC",function(){return G}),D.d(Q,"shouldAlignOnDiscontinuities",function(){return j}),D.d(Q,"findDiscontinuousReferenceFrag",function(){return I}),D.d(Q,"adjustSlidingStart",function(){return v}),D.d(Q,"alignStream",function(){return T}),D.d(Q,"alignPDT",function(){return _}),D.d(Q,"alignFragmentByPDTDelta",function(){return w}),D.d(Q,"alignMediaPlaylistByPDT",function(){return S});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function G(h,o){for(var l=null,u=0,A=h.length;u<A;u++){var p=h[u];if(p&&p.cc===o){l=p;break}}return l}function j(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function I(h,o){var l=h.fragments,u=o.fragments;if(!u.length||!l.length){B.logger.log("No fragments to align");return}var A=G(l,u[0].cc);if(!A||A&&!A.startPTS){B.logger.log("No frag in previous level to align on");return}return A}function k(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function v(h,o){for(var l=o.fragments,u=0,A=l.length;u<A;u++)k(l[u],h);o.fragmentHint&&k(o.fragmentHint,h),o.alignedSliding=!0}function T(h,o,l){if(!o)return;R(h,l,o),!l.alignedSliding&&o.details&&_(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(P.adjustSliding)(o.details,l)}function R(h,o,l){if(j(h,l,o)){var u=I(l.details,o);u&&Object(Z.isFiniteNumber)(u.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),v(u.start,o))}}function _(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=h.fragments[0].programDateTime,A=(u-l)/1e3+o.fragments[0].start;A&&Object(Z.isFiniteNumber)(A)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+A.toFixed(3)+" "+h.url+" "),v(A,h))}function w(h,o){var l=h.programDateTime;if(!l)return;var u=(l-o)/1e3;h.start=h.startPTS=u,h.endPTS=u+h.duration}function S(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=o.fragments[0].start,A=l-u*1e3;h.fragments.forEach(function(p){w(p,A)}),h.fragmentHint&&w(h.fragmentHint,A),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/ewma.ts"),B=function(){function P(j,I,k){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=k,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(j),this.fast_=new Z.default(I)}var G=P.prototype;return G.update=function(I,k){var v=this.slow_,T=this.fast_;this.slow_.halfLife!==I&&(this.slow_=new Z.default(I,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==k&&(this.fast_=new Z.default(k,T.getEstimate(),T.getTotalWeight()))},G.sample=function(I,k){I=Math.max(I,this.minDelayMs_);var v=8*k,T=I/1e3,R=v/T;this.fast_.sample(T,R),this.slow_.sample(T,R)},G.canEstimate=function(){var I=this.fast_;return I&&I.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},P}();Q.default=B},"./src/utils/ewma.ts":function(le,Q,D){"use strict";D.r(Q);var Z=function(){function B(G,j,I){j===void 0&&(j=0),I===void 0&&(I=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=j,this.totalWeight_=I}var P=B.prototype;return P.sample=function(j,I){var k=Math.pow(this.alpha_,j);this.estimate_=I*(1-k)+k*this.estimate_,this.totalWeight_+=j},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},B}();Q.default=Z},"./src/utils/fetch-loader.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"fetchSupported",function(){return w});var Z=D("./src/polyfills/number.ts"),B=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function G(u,A){u.prototype=Object.create(A.prototype),u.prototype.constructor=u,T(u,A)}function j(u){var A=typeof Map=="function"?new Map:void 0;return j=function(f){if(f===null||!v(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof A!="undefined"){if(A.has(f))return A.get(f);A.set(f,L)}function L(){return I(f,arguments,R(this).constructor)}return L.prototype=Object.create(f.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),T(L,f)},j(u)}function I(u,A,p){return k()?I=Reflect.construct:I=function(L,b,m){var c=[null];c.push.apply(c,b);var d=Function.bind.apply(L,c),a=new d;return m&&T(a,m.prototype),a},I.apply(null,arguments)}function k(){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(u){return!1}}function v(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function T(u,A){return T=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},T(u,A)}function R(u){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},R(u)}function _(){return _=Object.assign||function(u){for(var A=1;A<arguments.length;A++){var p=arguments[A];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(u[f]=p[f])}return u},_.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var S=function(){function u(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||o,this.controller=new self.AbortController,this.stats=new B.LoadStats}var A=u.prototype;return A.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},A.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},A.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},A.load=function(f,L,b){var m=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var d=h(f,this.controller.signal),a=b.onProgress,x=f.responseType==="arraybuffer",y=x?"byteLength":"length";this.context=f,this.config=L,this.callbacks=b,this.request=this.fetchSetup(f,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),b.onTimeout(c,f,m.response)},L.timeout),self.fetch(this.request).then(function(E){if(m.response=m.loader=E,!E.ok){var N=E.status,U=E.statusText;throw new l(U||"fetch, bad network response",N,E)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(L.highWaterMark)?m.loadProgressively(E,c,f,L.highWaterMark,a):x?E.arrayBuffer():E.text()}).then(function(E){var N=m.response;self.clearTimeout(m.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=E[y];var U={url:N.url,data:E};a&&!Object(Z.isFiniteNumber)(L.highWaterMark)&&a(c,f,E,N),b.onSuccess(U,c,f,N)}).catch(function(E){if(self.clearTimeout(m.requestTimeout),c.aborted)return;var N=E.code||0;b.onError({code:N,text:E.message},f,E.details)})},A.getCacheAge=function(){var f=null;if(this.response){var L=this.response.headers.get("age");f=L?parseFloat(L):null}return f},A.loadProgressively=function(f,L,b,m,c){m===void 0&&(m=0);var d=new P.default,a=f.body.getReader(),x=function y(){return a.read().then(function(E){if(E.done)return d.dataLength&&c(L,b,d.flush(),f),Promise.resolve(new ArrayBuffer(0));var N=E.value,U=N.length;return L.loaded+=U,U<m||d.dataLength?(d.push(N),d.dataLength>=m&&c(L,b,d.flush(),f)):c(L,b,N,f),y()}).catch(function(){return Promise.reject()})};return x()},u}();function h(u,A){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:A,headers:new self.Headers(_({},u.headers))};return u.rangeEnd&&p.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),p}function o(u,A){return new self.Request(u.url,A)}var l=function(u){G(A,u);function A(p,f,L){var b;return b=u.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=L,b}return A}(j(Error));Q.default=S},"./src/utils/imsc1-ttml-parser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"IMSC1_CODEC",function(){return v}),D.d(Q,"parseIMSC1",function(){return w});var Z=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),G=D("./src/demux/id3.ts"),j=D("./src/utils/timescale-conversion.ts"),I=D("./src/utils/webvtt-parser.ts");function k(){return k=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var d=arguments[c];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(m[a]=d[a])}return m},k.apply(this,arguments)}var v="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(m,c,d,a,x){var y=Object(Z.findBox)(new Uint8Array(m),["mdat"]);if(y.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var E=y[0],N=Object(G.utf8ArrayToStr)(new Uint8Array(m,E.start,E.end-E.start)),U=Object(j.toTimescaleFromScale)(c,1,d);try{a(S(N,U))}catch(K){x(K)}}function S(m,c){var d=new DOMParser,a=d.parseFromString(m,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(y).reduce(function(O,M){return O[M]=x.getAttribute("ttp:"+M)||y[M],O},{}),N=x.getAttribute("xml:space")!=="preserve",U=o(h(x,"styling","style")),K=o(h(x,"layout","region")),V=h(x,"body","[begin]");return[].map.call(V,function(O){var M=l(O,N);if(!M||!O.hasAttribute("begin"))return null;var $=f(O.getAttribute("begin"),E),ee=f(O.getAttribute("dur"),E),oe=f(O.getAttribute("end"),E);if($===null)throw p(O);if(oe===null){if(ee===null)throw p(O);oe=$+ee}var fe=new P.default($-c,oe-c,M);fe.id=Object(I.generateCueId)(fe.startTime,fe.endTime,fe.text);var Re=K[O.getAttribute("region")],Ee=U[O.getAttribute("style")];fe.position=10,fe.size=80;var Ce=u(Re,Ee),we=Ce.textAlign;if(we){var Te=_[we];Te&&(fe.lineAlign=Te),fe.align=we}return k(fe,Ce),fe}).filter(function(O){return O!==null})}function h(m,c,d){var a=m.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(m){return m.reduce(function(c,d){var a=d.getAttribute("xml:id");return a&&(c[a]=d),c},{})}function l(m,c){return[].slice.call(m.childNodes).reduce(function(d,a,x){var y;return a.nodeName==="br"&&x?d+`
`:(y=a.childNodes)!==null&&y!==void 0&&y.length?l(a,c):c?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function u(m,c){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,y){var E=A(c,d,y)||A(m,d,y);return E&&(x[y]=E),x},{})}function A(m,c,d){return m.hasAttributeNS(c,d)?m.getAttributeNS(c,d):null}function p(m){return new Error("Could not parse ttml timestamp "+m)}function f(m,c){if(!m)return null;var d=Object(B.parseTimeStamp)(m);return d===null&&(T.test(m)?d=L(m,c):R.test(m)&&(d=b(m,c))),d}function L(m,c){var d=T.exec(m),a=(d[4]|0)+(d[5]|0)/c.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/c.frameRate}function b(m,c){var d=R.exec(m),a=Number(d[1]),x=d[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"enableLogs",function(){return I}),D.d(Q,"logger",function(){return k});var Z=function(){},B={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},P=B;function G(v){var T=self.console[v];return T?T.bind(self.console,"["+v+"] >"):Z}function j(v){for(var T=arguments.length,R=new Array(T>1?T-1:0),_=1;_<T;_++)R[_-1]=arguments[_];R.forEach(function(w){P[w]=v[w]?v[w].bind(v):G(w)})}function I(v){if(self.console&&v===!0||typeof v=="object"){j(v,"debug","log","info","warn","error");try{P.log()}catch(T){P=B}}else P=B}var k=P},"./src/utils/mediakeys-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"KeySystems",function(){return Z}),D.d(Q,"requestMediaKeySystemAccess",function(){return B});var Z;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"bin2str",function(){return j}),D.d(Q,"readUint16",function(){return I}),D.d(Q,"readUint32",function(){return k}),D.d(Q,"writeUint32",function(){return v}),D.d(Q,"findBox",function(){return T}),D.d(Q,"parseSegmentIndex",function(){return R}),D.d(Q,"parseInitSegment",function(){return _}),D.d(Q,"getStartDTS",function(){return w}),D.d(Q,"getDuration",function(){return S}),D.d(Q,"computeRawDurationFromSamples",function(){return h}),D.d(Q,"offsetStartDTS",function(){return o}),D.d(Q,"segmentValidRange",function(){return l}),D.d(Q,"appendUint8Array",function(){return u});var Z=D("./src/utils/typed-array.ts"),B=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,G=[].push;function j(A){return String.fromCharCode.apply(null,A)}function I(A,p){"data"in A&&(p+=A.start,A=A.data);var f=A[p]<<8|A[p+1];return f<0?65536+f:f}function k(A,p){"data"in A&&(p+=A.start,A=A.data);var f=A[p]<<24|A[p+1]<<16|A[p+2]<<8|A[p+3];return f<0?4294967296+f:f}function v(A,p,f){"data"in A&&(p+=A.start,A=A.data),A[p]=f>>24,A[p+1]=f>>16&255,A[p+2]=f>>8&255,A[p+3]=f&255}function T(A,p){var f=[];if(!p.length)return f;var L,b,m;"data"in A?(L=A.data,b=A.start,m=A.end):(L=A,b=0,m=L.byteLength);for(var c=b;c<m;){var d=k(L,c),a=j(L.subarray(c+4,c+8)),x=d>1?c+d:m;if(a===p[0])if(p.length===1)f.push({data:L,start:c+8,end:x});else{var y=T({data:L,start:c+8,end:x},p.slice(1));y.length&&G.apply(f,y)}c=x}return f}function R(A){var p=T(A,["moov"]),f=p[0],L=f?f.end:null,b=T(A,["sidx"]);if(!b||!b[0])return null;var m=[],c=b[0],d=c.data[0],a=d===0?8:16,x=k(c,a);a+=4;var y=0,E=0;d===0?a+=8:a+=16,a+=2;var N=c.end+E,U=I(c,a);a+=2;for(var K=0;K<U;K++){var V=a,O=k(c,V);V+=4;var M=O&2147483647,$=(O&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=k(c,V);V+=4,m.push({referenceSize:M,subsegmentDuration:ee,info:{duration:ee/x,start:N,end:N+M-1}}),N+=M,V+=4,a=V}return{earliestPresentationTime:y,timescale:x,version:d,referencesCount:U,references:m,moovEndOffset:L}}function _(A){for(var p=[],f=T(A,["moov","trak"]),L=0;L<f.length;L++){var b=f[L],m=T(b,["tkhd"])[0];if(m){var c=m.data[m.start],d=c===0?12:20,a=k(m,d),x=T(b,["mdia","mdhd"])[0];if(x){c=x.data[x.start],d=c===0?12:20;var y=k(x,d),E=T(b,["mdia","hdlr"])[0];if(E){var N=j(E.data.subarray(E.start+8,E.start+12)),U={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[N];if(U){var K=T(b,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=j(K.data.subarray(K.start+12,K.start+16))),p[a]={timescale:y,type:U},p[U]={timescale:y,id:a,codec:V}}}}}}var O=T(A,["moov","mvex","trex"]);return O.forEach(function(M){var $=k(M,4),ee=p[$];ee&&(ee.default={duration:k(M,12),flags:k(M,20)})}),p}function w(A,p){return T(p,["moof","traf"]).reduce(function(f,L){var b=T(L,["tfdt"])[0],m=b.data[b.start],c=T(L,["tfhd"]).reduce(function(d,a){var x=k(a,4),y=A[x];if(y){var E=k(b,4);m===1&&(E*=Math.pow(2,32),E+=k(b,8));var N=y.timescale||9e4,U=E/N;if(isFinite(U)&&(d===null||U<d))return U}return d},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function S(A,p){for(var f=0,L=0,b=0,m=T(A,["moof","traf"]),c=0;c<m.length;c++){var d=m[c],a=T(d,["tfhd"])[0],x=k(a,4),y=p[x];if(!y)continue;var E=y.default,N=k(a,0)|(E==null?void 0:E.flags),U=E==null?void 0:E.duration;N&8&&(N&2?U=k(a,12):U=k(a,8));for(var K=y.timescale||9e4,V=T(d,["trun"]),O=0;O<V.length;O++){if(U){var M=k(V[O],4);f=U*M}else f=h(V[O]);y.type===B.ElementaryStreamTypes.VIDEO?L+=f/K:y.type===B.ElementaryStreamTypes.AUDIO&&(b+=f/K)}}if(L===0&&b===0){var $=R(A);if($!=null&&$.references)return $.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return L||b}function h(A){var p=k(A,0),f=8;p&1&&(f+=4),p&4&&(f+=4);for(var L=0,b=k(A,4),m=0;m<b;m++){if(p&256){var c=k(A,f);L+=c,f+=4}p&512&&(f+=4),p&1024&&(f+=4),p&2048&&(f+=4)}return L}function o(A,p,f){T(p,["moof","traf"]).forEach(function(L){T(L,["tfhd"]).forEach(function(b){var m=k(b,4),c=A[m];if(!c)return;var d=c.timescale||9e4;T(L,["tfdt"]).forEach(function(a){var x=a.data[a.start],y=k(a,4);if(x===0)v(a,4,y-f*d);else{y*=Math.pow(2,32),y+=k(a,8),y-=f*d,y=Math.max(y,0);var E=Math.floor(y/(P+1)),N=Math.floor(y%(P+1));v(a,4,E),v(a,8,N)}})})})}function l(A){var p={valid:null,remainder:null},f=T(A,["moof"]);if(f){if(f.length<2)return p.remainder=A,p}else return p;var L=f[f.length-1];return p.valid=Object(Z.sliceUint8)(A,0,L.start-8),p.remainder=Object(Z.sliceUint8)(A,L.start-8),p}function u(A,p){var f=new Uint8Array(A.length+p.length);return f.set(A),f.set(p,A.length),f}},"./src/utils/output-filter.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"default",function(){return Z});var Z=function(){function B(G,j){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=j}var P=B.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(j,I,k){(this.startTime===null||this.startTime>j)&&(this.startTime=j),this.endTime=I,this.screen=k,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"sendAddTrackEvent",function(){return B}),D.d(Q,"addCueToTrack",function(){return P}),D.d(Q,"clearCurrentCues",function(){return G}),D.d(Q,"removeCuesInRange",function(){return j}),D.d(Q,"getCuesInRange",function(){return k});var Z=D("./src/utils/logger.ts");function B(v,T){var R;try{R=new Event("addtrack")}catch(_){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=v,T.dispatchEvent(R)}function P(v,T){var R=v.mode;if(R==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(T.id))try{if(v.addCue(T),!v.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(w){Z.logger.debug("[texttrack-utils]: "+w);var _=new self.TextTrackCue(T.startTime,T.endTime,T.text);_.id=T.id,v.addCue(_)}R==="disabled"&&(v.mode=R)}function G(v){var T=v.mode;if(T==="disabled"&&(v.mode="hidden"),v.cues)for(var R=v.cues.length;R--;)v.removeCue(v.cues[R]);T==="disabled"&&(v.mode=T)}function j(v,T,R){var _=v.mode;if(_==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var w=k(v.cues,T,R),S=0;S<w.length;S++)v.removeCue(w[S]);_==="disabled"&&(v.mode=_)}function I(v,T){if(T<v[0].startTime)return 0;var R=v.length-1;if(T>v[R].endTime)return-1;for(var _=0,w=R;_<=w;){var S=Math.floor((w+_)/2);if(T<v[S].startTime)w=S-1;else if(T>v[S].startTime&&_<R)_=S+1;else return S}return v[_].startTime-T<T-v[w].startTime?_:w}function k(v,T,R){var _=[],w=I(v,T);if(w>-1)for(var S=w,h=v.length;S<h;S++){var o=v[S];if(o.startTime>=T&&o.endTime<=R)_.push(o);else if(o.startTime>R)return _}return _}},"./src/utils/time-ranges.ts":function(le,Q,D){"use strict";D.r(Q);var Z={toString:function(P){for(var G="",j=P.length,I=0;I<j;I++)G+="["+P.start(I).toFixed(3)+","+P.end(I).toFixed(3)+"]";return G}};Q.default=Z},"./src/utils/timescale-conversion.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"toTimescaleFromBase",function(){return B}),D.d(Q,"toTimescaleFromScale",function(){return P}),D.d(Q,"toMsFromMpegTsClock",function(){return G}),D.d(Q,"toMpegTsClockFromTimescale",function(){return j});var Z=9e4;function B(I,k,v,T){v===void 0&&(v=1),T===void 0&&(T=!1);var R=I*k*v;return T?Math.round(R):R}function P(I,k,v,T){return v===void 0&&(v=1),T===void 0&&(T=!1),B(I,k,1/v,T)}function G(I,k){return k===void 0&&(k=!1),B(I,1e3,1/Z,k)}function j(I,k){return k===void 0&&(k=1),B(I,Z,1/k)}},"./src/utils/typed-array.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"sliceUint8",function(){return Z});function Z(B,P,G){return Uint8Array.prototype.slice?B.slice(P,G):new Uint8Array(Array.prototype.slice.call(B,P,G))}},"./src/utils/vttcue.ts":function(le,Q,D){"use strict";D.r(Q),Q.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],B=["start","middle","end","left","right"];function P(v,T){if(typeof T!="string")return!1;if(!Array.isArray(v))return!1;var R=T.toLowerCase();return~v.indexOf(R)?R:!1}function G(v){return P(Z,v)}function j(v){return P(B,v)}function I(v){for(var T=arguments.length,R=new Array(T>1?T-1:0),_=1;_<T;_++)R[_-1]=arguments[_];for(var w=1;w<arguments.length;w++){var S=arguments[w];for(var h in S)v[h]=S[h]}return v}function k(v,T,R){var _=this,w={enumerable:!0};_.hasBeenReset=!1;var S="",h=!1,o=v,l=T,u=R,A=null,p="",f=!0,L="auto",b="start",m=50,c="middle",d=50,a="middle";Object.defineProperty(_,"id",I({},w,{get:function(){return S},set:function(y){S=""+y}})),Object.defineProperty(_,"pauseOnExit",I({},w,{get:function(){return h},set:function(y){h=!!y}})),Object.defineProperty(_,"startTime",I({},w,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",I({},w,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",I({},w,{get:function(){return u},set:function(y){u=""+y,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",I({},w,{get:function(){return A},set:function(y){A=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",I({},w,{get:function(){return p},set:function(y){var E=G(y);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",I({},w,{get:function(){return f},set:function(y){f=!!y,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",I({},w,{get:function(){return L},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",I({},w,{get:function(){return b},set:function(y){var E=j(y);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");b=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",I({},w,{get:function(){return m},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");m=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",I({},w,{get:function(){return c},set:function(y){var E=j(y);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",I({},w,{get:function(){return d},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");d=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",I({},w,{get:function(){return a},set:function(y){var E=j(y);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),_.displayState=void 0}return k.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},k}()},"./src/utils/vttparser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"parseTimeStamp",function(){return P}),D.d(Q,"fixLineBreaks",function(){return T}),D.d(Q,"VTTParser",function(){return R});var Z=D("./src/utils/vttcue.ts"),B=function(){function _(){}var w=_.prototype;return w.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},_}();function P(_){function w(h,o,l,u){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var S=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return S?parseFloat(S[2])>59?w(S[2],S[3],0,S[4]):w(S[1],S[2],S[3],S[4]):null}var G=function(){function _(){this.values=Object.create(null)}var w=_.prototype;return w.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},w.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},w.has=function(h){return h in this.values},w.alt=function(h,o,l){for(var u=0;u<l.length;++u)if(o===l[u]){this.set(h,o);break}},w.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},w.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},_}();function j(_,w,S,h){var o=h?_.split(h):[_];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(S);if(u.length!==2)continue;var A=u[0],p=u[1];w(A,p)}}var I=new Z.default(0,0,""),k=I.align==="middle"?"middle":"center";function v(_,w,S){var h=_;function o(){var A=P(_);if(A===null)throw new Error("Malformed timestamp: "+h);return _=_.replace(/^[^\sa-zA-Z-]+/,""),A}function l(A,p){var f=new G;j(A,function(m,c){var d;switch(m){case"region":for(var a=S.length-1;a>=0;a--)if(S[a].id===c){f.set(m,S[a].region);break}break;case"vertical":f.alt(m,c,["rl","lr"]);break;case"line":d=c.split(","),f.integer(m,d[0]),f.percent(m,d[0])&&f.set("snapToLines",!1),f.alt(m,d[0],["auto"]),d.length===2&&f.alt("lineAlign",d[1],["start",k,"end"]);break;case"position":d=c.split(","),f.percent(m,d[0]),d.length===2&&f.alt("positionAlign",d[1],["start",k,"end","line-left","line-right","auto"]);break;case"size":f.percent(m,c);break;case"align":f.alt(m,c,["start",k,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var L=f.get("line","auto");L==="auto"&&I.line===-1&&(L=-1),p.line=L,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",k);var b=f.get("position","auto");b==="auto"&&I.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function u(){_=_.replace(/^\s+/,"")}if(u(),w.startTime=o(),u(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);_=_.substr(3),u(),w.endTime=o(),u(),l(_,w)}function T(_){return _.replace(/<br(?: \/)?>/gi,`
`)}var R=function(){function _(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=_.prototype;return w.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function l(){var b=o.buffer,m=0;for(b=T(b);m<b.length&&b[m]!=="\r"&&b[m]!==`
`;)++m;var c=b.substr(0,m);return b[m]==="\r"&&++m,b[m]===`
`&&++m,o.buffer=b.substr(m),c}function u(b){j(b,function(m,c){},/:/)}try{var A="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;A=l();var p=A.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:A=l();switch(o.state){case"HEADER":/:/.test(A)?u(A):A||(o.state="ID");continue;case"NOTE":A||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(A)){o.state="NOTE";break}if(!A)continue;if(o.cue=new Z.default(0,0,""),o.state="CUE",A.indexOf("-->")===-1){o.cue.id=A;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{v(A,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=A.indexOf("-->")!==-1;if(!A||L&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=A}continue;case"BADCUE":A||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},_}()},"./src/utils/webvtt-parser.ts":function(le,Q,D){"use strict";D.r(Q),D.d(Q,"generateCueId",function(){return R}),D.d(Q,"parseWebVTT",function(){return w});var Z=D("./src/polyfills/number.ts"),B=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),G=D("./src/utils/timescale-conversion.ts"),j=D("./src/remux/mp4-remuxer.ts"),I=/\r\n|\n\r|\n|\r/g,k=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},v=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),u=parseInt(h.substr(-9,2)),A=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(o)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(u)||!Object(Z.isFiniteNumber)(A))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*A,o},T=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function R(S,h,o){return T(S.toString())+T(h.toString())+T(o)}var _=function(h,o,l){var u=h[o],A=h[u.prevCC];if(!A||!A.new&&u.new){h.ccOffset=h.presentationOffset=u.start,u.new=!1;return}for(;(p=A)!==null&&p!==void 0&&p.new;){var p;h.ccOffset+=u.start-A.start,u.new=!1,u=A,A=h[u.prevCC]}h.presentationOffset=l};function w(S,h,o,l,u,A,p,f){var L=new B.VTTParser,b=Object(P.utf8ArrayToStr)(new Uint8Array(S)).trim().replace(I,`
`).split(`
`),m=[],c=Object(G.toMpegTsClockFromTimescale)(h,o),d="00:00.000",a=0,x=0,y,E=!0,N=!1;L.oncue=function(U){var K=l[u],V=l.ccOffset,O=(a-c)/9e4;if(K!=null&&K.new&&(x!==void 0?V=l.ccOffset=K.start:_(l,u,O)),O&&(V=O-l.presentationOffset),N){var M=U.endTime-U.startTime,$=Object(j.normalizePts)((U.startTime+V-x)*9e4,A*9e4)/9e4;U.startTime=$,U.endTime=$+M}var ee=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(ee)),U.id||(U.id=R(U.startTime,U.endTime,ee)),U.endTime>0&&m.push(U)},L.onparsingerror=function(U){y=U},L.onflush=function(){if(y){f(y);return}p(m)},b.forEach(function(U){if(E)if(k(U,"X-TIMESTAMP-MAP=")){E=!1,N=!0,U.substr(16).split(",").forEach(function(K){k(K,"LOCAL:")?d=K.substr(6):k(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{x=v(d)/1e3}catch(K){N=!1,y=K}return}else U===""&&(E=!1);L.parse(U+`
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(le,Q,D){"use strict";D.r(Q);var Z=D("./src/utils/logger.ts"),B=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,G=function(){function j(k){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=k?k.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var I=j.prototype;return I.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},I.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},I.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},I.load=function(v,T,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=T,this.callbacks=R,this.retryDelay=T.retryDelay,this.loadInternal()},I.loadInternal=function(){var v=this.config,T=this.context;if(!v)return;var R=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var w=this.xhrSetup;try{if(w)try{w(R,T.url)}catch(o){R.open("GET",T.url,!0),w(R,T.url)}R.readyState||R.open("GET",T.url,!0);var S=this.context.headers;if(S)for(var h in S)R.setRequestHeader(h,S[h])}catch(o){this.callbacks.onError({code:R.status,text:o.message},T,R);return}T.rangeEnd&&R.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),R.send()},I.readystatechange=function(){var v=this.context,T=this.loader,R=this.stats;if(!v||!T)return;var _=T.readyState,w=this.config;if(R.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),_===4){T.onreadystatechange=null,T.onprogress=null;var S=T.status;if(S>=200&&S<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var h,o;if(v.responseType==="arraybuffer"?(h=T.response,o=h.byteLength):(h=T.responseText,o=h.length),R.loaded=R.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(R,v,h,T),!this.callbacks)return;var u={url:T.responseURL,data:h};this.callbacks.onSuccess(u,R,v,T)}else R.retry>=w.maxRetry||S>=400&&S<499?(Z.logger.error(S+" while loading "+v.url),this.callbacks.onError({code:S,text:T.statusText},v,T)):(Z.logger.warn(S+" while loading "+v.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,w.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},I.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},I.loadprogress=function(v){var T=this.stats;T.loaded=v.loaded,v.lengthComputable&&(T.total=v.total)},I.getCacheAge=function(){var v=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");v=T?parseFloat(T):null}return v},j}();Q.default=G}}).default})},vHTk:function(bt,qe,ie){bt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(bt,qe,ie){"use strict";ie.d(qe,"c",function(){return B}),ie.d(qe,"b",function(){return P}),ie.d(qe,"d",function(){return G}),ie.d(qe,"a",function(){return I}),ie.d(qe,"e",function(){return k});var le=ie("9og8"),Q=ie("WmNS"),D=ie.n(Q),Z=ie("ErOA");function B(v){return Object(Z.c)("libraries/".concat(v,".json"))}function P(){return Object(Z.c)("library_tags.json")}function G(v){return j.apply(this,arguments)}function j(){return j=Object(le.a)(D.a.mark(function v(T){var R;return D.a.wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,Object(Z.b)("attachments/".concat(T,".json"));case 2:return R=w.sent,w.abrupt("return",R.status===0);case 4:case"end":return w.stop()}},v)})),j.apply(this,arguments)}function I(v){return Object(Z.f)("libraries.json",v)}function k(v,T){return Object(Z.g)("libraries/".concat(v,".json"),T)}},y5JW:function(bt,qe,ie){"use strict";ie.d(qe,"c",function(){return S}),ie.d(qe,"a",function(){return h});var le=ie("DZo9"),Q=ie("8z0m"),D=ie("+L6B"),Z=ie("2/Rp"),B=ie("9og8"),P=ie("k1fw"),G=ie("oBTY"),j=ie("miYZ"),I=ie("tsqr"),k=ie("WmNS"),v=ie.n(k),T=ie("q1tI"),R=ie.n(T),_=ie("m3rI"),w=ie("wzkS"),S="\u3000\u3000";function h(o){var l=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,u)).toFixed(1)+" "+l[u]}qe.b=function(o){var l=o.value,u=l===void 0?[]:l,A=o.action,p=o.onChange,f=o.className,L=o.maxSize,b=L===void 0?150:L,m=o.title,c=m===void 0?"\u6587\u4EF6\u4E0A\u4F20":m,d=o.accept,a=d===void 0?null:d,x={multiple:!1,fileList:u,accept:a,withCredentials:!0,beforeUpload:function(N){var U=N.size/1024/1024;return U<b?!0:(I.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(_.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var U=Object(G.a)(N.fileList);U=U.map(function(K){return K.name.indexOf(S)===-1&&(K.name="".concat(K.name).concat(S).concat(h(K.size))),Object(P.a)({},K)}),p(U)},onRemove:function(){var E=Object(B.a)(v.a.mark(function U(K){var V,O,M;return v.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(V=K.size/1024/1024,!(K.status==="uploading")){ee.next=3;break}return ee.abrupt("return",!0);case 3:if(V<b){ee.next=7;break}return ee.abrupt("return",!0);case 7:if(O=K.response?K.response.id:K.uid,!O){ee.next=15;break}return ee.next=11,Object(w.d)(K.response?K.response.id:K.id);case 11:return M=ee.sent,ee.abrupt("return",M);case 15:return ee.abrupt("return",!0);case 16:case"end":return ee.stop()}},U)}));function N(U){return E.apply(this,arguments)}return N}()};function y(E){E.preventDefault(),E.stopPropagation()}return R.a.createElement("div",{className:"single-upload ".concat(f||"")},R.a.createElement(Q.a,x,R.a.createElement(Z.a,{type:"primary",title:u.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:u.length>0,ghost:!0},c),R.a.createElement("span",{onClick:y,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M) ")))}}}]);