(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".map-container{--gap: 30px;--root-radius: 30px;--main-radius: 20px;--root-color: #ffffff;--root-bgcolor: #4c4f69;--root-border-color: rgba(0, 0, 0, 0);--main-color: #444446;--main-bgcolor: #ffffff;--topic-padding: 3px;--color: #777777;--bgcolor: #f6f6f6;--selected: #4dc4ff;--panel-color: #444446;--panel-bgcolor: #ffffff;--panel-border-color: #eaeaea;-webkit-tap-highlight-color:rgba(0,0,0,0);font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif;-webkit-user-select:none;user-select:none;height:100%;width:100%;overflow:scroll;font-size:15px}.map-container *{box-sizing:border-box}.map-container::-webkit-scrollbar{width:0px;height:0px}.map-container .selected{outline:2px solid var(--selected);outline-offset:1px}.map-container .hyper-link{text-decoration:none;margin-left:.3em}.map-container .lhs{direction:rtl}.map-container .lhs me-tpc{direction:ltr}.map-container .map-canvas{height:20000px;width:20000px;position:relative;-webkit-user-select:none;user-select:none;transition:transform .3s;transform:scale(1);background-color:var(--bgcolor)}.map-container .map-canvas me-nodes{position:absolute;display:flex;justify-content:center;align-items:center;height:fit-content;width:fit-content}.map-container .map-canvas me-root{position:relative}.map-container .map-canvas me-root me-tpc{display:block;font-size:25px;color:var(--root-color);padding:10px var(--gap);border-radius:var(--root-radius);border:var(--root-border-color) 2px solid;white-space:pre-wrap;background-color:var(--root-bgcolor)}.map-container me-main>me-wrapper{position:relative;margin:45px 65px}.map-container me-main>me-wrapper>me-parent{margin:10px;padding:0}.map-container me-main>me-wrapper>me-parent>me-tpc{border-radius:var(--main-radius);background-color:var(--main-bgcolor);border:2px solid var(--main-color);color:var(--main-color);padding:8px 25px}.map-container me-wrapper{display:block;pointer-events:none;width:fit-content}.map-container me-children,.map-container me-parent{display:inline-block;vertical-align:middle}.map-container me-parent{position:relative;cursor:pointer;padding:6px var(--gap);margin-top:10px}.map-container me-parent me-tpc{position:relative;display:block;border-radius:3px;color:var(--color);pointer-events:all;max-width:35em;white-space:pre-wrap;padding:var(--topic-padding)}.map-container me-parent me-tpc .insert-preview{position:absolute;width:100%;left:0;z-index:9}.map-container me-parent me-tpc .show{background:#7ad5ff;pointer-events:none;opacity:.7}.map-container me-parent me-tpc .before{height:14px;top:-14px}.map-container me-parent me-tpc .in{height:100%;top:0}.map-container me-parent me-tpc .after{height:14px;bottom:-14px}.map-container me-parent me-epd{position:absolute;height:18px;width:18px;opacity:.8;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NDcxNzI0MiIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNDgwaC0xMzguNjY2NjY3VjM0MS4zMzMzMzNjMC0xNy4wNjY2NjctMTQuOTMzMzMzLTMyLTMyLTMycy0zMiAxNC45MzMzMzMtMzIgMzJ2MTM4LjY2NjY2N0gzNDEuMzMzMzMzYy0xNy4wNjY2NjcgMC0zMiAxNC45MzMzMzMtMzIgMzJzMTQuOTMzMzMzIDMyIDMyIDMyaDEzOC42NjY2NjdWNjgyLjY2NjY2N2MwIDE3LjA2NjY2NyAxNC45MzMzMzMgMzIgMzIgMzJzMzItMTQuOTMzMzMzIDMyLTMydi0xMzguNjY2NjY3SDY4Mi42NjY2NjdjMTcuMDY2NjY3IDAgMzItMTQuOTMzMzMzIDMyLTMycy0xNC45MzMzMzMtMzItMzItMzJ6Ij48L3BhdGg+Cjwvc3ZnPg==);background-repeat:no-repeat;background-size:contain;background-position:center;pointer-events:all;z-index:9}.map-container me-parent me-epd.minus{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdD0iMTY1NjY1NTU2NDk4NSIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+CiAgICA8cGF0aCBkPSJNNTEyIDc0LjY2NjY2N0MyNzAuOTMzMzMzIDc0LjY2NjY2NyA3NC42NjY2NjcgMjcwLjkzMzMzMyA3NC42NjY2NjcgNTEyUzI3MC45MzMzMzMgOTQ5LjMzMzMzMyA1MTIgOTQ5LjMzMzMzMyA5NDkuMzMzMzMzIDc1My4wNjY2NjcgOTQ5LjMzMzMzMyA1MTIgNzUzLjA2NjY2NyA3NC42NjY2NjcgNTEyIDc0LjY2NjY2N3oiIHN0cm9rZS13aWR0aD0iNTQiIHN0cm9rZT0nYmxhY2snIGZpbGw9J3doaXRlJyA+PC9wYXRoPgogICAgPHBhdGggZD0iTTY4Mi42NjY2NjcgNTQ0SDM0MS4zMzMzMzNjLTE3LjA2NjY2NyAwLTMyLTE0LjkzMzMzMy0zMi0zMnMxNC45MzMzMzMtMzIgMzItMzJoMzQxLjMzMzMzNGMxNy4wNjY2NjcgMCAzMiAxNC45MzMzMzMgMzIgMzJzLTE0LjkzMzMzMyAzMi0zMiAzMnoiPjwvcGF0aD4KPC9zdmc+)!important;transition:opacity .3s;opacity:0}.map-container me-parent me-epd.minus:hover{opacity:.8}.map-container .icon{width:1em;height:1em;vertical-align:-.15em;fill:currentColor;overflow:hidden}.map-container .lines,.map-container .summary,.map-container .subLines,.map-container .topiclinks,.map-container .linkcontroller{position:absolute;height:102%;width:100%;top:0;left:0}.map-container .topiclinks,.map-container .linkcontroller,.map-container .summary{pointer-events:none}.map-container .topiclinks text,.map-container .linkcontroller text,.map-container .summary text{pointer-events:all}.map-container .topiclinks .selected,.map-container .linkcontroller .selected,.map-container .summary .selected{pointer-events:none}.map-container .lines,.map-container .subLines{pointer-events:none;z-index:-1}.map-container .topiclinks *,.map-container .linkcontroller *{z-index:100}.map-container .topiclinks g{cursor:pointer}.map-container #input-box{position:absolute;top:0;left:0;width:max-content;max-width:35em;z-index:11;direction:ltr;-webkit-user-select:auto;user-select:auto;pointer-events:auto;background-color:var(--bgcolor)}.map-container me-tpc>*{pointer-events:none}.map-container me-tpc>a,.map-container me-tpc>iframe{pointer-events:auto}.map-container me-tpc>img{display:block;margin-bottom:8px;object-fit:cover}.map-container me-tpc>.text{display:inline-block}.map-container .circle{position:absolute;height:10px;width:10px;margin-top:-5px;margin-left:-5px;border-radius:100%;background:#757575;border:2px solid #ffffff;cursor:pointer}.map-container .tags{direction:ltr}.map-container .tags span{display:inline-block;border-radius:3px;padding:2px 4px;background:#d6f0f8;color:#276f86;margin:2px 4px 0 0;font-size:12px;line-height:1.3em}.map-container .icons{display:inline-block;direction:ltr;margin-left:5px}.map-container .icons span{display:inline-block;line-height:1.3em}.map-container .mind-elixir-ghost{position:fixed;top:-100%;left:-100%;box-sizing:content-box;opacity:.5;background-color:var(--main-bgcolor);border:2px solid var(--main-color);color:var(--main-color);max-width:200px;width:fit-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:8px 16px;border-radius:6px}.map-container .selection-area{background:#4f90f22d;border:1px solid #4f90f2}.map-container .context-menu{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99}.map-container .context-menu .menu-list{position:fixed;list-style:none;margin:0;padding:0;color:var(--panel-color);box-shadow:0 12px 15px #0003;border-radius:5px;overflow:hidden}.map-container .context-menu .menu-list li{min-width:200px;overflow:hidden;white-space:nowrap;padding:6px 10px;background:var(--panel-bgcolor);border-bottom:1px solid var(--panel-border-color);cursor:pointer}.map-container .context-menu .menu-list li span{line-height:20px}.map-container .context-menu .menu-list li a{color:#333;text-decoration:none}.map-container .context-menu .menu-list li.disabled{display:none}.map-container .context-menu .menu-list li:hover{filter:brightness(.95)}.map-container .context-menu .menu-list li:last-child{border-bottom:0}.map-container .context-menu .menu-list li span:last-child{float:right}.map-container .context-menu .key{font-size:10px;background-color:#f1f1f1;color:#333;padding:2px 5px;border-radius:3px}.map-container .tips{position:absolute;bottom:20px;left:50%;transform:translate(-50%);color:var(--panel-color);font-weight:bolder}.mind-elixir-toolbar{font-family:iconfont;position:absolute;color:var(--panel-color);background:var(--panel-bgcolor);padding:10px;border-radius:5px;box-shadow:0 1px 2px #0003}.mind-elixir-toolbar svg{display:inline-block}.mind-elixir-toolbar span:active{opacity:.5}.mind-elixir-toolbar.rb{right:20px;bottom:20px}.mind-elixir-toolbar.rb span+span{margin-left:10px}.mind-elixir-toolbar.lt{font-size:20px;left:20px;top:20px}.mind-elixir-toolbar.lt span{display:block}.mind-elixir-toolbar.lt span+span{margin-top:10px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();(function(e){var t,n,o,i,r,s,a='',l=(l=document.getElementsByTagName("script"))[l.length-1].getAttribute("data-injectcss");if(l&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("")}catch{}}function c(){r||(r=!0,o())}t=function(){var d,p,h,m;(m=document.createElement("div")).innerHTML=a,a=null,(h=m.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",d=h,(p=document.body).firstChild?(m=d,(h=p.firstChild).parentNode.insertBefore(m,h)):p.appendChild(d))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(n=function(){document.removeEventListener("DOMContentLoaded",n,!1),t()},document.addEventListener("DOMContentLoaded",n,!1)):document.attachEvent&&(o=t,i=e.document,r=!1,(s=function(){try{i.documentElement.doScroll("left")}catch{return void setTimeout(s,50)}c()})(),i.onreadystatechange=function(){i.readyState=="complete"&&(i.onreadystatechange=null,c())})})(window);const T=0,O=1,ce=2,Oe={name:"Latte",type:"light",palette:["#dd7878","#ea76cb","#8839ef","#e64553","#fe640b","#df8e1d","#40a02b","#209fb5","#1e66f5","#7287fd"],cssVar:{"--gap":"30px","--main-color":"#444446","--main-bgcolor":"#ffffff","--color":"#777777","--bgcolor":"#f6f6f6","--panel-color":"#444446","--panel-bgcolor":"#ffffff","--panel-border-color":"#eaeaea"}},$e={name:"Dark",type:"dark",palette:["#848FA0","#748BE9","#D2F9FE","#4145A5","#789AFA","#706CF4","#EF987F","#775DD5","#FCEECF","#DA7FBC"],cssVar:{"--main-color":"#ffffff","--main-bgcolor":"#4c4f69","--color":"#cccccc","--bgcolor":"#252526","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969"}};function ie(e){return e.replace(/&/g,"&").replace(/{if(e.parent=t,e.children)for(let n=0;n0&&(s=180-s),r<0&&i<0&&(s=180+s),r>0&&i<0&&(s=360-s);const a=12,l=30,c=s+l,d=s-l;return{x1:n+Math.cos(Math.PI*c/180)*a,y1:o-Math.sin(Math.PI*c/180)*a,x2:n+Math.cos(Math.PI*d/180)*a,y2:o-Math.sin(Math.PI*d/180)*a}}function q(){return(new Date().getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const tt=function(){const e=q();return{topic:this.newTopicName,id:e}};function fe(e){return JSON.parse(JSON.stringify(e,(t,n)=>{if(t!=="parent")return n}))}const P=(e,t)=>{let n=0,o=0;for(;t&&t!==e;)n+=t.offsetLeft,o+=t.offsetTop,t=t.offsetParent;return{offsetLeft:n,offsetTop:o}},w=(e,t)=>{for(const n in t)e.setAttribute(n,t[n])},he=e=>e?e.tagName==="ME-TPC":!1,de=e=>e.filter(t=>{for(let n=0;n{this.moved=!1,this.mousedown=!1},0)}};function nt(e){e.map.addEventListener("click",t=>{var n,o;if(t.button!==0)return;if((n=e.helper1)!=null&&n.moved){e.helper1.clear();return}if((o=e.helper2)!=null&&o.moved){e.helper2.clear();return}if(k.moved){k.clear();return}e.clearSelection();const i=t.target;if(i.tagName==="ME-EPD")e.expandNode(i.previousSibling);else if(he(i))e.selectNode(i,!1,t);else if(e.editable)i.tagName==="text"?i.dataset.type==="custom-link"?e.selectArrow(i.parentElement):e.selectSummary(i.parentElement):i.className;else return}),e.map.addEventListener("dblclick",t=>{if(!e.editable)return;const n=t.target;he(n)?e.beginEdit(n):n.tagName==="text"&&(n.dataset.type==="custom-link"?e.editArrowLabel(n.parentElement):e.editSummary(n.parentElement))}),e.map.addEventListener("mousemove",t=>{t.target.contentEditable==="inherit"&&k.onMove(t,e)}),e.map.addEventListener("mousedown",t=>{const n=e.mouseSelectionButton===0?2:0;t.button===n&&t.target.contentEditable==="inherit"&&(k.moved=!1,k.mousedown=!0)}),e.map.addEventListener("mouseleave",t=>{const n=e.mouseSelectionButton===0?2:0;t.button===n&&k.clear()}),e.map.addEventListener("mouseup",t=>{const n=e.mouseSelectionButton===0?2:0;t.button===n&&k.clear()})}const ot={create(){return{handlers:{},showHandler:function(){},addListener:function(e,t){this.handlers[e]===void 0&&(this.handlers[e]=[]),this.handlers[e].push(t)},fire:function(e,...t){if(this.handlers[e]instanceof Array){const n=this.handlers[e];for(let o=0;o(e.LHS="lhs",e.RHS="rhs",e))(j||{});const ae=document,it=function(){this.nodes.innerHTML="";const e=this.createTopic(this.nodeData);ge(e,this.nodeData),e.draggable=!1;const t=ae.createElement("me-root");t.appendChild(e);const n=this.nodeData.children||[];if(this.direction===ce){let o=0,i=0;n.map(r=>{r.direction===T?o+=1:r.direction===O?i+=1:o<=i?(r.direction=T,o+=1):(r.direction=O,i+=1)})}rt(this,n,t)},rt=function(e,t,n){const o=ae.createElement("me-main");o.className=j.LHS;const i=ae.createElement("me-main");i.className=j.RHS;for(let r=0;r{const n=(t?t.el:_).querySelector(`[data-nodeid=me${e}]`);if(!n)throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);return n},ge=function(e,t){if(e.innerHTML="",t.style&&(e.style.color=t.style.color||"",e.style.background=t.style.background||"",e.style.fontSize=t.style.fontSize+"px",e.style.fontWeight=t.style.fontWeight||"normal"),t.dangerouslySetInnerHTML){e.innerHTML=t.dangerouslySetInnerHTML;return}if(t.image){const n=t.image;if(n.url&&n.width&&n.height){const o=_.createElement("img");o.src=n.url,o.style.width=n.width+"px",o.style.height=n.height+"px",n.fit&&(o.style.objectFit=n.fit),e.appendChild(o),e.image=o}}else e.image&&(e.image=void 0);{const n=_.createElement("span");n.className="text",n.textContent=t.topic,e.appendChild(n),e.text=n}if(t.hyperLink){const n=_.createElement("a");n.className="hyper-link",n.target="_blank",n.innerText="🔗",n.href=t.hyperLink,e.appendChild(n),e.link=n}else e.link&&(e.link=void 0);if(t.icons&&t.icons.length){const n=_.createElement("span");n.className="icons",n.innerHTML=t.icons.map(o=>`${ie(o)}`).join(""),e.appendChild(n),e.icons=n}else e.icons&&(e.icons=void 0);if(t.tags&&t.tags.length){const n=_.createElement("div");n.className="tags",n.innerHTML=t.tags.map(o=>`${ie(o)}`).join(""),e.appendChild(n),e.tags=n}else e.tags&&(e.tags=void 0)},at=function(e,t){const n=_.createElement("me-wrapper"),{p:o,tpc:i}=this.createParent(e);if(n.appendChild(o),!t&&e.children&&e.children.length>0){const r=ve(e.expanded);if(o.appendChild(r),e.expanded!==!1){const s=st(this,e.children);n.appendChild(s)}}return{grp:n,top:o,tpc:i}},lt=function(e){const t=_.createElement("me-parent"),n=this.createTopic(e);return ge(n,e),t.appendChild(n),{p:t,tpc:n}},ct=function(e){const t=_.createElement("me-children");return t.append(...e),t},dt=function(e){const t=_.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t.draggable=this.draggable,t};function Pe(e){const t=_.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const ht=function(e){if(!e)return;const t=_.createElement("div"),n=e.text.textContent;e.appendChild(t),t.id="input-box",t.textContent=n,t.contentEditable="plaintext-only",t.spellcheck=!1;const o=getComputedStyle(e);t.style.cssText=`min-width:${e.offsetWidth-8}px; color:${o.color}; padding:${o.padding}; margin:${o.margin}; font:${o.font}; background-color:${o.backgroundColor!=="rgba(0, 0, 0, 0)"&&o.backgroundColor}; border-radius:${o.borderRadius};`,this.direction===T&&(t.style.right="0"),t.focus(),Pe(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",i=>{i.stopPropagation();const r=i.key;if(r==="Enter"||r==="Tab"){if(i.shiftKey)return;i.preventDefault(),t.blur(),this.map.focus()}}),t.addEventListener("blur",()=>{var i;if(!t)return;const r=e.nodeObj,s=((i=t.textContent)==null?void 0:i.trim())||"";s===""?r.topic=n:r.topic=s,t.remove(),s!==n&&(e.text.textContent=r.topic,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:r,origin:n}))})},ve=function(e){const t=_.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},V=document,X="http://www.w3.org/2000/svg",Be=function(e,t,n){const o=V.createElementNS(X,"path");return w(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},G=function(e){const t=V.createElementNS(X,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},Me=function(){const e=V.createElementNS(X,"line");return e.setAttribute("stroke","#bbb"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e},pt=function(e,t,n){const o={stroke:"rgb(235, 95, 82)",fill:"none","stroke-linecap":"cap","stroke-width":"2"},i=V.createElementNS(X,"g");return[e,t,n].forEach((r,s)=>{const a=V.createElementNS(X,"path"),l={d:r,...o};w(a,l),s===0&&a.setAttribute("stroke-dasharray","8,2"),i.appendChild(a)}),i},Re=function(e,t,n){if(!t)return;const o=V.createElement("div");e.nodes.appendChild(o);const i=t.innerHTML;o.id="input-box",o.textContent=i,o.contentEditable="plaintext-only",o.spellcheck=!1;const r=t.getBBox();o.style.cssText=` min-width:${Math.max(88,r.width)}px; position:absolute; left:${r.x}px; top:${r.y}px; padding: 2px 4px; margin: -2px -4px; `,o.focus(),Pe(o),o.addEventListener("keydown",s=>{s.stopPropagation();const a=s.key;if(a==="Enter"||a==="Tab"){if(s.shiftKey)return;s.preventDefault(),o.blur(),e.map.focus()}}),o.addEventListener("blur",()=>{o&&n(o)})},ut=function(e){const t=this.map.querySelector("me-root"),n=t.offsetTop,o=t.offsetLeft,i=t.offsetWidth,r=t.offsetHeight,s=this.map.querySelector("me-nodes").offsetWidth;this.nodes.style.top=`${1e4-this.nodes.offsetHeight/2}px`,this.alignment==="root"?this.nodes.style.left=`${1e4-o-i/2}px`:this.nodes.style.left=`${1e4-s/2}px`;const a=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="";for(let l=0;l{const N=document.createElement("div");return N.innerText=y,N.className="tips",N},o=(y,N,L)=>{const S=document.createElement("li");return S.id=y,S.innerHTML=`${ie(N)}${ie(L)}`,S},i=Ce[e.locale]?e.locale:"en",r=Ce[i],s=o("cm-add_child",r.addChild,"Tab"),a=o("cm-add_parent",r.addParent,"Ctrl + Enter"),l=o("cm-add_sibling",r.addSibling,"Enter"),c=o("cm-remove_child",r.removeNode,"Delete"),d=o("cm-fucus",r.focus,""),p=o("cm-unfucus",r.cancelFocus,""),h=o("cm-up",r.moveUp,"PgUp"),m=o("cm-down",r.moveDown,"Pgdn"),f=o("cm-link",r.link,""),v=o("cm-link-bidirectional","Bidirectional Link",""),g=o("cm-summary",r.summary,""),u=document.createElement("ul");if(u.className="menu-list",u.appendChild(s),u.appendChild(a),u.appendChild(l),u.appendChild(c),t.focus&&(u.appendChild(d),u.appendChild(p)),u.appendChild(h),u.appendChild(m),u.appendChild(g),t.link&&(u.appendChild(f),u.appendChild(v)),t&&t.extend)for(let y=0;y{N.onclick(S)}}const b=document.createElement("div");b.className="context-menu",b.appendChild(u),b.hidden=!0,e.container.append(b);let x=!0;e.container.oncontextmenu=function(y){if(y.preventDefault(),!e.editable||k.moved)return;const N=y.target;if(he(N)){N.parentElement.tagName==="ME-ROOT"?x=!0:x=!1,x?(d.className="disabled",h.className="disabled",m.className="disabled",a.className="disabled",l.className="disabled",c.className="disabled"):(d.className="",h.className="",m.className="",a.className="",l.className="",c.className=""),e.currentNodes||e.selectNode(N),b.hidden=!1,k.mousedown&&(k.mousedown=!1),u.style.top="",u.style.bottom="",u.style.left="",u.style.right="";const L=u.getBoundingClientRect(),S=u.offsetHeight,A=u.offsetWidth,U=y.clientY-L.top,Z=y.clientX-L.left;S+U>window.innerHeight?(u.style.top="",u.style.bottom="0px"):(u.style.bottom="",u.style.top=U+15+"px"),A+Z>window.innerWidth?(u.style.left="",u.style.right="0px"):(u.style.right="",u.style.left=Z+10+"px")}},b.onclick=y=>{y.target===b&&(b.hidden=!0)},s.onclick=()=>{e.addChild(),b.hidden=!0},a.onclick=()=>{e.insertParent(),b.hidden=!0},l.onclick=()=>{x||(e.insertSibling("after"),b.hidden=!0)},c.onclick=()=>{x||(e.removeNode(),b.hidden=!0)},d.onclick=()=>{x||(e.focusNode(e.currentNode),b.hidden=!0)},p.onclick=()=>{e.cancelFocus(),b.hidden=!0},h.onclick=()=>{x||(e.moveUpNode(),b.hidden=!0)},m.onclick=()=>{x||(e.moveDownNode(),b.hidden=!0)};const E=y=>{b.hidden=!0;const N=e.currentNode,L=n(r.clickTips);e.container.appendChild(L),e.map.addEventListener("click",S=>{S.preventDefault(),L.remove();const A=S.target;(A.parentElement.tagName==="ME-PARENT"||A.parentElement.tagName==="ME-ROOT")&&e.createArrow(N,A,y)},{once:!0})};return f.onclick=()=>E(),v.onclick=()=>E({bidirectional:!0}),g.onclick=()=>{b.hidden=!0,e.createSummary(),e.unselectNodes()},()=>{s.onclick=null,a.onclick=null,l.onclick=null,c.onclick=null,d.onclick=null,p.onclick=null,h.onclick=null,m.onclick=null,f.onclick=null,g.onclick=null,b.onclick=null,e.container.oncontextmenu=null}}const ft=e=>{const t=e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},gt=e=>{const t=e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},vt=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},bt=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},yt=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Ee=function(e,t){var n,o;const i=e.currentNode||((n=e.currentNodes)==null?void 0:n[0]);if(!i)return;const r=i.nodeObj,s=i.offsetParent.offsetParent.parentElement;r.parent?s.className===t?yt(e,i):(o=r.parent)!=null&&o.parent?bt(e,i):vt(e):t===j.LHS?ft(e):gt(e)},Se=function(e,t){var n;const o=e.currentNode||((n=e.currentNodes)==null?void 0:n[0]);if(!o||!o.nodeObj.parent)return;const i=t+"Sibling",r=o.parentElement.parentElement[i];r&&e.selectNode(r.firstChild.firstChild)},ee=function(e,t){switch(t){case"in":if(e.scaleVal>1.6)return;e.scale(e.scaleVal+=.2);break;case"out":if(e.scaleVal<.6)return;e.scale(e.scaleVal-=.2)}};function xt(e,t){t=t===!0?{}:t;const n=()=>{e.currentArrow?e.removeArrow():e.currentSummary?e.removeSummary(e.currentSummary.summaryObj.id):e.currentNode?e.removeNode():e.currentNodes&&e.removeNodes(e.currentNodes)},o={Enter:i=>{i.shiftKey?e.insertSibling("before"):i.ctrlKey?e.insertParent():e.insertSibling("after")},Tab:()=>{e.addChild()},F1:()=>{e.toCenter()},F2:()=>{e.beginEdit()},ArrowUp:i=>{if(i.altKey)e.moveUpNode();else{if(i.metaKey||i.ctrlKey)return e.initSide();Se(e,"previous")}},ArrowDown:i=>{i.altKey?e.moveDownNode():Se(e,"next")},ArrowLeft:i=>{if(i.metaKey||i.ctrlKey)return e.initLeft();Ee(e,j.LHS)},ArrowRight:i=>{if(i.metaKey||i.ctrlKey)return e.initRight();Ee(e,j.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},c:i=>{(i.metaKey||i.ctrlKey)&&(e.currentNode?e.waitCopy=[e.currentNode]:e.currentNodes&&(e.waitCopy=e.currentNodes))},x:i=>{(i.metaKey||i.ctrlKey)&&(e.currentNode?e.waitCopy=[e.currentNode]:e.currentNodes&&(e.waitCopy=e.currentNodes),n())},v:i=>{!e.waitCopy||!e.currentNode||(i.metaKey||i.ctrlKey)&&(e.waitCopy.length===1?e.copyNode(e.waitCopy[0],e.currentNode):e.copyNodes(e.waitCopy,e.currentNode))},"+":i=>{(i.metaKey||i.ctrlKey)&&ee(e,"in")},"-":i=>{(i.metaKey||i.ctrlKey)&&ee(e,"out")},0:i=>{(i.metaKey||i.ctrlKey)&&e.scale(1)},Delete:n,Backspace:n,...t};e.map.onkeydown=i=>{if(i.preventDefault(),!e.editable||i.target!==i.currentTarget)return;const r=o[i.key];r&&r(i)},e.map.onwheel=i=>{(i.ctrlKey||i.metaKey)&&(i.preventDefault(),i.deltaY<0?ee(e,"in"):e.scaleVal-.2>0&&ee(e,"out"),i.stopPropagation())}}const pe=document,Nt=function(e,t){if(!t)return ue(e),e;let n=e.querySelector(".insert-preview");const o=`insert-preview ${t} show`;return n||(n=pe.createElement("div"),e.appendChild(n)),n.className=o,e},ue=function(e){if(!e)return;const t=e.querySelectorAll(".insert-preview");for(const n of t||[])n.remove()},Le=function(e,t){for(const n of t){const o=n.parentElement.parentElement.contains(e);if(!(e&&e.tagName==="ME-TPC"&&e!==n&&!o&&e.nodeObj.parent))return!1}return!0},Mt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.map.appendChild(t),t};function wt(e){let t=null,n=null,o=null;const i=Mt(e),r=12;e.map.addEventListener("dragstart",s=>{var a;const l=s.target;if(l?.tagName!=="ME-TPC"){s.preventDefault();return}(a=e.currentNodes)!=null&&a.includes(l)||(e.unselectNodes(),e.selectNode(l)),e.currentNodes?(t=e.currentNodes,i.innerHTML=e.currentNodes.length+""):(t=[l],i.innerHTML=l.innerHTML);for(const c of t)c.parentElement.parentElement.style.opacity="0.5";s.dataTransfer.setDragImage(i,0,0),s.dataTransfer.dropEffect="move",k.clear()}),e.map.addEventListener("dragend",async s=>{if(!t)return;for(const l of t)l.parentElement.parentElement.style.opacity="1";const a=s.target;a.style.opacity="",o&&(ue(o),n==="before"?e.moveNodeBefore(t,o):n==="after"?e.moveNodeAfter(t,o):n==="in"&&e.moveNodeIn(t,o),t=null)}),e.map.addEventListener("dragover",function(s){if(s.preventDefault(),!t)return;ue(o);const a=pe.elementFromPoint(s.clientX,s.clientY-r);if(Le(a,t)){o=a;const l=a.getBoundingClientRect().y;s.clientY>l+a.clientHeight?n="after":n="in"}else{const l=pe.elementFromPoint(s.clientX,s.clientY+r);if(Le(l,t)){o=l;const c=l.getBoundingClientRect().y;s.clientYt.id)}:{type:"node",value:e.obj.id}};function Et(e){let t=[],n=-1,o=e.getData();e.bus.addListener("operation",i=>{if(i.name==="beginEdit")return;t=t.slice(0,n+1);const r=e.getData();t.push({prev:o,currentObject:Ct(i),next:r}),o=r,n=t.length-1}),e.undo=function(){if(n>-1){const i=t[n];o=i.prev,e.refresh(i.prev);try{i.currentObject.type==="node"?e.selectNode(C(i.currentObject.value)):i.currentObject.type==="nodes"&&e.selectNodes(i.currentObject.value.map(r=>C(r)))}catch{}finally{n--}}},e.redo=function(){if(nC(r)))}},e.map.addEventListener("keydown",i=>{(i.metaKey||i.ctrlKey)&&(i.shiftKey&&i.key==="Z"||i.key==="y")?e.redo():(i.metaKey||i.ctrlKey)&&i.key==="z"&&e.undo()})}const R=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=``,n};function St(e){const t=document.createElement("div"),n=R("fullscreen","full"),o=R("toCenter","living"),i=R("zoomout","move"),r=R("zoomin","add"),s=document.createElement("span");return s.innerText="100%",t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(r),t.className="mind-elixir-toolbar rb",n.onclick=()=>{e.el.requestFullscreen()},o.onclick=()=>{e.toCenter()},i.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-.2)},r.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+.2)},t}function Lt(e){const t=document.createElement("div"),n=R("tbltl","left"),o=R("tbltr","right"),i=R("tblts","side");return t.appendChild(n),t.appendChild(o),t.appendChild(i),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},o.onclick=()=>{e.initRight()},i.onclick=()=>{e.initSide()},t}function jt(e){e.container.append(St(e)),e.container.append(Lt(e))}/*! @viselect/vanilla v3.5.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */var kt=Object.defineProperty,_t=(e,t,n)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t,n)=>(_t(e,typeof t!="symbol"?t+"":t,n),n);class zt{constructor(){M(this,"_listeners",new Map),M(this,"on",this.addEventListener),M(this,"off",this.removeEventListener),M(this,"emit",this.dispatchEvent)}addEventListener(t,n){const o=this._listeners.get(t)??new Set;return this._listeners.set(t,o),o.add(n),this}removeEventListener(t,n){var o;return(o=this._listeners.get(t))==null||o.delete(n),this}dispatchEvent(t,...n){let o=!0;for(const i of this._listeners.get(t)??[])o=i(...n)!==!1&&o;return o}unbindAllListeners(){this._listeners.clear()}}const je=(e,t="px")=>typeof e=="number"?e+t:e;function H({style:e},t,n){if(typeof t=="object")for(const[o,i]of Object.entries(t))i!==void 0&&(e[o]=je(i));else n!==void 0&&(e[t]=je(n))}const Fe=e=>(t,n,o,i={})=>{t instanceof HTMLCollection||t instanceof NodeList?t=Array.from(t):Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);for(const r of t)if(r)for(const s of n)r[e](s,o,{capture:!1,...i});return[t,n,o,i]},Y=Fe("addEventListener"),I=Fe("removeEventListener"),te=e=>{var t;const{clientX:n,clientY:o,target:i}=((t=e.touches)==null?void 0:t[0])??e;return{x:n,y:o,target:i}};function ke(e,t,n="touch"){switch(n){case"center":{const o=t.left+t.width/2,i=t.top+t.height/2;return o>=e.left&&o<=e.right&&i>=e.top&&i<=e.bottom}case"cover":return t.left>=e.left&&t.top>=e.top&&t.right<=e.right&&t.bottom<=e.bottom;case"touch":return e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}}function F(e,t=document){const n=Array.isArray(e)?e:[e];let o=[];for(let i=0,r=n.length;imatchMedia("(hover: none), (pointer: coarse)").matches,At=()=>"safari"in window,Dt=e=>{let t,n=-1,o=!1;return{next(...i){t=i,o||(o=!0,n=requestAnimationFrame(()=>{e(...t),o=!1}))},cancel(){cancelAnimationFrame(n),o=!1}}};function Ht(e,t){for(const n of t){if(typeof n=="number")return e.button===n;if(typeof n=="object"){const o=n.button===e.button,i=n.modifiers.every(r=>{switch(r){case"alt":return e.altKey;case"ctrl":return e.ctrlKey||e.metaKey;case"shift":return e.shiftKey}});return o&&i}}return!1}const{abs:B,max:_e,min:ze,ceil:Te}=Math;class We extends zt{constructor(t){var n,o,i,r,s;super(),M(this,"_options"),M(this,"_selection",{stored:[],selected:[],touched:[],changed:{added:[],removed:[]}}),M(this,"_area"),M(this,"_clippingElement"),M(this,"_targetElement"),M(this,"_targetRect"),M(this,"_selectables",[]),M(this,"_latestElement"),M(this,"_areaRect",new DOMRect),M(this,"_areaLocation",{y1:0,x2:0,y2:0,x1:0}),M(this,"_singleClick",!0),M(this,"_frame"),M(this,"_scrollAvailable",!0),M(this,"_scrollingActive",!1),M(this,"_scrollSpeed",{x:0,y:0}),M(this,"_scrollDelta",{x:0,y:0}),M(this,"disable",this._bindStartEvents.bind(this,!1)),M(this,"enable",this._bindStartEvents),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",...t,behaviour:{overlap:"invert",intersect:"touch",triggers:[0],...t.behaviour,startThreshold:(n=t.behaviour)!=null&&n.startThreshold?typeof t.behaviour.startThreshold=="number"?t.behaviour.startThreshold:{x:10,y:10,...t.behaviour.startThreshold}:{x:10,y:10},scrolling:{speedDivider:10,manualSpeed:750,...(o=t.behaviour)==null?void 0:o.scrolling,startScrollMargins:{x:0,y:0,...(r=(i=t.behaviour)==null?void 0:i.scrolling)==null?void 0:r.startScrollMargins}}},features:{range:!0,touch:!0,...t.features,singleTap:{allow:!0,intersect:"native",...(s=t.features)==null?void 0:s.singleTap}}};for(const d of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[d]=="function"&&(this[d]=this[d].bind(this));const{document:a,selectionAreaClass:l,selectionContainerClass:c}=this._options;this._area=a.createElement("div"),this._clippingElement=a.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(l),c&&this._clippingElement.classList.add(c),H(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),H(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Dt(d=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",d),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(t=!0){const{document:n,features:o}=this._options,i=t?Y:I;i(n,"mousedown",this._onTapStart),o.touch&&i(n,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,n=!1){const{x:o,y:i,target:r}=te(t),{_options:s}=this,{document:a}=this._options,l=r.getBoundingClientRect();if(t instanceof MouseEvent&&!Ht(t,s.behaviour.triggers))return;const c=F(s.startAreas,s.document),d=F(s.boundaries,s.document);this._targetElement=d.find(m=>ke(m.getBoundingClientRect(),l));const p=t.composedPath();if(!this._targetElement||!c.find(m=>p.includes(m))||!d.find(m=>p.includes(m))||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:o,y1:i,x2:0,y2:0};const h=a.scrollingElement??a.body;this._scrollDelta={x:h.scrollLeft,y:h.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),Y(a,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),Y(a,["mouseup","touchcancel","touchend"],this._onTapStop),Y(a,"scroll",this._onScroll)}_onSingleTap(t){const{singleTap:{intersect:n},range:o}=this._options.features,i=te(t);let r;if(n==="native")r=i.target;else if(n==="touch"){this.resolveSelectables();const{x:a,y:l}=i;r=this._selectables.find(c=>{const{right:d,left:p,top:h,bottom:m}=c.getBoundingClientRect();return ap&&lh})}if(!r)return;for(this.resolveSelectables();!this._selectables.includes(r);){if(!r.parentElement)return;r=r.parentElement}const{stored:s}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&o&&this._latestElement){const a=this._latestElement,[l,c]=a.compareDocumentPosition(r)&4?[r,a]:[a,r],d=[...this._selectables.filter(p=>p.compareDocumentPosition(l)&4&&p.compareDocumentPosition(c)&2),l,c];this.select(d),this._latestElement=a}else s.includes(r)&&(s.length===1||t.ctrlKey||s.every(a=>this._selection.stored.includes(a)))?this.deselect(r):(this.select(r),this._latestElement=r)}_delayedTapMove(t){const{container:n,document:o,behaviour:{startThreshold:i}}=this._options,{x1:r,y1:s}=this._areaLocation,{x:a,y:l}=te(t);if(typeof i=="number"&&B(a+l-(r+s))>=i||typeof i=="object"&&B(a-r)>=i.x||B(l-s)>=i.y){if(I(o,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){I(o,["mouseup","touchcancel","touchend"],this._onTapStop);return}Y(o,["mousemove","touchmove"],this._onTapMove,{passive:!1}),H(this._area,"display","block"),F(n,o)[0].appendChild(this._clippingElement),this.resolveSelectables(),this._singleClick=!1,this._targetRect=this._targetElement.getBoundingClientRect(),this._scrollAvailable=this._targetElement.scrollHeight!==this._targetElement.clientHeight||this._targetElement.scrollWidth!==this._targetElement.clientWidth,this._scrollAvailable&&(Y(this._targetElement,"wheel",this._manualScroll,{passive:!1}),this._selectables=this._selectables.filter(c=>this._targetElement.contains(c))),this._setupSelectionArea(),this._emitEvent("start",t),this._onTapMove(t)}this._handleMoveEvent(t)}_setupSelectionArea(){const{_clippingElement:t,_targetElement:n,_area:o}=this,i=this._targetRect=n.getBoundingClientRect();this._scrollAvailable?(H(t,{top:i.top,left:i.left,width:i.width,height:i.height}),H(o,{marginTop:-i.top,marginLeft:-i.left})):(H(t,{top:0,left:0,width:"100%",height:"100%"}),H(o,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{x:n,y:o}=te(t),{_scrollSpeed:i,_areaLocation:r,_options:s,_frame:a}=this,{speedDivider:l}=s.behaviour.scrolling,c=this._targetElement;if(r.x2=n,r.y2=o,this._scrollAvailable&&!this._scrollingActive&&(i.y||i.x)){this._scrollingActive=!0;const d=()=>{if(!i.x&&!i.y){this._scrollingActive=!1;return}const{scrollTop:p,scrollLeft:h}=c;i.y&&(c.scrollTop+=Te(i.y/l),r.y1-=c.scrollTop-p),i.x&&(c.scrollLeft+=Te(i.x/l),r.x1-=c.scrollLeft-h),a.next(t),requestAnimationFrame(d)};requestAnimationFrame(d)}else a.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&Tt()||this._scrollAvailable&&At())&&t.preventDefault()}_onScroll(){const{_scrollDelta:t,_options:{document:n}}=this,{scrollTop:o,scrollLeft:i}=n.scrollingElement??n.body;this._areaLocation.x1+=t.x-i,this._areaLocation.y1+=t.y-o,t.x=i,t.y=o,this._setupSelectionArea(),this._frame.next(null)}_manualScroll(t){const{manualSpeed:n}=this._options.behaviour.scrolling,o=t.deltaY?t.deltaY>0?1:-1:0,i=t.deltaX?t.deltaX>0?1:-1:0;this._scrollSpeed.y+=o*n,this._scrollSpeed.x+=i*n,this._onTapMove(t),t.preventDefault()}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:n,_areaRect:o,_targetElement:i,_options:r}=this,{scrollTop:s,scrollHeight:a,clientHeight:l,scrollLeft:c,scrollWidth:d,clientWidth:p}=i,h=this._targetRect,{x1:m,y1:f}=n;let{x2:v,y2:g}=n;const{behaviour:{scrolling:{startScrollMargins:u}}}=r;vh.right-u.x?(t.x=d-c-p?B(h.left+h.width-v-u.x):0,v=v>h.right?h.right:v):t.x=0,gh.bottom-u.y?(t.y=a-s-l?B(h.top+h.height-g-u.y):0,g=g>h.bottom?h.bottom:g):t.y=0;const b=ze(m,v),x=ze(f,g),E=_e(m,v),y=_e(f,g);o.x=b,o.y=x,o.width=E-b,o.height=y-x}_redrawSelectionArea(){const{x:t,y:n,width:o,height:i}=this._areaRect,{style:r}=this._area;r.left=`${t}px`,r.top=`${n}px`,r.width=`${o}px`,r.height=`${i}px`}_onTapStop(t,n){var o;const{document:i,features:r}=this._options,{_singleClick:s}=this;I(i,["mousemove","touchmove"],this._delayedTapMove),I(i,["touchmove","mousemove"],this._onTapMove),I(i,["mouseup","touchcancel","touchend"],this._onTapStop),I(i,"scroll",this._onScroll),this._keepSelection(),t&&s&&r.singleTap.allow?this._onSingleTap(t):!s&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,I(this._targetElement,"wheel",this._manualScroll,{passive:!0}),this._clippingElement.remove(),(o=this._frame)==null||o.cancel(),H(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:o,_areaRect:i}=this,{stored:r,selected:s,touched:a}=o,{intersect:l,overlap:c}=n.behaviour,d=c==="invert",p=[],h=[],m=[];for(let v=0;v!s.includes(v)));const f=c==="keep";for(let v=0;v!s.includes(l));switch(t.behaviour.overlap){case"drop":{n.stored=[...a,...s.filter(l=>!r.includes(l))];break}case"invert":{n.stored=[...a,...s.filter(l=>!i.removed.includes(l))];break}case"keep":{n.stored=[...s,...o.filter(l=>!s.includes(l))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=F(this._options.selectables,this._options.document)}clearSelection(t=!0,n=!1){const{selected:o,stored:i,changed:r}=this._selection;r.added=[],r.removed.push(...o,...t?i:[]),n||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={stored:t?[]:i,selected:[],touched:[],changed:{added:[],removed:[]}}}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}cancel(t=!1){this._onTapStop(null,!t)}destroy(){this.cancel(),this.disable(),this._clippingElement.remove(),super.unbindAllListeners()}select(t,n=!1){const{changed:o,selected:i,stored:r}=this._selection,s=F(t,this._options.document).filter(a=>!i.includes(a)&&!r.includes(a));return r.push(...s),i.push(...s),o.added.push(...s),o.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),s}deselect(t,n=!1){const{selected:o,stored:i,changed:r}=this._selection,s=F(t,this._options.document).filter(a=>o.includes(a)||i.includes(a));s.length&&(this._selection.stored=i.filter(a=>!s.includes(a)),this._selection.selected=o.filter(a=>!s.includes(a)),this._selection.changed.added=[],this._selection.changed.removed.push(...s.filter(a=>!r.removed.includes(a))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)))}}M(We,"version","3.5.1");function It(e){const t=e.mouseSelectionButton===2?[2]:[0],n=new We({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.selectionContainer,behaviour:{triggers:t,scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:o})=>{if(o.target.tagName==="ME-TPC"||o.target.id==="input-box"||o.target.className==="circle")return!1;const i=n.getSelectionArea();return i.style.background="#4f90f22d",i.style.border="1px solid #4f90f2",i.parentElement&&(i.parentElement.style.zIndex="9999"),!0}).on("start",({event:o})=>{!o.ctrlKey&&!o.metaKey&&(e.clearSelection(),n.clearSelection(!0,!0))}).on("move",({store:{changed:{added:o,removed:i}}})=>{k.moved=!0;for(const r of o)r.classList.add("selected");for(const r of i)r.classList.remove("selected")}).on("stop",({store:{stored:o}})=>{e.selectNodes(o)});e.selection=n}const Ot=function(e,t=!0){this.theme=e;const n=this.theme.cssVar,o=Object.keys(n);this.container.style.cssText="";for(let i=0;i{var t;const n=(t=e.parent)==null?void 0:t.children,o=n?.indexOf(e)??0;return{siblings:n,index:o}};function $t(e){const{siblings:t,index:n}=K(e);if(t===void 0)return;const o=t[n];n===0?(t[n]=t[t.length-1],t[t.length-1]=o):(t[n]=t[n-1],t[n-1]=o)}function Pt(e){const{siblings:t,index:n}=K(e);if(t===void 0)return;const o=t[n];n===t.length-1?(t[n]=t[0],t[0]=o):(t[n]=t[n+1],t[n+1]=o)}function be(e){const{siblings:t,index:n}=K(e);return t===void 0?0:(t.splice(n,1),t.length)}function Bt(e,t,n){const{siblings:o,index:i}=K(n);o!==void 0&&(t==="before"?o.splice(i,0,e):o.splice(i+1,0,e))}function Rt(e,t){const{siblings:n,index:o}=K(e);n!==void 0&&(n[o]=t,t.children=[e])}function Ve(e,t,n){var o;if(be(t),(o=n.parent)!=null&&o.parent||(t.direction=n.direction),e==="in")n.children?n.children.push(t):n.children=[t];else{t.direction!==void 0&&(t.direction=n.direction);const{siblings:i,index:r}=K(n);if(i===void 0)return;e==="before"?i.splice(r,0,t):i.splice(r+1,0,t)}}const Yt=function({map:e,direction:t},n){var o,i;if(t===T)return T;if(t===O)return O;if(t===ce){const r=((o=e.querySelector(".lhs"))==null?void 0:o.childElementCount)||0,s=((i=e.querySelector(".rhs"))==null?void 0:i.childElementCount)||0;return r<=s?(n.direction=T,T):(n.direction=O,O)}},qe=function(e,t,n){var o,i;const r=n.children[0].children[0],s=t.parentElement;if(s.tagName==="ME-PARENT"){if(Q(r),s.children[1])s.nextSibling.appendChild(n);else{const a=e.createChildren([n]);s.appendChild(ve(!0)),s.insertAdjacentElement("afterend",a)}e.linkDiv(n.offsetParent)}else s.tagName==="ME-ROOT"&&(Yt(e,r.nodeObj)===T?(o=e.container.querySelector(".lhs"))==null||o.appendChild(n):(i=e.container.querySelector(".rhs"))==null||i.appendChild(n),e.linkDiv())},Ke=function(e,t){const n=e.parentNode;if(t===0){const o=n.parentNode.parentNode;o.tagName!=="ME-MAIN"&&(o.previousSibling.children[1].remove(),o.remove())}n.parentNode.remove()},Ue={before:"beforebegin",after:"afterend"},Q=function(e){const t=e.parentElement.parentElement.lastElementChild;t?.tagName==="svg"&&t?.remove()},Ft=function(e,t){const n=e.nodeObj,o=fe(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const i=Object.assign(n,t);ge(e,i),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:i,origin:o})},ye=function(e,t,n){if(!t)return null;const o=t.nodeObj;o.expanded===!1&&(e.expandNode(t,!0),t=C(o.id));const i=n||e.generateNewObj();o.children?o.children.push(i):o.children=[i],$(e.nodeData);const{grp:r,top:s}=e.createWrapper(i);return qe(e,t,r),{newTop:s,newNodeObj:i}},Wt=function(e,t,n){var o,i,r,s;const a=t||this.currentNode;if(!a)return;const l=a.nodeObj;if(l.parent){if(!((o=l.parent)!=null&&o.parent)&&((r=(i=l.parent)==null?void 0:i.children)==null?void 0:r.length)===1){this.addChild(C(l.parent.id),n);return}}else{this.addChild();return}const c=n||this.generateNewObj();if(!((s=l.parent)!=null&&s.parent)){const m=a.closest("me-main").className===j.LHS?T:O;c.direction=m}Bt(c,e,l),$(this.nodeData);const d=a.parentElement,{grp:p,top:h}=this.createWrapper(c);d.parentElement.insertAdjacentElement(Ue[e],p),this.linkDiv(p.offsetParent),n||this.editTopic(h.firstChild),this.selectNode(h.firstChild,!0),this.bus.fire("operation",{name:"insertSibling",type:e,obj:c})},Vt=function(e,t){const n=e||this.currentNode;if(!n)return;Q(n);const o=n.nodeObj;if(!o.parent)return;const i=t||this.generateNewObj();Rt(o,i),$(this.nodeData);const r=n.parentElement.parentElement,{grp:s,top:a}=this.createWrapper(i,!0);a.appendChild(ve(!0)),r.insertAdjacentElement("afterend",s);const l=this.createChildren([r]);a.insertAdjacentElement("afterend",l),this.linkDiv(),t||this.editTopic(a.firstChild),this.selectNode(a.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:i})},qt=function(e,t){const n=e||this.currentNode;if(!n)return;const o=ye(this,n,t);if(!o)return;const{newTop:i,newNodeObj:r}=o;this.bus.fire("operation",{name:"addChild",obj:r}),t||this.editTopic(i.firstChild),this.selectNode(i.firstChild,!0)},Kt=function(e,t){const n=fe(e.nodeObj);me(n);const o=ye(this,t,n);if(!o)return;const{newNodeObj:i}=o;this.selectNode(C(i.id)),this.bus.fire("operation",{name:"copyNode",obj:i})},Ut=function(e,t){e=de(e);const n=[];for(let o=0;oC(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},Zt=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;$t(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},Jt=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;Pt(n);const o=t.parentNode.parentNode;o.nextSibling?o.nextSibling.insertAdjacentElement("afterend",o):o.parentNode.prepend(o),this.linkDiv(),this.bus.fire("operation",{name:"moveDownNode",obj:n})},Gt=function(e){var t;const n=e||this.currentNode;if(!n)return;const o=n.nodeObj;if(!o.parent)throw new Error("Can not remove root node");const i=o.parent.children,r=i.findIndex(a=>a===o),s=be(o);if(Ke(n,s),i.length!==0){const a=i[r]||i[r-1];this.selectNode(C(a.id))}else this.selectNode(C(o.parent.id));this.linkDiv(),this.bus.fire("operation",{name:"removeNode",obj:o,originIndex:r,originParentId:(t=o?.parent)==null?void 0:t.id})},Xt=function(e){e=de(e);for(const t of e){const n=t.nodeObj;if(!n.parent)continue;const o=be(n);Ke(t,o)}this.linkDiv(),this.bus.fire("operation",{name:"removeNodes",objs:e.map(t=>t.nodeObj)})},Qt=function(e,t){e=de(e);const n=t.nodeObj;n.expanded===!1&&(this.expandNode(t,!0),t=C(n.id));for(const o of e){const i=o.nodeObj;Ve("in",i,n),$(this.nodeData);const r=o.parentElement;qe(this,t,r.parentElement)}this.linkDiv(),this.bus.fire("operation",{name:"moveNodeIn",objs:e.map(o=>o.nodeObj),toObj:n})},Ze=(e,t,n,o)=>{e=de(e),t==="after"&&(e=e.reverse());const i=n.nodeObj,r=[];for(const s of e){const a=s.nodeObj;Ve(t,a,i),$(o.nodeData),Q(s);const l=s.parentElement.parentNode;r.includes(l.parentElement)||r.push(l.parentElement),n.parentElement.parentNode.insertAdjacentElement(Ue[t],l)}for(const s of r)s.childElementCount===0&&s.tagName!=="ME-MAIN"&&(s.previousSibling.children[1].remove(),s.remove());o.linkDiv(),o.bus.fire("operation",{name:t==="before"?"moveNodeBefore":"moveNodeAfter",objs:e.map(s=>s.nodeObj),toObj:i})},en=function(e,t){Ze(e,"before",t,this)},tn=function(e,t){Ze(e,"after",t,this)},nn=function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},on=function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()},Je=Object.freeze(Object.defineProperty({__proto__:null,addChild:qt,beginEdit:nn,copyNode:Kt,copyNodes:Ut,insertParent:Vt,insertSibling:Wt,moveDownNode:Jt,moveNodeAfter:tn,moveNodeBefore:en,moveNodeIn:Qt,moveUpNode:Zt,removeNode:Gt,removeNodes:Xt,reshapeNode:Ft,rmSubline:Q,setNodeTopic:on},Symbol.toStringTag,{value:"Module"}));function Ge(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme}}const rn=function(e,t,n){if(e){if(this.clearSelection(),typeof e=="string"){const o=C(e);return o?this.selectNode(o):void 0}e.className="selected",e.scrollIntoView({block:"nearest",inline:"nearest"}),this.currentNode=e,t?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj,n)}},sn=function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},an=function(e){this.clearSelection();for(const t of e)t.className="selected";this.currentNodes=e,this.bus.fire("selectNodes",e.map(t=>t.nodeObj))},ln=function(){if(this.currentNodes)for(const e of this.currentNodes)e.classList.remove("selected");this.currentNodes=null,this.bus.fire("unselectNodes")},cn=function(){this.unselectNode(),this.unselectNodes(),this.unselectSummary(),this.unselectArrow()},dn=function(){const e=Ge(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},hn=function(){return JSON.parse(this.getDataString())},pn=function(){const e=Ge(this).nodeData;let t="# "+e.topic+` `;function n(o,i){for(let r=0;rthis.createWrapper(l).grp));o.parentNode.appendChild(a)}else o.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const r=e.getBoundingClientRect(),s=this.container.getBoundingClientRect();(r.bottom>s.bottom||r.tops.right||r.lefte.h/e.w||o<-e.h/e.w?e.cy-e.ctrlY<0?(t=e.cx-e.h/2/o,n=e.cy+e.h/2):(t=e.cx+e.h/2/o,n=e.cy-e.h/2):e.cx-e.ctrlX<0?(t=e.cx+e.w/2,n=e.cy-e.w*o/2):(t=e.cx-e.w/2,n=e.cy+e.w*o/2),{x:t,y:n}}const kn=function(e,t,n,o){const i=document.createElementNS("http://www.w3.org/2000/svg","text");return w(i,{"text-anchor":"middle",x:t+"",y:n+"",fill:o||"#666"}),i.dataset.type="custom-link",i.innerHTML=e,i},Xe=function(e,t,n,o,i){if(!t||!n)return;performance.now();const r=le(e,t,o.delta1),s=le(e,n,o.delta2),{x:a,y:l}=W(r),{ctrlX:c,ctrlY:d}=r,{ctrlX:p,ctrlY:h}=s,{x:m,y:f}=W(s),v=se(p,h,m,f),g=`M ${v.x1} ${v.y1} L ${m} ${f} L ${v.x2} ${v.y2}`;let u="";if(o.bidirectional){const N=se(c,d,a,l);u=`M ${N.x1} ${N.y1} L ${a} ${l} L ${N.x2} ${N.y2}`}const b=pt(`M ${a} ${l} C ${c} ${d} ${p} ${h} ${m} ${f}`,g,u),x=a/8+c*3/8+p*3/8+m/8,E=l/8+d*3/8+h*3/8+f/8,y=kn(o.label,x,E,e.theme.cssVar["--color"]);b.appendChild(y),b.arrowObj=o,b.dataset.linkid=o.id,e.linkSvgGroup.appendChild(b),i||(e.arrows.push(o),e.currentArrow=b,Qe(e,o,r,s)),performance.now()},_n=function(e,t,n={}){const o={id:q(),label:"Custom Link",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:0,y:-200},delta2:{x:0,y:-200},...n};Xe(this,e,t,o),this.bus.fire("operation",{name:"createArrow",obj:o})},zn=function(e){let t;if(e?t=e:t=this.currentArrow,!t)return;xe(this);const n=t.arrowObj.id;this.arrows=this.arrows.filter(o=>o.id!==n),t.remove(),this.bus.fire("operation",{name:"removeArrow",obj:{id:n}})},Tn=function(e){this.currentArrow=e;const t=e.arrowObj,n=C(t.from),o=C(t.to),i=le(this,n,t.delta1),r=le(this,o,t.delta2);Qe(this,t,i,r)},An=function(){this.currentArrow=null,xe(this)},xe=function(e){var t,n;(t=e.helper1)==null||t.destory(e.map),(n=e.helper2)==null||n.destory(e.map),e.linkController.style.display="none",e.P2.style.display="none",e.P3.style.display="none"},Qe=function(e,t,n,o){e.linkController.style.display="initial",e.P2.style.display="initial",e.P3.style.display="initial",e.nodes.appendChild(e.linkController),e.nodes.appendChild(e.P2),e.nodes.appendChild(e.P3);let{x:i,y:r}=W(n),{ctrlX:s,ctrlY:a}=n,{ctrlX:l,ctrlY:c}=o,{x:d,y:p}=W(o);e.P2.style.cssText=`top:${a}px;left:${s}px;`,e.P3.style.cssText=`top:${c}px;left:${l}px;`,w(e.line1,{x1:i+"",y1:r+"",x2:s+"",y2:a+""}),w(e.line2,{x1:l+"",y1:c+"",x2:d+"",y2:p+""}),e.helper1=Ae.create(e.P2),e.helper2=Ae.create(e.P3),e.helper1.init(e.map,(h,m)=>{if(!e.currentArrow)return;s=s+h/e.scaleVal,a=a+m/e.scaleVal;const f=W({...n,ctrlX:s,ctrlY:a});i=f.x,r=f.y;const v=i/8+s*3/8+l*3/8+d/8,g=r/8+a*3/8+c*3/8+p/8;if(e.P2.style.top=a+"px",e.P2.style.left=s+"px",e.currentArrow.children[0].setAttribute("d",`M ${i} ${r} C ${s} ${a} ${l} ${c} ${d} ${p}`),t.bidirectional){const u=se(s,a,i,r);e.currentArrow.children[2].setAttribute("d",`M ${u.x1} ${u.y1} L ${i} ${r} L ${u.x2} ${u.y2}`)}w(e.currentArrow.children[3],{x:v+"",y:g+""}),w(e.line1,{x1:i+"",y1:r+"",x2:s+"",y2:a+""}),t.delta1.x=s-n.cx,t.delta1.y=a-n.cy,e.bus.fire("updateArrowDelta",t)}),e.helper2.init(e.map,(h,m)=>{if(!e.currentArrow)return;l=l+h/e.scaleVal,c=c+m/e.scaleVal;const f=W({...o,ctrlX:l,ctrlY:c});d=f.x,p=f.y;const v=i/8+s*3/8+l*3/8+d/8,g=r/8+a*3/8+c*3/8+p/8,u=se(l,c,d,p);e.P3.style.top=c+"px",e.P3.style.left=l+"px",e.currentArrow.children[0].setAttribute("d",`M ${i} ${r} C ${s} ${a} ${l} ${c} ${d} ${p}`),e.currentArrow.children[1].setAttribute("d",`M ${u.x1} ${u.y1} L ${d} ${p} L ${u.x2} ${u.y2}`),w(e.currentArrow.children[3],{x:v+"",y:g+""}),w(e.line2,{x1:l+"",y1:c+"",x2:d+"",y2:p+""}),t.delta2.x=l-o.cx,t.delta2.y=c-o.cy,e.bus.fire("updateArrowDelta",t)})};function Dn(){this.linkSvgGroup.innerHTML="";for(let e=0;e{var o;const i=e.arrowObj,r=((o=n.textContent)==null?void 0:o.trim())||"";r===""?i.label=origin:i.label=r,n.remove(),r!==origin&&(t.innerHTML=i.label,this.linkDiv(),this.bus.fire("operation",{name:"finishEditArrowLabel",obj:i}))})}function In(){this.arrows=this.arrows.filter(e=>re(e.from,this.nodeData)&&re(e.to,this.nodeData))}const On=Object.freeze(Object.defineProperty({__proto__:null,createArrow:_n,editArrowLabel:Hn,removeArrow:zn,renderArrow:Dn,selectArrow:Tn,tidyArrow:In,unselectArrow:An},Symbol.toStringTag,{value:"Module"})),$n=function(e){var t,n;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const d=e[0].nodeObj,p=e[0].nodeObj.parent;if(!p)throw new Error("Can not select root node.");const h=p.children.findIndex(m=>d===m);return{parent:p.id,start:h,end:h}}let o=0;const i=e.map(d=>{let p=d.nodeObj;const h=[];for(;p.parent;){const m=p.parent,f=m.children,v=f?.indexOf(p);p=m,h.unshift({node:p,index:v})}return h.length>o&&(o=h.length),h});let r=0;e:for(;rd[r-1].index).sort(),a=s[0]||0,l=s[s.length-1]||0,c=i[0][r-1].node;if(!c.parent)throw new Error("Please select nodes in the same main topic.");return{parent:c.id,start:a,end:l}},Pn=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.setAttribute("id",e),t},De=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","path");return w(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},He=function(e,t,n,o,i){const r=document.createElementNS("http://www.w3.org/2000/svg","text");return w(r,{"text-anchor":o,x:t+"",y:n+"",fill:i||"#666"}),r.innerHTML=e,r},Bn=e=>C(e).parentElement.parentElement,Rn=function({parent:e,start:t}){const n=C(e),o=n.nodeObj;let i;return o.parent?i=n.closest("me-main").className:i=C(o.children[t].id).closest("me-main").className,i},Ne=function(e,t){var n;const{id:o,text:i,parent:r,start:s,end:a}=t,l=e.nodes,c=C(r).nodeObj,d=Rn(t);let p=1/0,h=0,m=0,f=0;for(let N=s;N<=a;N++){const L=(n=c.children)==null?void 0:n[N];if(!L)return e.removeSummary(o),null;const S=Bn(L.id),{offsetLeft:A,offsetTop:U}=P(l,S),Z=s===a?10:20;N===s&&(m=U+Z),N===a&&(f=U+S.offsetHeight-Z),Ah&&(h=S.offsetWidth+A)}let v,g;const u=m+10,b=f+10,x=(u+b)/2,E=e.theme.cssVar["--color"];d===j.LHS?(v=De(`M ${p+10} ${u} c -5 0 -10 5 -10 10 L ${p} ${b-10} c 0 5 5 10 10 10 M ${p} ${x} h -10`,E),g=He(i,p-20,x+6,"end",E)):(v=De(`M ${h-10} ${u} c 5 0 10 5 10 10 L ${h} ${b-10} c 0 5 -5 10 -10 10 M ${h} ${x} h 10`,E),g=He(i,h+20,x+6,"start",E));const y=Pn("s-"+o);return y.appendChild(v),y.appendChild(g),y.summaryObj=t,e.summarySvg.appendChild(y),y},Yn=function(){let e=[];this.currentNode?e=[this.currentNode]:this.currentNodes&&(e=this.currentNodes);const{parent:t,start:n,end:o}=$n(e),i={id:q(),parent:t,start:n,end:o,text:"summary"},r=Ne(this,i);this.summaries.push(i),this.editSummary(r),this.bus.fire("operation",{name:"createSummary",obj:i})},Fn=function(e){const t=q(),n={...e,id:t};Ne(this,n),this.summaries.push(n),this.bus.fire("operation",{name:"createSummary",obj:n})},Wn=function(e){var t;const n=this.summaries.findIndex(o=>o.id===e);n>-1&&(this.summaries.splice(n,1),(t=document.querySelector("#s-"+e))==null||t.remove()),this.bus.fire("operation",{name:"removeSummary",obj:{id:e}})},Vn=function(e){const t=e.children[1].getBBox(),n=6,o=3,i=document.createElementNS("http://www.w3.org/2000/svg","rect");w(i,{x:t.x-n+"",y:t.y-n+"",width:t.width+n*2+"",height:t.height+n*2+"",rx:o+"",stroke:this.theme.cssVar["--selected"]||"#4dc4ff","stroke-width":"2",fill:"none"}),e.appendChild(i),this.currentSummary=e},qn=function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null},Kn=function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{try{Ne(this,e)}catch{}}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},Un=function(e){if(!e)return;const t=e.childNodes[1];Re(this,t,n=>{var o;const i=e.summaryObj,r=((o=n.textContent)==null?void 0:o.trim())||"";r===""?i.text=origin:i.text=r,n.remove(),r!==origin&&(t.innerHTML=i.text,this.linkDiv(),this.bus.fire("operation",{name:"finishEditSummary",obj:i}))})},Zn=Object.freeze(Object.defineProperty({__proto__:null,createSummary:Yn,createSummaryFrom:Fn,editSummary:Un,removeSummary:Wn,renderSummary:Kn,selectSummary:Vn,unselectSummary:qn},Symbol.toStringTag,{value:"Module"})),z="http://www.w3.org/2000/svg";function Jn(e,t){const n=document.createElementNS(z,"svg");return w(n,{version:"1.1",xmlns:z,height:e,width:t}),n}function Gn(e,t){return(parseInt(e)-parseInt(t))/2}function Xn(e,t,n,o){const i=document.createElementNS(z,"g");let r="";return e.text?r=e.text.textContent:r=e.childNodes[0].textContent,r.split(` `).forEach((s,a)=>{const l=document.createElementNS(z,"text");w(l,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+Gn(t.lineHeight,t.fontSize)*(a+1)+parseFloat(t.fontSize)*(a+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),l.innerHTML=s,i.appendChild(l)}),i}function Qn(e,t,n,o){var i;let r="";(i=e.nodeObj)!=null&&i.dangerouslySetInnerHTML?r=e.nodeObj.dangerouslySetInnerHTML:e.text?r=e.text.textContent:r=e.childNodes[0].textContent;const s=document.createElementNS(z,"foreignObject");w(s,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const a=document.createElement("div");return w(a,{xmlns:"http://www.w3.org/1999/xhtml",style:`font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`}),a.innerHTML=r,s.appendChild(a),s}function eo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),r=document.createElementNS(z,"rect");return w(r,{x:o+"",y:i+"",rx:n.borderRadius,ry:n.borderRadius,width:n.width,height:n.height,fill:n.backgroundColor,stroke:n.borderColor,"stroke-width":n.borderWidth}),r}function ne(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:i,offsetTop:r}=P(e.nodes,t),s=document.createElementNS(z,"rect");w(s,{x:i+"",y:r+"",rx:o.borderRadius,ry:o.borderRadius,width:o.width,height:o.height,fill:o.backgroundColor,stroke:o.borderColor,"stroke-width":o.borderWidth});const a=document.createElementNS(z,"g");a.appendChild(s);let l;return n?l=Qn(t,o,i,r):l=Xn(t,o,i,r),a.appendChild(l),a}function to(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),r=document.createElementNS(z,"a"),s=document.createElementNS(z,"text");return w(s,{x:o+"",y:i+parseInt(n.fontSize)+"","text-anchor":"start","font-family":n.fontFamily,"font-size":`${n.fontSize}`,"font-weight":`${n.fontWeight}`,fill:`${n.color}`}),s.innerHTML=t.textContent,r.appendChild(s),r.setAttribute("href",t.href),r}function no(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),r=document.createElementNS(z,"image");return w(r,{x:o+"",y:i+"",width:n.width+"",height:n.height+"",href:t.src}),r}const oe=100,oo='',io=(e,t=!1)=>{var n,o,i;const r=e.nodes,s=r.offsetHeight+oe*2,a=r.offsetWidth+oe*2,l=Jn(s+"px",a+"px"),c=document.createElementNS(z,"svg"),d=document.createElementNS(z,"rect");w(d,{x:"0",y:"0",width:`${a}`,height:`${s}`,fill:e.theme.cssVar["--bgcolor"]}),l.appendChild(d),r.querySelectorAll(".subLines").forEach(f=>{const v=f.cloneNode(!0),{offsetLeft:g,offsetTop:u}=P(r,f.parentElement);v.setAttribute("x",`${g}`),v.setAttribute("y",`${u}`),c.appendChild(v)});const p=(n=r.querySelector(".lines"))==null?void 0:n.cloneNode(!0);p&&c.appendChild(p);const h=(o=r.querySelector(".topiclinks"))==null?void 0:o.cloneNode(!0);h&&c.appendChild(h);const m=(i=r.querySelector(".summary"))==null?void 0:i.cloneNode(!0);return m&&c.appendChild(m),r.querySelectorAll("me-tpc").forEach(f=>{f.nodeObj.dangerouslySetInnerHTML?c.appendChild(ne(e,f,!t)):(c.appendChild(eo(e,f)),c.appendChild(ne(e,f.text,!t)))}),r.querySelectorAll(".tags > span").forEach(f=>{c.appendChild(ne(e,f))}),r.querySelectorAll(".icons > span").forEach(f=>{c.appendChild(ne(e,f))}),r.querySelectorAll(".hyper-link").forEach(f=>{c.appendChild(to(e,f))}),r.querySelectorAll("img").forEach(f=>{c.appendChild(no(e,f))}),w(c,{x:oe+"",y:oe+"",overflow:"visible"}),l.appendChild(c),l},ro=(e,t)=>(t&&e.insertAdjacentHTML("afterbegin",""),oo+e.outerHTML);function so(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=i=>{t(i.target.result)},o.onerror=i=>{n(i)},o.readAsDataURL(e)})}const ao=function(e=!1,t){const n=io(this,e),o=ro(n,t);return new Blob([o],{type:"image/svg+xml"})},lo=async function(e=!1,t){const n=this.exportSvg(e,t),o=await so(n);return new Promise((i,r)=>{const s=new Image;s.setAttribute("crossOrigin","anonymous"),s.onload=()=>{const a=document.createElement("canvas");a.width=s.width,a.height=s.height,a.getContext("2d").drawImage(s,0,0),a.toBlob(i,"image/png",1)},s.src=o,s.onerror=r})},co=Object.freeze(Object.defineProperty({__proto__:null,exportPng:lo,exportSvg:ao},Symbol.toStringTag,{value:"Module"}));function ho(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const Ie=Object.keys(Je),et={};for(let e=0;et()),this.el&&(this.el.innerHTML=""),this.el=void 0,this.nodeData=void 0,this.arrows=void 0,this.summaries=void 0,this.currentArrow=void 0,this.currentNode=void 0,this.currentNodes=void 0,this.currentSummary=void 0,this.waitCopy=void 0,this.theme=void 0,this.direction=void 0,this.bus=void 0,this.container=void 0,this.map=void 0,this.lines=void 0,this.linkController=void 0,this.linkSvgGroup=void 0,this.P2=void 0,this.P3=void 0,this.line1=void 0,this.line2=void 0,this.nodes=void 0,(e=this.selection)==null||e.destroy(),this.selection=void 0}};function uo({pT:e,pL:t,pW:n,pH:o,cT:i,cL:r,cW:s,cH:a,direction:l,containerHeight:c}){let d=t+n/2;const p=e+o/2;let h;l===j.LHS?h=r+s:h=r;const m=i+a/2,f=(1-Math.abs(m-p)/c)*.25*(n/2);return l===j.LHS?d=d-n/10-f:d=d+n/10+f,`M ${d} ${p} Q ${d} ${m} ${h} ${m}`}function mo({pT:e,pL:t,pW:n,pH:o,cT:i,cL:r,cW:s,cH:a,direction:l,isFirst:c}){const d=parseInt(this.container.style.getPropertyValue("--gap"));let p=0,h=0;c?p=e+o/2:p=e+o;const m=i+a;let f=0,v=0,g=0;const u=Math.abs(p-m)/300*d;return l===j.LHS?(g=t,f=g+d,v=g-d,h=r+d,`M ${f} ${p} C ${g} ${p} ${g+u} ${m} ${v} ${m} H ${h}`):(g=t+n,f=g-d,v=g+d,h=r+s-d,`M ${f} ${p} C ${g} ${p} ${g-u} ${m} ${v} ${m} H ${h}`)}const fo="4.6.0",J=document;function D({el:e,direction:t,locale:n,draggable:o,editable:i,contextMenu:r,toolBar:s,keypress:a,mouseSelectionButton:l,selectionContainer:c,before:d,newTopicName:p,allowUndo:h,generateMainBranch:m,generateSubBranch:f,overflowHidden:v,theme:g,alignment:u}){let b=null;const x=Object.prototype.toString.call(e);if(x==="[object HTMLDivElement]"?b=e:x==="[object String]"&&(b=document.querySelector(e)),!b)throw new Error("MindElixir: el is not a valid element");b.style.position="relative",b.innerHTML="",this.el=b,this.disposable=[],this.before=d||{},this.locale=n||"en",this.contextMenu=r===void 0?!0:r,this.toolBar=s===void 0?!0:s,this.keypress=a===void 0?!0:a,this.mouseSelectionButton=l||0,this.direction=typeof t=="number"?t:1,this.draggable=o===void 0?!0:o,this.newTopicName=p||"new node",this.editable=i===void 0?!0:i,this.allowUndo=h===void 0?!1:h,this.currentNode=null,this.currentArrow=null,this.scaleVal=1,this.tempDirection=null,this.generateMainBranch=m||uo,this.generateSubBranch=f||mo,this.overflowHidden=v||!1,this.bus=ot.create(),this.container=J.createElement("div"),this.selectionContainer=c||this.container,this.container.className="map-container";const E=window.matchMedia("(prefers-color-scheme: dark)");this.theme=g||(E.matches?$e:Oe);const y=J.createElement("div");y.className="map-canvas",this.map=y,this.map.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.el.appendChild(this.container),this.nodes=J.createElement("me-nodes"),this.nodes.className="main-node-container",this.lines=G("lines"),this.summarySvg=G("summary"),this.linkController=G("linkcontroller"),this.P2=J.createElement("div"),this.P3=J.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=Me(),this.line2=Me(),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=G("topiclinks"),this.alignment=u??"root",this.map.appendChild(this.nodes),this.overflowHidden?this.container.style.overflow="hidden":nt(this)}D.prototype=po;D.LEFT=T;D.RIGHT=O;D.SIDE=ce;D.THEME=Oe;D.DARK_THEME=$e;D.version=fo;D.E=C;D.new=e=>({nodeData:{id:q(),topic:e||"new topic",children:[]}});D.dragMoveHelper=k;export{D as default};