(window.webpackJsonp=window.webpackJsonp||[]).push([[206,6,7,10],{"+NIl":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"use strict";ce.defineMode("stex",function($,D){"use strict";function Z(k,x){k.cmdState.push(x)}function B(k){return k.cmdState.length>0?k.cmdState[k.cmdState.length-1]:null}function M(k){var x=k.cmdState.pop();x&&x.closeBracket()}function G(k){for(var x=k.cmdState,E=x.length-1;E>=0;E--){var h=x[E];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function W(k,x,E){return function(){this.name=k,this.bracketNo=0,this.style=x,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var _={};_.importmodule=W("importmodule","tag",["string","builtin"]),_.documentclass=W("documentclass","tag",["","atom"]),_.usepackage=W("usepackage","tag",["atom"]),_.begin=W("begin","tag",["atom"]),_.end=W("end","tag",["atom"]),_.label=W("label","tag",["atom"]),_.ref=W("ref","tag",["atom"]),_.eqref=W("eqref","tag",["atom"]),_.cite=W("cite","tag",["atom"]),_.bibitem=W("bibitem","tag",["atom"]),_.Bibitem=W("Bibitem","tag",["atom"]),_.RBibitem=W("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(k,x){k.f=x}function y(k,x){var E;if(k.match(/^\\[a-zA-Z@]+/)){var h=k.current().slice(1);return E=_.hasOwnProperty(h)?_[h]:_.DEFAULT,E=new E,Z(x,E),O(x,R),E.style}if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/\\]/))return"tag";if(k.match("\\["))return O(x,function(u,d){return A(u,d,"\\]")}),"keyword";if(k.match("\\("))return O(x,function(u,d){return A(u,d,"\\)")}),"keyword";if(k.match("$$"))return O(x,function(u,d){return A(u,d,"$$")}),"keyword";if(k.match("$"))return O(x,function(u,d){return A(u,d,"$")}),"keyword";var o=k.next();if(o=="%")return k.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=B(x),E)E.closeBracket(o),O(x,R);else return"error";return"bracket"}else return o=="{"||o=="["?(E=_.DEFAULT,E=new E,Z(x,E),"bracket"):/\d/.test(o)?(k.eatWhile(/[\w.%]/),"atom"):(k.eatWhile(/[\w\-_]/),E=G(x),E.name=="begin"&&(E.argument=k.current()),E.styleIdentifier())}function A(k,x,E){if(k.eatSpace())return null;if(E&&k.match(E))return O(x,y),"keyword";if(k.match(/^\\[a-zA-Z@]+/))return"tag";if(k.match(/^[a-zA-Z]+/))return"variable-2";if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/]/))return"tag";if(k.match(/^[\^_&]/))return"tag";if(k.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(k.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=k.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(k.skipToEnd(),"comment"):"error"}function R(k,x){var E=k.peek(),h;return E=="{"||E=="["?(h=B(x),h.openBracket(E),k.eat(E),O(x,y),"bracket"):/[ \t\r]/.test(E)?(k.eat(E),null):(O(x,y),M(x),y(k,x))}return{startState:function(){var k=D.inMathMode?function(x,E){return A(x,E)}:y;return{cmdState:[],f:k}},copyState:function(k){return{cmdState:k.cmdState.slice(),f:k.f}},token:function(k,x){return x.f(k,x)},blankLine:function(k){k.f=y,k.cmdState.length=0},lineComment:"%"}}),ce.defineMIME("text/x-stex","stex"),ce.defineMIME("text/x-latex","stex")})},"19Vz":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){ce.defineOption("placeholder","",function(W,_,O){var y=O&&O!=ce.Init;if(_&&!y)W.on("blur",B),W.on("change",M),W.on("swapDoc",M),ce.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Z(W)}),M(W);else if(!_&&y){W.off("blur",B),W.off("change",M),W.off("swapDoc",M),ce.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),$(W);var A=W.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}_&&!W.hasFocus()&&B(W)});function $(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function D(W){$(W);var _=W.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=W.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var O=W.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),_.appendChild(O),W.display.lineSpace.insertBefore(_,W.display.lineSpace.firstChild)}function Z(W){setTimeout(function(){var _=!1,O=W.getInputField();O.nodeName=="TEXTAREA"?_=!O.value:W.lineCount()==1&&(_=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),_?D(W):$(W)},20)}function B(W){G(W)&&D(W)}function M(W){var _=W.getWrapperElement(),O=G(W);_.className=_.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?D(W):$(W)}function G(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"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};ce.defineMode("xml",function(Z,B){var M=Z.indentUnit,G={},W=B.htmlMode?$:D;for(var _ in W)G[_]=W[_];for(var _ in B)G[_]=B[_];var O,y;function A(a,C){function m(j){return C.tokenize=j,j(a,C)}var T=a.next();if(T=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(x("atom","]]>")):null:a.match("--")?m(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),C.tokenize=x("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",C.tokenize=R,"tag bracket");if(T=="&"){var U;return a.eat("#")?a.eat("x")?U=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):U=a.eatWhile(/[\d]/)&&a.eat(";"):U=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),U?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function R(a,C){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return C.tokenize=A,O=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return O="equals",null;if(m=="<"){C.tokenize=A,C.state=d,C.tagName=C.tagStart=null;var T=C.tokenize(a,C);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(m)?(C.tokenize=k(m),C.stringStartCol=a.column(),C.tokenize(a,C)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function k(a){var C=function(m,T){for(;!m.eol();)if(m.next()==a){T.tokenize=R;break}return"string"};return C.isInAttribute=!0,C}function x(a,C){return function(m,T){for(;!m.eol();){if(m.match(C)){T.tokenize=A;break}m.next()}return a}}function E(a){return function(C,m){for(var T;(T=C.next())!=null;){if(T=="<")return m.tokenize=E(a+1),m.tokenize(C,m);if(T==">")if(a==1){m.tokenize=A;break}else return m.tokenize=E(a-1),m.tokenize(C,m)}return"meta"}}function h(a,C,m){this.prev=a.context,this.tagName=C,this.indent=a.indented,this.startOfLine=m,(G.doNotIndent.hasOwnProperty(C)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,C){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!G.contextGrabbers.hasOwnProperty(m)||!G.contextGrabbers[m].hasOwnProperty(C))return;o(a)}}function d(a,C,m){return a=="openTag"?(m.tagStart=C.column(),S):a=="closeTag"?v:d}function S(a,C,m){return a=="word"?(m.tagName=C.current(),y="tag",b):G.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,C,m)):(y="error",S)}function v(a,C,m){if(a=="word"){var T=C.current();return m.context&&m.context.tagName!=T&&G.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==T||G.matchClosing===!1?(y="tag",p):(y="tag error",w)}else return G.allowMissingTagName&&a=="endTag"?(y="tag bracket",p(a,C,m)):(y="error",w)}function p(a,C,m){return a!="endTag"?(y="error",p):(o(m),d)}function w(a,C,m){return y="error",p(a,C,m)}function b(a,C,m){if(a=="word")return y="attribute",s;if(a=="endTag"||a=="selfcloseTag"){var T=m.tagName,U=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(T)?u(m,T):(u(m,T),m.context=new h(m,T,U==m.indented)),d}return y="error",b}function s(a,C,m){return a=="equals"?f:(G.allowMissing||(y="error"),b(a,C,m))}function f(a,C,m){return a=="string"?l:a=="word"&&G.allowUnquoted?(y="string",b):(y="error",b(a,C,m))}function l(a,C,m){return a=="string"?l:b(a,C,m)}return{startState:function(a){var C={tokenize:A,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(C.baseIndent=a),C},token:function(a,C){if(!C.tagName&&a.sol()&&(C.indented=a.indentation()),a.eatSpace())return null;O=null;var m=C.tokenize(a,C);return(m||O)&&m!="comment"&&(y=null,C.state=C.state(O||m,a,C),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,C,m){var T=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(T&&T.noIndent)return ce.Pass;if(a.tokenize!=R&&a.tokenize!=A)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/$/,blockCommentStart:"",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var C=[],m=a.context;m;m=m.prev)m.tagName&&C.push(m.tagName);return C.reverse()}}}),ce.defineMIME("text/xml","xml"),ce.defineMIME("application/xml","xml"),ce.mimeModes.hasOwnProperty("text/html")||ce.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(wt,nt,re){"use strict";var ce=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(!ce)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce($)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function B(R){return typeof R=="string"&&Z.test(R)}for(var M=B,G=[],W=0;W<256;++W)G.push((W+256).toString(16).substr(1));function _(R){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(G[R[k+0]]+G[R[k+1]]+G[R[k+2]]+G[R[k+3]]+"-"+G[R[k+4]]+G[R[k+5]]+"-"+G[R[k+6]]+G[R[k+7]]+"-"+G[R[k+8]]+G[R[k+9]]+"-"+G[R[k+10]]+G[R[k+11]]+G[R[k+12]]+G[R[k+13]]+G[R[k+14]]+G[R[k+15]]).toLowerCase();if(!M(x))throw TypeError("Stringified UUID is invalid");return x}var O=_;function y(R,k,x){R=R||{};var E=R.random||(R.rng||D)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,k){x=x||0;for(var h=0;h<16;++h)k[x+h]=E[h];return k}return O(E)}var A=nt.a=y},"7ahc":function(wt,nt,re){"use strict";re.d(nt,"a",function(){return S});var ce=re("k1fw"),$=re("0Owb"),D=re("+L6B"),Z=re("2/Rp"),B=re("y8nQ"),M=re("Vl3Y"),G=re("tJVT"),W=re("OaEy"),_=re("2fM7"),O=re("q1tI"),y=re.n(O),A=re("VrN/"),R=re.n(A),k=re("p77/"),x=re.n(k),E=re("c5Ni"),h=re.n(E),o=_.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};nt.b=function(v){var p=v.callback,w=v.onCancel,b=Object(O.useState)("python"),s=Object(G.a)(b,2),f=s[0],l=s[1];function a(m){l(d[m][1])}function C(m){p(m)}return y.a.createElement(M.a,Object($.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(_.a,{onChange:a},Object.keys(d).map(function(m){return y.a.createElement(o,{key:m,value:m},d[m][0])}))),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(S,{mode:f})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Z.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(v){var p=v.value,w=v.onChange,b=v.mode,s=v.options,f=s===void 0?{}:s,l=Object(O.useRef)(),a=Object(O.useState)(),C=Object(G.a)(a,2),m=C[0],T=C[1];return Object(O.useEffect)(function(){if(m){function U(j){var F=j.getValue();w&&w(F)}return m.on("change",U),function(){m.off("change",U)}}},[m,w]),Object(O.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(O.useEffect)(function(){m&&((p!==m.getValue()||p==="")&&setTimeout(function(){m.setValue(p||" ")},300))},[m,p]),Object(O.useEffect)(function(){if(l.current&&!m){var U=R.a.fromTextArea(l.current,Object(ce.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));T(U)}},[l.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:l}))}},"7ixt":function(wt,nt,re){"use strict";re.d(nt,"a",function(){return D});var ce={adjustX:1,adjustY:1},$=[0,0],D={left:{points:["cr","cl"],overflow:ce,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:ce,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:ce,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:ce,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:ce,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:ce,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:ce,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:ce,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:ce,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:ce,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:ce,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:ce,offset:[-4,0],targetOffset:$}},Z=D},"815F":function(wt,nt,re){"use strict";re.d(nt,"e",function(){return G}),re.d(nt,"c",function(){return _}),re.d(nt,"d",function(){return O}),re.d(nt,"a",function(){return A}),re.d(nt,"f",function(){return R}),re.d(nt,"b",function(){return k});var ce=re("KQm4"),$=re("VTBJ"),D=re("Ff2n"),Z=re("Zm9Q"),B=re("Kwbf"),M=re("OZM5");function G(x,E){return x!=null?x:E}function W(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=new Map;function h(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(o||[]).forEach(function(d){var S=d.key,v=d.children;Object(B.a)(S!=null,"Tree node must have a certain key: [".concat(u).concat(S,"]"));var p=String(S);Object(B.a)(!E.has(p)||S===null||S===void 0,"Same 'key' exist in the Tree: ".concat(p)),E.set(p,!0),h(v,"".concat(u).concat(p," > "))})}h(x)}function _(x){function E(h){var o=Object(Z.a)(h);return o.map(function(u){if(!Object(M.i)(u))return Object(B.a)(!u,"Tree/TreeNode can only accept TreeNode as children."),null;var d=u.key,S=u.props,v=S.children,p=Object(D.a)(S,["children"]),w=Object($.a)({key:d},p),b=E(v);return b.length&&(w.children=b),w}).filter(function(u){return u})}return E(x)}function O(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(E===!0?[]:E),o=[];function u(d){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return d.map(function(v,p){var w=Object(M.h)(S?S.pos:"0",p),b=G(v.key,w),s=Object($.a)(Object($.a)({},v),{},{parent:S,pos:w,children:null,data:v,isStart:[].concat(Object(ce.a)(S?S.isStart:[]),[p===0]),isEnd:[].concat(Object(ce.a)(S?S.isEnd:[]),[p===d.length-1])});return o.push(s),E===!0||h.has(b)?s.children=u(v.children||[],s):s.children=[],s})}return u(x),o}function y(x,E,h){var o;h?typeof h=="string"?o=function(S){return S[h]}:typeof h=="function"&&(o=function(S){return h(S)}):o=function(S,v){return G(S.key,v)};function u(d,S,v){var p=d?d.children:x,w=d?Object(M.h)(v.pos,S):"0";if(d){var b=o(d,w),s={node:d,index:S,pos:w,key:b,parentPos:v.node?v.pos:null,level:v.level+1};E(s)}p&&p.forEach(function(f,l){u(f,l,{node:d,pos:w,level:v?v.level+1:-1})})}u(null)}function A(x){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=E.initWrapper,o=E.processEntity,u=E.onProcessFinished,d=arguments.length>2?arguments[2]:void 0,S={},v={},p={posEntities:S,keyEntities:v};return h&&(p=h(p)||p),y(x,function(w){var b=w.node,s=w.index,f=w.pos,l=w.key,a=w.parentPos,C=w.level,m={node:b,index:s,key:l,pos:f,level:C},T=G(l,f);S[f]=m,v[T]=m,m.parent=S[a],m.parent&&(m.parent.children=m.parent.children||[],m.parent.children.push(m)),o&&o(m,p)},d),u&&u(p),p}function R(x,E){var h=E.expandedKeys,o=E.selectedKeys,u=E.loadedKeys,d=E.loadingKeys,S=E.checkedKeys,v=E.halfCheckedKeys,p=E.dragOverNodeKey,w=E.dropPosition,b=E.keyEntities,s=b[x],f={eventKey:x,expanded:h.indexOf(x)!==-1,selected:o.indexOf(x)!==-1,loaded:u.indexOf(x)!==-1,loading:d.indexOf(x)!==-1,checked:S.indexOf(x)!==-1,halfChecked:v.indexOf(x)!==-1,pos:String(s?s.pos:""),dragOver:p===x&&w===0,dragOverGapTop:p===x&&w===-1,dragOverGapBottom:p===x&&w===1};return f}function k(x){var E=x.data,h=x.expanded,o=x.selected,u=x.checked,d=x.loaded,S=x.loading,v=x.halfChecked,p=x.dragOver,w=x.dragOverGapTop,b=x.dragOverGapBottom,s=x.pos,f=x.active,l=Object($.a)(Object($.a)({},E),{},{expanded:h,selected:o,checked:u,loaded:d,loading:S,halfChecked:v,dragOver:p,dragOverGapTop:w,dragOverGapBottom:b,pos:s,active:f});return"props"in l||Object.defineProperty(l,"props",{get:function(){return Object(B.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),x}}),l}},"8EBN":function(wt,nt,re){(function(ce){ce(re("VrN/"))})(function(ce){"use strict";ce.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(G+1,Z.length);if(W)return ce.findModeByExtension(W)},ce.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,tt=De.get(Ke);return!Re&&S(tt,Ve)?null:tt},[De]),ze=_.useCallback(function(Ke){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,tt=Ie.get(Ke);return!Re&&S(tt,Ve)?null:tt},[Ie]);return[Be,ze]}function p(De){return _.useMemo(function(){var Ie=new Map,Be=new Map;return De.forEach(function(ze){Ie.set(ze.key,ze),Be.set(ze.data.value,ze)}),[Ie,Be]},[De])}var w={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},b=function(Ie,Be){var ze=Ie.prefixCls,Ke=Ie.height,Ve=Ie.itemHeight,Re=Ie.virtual,tt=Ie.options,it=Ie.flattenOptions,Me=Ie.multiple,We=Ie.searchValue,xe=Ie.onSelect,ye=Ie.onToggleOpen,Ce=Ie.open,le=Ie.notFoundContent,de=Ie.onMouseEnter,me=_.useContext(d),Ee=me.checkable,we=me.checkedKeys,Ue=me.halfCheckedKeys,Ze=me.treeExpandedKeys,at=me.treeDefaultExpandAll,vt=me.treeDefaultExpandedKeys,mt=me.onTreeExpand,Ct=me.treeIcon,Tt=me.showTreeIcon,ut=me.switcherIcon,Rt=me.treeLine,kt=me.treeNodeFilterProp,zt=me.loadData,Nt=me.treeLoadedKeys,Et=me.treeMotion,_t=me.onTreeLoad,Kt=_.useRef(),dt=Object(o.a)(function(){return tt},[Ce,tt],function(lt,$e){return $e[0]&<[1]!==$e[1]}),Zt=p(it),jt=Object(G.a)(Zt,2),Jt=jt[0],ar=jt[1],cr=v(Jt,ar),Er=Object(G.a)(cr,2),Ot=Er[0],ft=Er[1],or=_.useMemo(function(){return we.map(function(lt){var $e=ft(lt);return $e?$e.key:null})},[we]),xr=_.useMemo(function(){return Ee?{checked:or,halfChecked:Ue}:null},[or,Ue,Ee]);_.useEffect(function(){if(Ce&&!Me&&or.length){var lt;(lt=Kt.current)===null||lt===void 0||lt.scrollTo({key:or[0]})}},[Ce]);var ur=String(We).toLowerCase(),It=function($e){return ur?String($e[kt]).toLowerCase().includes(ur):!1},gr=_.useState(vt),sr=Object(G.a)(gr,2),Yr=sr[0],et=sr[1],Lt=_.useState(null),Kr=Object(G.a)(Lt,2),wr=Kr[0],$r=Kr[1],Gr=_.useMemo(function(){return Ze?Object(B.a)(Ze):We?wr:Yr},[Yr,wr,ur,Ze]);_.useEffect(function(){We&&$r(it.map(function(lt){return lt.key}))},[We]);var z=function($e){et($e),$r($e),mt&&mt($e)},c=function($e){$e.preventDefault()},g=function($e,gt){var yt=gt.node.key,Pt=Ot(yt,Ee?"checkbox":"select");Pt!==null&&xe(Pt.data.value,{selected:!we.includes(Pt.data.value)}),Me||ye(!1)},N=_.useState(null),q=Object(G.a)(N,2),K=q[0],Se=q[1],Qe=Ot(K);if(_.useImperativeHandle(Be,function(){return{onKeyDown:function($e){var gt,yt=$e.which;switch(yt){case h.a.UP:case h.a.DOWN:case h.a.LEFT:case h.a.RIGHT:(gt=Kt.current)===null||gt===void 0||gt.onKeyDown($e);break;case h.a.ENTER:{Qe!==null&&g(null,{node:{key:K},selected:!we.includes(Qe.data.value)});break}case h.a.ESC:ye(!1)}},onKeyUp:function(){}}}),dt.length===0)return _.createElement("div",{role:"listbox",className:"".concat(ze,"-empty"),onMouseDown:c},le);var ot={};return Nt&&(ot.loadedKeys=Nt),Gr&&(ot.expandedKeys=Gr),_.createElement("div",{onMouseDown:c,onMouseEnter:de},Qe&&Ce&&_.createElement("span",{style:w,"aria-live":"assertive"},Qe.data.value),_.createElement(u.b,Object.assign({ref:Kt,focusable:!1,prefixCls:"".concat(ze,"-tree"),treeData:dt,height:Ke,itemHeight:Ve,virtual:Re,multiple:Me,icon:Ct,showIcon:Tt,switcherIcon:ut,showLine:Rt,loadData:We?null:zt,motion:Et,checkable:Ee,checkStrictly:!0,checkedKeys:xr,selectedKeys:Ee?[]:or,defaultExpandAll:at},ot,{onActiveChange:Se,onSelect:g,onCheck:g,onExpand:z,onLoad:_t,filterTreeNode:It})))},s=_.forwardRef(b);s.displayName="OptionList";var f=s,l=function(){return null},a=l,C=re("Ff2n"),m=re("Zm9Q");function T(De){return Object(m.a)(De).map(function(Ie){if(!_.isValidElement(Ie)||!Ie.type)return null;var Be=Ie.key,ze=Ie.props,Ke=ze.children,Ve=ze.value,Re=Object(C.a)(ze,["children","value"]),tt=Object(W.a)({key:Be,value:Ve},Re),it=T(Ke);return it.length&&(tt.children=it),tt}).filter(function(Ie){return Ie})}function U(De){if(!De)return De;var Ie=Object(W.a)({},De);return"props"in Ie||Object.defineProperty(Ie,"props",{get:function(){return Object(E.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),Ie}}),Ie}function j(De,Ie,Be,ze,Ke){var Ve=null,Re=null;function tt(){function it(Me){var We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",xe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Me.map(function(ye,Ce){var le="".concat(We,"-").concat(Ce),de=Be.includes(ye.value),me=it(ye.children||[],le,de),Ee=_.createElement(a,Object.assign({},ye),me.map(function(Ue){return Ue.node}));if(Ie===ye.value&&(Ve=Ee),de){var we={pos:le,node:Ee,children:me};return xe||Re.push(we),we}return null}).filter(function(ye){return ye})}Re||(Re=[],it(ze),Re.sort(function(Me,We){var xe=Me.node.props.value,ye=We.node.props.value,Ce=Be.indexOf(xe),le=Be.indexOf(ye);return Ce-le}))}Object.defineProperty(De,"triggerNode",{get:function(){return Object(E.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),tt(),Ve}}),Object.defineProperty(De,"allCheckedNodes",{get:function(){return Object(E.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),tt(),Ke?Re:Re.map(function(Me){var We=Me.node;return We})}})}function F(De){return Array.isArray(De)?De:De!==void 0?[De]:[]}function V(De,Ie){var Be=new Map;return Ie.forEach(function(ze){var Ke=ze.data;Be.set(Ke.value,Ke)}),De.map(function(ze){return U(Be.get(ze))})}function P(De,Ie){var Be=V([De],Ie)[0];return Be?Be.disabled:!1}function I(De){return De.disabled||De.disableCheckbox||De.checkable===!1}function X(De){for(var Ie=De.parent,Be=0,ze=Ie;ze;)ze=ze.parent,Be+=1;return Be}function oe(De){function Ie(ze){return(ze||[]).map(function(Ke){var Ve=Ke.value,Re=Ke.key,tt=Ke.children,it=Object(W.a)(Object(W.a)({},Ke),{},{key:"key"in Ke?Re:Ve});return tt&&(it.children=Ie(tt)),it})}var Be=Object(A.d)(Ie(De),!0);return Be.map(function(ze){return{key:ze.data.key,data:ze.data,level:X(ze)}})}function pe(De){return function(Ie,Be){var ze=Be[De];return String(ze).toLowerCase().includes(String(Ie).toLowerCase())}}function ve(De,Ie,Be){var ze=Be.optionFilterProp,Ke=Be.filterOption;if(Ke===!1)return Ie;var Ve;typeof Ke=="function"?Ve=Ke:Ve=pe(ze);function Re(tt){var it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return tt.map(function(Me){var We=Me.children,xe=it||Ve(De,U(Me)),ye=Re(We||[],xe);return xe||ye.length?Object(W.a)(Object(W.a)({},Me),{},{children:ye}):null}).filter(function(Me){return Me})}return Re(Ie)}function Le(De,Ie,Be,ze){var Ke=new Map;return F(Ie).forEach(function(Ve){Ve&&Object(M.a)(Ve)==="object"&&"value"in Ve&&Ke.set(Ve.value,Ve)}),De.map(function(Ve){var Re={value:Ve},tt=Be(Ve,"select",!0),it=tt?ze(tt.data):Ve;if(Ke.has(Ve)){var Me=Ke.get(Ve);Re.label="label"in Me?Me.label:it,"halfChecked"in Me&&(Re.halfChecked=Me.halfChecked)}else Re.label=it;return Re})}function ke(De,Ie){var Be=new Set(De);return Be.add(Ie),Array.from(Be)}function he(De,Ie){var Be=new Set(De);return Be.delete(Ie),Array.from(Be)}function ae(De){var Ie=De.searchPlaceholder,Be=De.treeCheckStrictly,ze=De.treeCheckable,Ke=De.labelInValue,Ve=De.value,Re=De.multiple;Object(E.a)(!Ie,"`searchPlaceholder` has been removed."),Be&&Ke===!1&&Object(E.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Ke||Be)&&Object(E.a)(F(Ve).every(function(tt){return tt&&Object(M.a)(tt)==="object"&&"value"in tt}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),Be||Re||ze?Object(E.a)(!Ve||Array.isArray(Ve),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(E.a)(!Array.isArray(Ve),"`value` should not be array when `TreeSelect` is single mode.")}var ue=ae,ie=10;function se(De,Ie){var Be=Ie.id,ze=Ie.pId,Ke=Ie.rootPId,Ve={},Re=[],tt=De.map(function(it){var Me=Object(W.a)({},it),We=Me[Be];return Ve[We]=Me,Me.key=Me.key||We,Me});return tt.forEach(function(it){var Me=it[ze],We=Ve[Me];We&&(We.children=We.children||[],We.children.push(it)),(Me===Ke||!We&&Ke===null)&&Re.push(it)}),Re}function J(De,Ie){var Be=0,ze=new Set;function Ke(Ve){return(Ve||[]).map(function(Re){var tt=Re.key,it=Re.value,Me=Re.children,We=Object(C.a)(Re,["key","value","children"]),xe="value"in Re?it:tt,ye=Object(W.a)(Object(W.a)({},We),{},{key:tt!=null?tt:xe,value:xe,title:Ie(Re)});return"children"in Re&&(ye.children=Ke(Me)),ye})}return Ke(De)}function ee(De,Ie,Be){var ze=Be.getLabelProp,Ke=Be.simpleMode,Ve=_.useRef({});return De?(Ve.current.formatTreeData=Ve.current.treeData===De?Ve.current.formatTreeData:J(Ke?se(De,Object(W.a)({id:"id",pId:"pId",rootPId:null},Ke!==!0?Ke:{})):De,ze),Ve.current.treeData=De):Ve.current.formatTreeData=Ve.current.children===Ie?Ve.current.formatTreeData:J(T(Ie),ze),Ve.current.formatTreeData}var ne="SHOW_ALL",fe="SHOW_PARENT",Ae="SHOW_CHILD";function ge(De,Ie,Be){var ze=new Set(De);return Ie===Ae?De.filter(function(Ke){var Ve=Be[Ke];return!(Ve&&Ve.children&&Ve.children.every(function(Re){var tt=Re.node;return I(tt)||ze.has(tt.key)}))}):Ie===fe?De.filter(function(Ke){var Ve=Be[Ke],Re=Ve?Ve.parent:null;return!(Re&&!I(Re.node)&&ze.has(Re.node.key))}):De}function Oe(De,Ie){var Be=Ie.value,ze=Ie.getEntityByValue,Ke=Ie.getEntityByKey,Ve=Ie.treeConduction,Re=Ie.showCheckedStrategy,tt=Ie.conductKeyEntities,it=Ie.getLabelProp;return _.useMemo(function(){var Me=De;if(Ve){var We=ge(De.map(function(xe){var ye=ze(xe);return ye?ye.key:xe}),Re,tt);Me=We.map(function(xe){var ye=Ke(xe);return ye?ye.data.value:xe})}return Le(Me,Be,ze,it)},[De,Be,Ve,Re,ze])}var Pe=["expandedKeys","treeData","treeCheckable","showCheckedStrategy","searchPlaceholder","treeLine","treeIcon","showTreeIcon","switcherIcon","treeNodeFilterProp","filterTreeNode","dropdownPopupAlign","treeDefaultExpandAll","treeCheckStrictly","treeExpandedKeys","treeLoadedKeys","treeMotion","onTreeExpand","onTreeLoad","loadData","treeDataSimpleMode","treeNodeLabelProp","treeDefaultExpandedKeys"],je=Object(O.a)({prefixCls:"rc-tree-select",components:{optionList:f},convertChildrenToData:function(){return null},flattenOptions:oe,getLabeledValue:y.e,filterOptions:ve,isValueDisabled:P,findValueOption:V,omitDOMProps:function(Ie){var Be=Object(W.a)({},Ie);return Pe.forEach(function(ze){delete Be[ze]}),Be}});je.displayName="Select";var Ge=_.forwardRef(function(De,Ie){var Be=De.multiple,ze=De.treeCheckable,Ke=De.treeCheckStrictly,Ve=De.showCheckedStrategy,Re=Ve===void 0?"SHOW_CHILD":Ve,tt=De.labelInValue,it=De.loadData,Me=De.treeLoadedKeys,We=De.treeNodeFilterProp,xe=We===void 0?"value":We,ye=De.treeNodeLabelProp,Ce=De.treeDataSimpleMode,le=De.treeData,de=De.treeExpandedKeys,me=De.treeDefaultExpandedKeys,Ee=De.treeDefaultExpandAll,we=De.children,Ue=De.treeIcon,Ze=De.showTreeIcon,at=De.switcherIcon,vt=De.treeLine,mt=De.treeMotion,Ct=De.filterTreeNode,Tt=De.dropdownPopupAlign,ut=De.onChange,Rt=De.onTreeExpand,kt=De.onTreeLoad,zt=De.onDropdownVisibleChange,Nt=De.onSelect,Et=De.onDeselect,_t=ze||Ke,Kt=Be||_t,dt=ze&&!Ke,Zt=Ke||tt,jt=_.useRef(null);_.useImperativeHandle(Ie,function(){return{focus:jt.current.focus,blur:jt.current.blur}});var Jt=function(yt){return le&&yt.label||yt.title},ar=function(yt){return ye?yt[ye]:Jt(yt)},cr=ee(le,we,{getLabelProp:Jt,simpleMode:Ce}),Er=Object(_.useMemo)(function(){return oe(cr)},[cr]),Ot=p(Er),ft=Object(G.a)(Ot,2),or=ft[0],xr=ft[1],ur=v(or,xr),It=Object(G.a)(ur,2),gr=It[0],sr=It[1],Yr=Object(_.useMemo)(function(){return dt?Object(A.a)(cr):{keyEntities:null}},[cr,ze,Ke]),et=Yr.keyEntities,Lt=Object(x.a)(De.defaultValue,{value:De.value}),Kr=Object(G.a)(Lt,2),wr=Kr[0],$r=Kr[1],Gr=function(yt){var Pt=[],nr=[];return yt.forEach(function(Yt){sr(Yt)?nr.push(Yt):Pt.push(Yt)}),{missingRawValues:Pt,existRawValues:nr}},z=Object(_.useMemo)(function(){var gt=[],yt=[];if(F(wr).forEach(function(Vt){if(Vt&&Object(M.a)(Vt)==="object"&&"value"in Vt)if(Vt.halfChecked&&Ke){var Cr=sr(Vt.value);gt.push(Cr?Cr.key:Vt.value)}else yt.push(Vt.value);else yt.push(Vt)}),dt){var Pt=Gr(yt),nr=Pt.missingRawValues,Yt=Pt.existRawValues,Qt=Yt.map(function(Vt){return sr(Vt).key}),vr=Object(R.a)(Qt,!0,et),Wr=vr.checkedKeys,tr=vr.halfCheckedKeys;return[[].concat(Object(B.a)(nr),Object(B.a)(Wr.map(function(Vt){return gr(Vt).data.value}))),tr]}return[yt,gt]},[wr,Kt,Zt,ze,Ke]),c=Object(G.a)(z,2),g=c[0],N=c[1],q=Oe(g,{treeConduction:dt,value:wr,showCheckedStrategy:Re,conductKeyEntities:et,getEntityByValue:sr,getEntityByKey:gr,getLabelProp:ar}),K=function(yt,Pt,nr){if($r(Kt?yt:yt[0]),ut){var Yt=yt;if(dt&&Re!=="SHOW_ALL"){var Qt=yt.map(function(yr){var Or=sr(yr);return Or?Or.key:yr}),vr=ge(Qt,Re,et);Yt=vr.map(function(yr){var Or=gr(yr);return Or?Or.data.value:yr})}var Wr=Pt||{triggerValue:void 0,selected:void 0},tr=Wr.triggerValue,Vt=Wr.selected,Cr=Zt?Le(Yt,wr,sr,ar):Yt;if(Ke){var zr=N.map(function(yr){var Or=gr(yr);return Or?Or.data.value:yr}).filter(function(yr){return!Yt.includes(yr)});Cr=[].concat(Object(B.a)(Cr),Object(B.a)(Le(zr,wr,sr,ar)))}var ir={preValue:q,triggerValue:tr},dn=!0;(Ke||nr==="selection"&&!Vt)&&(dn=!1),j(ir,tr,yt,cr,dn),_t?ir.checked=Vt:ir.selected=Vt,ut(Kt?Cr:Cr[0],Zt?null:Yt.map(function(yr){var Or=sr(yr);return Or?ar(Or.data):null}),ir)}},Se=function(yt,Pt,nr){var Yt=yt;if(!Kt)K([yt],{selected:!0,triggerValue:yt},nr);else{var Qt=ke(g,yt);if(dt){var vr=Gr(Qt),Wr=vr.missingRawValues,tr=vr.existRawValues,Vt=tr.map(function(ir){return sr(ir).key}),Cr=Object(R.a)(Vt,!0,et),zr=Cr.checkedKeys;Qt=[].concat(Object(B.a)(Wr),Object(B.a)(zr.map(function(ir){return gr(ir).data.value})))}K(Qt,{selected:!0,triggerValue:yt},nr)}Nt&&Nt(Yt,Pt)},Qe=function(yt,Pt,nr){var Yt=yt,Qt=he(g,yt);if(dt){var vr=Gr(Qt),Wr=vr.missingRawValues,tr=vr.existRawValues,Vt=tr.map(function(ir){return sr(ir).key}),Cr=Object(R.a)(Vt,{checked:!1,halfCheckedKeys:N},et),zr=Cr.checkedKeys;Qt=[].concat(Object(B.a)(Wr),Object(B.a)(zr.map(function(ir){return gr(ir).data.value})))}K(Qt,{selected:!1,triggerValue:yt},nr),Et&&Et(Yt,Pt)},ot=function(){K([],null,"clear")},lt=_.useCallback(function(gt){if(zt){var yt={};Object.defineProperty(yt,"documentClickClose",{get:function(){return Object(E.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),zt(gt,yt)}},[zt]),$e={optionLabelProp:null,optionFilterProp:xe,dropdownAlign:Tt,internalProps:{mark:k.a,onClear:ot,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:Se,onRawDeselect:Qe}};return"filterTreeNode"in De&&($e.filterOption=Ct),_.createElement(d.Provider,{value:{checkable:_t,loadData:it,treeLoadedKeys:Me,onTreeLoad:kt,checkedKeys:g,halfCheckedKeys:N,treeDefaultExpandAll:Ee,treeExpandedKeys:de,treeDefaultExpandedKeys:me,onTreeExpand:Rt,treeIcon:Ue,treeMotion:mt,showTreeIcon:Ze,switcherIcon:at,treeLine:vt,treeNodeFilterProp:xe}},_.createElement(je,Object.assign({ref:jt,mode:Kt?"multiple":null},De,$e,{value:q,labelInValue:!0,options:cr,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:lt})))}),He=function(De){Object(D.a)(Be,De);var Ie=Object(Z.a)(Be);function Be(){var ze;return Object(ce.a)(this,Be),ze=Ie.apply(this,arguments),ze.selectRef=_.createRef(),ze.focus=function(){ze.selectRef.current.focus()},ze.blur=function(){ze.selectRef.current.blur()},ze}return Object($.a)(Be,[{key:"render",value:function(){return _.createElement(Ge,Object.assign({ref:this.selectRef},this.props))}}]),Be}(_.Component);He.TreeNode=a,He.SHOW_ALL=ne,He.SHOW_PARENT=fe,He.SHOW_CHILD=Ae;var Fe=He,qe=nt.e=Fe},"8hTe":function(wt,nt,re){wt.exports={button:"button___1wy9m"}},"8pgt":function(wt,nt,re){wt.exports={flexRow:"flexRow___2kcn2",flexColumn:"flexColumn___2bS_0",formWrap:"formWrap___3t-wi",example:"example___2J2YZ",footerWrap:"footerWrap___3u6gg"}},"9Bee":function(wt,nt,re){"use strict";var ce=re("DYRE"),$=re("zeV3"),D=re("+L6B"),Z=re("2/Rp"),B=re("k1fw"),M=re("9og8"),G=re("tJVT"),W=re("WmNS"),_=re.n(W),O=re("q1tI"),y=re.n(O),A=re("vg9a"),R=re("DlQD"),k=re.n(R),x=re("rUJ1");function E(z,c){var g=z.match(/^(\s+)(?:```)/);if(g===null)return c;var N=g[1];return c.split(`
`).map(function(q){var K=q.match(/^\s+/);if(K===null)return q;var Se=Object(G.a)(K,1),Qe=Se[0];return Qe.length>=N.length?q.slice(N.length):q}).join(`
`)}var h=[],o=[""],u=new k.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){h.length=0,o=[""]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(z,c,g,N){if(c>=z.length||z[c].level<=g)return c;var q=z[c];N.push("- "+q.text+""),c++;var K=[];return c=p(z,c,q.level,K),K.length>0&&(N.push("
"),K.forEach(function(Se){N.push(Se)}),N.push("
")),N.push(" "),c=p(z,c,g,N),c}function w(){return p(h,0,0,o),o.push("
"),o.join("")}var b={heading:function(c){var g=d.exec(c);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(c){var g=this.rules.block.fences.exec(c);if(g){var N=g[0],q=E(N,g[3]||""),K=g[2]?g[2].trim():g[2];if(["latex","katex","math"].indexOf(K)>=0){var Se=l(),Qe=q;q=Se,a[Se]={type:"block",expression:Qe}}return{type:"code",raw:N,lang:K,text:q}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,l=function(){return"__special_katext_id_".concat(f++,"__")},a={};function C(){return a}function m(){f=0,a={}}function T(z){return z=z.replace(s,function(c,g){var N=l();return a[N]={type:"inline",expression:g},N}),z}var U=u.listitem;u.listitem=function(z){return U(T(z))};var j=u.paragraph;u.paragraph=function(z){return j(T(z))};var F=u.tablecell;u.tablecell=function(z,c){return F(T(z),c)},u.code=function(z,c,g){var N=(c||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"".concat(z,"
"):'
').concat(g?z:Object(x.escape)(z,!0),`
`):''+(g?z:Object(x.escape)(z,!0))+"
"},u.heading=function(z,c,g){var N=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:N,level:c,text:z}),"'+z+""},k.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),k.a.use({tokenizer:b,renderer:u});var V=k.a,P=re("SJMd"),I=re("ulZh"),X=re.n(I),oe=re("m3rI"),pe=re("Oy/b"),ve=re("p5ED"),Le=re("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ke=function(z,c){return(ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,N){g.__proto__=N}||function(g,N){for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(g[q]=N[q])})(z,c)};function he(z,c){function g(){this.constructor=z}ke(z,c),z.prototype=c===null?Object.create(c):(g.prototype=c.prototype,new g)}function ae(z,c,g,N){return new(g||(g=Promise))(function(q,K){function Se(lt){try{ot(N.next(lt))}catch($e){K($e)}}function Qe(lt){try{ot(N.throw(lt))}catch($e){K($e)}}function ot(lt){var $e;lt.done?q(lt.value):($e=lt.value,$e instanceof g?$e:new g(function(gt){gt($e)})).then(Se,Qe)}ot((N=N.apply(z,c||[])).next())})}function ue(z,c){var g,N,q,K,Se={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return K={next:Qe(0),throw:Qe(1),return:Qe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Qe(ot){return function(lt){return function($e){if(g)throw new TypeError("Generator is already executing.");for(;Se;)try{if(g=1,N&&(q=2&$e[0]?N.return:$e[0]?N.throw||((q=N.return)&&q.call(N),0):N.next)&&!(q=q.call(N,$e[1])).done)return q;switch(N=0,q&&($e=[2&$e[0],q.value]),$e[0]){case 0:case 1:q=$e;break;case 4:return Se.label++,{value:$e[1],done:!1};case 5:Se.label++,N=$e[1],$e=[0];continue;case 7:$e=Se.ops.pop(),Se.trys.pop();continue;default:if(!(q=Se.trys,(q=q.length>0&&q[q.length-1])||$e[0]!==6&&$e[0]!==2)){Se=0;continue}if($e[0]===3&&(!q||$e[1]>q[0]&&$e[1]',"select"),this.addActionButton(N,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(N,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(N,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(N,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(N,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(N,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(N,'',"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(K){var Se=document.createElement("div");Se.className=""+g.toolbarButtonStyleClass.name,Se.setAttribute("data-type-name",K.typeName),Se.innerHTML=K.icon,Se.addEventListener("click",function(){g.markerToolbarButtonClicked(Se,K)}),g.buttons.push(Se),g.markerButtons.push(Se)}),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()},z.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},z.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var c=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var g=0;g0&&this.buttonClickListeners.forEach(function(N){return N("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(c,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(c){this.resetButtonStyles(),c.className=c.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),c.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(c){var g=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===c});g&&this.setActiveButton(g)},z.prototype.setCurrentMarker=function(c){var g=this;this.currentMarker=c,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){g.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},z}(),Pe=function(){function z(c,g,N,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=g,this.uiStyleSettings=N,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new ge("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 ge("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ge("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ge("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ge("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 ge("toolbox-panel-row_colors",`
background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ge("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
padding: `+g+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Ae("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Ae("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(c){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(c){var g,N,q=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(K){var Se;K.uiStyleSettings=q.uiStyleSettings;var Qe=document.createElement("div");Qe.className=q.toolboxButtonStyleClass.name+" "+((Se=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Se!==void 0?Se:q.toolboxButtonStyleColorsClass.name),Qe.innerHTML=K.icon,Qe.title=K.title,Qe.addEventListener("click",function(){q.panelButtonClick(K)}),q.panelButtons.push(Qe),q.buttonRow.appendChild(Qe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(c){var g=this,N=-1;if(c!==this.activePanel){N=this.panels.indexOf(c),this.panelRow.innerHTML="";var q=c.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=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(K,Se){var Qe,ot;K.className=g.toolboxButtonStyleClass.name+" "+(Se===N?""+((Qe=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Qe!==void 0?Qe:g.toolboxActiveButtonStyleColorsClass.name):""+((ot=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ot!==void 0?ot:g.toolboxButtonStyleColorsClass.name))})},z}(),je=function(z,c){this.title=z,this.icon=c},Ge=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'')||this;return Se.colors=[],Se.addTransparent=!1,Se.colorBoxes=[],Se.colors=N,Se.currentColor=q,Se.setCurrentColor=Se.setCurrentColor.bind(Se),Se.getColorBox=Se.getColorBox.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(q){var K=g.getColorBox(q);N.appendChild(K),g.colorBoxes.push(K)}),N},c.prototype.getColorBox=function(g){var N=this,q=this.uiStyleSettings.toolbarHeight/4,K=this.uiStyleSettings.toolbarHeight-q,Se=document.createElement("div");Se.style.display="inline-block",Se.style.boxSizing="content-box",Se.style.width=K-2+"px",Se.style.height=K-2+"px",Se.style.padding="1px",Se.style.marginRight="2px",Se.style.marginBottom="2px",Se.style.borderWidth="2px",Se.style.borderStyle="solid",Se.style.borderRadius=(K+2)/2+"px",Se.style.borderColor=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Se.addEventListener("click",function(){N.setCurrentColor(g,Se)});var Qe=document.createElement("div");return Qe.style.display="inline-block",Qe.style.width=K-2+"px",Qe.style.height=K-2+"px",Qe.style.backgroundColor=g,Qe.style.borderRadius=K/2+"px",g==="transparent"&&(Qe.style.fill=this.uiStyleSettings.toolboxAccentColor,Qe.innerHTML=``),Se.appendChild(Qe),Se},c.prototype.setCurrentColor=function(g,N){var q=this;this.currentColor=g,this.colorBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},c}(je),He=function(){function z(c,g,N){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=g,this.globalSettings=N,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(c){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(c,g){},z.prototype.dblClick=function(c,g){},z.prototype.manipulate=function(c){},z.prototype.pointerUp=function(c){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},z.prototype.scale=function(c,g){},z.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},z.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var c=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),c.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(c)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Fe=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(c){return this.topLeft.ownsTarget(c)?this.topLeft:this.topCenter.ownsTarget(c)?this.topCenter:this.topRight.ownsTarget(c)?this.topRight:this.centerLeft.ownsTarget(c)?this.centerLeft:this.centerRight.ownsTarget(c)?this.centerRight:this.bottomLeft.ownsTarget(c)?this.bottomLeft:this.bottomCenter.ownsTarget(c)?this.bottomCenter:this.bottomRight.ownsTarget(c)?this.bottomRight:void 0},z}(),qe=function(){function z(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},z}(),De=function(){function z(){}return z.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},z.toSVGMatrix=function(c,g){return c.a=g.a,c.b=g.b,c.c=g.c,c.d=g.d,c.e=g.e,c.f=g.f,c},z}(),Ie=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.left=0,K.top=0,K.width=0,K.height=0,K.defaultSize={x:50,y:20},K.offsetX=0,K.offsetY=0,K.rotationAngle=0,K.CB_DISTANCE=10,K._suppressMarkerCreateEvent=!1,K.container.transform.baseVal.appendItem(se.createTransform()),K.setupControlBox(),K}return he(c,z),Object.defineProperty(c.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"visual",{get:function(){return this._visual},set:function(g){this._visual=g;var N=se.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(g){return!!z.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(g);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(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var K=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=K.x-this.width/2,this.top=K.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Se=this.container.transform.baseVal.getItem(0);Se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(g){var N=this.state;z.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},c.prototype.manipulate=function(g){var N=this.unrotatePoint(g);this.state==="creating"?this.resize(g):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(g)},c.prototype.resize=function(g){var N=this.manipulationStartLeft,q=this.manipulationStartWidth,K=this.manipulationStartTop,Se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+g.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:K=this.manipulationStartTop+g.y-this.manipulationStartY,Se=this.manipulationStartHeight+this.manipulationStartTop-K;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Se=this.manipulationStartHeight+g.y-this.manipulationStartY}q>=0?(this.left=N,this.width=q):(this.left=N+q,this.width=-q),Se>=0?(this.top=K,this.height=Se):(this.top=K+Se,this.height=-Se),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var N=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},c.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},c.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var N=this.container.getCTM(),q=se.createPoint(g.x,g.y);return{x:(q=q.matrixTransform(N)).x,y:q.y}},c.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var N=this.container.getCTM();N=N.inverse();var q=se.createPoint(g.x,g.y);return{x:(q=q.matrixTransform(N)).x,y:q.y}},c.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var g=se.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),this.container.appendChild(this.controlBox),this.controlRect=se.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=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Fe,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},c.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()},c.prototype.createGrip=function(){var g=new qe;return g.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(g.visual),g},c.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,N=-g/2,q=N,K=(this.width+this.CB_DISTANCE)/2-g/2,Se=(this.height+this.CB_DISTANCE)/2-g/2,Qe=this.height+this.CB_DISTANCE-g/2,ot=this.width+this.CB_DISTANCE-g/2;this.positionGrip(this.controlGrips.topLeft.visual,N,q),this.positionGrip(this.controlGrips.topCenter.visual,K,q),this.positionGrip(this.controlGrips.topRight.visual,ot,q),this.positionGrip(this.controlGrips.centerLeft.visual,N,Se),this.positionGrip(this.controlGrips.centerRight.visual,ot,Se),this.positionGrip(this.controlGrips.bottomLeft.visual,N,Qe),this.positionGrip(this.controlGrips.bottomCenter.visual,K,Qe),this.positionGrip(this.controlGrips.bottomRight.visual,ot,Qe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,K,q-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(g,N,q){var K=g.transform.baseVal.getItem(0);K.setTranslate(N,q),g.transform.baseVal.replaceItem(K,0)},c.prototype.hideControlBox=function(){this.controlBox.style.display="none"},c.prototype.showControlBox=function(){this.controlBox.style.display=""},c.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:De.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:De.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N);var q=this.rotatePoint({x:this.left,y:this.top}),K=this.unrotatePoint({x:q.x*g,y:q.y*N});this.left=K.x,this.top=K.y,this.width=this.width*g,this.height=this.height*N,this.adjustControlBox()},c}(He),Be=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.createVisual=K.createVisual.bind(K),K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual)},c.prototype.createVisual=function(){this.visual=se.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)},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.setSize()},c.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(g){z.prototype.pointerUp.call(this,g),this.setSize()},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},c.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},c.prototype.restoreState=function(g){var N=g;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.setSize()},c.title="Rectangle marker",c}(Ie),ze=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'')||this;return Se.widths=[],Se.widthBoxes=[],Se.widths=N,Se.currentWidth=q,Se.setCurrentWidth=Se.setCurrentWidth.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.flexGrow="2",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=q===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentWidth(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.innerText=q.toString(),Se.style.marginRight="5px",K.appendChild(Se);var Qe=document.createElement("div");Qe.style.minHeight="20px",Qe.style.flexGrow="2",Qe.style.display="flex",Qe.style.alignItems="center";var ot=document.createElement("hr");ot.style.minWidth="20px",ot.style.border="0px",ot.style.borderTop=q+"px solid "+g.uiStyleSettings.toolboxColor,ot.style.flexGrow="2",Qe.appendChild(ot),K.appendChild(Qe),g.widthBoxes.push(K)}),N},c.prototype.setCurrentWidth=function(g,N){var q=this;this.currentWidth=g,this.widthBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(je),Ke=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'')||this;return Se.styles=[],Se.styleBoxes=[],Se.styles=N,Se.currentStyle=q,Se.setCurrentStyle=Se.setCurrentStyle.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/g.styles.length-5+"%",K.style.borderColor=q===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentStyle(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.style.minHeight="20px",Se.style.flexGrow="2",Se.style.overflow="hidden";var Qe=``;Se.innerHTML=Qe,K.appendChild(Se),g.styleBoxes.push(K)}),N},c.prototype.setCurrentStyle=function(g,N){var q=this;this.currentStyle=g,this.styleBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(je),Ve=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new Ge("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return he(c,z),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="FrameMarker",c.title="Frame marker",c.icon='',c}(Be),Re=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},tt=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.x1=0,K.y1=0,K.x2=0,K.y2=0,K.defaultLength=50,K.manipulationStartX=0,K.manipulationStartY=0,K.manipulationStartX1=0,K.manipulationStartY1=0,K.manipulationStartX2=0,K.manipulationStartY2=0,K.setupControlBox(),K}return he(c,z),c.prototype.ownsTarget=function(g){return!!z.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(g){var N=this.state;z.prototype.pointerUp.call(this,g),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(g),this._state="select",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},c.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){this.positionGrips()},c.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},c.prototype.createGrip=function(){var g=new qe;return g.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(g.visual),g},c.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},c.prototype.positionGrip=function(g,N,q){var K=g.transform.baseVal.getItem(0);K.setTranslate(N,q),g.transform.baseVal.replaceItem(K,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.x1=this.x1*g,this.y1=this.y1*N,this.x2=this.x2*g,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},c}(He),it=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new Ge("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.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)},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},c.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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='',c}(tt),Me=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'')||this;return Se.fonts=[],Se.fontBoxes=[],Se.fonts=N,Se.currentFont=q,Se.setCurrentFont=Se.setCurrentFont.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(q){var K=document.createElement("div");K.style.display="inline-block",K.style.alignItems="center",K.style.justifyContent="space-between",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.overflow="hidden",K.style.maxWidth=100/g.fonts.length-5+"%",K.style.borderColor=q===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentFont(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.style.display="flex",Se.style.minHeight="20px",Se.style.flexGrow="2",Se.style.fontFamily=q,Se.style.overflow="hidden";var Qe=document.createElement("div");Qe.style.whiteSpace="nowrap",Qe.style.overflow="hidden",Qe.style.textOverflow="ellipsis",Qe.innerHTML="The quick brown fox jumps over the lazy dog",Se.appendChild(Qe),K.appendChild(Se),g.fontBoxes.push(K)}),N},c.prototype.setCurrentFont=function(g,N){var q=this;this.currentFont=g,this.fontBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(je),We=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.color="transparent",K.padding=5,K.DEFAULT_TEXT="your text here",K.text=K.DEFAULT_TEXT,K.isMoved=!1,K.color=q.defaultColor,K.fontFamily=q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setColor=K.setColor.bind(K),K.setFont=K.setFont.bind(K),K.renderText=K.renderText.bind(K),K.sizeText=K.sizeText.bind(K),K.textEditDivClicked=K.textEditDivClicked.bind(K),K.showTextEditor=K.showTextEditor.bind(K),K.setSize=K.setSize.bind(K),K.positionTextEditor=K.positionTextEditor.bind(K),K.colorPanel=new Ge("Color",q.defaultColorSet,q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K}return he(c,z),c.prototype.ownsTarget=function(g){if(z.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(q){q===g&&(N=!0)}),N},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.renderText=function(){var g=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(N){g.textElement.appendChild(se.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var g=this.textElement.getBBox(),N=1;if(g.width>0&&g.height>0){var q=(1*this.width-this.width*this.padding*2/100)/g.width,K=(1*this.height-this.height*this.padding*2/100)/g.height;N=Math.min(q,K)}return N},c.prototype.getTextPosition=function(g){var N=this.textElement.getBBox(),q=0,K=0;return N.width>0&&N.height>0&&(q=(this.width-N.width*g)/2,K=this.height/2-N.height*g/2),{x:q,y:K}},c.prototype.sizeText=function(){var g=this.textElement.getBBox(),N=this.getTextScale(),q=this.getTextPosition(N);q.y-=g.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},c.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(g){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,g),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var g=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&N>.9;)N-=.1,g.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var q=N.clipboardData.getData("text"),K=window.getSelection();if(!K.rangeCount)return!1;K.deleteFromDocument(),K.getRangeAt(0).insertNode(document.createTextNode(q)),N.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){g.textEditDivClicked(g.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},c.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var g=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),K={x:q.width*g,y:q.height*g};N.x-=K.x/2,N.y-=K.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*g,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},c.prototype.dblClick=function(g,N){z.prototype.dblClick.call(this,g,N),this.showTextEditor()},c.prototype.setColor=function(g){this.textElement&&se.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},c.prototype.setFont=function(g){this.textElement&&se.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},c.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},c.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var N=g;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.icon='',c}(Ie),xe=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.color="transparent",K.lineWidth=3,K.drawing=!1,K.pixelRatio=1,K.color=q.defaultColor,K.lineWidth=q.defaultStrokeWidth,K.pixelRatio=q.freehandPixelRatio,K.setColor=K.setColor.bind(K),K.addCanvas=K.addCanvas.bind(K),K.finishCreation=K.finishCreation.bind(K),K.setLineWidth=K.setLineWidth.bind(K),K.colorPanel=new Ge("Color",q.defaultColorSet,q.defaultColor),K.colorPanel.onColorChanged=K.setColor,K.lineWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.lineWidthPanel.onWidthChanged=K.setLineWidth,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var g=se.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,N){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(g.x,g.y),this.drawing=!0):z.prototype.pointerDown.call(this,g,N)},c.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,g)},c.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)},c.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var g=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=N[0],K=N[1],Se=N[2],Qe=N[3],ot=!1,lt=0;lt0&&(ot=!0,ltQe&&(Qe=lt),$e>Se&&(Se=$e));if(ot){this.left=q/this.pixelRatio,this.top=K/this.pixelRatio,this.width=(Se-q)/this.pixelRatio,this.height=(Qe-K)/this.pixelRatio;var gt=document.createElement("canvas");gt.width=Se-q,gt.height=Qe-K,gt.getContext("2d").putImageData(this.canvasContext.getImageData(q,K,Se-q,Qe-K),0,0),this.drawingImgUrl=gt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(g){this.color=g,this.colorChanged(g)},c.prototype.setLineWidth=function(g){this.lineWidth=g},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){this.createVisual(),z.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.icon='',c}(Ie),ye=function(z){function c(g,N,q){var K=z.call(this,g,q||'')||this;return K.typeBoxes=[],K.currentType=N,K.setCurrentType=K.setCurrentType.bind(K),K}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var q=function(Qe){var ot="both";switch(Qe){case 0:ot="both";break;case 1:ot="start";break;case 2:ot="end";break;case 3:ot="none"}var lt=document.createElement("div");if(lt.style.display="flex",lt.style.flexGrow="2",lt.style.alignItems="center",lt.style.justifyContent="space-between",lt.style.padding="5px",lt.style.borderWidth="2px",lt.style.borderStyle="solid",lt.style.borderColor=ot===K.currentType?K.uiStyleSettings.toolboxAccentColor:"transparent",lt.addEventListener("click",function(){g.setCurrentType(ot,lt)}),N.appendChild(lt),ot==="both"||ot==="start"){var $e=document.createElement("div");$e.style.display="flex",$e.style.alignItems="center",$e.style.minHeight="20px",$e.innerHTML=``,$e.style.marginLeft="5px",lt.appendChild($e)}var gt=document.createElement("div");gt.style.display="flex",gt.style.alignItems="center",gt.style.minHeight="20px",gt.style.flexGrow="2";var yt=document.createElement("hr");if(yt.style.minWidth="20px",yt.style.border="0px",yt.style.borderTop="3px solid "+(K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxColor:"#eeeeee"),yt.style.flexGrow="2",gt.appendChild(yt),lt.appendChild(gt),ot==="both"||ot==="end"){var Pt=document.createElement("div");Pt.style.display="flex",Pt.style.alignItems="center",Pt.style.minHeight="20px",Pt.innerHTML=``,Pt.style.marginRight="5px",lt.appendChild(Pt)}K.typeBoxes.push(lt)},K=this,Se=0;Se<4;Se++)q(Se);return N},c.prototype.setCurrentType=function(g,N){var q=this;this.currentType=g,this.typeBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(je),Ce=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.arrowType="end",K.arrowBaseHeight=10,K.arrowBaseWidth=10,K.getArrowPoints=K.getArrowPoints.bind(K),K.setArrowType=K.setArrowType.bind(K),K.arrowTypePanel=new ye("Arrow type","end"),K.arrowTypePanel.onArrowTypeChanged=K.setArrowType,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},c.prototype.getArrowPoints=function(g,N){var q=this.arrowBaseWidth+2*this.strokeWidth,K=this.arrowBaseHeight+2*this.strokeWidth;return g-q/2+","+(N+K/2)+" "+g+","+(N-K/2)+" "+(g+q/2)+","+(N+K/2)},c.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},c.prototype.setArrowType=function(g){this.arrowType=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.arrowType=N.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='',c}(it),le=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.fillColor=q.defaultFillColor,K.strokeWidth=0,K.fillPanel=new Ge("Color",q.defaultColorSet,q.defaultFillColor),K.fillPanel.onColorChanged=K.setFillColor,K}return he(c,z),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="CoverMarker",c.title="Cover marker",c.icon='',c}(Be),de=function(z){function c(g,N,q,K){var Se=z.call(this,g,K||'')||this;return Se.opacities=[],Se.opacityBoxes=[],Se.opacities=N,Se.currentOpacity=q,Se.setCurrentOpacity=Se.setCurrentOpacity.bind(Se),Se}return he(c,z),c.prototype.getUi=function(){var g=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(q){var K=document.createElement("div");K.style.display="flex",K.style.alignItems="center",K.style.justifyContent="center",K.style.padding="5px",K.style.borderWidth="2px",K.style.borderStyle="solid",K.style.borderColor=q===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",K.addEventListener("click",function(){g.setCurrentOpacity(q,K)}),N.appendChild(K);var Se=document.createElement("div");Se.innerText=100*q+"%",K.appendChild(Se),g.opacityBoxes.push(K)}),N},c.prototype.setCurrentOpacity=function(g,N){var q=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(K){K.style.borderColor=K===N?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(je),me=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.setOpacity=K.setOpacity.bind(K),K.fillColor=q.defaultHighlightColor,K.strokeWidth=0,K.opacity=q.defaultHighlightOpacity,K.fillPanel=new Ge("Color",q.defaultColorSet,K.fillColor),K.fillPanel.onColorChanged=K.setFillColor,K.opacityPanel=new de("Opacity",q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return he(c,z),c.prototype.setOpacity=function(g){this.opacity=g,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="HighlightMarker",c.title="Highlight marker",c.icon='',c}(le),Ee='',we=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.bgColor="transparent",K.tipPosition={x:0,y:0},K.tipBase1Position={x:0,y:0},K.tipBase2Position={x:0,y:0},K.tipMoving=!1,K.color=q.defaultStrokeColor,K.bgColor=q.defaultFillColor,K.fontFamily=q.defaultFontFamily,K.defaultSize={x:100,y:30},K.setBgColor=K.setBgColor.bind(K),K.getTipPoints=K.getTipPoints.bind(K),K.positionTip=K.positionTip.bind(K),K.setTipPoints=K.setTipPoints.bind(K),K.colorPanel=new Ge("Text color",q.defaultColorSet,K.color,''),K.colorPanel.onColorChanged=K.setColor,K.bgColorPanel=new Ge("Fill color",q.defaultColorSet,K.bgColor,Ee),K.bgColorPanel.onColorChanged=K.setBgColor,K.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),K.fontFamilyPanel.onFontChanged=K.setFont,K.tipGrip=new qe,K.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),K.controlBox.appendChild(K.tipGrip.visual),K}return he(c,z),c.prototype.ownsTarget=function(g){return z.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},c.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(g,N){this.state==="new"&&z.prototype.pointerDown.call(this,g,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,g,N)},c.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,g);else{var N=this.state==="creating";z.prototype.pointerUp.call(this,g),this.setTipPoints(N),this.positionTip()}},c.prototype.manipulate=function(g){if(this.tipMoving){var N=this.unrotatePoint(g);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,g)},c.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",g]]),se.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},c.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},c.prototype.setTipPoints=function(g){g===void 0&&(g=!1);var N=Math.min(this.height/2,15),q=this.height/5;g&&(this.tipPosition={x:N+q/2,y:this.height+20});var K=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?K',c}(We),Ue=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.fillColor="transparent",K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.opacity=1,K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.fillColor=q.defaultFillColor,K.setStrokeColor=K.setStrokeColor.bind(K),K.setFillColor=K.setFillColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.setOpacity=K.setOpacity.bind(K),K.createVisual=K.createVisual.bind(K),K.strokePanel=new Ge("Line color",ie(q.defaultColorSet,["transparent"]),q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.fillPanel=new Ge("Fill color",ie(q.defaultColorSet,["transparent"]),K.fillColor,Ee),K.fillPanel.onColorChanged=K.setFillColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K.opacityPanel=new de("Opacity",q.defaultOpacitySteps,K.opacity),K.opacityPanel.onOpacityChanged=K.setOpacity,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual)},c.prototype.createVisual=function(){this.visual=se.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)},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.manipulate=function(g){z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){z.prototype.resize.call(this,g),this.setSize()},c.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},c.prototype.pointerUp=function(g){z.prototype.pointerUp.call(this,g),this.setSize()},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},c.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(g),this.stateChanged()},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(g){this.opacity=g,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var N=g;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,N){z.prototype.scale.call(this,g,N),this.setSize()},c.typeName="EllipseMarker",c.title="Ellipse marker",c.icon='',c}(Ie),Ze=function(z){function c(g,N,q){return z.call(this,g,N,q)||this}return he(c,z),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.tip1&&g!==this.tip2)},c.prototype.createTips=function(){this.tip1=se.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(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.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(se.createTransform()),this.visual.appendChild(this.tip2)},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.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()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(g+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.icon='',c}(it),at=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokePanel.colors=q.defaultColorSet,K.fillColor="transparent",K}return he(c,z),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=z.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.icon='',c}(Ue),vt=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(c){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(c)||(this.undoStack.push(c),JSON.stringify(this.lastRedoStep)!==JSON.stringify(c)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var c=this.undoStack.pop();return c!==void 0&&this.redoStack.push(c),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),mt=function(z){function c(g,N,q){var K=z.call(this,g,N,q)||this;return K.strokeColor="transparent",K.strokeWidth=0,K.strokeDasharray="",K.curveX=0,K.curveY=0,K.manipulationStartCurveX=0,K.manipulationStartCurveY=0,K.setStrokeColor=K.setStrokeColor.bind(K),K.setStrokeWidth=K.setStrokeWidth.bind(K),K.setStrokeDasharray=K.setStrokeDasharray.bind(K),K.positionGrips=K.positionGrips.bind(K),K.addControlGrips=K.addControlGrips.bind(K),K.adjustVisual=K.adjustVisual.bind(K),K.setupControlBox=K.setupControlBox.bind(K),K.resize=K.resize.bind(K),K.strokeColor=q.defaultColor,K.strokeWidth=q.defaultStrokeWidth,K.strokeDasharray=q.defaultStrokeDasharray,K.strokePanel=new Ge("Line color",q.defaultColorSet,q.defaultColor),K.strokePanel.onColorChanged=K.setStrokeColor,K.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),K.strokeWidthPanel.onWidthChanged=K.setStrokeWidth,K.strokeStylePanel=new Ke("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),K.strokeStylePanel.onStyleChanged=K.setStrokeDasharray,K}return he(c,z),c.prototype.ownsTarget=function(g){return!(!z.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},c.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.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)},c.prototype.pointerDown=function(g,N){z.prototype.pointerDown.call(this,g,N),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(N)&&(this.activeGrip=this.curveGrip,this._state="resize")},c.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.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)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},c.prototype.manipulate=function(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),z.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),z.prototype.resize.call(this,g),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},c.prototype.scale=function(g,N){this.curveX=this.curveX*g,this.curveY=this.curveY*N,z.prototype.scale.call(this,g,N)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){z.prototype.restoreState.call(this,g);var N=g;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.icon='',c}(tt),Ct=function(){function z(c,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=g}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Tt=function(z){function c(g,N,q){var K=z.call(this,g,!1)||this;return K.dataUrl=N,K.state=q,K}return he(c,z),c}(Ct),ut=function(z){function c(g,N,q){q===void 0&&(q=!1);var K=z.call(this,g,q)||this;return K.marker=N,K}return he(c,z),c}(Ct),Rt=function(){function z(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return z.prototype.addEventListener=function(c,g){this[c].push(g)},z.prototype.removeEventListener=function(c,g){var N=this[c].indexOf(g);N>-1&&this[c].splice(N,1)},z}(),kt=function(){function z(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Re,this._isOpen=!1,this.undoRedoManager=new vt,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new fe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=c,this.targetRoot=document.body,this.width=c.clientWidth,this.height=c.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ve,xe,Ce,We,at,Ue,me,we,Ze,le,it,mt]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ve,xe,Ce,We,Ue,me,we]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ve,xe,Ce,We,me]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var g=this;this._availableMarkerTypes.splice(0),c.forEach(function(N){if(typeof N=="string"){var q=g.ALL_MARKER_TYPES.find(function(K){return K.typeName===N});q!==void 0&&g._availableMarkerTypes.push(q)}else g._availableMarkerTypes.push(N)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(c){this._zoomLevel=c,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),J.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var c=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(g){return g(new Ct(c))})},z.prototype.render=function(){return ae(this,void 0,void 0,function(){var c;return ue(this,function(g){switch(g.label){case 0:return this.setCurrentMarker(),(c=new ee).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.markersOnly=this.renderMarkersOnly,c.width=this.renderWidth,c.height=this.renderHeight,[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return g.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},z.prototype.close=function(c){var g=this;if(c===void 0&&(c=!1),this.isOpen){var N=!1;c||this.eventListeners.beforeclose.forEach(function(q){var K=new Ct(g,!0);q(K),K.defaultPrevented&&(N=!0)}),N||(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 Ct(g))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var c,g=[],N=0;Nthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,N=g',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},z.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Oe(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},z.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},z.prototype.toolbarButtonClicked=function(c,g){if(c==="marker"&&g!==void 0)this.createNewMarker(g);else if(c==="action")switch(g){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},z.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var K=new ut(c,c._currentMarker,!0);q(K),K.defaultPrevented&&(g=!0)}),!g){var N=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 ut(c,N))})}}},z.prototype.clear=function(){var c=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Se){var Qe=new ut(c,void 0,!0);Se(Qe),Qe.defaultPrevented&&(g=!0)}),!g)){this.setCurrentMarker();for(var N=function(Se){var Qe=q.markers[Se];q.setCurrentMarker(q.markers[Se]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(ot){return ot(new ut(c,Qe))})},q=this,K=this.markers.length-1;K>=0;K--)N(K);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var c;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=(c=this._currentMarker.notes)!==null&&c!==void 0?c:"",this.overlayContainer.appendChild(this.notesArea))},z.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===g.width&&N.height===g.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),q1&&this.panTo({x:c.clientX,y:c.clientY}))},z.prototype.onPointerUp=function(c){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(c.clientX,c.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(c,g){var N=this.markerImage.getBoundingClientRect();return{x:(c-N.left)/this.zoomLevel,y:(g-N.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},z.prototype.addLicenseKey=function(c){J.addKey(c)},z.prototype.addEventListener=function(c,g){this.eventListeners.addEventListener(c,g)},z.prototype.removeEventListener=function(c,g){this.eventListeners.removeEventListener(c,g)},z.prototype.renderState=function(c){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(c),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var c=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(g){return g(new Ct(c))}))},z.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new Ct(c))}))},z.instanceCounter=0,z}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var zt=function(z,c){return(zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,N){g.__proto__=N}||function(g,N){for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(g[q]=N[q])})(z,c)};function Nt(z,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function g(){this.constructor=z}zt(z,c),z.prototype=c===null?Object.create(c):(g.prototype=c.prototype,new g)}function Et(z,c,g,N){return new(g||(g=Promise))(function(q,K){function Se(lt){try{ot(N.next(lt))}catch($e){K($e)}}function Qe(lt){try{ot(N.throw(lt))}catch($e){K($e)}}function ot(lt){var $e;lt.done?q(lt.value):($e=lt.value,$e instanceof g?$e:new g(function(gt){gt($e)})).then(Se,Qe)}ot((N=N.apply(z,c||[])).next())})}function _t(z,c){var g,N,q,K,Se={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return K={next:Qe(0),throw:Qe(1),return:Qe(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function Qe(ot){return function(lt){return function($e){if(g)throw new TypeError("Generator is already executing.");for(;Se;)try{if(g=1,N&&(q=2&$e[0]?N.return:$e[0]?N.throw||((q=N.return)&&q.call(N),0):N.next)&&!(q=q.call(N,$e[1])).done)return q;switch(N=0,q&&($e=[2&$e[0],q.value]),$e[0]){case 0:case 1:q=$e;break;case 4:return Se.label++,{value:$e[1],done:!1};case 5:Se.label++,N=$e[1],$e=[0];continue;case 7:$e=Se.ops.pop(),Se.trys.pop();continue;default:if(!(q=Se.trys,(q=q.length>0&&q[q.length-1])||$e[0]!==6&&$e[0]!==2)){Se=0;continue}if($e[0]===3&&(!q||$e[1]>q[0]&&$e[1]0&&g>0){var N=new or(c,g),q=N.ratio>=1?20:N.getHorizontalLength(20),K=N.ratio<1?20:N.getVerticalLength(20),Se=document.createElementNS("http://www.w3.org/2000/svg","svg");Se.setAttribute("xmlns","http://www.w3.org/2000/svg"),Se.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Se);var Qe=dt.createDefs();Se.appendChild(Qe);var ot=dt.createElement("clipPath",[["id","text-bg-clip"]]);Qe.appendChild(ot);var lt=dt.createPath(dt.getHollowRectanglePath((24-q)/2,(24-K)/2,q,K,(24-q)/2+2,(24-K)/2+2,q-4,K-4));Se.appendChild(lt);var $e=dt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);$e.appendChild(dt.createTSpan(c+":"+g)),Se.appendChild($e);var gt=$e.getBBox();dt.setAttributes($e,[["x",((24-gt.width)/2).toString()],["y",((24-gt.height)/2-gt.y).toString()]]);var yt=dt.createPath(dt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(gt.width))/2,(24-Math.ceil(gt.height))/2,Math.ceil(gt.width),Math.ceil(gt.height)));return ot.appendChild(yt),dt.setAttributes(lt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Se),Se.outerHTML}return''},z}(),ur=function(z){function c(g,N,q){var K=z.call(this,g,N)||this;return K.isDropdownOpen=!1,K.onClick=K.dropdownButtonClicked,K.dropdownButtons=q,K}return Nt(c,z),c.prototype.setupDropdown=function(){var g=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(N){N.className=g.className,N.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(N.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},c.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},c.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},c.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},c.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},c.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},c}(Ot),It=function(){function z(c,g){this.GRIP_SIZE=10,this.color=c,this.fillColor=g,this.visual=dt.createGroup(),this.visual.appendChild(dt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(dt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},z.prototype.setCenter=function(c,g){this.visual.childNodes.forEach(function(N){return dt.setAttributes(N,[["cx",c.toString()],["cy",g.toString()]])})},z}(),gr=function(){function z(c,g,N,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=g,this.margin=N,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(c){this._aspectRatio=c,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&dt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var c=this;this.cropShadeElement=dt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=dt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var g=0;gthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),dt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var N=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(K,Se){var Qe=g.y+N*(Se+1);dt.setAttributes(K,[["x1",""+g.x],["y1",""+Qe],["x2",""+(g.x+g.width)],["y2",""+Qe]])});var q=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(K,Se){var Qe=g.x+q*(Se+1);dt.setAttributes(K,[["x1",""+Qe],["y1",""+g.y],["x2",""+Qe],["y2",""+(g.y+g.height)]])}),dt.setAttributes(this.cropShadeElement,[["d",dt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},z.prototype.clientToLocalCoordinates=function(c,g){var N=this.container.getBoundingClientRect();return{x:c-N.left+this.margin,y:g-N.top+this.margin}},z.prototype.onPointerDown=function(c){this.container.setPointerCapture(c.pointerId),this.previousPoint=this.clientToLocalCoordinates(c.clientX,c.clientY),this.cropRectElement===c.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(c.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(c.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(c.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(c.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(g)}c.preventDefault()},z.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},z.prototype.move=function(c){var g=c.x-this.previousPoint.x,N=c.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,N=-N/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},z.prototype.resize=function(c){var g=Object.assign({},this.cropRect),N=c.x-this.previousPoint.x,q=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+Nthis.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-g.width),g.width+=N}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(N),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=q,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=q}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=c,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var c=this.cropRect.x+this.cropRect.width/2,g=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);N/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=c-this.cropRect.width/2,this.cropRect.y=g-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},z.prototype.getRescaledRect=function(c,g,N,q,K,Se){var Qe=N/c,ot=q/g;return{x:(K.x-Se)*Qe+Se,y:(K.y-Se)*ot+Se,width:K.width*Qe,height:K.height*ot}},z.prototype.scaleCanvas=function(c,g){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,g,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=g,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},z}(),sr=function(){function z(c){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=c,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(z.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},z.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},z.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},z.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();dt.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var c=this.scaleShape.transform.baseVal.getItem(0);c.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(c,0)}},z.prototype.getVisual=function(){var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",this.width+"px"),c.setAttribute("height",this.height+"px"),c.setAttribute("viewBox","0 0 "+this.width+" "+this.height),c.style.flexShrink="0",document.body.appendChild(c);for(var g="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var q=N%5==0?this.height/3:this.height/6;g+="h4v"+-q+"h1v"+q}g+="v1H0Z",this.scaleShape=dt.createPath(g);var K=dt.createTransform();this.scaleShape.transform.baseVal.appendItem(K),c.appendChild(this.scaleShape),this.angleLabelElement=dt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=dt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Se=dt.createTSpan("");return Se.innerHTML="°",this.angleLabelElement.appendChild(Se),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},z}(),Yr=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(c,g,N,q,K,Se,Qe){var ot=this;return new Promise(function(lt){var $e=document.createElement("canvas");$e.width=c.width.baseVal.value-2*q,$e.height=c.height.baseVal.value-2*q;var gt=1,yt=1;ot.naturalSize===!0?(gt=g.naturalWidth/(c.width.baseVal.value-2*q)/Se,yt=g.naturalHeight/(c.height.baseVal.value-2*q)/Qe,$e.width=g.naturalWidth/Se,$e.height=g.naturalHeight/Qe):ot.width!==void 0&&ot.height!==void 0&&(gt=ot.width/N.width,yt=ot.height/N.height,$e.width*=gt,$e.height*=yt);var Pt=$e.getContext("2d");Pt.translate($e.width/2,$e.height/2),Pt.rotate(K*Math.PI/180),Pt.scale(Se,Qe),Pt.translate(-$e.width/2,-$e.height/2),Pt.drawImage(g,0,0,$e.width,$e.height);var nr=document.createElement("canvas");nr.width=N.width*gt,nr.height=N.height*yt,nr.getContext("2d").putImageData(Pt.getImageData((N.x-q)*gt,(N.y-q)*yt,N.width*gt,N.height*yt),0,0),lt(nr.toDataURL(ot.imageType,ot.imageQuality))})},z}(),et=function(){function z(c){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=z.instanceCounter++,this.styles=new Zt(this.instanceNo),this.target=c,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(c){this._gridLines=c,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(c){this._rotationAngle=c,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var c;return(c=this._aspectRatio)!==null&&c!==void 0?c:this.aspectRatios[0]},set:function(c){this._aspectRatio=c},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(c){c===void 0&&(c=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),c||this.closeEventListeners.forEach(function(g){return g()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},z.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},z.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},z.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},z.prototype.setupResizeObserver=function(){var c=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=g+2*this.CANVAS_MARGINc+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new ar,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var g=new Er;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var N=[];this.aspectRatios.forEach(function(yt){var Pt=new Ot(xr.getIcon(yt.horizontal,yt.vertical),yt.horizontal===0&&yt.vertical===0?"FREE":yt.horizontal+":"+yt.vertical);Pt.onClick=function(){return c.ratioButtonClicked(yt)},N.push(Pt)}),this.aspectRatioButton=new ur(xr.getIcon(0,0),"Aspect ratio",N),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,g.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Ot('',"Toggle grid");q.isActive=this.isGridVisible,q.onClick=function(){c.isGridVisible=!c.isGridVisible,q.isActive=c.isGridVisible},g.addButton(q);var K=new Ot('',"Zoom to selection");if(K.isActive=this.zoomToCropEnabled,K.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,K.isActive=c.zoomToCropEnabled},g.addButton(K),!Kt.isLicensed){var Se=new ft;this.topToolbar.addElementBlock(Se);var Qe=document.createElement("div");Qe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ot=document.createElement("a");ot.style.color="currentColor",ot.href="https://markerjs.com/products/cropro",ot.target="_blank",ot.innerHTML='',Qe.appendChild(ot),Se.addElement(Qe)}var lt=new Er;lt.minWidth=3*this.toolbarHeight+"px",lt.contentAlign="end",this.topToolbar.addButtonBlock(lt);var $e=new Ot('',"OK");$e.onClick=this.startRenderAndClose,lt.addButton($e),this.styles.settings.toolbarOkButtonStyleColorsClassName&&($e.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var gt=new Ot('',"Close");gt.onClick=this.close,lt.addButton(gt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(gt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new ar,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var g=new Er;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);var N=new Ot('',"Rotate left");N.onClick=this.rotateLeftButtonClicked,g.addButton(N);var q=new Ot('',"Rotate right");q.onClick=this.rotateRightButtonClicked,g.addButton(q);var K=new ft;K.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(K),this.straightener=new sr("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(lt){c.rotateBy(lt),c.straightener.angle=c.rotationAngle},K.addElement(this.straightener.getUI());var Se=new Er;Se.minWidth=2*this.toolbarHeight+"px",Se.contentAlign="end",this.bottomToolbar.addButtonBlock(Se);var Qe=new Ot('',"Flip horizontal");Qe.onClick=this.flipHorizontallyButtonClicked,Se.addButton(Qe);var ot=new Ot('',"Flip vertical");ot.onClick=this.flipVerticallyButtonClicked,Se.addButton(ot)},z.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=xr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new or(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(c){if(c){var g=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(c,g){var N=this.cropImage.getBoundingClientRect();return{x:c-N.left,y:g-N.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var c=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},z.prototype.rotateLeftButtonClicked=function(){var c=this.rotationAngle-90;this.rotationAngle%90!=0&&(c+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(c)},z.prototype.rotateRightButtonClicked=function(){var c=this.rotationAngle+90;this.rotationAngle%90!=0&&(c-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(c)},z.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},z.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},z.prototype.applyRotation=function(){var c=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,0);var N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Et(this,void 0,void 0,function(){var c,g;return _t(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return c=N.sent(),g=this.getState(),this.renderEventListeners.forEach(function(q){return q(c,g)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Et(this,void 0,void 0,function(){var c;return _t(this,function(g){switch(g.label){case 0:return(c=new Yr).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),dt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,c.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return g.sent(),[4,c.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,g.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Jt("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 Jt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Jt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Jt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*c)+`px;
height: `+(this.toolbarHeight-2*c)+`px;
padding: `+c+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Jt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Jt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Jt("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 Jt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Jt("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 Jt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*c)+`px;
padding: `+c+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Jt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),Lt=re("8hTe"),Kr=re.n(Lt),wr=/]*>/g;function $r(z){var c=document.createElement("div");return c.innerHTML=z,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var Gr=nt.a=function(z){var c=z.value,g=c===void 0?"":c,N=z.edit,q=N===void 0?!1:N,K=z.className,Se=z.showTextOnly,Qe=z.showLines,ot=z.replaces,lt=z.zoomImg,$e=z.hasMask,gt=z.style,yt=gt===void 0?{}:gt,Pt=z.stylesPrev,nr=Pt===void 0?{}:Pt,Yt=String(g),Qt=Object(O.useRef)(),vr=Object(O.useRef)(),Wr=Object(O.useState)(""),tr=Object(G.a)(Wr,2),Vt=tr[0],Cr=tr[1],zr=Object(O.useState)("office"),ir=Object(G.a)(zr,2),dn=ir[0],yr=ir[1],Or=function(){var Xt=new et(vr.current);Xt.displayMode="popup",Xt.addRenderEventListener(function(){var Pr=Object(M.a)(_.a.mark(function Wt(Sr){var qt;return _.a.wrap(function(Ar){for(;;)switch(Ar.prev=Ar.next){case 0:return Qt.current.style.display="none",Ar.next=3,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Sr}});case 3:qt=Ar.sent,qt!=null&&qt.id&&ot(vr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(qt==null?void 0:qt.id,"?type=").concat(qt.content_type));case 5:case"end":return Ar.stop()}},Wt)}));return function(Wt){return Pr.apply(this,arguments)}}()),Xt.show()},Rn=function(){var Xt=new kt(vr.current);Xt.settings.displayMode="popup",Xt.addEventListener("render",function(){var Pr=Object(M.a)(_.a.mark(function Wt(Sr){var qt;return _.a.wrap(function(Ar){for(;;)switch(Ar.prev=Ar.next){case 0:if(Qt.current.style.display="none",!vr.current){Ar.next=6;break}return Ar.next=4,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Sr.dataUrl}});case 4:qt=Ar.sent,qt!=null&&qt.id&&ot(vr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(qt==null?void 0:qt.id,"?type=").concat(qt.content_type));case 6:case"end":return Ar.stop()}},Wt)}));return function(Wt){return Pr.apply(this,arguments)}}()),Xt.show(),window.markerArea=Xt},on=Object(O.useMemo)(function(){Qt.current&&(Qt.current.style.zIndex=-1);try{var hr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Xt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Yt=Yt.replace(hr,"("+oe.a.API_SERVER+"/api/attachments/").replace(Xt,'"'+oe.a.API_SERVER+"/api/attachments/").replace(Pr,'"'+oe.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(pn){}var Wt=V(Yt),Sr=C();if(Yt.match(/\[TOC\]/)&&(Wt=Wt.replace("[TOC]
",w()),S()),Wt=Wt.replace(/(__special_katext_id_\d+__)/g,function(pn,Ar){var Nr=Sr[Ar],An=Nr.type,xn=Nr.expression;return Object(pe.renderToString)($r(xn)||"",{displayMode:An==="block",throwOnError:!1,output:"html"})}),Wt=Wt.replace(/▁/g,"\u2581\u2581\u2581"),m(),Se){var qt=document.createElement("div");return qt.innerHTML=Wt,qt.innerText}return setTimeout(function(){return Gn()},500),Wt},[Yt]),qr=Object(O.useRef)();v.WebkitLineClamp=Qe,Qe&&(yt=Object(B.a)(Object(B.a)({},yt),v));function gn(hr){var Xt=hr.target;if(Xt.tagName.toUpperCase()==="IMG"){if(lt){var Pr=Xt.getAttribute("src");Cr(Pr),yr("image")}}else if(Xt.tagName.toUpperCase()==="A"){var Wt=Xt.getAttribute("href");if(Wt.indexOf("office")>-1)hr.preventDefault(),Cr(Wt),yr("office");else if(Wt.indexOf("application/pdf")>-1)hr.preventDefault(),Cr(Wt),yr("pdf");else if(Wt.indexOf("text/html")>-1)hr.preventDefault(),Cr(Wt),yr("html");else if(Wt.startsWith("#")){hr.preventDefault();var Sr=document.getElementById(Wt.replace("#",""));Sr&&Sr.scrollIntoView(!0)}}}var Gn=function(){var Xt,Pr=(Xt=qr.current)===null||Xt===void 0?void 0:Xt.querySelectorAll("video");Pr==null||Pr.forEach(function(Wt){if(Wt.oncontextmenu=function(){return!1},Wt.src.indexOf(".m3u8")>-1&&!Wt.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var Sr=new X.a;Sr.loadSource(Wt.src),Sr.attachMedia(Wt)}}})};Object(O.useEffect)(function(){if(qr.current&&on&&(on.match(wr)&&window.PR.prettyPrint()),qr.current)return qr.current.addEventListener("click",gn),function(){qr.current.removeEventListener("click",gn),m(),S()}},[on,qr.current,gn]);var vn=function(Xt){if(!q)return;Xt.target.nodeName==="IMG"?(Qt.current.style.zIndex=1,Qt.current.style.display="flex",Qt.current.style.width=Xt.target.clientWidth+"px",Qt.current.style.height=Xt.target.clientHeight+"px",Qt.current.style.top=Xt.target.offsetTop+"px",Qt.current.style.left=Xt.target.offsetLeft+"px",vr.current.src=Xt.target.getAttribute("src")):Qt.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:qr,style:Object(B.a)({},yt),className:"".concat(K||""," markdown-body ").concat(Kr.a.mdBody),onMouseOver:vn,dangerouslySetInnerHTML:{__html:on}}),y.a.createElement("div",{ref:Qt,className:Kr.a.button},y.a.createElement($.a,null,y.a.createElement(Z.a,{onClick:function(){return Or()}},"\u88C1\u526A"),y.a.createElement(Z.a,{onClick:function(){return Rn()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:vr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ve.a,{close:!0,data:Vt,type:Vt!=null&&Vt.length?dn:"",style:Object(B.a)({},nr),onClose:function(){return Cr("")}}))}},"9VGf":function(wt,nt,re){"use strict";re.d(nt,"a",function(){return D});var ce=re("q1tI"),$=re.n(ce);function D(Z,B){var M=Object(ce.useRef)();Object(ce.useEffect)(function(){M.current=Z}),Object(ce.useEffect)(function(){function G(){M.current()}if(B!==null){var W=setInterval(G,B);return function(){return clearInterval(W)}}},[B])}},Bd2K:function(wt,nt,re){(function(ce){ce(re("VrN/"),re("osHv"))})(function(ce){ce.defineOption("autoCloseTags",!1,function(_,O,y){if(y!=ce.Init&&y&&_.removeKeyMap("autoCloseTags"),!O)return;var A={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(A["'/'"]=function(R){return M(R)}),(typeof O!="object"||O.whenOpening!==!1)&&(A["'>'"]=function(R){return Z(R)}),_.addKeyMap(A)});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(_){if(_.getOption("disableInput"))return ce.Pass;for(var O=_.listSelections(),y=[],A=_.getOption("autoCloseTags"),R=0;Rk.ch&&(u=u.slice(0,u.length-x.end+k.ch));var p=u.toLowerCase();if(!u||x.type=="string"&&(x.end!=k.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==k.ch-x.start-1||S&&G(S,p)>-1||W(_,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(h)||[],u,k,!0))return ce.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&G(w,u)>-1){y[R]={text:"/>",newPos:ce.Pos(k.line,k.ch+2)};continue}var b=v&&G(v,p)>-1;y[R]={indent:b,text:">"+(b?`
`:"")+""+u+">",newPos:b?ce.Pos(k.line+1,0):ce.Pos(k.line,k.ch+1)}}for(var s=typeof A=="object"&&A.dontIndentOnAutoClose,R=O.length-1;R>=0;R--){var f=y[R];_.replaceRange(f.text,O[R].head,O[R].anchor,"+insert");var l=_.listSelections().slice(0);l[R]={head:f.newPos,anchor:f.newPos},_.setSelections(l),!s&&f.indent&&(_.indentLine(f.newPos.line,null,!0),_.indentLine(f.newPos.line+1,null,!0))}}function B(_,O){for(var y=_.listSelections(),A=[],R=O?"/":"",k=_.getOption("autoCloseTags"),x=typeof k=="object"&&k.dontIndentOnSlash,E=0;E"&&(S+=">"),A[E]=S}if(_.replaceSelections(A),y=_.listSelections(),!x)for(var E=0;E=0&&O[h]==y;h--)++E;A=x.to;for(var h=1;h0){for(var O=0;O1&&arguments[1]!==void 0?arguments[1]:"",O=[],y=0;yxe.length)&&(ye=xe.length);for(var Ce=0,le=new Array(ye);Ce=xe.length?{done:!0}:{done:!1,value:xe[le++]}}}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 Ce=xe[Symbol.iterator](),Ce.next.bind(Ce)}function M(xe,ye){return ye={exports:{}},xe(ye,ye.exports),ye.exports}var G=M(function(xe){function ye(){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 Ce(le){xe.exports.defaults=le}xe.exports={defaults:ye(),getDefaults:ye,changeDefaults:Ce}}),W=G.defaults,_=G.getDefaults,O=G.changeDefaults,y=/[&<>"']/,A=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,x={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(ye){return x[ye]};function h(xe,ye){if(ye){if(y.test(xe))return xe.replace(A,E)}else if(R.test(xe))return xe.replace(k,E);return xe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(xe){return xe.replace(o,function(ye,Ce){return Ce=Ce.toLowerCase(),Ce==="colon"?":":Ce.charAt(0)==="#"?Ce.charAt(1)==="x"?String.fromCharCode(parseInt(Ce.substring(2),16)):String.fromCharCode(+Ce.substring(1)):""})}var d=/(^|[^\[])\^/g;function S(xe,ye){xe=xe.source||xe,ye=ye||"";var Ce={replace:function(de,me){return me=me.source||me,me=me.replace(d,"$1"),xe=xe.replace(de,me),Ce},getRegex:function(){return new RegExp(xe,ye)}};return Ce}var v=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(xe,ye,Ce){if(xe){var le;try{le=decodeURIComponent(u(Ce)).replace(v,"").toLowerCase()}catch(de){return null}if(le.indexOf("javascript:")===0||le.indexOf("vbscript:")===0||le.indexOf("data:")===0)return null}ye&&!p.test(Ce)&&(Ce=a(ye,Ce));try{Ce=encodeURI(Ce).replace(/%25/g,"%")}catch(de){return null}return Ce}var b={},s=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,ye){b[" "+xe]||(s.test(xe)?b[" "+xe]=xe+"/":b[" "+xe]=U(xe,"/",!0)),xe=b[" "+xe];var Ce=xe.indexOf(":")===-1;return ye.substring(0,2)==="//"?Ce?ye:xe.replace(f,"$1")+ye:ye.charAt(0)==="/"?Ce?ye:xe.replace(l,"$1")+ye:xe+ye}var C={exec:function(){}};function m(xe){for(var ye=1,Ce,le;ye=0&&we[Ze]==="\\";)Ue=!Ue;return Ue?"|":" |"}),le=Ce.split(/ \|/),de=0;if(le.length>ye)le.splice(ye);else for(;le.length=le.length?de.slice(le.length):de}).join(`
`)}var ke=function(){function xe(Ce){this.options=Ce||P}var ye=xe.prototype;return ye.space=function(le){var de=this.rules.block.newline.exec(le);if(de)return de[0].length>1?{type:"space",raw:de[0]}:{raw:`
`}},ye.code=function(le,de){var me=this.rules.block.code.exec(le);if(me){var Ee=de[de.length-1];if(Ee&&Ee.type==="paragraph")return{raw:me[0],text:me[0].trimRight()};var we=me[0].replace(/^ {4}/gm,"");return{type:"code",raw:me[0],codeBlockStyle:"indented",text:this.options.pedantic?we:I(we,`
`)}}},ye.fences=function(le){var de=this.rules.block.fences.exec(le);if(de){var me=de[0],Ee=Le(me,de[3]||"");return{type:"code",raw:me,lang:de[2]?de[2].trim():de[2],text:Ee}}},ye.heading=function(le){var de=this.rules.block.heading.exec(le);if(de)return{type:"heading",raw:de[0],depth:de[1].length,text:de[2]}},ye.nptable=function(le){var de=this.rules.block.nptable.exec(le);if(de){var me={type:"table",header:X(de[1].replace(/^ *| *\| *$/g,"")),align:de[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:de[3]?de[3].replace(/\n$/,"").split(`
`):[],raw:de[0]};if(me.header.length===me.align.length){var Ee=me.align.length,we;for(we=0;we ?/gm,"");return{type:"blockquote",raw:de[0],text:me}}},ye.list=function(le){var de=this.rules.block.list.exec(le);if(de){for(var me=de[0],Ee=de[2],we=Ee.length>1,Ue=Ee[Ee.length-1]===")",Ze={type:"list",raw:me,ordered:we,start:we?+Ee.slice(0,-1):"",loose:!1,items:[]},at=de[0].match(this.rules.block.item),vt=!1,mt,Ct,Tt,ut,Rt,kt,zt,Nt=at.length,Et=0;Et1||this.options.smartLists&&Tt!==Ee)&&(ut=at.slice(Et+1).join(`
`),Ze.raw=Ze.raw.substring(0,Ze.raw.length-ut.length),Et=Nt-1)),Rt=vt||/\n\n(?!\s*$)/.test(mt),Et!==Nt-1&&(vt=mt.charAt(mt.length-1)===`
`,Rt||(Rt=vt)),Rt&&(Ze.loose=!0),kt=/^\[[ xX]\] /.test(mt),zt=void 0,kt&&(zt=mt[1]!==" ",mt=mt.replace(/^\[[ xX]\] +/,"")),Ze.items.push({type:"list_item",raw:me,task:kt,checked:zt,loose:Rt,text:mt});return Ze}},ye.html=function(le){var de=this.rules.block.html.exec(le);if(de)return{type:this.options.sanitize?"paragraph":"html",raw:de[0],pre:!this.options.sanitizer&&(de[1]==="pre"||de[1]==="script"||de[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):oe(de[0]):de[0]}},ye.def=function(le){var de=this.rules.block.def.exec(le);if(de){de[3]&&(de[3]=de[3].substring(1,de[3].length-1));var me=de[1].toLowerCase().replace(/\s+/g," ");return{tag:me,raw:de[0],href:de[2],title:de[3]}}},ye.table=function(le){var de=this.rules.block.table.exec(le);if(de){var me={type:"table",header:X(de[1].replace(/^ *| *\| *$/g,"")),align:de[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:de[3]?de[3].replace(/\n$/,"").split(`
`):[]};if(me.header.length===me.align.length){me.raw=de[0];var Ee=me.align.length,we;for(we=0;we/i.test(Ee[0])&&(de=!1),!me&&/^<(pre|code|kbd|script)(\s|>)/i.test(Ee[0])?me=!0:me&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Ee[0])&&(me=!1),{type:this.options.sanitize?"text":"html",raw:Ee[0],inLink:de,inRawBlock:me,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):oe(Ee[0]):Ee[0]}},ye.link=function(le){var de=this.rules.inline.link.exec(le);if(de){var me=pe(de[2],"()");if(me>-1){var Ee=de[0].indexOf("!")===0?5:4,we=Ee+de[1].length+me;de[2]=de[2].substring(0,me),de[0]=de[0].substring(0,we).trim(),de[3]=""}var Ue=de[2],Ze="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ue);at?(Ue=at[1],Ze=at[3]):Ze=""}else Ze=de[3]?de[3].slice(1,-1):"";Ue=Ue.trim().replace(/^<([\s\S]*)>$/,"$1");var vt=ve(de,{href:Ue&&Ue.replace(this.rules.inline._escapes,"$1"),title:Ze&&Ze.replace(this.rules.inline._escapes,"$1")},de[0]);return vt}},ye.reflink=function(le,de){var me;if((me=this.rules.inline.reflink.exec(le))||(me=this.rules.inline.nolink.exec(le))){var Ee=(me[2]||me[1]).replace(/\s+/g," ");if(Ee=de[Ee.toLowerCase()],!Ee||!Ee.href){var we=me[0].charAt(0);return{type:"text",raw:we,text:we}}var Ue=ve(me,Ee,me[0]);return Ue}},ye.strong=function(le,de,me){me===void 0&&(me="");var Ee=this.rules.inline.strong.start.exec(le);if(Ee&&(!Ee[1]||Ee[1]&&(me===""||this.rules.inline.punctuation.exec(me)))){de=de.slice(-1*le.length);var we=Ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var Ue;(Ee=we.exec(de))!=null;)if(Ue=this.rules.inline.strong.middle.exec(de.slice(0,Ee.index+3)),Ue)return{type:"strong",raw:le.slice(0,Ue[0].length),text:le.slice(2,Ue[0].length-2)}}},ye.em=function(le,de,me){me===void 0&&(me="");var Ee=this.rules.inline.em.start.exec(le);if(Ee&&(!Ee[1]||Ee[1]&&(me===""||this.rules.inline.punctuation.exec(me)))){de=de.slice(-1*le.length);var we=Ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var Ue;(Ee=we.exec(de))!=null;)if(Ue=this.rules.inline.em.middle.exec(de.slice(0,Ee.index+2)),Ue)return{type:"em",raw:le.slice(0,Ue[0].length),text:le.slice(1,Ue[0].length-1)}}},ye.codespan=function(le){var de=this.rules.inline.code.exec(le);if(de){var me=de[2].replace(/\n/g," "),Ee=/[^ ]/.test(me),we=me.startsWith(" ")&&me.endsWith(" ");return Ee&&we&&(me=me.substring(1,me.length-1)),me=oe(me,!0),{type:"codespan",raw:de[0],text:me}}},ye.br=function(le){var de=this.rules.inline.br.exec(le);if(de)return{type:"br",raw:de[0]}},ye.del=function(le){var de=this.rules.inline.del.exec(le);if(de)return{type:"del",raw:de[0],text:de[1]}},ye.autolink=function(le,de){var me=this.rules.inline.autolink.exec(le);if(me){var Ee,we;return me[2]==="@"?(Ee=oe(this.options.mangle?de(me[1]):me[1]),we="mailto:"+Ee):(Ee=oe(me[1]),we=Ee),{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.url=function(le,de){var me;if(me=this.rules.inline.url.exec(le)){var Ee,we;if(me[2]==="@")Ee=oe(this.options.mangle?de(me[0]):me[0]),we="mailto:"+Ee;else{var Ue;do Ue=me[0],me[0]=this.rules.inline._backpedal.exec(me[0])[0];while(Ue!==me[0]);Ee=oe(me[0]),me[1]==="www."?we="http://"+Ee:we=Ee}return{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.inlineText=function(le,de,me){var Ee=this.rules.inline.text.exec(le);if(Ee){var we;return de?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):oe(Ee[0]):Ee[0]:we=oe(this.options.smartypants?me(Ee[0]):Ee[0]),{type:"text",raw:Ee[0],text:we}}},xe}(),he=V.noopTest,ae=V.edit,ue=V.merge,ie={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:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=ae(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=ae(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=ae(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=//,ie.html=ae(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=ae(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=ae(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=ue({},ie),ie.gfm=ue({},ie.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*|$)"}),ie.gfm.nptable=ae(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=ae(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=ue({},ie.normal,{html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:he,paragraph:ae(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",se.punctuation=ae(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=ae(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=ae(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=ae(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=ae(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=ae(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=ae(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=ae(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=ae(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=ae(se._blockSkip,"g").getRegex(),se.overlapSkip=ae(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=ae(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=ae(se.tag).replace("comment",ie._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=ae(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=ae(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=ae(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=ue({},se),se.pedantic=ue({},se.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",se._label).getRegex(),reflink:ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=ue({},se.normal,{escape:ae(se.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&&(le="x"+le.toString(16)),ye+=""+le+";";return ye}var Oe=function(){function xe(Ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ce||ee,this.options.tokenizer=this.options.tokenizer||new ke,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var le={block:ne.normal,inline:fe.normal};this.options.pedantic?(le.block=ne.pedantic,le.inline=fe.pedantic):this.options.gfm&&(le.block=ne.gfm,this.options.breaks?le.inline=fe.breaks:le.inline=fe.gfm),this.tokenizer.rules=le}xe.lex=function(le,de){var me=new xe(de);return me.lex(le)};var ye=xe.prototype;return ye.lex=function(le){return le=le.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(le,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(le,de,me){de===void 0&&(de=[]),me===void 0&&(me=!0),le=le.replace(/^ +$/gm,"");for(var Ee,we,Ue,Ze;le;){if(Ee=this.tokenizer.space(le)){le=le.substring(Ee.raw.length),Ee.type&&de.push(Ee);continue}if(Ee=this.tokenizer.code(le,de)){le=le.substring(Ee.raw.length),Ee.type?de.push(Ee):(Ze=de[de.length-1],Ze.raw+=`
`+Ee.raw,Ze.text+=`
`+Ee.text);continue}if(Ee=this.tokenizer.fences(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.heading(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.nptable(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.hr(le)){le=le.substring(Ee.raw.length),de.push(Ee);continue}if(Ee=this.tokenizer.blockquote(le)){le=le.substring(Ee.raw.length),Ee.tokens=this.blockTokens(Ee.text,[],me),de.push(Ee);continue}if(Ee=this.tokenizer.list(le)){for(le=le.substring(Ee.raw.length),Ue=Ee.items.length,we=0;we0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec(Ze))!=null;)vt.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&(Ze=Ze.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec(Ze))!=null;)Ze=Ze.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;le;){if(Ue=this.tokenizer.escape(le)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.tag(le,me,Ee)){le=le.substring(Ue.raw.length),me=Ue.inLink,Ee=Ue.inRawBlock,de.push(Ue);continue}if(Ue=this.tokenizer.link(le)){le=le.substring(Ue.raw.length),Ue.type==="link"&&(Ue.tokens=this.inlineTokens(Ue.text,[],!0,Ee)),de.push(Ue);continue}if(Ue=this.tokenizer.reflink(le,this.tokens.links)){le=le.substring(Ue.raw.length),Ue.type==="link"&&(Ue.tokens=this.inlineTokens(Ue.text,[],!0,Ee)),de.push(Ue);continue}if(Ue=this.tokenizer.strong(le,Ze,we)){le=le.substring(Ue.raw.length),Ue.tokens=this.inlineTokens(Ue.text,[],me,Ee),de.push(Ue);continue}if(Ue=this.tokenizer.em(le,Ze,we)){le=le.substring(Ue.raw.length),Ue.tokens=this.inlineTokens(Ue.text,[],me,Ee),de.push(Ue);continue}if(Ue=this.tokenizer.codespan(le)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.br(le)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.del(le)){le=le.substring(Ue.raw.length),Ue.tokens=this.inlineTokens(Ue.text,[],me,Ee),de.push(Ue);continue}if(Ue=this.tokenizer.autolink(le,ge)){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(!me&&(Ue=this.tokenizer.url(le,ge))){le=le.substring(Ue.raw.length),de.push(Ue);continue}if(Ue=this.tokenizer.inlineText(le,Ee,Ae)){le=le.substring(Ue.raw.length),we=Ue.raw.slice(-1),de.push(Ue);continue}if(le){var mt="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(mt);break}else throw new Error(mt)}}return de},$(xe,null,[{key:"rules",get:function(){return{block:ne,inline:fe}}}]),xe}(),Pe=G.defaults,je=V.cleanUrl,Ge=V.escape,He=function(){function xe(Ce){this.options=Ce||Pe}var ye=xe.prototype;return ye.code=function(le,de,me){var Ee=(de||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(le,Ee);we!=null&&we!==le&&(me=!0,le=we)}return Ee?''+(me?le:Ge(le,!0))+`
`:""+(me?le:Ge(le,!0))+`
`},ye.blockquote=function(le){return`
`+le+`
`},ye.html=function(le){return le},ye.heading=function(le,de,me,Ee){return this.options.headerIds?"
`:""+le+"
`},ye.hr=function(){return this.options.xhtml?`
`:`
`},ye.list=function(le,de,me){var Ee=de?"ol":"ul",we=de&&me!==1?' start="'+me+'"':"";return"<"+Ee+we+`>
`+le+""+Ee+`>
`},ye.listitem=function(le){return""+le+`
`},ye.checkbox=function(le){return" "},ye.paragraph=function(le){return""+le+`
`},ye.table=function(le,de){return de&&(de=""+de+""),`
`},ye.tablerow=function(le){return`
`+le+`
`},ye.tablecell=function(le,de){var me=de.header?"th":"td",Ee=de.align?"<"+me+' align="'+de.align+'">':"<"+me+">";return Ee+le+""+me+`>
`},ye.strong=function(le){return""+le+""},ye.em=function(le){return""+le+""},ye.codespan=function(le){return""+le+""},ye.br=function(){return this.options.xhtml?"
":"
"},ye.del=function(le){return""+le+""},ye.link=function(le,de,me){if(le=je(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='"+me+"",Ee},ye.image=function(le,de,me){if(le=je(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='
":">",Ee},ye.text=function(le){return le},xe}(),Fe=function(){function xe(){}var ye=xe.prototype;return ye.strong=function(le){return le},ye.em=function(le){return le},ye.codespan=function(le){return le},ye.del=function(le){return le},ye.html=function(le){return le},ye.text=function(le){return le},ye.link=function(le,de,me){return""+me},ye.image=function(le,de,me){return""+me},ye.br=function(){return""},xe}(),qe=function(){function xe(){this.seen={}}var ye=xe.prototype;return ye.slug=function(le){var de=le.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(de)){var me=de;do this.seen[me]++,de=me+"-"+this.seen[me];while(this.seen.hasOwnProperty(de))}return this.seen[de]=0,de},xe}(),De=G.defaults,Ie=V.unescape,Be=function(){function xe(Ce){this.options=Ce||De,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new qe}xe.parse=function(le,de){var me=new xe(de);return me.parse(le)};var ye=xe.prototype;return ye.parse=function(le,de){de===void 0&&(de=!0);var me="",Ee,we,Ue,Ze,at,vt,mt,Ct,Tt,ut,Rt,kt,zt,Nt,Et,_t,Kt,dt,Zt=le.length;for(Ee=0;Ee0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=dt+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=dt+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:dt}):Nt+=dt),Nt+=this.parse(Et.tokens,zt),Tt+=this.renderer.listitem(Nt,Kt,_t);me+=this.renderer.list(Tt,Rt,kt);continue}case"html":{me+=this.renderer.html(ut.text);continue}case"paragraph":{me+=this.renderer.paragraph(this.parseInline(ut.tokens));continue}case"text":{for(Tt=ut.tokens?this.parseInline(ut.tokens):ut.text;Ee+1An error occurred:
"+Ve(Ue.message+"",!0)+"
";throw Ue}}Me.options=Me.setOptions=function(xe){return ze(Me.defaults,xe),tt(Me.defaults),Me},Me.getDefaults=Re,Me.defaults=it,Me.use=function(xe){var ye=ze({},xe);if(xe.renderer&&function(){var le=Me.defaults.renderer||new He,de=function(we){var Ue=le[we];le[we]=function(){for(var Ze=arguments.length,at=new Array(Ze),vt=0;vt`,triples:"",explode:"[]{}"},D=ce.Pos;ce.defineOption("autoCloseBrackets",!1,function(x,E,h){h&&h!=ce.Init&&(x.removeKeyMap(B),x.state.closeBrackets=null),E&&(M(Z(E,"pairs")),x.state.closeBrackets=E,x.addKeyMap(B))});function Z(x,E){return E=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[E]!=null?x[E]:$[E]}var B={Backspace:_,Enter:O};function M(x){for(var E=0;E=0;u--){var S=o[u].head;x.replaceRange("",D(S.line,S.ch-1),D(S.line,S.ch+1),"+delete")}}function O(x){var E=W(x),h=E&&Z(E,"explode");if(!h||x.getOption("disableInput"))return ce.Pass;for(var o=x.listSelections(),u=0;u0;return{anchor:new D(x.anchor.line,x.anchor.ch+(E?-1:1)),head:new D(x.head.line,x.head.ch+(E?1:-1))}}function A(x,E){var h=W(x);if(!h||x.getOption("disableInput"))return ce.Pass;var o=Z(h,"pairs"),u=o.indexOf(E);if(u==-1)return ce.Pass;for(var d=Z(h,"closeBefore"),S=Z(h,"triples"),v=o.charAt(u+1)==E,p=x.listSelections(),w=u%2==0,b,s=0;s=0&&x.getRange(l,D(l.line,l.ch+3))==E+E+E?a="skipThree":a="skip";else if(v&&l.ch>1&&S.indexOf(E)>=0&&x.getRange(D(l.line,l.ch-2),l)==E+E){if(l.ch>2&&/\bstring/.test(x.getTokenTypeAt(D(l.line,l.ch-2))))return ce.Pass;a="addFour"}else if(v){var m=l.ch==0?" ":x.getRange(D(l.line,l.ch-1),l);if(!ce.isWordChar(C)&&m!=E&&!ce.isWordChar(m))a="both";else return ce.Pass}else if(w&&(C.length===0||/\s/.test(C)||d.indexOf(C)>-1))a="both";else return ce.Pass;if(!b)b=a;else if(b!=a)return ce.Pass}var T=u%2?o.charAt(u-1):E,U=u%2?E:o.charAt(u+1);x.operation(function(){if(b=="skip")x.execCommand("goCharRight");else if(b=="skipThree")for(var j=0;j<3;j++)x.execCommand("goCharRight");else if(b=="surround"){for(var F=x.getSelections(),j=0;j0&&(pe.percent=pe.loaded/pe.total*100),V.onProgress(pe)});var I=new FormData;V.data&&Object.keys(V.data).forEach(function(oe){var pe=V.data[oe];if(Array.isArray(pe)){pe.forEach(function(ve){I.append(oe+"[]",ve)});return}I.append(oe,V.data[oe])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),P.onerror=function(pe){V.onError(pe)},P.onload=function(){return P.status<200||P.status>=300?V.onError(B(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 X=V.headers||{};return X["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(oe){X[oe]!==null&&P.setRequestHeader(oe,X[oe])}),P.send(I),{abort:function(){P.abort()}}}var W=+new Date,_=0;function O(){return"rc-upload-"+W+"-"+ ++_}function y(V,P){return V.indexOf(P,V.length-P.length)!==-1}var A=function(V,P){if(V&&P){var I=Array.isArray(P)?P:P.split(","),X=V.name||"",oe=V.type||"",pe=oe.replace(/\/.*$/,"");return I.some(function(ve){var Le=ve.trim();return Le.charAt(0)==="."?y(X.toLowerCase(),Le.toLowerCase()):/\/\*$/.test(Le)?pe===Le.replace(/\/.*$/,""):oe===Le})}return!0};function R(V,P){var I=V.createReader(),X=[];function oe(){I.readEntries(function(pe){var ve=Array.prototype.slice.apply(pe);X=X.concat(ve);var Le=!ve.length;Le?P(X):oe()})}oe()}var k=function(P,I,X){var oe=function pe(ve,Le){Le=Le||"",ve.isFile?ve.file(function(ke){X(ke)&&(ve.fullPath&&!ke.webkitRelativePath&&(Object.defineProperties(ke,{webkitRelativePath:{writable:!0}}),ke.webkitRelativePath=ve.fullPath.replace(/^\//,""),Object.defineProperties(ke,{webkitRelativePath:{writable:!1}})),I([ke]))}):ve.isDirectory&&R(ve,function(ke){ke.forEach(function(he){pe(he,""+Le+ve.name+"/")})})};P.forEach(function(pe){oe(pe.webkitGetAsEntry())})},x=k,E=Object.assign||function(V){for(var P=1;P=0)continue;if(!Object.prototype.hasOwnProperty.call(V,X))continue;I[X]=V[X]}return I}function S(V,P){if(!(V instanceof P))throw new TypeError("Cannot call a class as a function")}function v(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 p(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 w=function(P){return Object.keys(P).reduce(function(I,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(I[X]=P[X]),I},{})},b=function(V){p(P,V);function P(){var I,X,oe,pe;S(this,P);for(var ve=arguments.length,Le=Array(ve),ke=0;ke1&&arguments[1]!==void 0?arguments[1]:1,Ce=Fe.length,le=0;le1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(I).map(function(oe,pe){if(!B.isValidElement(oe)||!oe.type)return null;var ve=oe.type.isSelectOptGroup,Le=oe.key,ke=oe.props,he=ke.children,ae=Object(G.a)(ke,["children"]);return X||!ve?b(oe):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Le===null?pe:Le,"__"),label:Le},ae),{},{options:s(he)})}).filter(function(oe){return oe})}var f=re("2Qr1"),l=re("qNPg"),a=re("U8pU"),C=re("Kwbf"),m=re("WKfj");function T(I){var X=I.mode,oe=I.options,pe=I.children,ve=I.backfill,Le=I.allowClear,ke=I.placeholder,he=I.getInputElement,ae=I.showSearch,ue=I.onSearch,ie=I.defaultOpen,se=I.autoFocus,J=I.labelInValue,ee=I.value,ne=I.inputValue,fe=I.optionLabelProp,Ae=X==="multiple"||X==="tags",ge=ae!==void 0?ae:Ae||X==="combobox",Oe=oe||s(pe);if(Object(C.a)(X!=="tags"||Oe.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Pe=Oe.some(function(He){return He.options?He.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(C.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)(X!=="combobox"||!fe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)(X==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(C.a)(X==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(C.b)(X!=="combobox"||!he||!Le||!ke,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ue&&!ge&&X!=="combobox"&&X!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!ie||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ee!=null){var je=Object(m.d)(ee);Object(C.a)(!J||je.every(function(He){return Object(a.a)(He)==="object"&&("key"in He||"value"in He)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(C.a)(!Ae||Array.isArray(ee),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var Ge=null;Object(w.a)(pe).some(function(He){if(!B.isValidElement(He)||!He.type)return!1;var Fe=He.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var qe=Object(w.a)(He.props.children).every(function(De){return!B.isValidElement(De)||!He.type||De.type.isSelectOption?!0:(Ge=De.type,!1)});return!qe}return Ge=Fe,!0}),Ge&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ge.displayName||Ge.name||Ge,"`.")),Object(C.a)(ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var U=T,j=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:s,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:U,fillOptionsWithMissingValue:f.a}),F=function(I){Object(D.a)(oe,I);var X=Object(Z.a)(oe);function oe(){var pe;return Object(ce.a)(this,oe),pe=X.apply(this,arguments),pe.selectRef=B.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object($.a)(oe,[{key:"render",value:function(){return B.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),oe}(B.Component);F.Option=d,F.OptGroup=v;var V=F,P=nt.c=V},M8RZ:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return _});var ce=re("fWQN"),$=re("mtLc"),D=re("yKVA"),Z=re("879j"),B=re("q1tI"),M=re.n(B),G=re("i8i4"),W=re.n(G),_=function(O){Object(D.a)(A,O);var y=Object(Z.a)(A);function A(R){var k;Object(ce.a)(this,A),k=y.call(this,R);var x=window.document;return k.node=x.createElement("div"),x.body.appendChild(k.node),k}return Object($.a)(A,[{key:"render",value:function(){var k=this.props.children;return Object(G.createPortal)(k,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(M.a.Component)},NvD2:function(wt,nt,re){"use strict";re.d(nt,"a",function(){return M});var ce=re("Kwbf");function $(G,W){var _=new Set;return G.forEach(function(O){W.has(O)||_.add(O)}),_}function D(G){var W=G||{},_=W.disabled,O=W.disableCheckbox,y=W.checkable;return!!(_||O)||y===!1}function Z(G,W,_,O){for(var y=new Set(G),A=new Set,R=0;R<=_;R+=1){var k=W.get(R)||new Set;k.forEach(function(o){var u=o.key,d=o.node,S=o.children,v=S===void 0?[]:S;y.has(u)&&!O(d)&&v.filter(function(p){return!O(p.node)}).forEach(function(p){y.add(p.key)})})}for(var x=new Set,E=_;E>=0;E-=1){var h=W.get(E)||new Set;h.forEach(function(o){var u=o.parent,d=o.node;if(O(d)||!o.parent||x.has(o.parent.key))return;if(O(o.parent.node)){x.add(u.key);return}var S=!0,v=!1;(u.children||[]).filter(function(p){return!O(p.node)}).forEach(function(p){var w=p.key,b=y.has(w);S&&!b&&(S=!1),!v&&(b||A.has(w))&&(v=!0)}),S&&y.add(u.key),v&&A.add(u.key),x.add(u.key)})}return{checkedKeys:Array.from(y),halfCheckedKeys:Array.from($(A,y))}}function B(G,W,_,O,y){for(var A=new Set(G),R=new Set(W),k=0;k<=O;k+=1){var x=_.get(k)||new Set;x.forEach(function(u){var d=u.key,S=u.node,v=u.children,p=v===void 0?[]:v;!A.has(d)&&!R.has(d)&&!y(S)&&p.filter(function(w){return!y(w.node)}).forEach(function(w){A.delete(w.key)})})}R=new Set;for(var E=new Set,h=O;h>=0;h-=1){var o=_.get(h)||new Set;o.forEach(function(u){var d=u.parent,S=u.node;if(y(S)||!u.parent||E.has(u.parent.key))return;if(y(u.parent.node)){E.add(d.key);return}var v=!0,p=!1;(d.children||[]).filter(function(w){return!y(w.node)}).forEach(function(w){var b=w.key,s=A.has(b);v&&!s&&(v=!1),!p&&(s||R.has(b))&&(p=!0)}),v||A.delete(d.key),p&&R.add(d.key),E.add(d.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from($(R,A))}}function M(G,W,_,O){var y=[],A;O?A=O:A=D;var R=new Set(G.filter(function(h){var o=!!_[h];return o||y.push(h),o})),k=new Map,x=0;Object.keys(_).forEach(function(h){var o=_[h],u=o.level,d=k.get(u);d||(d=new Set,k.set(u,d)),d.add(o),x=Math.max(x,u)}),Object(ce.a)(!y.length,"Tree missing follow keys: ".concat(y.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var E;return W===!0?E=Z(R,k,x,A):E=B(R,W.halfCheckedKeys,k,x,A),E}},OLES:function(wt,nt,re){"use strict";var ce=re("U8pU"),$=re("VTBJ"),D=re("Ff2n"),Z=re("q1tI"),B=re("uciX"),M=re("7ixt"),G=function(R){var k=R.overlay,x=R.prefixCls,E=R.id,h=R.overlayInnerStyle;return Z.createElement("div",{className:"".concat(x,"-inner"),id:E,role:"tooltip",style:h},typeof k=="function"?k():k)},W=G,_=function(R,k){var x=R.overlayClassName,E=R.trigger,h=E===void 0?["hover"]:E,o=R.mouseEnterDelay,u=o===void 0?0:o,d=R.mouseLeaveDelay,S=d===void 0?.1:d,v=R.overlayStyle,p=R.prefixCls,w=p===void 0?"rc-tooltip":p,b=R.children,s=R.onVisibleChange,f=R.afterVisibleChange,l=R.transitionName,a=R.animation,C=R.placement,m=C===void 0?"right":C,T=R.align,U=T===void 0?{}:T,j=R.destroyTooltipOnHide,F=j===void 0?!1:j,V=R.defaultVisible,P=R.getTooltipContainer,I=R.overlayInnerStyle,X=Object(D.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),oe=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(k,function(){return oe.current});var pe=Object($.a)({},X);"visible"in R&&(pe.popupVisible=R.visible);var ve=function(){var ue=R.arrowContent,ie=ue===void 0?null:ue,se=R.overlay,J=R.id;return[Z.createElement("div",{className:"".concat(w,"-arrow"),key:"arrow"},ie),Z.createElement(W,{key:"content",prefixCls:w,id:J,overlay:se,overlayInnerStyle:I})]},Le=!1,ke=!1;if(typeof F=="boolean")Le=F;else if(F&&Object(ce.a)(F)==="object"){var he=F.keepParent;Le=he===!0,ke=he===!1}return Z.createElement(B.a,Object.assign({popupClassName:x,prefixCls:w,popup:ve,action:h,builtinPlacements:M.a,popupPlacement:m,ref:oe,popupAlign:U,getPopupContainer:P,onPopupVisibleChange:s,afterPopupVisibleChange:f,popupTransitionName:l,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Le,autoDestroy:ke,mouseLeaveDelay:S,popupStyle:v,mouseEnterDelay:u},pe),b)},O=Object(Z.forwardRef)(_),y=nt.a=O},OZM5:function(wt,nt,re){"use strict";re.d(nt,"b",function(){return O}),re.d(nt,"a",function(){return y}),re.d(nt,"k",function(){return A}),re.d(nt,"h",function(){return R}),re.d(nt,"i",function(){return k}),re.d(nt,"g",function(){return x}),re.d(nt,"c",function(){return E}),re.d(nt,"d",function(){return h}),re.d(nt,"j",function(){return d}),re.d(nt,"e",function(){return S}),re.d(nt,"f",function(){return v});var ce=re("KQm4"),$=re("U8pU"),D=re("Ff2n"),Z=re("q1tI"),B=re.n(Z),M=re("Kwbf"),G=re("WaYH"),W=.25,_=2;function O(p,w){var b=p.slice(),s=b.indexOf(w);return s>=0&&b.splice(s,1),b}function y(p,w){var b=p.slice();return b.indexOf(w)===-1&&b.push(w),b}function A(p){return p.split("-")}function R(p,w){return"".concat(p,"-").concat(w)}function k(p){return p&&p.type&&p.type.isTreeNode}function x(p,w){var b=[p],s=w[p];function f(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];l.forEach(function(a){var C=a.key,m=a.children;b.push(C),f(m)})}return f(s.children),b}function E(p,w){var b=p.clientY,s=w.selectHandle.getBoundingClientRect(),f=s.top,l=s.bottom,a=s.height,C=Math.max(a*W,_);return b<=f+C?-1:b>=l-C?1:0}function h(p,w){if(!p)return;var b=w.multiple;return b?p.slice():p.length?[p[0]]:p}var o=function(w){return w};function u(p,w){if(!p)return[];var b=w||{},s=b.processProps,f=s===void 0?o:s,l=Array.isArray(p)?p:[p];return l.map(function(a){var C=a.children,m=Object(D.a)(a,["children"]),T=u(C,w);return B.a.createElement(G.a,Object.assign({},f(m)),T)})}function d(p){if(!p)return null;var w;if(Array.isArray(p))w={checkedKeys:p,halfCheckedKeys:void 0};else if(Object($.a)(p)==="object")w={checkedKeys:p.checked||void 0,halfCheckedKeys:p.halfChecked||void 0};else return Object(M.a)(!1,"`checkedKeys` is not an array or an object"),null;return w}function S(p,w){var b=new Set;function s(f){if(b.has(f))return;var l=w[f];if(!l)return;b.add(f);var a=l.parent,C=l.node;if(C.disabled)return;a&&s(a.key)}return(p||[]).forEach(function(f){s(f)}),Object(ce.a)(b)}function v(p){var w={};return Object.keys(p).forEach(function(b){(b.startsWith("data-")||b.startsWith("aria-"))&&(w[b]=p[b])}),w}},Ot1p:function(wt,nt,re){"use strict";var ce=re("2qtc"),$=re("kLXV"),D=re("rAM+"),Z=re("miYZ"),B=re("tsqr"),M=re("9og8"),G=re("tJVT"),W=re("jrin"),_=re("WmNS"),O=re.n(_),y=re("q1tI"),A=re.n(y),R=re("VrN/"),k=re.n(R),x=re("bdgK"),E=re("p77/"),h=re("Bd2K"),o=re("ELLl"),u=re("19Vz"),d=re("lZu9"),S=re("+NIl"),v=re("kSUc"),p=re("9Bee"),w=function(we){var Ue=we.value,Ze=Ue===void 0?"":Ue,at=we.className,vt=we.showTextOnly,mt=we.showLines,Ct=we.style,Tt=Ct===void 0?{}:Ct,ut=Object(y.useMemo)(function(){return""},[Ze]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:ut}}))},b=re("0Owb"),s=re("dejd"),f=re("C+DQ"),l=re("1vsH"),a=re("m3rI"),C=[{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(we){var Ue=we.onActionCallback,Ze=we.title,at=we.icon,vt=we.actionName,mt=we.className,Ct=mt===void 0?"":mt,Tt=we.children;function ut(){Ue(vt)}return A.a.createElement("a",{title:Ze,className:Ct,onClick:ut},A.a.createElement("i",{className:"md-iconfont ".concat(at)}),Tt)}var T=function(we){var Ue=we.watch,Ze=we.showNullButton,at=we.onActionCallback,vt=we.fullScreen,mt=we.insertTemp,Ct=we.hidetoolBar,Tt=we.uuid,ut=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(Tt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Rt=[].concat(C,[{title:"".concat(Ue?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ue?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Rt.map(function(kt,zt){return A.a.createElement("li",{key:zt},kt.actionName?A.a.createElement(m,Object(b.a)({},kt,{onActionCallback:at})):A.a.createElement("span",{className:"v-line"}))}),Ze?A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:at},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,mt&&A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(mt),onActionCallback:at},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(m,{icon:"".concat(vt?"icon-shrink":"icon-enlarge"),title:vt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:at})))},U=re("M8RZ"),j=re("+L6B"),F=re("2/Rp"),V=re("y8nQ"),P=re("Vl3Y"),I=re("5NDa"),X=re("5rEg"),oe={labelCol:{span:4},wrapperCol:{span:20}},pe=function(we){var Ue=we.callback,Ze=we.onCancel;function at(vt){Ue(vt)}return A.a.createElement(P.a,Object(b.a)({},oe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:at}),A.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(X.a,null)),A.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(X.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(F.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))},ve=re("7ahc"),Le=re("HmJG"),ke=re("BjJ7"),he=P.a.useForm,ae={width:280,marginRight:10},ue={labelCol:{span:5},wrapperCol:{span:19}},ie=function(we){var Ue=we.callback,Ze=we.onCancel,at=he(),vt=Object(G.a)(at,1),mt=vt[0];function Ct(Rt){Ue(Rt)}function Tt(Rt,kt){if(Rt.status===-1){B.b.error(Rt.message);return}mt.setFieldsValue({src:"/api/attachments/".concat(Rt.id),type:kt.type})}function ut(Rt){var kt=Rt.target.files[0];J(kt,Tt)}return A.a.createElement(P.a,Object(b.a)({form:mt},ue,{className:"upload-image-panel",onFinish:Ct}),A.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(X.a,{style:ae})),A.a.createElement(se,{onFileChange:ut}))),A.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(X.a,{style:{width:264}})),A.a.createElement(P.a.Item,{style:{textAlign:"right"}},A.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(F.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))};function se(we){var Ue=we.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ue}))}function J(we,Ue){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ze=new FormData;Ze.append("editormd-image-file",we),Ze.append("file_param_name","editormd-image-file"),Ze.append("byxhr","true");var at=new window.XMLHttpRequest;at.withCredentials=!0,at.addEventListener("load",function(vt){Ue(JSON.parse(vt.target.responseText),we)},!1),at.addEventListener("error",function(vt){console.error(vt)},!1),at.open("POST","".concat(ke.a,"/api/attachments.json")),at.send(Ze)}var ee=re("giR+"),ne=re("fyUT"),fe=re("7Kak"),Ae=re("9yH6"),ge=Ae.a.Group,Oe={margin:"0 8px"},Pe=function(we){var Ue=we.callback,Ze=we.onCancel;function at(vt){Ue(vt)}return A.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:at},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Oe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Oe},"\u884C\u6570"),A.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ne.a,null)),A.a.createElement("span",{style:Oe},"\u5217\u6570"),A.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ne.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Oe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(P.a.Item,{name:"align"},A.a.createElement(ge,null,A.a.createElement(Ae.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Ae.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Ae.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Ae.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(F.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))},je=re("ErOA"),Ge=re("7Cbv"),He="link",Fe="upload-image",qe="code-block",De="add-table",Ie="------------",Be={default:Ie,left:":".concat(Ie),center:":".concat(Ie,":"),right:"".concat(Ie,":")},ze=re("9VGf"),Ke,Ve;function Re(){}var tt=0,it=1e4,Me="\u2581",We=`
**\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(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ce=ye?"Cmd":"Ctrl",le=["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"],de=(Ke={},Object(W.a)(Ke,Ce+"-B","bold"),Object(W.a)(Ke,Ce+"-I","italic"),Ke),me=(Ve={},Object(W.a)(Ve,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(Ve,qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(Ve,Fe,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(Ve,De,"\u6DFB\u52A0\u8868\u683C"),Ve),Ee=nt.a=function(we){var Ue=we.defaultValue,Ze=Ue===void 0?"":Ue,at=we.onChange,vt=we.width,mt=vt===void 0?"100%":vt,Ct=we.height,Tt=Ct===void 0?400:Ct,ut=we.miniToolbar,Rt=ut===void 0?!1:ut,kt=we.isFocus,zt=kt===void 0?!1:kt,Nt=we.watch,Et=we.insertTemp,_t=we.mode,Kt=_t===void 0?"markdown":_t,dt=we.id,Zt=dt===void 0?"markdown-editor-id":dt,jt=we.showResizeBar,Jt=jt===void 0?!1:jt,ar=we.noStorage,cr=ar===void 0?!1:ar,Er=we.showNullButton,Ot=Er===void 0?!1:Er,ft=we.hidetoolBar,or=ft===void 0?!1:ft,xr=we.fullScreen,ur=xr===void 0?!1:xr,It=we.onBlur,gr=we.onCMBeforeChange,sr=we.onFullScreen,Yr=we.className,et=Yr===void 0?"":Yr,Lt=we.disablePaste,Kr=Lt===void 0?!1:Lt,wr=we.placeholder,$r=wr===void 0?"":wr,Gr=we.values,z=Gr===void 0?"":Gr,c=Object(y.useState)(null),g=Object(G.a)(c,2),N=g[0],q=g[1],K=Object(y.useState)(Ze),Se=Object(G.a)(K,2),Qe=Se[0],ot=Se[1],lt=Object(y.useState)(Nt),$e=Object(G.a)(lt,2),gt=$e[0],yt=$e[1],Pt=Object(y.useState)(ur),nr=Object(G.a)(Pt,2),Yt=nr[0],Qt=nr[1],vr=Object(y.useState)(""),Wr=Object(G.a)(vr,2),tr=Wr[0],Vt=Wr[1],Cr=Object(y.useState)(0),zr=Object(G.a)(Cr,2),ir=zr[0],dn=zr[1],yr=Object(y.useState)(Tt),Or=Object(G.a)(yr,2),Rn=Or[0],on=Or[1],qr=Object(y.useState)(!1),gn=Object(G.a)(qr,2),Gn=gn[0],vn=gn[1],hr=Object(y.useRef)(Object(Ge.a)()),Xt=Object(y.useRef)(!1),Pr=Object(y.useRef)(),Wt=Object(y.useRef)(),Sr=Object(y.useRef)(),qt=Object(y.useRef)(),pn=Object(y.useRef)(),Ar=function(){var Xe=Object(M.a)(O.a.mark(function Ye(){var pt,xt;return O.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:hr.current}});case 2:xt=$t.sent,xt!=null&&(pt=xt.attachments)!==null&&pt!==void 0&&pt.length&&(console.log("cm:",N,Wt),xt.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?N.replaceSelection(".concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?N.replaceSelection('')):Bt.content_type.indexOf("pdf")>-1?N.replaceSelection('').concat(Bt.name,"")):N.replaceSelection("[".concat(Bt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return $t.stop()}},Ye)}));return function(){return Xe.apply(this,arguments)}}();Object(y.useEffect)(function(){ot(z),N==null||N.setValue(z)},[z]),Object(y.useEffect)(function(){sr==null||sr(Yt)},[Yt]),Object(y.useEffect)(function(){if(Wt.current){var Xe=k.a.fromTextArea(Wt.current,{mode:Kt,lineNumbers:!Rt,lineWrapping:!0,value:Ze,autoCloseTags:!0,autoCloseBrackets:!0});zt&&Xe.focus();function Ye(pt,xt){if(Kr){xt.preventDefault();return}var Mt=xt.clipboardData;if(Mt){var $t=Mt.types.toString(),Bt=Mt.items;if($t==="Files"||Mt.types.indexOf("Files")>-1){if(xt.preventDefault(),Kt=="stex")return;try{var dr,Lr=Bt[1];((dr=Bt[0])===null||dr===void 0?void 0:dr.kind)==="file"&&(Lr=Bt[0]);var Ft=Lr.getAsFile(),Zr=Ft.name.split(".").pop();J(Ft,function(Gt){if(Gt.id){var kr,pr,Mr;(Ft==null||((kr=Ft.type)===null||kr===void 0)?void 0:kr.indexOf("image"))>-1?Xe.replaceSelection(".concat(Gt.content_type,")")):(Ft==null||((pr=Ft.type)===null||pr===void 0)?void 0:pr.indexOf("video"))>-1?Xe.replaceSelection('')):(Ft==null||((Mr=Ft.type)===null||Mr===void 0)?void 0:Mr.indexOf("pdf"))>-1?Xe.replaceSelection('').concat(Ft.name,"")):le.includes(Zr)?Xe.replaceSelection('').concat(Ft.name,"")):Xe.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Xe.on("paste",Ye),Xe.on("dragleave",function(pt,xt){Sr.current.classList.remove("mouse-hover-md")}),Xe.on("dragover",function(pt,xt){Sr.current.classList.add("mouse-hover-md")}),Xe.on("drop",function(pt,xt){Sr.current.classList.add("mouse-hover-md");var Mt;if(Mt=xt.dataTransfer.files,Mt.length>0){xt.preventDefault(),xt.stopPropagation();for(var $t=function(Lr){var Ft=Mt[Lr],Zr=Ft.name.split(".").pop();J(Ft,function(Gt){if(Gt.id){var kr,pr,Mr;(Ft==null||((kr=Ft.type)===null||kr===void 0)?void 0:kr.indexOf("image"))>-1?Xe.replaceSelection(".concat(Gt.content_type,")")):(Ft==null||((pr=Ft.type)===null||pr===void 0)?void 0:pr.indexOf("video"))>-1?Xe.replaceSelection('')):(Ft==null||((Mr=Ft.type)===null||Mr===void 0)?void 0:Mr.indexOf("pdf"))>-1?Xe.replaceSelection('').concat(Ft.name,"")):le.includes(Zr)?Xe.replaceSelection('').concat(Ft.name,"")):Xe.replaceSelection("[".concat(Ft.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt0||Bt.target.offsetWidth>0)&&(Nr(),N.setSize("100%","100%"),N.refresh())}}catch(dr){Mt.e(dr)}finally{Mt.f()}});return pt.observe(Wt.current.parentElement),pt}if(N){var Ye=Xe();return function(){Ye.unobserve(Wt.current.parentElement)}}},[N,Nr]),Object(y.useEffect)(function(){if(N){for(var Xe=[],Ye=function(){var Bt=xt[pt];Mt=Object(G.a)(Bt,2);var dr=Mt[0],Lr=Mt[1],Ft=Object(W.a)({},dr,function(){An(Lr)});Xe.push(Ft),N.addKeyMap(Ft)},pt=0,xt=Object.entries(de);pt0){var Xe=new Date().getTime(),Ye=window.sessionStorage.getItem(Zt);Xe>=ir+it&&(!Ye||Ye!==Qe)&&(window.sessionStorage.setItem(Zt,Qe),vn(!0))}},it),Object(y.useEffect)(function(){yt(Nt)},[N,Nt]),Object(y.useEffect)(function(){N&&(zt&&N.focus())},[N,zt]),Object(y.useEffect)(function(){if(gt&&N){var Xe=N.getScrollerElement();function Ye(pt){var xt=pt.target;if(pn.current){var Mt=xt.scrollTop/xt.scrollHeight;pn.current.scrollTop=pn.current.scrollHeight*Mt}}return Xe.addEventListener("scroll",Ye),function(){Xe.removeEventListener("scroll",Ye)}}},[N,gt]),Object(y.useEffect)(function(){if(N&&gr){function Xe(Ye,pt){gr(Ye,pt)}return N.on("beforeChange",Xe),function(){N.off("beforeChange",Xe)}}},[N,gr]),Object(y.useEffect)(function(){if(N&&It){function Xe(){It(N.getValue())}return N.on("blur",Xe),function(){N.off("blur",Xe)}}},[N,It]),Object(y.useEffect)(function(){if(N){function Xe(Ye){var pt=Ye.getValue();ot(pt),dn(new Date().getTime()),Ye.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),at&&at(pt)}return N.on("change",Xe),function(){N.off("change",Xe)}}},[N,at]),Object(y.useEffect)(function(){N&&(Ze==null?(N.setValue(""),ot("")):Ze!==N.getValue()&&(N.setValue(Ze),ot(Ze),N.setCursor(N.lineCount(),0)))},[N,Ze]);var An=Object(y.useCallback)(function(Xe){var Ye=N.getCursor(),pt=N.getSelection(),xt=pt.split(`
`);switch(Xe){case"bold":return N.replaceSelection("**"+pt+"**"),pt===""&&N.setCursor(Ye.line,Ye.ch+2),N.focus();case"italic":return N.replaceSelection("*"+pt+"*"),pt===""&&N.setCursor(Ye.line,Ye.ch+1),N.focus();case"code":return N.replaceSelection("`"+pt+"`"),pt===""&&N.setCursor(Ye.line,Ye.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+pt+"$$`"),pt===""&&N.setCursor(Ye.line,Ye.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+pt+"\n```"),N.setCursor(Ye.line+1,pt.length+1),N.focus();case"line-break":return N.replaceSelection(`
`),N.focus();case"list-ul":return pt===""?N.replaceSelection("- "+pt):N.replaceSelection(xt.map(function(Mt){return Mt===""?"":"- ".concat(Mt)}).join(`
`)),N.focus();case"list-ol":return pt===""?N.replaceSelection("1. "+pt):N.replaceSelection(xt.map(function(Mt,$t){return Mt===""?"":"".concat($t+1,". ").concat(Mt)}).join(`
`)),N.focus();case"add-null-ch":return pt===""&&N.setCursor(Ye.line,Ye.ch+1),N.replaceSelection(Me),N.focus();case"inster-template-1":return pt===""&&N.setCursor(Ye.line,Ye.ch),N.replaceSelection(We),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return yt(!gt),N.focus();case"trigger-full-screen":return Qt(!Yt),N.focus();case He:Vt(He);return;case qe:Vt(qe);return;case Fe:Vt(Fe);return;case De:Vt(De);return;default:throw new Error}},[N,gt,Yt]),xn=Object(y.useCallback)(function(Xe){Vt("");switch(tr){case He:var Ye=Xe.title,pt=Xe.link;return N.replaceSelection("[".concat(Ye,"](").concat(pt,")")),N.focus();case qe:var xt=Xe.language,Mt=Xe.content;return N.replaceSelection(["```"+xt,Mt,"```"].join(`
`)),N.focus();case Fe:var $t=Xe.src,Bt=Xe.alt;return Bt?N.replaceSelection(".concat($t,' "').concat(Bt,'" )')):N.replaceSelection("")),N.focus();case De:for(var dr=Xe.row,Lr=Xe.col,Ft=Xe.align,Zr=`
`,Gt=0;Gt300&&(dr=300);var Lr=Tt+dr+"px";on(Lr)}}return Xe.addEventListener("mousedown",xt),document.addEventListener("mousemove",$t),document.addEventListener("mouseup",Mt),function(){Xe.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",$t),document.removeEventListener("mouseup",Mt)}}},[N,qt]),Object(y.useEffect)(function(){on(Tt)},[Tt]);var sn=xe(mt),Pn=xe(Rn),cn={width:sn,height:Pn},zn=Object(y.useMemo)(function(){if(ir){var Xe=new Date(ir),Ye=Xe.getHours(),pt=Xe.getMinutes(),xt=Xe.getSeconds();return Ye=Ye<10?"0"+Ye:Ye,pt=pt<10?"0"+pt:pt,xt=xt<10?"0"+xt:xt,"".concat(Ye,":").concat(pt,":").concat(xt)}return 0},[ir]);function ri(){window.sessionStorage.removeItem(Zt),vn(!1),dn(0)}function Ln(){vn(!1),dn(0),N.setValue(window.sessionStorage.getItem(Zt))}function Ut(Xe,Ye){var pt=N.getValue();pt=pt.replace(Xe,Ye),ot(pt),N==null||N.setValue(pt)}return A.a.createElement(y.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Sr},A.a.createElement("div",{className:"markdown-editor-container ".concat(et," ").concat(gt?"on-preview":""," ").concat(Rt?"mini":""," ").concat(Yt?"full-screen":""),style:cn},A.a.createElement(T,{insertTemp:Et,watch:gt,fullScreen:Yt,showNullButton:Ot,onActionCallback:An,hidetoolBar:or,uuid:hr.current,setOpenPhones:function(){Xt.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Wt,placeholder:$r})),gt?A.a.createElement("div",{ref:pn,className:"preview-container"},Kt==="stex"&&A.a.createElement(w,{value:Qe}),Kt!=="stex"&&A.a.createElement(p.a,{edit:!0,value:Qe,replaces:Ut})):null))),Jt?A.a.createElement("a",{ref:qt,className:"editor-resize"}):null,A.a.createElement(U.a,null,me[tr]?A.a.createElement($.a,{centered:!0,title:me[tr],visible:!0,onCancel:Cn,footer:null,className:"markdown-popup-form"},_n):null))}},RxwV:function(wt,nt,re){"use strict";var ce=re("q1tI"),$=re("uciX"),D=re("2W6z"),Z=re.n(D),B=re("4IlW"),M=re("uK0f"),G=re.n(M);function W(ae,ue){if(ae===ue)return!0;if(!ae||!ue)return!1;var ie=ae.length;if(ue.length!==ie)return!1;for(var se=0;se0;(De||ee.isLeaf===!1)&&(Fe+=" ".concat(Ae,"-menu-item-expand"),ee.loading||(qe=ce.createElement("span",{className:"".concat(Ae,"-menu-item-expand-icon")},Oe))),ge==="hover"&&(De||ee.isLeaf===!1)&&(He={onMouseEnter:this.delayOnSelect.bind(this,je),onMouseLeave:this.delayOnSelect.bind(this),onClick:je}),this.isActiveOption(ee,ne)&&(Fe+=" ".concat(Ae,"-menu-item-active"),He.ref=this.saveMenuItem(ne)),ee.disabled&&(Fe+=" ".concat(Ae,"-menu-item-disabled"));var Ie=null;ee.loading&&(Fe+=" ".concat(Ae,"-menu-item-loading"),Ie=Pe||null);var Be="";return"title"in ee?Be=ee.title:typeof ee[this.getFieldName("label")]=="string"&&(Be=ee[this.getFieldName("label")]),ce.createElement("li",Object.assign({key:ee[this.getFieldName("value")],className:Fe,title:Be},He,{role:"menuitem",onMouseDown:function(Ke){return Ke.preventDefault()}}),ee[this.getFieldName("label")],qe,Ie)}},{key:"getActiveOptions",value:function(ee){var ne=this,fe=this.props.options,Ae=ee||this.props.activeValue;return G()(fe,function(ge,Oe){return ge[ne.getFieldName("value")]===Ae[Oe]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var ee=this,ne=this.props.options,fe=this.getActiveOptions().map(function(Ae){return Ae[ee.getFieldName("children")]}).filter(function(Ae){return!!Ae});return fe.unshift(ne),fe}},{key:"delayOnSelect",value:function(ee){for(var ne=this,fe=arguments.length,Ae=new Array(fe>1?fe-1:0),ge=1;ge=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ae,se))continue;ie[se]=ae[se]}}return ie}function s(ae,ue){if(ae==null)return{};var ie={},se=Object.keys(ae),J,ee;for(ee=0;ee=0)continue;ie[J]=ae[J]}return ie}function f(ae){return m(ae)||C(ae)||a(ae)||l()}function l(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(ae,ue){if(!ae)return;if(typeof ae=="string")return T(ae,ue);var ie=Object.prototype.toString.call(ae).slice(8,-1);if(ie==="Object"&&ae.constructor&&(ie=ae.constructor.name),ie==="Map"||ie==="Set")return Array.from(ae);if(ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ie))return T(ae,ue)}function C(ae){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ae))return Array.from(ae)}function m(ae){if(Array.isArray(ae))return T(ae)}function T(ae,ue){(ue==null||ue>ae.length)&&(ue=ae.length);for(var ie=0,se=new Array(ue);ie=Pe.length?0:Ge):(Ge-=1,Ge=Ge<0?Pe.length-1:Ge):Ge=0,ge[Oe]=Pe[Ge][ee.getFieldName("value")]}else if(fe.keyCode===B.a.LEFT||fe.keyCode===B.a.BACKSPACE)fe.preventDefault(),ge.splice(ge.length-1,1);else if(fe.keyCode===B.a.RIGHT)fe.preventDefault(),Pe[je]&&Pe[je][ee.getFieldName("children")]&&ge.push(Pe[je][ee.getFieldName("children")][0][ee.getFieldName("value")]);else if(fe.keyCode===B.a.ESC||fe.keyCode===B.a.TAB){ee.setPopupVisible(!1);return}(!ge||ge.length===0)&&ee.setPopupVisible(!1);var He=ee.getActiveOptions(ge),Fe=He[He.length-1];ee.handleMenuSelect(Fe,He.length-1,fe),ee.props.onKeyDown&&ee.props.onKeyDown(fe)},ee.saveTrigger=function(fe){ee.trigger=fe};var ne=[];return"value"in J?ne=J.value||[]:"defaultValue"in J&&(ne=J.defaultValue||[]),Z()(!("filedNames"in J),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),ee.state={popupVisible:J.popupVisible,activeValue:ne,value:ne,prevProps:J},ee.defaultFieldNames={label:"label",value:"value",children:"children"},ee}return F(se,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(ee){var ne=this.defaultFieldNames,fe=this.props,Ae=fe.fieldNames,ge=fe.filedNames;return"filedNames"in this.props?ge[ee]||ne[ee]:Ae[ee]||ne[ee]}},{key:"getFieldNames",value:function(){var ee=this.props,ne=ee.fieldNames,fe=ee.filedNames;return"filedNames"in this.props?fe:ne}},{key:"getCurrentLevelOptions",value:function(){var ee=this,ne=this.props.options,fe=ne===void 0?[]:ne,Ae=this.state.activeValue,ge=Ae===void 0?[]:Ae,Oe=G()(fe,function(Pe,je){return Pe[ee.getFieldName("value")]===ge[je]},{childrenKeyName:this.getFieldName("children")});return Oe[Oe.length-2]?Oe[Oe.length-2][this.getFieldName("children")]:f(fe).filter(function(Pe){return!Pe.disabled})}},{key:"getActiveOptions",value:function(ee){var ne=this;return G()(this.props.options||[],function(fe,Ae){return fe[ne.getFieldName("value")]===ee[Ae]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var ee=this.props,ne=ee.prefixCls,fe=ee.transitionName,Ae=ee.popupClassName,ge=ee.options,Oe=ge===void 0?[]:ge,Pe=ee.disabled,je=ee.builtinPlacements,Ge=ee.popupPlacement,He=ee.children,Fe=ee.dropdownRender,qe=b(ee,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),De=ce.createElement("div",null),Ie="";Oe&&Oe.length>0?De=ce.createElement(S,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):Ie=" ".concat(ne,"-menus-empty");var Be=De;return Fe&&(Be=Fe(De)),ce.createElement($.a,Object.assign({ref:this.saveTrigger},qe,{popupPlacement:Ge,builtinPlacements:je,popupTransitionName:fe,action:Pe?[]:["click"],popupVisible:Pe?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(ne,"-menus"),popupClassName:Ae+Ie,popup:Be}),ce.cloneElement(He,{onKeyDown:this.handleKeyDown,tabIndex:Pe?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(ee,ne){var fe=ne.prevProps,Ae=fe===void 0?{}:fe,ge={prevProps:ee};return"value"in ee&&!W(Ae.value,ee.value)&&(ge.value=ee.value||[],"loadData"in ee||(ge.activeValue=ee.value||[])),"popupVisible"in ee&&(ge.popupVisible=ee.popupVisible),ge}}]),se}(ce.Component);return ae.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:p,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},ae}(),ke=Le,he=nt.a=ke},SJMd:function(wt,nt){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var re,ce,$,D=!1,Z,B;window.PR_SHOULD_USE_CONTINUATION=!0;var M,G;(function(){var W=window,_=["break,continue,do,else,for,if,return,while"],O=[_,"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"],y=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],k=[y,"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"],x="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",E=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[_,"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"],u=[_,"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"],d=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[A,k,R,E,h,o,u,d],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",w="kwd",b="com",s="typ",f="lit",l="pun",a="pln",C="tag",m="dec",T="src",U="atn",j="atv",F="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(ge){for(var Oe=0,Pe=!1,je=!1,Ge=0,He=ge.length;Ge122||(le<65||Ce>90||tt.push([Math.max(65,Ce)|32,Math.min(le,90)|32]),le<97||Ce>122||tt.push([Math.max(97,Ce)&~32,Math.min(le,122)&~32]))}}tt.sort(function(we,Ue){return we[0]-Ue[0]||Ue[1]-we[1]});for(var de=[],me=[],We=0;WeEe[0]&&(Ee[1]+1>Ee[0]&&Me.push("-"),Me.push(Ie(Ee[1])))}return Me.push("]"),Me.join("")}function ze(Ve){for(var Re=Ve.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),tt=Re.length,it=[],Me=0,We=0;Me=2&&Ce==="["?Re[Me]=Be(xe):Ce!=="\\"&&(Re[Me]=xe.replace(/[a-zA-Z]/g,function(me){var Ee=me.charCodeAt(0);return"["+String.fromCharCode(Ee&~32,Ee|32)+"]"}))}return Re.join("")}for(var Ke=[],Ge=0,He=ge.length;Ge=0;)Pe[Ke.charAt(Ve)]=ze;var Re=ze[1],tt=""+Re;De.hasOwnProperty(tt)||(qe.push(Re),De[tt]=null)}qe.push(/[\0-\uffff]/),je=P(qe)})();var Ge=Oe.length,He=function(Fe){for(var qe=Fe.sourceCode,De=Fe.basePos,Ie=Fe.sourceNode,Be=[De,a],ze=0,Ke=qe.match(je)||[],Ve={},Re=0,tt=Ke.length;Re=5&&Me.substring(0,5)==="lang-",xe&&!(We&&typeof We[1]=="string")&&(xe=!1,Me=T),xe||(Ve[it]=Me)}var le=ze;if(ze+=it.length,!xe)Be.push(De+le,Me);else{var de=We[1],me=it.indexOf(de),Ee=me+de.length;We[2]&&(Ee=it.length-We[2].length,me=Ee-de.length);var we=Me.substring(5);X(Ie,De+le,it.substring(0,me),He,Be),X(Ie,De+le+me,de,se(we,de),Be),X(Ie,De+le+Ee,it.substring(Ee),He,Be)}}Fe.decorations=Be};return He}function Le(ge){var Oe=[],Pe=[];ge.tripleQuotedStrings?Oe.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ge.multiLineStrings?Oe.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ge.verbatimStrings&&Pe.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=ge.hashComments;je&&(ge.cStyleComments?(je>1?Oe.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([b,/^#[^\r\n]*/,null,"#"])),ge.cStyleComments&&(Pe.push([b,/^\/\/[^\r\n]*/,null]),Pe.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ge=ge.regexLiterals;if(Ge){var He=Ge>1?"":`
\r`,Fe=He?".":"[\\S\\s]",qe="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+qe+")")])}var De=ge.types;De&&Pe.push([s,De]);var Ie=(""+ge.keywords).replace(/^ | $/g,"");Ie.length&&Pe.push([w,new RegExp("^(?:"+Ie.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([a,/^\s+/,null,` \r
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return ge.regexLiterals&&(Be+="(?!s*/)"),Pe.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[s,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Be),null]),ve(Oe,Pe)}var ke=Le({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(ge,Oe,Pe){for(var je=/(?:^|\s)nocode(?:\s|$)/,Ge=/\r\n?|\n/,He=ge.ownerDocument,Fe=He.createElement("li");ge.firstChild;)Fe.appendChild(ge.firstChild);var qe=[Fe];function De(Re){var tt=Re.nodeType;if(tt==1&&!je.test(Re.className))if(Re.nodeName==="br")Ie(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var it=Re.firstChild;it;it=it.nextSibling)De(it);else if((tt==3||tt==4)&&Pe){var Me=Re.nodeValue,We=Me.match(Ge);if(We){var xe=Me.substring(0,We.index);Re.nodeValue=xe;var ye=Me.substring(We.index+We[0].length);if(ye){var Ce=Re.parentNode;Ce.insertBefore(He.createTextNode(ye),Re.nextSibling)}Ie(Re),xe||Re.parentNode.removeChild(Re)}}}function Ie(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function tt(We,xe){var ye=xe?We.cloneNode(!1):We,Ce=We.parentNode;if(Ce){var le=tt(Ce,1),de=We.nextSibling;le.appendChild(ye);for(var me=de;me;me=de)de=me.nextSibling,le.appendChild(me)}return ye}for(var it=tt(Re.nextSibling,0),Me;(Me=it.parentNode)&&Me.nodeType===1;)it=Me;qe.push(it)}for(var Be=0;Be=Ce&&(De+=2),He>=le&&(ze+=2)}}finally{Me&&(Me.style.display=We)}}var ue={};function ie(ge,Oe){for(var Pe=Oe.length;--Pe>=0;){var je=Oe[Pe];ue.hasOwnProperty(je)?W.console&&console.warn("cannot override language handler %s",je):ue[je]=ge}}function se(ge,Oe){return ge&&ue.hasOwnProperty(ge)||(ge=/^\s*]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^