(window.webpackJsonp=window.webpackJsonp||[]).push([[152,6,7],{"+NIl":function(wt,rt,T){(function(K){K(T("VrN/"))})(function(K){"use strict";K.defineMode("stex",function(Te,de){"use strict";function Pe(oe,Z){oe.cmdState.push(Z)}function _e(oe){return oe.cmdState.length>0?oe.cmdState[oe.cmdState.length-1]:null}function re(oe){var Z=oe.cmdState.pop();Z&&Z.closeBracket()}function j(oe){for(var Z=oe.cmdState,q=Z.length-1;q>=0;q--){var z=Z[q];if(z.name=="DEFAULT")continue;return z}return{styleIdentifier:function(){return null}}}function Q(oe,Z,q){return function(){this.name=oe,this.bracketNo=0,this.style=Z,this.styles=q,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var ie={};ie.importmodule=Q("importmodule","tag",["string","builtin"]),ie.documentclass=Q("documentclass","tag",["","atom"]),ie.usepackage=Q("usepackage","tag",["atom"]),ie.begin=Q("begin","tag",["atom"]),ie.end=Q("end","tag",["atom"]),ie.label=Q("label","tag",["atom"]),ie.ref=Q("ref","tag",["atom"]),ie.eqref=Q("eqref","tag",["atom"]),ie.cite=Q("cite","tag",["atom"]),ie.bibitem=Q("bibitem","tag",["atom"]),ie.Bibitem=Q("Bibitem","tag",["atom"]),ie.RBibitem=Q("RBibitem","tag",["atom"]),ie.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function V(oe,Z){oe.f=Z}function M(oe,Z){var q;if(oe.match(/^\\[a-zA-Z@]+/)){var z=oe.current().slice(1);return q=ie.hasOwnProperty(z)?ie[z]:ie.DEFAULT,q=new q,Pe(Z,q),V(Z,ve),q.style}if(oe.match(/^\\[$&%#{}_]/))return"tag";if(oe.match(/^\\[,;!\/\\]/))return"tag";if(oe.match("\\["))return V(Z,function(ue,He){return O(ue,He,"\\]")}),"keyword";if(oe.match("\\("))return V(Z,function(ue,He){return O(ue,He,"\\)")}),"keyword";if(oe.match("$$"))return V(Z,function(ue,He){return O(ue,He,"$$")}),"keyword";if(oe.match("$"))return V(Z,function(ue,He){return O(ue,He,"$")}),"keyword";var me=oe.next();if(me=="%")return oe.skipToEnd(),"comment";if(me=="}"||me=="]"){if(q=_e(Z),q)q.closeBracket(me),V(Z,ve);else return"error";return"bracket"}else return me=="{"||me=="["?(q=ie.DEFAULT,q=new q,Pe(Z,q),"bracket"):/\d/.test(me)?(oe.eatWhile(/[\w.%]/),"atom"):(oe.eatWhile(/[\w\-_]/),q=j(Z),q.name=="begin"&&(q.argument=oe.current()),q.styleIdentifier())}function O(oe,Z,q){if(oe.eatSpace())return null;if(q&&oe.match(q))return V(Z,M),"keyword";if(oe.match(/^\\[a-zA-Z@]+/))return"tag";if(oe.match(/^[a-zA-Z]+/))return"variable-2";if(oe.match(/^\\[$&%#{}_]/))return"tag";if(oe.match(/^\\[,;!\/]/))return"tag";if(oe.match(/^[\^_&]/))return"tag";if(oe.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(oe.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var z=oe.next();return z=="{"||z=="}"||z=="["||z=="]"||z=="("||z==")"?"bracket":z=="%"?(oe.skipToEnd(),"comment"):"error"}function ve(oe,Z){var q=oe.peek(),z;return q=="{"||q=="["?(z=_e(Z),z.openBracket(q),oe.eat(q),V(Z,M),"bracket"):/[ \t\r]/.test(q)?(oe.eat(q),null):(V(Z,M),re(Z),M(oe,Z))}return{startState:function(){var oe=de.inMathMode?function(Z,q){return O(Z,q)}:M;return{cmdState:[],f:oe}},copyState:function(oe){return{cmdState:oe.cmdState.slice(),f:oe.f}},token:function(oe,Z){return Z.f(oe,Z)},blankLine:function(oe){oe.f=M,oe.cmdState.length=0},lineComment:"%"}}),K.defineMIME("text/x-stex","stex"),K.defineMIME("text/x-latex","stex")})},"19Vz":function(wt,rt,T){(function(K){K(T("VrN/"))})(function(K){K.defineOption("placeholder","",function(Q,ie,V){var M=V&&V!=K.Init;if(ie&&!M)Q.on("blur",_e),Q.on("change",re),Q.on("swapDoc",re),K.on(Q.getInputField(),"compositionupdate",Q.state.placeholderCompose=function(){Pe(Q)}),re(Q);else if(!ie&&M){Q.off("blur",_e),Q.off("change",re),Q.off("swapDoc",re),K.off(Q.getInputField(),"compositionupdate",Q.state.placeholderCompose),Te(Q);var O=Q.getWrapperElement();O.className=O.className.replace(" CodeMirror-empty","")}ie&&!Q.hasFocus()&&_e(Q)});function Te(Q){Q.state.placeholder&&(Q.state.placeholder.parentNode.removeChild(Q.state.placeholder),Q.state.placeholder=null)}function de(Q){Te(Q);var ie=Q.state.placeholder=document.createElement("pre");ie.style.cssText="height: 0; overflow: visible",ie.style.direction=Q.getOption("direction"),ie.className="CodeMirror-placeholder CodeMirror-line-like";var V=Q.getOption("placeholder");typeof V=="string"&&(V=document.createTextNode(V)),ie.appendChild(V),Q.display.lineSpace.insertBefore(ie,Q.display.lineSpace.firstChild)}function Pe(Q){setTimeout(function(){var ie=!1,V=Q.getInputField();V.nodeName=="TEXTAREA"?ie=!V.value:Q.lineCount()==1&&(ie=!/[^\u200b]/.test(V.querySelector(".CodeMirror-line").textContent)),ie?de(Q):Te(Q)},20)}function _e(Q){j(Q)&&de(Q)}function re(Q){var ie=Q.getWrapperElement(),V=j(Q);ie.className=ie.className.replace(" CodeMirror-empty","")+(V?" CodeMirror-empty":""),V?de(Q):Te(Q)}function j(Q){return Q.lineCount()===1&&Q.getLine(0)===""}})},"1eCo":function(wt,rt,T){(function(K){K(T("VrN/"))})(function(K){"use strict";var Te={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},de={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};K.defineMode("xml",function(Pe,_e){var re=Pe.indentUnit,j={},Q=_e.htmlMode?Te:de;for(var ie in Q)j[ie]=Q[ie];for(var ie in _e)j[ie]=_e[ie];var V,M;function O(C,ae){function Y(F){return ae.tokenize=F,F(C,ae)}var A=C.next();if(A=="<")return C.eat("!")?C.eat("[")?C.match("CDATA[")?Y(Z("atom","]]>")):null:C.match("--")?Y(Z("comment","-->")):C.match("DOCTYPE",!0,!0)?(C.eatWhile(/[\w\._\-]/),Y(q(1))):null:C.eat("?")?(C.eatWhile(/[\w\._\-]/),ae.tokenize=Z("meta","?>"),"meta"):(V=C.eat("/")?"closeTag":"openTag",ae.tokenize=ve,"tag bracket");if(A=="&"){var se;return C.eat("#")?C.eat("x")?se=C.eatWhile(/[a-fA-F\d]/)&&C.eat(";"):se=C.eatWhile(/[\d]/)&&C.eat(";"):se=C.eatWhile(/[\w\.\-:]/)&&C.eat(";"),se?"atom":"error"}else return C.eatWhile(/[^&<]/),null}O.isInText=!0;function ve(C,ae){var Y=C.next();if(Y==">"||Y=="/"&&C.eat(">"))return ae.tokenize=O,V=Y==">"?"endTag":"selfcloseTag","tag bracket";if(Y=="=")return V="equals",null;if(Y=="<"){ae.tokenize=O,ae.state=He,ae.tagName=ae.tagStart=null;var A=ae.tokenize(C,ae);return A?A+" tag error":"tag error"}else return/[\'\"]/.test(Y)?(ae.tokenize=oe(Y),ae.stringStartCol=C.column(),ae.tokenize(C,ae)):(C.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function oe(C){var ae=function(Y,A){for(;!Y.eol();)if(Y.next()==C){A.tokenize=ve;break}return"string"};return ae.isInAttribute=!0,ae}function Z(C,ae){return function(Y,A){for(;!Y.eol();){if(Y.match(ae)){A.tokenize=O;break}Y.next()}return C}}function q(C){return function(ae,Y){for(var A;(A=ae.next())!=null;){if(A=="<")return Y.tokenize=q(C+1),Y.tokenize(ae,Y);if(A==">")if(C==1){Y.tokenize=O;break}else return Y.tokenize=q(C-1),Y.tokenize(ae,Y)}return"meta"}}function z(C,ae,Y){this.prev=C.context,this.tagName=ae,this.indent=C.indented,this.startOfLine=Y,(j.doNotIndent.hasOwnProperty(ae)||C.context&&C.context.noIndent)&&(this.noIndent=!0)}function me(C){C.context&&(C.context=C.context.prev)}function ue(C,ae){for(var Y;;){if(!C.context)return;if(Y=C.context.tagName,!j.contextGrabbers.hasOwnProperty(Y)||!j.contextGrabbers[Y].hasOwnProperty(ae))return;me(C)}}function He(C,ae,Y){return C=="openTag"?(Y.tagStart=ae.column(),$e):C=="closeTag"?we:He}function $e(C,ae,Y){return C=="word"?(Y.tagName=ae.current(),M="tag",fe):j.allowMissingTagName&&C=="endTag"?(M="tag bracket",fe(C,ae,Y)):(M="error",$e)}function we(C,ae,Y){if(C=="word"){var A=ae.current();return Y.context&&Y.context.tagName!=A&&j.implicitlyClosed.hasOwnProperty(Y.context.tagName)&&me(Y),Y.context&&Y.context.tagName==A||j.matchClosing===!1?(M="tag",be):(M="tag error",Ve)}else return j.allowMissingTagName&&C=="endTag"?(M="tag bracket",be(C,ae,Y)):(M="error",Ve)}function be(C,ae,Y){return C!="endTag"?(M="error",be):(me(Y),He)}function Ve(C,ae,Y){return M="error",be(C,ae,Y)}function fe(C,ae,Y){if(C=="word")return M="attribute",ke;if(C=="endTag"||C=="selfcloseTag"){var A=Y.tagName,se=Y.tagStart;return Y.tagName=Y.tagStart=null,C=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(A)?ue(Y,A):(ue(Y,A),Y.context=new z(Y,A,se==Y.indented)),He}return M="error",fe}function ke(C,ae,Y){return C=="equals"?Be:(j.allowMissing||(M="error"),fe(C,ae,Y))}function Be(C,ae,Y){return C=="string"?he:C=="word"&&j.allowUnquoted?(M="string",fe):(M="error",fe(C,ae,Y))}function he(C,ae,Y){return C=="string"?he:fe(C,ae,Y)}return{startState:function(C){var ae={tokenize:O,state:He,indented:C||0,tagName:null,tagStart:null,context:null};return C!=null&&(ae.baseIndent=C),ae},token:function(C,ae){if(!ae.tagName&&C.sol()&&(ae.indented=C.indentation()),C.eatSpace())return null;V=null;var Y=ae.tokenize(C,ae);return(Y||V)&&Y!="comment"&&(M=null,ae.state=ae.state(V||Y,C,ae),M&&(Y=M=="error"?Y+" error":M)),Y},indent:function(C,ae,Y){var A=C.context;if(C.tokenize.isInAttribute)return C.tagStart==C.indented?C.stringStartCol+1:C.indented+re;if(A&&A.noIndent)return K.Pass;if(C.tokenize!=ve&&C.tokenize!=O)return Y?Y.match(/^(\s*)/)[0].length:0;if(C.tagName)return j.multilineTagIndentPastTag!==!1?C.tagStart+C.tagName.length+2:C.tagStart+re*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/$/,blockCommentStart:"",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(C){C.state==Be&&(C.state=fe)},xmlCurrentTag:function(C){return C.tagName?{name:C.tagName,close:C.type=="closeTag"}:null},xmlCurrentContext:function(C){for(var ae=[],Y=C.context;Y;Y=Y.prev)Y.tagName&&ae.push(Y.tagName);return ae.reverse()}}}),K.defineMIME("text/xml","xml"),K.defineMIME("application/xml","xml"),K.mimeModes.hasOwnProperty("text/html")||K.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(wt,rt,T){"use strict";var K=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Te=new Uint8Array(16);function de(){if(!K)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return K(Te)}var Pe=/^(?:[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 _e(ve){return typeof ve=="string"&&Pe.test(ve)}for(var re=_e,j=[],Q=0;Q<256;++Q)j.push((Q+256).toString(16).substr(1));function ie(ve){var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Z=(j[ve[oe+0]]+j[ve[oe+1]]+j[ve[oe+2]]+j[ve[oe+3]]+"-"+j[ve[oe+4]]+j[ve[oe+5]]+"-"+j[ve[oe+6]]+j[ve[oe+7]]+"-"+j[ve[oe+8]]+j[ve[oe+9]]+"-"+j[ve[oe+10]]+j[ve[oe+11]]+j[ve[oe+12]]+j[ve[oe+13]]+j[ve[oe+14]]+j[ve[oe+15]]).toLowerCase();if(!re(Z))throw TypeError("Stringified UUID is invalid");return Z}var V=ie;function M(ve,oe,Z){ve=ve||{};var q=ve.random||(ve.rng||de)();if(q[6]=q[6]&15|64,q[8]=q[8]&63|128,oe){Z=Z||0;for(var z=0;z<16;++z)oe[Z+z]=q[z];return oe}return V(q)}var O=rt.a=M},"7ahc":function(wt,rt,T){"use strict";T.d(rt,"a",function(){return $e});var K=T("k1fw"),Te=T("0Owb"),de=T("+L6B"),Pe=T("2/Rp"),_e=T("y8nQ"),re=T("Vl3Y"),j=T("tJVT"),Q=T("OaEy"),ie=T("2fM7"),V=T("q1tI"),M=T.n(V),O=T("VrN/"),ve=T.n(O),oe=T("p77/"),Z=T.n(oe),q=T("c5Ni"),z=T.n(q),me=ie.a.Option,ue={labelCol:{span:4},wrapperCol:{span:20}},He={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"]};rt.b=function(we){var be=we.callback,Ve=we.onCancel,fe=Object(V.useState)("python"),ke=Object(j.a)(fe,2),Be=ke[0],he=ke[1];function C(Y){he(He[Y][1])}function ae(Y){be(Y)}return M.a.createElement(re.a,Object(Te.a)({},ue,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:ae}),M.a.createElement(re.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},M.a.createElement(ie.a,{onChange:C},Object.keys(He).map(function(Y){return M.a.createElement(me,{key:Y,value:Y},He[Y][0])}))),M.a.createElement(re.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},M.a.createElement($e,{mode:Be})),M.a.createElement("div",{className:"flex-container flex-end"},M.a.createElement(Pe.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),M.a.createElement(Pe.a,{type:"ghost",onClick:Ve},"\u53D6\u6D88")))};function $e(we){var be=we.value,Ve=we.onChange,fe=we.mode,ke=we.options,Be=ke===void 0?{}:ke,he=Object(V.useRef)(),C=Object(V.useState)(),ae=Object(j.a)(C,2),Y=ae[0],A=ae[1];return Object(V.useEffect)(function(){if(Y){function se(F){var N=F.getValue();Ve&&Ve(N)}return Y.on("change",se),function(){Y.off("change",se)}}},[Y,Ve]),Object(V.useEffect)(function(){Y&&Y.setOption("mode",fe)},[Y,fe]),Object(V.useEffect)(function(){Y&&((be!==Y.getValue()||be==="")&&setTimeout(function(){Y.setValue(be||" ")},300))},[Y,be]),Object(V.useEffect)(function(){if(he.current&&!Y){var se=ve.a.fromTextArea(he.current,Object(K.a)({mode:fe,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},Be));A(se)}},[he.current,Y]),M.a.createElement("div",{className:"my-codemirror-container"},M.a.createElement("textarea",{ref:he}))}},"7ixt":function(wt,rt,T){"use strict";T.d(rt,"a",function(){return de});var K={adjustX:1,adjustY:1},Te=[0,0],de={left:{points:["cr","cl"],overflow:K,offset:[-4,0],targetOffset:Te},right:{points:["cl","cr"],overflow:K,offset:[4,0],targetOffset:Te},top:{points:["bc","tc"],overflow:K,offset:[0,-4],targetOffset:Te},bottom:{points:["tc","bc"],overflow:K,offset:[0,4],targetOffset:Te},topLeft:{points:["bl","tl"],overflow:K,offset:[0,-4],targetOffset:Te},leftTop:{points:["tr","tl"],overflow:K,offset:[-4,0],targetOffset:Te},topRight:{points:["br","tr"],overflow:K,offset:[0,-4],targetOffset:Te},rightTop:{points:["tl","tr"],overflow:K,offset:[4,0],targetOffset:Te},bottomRight:{points:["tr","br"],overflow:K,offset:[0,4],targetOffset:Te},rightBottom:{points:["bl","br"],overflow:K,offset:[4,0],targetOffset:Te},bottomLeft:{points:["tl","bl"],overflow:K,offset:[0,4],targetOffset:Te},leftBottom:{points:["br","bl"],overflow:K,offset:[-4,0],targetOffset:Te}},Pe=de},"8EBN":function(wt,rt,T){(function(K){K(T("VrN/"))})(function(K){"use strict";K.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 Te=0;Te-1&&Pe.substring(j+1,Pe.length);if(Q)return K.findModeByExtension(Q)},K.findModeByName=function(Pe){Pe=Pe.toLowerCase();for(var _e=0;_e=u.length?d.slice(u.length):d}).join(`
`)}var z=[],me=[""],ue=new oe.a.Renderer,He=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function $e(){z.length=0,me=[""]}var we={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function be(c,o,a,u){if(o>=c.length||c[o].level<=a)return o;var d=c[o];u.push("- "+d.text+""),o++;var h=[];return o=be(c,o,d.level,h),h.length>0&&(u.push("
"),h.forEach(function(I){u.push(I)}),u.push("
")),u.push(" "),o=be(c,o,a,u),o}function Ve(){return be(z,0,0,me),me.push("
"),me.join("")}var fe={heading:function(o){var a=He.exec(o);if(a)return{type:"heading",raw:a[0],depth:a[1].length,text:a[2]}},fences:function(o){var a=this.rules.block.fences.exec(o);if(a){var u=a[0],d=q(u,a[3]||""),h=a[2]?a[2].trim():a[2];if(["latex","katex","math"].indexOf(h)>=0){var I=he(),De=d;d=I,C[I]={type:"block",expression:De}}return{type:"code",raw:u,lang:h,text:d}}}},ke=/(?:\${2})([^\n`]+?)(?:\${2})/gi,Be=0,he=function(){return"__special_katext_id_".concat(Be++,"__")},C={};function ae(){return C}function Y(){Be=0,C={}}function A(c){return c=c.replace(ke,function(o,a){var u=he();return C[u]={type:"inline",expression:a},u}),c}var se=ue.listitem;ue.listitem=function(c){return se(A(c))};var F=ue.paragraph;ue.paragraph=function(c){return F(A(c))};var N=ue.tablecell;ue.tablecell=function(c,o){return N(A(c),o)},ue.code=function(c,o,a){var u=(o||"").match(/\S*/)[0];return u?["latex","katex","math"].indexOf(u)>=0?"".concat(c,"
"):'
').concat(a?c:Object(Z.escape)(c,!0),`
`):''+(a?c:Object(Z.escape)(c,!0))+"
"},ue.heading=function(c,o,a){var u=this.options.headerPrefix+a.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return z.push({anchor:u,level:o,text:c}),"'+c+""},oe.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),oe.a.use({tokenizer:fe,renderer:ue});var L=oe.a,m=T("SJMd"),f=T("ulZh"),w=T.n(f),P=T("m3rI"),J=T("Oy/b"),Se=T("p5ED"),Re=T("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 pe=function(c,o){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(a[d]=u[d])})(c,o)};function ye(c,o){function a(){this.constructor=c}pe(c,o),c.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}function ge(c,o,a,u){return new(a||(a=Promise))(function(d,h){function I(lt){try{Ze(u.next(lt))}catch(Ie){h(Ie)}}function De(lt){try{Ze(u.throw(lt))}catch(Ie){h(Ie)}}function Ze(lt){var Ie;lt.done?d(lt.value):(Ie=lt.value,Ie instanceof a?Ie:new a(function(xt){xt(Ie)})).then(I,De)}Ze((u=u.apply(c,o||[])).next())})}function ce(c,o){var a,u,d,h,I={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return h={next:De(0),throw:De(1),return:De(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function De(Ze){return function(lt){return function(Ie){if(a)throw new TypeError("Generator is already executing.");for(;I;)try{if(a=1,u&&(d=2&Ie[0]?u.return:Ie[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,Ie[1])).done)return d;switch(u=0,d&&(Ie=[2&Ie[0],d.value]),Ie[0]){case 0:case 1:d=Ie;break;case 4:return I.label++,{value:Ie[1],done:!1};case 5:I.label++,u=Ie[1],Ie=[0];continue;case 7:Ie=I.ops.pop(),I.trys.pop();continue;default:if(!(d=I.trys,(d=d.length>0&&d[d.length-1])||Ie[0]!==6&&Ie[0]!==2)){I=0;continue}if(Ie[0]===3&&(!d||Ie[1]>d[0]&&Ie[1]',"select"),this.addActionButton(u,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(u,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(u,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(u,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(u,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(u,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(u,'',"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 I=document.createElement("div");I.className=""+a.toolbarButtonStyleClass.name,I.setAttribute("data-type-name",h.typeName),I.innerHTML=h.icon,I.addEventListener("click",function(){a.markerToolbarButtonClicked(I,h)}),a.buttons.push(I),a.markerButtons.push(I)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var d=document.createElement("div");d.className=this.toolbarBlockStyleClass.name,d.style.whiteSpace="nowrap",d.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(d),this.addActionButton(d,'',"render"),this.addActionButton(d,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},c.prototype.addButtonClickListener=function(o){this.buttonClickListeners.push(o)},c.prototype.removeButtonClickListener=function(o){this.buttonClickListeners.indexOf(o)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(o),1)},c.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},c.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var o=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var a=0;a0&&this.buttonClickListeners.forEach(function(u){return u("marker",a)}),this.markerButtonOverflowBlock.style.display="none"},c.prototype.actionToolbarButtonClicked=function(o,a){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(u){return u("action",a)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},c.prototype.setActiveButton=function(o){this.resetButtonStyles(),o.className=o.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),o.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},c.prototype.setActiveMarkerButton=function(o){var a=this.markerButtons.find(function(u){return u.getAttribute("data-type-name")===o});a&&this.setActiveButton(a)},c.prototype.setCurrentMarker=function(o){var a=this;this.currentMarker=o,this.buttons.filter(function(u){return/delete|notes/.test(u.getAttribute("data-action"))}).forEach(function(u){a.currentMarker===void 0?(u.style.fillOpacity="0.4",u.style.pointerEvents="none"):(u.style.fillOpacity="1",u.style.pointerEvents="all")})},c}(),Me=function(){function c(o,a,u,d){this.panels=[],this.panelButtons=[],this.markerjsContainer=o,this.displayMode=a,this.uiStyleSettings=u,this.styles=d,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return c.prototype.addStyles=function(){var o;this.toolboxStyleClass=this.styles.addClass(new X("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 X("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var a=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new X("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new X("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new X("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 X("toolbox-panel-row_colors",`
background-color: `+((o=this.uiStyleSettings.toolboxBackgroundColor)!==null&&o!==void 0?o:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new X("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
padding: `+a+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new X("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new X("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new xe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new xe("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},c.prototype.show=function(o){var a;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolboxStyleClass.name+" "+((a=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&a!==void 0?a:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},c.prototype.setPanelButtons=function(o){var a,u,d=this;this.panels=o,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((a=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&a!==void 0?a:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((u=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&u!==void 0?u:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(h){var I;h.uiStyleSettings=d.uiStyleSettings;var De=document.createElement("div");De.className=d.toolboxButtonStyleClass.name+" "+((I=d.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&I!==void 0?I:d.toolboxButtonStyleColorsClass.name),De.innerHTML=h.icon,De.title=h.title,De.addEventListener("click",function(){d.panelButtonClick(h)}),d.panelButtons.push(De),d.buttonRow.appendChild(De)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},c.prototype.panelButtonClick=function(o){var a=this,u=-1;if(o!==this.activePanel){u=this.panels.indexOf(o),this.panelRow.innerHTML="";var d=o.getUi();d.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(d),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=o}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){a.displayMode==="inline"?a.panelRow.style.display="none":a.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(h,I){var De,Ze;h.className=a.toolboxButtonStyleClass.name+" "+(I===u?""+((De=a.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&De!==void 0?De:a.toolboxActiveButtonStyleColorsClass.name):""+((Ze=a.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ze!==void 0?Ze:a.toolboxButtonStyleColorsClass.name))})},c}(),Ge=function(c,o){this.title=c,this.icon=o},je=function(c){function o(a,u,d,h){var I=c.call(this,a,h||'')||this;return I.colors=[],I.addTransparent=!1,I.colorBoxes=[],I.colors=u,I.currentColor=d,I.setCurrentColor=I.setCurrentColor.bind(I),I.getColorBox=I.getColorBox.bind(I),I}return ye(o,c),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.overflow="hidden",u.style.whiteSpace="nowrap",this.colors.forEach(function(d){var h=a.getColorBox(d);u.appendChild(h),a.colorBoxes.push(h)}),u},o.prototype.getColorBox=function(a){var u=this,d=this.uiStyleSettings.toolbarHeight/4,h=this.uiStyleSettings.toolbarHeight-d,I=document.createElement("div");I.style.display="inline-block",I.style.boxSizing="content-box",I.style.width=h-2+"px",I.style.height=h-2+"px",I.style.padding="1px",I.style.marginRight="2px",I.style.marginBottom="2px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.borderRadius=(h+2)/2+"px",I.style.borderColor=a===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){u.setCurrentColor(a,I)});var De=document.createElement("div");return De.style.display="inline-block",De.style.width=h-2+"px",De.style.height=h-2+"px",De.style.backgroundColor=a,De.style.borderRadius=h/2+"px",a==="transparent"&&(De.style.fill=this.uiStyleSettings.toolboxAccentColor,De.innerHTML=``),I.appendChild(De),I},o.prototype.setCurrentColor=function(a,u){var d=this;this.currentColor=a,this.colorBoxes.forEach(function(h){h.style.borderColor=h===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(a)},o}(Ge),Ne=function(){function c(o,a,u){this._state="new",this._isSelected=!1,this._container=o,this._overlayContainer=a,this.globalSettings=u,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(c.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(o){return!1},Object.defineProperty(c.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),c.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},c.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},c.prototype.pointerDown=function(o,a){},c.prototype.dblClick=function(o,a){},c.prototype.manipulate=function(o){},c.prototype.pointerUp=function(o){this.stateChanged()},c.prototype.dispose=function(){},c.prototype.addMarkerVisualToContainer=function(o){this.container.childNodes.length>0?this.container.insertBefore(o,this.container.childNodes[0]):this.container.appendChild(o)},c.prototype.getState=function(){return{typeName:c.typeName,state:this.state,notes:this.notes}},c.prototype.restoreState=function(o){this._state=o.state,this.notes=o.notes},c.prototype.scale=function(o,a){},c.prototype.colorChanged=function(o){this.onColorChanged&&this.onColorChanged(o),this.stateChanged()},c.prototype.fillColorChanged=function(o){this.onFillColorChanged&&this.onFillColorChanged(o),this.stateChanged()},c.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var o=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),o.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(o)&&this.onStateChanged(this)}},c.typeName="MarkerBase",c}(),Fe=function(){function c(){this.findGripByVisual=this.findGripByVisual.bind(this)}return c.prototype.findGripByVisual=function(o){return this.topLeft.ownsTarget(o)?this.topLeft:this.topCenter.ownsTarget(o)?this.topCenter:this.topRight.ownsTarget(o)?this.topRight:this.centerLeft.ownsTarget(o)?this.centerLeft:this.centerRight.ownsTarget(o)?this.centerRight:this.bottomLeft.ownsTarget(o)?this.bottomLeft:this.bottomCenter.ownsTarget(o)?this.bottomCenter:this.bottomRight.ownsTarget(o)?this.bottomRight:void 0},c}(),dt=function(){function c(){this.GRIP_SIZE=10,this.visual=U.createGroup(),this.visual.appendChild(U.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(U.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return c.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},c}(),Qe=function(){function c(){}return c.toITransformMatrix=function(o){return{a:o.a,b:o.b,c:o.c,d:o.d,e:o.e,f:o.f}},c.toSVGMatrix=function(o,a){return o.a=a.a,o.b=a.b,o.c=a.c,o.d=a.d,o.e=a.e,o.f=a.f,o},c}(),et=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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(U.createTransform()),h.setupControlBox(),h}return ye(o,c),Object.defineProperty(o.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"visual",{get:function(){return this._visual},set:function(a){this._visual=a;var u=U.createTransform();this._visual.transform.baseVal.appendItem(u)},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(a){return!!c.prototype.ownsTarget.call(this,a)||!!(this.controlGrips.findGripByVisual(a)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(a))},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.left=a.x,this.top=a.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var d=this.unrotatePoint(a);if(this.manipulationStartX=d.x,this.manipulationStartY=d.y,this.offsetX=d.x-this.left,this.offsetY=d.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(u),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(u)){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 I=this.container.transform.baseVal.getItem(0);I.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(I,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},o.prototype.pointerUp=function(a){var u=this.state;c.prototype.pointerUp.call(this,a),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(a),this._state="select",u==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},o.prototype.moveVisual=function(a){this.visual.style.transform="translate("+a.x+"px, "+a.y+"px)"},o.prototype.manipulate=function(a){var u=this.unrotatePoint(a);this.state==="creating"?this.resize(a):this.state==="move"?(this.left=this.manipulationStartLeft+(u.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(u.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(u):this.state==="rotate"&&this.rotate(a)},o.prototype.resize=function(a){var u=this.manipulationStartLeft,d=this.manipulationStartWidth,h=this.manipulationStartTop,I=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:u=this.manipulationStartLeft+a.x-this.manipulationStartX,d=this.manipulationStartWidth+this.manipulationStartLeft-u;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:d=this.manipulationStartWidth+a.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:h=this.manipulationStartTop+a.y-this.manipulationStartY,I=this.manipulationStartHeight+this.manipulationStartTop-h;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:I=this.manipulationStartHeight+a.y-this.manipulationStartY}d>=0?(this.left=u,this.width=d):(this.left=u+d,this.width=-d),I>=0?(this.top=h,this.height=I):(this.top=h+I,this.height=-I),this.setSize()},o.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},o.prototype.rotate=function(a){if(Math.abs(a.x-this.centerX)>.1){var u=Math.sign(a.x-this.centerX);this.rotationAngle=180*Math.atan((a.y-this.centerY)/(a.x-this.centerX))/Math.PI+90*u,this.applyRotation()}},o.prototype.applyRotation=function(){var a=this.container.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(a,0)},o.prototype.rotatePoint=function(a){if(this.rotationAngle===0)return a;var u=this.container.getCTM(),d=U.createPoint(a.x,a.y);return{x:(d=d.matrixTransform(u)).x,y:d.y}},o.prototype.unrotatePoint=function(a){if(this.rotationAngle===0)return a;var u=this.container.getCTM();u=u.inverse();var d=U.createPoint(a.x,a.y);return{x:(d=d.matrixTransform(u)).x,y:d.y}},o.prototype.select=function(){c.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){c.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=U.createGroup();var a=U.createTransform();a.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(a),this.container.appendChild(this.controlBox),this.controlRect=U.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=U.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Fe,this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){var a=this.controlBox.transform.baseVal.getItem(0);a.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(a,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()},o.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()},o.prototype.createGrip=function(){var a=new dt;return a.visual.transform.baseVal.appendItem(U.createTransform()),this.controlBox.appendChild(a.visual),a},o.prototype.positionGrips=function(){var a=this.controlGrips.topLeft.GRIP_SIZE,u=-a/2,d=u,h=(this.width+this.CB_DISTANCE)/2-a/2,I=(this.height+this.CB_DISTANCE)/2-a/2,De=this.height+this.CB_DISTANCE-a/2,Ze=this.width+this.CB_DISTANCE-a/2;this.positionGrip(this.controlGrips.topLeft.visual,u,d),this.positionGrip(this.controlGrips.topCenter.visual,h,d),this.positionGrip(this.controlGrips.topRight.visual,Ze,d),this.positionGrip(this.controlGrips.centerLeft.visual,u,I),this.positionGrip(this.controlGrips.centerRight.visual,Ze,I),this.positionGrip(this.controlGrips.bottomLeft.visual,u,De),this.positionGrip(this.controlGrips.bottomCenter.visual,h,De),this.positionGrip(this.controlGrips.bottomRight.visual,Ze,De),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,h,d-3*this.CB_DISTANCE)},o.prototype.positionGrip=function(a,u,d){var h=a.transform.baseVal.getItem(0);h.setTranslate(u,d),a.transform.baseVal.replaceItem(h,0)},o.prototype.hideControlBox=function(){this.controlBox.style.display="none"},o.prototype.showControlBox=function(){this.controlBox.style.display=""},o.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},c.prototype.getState.call(this))},o.prototype.restoreState=function(a){c.prototype.restoreState.call(this,a);var u=a;this.left=u.left,this.top=u.top,this.width=u.width,this.height=u.height,this.rotationAngle=u.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,u.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,u.containerTransformMatrix))},o.prototype.scale=function(a,u){c.prototype.scale.call(this,a,u);var d=this.rotatePoint({x:this.left,y:this.top}),h=this.unrotatePoint({x:d.x*a,y:d.y*u});this.left=h.x,this.top=h.y,this.width=this.width*a,this.height=this.height*u,this.adjustControlBox()},o}(Ne),tt=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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 ye(o,c),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.visual)},o.prototype.createVisual=function(){this.visual=U.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)},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},o.prototype.manipulate=function(a){c.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){c.prototype.resize.call(this,a),this.setSize()},o.prototype.setSize=function(){c.prototype.setSize.call(this),U.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(a){c.prototype.pointerUp.call(this,a),this.setSize()},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.visual&&U.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(a),this.stateChanged()},o.prototype.setFillColor=function(a){this.fillColor=a,this.visual&&U.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.visual&&U.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.visual&&U.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},c.prototype.getState.call(this))},o.prototype.restoreState=function(a){var u=a;this.fillColor=u.fillColor,this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.opacity=u.opacity,this.createVisual(),c.prototype.restoreState.call(this,a),this.setSize()},o.prototype.scale=function(a,u){c.prototype.scale.call(this,a,u),this.setSize()},o.title="Rectangle marker",o}(et),mt=function(c){function o(a,u,d,h){var I=c.call(this,a,h||'')||this;return I.widths=[],I.widthBoxes=[],I.widths=u,I.currentWidth=d,I.setCurrentWidth=I.setCurrentWidth.bind(I),I}return ye(o,c),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2",this.widths.forEach(function(d){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=d===a.currentWidth?a.uiStyleSettings.toolboxAccentColor:"transparent",h.addEventListener("click",function(){a.setCurrentWidth(d,h)}),u.appendChild(h);var I=document.createElement("div");I.innerText=d.toString(),I.style.marginRight="5px",h.appendChild(I);var De=document.createElement("div");De.style.minHeight="20px",De.style.flexGrow="2",De.style.display="flex",De.style.alignItems="center";var Ze=document.createElement("hr");Ze.style.minWidth="20px",Ze.style.border="0px",Ze.style.borderTop=d+"px solid "+a.uiStyleSettings.toolboxColor,Ze.style.flexGrow="2",De.appendChild(Ze),h.appendChild(De),a.widthBoxes.push(h)}),u},o.prototype.setCurrentWidth=function(a,u){var d=this;this.currentWidth=a,this.widthBoxes.forEach(function(h){h.style.borderColor=h===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},o}(Ge),ht=function(c){function o(a,u,d,h){var I=c.call(this,a,h||'')||this;return I.styles=[],I.styleBoxes=[],I.styles=u,I.currentStyle=d,I.setCurrentStyle=I.setCurrentStyle.bind(I),I}return ye(o,c),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2",this.styles.forEach(function(d){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/a.styles.length-5+"%",h.style.borderColor=d===a.currentStyle?a.uiStyleSettings.toolboxAccentColor:"transparent",h.addEventListener("click",function(){a.setCurrentStyle(d,h)}),u.appendChild(h);var I=document.createElement("div");I.style.minHeight="20px",I.style.flexGrow="2",I.style.overflow="hidden";var De=``;I.innerHTML=De,h.appendChild(I),a.styleBoxes.push(h)}),u},o.prototype.setCurrentStyle=function(a,u){var d=this;this.currentStyle=a,this.styleBoxes.forEach(function(h){h.style.borderColor=h===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},o}(Ge),st=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.strokeColor=d.defaultColor,h.strokeWidth=d.defaultStrokeWidth,h.strokeDasharray=d.defaultStrokeDasharray,h.strokePanel=new je("Line color",d.defaultColorSet,d.defaultColor),h.strokePanel.onColorChanged=h.setStrokeColor,h.strokeWidthPanel=new mt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),h.strokeWidthPanel.onWidthChanged=h.setStrokeWidth,h.strokeStylePanel=new ht("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),h.strokeStylePanel.onStyleChanged=h.setStrokeDasharray,h}return ye(o,c),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=c.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="FrameMarker",o.title="Frame marker",o.icon='',o}(tt),Ee=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},pt=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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 ye(o,c),o.prototype.ownsTarget=function(a){return!!c.prototype.ownsTarget.call(this,a)||!(!this.grip1.ownsTarget(a)&&!this.grip2.ownsTarget(a))},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.manipulationStartX=a.x,this.manipulationStartY=a.y,this.state==="new"&&(this.x1=a.x,this.y1=a.y,this.x2=a.x,this.y2=a.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(u)?this.activeGrip=this.grip1:this.grip2.ownsTarget(u)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},o.prototype.pointerUp=function(a){var u=this.state;c.prototype.pointerUp.call(this,a),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(a),this._state="select",u==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},o.prototype.adjustVisual=function(){},o.prototype.manipulate=function(a){this.state==="creating"?this.resize(a):this.state==="move"?(this.x1=this.manipulationStartX1+a.x-this.manipulationStartX,this.y1=this.manipulationStartY1+a.y-this.manipulationStartY,this.x2=this.manipulationStartX2+a.x-this.manipulationStartX,this.y2=this.manipulationStartY2+a.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(a)},o.prototype.resize=function(a){switch(this.activeGrip){case this.grip1:this.x1=a.x,this.y1=a.y;break;case this.grip2:case void 0:this.x2=a.x,this.y2=a.y}this.adjustVisual(),this.adjustControlBox()},o.prototype.select=function(){c.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){c.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=U.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){this.positionGrips()},o.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},o.prototype.createGrip=function(){var a=new dt;return a.visual.transform.baseVal.appendItem(U.createTransform()),this.controlBox.appendChild(a.visual),a},o.prototype.positionGrips=function(){var a=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-a/2,this.y1-a/2),this.positionGrip(this.grip2.visual,this.x2-a/2,this.y2-a/2)},o.prototype.positionGrip=function(a,u,d){var h=a.transform.baseVal.getItem(0);h.setTranslate(u,d),a.transform.baseVal.replaceItem(h,0)},o.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},c.prototype.getState.call(this))},o.prototype.restoreState=function(a){c.prototype.restoreState.call(this,a);var u=a;this.x1=u.x1,this.y1=u.y1,this.x2=u.x2,this.y2=u.y2},o.prototype.scale=function(a,u){c.prototype.scale.call(this,a,u),this.x1=this.x1*a,this.y1=this.y1*u,this.x2=this.x2*a,this.y2=this.y2*u,this.adjustVisual(),this.adjustControlBox()},o}(Ne),ot=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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=d.defaultColor,h.strokeWidth=d.defaultStrokeWidth,h.strokeDasharray=d.defaultStrokeDasharray,h.strokePanel=new je("Line color",d.defaultColorSet,d.defaultColor),h.strokePanel.onColorChanged=h.setStrokeColor,h.strokeWidthPanel=new mt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),h.strokeWidthPanel.onWidthChanged=h.setStrokeWidth,h.strokeStylePanel=new ht("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),h.strokeStylePanel.onStyleChanged=h.setStrokeDasharray,h}return ye(o,c),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.selectorLine&&a!==this.visibleLine)},o.prototype.createVisual=function(){this.visual=U.createGroup(),this.selectorLine=U.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=U.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)},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},o.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()),U.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),U.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),U.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.adjustVisual(),this.colorChanged(a)},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.adjustVisual()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},c.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){c.prototype.restoreState.call(this,a);var u=a;this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.createVisual(),this.adjustVisual()},o.typeName="LineMarker",o.title="Line marker",o.icon='',o}(pt),Le=function(c){function o(a,u,d,h){var I=c.call(this,a,h||'')||this;return I.fonts=[],I.fontBoxes=[],I.fonts=u,I.currentFont=d,I.setCurrentFont=I.setCurrentFont.bind(I),I}return ye(o,c),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.overflow="hidden",u.style.flexGrow="2",this.fonts.forEach(function(d){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/a.fonts.length-5+"%",h.style.borderColor=d===a.currentFont?a.uiStyleSettings.toolboxAccentColor:"transparent",h.addEventListener("click",function(){a.setCurrentFont(d,h)}),u.appendChild(h);var I=document.createElement("div");I.style.display="flex",I.style.minHeight="20px",I.style.flexGrow="2",I.style.fontFamily=d,I.style.overflow="hidden";var De=document.createElement("div");De.style.whiteSpace="nowrap",De.style.overflow="hidden",De.style.textOverflow="ellipsis",De.innerHTML="The quick brown fox jumps over the lazy dog",I.appendChild(De),h.appendChild(I),a.fontBoxes.push(h)}),u},o.prototype.setCurrentFont=function(a,u){var d=this;this.currentFont=a,this.fontBoxes.forEach(function(h){h.style.borderColor=h===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},o}(Ge),ze=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.color="transparent",h.padding=5,h.DEFAULT_TEXT="your text here",h.text=h.DEFAULT_TEXT,h.isMoved=!1,h.color=d.defaultColor,h.fontFamily=d.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 je("Color",d.defaultColorSet,d.defaultColor),h.colorPanel.onColorChanged=h.setColor,h.fontFamilyPanel=new Le("Font",d.defaultFontFamilies,d.defaultFontFamily),h.fontFamilyPanel.onFontChanged=h.setFont,h}return ye(o,c),o.prototype.ownsTarget=function(a){if(c.prototype.ownsTarget.call(this,a)||a===this.visual||a===this.textElement||a===this.bgRectangle)return!0;var u=!1;return this.textElement.childNodes.forEach(function(d){d===a&&(u=!0)}),u},o.prototype.createVisual=function(){this.visual=U.createGroup(),this.bgRectangle=U.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=U.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(U.createTransform()),this.textElement.transform.baseVal.appendItem(U.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.isMoved=!1,this.pointerDownPoint=a,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},o.prototype.renderText=function(){var a=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(u){a.textElement.appendChild(U.createTSpan(u.trim()===""?" ":u.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},o.prototype.getTextScale=function(){var a=this.textElement.getBBox(),u=1;if(a.width>0&&a.height>0){var d=(1*this.width-this.width*this.padding*2/100)/a.width,h=(1*this.height-this.height*this.padding*2/100)/a.height;u=Math.min(d,h)}return u},o.prototype.getTextPosition=function(a){var u=this.textElement.getBBox(),d=0,h=0;return u.width>0&&u.height>0&&(d=(this.width-u.width*a)/2,h=this.height/2-u.height*a/2),{x:d,y:h}},o.prototype.sizeText=function(){var a=this.textElement.getBBox(),u=this.getTextScale(),d=this.getTextPosition(u);d.y-=a.y*u,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+d.x+"px, "+d.y+"px) scale("+u+", "+u+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(d.x,d.y),this.textElement.transform.baseVal.getItem(1).setScale(u,u))},o.prototype.manipulate=function(a){c.prototype.manipulate.call(this,a),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(a.x-this.pointerDownPoint.x)>5||Math.abs(a.y-this.pointerDownPoint.y)>5)},o.prototype.resize=function(a){c.prototype.resize.call(this,a),this.isMoved=!0,this.setSize(),this.sizeText()},o.prototype.setSize=function(){c.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(U.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),U.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},o.prototype.pointerUp=function(a){var u=this.state;u==="creating"&&(this._suppressMarkerCreateEvent=!0),c.prototype.pointerUp.call(this,a),this.setSize(),(u==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},o.prototype.showTextEditor=function(){var a=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(u){u.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var u=Number.parseFloat(a.textEditor.style.fontSize);a.textEditor.clientWidth>=Number.parseInt(a.textEditor.style.maxWidth)&&u>.9;)u-=.1,a.textEditor.style.fontSize=Math.max(u,.9)+"em"}),this.textEditor.addEventListener("keyup",function(u){u.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(u){if(u.clipboardData){var d=u.clipboardData.getData("text"),h=window.getSelection();if(!h.rangeCount)return!1;h.deleteFromDocument(),h.getRangeAt(0).insertNode(document.createTextNode(d)),u.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){a.textEditDivClicked(a.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},o.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var a=this.getTextScale(),u=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),d=this.textElement.getBBox(),h={x:d.width*a,y:d.height*a};u.x-=h.x/2,u.y-=h.y/2,this.textEditor.style.top=u.y+"px",this.textEditor.style.left=u.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-u.x+"px",this.textEditor.style.fontSize=Math.max(16*a,12)+"px",this.textElement.style.display="none"}},o.prototype.textEditDivClicked=function(a){this.text=a.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},o.prototype.select=function(){c.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},o.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),c.prototype.deselect.call(this)},o.prototype.dblClick=function(a,u){c.prototype.dblClick.call(this,a,u),this.showTextEditor()},o.prototype.setColor=function(a){this.textElement&&U.setAttributes(this.textElement,[["fill",a]]),this.color=a,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(a)},o.prototype.setFont=function(a){this.textElement&&U.setAttributes(this.textElement,[["font-family",a]]),this.fontFamily=a,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},o.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},o.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},c.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){var u=a;this.color=u.color,this.fontFamily=u.fontFamily,this.padding=u.padding,this.text=u.text,this.createVisual(),c.prototype.restoreState.call(this,a),this.setSize()},o.prototype.scale=function(a,u){c.prototype.scale.call(this,a,u),this.setSize(),this.sizeText(),this.positionTextEditor()},o.typeName="TextMarker",o.title="Text marker",o.icon='',o}(et),W=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.color="transparent",h.lineWidth=3,h.drawing=!1,h.pixelRatio=1,h.color=d.defaultColor,h.lineWidth=d.defaultStrokeWidth,h.pixelRatio=d.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 je("Color",d.defaultColorSet,d.defaultColor),h.colorPanel.onColorChanged=h.setColor,h.lineWidthPanel=new mt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),h.lineWidthPanel.onWidthChanged=h.setLineWidth,h}return ye(o,c),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.drawingImage)},o.prototype.createVisual=function(){this.visual=U.createGroup(),this.drawingImage=U.createImage(),this.visual.appendChild(this.drawingImage);var a=U.createTransform();this.visual.transform.baseVal.appendItem(a),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(a,u){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(a.x,a.y),this.drawing=!0):c.prototype.pointerDown.call(this,a,u)},o.prototype.manipulate=function(a){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(a.x,a.y),this.canvasContext.stroke()):c.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){c.prototype.resize.call(this,a),U.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),U.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(a){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):c.prototype.pointerUp.call(this,a)},o.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)},o.prototype.select=function(){this.state==="creating"&&this.finishCreation(),c.prototype.select.call(this)},o.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),c.prototype.deselect.call(this)},o.prototype.finishCreation=function(){for(var a=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),u=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],d=u[0],h=u[1],I=u[2],De=u[3],Ze=!1,lt=0;lt0&&(Ze=!0,ltDe&&(De=lt),Ie>I&&(I=Ie));if(Ze){this.left=d/this.pixelRatio,this.top=h/this.pixelRatio,this.width=(I-d)/this.pixelRatio,this.height=(De-h)/this.pixelRatio;var xt=document.createElement("canvas");xt.width=I-d,xt.height=De-h,xt.getContext("2d").putImageData(this.canvasContext.getImageData(d,h,I-d,De-h),0,0),this.drawingImgUrl=xt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},o.prototype.setDrawingImage=function(){U.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),U.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},o.prototype.setColor=function(a){this.color=a,this.colorChanged(a)},o.prototype.setLineWidth=function(a){this.lineWidth=a},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({drawingImgUrl:this.drawingImgUrl},c.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){this.createVisual(),c.prototype.restoreState.call(this,a),this.drawingImgUrl=a.drawingImgUrl,this.setDrawingImage()},o.prototype.scale=function(a,u){c.prototype.scale.call(this,a,u),this.setDrawingImage()},o.typeName="FreehandMarker",o.title="Freehand marker",o.icon='',o}(et),B=function(c){function o(a,u,d){var h=c.call(this,a,d||'')||this;return h.typeBoxes=[],h.currentType=u,h.setCurrentType=h.setCurrentType.bind(h),h}return ye(o,c),o.prototype.getUi=function(){var a=this,u=document.createElement("div");u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2";for(var d=function(De){var Ze="both";switch(De){case 0:Ze="both";break;case 1:Ze="start";break;case 2:Ze="end";break;case 3:Ze="none"}var lt=document.createElement("div");if(lt.style.display="flex",lt.style.flexGrow="2",lt.style.alignItems="center",lt.style.justifyContent="space-between",lt.style.padding="5px",lt.style.borderWidth="2px",lt.style.borderStyle="solid",lt.style.borderColor=Ze===h.currentType?h.uiStyleSettings.toolboxAccentColor:"transparent",lt.addEventListener("click",function(){a.setCurrentType(Ze,lt)}),u.appendChild(lt),Ze==="both"||Ze==="start"){var Ie=document.createElement("div");Ie.style.display="flex",Ie.style.alignItems="center",Ie.style.minHeight="20px",Ie.innerHTML=``,Ie.style.marginLeft="5px",lt.appendChild(Ie)}var xt=document.createElement("div");xt.style.display="flex",xt.style.alignItems="center",xt.style.minHeight="20px",xt.style.flexGrow="2";var Rt=document.createElement("hr");if(Rt.style.minWidth="20px",Rt.style.border="0px",Rt.style.borderTop="3px solid "+(h.uiStyleSettings!==void 0?h.uiStyleSettings.toolboxColor:"#eeeeee"),Rt.style.flexGrow="2",xt.appendChild(Rt),lt.appendChild(xt),Ze==="both"||Ze==="end"){var Xt=document.createElement("div");Xt.style.display="flex",Xt.style.alignItems="center",Xt.style.minHeight="20px",Xt.innerHTML=``,Xt.style.marginRight="5px",lt.appendChild(Xt)}h.typeBoxes.push(lt)},h=this,I=0;I<4;I++)d(I);return u},o.prototype.setCurrentType=function(a,u){var d=this;this.currentType=a,this.typeBoxes.forEach(function(h){h.style.borderColor=h===u?d.uiStyleSettings!==void 0?d.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},o}(Ge),H=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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 B("Arrow type","end"),h.arrowTypePanel.onArrowTypeChanged=h.setArrowType,h}return ye(o,c),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.arrow1&&a!==this.arrow2)},o.prototype.getArrowPoints=function(a,u){var d=this.arrowBaseWidth+2*this.strokeWidth,h=this.arrowBaseHeight+2*this.strokeWidth;return a-d/2+","+(u+h/2)+" "+a+","+(u-h/2)+" "+(a+d/2)+","+(u+h/2)},o.prototype.createTips=function(){this.arrow1=U.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(U.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=U.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(U.createTransform()),this.visual.appendChild(this.arrow2)},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(c.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",U.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),U.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var a=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),u=this.arrow1.transform.baseVal.getItem(0);u.setRotate(a,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(u,0);var d=this.arrow2.transform.baseVal.getItem(0);d.setRotate(a+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(d,0)}},o.prototype.setArrowType=function(a){this.arrowType=a,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({arrowType:this.arrowType},c.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){c.prototype.restoreState.call(this,a);var u=a;this.arrowType=u.arrowType,this.createTips(),this.adjustVisual()},o.typeName="ArrowMarker",o.title="Arrow marker",o.icon='',o}(ot),y=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.fillColor=d.defaultFillColor,h.strokeWidth=0,h.fillPanel=new je("Color",d.defaultColorSet,d.defaultFillColor),h.fillPanel.onColorChanged=h.setFillColor,h}return ye(o,c),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=c.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="CoverMarker",o.title="Cover marker",o.icon='',o}(tt),x=function(c){function o(a,u,d,h){var I=c.call(this,a,h||'')||this;return I.opacities=[],I.opacityBoxes=[],I.opacities=u,I.currentOpacity=d,I.setCurrentOpacity=I.setCurrentOpacity.bind(I),I}return ye(o,c),o.prototype.getUi=function(){var a=this,u=document.createElement("div");return u.style.display="flex",u.style.overflow="hidden",u.style.flexGrow="2",u.style.justifyContent="space-between",this.opacities.forEach(function(d){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=d===a.currentOpacity?a.uiStyleSettings.toolboxAccentColor:"transparent",h.addEventListener("click",function(){a.setCurrentOpacity(d,h)}),u.appendChild(h);var I=document.createElement("div");I.innerText=100*d+"%",h.appendChild(I),a.opacityBoxes.push(h)}),u},o.prototype.setCurrentOpacity=function(a,u){var d=this;this.currentOpacity=a,this.opacityBoxes.forEach(function(h){h.style.borderColor=h===u?d.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},o}(Ge),S=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.setOpacity=h.setOpacity.bind(h),h.fillColor=d.defaultHighlightColor,h.strokeWidth=0,h.opacity=d.defaultHighlightOpacity,h.fillPanel=new je("Color",d.defaultColorSet,h.fillColor),h.fillPanel.onColorChanged=h.setFillColor,h.opacityPanel=new x("Opacity",d.defaultOpacitySteps,h.opacity),h.opacityPanel.onOpacityChanged=h.setOpacity,h}return ye(o,c),o.prototype.setOpacity=function(a){this.opacity=a,this.visual&&U.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=c.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="HighlightMarker",o.title="Highlight marker",o.icon='',o}(y),E='',ne=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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=d.defaultStrokeColor,h.bgColor=d.defaultFillColor,h.fontFamily=d.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 je("Text color",d.defaultColorSet,h.color,''),h.colorPanel.onColorChanged=h.setColor,h.bgColorPanel=new je("Fill color",d.defaultColorSet,h.bgColor,E),h.bgColorPanel.onColorChanged=h.setBgColor,h.fontFamilyPanel=new Le("Font",d.defaultFontFamilies,d.defaultFontFamily),h.fontFamilyPanel.onFontChanged=h.setFont,h.tipGrip=new dt,h.tipGrip.visual.transform.baseVal.appendItem(U.createTransform()),h.controlBox.appendChild(h.tipGrip.visual),h}return ye(o,c),o.prototype.ownsTarget=function(a){return c.prototype.ownsTarget.call(this,a)||this.tipGrip.ownsTarget(a)||this.tip===a},o.prototype.createTip=function(){U.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=U.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},o.prototype.pointerDown=function(a,u){this.state==="new"&&c.prototype.pointerDown.call(this,a,u),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(u)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):c.prototype.pointerDown.call(this,a,u)},o.prototype.pointerUp=function(a){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,c.prototype.pointerUp.call(this,a);else{var u=this.state==="creating";c.prototype.pointerUp.call(this,a),this.setTipPoints(u),this.positionTip()}},o.prototype.manipulate=function(a){if(this.tipMoving){var u=this.unrotatePoint(a);this.tipPosition={x:u.x-this.manipulationStartLeft,y:u.y-this.manipulationStartTop},this.positionTip()}else c.prototype.manipulate.call(this,a)},o.prototype.setBgColor=function(a){this.bgRectangle&&this.tip&&(U.setAttributes(this.bgRectangle,[["fill",a]]),U.setAttributes(this.tip,[["fill",a]])),this.bgColor=a,this.fillColorChanged(a)},o.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},o.prototype.setTipPoints=function(a){a===void 0&&(a=!1);var u=Math.min(this.height/2,15),d=this.height/5;a&&(this.tipPosition={x:u+d/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.width/2&&this.tipPosition.y>=this.height/2?h',o}(ze),G=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.fillColor="transparent",h.strokeColor="transparent",h.strokeWidth=0,h.strokeDasharray="",h.opacity=1,h.strokeColor=d.defaultColor,h.strokeWidth=d.defaultStrokeWidth,h.strokeDasharray=d.defaultStrokeDasharray,h.fillColor=d.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 je("Line color",$(d.defaultColorSet,["transparent"]),d.defaultColor),h.strokePanel.onColorChanged=h.setStrokeColor,h.fillPanel=new je("Fill color",$(d.defaultColorSet,["transparent"]),h.fillColor,E),h.fillPanel.onColorChanged=h.setFillColor,h.strokeWidthPanel=new mt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),h.strokeWidthPanel.onWidthChanged=h.setStrokeWidth,h.strokeStylePanel=new ht("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),h.strokeStylePanel.onStyleChanged=h.setStrokeDasharray,h.opacityPanel=new x("Opacity",d.defaultOpacitySteps,h.opacity),h.opacityPanel.onOpacityChanged=h.setOpacity,h}return ye(o,c),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.visual)},o.prototype.createVisual=function(){this.visual=U.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)},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},o.prototype.manipulate=function(a){c.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){c.prototype.resize.call(this,a),this.setSize()},o.prototype.setSize=function(){c.prototype.setSize.call(this),U.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},o.prototype.pointerUp=function(a){c.prototype.pointerUp.call(this,a),this.setSize()},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.visual&&U.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(a),this.stateChanged()},o.prototype.setFillColor=function(a){this.fillColor=a,this.visual&&U.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(a),this.stateChanged()},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.visual&&U.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.visual&&U.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.setOpacity=function(a){this.opacity=a,this.visual&&U.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},c.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){var u=a;this.fillColor=u.fillColor,this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.opacity=u.opacity,this.createVisual(),c.prototype.restoreState.call(this,a),this.setSize()},o.prototype.scale=function(a,u){c.prototype.scale.call(this,a,u),this.setSize()},o.typeName="EllipseMarker",o.title="Ellipse marker",o.icon='',o}(et),Oe=function(c){function o(a,u,d){return c.call(this,a,u,d)||this}return ye(o,c),Object.defineProperty(o.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.tip1&&a!==this.tip2)},o.prototype.createTips=function(){this.tip1=U.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(U.createTransform()),this.visual.appendChild(this.tip1),this.tip2=U.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(U.createTransform()),this.visual.appendChild(this.tip2)},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(c.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(U.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()]]),U.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 a=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),u=this.tip1.transform.baseVal.getItem(0);u.setRotate(a,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(u,0);var d=this.tip2.transform.baseVal.getItem(0);d.setRotate(a+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(d,0)}},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=c.prototype.getState.call(this);return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){c.prototype.restoreState.call(this,a),this.createTips(),this.adjustVisual()},o.typeName="MeasurementMarker",o.title="Measurement marker",o.icon='',o}(ot),Ye=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||this;return h.strokePanel.colors=d.defaultColorSet,h.fillColor="transparent",h}return ye(o,c),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=c.prototype.getState.call(this);return a.typeName=o.typeName,a},o.typeName="EllipseFrameMarker",o.title="Ellipse frame marker",o.icon='',o}(G),nt=function(){function c(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(c.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),c.prototype.addUndoStep=function(o){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(o)||(this.undoStack.push(o),JSON.stringify(this.lastRedoStep)!==JSON.stringify(o)&&this.redoStack.splice(0,this.redoStack.length))},c.prototype.replaceLastUndoStep=function(o){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=o)},c.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},c.prototype.undo=function(){if(this.undoStack.length>1){var o=this.undoStack.pop();return o!==void 0&&this.redoStack.push(o),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},c.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},c}(),Ke=function(c){function o(a,u,d){var h=c.call(this,a,u,d)||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=d.defaultColor,h.strokeWidth=d.defaultStrokeWidth,h.strokeDasharray=d.defaultStrokeDasharray,h.strokePanel=new je("Line color",d.defaultColorSet,d.defaultColor),h.strokePanel.onColorChanged=h.setStrokeColor,h.strokeWidthPanel=new mt("Line width",d.defaultStrokeWidths,d.defaultStrokeWidth),h.strokeWidthPanel.onWidthChanged=h.setStrokeWidth,h.strokeStylePanel=new ht("Line style",d.defaultStrokeDasharrays,d.defaultStrokeDasharray),h.strokeStylePanel.onStyleChanged=h.setStrokeDasharray,h}return ye(o,c),o.prototype.ownsTarget=function(a){return!(!c.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.selectorCurve&&a!==this.visibleCurve&&!this.curveGrip.ownsTarget(a))},o.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},o.prototype.createVisual=function(){this.visual=U.createGroup(),this.selectorCurve=U.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=U.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)},o.prototype.pointerDown=function(a,u){c.prototype.pointerDown.call(this,a,u),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=a.x,this.curveY=a.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(u)&&(this.activeGrip=this.curveGrip,this._state="resize")},o.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),U.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),U.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),U.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setupControlBox=function(){c.prototype.setupControlBox.call(this),this.curveControlLine1=U.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=U.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)},o.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,c.prototype.addControlGrips.call(this)},o.prototype.positionGrips=function(){c.prototype.positionGrips.call(this);var a=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-a/2,this.curveY-a/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()))},o.prototype.manipulate=function(a){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+a.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+a.y-this.manipulationStartY),c.prototype.manipulate.call(this,a)},o.prototype.resize=function(a){this.activeGrip===this.curveGrip&&(this.curveX=a.x,this.curveY=a.y),c.prototype.resize.call(this,a),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},o.prototype.setStrokeColor=function(a){this.strokeColor=a,this.adjustVisual(),this.colorChanged(a)},o.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.adjustVisual()},o.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.adjustVisual()},o.prototype.scale=function(a,u){this.curveX=this.curveX*a,this.curveY=this.curveY*u,c.prototype.scale.call(this,a,u)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var a=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},c.prototype.getState.call(this));return a.typeName=o.typeName,a},o.prototype.restoreState=function(a){c.prototype.restoreState.call(this,a);var u=a;this.strokeColor=u.strokeColor,this.strokeWidth=u.strokeWidth,this.strokeDasharray=u.strokeDasharray,this.curveX=u.curveX,this.curveY=u.curveY,this.createVisual(),this.adjustVisual()},o.typeName="CurveMarker",o.title="Curve marker",o.icon='',o}(pt),Et=function(){function c(o,a){a===void 0&&(a=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=o,this.cancelable=a}return Object.defineProperty(c.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),c.prototype.preventDefault=function(){this._defaultPrevented=!0},c}(),Ct=function(c){function o(a,u,d){var h=c.call(this,a,!1)||this;return h.dataUrl=u,h.state=d,h}return ye(o,c),o}(Et),at=function(c){function o(a,u,d){d===void 0&&(d=!1);var h=c.call(this,a,d)||this;return h.marker=u,h}return ye(o,c),o}(Et),Ht=function(){function c(){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 c.prototype.addEventListener=function(o,a){this[o].push(a)},c.prototype.removeEventListener=function(o,a){var u=this[o].indexOf(a);u>-1&&this[o].splice(u,1)},c}(),Nt=function(){function c(o){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ee,this._isOpen=!1,this.undoRedoManager=new nt,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 Ht,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=c.instanceCounter++,this.styles=new le(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=o,this.targetRoot=document.body,this.width=o.clientWidth,this.height=o.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(c.prototype,"ALL_MARKER_TYPES",{get:function(){return[st,W,H,ze,Ye,G,S,ne,Oe,y,ot,Ke]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[st,W,H,ze,G,S,ne]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"BASIC_MARKER_TYPES",{get:function(){return[st,W,H,ze,S]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(o){var a=this;this._availableMarkerTypes.splice(0),o.forEach(function(u){if(typeof u=="string"){var d=a.ALL_MARKER_TYPES.find(function(h){return h.typeName===u});d!==void 0&&a._availableMarkerTypes.push(d)}else a._availableMarkerTypes.push(u)})},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(o){this._zoomLevel=o,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(c.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),c.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),b.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},c.prototype.show=function(){var o=this;this.styles.styleSheetRoot===void 0&&k.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=k.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(a){return a(new Et(o))})},c.prototype.render=function(){return ge(this,void 0,void 0,function(){var o;return ce(this,function(a){switch(a.label){case 0:return this.setCurrentMarker(),(o=new R).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.markersOnly=this.renderMarkersOnly,o.width=this.renderWidth,o.height=this.renderHeight,[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return a.sent(),[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,a.sent()]}})})},c.prototype.close=function(o){var a=this;if(o===void 0&&(o=!1),this.isOpen){var u=!1;o||this.eventListeners.beforeclose.forEach(function(d){var h=new Et(a,!0);d(h),h.defaultPrevented&&(u=!0)}),u||(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(d){return d(new Et(a))}),this.detachEvents(),this._isOpen=!1)}},c.prototype.addMarkersToToolbar=function(){for(var o,a=[],u=0;uthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*o:this.editorCanvas.clientWidth,u=a',o.title="Powered by marker.js",o.style.display="grid",o.style.alignItems="center",o.style.justifyItems="center",o.style.padding="3px",o.style.width="20px",o.style.height="20px",this.logoUI.appendChild(o),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},c.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")},c.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"},c.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},c.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 o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"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 Ce(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-1&&this.markers.splice(this.markers.indexOf(o),1),o.dispose()},c.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())},c.prototype.toolbarButtonClicked=function(o,a){if(o==="marker"&&a!==void 0)this.createNewMarker(a);else if(o==="action")switch(a){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()}},c.prototype.deleteSelectedMarker=function(){var o=this;if(this._currentMarker!==void 0){var a=!1;if(this.eventListeners.markerbeforedelete.forEach(function(d){var h=new at(o,o._currentMarker,!0);d(h),h.defaultPrevented&&(a=!0)}),!a){var u=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(d){return d(new at(o,u))})}}},c.prototype.clear=function(){var o=this,a=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(I){var De=new at(o,void 0,!0);I(De),De.defaultPrevented&&(a=!0)}),!a)){this.setCurrentMarker();for(var u=function(I){var De=d.markers[I];d.setCurrentMarker(d.markers[I]),d._currentMarker.dispose(),d.markerImage.removeChild(d._currentMarker.container),d.markers.splice(d.markers.indexOf(d._currentMarker),1),d.eventListeners.markerdelete.forEach(function(Ze){return Ze(new at(o,De))})},d=this,h=this.markers.length-1;h>=0;h--)u(h);this.addUndoStep()}},Object.defineProperty(c.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),c.prototype.showNotesEditor=function(){var o;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=(o=this._currentMarker.notes)!==null&&o!==void 0?o:"",this.overlayContainer.appendChild(this.notesArea))},c.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)},c.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},c.prototype.addUndoStep=function(){var o=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var a=this.getState(),u=this.undoRedoManager.getLastUndoStep();if(!u||u.width===a.width&&u.height===a.height){var d=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(a),d1&&this.panTo({x:o.clientX,y:o.clientY}))},c.prototype.onPointerUp=function(o){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(o.clientX,o.clientY)),this.isDragging=!1,this.addUndoStep()},c.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},c.prototype.onKeyUp=function(o){this._currentMarker===void 0||this.notesArea!==void 0||o.key!=="Delete"&&o.key!=="Backspace"||this.deleteSelectedMarker()},c.prototype.clientToLocalCoordinates=function(o,a){var u=this.markerImage.getBoundingClientRect();return{x:(o-u.left)/this.zoomLevel,y:(a-u.top)/this.zoomLevel}},c.prototype.onWindowResize=function(){this.positionUI()},c.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"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()},c.prototype.addLicenseKey=function(o){b.addKey(o)},c.prototype.addEventListener=function(o,a){this.eventListeners.addEventListener(o,a)},c.prototype.removeEventListener=function(o,a){this.eventListeners.removeEventListener(o,a)},c.prototype.renderState=function(o){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(o),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(c.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),c.prototype.focus=function(){var o=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(a){return a(new Et(o))}))},c.prototype.blur=function(){var o=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(a){return a(new Et(o))}))},c.instanceCounter=0,c}();/* **********************************
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 Tt=function(c,o){return(Tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(a[d]=u[d])})(c,o)};function Ot(c,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function a(){this.constructor=c}Tt(c,o),c.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}function _t(c,o,a,u){return new(a||(a=Promise))(function(d,h){function I(lt){try{Ze(u.next(lt))}catch(Ie){h(Ie)}}function De(lt){try{Ze(u.throw(lt))}catch(Ie){h(Ie)}}function Ze(lt){var Ie;lt.done?d(lt.value):(Ie=lt.value,Ie instanceof a?Ie:new a(function(xt){xt(Ie)})).then(I,De)}Ze((u=u.apply(c,o||[])).next())})}function bn(c,o){var a,u,d,h,I={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return h={next:De(0),throw:De(1),return:De(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function De(Ze){return function(lt){return function(Ie){if(a)throw new TypeError("Generator is already executing.");for(;I;)try{if(a=1,u&&(d=2&Ie[0]?u.return:Ie[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,Ie[1])).done)return d;switch(u=0,d&&(Ie=[2&Ie[0],d.value]),Ie[0]){case 0:case 1:d=Ie;break;case 4:return I.label++,{value:Ie[1],done:!1};case 5:I.label++,u=Ie[1],Ie=[0];continue;case 7:Ie=I.ops.pop(),I.trys.pop();continue;default:if(!(d=I.trys,(d=d.length>0&&d[d.length-1])||Ie[0]!==6&&Ie[0]!==2)){I=0;continue}if(Ie[0]===3&&(!d||Ie[1]>d[0]&&Ie[1]0&&a>0){var u=new Nn(o,a),d=u.ratio>=1?20:u.getHorizontalLength(20),h=u.ratio<1?20:u.getVerticalLength(20),I=document.createElementNS("http://www.w3.org/2000/svg","svg");I.setAttribute("xmlns","http://www.w3.org/2000/svg"),I.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(I);var De=vt.createDefs();I.appendChild(De);var Ze=vt.createElement("clipPath",[["id","text-bg-clip"]]);De.appendChild(Ze);var lt=vt.createPath(vt.getHollowRectanglePath((24-d)/2,(24-h)/2,d,h,(24-d)/2+2,(24-h)/2+2,d-4,h-4));I.appendChild(lt);var Ie=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ie.appendChild(vt.createTSpan(o+":"+a)),I.appendChild(Ie);var xt=Ie.getBBox();vt.setAttributes(Ie,[["x",((24-xt.width)/2).toString()],["y",((24-xt.height)/2-xt.y).toString()]]);var Rt=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(xt.width))/2,(24-Math.ceil(xt.height))/2,Math.ceil(xt.width),Math.ceil(xt.height)));return Ze.appendChild(Rt),vt.setAttributes(lt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(I),I.outerHTML}return''},c}(),Cn=function(c){function o(a,u,d){var h=c.call(this,a,u)||this;return h.isDropdownOpen=!1,h.onClick=h.dropdownButtonClicked,h.dropdownButtons=d,h}return Ot(o,c),o.prototype.setupDropdown=function(){var a=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(u){u.className=a.className,u.colorsClassName=a.colorsClassName,a.dropdownBlock.appendChild(u.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},o.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},o.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},o.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},o.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},o.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},o}(It),Lt=function(){function c(o,a){this.GRIP_SIZE=10,this.color=o,this.fillColor=a,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 c.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},c.prototype.setCenter=function(o,a){this.visual.childNodes.forEach(function(u){return vt.setAttributes(u,[["cx",o.toString()],["cy",a.toString()]])})},c}(),In=function(){function c(o,a,u,d){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=o,this.canvasHeight=a,this.margin=u,this.container=d,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(c.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(o){this._aspectRatio=o,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(o){this._zoomFactor=o,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),c.prototype.open=function(){var o=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 a=0;athis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-a.height/2),vt.setAttributes(this.cropRectElement,[["x",a.x.toString()],["y",a.y.toString()],["width",a.width.toString()],["height",a.height.toString()]]);var u=a.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(h,I){var De=a.y+u*(I+1);vt.setAttributes(h,[["x1",""+a.x],["y1",""+De],["x2",""+(a.x+a.width)],["y2",""+De]])});var d=a.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(h,I){var De=a.x+d*(I+1);vt.setAttributes(h,[["x1",""+De],["y1",""+a.y],["x2",""+De],["y2",""+(a.y+a.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,a.x,a.y,a.width,a.height)]]),this.topLeftGrip.setCenter(a.x,a.y),this.topRightGrip.setCenter(a.x+a.width,a.y),this.bottomLeftGrip.setCenter(a.x,a.y+a.height),this.bottomRightGrip.setCenter(a.x+a.width,a.y+a.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},c.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)},c.prototype.clientToLocalCoordinates=function(o,a){var u=this.container.getBoundingClientRect();return{x:o-u.left+this.margin,y:a-u.top+this.margin}},c.prototype.onPointerDown=function(o){this.container.setPointerCapture(o.pointerId),this.previousPoint=this.clientToLocalCoordinates(o.clientX,o.clientY),this.cropRectElement===o.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(o.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(o.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(o.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(o.target)&&(this.activeGrip=this.bottomRightGrip)},c.prototype.onPointerMove=function(o){if(this.isMoving)this.move(this.clientToLocalCoordinates(o.clientX,o.clientY));else if(this.activeGrip){var a=this.clientToLocalCoordinates(o.clientX,o.clientY);this.resize(a)}o.preventDefault()},c.prototype.onPointerUp=function(o){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(o.pointerId)},c.prototype.move=function(o){var a=o.x-this.previousPoint.x,u=o.y-this.previousPoint.y;this.zoomFactor!==1&&(a=-a/this.zoomFactor,u=-u/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+a),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+u),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=o},c.prototype.resize=function(o){var a=Object.assign({},this.cropRect),u=o.x-this.previousPoint.x,d=o.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:a.x+uthis.canvasWidth*this.zoomFactor&&(u=this.canvasWidth*this.zoomFactor-a.width),a.width+=u}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(a.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(u),a.height=this.aspectRatio.getVerticalLength(a.width)):(a.y+=d,a.height=this.cropRect.y+this.cropRect.height-a.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?a.height=this.aspectRatio.getVerticalLength(a.width):a.height+=d}a.width<10&&(a.x=this.cropRect.x,a.width=10),a.height<10&&(a.y=this.cropRect.y,a.height=10),this.previousPoint=o,a.x>=this.margin&&a.y>=this.margin&&a.x-this.margin+a.width<=this.canvasWidth&&a.y-this.margin+a.height<=this.canvasHeight&&(this.cropRect=a,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},c.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var o=this.cropRect.x+this.cropRect.width/2,a=this.cropRect.y+this.cropRect.height/2,u=this.aspectRatio.getHorizontalLength(this.cropRect.height),d=this.aspectRatio.getVerticalLength(this.cropRect.width);u/this.canvasWidththis.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=o-this.cropRect.width/2,this.cropRect.y=a-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)}},c.prototype.getRescaledRect=function(o,a,u,d,h,I){var De=u/o,Ze=d/a;return{x:(h.x-I)*De+I,y:(h.y-I)*Ze+I,width:h.width*De,height:h.height*Ze}},c.prototype.scaleCanvas=function(o,a){var u=this.getRescaledRect(this.canvasWidth,this.canvasHeight,o,a,this.cropRect,this.margin);this.canvasWidth=o,this.canvasHeight=a,this.onCropChange&&this.onCropChange(u),this.setCropRectangle(u)},c}(),Yn=function(){function c(o){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=o,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(c.prototype,"angle",{get:function(){return this._angle},set:function(o){this._angle=o,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),c.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},c.prototype.onPointerDown=function(o){this.controlContainer.setPointerCapture(o.pointerId),this.isDragging=!0,this.previousPoint={x:o.clientX,y:o.clientY}},c.prototype.onPointerMove=function(o){this.isDragging&&(this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.previousPoint.x=o.clientX)},c.prototype.onPointerUp=function(o){this.isDragging&&this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(o.pointerId)},c.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var o=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-o.width)/2).toString()],["y",(this.height/2).toString()]])}},c.prototype.positionScaleShape=function(){if(this.scaleShape){var o=this.scaleShape.transform.baseVal.getItem(0);o.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(o,0)}},c.prototype.getVisual=function(){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("width",this.width+"px"),o.setAttribute("height",this.height+"px"),o.setAttribute("viewBox","0 0 "+this.width+" "+this.height),o.style.flexShrink="0",document.body.appendChild(o);for(var a="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,u=1;u<=this.width/5+10;u++){var d=u%5==0?this.height/3:this.height/6;a+="h4v"+-d+"h1v"+d}a+="v1H0Z",this.scaleShape=vt.createPath(a);var h=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(h),o.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 I=vt.createTSpan("");return I.innerHTML="°",this.angleLabelElement.appendChild(I),o.appendChild(this.angleLabelElement),document.body.removeChild(o),o},c}(),hi=function(){function c(){this.naturalSize=!1,this.imageType="image/png"}return c.prototype.rasterize=function(o,a,u,d,h,I,De){var Ze=this;return new Promise(function(lt){var Ie=document.createElement("canvas");Ie.width=o.width.baseVal.value-2*d,Ie.height=o.height.baseVal.value-2*d;var xt=1,Rt=1;Ze.naturalSize===!0?(xt=a.naturalWidth/(o.width.baseVal.value-2*d)/I,Rt=a.naturalHeight/(o.height.baseVal.value-2*d)/De,Ie.width=a.naturalWidth/I,Ie.height=a.naturalHeight/De):Ze.width!==void 0&&Ze.height!==void 0&&(xt=Ze.width/u.width,Rt=Ze.height/u.height,Ie.width*=xt,Ie.height*=Rt);var Xt=Ie.getContext("2d");Xt.translate(Ie.width/2,Ie.height/2),Xt.rotate(h*Math.PI/180),Xt.scale(I,De),Xt.translate(-Ie.width/2,-Ie.height/2),Xt.drawImage(a,0,0,Ie.width,Ie.height);var jn=document.createElement("canvas");jn.width=u.width*xt,jn.height=u.height*Rt,jn.getContext("2d").putImageData(Xt.getImageData((u.x-d)*xt,(u.y-d)*Rt,u.width*xt,u.height*Rt),0,0),lt(jn.toDataURL(Ze.imageType,Ze.imageQuality))})},c}(),We=function(){function c(o){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=c.instanceCounter++,this.styles=new Kn(this.instanceNo),this.target=o,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(c.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(o){this._zoomToCropEnabled=o,o?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"gridLines",{get:function(){return this._gridLines},set:function(o){this._gridLines=o,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(o){this._rotationAngle=o,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"aspectRatio",{get:function(){var o;return(o=this._aspectRatio)!==null&&o!==void 0?o:this.aspectRatios[0]},set:function(o){this._aspectRatio=o},enumerable:!1,configurable:!0}),c.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},c.prototype.show=function(){this.showUI(),this.open()},c.prototype.close=function(o){o===void 0&&(o=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),o||this.closeEventListeners.forEach(function(a){return a()}),this._isOpen=!1)},c.prototype.addRenderEventListener=function(o){this.renderEventListeners.push(o)},c.prototype.removeRenderEventListener=function(o){this.renderEventListeners.indexOf(o)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(o),1)},c.prototype.addCloseEventListener=function(o){this.closeEventListeners.push(o)},c.prototype.removeCloseEventListener=function(o){this.closeEventListeners.indexOf(o)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(o),1)},c.prototype.setupResizeObserver=function(){var o=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.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))},c.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var o=1*this.target.clientWidth/this.target.clientHeight,a=this.contentDiv.clientWidth/o>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*o:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,u=a+2*this.CANVAS_MARGINo+this.CANVAS_MARGIN?this.target.offsetTop-(o+this.CANVAS_MARGIN):0;this.coverDiv.style.top=a+"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},c.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},c.prototype.addTopToolbar=function(){var o=this;this.topToolbar=new Wn,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 a=new li;a.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(a);var u=[];this.aspectRatios.forEach(function(Rt){var Xt=new It(ui.getIcon(Rt.horizontal,Rt.vertical),Rt.horizontal===0&&Rt.vertical===0?"FREE":Rt.horizontal+":"+Rt.vertical);Xt.onClick=function(){return o.ratioButtonClicked(Rt)},u.push(Xt)}),this.aspectRatioButton=new Cn(ui.getIcon(0,0),"Aspect ratio",u),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,a.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var d=new It('',"Toggle grid");d.isActive=this.isGridVisible,d.onClick=function(){o.isGridVisible=!o.isGridVisible,d.isActive=o.isGridVisible},a.addButton(d);var h=new It('',"Zoom to selection");if(h.isActive=this.zoomToCropEnabled,h.onClick=function(){o.zoomToCropEnabled=!o.zoomToCropEnabled,h.isActive=o.zoomToCropEnabled},a.addButton(h),!ai.isLicensed){var I=new ct;this.topToolbar.addElementBlock(I);var De=document.createElement("div");De.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ze=document.createElement("a");Ze.style.color="currentColor",Ze.href="https://markerjs.com/products/cropro",Ze.target="_blank",Ze.innerHTML='',De.appendChild(Ze),I.addElement(De)}var lt=new li;lt.minWidth=3*this.toolbarHeight+"px",lt.contentAlign="end",this.topToolbar.addButtonBlock(lt);var Ie=new It('',"OK");Ie.onClick=this.startRenderAndClose,lt.addButton(Ie),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ie.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var xt=new It('',"Close");xt.onClick=this.close,lt.addButton(xt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(xt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},c.prototype.addBottomToolbar=function(){var o=this;this.bottomToolbar=new Wn,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 a=new li;a.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(a);var u=new It('',"Rotate left");u.onClick=this.rotateLeftButtonClicked,a.addButton(u);var d=new It('',"Rotate right");d.onClick=this.rotateRightButtonClicked,a.addButton(d);var h=new ct;h.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(h),this.straightener=new Yn("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(lt){o.rotateBy(lt),o.straightener.angle=o.rotationAngle},h.addElement(this.straightener.getUI());var I=new li;I.minWidth=2*this.toolbarHeight+"px",I.contentAlign="end",this.bottomToolbar.addButtonBlock(I);var De=new It('',"Flip horizontal");De.onClick=this.flipHorizontallyButtonClicked,I.addButton(De);var Ze=new It('',"Flip vertical");Ze.onClick=this.flipVerticallyButtonClicked,I.addButton(Ze)},c.prototype.ratioButtonClicked=function(o){this.aspectRatio=o,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},c.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ui.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},c.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Nn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},c.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},c.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},c.prototype.restoreState=function(o){if(o){var a=this.cropLayer.getRescaledRect(o.width,o.height,this.imageWidth,this.imageHeight,o.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(a),this.cropRectChanged(a),this.flippedHorizontally=o.flippedHorizontally,this.flippedVertically=o.flippedVertically,this.applyFlip(),this.rotationAngle=o.rotationAngle,this.applyRotation()}},c.prototype.clientToLocalCoordinates=function(o,a){var u=this.cropImage.getBoundingClientRect();return{x:o-u.left,y:a-u.top}},c.prototype.onWindowResize=function(){this.positionUI()},c.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var o=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=o+"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()},c.prototype.rotateLeftButtonClicked=function(){var o=this.rotationAngle-90;this.rotationAngle%90!=0&&(o+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(o)},c.prototype.rotateRightButtonClicked=function(){var o=this.rotationAngle+90;this.rotationAngle%90!=0&&(o-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(o)},c.prototype.rotateTo=function(o){o=(o=o>180?o-360:o)<=-180?o+360:o,this.rotationAngle=o,this.applyRotation()},c.prototype.rotateBy=function(o){this.rotateTo((this.rotationAngle+o)%360)},c.prototype.applyRotation=function(){var o=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var a=this.editingTargetRotationContainer.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(a,0);var u=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/u.width,this.imageHeight/u.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=o},c.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},c.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},c.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},c.prototype.startRenderAndClose=function(){return _t(this,void 0,void 0,function(){var o,a;return bn(this,function(u){switch(u.label){case 0:return[4,this.render()];case 1:return o=u.sent(),a=this.getState(),this.renderEventListeners.forEach(function(d){return d(o,a)}),this.close(!0),[2]}})})},c.prototype.render=function(){return _t(this,void 0,void 0,function(){var o;return bn(this,function(a){switch(a.label){case 0:return(o=new hi).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.width=this.renderWidth,o.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,o.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 a.sent(),[4,o.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,a.sent()]}})})},c.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new fn("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 fn("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new fn("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var o=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new fn("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*o)+`px;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new fn("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new fn("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new on("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new on("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new fn("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 fn("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new fn("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 fn("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new fn("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},c.instanceCounter=0,c}(),St=T("8hTe"),ci=T.n(St),Ai=/]*>/g;function di(c){var o=document.createElement("div");return o.innerHTML=c,o.childNodes.length===0?"":o.childNodes[0].nodeValue}var Li=rt.a=function(c){var o=c.value,a=o===void 0?"":o,u=c.edit,d=u===void 0?!1:u,h=c.className,I=c.showTextOnly,De=c.showLines,Ze=c.replaces,lt=c.zoomImg,Ie=c.hasMask,xt=c.style,Rt=xt===void 0?{}:xt,Xt=c.stylesPrev,jn=Xt===void 0?{}:Xt,Bn=String(a),an=Object(V.useRef)(),Gn=Object(V.useRef)(),Wi=Object(V.useState)(""),Sn=Object(j.a)(Wi,2),Un=Sn[0],On=Sn[1],vi=Object(V.useState)("office"),$n=Object(j.a)(vi,2),fi=$n[0],ti=$n[1],cr=function(){var Bt=new We(Gn.current);Bt.displayMode="popup",Bt.addRenderEventListener(function(){var pn=Object(re.a)(ie.a.mark(function jt(en){var zt;return ie.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return an.current.style.display="none",qt.next=3,Object(Re.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:en}});case 3:zt=qt.sent,zt!=null&&zt.id&&Ze(Gn.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return qt.stop()}},jt)}));return function(jt){return pn.apply(this,arguments)}}()),Bt.show()},Gi=function(){var Bt=new Nt(Gn.current);Bt.settings.displayMode="popup",Bt.addEventListener("render",function(){var pn=Object(re.a)(ie.a.mark(function jt(en){var zt;return ie.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:if(an.current.style.display="none",!Gn.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:en.dataUrl}});case 4:zt=qt.sent,zt!=null&&zt.id&&Ze(Gn.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return qt.stop()}},jt)}));return function(jt){return pn.apply(this,arguments)}}()),Bt.show(),window.markerArea=Bt},Zn=Object(V.useMemo)(function(){try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Bt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Bn=Bn.replace(Zt,"("+P.a.API_SERVER+"/api/attachments/").replace(Bt,'"'+P.a.API_SERVER+"/api/attachments/").replace(pn,'"'+P.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,`
`),Bn=Bn.replace(new RegExp("(?[TOC]
",Ve()),$e()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(ni,qt){var kn=en[qt],Vi=kn.type,Xi=kn.expression;return Object(J.renderToString)(di(Xi)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),jt=jt.replace(/▁/g,"\u2581\u2581\u2581"),Y(),I){var zt=document.createElement("div");return zt.innerHTML=jt,zt.innerText}return setTimeout(function(){return Oi()},500),jt},[Bn]),Fn=Object(V.useRef)();we.WebkitLineClamp=De,De&&(Rt=Object(_e.a)(Object(_e.a)({},Rt),we));function Mi(Zt){var Bt=Zt.target;if(Bt.tagName.toUpperCase()==="IMG"){if(lt){var pn=Bt.getAttribute("src");On(pn),ti("image")}}else if(Bt.tagName.toUpperCase()==="A"){var jt=Bt.getAttribute("href");if(jt.indexOf("office")>-1)Zt.preventDefault(),On(jt),ti("office");else if(jt.indexOf("application/pdf")>-1)Zt.preventDefault(),On(jt),ti("pdf");else if(jt.indexOf("type=text")>-1)Zt.preventDefault(),On(jt),ti("html");else if(jt.startsWith("#")){Zt.preventDefault();var en=document.getElementById(jt.replace("#",""));en&&en.scrollIntoView(!0)}}}var Oi=function(){var Bt,pn=(Bt=Fn.current)===null||Bt===void 0?void 0:Bt.querySelectorAll("video");pn==null||pn.forEach(function(jt){if(jt.oncontextmenu=function(){return!1},jt.src.indexOf(".m3u8")>-1&&!jt.canPlayType("application/vnd.apple.mpegurl")){if(w.a.isSupported()){var en=new w.a;en.loadSource(jt.src),en.attachMedia(jt)}}})};Object(V.useEffect)(function(){if(Fn.current&&Zn&&(Zn.match(Ai)&&window.PR.prettyPrint()),Fn.current)return Fn.current.addEventListener("click",Mi),function(){Fn.current.removeEventListener("click",Mi),Y(),$e()}},[Zn,Fn.current,Mi]);var dr=function(Bt){if(!d)return;Bt.target.nodeName==="IMG"?(an.current.style.display="flex",an.current.style.width=Bt.target.clientWidth+"px",an.current.style.height=Bt.target.clientHeight+"px",an.current.style.top=Bt.target.offsetTop+"px",an.current.style.left=Bt.target.offsetLeft+"px",Gn.current.src=Bt.target.getAttribute("src")):an.current.style.display="none"};return M.a.createElement("div",{style:{position:"relative"}},M.a.createElement("div",{ref:Fn,style:Object(_e.a)({},Rt),className:"".concat(h||""," markdown-body ").concat(ci.a.mdBody),onMouseOver:dr,dangerouslySetInnerHTML:{__html:Zn}}),M.a.createElement("div",{ref:an,className:ci.a.button},M.a.createElement(Te.a,null,M.a.createElement(Pe.a,{onClick:function(){return cr()}},"\u88C1\u526A"),M.a.createElement(Pe.a,{onClick:function(){return Gi()}},"\u7F16\u8F91"))),M.a.createElement("img",{ref:Gn,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),M.a.createElement(Se.a,{close:!0,data:Un,hasMask:Ie,type:Un!=null&&Un.length?fi:"",style:Object(_e.a)({},jn),onClose:function(){return On("")}}))}},"9VGf":function(wt,rt,T){"use strict";T.d(rt,"a",function(){return de});var K=T("q1tI"),Te=T.n(K);function de(Pe,_e){var re=Object(K.useRef)();Object(K.useEffect)(function(){re.current=Pe}),Object(K.useEffect)(function(){function j(){re.current()}if(_e!==null){var Q=setInterval(j,_e);return function(){return clearInterval(Q)}}},[_e])}},"9ivq":function(wt,rt,T){},Bd2K:function(wt,rt,T){(function(K){K(T("VrN/"),T("osHv"))})(function(K){K.defineOption("autoCloseTags",!1,function(ie,V,M){if(M!=K.Init&&M&&ie.removeKeyMap("autoCloseTags"),!V)return;var O={name:"autoCloseTags"};(typeof V!="object"||V.whenClosing!==!1)&&(O["'/'"]=function(ve){return re(ve)}),(typeof V!="object"||V.whenOpening!==!1)&&(O["'>'"]=function(ve){return Pe(ve)}),ie.addKeyMap(O)});var Te=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],de=["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 Pe(ie){if(ie.getOption("disableInput"))return K.Pass;for(var V=ie.listSelections(),M=[],O=ie.getOption("autoCloseTags"),ve=0;veoe.ch&&(ue=ue.slice(0,ue.length-Z.end+oe.ch));var be=ue.toLowerCase();if(!ue||Z.type=="string"&&(Z.end!=oe.ch||!/[\"\']/.test(Z.string.charAt(Z.string.length-1))||Z.string.length==1)||Z.type=="tag"&&me.close||Z.string.indexOf("/")==oe.ch-Z.start-1||$e&&j($e,be)>-1||Q(ie,q.mode.xmlCurrentContext&&q.mode.xmlCurrentContext(z)||[],ue,oe,!0))return K.Pass;var Ve=typeof O=="object"&&O.emptyTags;if(Ve&&j(Ve,ue)>-1){M[ve]={text:"/>",newPos:K.Pos(oe.line,oe.ch+2)};continue}var fe=we&&j(we,be)>-1;M[ve]={indent:fe,text:">"+(fe?`
`:"")+""+ue+">",newPos:fe?K.Pos(oe.line+1,0):K.Pos(oe.line,oe.ch+1)}}for(var ke=typeof O=="object"&&O.dontIndentOnAutoClose,ve=V.length-1;ve>=0;ve--){var Be=M[ve];ie.replaceRange(Be.text,V[ve].head,V[ve].anchor,"+insert");var he=ie.listSelections().slice(0);he[ve]={head:Be.newPos,anchor:Be.newPos},ie.setSelections(he),!ke&&Be.indent&&(ie.indentLine(Be.newPos.line,null,!0),ie.indentLine(Be.newPos.line+1,null,!0))}}function _e(ie,V){for(var M=ie.listSelections(),O=[],ve=V?"/":"",oe=ie.getOption("autoCloseTags"),Z=typeof oe=="object"&&oe.dontIndentOnSlash,q=0;q"&&($e+=">"),O[q]=$e}if(ie.replaceSelections(O),M=ie.listSelections(),!Z)for(var q=0;q=0&&V[z]==M;z--)++q;O=Z.to;for(var z=1;z0){for(var V=0;V1&&arguments[1]!==void 0?arguments[1]:"",V=[],M=0;MW.length)&&(B=W.length);for(var H=0,y=new Array(B);H=W.length?{done:!0}:{done:!1,value:W[y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return H=W[Symbol.iterator](),H.next.bind(H)}function re(W,B){return B={exports:{}},W(B,B.exports),B.exports}var j=re(function(W){function B(){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 H(y){W.exports.defaults=y}W.exports={defaults:B(),getDefaults:B,changeDefaults:H}}),Q=j.defaults,ie=j.getDefaults,V=j.changeDefaults,M=/[&<>"']/,O=/[&<>"']/g,ve=/[<>"']|&(?!#?\w+;)/,oe=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&","<":"<",">":">",'"':""","'":"'"},q=function(B){return Z[B]};function z(W,B){if(B){if(M.test(W))return W.replace(O,q)}else if(ve.test(W))return W.replace(oe,q);return W}var me=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ue(W){return W.replace(me,function(B,H){return H=H.toLowerCase(),H==="colon"?":":H.charAt(0)==="#"?H.charAt(1)==="x"?String.fromCharCode(parseInt(H.substring(2),16)):String.fromCharCode(+H.substring(1)):""})}var He=/(^|[^\[])\^/g;function $e(W,B){W=W.source||W,B=B||"";var H={replace:function(x,S){return S=S.source||S,S=S.replace(He,"$1"),W=W.replace(x,S),H},getRegex:function(){return new RegExp(W,B)}};return H}var we=/[^\w:]/g,be=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Ve(W,B,H){if(W){var y;try{y=decodeURIComponent(ue(H)).replace(we,"").toLowerCase()}catch(x){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}B&&!be.test(H)&&(H=C(B,H));try{H=encodeURI(H).replace(/%25/g,"%")}catch(x){return null}return H}var fe={},ke=/^[^:]+:\/*[^/]*$/,Be=/^([^:]+:)[\s\S]*$/,he=/^([^:]+:\/*[^/]*)[\s\S]*$/;function C(W,B){fe[" "+W]||(ke.test(W)?fe[" "+W]=W+"/":fe[" "+W]=se(W,"/",!0)),W=fe[" "+W];var H=W.indexOf(":")===-1;return B.substring(0,2)==="//"?H?B:W.replace(Be,"$1")+B:B.charAt(0)==="/"?H?B:W.replace(he,"$1")+B:W+B}var ae={exec:function(){}};function Y(W){for(var B=1,H,y;B=0&&ne[Oe]==="\\";)G=!G;return G?"|":" |"}),y=H.split(/ \|/),x=0;if(y.length>B)y.splice(B);else for(;y.length=y.length?x.slice(y.length):x}).join(`
`)}var pe=function(){function W(H){this.options=H||m}var B=W.prototype;return B.space=function(y){var x=this.rules.block.newline.exec(y);if(x)return x[0].length>1?{type:"space",raw:x[0]}:{raw:`
`}},B.code=function(y,x){var S=this.rules.block.code.exec(y);if(S){var E=x[x.length-1];if(E&&E.type==="paragraph")return{raw:S[0],text:S[0].trimRight()};var ne=S[0].replace(/^ {4}/gm,"");return{type:"code",raw:S[0],codeBlockStyle:"indented",text:this.options.pedantic?ne:f(ne,`
`)}}},B.fences=function(y){var x=this.rules.block.fences.exec(y);if(x){var S=x[0],E=Re(S,x[3]||"");return{type:"code",raw:S,lang:x[2]?x[2].trim():x[2],text:E}}},B.heading=function(y){var x=this.rules.block.heading.exec(y);if(x)return{type:"heading",raw:x[0],depth:x[1].length,text:x[2]}},B.nptable=function(y){var x=this.rules.block.nptable.exec(y);if(x){var S={type:"table",header:w(x[1].replace(/^ *| *\| *$/g,"")),align:x[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:x[3]?x[3].replace(/\n$/,"").split(`
`):[],raw:x[0]};if(S.header.length===S.align.length){var E=S.align.length,ne;for(ne=0;ne ?/gm,"");return{type:"blockquote",raw:x[0],text:S}}},B.list=function(y){var x=this.rules.block.list.exec(y);if(x){for(var S=x[0],E=x[2],ne=E.length>1,G=E[E.length-1]===")",Oe={type:"list",raw:S,ordered:ne,start:ne?+E.slice(0,-1):"",loose:!1,items:[]},Ye=x[0].match(this.rules.block.item),nt=!1,Ke,Et,Ct,at,Ht,Nt,Tt,Ot=Ye.length,_t=0;_t1||this.options.smartLists&&Ct!==E)&&(at=Ye.slice(_t+1).join(`
`),Oe.raw=Oe.raw.substring(0,Oe.raw.length-at.length),_t=Ot-1)),Ht=nt||/\n\n(?!\s*$)/.test(Ke),_t!==Ot-1&&(nt=Ke.charAt(Ke.length-1)===`
`,Ht||(Ht=nt)),Ht&&(Oe.loose=!0),Nt=/^\[[ xX]\] /.test(Ke),Tt=void 0,Nt&&(Tt=Ke[1]!==" ",Ke=Ke.replace(/^\[[ xX]\] +/,"")),Oe.items.push({type:"list_item",raw:S,task:Nt,checked:Tt,loose:Ht,text:Ke});return Oe}},B.html=function(y){var x=this.rules.block.html.exec(y);if(x)return{type:this.options.sanitize?"paragraph":"html",raw:x[0],pre:!this.options.sanitizer&&(x[1]==="pre"||x[1]==="script"||x[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(x[0]):P(x[0]):x[0]}},B.def=function(y){var x=this.rules.block.def.exec(y);if(x){x[3]&&(x[3]=x[3].substring(1,x[3].length-1));var S=x[1].toLowerCase().replace(/\s+/g," ");return{tag:S,raw:x[0],href:x[2],title:x[3]}}},B.table=function(y){var x=this.rules.block.table.exec(y);if(x){var S={type:"table",header:w(x[1].replace(/^ *| *\| *$/g,"")),align:x[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:x[3]?x[3].replace(/\n$/,"").split(`
`):[]};if(S.header.length===S.align.length){S.raw=x[0];var E=S.align.length,ne;for(ne=0;ne/i.test(E[0])&&(x=!1),!S&&/^<(pre|code|kbd|script)(\s|>)/i.test(E[0])?S=!0:S&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(E[0])&&(S=!1),{type:this.options.sanitize?"text":"html",raw:E[0],inLink:x,inRawBlock:S,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(E[0]):P(E[0]):E[0]}},B.link=function(y){var x=this.rules.inline.link.exec(y);if(x){var S=J(x[2],"()");if(S>-1){var E=x[0].indexOf("!")===0?5:4,ne=E+x[1].length+S;x[2]=x[2].substring(0,S),x[0]=x[0].substring(0,ne).trim(),x[3]=""}var G=x[2],Oe="";if(this.options.pedantic){var Ye=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(G);Ye?(G=Ye[1],Oe=Ye[3]):Oe=""}else Oe=x[3]?x[3].slice(1,-1):"";G=G.trim().replace(/^<([\s\S]*)>$/,"$1");var nt=Se(x,{href:G&&G.replace(this.rules.inline._escapes,"$1"),title:Oe&&Oe.replace(this.rules.inline._escapes,"$1")},x[0]);return nt}},B.reflink=function(y,x){var S;if((S=this.rules.inline.reflink.exec(y))||(S=this.rules.inline.nolink.exec(y))){var E=(S[2]||S[1]).replace(/\s+/g," ");if(E=x[E.toLowerCase()],!E||!E.href){var ne=S[0].charAt(0);return{type:"text",raw:ne,text:ne}}var G=Se(S,E,S[0]);return G}},B.strong=function(y,x,S){S===void 0&&(S="");var E=this.rules.inline.strong.start.exec(y);if(E&&(!E[1]||E[1]&&(S===""||this.rules.inline.punctuation.exec(S)))){x=x.slice(-1*y.length);var ne=E[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ne.lastIndex=0;for(var G;(E=ne.exec(x))!=null;)if(G=this.rules.inline.strong.middle.exec(x.slice(0,E.index+3)),G)return{type:"strong",raw:y.slice(0,G[0].length),text:y.slice(2,G[0].length-2)}}},B.em=function(y,x,S){S===void 0&&(S="");var E=this.rules.inline.em.start.exec(y);if(E&&(!E[1]||E[1]&&(S===""||this.rules.inline.punctuation.exec(S)))){x=x.slice(-1*y.length);var ne=E[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ne.lastIndex=0;for(var G;(E=ne.exec(x))!=null;)if(G=this.rules.inline.em.middle.exec(x.slice(0,E.index+2)),G)return{type:"em",raw:y.slice(0,G[0].length),text:y.slice(1,G[0].length-1)}}},B.codespan=function(y){var x=this.rules.inline.code.exec(y);if(x){var S=x[2].replace(/\n/g," "),E=/[^ ]/.test(S),ne=S.startsWith(" ")&&S.endsWith(" ");return E&&ne&&(S=S.substring(1,S.length-1)),S=P(S,!0),{type:"codespan",raw:x[0],text:S}}},B.br=function(y){var x=this.rules.inline.br.exec(y);if(x)return{type:"br",raw:x[0]}},B.del=function(y){var x=this.rules.inline.del.exec(y);if(x)return{type:"del",raw:x[0],text:x[1]}},B.autolink=function(y,x){var S=this.rules.inline.autolink.exec(y);if(S){var E,ne;return S[2]==="@"?(E=P(this.options.mangle?x(S[1]):S[1]),ne="mailto:"+E):(E=P(S[1]),ne=E),{type:"link",raw:S[0],text:E,href:ne,tokens:[{type:"text",raw:E,text:E}]}}},B.url=function(y,x){var S;if(S=this.rules.inline.url.exec(y)){var E,ne;if(S[2]==="@")E=P(this.options.mangle?x(S[0]):S[0]),ne="mailto:"+E;else{var G;do G=S[0],S[0]=this.rules.inline._backpedal.exec(S[0])[0];while(G!==S[0]);E=P(S[0]),S[1]==="www."?ne="http://"+E:ne=E}return{type:"link",raw:S[0],text:E,href:ne,tokens:[{type:"text",raw:E,text:E}]}}},B.inlineText=function(y,x,S){var E=this.rules.inline.text.exec(y);if(E){var ne;return x?ne=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(E[0]):P(E[0]):E[0]:ne=P(this.options.smartypants?S(E[0]):E[0]),{type:"text",raw:E[0],text:ne}}},W}(),ye=L.noopTest,ge=L.edit,ce=L.merge,$={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*|\\n*|\\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:ye,table:ye,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};$._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,$._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,$.def=ge($.def).replace("label",$._label).replace("title",$._title).getRegex(),$.bullet=/(?:[*+-]|\d{1,9}[.)])/,$.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,$.item=ge($.item,"gm").replace(/bull/g,$.bullet).getRegex(),$.list=ge($.list).replace(/bull/g,$.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+$.def.source+")").getRegex(),$._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",$._comment=//,$.html=ge($.html,"i").replace("comment",$._comment).replace("tag",$._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$.paragraph=ge($._paragraph).replace("hr",$.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",$._tag).getRegex(),$.blockquote=ge($.blockquote).replace("paragraph",$.paragraph).getRegex(),$.normal=ce({},$),$.gfm=ce({},$.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*|$)"}),$.gfm.nptable=ge($.gfm.nptable).replace("hr",$.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",$._tag).getRegex(),$.gfm.table=ge($.gfm.table).replace("hr",$.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",$._tag).getRegex(),$.pedantic=ce({},$.normal,{html:ge(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$._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:ye,paragraph:ge($.normal._paragraph).replace("hr",$.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",$.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var U={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ye,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:ye,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",U.punctuation=ge(U.punctuation).replace(/punctuation/g,U._punctuation).getRegex(),U._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",U._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",U.em.start=ge(U.em.start).replace(/punctuation/g,U._punctuation).getRegex(),U.em.middle=ge(U.em.middle).replace(/punctuation/g,U._punctuation).replace(/overlapSkip/g,U._overlapSkip).getRegex(),U.em.endAst=ge(U.em.endAst,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.em.endUnd=ge(U.em.endUnd,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.strong.start=ge(U.strong.start).replace(/punctuation/g,U._punctuation).getRegex(),U.strong.middle=ge(U.strong.middle).replace(/punctuation/g,U._punctuation).replace(/blockSkip/g,U._blockSkip).getRegex(),U.strong.endAst=ge(U.strong.endAst,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.strong.endUnd=ge(U.strong.endUnd,"g").replace(/punctuation/g,U._punctuation).getRegex(),U.blockSkip=ge(U._blockSkip,"g").getRegex(),U.overlapSkip=ge(U._overlapSkip,"g").getRegex(),U._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,U._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,U._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])?)+(?![-_])/,U.autolink=ge(U.autolink).replace("scheme",U._scheme).replace("email",U._email).getRegex(),U._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,U.tag=ge(U.tag).replace("comment",$._comment).replace("attribute",U._attribute).getRegex(),U._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,U._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,U._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,U.link=ge(U.link).replace("label",U._label).replace("href",U._href).replace("title",U._title).getRegex(),U.reflink=ge(U.reflink).replace("label",U._label).getRegex(),U.reflinkSearch=ge(U.reflinkSearch,"g").replace("reflink",U.reflink).replace("nolink",U.nolink).getRegex(),U.normal=ce({},U),U.pedantic=ce({},U.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:ge(/^!?\[(label)\]\((.*?)\)/).replace("label",U._label).getRegex(),reflink:ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",U._label).getRegex()}),U.gfm=ce({},U.normal,{escape:ge(U.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]*?(?:(?=[\\.5&&(y="x"+y.toString(16)),B+=""+y+";";return B}var Ce=function(){function W(H){this.tokens=[],this.tokens.links=Object.create(null),this.options=H||R,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var y={block:k.normal,inline:le.normal};this.options.pedantic?(y.block=k.pedantic,y.inline=le.pedantic):this.options.gfm&&(y.block=k.gfm,this.options.breaks?y.inline=le.breaks:y.inline=le.gfm),this.tokenizer.rules=y}W.lex=function(y,x){var S=new W(x);return S.lex(y)};var B=W.prototype;return B.lex=function(y){return y=y.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(y,this.tokens,!0),this.inline(this.tokens),this.tokens},B.blockTokens=function(y,x,S){x===void 0&&(x=[]),S===void 0&&(S=!0),y=y.replace(/^ +$/gm,"");for(var E,ne,G,Oe;y;){if(E=this.tokenizer.space(y)){y=y.substring(E.raw.length),E.type&&x.push(E);continue}if(E=this.tokenizer.code(y,x)){y=y.substring(E.raw.length),E.type?x.push(E):(Oe=x[x.length-1],Oe.raw+=`
`+E.raw,Oe.text+=`
`+E.text);continue}if(E=this.tokenizer.fences(y)){y=y.substring(E.raw.length),x.push(E);continue}if(E=this.tokenizer.heading(y)){y=y.substring(E.raw.length),x.push(E);continue}if(E=this.tokenizer.nptable(y)){y=y.substring(E.raw.length),x.push(E);continue}if(E=this.tokenizer.hr(y)){y=y.substring(E.raw.length),x.push(E);continue}if(E=this.tokenizer.blockquote(y)){y=y.substring(E.raw.length),E.tokens=this.blockTokens(E.text,[],S),x.push(E);continue}if(E=this.tokenizer.list(y)){for(y=y.substring(E.raw.length),G=E.items.length,ne=0;ne0)for(;(Ye=this.tokenizer.rules.inline.reflinkSearch.exec(Oe))!=null;)nt.includes(Ye[0].slice(Ye[0].lastIndexOf("[")+1,-1))&&(Oe=Oe.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Oe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ye=this.tokenizer.rules.inline.blockSkip.exec(Oe))!=null;)Oe=Oe.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Oe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;y;){if(G=this.tokenizer.escape(y)){y=y.substring(G.raw.length),x.push(G);continue}if(G=this.tokenizer.tag(y,S,E)){y=y.substring(G.raw.length),S=G.inLink,E=G.inRawBlock,x.push(G);continue}if(G=this.tokenizer.link(y)){y=y.substring(G.raw.length),G.type==="link"&&(G.tokens=this.inlineTokens(G.text,[],!0,E)),x.push(G);continue}if(G=this.tokenizer.reflink(y,this.tokens.links)){y=y.substring(G.raw.length),G.type==="link"&&(G.tokens=this.inlineTokens(G.text,[],!0,E)),x.push(G);continue}if(G=this.tokenizer.strong(y,Oe,ne)){y=y.substring(G.raw.length),G.tokens=this.inlineTokens(G.text,[],S,E),x.push(G);continue}if(G=this.tokenizer.em(y,Oe,ne)){y=y.substring(G.raw.length),G.tokens=this.inlineTokens(G.text,[],S,E),x.push(G);continue}if(G=this.tokenizer.codespan(y)){y=y.substring(G.raw.length),x.push(G);continue}if(G=this.tokenizer.br(y)){y=y.substring(G.raw.length),x.push(G);continue}if(G=this.tokenizer.del(y)){y=y.substring(G.raw.length),G.tokens=this.inlineTokens(G.text,[],S,E),x.push(G);continue}if(G=this.tokenizer.autolink(y,X)){y=y.substring(G.raw.length),x.push(G);continue}if(!S&&(G=this.tokenizer.url(y,X))){y=y.substring(G.raw.length),x.push(G);continue}if(G=this.tokenizer.inlineText(y,E,xe)){y=y.substring(G.raw.length),ne=G.raw.slice(-1),x.push(G);continue}if(y){var Ke="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return x},Te(W,null,[{key:"rules",get:function(){return{block:k,inline:le}}}]),W}(),Me=j.defaults,Ge=L.cleanUrl,je=L.escape,Ne=function(){function W(H){this.options=H||Me}var B=W.prototype;return B.code=function(y,x,S){var E=(x||"").match(/\S*/)[0];if(this.options.highlight){var ne=this.options.highlight(y,E);ne!=null&&ne!==y&&(S=!0,y=ne)}return E?''+(S?y:je(y,!0))+`
`:""+(S?y:je(y,!0))+`
`},B.blockquote=function(y){return`
`+y+`
`},B.html=function(y){return y},B.heading=function(y,x,S,E){return this.options.headerIds?"
`:""+y+"
`},B.hr=function(){return this.options.xhtml?`
`:`
`},B.list=function(y,x,S){var E=x?"ol":"ul",ne=x&&S!==1?' start="'+S+'"':"";return"<"+E+ne+`>
`+y+""+E+`>
`},B.listitem=function(y){return""+y+`
`},B.checkbox=function(y){return" "},B.paragraph=function(y){return""+y+`
`},B.table=function(y,x){return x&&(x=""+x+""),`
`},B.tablerow=function(y){return`
`+y+`
`},B.tablecell=function(y,x){var S=x.header?"th":"td",E=x.align?"<"+S+' align="'+x.align+'">':"<"+S+">";return E+y+""+S+`>
`},B.strong=function(y){return""+y+""},B.em=function(y){return""+y+""},B.codespan=function(y){return""+y+""},B.br=function(){return this.options.xhtml?"
":"
"},B.del=function(y){return""+y+""},B.link=function(y,x,S){if(y=Ge(this.options.sanitize,this.options.baseUrl,y),y===null)return S;var E='"+S+"",E},B.image=function(y,x,S){if(y=Ge(this.options.sanitize,this.options.baseUrl,y),y===null)return S;var E='
":">",E},B.text=function(y){return y},W}(),Fe=function(){function W(){}var B=W.prototype;return B.strong=function(y){return y},B.em=function(y){return y},B.codespan=function(y){return y},B.del=function(y){return y},B.html=function(y){return y},B.text=function(y){return y},B.link=function(y,x,S){return""+S},B.image=function(y,x,S){return""+S},B.br=function(){return""},W}(),dt=function(){function W(){this.seen={}}var B=W.prototype;return B.slug=function(y){var x=y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(x)){var S=x;do this.seen[S]++,x=S+"-"+this.seen[S];while(this.seen.hasOwnProperty(x))}return this.seen[x]=0,x},W}(),Qe=j.defaults,et=L.unescape,tt=function(){function W(H){this.options=H||Qe,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new dt}W.parse=function(y,x){var S=new W(x);return S.parse(y)};var B=W.prototype;return B.parse=function(y,x){x===void 0&&(x=!0);var S="",E,ne,G,Oe,Ye,nt,Ke,Et,Ct,at,Ht,Nt,Tt,Ot,_t,bn,ai,vt,Kn=y.length;for(E=0;E0&&_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}):Ot+=vt),Ot+=this.parse(_t.tokens,Tt),Ct+=this.renderer.listitem(Ot,ai,bn);S+=this.renderer.list(Ct,Ht,Nt);continue}case"html":{S+=this.renderer.html(at.text);continue}case"paragraph":{S+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(Ct=at.tokens?this.parseInline(at.tokens):at.text;E+1An error occurred:"+st(G.message+"",!0)+"
";throw G}}Le.options=Le.setOptions=function(W){return mt(Le.defaults,W),pt(Le.defaults),Le},Le.getDefaults=Ee,Le.defaults=ot,Le.use=function(W){var B=mt({},W);if(W.renderer&&function(){var y=Le.defaults.renderer||new Ne,x=function(ne){var G=y[ne];y[ne]=function(){for(var Oe=arguments.length,Ye=new Array(Oe),nt=0;nt`,triples:"",explode:"[]{}"},de=K.Pos;K.defineOption("autoCloseBrackets",!1,function(Z,q,z){z&&z!=K.Init&&(Z.removeKeyMap(_e),Z.state.closeBrackets=null),q&&(re(Pe(q,"pairs")),Z.state.closeBrackets=q,Z.addKeyMap(_e))});function Pe(Z,q){return q=="pairs"&&typeof Z=="string"?Z:typeof Z=="object"&&Z[q]!=null?Z[q]:Te[q]}var _e={Backspace:ie,Enter:V};function re(Z){for(var q=0;q=0;ue--){var $e=me[ue].head;Z.replaceRange("",de($e.line,$e.ch-1),de($e.line,$e.ch+1),"+delete")}}function V(Z){var q=Q(Z),z=q&&Pe(q,"explode");if(!z||Z.getOption("disableInput"))return K.Pass;for(var me=Z.listSelections(),ue=0;ue0;return{anchor:new de(Z.anchor.line,Z.anchor.ch+(q?-1:1)),head:new de(Z.head.line,Z.head.ch+(q?1:-1))}}function O(Z,q){var z=Q(Z);if(!z||Z.getOption("disableInput"))return K.Pass;var me=Pe(z,"pairs"),ue=me.indexOf(q);if(ue==-1)return K.Pass;for(var He=Pe(z,"closeBefore"),$e=Pe(z,"triples"),we=me.charAt(ue+1)==q,be=Z.listSelections(),Ve=ue%2==0,fe,ke=0;ke=0&&Z.getRange(he,de(he.line,he.ch+3))==q+q+q?C="skipThree":C="skip";else if(we&&he.ch>1&&$e.indexOf(q)>=0&&Z.getRange(de(he.line,he.ch-2),he)==q+q){if(he.ch>2&&/\bstring/.test(Z.getTokenTypeAt(de(he.line,he.ch-2))))return K.Pass;C="addFour"}else if(we){var Y=he.ch==0?" ":Z.getRange(de(he.line,he.ch-1),he);if(!K.isWordChar(ae)&&Y!=q&&!K.isWordChar(Y))C="both";else return K.Pass}else if(Ve&&(ae.length===0||/\s/.test(ae)||He.indexOf(ae)>-1))C="both";else return K.Pass;if(!fe)fe=C;else if(fe!=C)return K.Pass}var A=ue%2?me.charAt(ue-1):q,se=ue%2?q:me.charAt(ue+1);Z.operation(function(){if(fe=="skip")Z.execCommand("goCharRight");else if(fe=="skipThree")for(var F=0;F<3;F++)Z.execCommand("goCharRight");else if(fe=="surround"){for(var N=Z.getSelections(),F=0;F0&&(J.percent=J.loaded/J.total*100),L.onProgress(J)});var f=new FormData;L.data&&Object.keys(L.data).forEach(function(P){var J=L.data[P];if(Array.isArray(J)){J.forEach(function(Se){f.append(P+"[]",Se)});return}f.append(P,L.data[P])}),L.file instanceof Blob?f.append(L.filename,L.file,L.file.name):f.append(L.filename,L.file),m.onerror=function(J){L.onError(J)},m.onload=function(){return m.status<200||m.status>=300?L.onError(_e(L,m),re(m)):L.onSuccess(re(m),m)},m.open(L.method,L.action,!0),L.withCredentials&&"withCredentials"in m&&(m.withCredentials=!0);var w=L.headers||{};return w["X-Requested-With"]!==null&&m.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(w).forEach(function(P){w[P]!==null&&m.setRequestHeader(P,w[P])}),m.send(f),{abort:function(){m.abort()}}}var Q=+new Date,ie=0;function V(){return"rc-upload-"+Q+"-"+ ++ie}function M(L,m){return L.indexOf(m,L.length-m.length)!==-1}var O=function(L,m){if(L&&m){var f=Array.isArray(m)?m:m.split(","),w=L.name||"",P=L.type||"",J=P.replace(/\/.*$/,"");return f.some(function(Se){var Re=Se.trim();return Re.charAt(0)==="."?M(w.toLowerCase(),Re.toLowerCase()):/\/\*$/.test(Re)?J===Re.replace(/\/.*$/,""):P===Re})}return!0};function ve(L,m){var f=L.createReader(),w=[];function P(){f.readEntries(function(J){var Se=Array.prototype.slice.apply(J);w=w.concat(Se);var Re=!Se.length;Re?m(w):P()})}P()}var oe=function(m,f,w){var P=function J(Se,Re){Re=Re||"",Se.isFile?Se.file(function(pe){w(pe)&&(Se.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=Se.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),f([pe]))}):Se.isDirectory&&ve(Se,function(pe){pe.forEach(function(ye){J(ye,""+Re+Se.name+"/")})})};m.forEach(function(J){P(J.webkitGetAsEntry())})},Z=oe,q=Object.assign||function(L){for(var m=1;m=0)continue;if(!Object.prototype.hasOwnProperty.call(L,w))continue;f[w]=L[w]}return f}function $e(L,m){if(!(L instanceof m))throw new TypeError("Cannot call a class as a function")}function we(L,m){if(!L)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:L}function be(L,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);L.prototype=Object.create(m&&m.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(L,m):L.__proto__=m)}var Ve=function(m){return Object.keys(m).reduce(function(f,w){return(w.substr(0,5)==="data-"||w.substr(0,5)==="aria-"||w==="role")&&(f[w]=m[w]),f},{})},fe=function(L){be(m,L);function m(){var f,w,P,J;$e(this,m);for(var Se=arguments.length,Re=Array(Se),pe=0;pe1&&arguments[1]!==void 0?arguments[1]:1,H=Fe.length,y=0;y1&&arguments[1]!==void 0?arguments[1]:!1;return Object(Ve.a)(f).map(function(P,J){if(!_e.isValidElement(P)||!P.type)return null;var Se=P.type.isSelectOptGroup,Re=P.key,pe=P.props,ye=pe.children,ge=Object(j.a)(pe,["children"]);return w||!Se?fe(P):Object(be.a)(Object(be.a)({key:"__RC_SELECT_GRP__".concat(Re===null?J:Re,"__"),label:Re},ge),{},{options:ke(ye)})}).filter(function(P){return P})}var Be=T("2Qr1"),he=T("qNPg"),C=T("U8pU"),ae=T("Kwbf"),Y=T("WKfj");function A(f){var w=f.mode,P=f.options,J=f.children,Se=f.backfill,Re=f.allowClear,pe=f.placeholder,ye=f.getInputElement,ge=f.showSearch,ce=f.onSearch,$=f.defaultOpen,U=f.autoFocus,b=f.labelInValue,R=f.value,k=f.inputValue,le=f.optionLabelProp,xe=w==="multiple"||w==="tags",X=ge!==void 0?ge:xe||w==="combobox",Ce=P||ke(J);if(Object(ae.a)(w!=="tags"||Ce.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),w==="tags"||w==="combobox"){var Me=Ce.some(function(Ne){return Ne.options?Ne.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(ae.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(ae.a)(w!=="combobox"||!le,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(ae.a)(w==="combobox"||!Se,"`backfill` only works with `combobox` mode."),Object(ae.a)(w==="combobox"||!ye,"`getInputElement` only work with `combobox` mode."),Object(ae.b)(w!=="combobox"||!ye||!Re||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ce&&!X&&w!=="combobox"&&w!=="tags"&&Object(ae.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(ae.b)(!$||U,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),R!=null){var Ge=Object(Y.d)(R);Object(ae.a)(!b||Ge.every(function(Ne){return Object(C.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(ae.a)(!xe||Array.isArray(R),"`value` should be array when `mode` is `multiple` or `tags`")}if(J){var je=null;Object(Ve.a)(J).some(function(Ne){if(!_e.isValidElement(Ne)||!Ne.type)return!1;var Fe=Ne.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var dt=Object(Ve.a)(Ne.props.children).every(function(Qe){return!_e.isValidElement(Qe)||!Ne.type||Qe.type.isSelectOption?!0:(je=Qe.type,!1)});return!dt}return je=Fe,!0}),je&&Object(ae.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(ae.a)(k===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var se=A,F=Object(he.a)({prefixCls:"rc-select",components:{optionList:me},convertChildrenToData:ke,flattenOptions:Be.d,getLabeledValue:Be.e,filterOptions:Be.b,isValueDisabled:Be.g,findValueOption:Be.c,warningProps:se,fillOptionsWithMissingValue:Be.a}),N=function(f){Object(de.a)(P,f);var w=Object(Pe.a)(P);function P(){var J;return Object(K.a)(this,P),J=w.apply(this,arguments),J.selectRef=_e.createRef(),J.focus=function(){J.selectRef.current.focus()},J.blur=function(){J.selectRef.current.blur()},J}return Object(Te.a)(P,[{key:"render",value:function(){return _e.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),P}(_e.Component);N.Option=He,N.OptGroup=we;var L=N,m=rt.c=L},M8RZ:function(wt,rt,T){"use strict";T.d(rt,"a",function(){return ie});var K=T("fWQN"),Te=T("mtLc"),de=T("yKVA"),Pe=T("879j"),_e=T("q1tI"),re=T.n(_e),j=T("i8i4"),Q=T.n(j),ie=function(V){Object(de.a)(O,V);var M=Object(Pe.a)(O);function O(ve){var oe;Object(K.a)(this,O),oe=M.call(this,ve);var Z=window.document;return oe.node=Z.createElement("div"),Z.body.appendChild(oe.node),oe}return Object(Te.a)(O,[{key:"render",value:function(){var oe=this.props.children;return Object(j.createPortal)(oe,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),O}(re.a.Component)},OLES:function(wt,rt,T){"use strict";var K=T("U8pU"),Te=T("VTBJ"),de=T("Ff2n"),Pe=T("q1tI"),_e=T("uciX"),re=T("7ixt"),j=function(ve){var oe=ve.overlay,Z=ve.prefixCls,q=ve.id,z=ve.overlayInnerStyle;return Pe.createElement("div",{className:"".concat(Z,"-inner"),id:q,role:"tooltip",style:z},typeof oe=="function"?oe():oe)},Q=j,ie=function(ve,oe){var Z=ve.overlayClassName,q=ve.trigger,z=q===void 0?["hover"]:q,me=ve.mouseEnterDelay,ue=me===void 0?0:me,He=ve.mouseLeaveDelay,$e=He===void 0?.1:He,we=ve.overlayStyle,be=ve.prefixCls,Ve=be===void 0?"rc-tooltip":be,fe=ve.children,ke=ve.onVisibleChange,Be=ve.afterVisibleChange,he=ve.transitionName,C=ve.animation,ae=ve.placement,Y=ae===void 0?"right":ae,A=ve.align,se=A===void 0?{}:A,F=ve.destroyTooltipOnHide,N=F===void 0?!1:F,L=ve.defaultVisible,m=ve.getTooltipContainer,f=ve.overlayInnerStyle,w=Object(de.a)(ve,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),P=Object(Pe.useRef)(null);Object(Pe.useImperativeHandle)(oe,function(){return P.current});var J=Object(Te.a)({},w);"visible"in ve&&(J.popupVisible=ve.visible);var Se=function(){var ce=ve.arrowContent,$=ce===void 0?null:ce,U=ve.overlay,b=ve.id;return[Pe.createElement("div",{className:"".concat(Ve,"-arrow"),key:"arrow"},$),Pe.createElement(Q,{key:"content",prefixCls:Ve,id:b,overlay:U,overlayInnerStyle:f})]},Re=!1,pe=!1;if(typeof N=="boolean")Re=N;else if(N&&Object(K.a)(N)==="object"){var ye=N.keepParent;Re=ye===!0,pe=ye===!1}return Pe.createElement(_e.a,Object.assign({popupClassName:Z,prefixCls:Ve,popup:Se,action:z,builtinPlacements:re.a,popupPlacement:Y,ref:P,popupAlign:se,getPopupContainer:m,onPopupVisibleChange:ke,afterPopupVisibleChange:Be,popupTransitionName:he,popupAnimation:C,defaultPopupVisible:L,destroyPopupOnHide:Re,autoDestroy:pe,mouseLeaveDelay:$e,popupStyle:we,mouseEnterDelay:ue},J),fe)},V=Object(Pe.forwardRef)(ie),M=rt.a=V},Ot1p:function(wt,rt,T){"use strict";var K=T("2qtc"),Te=T("kLXV"),de=T("rAM+"),Pe=T("miYZ"),_e=T("tsqr"),re=T("9og8"),j=T("tJVT"),Q=T("jrin"),ie=T("WmNS"),V=T.n(ie),M=T("q1tI"),O=T.n(M),ve=T("VrN/"),oe=T.n(ve),Z=T("bdgK"),q=T("p77/"),z=T("Bd2K"),me=T("ELLl"),ue=T("19Vz"),He=T("lZu9"),$e=T("+NIl"),we=T("kSUc"),be=T("9Bee"),Ve=function(G){var Oe=G.value,Ye=Oe===void 0?"":Oe,nt=G.className,Ke=G.showTextOnly,Et=G.showLines,Ct=G.style,at=Ct===void 0?{}:Ct,Ht=Object(M.useMemo)(function(){return""},[Ye]);return O.a.createElement(O.a.Fragment,null,O.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ht}}))},fe=T("0Owb"),ke=T("dejd"),Be=T("C+DQ"),he=T("1vsH"),C=T("m3rI"),ae=[{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(G){var Oe=G.onActionCallback,Ye=G.title,nt=G.icon,Ke=G.actionName,Et=G.className,Ct=Et===void 0?"":Et,at=G.children;function Ht(){Oe(Ke)}return O.a.createElement("a",{title:Ye,className:Ct,onClick:Ht},O.a.createElement("i",{className:"md-iconfont ".concat(nt)}),at)}var A=function(G){var Oe=G.watch,Ye=G.showNullButton,nt=G.onActionCallback,Ke=G.fullScreen,Et=G.insertTemp,Ct=G.hidetoolBar,at=G.uuid,Ht=G.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(he.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(he.E)("_educoder_session"),"&key=").concat(at,"&api=").concat(encodeURIComponent(C.a.PROXY_SERVER)));var Nt=[].concat(ae,[{title:"".concat(Oe?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Oe?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return O.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Nt.map(function(Tt,Ot){return O.a.createElement("li",{key:Ot},Tt.actionName?O.a.createElement(Y,Object(fe.a)({},Tt,{onActionCallback:nt})):O.a.createElement("span",{className:"v-line"}))}),Ye?O.a.createElement("li",null,O.a.createElement(Y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:nt},O.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&O.a.createElement("li",null,O.a.createElement(Y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:nt},O.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),O.a.createElement("li",{className:"btn-full-screen"},O.a.createElement(Y,{icon:"".concat(Ke?"icon-shrink":"icon-enlarge"),title:Ke?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:nt})))},se=T("M8RZ"),F=T("+L6B"),N=T("2/Rp"),L=T("y8nQ"),m=T("Vl3Y"),f=T("5NDa"),w=T("5rEg"),P={labelCol:{span:4},wrapperCol:{span:20}},J=function(G){var Oe=G.callback,Ye=G.onCancel;function nt(Ke){Oe(Ke)}return O.a.createElement(m.a,Object(fe.a)({},P,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:nt}),O.a.createElement(m.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},O.a.createElement(w.a,null)),O.a.createElement(m.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},O.a.createElement(w.a,null)),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(N.a,{type:"ghost",onClick:Ye},"\u53D6\u6D88")))},Se=T("7ahc"),Re=T("k1fw"),pe=T("HmJG"),ye=T("BjJ7"),ge=m.a.useForm,ce={width:280,marginRight:10},$={labelCol:{span:5},wrapperCol:{span:19}},U=function(G){var Oe=G.callback,Ye=G.onCancel,nt=ge(),Ke=Object(j.a)(nt,1),Et=Ke[0],Ct=Object(M.useRef)();function at(Tt){Oe(Object(Re.a)(Object(Re.a)({},Tt),{},{name:Ct.current}))}function Ht(Tt,Ot){Et.setFieldsValue({src:"/api/attachments/".concat(Tt.id,"?type=").concat(Tt.content_type),type:Ot.type})}function Nt(Tt){var Ot=Tt.target.files[0];Ct.current=Ot.name,R(Ot,Ht)}return O.a.createElement(m.a,Object(fe.a)({form:Et},$,{className:"upload-image-panel",onFinish:at}),O.a.createElement(m.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},O.a.createElement("div",{className:"flex-container"},O.a.createElement(m.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},O.a.createElement(w.a,{style:ce})),O.a.createElement(b,{onFileChange:Nt}))),O.a.createElement(m.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},O.a.createElement(w.a,{style:{width:264}})),O.a.createElement(m.a.Item,{style:{textAlign:"right"}},O.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(N.a,{type:"ghost",onClick:Ye},"\u53D6\u6D88")))};function b(G){var Oe=G.onFileChange;return O.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",O.a.createElement("input",{type:"file",onChange:Oe}))}function R(G,Oe){if(!G)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ye=new FormData;Ye.append("editormd-image-file",G),Ye.append("file_param_name","editormd-image-file"),Ye.append("byxhr","true");var nt=new window.XMLHttpRequest;nt.withCredentials=!0,nt.addEventListener("load",function(Ke){Oe(JSON.parse(Ke.target.responseText),G)},!1),nt.addEventListener("error",function(Ke){console.error(Ke)},!1),nt.open("POST","".concat(ye.a,"/api/attachments.json")),nt.send(Ye)}var k=T("giR+"),le=T("fyUT"),xe=T("7Kak"),X=T("9yH6"),Ce=X.a.Group,Me={margin:"0 8px"},Ge=function(G){var Oe=G.callback,Ye=G.onCancel;function nt(Ke){Oe(Ke)}return O.a.createElement(m.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:nt},O.a.createElement("div",{className:"flex-container"},O.a.createElement("span",{style:Me},"\u5355\u5143\u683C\u6570\uFF1A"),O.a.createElement("span",{style:Me},"\u884C\u6570"),O.a.createElement(m.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},O.a.createElement(le.a,null)),O.a.createElement("span",{style:Me},"\u5217\u6570"),O.a.createElement(m.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},O.a.createElement(le.a,null))),O.a.createElement("div",{className:"flex-container",style:{marginTop:12}},O.a.createElement("span",{style:Me},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),O.a.createElement(m.a.Item,{name:"align"},O.a.createElement(Ce,null,O.a.createElement(X.a,{value:"default"},O.a.createElement("i",{className:"fa fa-align-justify"})),O.a.createElement(X.a,{value:"left"},O.a.createElement("i",{className:"fa fa-align-left"})),O.a.createElement(X.a,{value:"center"},O.a.createElement("i",{className:"fa fa-align-center"})),O.a.createElement(X.a,{value:"right"},O.a.createElement("i",{className:"fa fa-align-right"}))))),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(N.a,{type:"ghost",onClick:Ye},"\u53D6\u6D88")))},je=T("ErOA"),Ne=T("7Cbv"),Fe="link",dt="upload-image",Qe="code-block",et="add-table",tt="------------",mt={default:tt,left:":".concat(tt),center:":".concat(tt,":"),right:"".concat(tt,":")},ht=T("9VGf"),st,Ee;function pt(){}var ot=0,Le=1e4,ze="\u2581",W=`
**\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 B(G){return/^\d+$/.test(G)?"".concat(G,"px"):G}var H=navigator.platform.toUpperCase().indexOf("MAC")>=0,y=H?"Cmd":"Ctrl",x=["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"],S=(st={},Object(Q.a)(st,y+"-B","bold"),Object(Q.a)(st,y+"-I","italic"),st),E=(Ee={},Object(Q.a)(Ee,Fe,"\u6DFB\u52A0\u94FE\u63A5"),Object(Q.a)(Ee,Qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(Q.a)(Ee,dt,"\u6DFB\u52A0\u6587\u4EF6"),Object(Q.a)(Ee,et,"\u6DFB\u52A0\u8868\u683C"),Ee),ne=rt.a=function(G){var Oe=G.defaultValue,Ye=Oe===void 0?"":Oe,nt=G.onChange,Ke=G.width,Et=Ke===void 0?"100%":Ke,Ct=G.height,at=Ct===void 0?400:Ct,Ht=G.miniToolbar,Nt=Ht===void 0?!1:Ht,Tt=G.isFocus,Ot=Tt===void 0?!1:Tt,_t=G.watch,bn=G.insertTemp,ai=G.mode,vt=ai===void 0?"markdown":ai,Kn=G.id,on=Kn===void 0?"markdown-editor-id":Kn,fn=G.showResizeBar,Wn=fn===void 0?!1:fn,si=G.noStorage,li=si===void 0?!1:si,It=G.showNullButton,ct=It===void 0?!1:It,Nn=G.hidetoolBar,ui=Nn===void 0?!1:Nn,Cn=G.fullScreen,Lt=Cn===void 0?!1:Cn,In=G.onBlur,Yn=G.onCMBeforeChange,hi=G.onFullScreen,We=G.className,St=We===void 0?"":We,ci=G.disablePaste,Ai=ci===void 0?!1:ci,di=G.placeholder,Li=di===void 0?"":di,c=G.values,o=c===void 0?"":c,a=Object(M.useState)(null),u=Object(j.a)(a,2),d=u[0],h=u[1],I=Object(M.useState)(Ye),De=Object(j.a)(I,2),Ze=De[0],lt=De[1],Ie=Object(M.useState)(_t),xt=Object(j.a)(Ie,2),Rt=xt[0],Xt=xt[1],jn=Object(M.useState)(Lt),Bn=Object(j.a)(jn,2),an=Bn[0],Gn=Bn[1],Wi=Object(M.useState)(""),Sn=Object(j.a)(Wi,2),Un=Sn[0],On=Sn[1],vi=Object(M.useState)(0),$n=Object(j.a)(vi,2),fi=$n[0],ti=$n[1],cr=Object(M.useState)(at),Gi=Object(j.a)(cr,2),Zn=Gi[0],Fn=Gi[1],Mi=Object(M.useState)(!1),Oi=Object(j.a)(Mi,2),dr=Oi[0],Zt=Oi[1],Bt=Object(M.useRef)(Object(Ne.a)()),pn=Object(M.useRef)(!1),jt=Object(M.useRef)(),en=Object(M.useRef)(),zt=Object(M.useRef)(),ni=Object(M.useRef)(),qt=Object(M.useRef)(),kn=function(){var ft=Object(re.a)(V.a.mark(function kt(){var yt,Mt;return V.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Bt.current}});case 2:Mt=Gt.sent,Mt!=null&&(yt=Mt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",d,en),Mt.attachments.map(function(Pt){Pt.content_type.indexOf("image")>-1?d.replaceSelection(".concat(Pt.content_type,")")):Pt.content_type.indexOf("video")>-1?d.replaceSelection('')):Pt.content_type.indexOf("pdf")>-1?d.replaceSelection('').concat(Pt.name,"")):d.replaceSelection("[".concat(Pt.name,"](").concat(C.a.API_SERVER,"/api/attachments/").concat(Pt.id,"?type=").concat(Pt.content_type,")"))}));case 4:case"end":return Gt.stop()}},kt)}));return function(){return ft.apply(this,arguments)}}();Object(M.useEffect)(function(){lt(o),d==null||d.setValue(o)},[o]),Object(M.useEffect)(function(){hi==null||hi(an)},[an]),Object(M.useEffect)(function(){if(en.current){var ft=oe.a.fromTextArea(en.current,{mode:vt,lineNumbers:!Nt,lineWrapping:!0,value:Ye,autoCloseTags:!0,autoCloseBrackets:!0});Ot&&ft.focus();function kt(yt,Mt){if(Ai){Mt.preventDefault();return}var Ut=Mt.clipboardData;if(Ut){var Gt=Ut.types.toString(),Pt=Ut.items;if(Gt==="Files"||Ut.types.indexOf("Files")>-1){if(Mt.preventDefault(),vt=="stex")return;try{var tn,En=Pt[1];((tn=Pt[0])===null||tn===void 0?void 0:tn.kind)==="file"&&(En=Pt[0]);var Dt=En.getAsFile(),bi=Dt.name.split(".").pop();R(Dt,function(Ft){if(Ft.id){var ln,Vn,Xn;(Dt==null||((ln=Dt.type)===null||ln===void 0)?void 0:ln.indexOf("image"))>-1?ft.replaceSelection(".concat(Ft.content_type,")")):(Dt==null||((Vn=Dt.type)===null||Vn===void 0)?void 0:Vn.indexOf("video"))>-1?ft.replaceSelection('')):(Dt==null||((Xn=Dt.type)===null||Xn===void 0)?void 0:Xn.indexOf("pdf"))>-1?ft.replaceSelection('').concat(Dt.name,"")):x.includes(bi)?ft.replaceSelection('').concat(Dt.name,"")):ft.replaceSelection("[".concat(Dt.name,"](").concat(C.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,")"))}else(Ft==null?void 0:Ft.status)===401&&(document.location.href="/user/login")})}catch(Ft){_e.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ft.on("paste",kt),ft.on("dragleave",function(yt,Mt){zt.current.classList.remove("mouse-hover-md")}),ft.on("dragover",function(yt,Mt){zt.current.classList.add("mouse-hover-md")}),ft.on("drop",function(yt,Mt){zt.current.classList.add("mouse-hover-md");var Ut;if(Ut=Mt.dataTransfer.files,Ut.length>0){Mt.preventDefault(),Mt.stopPropagation();for(var Gt=function(En){var Dt=Ut[En],bi=Dt.name.split(".").pop();R(Dt,function(Ft){if(Ft.id){var ln,Vn,Xn;(Dt==null||((ln=Dt.type)===null||ln===void 0)?void 0:ln.indexOf("image"))>-1?ft.replaceSelection(".concat(Ft.content_type,")")):(Dt==null||((Vn=Dt.type)===null||Vn===void 0)?void 0:Vn.indexOf("video"))>-1?ft.replaceSelection('')):(Dt==null||((Xn=Dt.type)===null||Xn===void 0)?void 0:Xn.indexOf("pdf"))>-1?ft.replaceSelection('').concat(Dt.name,"")):x.includes(bi)?ft.replaceSelection('').concat(Dt.name,"")):ft.replaceSelection("[".concat(Dt.name,"](").concat(C.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,")"))}else(Ft==null?void 0:Ft.status)===401&&(document.location.href="/user/login")})},Pt=0;Pt0||Pt.target.offsetWidth>0)&&(Vi(),d.setSize("100%","100%"),d.refresh())}}catch(tn){Ut.e(tn)}finally{Ut.f()}});return yt.observe(en.current.parentElement),yt}if(d){var kt=ft();return function(){kt.unobserve(en.current.parentElement)}}},[d,Vi]),Object(M.useEffect)(function(){if(d){for(var ft=[],kt=function(){var Pt=Mt[yt];Ut=Object(j.a)(Pt,2);var tn=Ut[0],En=Ut[1],Dt=Object(Q.a)({},tn,function(){Xi(En)});ft.push(Dt),d.addKeyMap(Dt)},yt=0,Mt=Object.entries(S);yt0){var ft=new Date().getTime(),kt=window.sessionStorage.getItem(on);ft>=fi+Le&&(!kt||kt!==Ze)&&(window.sessionStorage.setItem(on,Ze),Zt(!0))}},Le),Object(M.useEffect)(function(){Xt(_t)},[d,_t]),Object(M.useEffect)(function(){d&&(Ot&&d.focus())},[d,Ot]),Object(M.useEffect)(function(){if(Rt&&d){var ft=d.getScrollerElement();function kt(yt){var Mt=yt.target;if(qt.current){var Ut=Mt.scrollTop/Mt.scrollHeight;qt.current.scrollTop=qt.current.scrollHeight*Ut}}return ft.addEventListener("scroll",kt),function(){ft.removeEventListener("scroll",kt)}}},[d,Rt]),Object(M.useEffect)(function(){if(d&&Yn){function ft(kt,yt){Yn(kt,yt)}return d.on("beforeChange",ft),function(){d.off("beforeChange",ft)}}},[d,Yn]),Object(M.useEffect)(function(){if(d&&In){function ft(){In(d.getValue())}return d.on("blur",ft),function(){d.off("blur",ft)}}},[d,In]),Object(M.useEffect)(function(){if(d){function ft(kt){var yt=kt.getValue();lt(yt),ti(new Date().getTime()),kt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),nt&&nt(yt)}return d.on("change",ft),function(){d.off("change",ft)}}},[d,nt]),Object(M.useEffect)(function(){d&&(Ye==null?(d.setValue(""),lt("")):Ye!==d.getValue()&&(d.setValue(Ye),lt(Ye),d.setCursor(d.lineCount(),0)))},[d,Ye]);var Xi=Object(M.useCallback)(function(ft){var kt=d.getCursor(),yt=d.getSelection(),Mt=yt.split(`
`);switch(ft){case"bold":return d.replaceSelection("**"+yt+"**"),yt===""&&d.setCursor(kt.line,kt.ch+2),d.focus();case"italic":return d.replaceSelection("*"+yt+"*"),yt===""&&d.setCursor(kt.line,kt.ch+1),d.focus();case"code":return d.replaceSelection("`"+yt+"`"),yt===""&&d.setCursor(kt.line,kt.ch+1),d.focus();case"inline-latex":return d.replaceSelection("`$$"+yt+"$$`"),yt===""&&d.setCursor(kt.line,kt.ch+3),d.focus();case"latex":return d.replaceSelection("```latex\n"+yt+"\n```"),d.setCursor(kt.line+1,yt.length+1),d.focus();case"line-break":return d.replaceSelection(`
`),d.focus();case"list-ul":return yt===""?d.replaceSelection("- "+yt):d.replaceSelection(Mt.map(function(Ut){return Ut===""?"":"- ".concat(Ut)}).join(`
`)),d.focus();case"list-ol":return yt===""?d.replaceSelection("1. "+yt):d.replaceSelection(Mt.map(function(Ut,Gt){return Ut===""?"":"".concat(Gt+1,". ").concat(Ut)}).join(`
`)),d.focus();case"add-null-ch":return yt===""&&d.setCursor(kt.line,kt.ch+1),d.replaceSelection(ze),d.focus();case"inster-template-1":return yt===""&&d.setCursor(kt.line,kt.ch),d.replaceSelection(W),d.focus();case"eraser":return d.setValue(""),d.focus();case"trigger-watch":return Xt(!Rt),d.focus();case"trigger-full-screen":return Gn(!an),d.focus();case Fe:On(Fe);return;case Qe:On(Qe);return;case dt:On(dt);return;case et:On(et);return;default:throw new Error}},[d,Rt,an]),yi=Object(M.useCallback)(function(ft){On("");switch(Un){case Fe:var kt=ft.title,yt=ft.link;return d.replaceSelection("[".concat(kt,"](").concat(yt,")")),d.focus();case Qe:var Mt=ft.language,Ut=ft.content;return d.replaceSelection(["```"+Mt,Ut,"```"].join(`
`)),d.focus();case dt:var Gt=ft.src,Pt=ft.alt,tn=ft.name;return Gt.indexOf("type=image")>-1?d.replaceSelection(".concat(Gt,' "').concat(Pt||"",'" )')):Gt.indexOf("type=application/pdf")>-1?d.replaceSelection('').concat(tn,"")):d.replaceSelection('').concat(tn,"")),d.focus();case et:for(var En=ft.row,Dt=ft.col,bi=ft.align,Ft=`
`,ln=0;ln300&&(tn=300);var En=at+tn+"px";Fn(En)}}return ft.addEventListener("mousedown",Mt),document.addEventListener("mousemove",Gt),document.addEventListener("mouseup",Ut),function(){ft.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",Gt),document.removeEventListener("mouseup",Ut)}}},[d,ni]),Object(M.useEffect)(function(){Fn(at)},[at]);var fr=B(Et),Jn=B(Zn),Ki={width:fr,height:Jn},Fr=Object(M.useMemo)(function(){if(fi){var ft=new Date(fi),kt=ft.getHours(),yt=ft.getMinutes(),Mt=ft.getSeconds();return kt=kt<10?"0"+kt:kt,yt=yt<10?"0"+yt:yt,Mt=Mt<10?"0"+Mt:Mt,"".concat(kt,":").concat(yt,":").concat(Mt)}return 0},[fi]);function Ri(){window.sessionStorage.removeItem(on),Zt(!1),ti(0)}function Zo(){Zt(!1),ti(0),d.setValue(window.sessionStorage.getItem(on))}function ho(ft,kt){var yt=d.getValue();yt=yt.replace(ft,kt),lt(yt),d==null||d.setValue(yt)}return O.a.createElement(M.Fragment,null,O.a.createElement("div",{className:"markdown-editor-wrapper",ref:zt},O.a.createElement("div",{className:"markdown-editor-container ".concat(St," ").concat(Rt?"on-preview":""," ").concat(Nt?"mini":""," ").concat(an?"full-screen":""),style:Ki},O.a.createElement(A,{insertTemp:bn,watch:Rt,fullScreen:an,showNullButton:ct,onActionCallback:Xi,hidetoolBar:ui,uuid:Bt.current,setOpenPhones:function(){pn.current=!0}}),O.a.createElement("div",{className:"markdown-editor-body"},O.a.createElement("div",{className:"codemirror-container"},O.a.createElement("textarea",{ref:en,placeholder:Li})),Rt?O.a.createElement("div",{ref:qt,className:"preview-container"},vt==="stex"&&O.a.createElement(Ve,{value:Ze}),vt!=="stex"&&O.a.createElement(be.a,{edit:!0,value:Ze,replaces:ho})):null))),Wn?O.a.createElement("a",{ref:ni,className:"editor-resize"}):null,O.a.createElement(se.a,null,E[Un]?O.a.createElement(Te.a,{centered:!0,title:E[Un],visible:!0,onCancel:Rn,footer:null},Ur):null))}},SJMd:function(wt,rt){/**
* @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 T,K,Te,de=!1,Pe,_e;window.PR_SHOULD_USE_CONTINUATION=!0;var re,j;(function(){var Q=window,ie=["break,continue,do,else,for,if,return,while"],V=[ie,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],M=[V,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],O=[M,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],ve=[M,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],oe=[M,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],Z="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",q=[M,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],z="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",me=[ie,"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"],ue=[ie,"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"],He=[ie,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],$e=[O,oe,ve,q,z,me,ue,He],we=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,be="str",Ve="kwd",fe="com",ke="typ",Be="lit",he="pun",C="pln",ae="tag",Y="dec",A="src",se="atn",F="atv",N="nocode",L="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function m(X){for(var Ce=0,Me=!1,Ge=!1,je=0,Ne=X.length;je122||(y<65||H>90||pt.push([Math.max(65,H)|32,Math.min(y,90)|32]),y<97||H>122||pt.push([Math.max(97,H)&~32,Math.min(y,122)&~32]))}}pt.sort(function(ne,G){return ne[0]-G[0]||G[1]-ne[1]});for(var x=[],S=[],ze=0;zeE[0]&&(E[1]+1>E[0]&&Le.push("-"),Le.push(et(E[1])))}return Le.push("]"),Le.join("")}function mt(st){for(var Ee=st.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")),pt=Ee.length,ot=[],Le=0,ze=0;Le=2&&H==="["?Ee[Le]=tt(W):H!=="\\"&&(Ee[Le]=W.replace(/[a-zA-Z]/g,function(S){var E=S.charCodeAt(0);return"["+String.fromCharCode(E&~32,E|32)+"]"}))}return Ee.join("")}for(var ht=[],je=0,Ne=X.length;je=0;)Me[ht.charAt(st)]=mt;var Ee=mt[1],pt=""+Ee;Qe.hasOwnProperty(pt)||(dt.push(Ee),Qe[pt]=null)}dt.push(/[\0-\uffff]/),Ge=m(dt)})();var je=Ce.length,Ne=function(Fe){for(var dt=Fe.sourceCode,Qe=Fe.basePos,et=Fe.sourceNode,tt=[Qe,C],mt=0,ht=dt.match(Ge)||[],st={},Ee=0,pt=ht.length;Ee=5&&Le.substring(0,5)==="lang-",W&&!(ze&&typeof ze[1]=="string")&&(W=!1,Le=A),W||(st[ot]=Le)}var y=mt;if(mt+=ot.length,!W)tt.push(Qe+y,Le);else{var x=ze[1],S=ot.indexOf(x),E=S+x.length;ze[2]&&(E=ot.length-ze[2].length,S=E-x.length);var ne=Le.substring(5);w(et,Qe+y,ot.substring(0,S),Ne,tt),w(et,Qe+y+S,x,U(ne,x),tt),w(et,Qe+y+E,ot.substring(E),Ne,tt)}}Fe.decorations=tt};return Ne}function Re(X){var Ce=[],Me=[];X.tripleQuotedStrings?Ce.push([be,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):X.multiLineStrings?Ce.push([be,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ce.push([be,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),X.verbatimStrings&&Me.push([be,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=X.hashComments;Ge&&(X.cStyleComments?(Ge>1?Ce.push([fe,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ce.push([fe,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([be,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ce.push([fe,/^#[^\r\n]*/,null,"#"])),X.cStyleComments&&(Me.push([fe,/^\/\/[^\r\n]*/,null]),Me.push([fe,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=X.regexLiterals;if(je){var Ne=je>1?"":`
\r`,Fe=Ne?".":"[\\S\\s]",dt="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+L+"("+dt+")")])}var Qe=X.types;Qe&&Me.push([ke,Qe]);var et=(""+X.keywords).replace(/^ | $/g,"");et.length&&Me.push([Ve,new RegExp("^(?:"+et.replace(/[\s,]+/g,"|")+")\\b"),null]),Ce.push([C,/^\s+/,null,` \r
\xA0`]);var tt="^.[^\\s\\w.$@'\"`/\\\\]*";return X.regexLiterals&&(tt+="(?!s*/)"),Me.push([Be,/^@[a-z_$][a-z_$@0-9]*/i,null],[ke,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[C,/^[a-z_$][a-z_$@0-9]*/i,null],[Be,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[C,/^\\[\s\S]?/,null],[he,new RegExp(tt),null]),Se(Ce,Me)}var pe=Re({keywords:$e,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ye(X,Ce,Me){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Ne=X.ownerDocument,Fe=Ne.createElement("li");X.firstChild;)Fe.appendChild(X.firstChild);var dt=[Fe];function Qe(Ee){var pt=Ee.nodeType;if(pt==1&&!Ge.test(Ee.className))if(Ee.nodeName==="br")et(Ee),Ee.parentNode&&Ee.parentNode.removeChild(Ee);else for(var ot=Ee.firstChild;ot;ot=ot.nextSibling)Qe(ot);else if((pt==3||pt==4)&&Me){var Le=Ee.nodeValue,ze=Le.match(je);if(ze){var W=Le.substring(0,ze.index);Ee.nodeValue=W;var B=Le.substring(ze.index+ze[0].length);if(B){var H=Ee.parentNode;H.insertBefore(Ne.createTextNode(B),Ee.nextSibling)}et(Ee),W||Ee.parentNode.removeChild(Ee)}}}function et(Ee){for(;!Ee.nextSibling;)if(Ee=Ee.parentNode,!Ee)return;function pt(ze,W){var B=W?ze.cloneNode(!1):ze,H=ze.parentNode;if(H){var y=pt(H,1),x=ze.nextSibling;y.appendChild(B);for(var S=x;S;S=x)x=S.nextSibling,y.appendChild(S)}return B}for(var ot=pt(Ee.nextSibling,0),Le;(Le=ot.parentNode)&&Le.nodeType===1;)ot=Le;dt.push(ot)}for(var tt=0;tt=H&&(Qe+=2),Ne>=y&&(mt+=2)}}finally{Le&&(Le.style.display=ze)}}var ce={};function $(X,Ce){for(var Me=Ce.length;--Me>=0;){var Ge=Ce[Me];ce.hasOwnProperty(Ge)?Q.console&&console.warn("cannot override language handler %s",Ge):ce[Ge]=X}}function U(X,Ce){return X&&ce.hasOwnProperty(X)||(X=/^\s*]*(?:>|$)/],[fe,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[he,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^