mind-elixir 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- var MindElixir=function(){"use strict";var bo=Object.defineProperty;var yo=(G,O,K)=>O in G?bo(G,O,{enumerable:!0,configurable:!0,writable:!0,value:K}):G[O]=K;var Q=(G,O,K)=>(yo(G,typeof O!="symbol"?O+"":O,K),K);const G="",he={name:"Latte",type:"light",palette:["#dd7878","#ea76cb","#8839ef","#e64553","#fe640b","#df8e1d","#40a02b","#209fb5","#1e66f5","#7287fd"],cssVar:{"--node-gap-x":"30px","--node-gap-y":"10px","--main-gap-x":"65px","--main-gap-y":"45px","--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","--map-padding":"50px"}},ue={name:"Dark",type:"dark",palette:["#848FA0","#748BE9","#D2F9FE","#4145A5","#789AFA","#706CF4","#EF987F","#775DD5","#FCEECF","#DA7FBC"],cssVar:{"--node-gap-x":"30px","--node-gap-y":"10px","--main-gap-x":"65px","--main-gap-y":"45px","--root-radius":"30px","--main-radius":"20px","--root-color":"#ffffff","--root-bgcolor":"#2d3748","--root-border-color":"rgba(255, 255, 255, 0.1)","--main-color":"#ffffff","--main-bgcolor":"#4c4f69","--topic-padding":"3px","--color":"#cccccc","--bgcolor":"#252526","--selected":"#4dc4ff","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969","--map-padding":"50px 80px"}};function ee(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}const te=function(e,t){if(t.id===e)return t;if(t.children&&t.children.length){for(let n=0;n<t.children.length;n++){const o=te(e,t.children[n]);if(o)return o}return null}else return null},j=(e,t)=>{if(e.parent=t,e.children)for(let n=0;n<e.children.length;n++)j(e.children[n],e)};function fe(e){if(e.id=R(),e.children)for(let t=0;t<e.children.length;t++)fe(e.children[t])}function ne(e,t,n,o){const i=o-t,s=e-n;let r=Math.atan(Math.abs(i)/Math.abs(s))/3.14*180;if(isNaN(r))return;s<0&&i>0&&(r=180-r),s<0&&i<0&&(r=180+r),s>0&&i<0&&(r=360-r);const c=12,u=30,a=r+u,f=r-u;return{x1:n+Math.cos(Math.PI*a/180)*c,y1:o-Math.sin(Math.PI*a/180)*c,x2:n+Math.cos(Math.PI*f/180)*c,y2:o-Math.sin(Math.PI*f/180)*c}}function R(){return(new Date().getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const ht=function(){const e=R();return{topic:this.newTopicName,id:e}};function pe(e){return JSON.parse(JSON.stringify(e,(n,o)=>{if(n!=="parent")return o}))}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}},E=(e,t)=>{for(const n in t)e.setAttribute(n,t[n])},ge=e=>e?e.tagName==="ME-TPC":!1,oe=e=>e.filter(t=>t.nodeObj.parent).filter((t,n,o)=>{for(let i=0;i<o.length;i++){if(t===o[i])continue;const{parent:s}=t.nodeObj;if(s===o[i].nodeObj)return!1}return!0}),ke=e=>{const t=/translate\(([^,]+),\s*([^)]+)\)/,n=e.match(t);return n?{x:parseFloat(n[1]),y:parseFloat(n[2])}:{x:0,y:0}},me=function(e){for(let t=0;t<e.length;t++){const{dom:n,evt:o,func:i}=e[t];n.addEventListener(o,i)}return function(){for(let n=0;n<e.length;n++){const{dom:o,evt:i,func:s}=e[n];o.removeEventListener(i,s)}}};var L=(e=>(e.LHS="lhs",e.RHS="rhs",e))(L||{});const ut=e=>{const t=e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},ft=e=>{const t=e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},pt=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},gt=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},mt=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Te=function(e,t){var s,r;const n=e.currentNode||((s=e.currentNodes)==null?void 0:s[0]);if(!n)return;const o=n.nodeObj,i=n.offsetParent.offsetParent.parentElement;o.parent?i.className===t?mt(e,n):(r=o.parent)!=null&&r.parent?gt(e,n):pt(e):t===L.LHS?ut(e):ft(e)},Ae=function(e,t){const n=e.currentNode;if(!n||!n.nodeObj.parent)return;const i=t+"Sibling",s=n.parentElement.parentElement[i];s?e.selectNode(s.firstChild.firstChild):e.selectNode(n)},ie=function(e,t,n){const{scaleVal:o,scaleSensitivity:i}=e;switch(t){case"in":if(o>1.6)return;e.scale(o+i,n);break;case"out":if(o<.6)return;e.scale(o-i,n)}};function vt(e,t){t=t===!0?{}:t;const n=()=>{e.currentArrow?e.removeArrow():e.currentSummary?e.removeSummary(e.currentSummary.summaryObj.id):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();Ae(e,"previous")}},ArrowDown:i=>{i.altKey?e.moveDownNode():Ae(e,"next")},ArrowLeft:i=>{if(i.metaKey||i.ctrlKey)return e.initLeft();Te(e,L.LHS)},ArrowRight:i=>{if(i.metaKey||i.ctrlKey)return e.initRight();Te(e,L.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},c:i=>{(i.metaKey||i.ctrlKey)&&(e.waitCopy=e.currentNodes)},x:i=>{(i.metaKey||i.ctrlKey)&&(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)&&ie(e,"in")},"-":i=>{(i.metaKey||i.ctrlKey)&&ie(e,"out")},0:i=>{(i.metaKey||i.ctrlKey)&&e.scale(1)},Delete:n,Backspace:n,...t};e.container.onkeydown=i=>{if(i.preventDefault(),!e.editable||i.target!==i.currentTarget)return;const s=o[i.key];s&&s(i)}}function bt(e){const{dragMoveHelper:t}=e,n=d=>{var m,v,b;if(d.button!==0)return;if((m=e.helper1)!=null&&m.moved){e.helper1.clear();return}if((v=e.helper2)!=null&&v.moved){e.helper2.clear();return}if(t.moved){t.clear();return}const l=d.target;if(l.tagName==="ME-EPD")d.ctrlKey||d.metaKey?e.expandNodeAll(l.previousSibling):e.expandNode(l.previousSibling);else if(l.tagName==="ME-TPC"&&e.currentNodes.length>1)e.selectNode(l);else if(!e.editable)return;const p=(b=l.parentElement)==null?void 0:b.parentElement;p.getAttribute("class")==="topiclinks"?e.selectArrow(l.parentElement):p.getAttribute("class")==="summary"&&e.selectSummary(l.parentElement)},o=d=>{var m;if(!e.editable)return;const l=d.target;ge(l)&&e.beginEdit(l);const p=(m=l.parentElement)==null?void 0:m.parentElement;p.getAttribute("class")==="topiclinks"?e.editArrowLabel(l.parentElement):p.getAttribute("class")==="summary"&&e.editSummary(l.parentElement)};let i=0;const s=d=>{if(d.pointerType==="mouse")return;const l=new Date().getTime(),p=l-i;p<300&&p>0&&o(d),i=l},r=d=>{t.moved=!1;const l=e.mouseSelectionButton===0?2:0;if(d.button!==l&&d.pointerType==="mouse")return;t.x=d.clientX,t.y=d.clientY;const p=d.target;p.className!=="circle"&&p.contentEditable!=="plaintext-only"&&(t.mousedown=!0,e.map.style.transition="none",p.setPointerCapture(d.pointerId))},c=d=>{if(d.target.contentEditable!=="plaintext-only"){const l=d.clientX-t.x,p=d.clientY-t.y;t.onMove(l,p)}t.x=d.clientX,t.y=d.clientY},u=d=>{const l=e.mouseSelectionButton===0?2:0;if(d.button!==l&&d.pointerType==="mouse")return;const p=d.target;p.hasPointerCapture&&p.hasPointerCapture(d.pointerId)&&p.releasePointerCapture(d.pointerId),t.clear()},a=d=>{if(d.preventDefault(),d.button!==2||!e.editable)return;const l=d.target;ge(l)&&!l.classList.contains("selected")&&e.selectNode(l),setTimeout(()=>{e.dragMoveHelper.moved||e.bus.fire("showContextMenu",d)},200)},f=d=>{d.stopPropagation(),d.preventDefault(),d.ctrlKey||d.metaKey?d.deltaY<0?ie(e,"in",e.dragMoveHelper):e.scaleVal-e.scaleSensitivity>0&&ie(e,"out",e.dragMoveHelper):d.shiftKey?e.move(-d.deltaY,0):(e.map.style.transition="none",e.move(-d.deltaX,-d.deltaY),e.map.style.transition="transform 0.3s")},{container:h}=e;return me([{dom:h,evt:"pointerdown",func:r},{dom:h,evt:"pointermove",func:c},{dom:h,evt:"pointerup",func:u},{dom:h,evt:"pointerup",func:s},{dom:h,evt:"click",func:n},{dom:h,evt:"dblclick",func:o},{dom:h,evt:"contextmenu",func:a},{dom:h,evt:"wheel",func:f}])}function yt(){return{handlers:{},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<n.length;o++)n[o](...t)}},removeListener:function(e,t){if(!this.handlers[e])return;const n=this.handlers[e];if(!t)n.length=0;else if(n.length)for(let o=0;o<n.length;o++)n[o]===t&&this.handlers[e].splice(o,1)}}}const se=document,wt=function(){this.nodes.innerHTML="";const e=this.createTopic(this.nodeData);ve(e,this.nodeData),e.draggable=!1;const t=se.createElement("me-root");t.appendChild(e);const n=this.nodeData.children||[];if(this.direction===2){let o=0,i=0;n.map(s=>{s.direction===0?o+=1:s.direction===1?i+=1:o<=i?(s.direction=0,o+=1):(s.direction=1,i+=1)})}xt(this,n,t)},xt=function(e,t,n){const o=se.createElement("me-main");o.className=L.LHS;const i=se.createElement("me-main");i.className=L.RHS;for(let s=0;s<t.length;s++){const r=t[s],{grp:c}=e.createWrapper(r);e.direction===2?r.direction===0?o.appendChild(c):i.appendChild(c):e.direction===0?o.appendChild(c):i.appendChild(c)}e.nodes.appendChild(o),e.nodes.appendChild(n),e.nodes.appendChild(i),e.nodes.appendChild(e.lines)},Et=function(e,t){const n=se.createElement("me-children");for(let o=0;o<t.length;o++){const i=t[o],{grp:s}=e.createWrapper(i);n.appendChild(s)}return n},A=document,Le=function(e,t){const o=(this!=null&&this.el?this.el:t||document).querySelector(`[data-nodeid=me${e}]`);if(!o)throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);return o},ve=function(e,t){if(e.innerHTML="",t.style){const n=t.style;for(const o in n)e.style[o]=n[o]}if(t.dangerouslySetInnerHTML){e.innerHTML=t.dangerouslySetInnerHTML;return}if(t.image){const n=t.image;if(n.url&&n.width&&n.height){const o=A.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=A.createElement("span");n.className="text",n.textContent=t.topic,e.appendChild(n),e.text=n}if(t.hyperLink){const n=A.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=A.createElement("span");n.className="icons",n.innerHTML=t.icons.map(o=>`<span>${ee(o)}</span>`).join(""),e.appendChild(n),e.icons=n}else e.icons&&(e.icons=void 0);if(t.tags&&t.tags.length){const n=A.createElement("div");n.className="tags",n.innerHTML=t.tags.map(o=>`<span>${ee(o)}</span>`).join(""),e.appendChild(n),e.tags=n}else e.tags&&(e.tags=void 0)},St=function(e,t){const n=A.createElement("me-wrapper"),{p:o,tpc:i}=this.createParent(e);if(n.appendChild(o),!t&&e.children&&e.children.length>0){const s=be(e.expanded);if(o.appendChild(s),e.expanded!==!1){const r=Et(this,e.children);n.appendChild(r)}}return{grp:n,top:o,tpc:i}},Ct=function(e){const t=A.createElement("me-parent"),n=this.createTopic(e);return ve(n,e),t.appendChild(n),{p:t,tpc:n}},Nt=function(e){const t=A.createElement("me-children");return t.append(...e),t},_t=function(e){const t=A.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t.draggable=this.draggable,t};function Me(e){const t=A.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const kt=function(e){if(!e)return;const t=A.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;
1
+ var MindElixir=function(){"use strict";var bo=Object.defineProperty;var yo=(G,O,K)=>O in G?bo(G,O,{enumerable:!0,configurable:!0,writable:!0,value:K}):G[O]=K;var Q=(G,O,K)=>(yo(G,typeof O!="symbol"?O+"":O,K),K);const G="",ue={name:"Latte",type:"light",palette:["#dd7878","#ea76cb","#8839ef","#e64553","#fe640b","#df8e1d","#40a02b","#209fb5","#1e66f5","#7287fd"],cssVar:{"--node-gap-x":"30px","--node-gap-y":"10px","--main-gap-x":"65px","--main-gap-y":"45px","--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","--map-padding":"50px"}},fe={name:"Dark",type:"dark",palette:["#848FA0","#748BE9","#D2F9FE","#4145A5","#789AFA","#706CF4","#EF987F","#775DD5","#FCEECF","#DA7FBC"],cssVar:{"--node-gap-x":"30px","--node-gap-y":"10px","--main-gap-x":"65px","--main-gap-y":"45px","--root-radius":"30px","--main-radius":"20px","--root-color":"#ffffff","--root-bgcolor":"#2d3748","--root-border-color":"rgba(255, 255, 255, 0.1)","--main-color":"#ffffff","--main-bgcolor":"#4c4f69","--topic-padding":"3px","--color":"#cccccc","--bgcolor":"#252526","--selected":"#4dc4ff","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969","--map-padding":"50px 80px"}};function ee(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}const te=function(e,t){if(t.id===e)return t;if(t.children&&t.children.length){for(let n=0;n<t.children.length;n++){const o=te(e,t.children[n]);if(o)return o}return null}else return null},j=(e,t)=>{if(e.parent=t,e.children)for(let n=0;n<e.children.length;n++)j(e.children[n],e)};function pe(e){if(e.id=R(),e.children)for(let t=0;t<e.children.length;t++)pe(e.children[t])}function ne(e,t,n,o){const i=o-t,s=e-n;let r=Math.atan(Math.abs(i)/Math.abs(s))/3.14*180;if(isNaN(r))return;s<0&&i>0&&(r=180-r),s<0&&i<0&&(r=180+r),s>0&&i<0&&(r=360-r);const c=12,u=30,a=r+u,f=r-u;return{x1:n+Math.cos(Math.PI*a/180)*c,y1:o-Math.sin(Math.PI*a/180)*c,x2:n+Math.cos(Math.PI*f/180)*c,y2:o-Math.sin(Math.PI*f/180)*c}}function R(){return(new Date().getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const ht=function(){const e=R();return{topic:this.newTopicName,id:e}};function ge(e){return JSON.parse(JSON.stringify(e,(n,o)=>{if(n!=="parent")return o}))}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}},E=(e,t)=>{for(const n in t)e.setAttribute(n,t[n])},me=e=>e?e.tagName==="ME-TPC":!1,oe=e=>e.filter(t=>t.nodeObj.parent).filter((t,n,o)=>{for(let i=0;i<o.length;i++){if(t===o[i])continue;const{parent:s}=t.nodeObj;if(s===o[i].nodeObj)return!1}return!0}),ke=e=>{const t=/translate\(([^,]+),\s*([^)]+)\)/,n=e.match(t);return n?{x:parseFloat(n[1]),y:parseFloat(n[2])}:{x:0,y:0}},ve=function(e){for(let t=0;t<e.length;t++){const{dom:n,evt:o,func:i}=e[t];n.addEventListener(o,i)}return function(){for(let n=0;n<e.length;n++){const{dom:o,evt:i,func:s}=e[n];o.removeEventListener(i,s)}}};var L=(e=>(e.LHS="lhs",e.RHS="rhs",e))(L||{});const ut=e=>{const t=e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},ft=e=>{const t=e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},pt=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},gt=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},mt=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Te=function(e,t){var s,r;const n=e.currentNode||((s=e.currentNodes)==null?void 0:s[0]);if(!n)return;const o=n.nodeObj,i=n.offsetParent.offsetParent.parentElement;o.parent?i.className===t?mt(e,n):(r=o.parent)!=null&&r.parent?gt(e,n):pt(e):t===L.LHS?ut(e):ft(e)},Ae=function(e,t){const n=e.currentNode;if(!n||!n.nodeObj.parent)return;const i=t+"Sibling",s=n.parentElement.parentElement[i];s?e.selectNode(s.firstChild.firstChild):e.selectNode(n)},ie=function(e,t,n){const{scaleVal:o,scaleSensitivity:i}=e;switch(t){case"in":if(o>1.6)return;e.scale(o+i,n);break;case"out":if(o<.6)return;e.scale(o-i,n)}};function vt(e,t){t=t===!0?{}:t;const n=()=>{e.currentArrow?e.removeArrow():e.currentSummary?e.removeSummary(e.currentSummary.summaryObj.id):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();Ae(e,"previous")}},ArrowDown:i=>{i.altKey?e.moveDownNode():Ae(e,"next")},ArrowLeft:i=>{if(i.metaKey||i.ctrlKey)return e.initLeft();Te(e,L.LHS)},ArrowRight:i=>{if(i.metaKey||i.ctrlKey)return e.initRight();Te(e,L.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},c:i=>{(i.metaKey||i.ctrlKey)&&(e.waitCopy=e.currentNodes)},x:i=>{(i.metaKey||i.ctrlKey)&&(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)&&ie(e,"in")},"-":i=>{(i.metaKey||i.ctrlKey)&&ie(e,"out")},0:i=>{(i.metaKey||i.ctrlKey)&&e.scale(1)},Delete:n,Backspace:n,...t};e.container.onkeydown=i=>{if(i.preventDefault(),!e.editable)return;const s=o[i.key];s&&s(i)}}function bt(e){const{dragMoveHelper:t}=e,n=d=>{var m,v,b;if(d.button!==0)return;if((m=e.helper1)!=null&&m.moved){e.helper1.clear();return}if((v=e.helper2)!=null&&v.moved){e.helper2.clear();return}if(t.moved){t.clear();return}const l=d.target;if(l.tagName==="ME-EPD")d.ctrlKey||d.metaKey?e.expandNodeAll(l.previousSibling):e.expandNode(l.previousSibling);else if(l.tagName==="ME-TPC"&&e.currentNodes.length>1)e.selectNode(l);else if(!e.editable)return;const p=(b=l.parentElement)==null?void 0:b.parentElement;p.getAttribute("class")==="topiclinks"?e.selectArrow(l.parentElement):p.getAttribute("class")==="summary"&&e.selectSummary(l.parentElement)},o=d=>{var m;if(!e.editable)return;const l=d.target;me(l)&&e.beginEdit(l);const p=(m=l.parentElement)==null?void 0:m.parentElement;p.getAttribute("class")==="topiclinks"?e.editArrowLabel(l.parentElement):p.getAttribute("class")==="summary"&&e.editSummary(l.parentElement)};let i=0;const s=d=>{if(d.pointerType==="mouse")return;const l=new Date().getTime(),p=l-i;p<300&&p>0&&o(d),i=l},r=d=>{t.moved=!1;const l=e.mouseSelectionButton===0?2:0;if(d.button!==l&&d.pointerType==="mouse")return;t.x=d.clientX,t.y=d.clientY;const p=d.target;p.className!=="circle"&&p.contentEditable!=="plaintext-only"&&(t.mousedown=!0,e.map.style.transition="none",p.setPointerCapture(d.pointerId))},c=d=>{if(d.target.contentEditable!=="plaintext-only"){const l=d.clientX-t.x,p=d.clientY-t.y;t.onMove(l,p)}t.x=d.clientX,t.y=d.clientY},u=d=>{const l=e.mouseSelectionButton===0?2:0;if(d.button!==l&&d.pointerType==="mouse")return;const p=d.target;p.hasPointerCapture&&p.hasPointerCapture(d.pointerId)&&p.releasePointerCapture(d.pointerId),t.clear()},a=d=>{if(d.preventDefault(),d.button!==2||!e.editable)return;const l=d.target;me(l)&&!l.classList.contains("selected")&&e.selectNode(l),setTimeout(()=>{e.dragMoveHelper.moved||e.bus.fire("showContextMenu",d)},200)},f=d=>{d.stopPropagation(),d.preventDefault(),d.ctrlKey||d.metaKey?d.deltaY<0?ie(e,"in",e.dragMoveHelper):e.scaleVal-e.scaleSensitivity>0&&ie(e,"out",e.dragMoveHelper):d.shiftKey?e.move(-d.deltaY,0):(e.map.style.transition="none",e.move(-d.deltaX,-d.deltaY),e.map.style.transition="transform 0.3s")},{container:h}=e;return ve([{dom:h,evt:"pointerdown",func:r},{dom:h,evt:"pointermove",func:c},{dom:h,evt:"pointerup",func:u},{dom:h,evt:"pointerup",func:s},{dom:h,evt:"click",func:n},{dom:h,evt:"dblclick",func:o},{dom:h,evt:"contextmenu",func:a},{dom:h,evt:"wheel",func:f}])}function yt(){return{handlers:{},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<n.length;o++)n[o](...t)}},removeListener:function(e,t){if(!this.handlers[e])return;const n=this.handlers[e];if(!t)n.length=0;else if(n.length)for(let o=0;o<n.length;o++)n[o]===t&&this.handlers[e].splice(o,1)}}}const se=document,wt=function(){this.nodes.innerHTML="";const e=this.createTopic(this.nodeData);be(e,this.nodeData),e.draggable=!1;const t=se.createElement("me-root");t.appendChild(e);const n=this.nodeData.children||[];if(this.direction===2){let o=0,i=0;n.map(s=>{s.direction===0?o+=1:s.direction===1?i+=1:o<=i?(s.direction=0,o+=1):(s.direction=1,i+=1)})}xt(this,n,t)},xt=function(e,t,n){const o=se.createElement("me-main");o.className=L.LHS;const i=se.createElement("me-main");i.className=L.RHS;for(let s=0;s<t.length;s++){const r=t[s],{grp:c}=e.createWrapper(r);e.direction===2?r.direction===0?o.appendChild(c):i.appendChild(c):e.direction===0?o.appendChild(c):i.appendChild(c)}e.nodes.appendChild(o),e.nodes.appendChild(n),e.nodes.appendChild(i),e.nodes.appendChild(e.lines)},Et=function(e,t){const n=se.createElement("me-children");for(let o=0;o<t.length;o++){const i=t[o],{grp:s}=e.createWrapper(i);n.appendChild(s)}return n},A=document,Le=function(e,t){const o=(this!=null&&this.el?this.el:t||document).querySelector(`[data-nodeid="me${e}"]`);if(!o)throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);return o},be=function(e,t){if(e.innerHTML="",t.style){const n=t.style;for(const o in n)e.style[o]=n[o]}if(t.dangerouslySetInnerHTML){e.innerHTML=t.dangerouslySetInnerHTML;return}if(t.image){const n=t.image;if(n.url&&n.width&&n.height){const o=A.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=A.createElement("span");n.className="text",n.textContent=t.topic,e.appendChild(n),e.text=n}if(t.hyperLink){const n=A.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=A.createElement("span");n.className="icons",n.innerHTML=t.icons.map(o=>`<span>${ee(o)}</span>`).join(""),e.appendChild(n),e.icons=n}else e.icons&&(e.icons=void 0);if(t.tags&&t.tags.length){const n=A.createElement("div");n.className="tags",n.innerHTML=t.tags.map(o=>`<span>${ee(o)}</span>`).join(""),e.appendChild(n),e.tags=n}else e.tags&&(e.tags=void 0)},St=function(e,t){const n=A.createElement("me-wrapper"),{p:o,tpc:i}=this.createParent(e);if(n.appendChild(o),!t&&e.children&&e.children.length>0){const s=ye(e.expanded);if(o.appendChild(s),e.expanded!==!1){const r=Et(this,e.children);n.appendChild(r)}}return{grp:n,top:o,tpc:i}},Ct=function(e){const t=A.createElement("me-parent"),n=this.createTopic(e);return be(n,e),t.appendChild(n),{p:t,tpc:n}},Nt=function(e){const t=A.createElement("me-children");return t.append(...e),t},_t=function(e){const t=A.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t.draggable=this.draggable,t};function Me(e){const t=A.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const kt=function(e){if(!e)return;const t=A.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;
2
2
  color:${o.color};
3
3
  padding:${o.padding};
4
4
  margin:${o.margin};
5
5
  font:${o.font};
6
6
  background-color:${o.backgroundColor!=="rgba(0, 0, 0, 0)"&&o.backgroundColor};
7
- border-radius:${o.borderRadius};`,this.direction===0&&(t.style.right="0"),Me(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",i=>{i.stopPropagation();const s=i.key;if(s==="Enter"||s==="Tab"){if(i.shiftKey)return;i.preventDefault(),t.blur(),this.container.focus()}}),t.addEventListener("blur",()=>{var r;if(!t)return;const i=e.nodeObj,s=((r=t.textContent)==null?void 0:r.trim())||"";s===""?i.topic=n:i.topic=s,t.remove(),s!==n&&(e.text.textContent=i.topic,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:i,origin:n}))})},be=function(e){const t=A.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},F=document,k="http://www.w3.org/2000/svg",De=function(e,t,n){const o=F.createElementNS(k,"path");return E(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},X=function(e){const t=F.createElementNS(k,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},Oe=function(){const e=F.createElementNS(k,"line");return e.setAttribute("stroke","#4dc4ff"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e.setAttribute("opacity","0.45"),e},Tt=function(e,t,n,o){const i=F.createElementNS(k,"g");return[{name:"line",d:e},{name:"arrow1",d:t},{name:"arrow2",d:n}].forEach((r,c)=>{const u=r.d,a=F.createElementNS(k,"path"),f={d:u,stroke:(o==null?void 0:o.stroke)||"rgb(235, 95, 82)",fill:"none","stroke-linecap":(o==null?void 0:o.strokeLinecap)||"cap","stroke-width":String((o==null?void 0:o.strokeWidth)||"2")};(o==null?void 0:o.opacity)!==void 0&&(f.opacity=String(o.opacity)),E(a,f),c===0&&a.setAttribute("stroke-dasharray",(o==null?void 0:o.strokeDasharray)||"8,2");const h=F.createElementNS(k,"path");E(h,{d:u,stroke:"transparent",fill:"none","stroke-width":"15"}),i.appendChild(h),i.appendChild(a),i[r.name]=a}),i},je=function(e,t,n){if(!t)return;const o=F.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 s=t.getBBox();o.style.cssText=`
7
+ border-radius:${o.borderRadius};`,this.direction===0&&(t.style.right="0"),Me(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",i=>{i.stopPropagation();const s=i.key;if(s==="Enter"||s==="Tab"){if(i.shiftKey)return;i.preventDefault(),t.blur(),this.container.focus()}}),t.addEventListener("blur",()=>{var r;if(!t)return;const i=e.nodeObj,s=((r=t.textContent)==null?void 0:r.trim())||"";s===""?i.topic=n:i.topic=s,t.remove(),s!==n&&(e.text.textContent=i.topic,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:i,origin:n}))})},ye=function(e){const t=A.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},F=document,k="http://www.w3.org/2000/svg",De=function(e,t,n){const o=F.createElementNS(k,"path");return E(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},X=function(e){const t=F.createElementNS(k,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},Oe=function(){const e=F.createElementNS(k,"line");return e.setAttribute("stroke","#4dc4ff"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e.setAttribute("opacity","0.45"),e},Tt=function(e,t,n,o){const i=F.createElementNS(k,"g");return[{name:"line",d:e},{name:"arrow1",d:t},{name:"arrow2",d:n}].forEach((r,c)=>{const u=r.d,a=F.createElementNS(k,"path"),f={d:u,stroke:(o==null?void 0:o.stroke)||"rgb(235, 95, 82)",fill:"none","stroke-linecap":(o==null?void 0:o.strokeLinecap)||"cap","stroke-width":String((o==null?void 0:o.strokeWidth)||"2")};(o==null?void 0:o.opacity)!==void 0&&(f.opacity=String(o.opacity)),E(a,f),c===0&&a.setAttribute("stroke-dasharray",(o==null?void 0:o.strokeDasharray)||"8,2");const h=F.createElementNS(k,"path");E(h,{d:u,stroke:"transparent",fill:"none","stroke-width":"15"}),i.appendChild(h),i.appendChild(a),i[r.name]=a}),i},je=function(e,t,n){if(!t)return;const o=F.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 s=t.getBBox();o.style.cssText=`
8
8
  min-width:${Math.max(88,s.width)}px;
9
9
  position:absolute;
10
10
  left:${s.x}px;
11
11
  top:${s.y}px;
12
12
  padding: 2px 4px;
13
13
  margin: -2px -4px;
14
- `,Me(o),e.scrollIntoView(o),o.addEventListener("keydown",r=>{r.stopPropagation();const c=r.key;if(c==="Enter"||c==="Tab"){if(r.shiftKey)return;r.preventDefault(),o.blur(),e.container.focus()}}),o.addEventListener("blur",()=>{var c;if(!o)return;const r=((c=o.textContent)==null?void 0:c.trim())||"";r===""?n.label=i:n.label=r,o.remove(),r!==i&&(t.innerHTML=n.label,e.linkDiv(),"parent"in n?e.bus.fire("operation",{name:"finishEditSummary",obj:n}):e.bus.fire("operation",{name:"finishEditArrowLabel",obj:n}))})},At=function(e){const t=this.map.querySelector("me-root"),n=t.offsetTop,o=t.offsetLeft,i=t.offsetWidth,s=t.offsetHeight,r=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="";for(let c=0;c<r.length;c++){const u=r[c],a=u.querySelector("me-tpc"),{offsetLeft:f,offsetTop:h}=P(this.nodes,a),g=a.offsetWidth,d=a.offsetHeight,l=u.parentNode.className,p=this.generateMainBranch({pT:n,pL:o,pW:i,pH:s,cT:h,cL:f,cW:g,cH:d,direction:l,containerHeight:this.nodes.offsetHeight}),m=this.theme.palette,v=a.nodeObj.branchColor||m[c%m.length];if(a.style.borderColor=v,this.lines.appendChild(De(p,v,"3")),e&&e!==u)continue;const b=X("subLines"),y=u.lastChild;y.tagName==="svg"&&y.remove(),u.appendChild(b),Pe(this,b,v,u,l,!0)}this.renderArrow(),this.renderSummary(),this.bus.fire("linkDiv")},Pe=function(e,t,n,o,i,s){const r=o.firstChild,c=o.children[1].children;if(c.length===0)return;const u=r.offsetTop,a=r.offsetLeft,f=r.offsetWidth,h=r.offsetHeight;for(let g=0;g<c.length;g++){const d=c[g],l=d.firstChild,p=l.offsetTop,m=l.offsetLeft,v=l.offsetWidth,b=l.offsetHeight,y=l.firstChild.nodeObj.branchColor||n,S=e.generateSubBranch({pT:u,pL:a,pW:f,pH:h,cT:p,cL:m,cW:v,cH:b,direction:i,isFirst:s});t.appendChild(De(S,y,"2"));const N=l.children[1];if(N){if(!N.expanded)continue}else continue;Pe(e,t,y,d,i)}},$e={addChild:"插入子节点",addParent:"插入父节点",addSibling:"插入同级节点",removeNode:"删除节点",focus:"专注",cancelFocus:"取消专注",moveUp:"上移",moveDown:"下移",link:"连接",clickTips:"请点击目标节点",summary:"摘要"},He={cn:$e,zh_CN:$e,zh_TW:{addChild:"插入子節點",addParent:"插入父節點",addSibling:"插入同級節點",removeNode:"刪除節點",focus:"專注",cancelFocus:"取消專注",moveUp:"上移",moveDown:"下移",link:"連接",clickTips:"請點擊目標節點",summary:"摘要"},en:{addChild:"Add child",addParent:"Add parent",addSibling:"Add sibling",removeNode:"Remove node",focus:"Focus Mode",cancelFocus:"Cancel Focus Mode",moveUp:"Move up",moveDown:"Move down",link:"Link",clickTips:"Please click the target node",summary:"Summary"},ru:{addChild:"Добавить дочерний элемент",addParent:"Добавить родительский элемент",addSibling:"Добавить на этом уровне",removeNode:"Удалить узел",focus:"Режим фокусировки",cancelFocus:"Отменить режим фокусировки",moveUp:"Поднять выше",moveDown:"Опустить ниже",link:"Ссылка",clickTips:"Пожалуйста, нажмите на целевой узел",summary:"Описание"},ja:{addChild:"子ノードを追加する",addParent:"親ノードを追加します",addSibling:"兄弟ノードを追加する",removeNode:"ノードを削除",focus:"集中",cancelFocus:"集中解除",moveUp:"上へ移動",moveDown:"下へ移動",link:"コネクト",clickTips:"ターゲットノードをクリックしてください",summary:"概要"},pt:{addChild:"Adicionar item filho",addParent:"Adicionar item pai",addSibling:"Adicionar item irmao",removeNode:"Remover item",focus:"Modo Foco",cancelFocus:"Cancelar Modo Foco",moveUp:"Mover para cima",moveDown:"Mover para baixo",link:"Link",clickTips:"Favor clicar no item alvo",summary:"Resumo"},it:{addChild:"Aggiungi figlio",addParent:"Aggiungi genitore",addSibling:"Aggiungi fratello",removeNode:"Rimuovi nodo",focus:"Modalità Focus",cancelFocus:"Annulla Modalità Focus",moveUp:"Sposta su",moveDown:"Sposta giù",link:"Collega",clickTips:"Si prega di fare clic sul nodo di destinazione",summary:"Unisci nodi"},es:{addChild:"Agregar hijo",addParent:"Agregar padre",addSibling:"Agregar hermano",removeNode:"Eliminar nodo",focus:"Modo Enfoque",cancelFocus:"Cancelar Modo Enfoque",moveUp:"Mover hacia arriba",moveDown:"Mover hacia abajo",link:"Enlace",clickTips:"Por favor haga clic en el nodo de destino",summary:"Resumen"},fr:{addChild:"Ajout enfant",addParent:"Ajout parent",addSibling:"Ajout voisin",removeNode:"Supprimer",focus:"Cibler",cancelFocus:"Retour",moveUp:"Monter",moveDown:"Descendre",link:"Lier",clickTips:"Cliquer sur le noeud cible",summary:"Annoter"},ko:{addChild:"자식 추가",addParent:"부모 추가",addSibling:"형제 추가",removeNode:"노드 삭제",focus:"포커스 모드",cancelFocus:"포커스 모드 취소",moveUp:"위로 이동",moveDown:"아래로 이동",link:"연결",clickTips:"대상 노드를 클릭하십시오",summary:"요약"}},xo="";function Lt(e,t){t=t===!0?{focus:!0,link:!0}:t;const n=w=>{const x=document.createElement("div");return x.innerText=w,x.className="tips",x},o=(w,x,C)=>{const _=document.createElement("li");return _.id=w,_.innerHTML=`<span>${ee(x)}</span><span ${C?'class="key"':""}>${ee(C)}</span>`,_},i=He[e.locale]?e.locale:"en",s=He[i],r=o("cm-add_child",s.addChild,"Tab"),c=o("cm-add_parent",s.addParent,"Ctrl + Enter"),u=o("cm-add_sibling",s.addSibling,"Enter"),a=o("cm-remove_child",s.removeNode,"Delete"),f=o("cm-fucus",s.focus,""),h=o("cm-unfucus",s.cancelFocus,""),g=o("cm-up",s.moveUp,"PgUp"),d=o("cm-down",s.moveDown,"Pgdn"),l=o("cm-link",s.link,""),p=o("cm-link-bidirectional","Bidirectional Link",""),m=o("cm-summary",s.summary,""),v=document.createElement("ul");if(v.className="menu-list",v.appendChild(r),v.appendChild(c),v.appendChild(u),v.appendChild(a),t.focus&&(v.appendChild(f),v.appendChild(h)),v.appendChild(g),v.appendChild(d),v.appendChild(m),t.link&&(v.appendChild(l),v.appendChild(p)),t&&t.extend)for(let w=0;w<t.extend.length;w++){const x=t.extend[w],C=o(x.name,x.name,x.key||"");v.appendChild(C),C.onclick=_=>{x.onclick(_)}}const b=document.createElement("div");b.className="context-menu",b.appendChild(v),b.hidden=!0,e.container.append(b);let y=!0;const S=w=>{const x=w.target;if(ge(x)){x.parentElement.tagName==="ME-ROOT"?y=!0:y=!1,y?(f.className="disabled",g.className="disabled",d.className="disabled",c.className="disabled",u.className="disabled",a.className="disabled"):(f.className="",g.className="",d.className="",c.className="",u.className="",a.className=""),b.hidden=!1,v.style.top="",v.style.bottom="",v.style.left="",v.style.right="";const C=v.getBoundingClientRect(),_=v.offsetHeight,B=v.offsetWidth,V=w.clientY-C.top,Y=w.clientX-C.left;_+V>window.innerHeight?(v.style.top="",v.style.bottom="0px"):(v.style.bottom="",v.style.top=V+15+"px"),B+Y>window.innerWidth?(v.style.left="",v.style.right="0px"):(v.style.right="",v.style.left=Y+10+"px")}};e.bus.addListener("showContextMenu",S),b.onclick=w=>{w.target===b&&(b.hidden=!0)},r.onclick=()=>{e.addChild(),b.hidden=!0},c.onclick=()=>{e.insertParent(),b.hidden=!0},u.onclick=()=>{y||(e.insertSibling("after"),b.hidden=!0)},a.onclick=()=>{y||(e.removeNodes(e.currentNodes||[]),b.hidden=!0)},f.onclick=()=>{y||(e.focusNode(e.currentNode),b.hidden=!0)},h.onclick=()=>{e.cancelFocus(),b.hidden=!0},g.onclick=()=>{y||(e.moveUpNode(),b.hidden=!0)},d.onclick=()=>{y||(e.moveDownNode(),b.hidden=!0)};const N=w=>{b.hidden=!0;const x=e.currentNode,C=n(s.clickTips);e.container.appendChild(C),e.map.addEventListener("click",_=>{_.preventDefault(),C.remove();const B=_.target;(B.parentElement.tagName==="ME-PARENT"||B.parentElement.tagName==="ME-ROOT")&&e.createArrow(x,B,w)},{once:!0})};return l.onclick=()=>N(),p.onclick=()=>N({bidirectional:!0}),m.onclick=()=>{b.hidden=!0,e.createSummary(),e.unselectNodes(e.currentNodes)},()=>{r.onclick=null,c.onclick=null,u.onclick=null,a.onclick=null,f.onclick=null,h.onclick=null,g.onclick=null,d.onclick=null,l.onclick=null,m.onclick=null,b.onclick=null,e.container.oncontextmenu=null}}const ye=document,Mt=function(e,t){if(!t)return we(e),e;let n=e.querySelector(".insert-preview");const o=`insert-preview ${t} show`;return n||(n=ye.createElement("div"),e.appendChild(n)),n.className=o,e},we=function(e){if(!e)return;const t=e.querySelectorAll(".insert-preview");for(const n of t||[])n.remove()},Be=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},Dt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.container.appendChild(t),t};class Ot{constructor(t){Q(this,"mind");Q(this,"isMoving",!1);Q(this,"interval",null);Q(this,"speed",20);this.mind=t}move(t,n){this.isMoving||(this.isMoving=!0,this.interval=setInterval(()=>{this.mind.move(t*this.speed*this.mind.scaleVal,n*this.speed*this.mind.scaleVal)},100))}stop(){this.isMoving=!1,clearInterval(this.interval)}}function jt(e){let t=null,n=null;const o=Dt(e),i=new Ot(e),s=a=>{e.selection.cancel();const f=a.target;if((f==null?void 0:f.tagName)!=="ME-TPC"){a.preventDefault();return}let h=e.currentNodes;h!=null&&h.includes(f)||(e.selectNode(f),h=e.currentNodes),e.dragged=h,h.length>1?o.innerHTML=h.length+"":o.innerHTML=f.innerHTML;for(const g of h)g.parentElement.parentElement.style.opacity="0.5";a.dataTransfer.setDragImage(o,0,0),a.dataTransfer.dropEffect="move",e.dragMoveHelper.clear()},r=a=>{const{dragged:f}=e;if(!f)return;i.stop();for(const g of f)g.parentElement.parentElement.style.opacity="1";const h=a.target;h.style.opacity="",n&&(we(n),t==="before"?e.moveNodeBefore(f,n):t==="after"?e.moveNodeAfter(f,n):t==="in"&&e.moveNodeIn(f,n),e.dragged=null)},c=a=>{a.preventDefault();const f=12*e.scaleVal,{dragged:h}=e;if(!h)return;const g=e.container.getBoundingClientRect();a.clientX<g.x+50?i.move(1,0):a.clientX>g.x+g.width-50?i.move(-1,0):a.clientY<g.y+50?i.move(0,1):a.clientY>g.y+g.height-50?i.move(0,-1):i.stop(),we(n);const d=ye.elementFromPoint(a.clientX,a.clientY-f);if(Be(d,h)){n=d;const l=d.getBoundingClientRect(),p=l.y;a.clientY>p+l.height?t="after":t="in"}else{const l=ye.elementFromPoint(a.clientX,a.clientY+f),p=l.getBoundingClientRect();if(Be(l,h)){n=l;const m=p.y;a.clientY<m?t="before":t="in"}else t=n=null}n&&Mt(n,t)};return me([{dom:e.map,evt:"dragstart",func:s},{dom:e.map,evt:"dragend",func:r},{dom:e.map,evt:"dragover",func:c}])}const Pt=function(e){return["createSummary","removeSummary","finishEditSummary"].includes(e.name)?{type:"summary",value:e.obj.id}:["createArrow","removeArrow","finishEditArrowLabel"].includes(e.name)?{type:"arrow",value:e.obj.id}:["removeNodes","copyNodes","moveNodeBefore","moveNodeAfter","moveNodeIn"].includes(e.name)?{type:"nodes",value:e.objs.map(t=>t.id)}:{type:"node",value:e.obj.id}};function $t(e){let t=[],n=-1,o=e.getData();e.undo=function(){if(n>-1){const r=t[n];o=r.prev,e.refresh(r.prev);try{r.currentObject.type==="node"?e.selectNode(this.findEle(r.currentObject.value)):r.currentObject.type==="nodes"&&e.selectNodes(r.currentObject.value.map(c=>this.findEle(c)))}catch{}finally{n--}}},e.redo=function(){if(n<t.length-1){n++;const r=t[n];o=r.next,e.refresh(r.next),r.currentObject.type==="node"?e.selectNode(this.findEle(r.currentObject.value)):r.currentObject.type==="nodes"&&(e.unselectNodes(this.currentNodes),e.selectNodes(r.currentObject.value.map(c=>this.findEle(c))))}};const i=function(r){if(r.name==="beginEdit")return;t=t.slice(0,n+1);const c=e.getData();t.push({prev:o,currentObject:Pt(r),next:c}),o=c,n=t.length-1},s=function(r){(r.metaKey||r.ctrlKey)&&(r.shiftKey&&r.key==="Z"||r.key==="y")?e.redo():(r.metaKey||r.ctrlKey)&&r.key==="z"&&e.undo()};return e.bus.addListener("operation",i),e.map.addEventListener("keydown",s),()=>{e.bus.removeListener("operation",i),e.map.removeEventListener("keydown",s)}}const Ht='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>',Bt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>',Rt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>',Ft='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>',It='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>',Wt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>',Vt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>',Eo="",Yt={side:Ht,left:Bt,right:Rt,full:Ft,living:It,zoomin:Wt,zoomout:Vt},I=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=Yt[t],n};function Gt(e){const t=document.createElement("div"),n=I("fullscreen","full"),o=I("toCenter","living"),i=I("zoomout","zoomout"),s=I("zoomin","zoomin"),r=document.createElement("span");return r.innerText="100%",t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(s),t.className="mind-elixir-toolbar rb",n.onclick=()=>{document.fullscreenElement===e.el?document.exitFullscreen():e.el.requestFullscreen()},o.onclick=()=>{e.toCenter()},i.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-e.scaleSensitivity)},s.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+e.scaleSensitivity)},t}function Kt(e){const t=document.createElement("div"),n=I("tbltl","left"),o=I("tbltr","right"),i=I("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 qt(e){e.container.append(Gt(e)),e.container.append(Kt(e))}/*! @viselect/vanilla v3.9.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */class zt{constructor(){this._listeners=new Map,this.on=this.addEventListener,this.off=this.removeEventListener,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 Re=(e,t="px")=>typeof e=="number"?e+t:e,$=({style:e},t,n)=>{if(typeof t=="object")for(const[o,i]of Object.entries(t))i!==void 0&&(e[o]=Re(i));else n!==void 0&&(e[t]=Re(n))},Fe=(e=0,t=0,n=0,o=0)=>{const i={x:e,y:t,width:n,height:o,top:t,left:e,right:e+n,bottom:t+o};return{...i,toJSON:()=>JSON.stringify(i)}},Ut=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}}},Ie=(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}},Xt=()=>matchMedia("(hover: none), (pointer: coarse)").matches,Jt=()=>"safari"in window,xe=e=>Array.isArray(e)?e:[e],We=e=>(t,n,o,i={})=>{(t instanceof HTMLCollection||t instanceof NodeList)&&(t=Array.from(t)),n=xe(n),t=xe(t);for(const s of t)if(s)for(const r of n)s[e](r,o,{capture:!1,...i})},H=We("addEventListener"),M=We("removeEventListener"),re=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}},q=(e,t=document)=>xe(e).map(n=>typeof n=="string"?Array.from(t.querySelectorAll(n)):n instanceof Element?n:null).flat().filter(Boolean),Zt=(e,t)=>t.some(n=>typeof n=="number"?e.button===n:typeof n=="object"?n.button!==e.button?!1:n.modifiers.every(o=>{switch(o){case"alt":return e.altKey;case"ctrl":return e.ctrlKey||e.metaKey;case"shift":return e.shiftKey}}):!1),{abs:W,max:Ve,min:Ye,ceil:Ge}=Math,Ke=(e=[])=>({stored:e,selected:[],touched:[],changed:{added:[],removed:[]}}),qe=class extends zt{constructor(t){var n,o,i,s,r;super(),this._selection=Ke(),this._targetBoundaryScrolled=!0,this._selectables=[],this._areaLocation={y1:0,x2:0,y2:0,x1:0},this._areaRect=Fe(),this._singleClick=!0,this._scrollAvailable=!0,this._scrollingActive=!1,this._scrollSpeed={x:0,y:0},this._scrollDelta={x:0,y:0},this._lastMousePosition={x:0,y:0},this.enable=this._toggleStartEvents,this.disable=this._toggleStartEvents.bind(this,!1),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,...(s=(i=t.behaviour)==null?void 0:i.scrolling)==null?void 0:s.startScrollMargins}}},features:{range:!0,touch:!0,deselectOnBlur:!1,...t.features,singleTap:{allow:!0,intersect:"native",...(r=t.features)==null?void 0:r.singleTap}}};for(const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[f]=="function"&&(this[f]=this[f].bind(this));const{document:c,selectionAreaClass:u,selectionContainerClass:a}=this._options;this._area=c.createElement("div"),this._clippingElement=c.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(u),a&&this._clippingElement.classList.add(a),$(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),$(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Ut(f=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",f),this._redrawSelectionArea()}),this.enable()}_toggleStartEvents(t=!0){const{document:n,features:o}=this._options,i=t?H:M;i(n,"mousedown",this._onTapStart),o.touch&&i(n,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,n=!1){const{x:o,y:i,target:s}=re(t),{document:r,startAreas:c,boundaries:u,features:a,behaviour:f}=this._options,h=s.getBoundingClientRect();if(t instanceof MouseEvent&&!Zt(t,f.triggers))return;const g=q(c,r),d=q(u,r);this._targetElement=d.find(v=>Ie(v.getBoundingClientRect(),h));const l=t.composedPath(),p=g.find(v=>l.includes(v));if(this._targetBoundary=d.find(v=>l.includes(v)),!this._targetElement||!p||!this._targetBoundary||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:o,y1:i,x2:0,y2:0};const m=r.scrollingElement??r.body;this._scrollDelta={x:m.scrollLeft,y:m.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),H(r,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),H(r,["mouseup","touchcancel","touchend"],this._onTapStop),H(r,"scroll",this._onScroll),a.deselectOnBlur&&(this._targetBoundaryScrolled=!1,H(this._targetBoundary,"scroll",this._onStartAreaScroll))}_onSingleTap(t){const{singleTap:{intersect:n},range:o}=this._options.features,i=re(t);let s;if(n==="native")s=i.target;else if(n==="touch"){this.resolveSelectables();const{x:c,y:u}=i;s=this._selectables.find(a=>{const{right:f,left:h,top:g,bottom:d}=a.getBoundingClientRect();return c<f&&c>h&&u<d&&u>g})}if(!s)return;for(this.resolveSelectables();!this._selectables.includes(s);)if(s.parentElement)s=s.parentElement;else{this._targetBoundaryScrolled||this.clearSelection();return}const{stored:r}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&o&&this._latestElement){const c=this._latestElement,[u,a]=c.compareDocumentPosition(s)&4?[s,c]:[c,s],f=[...this._selectables.filter(h=>h.compareDocumentPosition(u)&4&&h.compareDocumentPosition(a)&2),u,a];this.select(f),this._latestElement=c}else r.includes(s)&&(r.length===1||t.ctrlKey||r.every(c=>this._selection.stored.includes(c)))?this.deselect(s):(this.select(s),this._latestElement=s)}_delayedTapMove(t){const{container:n,document:o,behaviour:{startThreshold:i}}=this._options,{x1:s,y1:r}=this._areaLocation,{x:c,y:u}=re(t);if(typeof i=="number"&&W(c+u-(s+r))>=i||typeof i=="object"&&W(c-s)>=i.x||W(u-r)>=i.y){if(M(o,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){M(o,["mouseup","touchcancel","touchend"],this._onTapStop);return}H(o,["mousemove","touchmove"],this._onTapMove,{passive:!1}),$(this._area,"display","block"),q(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&&(H(this._targetElement,"wheel",this._wheelScroll,{passive:!1}),H(this._options.document,"keydown",this._keyboardScroll,{passive:!1}),this._selectables=this._selectables.filter(a=>this._targetElement.contains(a))),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?($(t,{top:i.top,left:i.left,width:i.width,height:i.height}),$(o,{marginTop:-i.top,marginLeft:-i.left})):($(t,{top:0,left:0,width:"100%",height:"100%"}),$(o,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{_scrollSpeed:n,_areaLocation:o,_options:i,_frame:s}=this,{speedDivider:r}=i.behaviour.scrolling,c=this._targetElement,{x:u,y:a}=re(t);if(o.x2=u,o.y2=a,this._lastMousePosition.x=u,this._lastMousePosition.y=a,this._scrollAvailable&&!this._scrollingActive&&(n.y||n.x)){this._scrollingActive=!0;const f=()=>{if(!n.x&&!n.y){this._scrollingActive=!1;return}const{scrollTop:h,scrollLeft:g}=c;n.y&&(c.scrollTop+=Ge(n.y/r),o.y1-=c.scrollTop-h),n.x&&(c.scrollLeft+=Ge(n.x/r),o.x1-=c.scrollLeft-g),s.next(t),requestAnimationFrame(f)};requestAnimationFrame(f)}else s.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&Xt()||this._scrollAvailable&&Jt())&&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)}_onStartAreaScroll(){this._targetBoundaryScrolled=!0,M(this._targetElement,"scroll",this._onStartAreaScroll)}_wheelScroll(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()}_keyboardScroll(t){const{manualSpeed:n}=this._options.behaviour.scrolling,o=t.key==="ArrowLeft"?-1:t.key==="ArrowRight"?1:0,i=t.key==="ArrowUp"?-1:t.key==="ArrowDown"?1:0;this._scrollSpeed.x+=Math.sign(o)*n,this._scrollSpeed.y+=Math.sign(i)*n,t.preventDefault(),this._onTapMove({clientX:this._lastMousePosition.x,clientY:this._lastMousePosition.y,preventDefault:()=>{}})}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:n,_targetElement:o,_options:i}=this,{scrollTop:s,scrollHeight:r,clientHeight:c,scrollLeft:u,scrollWidth:a,clientWidth:f}=o,h=this._targetRect,{x1:g,y1:d}=n;let{x2:l,y2:p}=n;const{behaviour:{scrolling:{startScrollMargins:m}}}=i;l<h.left+m.x?(t.x=u?-W(h.left-l+m.x):0,l=l<h.left?h.left:l):l>h.right-m.x?(t.x=a-u-f?W(h.left+h.width-l-m.x):0,l=l>h.right?h.right:l):t.x=0,p<h.top+m.y?(t.y=s?-W(h.top-p+m.y):0,p=p<h.top?h.top:p):p>h.bottom-m.y?(t.y=r-s-c?W(h.top+h.height-p-m.y):0,p=p>h.bottom?h.bottom:p):t.y=0;const v=Ye(g,l),b=Ye(d,p),y=Ve(g,l),S=Ve(d,p);this._areaRect=Fe(v,b,y-v,S-b)}_redrawSelectionArea(){const{x:t,y:n,width:o,height:i}=this._areaRect,{style:s}=this._area;s.left=`${t}px`,s.top=`${n}px`,s.width=`${o}px`,s.height=`${i}px`}_onTapStop(t,n){var o;const{document:i,features:s}=this._options,{_singleClick:r}=this;M(this._targetElement,"scroll",this._onStartAreaScroll),M(i,["mousemove","touchmove"],this._delayedTapMove),M(i,["touchmove","mousemove"],this._onTapMove),M(i,["mouseup","touchcancel","touchend"],this._onTapStop),M(i,"scroll",this._onScroll),this._keepSelection(),t&&r&&s.singleTap.allow?this._onSingleTap(t):!r&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,M(this._targetElement,"wheel",this._wheelScroll,{passive:!0}),M(this._options.document,"keydown",this._keyboardScroll,{passive:!0}),this._clippingElement.remove(),(o=this._frame)==null||o.cancel(),$(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:o,_areaRect:i}=this,{stored:s,selected:r,touched:c}=o,{intersect:u,overlap:a}=n.behaviour,f=a==="invert",h=[],g=[],d=[];for(let p=0;p<t.length;p++){const m=t[p];if(Ie(i,m.getBoundingClientRect(),u)){if(r.includes(m))s.includes(m)&&!c.includes(m)&&c.push(m);else if(f&&s.includes(m)){d.push(m);continue}else g.push(m);h.push(m)}}f&&g.push(...s.filter(p=>!r.includes(p)));const l=a==="keep";for(let p=0;p<r.length;p++){const m=r[p];!h.includes(m)&&!(l&&s.includes(m))&&d.push(m)}o.selected=h,o.changed={added:g,removed:d},this._latestElement=void 0}_emitEvent(t,n){return this.emit(t,{event:n,store:this._selection,selection:this})}_keepSelection(){const{_options:t,_selection:n}=this,{selected:o,changed:i,touched:s,stored:r}=n,c=o.filter(u=>!r.includes(u));switch(t.behaviour.overlap){case"drop":{n.stored=[...c,...r.filter(u=>!s.includes(u))];break}case"invert":{n.stored=[...c,...r.filter(u=>!i.removed.includes(u))];break}case"keep":{n.stored=[...r,...o.filter(u=>!r.includes(u))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=q(this._options.selectables,this._options.document)}clearSelection(t=!0,n=!1){const{selected:o,stored:i,changed:s}=this._selection;s.added=[],s.removed.push(...o,...t?i:[]),n||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection=Ke(t?[]:i)}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}getSelectables(){return this._selectables}setAreaLocation(t){Object.assign(this._areaLocation,t),this._redrawSelectionArea()}getAreaLocation(){return this._areaLocation}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:s}=this._selection,r=q(t,this._options.document).filter(c=>!i.includes(c)&&!s.includes(c));return s.push(...r),i.push(...r),o.added.push(...r),o.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),r}deselect(t,n=!1){const{selected:o,stored:i,changed:s}=this._selection,r=q(t,this._options.document).filter(c=>o.includes(c)||i.includes(c));this._selection.stored=i.filter(c=>!r.includes(c)),this._selection.selected=o.filter(c=>!r.includes(c)),this._selection.changed.added=[],this._selection.changed.removed.push(...r.filter(c=>!s.removed.includes(c))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null))}};qe.version="3.9.0";let Qt=qe;function en(e){const t=e.mouseSelectionButton===2?[2]:[0],n=new Qt({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.selectionContainer,features:{touch:!1},behaviour:{triggers:t,scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:o})=>{var r;const i=o.target;if(i.id==="input-box"||i.className==="circle"||(r=e.container.querySelector(".context-menu"))!=null&&r.contains(i))return!1;if(!o.ctrlKey&&!o.metaKey){if(i.tagName==="ME-TPC"&&i.classList.contains("selected"))return!1;e.clearSelection()}const s=n.getSelectionArea();return s.style.background="#4f90f22d",s.style.border="1px solid #4f90f2",s.parentElement&&(s.parentElement.style.zIndex="9999"),!0}).on("move",({store:{changed:{added:o,removed:i}}})=>{if(o.length>0||i.length>0,o.length>0){for(const s of o)s.className="selected";e.currentNodes=[...e.currentNodes,...o],e.bus.fire("selectNodes",o.map(s=>s.nodeObj))}if(i.length>0){for(const s of i)s.classList.remove("selected");e.currentNodes=e.currentNodes.filter(s=>!(i!=null&&i.includes(s))),e.bus.fire("unselectNodes",i.map(s=>s.nodeObj))}});e.selection=n}const tn=function(e,t=!0){this.theme=e;const o={...(e.type==="dark"?ue:he).cssVar,...e.cssVar},i=Object.keys(o);for(let s=0;s<i.length;s++){const r=i[s];this.container.style.setProperty(r,o[r])}t&&this.refresh()},z=e=>{var o;const t=(o=e.parent)==null?void 0:o.children,n=(t==null?void 0:t.indexOf(e))??0;return{siblings:t,index:n}};function nn(e){const{siblings:t,index:n}=z(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 on(e){const{siblings:t,index:n}=z(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 ze(e){const{siblings:t,index:n}=z(e);return t===void 0?0:(t.splice(n,1),t.length)}function sn(e,t,n){const{siblings:o,index:i}=z(n);o!==void 0&&(t==="before"?o.splice(i,0,e):o.splice(i+1,0,e))}function rn(e,t){const{siblings:n,index:o}=z(e);n!==void 0&&(n[o]=t,t.children=[e])}function Ue(e,t,n){var o;if(ze(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:s}=z(n);if(i===void 0)return;e==="before"?i.splice(s,0,t):i.splice(s+1,0,t)}}const cn=function({map:e,direction:t},n){var o,i;if(t===0)return 0;if(t===1)return 1;if(t===2){const s=((o=e.querySelector(".lhs"))==null?void 0:o.childElementCount)||0,r=((i=e.querySelector(".rhs"))==null?void 0:i.childElementCount)||0;return s<=r?(n.direction=0,0):(n.direction=1,1)}},Xe=function(e,t,n){var s,r;const o=n.children[0].children[0],i=t.parentElement;if(i.tagName==="ME-PARENT"){if(J(o),i.children[1])i.nextSibling.appendChild(n);else{const c=e.createChildren([n]);i.appendChild(be(!0)),i.insertAdjacentElement("afterend",c)}e.linkDiv(n.offsetParent)}else i.tagName==="ME-ROOT"&&(cn(e,o.nodeObj)===0?(s=e.container.querySelector(".lhs"))==null||s.appendChild(n):(r=e.container.querySelector(".rhs"))==null||r.appendChild(n),e.linkDiv())},ln=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()},Je={before:"beforebegin",after:"afterend"},J=function(e){const n=e.parentElement.parentElement.lastElementChild;(n==null?void 0:n.tagName)==="svg"&&(n==null||n.remove())},an=function(e,t){const n=e.nodeObj,o=pe(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const i=Object.assign(n,t);ve(e,i),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:i,origin:o})},Ee=function(e,t,n){if(!t)return null;const o=t.nodeObj;o.expanded===!1&&(e.expandNode(t,!0),t=e.findEle(o.id));const i=n||e.generateNewObj();o.children?o.children.push(i):o.children=[i],j(e.nodeData);const{grp:s,top:r}=e.createWrapper(i);return Xe(e,t,s),{newTop:r,newNodeObj:i}},dn=function(e,t,n){var a,f,h,g;const o=t||this.currentNode;if(!o)return;const i=o.nodeObj;if(i.parent){if(!((a=i.parent)!=null&&a.parent)&&((h=(f=i.parent)==null?void 0:f.children)==null?void 0:h.length)===1&&this.direction===2){this.addChild(this.findEle(i.parent.id),n);return}}else{this.addChild();return}const s=n||this.generateNewObj();if(!((g=i.parent)!=null&&g.parent)){const d=o.closest("me-main").className===L.LHS?0:1;s.direction=d}sn(s,e,i),j(this.nodeData);const r=o.parentElement,{grp:c,top:u}=this.createWrapper(s);r.parentElement.insertAdjacentElement(Je[e],c),this.linkDiv(c.offsetParent),n||this.editTopic(u.firstChild),this.selectNode(u.firstChild,!0),this.bus.fire("operation",{name:"insertSibling",type:e,obj:s})},hn=function(e,t){const n=e||this.currentNode;if(!n)return;J(n);const o=n.nodeObj;if(!o.parent)return;const i=t||this.generateNewObj();rn(o,i),j(this.nodeData);const s=n.parentElement.parentElement,{grp:r,top:c}=this.createWrapper(i,!0);c.appendChild(be(!0)),s.insertAdjacentElement("afterend",r);const u=this.createChildren([s]);c.insertAdjacentElement("afterend",u),this.linkDiv(),t||this.editTopic(c.firstChild),this.selectNode(c.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:i})},un=function(e,t){const n=e||this.currentNode;if(!n)return;const o=Ee(this,n,t);if(!o)return;const{newTop:i,newNodeObj:s}=o;this.bus.fire("operation",{name:"addChild",obj:s}),t||this.editTopic(i.firstChild),this.selectNode(i.firstChild,!0)},fn=function(e,t){const n=pe(e.nodeObj);fe(n);const o=Ee(this,t,n);if(!o)return;const{newNodeObj:i}=o;this.selectNode(this.findEle(i.id)),this.bus.fire("operation",{name:"copyNode",obj:i})},pn=function(e,t){e=oe(e);const n=[];for(let o=0;o<e.length;o++){const i=e[o],s=pe(i.nodeObj);fe(s);const r=Ee(this,t,s);if(!r)return;const{newNodeObj:c}=r;n.push(c)}this.unselectNodes(this.currentNodes),this.selectNodes(n.map(o=>this.findEle(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},gn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;nn(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},mn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;on(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})},vn=function(e){if(e.length===0)return;e=oe(e);for(const n of e){const o=n.nodeObj,i=ze(o);ln(n,i)}const t=e[e.length-1];this.selectNode(this.findEle(t.nodeObj.parent.id)),this.linkDiv(),this.bus.fire("operation",{name:"removeNodes",objs:e.map(n=>n.nodeObj)})},bn=function(e,t){e=oe(e);const n=t.nodeObj;n.expanded===!1&&(this.expandNode(t,!0),t=this.findEle(n.id));for(const o of e){const i=o.nodeObj;Ue("in",i,n),j(this.nodeData);const s=o.parentElement;Xe(this,t,s.parentElement)}this.linkDiv(),this.bus.fire("operation",{name:"moveNodeIn",objs:e.map(o=>o.nodeObj),toObj:n})},Ze=(e,t,n,o)=>{e=oe(e),t==="after"&&(e=e.reverse());const i=n.nodeObj,s=[];for(const r of e){const c=r.nodeObj;Ue(t,c,i),j(o.nodeData),J(r);const u=r.parentElement.parentNode;s.includes(u.parentElement)||s.push(u.parentElement),n.parentElement.parentNode.insertAdjacentElement(Je[t],u)}for(const r of s)r.childElementCount===0&&r.tagName!=="ME-MAIN"&&(r.previousSibling.children[1].remove(),r.remove());o.linkDiv(),o.bus.fire("operation",{name:t==="before"?"moveNodeBefore":"moveNodeAfter",objs:e.map(r=>r.nodeObj),toObj:i})},Qe=Object.freeze(Object.defineProperty({__proto__:null,addChild:un,beginEdit:function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},copyNode:fn,copyNodes:pn,insertParent:hn,insertSibling:dn,moveDownNode:mn,moveNodeAfter:function(e,t){Ze(e,"after",t,this)},moveNodeBefore:function(e,t){Ze(e,"before",t,this)},moveNodeIn:bn,moveUpNode:gn,removeNodes:vn,reshapeNode:an,rmSubline:J,setNodeTopic:function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"}));function yn(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme}}const wn=function(e){const t=this.container,n=e.getBoundingClientRect(),o=t.getBoundingClientRect();if(n.top>o.bottom||n.bottom<o.top||n.left>o.right||n.right<o.left){const s=n.left+n.width/2,r=n.top+n.height/2,c=o.left+o.width/2,u=o.top+o.height/2,a=s-c,f=r-u;this.move(-a,-f)}},xn=function(e,t,n){this.clearSelection(),this.scrollIntoView(e),this.selection.select(e),t&&this.bus.fire("selectNewNode",e.nodeObj)},En=function(e){this.selection.select(e)},Sn=function(e){this.selection.deselect(e)},Cn=function(){this.unselectNodes(this.currentNodes),this.unselectSummary(),this.unselectArrow()},Nn=function(){const e=yn(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},_n=function(){return JSON.parse(this.getDataString())},kn=function(){this.editable=!0},Tn=function(){this.editable=!1},An=function(e,t={x:0,y:0}){const n=this.container.getBoundingClientRect(),o=t.x?t.x-n.left-n.width/2:0,i=t.y?t.y-n.top-n.height/2:0,{dx:s,dy:r}=et(this),c=this.map.style.transform,{x:u,y:a}=ke(c),f=u-s,h=a-r,g=this.scaleVal,d=(-o+f)*(1-e/g),l=(-i+h)*(1-e/g);this.map.style.transform=`translate(${u-d}px, ${a-l}px) scale(${e})`,this.scaleVal=e,this.bus.fire("scale",e)},Ln=function(){const e=this.nodes.offsetHeight/this.container.offsetHeight,t=this.nodes.offsetWidth/this.container.offsetWidth,n=1/Math.max(1,Math.max(e,t));this.scaleVal=n,this.map.style.transform="scale("+n+")",this.bus.fire("scale",n)},Mn=function(e,t){const{map:n,scaleVal:o,bus:i}=this,s=n.style.transform;let{x:r,y:c}=ke(s);r+=e,c+=t,n.style.transform=`translate(${r}px, ${c}px) scale(${o})`,i.fire("move",{dx:e,dy:t})},et=e=>{const{container:t,map:n,nodes:o}=e,i=n.querySelector("me-root"),s=i.offsetTop,r=i.offsetLeft,c=i.offsetWidth,u=i.offsetHeight;let a,f;return e.alignment==="root"?(a=t.offsetWidth/2-r-c/2,f=t.offsetHeight/2-s-u/2,n.style.transformOrigin=`${r+c/2}px 50%`):(a=(t.offsetWidth-o.offsetWidth)/2,f=(t.offsetHeight-o.offsetHeight)/2,n.style.transformOrigin="50% 50%"),{dx:a,dy:f}},Dn=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},clearSelection:Cn,disableEdit:Tn,enableEdit:kn,expandNode:function(e,t){const n=e.nodeObj;typeof t=="boolean"?n.expanded=t:n.expanded!==!1?n.expanded=!1:n.expanded=!0;const o=e.parentNode,i=o.children[1];if(i.expanded=n.expanded,i.className=n.expanded?"minus":"",J(e),n.expanded){const u=this.createChildren(n.children.map(a=>this.createWrapper(a).grp));o.parentNode.appendChild(u)}else o.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const s=e.getBoundingClientRect(),r=this.container.getBoundingClientRect();(s.bottom>r.bottom||s.top<r.top||s.right>r.right||s.left<r.left)&&this.scrollIntoView(e),this.bus.fire("expandNode",n)},expandNodeAll:function(e,t){const n=e.nodeObj,o=(i,s)=>{i.expanded=s,i.children&&i.children.forEach(r=>{o(r,s)})};typeof t=="boolean"?o(n,t):n.expanded!==!1?o(n,!1):o(n,!0),this.refresh()},focusNode:function(e){e.nodeObj.parent&&(this.clearSelection(),this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.initRight(),this.toCenter())},getData:_n,getDataString:Nn,initLeft:function(){this.direction=0,this.refresh(),this.toCenter()},initRight:function(){this.direction=1,this.refresh(),this.toCenter()},initSide:function(){this.direction=2,this.refresh(),this.toCenter()},install:function(e){e(this)},move:Mn,refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.arrows=e.arrows||[],this.summaries=e.summaries||[]),j(this.nodeData),this.layout(),this.linkDiv()},scale:An,scaleFit:Ln,scrollIntoView:wn,selectNode:xn,selectNodes:En,setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){const{map:e}=this,{dx:t,dy:n}=et(this);e.style.transform=`translate(${t}px, ${n}px) scale(${this.scaleVal})`},unselectNodes:Sn},Symbol.toStringTag,{value:"Module"})),tt={create:function(e){return{dom:e,moved:!1,pointerdown:!1,lastX:0,lastY:0,handlePointerMove(t){if(this.pointerdown){this.moved=!0;const n=t.clientX-this.lastX,o=t.clientY-this.lastY;this.lastX=t.clientX,this.lastY=t.clientY,this.cb&&this.cb(n,o)}},handlePointerDown(t){t.button===0&&(this.pointerdown=!0,this.lastX=t.clientX,this.lastY=t.clientY,this.dom.setPointerCapture(t.pointerId))},handleClear(t){this.pointerdown=!1,t.pointerId!==void 0&&this.dom.releasePointerCapture(t.pointerId)},cb:null,init(t,n){this.cb=n,this.handleClear=this.handleClear.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerDown=this.handlePointerDown.bind(this),this.destroy=me([{dom:t,evt:"pointermove",func:this.handlePointerMove},{dom:t,evt:"pointerleave",func:this.handleClear},{dom:t,evt:"pointerup",func:this.handleClear},{dom:this.dom,evt:"pointerdown",func:this.handlePointerDown}])},destroy:null,clear(){this.moved=!1,this.pointerdown=!1}}}},On="#4dc4ff";function nt(e,t,n,o,i,s,r,c){return{x:e/8+n*3/8+i*3/8+r/8,y:t/8+o*3/8+s*3/8+c/8}}function jn(e,t,n){E(e,{x:t+"",y:n+""})}function ce(e,t,n,o,i){E(e,{x1:t+"",y1:n+"",x2:o+"",y2:i+""})}function ot(e,t,n,o,i,s,r,c,u,a){var d;if(e.line.setAttribute("d",`M ${t} ${n} C ${o} ${i} ${s} ${r} ${c} ${u}`),a.style){const l=a.style;l.stroke&&e.line.setAttribute("stroke",l.stroke),l.strokeWidth&&e.line.setAttribute("stroke-width",String(l.strokeWidth)),l.strokeDasharray&&e.line.setAttribute("stroke-dasharray",l.strokeDasharray),l.strokeLinecap&&e.line.setAttribute("stroke-linecap",l.strokeLinecap),l.opacity!==void 0&&e.line.setAttribute("opacity",String(l.opacity))}const f=ne(s,r,c,u);if(f&&(e.arrow1.setAttribute("d",`M ${f.x1} ${f.y1} L ${c} ${u} L ${f.x2} ${f.y2}`),a.style)){const l=a.style;l.stroke&&e.arrow1.setAttribute("stroke",l.stroke),l.strokeWidth&&e.arrow1.setAttribute("stroke-width",String(l.strokeWidth)),l.strokeLinecap&&e.arrow1.setAttribute("stroke-linecap",l.strokeLinecap),l.opacity!==void 0&&e.arrow1.setAttribute("opacity",String(l.opacity))}if(a.bidirectional){const l=ne(o,i,t,n);if(l&&(e.arrow2.setAttribute("d",`M ${l.x1} ${l.y1} L ${t} ${n} L ${l.x2} ${l.y2}`),a.style)){const p=a.style;p.stroke&&e.arrow2.setAttribute("stroke",p.stroke),p.strokeWidth&&e.arrow2.setAttribute("stroke-width",String(p.strokeWidth)),p.strokeLinecap&&e.arrow2.setAttribute("stroke-linecap",p.strokeLinecap),p.opacity!==void 0&&e.arrow2.setAttribute("opacity",String(p.opacity))}}const{x:h,y:g}=nt(t,n,o,i,s,r,c,u);jn(e.label,h,g),(d=a.style)!=null&&d.labelColor&&e.label.setAttribute("fill",a.style.labelColor),Vn(e)}function le(e,t,n){const{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=t.offsetWidth,r=t.offsetHeight,c=o+s/2,u=i+r/2,a=c+n.x,f=u+n.y;return{w:s,h:r,cx:c,cy:u,ctrlX:a,ctrlY:f}}function U(e){let t,n;const o=(e.cy-e.ctrlY)/(e.ctrlX-e.cx);return o>e.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 Pn=function(e,t,n,o){const i=document.createElementNS(k,"text");return E(i,{"text-anchor":"middle",x:t+"",y:n+"",fill:o||"rgb(235, 95, 82)"}),i.dataset.type="custom-link",i.innerHTML=e,i},Se=function(e,t,n,o,i){var x;if(!t||!n)return;const s=le(e,t,o.delta1),r=le(e,n,o.delta2),{x:c,y:u}=U(s),{ctrlX:a,ctrlY:f}=s,{ctrlX:h,ctrlY:g}=r,{x:d,y:l}=U(r),p=ne(h,g,d,l);if(!p)return;const m=`M ${p.x1} ${p.y1} L ${d} ${l} L ${p.x2} ${p.y2}`;let v="";if(o.bidirectional){const C=ne(a,f,c,u);if(!C)return;v=`M ${C.x1} ${C.y1} L ${c} ${u} L ${C.x2} ${C.y2}`}const b=Tt(`M ${c} ${u} C ${a} ${f} ${h} ${g} ${d} ${l}`,m,v,o.style),{x:y,y:S}=nt(c,u,a,f,h,g,d,l),N=(x=o.style)==null?void 0:x.labelColor,w=Pn(o.label,y,S,N);b.appendChild(w),b.label=w,b.arrowObj=o,b.dataset.linkid=o.id,e.linkSvgGroup.appendChild(b),i||(e.arrows.push(o),e.currentArrow=b,it(e,o,s,r))},$n=function(e,t,n={}){const o={id:R(),label:"Custom Link",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:e.offsetWidth/2+100,y:0},delta2:{x:t.offsetWidth/2+100,y:0},...n};Se(this,e,t,o),this.bus.fire("operation",{name:"createArrow",obj:o})},Hn=function(e){const t={...e,id:R()};Se(this,this.findEle(t.from),this.findEle(t.to),t),this.bus.fire("operation",{name:"createArrow",obj:t})},Bn=function(e){let t;if(e?t=e:t=this.currentArrow,!t)return;Ne(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}})},Rn=function(e){this.currentArrow=e;const t=e.arrowObj,n=this.findEle(t.from),o=this.findEle(t.to),i=le(this,n,t.delta1),s=le(this,o,t.delta2);it(this,t,i,s)},Fn=function(){Ne(this),this.currentArrow=null},Ce=function(e,t){const n=document.createElementNS(k,"path");return E(n,{d:e,stroke:t,fill:"none","stroke-width":"6","stroke-linecap":"round","stroke-linejoin":"round"}),n},In=function(e,t){const n=document.createElementNS(k,"g");n.setAttribute("class","arrow-highlight"),n.setAttribute("opacity","0.45");const o=Ce(e.line.getAttribute("d"),t);n.appendChild(o);const i=Ce(e.arrow1.getAttribute("d"),t);if(n.appendChild(i),e.arrow2.getAttribute("d")){const s=Ce(e.arrow2.getAttribute("d"),t);n.appendChild(s)}e.insertBefore(n,e.firstChild)},Wn=function(e){const t=e.querySelector(".arrow-highlight");t&&t.remove()},Vn=function(e){const t=e.querySelector(".arrow-highlight");if(!t)return;const n=t.querySelectorAll("path");n.length>=1&&n[0].setAttribute("d",e.line.getAttribute("d")),n.length>=2&&n[1].setAttribute("d",e.arrow1.getAttribute("d")),n.length>=3&&e.arrow2.getAttribute("d")&&n[2].setAttribute("d",e.arrow2.getAttribute("d"))},Ne=function(e){var t,n;(t=e.helper1)==null||t.destroy(),(n=e.helper2)==null||n.destroy(),e.linkController.style.display="none",e.P2.style.display="none",e.P3.style.display="none",e.currentArrow&&Wn(e.currentArrow)},it=function(e,t,n,o){const{linkController:i,P2:s,P3:r,line1:c,line2:u,nodes:a,map:f,currentArrow:h,bus:g}=e;if(!h)return;i.style.display="initial",s.style.display="initial",r.style.display="initial",a.appendChild(i),a.appendChild(s),a.appendChild(r),In(h,On);let{x:d,y:l}=U(n),{ctrlX:p,ctrlY:m}=n,{ctrlX:v,ctrlY:b}=o,{x:y,y:S}=U(o);s.style.cssText=`top:${m}px;left:${p}px;`,r.style.cssText=`top:${b}px;left:${v}px;`,ce(c,d,l,p,m),ce(u,v,b,y,S),e.helper1=tt.create(s),e.helper2=tt.create(r),e.helper1.init(f,(N,w)=>{p=p+N/e.scaleVal,m=m+w/e.scaleVal;const x=U({...n,ctrlX:p,ctrlY:m});d=x.x,l=x.y,s.style.top=m+"px",s.style.left=p+"px",ot(h,d,l,p,m,v,b,y,S,t),ce(c,d,l,p,m),t.delta1.x=p-n.cx,t.delta1.y=m-n.cy,g.fire("updateArrowDelta",t)}),e.helper2.init(f,(N,w)=>{v=v+N/e.scaleVal,b=b+w/e.scaleVal;const x=U({...o,ctrlX:v,ctrlY:b});y=x.x,S=x.y,r.style.top=b+"px",r.style.left=v+"px",ot(h,d,l,p,m,v,b,y,S,t),ce(u,v,b,y,S),t.delta2.x=v-o.cx,t.delta2.y=b-o.cy,g.fire("updateArrowDelta",t)})};function Yn(){this.linkSvgGroup.innerHTML="";for(let e=0;e<this.arrows.length;e++){const t=this.arrows[e];try{Se(this,this.findEle(t.from),this.findEle(t.to),t,!0)}catch{}}this.nodes.appendChild(this.linkSvgGroup)}function Gn(e){if(Ne(this),!e)return;const t=e.label;je(this,t,e.arrowObj)}function Kn(){this.arrows=this.arrows.filter(e=>te(e.from,this.nodeData)&&te(e.to,this.nodeData))}const qn=Object.freeze(Object.defineProperty({__proto__:null,createArrow:$n,createArrowFrom:Hn,editArrowLabel:Gn,removeArrow:Bn,renderArrow:Yn,selectArrow:Rn,tidyArrow:Kn,unselectArrow:Fn},Symbol.toStringTag,{value:"Module"})),zn=function(e){var u,a;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const f=e[0].nodeObj,h=e[0].nodeObj.parent;if(!h)throw new Error("Can not select root node.");const g=h.children.findIndex(d=>f===d);return{parent:h.id,start:g,end:g}}let t=0;const n=e.map(f=>{let h=f.nodeObj;const g=[];for(;h.parent;){const d=h.parent,l=d.children,p=l==null?void 0:l.indexOf(h);h=d,g.unshift({node:h,index:p})}return g.length>t&&(t=g.length),g});let o=0;e:for(;o<t;o++){const f=(u=n[0][o])==null?void 0:u.node;for(let h=1;h<n.length;h++)if(((a=n[h][o])==null?void 0:a.node)!==f)break e}if(!o)throw new Error("Can not select root node.");const i=n.map(f=>f[o-1].index).sort(),s=i[0]||0,r=i[i.length-1]||0,c=n[0][o-1].node;if(!c.parent)throw new Error("Please select nodes in the same main topic.");return{parent:c.id,start:s,end:r}},Un=function(e){const t=document.createElementNS(k,"g");return t.setAttribute("id",e),t},st=function(e,t){const n=document.createElementNS(k,"path");return E(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},rt=function(e,t,n,o,i){const s=document.createElementNS(k,"text");return E(s,{"text-anchor":o,x:t+"",y:n+"",fill:i||"#666"}),s.innerHTML=e,s},Xn=e=>e.parentElement.parentElement,Jn=function(e,{parent:t,start:n}){const o=e.findEle(t),i=o.nodeObj;let s;return i.parent?s=o.closest("me-main").className:s=e.findEle(i.children[n].id).closest("me-main").className,s},_e=function(e,t){var C;const{id:n,label:o,parent:i,start:s,end:r}=t,{nodes:c,theme:u,summarySvg:a}=e,h=e.findEle(i).nodeObj,g=Jn(e,t);let d=1/0,l=0,p=0,m=0;for(let _=s;_<=r;_++){const B=(C=h.children)==null?void 0:C[_];if(!B)return e.removeSummary(n),null;const V=Xn(e.findEle(B.id)),{offsetLeft:Y,offsetTop:at}=P(c,V),dt=s===r?10:20;_===s&&(p=at+dt),_===r&&(m=at+V.offsetHeight-dt),Y<d&&(d=Y),V.offsetWidth+Y>l&&(l=V.offsetWidth+Y)}let v,b;const y=p+10,S=m+10,N=(y+S)/2,w=u.cssVar["--color"];g===L.LHS?(v=st(`M ${d+10} ${y} c -5 0 -10 5 -10 10 L ${d} ${S-10} c 0 5 5 10 10 10 M ${d} ${N} h -10`,w),b=rt(o,d-20,N+6,"end",w)):(v=st(`M ${l-10} ${y} c 5 0 10 5 10 10 L ${l} ${S-10} c 0 5 -5 10 -10 10 M ${l} ${N} h 10`,w),b=rt(o,l+20,N+6,"start",w));const x=Un("s-"+n);return x.appendChild(v),x.appendChild(b),x.summaryObj=t,a.appendChild(x),x},Zn=Object.freeze(Object.defineProperty({__proto__:null,createSummary:function(){if(!this.currentNodes)return;const{currentNodes:e,summaries:t,bus:n}=this,{parent:o,start:i,end:s}=zn(e),r={id:R(),parent:o,start:i,end:s,label:"summary"},c=_e(this,r);t.push(r),this.editSummary(c),n.fire("operation",{name:"createSummary",obj:r})},createSummaryFrom:function(e){const t=R(),n={...e,id:t};_e(this,n),this.summaries.push(n),this.bus.fire("operation",{name:"createSummary",obj:n})},editSummary:function(e){if(!e)return;const t=e.childNodes[1];je(this,t,e.summaryObj)},removeSummary:function(e){var n;const t=this.summaries.findIndex(o=>o.id===e);t>-1&&(this.summaries.splice(t,1),(n=document.querySelector("#s-"+e))==null||n.remove()),this.bus.fire("operation",{name:"removeSummary",obj:{id:e}})},renderSummary:function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{try{_e(this,e)}catch{}}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},selectSummary:function(e){const t=e.children[1].getBBox(),n=6,o=3,i=document.createElementNS(k,"rect");E(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},unselectSummary:function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null}},Symbol.toStringTag,{value:"Module"})),T="http://www.w3.org/2000/svg";function Qn(e,t){const n=document.createElementNS(T,"svg");return E(n,{version:"1.1",xmlns:T,height:e,width:t}),n}function eo(e,t){return(parseInt(e)-parseInt(t))/2}function to(e,t,n,o){const i=document.createElementNS(T,"g");let s="";return e.text?s=e.text.textContent:s=e.childNodes[0].textContent,s.split(`
15
- `).forEach((c,u)=>{const a=document.createElementNS(T,"text");E(a,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+eo(t.lineHeight,t.fontSize)*(u+1)+parseFloat(t.fontSize)*(u+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),a.innerHTML=c,i.appendChild(a)}),i}function no(e,t,n,o){var c;let i="";(c=e.nodeObj)!=null&&c.dangerouslySetInnerHTML?i=e.nodeObj.dangerouslySetInnerHTML:e.text?i=e.text.textContent:i=e.childNodes[0].textContent;const s=document.createElementNS(T,"foreignObject");E(s,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const r=document.createElement("div");return E(r,{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;`}),r.innerHTML=i,s.appendChild(r),s}function oo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=document.createElementNS(T,"rect");return E(s,{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}),s}function ae(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:i,offsetTop:s}=P(e.nodes,t),r=document.createElementNS(T,"rect");E(r,{x:i+"",y:s+"",rx:o.borderRadius,ry:o.borderRadius,width:o.width,height:o.height,fill:o.backgroundColor,stroke:o.borderColor,"stroke-width":o.borderWidth});const c=document.createElementNS(T,"g");c.appendChild(r);let u;return n?u=no(t,o,i,s):u=to(t,o,i,s),c.appendChild(u),c}function io(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=document.createElementNS(T,"a"),r=document.createElementNS(T,"text");return E(r,{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}`}),r.innerHTML=t.textContent,s.appendChild(r),s.setAttribute("href",t.href),s}function so(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=document.createElementNS(T,"image");return E(s,{x:o+"",y:i+"",width:n.width+"",height:n.height+"",href:t.src}),s}const de=100,ro='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',co=(e,t=!1)=>{var h,g,d;const n=e.nodes,o=n.offsetHeight+de*2,i=n.offsetWidth+de*2,s=Qn(o+"px",i+"px"),r=document.createElementNS(T,"svg"),c=document.createElementNS(T,"rect");E(c,{x:"0",y:"0",width:`${i}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),s.appendChild(c),n.querySelectorAll(".subLines").forEach(l=>{const p=l.cloneNode(!0),{offsetLeft:m,offsetTop:v}=P(n,l.parentElement);p.setAttribute("x",`${m}`),p.setAttribute("y",`${v}`),r.appendChild(p)});const u=(h=n.querySelector(".lines"))==null?void 0:h.cloneNode(!0);u&&r.appendChild(u);const a=(g=n.querySelector(".topiclinks"))==null?void 0:g.cloneNode(!0);a&&r.appendChild(a);const f=(d=n.querySelector(".summary"))==null?void 0:d.cloneNode(!0);return f&&r.appendChild(f),n.querySelectorAll("me-tpc").forEach(l=>{l.nodeObj.dangerouslySetInnerHTML?r.appendChild(ae(e,l,!t)):(r.appendChild(oo(e,l)),r.appendChild(ae(e,l.text,!t)))}),n.querySelectorAll(".tags > span").forEach(l=>{r.appendChild(ae(e,l))}),n.querySelectorAll(".icons > span").forEach(l=>{r.appendChild(ae(e,l))}),n.querySelectorAll(".hyper-link").forEach(l=>{r.appendChild(io(e,l))}),n.querySelectorAll("img").forEach(l=>{r.appendChild(so(e,l))}),E(r,{x:de+"",y:de+"",overflow:"visible"}),s.appendChild(r),s},lo=(e,t)=>(t&&e.insertAdjacentHTML("afterbegin","<style>"+t+"</style>"),ro+e.outerHTML);function ao(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 ho=Object.freeze(Object.defineProperty({__proto__:null,exportPng:async function(e=!1,t){const n=this.exportSvg(e,t),o=await ao(n);return new Promise((i,s)=>{const r=new Image;r.setAttribute("crossOrigin","anonymous"),r.onload=()=>{const c=document.createElement("canvas");c.width=r.width,c.height=r.height,c.getContext("2d").drawImage(r,0,0),c.toBlob(i,"image/png",1)},r.src=o,r.onerror=s})},exportSvg:function(e=!1,t){const n=co(this,e),o=lo(n,t);return new Blob([o],{type:"image/svg+xml"})}},Symbol.toStringTag,{value:"Module"}));function uo(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const ct=Object.keys(Qe),lt={};for(let e=0;e<ct.length;e++){const t=ct[e];lt[t]=uo(Qe[t],t)}const fo={getObjById:te,generateNewObj:ht,layout:wt,linkDiv:At,editTopic:kt,createWrapper:St,createParent:Ct,createChildren:Nt,createTopic:_t,findEle:Le,changeTheme:tn,...Dn,...lt,...qn,...Zn,...ho,init(e){if(e=JSON.parse(JSON.stringify(e)),!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),this.changeTheme(e.theme||this.theme,!1),this.nodeData=e.nodeData,j(this.nodeData),this.arrows=e.arrows||[],this.summaries=e.summaries||[],this.tidyArrow(),this.toolBar&&qt(this),this.keypress&&vt(this,this.keypress),this.editable&&en(this),this.contextMenu&&this.disposable.push(Lt(this,this.contextMenu)),this.draggable&&this.disposable.push(jt(this)),this.allowUndo&&this.disposable.push($t(this)),this.layout(),this.linkDiv(),this.toCenter()},destroy(){var e;this.disposable.forEach(t=>t()),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.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 po({pT:e,pL:t,pW:n,pH:o,cT:i,cL:s,cW:r,cH:c,direction:u,containerHeight:a}){let f=t+n/2;const h=e+o/2;let g;u===L.LHS?g=s+r:g=s;const d=i+c/2,p=(1-Math.abs(d-h)/a)*.25*(n/2);return u===L.LHS?f=f-n/10-p:f=f+n/10+p,`M ${f} ${h} Q ${f} ${d} ${g} ${d}`}function go({pT:e,pL:t,pW:n,pH:o,cT:i,cL:s,cW:r,cH:c,direction:u,isFirst:a}){const f=parseInt(this.container.style.getPropertyValue("--node-gap-x"));let h=0,g=0;a?h=e+o/2:h=e+o;const d=i+c;let l=0,p=0,m=0;const v=Math.abs(h-d)/300*f;return u===L.LHS?(m=t,l=m+f,p=m-f,g=s+f,`M ${l} ${h} C ${m} ${h} ${m+v} ${d} ${p} ${d} H ${g}`):(m=t+n,l=m-f,p=m+f,g=s+r-f,`M ${l} ${h} C ${m} ${h} ${m-v} ${d} ${p} ${d} H ${g}`)}const mo="5.0.1";function vo(e){return{x:0,y:0,moved:!1,mousedown:!1,onMove(t,n){this.mousedown&&(this.moved=!0,e.move(t,n))},clear(){this.mousedown=!1,e.map.style.transition="transform 0.3s"}}}const Z=document;function D({el:e,direction:t,locale:n,draggable:o,editable:i,contextMenu:s,toolBar:r,keypress:c,mouseSelectionButton:u,selectionContainer:a,before:f,newTopicName:h,allowUndo:g,generateMainBranch:d,generateSubBranch:l,overflowHidden:p,theme:m,alignment:v,scaleSensitivity:b}){let y=null;const S=Object.prototype.toString.call(e);if(S==="[object HTMLDivElement]"?y=e:S==="[object String]"&&(y=document.querySelector(e)),!y)throw new Error("MindElixir: el is not a valid element");y.style.position="relative",y.innerHTML="",this.el=y,this.disposable=[],this.before=f||{},this.locale=n||"en",this.contextMenu=s===void 0?!0:s,this.toolBar=r===void 0?!0:r,this.keypress=c===void 0?!0:c,this.mouseSelectionButton=u||0,this.direction=typeof t=="number"?t:1,this.draggable=o===void 0?!0:o,this.newTopicName=h||"new node",this.editable=i===void 0?!0:i,this.allowUndo=g===void 0?!1:g,this.scaleSensitivity=typeof b=="number"?b:.2,this.currentNodes=[],this.currentArrow=null,this.scaleVal=1,this.tempDirection=null,this.generateMainBranch=d||po,this.generateSubBranch=l||go,this.overflowHidden=p||!1,this.dragMoveHelper=vo(this),this.bus=yt(),this.container=Z.createElement("div"),this.selectionContainer=a||this.container,this.container.className="map-container";const N=window.matchMedia("(prefers-color-scheme: dark)");this.theme=m||(N.matches?ue:he);const w=Z.createElement("div");w.className="map-canvas",setTimeout(()=>{w.style.transition="all 0.3s"},300),this.map=w,this.container.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.el.appendChild(this.container),this.nodes=Z.createElement("me-nodes"),this.lines=X("lines"),this.summarySvg=X("summary"),this.linkController=X("linkcontroller"),this.P2=Z.createElement("div"),this.P3=Z.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=Oe(),this.line2=Oe(),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=X("topiclinks"),this.alignment=v??"root",this.map.appendChild(this.nodes),this.overflowHidden?this.container.style.overflow="hidden":this.disposable.push(bt(this))}return D.prototype=fo,Object.defineProperty(D.prototype,"currentNode",{get(){return this.currentNodes[this.currentNodes.length-1]},enumerable:!0}),D.LEFT=0,D.RIGHT=1,D.SIDE=2,D.THEME=he,D.DARK_THEME=ue,D.version=mo,D.E=Le,D.new=e=>({nodeData:{id:R(),topic:e||"new topic",children:[]}}),D}();
14
+ `,Me(o),e.scrollIntoView(o),o.addEventListener("keydown",r=>{r.stopPropagation();const c=r.key;if(c==="Enter"||c==="Tab"){if(r.shiftKey)return;r.preventDefault(),o.blur(),e.container.focus()}}),o.addEventListener("blur",()=>{var c;if(!o)return;const r=((c=o.textContent)==null?void 0:c.trim())||"";r===""?n.label=i:n.label=r,o.remove(),r!==i&&(t.innerHTML=n.label,e.linkDiv(),"parent"in n?e.bus.fire("operation",{name:"finishEditSummary",obj:n}):e.bus.fire("operation",{name:"finishEditArrowLabel",obj:n}))})},At=function(e){const t=this.map.querySelector("me-root"),n=t.offsetTop,o=t.offsetLeft,i=t.offsetWidth,s=t.offsetHeight,r=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="";for(let c=0;c<r.length;c++){const u=r[c],a=u.querySelector("me-tpc"),{offsetLeft:f,offsetTop:h}=P(this.nodes,a),g=a.offsetWidth,d=a.offsetHeight,l=u.parentNode.className,p=this.generateMainBranch({pT:n,pL:o,pW:i,pH:s,cT:h,cL:f,cW:g,cH:d,direction:l,containerHeight:this.nodes.offsetHeight}),m=this.theme.palette,v=a.nodeObj.branchColor||m[c%m.length];if(a.style.borderColor=v,this.lines.appendChild(De(p,v,"3")),e&&e!==u)continue;const b=X("subLines"),y=u.lastChild;y.tagName==="svg"&&y.remove(),u.appendChild(b),Pe(this,b,v,u,l,!0)}this.renderArrow(),this.renderSummary(),this.bus.fire("linkDiv")},Pe=function(e,t,n,o,i,s){const r=o.firstChild,c=o.children[1].children;if(c.length===0)return;const u=r.offsetTop,a=r.offsetLeft,f=r.offsetWidth,h=r.offsetHeight;for(let g=0;g<c.length;g++){const d=c[g],l=d.firstChild,p=l.offsetTop,m=l.offsetLeft,v=l.offsetWidth,b=l.offsetHeight,y=l.firstChild.nodeObj.branchColor||n,S=e.generateSubBranch({pT:u,pL:a,pW:f,pH:h,cT:p,cL:m,cW:v,cH:b,direction:i,isFirst:s});t.appendChild(De(S,y,"2"));const N=l.children[1];if(N){if(!N.expanded)continue}else continue;Pe(e,t,y,d,i)}},$e={addChild:"插入子节点",addParent:"插入父节点",addSibling:"插入同级节点",removeNode:"删除节点",focus:"专注",cancelFocus:"取消专注",moveUp:"上移",moveDown:"下移",link:"连接",clickTips:"请点击目标节点",summary:"摘要"},He={cn:$e,zh_CN:$e,zh_TW:{addChild:"插入子節點",addParent:"插入父節點",addSibling:"插入同級節點",removeNode:"刪除節點",focus:"專注",cancelFocus:"取消專注",moveUp:"上移",moveDown:"下移",link:"連接",clickTips:"請點擊目標節點",summary:"摘要"},en:{addChild:"Add child",addParent:"Add parent",addSibling:"Add sibling",removeNode:"Remove node",focus:"Focus Mode",cancelFocus:"Cancel Focus Mode",moveUp:"Move up",moveDown:"Move down",link:"Link",clickTips:"Please click the target node",summary:"Summary"},ru:{addChild:"Добавить дочерний элемент",addParent:"Добавить родительский элемент",addSibling:"Добавить на этом уровне",removeNode:"Удалить узел",focus:"Режим фокусировки",cancelFocus:"Отменить режим фокусировки",moveUp:"Поднять выше",moveDown:"Опустить ниже",link:"Ссылка",clickTips:"Пожалуйста, нажмите на целевой узел",summary:"Описание"},ja:{addChild:"子ノードを追加する",addParent:"親ノードを追加します",addSibling:"兄弟ノードを追加する",removeNode:"ノードを削除",focus:"集中",cancelFocus:"集中解除",moveUp:"上へ移動",moveDown:"下へ移動",link:"コネクト",clickTips:"ターゲットノードをクリックしてください",summary:"概要"},pt:{addChild:"Adicionar item filho",addParent:"Adicionar item pai",addSibling:"Adicionar item irmao",removeNode:"Remover item",focus:"Modo Foco",cancelFocus:"Cancelar Modo Foco",moveUp:"Mover para cima",moveDown:"Mover para baixo",link:"Link",clickTips:"Favor clicar no item alvo",summary:"Resumo"},it:{addChild:"Aggiungi figlio",addParent:"Aggiungi genitore",addSibling:"Aggiungi fratello",removeNode:"Rimuovi nodo",focus:"Modalità Focus",cancelFocus:"Annulla Modalità Focus",moveUp:"Sposta su",moveDown:"Sposta giù",link:"Collega",clickTips:"Si prega di fare clic sul nodo di destinazione",summary:"Unisci nodi"},es:{addChild:"Agregar hijo",addParent:"Agregar padre",addSibling:"Agregar hermano",removeNode:"Eliminar nodo",focus:"Modo Enfoque",cancelFocus:"Cancelar Modo Enfoque",moveUp:"Mover hacia arriba",moveDown:"Mover hacia abajo",link:"Enlace",clickTips:"Por favor haga clic en el nodo de destino",summary:"Resumen"},fr:{addChild:"Ajout enfant",addParent:"Ajout parent",addSibling:"Ajout voisin",removeNode:"Supprimer",focus:"Cibler",cancelFocus:"Retour",moveUp:"Monter",moveDown:"Descendre",link:"Lier",clickTips:"Cliquer sur le noeud cible",summary:"Annoter"},ko:{addChild:"자식 추가",addParent:"부모 추가",addSibling:"형제 추가",removeNode:"노드 삭제",focus:"포커스 모드",cancelFocus:"포커스 모드 취소",moveUp:"위로 이동",moveDown:"아래로 이동",link:"연결",clickTips:"대상 노드를 클릭하십시오",summary:"요약"}},xo="";function Lt(e,t){t=t===!0?{focus:!0,link:!0}:t;const n=w=>{const x=document.createElement("div");return x.innerText=w,x.className="tips",x},o=(w,x,C)=>{const _=document.createElement("li");return _.id=w,_.innerHTML=`<span>${ee(x)}</span><span ${C?'class="key"':""}>${ee(C)}</span>`,_},i=He[e.locale]?e.locale:"en",s=He[i],r=o("cm-add_child",s.addChild,"Tab"),c=o("cm-add_parent",s.addParent,"Ctrl + Enter"),u=o("cm-add_sibling",s.addSibling,"Enter"),a=o("cm-remove_child",s.removeNode,"Delete"),f=o("cm-fucus",s.focus,""),h=o("cm-unfucus",s.cancelFocus,""),g=o("cm-up",s.moveUp,"PgUp"),d=o("cm-down",s.moveDown,"Pgdn"),l=o("cm-link",s.link,""),p=o("cm-link-bidirectional","Bidirectional Link",""),m=o("cm-summary",s.summary,""),v=document.createElement("ul");if(v.className="menu-list",v.appendChild(r),v.appendChild(c),v.appendChild(u),v.appendChild(a),t.focus&&(v.appendChild(f),v.appendChild(h)),v.appendChild(g),v.appendChild(d),v.appendChild(m),t.link&&(v.appendChild(l),v.appendChild(p)),t&&t.extend)for(let w=0;w<t.extend.length;w++){const x=t.extend[w],C=o(x.name,x.name,x.key||"");v.appendChild(C),C.onclick=_=>{x.onclick(_)}}const b=document.createElement("div");b.className="context-menu",b.appendChild(v),b.hidden=!0,e.container.append(b);let y=!0;const S=w=>{const x=w.target;if(me(x)){x.parentElement.tagName==="ME-ROOT"?y=!0:y=!1,y?(f.className="disabled",g.className="disabled",d.className="disabled",c.className="disabled",u.className="disabled",a.className="disabled"):(f.className="",g.className="",d.className="",c.className="",u.className="",a.className=""),b.hidden=!1,v.style.top="",v.style.bottom="",v.style.left="",v.style.right="";const C=v.getBoundingClientRect(),_=v.offsetHeight,B=v.offsetWidth,V=w.clientY-C.top,Y=w.clientX-C.left;_+V>window.innerHeight?(v.style.top="",v.style.bottom="0px"):(v.style.bottom="",v.style.top=V+15+"px"),B+Y>window.innerWidth?(v.style.left="",v.style.right="0px"):(v.style.right="",v.style.left=Y+10+"px")}};e.bus.addListener("showContextMenu",S),b.onclick=w=>{w.target===b&&(b.hidden=!0)},r.onclick=()=>{e.addChild(),b.hidden=!0},c.onclick=()=>{e.insertParent(),b.hidden=!0},u.onclick=()=>{y||(e.insertSibling("after"),b.hidden=!0)},a.onclick=()=>{y||(e.removeNodes(e.currentNodes||[]),b.hidden=!0)},f.onclick=()=>{y||(e.focusNode(e.currentNode),b.hidden=!0)},h.onclick=()=>{e.cancelFocus(),b.hidden=!0},g.onclick=()=>{y||(e.moveUpNode(),b.hidden=!0)},d.onclick=()=>{y||(e.moveDownNode(),b.hidden=!0)};const N=w=>{b.hidden=!0;const x=e.currentNode,C=n(s.clickTips);e.container.appendChild(C),e.map.addEventListener("click",_=>{_.preventDefault(),C.remove();const B=_.target;(B.parentElement.tagName==="ME-PARENT"||B.parentElement.tagName==="ME-ROOT")&&e.createArrow(x,B,w)},{once:!0})};return l.onclick=()=>N(),p.onclick=()=>N({bidirectional:!0}),m.onclick=()=>{b.hidden=!0,e.createSummary(),e.unselectNodes(e.currentNodes)},()=>{r.onclick=null,c.onclick=null,u.onclick=null,a.onclick=null,f.onclick=null,h.onclick=null,g.onclick=null,d.onclick=null,l.onclick=null,m.onclick=null,b.onclick=null,e.container.oncontextmenu=null}}const we=document,Mt=function(e,t){if(!t)return xe(e),e;let n=e.querySelector(".insert-preview");const o=`insert-preview ${t} show`;return n||(n=we.createElement("div"),e.appendChild(n)),n.className=o,e},xe=function(e){if(!e)return;const t=e.querySelectorAll(".insert-preview");for(const n of t||[])n.remove()},Be=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},Dt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.container.appendChild(t),t};class Ot{constructor(t){Q(this,"mind");Q(this,"isMoving",!1);Q(this,"interval",null);Q(this,"speed",20);this.mind=t}move(t,n){this.isMoving||(this.isMoving=!0,this.interval=setInterval(()=>{this.mind.move(t*this.speed*this.mind.scaleVal,n*this.speed*this.mind.scaleVal)},100))}stop(){this.isMoving=!1,clearInterval(this.interval)}}function jt(e){let t=null,n=null;const o=Dt(e),i=new Ot(e),s=a=>{e.selection.cancel();const f=a.target;if((f==null?void 0:f.tagName)!=="ME-TPC"){a.preventDefault();return}let h=e.currentNodes;h!=null&&h.includes(f)||(e.selectNode(f),h=e.currentNodes),e.dragged=h,h.length>1?o.innerHTML=h.length+"":o.innerHTML=f.innerHTML;for(const g of h)g.parentElement.parentElement.style.opacity="0.5";a.dataTransfer.setDragImage(o,0,0),a.dataTransfer.dropEffect="move",e.dragMoveHelper.clear()},r=a=>{const{dragged:f}=e;if(!f)return;i.stop();for(const g of f)g.parentElement.parentElement.style.opacity="1";const h=a.target;h.style.opacity="",n&&(xe(n),t==="before"?e.moveNodeBefore(f,n):t==="after"?e.moveNodeAfter(f,n):t==="in"&&e.moveNodeIn(f,n),e.dragged=null)},c=a=>{a.preventDefault();const f=12*e.scaleVal,{dragged:h}=e;if(!h)return;const g=e.container.getBoundingClientRect();a.clientX<g.x+50?i.move(1,0):a.clientX>g.x+g.width-50?i.move(-1,0):a.clientY<g.y+50?i.move(0,1):a.clientY>g.y+g.height-50?i.move(0,-1):i.stop(),xe(n);const d=we.elementFromPoint(a.clientX,a.clientY-f);if(Be(d,h)){n=d;const l=d.getBoundingClientRect(),p=l.y;a.clientY>p+l.height?t="after":t="in"}else{const l=we.elementFromPoint(a.clientX,a.clientY+f),p=l.getBoundingClientRect();if(Be(l,h)){n=l;const m=p.y;a.clientY<m?t="before":t="in"}else t=n=null}n&&Mt(n,t)};return ve([{dom:e.map,evt:"dragstart",func:s},{dom:e.map,evt:"dragend",func:r},{dom:e.map,evt:"dragover",func:c}])}const Pt=function(e){return["createSummary","removeSummary","finishEditSummary"].includes(e.name)?{type:"summary",value:e.obj.id}:["createArrow","removeArrow","finishEditArrowLabel"].includes(e.name)?{type:"arrow",value:e.obj.id}:["removeNodes","copyNodes","moveNodeBefore","moveNodeAfter","moveNodeIn"].includes(e.name)?{type:"nodes",value:e.objs.map(t=>t.id)}:{type:"node",value:e.obj.id}};function $t(e){let t=[],n=-1,o=e.getData();e.undo=function(){if(n>-1){const r=t[n];o=r.prev,e.refresh(r.prev);try{r.currentObject.type==="node"?e.selectNode(this.findEle(r.currentObject.value)):r.currentObject.type==="nodes"&&e.selectNodes(r.currentObject.value.map(c=>this.findEle(c)))}catch{}finally{n--}}},e.redo=function(){if(n<t.length-1){n++;const r=t[n];o=r.next,e.refresh(r.next),r.currentObject.type==="node"?e.selectNode(this.findEle(r.currentObject.value)):r.currentObject.type==="nodes"&&(e.unselectNodes(this.currentNodes),e.selectNodes(r.currentObject.value.map(c=>this.findEle(c))))}};const i=function(r){if(r.name==="beginEdit")return;t=t.slice(0,n+1);const c=e.getData();t.push({prev:o,currentObject:Pt(r),next:c}),o=c,n=t.length-1},s=function(r){(r.metaKey||r.ctrlKey)&&(r.shiftKey&&r.key==="Z"||r.key==="y")?e.redo():(r.metaKey||r.ctrlKey)&&r.key==="z"&&e.undo()};return e.bus.addListener("operation",i),e.map.addEventListener("keydown",s),()=>{e.bus.removeListener("operation",i),e.map.removeEventListener("keydown",s)}}const Ht='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>',Bt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>',Rt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>',Ft='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>',It='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>',Wt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>',Vt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>',Eo="",Yt={side:Ht,left:Bt,right:Rt,full:Ft,living:It,zoomin:Wt,zoomout:Vt},I=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=Yt[t],n};function Gt(e){const t=document.createElement("div"),n=I("fullscreen","full"),o=I("toCenter","living"),i=I("zoomout","zoomout"),s=I("zoomin","zoomin"),r=document.createElement("span");return r.innerText="100%",t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(s),t.className="mind-elixir-toolbar rb",n.onclick=()=>{document.fullscreenElement===e.el?document.exitFullscreen():e.el.requestFullscreen()},o.onclick=()=>{e.toCenter()},i.onclick=()=>{e.scaleVal<.6||e.scale(e.scaleVal-e.scaleSensitivity)},s.onclick=()=>{e.scaleVal>1.6||e.scale(e.scaleVal+e.scaleSensitivity)},t}function Kt(e){const t=document.createElement("div"),n=I("tbltl","left"),o=I("tbltr","right"),i=I("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 qt(e){e.container.append(Gt(e)),e.container.append(Kt(e))}/*! @viselect/vanilla v3.9.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */class zt{constructor(){this._listeners=new Map,this.on=this.addEventListener,this.off=this.removeEventListener,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 Re=(e,t="px")=>typeof e=="number"?e+t:e,$=({style:e},t,n)=>{if(typeof t=="object")for(const[o,i]of Object.entries(t))i!==void 0&&(e[o]=Re(i));else n!==void 0&&(e[t]=Re(n))},Fe=(e=0,t=0,n=0,o=0)=>{const i={x:e,y:t,width:n,height:o,top:t,left:e,right:e+n,bottom:t+o};return{...i,toJSON:()=>JSON.stringify(i)}},Ut=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}}},Ie=(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}},Xt=()=>matchMedia("(hover: none), (pointer: coarse)").matches,Jt=()=>"safari"in window,Ee=e=>Array.isArray(e)?e:[e],We=e=>(t,n,o,i={})=>{(t instanceof HTMLCollection||t instanceof NodeList)&&(t=Array.from(t)),n=Ee(n),t=Ee(t);for(const s of t)if(s)for(const r of n)s[e](r,o,{capture:!1,...i})},H=We("addEventListener"),M=We("removeEventListener"),re=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}},q=(e,t=document)=>Ee(e).map(n=>typeof n=="string"?Array.from(t.querySelectorAll(n)):n instanceof Element?n:null).flat().filter(Boolean),Zt=(e,t)=>t.some(n=>typeof n=="number"?e.button===n:typeof n=="object"?n.button!==e.button?!1:n.modifiers.every(o=>{switch(o){case"alt":return e.altKey;case"ctrl":return e.ctrlKey||e.metaKey;case"shift":return e.shiftKey}}):!1),{abs:W,max:Ve,min:Ye,ceil:Ge}=Math,Ke=(e=[])=>({stored:e,selected:[],touched:[],changed:{added:[],removed:[]}}),qe=class extends zt{constructor(t){var n,o,i,s,r;super(),this._selection=Ke(),this._targetBoundaryScrolled=!0,this._selectables=[],this._areaLocation={y1:0,x2:0,y2:0,x1:0},this._areaRect=Fe(),this._singleClick=!0,this._scrollAvailable=!0,this._scrollingActive=!1,this._scrollSpeed={x:0,y:0},this._scrollDelta={x:0,y:0},this._lastMousePosition={x:0,y:0},this.enable=this._toggleStartEvents,this.disable=this._toggleStartEvents.bind(this,!1),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,...(s=(i=t.behaviour)==null?void 0:i.scrolling)==null?void 0:s.startScrollMargins}}},features:{range:!0,touch:!0,deselectOnBlur:!1,...t.features,singleTap:{allow:!0,intersect:"native",...(r=t.features)==null?void 0:r.singleTap}}};for(const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[f]=="function"&&(this[f]=this[f].bind(this));const{document:c,selectionAreaClass:u,selectionContainerClass:a}=this._options;this._area=c.createElement("div"),this._clippingElement=c.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(u),a&&this._clippingElement.classList.add(a),$(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),$(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Ut(f=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",f),this._redrawSelectionArea()}),this.enable()}_toggleStartEvents(t=!0){const{document:n,features:o}=this._options,i=t?H:M;i(n,"mousedown",this._onTapStart),o.touch&&i(n,"touchstart",this._onTapStart,{passive:!1})}_onTapStart(t,n=!1){const{x:o,y:i,target:s}=re(t),{document:r,startAreas:c,boundaries:u,features:a,behaviour:f}=this._options,h=s.getBoundingClientRect();if(t instanceof MouseEvent&&!Zt(t,f.triggers))return;const g=q(c,r),d=q(u,r);this._targetElement=d.find(v=>Ie(v.getBoundingClientRect(),h));const l=t.composedPath(),p=g.find(v=>l.includes(v));if(this._targetBoundary=d.find(v=>l.includes(v)),!this._targetElement||!p||!this._targetBoundary||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:o,y1:i,x2:0,y2:0};const m=r.scrollingElement??r.body;this._scrollDelta={x:m.scrollLeft,y:m.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),H(r,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),H(r,["mouseup","touchcancel","touchend"],this._onTapStop),H(r,"scroll",this._onScroll),a.deselectOnBlur&&(this._targetBoundaryScrolled=!1,H(this._targetBoundary,"scroll",this._onStartAreaScroll))}_onSingleTap(t){const{singleTap:{intersect:n},range:o}=this._options.features,i=re(t);let s;if(n==="native")s=i.target;else if(n==="touch"){this.resolveSelectables();const{x:c,y:u}=i;s=this._selectables.find(a=>{const{right:f,left:h,top:g,bottom:d}=a.getBoundingClientRect();return c<f&&c>h&&u<d&&u>g})}if(!s)return;for(this.resolveSelectables();!this._selectables.includes(s);)if(s.parentElement)s=s.parentElement;else{this._targetBoundaryScrolled||this.clearSelection();return}const{stored:r}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&o&&this._latestElement){const c=this._latestElement,[u,a]=c.compareDocumentPosition(s)&4?[s,c]:[c,s],f=[...this._selectables.filter(h=>h.compareDocumentPosition(u)&4&&h.compareDocumentPosition(a)&2),u,a];this.select(f),this._latestElement=c}else r.includes(s)&&(r.length===1||t.ctrlKey||r.every(c=>this._selection.stored.includes(c)))?this.deselect(s):(this.select(s),this._latestElement=s)}_delayedTapMove(t){const{container:n,document:o,behaviour:{startThreshold:i}}=this._options,{x1:s,y1:r}=this._areaLocation,{x:c,y:u}=re(t);if(typeof i=="number"&&W(c+u-(s+r))>=i||typeof i=="object"&&W(c-s)>=i.x||W(u-r)>=i.y){if(M(o,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){M(o,["mouseup","touchcancel","touchend"],this._onTapStop);return}H(o,["mousemove","touchmove"],this._onTapMove,{passive:!1}),$(this._area,"display","block"),q(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&&(H(this._targetElement,"wheel",this._wheelScroll,{passive:!1}),H(this._options.document,"keydown",this._keyboardScroll,{passive:!1}),this._selectables=this._selectables.filter(a=>this._targetElement.contains(a))),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?($(t,{top:i.top,left:i.left,width:i.width,height:i.height}),$(o,{marginTop:-i.top,marginLeft:-i.left})):($(t,{top:0,left:0,width:"100%",height:"100%"}),$(o,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{_scrollSpeed:n,_areaLocation:o,_options:i,_frame:s}=this,{speedDivider:r}=i.behaviour.scrolling,c=this._targetElement,{x:u,y:a}=re(t);if(o.x2=u,o.y2=a,this._lastMousePosition.x=u,this._lastMousePosition.y=a,this._scrollAvailable&&!this._scrollingActive&&(n.y||n.x)){this._scrollingActive=!0;const f=()=>{if(!n.x&&!n.y){this._scrollingActive=!1;return}const{scrollTop:h,scrollLeft:g}=c;n.y&&(c.scrollTop+=Ge(n.y/r),o.y1-=c.scrollTop-h),n.x&&(c.scrollLeft+=Ge(n.x/r),o.x1-=c.scrollLeft-g),s.next(t),requestAnimationFrame(f)};requestAnimationFrame(f)}else s.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&Xt()||this._scrollAvailable&&Jt())&&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)}_onStartAreaScroll(){this._targetBoundaryScrolled=!0,M(this._targetElement,"scroll",this._onStartAreaScroll)}_wheelScroll(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()}_keyboardScroll(t){const{manualSpeed:n}=this._options.behaviour.scrolling,o=t.key==="ArrowLeft"?-1:t.key==="ArrowRight"?1:0,i=t.key==="ArrowUp"?-1:t.key==="ArrowDown"?1:0;this._scrollSpeed.x+=Math.sign(o)*n,this._scrollSpeed.y+=Math.sign(i)*n,t.preventDefault(),this._onTapMove({clientX:this._lastMousePosition.x,clientY:this._lastMousePosition.y,preventDefault:()=>{}})}_recalculateSelectionAreaRect(){const{_scrollSpeed:t,_areaLocation:n,_targetElement:o,_options:i}=this,{scrollTop:s,scrollHeight:r,clientHeight:c,scrollLeft:u,scrollWidth:a,clientWidth:f}=o,h=this._targetRect,{x1:g,y1:d}=n;let{x2:l,y2:p}=n;const{behaviour:{scrolling:{startScrollMargins:m}}}=i;l<h.left+m.x?(t.x=u?-W(h.left-l+m.x):0,l=l<h.left?h.left:l):l>h.right-m.x?(t.x=a-u-f?W(h.left+h.width-l-m.x):0,l=l>h.right?h.right:l):t.x=0,p<h.top+m.y?(t.y=s?-W(h.top-p+m.y):0,p=p<h.top?h.top:p):p>h.bottom-m.y?(t.y=r-s-c?W(h.top+h.height-p-m.y):0,p=p>h.bottom?h.bottom:p):t.y=0;const v=Ye(g,l),b=Ye(d,p),y=Ve(g,l),S=Ve(d,p);this._areaRect=Fe(v,b,y-v,S-b)}_redrawSelectionArea(){const{x:t,y:n,width:o,height:i}=this._areaRect,{style:s}=this._area;s.left=`${t}px`,s.top=`${n}px`,s.width=`${o}px`,s.height=`${i}px`}_onTapStop(t,n){var o;const{document:i,features:s}=this._options,{_singleClick:r}=this;M(this._targetElement,"scroll",this._onStartAreaScroll),M(i,["mousemove","touchmove"],this._delayedTapMove),M(i,["touchmove","mousemove"],this._onTapMove),M(i,["mouseup","touchcancel","touchend"],this._onTapStop),M(i,"scroll",this._onScroll),this._keepSelection(),t&&r&&s.singleTap.allow?this._onSingleTap(t):!r&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,M(this._targetElement,"wheel",this._wheelScroll,{passive:!0}),M(this._options.document,"keydown",this._keyboardScroll,{passive:!0}),this._clippingElement.remove(),(o=this._frame)==null||o.cancel(),$(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:o,_areaRect:i}=this,{stored:s,selected:r,touched:c}=o,{intersect:u,overlap:a}=n.behaviour,f=a==="invert",h=[],g=[],d=[];for(let p=0;p<t.length;p++){const m=t[p];if(Ie(i,m.getBoundingClientRect(),u)){if(r.includes(m))s.includes(m)&&!c.includes(m)&&c.push(m);else if(f&&s.includes(m)){d.push(m);continue}else g.push(m);h.push(m)}}f&&g.push(...s.filter(p=>!r.includes(p)));const l=a==="keep";for(let p=0;p<r.length;p++){const m=r[p];!h.includes(m)&&!(l&&s.includes(m))&&d.push(m)}o.selected=h,o.changed={added:g,removed:d},this._latestElement=void 0}_emitEvent(t,n){return this.emit(t,{event:n,store:this._selection,selection:this})}_keepSelection(){const{_options:t,_selection:n}=this,{selected:o,changed:i,touched:s,stored:r}=n,c=o.filter(u=>!r.includes(u));switch(t.behaviour.overlap){case"drop":{n.stored=[...c,...r.filter(u=>!s.includes(u))];break}case"invert":{n.stored=[...c,...r.filter(u=>!i.removed.includes(u))];break}case"keep":{n.stored=[...r,...o.filter(u=>!r.includes(u))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=q(this._options.selectables,this._options.document)}clearSelection(t=!0,n=!1){const{selected:o,stored:i,changed:s}=this._selection;s.added=[],s.removed.push(...o,...t?i:[]),n||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection=Ke(t?[]:i)}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}getSelectables(){return this._selectables}setAreaLocation(t){Object.assign(this._areaLocation,t),this._redrawSelectionArea()}getAreaLocation(){return this._areaLocation}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:s}=this._selection,r=q(t,this._options.document).filter(c=>!i.includes(c)&&!s.includes(c));return s.push(...r),i.push(...r),o.added.push(...r),o.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),r}deselect(t,n=!1){const{selected:o,stored:i,changed:s}=this._selection,r=q(t,this._options.document).filter(c=>o.includes(c)||i.includes(c));this._selection.stored=i.filter(c=>!r.includes(c)),this._selection.selected=o.filter(c=>!r.includes(c)),this._selection.changed.added=[],this._selection.changed.removed.push(...r.filter(c=>!s.removed.includes(c))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null))}};qe.version="3.9.0";let Qt=qe;function en(e){const t=e.mouseSelectionButton===2?[2]:[0],n=new Qt({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.selectionContainer,features:{touch:!1},behaviour:{triggers:t,scrolling:{speedDivider:10,manualSpeed:750,startScrollMargins:{x:10,y:10}}}}).on("beforestart",({event:o})=>{var r;const i=o.target;if(i.id==="input-box"||i.className==="circle"||(r=e.container.querySelector(".context-menu"))!=null&&r.contains(i))return!1;if(!o.ctrlKey&&!o.metaKey){if(i.tagName==="ME-TPC"&&i.classList.contains("selected"))return!1;e.clearSelection()}const s=n.getSelectionArea();return s.style.background="#4f90f22d",s.style.border="1px solid #4f90f2",s.parentElement&&(s.parentElement.style.zIndex="9999"),!0}).on("move",({store:{changed:{added:o,removed:i}}})=>{if(o.length>0||i.length>0,o.length>0){for(const s of o)s.className="selected";e.currentNodes=[...e.currentNodes,...o],e.bus.fire("selectNodes",o.map(s=>s.nodeObj))}if(i.length>0){for(const s of i)s.classList.remove("selected");e.currentNodes=e.currentNodes.filter(s=>!(i!=null&&i.includes(s))),e.bus.fire("unselectNodes",i.map(s=>s.nodeObj))}});e.selection=n}const tn=function(e,t=!0){this.theme=e;const o={...(e.type==="dark"?fe:ue).cssVar,...e.cssVar},i=Object.keys(o);for(let s=0;s<i.length;s++){const r=i[s];this.container.style.setProperty(r,o[r])}t&&this.refresh()},z=e=>{var o;const t=(o=e.parent)==null?void 0:o.children,n=(t==null?void 0:t.indexOf(e))??0;return{siblings:t,index:n}};function nn(e){const{siblings:t,index:n}=z(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 on(e){const{siblings:t,index:n}=z(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 ze(e){const{siblings:t,index:n}=z(e);return t===void 0?0:(t.splice(n,1),t.length)}function sn(e,t,n){const{siblings:o,index:i}=z(n);o!==void 0&&(t==="before"?o.splice(i,0,e):o.splice(i+1,0,e))}function rn(e,t){const{siblings:n,index:o}=z(e);n!==void 0&&(n[o]=t,t.children=[e])}function Ue(e,t,n){var o;if(ze(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:s}=z(n);if(i===void 0)return;e==="before"?i.splice(s,0,t):i.splice(s+1,0,t)}}const cn=function({map:e,direction:t},n){var o,i;if(t===0)return 0;if(t===1)return 1;if(t===2){const s=((o=e.querySelector(".lhs"))==null?void 0:o.childElementCount)||0,r=((i=e.querySelector(".rhs"))==null?void 0:i.childElementCount)||0;return s<=r?(n.direction=0,0):(n.direction=1,1)}},Xe=function(e,t,n){var s,r;const o=n.children[0].children[0],i=t.parentElement;if(i.tagName==="ME-PARENT"){if(J(o),i.children[1])i.nextSibling.appendChild(n);else{const c=e.createChildren([n]);i.appendChild(ye(!0)),i.insertAdjacentElement("afterend",c)}e.linkDiv(n.offsetParent)}else i.tagName==="ME-ROOT"&&(cn(e,o.nodeObj)===0?(s=e.container.querySelector(".lhs"))==null||s.appendChild(n):(r=e.container.querySelector(".rhs"))==null||r.appendChild(n),e.linkDiv())},ln=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()},Je={before:"beforebegin",after:"afterend"},J=function(e){const n=e.parentElement.parentElement.lastElementChild;(n==null?void 0:n.tagName)==="svg"&&(n==null||n.remove())},an=function(e,t){const n=e.nodeObj,o=ge(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const i=Object.assign(n,t);be(e,i),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:i,origin:o})},Se=function(e,t,n){if(!t)return null;const o=t.nodeObj;o.expanded===!1&&(e.expandNode(t,!0),t=e.findEle(o.id));const i=n||e.generateNewObj();o.children?o.children.push(i):o.children=[i],j(e.nodeData);const{grp:s,top:r}=e.createWrapper(i);return Xe(e,t,s),{newTop:r,newNodeObj:i}},dn=function(e,t,n){var a,f,h,g;const o=t||this.currentNode;if(!o)return;const i=o.nodeObj;if(i.parent){if(!((a=i.parent)!=null&&a.parent)&&((h=(f=i.parent)==null?void 0:f.children)==null?void 0:h.length)===1&&this.direction===2){this.addChild(this.findEle(i.parent.id),n);return}}else{this.addChild();return}const s=n||this.generateNewObj();if(!((g=i.parent)!=null&&g.parent)){const d=o.closest("me-main").className===L.LHS?0:1;s.direction=d}sn(s,e,i),j(this.nodeData);const r=o.parentElement,{grp:c,top:u}=this.createWrapper(s);r.parentElement.insertAdjacentElement(Je[e],c),this.linkDiv(c.offsetParent),n||this.editTopic(u.firstChild),this.selectNode(u.firstChild,!0),this.bus.fire("operation",{name:"insertSibling",type:e,obj:s})},hn=function(e,t){const n=e||this.currentNode;if(!n)return;J(n);const o=n.nodeObj;if(!o.parent)return;const i=t||this.generateNewObj();rn(o,i),j(this.nodeData);const s=n.parentElement.parentElement,{grp:r,top:c}=this.createWrapper(i,!0);c.appendChild(ye(!0)),s.insertAdjacentElement("afterend",r);const u=this.createChildren([s]);c.insertAdjacentElement("afterend",u),this.linkDiv(),t||this.editTopic(c.firstChild),this.selectNode(c.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:i})},un=function(e,t){const n=e||this.currentNode;if(!n)return;const o=Se(this,n,t);if(!o)return;const{newTop:i,newNodeObj:s}=o;this.bus.fire("operation",{name:"addChild",obj:s}),t||this.editTopic(i.firstChild),this.selectNode(i.firstChild,!0)},fn=function(e,t){const n=ge(e.nodeObj);pe(n);const o=Se(this,t,n);if(!o)return;const{newNodeObj:i}=o;this.selectNode(this.findEle(i.id)),this.bus.fire("operation",{name:"copyNode",obj:i})},pn=function(e,t){e=oe(e);const n=[];for(let o=0;o<e.length;o++){const i=e[o],s=ge(i.nodeObj);pe(s);const r=Se(this,t,s);if(!r)return;const{newNodeObj:c}=r;n.push(c)}this.unselectNodes(this.currentNodes),this.selectNodes(n.map(o=>this.findEle(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},gn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;nn(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},mn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;on(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})},vn=function(e){if(e.length===0)return;e=oe(e);for(const n of e){const o=n.nodeObj,i=ze(o);ln(n,i)}const t=e[e.length-1];this.selectNode(this.findEle(t.nodeObj.parent.id)),this.linkDiv(),this.bus.fire("operation",{name:"removeNodes",objs:e.map(n=>n.nodeObj)})},bn=function(e,t){e=oe(e);const n=t.nodeObj;n.expanded===!1&&(this.expandNode(t,!0),t=this.findEle(n.id));for(const o of e){const i=o.nodeObj;Ue("in",i,n),j(this.nodeData);const s=o.parentElement;Xe(this,t,s.parentElement)}this.linkDiv(),this.bus.fire("operation",{name:"moveNodeIn",objs:e.map(o=>o.nodeObj),toObj:n})},Ze=(e,t,n,o)=>{e=oe(e),t==="after"&&(e=e.reverse());const i=n.nodeObj,s=[];for(const r of e){const c=r.nodeObj;Ue(t,c,i),j(o.nodeData),J(r);const u=r.parentElement.parentNode;s.includes(u.parentElement)||s.push(u.parentElement),n.parentElement.parentNode.insertAdjacentElement(Je[t],u)}for(const r of s)r.childElementCount===0&&r.tagName!=="ME-MAIN"&&(r.previousSibling.children[1].remove(),r.remove());o.linkDiv(),o.bus.fire("operation",{name:t==="before"?"moveNodeBefore":"moveNodeAfter",objs:e.map(r=>r.nodeObj),toObj:i})},Qe=Object.freeze(Object.defineProperty({__proto__:null,addChild:un,beginEdit:function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},copyNode:fn,copyNodes:pn,insertParent:hn,insertSibling:dn,moveDownNode:mn,moveNodeAfter:function(e,t){Ze(e,"after",t,this)},moveNodeBefore:function(e,t){Ze(e,"before",t,this)},moveNodeIn:bn,moveUpNode:gn,removeNodes:vn,reshapeNode:an,rmSubline:J,setNodeTopic:function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"}));function yn(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme}}const wn=function(e){const t=this.container,n=e.getBoundingClientRect(),o=t.getBoundingClientRect();if(n.top>o.bottom||n.bottom<o.top||n.left>o.right||n.right<o.left){const s=n.left+n.width/2,r=n.top+n.height/2,c=o.left+o.width/2,u=o.top+o.height/2,a=s-c,f=r-u;this.move(-a,-f)}},xn=function(e,t,n){this.clearSelection(),this.scrollIntoView(e),this.selection.select(e),t&&this.bus.fire("selectNewNode",e.nodeObj)},En=function(e){this.selection.select(e)},Sn=function(e){this.selection.deselect(e)},Cn=function(){this.unselectNodes(this.currentNodes),this.unselectSummary(),this.unselectArrow()},Nn=function(){const e=yn(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},_n=function(){return JSON.parse(this.getDataString())},kn=function(){this.editable=!0},Tn=function(){this.editable=!1},An=function(e,t={x:0,y:0}){const n=this.container.getBoundingClientRect(),o=t.x?t.x-n.left-n.width/2:0,i=t.y?t.y-n.top-n.height/2:0,{dx:s,dy:r}=et(this),c=this.map.style.transform,{x:u,y:a}=ke(c),f=u-s,h=a-r,g=this.scaleVal,d=(-o+f)*(1-e/g),l=(-i+h)*(1-e/g);this.map.style.transform=`translate(${u-d}px, ${a-l}px) scale(${e})`,this.scaleVal=e,this.bus.fire("scale",e)},Ln=function(){const e=this.nodes.offsetHeight/this.container.offsetHeight,t=this.nodes.offsetWidth/this.container.offsetWidth,n=1/Math.max(1,Math.max(e,t));this.scaleVal=n,this.map.style.transform="scale("+n+")",this.bus.fire("scale",n)},Mn=function(e,t){const{map:n,scaleVal:o,bus:i}=this,s=n.style.transform;let{x:r,y:c}=ke(s);r+=e,c+=t,n.style.transform=`translate(${r}px, ${c}px) scale(${o})`,i.fire("move",{dx:e,dy:t})},et=e=>{const{container:t,map:n,nodes:o}=e,i=n.querySelector("me-root"),s=i.offsetTop,r=i.offsetLeft,c=i.offsetWidth,u=i.offsetHeight;let a,f;return e.alignment==="root"?(a=t.offsetWidth/2-r-c/2,f=t.offsetHeight/2-s-u/2,n.style.transformOrigin=`${r+c/2}px 50%`):(a=(t.offsetWidth-o.offsetWidth)/2,f=(t.offsetHeight-o.offsetHeight)/2,n.style.transformOrigin="50% 50%"),{dx:a,dy:f}},Dn=Object.freeze(Object.defineProperty({__proto__:null,cancelFocus:function(){this.isFocusMode=!1,this.tempDirection!==null&&(this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.refresh(),this.toCenter())},clearSelection:Cn,disableEdit:Tn,enableEdit:kn,expandNode:function(e,t){const n=e.nodeObj;typeof t=="boolean"?n.expanded=t:n.expanded!==!1?n.expanded=!1:n.expanded=!0;const o=e.parentNode,i=o.children[1];if(i.expanded=n.expanded,i.className=n.expanded?"minus":"",J(e),n.expanded){const u=this.createChildren(n.children.map(a=>this.createWrapper(a).grp));o.parentNode.appendChild(u)}else o.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const s=e.getBoundingClientRect(),r=this.container.getBoundingClientRect();(s.bottom>r.bottom||s.top<r.top||s.right>r.right||s.left<r.left)&&this.scrollIntoView(e),this.bus.fire("expandNode",n)},expandNodeAll:function(e,t){const n=e.nodeObj,o=(i,s)=>{i.expanded=s,i.children&&i.children.forEach(r=>{o(r,s)})};typeof t=="boolean"?o(n,t):n.expanded!==!1?o(n,!1):o(n,!0),this.refresh()},focusNode:function(e){e.nodeObj.parent&&(this.clearSelection(),this.tempDirection===null&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.initRight(),this.toCenter())},getData:_n,getDataString:Nn,initLeft:function(){this.direction=0,this.refresh(),this.toCenter()},initRight:function(){this.direction=1,this.refresh(),this.toCenter()},initSide:function(){this.direction=2,this.refresh(),this.toCenter()},install:function(e){e(this)},move:Mn,refresh:function(e){e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.arrows=e.arrows||[],this.summaries=e.summaries||[]),j(this.nodeData),this.layout(),this.linkDiv()},scale:An,scaleFit:Ln,scrollIntoView:wn,selectNode:xn,selectNodes:En,setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){const{map:e}=this,{dx:t,dy:n}=et(this);e.style.transform=`translate(${t}px, ${n}px) scale(${this.scaleVal})`},unselectNodes:Sn},Symbol.toStringTag,{value:"Module"})),tt={create:function(e){return{dom:e,moved:!1,pointerdown:!1,lastX:0,lastY:0,handlePointerMove(t){if(this.pointerdown){this.moved=!0;const n=t.clientX-this.lastX,o=t.clientY-this.lastY;this.lastX=t.clientX,this.lastY=t.clientY,this.cb&&this.cb(n,o)}},handlePointerDown(t){t.button===0&&(this.pointerdown=!0,this.lastX=t.clientX,this.lastY=t.clientY,this.dom.setPointerCapture(t.pointerId))},handleClear(t){this.pointerdown=!1,t.pointerId!==void 0&&this.dom.releasePointerCapture(t.pointerId)},cb:null,init(t,n){this.cb=n,this.handleClear=this.handleClear.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerDown=this.handlePointerDown.bind(this),this.destroy=ve([{dom:t,evt:"pointermove",func:this.handlePointerMove},{dom:t,evt:"pointerleave",func:this.handleClear},{dom:t,evt:"pointerup",func:this.handleClear},{dom:this.dom,evt:"pointerdown",func:this.handlePointerDown}])},destroy:null,clear(){this.moved=!1,this.pointerdown=!1}}}},On="#4dc4ff";function nt(e,t,n,o,i,s,r,c){return{x:e/8+n*3/8+i*3/8+r/8,y:t/8+o*3/8+s*3/8+c/8}}function jn(e,t,n){E(e,{x:t+"",y:n+""})}function ce(e,t,n,o,i){E(e,{x1:t+"",y1:n+"",x2:o+"",y2:i+""})}function ot(e,t,n,o,i,s,r,c,u,a){var d;if(e.line.setAttribute("d",`M ${t} ${n} C ${o} ${i} ${s} ${r} ${c} ${u}`),a.style){const l=a.style;l.stroke&&e.line.setAttribute("stroke",l.stroke),l.strokeWidth&&e.line.setAttribute("stroke-width",String(l.strokeWidth)),l.strokeDasharray&&e.line.setAttribute("stroke-dasharray",l.strokeDasharray),l.strokeLinecap&&e.line.setAttribute("stroke-linecap",l.strokeLinecap),l.opacity!==void 0&&e.line.setAttribute("opacity",String(l.opacity))}const f=ne(s,r,c,u);if(f&&(e.arrow1.setAttribute("d",`M ${f.x1} ${f.y1} L ${c} ${u} L ${f.x2} ${f.y2}`),a.style)){const l=a.style;l.stroke&&e.arrow1.setAttribute("stroke",l.stroke),l.strokeWidth&&e.arrow1.setAttribute("stroke-width",String(l.strokeWidth)),l.strokeLinecap&&e.arrow1.setAttribute("stroke-linecap",l.strokeLinecap),l.opacity!==void 0&&e.arrow1.setAttribute("opacity",String(l.opacity))}if(a.bidirectional){const l=ne(o,i,t,n);if(l&&(e.arrow2.setAttribute("d",`M ${l.x1} ${l.y1} L ${t} ${n} L ${l.x2} ${l.y2}`),a.style)){const p=a.style;p.stroke&&e.arrow2.setAttribute("stroke",p.stroke),p.strokeWidth&&e.arrow2.setAttribute("stroke-width",String(p.strokeWidth)),p.strokeLinecap&&e.arrow2.setAttribute("stroke-linecap",p.strokeLinecap),p.opacity!==void 0&&e.arrow2.setAttribute("opacity",String(p.opacity))}}const{x:h,y:g}=nt(t,n,o,i,s,r,c,u);jn(e.label,h,g),(d=a.style)!=null&&d.labelColor&&e.label.setAttribute("fill",a.style.labelColor),Vn(e)}function le(e,t,n){const{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=t.offsetWidth,r=t.offsetHeight,c=o+s/2,u=i+r/2,a=c+n.x,f=u+n.y;return{w:s,h:r,cx:c,cy:u,ctrlX:a,ctrlY:f}}function U(e){let t,n;const o=(e.cy-e.ctrlY)/(e.ctrlX-e.cx);return o>e.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 Pn=function(e,t,n,o){const i=document.createElementNS(k,"text");return E(i,{"text-anchor":"middle",x:t+"",y:n+"",fill:o||"rgb(235, 95, 82)"}),i.dataset.type="custom-link",i.innerHTML=e,i},Ce=function(e,t,n,o,i){var x;if(!t||!n)return;const s=le(e,t,o.delta1),r=le(e,n,o.delta2),{x:c,y:u}=U(s),{ctrlX:a,ctrlY:f}=s,{ctrlX:h,ctrlY:g}=r,{x:d,y:l}=U(r),p=ne(h,g,d,l);if(!p)return;const m=`M ${p.x1} ${p.y1} L ${d} ${l} L ${p.x2} ${p.y2}`;let v="";if(o.bidirectional){const C=ne(a,f,c,u);if(!C)return;v=`M ${C.x1} ${C.y1} L ${c} ${u} L ${C.x2} ${C.y2}`}const b=Tt(`M ${c} ${u} C ${a} ${f} ${h} ${g} ${d} ${l}`,m,v,o.style),{x:y,y:S}=nt(c,u,a,f,h,g,d,l),N=(x=o.style)==null?void 0:x.labelColor,w=Pn(o.label,y,S,N);b.appendChild(w),b.label=w,b.arrowObj=o,b.dataset.linkid=o.id,e.linkSvgGroup.appendChild(b),i||(e.arrows.push(o),e.currentArrow=b,it(e,o,s,r))},$n=function(e,t,n={}){const o={id:R(),label:"Custom Link",from:e.nodeObj.id,to:t.nodeObj.id,delta1:{x:e.offsetWidth/2+100,y:0},delta2:{x:t.offsetWidth/2+100,y:0},...n};Ce(this,e,t,o),this.bus.fire("operation",{name:"createArrow",obj:o})},Hn=function(e){ae(this);const t={...e,id:R()};Ce(this,this.findEle(t.from),this.findEle(t.to),t),this.bus.fire("operation",{name:"createArrow",obj:t})},Bn=function(e){let t;if(e?t=e:t=this.currentArrow,!t)return;ae(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}})},Rn=function(e){this.currentArrow=e;const t=e.arrowObj,n=this.findEle(t.from),o=this.findEle(t.to),i=le(this,n,t.delta1),s=le(this,o,t.delta2);it(this,t,i,s)},Fn=function(){ae(this),this.currentArrow=null},Ne=function(e,t){const n=document.createElementNS(k,"path");return E(n,{d:e,stroke:t,fill:"none","stroke-width":"6","stroke-linecap":"round","stroke-linejoin":"round"}),n},In=function(e,t){const n=document.createElementNS(k,"g");n.setAttribute("class","arrow-highlight"),n.setAttribute("opacity","0.45");const o=Ne(e.line.getAttribute("d"),t);n.appendChild(o);const i=Ne(e.arrow1.getAttribute("d"),t);if(n.appendChild(i),e.arrow2.getAttribute("d")){const s=Ne(e.arrow2.getAttribute("d"),t);n.appendChild(s)}e.insertBefore(n,e.firstChild)},Wn=function(e){const t=e.querySelector(".arrow-highlight");t&&t.remove()},Vn=function(e){const t=e.querySelector(".arrow-highlight");if(!t)return;const n=t.querySelectorAll("path");n.length>=1&&n[0].setAttribute("d",e.line.getAttribute("d")),n.length>=2&&n[1].setAttribute("d",e.arrow1.getAttribute("d")),n.length>=3&&e.arrow2.getAttribute("d")&&n[2].setAttribute("d",e.arrow2.getAttribute("d"))},ae=function(e){var t,n;(t=e.helper1)==null||t.destroy(),(n=e.helper2)==null||n.destroy(),e.linkController.style.display="none",e.P2.style.display="none",e.P3.style.display="none",e.currentArrow&&Wn(e.currentArrow)},it=function(e,t,n,o){const{linkController:i,P2:s,P3:r,line1:c,line2:u,nodes:a,map:f,currentArrow:h,bus:g}=e;if(!h)return;i.style.display="initial",s.style.display="initial",r.style.display="initial",a.appendChild(i),a.appendChild(s),a.appendChild(r),In(h,On);let{x:d,y:l}=U(n),{ctrlX:p,ctrlY:m}=n,{ctrlX:v,ctrlY:b}=o,{x:y,y:S}=U(o);s.style.cssText=`top:${m}px;left:${p}px;`,r.style.cssText=`top:${b}px;left:${v}px;`,ce(c,d,l,p,m),ce(u,v,b,y,S),e.helper1=tt.create(s),e.helper2=tt.create(r),e.helper1.init(f,(N,w)=>{p=p+N/e.scaleVal,m=m+w/e.scaleVal;const x=U({...n,ctrlX:p,ctrlY:m});d=x.x,l=x.y,s.style.top=m+"px",s.style.left=p+"px",ot(h,d,l,p,m,v,b,y,S,t),ce(c,d,l,p,m),t.delta1.x=p-n.cx,t.delta1.y=m-n.cy,g.fire("updateArrowDelta",t)}),e.helper2.init(f,(N,w)=>{v=v+N/e.scaleVal,b=b+w/e.scaleVal;const x=U({...o,ctrlX:v,ctrlY:b});y=x.x,S=x.y,r.style.top=b+"px",r.style.left=v+"px",ot(h,d,l,p,m,v,b,y,S,t),ce(u,v,b,y,S),t.delta2.x=v-o.cx,t.delta2.y=b-o.cy,g.fire("updateArrowDelta",t)})};function Yn(){this.linkSvgGroup.innerHTML="";for(let e=0;e<this.arrows.length;e++){const t=this.arrows[e];try{Ce(this,this.findEle(t.from),this.findEle(t.to),t,!0)}catch{}}this.nodes.appendChild(this.linkSvgGroup)}function Gn(e){if(ae(this),!e)return;const t=e.label;je(this,t,e.arrowObj)}function Kn(){this.arrows=this.arrows.filter(e=>te(e.from,this.nodeData)&&te(e.to,this.nodeData))}const qn=Object.freeze(Object.defineProperty({__proto__:null,createArrow:$n,createArrowFrom:Hn,editArrowLabel:Gn,removeArrow:Bn,renderArrow:Yn,selectArrow:Rn,tidyArrow:Kn,unselectArrow:Fn},Symbol.toStringTag,{value:"Module"})),zn=function(e){var u,a;if(e.length===0)throw new Error("No selected node.");if(e.length===1){const f=e[0].nodeObj,h=e[0].nodeObj.parent;if(!h)throw new Error("Can not select root node.");const g=h.children.findIndex(d=>f===d);return{parent:h.id,start:g,end:g}}let t=0;const n=e.map(f=>{let h=f.nodeObj;const g=[];for(;h.parent;){const d=h.parent,l=d.children,p=l==null?void 0:l.indexOf(h);h=d,g.unshift({node:h,index:p})}return g.length>t&&(t=g.length),g});let o=0;e:for(;o<t;o++){const f=(u=n[0][o])==null?void 0:u.node;for(let h=1;h<n.length;h++)if(((a=n[h][o])==null?void 0:a.node)!==f)break e}if(!o)throw new Error("Can not select root node.");const i=n.map(f=>f[o-1].index).sort(),s=i[0]||0,r=i[i.length-1]||0,c=n[0][o-1].node;if(!c.parent)throw new Error("Please select nodes in the same main topic.");return{parent:c.id,start:s,end:r}},Un=function(e){const t=document.createElementNS(k,"g");return t.setAttribute("id",e),t},st=function(e,t){const n=document.createElementNS(k,"path");return E(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},rt=function(e,t,n,o,i){const s=document.createElementNS(k,"text");return E(s,{"text-anchor":o,x:t+"",y:n+"",fill:i||"#666"}),s.innerHTML=e,s},Xn=e=>e.parentElement.parentElement,Jn=function(e,{parent:t,start:n}){const o=e.findEle(t),i=o.nodeObj;let s;return i.parent?s=o.closest("me-main").className:s=e.findEle(i.children[n].id).closest("me-main").className,s},_e=function(e,t){var C;const{id:n,label:o,parent:i,start:s,end:r}=t,{nodes:c,theme:u,summarySvg:a}=e,h=e.findEle(i).nodeObj,g=Jn(e,t);let d=1/0,l=0,p=0,m=0;for(let _=s;_<=r;_++){const B=(C=h.children)==null?void 0:C[_];if(!B)return e.removeSummary(n),null;const V=Xn(e.findEle(B.id)),{offsetLeft:Y,offsetTop:at}=P(c,V),dt=s===r?10:20;_===s&&(p=at+dt),_===r&&(m=at+V.offsetHeight-dt),Y<d&&(d=Y),V.offsetWidth+Y>l&&(l=V.offsetWidth+Y)}let v,b;const y=p+10,S=m+10,N=(y+S)/2,w=u.cssVar["--color"];g===L.LHS?(v=st(`M ${d+10} ${y} c -5 0 -10 5 -10 10 L ${d} ${S-10} c 0 5 5 10 10 10 M ${d} ${N} h -10`,w),b=rt(o,d-20,N+6,"end",w)):(v=st(`M ${l-10} ${y} c 5 0 10 5 10 10 L ${l} ${S-10} c 0 5 -5 10 -10 10 M ${l} ${N} h 10`,w),b=rt(o,l+20,N+6,"start",w));const x=Un("s-"+n);return x.appendChild(v),x.appendChild(b),x.summaryObj=t,a.appendChild(x),x},Zn=Object.freeze(Object.defineProperty({__proto__:null,createSummary:function(){if(!this.currentNodes)return;const{currentNodes:e,summaries:t,bus:n}=this,{parent:o,start:i,end:s}=zn(e),r={id:R(),parent:o,start:i,end:s,label:"summary"},c=_e(this,r);t.push(r),this.editSummary(c),n.fire("operation",{name:"createSummary",obj:r})},createSummaryFrom:function(e){const t=R(),n={...e,id:t};_e(this,n),this.summaries.push(n),this.bus.fire("operation",{name:"createSummary",obj:n})},editSummary:function(e){if(!e)return;const t=e.childNodes[1];je(this,t,e.summaryObj)},removeSummary:function(e){var n;const t=this.summaries.findIndex(o=>o.id===e);t>-1&&(this.summaries.splice(t,1),(n=document.querySelector("#s-"+e))==null||n.remove()),this.bus.fire("operation",{name:"removeSummary",obj:{id:e}})},renderSummary:function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{try{_e(this,e)}catch{}}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},selectSummary:function(e){const t=e.children[1].getBBox(),n=6,o=3,i=document.createElementNS(k,"rect");E(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},unselectSummary:function(){var e,t;(t=(e=this.currentSummary)==null?void 0:e.querySelector("rect"))==null||t.remove(),this.currentSummary=null}},Symbol.toStringTag,{value:"Module"})),T="http://www.w3.org/2000/svg";function Qn(e,t){const n=document.createElementNS(T,"svg");return E(n,{version:"1.1",xmlns:T,height:e,width:t}),n}function eo(e,t){return(parseInt(e)-parseInt(t))/2}function to(e,t,n,o){const i=document.createElementNS(T,"g");let s="";return e.text?s=e.text.textContent:s=e.childNodes[0].textContent,s.split(`
15
+ `).forEach((c,u)=>{const a=document.createElementNS(T,"text");E(a,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+eo(t.lineHeight,t.fontSize)*(u+1)+parseFloat(t.fontSize)*(u+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),a.innerHTML=c,i.appendChild(a)}),i}function no(e,t,n,o){var c;let i="";(c=e.nodeObj)!=null&&c.dangerouslySetInnerHTML?i=e.nodeObj.dangerouslySetInnerHTML:e.text?i=e.text.textContent:i=e.childNodes[0].textContent;const s=document.createElementNS(T,"foreignObject");E(s,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const r=document.createElement("div");return E(r,{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;`}),r.innerHTML=i,s.appendChild(r),s}function oo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=document.createElementNS(T,"rect");return E(s,{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}),s}function de(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:i,offsetTop:s}=P(e.nodes,t),r=document.createElementNS(T,"rect");E(r,{x:i+"",y:s+"",rx:o.borderRadius,ry:o.borderRadius,width:o.width,height:o.height,fill:o.backgroundColor,stroke:o.borderColor,"stroke-width":o.borderWidth});const c=document.createElementNS(T,"g");c.appendChild(r);let u;return n?u=no(t,o,i,s):u=to(t,o,i,s),c.appendChild(u),c}function io(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=document.createElementNS(T,"a"),r=document.createElementNS(T,"text");return E(r,{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}`}),r.innerHTML=t.textContent,s.appendChild(r),s.setAttribute("href",t.href),s}function so(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=P(e.nodes,t),s=document.createElementNS(T,"image");return E(s,{x:o+"",y:i+"",width:n.width+"",height:n.height+"",href:t.src}),s}const he=100,ro='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',co=(e,t=!1)=>{var h,g,d;const n=e.nodes,o=n.offsetHeight+he*2,i=n.offsetWidth+he*2,s=Qn(o+"px",i+"px"),r=document.createElementNS(T,"svg"),c=document.createElementNS(T,"rect");E(c,{x:"0",y:"0",width:`${i}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),s.appendChild(c),n.querySelectorAll(".subLines").forEach(l=>{const p=l.cloneNode(!0),{offsetLeft:m,offsetTop:v}=P(n,l.parentElement);p.setAttribute("x",`${m}`),p.setAttribute("y",`${v}`),r.appendChild(p)});const u=(h=n.querySelector(".lines"))==null?void 0:h.cloneNode(!0);u&&r.appendChild(u);const a=(g=n.querySelector(".topiclinks"))==null?void 0:g.cloneNode(!0);a&&r.appendChild(a);const f=(d=n.querySelector(".summary"))==null?void 0:d.cloneNode(!0);return f&&r.appendChild(f),n.querySelectorAll("me-tpc").forEach(l=>{l.nodeObj.dangerouslySetInnerHTML?r.appendChild(de(e,l,!t)):(r.appendChild(oo(e,l)),r.appendChild(de(e,l.text,!t)))}),n.querySelectorAll(".tags > span").forEach(l=>{r.appendChild(de(e,l))}),n.querySelectorAll(".icons > span").forEach(l=>{r.appendChild(de(e,l))}),n.querySelectorAll(".hyper-link").forEach(l=>{r.appendChild(io(e,l))}),n.querySelectorAll("img").forEach(l=>{r.appendChild(so(e,l))}),E(r,{x:he+"",y:he+"",overflow:"visible"}),s.appendChild(r),s},lo=(e,t)=>(t&&e.insertAdjacentHTML("afterbegin","<style>"+t+"</style>"),ro+e.outerHTML);function ao(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 ho=Object.freeze(Object.defineProperty({__proto__:null,exportPng:async function(e=!1,t){const n=this.exportSvg(e,t),o=await ao(n);return new Promise((i,s)=>{const r=new Image;r.setAttribute("crossOrigin","anonymous"),r.onload=()=>{const c=document.createElement("canvas");c.width=r.width,c.height=r.height,c.getContext("2d").drawImage(r,0,0),c.toBlob(i,"image/png",1)},r.src=o,r.onerror=s})},exportSvg:function(e=!1,t){const n=co(this,e),o=lo(n,t);return new Blob([o],{type:"image/svg+xml"})}},Symbol.toStringTag,{value:"Module"}));function uo(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const ct=Object.keys(Qe),lt={};for(let e=0;e<ct.length;e++){const t=ct[e];lt[t]=uo(Qe[t],t)}const fo={getObjById:te,generateNewObj:ht,layout:wt,linkDiv:At,editTopic:kt,createWrapper:St,createParent:Ct,createChildren:Nt,createTopic:_t,findEle:Le,changeTheme:tn,...Dn,...lt,...qn,...Zn,...ho,init(e){if(e=JSON.parse(JSON.stringify(e)),!e||!e.nodeData)return new Error("MindElixir: `data` is required");e.direction!==void 0&&(this.direction=e.direction),this.changeTheme(e.theme||this.theme,!1),this.nodeData=e.nodeData,j(this.nodeData),this.arrows=e.arrows||[],this.summaries=e.summaries||[],this.tidyArrow(),this.toolBar&&qt(this),this.keypress&&vt(this,this.keypress),this.editable&&en(this),this.contextMenu&&this.disposable.push(Lt(this,this.contextMenu)),this.draggable&&this.disposable.push(jt(this)),this.allowUndo&&this.disposable.push($t(this)),this.layout(),this.linkDiv(),this.toCenter()},destroy(){var e;this.disposable.forEach(t=>t()),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.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 po({pT:e,pL:t,pW:n,pH:o,cT:i,cL:s,cW:r,cH:c,direction:u,containerHeight:a}){let f=t+n/2;const h=e+o/2;let g;u===L.LHS?g=s+r:g=s;const d=i+c/2,p=(1-Math.abs(d-h)/a)*.25*(n/2);return u===L.LHS?f=f-n/10-p:f=f+n/10+p,`M ${f} ${h} Q ${f} ${d} ${g} ${d}`}function go({pT:e,pL:t,pW:n,pH:o,cT:i,cL:s,cW:r,cH:c,direction:u,isFirst:a}){const f=parseInt(this.container.style.getPropertyValue("--node-gap-x"));let h=0,g=0;a?h=e+o/2:h=e+o;const d=i+c;let l=0,p=0,m=0;const v=Math.abs(h-d)/300*f;return u===L.LHS?(m=t,l=m+f,p=m-f,g=s+f,`M ${l} ${h} C ${m} ${h} ${m+v} ${d} ${p} ${d} H ${g}`):(m=t+n,l=m-f,p=m+f,g=s+r-f,`M ${l} ${h} C ${m} ${h} ${m-v} ${d} ${p} ${d} H ${g}`)}const mo="5.0.2";function vo(e){return{x:0,y:0,moved:!1,mousedown:!1,onMove(t,n){this.mousedown&&(this.moved=!0,e.move(t,n))},clear(){this.mousedown=!1,e.map.style.transition="transform 0.3s"}}}const Z=document;function D({el:e,direction:t,locale:n,draggable:o,editable:i,contextMenu:s,toolBar:r,keypress:c,mouseSelectionButton:u,selectionContainer:a,before:f,newTopicName:h,allowUndo:g,generateMainBranch:d,generateSubBranch:l,overflowHidden:p,theme:m,alignment:v,scaleSensitivity:b}){let y=null;const S=Object.prototype.toString.call(e);if(S==="[object HTMLDivElement]"?y=e:S==="[object String]"&&(y=document.querySelector(e)),!y)throw new Error("MindElixir: el is not a valid element");y.style.position="relative",y.innerHTML="",this.el=y,this.disposable=[],this.before=f||{},this.locale=n||"en",this.contextMenu=s===void 0?!0:s,this.toolBar=r===void 0?!0:r,this.keypress=c===void 0?!0:c,this.mouseSelectionButton=u||0,this.direction=typeof t=="number"?t:1,this.draggable=o===void 0?!0:o,this.newTopicName=h||"new node",this.editable=i===void 0?!0:i,this.allowUndo=g===void 0?!1:g,this.scaleSensitivity=typeof b=="number"?b:.2,this.currentNodes=[],this.currentArrow=null,this.scaleVal=1,this.tempDirection=null,this.generateMainBranch=d||po,this.generateSubBranch=l||go,this.overflowHidden=p||!1,this.dragMoveHelper=vo(this),this.bus=yt(),this.container=Z.createElement("div"),this.selectionContainer=a||this.container,this.container.className="map-container";const N=window.matchMedia("(prefers-color-scheme: dark)");this.theme=m||(N.matches?fe:ue);const w=Z.createElement("div");w.className="map-canvas",setTimeout(()=>{w.style.transition="all 0.3s"},300),this.map=w,this.container.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.el.appendChild(this.container),this.nodes=Z.createElement("me-nodes"),this.lines=X("lines"),this.summarySvg=X("summary"),this.linkController=X("linkcontroller"),this.P2=Z.createElement("div"),this.P3=Z.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=Oe(),this.line2=Oe(),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=X("topiclinks"),this.alignment=v??"root",this.map.appendChild(this.nodes),this.overflowHidden?this.container.style.overflow="hidden":this.disposable.push(bt(this))}return D.prototype=fo,Object.defineProperty(D.prototype,"currentNode",{get(){return this.currentNodes[this.currentNodes.length-1]},enumerable:!0}),D.LEFT=0,D.RIGHT=1,D.SIDE=2,D.THEME=ue,D.DARK_THEME=fe,D.version=mo,D.E=Le,D.new=e=>({nodeData:{id:R(),topic:e||"new topic",children:[]}}),D}();