(window.webpackJsonp=window.webpackJsonp||[]).push([[143,5,7],{"+NIl":function(Ct,dt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function(Z,R){"use strict";function X(A,E){A.cmdState.push(E)}function I(A){return A.cmdState.length>0?A.cmdState[A.cmdState.length-1]:null}function D(A){var E=A.cmdState.pop();E&&E.closeBracket()}function H(A){for(var E=A.cmdState,w=E.length-1;w>=0;w--){var d=E[w];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function F(A,E,w){return function(){this.name=A,this.bracketNo=0,this.style=E,this.styles=w,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=F("importmodule","tag",["string","builtin"]),M.documentclass=F("documentclass","tag",["","atom"]),M.usepackage=F("usepackage","tag",["atom"]),M.begin=F("begin","tag",["atom"]),M.end=F("end","tag",["atom"]),M.label=F("label","tag",["atom"]),M.ref=F("ref","tag",["atom"]),M.eqref=F("eqref","tag",["atom"]),M.cite=F("cite","tag",["atom"]),M.bibitem=F("bibitem","tag",["atom"]),M.Bibitem=F("Bibitem","tag",["atom"]),M.RBibitem=F("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(A,E){A.f=E}function v(A,E){var w;if(A.match(/^\\[a-zA-Z@]+/)){var d=A.current().slice(1);return w=M.hasOwnProperty(d)?M[d]:M.DEFAULT,w=new w,X(E,w),O(E,k),w.style}if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/\\]/))return"tag";if(A.match("\\["))return O(E,function(l,h){return C(l,h,"\\]")}),"keyword";if(A.match("\\("))return O(E,function(l,h){return C(l,h,"\\)")}),"keyword";if(A.match("$$"))return O(E,function(l,h){return C(l,h,"$$")}),"keyword";if(A.match("$"))return O(E,function(l,h){return C(l,h,"$")}),"keyword";var o=A.next();if(o=="%")return A.skipToEnd(),"comment";if(o=="}"||o=="]"){if(w=I(E),w)w.closeBracket(o),O(E,k);else return"error";return"bracket"}else return o=="{"||o=="["?(w=M.DEFAULT,w=new w,X(E,w),"bracket"):/\d/.test(o)?(A.eatWhile(/[\w.%]/),"atom"):(A.eatWhile(/[\w\-_]/),w=H(E),w.name=="begin"&&(w.argument=A.current()),w.styleIdentifier())}function C(A,E,w){if(A.eatSpace())return null;if(w&&A.match(w))return O(E,v),"keyword";if(A.match(/^\\[a-zA-Z@]+/))return"tag";if(A.match(/^[a-zA-Z]+/))return"variable-2";if(A.match(/^\\[$&%#{}_]/))return"tag";if(A.match(/^\\[,;!\/]/))return"tag";if(A.match(/^[\^_&]/))return"tag";if(A.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(A.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=A.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(A.skipToEnd(),"comment"):"error"}function k(A,E){var w=A.peek(),d;return w=="{"||w=="["?(d=I(E),d.openBracket(w),A.eat(w),O(E,v),"bracket"):/[ \t\r]/.test(w)?(A.eat(w),null):(O(E,v),D(E),v(A,E))}return{startState:function(){var A=R.inMathMode?function(E,w){return C(E,w)}:v;return{cmdState:[],f:A}},copyState:function(A){return{cmdState:A.cmdState.slice(),f:A.f}},token:function(A,E){return E.f(A,E)},blankLine:function(A){A.f=v,A.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"19Vz":function(Ct,dt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(F,M,O){var v=O&&O!=ae.Init;if(M&&!v)F.on("blur",I),F.on("change",D),F.on("swapDoc",D),ae.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){X(F)}),D(F);else if(!M&&v){F.off("blur",I),F.off("change",D),F.off("swapDoc",D),ae.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),Z(F);var C=F.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}M&&!F.hasFocus()&&I(F)});function Z(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function R(F){Z(F);var M=F.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=F.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var O=F.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),M.appendChild(O),F.display.lineSpace.insertBefore(M,F.display.lineSpace.firstChild)}function X(F){setTimeout(function(){var M=!1,O=F.getInputField();O.nodeName=="TEXTAREA"?M=!O.value:F.lineCount()==1&&(M=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),M?R(F):Z(F)},20)}function I(F){H(F)&&R(F)}function D(F){var M=F.getWrapperElement(),O=H(F);M.className=M.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?R(F):Z(F)}function H(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(Ct,dt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(X,I){var D=X.indentUnit,H={},F=I.htmlMode?Z:R;for(var M in F)H[M]=F[M];for(var M in I)H[M]=I[M];var O,v;function C(a,x){function y(G){return x.tokenize=G,G(a,x)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(E("atom","]]>")):null:a.match("--")?y(E("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(w(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=E("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",x.tokenize=k,"tag bracket");if(S=="&"){var P;return a.eat("#")?a.eat("x")?P=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):P=a.eatWhile(/[\d]/)&&a.eat(";"):P=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),P?"atom":"error"}else return a.eatWhile(/[^&<]/),null}C.isInText=!0;function k(a,x){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return x.tokenize=C,O=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return O="equals",null;if(y=="<"){x.tokenize=C,x.state=h,x.tagName=x.tagStart=null;var S=x.tokenize(a,x);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=A(y),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(a){var x=function(y,S){for(;!y.eol();)if(y.next()==a){S.tokenize=k;break}return"string"};return x.isInAttribute=!0,x}function E(a,x){return function(y,S){for(;!y.eol();){if(y.match(x)){S.tokenize=C;break}y.next()}return a}}function w(a){return function(x,y){for(var S;(S=x.next())!=null;){if(S=="<")return y.tokenize=w(a+1),y.tokenize(x,y);if(S==">")if(a==1){y.tokenize=C;break}else return y.tokenize=w(a-1),y.tokenize(x,y)}return"meta"}}function d(a,x,y){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=y,(H.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!H.contextGrabbers.hasOwnProperty(y)||!H.contextGrabbers[y].hasOwnProperty(x))return;o(a)}}function h(a,x,y){return a=="openTag"?(y.tagStart=x.column(),L):a=="closeTag"?f:h}function L(a,x,y){return a=="word"?(y.tagName=x.current(),v="tag",b):H.allowMissingTagName&&a=="endTag"?(v="tag bracket",b(a,x,y)):(v="error",L)}function f(a,x,y){if(a=="word"){var S=x.current();return y.context&&y.context.tagName!=S&&H.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==S||H.matchClosing===!1?(v="tag",p):(v="tag error",_)}else return H.allowMissingTagName&&a=="endTag"?(v="tag bracket",p(a,x,y)):(v="error",_)}function p(a,x,y){return a!="endTag"?(v="error",p):(o(y),h)}function _(a,x,y){return v="error",p(a,x,y)}function b(a,x,y){if(a=="word")return v="attribute",g;if(a=="endTag"||a=="selfcloseTag"){var S=y.tagName,P=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(S)?l(y,S):(l(y,S),y.context=new d(y,S,P==y.indented)),h}return v="error",b}function g(a,x,y){return a=="equals"?c:(H.allowMissing||(v="error"),b(a,x,y))}function c(a,x,y){return a=="string"?u:a=="word"&&H.allowUnquoted?(v="string",b):(v="error",b(a,x,y))}function u(a,x,y){return a=="string"?u:b(a,x,y)}return{startState:function(a){var x={tokenize:C,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;O=null;var y=x.tokenize(a,x);return(y||O)&&y!="comment"&&(v=null,x.state=x.state(O||y,a,x),v&&(y=v=="error"?y+" error":v)),y},indent:function(a,x,y){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+D;if(S&&S.noIndent)return ae.Pass;if(a.tokenize!=k&&a.tokenize!=C)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return H.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+D*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/$/,blockCommentStart:"",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],y=a.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(Ct,dt,ie){"use strict";ie.d(dt,"a",function(){return l}),ie.d(dt,"b",function(){return b});var ae=ie("Ty5D"),Z=ie("dI71"),R=ie("q1tI"),X=ie.n(R),I=ie("YS25"),D=ie("17x9"),H=ie.n(D),F=ie("wx14"),M=ie("zLVn"),O=ie("9R94"),v=function(c){Object(Z.a)(u,c);function u(){for(var x,y=arguments.length,S=new Array(y),P=0;P1&&arguments[1]!==void 0?arguments[1]:0,E=(H[k[A+0]]+H[k[A+1]]+H[k[A+2]]+H[k[A+3]]+"-"+H[k[A+4]]+H[k[A+5]]+"-"+H[k[A+6]]+H[k[A+7]]+"-"+H[k[A+8]]+H[k[A+9]]+"-"+H[k[A+10]]+H[k[A+11]]+H[k[A+12]]+H[k[A+13]]+H[k[A+14]]+H[k[A+15]]).toLowerCase();if(!D(E))throw TypeError("Stringified UUID is invalid");return E}var O=M;function v(k,A,E){k=k||{};var w=k.random||(k.rng||R)();if(w[6]=w[6]&15|64,w[8]=w[8]&63|128,A){E=E||0;for(var d=0;d<16;++d)A[E+d]=w[d];return A}return O(w)}var C=dt.a=v},"7ahc":function(Ct,dt,ie){"use strict";ie.d(dt,"a",function(){return L});var ae=ie("k1fw"),Z=ie("0Owb"),R=ie("+L6B"),X=ie("2/Rp"),I=ie("y8nQ"),D=ie("Vl3Y"),H=ie("tJVT"),F=ie("OaEy"),M=ie("2fM7"),O=ie("q1tI"),v=ie.n(O),C=ie("VrN/"),k=ie.n(C),A=ie("p77/"),E=ie.n(A),w=ie("c5Ni"),d=ie.n(w),o=M.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};dt.b=function(f){var p=f.callback,_=f.onCancel,b=Object(O.useState)("python"),g=Object(H.a)(b,2),c=g[0],u=g[1];function a(y){u(h[y][1])}function x(y){p(y)}return v.a.createElement(D.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),v.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(M.a,{onChange:a},Object.keys(h).map(function(y){return v.a.createElement(o,{key:y,value:y},h[y][0])}))),v.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(L,{mode:c})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(X.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function L(f){var p=f.value,_=f.onChange,b=f.mode,g=f.options,c=g===void 0?{}:g,u=Object(O.useRef)(),a=Object(O.useState)(),x=Object(H.a)(a,2),y=x[0],S=x[1];return Object(O.useEffect)(function(){if(y){function P(G){var Y=G.getValue();_&&_(Y)}return y.on("change",P),function(){y.off("change",P)}}},[y,_]),Object(O.useEffect)(function(){y&&y.setOption("mode",b)},[y,b]),Object(O.useEffect)(function(){y&&((p!==y.getValue()||p==="")&&setTimeout(function(){y.setValue(p||" ")},300))},[y,p]),Object(O.useEffect)(function(){if(u.current&&!y){var P=k.a.fromTextArea(u.current,Object(ae.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));S(P)}},[u.current,y]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:u}))}},"8EBN":function(Ct,dt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";ae.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Z=0;Z-1&&X.substring(H+1,X.length);if(F)return ae.findModeByExtension(F)},ae.findModeByName=function(X){X=X.toLowerCase();for(var I=0;I=U.length?K.slice(U.length):K}).join(`
`)}var d=[],o=[""],l=new A.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){d.length=0,o=[""]}var f={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(W,s,m,U){if(s>=W.length||W[s].level<=m)return s;var K=W[s];U.push("- "+K.text+""),s++;var B=[];return s=p(W,s,K.level,B),B.length>0&&(U.push("
"),B.forEach(function(ce){U.push(ce)}),U.push("
")),U.push(" "),s=p(W,s,m,U),s}function _(){return p(d,0,0,o),o.push("
"),o.join("")}var b={heading:function(s){var m=h.exec(s);if(m)return{type:"heading",raw:m[0],depth:m[1].length,text:m[2]}},fences:function(s){var m=this.rules.block.fences.exec(s);if(m){var U=m[0],K=w(U,m[3]||""),B=m[2]?m[2].trim():m[2];if(["latex","katex","math"].indexOf(B)>=0){var ce=u(),Oe=K;K=ce,a[ce]={type:"block",expression:Oe}}return{type:"code",raw:U,lang:B,text:K}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},a={};function x(){return a}function y(){c=0,a={}}function S(W){return W=W.replace(g,function(s,m){var U=u();return a[U]={type:"inline",expression:m},U}),W}var P=l.listitem;l.listitem=function(W){return P(S(W))};var G=l.paragraph;l.paragraph=function(W){return G(S(W))};var Y=l.tablecell;l.tablecell=function(W,s){return Y(S(W),s)},l.code=function(W,s,m){var U=(s||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"".concat(W,"
"):'
').concat(m?W:Object(E.escape)(W,!0),`
`):''+(m?W:Object(E.escape)(W,!0))+"
"},l.heading=function(W,s,m){var U=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:U,level:s,text:W}),"'+W+""},A.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),A.a.use({tokenizer:b,renderer:l});var Q=A.a,z=ie("SJMd"),j=ie("ulZh"),ee=ie.n(j),oe=ie("m3rI"),fe=ie("Oy/b"),ve=ie("p5ED"),Re=ie("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ee=function(W,s){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,U){m.__proto__=U}||function(m,U){for(var K in U)Object.prototype.hasOwnProperty.call(U,K)&&(m[K]=U[K])})(W,s)};function Se(W,s){function m(){this.constructor=W}Ee(W,s),W.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}function we(W,s,m,U){return new(m||(m=Promise))(function(K,B){function ce(pt){try{rt(U.next(pt))}catch(Ue){B(Ue)}}function Oe(pt){try{rt(U.throw(pt))}catch(Ue){B(Ue)}}function rt(pt){var Ue;pt.done?K(pt.value):(Ue=pt.value,Ue instanceof m?Ue:new m(function(wt){wt(Ue)})).then(ce,Oe)}rt((U=U.apply(W,s||[])).next())})}function Te(W,s){var m,U,K,B,ce={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return B={next:Oe(0),throw:Oe(1),return:Oe(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function Oe(rt){return function(pt){return function(Ue){if(m)throw new TypeError("Generator is already executing.");for(;ce;)try{if(m=1,U&&(K=2&Ue[0]?U.return:Ue[0]?U.throw||((K=U.return)&&K.call(U),0):U.next)&&!(K=K.call(U,Ue[1])).done)return K;switch(U=0,K&&(Ue=[2&Ue[0],K.value]),Ue[0]){case 0:case 1:K=Ue;break;case 4:return ce.label++,{value:Ue[1],done:!1};case 5:ce.label++,U=Ue[1],Ue=[0];continue;case 7:Ue=ce.ops.pop(),ce.trys.pop();continue;default:if(!(K=ce.trys,(K=K.length>0&&K[K.length-1])||Ue[0]!==6&&Ue[0]!==2)){ce=0;continue}if(Ue[0]===3&&(!K||Ue[1]>K[0]&&Ue[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(B){var ce=document.createElement("div");ce.className=""+m.toolbarButtonStyleClass.name,ce.setAttribute("data-type-name",B.typeName),ce.innerHTML=B.icon,ce.addEventListener("click",function(){m.markerToolbarButtonClicked(ce,B)}),m.buttons.push(ce),m.markerButtons.push(ce)}),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 K=document.createElement("div");K.className=this.toolbarBlockStyleClass.name,K.style.whiteSpace="nowrap",K.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(K),this.addActionButton(K,'',"render"),this.addActionButton(K,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},W.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},W.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},W.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},W.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var m=0;m0&&this.buttonClickListeners.forEach(function(U){return U("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},W.prototype.actionToolbarButtonClicked=function(s,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},W.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},W.prototype.setActiveMarkerButton=function(s){var m=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===s});m&&this.setActiveButton(m)},W.prototype.setCurrentMarker=function(s){var m=this;this.currentMarker=s,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){m.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},W}(),je=function(){function W(s,m,U,K){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=m,this.uiStyleSettings=U,this.styles=K,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return W.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ae("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ae("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ae("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 Ae("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ae("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
padding: `+m+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Ye("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Ye("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},W.prototype.show=function(s){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},W.prototype.setPanelButtons=function(s){var m,U,K=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m: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(B){var ce;B.uiStyleSettings=K.uiStyleSettings;var Oe=document.createElement("div");Oe.className=K.toolboxButtonStyleClass.name+" "+((ce=K.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ce!==void 0?ce:K.toolboxButtonStyleColorsClass.name),Oe.innerHTML=B.icon,Oe.title=B.title,Oe.addEventListener("click",function(){K.panelButtonClick(B)}),K.panelButtons.push(Oe),K.buttonRow.appendChild(Oe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},W.prototype.panelButtonClick=function(s){var m=this,U=-1;if(s!==this.activePanel){U=this.panels.indexOf(s),this.panelRow.innerHTML="";var K=s.getUi();K.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(K),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(B,ce){var Oe,rt;B.className=m.toolboxButtonStyleClass.name+" "+(ce===U?""+((Oe=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:m.toolboxActiveButtonStyleColorsClass.name):""+((rt=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&rt!==void 0?rt:m.toolboxButtonStyleColorsClass.name))})},W}(),et=function(W,s){this.title=W,this.icon=s},Xe=function(W){function s(m,U,K,B){var ce=W.call(this,m,B||'')||this;return ce.colors=[],ce.addTransparent=!1,ce.colorBoxes=[],ce.colors=U,ce.currentColor=K,ce.setCurrentColor=ce.setCurrentColor.bind(ce),ce.getColorBox=ce.getColorBox.bind(ce),ce}return Se(s,W),s.prototype.getUi=function(){var m=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(K){var B=m.getColorBox(K);U.appendChild(B),m.colorBoxes.push(B)}),U},s.prototype.getColorBox=function(m){var U=this,K=this.uiStyleSettings.toolbarHeight/4,B=this.uiStyleSettings.toolbarHeight-K,ce=document.createElement("div");ce.style.display="inline-block",ce.style.boxSizing="content-box",ce.style.width=B-2+"px",ce.style.height=B-2+"px",ce.style.padding="1px",ce.style.marginRight="2px",ce.style.marginBottom="2px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderRadius=(B+2)/2+"px",ce.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){U.setCurrentColor(m,ce)});var Oe=document.createElement("div");return Oe.style.display="inline-block",Oe.style.width=B-2+"px",Oe.style.height=B-2+"px",Oe.style.backgroundColor=m,Oe.style.borderRadius=B/2+"px",m==="transparent"&&(Oe.style.fill=this.uiStyleSettings.toolboxAccentColor,Oe.innerHTML=``),ce.appendChild(Oe),ce},s.prototype.setCurrentColor=function(m,U){var K=this;this.currentColor=m,this.colorBoxes.forEach(function(B){B.style.borderColor=B===U?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},s}(et),Ne=function(){function W(s,m,U){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=m,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(W.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),W.prototype.ownsTarget=function(s){return!1},Object.defineProperty(W.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),W.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},W.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},W.prototype.pointerDown=function(s,m){},W.prototype.dblClick=function(s,m){},W.prototype.manipulate=function(s){},W.prototype.pointerUp=function(s){this.stateChanged()},W.prototype.dispose=function(){},W.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},W.prototype.getState=function(){return{typeName:W.typeName,state:this.state,notes:this.notes}},W.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},W.prototype.scale=function(s,m){},W.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},W.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},W.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},W.typeName="MarkerBase",W}(),Be=function(){function W(){this.findGripByVisual=this.findGripByVisual.bind(this)}return W.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},W}(),ht=function(){function W(){this.GRIP_SIZE=10,this.visual=de.createGroup(),this.visual.appendChild(de.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(de.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return W.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},W}(),We=function(){function W(){}return W.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},W.toSVGMatrix=function(s,m){return s.a=m.a,s.b=m.b,s.c=m.c,s.d=m.d,s.e=m.e,s.f=m.f,s},W}(),Pe=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.left=0,B.top=0,B.width=0,B.height=0,B.defaultSize={x:50,y:20},B.offsetX=0,B.offsetY=0,B.rotationAngle=0,B.CB_DISTANCE=10,B._suppressMarkerCreateEvent=!1,B.container.transform.baseVal.appendItem(de.createTransform()),B.setupControlBox(),B}return Se(s,W),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(m){this._visual=m;var U=de.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(m){return!!W.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var K=this.unrotatePoint(m);if(this.manipulationStartX=K.x,this.manipulationStartY=K.y,this.offsetX=K.x-this.left,this.offsetY=K.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 B=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=B.x-this.width/2,this.top=B.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ce=this.container.transform.baseVal.getItem(0);ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(m){var U=this.state;W.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},s.prototype.manipulate=function(m){var U=this.unrotatePoint(m);this.state==="creating"?this.resize(m):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(m)},s.prototype.resize=function(m){var U=this.manipulationStartLeft,K=this.manipulationStartWidth,B=this.manipulationStartTop,ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+m.x-this.manipulationStartX,K=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:K=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:B=this.manipulationStartTop+m.y-this.manipulationStartY,ce=this.manipulationStartHeight+this.manipulationStartTop-B;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ce=this.manipulationStartHeight+m.y-this.manipulationStartY}K>=0?(this.left=U,this.width=K):(this.left=U+K,this.width=-K),ce>=0?(this.top=B,this.height=ce):(this.top=B+ce,this.height=-ce),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var U=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},s.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},s.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var U=this.container.getCTM(),K=de.createPoint(m.x,m.y);return{x:(K=K.matrixTransform(U)).x,y:K.y}},s.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var U=this.container.getCTM();U=U.inverse();var K=de.createPoint(m.x,m.y);return{x:(K=K.matrixTransform(U)).x,y:K.y}},s.prototype.select=function(){W.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){W.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=de.createGroup();var m=de.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),this.container.appendChild(this.controlBox),this.controlRect=de.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=de.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Be,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},s.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},s.prototype.createGrip=function(){var m=new ht;return m.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(m.visual),m},s.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,U=-m/2,K=U,B=(this.width+this.CB_DISTANCE)/2-m/2,ce=(this.height+this.CB_DISTANCE)/2-m/2,Oe=this.height+this.CB_DISTANCE-m/2,rt=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,U,K),this.positionGrip(this.controlGrips.topCenter.visual,B,K),this.positionGrip(this.controlGrips.topRight.visual,rt,K),this.positionGrip(this.controlGrips.centerLeft.visual,U,ce),this.positionGrip(this.controlGrips.centerRight.visual,rt,ce),this.positionGrip(this.controlGrips.bottomLeft.visual,U,Oe),this.positionGrip(this.controlGrips.bottomCenter.visual,B,Oe),this.positionGrip(this.controlGrips.bottomRight.visual,rt,Oe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,B,K-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(m,U,K){var B=m.transform.baseVal.getItem(0);B.setTranslate(U,K),m.transform.baseVal.replaceItem(B,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:We.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:We.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},W.prototype.getState.call(this))},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var U=m;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(We.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(We.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},s.prototype.scale=function(m,U){W.prototype.scale.call(this,m,U);var K=this.rotatePoint({x:this.left,y:this.top}),B=this.unrotatePoint({x:K.x*m,y:K.y*U});this.left=B.x,this.top=B.y,this.width=this.width*m,this.height=this.height*U,this.adjustControlBox()},s}(Ne),Ke=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.createVisual=B.createVisual.bind(B),B}return Se(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual)},s.prototype.createVisual=function(){this.visual=de.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.manipulate=function(m){W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.setSize()},s.prototype.setSize=function(){W.prototype.setSize.call(this),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(m){W.prototype.pointerUp.call(this,m),this.setSize()},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},s.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},W.prototype.getState.call(this))},s.prototype.restoreState=function(m){var U=m;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),W.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,U){W.prototype.scale.call(this,m,U),this.setSize()},s.title="Rectangle marker",s}(Pe),qe=function(W){function s(m,U,K,B){var ce=W.call(this,m,B||'')||this;return ce.widths=[],ce.widthBoxes=[],ce.widths=U,ce.currentWidth=K,ce.setCurrentWidth=ce.setCurrentWidth.bind(ce),ce}return Se(s,W),s.prototype.getUi=function(){var m=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(K){var B=document.createElement("div");B.style.display="flex",B.style.flexGrow="2",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=K===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){m.setCurrentWidth(K,B)}),U.appendChild(B);var ce=document.createElement("div");ce.innerText=K.toString(),ce.style.marginRight="5px",B.appendChild(ce);var Oe=document.createElement("div");Oe.style.minHeight="20px",Oe.style.flexGrow="2",Oe.style.display="flex",Oe.style.alignItems="center";var rt=document.createElement("hr");rt.style.minWidth="20px",rt.style.border="0px",rt.style.borderTop=K+"px solid "+m.uiStyleSettings.toolboxColor,rt.style.flexGrow="2",Oe.appendChild(rt),B.appendChild(Oe),m.widthBoxes.push(B)}),U},s.prototype.setCurrentWidth=function(m,U){var K=this;this.currentWidth=m,this.widthBoxes.forEach(function(B){B.style.borderColor=B===U?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(et),Ve=function(W){function s(m,U,K,B){var ce=W.call(this,m,B||'')||this;return ce.styles=[],ce.styleBoxes=[],ce.styles=U,ce.currentStyle=K,ce.setCurrentStyle=ce.setCurrentStyle.bind(ce),ce}return Se(s,W),s.prototype.getUi=function(){var m=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(K){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/m.styles.length-5+"%",B.style.borderColor=K===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){m.setCurrentStyle(K,B)}),U.appendChild(B);var ce=document.createElement("div");ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.overflow="hidden";var Oe=``;ce.innerHTML=Oe,B.appendChild(ce),m.styleBoxes.push(B)}),U},s.prototype.setCurrentStyle=function(m,U){var K=this;this.currentStyle=m,this.styleBoxes.forEach(function(B){B.style.borderColor=B===U?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(et),it=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.strokeColor=K.defaultColor,B.strokeWidth=K.defaultStrokeWidth,B.strokeDasharray=K.defaultStrokeDasharray,B.strokePanel=new Xe("Line color",K.defaultColorSet,K.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new qe("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new Ve("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Se(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="FrameMarker",s.title="Frame marker",s.icon='',s}(Ke),Ce=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},tt=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.x1=0,B.y1=0,B.x2=0,B.y2=0,B.defaultLength=50,B.manipulationStartX=0,B.manipulationStartY=0,B.manipulationStartX1=0,B.manipulationStartY1=0,B.manipulationStartX2=0,B.manipulationStartY2=0,B.setupControlBox(),B}return Se(s,W),s.prototype.ownsTarget=function(m){return!!W.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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")},s.prototype.pointerUp=function(m){var U=this.state;W.prototype.pointerUp.call(this,m),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(m),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},s.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){W.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){W.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=de.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var m=new ht;return m.visual.transform.baseVal.appendItem(de.createTransform()),this.controlBox.appendChild(m.visual),m},s.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},s.prototype.positionGrip=function(m,U,K){var B=m.transform.baseVal.getItem(0);B.setTranslate(U,K),m.transform.baseVal.replaceItem(B,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},W.prototype.getState.call(this))},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var U=m;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},s.prototype.scale=function(m,U){W.prototype.scale.call(this,m,U),this.x1=this.x1*m,this.y1=this.y1*U,this.x2=this.x2*m,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},s}(Ne),nt=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.strokeColor=K.defaultColor,B.strokeWidth=K.defaultStrokeWidth,B.strokeDasharray=K.defaultStrokeDasharray,B.strokePanel=new Xe("Line color",K.defaultColorSet,K.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new qe("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new Ve("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Se(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorLine=de.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=de.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),de.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var U=m;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='',s}(tt),Le=function(W){function s(m,U,K,B){var ce=W.call(this,m,B||'')||this;return ce.fonts=[],ce.fontBoxes=[],ce.fonts=U,ce.currentFont=K,ce.setCurrentFont=ce.setCurrentFont.bind(ce),ce}return Se(s,W),s.prototype.getUi=function(){var m=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(K){var B=document.createElement("div");B.style.display="inline-block",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/m.fonts.length-5+"%",B.style.borderColor=K===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){m.setCurrentFont(K,B)}),U.appendChild(B);var ce=document.createElement("div");ce.style.display="flex",ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.fontFamily=K,ce.style.overflow="hidden";var Oe=document.createElement("div");Oe.style.whiteSpace="nowrap",Oe.style.overflow="hidden",Oe.style.textOverflow="ellipsis",Oe.innerHTML="The quick brown fox jumps over the lazy dog",ce.appendChild(Oe),B.appendChild(ce),m.fontBoxes.push(B)}),U},s.prototype.setCurrentFont=function(m,U){var K=this;this.currentFont=m,this.fontBoxes.forEach(function(B){B.style.borderColor=B===U?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(et),Ie=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.color="transparent",B.padding=5,B.DEFAULT_TEXT="your text here",B.text=B.DEFAULT_TEXT,B.isMoved=!1,B.color=K.defaultColor,B.fontFamily=K.defaultFontFamily,B.defaultSize={x:100,y:30},B.setColor=B.setColor.bind(B),B.setFont=B.setFont.bind(B),B.renderText=B.renderText.bind(B),B.sizeText=B.sizeText.bind(B),B.textEditDivClicked=B.textEditDivClicked.bind(B),B.showTextEditor=B.showTextEditor.bind(B),B.setSize=B.setSize.bind(B),B.positionTextEditor=B.positionTextEditor.bind(B),B.colorPanel=new Xe("Color",K.defaultColorSet,K.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.fontFamilyPanel=new Le("Font",K.defaultFontFamilies,K.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B}return Se(s,W),s.prototype.ownsTarget=function(m){if(W.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(K){K===m&&(U=!0)}),U},s.prototype.createVisual=function(){this.visual=de.createGroup(),this.bgRectangle=de.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=de.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.textElement.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.renderText=function(){var m=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){m.textElement.appendChild(de.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var m=this.textElement.getBBox(),U=1;if(m.width>0&&m.height>0){var K=(1*this.width-this.width*this.padding*2/100)/m.width,B=(1*this.height-this.height*this.padding*2/100)/m.height;U=Math.min(K,B)}return U},s.prototype.getTextPosition=function(m){var U=this.textElement.getBBox(),K=0,B=0;return U.width>0&&U.height>0&&(K=(this.width-U.width*m)/2,B=this.height/2-U.height*m/2),{x:K,y:B}},s.prototype.sizeText=function(){var m=this.textElement.getBBox(),U=this.getTextScale(),K=this.getTextPosition(U);K.y-=m.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+K.x+"px, "+K.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(K.x,K.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},s.prototype.manipulate=function(m){W.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){W.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(m){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),W.prototype.pointerUp.call(this,m),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var m=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(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&U>.9;)U-=.1,m.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 K=U.clipboardData.getData("text"),B=window.getSelection();if(!B.rangeCount)return!1;B.deleteFromDocument(),B.getRangeAt(0).insertNode(document.createTextNode(K)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var m=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),K=this.textElement.getBBox(),B={x:K.width*m,y:K.height*m};U.x-=B.x/2,U.y-=B.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*m,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){W.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),W.prototype.deselect.call(this)},s.prototype.dblClick=function(m,U){W.prototype.dblClick.call(this,m,U),this.showTextEditor()},s.prototype.setColor=function(m){this.textElement&&de.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},s.prototype.setFont=function(m){this.textElement&&de.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var U=m;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),W.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,U){W.prototype.scale.call(this,m,U),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='',s}(Pe),pe=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.color="transparent",B.lineWidth=3,B.drawing=!1,B.pixelRatio=1,B.color=K.defaultColor,B.lineWidth=K.defaultStrokeWidth,B.pixelRatio=K.freehandPixelRatio,B.setColor=B.setColor.bind(B),B.addCanvas=B.addCanvas.bind(B),B.finishCreation=B.finishCreation.bind(B),B.setLineWidth=B.setLineWidth.bind(B),B.colorPanel=new Xe("Color",K.defaultColorSet,K.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.lineWidthPanel=new qe("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),B.lineWidthPanel.onWidthChanged=B.setLineWidth,B}return Se(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=de.createGroup(),this.drawingImage=de.createImage(),this.visual.appendChild(this.drawingImage);var m=de.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,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(m.x,m.y),this.drawing=!0):W.prototype.pointerDown.call(this,m,U)},s.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),de.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):W.prototype.pointerUp.call(this,m)},s.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),W.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),W.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],K=U[0],B=U[1],ce=U[2],Oe=U[3],rt=!1,pt=0;pt0&&(rt=!0,ptOe&&(Oe=pt),Ue>ce&&(ce=Ue));if(rt){this.left=K/this.pixelRatio,this.top=B/this.pixelRatio,this.width=(ce-K)/this.pixelRatio,this.height=(Oe-B)/this.pixelRatio;var wt=document.createElement("canvas");wt.width=ce-K,wt.height=Oe-B,wt.getContext("2d").putImageData(this.canvasContext.getImageData(K,B,ce-K,Oe-B),0,0),this.drawingImgUrl=wt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){de.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),de.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},s.prototype.setLineWidth=function(m){this.lineWidth=m},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({drawingImgUrl:this.drawingImgUrl},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){this.createVisual(),W.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(m,U){W.prototype.scale.call(this,m,U),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='',s}(Pe),le=function(W){function s(m,U,K){var B=W.call(this,m,K||'')||this;return B.typeBoxes=[],B.currentType=U,B.setCurrentType=B.setCurrentType.bind(B),B}return Se(s,W),s.prototype.getUi=function(){var m=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var K=function(Oe){var rt="both";switch(Oe){case 0:rt="both";break;case 1:rt="start";break;case 2:rt="end";break;case 3:rt="none"}var pt=document.createElement("div");if(pt.style.display="flex",pt.style.flexGrow="2",pt.style.alignItems="center",pt.style.justifyContent="space-between",pt.style.padding="5px",pt.style.borderWidth="2px",pt.style.borderStyle="solid",pt.style.borderColor=rt===B.currentType?B.uiStyleSettings.toolboxAccentColor:"transparent",pt.addEventListener("click",function(){m.setCurrentType(rt,pt)}),U.appendChild(pt),rt==="both"||rt==="start"){var Ue=document.createElement("div");Ue.style.display="flex",Ue.style.alignItems="center",Ue.style.minHeight="20px",Ue.innerHTML=``,Ue.style.marginLeft="5px",pt.appendChild(Ue)}var wt=document.createElement("div");wt.style.display="flex",wt.style.alignItems="center",wt.style.minHeight="20px",wt.style.flexGrow="2";var It=document.createElement("hr");if(It.style.minWidth="20px",It.style.border="0px",It.style.borderTop="3px solid "+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee"),It.style.flexGrow="2",wt.appendChild(It),pt.appendChild(wt),rt==="both"||rt==="end"){var $t=document.createElement("div");$t.style.display="flex",$t.style.alignItems="center",$t.style.minHeight="20px",$t.innerHTML=``,$t.style.marginRight="5px",pt.appendChild($t)}B.typeBoxes.push(pt)},B=this,ce=0;ce<4;ce++)K(ce);return U},s.prototype.setCurrentType=function(m,U){var K=this;this.currentType=m,this.typeBoxes.forEach(function(B){B.style.borderColor=B===U?K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(et),ue=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.arrowType="end",B.arrowBaseHeight=10,B.arrowBaseWidth=10,B.getArrowPoints=B.getArrowPoints.bind(B),B.setArrowType=B.setArrowType.bind(B),B.arrowTypePanel=new le("Arrow type","end"),B.arrowTypePanel.onArrowTypeChanged=B.setArrowType,B}return Se(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},s.prototype.getArrowPoints=function(m,U){var K=this.arrowBaseWidth+2*this.strokeWidth,B=this.arrowBaseHeight+2*this.strokeWidth;return m-K/2+","+(U+B/2)+" "+m+","+(U-B/2)+" "+(m+K/2)+","+(U+B/2)},s.prototype.createTips=function(){this.arrow1=de.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=de.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(de.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(W.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",de.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),de.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var m=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(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var K=this.arrow2.transform.baseVal.getItem(0);K.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(K,0)}},s.prototype.setArrowType=function(m){this.arrowType=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({arrowType:this.arrowType},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var U=m;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='',s}(nt),te=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.fillColor=K.defaultFillColor,B.strokeWidth=0,B.fillPanel=new Xe("Color",K.defaultColorSet,K.defaultFillColor),B.fillPanel.onColorChanged=B.setFillColor,B}return Se(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="CoverMarker",s.title="Cover marker",s.icon='',s}(Ke),q=function(W){function s(m,U,K,B){var ce=W.call(this,m,B||'')||this;return ce.opacities=[],ce.opacityBoxes=[],ce.opacities=U,ce.currentOpacity=K,ce.setCurrentOpacity=ce.setCurrentOpacity.bind(ce),ce}return Se(s,W),s.prototype.getUi=function(){var m=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(K){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=K===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){m.setCurrentOpacity(K,B)}),U.appendChild(B);var ce=document.createElement("div");ce.innerText=100*K+"%",B.appendChild(ce),m.opacityBoxes.push(B)}),U},s.prototype.setCurrentOpacity=function(m,U){var K=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(B){B.style.borderColor=B===U?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(et),re=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.setOpacity=B.setOpacity.bind(B),B.fillColor=K.defaultHighlightColor,B.strokeWidth=0,B.opacity=K.defaultHighlightOpacity,B.fillPanel=new Xe("Color",K.defaultColorSet,B.fillColor),B.fillPanel.onColorChanged=B.setFillColor,B.opacityPanel=new q("Opacity",K.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Se(s,W),s.prototype.setOpacity=function(m){this.opacity=m,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='',s}(te),ne='',ye=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.bgColor="transparent",B.tipPosition={x:0,y:0},B.tipBase1Position={x:0,y:0},B.tipBase2Position={x:0,y:0},B.tipMoving=!1,B.color=K.defaultStrokeColor,B.bgColor=K.defaultFillColor,B.fontFamily=K.defaultFontFamily,B.defaultSize={x:100,y:30},B.setBgColor=B.setBgColor.bind(B),B.getTipPoints=B.getTipPoints.bind(B),B.positionTip=B.positionTip.bind(B),B.setTipPoints=B.setTipPoints.bind(B),B.colorPanel=new Xe("Text color",K.defaultColorSet,B.color,''),B.colorPanel.onColorChanged=B.setColor,B.bgColorPanel=new Xe("Fill color",K.defaultColorSet,B.bgColor,ne),B.bgColorPanel.onColorChanged=B.setBgColor,B.fontFamilyPanel=new Le("Font",K.defaultFontFamilies,K.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B.tipGrip=new ht,B.tipGrip.visual.transform.baseVal.appendItem(de.createTransform()),B.controlBox.appendChild(B.tipGrip.visual),B}return Se(s,W),s.prototype.ownsTarget=function(m){return W.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},s.prototype.createTip=function(){de.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=de.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(m,U){this.state==="new"&&W.prototype.pointerDown.call(this,m,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):W.prototype.pointerDown.call(this,m,U)},s.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,W.prototype.pointerUp.call(this,m);else{var U=this.state==="creating";W.prototype.pointerUp.call(this,m),this.setTipPoints(U),this.positionTip()}},s.prototype.manipulate=function(m){if(this.tipMoving){var U=this.unrotatePoint(m);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else W.prototype.manipulate.call(this,m)},s.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(de.setAttributes(this.bgRectangle,[["fill",m]]),de.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},s.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},s.prototype.setTipPoints=function(m){m===void 0&&(m=!1);var U=Math.min(this.height/2,15),K=this.height/5;m&&(this.tipPosition={x:U+K/2,y:this.height+20});var B=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?B',s}(Ie),ge=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.strokeColor=K.defaultColor,B.strokeWidth=K.defaultStrokeWidth,B.strokeDasharray=K.defaultStrokeDasharray,B.fillColor=K.defaultFillColor,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.setOpacity=B.setOpacity.bind(B),B.createVisual=B.createVisual.bind(B),B.strokePanel=new Xe("Line color",me(K.defaultColorSet,["transparent"]),K.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.fillPanel=new Xe("Fill color",me(K.defaultColorSet,["transparent"]),B.fillColor,ne),B.fillPanel.onColorChanged=B.setFillColor,B.strokeWidthPanel=new qe("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new Ve("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B.opacityPanel=new q("Opacity",K.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Se(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual)},s.prototype.createVisual=function(){this.visual=de.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.manipulate=function(m){W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.setSize()},s.prototype.setSize=function(){W.prototype.setSize.call(this),de.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(m){W.prototype.pointerUp.call(this,m),this.setSize()},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&de.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},s.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&de.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&de.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&de.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(m){this.opacity=m,this.visual&&de.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var U=m;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),W.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,U){W.prototype.scale.call(this,m,U),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='',s}(Pe),_e=function(W){function s(m,U,K){return W.call(this,m,U,K)||this}return Se(s,W),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},s.prototype.createTips=function(){this.tip1=de.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(de.createTransform()),this.visual.appendChild(this.tip1),this.tip2=de.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(de.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(W.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(de.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()]]),de.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 m=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(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var K=this.tip2.transform.baseVal.getItem(0);K.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(K,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='',s}(nt),ze=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.strokePanel.colors=K.defaultColorSet,B.fillColor="transparent",B}return Se(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='',s}(ge),ft=function(){function W(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(W.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),W.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},W.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},W.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},W.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},W.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},W}(),lt=function(W){function s(m,U,K){var B=W.call(this,m,U,K)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.curveX=0,B.curveY=0,B.manipulationStartCurveX=0,B.manipulationStartCurveY=0,B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.positionGrips=B.positionGrips.bind(B),B.addControlGrips=B.addControlGrips.bind(B),B.adjustVisual=B.adjustVisual.bind(B),B.setupControlBox=B.setupControlBox.bind(B),B.resize=B.resize.bind(B),B.strokeColor=K.defaultColor,B.strokeWidth=K.defaultStrokeWidth,B.strokeDasharray=K.defaultStrokeDasharray,B.strokePanel=new Xe("Line color",K.defaultColorSet,K.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new qe("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new Ve("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Se(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=de.createGroup(),this.selectorCurve=de.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=de.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,U){W.prototype.pointerDown.call(this,m,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),de.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),de.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),de.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){W.prototype.setupControlBox.call(this),this.curveControlLine1=de.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=de.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,W.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){W.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},s.prototype.manipulate=function(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),W.prototype.resize.call(this,m),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},s.prototype.scale=function(m,U){this.curveX=this.curveX*m,this.curveY=this.curveY*U,W.prototype.scale.call(this,m,U)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var U=m;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='',s}(tt),At=function(){function W(s,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=m}return Object.defineProperty(W.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),W.prototype.preventDefault=function(){this._defaultPrevented=!0},W}(),Et=function(W){function s(m,U,K){var B=W.call(this,m,!1)||this;return B.dataUrl=U,B.state=K,B}return Se(s,W),s}(At),$e=function(W){function s(m,U,K){K===void 0&&(K=!1);var B=W.call(this,m,K)||this;return B.marker=U,B}return Se(s,W),s}(At),Rt=function(){function W(){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 W.prototype.addEventListener=function(s,m){this[s].push(m)},W.prototype.removeEventListener=function(s,m){var U=this[s].indexOf(m);U>-1&&this[s].splice(U,1)},W}(),yt=function(){function W(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ce,this._isOpen=!1,this.undoRedoManager=new ft,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=W.instanceCounter++,this.styles=new Qe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(W.prototype,"ALL_MARKER_TYPES",{get:function(){return[it,pe,ue,Ie,ze,ge,re,ye,_e,te,nt,lt]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[it,pe,ue,Ie,ge,re,ye]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"BASIC_MARKER_TYPES",{get:function(){return[it,pe,ue,Ie,re]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var m=this;this._availableMarkerTypes.splice(0),s.forEach(function(U){if(typeof U=="string"){var K=m.ALL_MARKER_TYPES.find(function(B){return B.typeName===U});K!==void 0&&m._availableMarkerTypes.push(K)}else m._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),W.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),ke.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},W.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&Ge.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ge.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new At(s))})},W.prototype.render=function(){return we(this,void 0,void 0,function(){var s;return Te(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(s=new Je).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return m.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},W.prototype.close=function(s){var m=this;if(s===void 0&&(s=!1),this.isOpen){var U=!1;s||this.eventListeners.beforeclose.forEach(function(K){var B=new At(m,!0);K(B),B.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(K){return K(new At(m))}),this.detachEvents(),this._isOpen=!1)}},W.prototype.addMarkersToToolbar=function(){for(var s,m=[],U=0;Uthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,U=m',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},W.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")},W.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"},W.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},W.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Me(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(s),1),s.dispose()},W.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())},W.prototype.toolbarButtonClicked=function(s,m){if(s==="marker"&&m!==void 0)this.createNewMarker(m);else if(s==="action")switch(m){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()}},W.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(K){var B=new $e(s,s._currentMarker,!0);K(B),B.defaultPrevented&&(m=!0)}),!m){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(K){return K(new $e(s,U))})}}},W.prototype.clear=function(){var s=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ce){var Oe=new $e(s,void 0,!0);ce(Oe),Oe.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var U=function(ce){var Oe=K.markers[ce];K.setCurrentMarker(K.markers[ce]),K._currentMarker.dispose(),K.markerImage.removeChild(K._currentMarker.container),K.markers.splice(K.markers.indexOf(K._currentMarker),1),K.eventListeners.markerdelete.forEach(function(rt){return rt(new $e(s,Oe))})},K=this,B=this.markers.length-1;B>=0;B--)U(B);this.addUndoStep()}},Object.defineProperty(W.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),W.prototype.showNotesEditor=function(){var s;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},W.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)},W.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},W.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===m.width&&U.height===m.height){var K=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),K1&&this.panTo({x:s.clientX,y:s.clientY}))},W.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},W.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},W.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},W.prototype.clientToLocalCoordinates=function(s,m){var U=this.markerImage.getBoundingClientRect();return{x:(s-U.left)/this.zoomLevel,y:(m-U.top)/this.zoomLevel}},W.prototype.onWindowResize=function(){this.positionUI()},W.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},W.prototype.addLicenseKey=function(s){ke.addKey(s)},W.prototype.addEventListener=function(s,m){this.eventListeners.addEventListener(s,m)},W.prototype.removeEventListener=function(s,m){this.eventListeners.removeEventListener(s,m)},W.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(W.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),W.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(m){return m(new At(s))}))},W.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new At(s))}))},W.instanceCounter=0,W}();/* **********************************
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 Ot=function(W,s){return(Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,U){m.__proto__=U}||function(m,U){for(var K in U)Object.prototype.hasOwnProperty.call(U,K)&&(m[K]=U[K])})(W,s)};function Lt(W,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function m(){this.constructor=W}Ot(W,s),W.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}function Tt(W,s,m,U){return new(m||(m=Promise))(function(K,B){function ce(pt){try{rt(U.next(pt))}catch(Ue){B(Ue)}}function Oe(pt){try{rt(U.throw(pt))}catch(Ue){B(Ue)}}function rt(pt){var Ue;pt.done?K(pt.value):(Ue=pt.value,Ue instanceof m?Ue:new m(function(wt){wt(Ue)})).then(ce,Oe)}rt((U=U.apply(W,s||[])).next())})}function wr(W,s){var m,U,K,B,ce={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return B={next:Oe(0),throw:Oe(1),return:Oe(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function Oe(rt){return function(pt){return function(Ue){if(m)throw new TypeError("Generator is already executing.");for(;ce;)try{if(m=1,U&&(K=2&Ue[0]?U.return:Ue[0]?U.throw||((K=U.return)&&K.call(U),0):U.next)&&!(K=K.call(U,Ue[1])).done)return K;switch(U=0,K&&(Ue=[2&Ue[0],K.value]),Ue[0]){case 0:case 1:K=Ue;break;case 4:return ce.label++,{value:Ue[1],done:!1};case 5:ce.label++,U=Ue[1],Ue=[0];continue;case 7:Ue=ce.ops.pop(),ce.trys.pop();continue;default:if(!(K=ce.trys,(K=K.length>0&&K[K.length-1])||Ue[0]!==6&&Ue[0]!==2)){ce=0;continue}if(Ue[0]===3&&(!K||Ue[1]>K[0]&&Ue[1]0&&m>0){var U=new Jt(s,m),K=U.ratio>=1?20:U.getHorizontalLength(20),B=U.ratio<1?20:U.getVerticalLength(20),ce=document.createElementNS("http://www.w3.org/2000/svg","svg");ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),ce.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ce);var Oe=vt.createDefs();ce.appendChild(Oe);var rt=vt.createElement("clipPath",[["id","text-bg-clip"]]);Oe.appendChild(rt);var pt=vt.createPath(vt.getHollowRectanglePath((24-K)/2,(24-B)/2,K,B,(24-K)/2+2,(24-B)/2+2,K-4,B-4));ce.appendChild(pt);var Ue=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ue.appendChild(vt.createTSpan(s+":"+m)),ce.appendChild(Ue);var wt=Ue.getBBox();vt.setAttributes(Ue,[["x",((24-wt.width)/2).toString()],["y",((24-wt.height)/2-wt.y).toString()]]);var It=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(wt.width))/2,(24-Math.ceil(wt.height))/2,Math.ceil(wt.width),Math.ceil(wt.height)));return rt.appendChild(It),vt.setAttributes(pt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ce),ce.outerHTML}return''},W}(),Ut=function(W){function s(m,U,K){var B=W.call(this,m,U)||this;return B.isDropdownOpen=!1,B.onClick=B.dropdownButtonClicked,B.dropdownButtons=K,B}return Lt(s,W),s.prototype.setupDropdown=function(){var m=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=m.className,U.colorsClassName=m.colorsClassName,m.dropdownBlock.appendChild(U.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(ct),kt=function(){function W(s,m){this.GRIP_SIZE=10,this.color=s,this.fillColor=m,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 W.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},W.prototype.setCenter=function(s,m){this.visual.childNodes.forEach(function(U){return vt.setAttributes(U,[["cx",s.toString()],["cy",m.toString()]])})},W}(),Gt=function(){function W(s,m,U,K){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=m,this.margin=U,this.container=K,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(W.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),W.prototype.open=function(){var s=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var m=0;mthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-m.height/2),vt.setAttributes(this.cropRectElement,[["x",m.x.toString()],["y",m.y.toString()],["width",m.width.toString()],["height",m.height.toString()]]);var U=m.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(B,ce){var Oe=m.y+U*(ce+1);vt.setAttributes(B,[["x1",""+m.x],["y1",""+Oe],["x2",""+(m.x+m.width)],["y2",""+Oe]])});var K=m.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(B,ce){var Oe=m.x+K*(ce+1);vt.setAttributes(B,[["x1",""+Oe],["y1",""+m.y],["x2",""+Oe],["y2",""+(m.y+m.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,m.x,m.y,m.width,m.height)]]),this.topLeftGrip.setCenter(m.x,m.y),this.topRightGrip.setCenter(m.x+m.width,m.y),this.bottomLeftGrip.setCenter(m.x,m.y+m.height),this.bottomRightGrip.setCenter(m.x+m.width,m.y+m.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},W.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)},W.prototype.clientToLocalCoordinates=function(s,m){var U=this.container.getBoundingClientRect();return{x:s-U.left+this.margin,y:m-U.top+this.margin}},W.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},W.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var m=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(m)}s.preventDefault()},W.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},W.prototype.move=function(s){var m=s.x-this.previousPoint.x,U=s.y-this.previousPoint.y;this.zoomFactor!==1&&(m=-m/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+m),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=s},W.prototype.resize=function(s){var m=Object.assign({},this.cropRect),U=s.x-this.previousPoint.x,K=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:m.x+Uthis.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-m.width),m.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(m.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),m.height=this.aspectRatio.getVerticalLength(m.width)):(m.y+=K,m.height=this.cropRect.y+this.cropRect.height-m.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?m.height=this.aspectRatio.getVerticalLength(m.width):m.height+=K}m.width<10&&(m.x=this.cropRect.x,m.width=10),m.height<10&&(m.y=this.cropRect.y,m.height=10),this.previousPoint=s,m.x>=this.margin&&m.y>=this.margin&&m.x-this.margin+m.width<=this.canvasWidth&&m.y-this.margin+m.height<=this.canvasHeight&&(this.cropRect=m,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},W.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,m=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),K=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=s-this.cropRect.width/2,this.cropRect.y=m-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)}},W.prototype.getRescaledRect=function(s,m,U,K,B,ce){var Oe=U/s,rt=K/m;return{x:(B.x-ce)*Oe+ce,y:(B.y-ce)*rt+ce,width:B.width*Oe,height:B.height*rt}},W.prototype.scaleCanvas=function(s,m){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,m,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=m,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},W}(),Sr=function(){function W(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(W.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),W.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},W.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},W.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},W.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},W.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},W.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},W.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var m="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var K=U%5==0?this.height/3:this.height/6;m+="h4v"+-K+"h1v"+K}m+="v1H0Z",this.scaleShape=vt.createPath(m);var B=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(B),s.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ce=vt.createTSpan("");return ce.innerHTML="°",this.angleLabelElement.appendChild(ce),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},W}(),ui=function(){function W(){this.naturalSize=!1,this.imageType="image/png"}return W.prototype.rasterize=function(s,m,U,K,B,ce,Oe){var rt=this;return new Promise(function(pt){var Ue=document.createElement("canvas");Ue.width=s.width.baseVal.value-2*K,Ue.height=s.height.baseVal.value-2*K;var wt=1,It=1;rt.naturalSize===!0?(wt=m.naturalWidth/(s.width.baseVal.value-2*K)/ce,It=m.naturalHeight/(s.height.baseVal.value-2*K)/Oe,Ue.width=m.naturalWidth/ce,Ue.height=m.naturalHeight/Oe):rt.width!==void 0&&rt.height!==void 0&&(wt=rt.width/U.width,It=rt.height/U.height,Ue.width*=wt,Ue.height*=It);var $t=Ue.getContext("2d");$t.translate(Ue.width/2,Ue.height/2),$t.rotate(B*Math.PI/180),$t.scale(ce,Oe),$t.translate(-Ue.width/2,-Ue.height/2),$t.drawImage(m,0,0,Ue.width,Ue.height);var Wr=document.createElement("canvas");Wr.width=U.width*wt,Wr.height=U.height*It,Wr.getContext("2d").putImageData($t.getImageData((U.x-K)*wt,(U.y-K)*It,U.width*wt,U.height*It),0,0),pt(Wr.toDataURL(rt.imageType,rt.imageQuality))})},W}(),He=function(){function W(s){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=W.instanceCounter++,this.styles=new rr(this.instanceNo),this.target=s,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(W.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),W.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},W.prototype.show=function(){this.showUI(),this.open()},W.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(m){return m()}),this._isOpen=!1)},W.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},W.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},W.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},W.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},W.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},W.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,m=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=m+2*this.CANVAS_MARGINs+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=m+"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},W.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},W.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Nr,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 m=new Jr;m.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(m);var U=[];this.aspectRatios.forEach(function(It){var $t=new ct(jt.getIcon(It.horizontal,It.vertical),It.horizontal===0&&It.vertical===0?"FREE":It.horizontal+":"+It.vertical);$t.onClick=function(){return s.ratioButtonClicked(It)},U.push($t)}),this.aspectRatioButton=new Ut(jt.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,m.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var K=new ct('',"Toggle grid");K.isActive=this.isGridVisible,K.onClick=function(){s.isGridVisible=!s.isGridVisible,K.isActive=s.isGridVisible},m.addButton(K);var B=new ct('',"Zoom to selection");if(B.isActive=this.zoomToCropEnabled,B.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,B.isActive=s.zoomToCropEnabled},m.addButton(B),!fr.isLicensed){var ce=new st;this.topToolbar.addElementBlock(ce);var Oe=document.createElement("div");Oe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var rt=document.createElement("a");rt.style.color="currentColor",rt.href="https://markerjs.com/products/cropro",rt.target="_blank",rt.innerHTML='',Oe.appendChild(rt),ce.addElement(Oe)}var pt=new Jr;pt.minWidth=3*this.toolbarHeight+"px",pt.contentAlign="end",this.topToolbar.addButtonBlock(pt);var Ue=new ct('',"OK");Ue.onClick=this.startRenderAndClose,pt.addButton(Ue),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ue.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var wt=new ct('',"Close");wt.onClick=this.close,pt.addButton(wt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(wt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},W.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Nr,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 m=new Jr;m.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(m);var U=new ct('',"Rotate left");U.onClick=this.rotateLeftButtonClicked,m.addButton(U);var K=new ct('',"Rotate right");K.onClick=this.rotateRightButtonClicked,m.addButton(K);var B=new st;B.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(B),this.straightener=new Sr("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(pt){s.rotateBy(pt),s.straightener.angle=s.rotationAngle},B.addElement(this.straightener.getUI());var ce=new Jr;ce.minWidth=2*this.toolbarHeight+"px",ce.contentAlign="end",this.bottomToolbar.addButtonBlock(ce);var Oe=new ct('',"Flip horizontal");Oe.onClick=this.flipHorizontallyButtonClicked,ce.addButton(Oe);var rt=new ct('',"Flip vertical");rt.onClick=this.flipVerticallyButtonClicked,ce.addButton(rt)},W.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},W.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=jt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},W.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Jt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},W.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},W.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},W.prototype.restoreState=function(s){if(s){var m=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(m),this.cropRectChanged(m),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},W.prototype.clientToLocalCoordinates=function(s,m){var U=this.cropImage.getBoundingClientRect();return{x:s-U.left,y:m-U.top}},W.prototype.onWindowResize=function(){this.positionUI()},W.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},W.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},W.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},W.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},W.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},W.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var m=this.editingTargetRotationContainer.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(m,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=s},W.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},W.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},W.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},W.prototype.startRenderAndClose=function(){return Tt(this,void 0,void 0,function(){var s,m;return wr(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return s=U.sent(),m=this.getState(),this.renderEventListeners.forEach(function(K){return K(s,m)}),this.close(!0),[2]}})})},W.prototype.render=function(){return Tt(this,void 0,void 0,function(){var s;return wr(this,function(m){switch(m.label){case 0:return(s=new ui).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return m.sent(),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,m.sent()]}})})},W.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new or("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 or("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new or("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new or("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new or("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new or("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new ir("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new ir("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new or("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 or("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new or("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 or("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new or("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},W.instanceCounter=0,W}(),_t=ie("8hTe"),di=ie.n(_t),Ai=/]*>/g;function hi(W){var s=document.createElement("div");return s.innerHTML=W,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var _i=dt.a=function(W){var s=W.value,m=s===void 0?"":s,U=W.edit,K=U===void 0?!1:U,B=W.className,ce=W.showTextOnly,Oe=W.showLines,rt=W.replaces,pt=W.zoomImg,Ue=W.hasMask,wt=W.style,It=wt===void 0?{}:wt,$t=W.stylesPrev,Wr=$t===void 0?{}:$t,Hr=String(m),hr=Object(O.useRef)(),Yr=Object(O.useRef)(),Hi=Object(O.useState)(""),_r=Object(H.a)(Hi,2),Gr=_r[0],Ur=_r[1],gi=Object(O.useState)("office"),Qr=Object(H.a)(gi,2),ci=Qr[0],ni=Qr[1],hn=function(){var Wt=new He(Yr.current);Wt.displayMode="popup",Wt.addRenderEventListener(function(){var br=Object(D.a)(M.a.mark(function Ft(sr){var Kt;return M.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:return hr.current.style.display="none",nr.next=3,Object(Re.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:sr}});case 3:Kt=nr.sent,Kt!=null&&Kt.id&&rt(Yr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(Kt==null?void 0:Kt.id,"?type=").concat(Kt.content_type));case 5:case"end":return nr.stop()}},Ft)}));return function(Ft){return br.apply(this,arguments)}}()),Wt.show()},Gi=function(){var Wt=new yt(Yr.current);Wt.settings.displayMode="popup",Wt.addEventListener("render",function(){var br=Object(D.a)(M.a.mark(function Ft(sr){var Kt;return M.a.wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:if(hr.current.style.display="none",!Yr.current){nr.next=6;break}return nr.next=4,Object(Re.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:sr.dataUrl}});case 4:Kt=nr.sent,Kt!=null&&Kt.id&&rt(Yr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(Kt==null?void 0:Kt.id,"?type=").concat(Kt.content_type));case 6:case"end":return nr.stop()}},Ft)}));return function(Ft){return br.apply(this,arguments)}}()),Wt.show(),window.markerArea=Wt},qr=Object(O.useMemo)(function(){try{var er=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Wt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,br=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Hr=Hr.replace(er,"("+oe.a.API_SERVER+"/api/attachments/").replace(Wt,'"'+oe.a.API_SERVER+"/api/attachments/").replace(br,'"'+oe.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,`
`),Hr=Hr.replace(new RegExp("(?[TOC]
",_()),L()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(ai,nr){var Dr=sr[nr],zi=Dr.type,Ki=Dr.expression;return Object(fe.renderToString)(hi(Ki)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),y(),ce){var Kt=document.createElement("div");return Kt.innerHTML=Ft,Kt.innerText}return setTimeout(function(){return Ri()},500),Ft},[Hr]),zr=Object(O.useRef)();f.WebkitLineClamp=Oe,Oe&&(It=Object(I.a)(Object(I.a)({},It),f));function Di(er){var Wt=er.target;if(Wt.tagName.toUpperCase()==="IMG"){if(pt){var br=Wt.getAttribute("src");Ur(br),ni("image")}}else if(Wt.tagName.toUpperCase()==="A"){var Ft=Wt.getAttribute("href");if(Ft.indexOf("office")>-1)er.preventDefault(),Ur(Ft),ni("office");else if(Ft.indexOf("application/pdf")>-1)er.preventDefault(),Ur(Ft),ni("pdf");else if(Ft.indexOf("type=text")>-1)er.preventDefault(),Ur(Ft),ni("html");else if(Ft.startsWith("#")){er.preventDefault();var sr=document.getElementById(Ft.replace("#",""));sr&&sr.scrollIntoView(!0)}}}var Ri=function(){var Wt,br=(Wt=zr.current)===null||Wt===void 0?void 0:Wt.querySelectorAll("video");br==null||br.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if(ee.a.isSupported()){var sr=new ee.a;sr.loadSource(Ft.src),sr.attachMedia(Ft)}}})};Object(O.useEffect)(function(){if(zr.current&&qr&&(qr.match(Ai)&&window.PR.prettyPrint()),zr.current)return zr.current.addEventListener("click",Di),function(){zr.current.removeEventListener("click",Di),y(),L()}},[qr,zr.current,Di]);var cn=function(Wt){if(!K)return;Wt.target.nodeName==="IMG"?(hr.current.style.display="flex",hr.current.style.width=Wt.target.clientWidth+"px",hr.current.style.height=Wt.target.clientHeight+"px",hr.current.style.top=Wt.target.offsetTop+"px",hr.current.style.left=Wt.target.offsetLeft+"px",Yr.current.src=Wt.target.getAttribute("src")):hr.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:zr,style:Object(I.a)({},It),className:"".concat(B||""," markdown-body ").concat(di.a.mdBody),onMouseOver:cn,dangerouslySetInnerHTML:{__html:qr}}),v.a.createElement("div",{ref:hr,className:di.a.button},v.a.createElement(Z.a,null,v.a.createElement(X.a,{onClick:function(){return hn()}},"\u88C1\u526A"),v.a.createElement(X.a,{onClick:function(){return Gi()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:Yr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(ve.a,{close:!0,data:Gr,hasMask:Ue,type:Gr!=null&&Gr.length?ci:"",style:Object(I.a)({},Wr),onClose:function(){return Ur("")}}))}},"9VGf":function(Ct,dt,ie){"use strict";ie.d(dt,"a",function(){return R});var ae=ie("q1tI"),Z=ie.n(ae);function R(X,I){var D=Object(ae.useRef)();Object(ae.useEffect)(function(){D.current=X}),Object(ae.useEffect)(function(){function H(){D.current()}if(I!==null){var F=setInterval(H,I);return function(){return clearInterval(F)}}},[I])}},BU3w:function(Ct,dt,ie){"use strict";ie.d(dt,"a",function(){return D});var ae=ie("MNnm"),Z="rc-util-key";function R(H){if(H.attachTo)return H.attachTo;var F=document.querySelector("head");return F||document.body}function X(H){var F,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ae.a)())return null;var O=document.createElement("style");if((F=M.csp)===null||F===void 0?void 0:F.nonce){var v;O.nonce=(v=M.csp)===null||v===void 0?void 0:v.nonce}O.innerHTML=H;var C=R(M),k=C.firstChild;return M.prepend&&C.prepend?C.prepend(O):M.prepend&&k?C.insertBefore(O,k):C.appendChild(O),O}var I=new Map;function D(H,F){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=R(M);if(!I.has(O)){var v=X("",M),C=v.parentNode;I.set(O,C),C.removeChild(v)}var k=Array.from(I.get(O).children).find(function(o){return o.tagName==="STYLE"&&o[Z]===F});if(k){var A,E;if(((A=M.csp)===null||A===void 0?void 0:A.nonce)&&k.nonce!==((E=M.csp)===null||E===void 0?void 0:E.nonce)){var w;k.nonce=(w=M.csp)===null||w===void 0?void 0:w.nonce}return k.innerHTML!==H&&(k.innerHTML=H),k}var d=X(H,M);return d[Z]=F,d}},Bd2K:function(Ct,dt,ie){(function(ae){ae(ie("VrN/"),ie("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(M,O,v){if(v!=ae.Init&&v&&M.removeKeyMap("autoCloseTags"),!O)return;var C={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(C["'/'"]=function(k){return D(k)}),(typeof O!="object"||O.whenOpening!==!1)&&(C["'>'"]=function(k){return X(k)}),M.addKeyMap(C)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["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 X(M){if(M.getOption("disableInput"))return ae.Pass;for(var O=M.listSelections(),v=[],C=M.getOption("autoCloseTags"),k=0;kA.ch&&(l=l.slice(0,l.length-E.end+A.ch));var p=l.toLowerCase();if(!l||E.type=="string"&&(E.end!=A.ch||!/[\"\']/.test(E.string.charAt(E.string.length-1))||E.string.length==1)||E.type=="tag"&&o.close||E.string.indexOf("/")==A.ch-E.start-1||L&&H(L,p)>-1||F(M,w.mode.xmlCurrentContext&&w.mode.xmlCurrentContext(d)||[],l,A,!0))return ae.Pass;var _=typeof C=="object"&&C.emptyTags;if(_&&H(_,l)>-1){v[k]={text:"/>",newPos:ae.Pos(A.line,A.ch+2)};continue}var b=f&&H(f,p)>-1;v[k]={indent:b,text:">"+(b?`
`:"")+""+l+">",newPos:b?ae.Pos(A.line+1,0):ae.Pos(A.line,A.ch+1)}}for(var g=typeof C=="object"&&C.dontIndentOnAutoClose,k=O.length-1;k>=0;k--){var c=v[k];M.replaceRange(c.text,O[k].head,O[k].anchor,"+insert");var u=M.listSelections().slice(0);u[k]={head:c.newPos,anchor:c.newPos},M.setSelections(u),!g&&c.indent&&(M.indentLine(c.newPos.line,null,!0),M.indentLine(c.newPos.line+1,null,!0))}}function I(M,O){for(var v=M.listSelections(),C=[],k=O?"/":"",A=M.getOption("autoCloseTags"),E=typeof A=="object"&&A.dontIndentOnSlash,w=0;w"&&(L+=">"),C[w]=L}if(M.replaceSelections(C),v=M.listSelections(),!E)for(var w=0;w=0&&O[d]==v;d--)++w;C=E.to;for(var d=1;d0){for(var O=0;O1&&arguments[1]!==void 0?arguments[1]:"",O=[],v=0;vpe.length)&&(le=pe.length);for(var ue=0,te=new Array(le);ue=pe.length?{done:!0}:{done:!1,value:pe[te++]}}}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 ue=pe[Symbol.iterator](),ue.next.bind(ue)}function D(pe,le){return le={exports:{}},pe(le,le.exports),le.exports}var H=D(function(pe){function le(){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 ue(te){pe.exports.defaults=te}pe.exports={defaults:le(),getDefaults:le,changeDefaults:ue}}),F=H.defaults,M=H.getDefaults,O=H.changeDefaults,v=/[&<>"']/,C=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},w=function(le){return E[le]};function d(pe,le){if(le){if(v.test(pe))return pe.replace(C,w)}else if(k.test(pe))return pe.replace(A,w);return pe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(pe){return pe.replace(o,function(le,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var h=/(^|[^\[])\^/g;function L(pe,le){pe=pe.source||pe,le=le||"";var ue={replace:function(q,re){return re=re.source||re,re=re.replace(h,"$1"),pe=pe.replace(q,re),ue},getRegex:function(){return new RegExp(pe,le)}};return ue}var f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(pe,le,ue){if(pe){var te;try{te=decodeURIComponent(l(ue)).replace(f,"").toLowerCase()}catch(q){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}le&&!p.test(ue)&&(ue=a(le,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(q){return null}return ue}var b={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(pe,le){b[" "+pe]||(g.test(pe)?b[" "+pe]=pe+"/":b[" "+pe]=P(pe,"/",!0)),pe=b[" "+pe];var ue=pe.indexOf(":")===-1;return le.substring(0,2)==="//"?ue?le:pe.replace(c,"$1")+le:le.charAt(0)==="/"?ue?le:pe.replace(u,"$1")+le:pe+le}var x={exec:function(){}};function y(pe){for(var le=1,ue,te;le=0&&ye[_e]==="\\";)ge=!ge;return ge?"|":" |"}),te=ue.split(/ \|/),q=0;if(te.length>le)te.splice(le);else for(;te.length=te.length?q.slice(te.length):q}).join(`
`)}var Ee=function(){function pe(ue){this.options=ue||z}var le=pe.prototype;return le.space=function(te){var q=this.rules.block.newline.exec(te);if(q)return q[0].length>1?{type:"space",raw:q[0]}:{raw:`
`}},le.code=function(te,q){var re=this.rules.block.code.exec(te);if(re){var ne=q[q.length-1];if(ne&&ne.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var ye=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?ye:j(ye,`
`)}}},le.fences=function(te){var q=this.rules.block.fences.exec(te);if(q){var re=q[0],ne=Re(re,q[3]||"");return{type:"code",raw:re,lang:q[2]?q[2].trim():q[2],text:ne}}},le.heading=function(te){var q=this.rules.block.heading.exec(te);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},le.nptable=function(te){var q=this.rules.block.nptable.exec(te);if(q){var re={type:"table",header:ee(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
`):[],raw:q[0]};if(re.header.length===re.align.length){var ne=re.align.length,ye;for(ye=0;ye ?/gm,"");return{type:"blockquote",raw:q[0],text:re}}},le.list=function(te){var q=this.rules.block.list.exec(te);if(q){for(var re=q[0],ne=q[2],ye=ne.length>1,ge=ne[ne.length-1]===")",_e={type:"list",raw:re,ordered:ye,start:ye?+ne.slice(0,-1):"",loose:!1,items:[]},ze=q[0].match(this.rules.block.item),ft=!1,lt,At,Et,$e,Rt,yt,Ot,Lt=ze.length,Tt=0;Tt1||this.options.smartLists&&Et!==ne)&&($e=ze.slice(Tt+1).join(`
`),_e.raw=_e.raw.substring(0,_e.raw.length-$e.length),Tt=Lt-1)),Rt=ft||/\n\n(?!\s*$)/.test(lt),Tt!==Lt-1&&(ft=lt.charAt(lt.length-1)===`
`,Rt||(Rt=ft)),Rt&&(_e.loose=!0),yt=/^\[[ xX]\] /.test(lt),Ot=void 0,yt&&(Ot=lt[1]!==" ",lt=lt.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:re,task:yt,checked:Ot,loose:Rt,text:lt});return _e}},le.html=function(te){var q=this.rules.block.html.exec(te);if(q)return{type:this.options.sanitize?"paragraph":"html",raw:q[0],pre:!this.options.sanitizer&&(q[1]==="pre"||q[1]==="script"||q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):oe(q[0]):q[0]}},le.def=function(te){var q=this.rules.block.def.exec(te);if(q){q[3]&&(q[3]=q[3].substring(1,q[3].length-1));var re=q[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:q[0],href:q[2],title:q[3]}}},le.table=function(te){var q=this.rules.block.table.exec(te);if(q){var re={type:"table",header:ee(q[1].replace(/^ *| *\| *$/g,"")),align:q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:q[3]?q[3].replace(/\n$/,"").split(`
`):[]};if(re.header.length===re.align.length){re.raw=q[0];var ne=re.align.length,ye;for(ye=0;ye/i.test(ne[0])&&(q=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(ne[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ne[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:ne[0],inLink:q,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):oe(ne[0]):ne[0]}},le.link=function(te){var q=this.rules.inline.link.exec(te);if(q){var re=fe(q[2],"()");if(re>-1){var ne=q[0].indexOf("!")===0?5:4,ye=ne+q[1].length+re;q[2]=q[2].substring(0,re),q[0]=q[0].substring(0,ye).trim(),q[3]=""}var ge=q[2],_e="";if(this.options.pedantic){var ze=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ge);ze?(ge=ze[1],_e=ze[3]):_e=""}else _e=q[3]?q[3].slice(1,-1):"";ge=ge.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=ve(q,{href:ge&&ge.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},q[0]);return ft}},le.reflink=function(te,q){var re;if((re=this.rules.inline.reflink.exec(te))||(re=this.rules.inline.nolink.exec(te))){var ne=(re[2]||re[1]).replace(/\s+/g," ");if(ne=q[ne.toLowerCase()],!ne||!ne.href){var ye=re[0].charAt(0);return{type:"text",raw:ye,text:ye}}var ge=ve(re,ne,re[0]);return ge}},le.strong=function(te,q,re){re===void 0&&(re="");var ne=this.rules.inline.strong.start.exec(te);if(ne&&(!ne[1]||ne[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*te.length);var ye=ne[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ye.lastIndex=0;for(var ge;(ne=ye.exec(q))!=null;)if(ge=this.rules.inline.strong.middle.exec(q.slice(0,ne.index+3)),ge)return{type:"strong",raw:te.slice(0,ge[0].length),text:te.slice(2,ge[0].length-2)}}},le.em=function(te,q,re){re===void 0&&(re="");var ne=this.rules.inline.em.start.exec(te);if(ne&&(!ne[1]||ne[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){q=q.slice(-1*te.length);var ye=ne[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ye.lastIndex=0;for(var ge;(ne=ye.exec(q))!=null;)if(ge=this.rules.inline.em.middle.exec(q.slice(0,ne.index+2)),ge)return{type:"em",raw:te.slice(0,ge[0].length),text:te.slice(1,ge[0].length-1)}}},le.codespan=function(te){var q=this.rules.inline.code.exec(te);if(q){var re=q[2].replace(/\n/g," "),ne=/[^ ]/.test(re),ye=re.startsWith(" ")&&re.endsWith(" ");return ne&&ye&&(re=re.substring(1,re.length-1)),re=oe(re,!0),{type:"codespan",raw:q[0],text:re}}},le.br=function(te){var q=this.rules.inline.br.exec(te);if(q)return{type:"br",raw:q[0]}},le.del=function(te){var q=this.rules.inline.del.exec(te);if(q)return{type:"del",raw:q[0],text:q[1]}},le.autolink=function(te,q){var re=this.rules.inline.autolink.exec(te);if(re){var ne,ye;return re[2]==="@"?(ne=oe(this.options.mangle?q(re[1]):re[1]),ye="mailto:"+ne):(ne=oe(re[1]),ye=ne),{type:"link",raw:re[0],text:ne,href:ye,tokens:[{type:"text",raw:ne,text:ne}]}}},le.url=function(te,q){var re;if(re=this.rules.inline.url.exec(te)){var ne,ye;if(re[2]==="@")ne=oe(this.options.mangle?q(re[0]):re[0]),ye="mailto:"+ne;else{var ge;do ge=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(ge!==re[0]);ne=oe(re[0]),re[1]==="www."?ye="http://"+ne:ye=ne}return{type:"link",raw:re[0],text:ne,href:ye,tokens:[{type:"text",raw:ne,text:ne}]}}},le.inlineText=function(te,q,re){var ne=this.rules.inline.text.exec(te);if(ne){var ye;return q?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):oe(ne[0]):ne[0]:ye=oe(this.options.smartypants?re(ne[0]):ne[0]),{type:"text",raw:ne[0],text:ye}}},pe}(),Se=Q.noopTest,we=Q.edit,Te=Q.merge,me={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:Se,table:Se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=we(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=we(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=we(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._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",me._comment=//,me.html=we(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=we(me._paragraph).replace("hr",me.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",me._tag).getRegex(),me.blockquote=we(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Te({},me),me.gfm=Te({},me.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*|$)"}),me.gfm.nptable=we(me.gfm.nptable).replace("hr",me.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",me._tag).getRegex(),me.gfm.table=we(me.gfm.table).replace("hr",me.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",me._tag).getRegex(),me.pedantic=Te({},me.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._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:Se,paragraph:we(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var de={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Se,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:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",de.punctuation=we(de.punctuation).replace(/punctuation/g,de._punctuation).getRegex(),de._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",de._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",de.em.start=we(de.em.start).replace(/punctuation/g,de._punctuation).getRegex(),de.em.middle=we(de.em.middle).replace(/punctuation/g,de._punctuation).replace(/overlapSkip/g,de._overlapSkip).getRegex(),de.em.endAst=we(de.em.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.em.endUnd=we(de.em.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.start=we(de.strong.start).replace(/punctuation/g,de._punctuation).getRegex(),de.strong.middle=we(de.strong.middle).replace(/punctuation/g,de._punctuation).replace(/blockSkip/g,de._blockSkip).getRegex(),de.strong.endAst=we(de.strong.endAst,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.strong.endUnd=we(de.strong.endUnd,"g").replace(/punctuation/g,de._punctuation).getRegex(),de.blockSkip=we(de._blockSkip,"g").getRegex(),de.overlapSkip=we(de._overlapSkip,"g").getRegex(),de._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,de._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,de._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])?)+(?![-_])/,de.autolink=we(de.autolink).replace("scheme",de._scheme).replace("email",de._email).getRegex(),de._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,de.tag=we(de.tag).replace("comment",me._comment).replace("attribute",de._attribute).getRegex(),de._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,de._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,de._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,de.link=we(de.link).replace("label",de._label).replace("href",de._href).replace("title",de._title).getRegex(),de.reflink=we(de.reflink).replace("label",de._label).getRegex(),de.reflinkSearch=we(de.reflinkSearch,"g").replace("reflink",de.reflink).replace("nolink",de.nolink).getRegex(),de.normal=Te({},de),de.pedantic=Te({},de.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:we(/^!?\[(label)\]\((.*?)\)/).replace("label",de._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",de._label).getRegex()}),de.gfm=Te({},de.normal,{escape:we(de.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&&(te="x"+te.toString(16)),le+=""+te+";";return le}var Me=function(){function pe(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||Je,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:Ge.normal,inline:Qe.normal};this.options.pedantic?(te.block=Ge.pedantic,te.inline=Qe.pedantic):this.options.gfm&&(te.block=Ge.gfm,this.options.breaks?te.inline=Qe.breaks:te.inline=Qe.gfm),this.tokenizer.rules=te}pe.lex=function(te,q){var re=new pe(q);return re.lex(te)};var le=pe.prototype;return le.lex=function(te){return te=te.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function(te,q,re){q===void 0&&(q=[]),re===void 0&&(re=!0),te=te.replace(/^ +$/gm,"");for(var ne,ye,ge,_e;te;){if(ne=this.tokenizer.space(te)){te=te.substring(ne.raw.length),ne.type&&q.push(ne);continue}if(ne=this.tokenizer.code(te,q)){te=te.substring(ne.raw.length),ne.type?q.push(ne):(_e=q[q.length-1],_e.raw+=`
`+ne.raw,_e.text+=`
`+ne.text);continue}if(ne=this.tokenizer.fences(te)){te=te.substring(ne.raw.length),q.push(ne);continue}if(ne=this.tokenizer.heading(te)){te=te.substring(ne.raw.length),q.push(ne);continue}if(ne=this.tokenizer.nptable(te)){te=te.substring(ne.raw.length),q.push(ne);continue}if(ne=this.tokenizer.hr(te)){te=te.substring(ne.raw.length),q.push(ne);continue}if(ne=this.tokenizer.blockquote(te)){te=te.substring(ne.raw.length),ne.tokens=this.blockTokens(ne.text,[],re),q.push(ne);continue}if(ne=this.tokenizer.list(te)){for(te=te.substring(ne.raw.length),ge=ne.items.length,ye=0;ye0)for(;(ze=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)ft.includes(ze[0].slice(ze[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,ze.index)+"["+"a".repeat(ze[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ze=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,ze.index)+"["+"a".repeat(ze[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(ge=this.tokenizer.escape(te)){te=te.substring(ge.raw.length),q.push(ge);continue}if(ge=this.tokenizer.tag(te,re,ne)){te=te.substring(ge.raw.length),re=ge.inLink,ne=ge.inRawBlock,q.push(ge);continue}if(ge=this.tokenizer.link(te)){te=te.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,ne)),q.push(ge);continue}if(ge=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,ne)),q.push(ge);continue}if(ge=this.tokenizer.strong(te,_e,ye)){te=te.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],re,ne),q.push(ge);continue}if(ge=this.tokenizer.em(te,_e,ye)){te=te.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],re,ne),q.push(ge);continue}if(ge=this.tokenizer.codespan(te)){te=te.substring(ge.raw.length),q.push(ge);continue}if(ge=this.tokenizer.br(te)){te=te.substring(ge.raw.length),q.push(ge);continue}if(ge=this.tokenizer.del(te)){te=te.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],re,ne),q.push(ge);continue}if(ge=this.tokenizer.autolink(te,Ae)){te=te.substring(ge.raw.length),q.push(ge);continue}if(!re&&(ge=this.tokenizer.url(te,Ae))){te=te.substring(ge.raw.length),q.push(ge);continue}if(ge=this.tokenizer.inlineText(te,ne,Ye)){te=te.substring(ge.raw.length),ye=ge.raw.slice(-1),q.push(ge);continue}if(te){var lt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return q},Z(pe,null,[{key:"rules",get:function(){return{block:Ge,inline:Qe}}}]),pe}(),je=H.defaults,et=Q.cleanUrl,Xe=Q.escape,Ne=function(){function pe(ue){this.options=ue||je}var le=pe.prototype;return le.code=function(te,q,re){var ne=(q||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight(te,ne);ye!=null&&ye!==te&&(re=!0,te=ye)}return ne?''+(re?te:Xe(te,!0))+`
`:""+(re?te:Xe(te,!0))+`
`},le.blockquote=function(te){return`
`+te+`
`},le.html=function(te){return te},le.heading=function(te,q,re,ne){return this.options.headerIds?"
`:""+te+"
`},le.hr=function(){return this.options.xhtml?`
`:`
`},le.list=function(te,q,re){var ne=q?"ol":"ul",ye=q&&re!==1?' start="'+re+'"':"";return"<"+ne+ye+`>
`+te+""+ne+`>
`},le.listitem=function(te){return""+te+`
`},le.checkbox=function(te){return" "},le.paragraph=function(te){return""+te+`
`},le.table=function(te,q){return q&&(q=""+q+""),`
`},le.tablerow=function(te){return`
`+te+`
`},le.tablecell=function(te,q){var re=q.header?"th":"td",ne=q.align?"<"+re+' align="'+q.align+'">':"<"+re+">";return ne+te+""+re+`>
`},le.strong=function(te){return""+te+""},le.em=function(te){return""+te+""},le.codespan=function(te){return""+te+""},le.br=function(){return this.options.xhtml?"
":"
"},le.del=function(te){return""+te+""},le.link=function(te,q,re){if(te=et(this.options.sanitize,this.options.baseUrl,te),te===null)return re;var ne='"+re+"",ne},le.image=function(te,q,re){if(te=et(this.options.sanitize,this.options.baseUrl,te),te===null)return re;var ne='
":">",ne},le.text=function(te){return te},pe}(),Be=function(){function pe(){}var le=pe.prototype;return le.strong=function(te){return te},le.em=function(te){return te},le.codespan=function(te){return te},le.del=function(te){return te},le.html=function(te){return te},le.text=function(te){return te},le.link=function(te,q,re){return""+re},le.image=function(te,q,re){return""+re},le.br=function(){return""},pe}(),ht=function(){function pe(){this.seen={}}var le=pe.prototype;return le.slug=function(te){var q=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(q)){var re=q;do this.seen[re]++,q=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(q))}return this.seen[q]=0,q},pe}(),We=H.defaults,Pe=Q.unescape,Ke=function(){function pe(ue){this.options=ue||We,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new ht}pe.parse=function(te,q){var re=new pe(q);return re.parse(te)};var le=pe.prototype;return le.parse=function(te,q){q===void 0&&(q=!0);var re="",ne,ye,ge,_e,ze,ft,lt,At,Et,$e,Rt,yt,Ot,Lt,Tt,wr,fr,vt,rr=te.length;for(ne=0;ne0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=vt+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=vt+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:vt}):Lt+=vt),Lt+=this.parse(Tt.tokens,Ot),Et+=this.renderer.listitem(Lt,fr,wr);re+=this.renderer.list(Et,Rt,yt);continue}case"html":{re+=this.renderer.html($e.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline($e.tokens));continue}case"text":{for(Et=$e.tokens?this.parseInline($e.tokens):$e.text;ne+1An error occurred:"+it(ge.message+"",!0)+"
";throw ge}}Le.options=Le.setOptions=function(pe){return qe(Le.defaults,pe),tt(Le.defaults),Le},Le.getDefaults=Ce,Le.defaults=nt,Le.use=function(pe){var le=qe({},pe);if(pe.renderer&&function(){var te=Le.defaults.renderer||new Ne,q=function(ye){var ge=te[ye];te[ye]=function(){for(var _e=arguments.length,ze=new Array(_e),ft=0;ft<_e;ft++)ze[ft]=arguments[ft];var lt=pe.renderer[ye].apply(te,ze);return lt===!1&&(lt=ge.apply(te,ze)),lt}};for(var re in pe.renderer)q(re);le.renderer=te}(),pe.tokenizer&&function(){var te=Le.defaults.tokenizer||new Ee,q=function(ye){var ge=te[ye];te[ye]=function(){for(var _e=arguments.length,ze=new Array(_e),ft=0;ft<_e;ft++)ze[ft]=arguments[ft];var lt=pe.tokenizer[ye].apply(te,ze);return lt===!1&&(lt=ge.apply(te,ze)),lt}};for(var re in pe.tokenizer)q(re);le.tokenizer=te}(),pe.walkTokens){var ue=Le.defaults.walkTokens;le.walkTokens=function(te){pe.walkTokens(te),ue&&ue(te)}}Le.setOptions(le)},Le.walkTokens=function(pe,le){for(var ue=I(pe),te;!(te=ue()).done;){var q=te.value;le(q);switch(q.type){case"table":{for(var re=I(q.tokens.header),ne;!(ne=re()).done;){var ye=ne.value;Le.walkTokens(ye,le)}for(var ge=I(q.tokens.cells),_e;!(_e=ge()).done;)for(var ze=_e.value,ft=I(ze),lt;!(lt=ft()).done;){var At=lt.value;Le.walkTokens(At,le)}break}case"list":{Le.walkTokens(q.items,le);break}default:q.tokens&&Le.walkTokens(q.tokens,le)}}},Le.Parser=Ke,Le.parser=Ke.parse,Le.Renderer=Ne,Le.TextRenderer=Be,Le.Lexer=Me,Le.lexer=Me.lex,Le.Tokenizer=Ee,Le.Slugger=ht,Le.parse=Le;var Ie=Le;return Ie})},ELLl:function(Ct,dt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(E,w,d){d&&d!=ae.Init&&(E.removeKeyMap(I),E.state.closeBrackets=null),w&&(D(X(w,"pairs")),E.state.closeBrackets=w,E.addKeyMap(I))});function X(E,w){return w=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[w]!=null?E[w]:Z[w]}var I={Backspace:M,Enter:O};function D(E){for(var w=0;w=0;l--){var L=o[l].head;E.replaceRange("",R(L.line,L.ch-1),R(L.line,L.ch+1),"+delete")}}function O(E){var w=F(E),d=w&&X(w,"explode");if(!d||E.getOption("disableInput"))return ae.Pass;for(var o=E.listSelections(),l=0;l0;return{anchor:new R(E.anchor.line,E.anchor.ch+(w?-1:1)),head:new R(E.head.line,E.head.ch+(w?1:-1))}}function C(E,w){var d=F(E);if(!d||E.getOption("disableInput"))return ae.Pass;var o=X(d,"pairs"),l=o.indexOf(w);if(l==-1)return ae.Pass;for(var h=X(d,"closeBefore"),L=X(d,"triples"),f=o.charAt(l+1)==w,p=E.listSelections(),_=l%2==0,b,g=0;g=0&&E.getRange(u,R(u.line,u.ch+3))==w+w+w?a="skipThree":a="skip";else if(f&&u.ch>1&&L.indexOf(w)>=0&&E.getRange(R(u.line,u.ch-2),u)==w+w){if(u.ch>2&&/\bstring/.test(E.getTokenTypeAt(R(u.line,u.ch-2))))return ae.Pass;a="addFour"}else if(f){var y=u.ch==0?" ":E.getRange(R(u.line,u.ch-1),u);if(!ae.isWordChar(x)&&y!=w&&!ae.isWordChar(y))a="both";else return ae.Pass}else if(_&&(x.length===0||/\s/.test(x)||h.indexOf(x)>-1))a="both";else return ae.Pass;if(!b)b=a;else if(b!=a)return ae.Pass}var S=l%2?o.charAt(l-1):w,P=l%2?w:o.charAt(l+1);E.operation(function(){if(b=="skip")E.execCommand("goCharRight");else if(b=="skipThree")for(var G=0;G<3;G++)E.execCommand("goCharRight");else if(b=="surround"){for(var Y=E.getSelections(),G=0;G10)},[pe==null?void 0:pe.replies_count]);var Nr=function(){var ct=Object(ae.a)(X.a.mark(function st(){var Jt,jt,Ut;return X.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Jt=wr+1,fr(Jt),Gt.next=4,Object(l.h)({id:ue.memoId,page:Jt});case 4:jt=Gt.sent,jt!=null&&jt.memo_replies&&(tt({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},Ve.forumsDetailData),{},{memo_replies:[].concat(Object(oe.a)(le),Object(oe.a)(jt.memo_replies))})}),Ot(((Ut=jt.memo_replies)===null||Ut===void 0?void 0:Ut.length)===10));case 6:case"end":return Gt.stop()}},st)}));return function(){return ct.apply(this,arguments)}}(),Xr=function(st){var Jt,jt,Ut,kt;return Object(E.a)(Object(E.a)({},st),{},{image_url:(Jt=qe.userInfo)===null||Jt===void 0?void 0:Jt.image_url,children:[],user_id:(jt=qe.userInfo)===null||jt===void 0?void 0:jt.user_id,user_login:(Ut=qe.userInfo)===null||Ut===void 0?void 0:Ut.login,username:(kt=qe.userInfo)===null||kt===void 0?void 0:kt.username,time:"".concat(Object(me.Z)((new Date().getTime()-new Date(st.created_at).getTime())/1e3),"\u524D")})},Jr=function(){or(!0)};return D.a.createElement("section",{className:Se.a.wrap},!!(le!=null&&le.length)&&D.a.createElement("aside",{className:Se.a.content},D.a.createElement("div",{style:{padding:"10px 15px 5px 15px",justifyContent:"space-between",display:"flex"}},D.a.createElement("span",null,"\u5168\u90E8\u56DE\u590D\uFF08",pe.replies_count,"\uFF09")),D.a.createElement("aside",{className:Se.a.replyList},le==null?void 0:le.map(function(ct,st){var Jt;return D.a.createElement(O.a,{gutter:[12,12],key:st},D.a.createElement(C.a,{flex:"40px"},D.a.createElement("a",{href:"/users/".concat(ct.user_login),target:"_blank"},D.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",width:"50",height:"50",src:"".concat(w.a.IMG_SERVER,"/images/").concat(ct==null?void 0:ct.image_url)}))),D.a.createElement(C.a,{flex:"1"},D.a.createElement(O.a,{align:"middle"},D.a.createElement(C.a,{span:24},D.a.createElement("a",{href:"/users/".concat(ct.user_login),target:"_blank"},D.a.createElement("span",{className:"c-light-black"},ct==null?void 0:ct.username)),D.a.createElement("span",{className:"c-light-black ml10"},ct.time)),D.a.createElement(C.a,{span:24},D.a.createElement("div",{onClick:nt},D.a.createElement(ee.a,{value:ct.content}))),!!(ct!=null&&(Jt=ct.children)!==null&&Jt!==void 0&&Jt.length)&&D.a.createElement(Te,{user:qe,id:ct==null?void 0:ct.id,vlist:ct==null?void 0:ct.children,dispatch:tt,params:ue,memo_replies:le,forumsDetail:Ve}),D.a.createElement(C.a,{span:24,className:"mt5 c-light-black"},At===st?D.a.createElement("aside",null,D.a.createElement(ve.a,{onChange:function(Ut){ze(Ut)},height:150,isFocus:!0,placeholder:"\u6211\u8981\u56DE\u590D..."}),D.a.createElement(O.a,null,D.a.createElement(C.a,{span:24,className:"tr"},D.a.createElement(A.a,{type:"primary",size:"large",onClick:Object(ae.a)(X.a.mark(function jt(){var Ut;return X.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:if(!(_e==="")){Gt.next=4;break}Y.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),Gt.next=9;break;case 4:return Gt.next=6,Object(l.k)({parent_id:ct.id,content:_e});case 6:Ut=Gt.sent,ze(null),Ut&&(Et(-1),le.find(function(Sr){return Sr.id===Ut.parent_id}).children.push(Xr(Ut)),tt({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},Ve.forumsDetailData),{},{memo:Object(E.a)(Object(E.a)({},pe),{},{replies_count:pe.replies_count+1}),memo_replies:Object(oe.a)(le)})}));case 9:case"end":return Gt.stop()}},jt)}))},"\u53D1\u9001")))):D.a.createElement("div",{className:"tr"},D.a.createElement("span",{className:"iconfont icon-huifu1 mr15 ml30 current",onClick:function(){return Et(st)}}),D.a.createElement(b.a,{title:ct.user_praise?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},D.a.createElement("span",{className:ct.user_praise?"c-orange":"c-gery-888"},D.a.createElement("i",{className:"iconfont icon-dianzan mr3 current",onClick:Object(ae.a)(X.a.mark(function jt(){var Ut;return X.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(l.i)({id:ct.id,container_type:"Memo",type:ct.user_praise?0:1});case 2:Ut=Gt.sent,(Ut==null?void 0:Ut.praise_count)>=0&&(le.find(function(Sr){return Sr.id===ct.id}).user_praise=!ct.user_praise,le.find(function(Sr){return Sr.id===ct.id}).praise_count=Ut==null?void 0:Ut.praise_count,tt({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},Ve.forumsDetailData),{},{memo_replies:Object(oe.a)(le)})}));case 4:case"end":return Gt.stop()}},jt)}))}),ct.praise_count>0?ct.praise_count:"")))))))}))),yt&&D.a.createElement("aside",{className:"bg-white pb20",style:{display:"flex",justifyContent:"center"}},D.a.createElement(O.a,{justify:"space-between"},D.a.createElement(C.a,null),D.a.createElement(C.a,null,yt&&D.a.createElement("a",{className:"c-black",onClick:Nr},"\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA")))),D.a.createElement("aside",{className:Se.a.reply},D.a.createElement(ve.a,{onBlur:function(){return or(!1)},isFocus:ir,defaultValue:re,id:"writeForumsReviewId",onChange:function(st){ne(st)},placeholder:"\u6211\u8981\u56DE\u590D...",height:240}),D.a.createElement(O.a,null,D.a.createElement(C.a,{flex:"1"}),D.a.createElement(C.a,null,D.a.createElement(A.a,{type:"primary",size:"large",onClick:Object(ae.a)(X.a.mark(function ct(){var st;return X.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:if(!(re==="")){jt.next=4;break}Y.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),jt.next=9;break;case 4:return jt.next=6,Object(l.k)({parent_id:pe.id,content:re});case 6:st=jt.sent,ne(null),st&&tt({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},Ve.forumsDetailData),{},{memo:Object(E.a)(Object(E.a)({},pe),{},{replies_count:pe.replies_count+1}),memo_replies:[Xr(st)].concat(Object(oe.a)(le))})});case 9:case"end":return jt.stop()}},ct)}))},"\u53D1\u9001")))))},ke=Object(F.a)(function(We){var Pe=We.user,Ke=We.forumsDetail,qe=We.loading,Ve=We.globalSetting;return{user:Pe,forumsDetail:Ke,globalSetting:Ve,loading:qe.models.forumsDetail}},null,null,{forwardRef:!0})(Object(I.forwardRef)(de)),Je=ie("smFo"),Ge=ie.n(Je),Qe=ie("RCxd"),Ye=ie("kaH+"),Ae=ie("dhSg"),Me={5:"\u6280\u672F\u5206\u4EAB",3:"\u64CD\u4F5C\u6307\u5357",16:"\u901A\u77E5\u516C\u544A"},je=function(Pe){var Ke,qe,Ve,it,Ce,tt=Pe.user,nt=Pe.forumsDetail,Le=Pe.globalSetting,Ie=Pe.loading,pe=Pe.dispatch,le=Object(Z.a)(Pe,["user","forumsDetail","globalSetting","loading","dispatch"]),ue=nt.forumsDetailData||{},te=ue.author_info,q=ue.memo,re=ue.attachments_list,ne=Object(I.useRef)(),ye=Object(I.useRef)(),ge=function(){var $e=Object(ae.a)(X.a.mark(function Rt(){var yt,Ot;return X.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return yt={id:q.id,sticky:q.sticky?0:1},Tt.next=3,Object(l.m)(yt);case 3:Ot=Tt.sent,(Ot==null?void 0:Ot.status)===0&&pe({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},nt.forumsDetailData),{},{memo:Object(E.a)(Object(E.a)({},q),{},{sticky:!(q!=null&&q.sticky)})})});case 5:case"end":return Tt.stop()}},Rt)}));return function(){return $e.apply(this,arguments)}}(),_e=function(){var $e=Object(ae.a)(X.a.mark(function Rt(){var yt;return X.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(l.b)({id:q==null?void 0:q.id});case 2:yt=Lt.sent,(yt==null?void 0:yt.status)===0&&(Y.b.success("\u5220\u9664\u6210\u529F"),F.d.push("/forums")),(yt==null?void 0:yt.status)===-1&&F.d.push("/forums");case 5:case"end":return Lt.stop()}},Rt)}));return function(){return $e.apply(this,arguments)}}(),ze=function(){var $e=Object(ae.a)(X.a.mark(function Rt(){return X.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:P.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5956\u52B1\u8BBE\u7F6E",content:D.a.createElement("div",{className:"font14 tc"},D.a.createElement(y.a,{defaultValue:ne.current,onChange:function(Tt){return ne.current=Tt.target.value}})),onOk:function(){var Lt=Object(ae.a)(X.a.mark(function wr(){var fr;return X.a.wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:return rr.next=2,Object(l.l)({id:q==null?void 0:q.id,container_type:"Memo",score:ne.current?Number(ne.current):0,user_id:te==null?void 0:te.user_id});case 2:if(fr=rr.sent,ne.current=null,!((fr==null?void 0:fr.code)>0)){rr.next=8;break}return pe({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},nt.forumsDetailData),{},{memo:Object(E.a)(Object(E.a)({},q),{},{reward:fr==null?void 0:fr.code})})}),Y.b.success("\u5956\u52B1\u6210\u529F"),rr.abrupt("return");case 8:Y.b.success("\u5956\u52B1\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\uFF01");case 9:case"end":return rr.stop()}},wr)}));function Tt(){return Lt.apply(this,arguments)}return Tt}()});case 1:case"end":return Ot.stop()}},Rt)}));return function(){return $e.apply(this,arguments)}}(),ft=function(){ye.current.onMdFouch&&ye.current.onMdFouch()},lt=function(){var $e=Object(ae.a)(X.a.mark(function Rt(){var yt;return X.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(l.i)({id:q.id,container_type:"Memo",type:1});case 2:yt=Lt.sent,(yt==null?void 0:yt.praise_count)>=0&&pe({type:"forumsDetail/setForumsDetailData",payload:Object(E.a)(Object(E.a)({},nt.forumsDetailData),{},{memo:Object(E.a)(Object(E.a)({},q),{},{user_praise:!(q!=null&&q.user_praise),memo_praise_count:yt==null?void 0:yt.praise_count})})});case 4:case"end":return Lt.stop()}},Rt)}));return function(){return $e.apply(this,arguments)}}(),At=D.a.createElement(a.a,{className:Ge.a.menu},((Ke=tt.userInfo)===null||Ke===void 0?void 0:Ke.admin)&&(q==null?void 0:q.sticky)&&D.a.createElement(a.a.Item,null,D.a.createElement("a",{onClick:function(){return ge()}},"\u53D6\u6D88\u7F6E\u9876")),((qe=tt.userInfo)===null||qe===void 0?void 0:qe.admin)&&!(q!=null&&q.sticky)&&D.a.createElement(a.a.Item,null,D.a.createElement("a",{onClick:function(){return ge()}},"\u7F6E\xA0\xA0\u9876")),D.a.createElement(a.a.Item,null,D.a.createElement(Q.a,{to:"/forums/".concat(q==null?void 0:q.id,"/edit")},"\u7F16\xA0\xA0\u8F91")),D.a.createElement(a.a.Item,null,D.a.createElement("a",{onClick:function(){P.a.confirm({title:"\u63D0\u793A",icon:D.a.createElement(Qe.a,null),content:"\u5E16\u5B50\u5C06\u88AB\u5220\u9664\uFF0C\u65E0\u6CD5\u6062\u590D\u3002\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",okText:"\u786E\u8BA4",onOk:function(){_e()},cancelText:"\u53D6\u6D88"})}},"\u5220\xA0\xA0\u9664"))),Et=function(Rt){var yt=Rt.target,Ot=yt.nodeName,Lt=yt.src;Ot==="IMG"&&(Ae.a.publish("preview-image",Lt),console.log("src:",Lt))};return Object(I.useEffect)(function(){},[]),D.a.createElement("section",{className:Ge.a.wrap},D.a.createElement(c.a,{separator:"/",className:"mb5"},D.a.createElement(c.a.Item,null,D.a.createElement(Q.a,{to:"/forums/categories/".concat(q==null?void 0:q.forum_id)},Me[q==null?void 0:q.forum_id])),D.a.createElement(c.a.Item,null,"\u8BE6\u60C5")),D.a.createElement("header",{className:"bg-white pt40 pb40 pl30 pr30 ".concat(Ge.a.header)},D.a.createElement(O.a,{align:"middle"},D.a.createElement(C.a,{flex:1,className:"font24 mb5"},D.a.createElement("span",{className:Ge.a.title},q==null?void 0:q.subject),(q==null?void 0:q.sticky)&&D.a.createElement("span",{className:Ge.a.top},"\u7F6E\u9876"),!!(q!=null&&q.reward)&&D.a.createElement(b.a,{placement:"bottom",title:"\u83B7\u5F97\u5E73\u53F0\u5956\u52B1\u91D1\u5E01\uFF1A".concat(q==null?void 0:q.reward)},D.a.createElement("span",{className:"ml10 c-orange-ff7"},D.a.createElement("i",{className:"iconfont icon-gift font16 mr5"}),D.a.createElement("span",{className:"font14"},q==null?void 0:q.reward)))),D.a.createElement(C.a,null,(((Ve=tt.userInfo)===null||Ve===void 0?void 0:Ve.admin)||((it=tt.userInfo)===null||it===void 0?void 0:it.user_id)===(te==null?void 0:te.user_id))&&D.a.createElement(p.a,{overlay:At},D.a.createElement("i",{className:"fa fa-bars font-16 current c-grey-bcb"})))),D.a.createElement(O.a,{align:"middle",className:"font14"},D.a.createElement(C.a,{flex:1,className:"c-grey-999"},D.a.createElement("span",null,j()(q==null?void 0:q.time).fromNow()," \u53D1\u5E03")),D.a.createElement(C.a,{className:"c-grey-999"},((Ce=tt.userInfo)===null||Ce===void 0?void 0:Ce.admin)&&D.a.createElement(b.a,{placement:"bottom",title:"\u5E16\u5B50\u5956\u52B1"},D.a.createElement("span",{className:"current pr10 ".concat(Ge.a.line),onClick:ze},D.a.createElement("i",{className:"iconfont icon-jiangli font18 mr5"}))),D.a.createElement("span",{className:"pr10 pl10 ".concat(q!=null&&q.replies_count?Ge.a.line:"")},D.a.createElement("i",{className:"iconfont icon-liulanyan font18 mr5"}),q==null?void 0:q.viewed_count),!!(q!=null&&q.replies_count)&&D.a.createElement(b.a,{placement:"bottom",title:"\u5199\u8BC4\u8BBA"},D.a.createElement("span",{className:"current pl10",onClick:ft},D.a.createElement("i",{className:"iconfont icon-huifu1 font18 mr5"}),q==null?void 0:q.replies_count))))),D.a.createElement("main",{className:"bg-white pt40 pb40 pl40 pr40"},D.a.createElement("div",{onClick:Et},D.a.createElement(ee.a,{value:q==null?void 0:q.content})),D.a.createElement("div",{className:"bg-white pl40 pr40 mt40"},D.a.createElement("div",{className:"mt10 mb20 ".concat(Ge.a.flexCenter)},D.a.createElement("div",{className:"".concat(Ge.a.like," ").concat(q!=null&&q.user_praise?"":Ge.a.canLike),onClick:lt},D.a.createElement("i",{className:"iconfont icon-dianzan font18"}),D.a.createElement("br",null),D.a.createElement("span",null,q==null?void 0:q.memo_praise_count)))),!!(re!=null&&re.length)&&D.a.createElement("div",{className:"mt40"},re==null?void 0:re.map(function($e){return D.a.createElement("div",{className:"c-grey-888 ".concat(Ge.a.flexCenter)},D.a.createElement("i",{className:"iconfont icon-fujian mr10 font14 c-green-29b"}),D.a.createElement("a",{href:$e==null?void 0:$e.url,title:$e==null?void 0:$e.title,className:"".concat(Ge.a.attachmentName," mr10")},$e==null?void 0:$e.title),D.a.createElement("span",{className:"font12 c-grey-666 mt3"},$e==null?void 0:$e.filesize))}))),D.a.createElement(ke,{ref:ye,handleClick:Et}),D.a.createElement(Ye.a,null))},et=Object(F.a)(function(We){var Pe=We.user,Ke=We.forumsDetail,qe=We.loading,Ve=We.globalSetting;return{user:Pe,forumsDetail:Ke,globalSetting:Ve,loading:qe.effects}})(je),Xe=ie("G8my"),Ne=ie.n(Xe),Be=function(Pe){var Ke=Pe.forumsDetail,qe=Pe.globalSetting,Ve=Pe.loading,it=Pe.dispatch,Ce=Object(Z.a)(Pe,["forumsDetail","globalSetting","loading","dispatch"]),tt=Object(H.i)();Object(I.useEffect)(function(){nt()},[tt.memoId]);var nt=function(){var Le=Object(ae.a)(X.a.mark(function Ie(){return X.a.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:it({type:"forumsDetail/getForumsDetailData",payload:{id:tt.memoId}});case 1:case"end":return le.stop()}},Ie)}));return function(){return Le.apply(this,arguments)}}();return D.a.createElement("section",{className:"edu-container mb20 mt30 ".concat(Ne.a.flex)},D.a.createElement(et,null),D.a.createElement(L,null))},ht=dt.default=Object(F.a)(function(We){var Pe=We.forumsDetail,Ke=We.loading,qe=We.globalSetting;return{forumsDetail:Pe,globalSetting:qe,loading:Ke.models.forumsDetail}})(Be)},LO5M:function(Ct,dt,ie){Ct.exports={wrap:"wrap___1d4rP",head:"head___1_Uzf",recommendItem:"recommendItem___IStR9",buttonWrap:"buttonWrap___3dpFm",privateMessage:"privateMessage___24GfS",flex1:"flex1___3wIqQ",mWidth147:"mWidth147___3ODny"}},LdHM:function(Ct,dt,ie){"use strict";ie.d(dt,"b",function(){return h}),ie.d(dt,"a",function(){return f});var ae=ie("1OyB"),Z=ie("vuIU"),R=ie("Ji7U"),X=ie("LK+K"),I=ie("q1tI"),D=ie("rePB"),H=ie("Ff2n"),F=ie("ODXe"),M=ie("4IlW"),O=ie("bX4T"),v=ie("YrtM"),C=ie("TSYQ"),k=ie.n(C),A=ie("+nKL"),E=ie("8OUc"),w=function(ee,oe){var fe=ee.prefixCls,ve=ee.id,Re=ee.flattenOptions,Ee=ee.childrenAsData,Se=ee.values,we=ee.searchValue,Te=ee.multiple,me=ee.defaultActiveFirstOption,de=ee.height,ke=ee.itemHeight,Je=ee.notFoundContent,Ge=ee.open,Qe=ee.menuItemSelectedIcon,Ye=ee.virtual,Ae=ee.onSelect,Me=ee.onToggleOpen,je=ee.onActiveValue,et=ee.onScroll,Xe=ee.onMouseEnter,Ne="".concat(fe,"-item"),Be=Object(v.a)(function(){return Re},[Ge,Re],function(Ie,pe){return pe[0]&&Ie[1]!==pe[1]}),ht=I.useRef(null),We=function(pe){pe.preventDefault()},Pe=function(pe){ht.current&&ht.current.scrollTo({index:pe})},Ke=function(pe){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Be.length,te=0;te1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(j).map(function(oe,fe){if(!I.isValidElement(oe)||!oe.type)return null;var ve=oe.type.isSelectOptGroup,Re=oe.key,Ee=oe.props,Se=Ee.children,we=Object(H.a)(Ee,["children"]);return ee||!ve?b(oe):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Re===null?fe:Re,"__"),label:Re},we),{},{options:g(Se)})}).filter(function(oe){return oe})}var c=ie("2Qr1"),u=ie("qNPg"),a=ie("U8pU"),x=ie("Kwbf"),y=ie("WKfj");function S(j){var ee=j.mode,oe=j.options,fe=j.children,ve=j.backfill,Re=j.allowClear,Ee=j.placeholder,Se=j.getInputElement,we=j.showSearch,Te=j.onSearch,me=j.defaultOpen,de=j.autoFocus,ke=j.labelInValue,Je=j.value,Ge=j.inputValue,Qe=j.optionLabelProp,Ye=ee==="multiple"||ee==="tags",Ae=we!==void 0?we:Ye||ee==="combobox",Me=oe||g(fe);if(Object(x.a)(ee!=="tags"||Me.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),ee==="tags"||ee==="combobox"){var je=Me.some(function(Ne){return Ne.options?Ne.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(x.a)(!je,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(ee!=="combobox"||!Qe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(ee==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(x.a)(ee==="combobox"||!Se,"`getInputElement` only work with `combobox` mode."),Object(x.b)(ee!=="combobox"||!Se||!Re||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Te&&!Ae&&ee!=="combobox"&&ee!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!me||de,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Je!=null){var et=Object(y.d)(Je);Object(x.a)(!ke||et.every(function(Ne){return Object(a.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(x.a)(!Ye||Array.isArray(Je),"`value` should be array when `mode` is `multiple` or `tags`")}if(fe){var Xe=null;Object(_.a)(fe).some(function(Ne){if(!I.isValidElement(Ne)||!Ne.type)return!1;var Be=Ne.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var ht=Object(_.a)(Ne.props.children).every(function(We){return!I.isValidElement(We)||!Ne.type||We.type.isSelectOption?!0:(Xe=We.type,!1)});return!ht}return Xe=Be,!0}),Xe&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Xe.displayName||Xe.name||Xe,"`.")),Object(x.a)(Ge===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=S,G=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:g,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:P,fillOptionsWithMissingValue:c.a}),Y=function(j){Object(R.a)(oe,j);var ee=Object(X.a)(oe);function oe(){var fe;return Object(ae.a)(this,oe),fe=ee.apply(this,arguments),fe.selectRef=I.createRef(),fe.focus=function(){fe.selectRef.current.focus()},fe.blur=function(){fe.selectRef.current.blur()},fe}return Object(Z.a)(oe,[{key:"render",value:function(){return I.createElement(G,Object.assign({ref:this.selectRef},this.props))}}]),oe}(I.Component);Y.Option=h,Y.OptGroup=f;var Q=Y,z=dt.c=Q},M8RZ:function(Ct,dt,ie){"use strict";ie.d(dt,"a",function(){return M});var ae=ie("fWQN"),Z=ie("mtLc"),R=ie("yKVA"),X=ie("879j"),I=ie("q1tI"),D=ie.n(I),H=ie("i8i4"),F=ie.n(H),M=function(O){Object(R.a)(C,O);var v=Object(X.a)(C);function C(k){var A;Object(ae.a)(this,C),A=v.call(this,k);var E=window.document;return A.node=E.createElement("div"),E.body.appendChild(A.node),A}return Object(Z.a)(C,[{key:"render",value:function(){var A=this.props.children;return Object(H.createPortal)(A,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),C}(D.a.Component)},Ot1p:function(Ct,dt,ie){"use strict";var ae=ie("2qtc"),Z=ie("kLXV"),R=ie("rAM+"),X=ie("miYZ"),I=ie("tsqr"),D=ie("9og8"),H=ie("tJVT"),F=ie("jrin"),M=ie("WmNS"),O=ie.n(M),v=ie("q1tI"),C=ie.n(v),k=ie("VrN/"),A=ie.n(k),E=ie("bdgK"),w=ie("p77/"),d=ie("Bd2K"),o=ie("ELLl"),l=ie("19Vz"),h=ie("lZu9"),L=ie("+NIl"),f=ie("kSUc"),p=ie("9Bee"),_=function(ge){var _e=ge.value,ze=_e===void 0?"":_e,ft=ge.className,lt=ge.showTextOnly,At=ge.showLines,Et=ge.style,$e=Et===void 0?{}:Et,Rt=Object(v.useMemo)(function(){return""},[ze]);return C.a.createElement(C.a.Fragment,null,C.a.createElement("div",{dangerouslySetInnerHTML:{__html:Rt}}))},b=ie("0Owb"),g=ie("dejd"),c=ie("C+DQ"),u=ie("1vsH"),a=ie("m3rI"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function y(ge){var _e=ge.onActionCallback,ze=ge.title,ft=ge.icon,lt=ge.actionName,At=ge.className,Et=At===void 0?"":At,$e=ge.children;function Rt(){_e(lt)}return C.a.createElement("a",{title:ze,className:Et,onClick:Rt},C.a.createElement("i",{className:"md-iconfont ".concat(ft)}),$e)}var S=function(ge){var _e=ge.watch,ze=ge.showNullButton,ft=ge.onActionCallback,lt=ge.fullScreen,At=ge.insertTemp,Et=ge.hidetoolBar,$e=ge.uuid,Rt=ge.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.E)("_educoder_session"),"&key=").concat($e,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var yt=[].concat(x,[{title:"".concat(_e?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(_e?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return C.a.createElement("ul",{className:"markdown-toolbar-container"},!Et&&yt.map(function(Ot,Lt){return C.a.createElement("li",{key:Lt},Ot.actionName?C.a.createElement(y,Object(b.a)({},Ot,{onActionCallback:ft})):C.a.createElement("span",{className:"v-line"}))}),ze?C.a.createElement("li",null,C.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ft},C.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,At&&C.a.createElement("li",null,C.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(At),onActionCallback:ft},C.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),C.a.createElement("li",{className:"btn-full-screen"},C.a.createElement(y,{icon:"".concat(lt?"icon-shrink":"icon-enlarge"),title:lt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ft})))},P=ie("M8RZ"),G=ie("+L6B"),Y=ie("2/Rp"),Q=ie("y8nQ"),z=ie("Vl3Y"),j=ie("5NDa"),ee=ie("5rEg"),oe={labelCol:{span:4},wrapperCol:{span:20}},fe=function(ge){var _e=ge.callback,ze=ge.onCancel;function ft(lt){_e(lt)}return C.a.createElement(z.a,Object(b.a)({},oe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ft}),C.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},C.a.createElement(ee.a,null)),C.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},C.a.createElement(ee.a,null)),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(Y.a,{type:"ghost",onClick:ze},"\u53D6\u6D88")))},ve=ie("7ahc"),Re=ie("k1fw"),Ee=ie("HmJG"),Se=ie("BjJ7"),we=z.a.useForm,Te={width:280,marginRight:10},me={labelCol:{span:5},wrapperCol:{span:19}},de=function(ge){var _e=ge.callback,ze=ge.onCancel,ft=we(),lt=Object(H.a)(ft,1),At=lt[0],Et=Object(v.useRef)();function $e(Ot){_e(Object(Re.a)(Object(Re.a)({},Ot),{},{name:Et.current}))}function Rt(Ot,Lt){At.setFieldsValue({src:"/api/attachments/".concat(Ot.id,"?type=").concat(Ot.content_type),type:Lt.type})}function yt(Ot){var Lt=Ot.target.files[0];Et.current=Lt.name,Je(Lt,Rt)}return C.a.createElement(z.a,Object(b.a)({form:At},me,{className:"upload-image-panel",onFinish:$e}),C.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},C.a.createElement("div",{className:"flex-container"},C.a.createElement(z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},C.a.createElement(ee.a,{style:Te})),C.a.createElement(ke,{onFileChange:yt}))),C.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},C.a.createElement(ee.a,{style:{width:264}})),C.a.createElement(z.a.Item,{style:{textAlign:"right"}},C.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(Y.a,{type:"ghost",onClick:ze},"\u53D6\u6D88")))};function ke(ge){var _e=ge.onFileChange;return C.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",C.a.createElement("input",{type:"file",onChange:_e}))}function Je(ge,_e){if(!ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var ze=new FormData;ze.append("editormd-image-file",ge),ze.append("file_param_name","editormd-image-file"),ze.append("byxhr","true");var ft=new window.XMLHttpRequest;ft.withCredentials=!0,ft.addEventListener("load",function(lt){_e(JSON.parse(lt.target.responseText),ge)},!1),ft.addEventListener("error",function(lt){console.error(lt)},!1),ft.open("POST","".concat(Se.a,"/api/attachments.json")),ft.send(ze)}var Ge=ie("giR+"),Qe=ie("fyUT"),Ye=ie("7Kak"),Ae=ie("9yH6"),Me=Ae.a.Group,je={margin:"0 8px"},et=function(ge){var _e=ge.callback,ze=ge.onCancel;function ft(lt){_e(lt)}return C.a.createElement(z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ft},C.a.createElement("div",{className:"flex-container"},C.a.createElement("span",{style:je},"\u5355\u5143\u683C\u6570\uFF1A"),C.a.createElement("span",{style:je},"\u884C\u6570"),C.a.createElement(z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},C.a.createElement(Qe.a,null)),C.a.createElement("span",{style:je},"\u5217\u6570"),C.a.createElement(z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},C.a.createElement(Qe.a,null))),C.a.createElement("div",{className:"flex-container",style:{marginTop:12}},C.a.createElement("span",{style:je},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),C.a.createElement(z.a.Item,{name:"align"},C.a.createElement(Me,null,C.a.createElement(Ae.a,{value:"default"},C.a.createElement("i",{className:"fa fa-align-justify"})),C.a.createElement(Ae.a,{value:"left"},C.a.createElement("i",{className:"fa fa-align-left"})),C.a.createElement(Ae.a,{value:"center"},C.a.createElement("i",{className:"fa fa-align-center"})),C.a.createElement(Ae.a,{value:"right"},C.a.createElement("i",{className:"fa fa-align-right"}))))),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(Y.a,{type:"ghost",onClick:ze},"\u53D6\u6D88")))},Xe=ie("ErOA"),Ne=ie("7Cbv"),Be="link",ht="upload-image",We="code-block",Pe="add-table",Ke="------------",qe={default:Ke,left:":".concat(Ke),center:":".concat(Ke,":"),right:"".concat(Ke,":")},Ve=ie("9VGf"),it,Ce;function tt(){}var nt=0,Le=1e4,Ie="\u2581",pe=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function le(ge){return/^\d+$/.test(ge)?"".concat(ge,"px"):ge}var ue=navigator.platform.toUpperCase().indexOf("MAC")>=0,te=ue?"Cmd":"Ctrl",q=["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"],re=(it={},Object(F.a)(it,te+"-B","bold"),Object(F.a)(it,te+"-I","italic"),it),ne=(Ce={},Object(F.a)(Ce,Be,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ce,We,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ce,ht,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(Ce,Pe,"\u6DFB\u52A0\u8868\u683C"),Ce),ye=dt.a=function(ge){var _e=ge.defaultValue,ze=_e===void 0?"":_e,ft=ge.onChange,lt=ge.width,At=lt===void 0?"100%":lt,Et=ge.height,$e=Et===void 0?400:Et,Rt=ge.miniToolbar,yt=Rt===void 0?!1:Rt,Ot=ge.isFocus,Lt=Ot===void 0?!1:Ot,Tt=ge.watch,wr=ge.insertTemp,fr=ge.mode,vt=fr===void 0?"markdown":fr,rr=ge.id,ir=rr===void 0?"markdown-editor-id":rr,or=ge.showResizeBar,Nr=or===void 0?!1:or,Xr=ge.noStorage,Jr=Xr===void 0?!1:Xr,ct=ge.showNullButton,st=ct===void 0?!1:ct,Jt=ge.hidetoolBar,jt=Jt===void 0?!1:Jt,Ut=ge.fullScreen,kt=Ut===void 0?!1:Ut,Gt=ge.onBlur,Sr=ge.onCMBeforeChange,ui=ge.onFullScreen,He=ge.className,_t=He===void 0?"":He,di=ge.disablePaste,Ai=di===void 0?!1:di,hi=ge.placeholder,_i=hi===void 0?"":hi,W=ge.values,s=W===void 0?"":W,m=Object(v.useState)(null),U=Object(H.a)(m,2),K=U[0],B=U[1],ce=Object(v.useState)(ze),Oe=Object(H.a)(ce,2),rt=Oe[0],pt=Oe[1],Ue=Object(v.useState)(Tt),wt=Object(H.a)(Ue,2),It=wt[0],$t=wt[1],Wr=Object(v.useState)(kt),Hr=Object(H.a)(Wr,2),hr=Hr[0],Yr=Hr[1],Hi=Object(v.useState)(""),_r=Object(H.a)(Hi,2),Gr=_r[0],Ur=_r[1],gi=Object(v.useState)(0),Qr=Object(H.a)(gi,2),ci=Qr[0],ni=Qr[1],hn=Object(v.useState)($e),Gi=Object(H.a)(hn,2),qr=Gi[0],zr=Gi[1],Di=Object(v.useState)(!1),Ri=Object(H.a)(Di,2),cn=Ri[0],er=Ri[1],Wt=Object(v.useRef)(Object(Ne.a)()),br=Object(v.useRef)(!1),Ft=Object(v.useRef)(),sr=Object(v.useRef)(),Kt=Object(v.useRef)(),ai=Object(v.useRef)(),nr=Object(v.useRef)(),Dr=function(){var gt=Object(D.a)(O.a.mark(function Dt(){var xt,Pt;return O.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.next=2,Object(Xe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Wt.current}});case 2:Pt=Xt.sent,Pt!=null&&(xt=Pt.attachments)!==null&&xt!==void 0&&xt.length&&(console.log("cm:",K,sr),Pt.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?K.replaceSelection(".concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?K.replaceSelection('')):Bt.content_type.indexOf("pdf")>-1?K.replaceSelection('').concat(Bt.name,"")):K.replaceSelection("[".concat(Bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return Xt.stop()}},Dt)}));return function(){return gt.apply(this,arguments)}}();Object(v.useEffect)(function(){pt(s),K==null||K.setValue(s)},[s]),Object(v.useEffect)(function(){ui==null||ui(hr)},[hr]),Object(v.useEffect)(function(){if(sr.current){var gt=A.a.fromTextArea(sr.current,{mode:vt,lineNumbers:!yt,lineWrapping:!0,value:ze,autoCloseTags:!0,autoCloseBrackets:!0});Lt&>.focus();function Dt(xt,Pt){if(Ai){Pt.preventDefault();return}var Ht=Pt.clipboardData;if(Ht){var Xt=Ht.types.toString(),Bt=Ht.items;if(Xt==="Files"||Ht.types.indexOf("Files")>-1){if(Pt.preventDefault(),vt=="stex")return;try{var lr,Rr=Bt[1];((lr=Bt[0])===null||lr===void 0?void 0:lr.kind)==="file"&&(Rr=Bt[0]);var Nt=Rr.getAsFile(),yi=Nt.name.split(".").pop();Je(Nt,function(zt){if(zt.id){var pr,$r,Zr;(Nt==null||((pr=Nt.type)===null||pr===void 0)?void 0:pr.indexOf("image"))>-1?gt.replaceSelection(".concat(zt.content_type,")")):(Nt==null||(($r=Nt.type)===null||$r===void 0)?void 0:$r.indexOf("video"))>-1?gt.replaceSelection('')):(Nt==null||((Zr=Nt.type)===null||Zr===void 0)?void 0:Zr.indexOf("pdf"))>-1?gt.replaceSelection('').concat(Nt.name,"")):q.includes(yi)?gt.replaceSelection('').concat(Nt.name,"")):gt.replaceSelection("[".concat(Nt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return gt.on("paste",Dt),gt.on("dragleave",function(xt,Pt){Kt.current.classList.remove("mouse-hover-md")}),gt.on("dragover",function(xt,Pt){Kt.current.classList.add("mouse-hover-md")}),gt.on("drop",function(xt,Pt){Kt.current.classList.add("mouse-hover-md");var Ht;if(Ht=Pt.dataTransfer.files,Ht.length>0){Pt.preventDefault(),Pt.stopPropagation();for(var Xt=function(Rr){var Nt=Ht[Rr],yi=Nt.name.split(".").pop();Je(Nt,function(zt){if(zt.id){var pr,$r,Zr;(Nt==null||((pr=Nt.type)===null||pr===void 0)?void 0:pr.indexOf("image"))>-1?gt.replaceSelection(".concat(zt.content_type,")")):(Nt==null||(($r=Nt.type)===null||$r===void 0)?void 0:$r.indexOf("video"))>-1?gt.replaceSelection('')):(Nt==null||((Zr=Nt.type)===null||Zr===void 0)?void 0:Zr.indexOf("pdf"))>-1?gt.replaceSelection('').concat(Nt.name,"")):q.includes(yi)?gt.replaceSelection('').concat(Nt.name,"")):gt.replaceSelection("[".concat(Nt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt0||Bt.target.offsetWidth>0)&&(zi(),K.setSize("100%","100%"),K.refresh())}}catch(lr){Ht.e(lr)}finally{Ht.f()}});return xt.observe(sr.current.parentElement),xt}if(K){var Dt=gt();return function(){Dt.unobserve(sr.current.parentElement)}}},[K,zi]),Object(v.useEffect)(function(){if(K){for(var gt=[],Dt=function(){var Bt=Pt[xt];Ht=Object(H.a)(Bt,2);var lr=Ht[0],Rr=Ht[1],Nt=Object(F.a)({},lr,function(){Ki(Rr)});gt.push(Nt),K.addKeyMap(Nt)},xt=0,Pt=Object.entries(re);xt0){var gt=new Date().getTime(),Dt=window.sessionStorage.getItem(ir);gt>=ci+Le&&(!Dt||Dt!==rt)&&(window.sessionStorage.setItem(ir,rt),er(!0))}},Le),Object(v.useEffect)(function(){$t(Tt)},[K,Tt]),Object(v.useEffect)(function(){K&&(Lt&&K.focus())},[K,Lt]),Object(v.useEffect)(function(){if(It&&K){var gt=K.getScrollerElement();function Dt(xt){var Pt=xt.target;if(nr.current){var Ht=Pt.scrollTop/Pt.scrollHeight;nr.current.scrollTop=nr.current.scrollHeight*Ht}}return gt.addEventListener("scroll",Dt),function(){gt.removeEventListener("scroll",Dt)}}},[K,It]),Object(v.useEffect)(function(){if(K&&Sr){function gt(Dt,xt){Sr(Dt,xt)}return K.on("beforeChange",gt),function(){K.off("beforeChange",gt)}}},[K,Sr]),Object(v.useEffect)(function(){if(K&&Gt){function gt(){Gt(K.getValue())}return K.on("blur",gt),function(){K.off("blur",gt)}}},[K,Gt]),Object(v.useEffect)(function(){if(K){function gt(Dt){var xt=Dt.getValue();pt(xt),ni(new Date().getTime()),Dt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ft&&ft(xt)}return K.on("change",gt),function(){K.off("change",gt)}}},[K,ft]),Object(v.useEffect)(function(){K&&(ze==null?(K.setValue(""),pt("")):ze!==K.getValue()&&(K.setValue(ze),pt(ze),K.setCursor(K.lineCount(),0)))},[K,ze]);var Ki=Object(v.useCallback)(function(gt){var Dt=K.getCursor(),xt=K.getSelection(),Pt=xt.split(`
`);switch(gt){case"bold":return K.replaceSelection("**"+xt+"**"),xt===""&&K.setCursor(Dt.line,Dt.ch+2),K.focus();case"italic":return K.replaceSelection("*"+xt+"*"),xt===""&&K.setCursor(Dt.line,Dt.ch+1),K.focus();case"code":return K.replaceSelection("`"+xt+"`"),xt===""&&K.setCursor(Dt.line,Dt.ch+1),K.focus();case"inline-latex":return K.replaceSelection("`$$"+xt+"$$`"),xt===""&&K.setCursor(Dt.line,Dt.ch+3),K.focus();case"latex":return K.replaceSelection("```latex\n"+xt+"\n```"),K.setCursor(Dt.line+1,xt.length+1),K.focus();case"line-break":return K.replaceSelection(`
`),K.focus();case"list-ul":return xt===""?K.replaceSelection("- "+xt):K.replaceSelection(Pt.map(function(Ht){return Ht===""?"":"- ".concat(Ht)}).join(`
`)),K.focus();case"list-ol":return xt===""?K.replaceSelection("1. "+xt):K.replaceSelection(Pt.map(function(Ht,Xt){return Ht===""?"":"".concat(Xt+1,". ").concat(Ht)}).join(`
`)),K.focus();case"add-null-ch":return xt===""&&K.setCursor(Dt.line,Dt.ch+1),K.replaceSelection(Ie),K.focus();case"inster-template-1":return xt===""&&K.setCursor(Dt.line,Dt.ch),K.replaceSelection(pe),K.focus();case"eraser":return K.setValue(""),K.focus();case"trigger-watch":return $t(!It),K.focus();case"trigger-full-screen":return Yr(!hr),K.focus();case Be:Ur(Be);return;case We:Ur(We);return;case ht:Ur(ht);return;case Pe:Ur(Pe);return;default:throw new Error}},[K,It,hr]),vi=Object(v.useCallback)(function(gt){Ur("");switch(Gr){case Be:var Dt=gt.title,xt=gt.link;return K.replaceSelection("[".concat(Dt,"](").concat(xt,")")),K.focus();case We:var Pt=gt.language,Ht=gt.content;return K.replaceSelection(["```"+Pt,Ht,"```"].join(`
`)),K.focus();case ht:var Xt=gt.src,Bt=gt.alt,lr=gt.name;return Xt.indexOf("type=image")>-1?K.replaceSelection(".concat(Xt,' "').concat(Bt||"",'" )')):Xt.indexOf("type=application/pdf")>-1?K.replaceSelection('').concat(lr,"")):K.replaceSelection('').concat(lr,"")),K.focus();case Pe:for(var Rr=gt.row,Nt=gt.col,yi=gt.align,zt=`
`,pr=0;pr300&&(lr=300);var Rr=$e+lr+"px";zr(Rr)}}return gt.addEventListener("mousedown",Pt),document.addEventListener("mousemove",Xt),document.addEventListener("mouseup",Ht),function(){gt.removeEventListener("mousedown",Pt),document.removeEventListener("mousemove",Xt),document.removeEventListener("mouseup",Ht)}}},[K,ai]),Object(v.useEffect)(function(){zr($e)},[$e]);var fn=le(At),ei=le(qr),Vi={width:fn,height:ei},jn=Object(v.useMemo)(function(){if(ci){var gt=new Date(ci),Dt=gt.getHours(),xt=gt.getMinutes(),Pt=gt.getSeconds();return Dt=Dt<10?"0"+Dt:Dt,xt=xt<10?"0"+xt:xt,Pt=Pt<10?"0"+Pt:Pt,"".concat(Dt,":").concat(xt,":").concat(Pt)}return 0},[ci]);function ki(){window.sessionStorage.removeItem(ir),er(!1),ni(0)}function $a(){er(!1),ni(0),K.setValue(window.sessionStorage.getItem(ir))}function da(gt,Dt){var xt=K.getValue();xt=xt.replace(gt,Dt),pt(xt),K==null||K.setValue(xt)}return C.a.createElement(v.Fragment,null,C.a.createElement("div",{className:"markdown-editor-wrapper",ref:Kt},C.a.createElement("div",{className:"markdown-editor-container ".concat(_t," ").concat(It?"on-preview":""," ").concat(yt?"mini":""," ").concat(hr?"full-screen":""),style:Vi},C.a.createElement(S,{insertTemp:wr,watch:It,fullScreen:hr,showNullButton:st,onActionCallback:Ki,hidetoolBar:jt,uuid:Wt.current,setOpenPhones:function(){br.current=!0}}),C.a.createElement("div",{className:"markdown-editor-body"},C.a.createElement("div",{className:"codemirror-container"},C.a.createElement("textarea",{ref:sr,placeholder:_i})),It?C.a.createElement("div",{ref:nr,className:"preview-container"},vt==="stex"&&C.a.createElement(_,{value:rt}),vt!=="stex"&&C.a.createElement(p.a,{edit:!0,value:rt,replaces:da})):null))),Nr?C.a.createElement("a",{ref:ai,className:"editor-resize"}):null,C.a.createElement(P.a,null,ne[Gr]?C.a.createElement(Z.a,{centered:!0,title:ne[Gr],visible:!0,onCancel:Br,footer:null},Fn):null))}},SJMd:function(Ct,dt){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var ie,ae,Z,R=!1,X,I;window.PR_SHOULD_USE_CONTINUATION=!0;var D,H;(function(){var F=window,M=["break,continue,do,else,for,if,return,while"],O=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],v=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],C=[v,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],k=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],A=[v,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],E="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",w=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[M,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[C,A,k,w,d,o,l,h],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",_="kwd",b="com",g="typ",c="lit",u="pun",a="pln",x="tag",y="dec",S="src",P="atn",G="atv",Y="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(Ae){for(var Me=0,je=!1,et=!1,Xe=0,Ne=Ae.length;Xe122||(te<65||ue>90||tt.push([Math.max(65,ue)|32,Math.min(te,90)|32]),te<97||ue>122||tt.push([Math.max(97,ue)&~32,Math.min(te,122)&~32]))}}tt.sort(function(ye,ge){return ye[0]-ge[0]||ge[1]-ye[1]});for(var q=[],re=[],Ie=0;Iene[0]&&(ne[1]+1>ne[0]&&Le.push("-"),Le.push(Pe(ne[1])))}return Le.push("]"),Le.join("")}function qe(it){for(var Ce=it.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")),tt=Ce.length,nt=[],Le=0,Ie=0;Le=2&&ue==="["?Ce[Le]=Ke(pe):ue!=="\\"&&(Ce[Le]=pe.replace(/[a-zA-Z]/g,function(re){var ne=re.charCodeAt(0);return"["+String.fromCharCode(ne&~32,ne|32)+"]"}))}return Ce.join("")}for(var Ve=[],Xe=0,Ne=Ae.length;Xe=0;)je[Ve.charAt(it)]=qe;var Ce=qe[1],tt=""+Ce;We.hasOwnProperty(tt)||(ht.push(Ce),We[tt]=null)}ht.push(/[\0-\uffff]/),et=z(ht)})();var Xe=Me.length,Ne=function(Be){for(var ht=Be.sourceCode,We=Be.basePos,Pe=Be.sourceNode,Ke=[We,a],qe=0,Ve=ht.match(et)||[],it={},Ce=0,tt=Ve.length;Ce=5&&Le.substring(0,5)==="lang-",pe&&!(Ie&&typeof Ie[1]=="string")&&(pe=!1,Le=S),pe||(it[nt]=Le)}var te=qe;if(qe+=nt.length,!pe)Ke.push(We+te,Le);else{var q=Ie[1],re=nt.indexOf(q),ne=re+q.length;Ie[2]&&(ne=nt.length-Ie[2].length,re=ne-q.length);var ye=Le.substring(5);ee(Pe,We+te,nt.substring(0,re),Ne,Ke),ee(Pe,We+te+re,q,de(ye,q),Ke),ee(Pe,We+te+ne,nt.substring(ne),Ne,Ke)}}Be.decorations=Ke};return Ne}function Re(Ae){var Me=[],je=[];Ae.tripleQuotedStrings?Me.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?Me.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Me.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&je.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var et=Ae.hashComments;et&&(Ae.cStyleComments?(et>1?Me.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Me.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),je.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Me.push([b,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(je.push([b,/^\/\/[^\r\n]*/,null]),je.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Xe=Ae.regexLiterals;if(Xe){var Ne=Xe>1?"":`
\r`,Be=Ne?".":"[\\S\\s]",ht="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";je.push(["lang-regex",RegExp("^"+Q+"("+ht+")")])}var We=Ae.types;We&&je.push([g,We]);var Pe=(""+Ae.keywords).replace(/^ | $/g,"");Pe.length&&je.push([_,new RegExp("^(?:"+Pe.replace(/[\s,]+/g,"|")+")\\b"),null]),Me.push([a,/^\s+/,null,` \r
\xA0`]);var Ke="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(Ke+="(?!s*/)"),je.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp(Ke),null]),ve(Me,je)}var Ee=Re({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Se(Ae,Me,je){for(var et=/(?:^|\s)nocode(?:\s|$)/,Xe=/\r\n?|\n/,Ne=Ae.ownerDocument,Be=Ne.createElement("li");Ae.firstChild;)Be.appendChild(Ae.firstChild);var ht=[Be];function We(Ce){var tt=Ce.nodeType;if(tt==1&&!et.test(Ce.className))if(Ce.nodeName==="br")Pe(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var nt=Ce.firstChild;nt;nt=nt.nextSibling)We(nt);else if((tt==3||tt==4)&&je){var Le=Ce.nodeValue,Ie=Le.match(Xe);if(Ie){var pe=Le.substring(0,Ie.index);Ce.nodeValue=pe;var le=Le.substring(Ie.index+Ie[0].length);if(le){var ue=Ce.parentNode;ue.insertBefore(Ne.createTextNode(le),Ce.nextSibling)}Pe(Ce),pe||Ce.parentNode.removeChild(Ce)}}}function Pe(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function tt(Ie,pe){var le=pe?Ie.cloneNode(!1):Ie,ue=Ie.parentNode;if(ue){var te=tt(ue,1),q=Ie.nextSibling;te.appendChild(le);for(var re=q;re;re=q)q=re.nextSibling,te.appendChild(re)}return le}for(var nt=tt(Ce.nextSibling,0),Le;(Le=nt.parentNode)&&Le.nodeType===1;)nt=Le;ht.push(nt)}for(var Ke=0;Ke=ue&&(We+=2),Ne>=te&&(qe+=2)}}finally{Le&&(Le.style.display=Ie)}}var Te={};function me(Ae,Me){for(var je=Me.length;--je>=0;){var et=Me[je];Te.hasOwnProperty(et)?F.console&&console.warn("cannot override language handler %s",et):Te[et]=Ae}}function de(Ae,Me){return Ae&&Te.hasOwnProperty(Ae)||(Ae=/^\s*]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^