(window.webpackJsonp=window.webpackJsonp||[]).push([[170,6,7],{"+NIl":function(Tt,ut,he){(function(oe){oe(he("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function($,D){"use strict";function Z(L,A){L.cmdState.push(A)}function F(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function M(L){var A=L.cmdState.pop();A&&A.closeBracket()}function z(L){for(var A=L.cmdState,C=A.length-1;C>=0;C--){var u=A[C];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function H(L,A,C){return function(){this.name=L,this.bracketNo=0,this.style=A,this.styles=C,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var N={};N.importmodule=H("importmodule","tag",["string","builtin"]),N.documentclass=H("documentclass","tag",["","atom"]),N.usepackage=H("usepackage","tag",["atom"]),N.begin=H("begin","tag",["atom"]),N.end=H("end","tag",["atom"]),N.label=H("label","tag",["atom"]),N.ref=H("ref","tag",["atom"]),N.eqref=H("eqref","tag",["atom"]),N.cite=H("cite","tag",["atom"]),N.bibitem=H("bibitem","tag",["atom"]),N.Bibitem=H("Bibitem","tag",["atom"]),N.RBibitem=H("RBibitem","tag",["atom"]),N.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(L,A){L.f=A}function v(L,A){var C;if(L.match(/^\\[a-zA-Z@]+/)){var u=L.current().slice(1);return C=N.hasOwnProperty(u)?N[u]:N.DEFAULT,C=new C,Z(A,C),R(A,O),C.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return R(A,function(l,h){return T(l,h,"\\]")}),"keyword";if(L.match("\\("))return R(A,function(l,h){return T(l,h,"\\)")}),"keyword";if(L.match("$$"))return R(A,function(l,h){return T(l,h,"$$")}),"keyword";if(L.match("$"))return R(A,function(l,h){return T(l,h,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(C=F(A),C)C.closeBracket(o),R(A,O);else return"error";return"bracket"}else return o=="{"||o=="["?(C=N.DEFAULT,C=new C,Z(A,C),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),C=z(A),C.name=="begin"&&(C.argument=L.current()),C.styleIdentifier())}function T(L,A,C){if(L.eatSpace())return null;if(C&&L.match(C))return R(A,v),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=L.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(L.skipToEnd(),"comment"):"error"}function O(L,A){var C=L.peek(),u;return C=="{"||C=="["?(u=F(A),u.openBracket(C),L.eat(C),R(A,v),"bracket"):/[ \t\r]/.test(C)?(L.eat(C),null):(R(A,v),M(A),v(L,A))}return{startState:function(){var L=D.inMathMode?function(A,C){return T(A,C)}:v;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,A){return A.f(L,A)},blankLine:function(L){L.f=v,L.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"19Vz":function(Tt,ut,he){(function(oe){oe(he("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(H,N,R){var v=R&&R!=oe.Init;if(N&&!v)H.on("blur",F),H.on("change",M),H.on("swapDoc",M),oe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){Z(H)}),M(H);else if(!N&&v){H.off("blur",F),H.off("change",M),H.off("swapDoc",M),oe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),$(H);var T=H.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}N&&!H.hasFocus()&&F(H)});function $(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function D(H){$(H);var N=H.state.placeholder=document.createElement("pre");N.style.cssText="height: 0; overflow: visible",N.style.direction=H.getOption("direction"),N.className="CodeMirror-placeholder CodeMirror-line-like";var R=H.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),N.appendChild(R),H.display.lineSpace.insertBefore(N,H.display.lineSpace.firstChild)}function Z(H){setTimeout(function(){var N=!1,R=H.getInputField();R.nodeName=="TEXTAREA"?N=!R.value:H.lineCount()==1&&(N=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),N?D(H):$(H)},20)}function F(H){z(H)&&D(H)}function M(H){var N=H.getWrapperElement(),R=z(H);N.className=N.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?D(H):$(H)}function z(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(Tt,ut,he){(function(oe){oe(he("VrN/"))})(function(oe){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function(Z,F){var M=Z.indentUnit,z={},H=F.htmlMode?$:D;for(var N in H)z[N]=H[N];for(var N in F)z[N]=F[N];var R,v;function T(a,b){function m(U){return b.tokenize=U,U(a,b)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(A("atom","]]>")):null:a.match("--")?m(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(C(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=A("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",b.tokenize=O,"tag bracket");if(E=="&"){var B;return a.eat("#")?a.eat("x")?B=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):B=a.eatWhile(/[\d]/)&&a.eat(";"):B=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),B?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function O(a,b){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return b.tokenize=T,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){b.tokenize=T,b.state=h,b.tagName=b.tagStart=null;var E=b.tokenize(a,b);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(b.tokenize=L(m),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var b=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=O;break}return"string"};return b.isInAttribute=!0,b}function A(a,b){return function(m,E){for(;!m.eol();){if(m.match(b)){E.tokenize=T;break}m.next()}return a}}function C(a){return function(b,m){for(var E;(E=b.next())!=null;){if(E=="<")return m.tokenize=C(a+1),m.tokenize(b,m);if(E==">")if(a==1){m.tokenize=T;break}else return m.tokenize=C(a-1),m.tokenize(b,m)}return"meta"}}function u(a,b,m){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=m,(z.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,b){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!z.contextGrabbers.hasOwnProperty(m)||!z.contextGrabbers[m].hasOwnProperty(b))return;o(a)}}function h(a,b,m){return a=="openTag"?(m.tagStart=b.column(),w):a=="closeTag"?y:h}function w(a,b,m){return a=="word"?(m.tagName=b.current(),v="tag",x):z.allowMissingTagName&&a=="endTag"?(v="tag bracket",x(a,b,m)):(v="error",w)}function y(a,b,m){if(a=="word"){var E=b.current();return m.context&&m.context.tagName!=E&&z.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||z.matchClosing===!1?(v="tag",g):(v="tag error",k)}else return z.allowMissingTagName&&a=="endTag"?(v="tag bracket",g(a,b,m)):(v="error",k)}function g(a,b,m){return a!="endTag"?(v="error",g):(o(m),h)}function k(a,b,m){return v="error",g(a,b,m)}function x(a,b,m){if(a=="word")return v="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,B=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(E)?l(m,E):(l(m,E),m.context=new u(m,E,B==m.indented)),h}return v="error",x}function f(a,b,m){return a=="equals"?p:(z.allowMissing||(v="error"),x(a,b,m))}function p(a,b,m){return a=="string"?d:a=="word"&&z.allowUnquoted?(v="string",x):(v="error",x(a,b,m))}function d(a,b,m){return a=="string"?d:x(a,b,m)}return{startState:function(a){var b={tokenize:T,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;R=null;var m=b.tokenize(a,b);return(m||R)&&m!="comment"&&(v=null,b.state=b.state(R||m,a,b),v&&(m=v=="error"?m+" error":v)),m},indent:function(a,b,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(E&&E.noIndent)return oe.Pass;if(a.tokenize!=O&&a.tokenize!=T)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return z.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/$/,blockCommentStart:"",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(a){a.state==p&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],m=a.context;m;m=m.prev)m.tagName&&b.push(m.tagName);return b.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(Tt,ut,he){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function D(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe($)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(O){return typeof O=="string"&&Z.test(O)}for(var M=F,z=[],H=0;H<256;++H)z.push((H+256).toString(16).substr(1));function N(O){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(z[O[L+0]]+z[O[L+1]]+z[O[L+2]]+z[O[L+3]]+"-"+z[O[L+4]]+z[O[L+5]]+"-"+z[O[L+6]]+z[O[L+7]]+"-"+z[O[L+8]]+z[O[L+9]]+"-"+z[O[L+10]]+z[O[L+11]]+z[O[L+12]]+z[O[L+13]]+z[O[L+14]]+z[O[L+15]]).toLowerCase();if(!M(A))throw TypeError("Stringified UUID is invalid");return A}var R=N;function v(O,L,A){O=O||{};var C=O.random||(O.rng||D)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,L){A=A||0;for(var u=0;u<16;++u)L[A+u]=C[u];return L}return R(C)}var T=ut.a=v},"7ahc":function(Tt,ut,he){"use strict";he.d(ut,"a",function(){return w});var oe=he("k1fw"),$=he("0Owb"),D=he("+L6B"),Z=he("2/Rp"),F=he("y8nQ"),M=he("Vl3Y"),z=he("tJVT"),H=he("OaEy"),N=he("2fM7"),R=he("q1tI"),v=he.n(R),T=he("VrN/"),O=he.n(T),L=he("p77/"),A=he.n(L),C=he("c5Ni"),u=he.n(C),o=N.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"]};ut.b=function(y){var g=y.callback,k=y.onCancel,x=Object(R.useState)("python"),f=Object(z.a)(x,2),p=f[0],d=f[1];function a(m){d(h[m][1])}function b(m){g(m)}return v.a.createElement(M.a,Object($.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),v.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(N.a,{onChange:a},Object.keys(h).map(function(m){return v.a.createElement(o,{key:m,value:m},h[m][0])}))),v.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(w,{mode:p})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(Z.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function w(y){var g=y.value,k=y.onChange,x=y.mode,f=y.options,p=f===void 0?{}:f,d=Object(R.useRef)(),a=Object(R.useState)(),b=Object(z.a)(a,2),m=b[0],E=b[1];return Object(R.useEffect)(function(){if(m){function B(U){var K=U.getValue();k&&k(K)}return m.on("change",B),function(){m.off("change",B)}}},[m,k]),Object(R.useEffect)(function(){m&&m.setOption("mode",x)},[m,x]),Object(R.useEffect)(function(){m&&((g!==m.getValue()||g==="")&&setTimeout(function(){m.setValue(g||" ")},300))},[m,g]),Object(R.useEffect)(function(){if(d.current&&!m){var B=O.a.fromTextArea(d.current,Object(oe.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));E(B)}},[d.current,m]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:d}))}},"7ixt":function(Tt,ut,he){"use strict";he.d(ut,"a",function(){return D});var oe={adjustX:1,adjustY:1},$=[0,0],D={left:{points:["cr","cl"],overflow:oe,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:oe,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:oe,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:oe,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:oe,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:oe,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:oe,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:oe,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:oe,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:oe,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:oe,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:oe,offset:[-4,0],targetOffset:$}},Z=D},"8EBN":function(Tt,ut,he){(function(oe){oe(he("VrN/"))})(function(oe){"use strict";oe.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var $=0;$-1&&Z.substring(z+1,Z.length);if(H)return oe.findModeByExtension(H)},oe.findModeByName=function(Z){Z=Z.toLowerCase();for(var F=0;F=I.length?Q.slice(I.length):Q}).join(`
`)}var u=[],o=[""],l=new L.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){u.length=0,o=[""]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(G,s,c,I){if(s>=G.length||G[s].level<=c)return s;var Q=G[s];I.push(""+Q.text+" "),s++;var W=[];return s=g(G,s,Q.level,W),W.length>0&&(I.push(""),W.forEach(function(ge){I.push(ge)}),I.push(" ")),I.push(" "),s=g(G,s,c,I),s}function k(){return g(u,0,0,o),o.push(" "),o.join("")}var x={heading:function(s){var c=h.exec(s);if(c)return{type:"heading",raw:c[0],depth:c[1].length,text:c[2]}},fences:function(s){var c=this.rules.block.fences.exec(s);if(c){var I=c[0],Q=C(I,c[3]||""),W=c[2]?c[2].trim():c[2];if(["latex","katex","math"].indexOf(W)>=0){var ge=d(),je=Q;Q=ge,a[ge]={type:"block",expression:je}}return{type:"code",raw:I,lang:W,text:Q}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,d=function(){return"__special_katext_id_".concat(p++,"__")},a={};function b(){return a}function m(){p=0,a={}}function E(G){return G=G.replace(f,function(s,c){var I=d();return a[I]={type:"inline",expression:c},I}),G}var B=l.listitem;l.listitem=function(G){return B(E(G))};var U=l.paragraph;l.paragraph=function(G){return U(E(G))};var K=l.tablecell;l.tablecell=function(G,s){return K(E(G),s)},l.code=function(G,s,c){var I=(s||"").match(/\S*/)[0];return I?["latex","katex","math"].indexOf(I)>=0?"".concat(G,"
"):' ').concat(c?G:Object(A.escape)(G,!0),`
`):''+(c?G:Object(A.escape)(G,!0))+" "},l.heading=function(G,s,c){var I=this.options.headerPrefix+c.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:I,level:s,text:G}),"'+G+" "},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:x,renderer:l});var V=L.a,P=he("SJMd"),_=he("ulZh"),Y=he.n(_),ee=he("m3rI"),ae=he("Oy/b"),ce=he("p5ED"),De=he("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 Se=function(G,s){return(Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,I){c.__proto__=I}||function(c,I){for(var Q in I)Object.prototype.hasOwnProperty.call(I,Q)&&(c[Q]=I[Q])})(G,s)};function Ce(G,s){function c(){this.constructor=G}Se(G,s),G.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function Ae(G,s,c,I){return new(c||(c=Promise))(function(Q,W){function ge(pt){try{Je(I.next(pt))}catch(He){W(He)}}function je(pt){try{Je(I.throw(pt))}catch(He){W(He)}}function Je(pt){var He;pt.done?Q(pt.value):(He=pt.value,He instanceof c?He:new c(function(vt){vt(He)})).then(ge,je)}Je((I=I.apply(G,s||[])).next())})}function Te(G,s){var c,I,Q,W,ge={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return W={next:je(0),throw:je(1),return:je(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function je(Je){return function(pt){return function(He){if(c)throw new TypeError("Generator is already executing.");for(;ge;)try{if(c=1,I&&(Q=2&He[0]?I.return:He[0]?I.throw||((Q=I.return)&&Q.call(I),0):I.next)&&!(Q=Q.call(I,He[1])).done)return Q;switch(I=0,Q&&(He=[2&He[0],Q.value]),He[0]){case 0:case 1:Q=He;break;case 4:return ge.label++,{value:He[1],done:!1};case 5:ge.label++,I=He[1],He=[0];continue;case 7:He=ge.ops.pop(),ge.trys.pop();continue;default:if(!(Q=ge.trys,(Q=Q.length>0&&Q[Q.length-1])||He[0]!==6&&He[0]!==2)){ge=0;continue}if(He[0]===3&&(!Q||He[1]>Q[0]&&He[1] ',"select"),this.addActionButton(I,' ',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(I,' ',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(I,' ',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(I,' ',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(I,' ',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(I,' ',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(I,' ',"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(W){var ge=document.createElement("div");ge.className=""+c.toolbarButtonStyleClass.name,ge.setAttribute("data-type-name",W.typeName),ge.innerHTML=W.icon,ge.addEventListener("click",function(){c.markerToolbarButtonClicked(ge,W)}),c.buttons.push(ge),c.markerButtons.push(ge)}),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 Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,' ',"render"),this.addActionButton(Q,' ',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},G.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},G.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.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 c=0;c0&&this.buttonClickListeners.forEach(function(I){return I("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(I){return I("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.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)},G.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(I){return I.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},G.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(I){return/delete|notes/.test(I.getAttribute("data-action"))}).forEach(function(I){c.currentMarker===void 0?(I.style.fillOpacity="0.4",I.style.pointerEvents="none"):(I.style.fillOpacity="1",I.style.pointerEvents="all")})},G}(),Be=function(){function G(s,c,I,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=I,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ee("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ee("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ee("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
padding: `+c+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Oe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Oe("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},G.prototype.show=function(s){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(s){var c,I,Q=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((I=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&I!==void 0?I:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(W){var ge;W.uiStyleSettings=Q.uiStyleSettings;var je=document.createElement("div");je.className=Q.toolboxButtonStyleClass.name+" "+((ge=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ge!==void 0?ge:Q.toolboxButtonStyleColorsClass.name),je.innerHTML=W.icon,je.title=W.title,je.addEventListener("click",function(){Q.panelButtonClick(W)}),Q.panelButtons.push(je),Q.buttonRow.appendChild(je)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(s){var c=this,I=-1;if(s!==this.activePanel){I=this.panels.indexOf(s),this.panelRow.innerHTML="";var Q=s.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),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(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(W,ge){var je,Je;W.className=c.toolboxButtonStyleClass.name+" "+(ge===I?""+((je=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&je!==void 0?je:c.toolboxActiveButtonStyleColorsClass.name):""+((Je=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Je!==void 0?Je:c.toolboxButtonStyleColorsClass.name))})},G}(),ze=function(G,s){this.title=G,this.icon=s},Fe=function(G){function s(c,I,Q,W){var ge=G.call(this,c,W||' ')||this;return ge.colors=[],ge.addTransparent=!1,ge.colorBoxes=[],ge.colors=I,ge.currentColor=Q,ge.setCurrentColor=ge.setCurrentColor.bind(ge),ge.getColorBox=ge.getColorBox.bind(ge),ge}return Ce(s,G),s.prototype.getUi=function(){var c=this,I=document.createElement("div");return I.style.overflow="hidden",I.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var W=c.getColorBox(Q);I.appendChild(W),c.colorBoxes.push(W)}),I},s.prototype.getColorBox=function(c){var I=this,Q=this.uiStyleSettings.toolbarHeight/4,W=this.uiStyleSettings.toolbarHeight-Q,ge=document.createElement("div");ge.style.display="inline-block",ge.style.boxSizing="content-box",ge.style.width=W-2+"px",ge.style.height=W-2+"px",ge.style.padding="1px",ge.style.marginRight="2px",ge.style.marginBottom="2px",ge.style.borderWidth="2px",ge.style.borderStyle="solid",ge.style.borderRadius=(W+2)/2+"px",ge.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ge.addEventListener("click",function(){I.setCurrentColor(c,ge)});var je=document.createElement("div");return je.style.display="inline-block",je.style.width=W-2+"px",je.style.height=W-2+"px",je.style.backgroundColor=c,je.style.borderRadius=W/2+"px",c==="transparent"&&(je.style.fill=this.uiStyleSettings.toolboxAccentColor,je.innerHTML=`
`),ge.appendChild(je),ge},s.prototype.setCurrentColor=function(c,I){var Q=this;this.currentColor=c,this.colorBoxes.forEach(function(W){W.style.borderColor=W===I?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(ze),Ue=function(){function G(s,c,I){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=I,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(G.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),G.prototype.ownsTarget=function(s){return!1},Object.defineProperty(G.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),G.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},G.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},G.prototype.pointerDown=function(s,c){},G.prototype.dblClick=function(s,c){},G.prototype.manipulate=function(s){},G.prototype.pointerUp=function(s){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},G.prototype.scale=function(s,c){},G.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},G.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},G.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)}},G.typeName="MarkerBase",G}(),Ie=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.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},G}(),it=function(){function G(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},G}(),Ye=function(){function G(){}return G.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},G.toSVGMatrix=function(s,c){return s.a=c.a,s.b=c.b,s.c=c.c,s.d=c.d,s.e=c.e,s.f=c.f,s},G}(),Qe=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.left=0,W.top=0,W.width=0,W.height=0,W.defaultSize={x:50,y:20},W.offsetX=0,W.offsetY=0,W.rotationAngle=0,W.CB_DISTANCE=10,W._suppressMarkerCreateEvent=!1,W.container.transform.baseVal.appendItem(le.createTransform()),W.setupControlBox(),W}return Ce(s,G),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(c){this._visual=c;var I=le.createTransform();this._visual.transform.baseVal.appendItem(I)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!G.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,I){G.prototype.pointerDown.call(this,c,I),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(c);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(I),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(I)){this.activeGrip=this.rotatorGrip;var W=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=W.x-this.width/2,this.top=W.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ge=this.container.transform.baseVal.getItem(0);ge.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ge,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(c){var I=this.state;G.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",I==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},s.prototype.manipulate=function(c){var I=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(I.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(I.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(I):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var I=this.manipulationStartLeft,Q=this.manipulationStartWidth,W=this.manipulationStartTop,ge=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:I=this.manipulationStartLeft+c.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-I;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:W=this.manipulationStartTop+c.y-this.manipulationStartY,ge=this.manipulationStartHeight+this.manipulationStartTop-W;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ge=this.manipulationStartHeight+c.y-this.manipulationStartY}Q>=0?(this.left=I,this.width=Q):(this.left=I+Q,this.width=-Q),ge>=0?(this.top=W,this.height=ge):(this.top=W+ge,this.height=-ge),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var I=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*I,this.applyRotation()}},s.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},s.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var I=this.container.getCTM(),Q=le.createPoint(c.x,c.y);return{x:(Q=Q.matrixTransform(I)).x,y:Q.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var I=this.container.getCTM();I=I.inverse();var Q=le.createPoint(c.x,c.y);return{x:(Q=Q.matrixTransform(I)).x,y:Q.y}},s.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var c=le.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=le.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=le.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 Ie,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,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 c=new it;return c.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,I=-c/2,Q=I,W=(this.width+this.CB_DISTANCE)/2-c/2,ge=(this.height+this.CB_DISTANCE)/2-c/2,je=this.height+this.CB_DISTANCE-c/2,Je=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,I,Q),this.positionGrip(this.controlGrips.topCenter.visual,W,Q),this.positionGrip(this.controlGrips.topRight.visual,Je,Q),this.positionGrip(this.controlGrips.centerLeft.visual,I,ge),this.positionGrip(this.controlGrips.centerRight.visual,Je,ge),this.positionGrip(this.controlGrips.bottomLeft.visual,I,je),this.positionGrip(this.controlGrips.bottomCenter.visual,W,je),this.positionGrip(this.controlGrips.bottomRight.visual,Je,je),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,W,Q-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,I,Q){var W=c.transform.baseVal.getItem(0);W.setTranslate(I,Q),c.transform.baseVal.replaceItem(W,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:Ye.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ye.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var I=c;this.left=I.left,this.top=I.top,this.width=I.width,this.height=I.height,this.rotationAngle=I.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ye.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,I.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ye.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,I.containerTransformMatrix))},s.prototype.scale=function(c,I){G.prototype.scale.call(this,c,I);var Q=this.rotatePoint({x:this.left,y:this.top}),W=this.unrotatePoint({x:Q.x*c,y:Q.y*I});this.left=W.x,this.top=W.y,this.width=this.width*c,this.height=this.height*I,this.adjustControlBox()},s}(Ue),qe=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.createVisual=W.createVisual.bind(W),W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=le.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(c,I){G.prototype.pointerDown.call(this,c,I),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){G.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){G.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&le.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},G.prototype.getState.call(this))},s.prototype.restoreState=function(c){var I=c;this.fillColor=I.fillColor,this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.opacity=I.opacity,this.createVisual(),G.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,I){G.prototype.scale.call(this,c,I),this.setSize()},s.title="Rectangle marker",s}(Qe),ct=function(G){function s(c,I,Q,W){var ge=G.call(this,c,W||' ')||this;return ge.widths=[],ge.widthBoxes=[],ge.widths=I,ge.currentWidth=Q,ge.setCurrentWidth=ge.setCurrentWidth.bind(ge),ge}return Ce(s,G),s.prototype.getUi=function(){var c=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",this.widths.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.flexGrow="2",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Q===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){c.setCurrentWidth(Q,W)}),I.appendChild(W);var ge=document.createElement("div");ge.innerText=Q.toString(),ge.style.marginRight="5px",W.appendChild(ge);var je=document.createElement("div");je.style.minHeight="20px",je.style.flexGrow="2",je.style.display="flex",je.style.alignItems="center";var Je=document.createElement("hr");Je.style.minWidth="20px",Je.style.border="0px",Je.style.borderTop=Q+"px solid "+c.uiStyleSettings.toolboxColor,Je.style.flexGrow="2",je.appendChild(Je),W.appendChild(je),c.widthBoxes.push(W)}),I},s.prototype.setCurrentWidth=function(c,I){var Q=this;this.currentWidth=c,this.widthBoxes.forEach(function(W){W.style.borderColor=W===I?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(ze),et=function(G){function s(c,I,Q,W){var ge=G.call(this,c,W||' ')||this;return ge.styles=[],ge.styleBoxes=[],ge.styles=I,ge.currentStyle=Q,ge.setCurrentStyle=ge.setCurrentStyle.bind(ge),ge}return Ce(s,G),s.prototype.getUi=function(){var c=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",this.styles.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/c.styles.length-5+"%",W.style.borderColor=Q===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){c.setCurrentStyle(Q,W)}),I.appendChild(W);var ge=document.createElement("div");ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.overflow="hidden";var je=`
`;ge.innerHTML=je,W.appendChild(ge),c.styleBoxes.push(W)}),I},s.prototype.setCurrentStyle=function(c,I){var Q=this;this.currentStyle=c,this.styleBoxes.forEach(function(W){W.style.borderColor=W===I?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(ze),nt=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new Fe("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new ct("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new et("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return Ce(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="FrameMarker",s.title="Frame marker",s.icon=' ',s}(qe),Pe=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},dt=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.x1=0,W.y1=0,W.x2=0,W.y2=0,W.defaultLength=50,W.manipulationStartX=0,W.manipulationStartY=0,W.manipulationStartX1=0,W.manipulationStartY1=0,W.manipulationStartX2=0,W.manipulationStartY2=0,W.setupControlBox(),W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!!G.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,I){G.prototype.pointerDown.call(this,c,I),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.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(I)?this.activeGrip=this.grip1:this.grip2.ownsTarget(I)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var I=this.state;G.prototype.pointerUp.call(this,c),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(c),this._state="select",I==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},s.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=le.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 c=new it;return c.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},s.prototype.positionGrip=function(c,I,Q){var W=c.transform.baseVal.getItem(0);W.setTranslate(I,Q),c.transform.baseVal.replaceItem(W,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var I=c;this.x1=I.x1,this.y1=I.y1,this.x2=I.x2,this.y2=I.y2},s.prototype.scale=function(c,I){G.prototype.scale.call(this,c,I),this.x1=this.x1*c,this.y1=this.y1*I,this.x2=this.x2*c,this.y2=this.y2*I,this.adjustVisual(),this.adjustControlBox()},s}(Ue),at=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new Fe("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new ct("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new et("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.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(c,I){G.prototype.pointerDown.call(this,c,I),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()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,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 c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var I=c;this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon=' ',s}(dt),Me=function(G){function s(c,I,Q,W){var ge=G.call(this,c,W||' ')||this;return ge.fonts=[],ge.fontBoxes=[],ge.fonts=I,ge.currentFont=Q,ge.setCurrentFont=ge.setCurrentFont.bind(ge),ge}return Ce(s,G),s.prototype.getUi=function(){var c=this,I=document.createElement("div");return I.style.overflow="hidden",I.style.flexGrow="2",this.fonts.forEach(function(Q){var W=document.createElement("div");W.style.display="inline-block",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/c.fonts.length-5+"%",W.style.borderColor=Q===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){c.setCurrentFont(Q,W)}),I.appendChild(W);var ge=document.createElement("div");ge.style.display="flex",ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.fontFamily=Q,ge.style.overflow="hidden";var je=document.createElement("div");je.style.whiteSpace="nowrap",je.style.overflow="hidden",je.style.textOverflow="ellipsis",je.innerHTML="The quick brown fox jumps over the lazy dog",ge.appendChild(je),W.appendChild(ge),c.fontBoxes.push(W)}),I},s.prototype.setCurrentFont=function(c,I){var Q=this;this.currentFont=c,this.fontBoxes.forEach(function(W){W.style.borderColor=W===I?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(ze),Ge=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.color="transparent",W.padding=5,W.DEFAULT_TEXT="your text here",W.text=W.DEFAULT_TEXT,W.isMoved=!1,W.color=Q.defaultColor,W.fontFamily=Q.defaultFontFamily,W.defaultSize={x:100,y:30},W.setColor=W.setColor.bind(W),W.setFont=W.setFont.bind(W),W.renderText=W.renderText.bind(W),W.sizeText=W.sizeText.bind(W),W.textEditDivClicked=W.textEditDivClicked.bind(W),W.showTextEditor=W.showTextEditor.bind(W),W.setSize=W.setSize.bind(W),W.positionTextEditor=W.positionTextEditor.bind(W),W.colorPanel=new Fe("Color",Q.defaultColorSet,Q.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.fontFamilyPanel=new Me("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W}return Ce(s,G),s.prototype.ownsTarget=function(c){if(G.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var I=!1;return this.textElement.childNodes.forEach(function(Q){Q===c&&(I=!0)}),I},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,I){G.prototype.pointerDown.call(this,c,I),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.renderText=function(){var c=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(I){c.textElement.appendChild(le.createTSpan(I.trim()===""?" ":I.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),I=1;if(c.width>0&&c.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/c.width,W=(1*this.height-this.height*this.padding*2/100)/c.height;I=Math.min(Q,W)}return I},s.prototype.getTextPosition=function(c){var I=this.textElement.getBBox(),Q=0,W=0;return I.width>0&&I.height>0&&(Q=(this.width-I.width*c)/2,W=this.height/2-I.height*c/2),{x:Q,y:W}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),I=this.getTextScale(),Q=this.getTextPosition(I);Q.y-=c.y*I,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+I+", "+I+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(I,I))},s.prototype.manipulate=function(c){G.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var I=this.state;I==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,c),this.setSize(),(I==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var c=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(I){I.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var I=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&I>.9;)I-=.1,c.textEditor.style.fontSize=Math.max(I,.9)+"em"}),this.textEditor.addEventListener("keyup",function(I){I.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(I){if(I.clipboardData){var Q=I.clipboardData.getData("text"),W=window.getSelection();if(!W.rangeCount)return!1;W.deleteFromDocument(),W.getRangeAt(0).insertNode(document.createTextNode(Q)),I.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.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 c=this.getTextScale(),I=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),W={x:Q.width*c,y:Q.height*c};I.x-=W.x/2,I.y-=W.y/2,this.textEditor.style.top=I.y+"px",this.textEditor.style.left=I.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-I.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},s.prototype.dblClick=function(c,I){G.prototype.dblClick.call(this,c,I),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&le.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},s.prototype.setFont=function(c){this.textElement&&le.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,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 c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var I=c;this.color=I.color,this.fontFamily=I.fontFamily,this.padding=I.padding,this.text=I.text,this.createVisual(),G.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,I){G.prototype.scale.call(this,c,I),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon=' ',s}(Qe),xe=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.color="transparent",W.lineWidth=3,W.drawing=!1,W.pixelRatio=1,W.color=Q.defaultColor,W.lineWidth=Q.defaultStrokeWidth,W.pixelRatio=Q.freehandPixelRatio,W.setColor=W.setColor.bind(W),W.addCanvas=W.addCanvas.bind(W),W.finishCreation=W.finishCreation.bind(W),W.setLineWidth=W.setLineWidth.bind(W),W.colorPanel=new Fe("Color",Q.defaultColorSet,Q.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.lineWidthPanel=new ct("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.lineWidthPanel.onWidthChanged=W.setLineWidth,W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var c=le.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,I){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(c.x,c.y),this.drawing=!0):G.prototype.pointerDown.call(this,c,I)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,c)},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(),G.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),I=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=I[0],W=I[1],ge=I[2],je=I[3],Je=!1,pt=0;pt0&&(Je=!0,ptje&&(je=pt),He>ge&&(ge=He));if(Je){this.left=Q/this.pixelRatio,this.top=W/this.pixelRatio,this.width=(ge-Q)/this.pixelRatio,this.height=(je-W)/this.pixelRatio;var vt=document.createElement("canvas");vt.width=ge-Q,vt.height=je-W,vt.getContext("2d").putImageData(this.canvasContext.getImageData(Q,W,ge-Q,je-W),0,0),this.drawingImgUrl=vt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},s.prototype.setLineWidth=function(c){this.lineWidth=c},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 c=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),G.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,I){G.prototype.scale.call(this,c,I),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon=' ',s}(Qe),me=function(G){function s(c,I,Q){var W=G.call(this,c,Q||' ')||this;return W.typeBoxes=[],W.currentType=I,W.setCurrentType=W.setCurrentType.bind(W),W}return Ce(s,G),s.prototype.getUi=function(){var c=this,I=document.createElement("div");I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2";for(var Q=function(je){var Je="both";switch(je){case 0:Je="both";break;case 1:Je="start";break;case 2:Je="end";break;case 3:Je="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=Je===W.currentType?W.uiStyleSettings.toolboxAccentColor:"transparent",pt.addEventListener("click",function(){c.setCurrentType(Je,pt)}),I.appendChild(pt),Je==="both"||Je==="start"){var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.innerHTML=`
`,He.style.marginLeft="5px",pt.appendChild(He)}var vt=document.createElement("div");vt.style.display="flex",vt.style.alignItems="center",vt.style.minHeight="20px",vt.style.flexGrow="2";var Ft=document.createElement("hr");if(Ft.style.minWidth="20px",Ft.style.border="0px",Ft.style.borderTop="3px solid "+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee"),Ft.style.flexGrow="2",vt.appendChild(Ft),pt.appendChild(vt),Je==="both"||Je==="end"){var Xt=document.createElement("div");Xt.style.display="flex",Xt.style.alignItems="center",Xt.style.minHeight="20px",Xt.innerHTML=`
`,Xt.style.marginRight="5px",pt.appendChild(Xt)}W.typeBoxes.push(pt)},W=this,ge=0;ge<4;ge++)Q(ge);return I},s.prototype.setCurrentType=function(c,I){var Q=this;this.currentType=c,this.typeBoxes.forEach(function(W){W.style.borderColor=W===I?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(ze),ye=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.arrowType="end",W.arrowBaseHeight=10,W.arrowBaseWidth=10,W.getArrowPoints=W.getArrowPoints.bind(W),W.setArrowType=W.setArrowType.bind(W),W.arrowTypePanel=new me("Arrow type","end"),W.arrowTypePanel.onArrowTypeChanged=W.setArrowType,W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,I){var Q=this.arrowBaseWidth+2*this.strokeWidth,W=this.arrowBaseHeight+2*this.strokeWidth;return c-Q/2+","+(I+W/2)+" "+c+","+(I-W/2)+" "+(c+Q/2)+","+(I+W/2)},s.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,I){G.prototype.pointerDown.call(this,c,I),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(G.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",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),I=this.arrow1.transform.baseVal.getItem(0);I.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(I,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},s.prototype.setArrowType=function(c){this.arrowType=c,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 c=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var I=c;this.arrowType=I.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon=' ',s}(at),re=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.fillColor=Q.defaultFillColor,W.strokeWidth=0,W.fillPanel=new Fe("Color",Q.defaultColorSet,Q.defaultFillColor),W.fillPanel.onColorChanged=W.setFillColor,W}return Ce(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="CoverMarker",s.title="Cover marker",s.icon=' ',s}(qe),ie=function(G){function s(c,I,Q,W){var ge=G.call(this,c,W||' ')||this;return ge.opacities=[],ge.opacityBoxes=[],ge.opacities=I,ge.currentOpacity=Q,ge.setCurrentOpacity=ge.setCurrentOpacity.bind(ge),ge}return Ce(s,G),s.prototype.getUi=function(){var c=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",I.style.justifyContent="space-between",this.opacities.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Q===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){c.setCurrentOpacity(Q,W)}),I.appendChild(W);var ge=document.createElement("div");ge.innerText=100*Q+"%",W.appendChild(ge),c.opacityBoxes.push(W)}),I},s.prototype.setCurrentOpacity=function(c,I){var Q=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(W){W.style.borderColor=W===I?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(ze),se=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.setOpacity=W.setOpacity.bind(W),W.fillColor=Q.defaultHighlightColor,W.strokeWidth=0,W.opacity=Q.defaultHighlightOpacity,W.fillPanel=new Fe("Color",Q.defaultColorSet,W.fillColor),W.fillPanel.onColorChanged=W.setFillColor,W.opacityPanel=new ie("Opacity",Q.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return Ce(s,G),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&le.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 c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon=' ',s}(re),pe=' ',be=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.bgColor="transparent",W.tipPosition={x:0,y:0},W.tipBase1Position={x:0,y:0},W.tipBase2Position={x:0,y:0},W.tipMoving=!1,W.color=Q.defaultStrokeColor,W.bgColor=Q.defaultFillColor,W.fontFamily=Q.defaultFontFamily,W.defaultSize={x:100,y:30},W.setBgColor=W.setBgColor.bind(W),W.getTipPoints=W.getTipPoints.bind(W),W.positionTip=W.positionTip.bind(W),W.setTipPoints=W.setTipPoints.bind(W),W.colorPanel=new Fe("Text color",Q.defaultColorSet,W.color,' '),W.colorPanel.onColorChanged=W.setColor,W.bgColorPanel=new Fe("Fill color",Q.defaultColorSet,W.bgColor,pe),W.bgColorPanel.onColorChanged=W.setBgColor,W.fontFamilyPanel=new Me("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W.tipGrip=new it,W.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),W.controlBox.appendChild(W.tipGrip.visual),W}return Ce(s,G),s.prototype.ownsTarget=function(c){return G.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,I){this.state==="new"&&G.prototype.pointerDown.call(this,c,I),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(I)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,c,I)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,c);else{var I=this.state==="creating";G.prototype.pointerUp.call(this,c),this.setTipPoints(I),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var I=this.unrotatePoint(c);this.tipPosition={x:I.x-this.manipulationStartLeft,y:I.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",c]]),le.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},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(c){c===void 0&&(c=!1);var I=Math.min(this.height/2,15),Q=this.height/5;c&&(this.tipPosition={x:I+Q/2,y:this.height+20});var W=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?W ',s}(Ge),_e=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.fillColor=Q.defaultFillColor,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.setOpacity=W.setOpacity.bind(W),W.createVisual=W.createVisual.bind(W),W.strokePanel=new Fe("Line color",ve(Q.defaultColorSet,["transparent"]),Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.fillPanel=new Fe("Fill color",ve(Q.defaultColorSet,["transparent"]),W.fillColor,pe),W.fillPanel.onColorChanged=W.setFillColor,W.strokeWidthPanel=new ct("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new et("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W.opacityPanel=new ie("Opacity",Q.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=le.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(c,I){G.prototype.pointerDown.call(this,c,I),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){G.prototype.setSize.call(this),le.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(c){G.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&le.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 c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var I=c;this.fillColor=I.fillColor,this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.opacity=I.opacity,this.createVisual(),G.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,I){G.prototype.scale.call(this,c,I),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon=' ',s}(Qe),We=function(G){function s(c,I,Q){return G.call(this,c,I,Q)||this}return Ce(s,G),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=le.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(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.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(le.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,I){G.prototype.pointerDown.call(this,c,I),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.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()]]),le.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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),I=this.tip1.transform.baseVal.getItem(0);I.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(I,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon=' ',s}(at),$e=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.strokePanel.colors=Q.defaultColorSet,W.fillColor="transparent",W}return Ce(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon=' ',s}(_e),st=function(){function G(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),G.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))},G.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},G.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},G.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}},G.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},G}(),Ze=function(G){function s(c,I,Q){var W=G.call(this,c,I,Q)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.curveX=0,W.curveY=0,W.manipulationStartCurveX=0,W.manipulationStartCurveY=0,W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.positionGrips=W.positionGrips.bind(W),W.addControlGrips=W.addControlGrips.bind(W),W.adjustVisual=W.adjustVisual.bind(W),W.setupControlBox=W.setupControlBox.bind(W),W.resize=W.resize.bind(W),W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new Fe("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new ct("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new et("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return Ce(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},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=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.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(c,I){G.prototype.pointerDown.call(this,c,I),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(I)&&(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()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.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,G.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/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(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),G.prototype.resize.call(this,c),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(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},s.prototype.scale=function(c,I){this.curveX=this.curveX*c,this.curveY=this.curveY*I,G.prototype.scale.call(this,c,I)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var I=c;this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.curveX=I.curveX,this.curveY=I.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon=' ',s}(dt),St=function(){function G(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),Et=function(G){function s(c,I,Q){var W=G.call(this,c,!1)||this;return W.dataUrl=I,W.state=Q,W}return Ce(s,G),s}(St),lt=function(G){function s(c,I,Q){Q===void 0&&(Q=!1);var W=G.call(this,c,Q)||this;return W.marker=I,W}return Ce(s,G),s}(St),Pt=function(){function G(){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 G.prototype.addEventListener=function(s,c){this[s].push(c)},G.prototype.removeEventListener=function(s,c){var I=this[s].indexOf(c);I>-1&&this[s].splice(I,1)},G}(),_t=function(){function G(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 Pe,this._isOpen=!1,this.undoRedoManager=new st,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 Pt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new ke(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(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[nt,xe,ye,Ge,$e,_e,se,be,We,re,at,Ze]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[nt,xe,ye,Ge,_e,se,be]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[nt,xe,ye,Ge,se]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(I){if(typeof I=="string"){var Q=c.ALL_MARKER_TYPES.find(function(W){return W.typeName===I});Q!==void 0&&c._availableMarkerTypes.push(Q)}else c._availableMarkerTypes.push(I)})},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),G.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},G.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new St(s))})},G.prototype.render=function(){return Ae(this,void 0,void 0,function(){var s;return Te(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new de).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 c.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},G.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var I=!1;s||this.eventListeners.beforeclose.forEach(function(Q){var W=new St(c,!0);Q(W),W.defaultPrevented&&(I=!0)}),I||(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(Q){return Q(new St(c))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var s,c=[],I=0;Ithis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,I=c ',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()},G.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")},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 Re(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()},G.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())},G.prototype.toolbarButtonClicked=function(s,c){if(s==="marker"&&c!==void 0)this.createNewMarker(c);else if(s==="action")switch(c){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()}},G.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var W=new lt(s,s._currentMarker,!0);Q(W),W.defaultPrevented&&(c=!0)}),!c){var I=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(Q){return Q(new lt(s,I))})}}},G.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ge){var je=new lt(s,void 0,!0);ge(je),je.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var I=function(ge){var je=Q.markers[ge];Q.setCurrentMarker(Q.markers[ge]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(Je){return Je(new lt(s,je))})},Q=this,W=this.markers.length-1;W>=0;W--)I(W);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.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))},G.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)},G.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},G.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),I=this.undoRedoManager.getLastUndoStep();if(!I||I.width===c.width&&I.height===c.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),Q1&&this.panTo({x:s.clientX,y:s.clientY}))},G.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()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(s,c){var I=this.markerImage.getBoundingClientRect();return{x:(s-I.left)/this.zoomLevel,y:(c-I.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.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()},G.prototype.addLicenseKey=function(s){te.addKey(s)},G.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},G.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},G.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(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.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(c){return c(new St(s))}))},G.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new St(s))}))},G.instanceCounter=0,G}();/* **********************************
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 Mt=function(G,s){return(Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,I){c.__proto__=I}||function(c,I){for(var Q in I)Object.prototype.hasOwnProperty.call(I,Q)&&(c[Q]=I[Q])})(G,s)};function jt(G,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function c(){this.constructor=G}Mt(G,s),G.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function Lt(G,s,c,I){return new(c||(c=Promise))(function(Q,W){function ge(pt){try{Je(I.next(pt))}catch(He){W(He)}}function je(pt){try{Je(I.throw(pt))}catch(He){W(He)}}function Je(pt){var He;pt.done?Q(pt.value):(He=pt.value,He instanceof c?He:new c(function(vt){vt(He)})).then(ge,je)}Je((I=I.apply(G,s||[])).next())})}function pr(G,s){var c,I,Q,W,ge={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return W={next:je(0),throw:je(1),return:je(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function je(Je){return function(pt){return function(He){if(c)throw new TypeError("Generator is already executing.");for(;ge;)try{if(c=1,I&&(Q=2&He[0]?I.return:He[0]?I.throw||((Q=I.return)&&Q.call(I),0):I.next)&&!(Q=Q.call(I,He[1])).done)return Q;switch(I=0,Q&&(He=[2&He[0],Q.value]),He[0]){case 0:case 1:Q=He;break;case 4:return ge.label++,{value:He[1],done:!1};case 5:ge.label++,I=He[1],He=[0];continue;case 7:He=ge.ops.pop(),ge.trys.pop();continue;default:if(!(Q=ge.trys,(Q=Q.length>0&&Q[Q.length-1])||He[0]!==6&&He[0]!==2)){ge=0;continue}if(He[0]===3&&(!Q||He[1]>Q[0]&&He[1]0&&c>0){var I=new Hr(s,c),Q=I.ratio>=1?20:I.getHorizontalLength(20),W=I.ratio<1?20:I.getVerticalLength(20),ge=document.createElementNS("http://www.w3.org/2000/svg","svg");ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),ge.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ge);var je=bt.createDefs();ge.appendChild(je);var Je=bt.createElement("clipPath",[["id","text-bg-clip"]]);je.appendChild(Je);var pt=bt.createPath(bt.getHollowRectanglePath((24-Q)/2,(24-W)/2,Q,W,(24-Q)/2+2,(24-W)/2+2,Q-4,W-4));ge.appendChild(pt);var He=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);He.appendChild(bt.createTSpan(s+":"+c)),ge.appendChild(He);var vt=He.getBBox();bt.setAttributes(He,[["x",((24-vt.width)/2).toString()],["y",((24-vt.height)/2-vt.y).toString()]]);var Ft=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(vt.width))/2,(24-Math.ceil(vt.height))/2,Math.ceil(vt.width),Math.ceil(vt.height)));return Je.appendChild(Ft),bt.setAttributes(pt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ge),ge.outerHTML}return' '},G}(),gr=function(G){function s(c,I,Q){var W=G.call(this,c,I)||this;return W.isDropdownOpen=!1,W.onClick=W.dropdownButtonClicked,W.dropdownButtons=Q,W}return jt(s,G),s.prototype.setupDropdown=function(){var c=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(I){I.className=c.className,I.colorsClassName=c.colorsClassName,c.dropdownBlock.appendChild(I.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}(Bt),Dt=function(){function G(s,c){this.GRIP_SIZE=10,this.color=s,this.fillColor=c,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},G.prototype.setCenter=function(s,c){this.visual.childNodes.forEach(function(I){return bt.setAttributes(I,[["cx",s.toString()],["cy",c.toString()]])})},G}(),Fr=function(){function G(s,c,I,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=c,this.margin=I,this.container=Q,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(G.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(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),G.prototype.open=function(){var s=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var c=0;cthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-c.height/2),bt.setAttributes(this.cropRectElement,[["x",c.x.toString()],["y",c.y.toString()],["width",c.width.toString()],["height",c.height.toString()]]);var I=c.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(W,ge){var je=c.y+I*(ge+1);bt.setAttributes(W,[["x1",""+c.x],["y1",""+je],["x2",""+(c.x+c.width)],["y2",""+je]])});var Q=c.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(W,ge){var je=c.x+Q*(ge+1);bt.setAttributes(W,[["x1",""+je],["y1",""+c.y],["x2",""+je],["y2",""+(c.y+c.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,c.x,c.y,c.width,c.height)]]),this.topLeftGrip.setCenter(c.x,c.y),this.topRightGrip.setCenter(c.x+c.width,c.y),this.bottomLeftGrip.setCenter(c.x,c.y+c.height),this.bottomRightGrip.setCenter(c.x+c.width,c.y+c.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},G.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)},G.prototype.clientToLocalCoordinates=function(s,c){var I=this.container.getBoundingClientRect();return{x:s-I.left+this.margin,y:c-I.top+this.margin}},G.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)},G.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var c=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(c)}s.preventDefault()},G.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},G.prototype.move=function(s){var c=s.x-this.previousPoint.x,I=s.y-this.previousPoint.y;this.zoomFactor!==1&&(c=-c/this.zoomFactor,I=-I/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+c),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+I),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},G.prototype.resize=function(s){var c=Object.assign({},this.cropRect),I=s.x-this.previousPoint.x,Q=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:c.x+Ithis.canvasWidth*this.zoomFactor&&(I=this.canvasWidth*this.zoomFactor-c.width),c.width+=I}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(c.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(I),c.height=this.aspectRatio.getVerticalLength(c.width)):(c.y+=Q,c.height=this.cropRect.y+this.cropRect.height-c.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?c.height=this.aspectRatio.getVerticalLength(c.width):c.height+=Q}c.width<10&&(c.x=this.cropRect.x,c.width=10),c.height<10&&(c.y=this.cropRect.y,c.height=10),this.previousPoint=s,c.x>=this.margin&&c.y>=this.margin&&c.x-this.margin+c.width<=this.canvasWidth&&c.y-this.margin+c.height<=this.canvasHeight&&(this.cropRect=c,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},G.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,c=this.cropRect.y+this.cropRect.height/2,I=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);I/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=c-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)}},G.prototype.getRescaledRect=function(s,c,I,Q,W,ge){var je=I/s,Je=Q/c;return{x:(W.x-ge)*je+ge,y:(W.y-ge)*Je+ge,width:W.width*je,height:W.height*Je}},G.prototype.scaleCanvas=function(s,c){var I=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,c,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=c,this.onCropChange&&this.onCropChange(I),this.setCropRectangle(I)},G}(),Vr=function(){function G(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(G.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),G.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},G.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},G.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},G.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},G.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},G.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)}},G.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 c="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,I=1;I<=this.width/5+10;I++){var Q=I%5==0?this.height/3:this.height/6;c+="h4v"+-Q+"h1v"+Q}c+="v1H0Z",this.scaleShape=bt.createPath(c);var W=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(W),s.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ge=bt.createTSpan("");return ge.innerHTML="°",this.angleLabelElement.appendChild(ge),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},G}(),fi=function(){function G(){this.naturalSize=!1,this.imageType="image/png"}return G.prototype.rasterize=function(s,c,I,Q,W,ge,je){var Je=this;return new Promise(function(pt){var He=document.createElement("canvas");He.width=s.width.baseVal.value-2*Q,He.height=s.height.baseVal.value-2*Q;var vt=1,Ft=1;Je.naturalSize===!0?(vt=c.naturalWidth/(s.width.baseVal.value-2*Q)/ge,Ft=c.naturalHeight/(s.height.baseVal.value-2*Q)/je,He.width=c.naturalWidth/ge,He.height=c.naturalHeight/je):Je.width!==void 0&&Je.height!==void 0&&(vt=Je.width/I.width,Ft=Je.height/I.height,He.width*=vt,He.height*=Ft);var Xt=He.getContext("2d");Xt.translate(He.width/2,He.height/2),Xt.rotate(W*Math.PI/180),Xt.scale(ge,je),Xt.translate(-He.width/2,-He.height/2),Xt.drawImage(c,0,0,He.width,He.height);var _r=document.createElement("canvas");_r.width=I.width*vt,_r.height=I.height*Ft,_r.getContext("2d").putImageData(Xt.getImageData((I.x-Q)*vt,(I.y-Q)*Ft,I.width*vt,I.height*Ft),0,0),pt(_r.toDataURL(Je.imageType,Je.imageQuality))})},G}(),Ve=function(){function G(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=G.instanceCounter++,this.styles=new Nr(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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.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(G.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(G.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.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}),G.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},G.prototype.show=function(){this.showUI(),this.open()},G.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(c){return c()}),this._isOpen=!1)},G.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},G.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},G.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},G.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},G.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))},G.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,I=c+2*this.CANVAS_MARGINs+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=c+"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},G.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},G.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Br,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 c=new qr;c.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(c);var I=[];this.aspectRatios.forEach(function(Ft){var Xt=new Bt(ei.getIcon(Ft.horizontal,Ft.vertical),Ft.horizontal===0&&Ft.vertical===0?"FREE":Ft.horizontal+":"+Ft.vertical);Xt.onClick=function(){return s.ratioButtonClicked(Ft)},I.push(Xt)}),this.aspectRatioButton=new gr(ei.getIcon(0,0),"Aspect ratio",I),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,c.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new Bt(' ',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){s.isGridVisible=!s.isGridVisible,Q.isActive=s.isGridVisible},c.addButton(Q);var W=new Bt(' ',"Zoom to selection");if(W.isActive=this.zoomToCropEnabled,W.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,W.isActive=s.zoomToCropEnabled},c.addButton(W),!Kr.isLicensed){var ge=new ft;this.topToolbar.addElementBlock(ge);var je=document.createElement("div");je.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Je=document.createElement("a");Je.style.color="currentColor",Je.href="https://markerjs.com/products/cropro",Je.target="_blank",Je.innerHTML=' ',je.appendChild(Je),ge.addElement(je)}var pt=new qr;pt.minWidth=3*this.toolbarHeight+"px",pt.contentAlign="end",this.topToolbar.addButtonBlock(pt);var He=new Bt(' ',"OK");He.onClick=this.startRenderAndClose,pt.addButton(He),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(He.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var vt=new Bt(' ',"Close");vt.onClick=this.close,pt.addButton(vt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(vt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},G.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Br,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 c=new qr;c.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(c);var I=new Bt(' ',"Rotate left");I.onClick=this.rotateLeftButtonClicked,c.addButton(I);var Q=new Bt(' ',"Rotate right");Q.onClick=this.rotateRightButtonClicked,c.addButton(Q);var W=new ft;W.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(W),this.straightener=new Vr("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},W.addElement(this.straightener.getUI());var ge=new qr;ge.minWidth=2*this.toolbarHeight+"px",ge.contentAlign="end",this.bottomToolbar.addButtonBlock(ge);var je=new Bt(' ',"Flip horizontal");je.onClick=this.flipHorizontallyButtonClicked,ge.addButton(je);var Je=new Bt(' ',"Flip vertical");Je.onClick=this.flipVerticallyButtonClicked,ge.addButton(Je)},G.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},G.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ei.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},G.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Hr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},G.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},G.prototype.restoreState=function(s){if(s){var c=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(c),this.cropRectChanged(c),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},G.prototype.clientToLocalCoordinates=function(s,c){var I=this.cropImage.getBoundingClientRect();return{x:s-I.left,y:c-I.top}},G.prototype.onWindowResize=function(){this.positionUI()},G.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()},G.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)},G.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)},G.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},G.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},G.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 c=this.editingTargetRotationContainer.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(c,0);var I=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/I.width,this.imageHeight/I.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},G.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},G.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},G.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},G.prototype.startRenderAndClose=function(){return Lt(this,void 0,void 0,function(){var s,c;return pr(this,function(I){switch(I.label){case 0:return[4,this.render()];case 1:return s=I.sent(),c=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(s,c)}),this.close(!0),[2]}})})},G.prototype.render=function(){return Lt(this,void 0,void 0,function(){var s;return pr(this,function(c){switch(c.label){case 0:return(s=new fi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),bt.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 c.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,c.sent()]}})})},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new mr("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 mr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new mr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new mr("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 mr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new mr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new mr("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 mr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new mr("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 mr("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 mr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},G.instanceCounter=0,G}(),Ct=he("8hTe"),pi=he.n(Ct),mi=/]*>/g;function gi(G){var s=document.createElement("div");return s.innerHTML=G,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var vi=ut.a=function(G){var s=G.value,c=s===void 0?"":s,I=G.edit,Q=I===void 0?!1:I,W=G.className,ge=G.showTextOnly,je=G.showLines,Je=G.replaces,pt=G.zoomImg,He=G.hasMask,vt=G.style,Ft=vt===void 0?{}:vt,Xt=G.stylesPrev,_r=Xt===void 0?{}:Xt,vr=String(c),yr=Object(R.useRef)(),Xr=Object(R.useRef)(),Oi=Object(R.useState)(""),nr=Object(z.a)(Oi,2),Ur=nr[0],oi=nr[1],si=Object(R.useState)("office"),Pr=Object(z.a)(si,2),_i=Pr[0],yi=Pr[1],zi=function(){var Ut=new Ve(Xr.current);Ut.displayMode="popup",Ut.addRenderEventListener(function(){var dr=Object(M.a)(N.a.mark(function Rt(qt){var Gt;return N.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return yr.current.style.display="none",ar.next=3,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt}});case 3:Gt=ar.sent,Gt!=null&&Gt.id&&Je(Xr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Gt==null?void 0:Gt.id,"?type=").concat(Gt.content_type));case 5:case"end":return ar.stop()}},Rt)}));return function(Rt){return dr.apply(this,arguments)}}()),Ut.show()},Ki=function(){var Ut=new _t(Xr.current);Ut.settings.displayMode="popup",Ut.addEventListener("render",function(){var dr=Object(M.a)(N.a.mark(function Rt(qt){var Gt;return N.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:if(yr.current.style.display="none",!Xr.current){ar.next=6;break}return ar.next=4,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:qt.dataUrl}});case 4:Gt=ar.sent,Gt!=null&&Gt.id&&Je(Xr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Gt==null?void 0:Gt.id,"?type=").concat(Gt.content_type));case 6:case"end":return ar.stop()}},Rt)}));return function(Rt){return dr.apply(this,arguments)}}()),Ut.show(),window.markerArea=Ut},Yr=Object(R.useMemo)(function(){yr.current&&(yr.current.style.zIndex=-1);try{var Jt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ut=/\"\/api\/attachments\/|\"\/attachments\/download\//g,dr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;vr=vr.replace(Jt,"("+ee.a.API_SERVER+"/api/attachments/").replace(Ut,'"'+ee.a.API_SERVER+"/api/attachments/").replace(dr,'"'+ee.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(ti){}var Rt=V(vr),qt=b();if(vr.match(/\[TOC\]/)&&(Rt=Rt.replace("[TOC]
",k()),w()),Rt=Rt.replace(/(__special_katext_id_\d+__)/g,function(ti,ar){var Sr=qt[ar],Vi=Sr.type,Ei=Sr.expression;return Object(ae.renderToString)(gi(Ei)||"",{displayMode:Vi==="block",throwOnError:!1,output:"html"})}),Rt=Rt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ge){var Gt=document.createElement("div");return Gt.innerHTML=Rt,Gt.innerText}return setTimeout(function(){return dn()},500),Rt},[vr]),Gr=Object(R.useRef)();y.WebkitLineClamp=je,je&&(Ft=Object(F.a)(Object(F.a)({},Ft),y));function bi(Jt){var Ut=Jt.target;if(Ut.tagName.toUpperCase()==="IMG"){if(pt){var dr=Ut.getAttribute("src");oi(dr),yi("image")}}else if(Ut.tagName.toUpperCase()==="A"){var Rt=Ut.getAttribute("href");if(Rt.indexOf("office")>-1)Jt.preventDefault(),oi(Rt),yi("office");else if(Rt.indexOf("application/pdf")>-1)Jt.preventDefault(),oi(Rt),yi("pdf");else if(Rt.indexOf("text/html")>-1)Jt.preventDefault(),oi(Rt),yi("html");else if(Rt.startsWith("#")){Jt.preventDefault();var qt=document.getElementById(Rt.replace("#",""));qt&&qt.scrollIntoView(!0)}}}var dn=function(){var Ut,dr=(Ut=Gr.current)===null||Ut===void 0?void 0:Ut.querySelectorAll("video");dr==null||dr.forEach(function(Rt){if(Rt.oncontextmenu=function(){return!1},Rt.src.indexOf(".m3u8")>-1&&!Rt.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var qt=new Y.a;qt.loadSource(Rt.src),qt.attachMedia(Rt)}}})};Object(R.useEffect)(function(){if(Gr.current&&Yr&&(Yr.match(mi)&&window.PR.prettyPrint()),Gr.current)return Gr.current.addEventListener("click",bi),function(){Gr.current.removeEventListener("click",bi),m(),w()}},[Yr,Gr.current,bi]);var xi=function(Ut){if(!Q)return;Ut.target.nodeName==="IMG"?(yr.current.style.zIndex=1,yr.current.style.display="flex",yr.current.style.width=Ut.target.clientWidth+"px",yr.current.style.height=Ut.target.clientHeight+"px",yr.current.style.top=Ut.target.offsetTop+"px",yr.current.style.left=Ut.target.offsetLeft+"px",Xr.current.src=Ut.target.getAttribute("src")):yr.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:Gr,style:Object(F.a)({},Ft),className:"".concat(W||""," markdown-body ").concat(pi.a.mdBody),onMouseOver:xi,dangerouslySetInnerHTML:{__html:Yr}}),v.a.createElement("div",{ref:yr,className:pi.a.button},v.a.createElement($.a,null,v.a.createElement(Z.a,{onClick:function(){return zi()}},"\u88C1\u526A"),v.a.createElement(Z.a,{onClick:function(){return Ki()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:Xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(ce.a,{close:!0,data:Ur,type:Ur!=null&&Ur.length?_i:"",style:Object(F.a)({},_r),onClose:function(){return oi("")}}))}},"9VGf":function(Tt,ut,he){"use strict";he.d(ut,"a",function(){return D});var oe=he("q1tI"),$=he.n(oe);function D(Z,F){var M=Object(oe.useRef)();Object(oe.useEffect)(function(){M.current=Z}),Object(oe.useEffect)(function(){function z(){M.current()}if(F!==null){var H=setInterval(z,F);return function(){return clearInterval(H)}}},[F])}},"9ivq":function(Tt,ut,he){},Bd2K:function(Tt,ut,he){(function(oe){oe(he("VrN/"),he("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(N,R,v){if(v!=oe.Init&&v&&N.removeKeyMap("autoCloseTags"),!R)return;var T={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(T["'/'"]=function(O){return M(O)}),(typeof R!="object"||R.whenOpening!==!1)&&(T["'>'"]=function(O){return Z(O)}),N.addKeyMap(T)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Z(N){if(N.getOption("disableInput"))return oe.Pass;for(var R=N.listSelections(),v=[],T=N.getOption("autoCloseTags"),O=0;OL.ch&&(l=l.slice(0,l.length-A.end+L.ch));var g=l.toLowerCase();if(!l||A.type=="string"&&(A.end!=L.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==L.ch-A.start-1||w&&z(w,g)>-1||H(N,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(u)||[],l,L,!0))return oe.Pass;var k=typeof T=="object"&&T.emptyTags;if(k&&z(k,l)>-1){v[O]={text:"/>",newPos:oe.Pos(L.line,L.ch+2)};continue}var x=y&&z(y,g)>-1;v[O]={indent:x,text:">"+(x?`
`:"")+""+l+">",newPos:x?oe.Pos(L.line+1,0):oe.Pos(L.line,L.ch+1)}}for(var f=typeof T=="object"&&T.dontIndentOnAutoClose,O=R.length-1;O>=0;O--){var p=v[O];N.replaceRange(p.text,R[O].head,R[O].anchor,"+insert");var d=N.listSelections().slice(0);d[O]={head:p.newPos,anchor:p.newPos},N.setSelections(d),!f&&p.indent&&(N.indentLine(p.newPos.line,null,!0),N.indentLine(p.newPos.line+1,null,!0))}}function F(N,R){for(var v=N.listSelections(),T=[],O=R?"/":"",L=N.getOption("autoCloseTags"),A=typeof L=="object"&&L.dontIndentOnSlash,C=0;C"&&(w+=">"),T[C]=w}if(N.replaceSelections(T),v=N.listSelections(),!A)for(var C=0;C=0&&R[u]==v;u--)++C;T=A.to;for(var u=1;u0){for(var R=0;R1&&arguments[1]!==void 0?arguments[1]:"",R=[],v=0;vxe.length)&&(me=xe.length);for(var ye=0,re=new Array(me);ye=xe.length?{done:!0}:{done:!1,value:xe[re++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ye=xe[Symbol.iterator](),ye.next.bind(ye)}function M(xe,me){return me={exports:{}},xe(me,me.exports),me.exports}var z=M(function(xe){function me(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ye(re){xe.exports.defaults=re}xe.exports={defaults:me(),getDefaults:me,changeDefaults:ye}}),H=z.defaults,N=z.getDefaults,R=z.changeDefaults,v=/[&<>"']/,T=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,A={"&":"&","<":"<",">":">",'"':""","'":"'"},C=function(me){return A[me]};function u(xe,me){if(me){if(v.test(xe))return xe.replace(T,C)}else if(O.test(xe))return xe.replace(L,C);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(xe){return xe.replace(o,function(me,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var h=/(^|[^\[])\^/g;function w(xe,me){xe=xe.source||xe,me=me||"";var ye={replace:function(ie,se){return se=se.source||se,se=se.replace(h,"$1"),xe=xe.replace(ie,se),ye},getRegex:function(){return new RegExp(xe,me)}};return ye}var y=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(xe,me,ye){if(xe){var re;try{re=decodeURIComponent(l(ye)).replace(y,"").toLowerCase()}catch(ie){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}me&&!g.test(ye)&&(ye=a(me,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(ie){return null}return ye}var x={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,me){x[" "+xe]||(f.test(xe)?x[" "+xe]=xe+"/":x[" "+xe]=B(xe,"/",!0)),xe=x[" "+xe];var ye=xe.indexOf(":")===-1;return me.substring(0,2)==="//"?ye?me:xe.replace(p,"$1")+me:me.charAt(0)==="/"?ye?me:xe.replace(d,"$1")+me:xe+me}var b={exec:function(){}};function m(xe){for(var me=1,ye,re;me=0&&be[We]==="\\";)_e=!_e;return _e?"|":" |"}),re=ye.split(/ \|/),ie=0;if(re.length>me)re.splice(me);else for(;re.length=re.length?ie.slice(re.length):ie}).join(`
`)}var Se=function(){function xe(ye){this.options=ye||P}var me=xe.prototype;return me.space=function(re){var ie=this.rules.block.newline.exec(re);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
`}},me.code=function(re,ie){var se=this.rules.block.code.exec(re);if(se){var pe=ie[ie.length-1];if(pe&&pe.type==="paragraph")return{raw:se[0],text:se[0].trimRight()};var be=se[0].replace(/^ {4}/gm,"");return{type:"code",raw:se[0],codeBlockStyle:"indented",text:this.options.pedantic?be:_(be,`
`)}}},me.fences=function(re){var ie=this.rules.block.fences.exec(re);if(ie){var se=ie[0],pe=De(se,ie[3]||"");return{type:"code",raw:se,lang:ie[2]?ie[2].trim():ie[2],text:pe}}},me.heading=function(re){var ie=this.rules.block.heading.exec(re);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},me.nptable=function(re){var ie=this.rules.block.nptable.exec(re);if(ie){var se={type:"table",header:Y(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[],raw:ie[0]};if(se.header.length===se.align.length){var pe=se.align.length,be;for(be=0;be ?/gm,"");return{type:"blockquote",raw:ie[0],text:se}}},me.list=function(re){var ie=this.rules.block.list.exec(re);if(ie){for(var se=ie[0],pe=ie[2],be=pe.length>1,_e=pe[pe.length-1]===")",We={type:"list",raw:se,ordered:be,start:be?+pe.slice(0,-1):"",loose:!1,items:[]},$e=ie[0].match(this.rules.block.item),st=!1,Ze,St,Et,lt,Pt,_t,Mt,jt=$e.length,Lt=0;Lt1||this.options.smartLists&&Et!==pe)&&(lt=$e.slice(Lt+1).join(`
`),We.raw=We.raw.substring(0,We.raw.length-lt.length),Lt=jt-1)),Pt=st||/\n\n(?!\s*$)/.test(Ze),Lt!==jt-1&&(st=Ze.charAt(Ze.length-1)===`
`,Pt||(Pt=st)),Pt&&(We.loose=!0),_t=/^\[[ xX]\] /.test(Ze),Mt=void 0,_t&&(Mt=Ze[1]!==" ",Ze=Ze.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:se,task:_t,checked:Mt,loose:Pt,text:Ze});return We}},me.html=function(re){var ie=this.rules.block.html.exec(re);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ee(ie[0]):ie[0]}},me.def=function(re){var ie=this.rules.block.def.exec(re);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var se=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:se,raw:ie[0],href:ie[2],title:ie[3]}}},me.table=function(re){var ie=this.rules.block.table.exec(re);if(ie){var se={type:"table",header:Y(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[]};if(se.header.length===se.align.length){se.raw=ie[0];var pe=se.align.length,be;for(be=0;be/i.test(pe[0])&&(ie=!1),!se&&/^<(pre|code|kbd|script)(\s|>)/i.test(pe[0])?se=!0:se&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(pe[0])&&(se=!1),{type:this.options.sanitize?"text":"html",raw:pe[0],inLink:ie,inRawBlock:se,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):ee(pe[0]):pe[0]}},me.link=function(re){var ie=this.rules.inline.link.exec(re);if(ie){var se=ae(ie[2],"()");if(se>-1){var pe=ie[0].indexOf("!")===0?5:4,be=pe+ie[1].length+se;ie[2]=ie[2].substring(0,se),ie[0]=ie[0].substring(0,be).trim(),ie[3]=""}var _e=ie[2],We="";if(this.options.pedantic){var $e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(_e);$e?(_e=$e[1],We=$e[3]):We=""}else We=ie[3]?ie[3].slice(1,-1):"";_e=_e.trim().replace(/^<([\s\S]*)>$/,"$1");var st=ce(ie,{href:_e&&_e.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ie[0]);return st}},me.reflink=function(re,ie){var se;if((se=this.rules.inline.reflink.exec(re))||(se=this.rules.inline.nolink.exec(re))){var pe=(se[2]||se[1]).replace(/\s+/g," ");if(pe=ie[pe.toLowerCase()],!pe||!pe.href){var be=se[0].charAt(0);return{type:"text",raw:be,text:be}}var _e=ce(se,pe,se[0]);return _e}},me.strong=function(re,ie,se){se===void 0&&(se="");var pe=this.rules.inline.strong.start.exec(re);if(pe&&(!pe[1]||pe[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ie=ie.slice(-1*re.length);var be=pe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var _e;(pe=be.exec(ie))!=null;)if(_e=this.rules.inline.strong.middle.exec(ie.slice(0,pe.index+3)),_e)return{type:"strong",raw:re.slice(0,_e[0].length),text:re.slice(2,_e[0].length-2)}}},me.em=function(re,ie,se){se===void 0&&(se="");var pe=this.rules.inline.em.start.exec(re);if(pe&&(!pe[1]||pe[1]&&(se===""||this.rules.inline.punctuation.exec(se)))){ie=ie.slice(-1*re.length);var be=pe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var _e;(pe=be.exec(ie))!=null;)if(_e=this.rules.inline.em.middle.exec(ie.slice(0,pe.index+2)),_e)return{type:"em",raw:re.slice(0,_e[0].length),text:re.slice(1,_e[0].length-1)}}},me.codespan=function(re){var ie=this.rules.inline.code.exec(re);if(ie){var se=ie[2].replace(/\n/g," "),pe=/[^ ]/.test(se),be=se.startsWith(" ")&&se.endsWith(" ");return pe&&be&&(se=se.substring(1,se.length-1)),se=ee(se,!0),{type:"codespan",raw:ie[0],text:se}}},me.br=function(re){var ie=this.rules.inline.br.exec(re);if(ie)return{type:"br",raw:ie[0]}},me.del=function(re){var ie=this.rules.inline.del.exec(re);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},me.autolink=function(re,ie){var se=this.rules.inline.autolink.exec(re);if(se){var pe,be;return se[2]==="@"?(pe=ee(this.options.mangle?ie(se[1]):se[1]),be="mailto:"+pe):(pe=ee(se[1]),be=pe),{type:"link",raw:se[0],text:pe,href:be,tokens:[{type:"text",raw:pe,text:pe}]}}},me.url=function(re,ie){var se;if(se=this.rules.inline.url.exec(re)){var pe,be;if(se[2]==="@")pe=ee(this.options.mangle?ie(se[0]):se[0]),be="mailto:"+pe;else{var _e;do _e=se[0],se[0]=this.rules.inline._backpedal.exec(se[0])[0];while(_e!==se[0]);pe=ee(se[0]),se[1]==="www."?be="http://"+pe:be=pe}return{type:"link",raw:se[0],text:pe,href:be,tokens:[{type:"text",raw:pe,text:pe}]}}},me.inlineText=function(re,ie,se){var pe=this.rules.inline.text.exec(re);if(pe){var be;return ie?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):ee(pe[0]):pe[0]:be=ee(this.options.smartypants?se(pe[0]):pe[0]),{type:"text",raw:pe[0],text:be}}},xe}(),Ce=V.noopTest,Ae=V.edit,Te=V.merge,ve={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:Ce,table:Ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ve._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ve._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ve.def=Ae(ve.def).replace("label",ve._label).replace("title",ve._title).getRegex(),ve.bullet=/(?:[*+-]|\d{1,9}[.)])/,ve.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ve.item=Ae(ve.item,"gm").replace(/bull/g,ve.bullet).getRegex(),ve.list=Ae(ve.list).replace(/bull/g,ve.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ve.def.source+")").getRegex(),ve._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",ve._comment=//,ve.html=Ae(ve.html,"i").replace("comment",ve._comment).replace("tag",ve._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ve.paragraph=Ae(ve._paragraph).replace("hr",ve.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",ve._tag).getRegex(),ve.blockquote=Ae(ve.blockquote).replace("paragraph",ve.paragraph).getRegex(),ve.normal=Te({},ve),ve.gfm=Te({},ve.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*|$)"}),ve.gfm.nptable=Ae(ve.gfm.nptable).replace("hr",ve.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",ve._tag).getRegex(),ve.gfm.table=Ae(ve.gfm.table).replace("hr",ve.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",ve._tag).getRegex(),ve.pedantic=Te({},ve.normal,{html:Ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Ce,paragraph:Ae(ve.normal._paragraph).replace("hr",ve.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ve.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",le.punctuation=Ae(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Ae(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Ae(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Ae(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Ae(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Ae(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Ae(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Ae(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Ae(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Ae(le._blockSkip,"g").getRegex(),le.overlapSkip=Ae(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Ae(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Ae(le.tag).replace("comment",ve._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Ae(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Ae(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Ae(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=Te({},le),le.pedantic=Te({},le.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:Ae(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=Te({},le.normal,{escape:Ae(le.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&&(re="x"+re.toString(16)),me+=""+re+";";return me}var Re=function(){function xe(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||de,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ne.normal,inline:ke.normal};this.options.pedantic?(re.block=ne.pedantic,re.inline=ke.pedantic):this.options.gfm&&(re.block=ne.gfm,this.options.breaks?re.inline=ke.breaks:re.inline=ke.gfm),this.tokenizer.rules=re}xe.lex=function(re,ie){var se=new xe(ie);return se.lex(re)};var me=xe.prototype;return me.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},me.blockTokens=function(re,ie,se){ie===void 0&&(ie=[]),se===void 0&&(se=!0),re=re.replace(/^ +$/gm,"");for(var pe,be,_e,We;re;){if(pe=this.tokenizer.space(re)){re=re.substring(pe.raw.length),pe.type&&ie.push(pe);continue}if(pe=this.tokenizer.code(re,ie)){re=re.substring(pe.raw.length),pe.type?ie.push(pe):(We=ie[ie.length-1],We.raw+=`
`+pe.raw,We.text+=`
`+pe.text);continue}if(pe=this.tokenizer.fences(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.heading(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.nptable(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.hr(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.blockquote(re)){re=re.substring(pe.raw.length),pe.tokens=this.blockTokens(pe.text,[],se),ie.push(pe);continue}if(pe=this.tokenizer.list(re)){for(re=re.substring(pe.raw.length),_e=pe.items.length,be=0;be<_e;be++)pe.items[be].tokens=this.blockTokens(pe.items[be].text,[],!1);ie.push(pe);continue}if(pe=this.tokenizer.html(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(se&&(pe=this.tokenizer.def(re))){re=re.substring(pe.raw.length),this.tokens.links[pe.tag]||(this.tokens.links[pe.tag]={href:pe.href,title:pe.title});continue}if(pe=this.tokenizer.table(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.lheading(re)){re=re.substring(pe.raw.length),ie.push(pe);continue}if(se&&(pe=this.tokenizer.paragraph(re))){re=re.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.text(re,ie)){re=re.substring(pe.raw.length),pe.type?ie.push(pe):(We=ie[ie.length-1],We.raw+=`
`+pe.raw,We.text+=`
`+pe.text);continue}if(re){var $e="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return ie},me.inline=function(re){var ie,se,pe,be,_e,We,$e=re.length;for(ie=0;ie<$e;ie++){We=re[ie];switch(We.type){case"paragraph":case"text":case"heading":{We.tokens=[],this.inlineTokens(We.text,We.tokens);break}case"table":{for(We.tokens={header:[],cells:[]},be=We.header.length,se=0;se0)for(;($e=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)st.includes($e[0].slice($e[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($e=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,$e.index)+"["+"a".repeat($e[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(_e=this.tokenizer.escape(re)){re=re.substring(_e.raw.length),ie.push(_e);continue}if(_e=this.tokenizer.tag(re,se,pe)){re=re.substring(_e.raw.length),se=_e.inLink,pe=_e.inRawBlock,ie.push(_e);continue}if(_e=this.tokenizer.link(re)){re=re.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,pe)),ie.push(_e);continue}if(_e=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,pe)),ie.push(_e);continue}if(_e=this.tokenizer.strong(re,We,be)){re=re.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],se,pe),ie.push(_e);continue}if(_e=this.tokenizer.em(re,We,be)){re=re.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],se,pe),ie.push(_e);continue}if(_e=this.tokenizer.codespan(re)){re=re.substring(_e.raw.length),ie.push(_e);continue}if(_e=this.tokenizer.br(re)){re=re.substring(_e.raw.length),ie.push(_e);continue}if(_e=this.tokenizer.del(re)){re=re.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],se,pe),ie.push(_e);continue}if(_e=this.tokenizer.autolink(re,Ee)){re=re.substring(_e.raw.length),ie.push(_e);continue}if(!se&&(_e=this.tokenizer.url(re,Ee))){re=re.substring(_e.raw.length),ie.push(_e);continue}if(_e=this.tokenizer.inlineText(re,pe,Oe)){re=re.substring(_e.raw.length),be=_e.raw.slice(-1),ie.push(_e);continue}if(re){var Ze="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Ze);break}else throw new Error(Ze)}}return ie},$(xe,null,[{key:"rules",get:function(){return{block:ne,inline:ke}}}]),xe}(),Be=z.defaults,ze=V.cleanUrl,Fe=V.escape,Ue=function(){function xe(ye){this.options=ye||Be}var me=xe.prototype;return me.code=function(re,ie,se){var pe=(ie||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(re,pe);be!=null&&be!==re&&(se=!0,re=be)}return pe?''+(se?re:Fe(re,!0))+`
`:""+(se?re:Fe(re,!0))+`
`},me.blockquote=function(re){return`
`+re+`
`},me.html=function(re){return re},me.heading=function(re,ie,se,pe){return this.options.headerIds?"
`:""+re+"
`},me.hr=function(){return this.options.xhtml?`
`:`
`},me.list=function(re,ie,se){var pe=ie?"ol":"ul",be=ie&&se!==1?' start="'+se+'"':"";return"<"+pe+be+`>
`+re+""+pe+`>
`},me.listitem=function(re){return""+re+`
`},me.checkbox=function(re){return" "},me.paragraph=function(re){return""+re+`
`},me.table=function(re,ie){return ie&&(ie=""+ie+" "),`
`},me.tablerow=function(re){return`
`+re+`
`},me.tablecell=function(re,ie){var se=ie.header?"th":"td",pe=ie.align?"<"+se+' align="'+ie.align+'">':"<"+se+">";return pe+re+""+se+`>
`},me.strong=function(re){return""+re+" "},me.em=function(re){return""+re+" "},me.codespan=function(re){return""+re+""},me.br=function(){return this.options.xhtml?" ":" "},me.del=function(re){return""+re+""},me.link=function(re,ie,se){if(re=ze(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var pe='"+se+" ",pe},me.image=function(re,ie,se){if(re=ze(this.options.sanitize,this.options.baseUrl,re),re===null)return se;var pe=' ":">",pe},me.text=function(re){return re},xe}(),Ie=function(){function xe(){}var me=xe.prototype;return me.strong=function(re){return re},me.em=function(re){return re},me.codespan=function(re){return re},me.del=function(re){return re},me.html=function(re){return re},me.text=function(re){return re},me.link=function(re,ie,se){return""+se},me.image=function(re,ie,se){return""+se},me.br=function(){return""},xe}(),it=function(){function xe(){this.seen={}}var me=xe.prototype;return me.slug=function(re){var ie=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var se=ie;do this.seen[se]++,ie=se+"-"+this.seen[se];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},xe}(),Ye=z.defaults,Qe=V.unescape,qe=function(){function xe(ye){this.options=ye||Ye,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ie,this.slugger=new it}xe.parse=function(re,ie){var se=new xe(ie);return se.parse(re)};var me=xe.prototype;return me.parse=function(re,ie){ie===void 0&&(ie=!0);var se="",pe,be,_e,We,$e,st,Ze,St,Et,lt,Pt,_t,Mt,jt,Lt,pr,Kr,bt,Nr=re.length;for(pe=0;pe0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=bt+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=bt+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:bt}):jt+=bt),jt+=this.parse(Lt.tokens,Mt),Et+=this.renderer.listitem(jt,Kr,pr);se+=this.renderer.list(Et,Pt,_t);continue}case"html":{se+=this.renderer.html(lt.text);continue}case"paragraph":{se+=this.renderer.paragraph(this.parseInline(lt.tokens));continue}case"text":{for(Et=lt.tokens?this.parseInline(lt.tokens):lt.text;pe+1An error occurred:
"+nt(_e.message+"",!0)+" ";throw _e}}Me.options=Me.setOptions=function(xe){return ct(Me.defaults,xe),dt(Me.defaults),Me},Me.getDefaults=Pe,Me.defaults=at,Me.use=function(xe){var me=ct({},xe);if(xe.renderer&&function(){var re=Me.defaults.renderer||new Ue,ie=function(be){var _e=re[be];re[be]=function(){for(var We=arguments.length,$e=new Array(We),st=0;st`,triples:"",explode:"[]{}"},D=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(A,C,u){u&&u!=oe.Init&&(A.removeKeyMap(F),A.state.closeBrackets=null),C&&(M(Z(C,"pairs")),A.state.closeBrackets=C,A.addKeyMap(F))});function Z(A,C){return C=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[C]!=null?A[C]:$[C]}var F={Backspace:N,Enter:R};function M(A){for(var C=0;C=0;l--){var w=o[l].head;A.replaceRange("",D(w.line,w.ch-1),D(w.line,w.ch+1),"+delete")}}function R(A){var C=H(A),u=C&&Z(C,"explode");if(!u||A.getOption("disableInput"))return oe.Pass;for(var o=A.listSelections(),l=0;l0;return{anchor:new D(A.anchor.line,A.anchor.ch+(C?-1:1)),head:new D(A.head.line,A.head.ch+(C?1:-1))}}function T(A,C){var u=H(A);if(!u||A.getOption("disableInput"))return oe.Pass;var o=Z(u,"pairs"),l=o.indexOf(C);if(l==-1)return oe.Pass;for(var h=Z(u,"closeBefore"),w=Z(u,"triples"),y=o.charAt(l+1)==C,g=A.listSelections(),k=l%2==0,x,f=0;f=0&&A.getRange(d,D(d.line,d.ch+3))==C+C+C?a="skipThree":a="skip";else if(y&&d.ch>1&&w.indexOf(C)>=0&&A.getRange(D(d.line,d.ch-2),d)==C+C){if(d.ch>2&&/\bstring/.test(A.getTokenTypeAt(D(d.line,d.ch-2))))return oe.Pass;a="addFour"}else if(y){var m=d.ch==0?" ":A.getRange(D(d.line,d.ch-1),d);if(!oe.isWordChar(b)&&m!=C&&!oe.isWordChar(m))a="both";else return oe.Pass}else if(k&&(b.length===0||/\s/.test(b)||h.indexOf(b)>-1))a="both";else return oe.Pass;if(!x)x=a;else if(x!=a)return oe.Pass}var E=l%2?o.charAt(l-1):C,B=l%2?C:o.charAt(l+1);A.operation(function(){if(x=="skip")A.execCommand("goCharRight");else if(x=="skipThree")for(var U=0;U<3;U++)A.execCommand("goCharRight");else if(x=="surround"){for(var K=A.getSelections(),U=0;U0&&(ae.percent=ae.loaded/ae.total*100),V.onProgress(ae)});var _=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var ae=V.data[ee];if(Array.isArray(ae)){ae.forEach(function(ce){_.append(ee+"[]",ce)});return}_.append(ee,V.data[ee])}),V.file instanceof Blob?_.append(V.filename,V.file,V.file.name):_.append(V.filename,V.file),P.onerror=function(ae){V.onError(ae)},P.onload=function(){return P.status<200||P.status>=300?V.onError(F(V,P),M(P)):V.onSuccess(M(P),P)},P.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var Y=V.headers||{};return Y["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(ee){Y[ee]!==null&&P.setRequestHeader(ee,Y[ee])}),P.send(_),{abort:function(){P.abort()}}}var H=+new Date,N=0;function R(){return"rc-upload-"+H+"-"+ ++N}function v(V,P){return V.indexOf(P,V.length-P.length)!==-1}var T=function(V,P){if(V&&P){var _=Array.isArray(P)?P:P.split(","),Y=V.name||"",ee=V.type||"",ae=ee.replace(/\/.*$/,"");return _.some(function(ce){var De=ce.trim();return De.charAt(0)==="."?v(Y.toLowerCase(),De.toLowerCase()):/\/\*$/.test(De)?ae===De.replace(/\/.*$/,""):ee===De})}return!0};function O(V,P){var _=V.createReader(),Y=[];function ee(){_.readEntries(function(ae){var ce=Array.prototype.slice.apply(ae);Y=Y.concat(ce);var De=!ce.length;De?P(Y):ee()})}ee()}var L=function(P,_,Y){var ee=function ae(ce,De){De=De||"",ce.isFile?ce.file(function(Se){Y(Se)&&(ce.fullPath&&!Se.webkitRelativePath&&(Object.defineProperties(Se,{webkitRelativePath:{writable:!0}}),Se.webkitRelativePath=ce.fullPath.replace(/^\//,""),Object.defineProperties(Se,{webkitRelativePath:{writable:!1}})),_([Se]))}):ce.isDirectory&&O(ce,function(Se){Se.forEach(function(Ce){ae(Ce,""+De+ce.name+"/")})})};P.forEach(function(ae){ee(ae.webkitGetAsEntry())})},A=L,C=Object.assign||function(V){for(var P=1;P=0)continue;if(!Object.prototype.hasOwnProperty.call(V,Y))continue;_[Y]=V[Y]}return _}function w(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function y(V,P){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:V}function g(V,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);V.prototype=Object.create(P&&P.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(V,P):V.__proto__=P)}var k=function(P){return Object.keys(P).reduce(function(_,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(_[Y]=P[Y]),_},{})},x=function(V){g(P,V);function P(){var _,Y,ee,ae;w(this,P);for(var ce=arguments.length,De=Array(ce),Se=0;Se1&&arguments[1]!==void 0?arguments[1]:1,ye=Ie.length,re=0;re1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(_).map(function(ee,ae){if(!F.isValidElement(ee)||!ee.type)return null;var ce=ee.type.isSelectOptGroup,De=ee.key,Se=ee.props,Ce=Se.children,Ae=Object(z.a)(Se,["children"]);return Y||!ce?x(ee):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(De===null?ae:De,"__"),label:De},Ae),{},{options:f(Ce)})}).filter(function(ee){return ee})}var p=he("2Qr1"),d=he("qNPg"),a=he("U8pU"),b=he("Kwbf"),m=he("WKfj");function E(_){var Y=_.mode,ee=_.options,ae=_.children,ce=_.backfill,De=_.allowClear,Se=_.placeholder,Ce=_.getInputElement,Ae=_.showSearch,Te=_.onSearch,ve=_.defaultOpen,le=_.autoFocus,te=_.labelInValue,de=_.value,ne=_.inputValue,ke=_.optionLabelProp,Oe=Y==="multiple"||Y==="tags",Ee=Ae!==void 0?Ae:Oe||Y==="combobox",Re=ee||f(ae);if(Object(b.a)(Y!=="tags"||Re.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var Be=Re.some(function(Ue){return Ue.options?Ue.options.some(function(Ie){return typeof("value"in Ie?Ie.value:Ie.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(b.a)(!Be,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(Y!=="combobox"||!ke,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(Y==="combobox"||!ce,"`backfill` only works with `combobox` mode."),Object(b.a)(Y==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(b.b)(Y!=="combobox"||!Ce||!De||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Te&&!Ee&&Y!=="combobox"&&Y!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ve||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var ze=Object(m.d)(de);Object(b.a)(!te||ze.every(function(Ue){return Object(a.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Oe||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var Fe=null;Object(k.a)(ae).some(function(Ue){if(!F.isValidElement(Ue)||!Ue.type)return!1;var Ie=Ue.type;if(Ie.isSelectOption)return!1;if(Ie.isSelectOptGroup){var it=Object(k.a)(Ue.props.children).every(function(Ye){return!F.isValidElement(Ye)||!Ue.type||Ye.type.isSelectOption?!0:(Fe=Ye.type,!1)});return!it}return Fe=Ie,!0}),Fe&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(b.a)(ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var B=E,U=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:B,fillOptionsWithMissingValue:p.a}),K=function(_){Object(D.a)(ee,_);var Y=Object(Z.a)(ee);function ee(){var ae;return Object(oe.a)(this,ee),ae=Y.apply(this,arguments),ae.selectRef=F.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object($.a)(ee,[{key:"render",value:function(){return F.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),ee}(F.Component);K.Option=h,K.OptGroup=y;var V=K,P=ut.c=V},M8RZ:function(Tt,ut,he){"use strict";he.d(ut,"a",function(){return N});var oe=he("fWQN"),$=he("mtLc"),D=he("yKVA"),Z=he("879j"),F=he("q1tI"),M=he.n(F),z=he("i8i4"),H=he.n(z),N=function(R){Object(D.a)(T,R);var v=Object(Z.a)(T);function T(O){var L;Object(oe.a)(this,T),L=v.call(this,O);var A=window.document;return L.node=A.createElement("div"),A.body.appendChild(L.node),L}return Object($.a)(T,[{key:"render",value:function(){var L=this.props.children;return Object(z.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(M.a.Component)},OLES:function(Tt,ut,he){"use strict";var oe=he("U8pU"),$=he("VTBJ"),D=he("Ff2n"),Z=he("q1tI"),F=he("uciX"),M=he("7ixt"),z=function(O){var L=O.overlay,A=O.prefixCls,C=O.id,u=O.overlayInnerStyle;return Z.createElement("div",{className:"".concat(A,"-inner"),id:C,role:"tooltip",style:u},typeof L=="function"?L():L)},H=z,N=function(O,L){var A=O.overlayClassName,C=O.trigger,u=C===void 0?["hover"]:C,o=O.mouseEnterDelay,l=o===void 0?0:o,h=O.mouseLeaveDelay,w=h===void 0?.1:h,y=O.overlayStyle,g=O.prefixCls,k=g===void 0?"rc-tooltip":g,x=O.children,f=O.onVisibleChange,p=O.afterVisibleChange,d=O.transitionName,a=O.animation,b=O.placement,m=b===void 0?"right":b,E=O.align,B=E===void 0?{}:E,U=O.destroyTooltipOnHide,K=U===void 0?!1:U,V=O.defaultVisible,P=O.getTooltipContainer,_=O.overlayInnerStyle,Y=Object(D.a)(O,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ee=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(L,function(){return ee.current});var ae=Object($.a)({},Y);"visible"in O&&(ae.popupVisible=O.visible);var ce=function(){var Te=O.arrowContent,ve=Te===void 0?null:Te,le=O.overlay,te=O.id;return[Z.createElement("div",{className:"".concat(k,"-arrow"),key:"arrow"},ve),Z.createElement(H,{key:"content",prefixCls:k,id:te,overlay:le,overlayInnerStyle:_})]},De=!1,Se=!1;if(typeof K=="boolean")De=K;else if(K&&Object(oe.a)(K)==="object"){var Ce=K.keepParent;De=Ce===!0,Se=Ce===!1}return Z.createElement(F.a,Object.assign({popupClassName:A,prefixCls:k,popup:ce,action:u,builtinPlacements:M.a,popupPlacement:m,ref:ee,popupAlign:B,getPopupContainer:P,onPopupVisibleChange:f,afterPopupVisibleChange:p,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:De,autoDestroy:Se,mouseLeaveDelay:w,popupStyle:y,mouseEnterDelay:l},ae),x)},R=Object(Z.forwardRef)(N),v=ut.a=R},Ot1p:function(Tt,ut,he){"use strict";var oe=he("2qtc"),$=he("kLXV"),D=he("rAM+"),Z=he("miYZ"),F=he("tsqr"),M=he("9og8"),z=he("tJVT"),H=he("jrin"),N=he("WmNS"),R=he.n(N),v=he("q1tI"),T=he.n(v),O=he("VrN/"),L=he.n(O),A=he("bdgK"),C=he("p77/"),u=he("Bd2K"),o=he("ELLl"),l=he("19Vz"),h=he("lZu9"),w=he("+NIl"),y=he("kSUc"),g=he("9Bee"),k=function(be){var _e=be.value,We=_e===void 0?"":_e,$e=be.className,st=be.showTextOnly,Ze=be.showLines,St=be.style,Et=St===void 0?{}:St,lt=Object(v.useMemo)(function(){return""},[We]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:lt}}))},x=he("0Owb"),f=he("dejd"),p=he("C+DQ"),d=he("1vsH"),a=he("m3rI"),b=[{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 m(be){var _e=be.onActionCallback,We=be.title,$e=be.icon,st=be.actionName,Ze=be.className,St=Ze===void 0?"":Ze,Et=be.children;function lt(){_e(st)}return T.a.createElement("a",{title:We,className:St,onClick:lt},T.a.createElement("i",{className:"md-iconfont ".concat($e)}),Et)}var E=function(be){var _e=be.watch,We=be.showNullButton,$e=be.onActionCallback,st=be.fullScreen,Ze=be.insertTemp,St=be.hidetoolBar,Et=be.uuid,lt=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.F)("_educoder_session"),"&key=").concat(Et,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Pt=[].concat(b,[{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 T.a.createElement("ul",{className:"markdown-toolbar-container"},!St&&Pt.map(function(_t,Mt){return T.a.createElement("li",{key:Mt},_t.actionName?T.a.createElement(m,Object(x.a)({},_t,{onActionCallback:$e})):T.a.createElement("span",{className:"v-line"}))}),We?T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$e},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ze&&T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ze),onActionCallback:$e},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(m,{icon:"".concat(st?"icon-shrink":"icon-enlarge"),title:st?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$e})))},B=he("M8RZ"),U=he("+L6B"),K=he("2/Rp"),V=he("y8nQ"),P=he("Vl3Y"),_=he("5NDa"),Y=he("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},ae=function(be){var _e=be.callback,We=be.onCancel;function $e(st){_e(st)}return T.a.createElement(P.a,Object(x.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$e}),T.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement(Y.a,null)),T.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement(Y.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},ce=he("7ahc"),De=he("HmJG"),Se=he("BjJ7"),Ce=P.a.useForm,Ae={width:280,marginRight:10},Te={labelCol:{span:5},wrapperCol:{span:19}},ve=function(be){var _e=be.callback,We=be.onCancel,$e=Ce(),st=Object(z.a)($e,1),Ze=st[0];function St(Pt){_e(Pt)}function Et(Pt,_t){if(Pt.status===-1){F.b.error(Pt.message);return}Ze.setFieldsValue({src:"/api/attachments/".concat(Pt.id),type:_t.type})}function lt(Pt){var _t=Pt.target.files[0];te(_t,Et)}return T.a.createElement(P.a,Object(x.a)({form:Ze},Te,{className:"upload-image-panel",onFinish:St}),T.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},T.a.createElement(Y.a,{style:Ae})),T.a.createElement(le,{onFileChange:lt}))),T.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},T.a.createElement(Y.a,{style:{width:264}})),T.a.createElement(P.a.Item,{style:{textAlign:"right"}},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))};function le(be){var _e=be.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:_e}))}function te(be,_e){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var We=new FormData;We.append("editormd-image-file",be),We.append("file_param_name","editormd-image-file"),We.append("byxhr","true");var $e=new window.XMLHttpRequest;$e.withCredentials=!0,$e.addEventListener("load",function(st){_e(JSON.parse(st.target.responseText),be)},!1),$e.addEventListener("error",function(st){console.error(st)},!1),$e.open("POST","".concat(Se.a,"/api/attachments.json")),$e.send(We)}var de=he("giR+"),ne=he("fyUT"),ke=he("7Kak"),Oe=he("9yH6"),Ee=Oe.a.Group,Re={margin:"0 8px"},Be=function(be){var _e=be.callback,We=be.onCancel;function $e(st){_e(st)}return T.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$e},T.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},T.a.createElement("span",{style:Re},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:Re},"\u884C\u6570"),T.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(ne.a,null)),T.a.createElement("span",{style:Re},"\u5217\u6570"),T.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(ne.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},T.a.createElement("span",{style:Re},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(P.a.Item,{name:"align"},T.a.createElement(Ee,null,T.a.createElement(Oe.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(Oe.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(Oe.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(Oe.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},ze=he("ErOA"),Fe=he("7Cbv"),Ue="link",Ie="upload-image",it="code-block",Ye="add-table",Qe="------------",qe={default:Qe,left:":".concat(Qe),center:":".concat(Qe,":"),right:"".concat(Qe,":")},ct=he("9VGf"),et,nt;function Pe(){}var dt=0,at=1e4,Me="\u2581",Ge=`
**\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 xe(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var me=navigator.platform.toUpperCase().indexOf("MAC")>=0,ye=me?"Cmd":"Ctrl",re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ie=(et={},Object(H.a)(et,ye+"-B","bold"),Object(H.a)(et,ye+"-I","italic"),et),se=(nt={},Object(H.a)(nt,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(nt,it,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(nt,Ie,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(nt,Ye,"\u6DFB\u52A0\u8868\u683C"),nt),pe=ut.a=function(be){var _e=be.defaultValue,We=_e===void 0?"":_e,$e=be.onChange,st=be.width,Ze=st===void 0?"100%":st,St=be.height,Et=St===void 0?400:St,lt=be.miniToolbar,Pt=lt===void 0?!1:lt,_t=be.isFocus,Mt=_t===void 0?!1:_t,jt=be.watch,Lt=be.insertTemp,pr=be.mode,Kr=pr===void 0?"markdown":pr,bt=be.id,Nr=bt===void 0?"markdown-editor-id":bt,hr=be.showResizeBar,mr=hr===void 0?!1:hr,Br=be.noStorage,ci=Br===void 0?!1:Br,qr=be.showNullButton,Bt=qr===void 0?!1:qr,ft=be.hidetoolBar,Hr=ft===void 0?!1:ft,ei=be.fullScreen,gr=ei===void 0?!1:ei,Dt=be.onBlur,Fr=be.onCMBeforeChange,Vr=be.onFullScreen,fi=be.className,Ve=fi===void 0?"":fi,Ct=be.disablePaste,pi=Ct===void 0?!1:Ct,mi=be.placeholder,gi=mi===void 0?"":mi,vi=be.values,G=vi===void 0?"":vi,s=Object(v.useState)(null),c=Object(z.a)(s,2),I=c[0],Q=c[1],W=Object(v.useState)(We),ge=Object(z.a)(W,2),je=ge[0],Je=ge[1],pt=Object(v.useState)(jt),He=Object(z.a)(pt,2),vt=He[0],Ft=He[1],Xt=Object(v.useState)(gr),_r=Object(z.a)(Xt,2),vr=_r[0],yr=_r[1],Xr=Object(v.useState)(""),Oi=Object(z.a)(Xr,2),nr=Oi[0],Ur=Oi[1],oi=Object(v.useState)(0),si=Object(z.a)(oi,2),Pr=si[0],_i=si[1],yi=Object(v.useState)(Et),zi=Object(z.a)(yi,2),Ki=zi[0],Yr=zi[1],Gr=Object(v.useState)(!1),bi=Object(z.a)(Gr,2),dn=bi[0],xi=bi[1],Jt=Object(v.useRef)(Object(Fe.a)()),Ut=Object(v.useRef)(!1),dr=Object(v.useRef)(),Rt=Object(v.useRef)(),qt=Object(v.useRef)(),Gt=Object(v.useRef)(),ti=Object(v.useRef)(),ar=function(){var mt=Object(M.a)(R.a.mark(function wt(){var yt,kt;return R.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.next=2,Object(ze.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Jt.current}});case 2:kt=Kt.sent,kt!=null&&(yt=kt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",I,Rt),kt.attachments.map(function(It){It.content_type.indexOf("image")>-1?I.replaceSelection(".concat(It.content_type,")")):It.content_type.indexOf("video")>-1?I.replaceSelection(' ')):It.content_type.indexOf("pdf")>-1?I.replaceSelection('').concat(It.name," ")):I.replaceSelection("[".concat(It.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}));case 4:case"end":return Kt.stop()}},wt)}));return function(){return mt.apply(this,arguments)}}();Object(v.useEffect)(function(){Je(G),I==null||I.setValue(G)},[G]),Object(v.useEffect)(function(){Vr==null||Vr(vr)},[vr]),Object(v.useEffect)(function(){if(Rt.current){var mt=L.a.fromTextArea(Rt.current,{mode:Kr,lineNumbers:!Pt,lineWrapping:!0,value:We,autoCloseTags:!0,autoCloseBrackets:!0});Mt&&mt.focus();function wt(yt,kt){if(pi){kt.preventDefault();return}var Nt=kt.clipboardData;if(Nt){var Kt=Nt.types.toString(),It=Nt.items;if(Kt==="Files"||Nt.types.indexOf("Files")>-1){if(kt.preventDefault(),Kr=="stex")return;try{var rr,wr=It[1];((rr=It[0])===null||rr===void 0?void 0:rr.kind)==="file"&&(wr=It[0]);var Ot=wr.getAsFile(),li=Ot.name.split(".").pop();te(Ot,function(Wt){if(Wt.id){var Ar,br,zr;(Ot==null||((Ar=Ot.type)===null||Ar===void 0)?void 0:Ar.indexOf("image"))>-1?mt.replaceSelection(".concat(Wt.content_type,")")):(Ot==null||((br=Ot.type)===null||br===void 0)?void 0:br.indexOf("video"))>-1?mt.replaceSelection(' ')):(Ot==null||((zr=Ot.type)===null||zr===void 0)?void 0:zr.indexOf("pdf"))>-1?mt.replaceSelection('').concat(Ot.name," ")):re.includes(li)?mt.replaceSelection('').concat(Ot.name," ")):mt.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return mt.on("paste",wt),mt.on("dragleave",function(yt,kt){qt.current.classList.remove("mouse-hover-md")}),mt.on("dragover",function(yt,kt){qt.current.classList.add("mouse-hover-md")}),mt.on("drop",function(yt,kt){qt.current.classList.add("mouse-hover-md");var Nt;if(Nt=kt.dataTransfer.files,Nt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Kt=function(wr){var Ot=Nt[wr],li=Ot.name.split(".").pop();te(Ot,function(Wt){if(Wt.id){var Ar,br,zr;(Ot==null||((Ar=Ot.type)===null||Ar===void 0)?void 0:Ar.indexOf("image"))>-1?mt.replaceSelection(".concat(Wt.content_type,")")):(Ot==null||((br=Ot.type)===null||br===void 0)?void 0:br.indexOf("video"))>-1?mt.replaceSelection(' ')):(Ot==null||((zr=Ot.type)===null||zr===void 0)?void 0:zr.indexOf("pdf"))>-1?mt.replaceSelection('').concat(Ot.name," ")):re.includes(li)?mt.replaceSelection('').concat(Ot.name," ")):mt.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},It=0;It0||It.target.offsetWidth>0)&&(Sr(),I.setSize("100%","100%"),I.refresh())}}catch(rr){Nt.e(rr)}finally{Nt.f()}});return yt.observe(Rt.current.parentElement),yt}if(I){var wt=mt();return function(){wt.unobserve(Rt.current.parentElement)}}},[I,Sr]),Object(v.useEffect)(function(){if(I){for(var mt=[],wt=function(){var It=kt[yt];Nt=Object(z.a)(It,2);var rr=Nt[0],wr=Nt[1],Ot=Object(H.a)({},rr,function(){Vi(wr)});mt.push(Ot),I.addKeyMap(Ot)},yt=0,kt=Object.entries(ie);yt0){var mt=new Date().getTime(),wt=window.sessionStorage.getItem(Nr);mt>=Pr+at&&(!wt||wt!==je)&&(window.sessionStorage.setItem(Nr,je),xi(!0))}},at),Object(v.useEffect)(function(){Ft(jt)},[I,jt]),Object(v.useEffect)(function(){I&&(Mt&&I.focus())},[I,Mt]),Object(v.useEffect)(function(){if(vt&&I){var mt=I.getScrollerElement();function wt(yt){var kt=yt.target;if(ti.current){var Nt=kt.scrollTop/kt.scrollHeight;ti.current.scrollTop=ti.current.scrollHeight*Nt}}return mt.addEventListener("scroll",wt),function(){mt.removeEventListener("scroll",wt)}}},[I,vt]),Object(v.useEffect)(function(){if(I&&Fr){function mt(wt,yt){Fr(wt,yt)}return I.on("beforeChange",mt),function(){I.off("beforeChange",mt)}}},[I,Fr]),Object(v.useEffect)(function(){if(I&&Dt){function mt(){Dt(I.getValue())}return I.on("blur",mt),function(){I.off("blur",mt)}}},[I,Dt]),Object(v.useEffect)(function(){if(I){function mt(wt){var yt=wt.getValue();Je(yt),_i(new Date().getTime()),wt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$e&&$e(yt)}return I.on("change",mt),function(){I.off("change",mt)}}},[I,$e]),Object(v.useEffect)(function(){I&&(We==null?(I.setValue(""),Je("")):We!==I.getValue()&&(I.setValue(We),Je(We),I.setCursor(I.lineCount(),0)))},[I,We]);var Vi=Object(v.useCallback)(function(mt){var wt=I.getCursor(),yt=I.getSelection(),kt=yt.split(`
`);switch(mt){case"bold":return I.replaceSelection("**"+yt+"**"),yt===""&&I.setCursor(wt.line,wt.ch+2),I.focus();case"italic":return I.replaceSelection("*"+yt+"*"),yt===""&&I.setCursor(wt.line,wt.ch+1),I.focus();case"code":return I.replaceSelection("`"+yt+"`"),yt===""&&I.setCursor(wt.line,wt.ch+1),I.focus();case"inline-latex":return I.replaceSelection("`$$"+yt+"$$`"),yt===""&&I.setCursor(wt.line,wt.ch+3),I.focus();case"latex":return I.replaceSelection("```latex\n"+yt+"\n```"),I.setCursor(wt.line+1,yt.length+1),I.focus();case"line-break":return I.replaceSelection(`
`),I.focus();case"list-ul":return yt===""?I.replaceSelection("- "+yt):I.replaceSelection(kt.map(function(Nt){return Nt===""?"":"- ".concat(Nt)}).join(`
`)),I.focus();case"list-ol":return yt===""?I.replaceSelection("1. "+yt):I.replaceSelection(kt.map(function(Nt,Kt){return Nt===""?"":"".concat(Kt+1,". ").concat(Nt)}).join(`
`)),I.focus();case"add-null-ch":return yt===""&&I.setCursor(wt.line,wt.ch+1),I.replaceSelection(Me),I.focus();case"inster-template-1":return yt===""&&I.setCursor(wt.line,wt.ch),I.replaceSelection(Ge),I.focus();case"eraser":return I.setValue(""),I.focus();case"trigger-watch":return Ft(!vt),I.focus();case"trigger-full-screen":return yr(!vr),I.focus();case Ue:Ur(Ue);return;case it:Ur(it);return;case Ie:Ur(Ie);return;case Ye:Ur(Ye);return;default:throw new Error}},[I,vt,vr]),Ei=Object(v.useCallback)(function(mt){Ur("");switch(nr){case Ue:var wt=mt.title,yt=mt.link;return I.replaceSelection("[".concat(wt,"](").concat(yt,")")),I.focus();case it:var kt=mt.language,Nt=mt.content;return I.replaceSelection(["```"+kt,Nt,"```"].join(`
`)),I.focus();case Ie:var Kt=mt.src,It=mt.alt;return It?I.replaceSelection(".concat(Kt,' "').concat(It,'" )')):I.replaceSelection("")),I.focus();case Ye:for(var rr=mt.row,wr=mt.col,Ot=mt.align,li=`
`,Wt=0;Wt300&&(rr=300);var wr=Et+rr+"px";Yr(wr)}}return mt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Kt),document.addEventListener("mouseup",Nt),function(){mt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Kt),document.removeEventListener("mouseup",Nt)}}},[I,Gt]),Object(v.useEffect)(function(){Yr(Et)},[Et]);var ri=xe(Ze),fn=xe(Ki),$r={width:ri,height:fn},pn=Object(v.useMemo)(function(){if(Pr){var mt=new Date(Pr),wt=mt.getHours(),yt=mt.getMinutes(),kt=mt.getSeconds();return wt=wt<10?"0"+wt:wt,yt=yt<10?"0"+yt:yt,kt=kt<10?"0"+kt:kt,"".concat(wt,":").concat(yt,":").concat(kt)}return 0},[Pr]);function jn(){window.sessionStorage.removeItem(Nr),xi(!1),_i(0)}function Pi(){xi(!1),_i(0),I.setValue(window.sessionStorage.getItem(Nr))}function ua(mt,wt){var yt=I.getValue();yt=yt.replace(mt,wt),Je(yt),I==null||I.setValue(yt)}return T.a.createElement(v.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:qt},T.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(vt?"on-preview":""," ").concat(Pt?"mini":""," ").concat(vr?"full-screen":""),style:$r},T.a.createElement(E,{insertTemp:Lt,watch:vt,fullScreen:vr,showNullButton:Bt,onActionCallback:Vi,hidetoolBar:Hr,uuid:Jt.current,setOpenPhones:function(){Ut.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:Rt,placeholder:gi})),vt?T.a.createElement("div",{ref:ti,className:"preview-container"},Kr==="stex"&&T.a.createElement(k,{value:je}),Kr!=="stex"&&T.a.createElement(g.a,{edit:!0,value:je,replaces:ua})):null))),mr?T.a.createElement("a",{ref:Gt,className:"editor-resize"}):null,T.a.createElement(B.a,null,se[nr]?T.a.createElement($.a,{centered:!0,title:se[nr],visible:!0,onCancel:Si,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(Tt,ut){/**
* @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 he,oe,$,D=!1,Z,F;window.PR_SHOULD_USE_CONTINUATION=!0;var M,z;(function(){var H=window,N=["break,continue,do,else,for,if,return,while"],R=[N,"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=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[v,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[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"],A="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",C=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="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=[N,"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=[N,"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=[N,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[T,L,O,C,u,o,l,h],y=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",k="kwd",x="com",f="typ",p="lit",d="pun",a="pln",b="tag",m="dec",E="src",B="atn",U="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(Ee){for(var Re=0,Be=!1,ze=!1,Fe=0,Ue=Ee.length;Fe122||(re<65||ye>90||dt.push([Math.max(65,ye)|32,Math.min(re,90)|32]),re<97||ye>122||dt.push([Math.max(97,ye)&~32,Math.min(re,122)&~32]))}}dt.sort(function(be,_e){return be[0]-_e[0]||_e[1]-be[1]});for(var ie=[],se=[],Ge=0;Gepe[0]&&(pe[1]+1>pe[0]&&Me.push("-"),Me.push(Qe(pe[1])))}return Me.push("]"),Me.join("")}function ct(nt){for(var Pe=nt.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),dt=Pe.length,at=[],Me=0,Ge=0;Me=2&&ye==="["?Pe[Me]=qe(xe):ye!=="\\"&&(Pe[Me]=xe.replace(/[a-zA-Z]/g,function(se){var pe=se.charCodeAt(0);return"["+String.fromCharCode(pe&~32,pe|32)+"]"}))}return Pe.join("")}for(var et=[],Fe=0,Ue=Ee.length;Fe=0;)Be[et.charAt(nt)]=ct;var Pe=ct[1],dt=""+Pe;Ye.hasOwnProperty(dt)||(it.push(Pe),Ye[dt]=null)}it.push(/[\0-\uffff]/),ze=P(it)})();var Fe=Re.length,Ue=function(Ie){for(var it=Ie.sourceCode,Ye=Ie.basePos,Qe=Ie.sourceNode,qe=[Ye,a],ct=0,et=it.match(ze)||[],nt={},Pe=0,dt=et.length;Pe=5&&Me.substring(0,5)==="lang-",xe&&!(Ge&&typeof Ge[1]=="string")&&(xe=!1,Me=E),xe||(nt[at]=Me)}var re=ct;if(ct+=at.length,!xe)qe.push(Ye+re,Me);else{var ie=Ge[1],se=at.indexOf(ie),pe=se+ie.length;Ge[2]&&(pe=at.length-Ge[2].length,se=pe-ie.length);var be=Me.substring(5);Y(Qe,Ye+re,at.substring(0,se),Ue,qe),Y(Qe,Ye+re+se,ie,le(be,ie),qe),Y(Qe,Ye+re+pe,at.substring(pe),Ue,qe)}}Ie.decorations=qe};return Ue}function De(Ee){var Re=[],Be=[];Ee.tripleQuotedStrings?Re.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?Re.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Re.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Be.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ze=Ee.hashComments;ze&&(Ee.cStyleComments?(ze>1?Re.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Re.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Be.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Re.push([x,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Be.push([x,/^\/\/[^\r\n]*/,null]),Be.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Ee.regexLiterals;if(Fe){var Ue=Fe>1?"":`
\r`,Ie=Ue?".":"[\\S\\s]",it="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Ie+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Ie+")*(?:\\x5D|$))+/";Be.push(["lang-regex",RegExp("^"+V+"("+it+")")])}var Ye=Ee.types;Ye&&Be.push([f,Ye]);var Qe=(""+Ee.keywords).replace(/^ | $/g,"");Qe.length&&Be.push([k,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Re.push([a,/^\s+/,null,` \r
\xA0`]);var qe="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(qe+="(?!s*/)"),Be.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(qe),null]),ce(Re,Be)}var Se=De({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(Ee,Re,Be){for(var ze=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ue=Ee.ownerDocument,Ie=Ue.createElement("li");Ee.firstChild;)Ie.appendChild(Ee.firstChild);var it=[Ie];function Ye(Pe){var dt=Pe.nodeType;if(dt==1&&!ze.test(Pe.className))if(Pe.nodeName==="br")Qe(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var at=Pe.firstChild;at;at=at.nextSibling)Ye(at);else if((dt==3||dt==4)&&Be){var Me=Pe.nodeValue,Ge=Me.match(Fe);if(Ge){var xe=Me.substring(0,Ge.index);Pe.nodeValue=xe;var me=Me.substring(Ge.index+Ge[0].length);if(me){var ye=Pe.parentNode;ye.insertBefore(Ue.createTextNode(me),Pe.nextSibling)}Qe(Pe),xe||Pe.parentNode.removeChild(Pe)}}}function Qe(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function dt(Ge,xe){var me=xe?Ge.cloneNode(!1):Ge,ye=Ge.parentNode;if(ye){var re=dt(ye,1),ie=Ge.nextSibling;re.appendChild(me);for(var se=ie;se;se=ie)ie=se.nextSibling,re.appendChild(se)}return me}for(var at=dt(Pe.nextSibling,0),Me;(Me=at.parentNode)&&Me.nodeType===1;)at=Me;it.push(at)}for(var qe=0;qe=ye&&(Ye+=2),Ue>=re&&(ct+=2)}}finally{Me&&(Me.style.display=Ge)}}var Te={};function ve(Ee,Re){for(var Be=Re.length;--Be>=0;){var ze=Re[Be];Te.hasOwnProperty(ze)?H.console&&console.warn("cannot override language handler %s",ze):Te[ze]=Ee}}function le(Ee,Re){return Ee&&Te.hasOwnProperty(Ee)||(Ee=/^\s*]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^