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