mind-elixir 5.4.0 → 5.5.0
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.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +208 -193
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +366 -351
- package/package.json +2 -2
package/dist/MindElixir.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var MindElixir=(function(){"use strict";const ve={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","--accent-color":"#e64553","--panel-color":"#444446","--panel-bgcolor":"#ffffff","--panel-border-color":"#eaeaea","--map-padding":"50px"}},be={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","--accent-color":"#789AFA","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969","--map-padding":"50px 80px"}};function we(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""")}const se=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=se(e,t.children[n]);if(o)return o}return null}else return null},G=(e,t)=>{if(e.parent=t,e.children)for(let n=0;n<e.children.length;n++)G(e.children[n],e)},V=(e,t,n)=>{if(e.expanded=t,e.children)if(n===void 0||n>0){const o=n!==void 0?n-1:void 0;e.children.forEach(i=>{V(i,t,o)})}else e.children.forEach(o=>{V(o,!1)})};function xe(e){if(e.id=K(),e.children)for(let t=0;t<e.children.length;t++)xe(e.children[t])}function re(e,t,n,o){const i=o-t,s=e-n;let l=Math.atan(Math.abs(i)/Math.abs(s))/3.14*180;if(isNaN(l))return;s<0&&i>0&&(l=180-l),s<0&&i<0&&(l=180+l),s>0&&i<0&&(l=360-l);const r=12,c=30,a=l+c,d=l-c;return{x1:n+Math.cos(Math.PI*a/180)*r,y1:o-Math.sin(Math.PI*a/180)*r,x2:n+Math.cos(Math.PI*d/180)*r,y2:o-Math.sin(Math.PI*d/180)*r}}function K(){return(new Date().getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const vt=function(){const e=K();return{topic:this.newTopicName,id:e}};function Ee(e){return JSON.parse(JSON.stringify(e,(n,o)=>{if(n!=="parent")return o}))}const R=(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}},A=(e,t)=>{for(const n in t)e.setAttribute(n,t[n])},le=e=>e?e.tagName==="ME-TPC":!1,Ce=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}),je=e=>{const t=/translate3d\(([^,]+),\s*([^,]+)/,n=e.match(t);return n?{x:parseFloat(n[1]),y:parseFloat(n[2])}:{x:0,y:0}},He=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)}}},Ie=(e,t)=>{const n=e.x-t.x,o=e.y-t.y;return Math.sqrt(n*n+o*o)},I={LHS:"lhs",RHS:"rhs"},bt=e=>{const t=e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},wt=e=>{const t=e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},xt=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},Et=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},Ct=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Be=function(e,t){const n=e.currentNode||e.currentNodes?.[0];if(!n)return;const o=n.nodeObj,i=n.offsetParent.offsetParent.parentElement;o.parent?i.className===t?Ct(e,n):o.parent?.parent?Et(e,n):xt(e):t===I.LHS?bt(e):wt(e)},Re=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)},U=function(e,t,n){const{scaleVal:o,scaleSensitivity:i}=e;switch(t){case"in":e.scale(o+i,n);break;case"out":e.scale(o-i,n)}};function St(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)};let o=!1,i=null;const s=r=>{const c=e.nodeData;if(r.key==="0")for(const a of c.children)V(a,!1);if(r.key==="=")for(const a of c.children)V(a,!0);if(["1","2","3","4","5","6","7","8","9"].includes(r.key))for(const a of c.children)V(a,!0,Number(r.key)-1);e.refresh(),e.toCenter(),o=!1,i&&(clearTimeout(i),i=null,e.container.removeEventListener("keydown",s))},l={Enter:r=>{r.shiftKey?e.insertSibling("before"):r.ctrlKey||r.metaKey?e.insertParent():e.insertSibling("after")},Tab:()=>{e.addChild()},F1:()=>{e.toCenter()},F2:()=>{e.currentSummary?e.editSummary(e.currentSummary):e.currentArrow?e.editArrowLabel(e.currentArrow):e.beginEdit()},ArrowUp:r=>{if(r.altKey)e.moveUpNode();else{if(r.metaKey||r.ctrlKey)return e.initSide();Re(e,"previous")}},ArrowDown:r=>{r.altKey?e.moveDownNode():Re(e,"next")},ArrowLeft:r=>{if(r.metaKey||r.ctrlKey)return e.initLeft();Be(e,I.LHS)},ArrowRight:r=>{if(r.metaKey||r.ctrlKey)return e.initRight();Be(e,I.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},c:r=>{(r.metaKey||r.ctrlKey)&&(e.waitCopy=e.currentNodes)},x:r=>{(r.metaKey||r.ctrlKey)&&(e.waitCopy=e.currentNodes,n())},v:r=>{!e.waitCopy||!e.currentNode||(r.metaKey||r.ctrlKey)&&(e.waitCopy.length===1?e.copyNode(e.waitCopy[0],e.currentNode):e.copyNodes(e.waitCopy,e.currentNode))},"=":r=>{(r.metaKey||r.ctrlKey)&&U(e,"in")},"-":r=>{(r.metaKey||r.ctrlKey)&&U(e,"out")},0:r=>{if(r.metaKey||r.ctrlKey){if(o)return;e.scale(1)}},k:r=>{(r.metaKey||r.ctrlKey)&&(o=!0,i&&(clearTimeout(i),e.container.removeEventListener("keydown",s)),i=window.setTimeout(()=>{o=!1,i=null},2e3),e.container.addEventListener("keydown",s))},Delete:n,Backspace:n,...t};e.container.onkeydown=r=>{if(r.preventDefault(),!e.editable)return;const c=l[r.key];c&&c(r)}}const Se=document,Nt=function(e,t){if(!t)return ce(e),e;let n=e.querySelector(".insert-preview");const o=`insert-preview ${t} show`;return n||(n=Se.createElement("div"),e.appendChild(n)),n.className=o,e},ce=function(e){if(!e)return;const t=e.querySelectorAll(".insert-preview");for(const n of t||[])n.remove()},Fe=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},kt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.container.appendChild(t),t};class Tt{mind;isMoving=!1;interval=null;speed=20;constructor(t){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,this.interval&&(clearInterval(this.interval),this.interval=null)}}function _t(e){return{isDragging:!1,insertType:null,meet:null,ghost:kt(e),edgeMoveController:new Tt(e),startX:0,startY:0,pointerId:null}}const Lt=5;function Ye(e,t,n,o=!1){if(e.spacePressed)return!1;const i=n.target;if(i?.tagName!=="ME-TPC"||!i.nodeObj.parent)return!1;t.startX=n.clientX,t.startY=n.clientY,t.pointerId=n.pointerId,e.selection.cancel();let s=e.currentNodes;return s?.includes(i)||(e.selectNode(i),s=e.currentNodes),e.dragged=s,o&&We(e,t),!0}function ze(e,t,n){e.style.transform=`translate(${t+10}px, ${n+10}px)`,e.style.display="block"}function We(e,t){const{dragged:n}=e;if(!n)return;const o=document.activeElement;o&&o.isContentEditable&&o.blur(),t.isDragging=!0,n.length>1?t.ghost.innerHTML=n.length+"":t.ghost.innerHTML=n[0].innerHTML;for(const i of n)i.parentElement.parentElement.style.opacity="0.5";e.dragMoveHelper.clear()}function At(e,t,n){const{dragged:o}=e;if(!o||t.pointerId!==n.pointerId)return;const i=n.clientX-t.startX,s=n.clientY-t.startY,l=Math.sqrt(i*i+s*s);if(!t.isDragging&&l>Lt&&We(e,t),!t.isDragging)return;ze(t.ghost,n.clientX,n.clientY);const r=e.container.getBoundingClientRect();n.clientX<r.x+50?t.edgeMoveController.move(1,0):n.clientX>r.x+r.width-50?t.edgeMoveController.move(-1,0):n.clientY<r.y+50?t.edgeMoveController.move(0,1):n.clientY>r.y+r.height-50?t.edgeMoveController.move(0,-1):t.edgeMoveController.stop(),ce(t.meet);const c=12*e.scaleVal,a=Se.elementFromPoint(n.clientX,n.clientY-c);if(Fe(a,o)){t.meet=a;const d=a.getBoundingClientRect(),u=d.y;n.clientY>u+d.height?t.insertType="after":t.insertType="in"}else{const d=Se.elementFromPoint(n.clientX,n.clientY+c);if(Fe(d,o)){t.meet=d;const g=d.getBoundingClientRect().y;n.clientY<g?t.insertType="before":t.insertType="in"}else t.insertType=null,t.meet=null}t.meet&&Nt(t.meet,t.insertType)}function Mt(e,t,n){const{dragged:o}=e;if(!(!o||t.pointerId!==n.pointerId)){t.edgeMoveController.stop();for(const i of o)i.parentElement.parentElement.style.opacity="1";t.ghost.style.display="none",t.ghost.innerHTML="",t.isDragging&&t.meet&&(ce(t.meet),t.insertType==="before"?e.moveNodeBefore(o,t.meet):t.insertType==="after"?e.moveNodeAfter(o,t.meet):t.insertType==="in"&&e.moveNodeIn(o,t.meet)),e.dragged=null,t.isDragging=!1,t.insertType=null,t.meet=null,t.pointerId=null}}function Ne(e,t){const{dragged:n}=e;if(n){t.edgeMoveController.stop();for(const o of n)o.parentElement.parentElement.style.opacity="1";t.meet&&ce(t.meet),t.ghost.style.display="none",t.ghost.innerHTML="",e.dragged=null,t.isDragging=!1,t.insertType=null,t.meet=null,t.pointerId=null}}function Dt(e){return()=>{}}function Pt(e){const{dragMoveHelper:t}=e;let n=0;e.spacePressed=!1;let o=null;const i=new Map,s=e.draggable?_t(e):null;let l=null,r=null,c=null,a=null;const d=500,u=10,g=()=>{l!==null&&(clearTimeout(l),l=null,r=null,c=null,a=null)},y=(h,w)=>{h.hasPointerCapture&&h.hasPointerCapture(w)&&h.releasePointerCapture(w)},v=(h,w)=>{const k=h.closest(".svg-label");if(k){const M=k.dataset.svgId,ye=k.dataset.type,ie=document.getElementById(M);if(ie){if(ye==="arrow")return w?e.editArrowLabel(ie):e.selectArrow(ie),!0;if(ye==="summary")return w?e.editSummary(ie):e.selectSummary(ie),!0}}if(h.closest(".topiclinks")){const M=h.closest("g");if(M)return w?e.editArrowLabel(M):e.selectArrow(M),!0}if(h.closest(".summary")){const M=h.closest("g");if(M)return w?e.editSummary(M):e.selectSummary(M),!0}return!1},f=h=>{if(h.button!==0)return;if(e.helper1?.moved){e.helper1.clear();return}if(e.helper2?.moved){e.helper2.clear();return}if(t.moved){t.clear();return}if(s?.isDragging)return;const w=h.target;if(w.tagName==="ME-EPD")h.ctrlKey||h.metaKey?e.expandNodeAll(w.previousSibling):e.expandNode(w.previousSibling);else if(w.tagName==="ME-TPC"&&e.currentNodes.length>1)e.selectNode(w);else if(!e.editable)return;v(w,!1)},m=h=>{if(!e.editable)return;const w=h.target;le(w)&&e.beginEdit(w),v(w,!0)},p=h=>{if(h.pointerType==="mouse"||i.size>1)return;const w=new Date().getTime(),k=w-n;k<300&&k>0&&m(h),n=w},b=h=>{h.code==="Space"&&(e.spacePressed=!0,e.container.classList.add("space-pressed"))},x=h=>{h.code==="Space"&&(e.spacePressed=!1,e.container.classList.remove("space-pressed"))},L=h=>{if(h.pointerType==="touch"&&(i.set(h.pointerId,{x:h.clientX,y:h.clientY}),i.size===2)){const[M,ye]=Array.from(i.values());o=Ie(M,ye),g()}t.moved=!1;const w=h.target,k=e.mouseSelectionButton===0?2:0;if(s&&(h.button===0||h.pointerType==="touch")){if(h.pointerType==="touch"&&i.size>1)(s.isDragging||s.pointerId!==null)&&Ne(e,s);else if(h.pointerType==="touch"&&i.size===1)(le(w)||w.closest("me-tpc"))&&(r={x:h.clientX,y:h.clientY},c=w,a=h.pointerId,l=window.setTimeout(()=>{Ye(e,s,h,!0)&&(c&&c.setPointerCapture(h.pointerId),ze(s.ghost,h.clientX,h.clientY)),l=null,r=null,c=null,a=null},d));else if(h.pointerType==="mouse"&&Ye(e,s,h,!1)){w.setPointerCapture(h.pointerId);return}}const O=e.spacePressed&&h.button===0&&h.pointerType==="mouse",W=h.button===k&&h.pointerType==="mouse"||h.pointerType==="touch";!O&&!W||(t.x=h.clientX,t.y=h.clientY,w.className!=="circle"&&w.contentEditable!=="plaintext-only"&&(t.mousedown=!0,w.setPointerCapture(h.pointerId)))},_=h=>{if(h.pointerType==="touch"&&i.has(h.pointerId)){if(i.set(h.pointerId,{x:h.clientX,y:h.clientY}),l!==null&&r!==null&&h.pointerId===a){const w=h.clientX-r.x,k=h.clientY-r.y;Math.sqrt(w*w+k*k)>u&&g()}if(i.size>=2){const[w,k]=Array.from(i.values()),O=Ie(w,k);if(o==null)o=O;else{const W=O-o;Math.abs(W)>8&&(W>0?U(e,"in",{x:(w.x+k.x)/2,y:(w.y+k.y)/2}):U(e,"out",{x:(w.x+k.x)/2,y:(w.y+k.y)/2}),o=O)}return}}if(!(s&&s.pointerId!==null&&(At(e,s,h),s.isDragging))){if(h.target.contentEditable!=="plaintext-only"||e.spacePressed&&t.mousedown){const w=h.clientX-t.x,k=h.clientY-t.y;t.onMove(w,k)}t.x=h.clientX,t.y=h.clientY}},C=h=>{if(h.pointerType==="touch"&&(i.delete(h.pointerId),i.size<2&&(o=null),g()),s&&s.pointerId!==null){const w=s.isDragging;if(Mt(e,s,h),y(h.target,h.pointerId),w)return}t.mousedown&&(y(h.target,h.pointerId),t.clear())},E=()=>{g(),t.mousedown&&t.clear(),s&&(s.isDragging||s.pointerId!==null)&&Ne(e,s)},S=h=>{h.pointerType==="touch"&&(i.delete(h.pointerId),i.size<2&&(o=null),g()),s&&s.pointerId===h.pointerId&&Ne(e,s),C(h)},N=h=>{if(h.preventDefault(),h.button!==2||!e.editable)return;const w=h.target;le(w)&&!w.classList.contains("selected")&&e.selectNode(w),setTimeout(()=>{e.dragMoveHelper.moved||e.bus.fire("showContextMenu",h)},200)},$=h=>{h.stopPropagation(),h.preventDefault(),h.ctrlKey||h.metaKey?h.deltaY<0?U(e,"in",e.dragMoveHelper):e.scaleVal-e.scaleSensitivity>0&&U(e,"out",e.dragMoveHelper):h.shiftKey?e.move(-h.deltaY,0):e.move(-h.deltaX,-h.deltaY)},{container:T}=e;return He([{dom:T,evt:"pointerdown",func:L},{dom:T,evt:"pointermove",func:_},{dom:T,evt:"pointerup",func:C},{dom:T,evt:"pointercancel",func:S},{dom:T,evt:"pointerdown",func:p},{dom:T,evt:"click",func:f},{dom:T,evt:"dblclick",func:m},{dom:T,evt:"contextmenu",func:N},{dom:T,evt:"wheel",func:typeof e.handleWheel=="function"?e.handleWheel:$},{dom:T,evt:"blur",func:E},{dom:T,evt:"keydown",func:b},{dom:T,evt:"keyup",func:x}])}function $t(){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 ae=document,Ot=function(){this.nodes.innerHTML="";const e=this.createTopic(this.nodeData);ke.call(this,e,this.nodeData),e.draggable=!1;const t=ae.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)})}jt(this,n,t)},jt=function(e,t,n){const o=ae.createElement("me-main");o.className=I.LHS;const i=ae.createElement("me-main");i.className=I.RHS;for(let s=0;s<t.length;s++){const l=t[s],{grp:r}=e.createWrapper(l);e.direction===2?l.direction===0?o.appendChild(r):i.appendChild(r):e.direction===0?o.appendChild(r):i.appendChild(r)}e.nodes.appendChild(o),e.nodes.appendChild(n),e.nodes.appendChild(i),e.nodes.appendChild(e.lines),e.nodes.appendChild(e.labelContainer)},Ht=function(e,t){const n=ae.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},D=document,Ge=function(e,t){const o=(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},ke=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=D.createElement("img");o.src=this.imageProxy?this.imageProxy(n.url):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=D.createElement("span");n.className="text",this.markdown?n.innerHTML=this.markdown(t.topic,t):n.textContent=t.topic,e.appendChild(n),e.text=n}if(t.hyperLink){const n=D.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=D.createElement("span");n.className="icons",n.innerHTML=t.icons.map(o=>`<span>${we(o)}</span>`).join(""),e.appendChild(n),e.icons=n}else e.icons&&(e.icons=void 0);if(t.tags&&t.tags.length){const n=D.createElement("div");n.className="tags",t.tags.forEach(o=>{const i=D.createElement("span");typeof o=="string"?i.textContent=o:(i.textContent=o.text,o.className&&(i.className=o.className),o.style&&Object.assign(i.style,o.style)),n.appendChild(i)}),e.appendChild(n),e.tags=n}else e.tags&&(e.tags=void 0)},It=function(e,t){const n=D.createElement("me-wrapper"),{p:o,tpc:i}=this.createParent(e);if(n.appendChild(o),!t&&e.children&&e.children.length>0){const s=Te(e.expanded);if(o.appendChild(s),e.expanded!==!1){const l=Ht(this,e.children);n.appendChild(l)}}return{grp:n,top:o,tpc:i}},Bt=function(e){const t=D.createElement("me-parent"),n=this.createTopic(e);return ke.call(this,n,e),t.appendChild(n),{p:t,tpc:n}},Rt=function(e){const t=D.createElement("me-children");return t.append(...e),t},Ft=function(e){const t=D.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t};function Ke(e){const t=D.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Yt=function(e){if(!e)return;const t=D.createElement("div"),n=e.nodeObj,o=n.topic,{offsetLeft:i,offsetTop:s}=R(this.nodes,e);this.nodes.appendChild(t),t.id="input-box",t.textContent=o,t.contentEditable="plaintext-only",t.spellcheck=!1;const l=getComputedStyle(e);t.style.cssText=`
|
|
1
|
+
var MindElixir=(function(){"use strict";const ve={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","--accent-color":"#e64553","--panel-color":"#444446","--panel-bgcolor":"#ffffff","--panel-border-color":"#eaeaea","--map-padding":"50px"}},be={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","--accent-color":"#789AFA","--panel-color":"#ffffff","--panel-bgcolor":"#2d3748","--panel-border-color":"#696969","--map-padding":"50px 80px"}};function we(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""")}const se=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=se(e,t.children[n]);if(o)return o}return null}else return null},G=(e,t)=>{if(e.parent=t,e.children)for(let n=0;n<e.children.length;n++)G(e.children[n],e)},V=(e,t,n)=>{if(e.expanded=t,e.children)if(n===void 0||n>0){const o=n!==void 0?n-1:void 0;e.children.forEach(i=>{V(i,t,o)})}else e.children.forEach(o=>{V(o,!1)})};function xe(e){if(e.id=K(),e.children)for(let t=0;t<e.children.length;t++)xe(e.children[t])}function re(e,t,n,o){const i=o-t,s=e-n;let l=Math.atan(Math.abs(i)/Math.abs(s))/3.14*180;if(isNaN(l))return;s<0&&i>0&&(l=180-l),s<0&&i<0&&(l=180+l),s>0&&i<0&&(l=360-l);const r=12,c=30,a=l+c,d=l-c;return{x1:n+Math.cos(Math.PI*a/180)*r,y1:o-Math.sin(Math.PI*a/180)*r,x2:n+Math.cos(Math.PI*d/180)*r,y2:o-Math.sin(Math.PI*d/180)*r}}function K(){return(new Date().getTime().toString(16)+Math.random().toString(16).substr(2)).substr(2,16)}const vt=function(){const e=K();return{topic:this.newTopicName,id:e}};function Ee(e){return JSON.parse(JSON.stringify(e,(n,o)=>{if(n!=="parent")return o}))}const R=(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}},A=(e,t)=>{for(const n in t)e.setAttribute(n,t[n])},le=e=>e?e.tagName==="ME-TPC":!1,Ce=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}),je=e=>{const t=/translate3d\(([^,]+),\s*([^,]+)/,n=e.match(t);return n?{x:parseFloat(n[1]),y:parseFloat(n[2])}:{x:0,y:0}},He=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)}}},Ie=(e,t)=>{const n=e.x-t.x,o=e.y-t.y;return Math.sqrt(n*n+o*o)},I={LHS:"lhs",RHS:"rhs"},bt=e=>{const t=e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},wt=e=>{const t=e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");e.selectNode(t[Math.ceil(t.length/2)-1])},xt=e=>{e.selectNode(e.map.querySelector("me-root>me-tpc"))},Et=function(e,t){const n=t.parentElement.parentElement.parentElement.previousSibling;if(n){const o=n.firstChild;e.selectNode(o)}},Ct=function(e,t){const n=t.parentElement.nextSibling;if(n&&n.firstChild){const o=n.firstChild.firstChild.firstChild;e.selectNode(o)}},Be=function(e,t){const n=e.currentNode||e.currentNodes?.[0];if(!n)return;const o=n.nodeObj,i=n.offsetParent.offsetParent.parentElement;o.parent?i.className===t?Ct(e,n):o.parent?.parent?Et(e,n):xt(e):t===I.LHS?bt(e):wt(e)},Re=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)},U=function(e,t,n){const{scaleVal:o,scaleSensitivity:i}=e;switch(t){case"in":e.scale(o+i,n);break;case"out":e.scale(o-i,n)}};function St(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)};let o=!1,i=null;const s=r=>{const c=e.nodeData;if(r.key==="0")for(const a of c.children)V(a,!1);if(r.key==="=")for(const a of c.children)V(a,!0);if(["1","2","3","4","5","6","7","8","9"].includes(r.key))for(const a of c.children)V(a,!0,Number(r.key)-1);e.refresh(),e.toCenter(),o=!1,i&&(clearTimeout(i),i=null,e.container.removeEventListener("keydown",s))},l={Enter:r=>{r.shiftKey?e.insertSibling("before"):r.ctrlKey||r.metaKey?e.insertParent():e.insertSibling("after")},Tab:()=>{e.addChild()},F1:()=>{e.toCenter()},F2:()=>{e.currentSummary?e.editSummary(e.currentSummary):e.currentArrow?e.editArrowLabel(e.currentArrow):e.beginEdit()},ArrowUp:r=>{if(r.altKey)e.moveUpNode();else{if(r.metaKey||r.ctrlKey)return e.initSide();Re(e,"previous")}},ArrowDown:r=>{r.altKey?e.moveDownNode():Re(e,"next")},ArrowLeft:r=>{if(r.metaKey||r.ctrlKey)return e.initLeft();Be(e,I.LHS)},ArrowRight:r=>{if(r.metaKey||r.ctrlKey)return e.initRight();Be(e,I.RHS)},PageUp:()=>e.moveUpNode(),PageDown:()=>{e.moveDownNode()},c:r=>{(r.metaKey||r.ctrlKey)&&(e.waitCopy=e.currentNodes)},x:r=>{(r.metaKey||r.ctrlKey)&&(e.waitCopy=e.currentNodes,n())},v:r=>{!e.waitCopy||!e.currentNode||(r.metaKey||r.ctrlKey)&&(e.waitCopy.length===1?e.copyNode(e.waitCopy[0],e.currentNode):e.copyNodes(e.waitCopy,e.currentNode))},"=":r=>{(r.metaKey||r.ctrlKey)&&U(e,"in")},"-":r=>{(r.metaKey||r.ctrlKey)&&U(e,"out")},0:r=>{if(r.metaKey||r.ctrlKey){if(o)return;e.scale(1)}},k:r=>{(r.metaKey||r.ctrlKey)&&(o=!0,i&&(clearTimeout(i),e.container.removeEventListener("keydown",s)),i=window.setTimeout(()=>{o=!1,i=null},2e3),e.container.addEventListener("keydown",s))},Delete:n,Backspace:n,...t};e.container.onkeydown=r=>{if(r.preventDefault(),!e.editable)return;const c=l[r.key];c&&c(r)}}const Se=document,Nt=function(e,t){if(!t)return ce(e),e;let n=e.querySelector(".insert-preview");const o=`insert-preview ${t} show`;return n||(n=Se.createElement("div"),e.appendChild(n)),n.className=o,e},ce=function(e){if(!e)return;const t=e.querySelectorAll(".insert-preview");for(const n of t||[])n.remove()},Fe=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},kt=function(e){const t=document.createElement("div");return t.className="mind-elixir-ghost",e.container.appendChild(t),t};class Tt{mind;isMoving=!1;interval=null;speed=20;constructor(t){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,this.interval&&(clearInterval(this.interval),this.interval=null)}}function _t(e){return{isDragging:!1,insertType:null,meet:null,ghost:kt(e),edgeMoveController:new Tt(e),startX:0,startY:0,pointerId:null}}const Lt=5;function Ye(e,t,n,o=!1){if(e.spacePressed)return!1;const i=n.target;if(i?.tagName!=="ME-TPC"||!i.nodeObj.parent)return!1;t.startX=n.clientX,t.startY=n.clientY,t.pointerId=n.pointerId,e.selection.cancel();let s=e.currentNodes;return s?.includes(i)||(e.selectNode(i),s=e.currentNodes),e.dragged=s,o&&We(e,t),!0}function ze(e,t,n){e.style.transform=`translate(${t+10}px, ${n+10}px)`,e.style.display="block"}function We(e,t){const{dragged:n}=e;if(!n)return;const o=document.activeElement;o&&o.isContentEditable&&o.blur(),t.isDragging=!0,n.length>1?t.ghost.innerHTML=n.length+"":t.ghost.innerHTML=n[0].innerHTML;for(const i of n)i.parentElement.parentElement.style.opacity="0.5";e.dragMoveHelper.clear()}function At(e,t,n){const{dragged:o}=e;if(!o||t.pointerId!==n.pointerId)return;const i=n.clientX-t.startX,s=n.clientY-t.startY,l=Math.sqrt(i*i+s*s);if(!t.isDragging&&l>Lt&&We(e,t),!t.isDragging)return;ze(t.ghost,n.clientX,n.clientY);const r=e.container.getBoundingClientRect();n.clientX<r.x+50?t.edgeMoveController.move(1,0):n.clientX>r.x+r.width-50?t.edgeMoveController.move(-1,0):n.clientY<r.y+50?t.edgeMoveController.move(0,1):n.clientY>r.y+r.height-50?t.edgeMoveController.move(0,-1):t.edgeMoveController.stop(),ce(t.meet);const c=12*e.scaleVal,a=Se.elementFromPoint(n.clientX,n.clientY-c);if(Fe(a,o)){t.meet=a;const d=a.getBoundingClientRect(),h=d.y;n.clientY>h+d.height?t.insertType="after":t.insertType="in"}else{const d=Se.elementFromPoint(n.clientX,n.clientY+c);if(Fe(d,o)){t.meet=d;const f=d.getBoundingClientRect().y;n.clientY<f?t.insertType="before":t.insertType="in"}else t.insertType=null,t.meet=null}t.meet&&Nt(t.meet,t.insertType)}function Mt(e,t,n){const{dragged:o}=e;if(!(!o||t.pointerId!==n.pointerId)){t.edgeMoveController.stop();for(const i of o)i.parentElement.parentElement.style.opacity="1";t.ghost.style.display="none",t.ghost.innerHTML="",t.isDragging&&t.meet&&(ce(t.meet),t.insertType==="before"?e.moveNodeBefore(o,t.meet):t.insertType==="after"?e.moveNodeAfter(o,t.meet):t.insertType==="in"&&e.moveNodeIn(o,t.meet)),e.dragged=null,t.isDragging=!1,t.insertType=null,t.meet=null,t.pointerId=null}}function Ne(e,t){const{dragged:n}=e;if(n){t.edgeMoveController.stop();for(const o of n)o.parentElement.parentElement.style.opacity="1";t.meet&&ce(t.meet),t.ghost.style.display="none",t.ghost.innerHTML="",e.dragged=null,t.isDragging=!1,t.insertType=null,t.meet=null,t.pointerId=null}}function Dt(e){return()=>{}}function Pt(e){const{dragMoveHelper:t}=e;let n=0;e.spacePressed=!1;let o=null;const i=new Map,s=e.draggable?_t(e):null;let l=null,r=null,c=null,a=null;const d=500,h=10,f=()=>{l!==null&&(clearTimeout(l),l=null,r=null,c=null,a=null)},y=(u,w)=>{u.hasPointerCapture&&u.hasPointerCapture(w)&&u.releasePointerCapture(w)},v=(u,w)=>{const k=u.closest(".svg-label");if(k){const M=k.dataset.svgId,ye=k.dataset.type,ie=document.getElementById(M);if(ie){if(ye==="arrow")return w?e.editArrowLabel(ie):e.selectArrow(ie),!0;if(ye==="summary")return w?e.editSummary(ie):e.selectSummary(ie),!0}}if(u.closest(".topiclinks")){const M=u.closest("g");if(M)return w?e.editArrowLabel(M):e.selectArrow(M),!0}if(u.closest(".summary")){const M=u.closest("g");if(M)return w?e.editSummary(M):e.selectSummary(M),!0}return!1},p=u=>{if(u.button!==0)return;if(e.helper1?.moved){e.helper1.clear();return}if(e.helper2?.moved){e.helper2.clear();return}if(t.moved){t.clear();return}if(s?.isDragging)return;const w=u.target;if(w.tagName==="ME-EPD")u.ctrlKey||u.metaKey?e.expandNodeAll(w.previousSibling):e.expandNode(w.previousSibling);else if(w.tagName==="ME-TPC"&&e.currentNodes.length>1)e.selectNode(w);else if(!e.editable)return;v(w,!1)},m=u=>{if(!e.editable)return;const w=u.target;le(w)&&e.beginEdit(w),v(w,!0)},g=u=>{if(u.pointerType==="mouse"||i.size>1)return;const w=new Date().getTime(),k=w-n;k<300&&k>0&&m(u),n=w},b=u=>{u.code==="Space"&&(e.spacePressed=!0,e.container.classList.add("space-pressed"))},x=u=>{u.code==="Space"&&(e.spacePressed=!1,e.container.classList.remove("space-pressed"))},L=u=>{if(u.pointerType==="touch"&&(i.set(u.pointerId,{x:u.clientX,y:u.clientY}),i.size===2)){const[M,ye]=Array.from(i.values());o=Ie(M,ye),f()}t.moved=!1;const w=u.target,k=e.mouseSelectionButton===0?2:0;if(s&&(u.button===0||u.pointerType==="touch")){if(u.pointerType==="touch"&&i.size>1)(s.isDragging||s.pointerId!==null)&&Ne(e,s);else if(u.pointerType==="touch"&&i.size===1)(le(w)||w.closest("me-tpc"))&&(r={x:u.clientX,y:u.clientY},c=w,a=u.pointerId,l=window.setTimeout(()=>{Ye(e,s,u,!0)&&(c&&c.setPointerCapture(u.pointerId),ze(s.ghost,u.clientX,u.clientY)),l=null,r=null,c=null,a=null},d));else if(u.pointerType==="mouse"&&Ye(e,s,u,!1)){w.setPointerCapture(u.pointerId);return}}const O=e.spacePressed&&u.button===0&&u.pointerType==="mouse",W=u.button===k&&u.pointerType==="mouse"||u.pointerType==="touch";!O&&!W||(t.x=u.clientX,t.y=u.clientY,w.className!=="circle"&&w.contentEditable!=="plaintext-only"&&(t.mousedown=!0,w.setPointerCapture(u.pointerId)))},_=u=>{if(u.pointerType==="touch"&&i.has(u.pointerId)){if(i.set(u.pointerId,{x:u.clientX,y:u.clientY}),l!==null&&r!==null&&u.pointerId===a){const w=u.clientX-r.x,k=u.clientY-r.y;Math.sqrt(w*w+k*k)>h&&f()}if(i.size>=2){const[w,k]=Array.from(i.values()),O=Ie(w,k);if(o==null)o=O;else{const W=O-o;Math.abs(W)>8&&(W>0?U(e,"in",{x:(w.x+k.x)/2,y:(w.y+k.y)/2}):U(e,"out",{x:(w.x+k.x)/2,y:(w.y+k.y)/2}),o=O)}return}}if(!(s&&s.pointerId!==null&&(At(e,s,u),s.isDragging))){if(u.target.contentEditable!=="plaintext-only"||e.spacePressed&&t.mousedown){const w=u.clientX-t.x,k=u.clientY-t.y;t.onMove(w,k)}t.x=u.clientX,t.y=u.clientY}},C=u=>{if(u.pointerType==="touch"&&(i.delete(u.pointerId),i.size<2&&(o=null),f()),s&&s.pointerId!==null){const w=s.isDragging;if(Mt(e,s,u),y(u.target,u.pointerId),w)return}t.mousedown&&(y(u.target,u.pointerId),t.clear())},E=()=>{f(),t.mousedown&&t.clear(),s&&(s.isDragging||s.pointerId!==null)&&Ne(e,s)},S=u=>{u.pointerType==="touch"&&(i.delete(u.pointerId),i.size<2&&(o=null),f()),s&&s.pointerId===u.pointerId&&Ne(e,s),C(u)},N=u=>{if(u.preventDefault(),u.button!==2||!e.editable)return;const w=u.target;le(w)&&!w.classList.contains("selected")&&e.selectNode(w),setTimeout(()=>{e.dragMoveHelper.moved||e.bus.fire("showContextMenu",u)},200)},$=u=>{u.stopPropagation(),u.preventDefault(),u.ctrlKey||u.metaKey?u.deltaY<0?U(e,"in",e.dragMoveHelper):e.scaleVal-e.scaleSensitivity>0&&U(e,"out",e.dragMoveHelper):u.shiftKey?e.move(-u.deltaY,0):e.move(-u.deltaX,-u.deltaY)},{container:T}=e;return He([{dom:T,evt:"pointerdown",func:L},{dom:T,evt:"pointermove",func:_},{dom:T,evt:"pointerup",func:C},{dom:T,evt:"pointercancel",func:S},{dom:T,evt:"pointerdown",func:g},{dom:T,evt:"click",func:p},{dom:T,evt:"dblclick",func:m},{dom:T,evt:"contextmenu",func:N},{dom:T,evt:"wheel",func:typeof e.handleWheel=="function"?e.handleWheel:$},{dom:T,evt:"blur",func:E},{dom:T,evt:"keydown",func:b},{dom:T,evt:"keyup",func:x}])}function $t(){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 ae=document,Ot=function(){this.nodes.innerHTML="";const e=this.createTopic(this.nodeData);ke.call(this,e,this.nodeData),e.draggable=!1;const t=ae.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)})}jt(this,n,t)},jt=function(e,t,n){const o=ae.createElement("me-main");o.className=I.LHS;const i=ae.createElement("me-main");i.className=I.RHS;for(let s=0;s<t.length;s++){const l=t[s],{grp:r}=e.createWrapper(l);e.direction===2?l.direction===0?o.appendChild(r):i.appendChild(r):e.direction===0?o.appendChild(r):i.appendChild(r)}e.nodes.appendChild(o),e.nodes.appendChild(n),e.nodes.appendChild(i),e.nodes.appendChild(e.lines),e.nodes.appendChild(e.labelContainer)},Ht=function(e,t){const n=ae.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},D=document,Ge=function(e,t){const o=(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},ke=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=D.createElement("img");o.src=this.imageProxy?this.imageProxy(n.url):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=D.createElement("span");n.className="text",this.markdown?n.innerHTML=this.markdown(t.topic,t):n.textContent=t.topic,e.appendChild(n),e.text=n}if(t.hyperLink){const n=D.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=D.createElement("span");n.className="icons",n.innerHTML=t.icons.map(o=>`<span>${we(o)}</span>`).join(""),e.appendChild(n),e.icons=n}else e.icons&&(e.icons=void 0);if(t.tags&&t.tags.length){const n=D.createElement("div");n.className="tags",t.tags.forEach(o=>{const i=D.createElement("span");typeof o=="string"?i.textContent=o:(i.textContent=o.text,o.className&&(i.className=o.className),o.style&&Object.assign(i.style,o.style)),n.appendChild(i)}),e.appendChild(n),e.tags=n}else e.tags&&(e.tags=void 0)},It=function(e,t){const n=D.createElement("me-wrapper"),{p:o,tpc:i}=this.createParent(e);if(n.appendChild(o),!t&&e.children&&e.children.length>0){const s=Te(e.expanded);if(o.appendChild(s),e.expanded!==!1){const l=Ht(this,e.children);n.appendChild(l)}}return{grp:n,top:o,tpc:i}},Bt=function(e){const t=D.createElement("me-parent"),n=this.createTopic(e);return ke.call(this,n,e),t.appendChild(n),{p:t,tpc:n}},Rt=function(e){const t=D.createElement("me-children");return t.append(...e),t},Ft=function(e){const t=D.createElement("me-tpc");return t.nodeObj=e,t.dataset.nodeid="me"+e.id,t};function Ke(e){const t=D.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}const Yt=function(e){if(!e)return;const t=D.createElement("div"),n=e.nodeObj,o=n.topic,{offsetLeft:i,offsetTop:s}=R(this.nodes,e);this.nodes.appendChild(t),t.id="input-box",t.textContent=o,t.contentEditable="plaintext-only",t.spellcheck=!1;const l=getComputedStyle(e);t.style.cssText=`
|
|
2
2
|
left: ${i}px;
|
|
3
3
|
top: ${s}px;
|
|
4
4
|
min-width:${e.offsetWidth-8}px;
|
|
@@ -8,9 +8,9 @@ var MindElixir=(function(){"use strict";const ve={name:"Latte",type:"light",pale
|
|
|
8
8
|
margin:${l.margin};
|
|
9
9
|
background-color:${l.backgroundColor!=="rgba(0, 0, 0, 0)"&&l.backgroundColor};
|
|
10
10
|
border: ${l.border};
|
|
11
|
-
border-radius:${l.borderRadius}; `,this.direction===0&&(t.style.right="0"),Ke(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",r=>{r.stopPropagation();const c=r.key;if(c==="Enter"||c==="Tab"){if(r.shiftKey)return;r.preventDefault(),t.blur(),this.container.focus()}}),t.addEventListener("blur",()=>{if(!t)return;t.remove();const r=t.textContent?.trim()||"";r===o||r===""||(n.topic=r,this.markdown?e.text.innerHTML=this.markdown(n.topic,n):e.text.textContent=r,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:n,origin:o}))})},Te=function(e){const t=D.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},J=document,B="http://www.w3.org/2000/svg",de=function(e){const t=e.clientWidth,n=e.clientHeight,o=e.dataset,i=Number(o.x),s=Number(o.y),l=o.anchor;let r=i;l==="middle"?r=i-t/2:l==="end"&&(r=i-t),e.style.left=`${r}px`,e.style.top=`${s-n/2}px`,e.style.visibility="visible"},_e=function(e,t,n,o){const{anchor:i="middle",color:s,dataType:l,svgId:r}=o,c=document.createElement("div");c.className="svg-label",c.style.color=s||"#666";const a="label-"+r;return c.id=a,c.innerHTML=e,c.dataset.type=l,c.dataset.svgId=r,c.dataset.x=t.toString(),c.dataset.y=n.toString(),c.dataset.anchor=i,c},Xe=function(e,t,n){const o=J.createElementNS(B,"path");return A(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},ne=function(e){const t=J.createElementNS(B,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},qe=function(){const e=J.createElementNS(B,"line");return e.setAttribute("stroke","#4dc4ff"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e.setAttribute("opacity","0.45"),e},zt=function(e,t,n,o){const i=J.createElementNS(B,"g");return[{name:"line",d:e},{name:"arrow1",d:t},{name:"arrow2",d:n}].forEach((l,r)=>{const c=l.d,a=J.createElementNS(B,"path"),d={d:c,stroke:o?.stroke||"rgb(227, 125, 116)",fill:"none","stroke-linecap":o?.strokeLinecap||"cap","stroke-width":String(o?.strokeWidth||"2")};o?.opacity!==void 0&&(d.opacity=String(o.opacity)),A(a,d),r===0&&a.setAttribute("stroke-dasharray",o?.strokeDasharray||"8,2");const
|
|
11
|
+
border-radius:${l.borderRadius}; `,this.direction===0&&(t.style.right="0"),Ke(t),this.bus.fire("operation",{name:"beginEdit",obj:e.nodeObj}),t.addEventListener("keydown",r=>{r.stopPropagation();const c=r.key;if(c==="Enter"||c==="Tab"){if(r.shiftKey)return;r.preventDefault(),t.blur(),this.container.focus()}}),t.addEventListener("blur",()=>{if(!t)return;t.remove();const r=t.textContent?.trim()||"";r===o||r===""||(n.topic=r,this.markdown?e.text.innerHTML=this.markdown(n.topic,n):e.text.textContent=r,this.linkDiv(),this.bus.fire("operation",{name:"finishEdit",obj:n,origin:o}))})},Te=function(e){const t=D.createElement("me-epd");return t.expanded=e!==!1,t.className=e!==!1?"minus":"",t},J=document,B="http://www.w3.org/2000/svg",de=function(e){const t=e.clientWidth,n=e.clientHeight,o=e.dataset,i=Number(o.x),s=Number(o.y),l=o.anchor;let r=i;l==="middle"?r=i-t/2:l==="end"&&(r=i-t),e.style.left=`${r}px`,e.style.top=`${s-n/2}px`,e.style.visibility="visible"},_e=function(e,t,n,o){const{anchor:i="middle",color:s,dataType:l,svgId:r}=o,c=document.createElement("div");c.className="svg-label",c.style.color=s||"#666";const a="label-"+r;return c.id=a,c.innerHTML=e,c.dataset.type=l,c.dataset.svgId=r,c.dataset.x=t.toString(),c.dataset.y=n.toString(),c.dataset.anchor=i,c},Xe=function(e,t,n){const o=J.createElementNS(B,"path");return A(o,{d:e,stroke:t||"#666",fill:"none","stroke-width":n}),o},ne=function(e){const t=J.createElementNS(B,"svg");return t.setAttribute("class",e),t.setAttribute("overflow","visible"),t},qe=function(){const e=J.createElementNS(B,"line");return e.setAttribute("stroke","#4dc4ff"),e.setAttribute("fill","none"),e.setAttribute("stroke-width","2"),e.setAttribute("opacity","0.45"),e},zt=function(e,t,n,o){const i=J.createElementNS(B,"g");return[{name:"line",d:e},{name:"arrow1",d:t},{name:"arrow2",d:n}].forEach((l,r)=>{const c=l.d,a=J.createElementNS(B,"path"),d={d:c,stroke:o?.stroke||"rgb(227, 125, 116)",fill:"none","stroke-linecap":o?.strokeLinecap||"cap","stroke-width":String(o?.strokeWidth||"2")};o?.opacity!==void 0&&(d.opacity=String(o.opacity)),A(a,d),r===0&&a.setAttribute("stroke-dasharray",o?.strokeDasharray||"8,2");const h=J.createElementNS(B,"path");A(h,{d:c,stroke:"transparent",fill:"none","stroke-width":"15"}),i.appendChild(h),i.appendChild(a),i[l.name]=a}),i},Ve=function(e,t,n){if(!t)return;const o=n.label,i=t.cloneNode(!0);e.nodes.appendChild(i),i.id="input-box",i.textContent=o,i.contentEditable="plaintext-only",i.spellcheck=!1,i.style.cssText=`
|
|
12
12
|
left:${t.style.left};
|
|
13
13
|
top:${t.style.top};
|
|
14
14
|
max-width: 200px;
|
|
15
|
-
`,Ke(i),e.scrollIntoView(i),i.addEventListener("keydown",s=>{s.stopPropagation();const l=s.key;if(l==="Enter"||l==="Tab"){if(s.shiftKey)return;s.preventDefault(),i.blur(),e.container.focus()}}),i.addEventListener("blur",()=>{if(!i)return;const s=i.textContent?.trim()||"";s===""?n.label=o:n.label=s,i.remove(),s!==o&&(e.markdown?t.innerHTML=e.markdown(n.label,n):t.textContent=n.label,de(t),"parent"in n?e.bus.fire("operation",{name:"finishEditSummary",obj:n}):e.bus.fire("operation",{name:"finishEditArrowLabel",obj:n}))})},Wt=function(e){const t=this.map.querySelector("me-root"),n=t.offsetTop,o=t.offsetLeft,i=t.offsetWidth,s=t.offsetHeight,l=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="";for(let r=0;r<l.length;r++){const c=l[r],a=c.querySelector("me-tpc"),{offsetLeft:d,offsetTop:u}=R(this.nodes,a),g=a.offsetWidth,y=a.offsetHeight,v=c.parentNode.className,f=this.generateMainBranch({pT:n,pL:o,pW:i,pH:s,cT:u,cL:d,cW:g,cH:y,direction:v,containerHeight:this.nodes.offsetHeight}),m=this.theme.palette,p=a.nodeObj.branchColor||m[r%m.length];if(a.style.borderColor=p,this.lines.appendChild(Xe(f,p,"3")),e&&e!==c)continue;const b=ne("subLines"),x=c.lastChild;x.tagName==="svg"&&x.remove(),c.appendChild(b),Ue(this,b,p,c,v,!0)}this.labelContainer.innerHTML="",this.renderArrow(),this.renderSummary(),this.bus.fire("linkDiv")},Ue=function(e,t,n,o,i,s){const l=o.firstChild,r=o.children[1].children;if(r.length===0)return;const c=l.offsetTop,a=l.offsetLeft,d=l.offsetWidth,u=l.offsetHeight;for(let g=0;g<r.length;g++){const y=r[g],v=y.firstChild,f=v.offsetTop,m=v.offsetLeft,p=v.offsetWidth,b=v.offsetHeight,x=v.firstChild.nodeObj.branchColor||n,L=e.generateSubBranch({pT:c,pL:a,pW:d,pH:u,cT:f,cL:m,cW:p,cH:b,direction:i,isFirst:s});t.appendChild(Xe(L,x,"2"));const _=v.children[1];if(_){if(!_.expanded)continue}else continue;Ue(e,t,x,y,i)}},Je={addChild:"插入子节点",addParent:"插入父节点",addSibling:"插入同级节点",removeNode:"删除节点",focus:"专注",cancelFocus:"取消专注",moveUp:"上移",moveDown:"下移",link:"连接",linkBidirectional:"双向连接",clickTips:"请点击目标节点",summary:"摘要"},Ze={cn:Je,zh_CN:Je,zh_TW:{addChild:"插入子節點",addParent:"插入父節點",addSibling:"插入同級節點",removeNode:"刪除節點",focus:"專注",cancelFocus:"取消專注",moveUp:"上移",moveDown:"下移",link:"連接",linkBidirectional:"雙向連接",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",linkBidirectional:"Bidirectional Link",clickTips:"Please click the target node",summary:"Summary"},ru:{addChild:"Добавить дочерний элемент",addParent:"Добавить родительский элемент",addSibling:"Добавить на этом уровне",removeNode:"Удалить узел",focus:"Режим фокусировки",cancelFocus:"Отменить режим фокусировки",moveUp:"Поднять выше",moveDown:"Опустить ниже",link:"Ссылка",linkBidirectional:"Двунаправленная ссылка",clickTips:"Пожалуйста, нажмите на целевой узел",summary:"Описание"},ja:{addChild:"子ノードを追加する",addParent:"親ノードを追加します",addSibling:"兄弟ノードを追加する",removeNode:"ノードを削除",focus:"集中",cancelFocus:"集中解除",moveUp:"上へ移動",moveDown:"下へ移動",link:"コネクト",linkBidirectional:"双方向リンク",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",linkBidirectional:"Link bidirecional",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",linkBidirectional:"Collegamento bidirezionale",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",linkBidirectional:"Enlace bidireccional",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",linkBidirectional:"Lien bidirectionnel",clickTips:"Cliquer sur le noeud cible",summary:"Annoter"},ko:{addChild:"자식 추가",addParent:"부모 추가",addSibling:"형제 추가",removeNode:"노드 삭제",focus:"포커스 모드",cancelFocus:"포커스 모드 취소",moveUp:"위로 이동",moveDown:"아래로 이동",link:"연결",linkBidirectional:"양방향 연결",clickTips:"대상 노드를 클릭하십시오",summary:"요약"},ro:{addChild:"Adaugă sub-nod",addParent:"Adaugă nod părinte",addSibling:"Adaugă nod la același nivel",removeNode:"Șterge nodul",focus:"Focalizare",cancelFocus:"Anulează focalizarea",moveUp:"Mută în sus",moveDown:"Mută în jos",link:"Creează legătură",linkBidirectional:"Creează legătură bidirecțională",clickTips:"Click pe nodul țintă",summary:"Rezumat"}};function Gt(e,t){t=t===!0?{focus:!0,link:!0}:t;const n=C=>{const E=document.createElement("div");return E.innerText=C,E.className="tips",E},o=(C,E,S)=>{const N=document.createElement("li");return N.id=C,N.innerHTML=`<span>${we(E)}</span><span ${S?'class="key"':""}>${we(S)}</span>`,N},i=Ze[e.locale]?e.locale:"en",s=Ze[i],l=o("cm-add_child",s.addChild,"Tab"),r=o("cm-add_parent",s.addParent,"Ctrl + Enter"),c=o("cm-add_sibling",s.addSibling,"Enter"),a=o("cm-remove_child",s.removeNode,"Delete"),d=o("cm-fucus",s.focus,""),u=o("cm-unfucus",s.cancelFocus,""),g=o("cm-up",s.moveUp,"PgUp"),y=o("cm-down",s.moveDown,"Pgdn"),v=o("cm-link",s.link,""),f=o("cm-link-bidirectional",s.linkBidirectional,""),m=o("cm-summary",s.summary,""),p=document.createElement("ul");if(p.className="menu-list",p.appendChild(l),p.appendChild(r),p.appendChild(c),p.appendChild(a),t.focus&&(p.appendChild(d),p.appendChild(u)),p.appendChild(g),p.appendChild(y),p.appendChild(m),t.link&&(p.appendChild(v),p.appendChild(f)),t&&t.extend)for(let C=0;C<t.extend.length;C++){const E=t.extend[C],S=o(E.name,E.name,E.key||"");p.appendChild(S),S.onclick=N=>{E.onclick(N)}}const b=document.createElement("div");b.className="context-menu",b.appendChild(p),b.hidden=!0,e.container.append(b);let x=!0;const L=C=>{const E=C.target;if(le(E)){E.parentElement.tagName==="ME-ROOT"?x=!0:x=!1,x?(d.className="disabled",g.className="disabled",y.className="disabled",r.className="disabled",c.className="disabled",a.className="disabled"):(d.className="",g.className="",y.className="",r.className="",c.className="",a.className=""),b.hidden=!1,p.style.top="",p.style.bottom="",p.style.left="",p.style.right="";const S=p.getBoundingClientRect(),N=p.offsetHeight,$=p.offsetWidth,T=C.clientY-S.top,F=C.clientX-S.left;N+T>window.innerHeight?(p.style.top="",p.style.bottom="0px"):(p.style.bottom="",p.style.top=T+15+"px"),$+F>window.innerWidth?(p.style.left="",p.style.right="0px"):(p.style.right="",p.style.left=F+10+"px")}};e.bus.addListener("showContextMenu",L),b.onclick=C=>{C.target===b&&(b.hidden=!0)},l.onclick=()=>{e.addChild(),b.hidden=!0},r.onclick=()=>{e.insertParent(),b.hidden=!0},c.onclick=()=>{x||(e.insertSibling("after"),b.hidden=!0)},a.onclick=()=>{x||(e.removeNodes(e.currentNodes||[]),b.hidden=!0)},d.onclick=()=>{x||(e.focusNode(e.currentNode),b.hidden=!0)},u.onclick=()=>{e.cancelFocus(),b.hidden=!0},g.onclick=()=>{x||(e.moveUpNode(),b.hidden=!0)},y.onclick=()=>{x||(e.moveDownNode(),b.hidden=!0)};const _=C=>{b.hidden=!0;const E=e.currentNode,S=n(s.clickTips);e.container.appendChild(S),e.map.addEventListener("click",N=>{N.preventDefault(),S.remove();const $=N.target;($.parentElement.tagName==="ME-PARENT"||$.parentElement.tagName==="ME-ROOT")&&e.createArrow(E,$,C)},{once:!0})};return v.onclick=()=>_(),f.onclick=()=>_({bidirectional:!0}),m.onclick=()=>{b.hidden=!0,e.createSummary(),e.unselectNodes(e.currentNodes)},()=>{l.onclick=null,r.onclick=null,c.onclick=null,a.onclick=null,d.onclick=null,u.onclick=null,g.onclick=null,y.onclick=null,v.onclick=null,m.onclick=null,b.onclick=null,e.container.oncontextmenu=null}}const Kt=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:"nodes",value:[e.obj.id]}};function Xt(e){let t=[],n=-1,o=e.getData(),i=[];e.undo=function(){if(n>-1){const c=t[n];o=c.prev,e.refresh(c.prev);try{c.currentTarget.type==="nodes"&&(c.operation==="removeNodes"?e.selectNodes(c.currentTarget.value.map(a=>this.findEle(a))):e.selectNodes(c.currentSelected.map(a=>this.findEle(a))))}catch{}finally{n--}}},e.redo=function(){if(n<t.length-1){n++;const c=t[n];o=c.next,e.refresh(c.next);try{c.currentTarget.type==="nodes"&&(c.operation==="removeNodes"?e.selectNodes(c.currentSelected.map(a=>this.findEle(a))):e.selectNodes(c.currentTarget.value.map(a=>this.findEle(a))))}catch{}}};const s=function(c){if(c.name==="beginEdit")return;t=t.slice(0,n+1);const a=e.getData(),d={prev:o,operation:c.name,currentSelected:i.map(u=>u.id),currentTarget:Kt(c),next:a};t.push(d),o=a,n=t.length-1},l=function(c){(c.metaKey||c.ctrlKey)&&(c.shiftKey&&c.key==="Z"||c.key==="y")?e.redo():(c.metaKey||c.ctrlKey)&&c.key==="z"&&e.undo()},r=function(){i=e.currentNodes.map(c=>c.nodeObj)};return e.bus.addListener("operation",s),e.bus.addListener("selectNodes",r),e.container.addEventListener("keydown",l),()=>{e.bus.removeListener("operation",s),e.bus.removeListener("selectNodes",r),e.container.removeEventListener("keydown",l)}}const qt={side:'<?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>',left:'<?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>',right:'<?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>',full:'<?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>',living:'<?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>',zoomin:'<?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>',zoomout:'<?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>'},X=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=qt[t],n};function Vt(e){const t=document.createElement("div"),n=X("fullscreen","full"),o=X("toCenter","living"),i=X("zoomout","zoomout"),s=X("zoomin","zoomin"),l=document.createElement("span");return l.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.scale(e.scaleVal-e.scaleSensitivity)},s.onclick=()=>{e.scale(e.scaleVal+e.scaleSensitivity)},t}function Ut(e){const t=document.createElement("div"),n=X("tbltl","left"),o=X("tbltr","right"),i=X("tblts","side");return t.appendChild(n),t.appendChild(o),t.appendChild(i),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},o.onclick=()=>{e.initRight()},i.onclick=()=>{e.initSide()},t}function Jt(e){e.container.append(Vt(e)),e.container.append(Ut(e))}class Zt{_listeners=new Map;addEventListener(t,n){const o=this._listeners.get(t)??new Set;return this._listeners.set(t,o),o.add(n),this}removeEventListener(t,n){return this._listeners.get(t)?.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()}on=this.addEventListener;off=this.removeEventListener;emit=this.dispatchEvent}const Qe=(e,t="px")=>typeof e=="number"?e+t:e,Y=({style:e},t,n)=>{if(typeof t=="object")for(const[o,i]of Object.entries(t))i!==void 0&&(e[o]=Qe(i));else n!==void 0&&(e[t]=Qe(n))},et=(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)}},Qt=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}}},tt=(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}},en=()=>matchMedia("(hover: none), (pointer: coarse)").matches,tn=()=>"safari"in window,Le=e=>Array.isArray(e)?e:[e],nt=e=>(t,n,o,i={})=>{(t instanceof HTMLCollection||t instanceof NodeList)&&(t=Array.from(t)),n=Le(n),t=Le(t);for(const s of t)if(s)for(const l of n)s[e](l,o,{capture:!1,...i})},z=nt("addEventListener"),j=nt("removeEventListener"),he=e=>{const{clientX:t,clientY:n,target:o}=e.touches?.[0]??e;return{x:t,y:n,target:o}},Z=(e,t=document)=>Le(e).map(n=>typeof n=="string"?Array.from(t.querySelectorAll(n)):n instanceof Element?n:null).flat().filter(Boolean),nn=(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:q,max:ot,min:it,ceil:st}=Math,rt=(e=[])=>({stored:e,selected:[],touched:[],changed:{added:[],removed:[]}});class on extends Zt{static version="mind-elixir-fork";_options;_selection=rt();_area;_clippingElement;_targetElement;_targetBoundary;_targetBoundaryScrolled=!0;_targetRect;_selectables=[];_latestElement;_areaLocation={y1:0,x2:0,y2:0,x1:0};_areaRect=et();_singleClick=!0;_frame;_scrollAvailable=!0;_scrollingActive=!1;_scrollSpeed={x:0,y:0};_scrollDelta={x:0,y:0};_lastMousePosition={x:0,y:0};constructor(t){super(),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",mindElixirInstance:void 0,...t,behaviour:{overlap:"invert",intersect:"touch",triggers:[0],...t.behaviour,startThreshold:t.behaviour?.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,...t.behaviour?.scrolling,startScrollMargins:{x:0,y:0,...t.behaviour?.scrolling?.startScrollMargins}}},features:{range:!0,touch:!0,deselectOnBlur:!1,...t.features,singleTap:{allow:!0,intersect:"native",...t.features?.singleTap}}};for(const s of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[s]=="function"&&(this[s]=this[s].bind(this));const{document:n,selectionAreaClass:o,selectionContainerClass:i}=this._options;this._area=n.createElement("div"),this._clippingElement=n.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(o),i&&this._clippingElement.classList.add(i),Y(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),Y(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Qt(s=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",s),this._redrawSelectionArea()}),this.enable()}_toggleStartEvents(t=!0){const{document:n,features:o}=this._options,i=t?z:j;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}=he(t),{document:l,startAreas:r,boundaries:c,features:a,behaviour:d}=this._options,u=s.getBoundingClientRect();if(t instanceof MouseEvent&&!nn(t,d.triggers))return;const g=Z(r,l),y=Z(c,l);this._targetElement=y.find(p=>tt(p.getBoundingClientRect(),u));const v=t.composedPath(),f=g.find(p=>v.includes(p));if(this._targetBoundary=y.find(p=>v.includes(p)),!this._targetElement||!f||!this._targetBoundary||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:o,y1:i,x2:0,y2:0};const m=l.scrollingElement??l.body;this._scrollDelta={x:m.scrollLeft,y:m.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),z(l,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),z(l,["mouseup","touchcancel","touchend"],this._onTapStop),z(l,"scroll",this._onScroll),a.deselectOnBlur&&(this._targetBoundaryScrolled=!1,z(this._targetBoundary,"scroll",this._onStartAreaScroll))}_onSingleTap(t){const{singleTap:{intersect:n},range:o}=this._options.features,i=he(t);let s;if(n==="native")s=i.target;else if(n==="touch"){this.resolveSelectables();const{x:r,y:c}=i;s=this._selectables.find(a=>{const{right:d,left:u,top:g,bottom:y}=a.getBoundingClientRect();return r<d&&r>u&&c<y&&c>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:l}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&o&&this._latestElement){const r=this._latestElement,[c,a]=r.compareDocumentPosition(s)&4?[s,r]:[r,s],d=[...this._selectables.filter(u=>u.compareDocumentPosition(c)&4&&u.compareDocumentPosition(a)&2),c,a];this.select(d),this._latestElement=r}else l.includes(s)&&(l.length===1||t.ctrlKey||l.every(r=>this._selection.stored.includes(r)))?this.deselect(s):(this.select(s),this._latestElement=s)}_delayedTapMove(t){const{container:n,document:o,behaviour:{startThreshold:i}}=this._options,{x1:s,y1:l}=this._areaLocation,{x:r,y:c}=he(t);if(typeof i=="number"&&q(r+c-(s+l))>=i||typeof i=="object"&&q(r-s)>=i.x||q(c-l)>=i.y){if(j(o,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){j(o,["mouseup","touchcancel","touchend"],this._onTapStop);return}z(o,["mousemove","touchmove"],this._onTapMove,{passive:!1}),Y(this._area,"display","block"),Z(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&&(z(this._targetElement,"wheel",this._wheelScroll,{passive:!1}),z(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?(Y(t,{top:i.top,left:i.left,width:i.width,height:i.height}),Y(o,{marginTop:-i.top,marginLeft:-i.left})):(Y(t,{top:0,left:0,width:"100%",height:"100%"}),Y(o,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{_scrollSpeed:n,_areaLocation:o,_options:i,_frame:s}=this,{speedDivider:l}=i.behaviour.scrolling;this._targetElement;const{x:r,y:c}=he(t);if(o.x2=r,o.y2=c,this._lastMousePosition.x=r,this._lastMousePosition.y=c,this._scrollAvailable&&!this._scrollingActive&&(n.y||n.x)){this._scrollingActive=!0;const a=()=>{if(!n.x&&!n.y){this._scrollingActive=!1;return}const d=this._options.mindElixirInstance;if(d&&d.move){const u=n.x?st(n.x/l):0,g=n.y?st(n.y/l):0;(u||g)&&(d.move(-u,-g),o.x1-=u,o.y1-=g)}s.next(t),requestAnimationFrame(a)};requestAnimationFrame(a)}else s.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&en()||this._scrollAvailable&&tn())&&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,j(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,s=this._targetRect,{x1:l,y1:r}=n;let{x2:c,y2:a}=n;const{behaviour:{scrolling:{startScrollMargins:d}}}=i;c<s.left+d.x?(t.x=-q(s.left-c+d.x),c=c<s.left?s.left:c):c>s.right-d.x?(t.x=q(s.left+s.width-c-d.x),c=c>s.right?s.right:c):t.x=0,a<s.top+d.y?(t.y=-q(s.top-a+d.y),a=a<s.top?s.top:a):a>s.bottom-d.y?(t.y=q(s.top+s.height-a-d.y),a=a>s.bottom?s.bottom:a):t.y=0;const u=it(l,c),g=it(r,a),y=ot(l,c),v=ot(r,a);this._areaRect=et(u,g,y-u,v-g)}_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){const{document:o,features:i}=this._options,{_singleClick:s}=this;j(this._targetElement,"scroll",this._onStartAreaScroll),j(o,["mousemove","touchmove"],this._delayedTapMove),j(o,["touchmove","mousemove"],this._onTapMove),j(o,["mouseup","touchcancel","touchend"],this._onTapStop),j(o,"scroll",this._onScroll),this._keepSelection(),t&&s&&i.singleTap.allow?this._onSingleTap(t):!s&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,j(this._targetElement,"wheel",this._wheelScroll,{passive:!0}),j(this._options.document,"keydown",this._keyboardScroll,{passive:!0}),this._clippingElement.remove(),this._frame?.cancel(),Y(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:o,_areaRect:i}=this,{stored:s,selected:l,touched:r}=o,{intersect:c,overlap:a}=n.behaviour,d=a==="invert",u=[],g=[],y=[];for(let f=0;f<t.length;f++){const m=t[f];if(tt(i,m.getBoundingClientRect(),c)){if(l.includes(m))s.includes(m)&&!r.includes(m)&&r.push(m);else if(d&&s.includes(m)){y.push(m);continue}else g.push(m);u.push(m)}}d&&g.push(...s.filter(f=>!l.includes(f)));const v=a==="keep";for(let f=0;f<l.length;f++){const m=l[f];!u.includes(m)&&!(v&&s.includes(m))&&y.push(m)}o.selected=u,o.changed={added:g,removed:y},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:l}=n,r=o.filter(c=>!l.includes(c));switch(t.behaviour.overlap){case"drop":{n.stored=[...r,...l.filter(c=>!s.includes(c))];break}case"invert":{n.stored=[...r,...l.filter(c=>!i.removed.includes(c))];break}case"keep":{n.stored=[...l,...o.filter(c=>!l.includes(c))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=Z(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=rt(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()}enable=this._toggleStartEvents;disable=this._toggleStartEvents.bind(this,!1);select(t,n=!1){const{changed:o,selected:i,stored:s}=this._selection,l=Z(t,this._options.document).filter(r=>!i.includes(r)&&!s.includes(r));return s.push(...l),i.push(...l),o.added.push(...l),o.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),l}deselect(t,n=!1){const{selected:o,stored:i,changed:s}=this._selection,l=Z(t,this._options.document).filter(r=>o.includes(r)||i.includes(r));this._selection.stored=i.filter(r=>!l.includes(r)),this._selection.selected=o.filter(r=>!l.includes(r)),this._selection.changed.added=[],this._selection.changed.removed.push(...l.filter(r=>!s.removed.includes(r))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null))}}function sn(e){const t=e.mouseSelectionButton===2?[2]:[0],n=new on({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.selectionContainer,mindElixirInstance:e,features:{touch:!1},behaviour:{triggers:t,scrolling:{speedDivider:10,startScrollMargins:{x:50,y:50}}}}).on("beforestart",({event:o})=>{if(e.spacePressed)return!1;const i=o.target;if(i.id==="input-box"||i.className==="circle"||e.container.querySelector(".context-menu")?.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?.includes(s)),e.bus.fire("unselectNodes",i.map(s=>s.nodeObj))}});e.selection=n}const rn=function(e,t=!0){this.theme=e;const o={...(e.type==="dark"?be:ve).cssVar,...e.cssVar},i=Object.keys(o);for(let s=0;s<i.length;s++){const l=i[s];this.container.style.setProperty(l,o[l])}t&&this.refresh()},Q=e=>{const t=e.parent?.children,n=t?.indexOf(e)??0;return{siblings:t,index:n}};function ln(e){const{siblings:t,index:n}=Q(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 cn(e){const{siblings:t,index:n}=Q(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 lt(e){const{siblings:t,index:n}=Q(e);return t===void 0?0:(t.splice(n,1),t.length)}function an(e,t,n){const{siblings:o,index:i}=Q(n);o!==void 0&&(t==="before"?o.splice(i,0,e):o.splice(i+1,0,e))}function dn(e,t){const{siblings:n,index:o}=Q(e);n!==void 0&&(n[o]=t,t.children=[e])}function hn(e,t,n){if(lt(t),n.parent?.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:o,index:i}=Q(n);if(o===void 0)return;e==="before"?o.splice(i,0,t):o.splice(i+1,0,t)}}const un=function({map:e,direction:t},n){if(t===0)return 0;if(t===1)return 1;if(t===2){const o=e.querySelector(".lhs")?.childElementCount||0,i=e.querySelector(".rhs")?.childElementCount||0;return o<=i?(n.direction=0,0):(n.direction=1,1)}},ct=function(e,t,n){const o=n.children[0].children[0],i=t.parentElement;if(i.tagName==="ME-PARENT"){if(oe(o),i.children[1])i.nextSibling.appendChild(n);else{const s=e.createChildren([n]);i.appendChild(Te(!0)),i.insertAdjacentElement("afterend",s)}e.linkDiv(n.offsetParent)}else i.tagName==="ME-ROOT"&&(un(e,o.nodeObj)===0?e.container.querySelector(".lhs")?.appendChild(n):e.container.querySelector(".rhs")?.appendChild(n),e.linkDiv())},fn=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()},at={before:"beforebegin",after:"afterend"},oe=function(e){const n=e.parentElement.parentElement.lastElementChild;n?.tagName==="svg"&&n?.remove()},pn=function(e,t){const n=e.nodeObj,o=Ee(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const i=Object.assign(n,t);ke.call(this,e,i),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:i,origin:o})},Ae=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],G(e.nodeData);const{grp:s,top:l}=e.createWrapper(i);return ct(e,t,s),{newTop:l,newNodeObj:i}},gn=function(e,t,n){const o=t||this.currentNode;if(!o)return;const i=o.nodeObj;if(i.parent){if(!i.parent?.parent&&this.direction===2){const a=this.map.querySelector(".lhs")?.childElementCount||0,d=this.map.querySelector(".rhs")?.childElementCount||0;if(!a||!d){this.addChild(this.findEle(i.parent.id),n);return}}}else{this.addChild();return}const s=n||this.generateNewObj();if(!i.parent?.parent){const a=o.closest("me-main").className===I.LHS?0:1;s.direction=a}an(s,e,i),G(this.nodeData);const l=o.parentElement,{grp:r,top:c}=this.createWrapper(s);l.parentElement.insertAdjacentElement(at[e],r),this.linkDiv(r.offsetParent),n||this.editTopic(c.firstChild),this.bus.fire("operation",{name:"insertSibling",type:e,obj:s}),this.selectNode(c.firstChild,!0)},mn=function(e,t){const n=e||this.currentNode;if(!n)return;oe(n);const o=n.nodeObj;if(!o.parent)return;const i=t||this.generateNewObj();dn(o,i),G(this.nodeData);const s=n.parentElement.parentElement,{grp:l,top:r}=this.createWrapper(i,!0);r.appendChild(Te(!0)),s.insertAdjacentElement("afterend",l);const c=this.createChildren([s]);r.insertAdjacentElement("afterend",c),this.linkDiv(),t||this.editTopic(r.firstChild),this.selectNode(r.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:i})},yn=function(e,t){const n=e||this.currentNode;if(!n)return;const o=Ae(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)},vn=function(e,t){const n=Ee(e.nodeObj);xe(n);const o=Ae(this,t,n);if(!o)return;const{newNodeObj:i}=o;this.selectNode(this.findEle(i.id)),this.bus.fire("operation",{name:"copyNode",obj:i})},bn=function(e,t){e=Ce(e);const n=[];for(let o=0;o<e.length;o++){const i=e[o],s=Ee(i.nodeObj);xe(s);const l=Ae(this,t,s);if(!l)return;const{newNodeObj:r}=l;n.push(r)}this.unselectNodes(this.currentNodes),this.selectNodes(n.map(o=>this.findEle(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},wn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;ln(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},xn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;cn(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})},En=function(e){if(e.length===0)return;e=Ce(e);for(const n of e){const o=n.nodeObj,i=lt(o);fn(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)})},Me=(e,t,n,o)=>{e=Ce(e);let i=n.nodeObj;t==="in"&&i.expanded===!1&&(o.expandNode(n,!0),n=o.findEle(i.id),i=n.nodeObj),t==="after"&&(e=e.reverse());const s=[];for(const r of e){const c=r.nodeObj;if(hn(t,c,i),G(o.nodeData),t==="in"){const a=r.parentElement;ct(o,n,a.parentElement)}else{oe(r);const a=r.parentElement.parentNode;s.includes(a.parentElement)||s.push(a.parentElement),n.parentElement.parentNode.insertAdjacentElement(at[t],a)}}for(const r of s)r.childElementCount===0&&r.tagName!=="ME-MAIN"&&(r.previousSibling.children[1].remove(),r.remove());o.linkDiv(),o.scrollIntoView(e[e.length-1]);const l=t==="before"?"moveNodeBefore":t==="after"?"moveNodeAfter":"moveNodeIn";o.bus.fire("operation",{name:l,objs:e.map(r=>r.nodeObj),toObj:i})},dt=Object.freeze(Object.defineProperty({__proto__:null,addChild:yn,beginEdit:function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},copyNode:vn,copyNodes:bn,insertParent:mn,insertSibling:gn,moveDownNode:xn,moveNodeAfter:function(e,t){Me(e,"after",t,this)},moveNodeBefore:function(e,t){Me(e,"before",t,this)},moveNodeIn:function(e,t){Me(e,"in",t,this)},moveUpNode:wn,removeNodes:En,reshapeNode:pn,rmSubline:oe,setNodeTopic:function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"}));function Cn(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme}}const Sn=function(e){const t=this.container,n=e.getBoundingClientRect(),o=t.getBoundingClientRect();if(n.top>o.bottom-50||n.bottom<o.top+50||n.left>o.right-50||n.right<o.left+50){const s=n.left+n.width/2,l=n.top+n.height/2,r=o.left+o.width/2,c=o.top+o.height/2,a=s-r,d=l-c;this.move(-a,-d,!0)}},Nn=function(e,t,n){this.clearSelection(),this.scrollIntoView(e),this.selection.select(e),t&&this.bus.fire("selectNewNode",e.nodeObj)},kn=function(e){this.selection.select(e)},Tn=function(e){this.selection?.deselect(e)},_n=function(){this.unselectNodes(this.currentNodes),this.unselectSummary(),this.unselectArrow()},Ln=function(){const e=Cn(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},An=function(){return JSON.parse(this.getDataString())},Mn=function(){this.editable=!0},Dn=function(){this.editable=!1},Pn=function(e,t={x:0,y:0}){if(e<this.scaleMin||e>this.scaleMax)return;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:l}=De(this),r=this.map.style.transform,{x:c,y:a}=je(r),d=c-s,u=a-l,g=this.scaleVal,y=(-o+d)*(1-e/g),v=(-i+u)*(1-e/g);this.map.style.transform=`translate3d(${c-y}px, ${a-v}px, 0) scale(${e})`,this.scaleVal=e,this.bus.fire("scale",e)},$n=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;const{dx:o,dy:i}=De(this);this.map.style.transform=`translate3d(${o}px, ${i}px, 0) scale(${n})`,this.bus.fire("scale",n)},On=function(e,t,n=!1){const{map:o,scaleVal:i,bus:s}=this;if(n&&o.style.transition==="transform 0.3s")return;const l=o.style.transform;let{x:r,y:c}=je(l);r+=e,c+=t,n&&(o.style.transition="transform 0.3s",setTimeout(()=>{o.style.transition="none"},300)),o.style.transform=`translate3d(${r}px, ${c}px, 0) scale(${i})`,s.fire("move",{dx:e,dy:t})},De=e=>{const{container:t,map:n,nodes:o}=e,i=n.querySelector("me-root"),s=i.offsetTop,l=i.offsetLeft,r=i.offsetWidth,c=i.offsetHeight;let a,d;return e.alignment==="root"?(a=t.offsetWidth/2-l-r/2,d=t.offsetHeight/2-s-c/2,n.style.transformOrigin=`${l+r/2}px 50%`):(a=(t.offsetWidth-o.offsetWidth)/2,d=(t.offsetHeight-o.offsetHeight)/2,n.style.transformOrigin="50% 50%"),{dx:a,dy:d}},jn=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:_n,disableEdit:Dn,enableEdit:Mn,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.getBoundingClientRect(),i={x:o.left,y:o.top},s=e.parentNode,l=s.children[1];if(l.expanded=n.expanded,l.className=n.expanded?"minus":"",oe(e),n.expanded){const u=this.createChildren(n.children.map(g=>this.createWrapper(g).grp));s.parentNode.appendChild(u)}else s.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const r=e.getBoundingClientRect(),c={x:r.left,y:r.top},a=i.x-c.x,d=i.y-c.y;this.move(a,d),this.bus.fire("expandNode",n)},expandNodeAll:function(e,t){const n=e.nodeObj,o=e.getBoundingClientRect(),i={x:o.left,y:o.top};V(n,t??!n.expanded),this.refresh();const s=this.findEle(n.id).getBoundingClientRect(),l={x:s.left,y:s.top},r=i.x-l.x,c=i.y-l.y;this.move(r,c)},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:An,getDataString:Ln,initLeft:function(){this.direction=0,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initRight:function(){this.direction=1,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initSide:function(){this.direction=2,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},install:function(e){e(this)},move:On,refresh:function(e){this.clearSelection(),e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.arrows=e.arrows||[],this.summaries=e.summaries||[],e.theme&&this.changeTheme(e.theme)),G(this.nodeData),this.layout(),this.linkDiv()},scale:Pn,scaleFit:$n,scrollIntoView:Sn,selectNode:Nn,selectNodes:kn,setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){const{map:e,container:t}=this,{dx:n,dy:o}=De(this);t.scrollTop=0,t.scrollLeft=0,e.style.transform=`translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`},unselectNodes:Tn},Symbol.toStringTag,{value:"Module"})),ht={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=He([{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}}}},Hn="#4dc4ff";function ut(e,t,n,o,i,s,l,r){return{x:e/8+n*3/8+i*3/8+l/8,y:t/8+o*3/8+s*3/8+r/8}}function In(e,t,n){e&&(e.dataset.x=t.toString(),e.dataset.y=n.toString(),de(e))}function ue(e,t,n,o,i){A(e,{x1:t+"",y1:n+"",x2:o+"",y2:i+""})}function ft(e,t,n,o,i,s,l,r,c,a){const d=`M ${t} ${n} C ${o} ${i} ${s} ${l} ${r} ${c}`;if(e.line.setAttribute("d",d),a.style){const f=a.style;f.stroke&&e.line.setAttribute("stroke",f.stroke),f.strokeWidth&&e.line.setAttribute("stroke-width",String(f.strokeWidth)),f.strokeDasharray&&e.line.setAttribute("stroke-dasharray",f.strokeDasharray),f.strokeLinecap&&e.line.setAttribute("stroke-linecap",f.strokeLinecap),f.opacity!==void 0&&e.line.setAttribute("opacity",String(f.opacity))}const u=e.querySelectorAll('path[stroke="transparent"]');u.length>0&&u[0].setAttribute("d",d);const g=re(s,l,r,c);if(g){const f=`M ${g.x1} ${g.y1} L ${r} ${c} L ${g.x2} ${g.y2}`;if(e.arrow1.setAttribute("d",f),u.length>1&&u[1].setAttribute("d",f),a.style){const m=a.style;m.stroke&&e.arrow1.setAttribute("stroke",m.stroke),m.strokeWidth&&e.arrow1.setAttribute("stroke-width",String(m.strokeWidth)),m.strokeLinecap&&e.arrow1.setAttribute("stroke-linecap",m.strokeLinecap),m.opacity!==void 0&&e.arrow1.setAttribute("opacity",String(m.opacity))}}if(a.bidirectional){const f=re(o,i,t,n);if(f){const m=`M ${f.x1} ${f.y1} L ${t} ${n} L ${f.x2} ${f.y2}`;if(e.arrow2.setAttribute("d",m),u.length>2&&u[2].setAttribute("d",m),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:y,y:v}=ut(t,n,o,i,s,l,r,c);if(e.labelEl&&In(e.labelEl,y,v),a.style?.labelColor){const f=e.labelEl;f&&(f.style.color=a.style.labelColor)}Kn(e)}function fe(e,t,n){const{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=t.offsetWidth,l=t.offsetHeight,r=o+s/2,c=i+l/2,a=r+n.x,d=c+n.y;return{w:s,h:l,cx:r,cy:c,ctrlX:a,ctrlY:d}}function ee(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 Pe=function(e,t,n,o,i){if(!t||!n)return;const s=fe(e,t,o.delta1),l=fe(e,n,o.delta2),{x:r,y:c}=ee(s),{ctrlX:a,ctrlY:d}=s,{ctrlX:u,ctrlY:g}=l,{x:y,y:v}=ee(l),f=re(u,g,y,v);if(!f)return;const m=`M ${f.x1} ${f.y1} L ${y} ${v} L ${f.x2} ${f.y2}`;let p="";if(o.bidirectional){const N=re(a,d,r,c);if(!N)return;p=`M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`}const b=zt(`M ${r} ${c} C ${a} ${d} ${u} ${g} ${y} ${v}`,m,p,o.style),{x,y:L}=ut(r,c,a,d,u,g,y,v),_=o.style?.labelColor||"rgb(235, 95, 82)",C="arrow-"+o.id;b.id=C;const E=e.markdown?e.markdown(o.label,o):o.label,S=_e(E,x,L,{anchor:"middle",color:_,dataType:"arrow",svgId:C});b.labelEl=S,b.arrowObj=o,b.dataset.linkid=o.id,e.labelContainer.appendChild(S),e.linkSvgGroup.appendChild(b),de(S),i||(e.arrows.push(o),e.currentArrow=b,pt(e,o,s,l))},Bn=function(e,t,n={}){const o={id:K(),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};Pe(this,e,t,o),this.bus.fire("operation",{name:"createArrow",obj:o})},Rn=function(e){pe(this);const t={...e,id:K()};Pe(this,this.findEle(t.from),this.findEle(t.to),t),this.bus.fire("operation",{name:"createArrow",obj:t})},Fn=function(e){let t;if(e?t=e:t=this.currentArrow,!t)return;pe(this);const n=t.arrowObj.id;this.arrows=this.arrows.filter(o=>o.id!==n),t.labelEl?.remove(),t.remove(),this.bus.fire("operation",{name:"removeArrow",obj:{id:n}})},Yn=function(e){this.currentArrow=e;const t=e.arrowObj,n=this.findEle(t.from),o=this.findEle(t.to),i=fe(this,n,t.delta1),s=fe(this,o,t.delta2);pt(this,t,i,s)},zn=function(){pe(this),this.currentArrow=null},$e=function(e,t){const n=document.createElementNS(B,"path");return A(n,{d:e,stroke:t,fill:"none","stroke-width":"6","stroke-linecap":"round","stroke-linejoin":"round"}),n},Wn=function(e,t){const n=document.createElementNS(B,"g");n.setAttribute("class","arrow-highlight"),n.setAttribute("opacity","0.45");const o=$e(e.line.getAttribute("d"),t);n.appendChild(o);const i=$e(e.arrow1.getAttribute("d"),t);if(n.appendChild(i),e.arrow2.getAttribute("d")){const s=$e(e.arrow2.getAttribute("d"),t);n.appendChild(s)}e.insertBefore(n,e.firstChild)},Gn=function(e){const t=e.querySelector(".arrow-highlight");t&&t.remove()},Kn=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"))},pe=function(e){e.helper1?.destroy(),e.helper2?.destroy(),e.linkController.style.display="none",e.P2.style.display="none",e.P3.style.display="none",e.currentArrow&&Gn(e.currentArrow)},pt=function(e,t,n,o){const{linkController:i,P2:s,P3:l,line1:r,line2:c,nodes:a,map:d,currentArrow:u,bus:g}=e;if(!u)return;i.style.display="initial",s.style.display="initial",l.style.display="initial",a.appendChild(i),a.appendChild(s),a.appendChild(l),Wn(u,Hn);let{x:y,y:v}=ee(n),{ctrlX:f,ctrlY:m}=n,{ctrlX:p,ctrlY:b}=o,{x,y:L}=ee(o);s.style.cssText=`top:${m}px;left:${f}px;`,l.style.cssText=`top:${b}px;left:${p}px;`,ue(r,y,v,f,m),ue(c,p,b,x,L),e.helper1=ht.create(s),e.helper2=ht.create(l),e.helper1.init(d,(_,C)=>{f=f+_/e.scaleVal,m=m+C/e.scaleVal;const E=ee({...n,ctrlX:f,ctrlY:m});y=E.x,v=E.y,s.style.top=m+"px",s.style.left=f+"px",ft(u,y,v,f,m,p,b,x,L,t),ue(r,y,v,f,m),t.delta1.x=f-n.cx,t.delta1.y=m-n.cy,g.fire("updateArrowDelta",t)}),e.helper2.init(d,(_,C)=>{p=p+_/e.scaleVal,b=b+C/e.scaleVal;const E=ee({...o,ctrlX:p,ctrlY:b});x=E.x,L=E.y,l.style.top=b+"px",l.style.left=p+"px",ft(u,y,v,f,m,p,b,x,L,t),ue(c,p,b,x,L),t.delta2.x=p-o.cx,t.delta2.y=b-o.cy,g.fire("updateArrowDelta",t)})};function Xn(){this.linkSvgGroup.innerHTML="",this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach(t=>t.remove());for(let t=0;t<this.arrows.length;t++){const n=this.arrows[t];try{Pe(this,this.findEle(n.from),this.findEle(n.to),n,!0)}catch{}}this.nodes.appendChild(this.linkSvgGroup)}function qn(e){pe(this),e&&e.labelEl&&Ve(this,e.labelEl,e.arrowObj)}function Vn(){this.arrows=this.arrows.filter(e=>se(e.from,this.nodeData)&&se(e.to,this.nodeData))}const Un=Object.freeze(Object.defineProperty({__proto__:null,createArrow:Bn,createArrowFrom:Rn,editArrowLabel:qn,removeArrow:Fn,renderArrow:Xn,selectArrow:Yn,tidyArrow:Vn,unselectArrow:zn},Symbol.toStringTag,{value:"Module"})),Jn=function(e){if(e.length===0)throw new Error("No selected node.");if(e.length===1){const c=e[0].nodeObj,a=e[0].nodeObj.parent;if(!a)throw new Error("Can not select root node.");const d=a.children.findIndex(u=>c===u);return{parent:a.id,start:d,end:d}}let t=0;const n=e.map(c=>{let a=c.nodeObj;const d=[];for(;a.parent;){const u=a.parent,y=u.children?.indexOf(a);a=u,d.unshift({node:a,index:y})}return d.length>t&&(t=d.length),d});let o=0;e:for(;o<t;o++){const c=n[0][o]?.node;for(let a=1;a<n.length;a++)if(n[a][o]?.node!==c)break e}if(!o)throw new Error("Can not select root node.");const i=n.map(c=>c[o-1].index).sort(),s=i[0]||0,l=i[i.length-1]||0,r=n[0][o-1].node;if(!r.parent)throw new Error("Please select nodes in the same main topic.");return{parent:r.id,start:s,end:l}},Zn=function(e){const t=document.createElementNS(B,"g");return t.setAttribute("id",e),t},gt=function(e,t){const n=document.createElementNS(B,"path");return A(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},Qn=e=>e.parentElement.parentElement,eo=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},Oe=function(e,t){const{id:n,label:o,parent:i,start:s,end:l,style:r}=t,{nodes:c,theme:a,summarySvg:d}=e,g=e.findEle(i).nodeObj,y=eo(e,t);let v=1/0,f=0,m=0,p=0;for(let h=s;h<=l;h++){const w=g.children?.[h];if(!w)return e.removeSummary(n),null;const k=Qn(e.findEle(w.id)),{offsetLeft:O,offsetTop:W}=R(c,k),M=s===l?10:20;h===s&&(m=W+M),h===l&&(p=W+k.offsetHeight-M),O<v&&(v=O),k.offsetWidth+O>f&&(f=k.offsetWidth+O)}let b,x;const L=g.parent?10:0,_=m+L,C=p+L,E=(_+C)/2,S=r?.stroke||a.cssVar["--color"],N=r?.labelColor||a.cssVar["--color"],$="s-"+n,T=e.markdown?e.markdown(o,t):o;y===I.LHS?(b=gt(`M ${v+10} ${_} c -5 0 -10 5 -10 10 L ${v} ${C-10} c 0 5 5 10 10 10 M ${v} ${E} h -10`,S),x=_e(T,v-20,E,{anchor:"end",color:N,dataType:"summary",svgId:$})):(b=gt(`M ${f-10} ${_} c 5 0 10 5 10 10 L ${f} ${C-10} c 0 5 -5 10 -10 10 M ${f} ${E} h 10`,S),x=_e(T,f+20,E,{anchor:"start",color:N,dataType:"summary",svgId:$}));const F=Zn($);return F.appendChild(b),e.labelContainer.appendChild(x),de(x),F.summaryObj=t,F.labelEl=x,d.appendChild(F),F},to=Object.freeze(Object.defineProperty({__proto__:null,createSummary:function(e={}){if(!this.currentNodes)return;const{currentNodes:t,summaries:n,bus:o}=this,{parent:i,start:s,end:l}=Jn(t),r={id:K(),parent:i,start:s,end:l,label:"summary",style:e.style},c=Oe(this,r);n.push(r),this.editSummary(c),o.fire("operation",{name:"createSummary",obj:r})},createSummaryFrom:function(e){const t=K(),n={...e,id:t};Oe(this,n),this.summaries.push(n),this.bus.fire("operation",{name:"createSummary",obj:n})},editSummary:function(e){e&&e.labelEl&&Ve(this,e.labelEl,e.summaryObj)},removeSummary:function(e){const t=this.summaries.findIndex(n=>n.id===e);t>-1&&(this.summaries.splice(t,1),this.nodes.querySelector("#s-"+e)?.remove(),this.nodes.querySelector("#label-s-"+e)?.remove()),this.bus.fire("operation",{name:"removeSummary",obj:{id:e}})},renderSummary:function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{try{Oe(this,e)}catch{}}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},selectSummary:function(e){const t=e.labelEl;t&&t.classList.add("selected"),this.currentSummary=e},unselectSummary:function(){this.currentSummary?.labelEl?.classList.remove("selected"),this.currentSummary=null}},Symbol.toStringTag,{value:"Module"})),P="http://www.w3.org/2000/svg";function no(e,t){const n=document.createElementNS(P,"svg");return A(n,{version:"1.1",xmlns:P,height:e,width:t}),n}function oo(e,t){return(parseInt(e)-parseInt(t))/2}function io(e,t,n,o){const i=document.createElementNS(P,"g");let s="";return e.text?s=e.text.textContent:s=e.childNodes[0].textContent,s.split(`
|
|
16
|
-
`).forEach((r,c)=>{const a=document.createElementNS(P,"text");A(a,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+oo(t.lineHeight,t.fontSize)*(c+1)+parseFloat(t.fontSize)*(c+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),a.innerHTML=r,i.appendChild(a)}),i}function so(e,t,n,o){let i="";e.nodeObj?.dangerouslySetInnerHTML?i=e.nodeObj.dangerouslySetInnerHTML:e.text?i=e.text.textContent:i=e.childNodes[0].textContent;const s=document.createElementNS(P,"foreignObject");A(s,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const l=document.createElement("div");return A(l,{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;`}),l.innerHTML=i,s.appendChild(l),s}function ro(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=document.createElementNS(P,"rect");return A(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 ge(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:i,offsetTop:s}=R(e.nodes,t),l=document.createElementNS(P,"rect");A(l,{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 r=document.createElementNS(P,"g");r.appendChild(l);let c;return n?c=so(t,o,i,s):c=io(t,o,i,s),r.appendChild(c),r}function lo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=document.createElementNS(P,"a"),l=document.createElementNS(P,"text");return A(l,{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}`}),l.innerHTML=t.textContent,s.appendChild(l),s.setAttribute("href",t.href),s}function co(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=document.createElementNS(P,"image");return A(s,{x:o+"",y:i+"",width:n.width+"",height:n.height+"",href:t.src}),s}const me=100,ao='<?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">',ho=(e,t=!1)=>{const n=e.nodes,o=n.offsetHeight+me*2,i=n.offsetWidth+me*2,s=no(o+"px",i+"px"),l=document.createElementNS(P,"svg"),r=document.createElementNS(P,"rect");A(r,{x:"0",y:"0",width:`${i}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),s.appendChild(r),n.querySelectorAll(".subLines").forEach(
|
|
15
|
+
`,Ke(i),e.scrollIntoView(i),i.addEventListener("keydown",s=>{s.stopPropagation();const l=s.key;if(l==="Enter"||l==="Tab"){if(s.shiftKey)return;s.preventDefault(),i.blur(),e.container.focus()}}),i.addEventListener("blur",()=>{if(!i)return;const s=i.textContent?.trim()||"";s===""?n.label=o:n.label=s,i.remove(),s!==o&&(e.markdown?t.innerHTML=e.markdown(n.label,n):t.textContent=n.label,de(t),"parent"in n?e.bus.fire("operation",{name:"finishEditSummary",obj:n}):e.bus.fire("operation",{name:"finishEditArrowLabel",obj:n}))})},Wt=function(e){const t=this.map.querySelector("me-root"),n=t.offsetTop,o=t.offsetLeft,i=t.offsetWidth,s=t.offsetHeight,l=this.map.querySelectorAll("me-main > me-wrapper");this.lines.innerHTML="";for(let r=0;r<l.length;r++){const c=l[r],a=c.querySelector("me-tpc"),{offsetLeft:d,offsetTop:h}=R(this.nodes,a),f=a.offsetWidth,y=a.offsetHeight,v=c.parentNode.className,p=this.generateMainBranch({pT:n,pL:o,pW:i,pH:s,cT:h,cL:d,cW:f,cH:y,direction:v,containerHeight:this.nodes.offsetHeight}),m=this.theme.palette,g=a.nodeObj.branchColor||m[r%m.length];if(a.style.borderColor=g,this.lines.appendChild(Xe(p,g,"3")),e&&e!==c)continue;const b=ne("subLines"),x=c.lastChild;x.tagName==="svg"&&x.remove(),c.appendChild(b),Ue(this,b,g,c,v,!0)}this.labelContainer.innerHTML="",this.renderArrow(),this.renderSummary(),this.bus.fire("linkDiv")},Ue=function(e,t,n,o,i,s){const l=o.firstChild,r=o.children[1].children;if(r.length===0)return;const c=l.offsetTop,a=l.offsetLeft,d=l.offsetWidth,h=l.offsetHeight;for(let f=0;f<r.length;f++){const y=r[f],v=y.firstChild,p=v.offsetTop,m=v.offsetLeft,g=v.offsetWidth,b=v.offsetHeight,x=v.firstChild.nodeObj.branchColor||n,L=e.generateSubBranch({pT:c,pL:a,pW:d,pH:h,cT:p,cL:m,cW:g,cH:b,direction:i,isFirst:s});t.appendChild(Xe(L,x,"2"));const _=v.children[1];if(_){if(!_.expanded)continue}else continue;Ue(e,t,x,y,i)}},Je={addChild:"插入子节点",addParent:"插入父节点",addSibling:"插入同级节点",removeNode:"删除节点",focus:"专注",cancelFocus:"取消专注",moveUp:"上移",moveDown:"下移",link:"连接",linkBidirectional:"双向连接",clickTips:"请点击目标节点",summary:"摘要"},Ze={cn:Je,zh_CN:Je,zh_TW:{addChild:"插入子節點",addParent:"插入父節點",addSibling:"插入同級節點",removeNode:"刪除節點",focus:"專注",cancelFocus:"取消專注",moveUp:"上移",moveDown:"下移",link:"連接",linkBidirectional:"雙向連接",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",linkBidirectional:"Bidirectional Link",clickTips:"Please click the target node",summary:"Summary"},ru:{addChild:"Добавить дочерний элемент",addParent:"Добавить родительский элемент",addSibling:"Добавить на этом уровне",removeNode:"Удалить узел",focus:"Режим фокусировки",cancelFocus:"Отменить режим фокусировки",moveUp:"Поднять выше",moveDown:"Опустить ниже",link:"Ссылка",linkBidirectional:"Двунаправленная ссылка",clickTips:"Пожалуйста, нажмите на целевой узел",summary:"Описание"},ja:{addChild:"子ノードを追加する",addParent:"親ノードを追加します",addSibling:"兄弟ノードを追加する",removeNode:"ノードを削除",focus:"集中",cancelFocus:"集中解除",moveUp:"上へ移動",moveDown:"下へ移動",link:"コネクト",linkBidirectional:"双方向リンク",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",linkBidirectional:"Link bidirecional",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",linkBidirectional:"Collegamento bidirezionale",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",linkBidirectional:"Enlace bidireccional",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",linkBidirectional:"Lien bidirectionnel",clickTips:"Cliquer sur le noeud cible",summary:"Annoter"},ko:{addChild:"자식 추가",addParent:"부모 추가",addSibling:"형제 추가",removeNode:"노드 삭제",focus:"포커스 모드",cancelFocus:"포커스 모드 취소",moveUp:"위로 이동",moveDown:"아래로 이동",link:"연결",linkBidirectional:"양방향 연결",clickTips:"대상 노드를 클릭하십시오",summary:"요약"},ro:{addChild:"Adaugă sub-nod",addParent:"Adaugă nod părinte",addSibling:"Adaugă nod la același nivel",removeNode:"Șterge nodul",focus:"Focalizare",cancelFocus:"Anulează focalizarea",moveUp:"Mută în sus",moveDown:"Mută în jos",link:"Creează legătură",linkBidirectional:"Creează legătură bidirecțională",clickTips:"Click pe nodul țintă",summary:"Rezumat"}};function Gt(e,t){t=t===!0?{focus:!0,link:!0}:t;const n=C=>{const E=document.createElement("div");return E.innerText=C,E.className="tips",E},o=(C,E,S)=>{const N=document.createElement("li");return N.id=C,N.innerHTML=`<span>${we(E)}</span><span ${S?'class="key"':""}>${we(S)}</span>`,N},i=Ze[e.locale]?e.locale:"en",s=Ze[i],l=o("cm-add_child",s.addChild,"Tab"),r=o("cm-add_parent",s.addParent,"Ctrl + Enter"),c=o("cm-add_sibling",s.addSibling,"Enter"),a=o("cm-remove_child",s.removeNode,"Delete"),d=o("cm-fucus",s.focus,""),h=o("cm-unfucus",s.cancelFocus,""),f=o("cm-up",s.moveUp,"PgUp"),y=o("cm-down",s.moveDown,"Pgdn"),v=o("cm-link",s.link,""),p=o("cm-link-bidirectional",s.linkBidirectional,""),m=o("cm-summary",s.summary,""),g=document.createElement("ul");if(g.className="menu-list",g.appendChild(l),g.appendChild(r),g.appendChild(c),g.appendChild(a),t.focus&&(g.appendChild(d),g.appendChild(h)),g.appendChild(f),g.appendChild(y),g.appendChild(m),t.link&&(g.appendChild(v),g.appendChild(p)),t&&t.extend)for(let C=0;C<t.extend.length;C++){const E=t.extend[C],S=o(E.name,E.name,E.key||"");g.appendChild(S),S.onclick=N=>{E.onclick(N)}}const b=document.createElement("div");b.className="context-menu",b.appendChild(g),b.hidden=!0,e.container.append(b);let x=!0;const L=C=>{const E=C.target;if(le(E)){E.parentElement.tagName==="ME-ROOT"?x=!0:x=!1,x?(d.className="disabled",f.className="disabled",y.className="disabled",r.className="disabled",c.className="disabled",a.className="disabled"):(d.className="",f.className="",y.className="",r.className="",c.className="",a.className=""),b.hidden=!1,g.style.top="",g.style.bottom="",g.style.left="",g.style.right="";const S=g.getBoundingClientRect(),N=g.offsetHeight,$=g.offsetWidth,T=C.clientY-S.top,F=C.clientX-S.left;N+T>window.innerHeight?(g.style.top="",g.style.bottom="0px"):(g.style.bottom="",g.style.top=T+15+"px"),$+F>window.innerWidth?(g.style.left="",g.style.right="0px"):(g.style.right="",g.style.left=F+10+"px")}};e.bus.addListener("showContextMenu",L),b.onclick=C=>{C.target===b&&(b.hidden=!0)},l.onclick=()=>{e.addChild(),b.hidden=!0},r.onclick=()=>{e.insertParent(),b.hidden=!0},c.onclick=()=>{x||(e.insertSibling("after"),b.hidden=!0)},a.onclick=()=>{x||(e.removeNodes(e.currentNodes||[]),b.hidden=!0)},d.onclick=()=>{x||(e.focusNode(e.currentNode),b.hidden=!0)},h.onclick=()=>{e.cancelFocus(),b.hidden=!0},f.onclick=()=>{x||(e.moveUpNode(),b.hidden=!0)},y.onclick=()=>{x||(e.moveDownNode(),b.hidden=!0)};const _=C=>{b.hidden=!0;const E=e.currentNode,S=n(s.clickTips);e.container.appendChild(S),e.map.addEventListener("click",N=>{N.preventDefault(),S.remove();const $=N.target;($.parentElement.tagName==="ME-PARENT"||$.parentElement.tagName==="ME-ROOT")&&e.createArrow(E,$,C)},{once:!0})};return v.onclick=()=>_(),p.onclick=()=>_({bidirectional:!0}),m.onclick=()=>{b.hidden=!0,e.createSummary(),e.unselectNodes(e.currentNodes)},()=>{l.onclick=null,r.onclick=null,c.onclick=null,a.onclick=null,d.onclick=null,h.onclick=null,f.onclick=null,y.onclick=null,v.onclick=null,m.onclick=null,b.onclick=null,e.container.oncontextmenu=null}}const Kt=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:"nodes",value:[e.obj.id]}};function Xt(e){let t=[],n=-1,o=e.getData(),i=[];e.undo=function(){if(n>-1){const c=t[n];o=c.prev,e.refresh(c.prev);try{c.currentTarget.type==="nodes"&&(c.operation==="removeNodes"?e.selectNodes(c.currentTarget.value.map(a=>this.findEle(a))):e.selectNodes(c.currentSelected.map(a=>this.findEle(a))))}catch{}finally{n--}}},e.redo=function(){if(n<t.length-1){n++;const c=t[n];o=c.next,e.refresh(c.next);try{c.currentTarget.type==="nodes"&&(c.operation==="removeNodes"?e.selectNodes(c.currentSelected.map(a=>this.findEle(a))):e.selectNodes(c.currentTarget.value.map(a=>this.findEle(a))))}catch{}}};const s=function(c){if(c.name==="beginEdit")return;t=t.slice(0,n+1);const a=e.getData(),d={prev:o,operation:c.name,currentSelected:i.map(h=>h.id),currentTarget:Kt(c),next:a};t.push(d),o=a,n=t.length-1},l=function(c){(c.metaKey||c.ctrlKey)&&(c.shiftKey&&c.key==="Z"||c.key==="y")?e.redo():(c.metaKey||c.ctrlKey)&&c.key==="z"&&e.undo()},r=function(){i=e.currentNodes.map(c=>c.nodeObj)};return e.bus.addListener("operation",s),e.bus.addListener("selectNodes",r),e.container.addEventListener("keydown",l),()=>{e.bus.removeListener("operation",s),e.bus.removeListener("selectNodes",r),e.container.removeEventListener("keydown",l)}}const qt={side:'<?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>',left:'<?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>',right:'<?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>',full:'<?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>',living:'<?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>',zoomin:'<?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>',zoomout:'<?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>'},X=(e,t)=>{const n=document.createElement("span");return n.id=e,n.innerHTML=qt[t],n};function Vt(e){const t=document.createElement("div"),n=X("fullscreen","full"),o=X("toCenter","living"),i=X("zoomout","zoomout"),s=X("zoomin","zoomin"),l=document.createElement("span");return l.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.scale(e.scaleVal-e.scaleSensitivity)},s.onclick=()=>{e.scale(e.scaleVal+e.scaleSensitivity)},t}function Ut(e){const t=document.createElement("div"),n=X("tbltl","left"),o=X("tbltr","right"),i=X("tblts","side");return t.appendChild(n),t.appendChild(o),t.appendChild(i),t.className="mind-elixir-toolbar lt",n.onclick=()=>{e.initLeft()},o.onclick=()=>{e.initRight()},i.onclick=()=>{e.initSide()},t}function Jt(e){e.container.append(Vt(e)),e.container.append(Ut(e))}class Zt{_listeners=new Map;addEventListener(t,n){const o=this._listeners.get(t)??new Set;return this._listeners.set(t,o),o.add(n),this}removeEventListener(t,n){return this._listeners.get(t)?.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()}on=this.addEventListener;off=this.removeEventListener;emit=this.dispatchEvent}const Qe=(e,t="px")=>typeof e=="number"?e+t:e,Y=({style:e},t,n)=>{if(typeof t=="object")for(const[o,i]of Object.entries(t))i!==void 0&&(e[o]=Qe(i));else n!==void 0&&(e[t]=Qe(n))},et=(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)}},Qt=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}}},tt=(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}},en=()=>matchMedia("(hover: none), (pointer: coarse)").matches,tn=()=>"safari"in window,Le=e=>Array.isArray(e)?e:[e],nt=e=>(t,n,o,i={})=>{(t instanceof HTMLCollection||t instanceof NodeList)&&(t=Array.from(t)),n=Le(n),t=Le(t);for(const s of t)if(s)for(const l of n)s[e](l,o,{capture:!1,...i})},z=nt("addEventListener"),j=nt("removeEventListener"),he=e=>{const{clientX:t,clientY:n,target:o}=e.touches?.[0]??e;return{x:t,y:n,target:o}},Z=(e,t=document)=>Le(e).map(n=>typeof n=="string"?Array.from(t.querySelectorAll(n)):n instanceof Element?n:null).flat().filter(Boolean),nn=(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:q,max:ot,min:it,ceil:st}=Math,rt=(e=[])=>({stored:e,selected:[],touched:[],changed:{added:[],removed:[]}});class on extends Zt{static version="mind-elixir-fork";_options;_selection=rt();_area;_clippingElement;_targetElement;_targetBoundary;_targetBoundaryScrolled=!0;_targetRect;_selectables=[];_latestElement;_areaLocation={y1:0,x2:0,y2:0,x1:0};_areaRect=et();_singleClick=!0;_frame;_scrollAvailable=!0;_scrollingActive=!1;_scrollSpeed={x:0,y:0};_scrollDelta={x:0,y:0};_lastMousePosition={x:0,y:0};constructor(t){super(),this._options={selectionAreaClass:"selection-area",selectionContainerClass:void 0,selectables:[],document:window.document,startAreas:["html"],boundaries:["html"],container:"body",mindElixirInstance:void 0,...t,behaviour:{overlap:"invert",intersect:"touch",triggers:[0],...t.behaviour,startThreshold:t.behaviour?.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,...t.behaviour?.scrolling,startScrollMargins:{x:0,y:0,...t.behaviour?.scrolling?.startScrollMargins}}},features:{range:!0,touch:!0,deselectOnBlur:!1,...t.features,singleTap:{allow:!0,intersect:"native",...t.features?.singleTap}}};for(const s of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))typeof this[s]=="function"&&(this[s]=this[s].bind(this));const{document:n,selectionAreaClass:o,selectionContainerClass:i}=this._options;this._area=n.createElement("div"),this._clippingElement=n.createElement("div"),this._clippingElement.appendChild(this._area),this._area.classList.add(o),i&&this._clippingElement.classList.add(i),Y(this._area,{willChange:"top, left, bottom, right, width, height",top:0,left:0,position:"fixed"}),Y(this._clippingElement,{overflow:"hidden",position:"fixed",transform:"translate3d(0, 0, 0)",pointerEvents:"none",zIndex:"1"}),this._frame=Qt(s=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",s),this._redrawSelectionArea()}),this.enable()}_toggleStartEvents(t=!0){const{document:n,features:o}=this._options,i=t?z:j;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}=he(t),{document:l,startAreas:r,boundaries:c,features:a,behaviour:d}=this._options,h=s.getBoundingClientRect();if(t instanceof MouseEvent&&!nn(t,d.triggers))return;const f=Z(r,l),y=Z(c,l);this._targetElement=y.find(g=>tt(g.getBoundingClientRect(),h));const v=t.composedPath(),p=f.find(g=>v.includes(g));if(this._targetBoundary=y.find(g=>v.includes(g)),!this._targetElement||!p||!this._targetBoundary||!n&&this._emitEvent("beforestart",t)===!1)return;this._areaLocation={x1:o,y1:i,x2:0,y2:0};const m=l.scrollingElement??l.body;this._scrollDelta={x:m.scrollLeft,y:m.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),z(l,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),z(l,["mouseup","touchcancel","touchend"],this._onTapStop),z(l,"scroll",this._onScroll),a.deselectOnBlur&&(this._targetBoundaryScrolled=!1,z(this._targetBoundary,"scroll",this._onStartAreaScroll))}_onSingleTap(t){const{singleTap:{intersect:n},range:o}=this._options.features,i=he(t);let s;if(n==="native")s=i.target;else if(n==="touch"){this.resolveSelectables();const{x:r,y:c}=i;s=this._selectables.find(a=>{const{right:d,left:h,top:f,bottom:y}=a.getBoundingClientRect();return r<d&&r>h&&c<y&&c>f})}if(!s)return;for(this.resolveSelectables();!this._selectables.includes(s);)if(s.parentElement)s=s.parentElement;else{this._targetBoundaryScrolled||this.clearSelection();return}const{stored:l}=this._selection;if(this._emitEvent("start",t),t.shiftKey&&o&&this._latestElement){const r=this._latestElement,[c,a]=r.compareDocumentPosition(s)&4?[s,r]:[r,s],d=[...this._selectables.filter(h=>h.compareDocumentPosition(c)&4&&h.compareDocumentPosition(a)&2),c,a];this.select(d),this._latestElement=r}else l.includes(s)&&(l.length===1||t.ctrlKey||l.every(r=>this._selection.stored.includes(r)))?this.deselect(s):(this.select(s),this._latestElement=s)}_delayedTapMove(t){const{container:n,document:o,behaviour:{startThreshold:i}}=this._options,{x1:s,y1:l}=this._areaLocation,{x:r,y:c}=he(t);if(typeof i=="number"&&q(r+c-(s+l))>=i||typeof i=="object"&&q(r-s)>=i.x||q(c-l)>=i.y){if(j(o,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),this._emitEvent("beforedrag",t)===!1){j(o,["mouseup","touchcancel","touchend"],this._onTapStop);return}z(o,["mousemove","touchmove"],this._onTapMove,{passive:!1}),Y(this._area,"display","block"),Z(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&&(z(this._targetElement,"wheel",this._wheelScroll,{passive:!1}),z(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?(Y(t,{top:i.top,left:i.left,width:i.width,height:i.height}),Y(o,{marginTop:-i.top,marginLeft:-i.left})):(Y(t,{top:0,left:0,width:"100%",height:"100%"}),Y(o,{marginTop:0,marginLeft:0}))}_onTapMove(t){const{_scrollSpeed:n,_areaLocation:o,_options:i,_frame:s}=this,{speedDivider:l}=i.behaviour.scrolling;this._targetElement;const{x:r,y:c}=he(t);if(o.x2=r,o.y2=c,this._lastMousePosition.x=r,this._lastMousePosition.y=c,this._scrollAvailable&&!this._scrollingActive&&(n.y||n.x)){this._scrollingActive=!0;const a=()=>{if(!n.x&&!n.y){this._scrollingActive=!1;return}const d=this._options.mindElixirInstance;if(d&&d.move){const h=n.x?st(n.x/l):0,f=n.y?st(n.y/l):0;(h||f)&&(d.move(-h,-f),o.x1-=h,o.y1-=f)}s.next(t),requestAnimationFrame(a)};requestAnimationFrame(a)}else s.next(t);this._handleMoveEvent(t)}_handleMoveEvent(t){const{features:n}=this._options;(n.touch&&en()||this._scrollAvailable&&tn())&&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,j(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,s=this._targetRect,{x1:l,y1:r}=n;let{x2:c,y2:a}=n;const{behaviour:{scrolling:{startScrollMargins:d}}}=i;c<s.left+d.x?(t.x=-q(s.left-c+d.x),c=c<s.left?s.left:c):c>s.right-d.x?(t.x=q(s.left+s.width-c-d.x),c=c>s.right?s.right:c):t.x=0,a<s.top+d.y?(t.y=-q(s.top-a+d.y),a=a<s.top?s.top:a):a>s.bottom-d.y?(t.y=q(s.top+s.height-a-d.y),a=a>s.bottom?s.bottom:a):t.y=0;const h=it(l,c),f=it(r,a),y=ot(l,c),v=ot(r,a);this._areaRect=et(h,f,y-h,v-f)}_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){const{document:o,features:i}=this._options,{_singleClick:s}=this;j(this._targetElement,"scroll",this._onStartAreaScroll),j(o,["mousemove","touchmove"],this._delayedTapMove),j(o,["touchmove","mousemove"],this._onTapMove),j(o,["mouseup","touchcancel","touchend"],this._onTapStop),j(o,"scroll",this._onScroll),this._keepSelection(),t&&s&&i.singleTap.allow?this._onSingleTap(t):!s&&!n&&(this._updateElementSelection(),this._emitEvent("stop",t)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,j(this._targetElement,"wheel",this._wheelScroll,{passive:!0}),j(this._options.document,"keydown",this._keyboardScroll,{passive:!0}),this._clippingElement.remove(),this._frame?.cancel(),Y(this._area,"display","none")}_updateElementSelection(){const{_selectables:t,_options:n,_selection:o,_areaRect:i}=this,{stored:s,selected:l,touched:r}=o,{intersect:c,overlap:a}=n.behaviour,d=a==="invert",h=[],f=[],y=[];for(let p=0;p<t.length;p++){const m=t[p];if(tt(i,m.getBoundingClientRect(),c)){if(l.includes(m))s.includes(m)&&!r.includes(m)&&r.push(m);else if(d&&s.includes(m)){y.push(m);continue}else f.push(m);h.push(m)}}d&&f.push(...s.filter(p=>!l.includes(p)));const v=a==="keep";for(let p=0;p<l.length;p++){const m=l[p];!h.includes(m)&&!(v&&s.includes(m))&&y.push(m)}o.selected=h,o.changed={added:f,removed:y},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:l}=n,r=o.filter(c=>!l.includes(c));switch(t.behaviour.overlap){case"drop":{n.stored=[...r,...l.filter(c=>!s.includes(c))];break}case"invert":{n.stored=[...r,...l.filter(c=>!i.removed.includes(c))];break}case"keep":{n.stored=[...l,...o.filter(c=>!l.includes(c))];break}}}trigger(t,n=!0){this._onTapStart(t,n)}resolveSelectables(){this._selectables=Z(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=rt(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()}enable=this._toggleStartEvents;disable=this._toggleStartEvents.bind(this,!1);select(t,n=!1){const{changed:o,selected:i,stored:s}=this._selection,l=Z(t,this._options.document).filter(r=>!i.includes(r)&&!s.includes(r));return s.push(...l),i.push(...l),o.added.push(...l),o.removed=[],this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null)),l}deselect(t,n=!1){const{selected:o,stored:i,changed:s}=this._selection,l=Z(t,this._options.document).filter(r=>o.includes(r)||i.includes(r));this._selection.stored=i.filter(r=>!l.includes(r)),this._selection.selected=o.filter(r=>!l.includes(r)),this._selection.changed.added=[],this._selection.changed.removed.push(...l.filter(r=>!s.removed.includes(r))),this._latestElement=void 0,n||(this._emitEvent("move",null),this._emitEvent("stop",null))}}function sn(e){const t=e.mouseSelectionButton===2?[2]:[0],n=new on({selectables:[".map-container me-tpc"],boundaries:[e.container],container:e.selectionContainer,mindElixirInstance:e,features:{touch:!1},behaviour:{triggers:t,scrolling:{speedDivider:10,startScrollMargins:{x:50,y:50}}}}).on("beforestart",({event:o})=>{if(e.spacePressed)return!1;const i=o.target;if(i.id==="input-box"||i.className==="circle"||e.container.querySelector(".context-menu")?.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?.includes(s)),e.bus.fire("unselectNodes",i.map(s=>s.nodeObj))}});e.selection=n}const rn=function(e,t=!0){this.theme=e;const o={...(e.type==="dark"?be:ve).cssVar,...e.cssVar},i=Object.keys(o);for(let s=0;s<i.length;s++){const l=i[s];this.container.style.setProperty(l,o[l])}t&&this.refresh()},Q=e=>{const t=e.parent?.children,n=t?.indexOf(e)??0;return{siblings:t,index:n}};function ln(e){const{siblings:t,index:n}=Q(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 cn(e){const{siblings:t,index:n}=Q(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 lt(e){const{siblings:t,index:n}=Q(e);return t===void 0?0:(t.splice(n,1),t.length)}function an(e,t,n){const{siblings:o,index:i}=Q(n);o!==void 0&&(t==="before"?o.splice(i,0,e):o.splice(i+1,0,e))}function dn(e,t){const{siblings:n,index:o}=Q(e);n!==void 0&&(n[o]=t,t.children=[e])}function hn(e,t,n){if(lt(t),n.parent?.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:o,index:i}=Q(n);if(o===void 0)return;e==="before"?o.splice(i,0,t):o.splice(i+1,0,t)}}const un=function({map:e,direction:t},n){if(t===0)return 0;if(t===1)return 1;if(t===2){const o=e.querySelector(".lhs")?.childElementCount||0,i=e.querySelector(".rhs")?.childElementCount||0;return o<=i?(n.direction=0,0):(n.direction=1,1)}},ct=function(e,t,n){const o=n.children[0].children[0],i=t.parentElement;if(i.tagName==="ME-PARENT"){if(oe(o),i.children[1])i.nextSibling.appendChild(n);else{const s=e.createChildren([n]);i.appendChild(Te(!0)),i.insertAdjacentElement("afterend",s)}e.linkDiv(n.offsetParent)}else i.tagName==="ME-ROOT"&&(un(e,o.nodeObj)===0?e.container.querySelector(".lhs")?.appendChild(n):e.container.querySelector(".rhs")?.appendChild(n),e.linkDiv())},fn=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()},at={before:"beforebegin",after:"afterend"},oe=function(e){const n=e.parentElement.parentElement.lastElementChild;n?.tagName==="svg"&&n?.remove()},pn=function(e,t){const n=e.nodeObj,o=Ee(n);o.style&&t.style&&(t.style=Object.assign(o.style,t.style));const i=Object.assign(n,t);ke.call(this,e,i),this.linkDiv(),this.bus.fire("operation",{name:"reshapeNode",obj:i,origin:o})},Ae=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],G(e.nodeData);const{grp:s,top:l}=e.createWrapper(i);return ct(e,t,s),{newTop:l,newNodeObj:i}},gn=function(e,t,n){const o=t||this.currentNode;if(!o)return;const i=o.nodeObj;if(i.parent){if(!i.parent?.parent&&this.direction===2){const a=this.map.querySelector(".lhs")?.childElementCount||0,d=this.map.querySelector(".rhs")?.childElementCount||0;if(!a||!d){this.addChild(this.findEle(i.parent.id),n);return}}}else{this.addChild();return}const s=n||this.generateNewObj();if(!i.parent?.parent){const a=o.closest("me-main").className===I.LHS?0:1;s.direction=a}an(s,e,i),G(this.nodeData);const l=o.parentElement,{grp:r,top:c}=this.createWrapper(s);l.parentElement.insertAdjacentElement(at[e],r),this.linkDiv(r.offsetParent),n||this.editTopic(c.firstChild),this.bus.fire("operation",{name:"insertSibling",type:e,obj:s}),this.selectNode(c.firstChild,!0)},mn=function(e,t){const n=e||this.currentNode;if(!n)return;oe(n);const o=n.nodeObj;if(!o.parent)return;const i=t||this.generateNewObj();dn(o,i),G(this.nodeData);const s=n.parentElement.parentElement,{grp:l,top:r}=this.createWrapper(i,!0);r.appendChild(Te(!0)),s.insertAdjacentElement("afterend",l);const c=this.createChildren([s]);r.insertAdjacentElement("afterend",c),this.linkDiv(),t||this.editTopic(r.firstChild),this.selectNode(r.firstChild,!0),this.bus.fire("operation",{name:"insertParent",obj:i})},yn=function(e,t){const n=e||this.currentNode;if(!n)return;const o=Ae(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)},vn=function(e,t){const n=Ee(e.nodeObj);xe(n);const o=Ae(this,t,n);if(!o)return;const{newNodeObj:i}=o;this.selectNode(this.findEle(i.id)),this.bus.fire("operation",{name:"copyNode",obj:i})},bn=function(e,t){e=Ce(e);const n=[];for(let o=0;o<e.length;o++){const i=e[o],s=Ee(i.nodeObj);xe(s);const l=Ae(this,t,s);if(!l)return;const{newNodeObj:r}=l;n.push(r)}this.unselectNodes(this.currentNodes),this.selectNodes(n.map(o=>this.findEle(o.id))),this.bus.fire("operation",{name:"copyNodes",objs:n})},wn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;ln(n);const o=t.parentNode.parentNode;o.parentNode.insertBefore(o,o.previousSibling),this.linkDiv(),this.bus.fire("operation",{name:"moveUpNode",obj:n})},xn=function(e){const t=e||this.currentNode;if(!t)return;const n=t.nodeObj;cn(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})},En=function(e){if(e.length===0)return;e=Ce(e);for(const n of e){const o=n.nodeObj,i=lt(o);fn(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)})},Me=(e,t,n,o)=>{e=Ce(e);let i=n.nodeObj;t==="in"&&i.expanded===!1&&(o.expandNode(n,!0),n=o.findEle(i.id),i=n.nodeObj),t==="after"&&(e=e.reverse());const s=[];for(const r of e){const c=r.nodeObj;if(hn(t,c,i),G(o.nodeData),t==="in"){const a=r.parentElement;ct(o,n,a.parentElement)}else{oe(r);const a=r.parentElement.parentNode;s.includes(a.parentElement)||s.push(a.parentElement),n.parentElement.parentNode.insertAdjacentElement(at[t],a)}}for(const r of s)r.childElementCount===0&&r.tagName!=="ME-MAIN"&&(r.previousSibling.children[1].remove(),r.remove());o.linkDiv(),o.scrollIntoView(e[e.length-1]);const l=t==="before"?"moveNodeBefore":t==="after"?"moveNodeAfter":"moveNodeIn";o.bus.fire("operation",{name:l,objs:e.map(r=>r.nodeObj),toObj:i})},dt=Object.freeze(Object.defineProperty({__proto__:null,addChild:yn,beginEdit:function(e){const t=e||this.currentNode;t&&(t.nodeObj.dangerouslySetInnerHTML||this.editTopic(t))},copyNode:vn,copyNodes:bn,insertParent:mn,insertSibling:gn,moveDownNode:xn,moveNodeAfter:function(e,t){Me(e,"after",t,this)},moveNodeBefore:function(e,t){Me(e,"before",t,this)},moveNodeIn:function(e,t){Me(e,"in",t,this)},moveUpNode:wn,removeNodes:En,reshapeNode:pn,rmSubline:oe,setNodeTopic:function(e,t){e.text.textContent=t,e.nodeObj.topic=t,this.linkDiv()}},Symbol.toStringTag,{value:"Module"}));function Cn(e){return{nodeData:e.isFocusMode?e.nodeDataBackup:e.nodeData,arrows:e.arrows,summaries:e.summaries,direction:e.direction,theme:e.theme}}const Sn=function(e){const t=this.container,n=e.getBoundingClientRect(),o=t.getBoundingClientRect();if(n.top>o.bottom-50||n.bottom<o.top+50||n.left>o.right-50||n.right<o.left+50){const s=n.left+n.width/2,l=n.top+n.height/2,r=o.left+o.width/2,c=o.top+o.height/2,a=s-r,d=l-c;this.move(-a,-d,!0)}},Nn=function(e,t,n){this.clearSelection(),this.scrollIntoView(e),this.selection.select(e),t&&this.bus.fire("selectNewNode",e.nodeObj)},kn=function(e){this.selection.select(e)},Tn=function(e){this.selection?.deselect(e)},_n=function(){this.unselectNodes(this.currentNodes),this.unselectSummary(),this.unselectArrow()},Ln=function(){const e=Cn(this);return JSON.stringify(e,(t,n)=>{if(!(t==="parent"&&typeof n!="string"))return n})},An=function(){return JSON.parse(this.getDataString())},Mn=function(){this.editable=!0},Dn=function(){this.editable=!1},Pn=function(e,t={x:0,y:0}){if(e<this.scaleMin||e>this.scaleMax)return;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:l}=De(this),r=this.map.style.transform,{x:c,y:a}=je(r),d=c-s,h=a-l,f=this.scaleVal,y=(-o+d)*(1-e/f),v=(-i+h)*(1-e/f);this.map.style.transform=`translate3d(${c-y}px, ${a-v}px, 0) scale(${e})`,this.scaleVal=e,this.bus.fire("scale",e)},$n=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;const{dx:o,dy:i}=De(this,!0);this.map.style.transform=`translate3d(${o}px, ${i}px, 0) scale(${n})`,this.bus.fire("scale",n)},On=function(e,t,n=!1){const{map:o,scaleVal:i,bus:s,container:l,nodes:r}=this;if(n&&o.style.transition==="transform 0.3s")return;const c=o.style.transform;let{x:a,y:d}=je(c);const h=l.getBoundingClientRect(),f=r.getBoundingClientRect(),y=f.left<h.right&&f.right>h.left,v=f.top<h.bottom&&f.bottom>h.top;if(y){const p=f.left+e,m=f.right+e;(p>=h.right||m<=h.left)&&(e=0)}if(v){const p=f.top+t,m=f.bottom+t;(p>=h.bottom||m<=h.top)&&(t=0)}a+=e,d+=t,n&&(o.style.transition="transform 0.3s",setTimeout(()=>{o.style.transition="none"},300)),o.style.transform=`translate3d(${a}px, ${d}px, 0) scale(${i})`,s.fire("move",{dx:e,dy:t})},De=(e,t=!1)=>{const{container:n,map:o,nodes:i}=e;let s,l;if(e.alignment==="nodes"||t)s=(n.offsetWidth-i.offsetWidth)/2,l=(n.offsetHeight-i.offsetHeight)/2,o.style.transformOrigin="50% 50%";else{const r=o.querySelector("me-root"),c=r.offsetTop,a=r.offsetLeft,d=r.offsetWidth,h=r.offsetHeight;s=n.offsetWidth/2-a-d/2,l=n.offsetHeight/2-c-h/2,o.style.transformOrigin=`${a+d/2}px 50%`}return{dx:s,dy:l}},jn=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:_n,disableEdit:Dn,enableEdit:Mn,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.getBoundingClientRect(),i={x:o.left,y:o.top},s=e.parentNode,l=s.children[1];if(l.expanded=n.expanded,l.className=n.expanded?"minus":"",oe(e),n.expanded){const h=this.createChildren(n.children.map(f=>this.createWrapper(f).grp));s.parentNode.appendChild(h)}else s.parentNode.children[1].remove();this.linkDiv(e.closest("me-main > me-wrapper"));const r=e.getBoundingClientRect(),c={x:r.left,y:r.top},a=i.x-c.x,d=i.y-c.y;this.move(a,d),this.bus.fire("expandNode",n)},expandNodeAll:function(e,t){const n=e.nodeObj,o=e.getBoundingClientRect(),i={x:o.left,y:o.top};V(n,t??!n.expanded),this.refresh();const s=this.findEle(n.id).getBoundingClientRect(),l={x:s.left,y:s.top},r=i.x-l.x,c=i.y-l.y;this.move(r,c)},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:An,getDataString:Ln,initLeft:function(){this.direction=0,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initRight:function(){this.direction=1,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},initSide:function(){this.direction=2,this.refresh(),this.toCenter(),this.bus.fire("changeDirection",this.direction)},install:function(e){e(this)},move:On,refresh:function(e){this.clearSelection(),e&&(e=JSON.parse(JSON.stringify(e)),this.nodeData=e.nodeData,this.arrows=e.arrows||[],this.summaries=e.summaries||[],e.theme&&this.changeTheme(e.theme)),G(this.nodeData),this.layout(),this.linkDiv()},scale:Pn,scaleFit:$n,scrollIntoView:Sn,selectNode:Nn,selectNodes:kn,setLocale:function(e){this.locale=e,this.refresh()},toCenter:function(){const{map:e,container:t}=this,{dx:n,dy:o}=De(this);t.scrollTop=0,t.scrollLeft=0,e.style.transform=`translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`},unselectNodes:Tn},Symbol.toStringTag,{value:"Module"})),ht={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=He([{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}}}},Hn="#4dc4ff";function ut(e,t,n,o,i,s,l,r){return{x:e/8+n*3/8+i*3/8+l/8,y:t/8+o*3/8+s*3/8+r/8}}function In(e,t,n){e&&(e.dataset.x=t.toString(),e.dataset.y=n.toString(),de(e))}function ue(e,t,n,o,i){A(e,{x1:t+"",y1:n+"",x2:o+"",y2:i+""})}function ft(e,t,n,o,i,s,l,r,c,a){const d=`M ${t} ${n} C ${o} ${i} ${s} ${l} ${r} ${c}`;if(e.line.setAttribute("d",d),a.style){const p=a.style;p.stroke&&e.line.setAttribute("stroke",p.stroke),p.strokeWidth&&e.line.setAttribute("stroke-width",String(p.strokeWidth)),p.strokeDasharray&&e.line.setAttribute("stroke-dasharray",p.strokeDasharray),p.strokeLinecap&&e.line.setAttribute("stroke-linecap",p.strokeLinecap),p.opacity!==void 0&&e.line.setAttribute("opacity",String(p.opacity))}const h=e.querySelectorAll('path[stroke="transparent"]');h.length>0&&h[0].setAttribute("d",d);const f=re(s,l,r,c);if(f){const p=`M ${f.x1} ${f.y1} L ${r} ${c} L ${f.x2} ${f.y2}`;if(e.arrow1.setAttribute("d",p),h.length>1&&h[1].setAttribute("d",p),a.style){const m=a.style;m.stroke&&e.arrow1.setAttribute("stroke",m.stroke),m.strokeWidth&&e.arrow1.setAttribute("stroke-width",String(m.strokeWidth)),m.strokeLinecap&&e.arrow1.setAttribute("stroke-linecap",m.strokeLinecap),m.opacity!==void 0&&e.arrow1.setAttribute("opacity",String(m.opacity))}}if(a.bidirectional){const p=re(o,i,t,n);if(p){const m=`M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;if(e.arrow2.setAttribute("d",m),h.length>2&&h[2].setAttribute("d",m),a.style){const g=a.style;g.stroke&&e.arrow2.setAttribute("stroke",g.stroke),g.strokeWidth&&e.arrow2.setAttribute("stroke-width",String(g.strokeWidth)),g.strokeLinecap&&e.arrow2.setAttribute("stroke-linecap",g.strokeLinecap),g.opacity!==void 0&&e.arrow2.setAttribute("opacity",String(g.opacity))}}}const{x:y,y:v}=ut(t,n,o,i,s,l,r,c);if(e.labelEl&&In(e.labelEl,y,v),a.style?.labelColor){const p=e.labelEl;p&&(p.style.color=a.style.labelColor)}Kn(e)}function fe(e,t,n){const{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=t.offsetWidth,l=t.offsetHeight,r=o+s/2,c=i+l/2,a=r+n.x,d=c+n.y;return{w:s,h:l,cx:r,cy:c,ctrlX:a,ctrlY:d}}function ee(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 Pe=function(e,t,n,o,i){if(!t||!n)return;const s=fe(e,t,o.delta1),l=fe(e,n,o.delta2),{x:r,y:c}=ee(s),{ctrlX:a,ctrlY:d}=s,{ctrlX:h,ctrlY:f}=l,{x:y,y:v}=ee(l),p=re(h,f,y,v);if(!p)return;const m=`M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;let g="";if(o.bidirectional){const N=re(a,d,r,c);if(!N)return;g=`M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`}const b=zt(`M ${r} ${c} C ${a} ${d} ${h} ${f} ${y} ${v}`,m,g,o.style),{x,y:L}=ut(r,c,a,d,h,f,y,v),_=o.style?.labelColor||"rgb(235, 95, 82)",C="arrow-"+o.id;b.id=C;const E=e.markdown?e.markdown(o.label,o):o.label,S=_e(E,x,L,{anchor:"middle",color:_,dataType:"arrow",svgId:C});b.labelEl=S,b.arrowObj=o,b.dataset.linkid=o.id,e.labelContainer.appendChild(S),e.linkSvgGroup.appendChild(b),de(S),i||(e.arrows.push(o),e.currentArrow=b,pt(e,o,s,l))},Bn=function(e,t,n={}){const o={id:K(),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};Pe(this,e,t,o),this.bus.fire("operation",{name:"createArrow",obj:o})},Rn=function(e){pe(this);const t={...e,id:K()};Pe(this,this.findEle(t.from),this.findEle(t.to),t),this.bus.fire("operation",{name:"createArrow",obj:t})},Fn=function(e){let t;if(e?t=e:t=this.currentArrow,!t)return;pe(this);const n=t.arrowObj.id;this.arrows=this.arrows.filter(o=>o.id!==n),t.labelEl?.remove(),t.remove(),this.bus.fire("operation",{name:"removeArrow",obj:{id:n}})},Yn=function(e){this.currentArrow=e;const t=e.arrowObj,n=this.findEle(t.from),o=this.findEle(t.to),i=fe(this,n,t.delta1),s=fe(this,o,t.delta2);pt(this,t,i,s)},zn=function(){pe(this),this.currentArrow=null},$e=function(e,t){const n=document.createElementNS(B,"path");return A(n,{d:e,stroke:t,fill:"none","stroke-width":"6","stroke-linecap":"round","stroke-linejoin":"round"}),n},Wn=function(e,t){const n=document.createElementNS(B,"g");n.setAttribute("class","arrow-highlight"),n.setAttribute("opacity","0.45");const o=$e(e.line.getAttribute("d"),t);n.appendChild(o);const i=$e(e.arrow1.getAttribute("d"),t);if(n.appendChild(i),e.arrow2.getAttribute("d")){const s=$e(e.arrow2.getAttribute("d"),t);n.appendChild(s)}e.insertBefore(n,e.firstChild)},Gn=function(e){const t=e.querySelector(".arrow-highlight");t&&t.remove()},Kn=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"))},pe=function(e){e.helper1?.destroy(),e.helper2?.destroy(),e.linkController.style.display="none",e.P2.style.display="none",e.P3.style.display="none",e.currentArrow&&Gn(e.currentArrow)},pt=function(e,t,n,o){const{linkController:i,P2:s,P3:l,line1:r,line2:c,nodes:a,map:d,currentArrow:h,bus:f}=e;if(!h)return;i.style.display="initial",s.style.display="initial",l.style.display="initial",a.appendChild(i),a.appendChild(s),a.appendChild(l),Wn(h,Hn);let{x:y,y:v}=ee(n),{ctrlX:p,ctrlY:m}=n,{ctrlX:g,ctrlY:b}=o,{x,y:L}=ee(o);s.style.cssText=`top:${m}px;left:${p}px;`,l.style.cssText=`top:${b}px;left:${g}px;`,ue(r,y,v,p,m),ue(c,g,b,x,L),e.helper1=ht.create(s),e.helper2=ht.create(l),e.helper1.init(d,(_,C)=>{p=p+_/e.scaleVal,m=m+C/e.scaleVal;const E=ee({...n,ctrlX:p,ctrlY:m});y=E.x,v=E.y,s.style.top=m+"px",s.style.left=p+"px",ft(h,y,v,p,m,g,b,x,L,t),ue(r,y,v,p,m),t.delta1.x=p-n.cx,t.delta1.y=m-n.cy,f.fire("updateArrowDelta",t)}),e.helper2.init(d,(_,C)=>{g=g+_/e.scaleVal,b=b+C/e.scaleVal;const E=ee({...o,ctrlX:g,ctrlY:b});x=E.x,L=E.y,l.style.top=b+"px",l.style.left=g+"px",ft(h,y,v,p,m,g,b,x,L,t),ue(c,g,b,x,L),t.delta2.x=g-o.cx,t.delta2.y=b-o.cy,f.fire("updateArrowDelta",t)})};function Xn(){this.linkSvgGroup.innerHTML="",this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach(t=>t.remove());for(let t=0;t<this.arrows.length;t++){const n=this.arrows[t];try{Pe(this,this.findEle(n.from),this.findEle(n.to),n,!0)}catch{}}this.nodes.appendChild(this.linkSvgGroup)}function qn(e){pe(this),e&&e.labelEl&&Ve(this,e.labelEl,e.arrowObj)}function Vn(){this.arrows=this.arrows.filter(e=>se(e.from,this.nodeData)&&se(e.to,this.nodeData))}const Un=Object.freeze(Object.defineProperty({__proto__:null,createArrow:Bn,createArrowFrom:Rn,editArrowLabel:qn,removeArrow:Fn,renderArrow:Xn,selectArrow:Yn,tidyArrow:Vn,unselectArrow:zn},Symbol.toStringTag,{value:"Module"})),Jn=function(e){if(e.length===0)throw new Error("No selected node.");if(e.length===1){const c=e[0].nodeObj,a=e[0].nodeObj.parent;if(!a)throw new Error("Can not select root node.");const d=a.children.findIndex(h=>c===h);return{parent:a.id,start:d,end:d}}let t=0;const n=e.map(c=>{let a=c.nodeObj;const d=[];for(;a.parent;){const h=a.parent,y=h.children?.indexOf(a);a=h,d.unshift({node:a,index:y})}return d.length>t&&(t=d.length),d});let o=0;e:for(;o<t;o++){const c=n[0][o]?.node;for(let a=1;a<n.length;a++)if(n[a][o]?.node!==c)break e}if(!o)throw new Error("Can not select root node.");const i=n.map(c=>c[o-1].index).sort(),s=i[0]||0,l=i[i.length-1]||0,r=n[0][o-1].node;if(!r.parent)throw new Error("Please select nodes in the same main topic.");return{parent:r.id,start:s,end:l}},Zn=function(e){const t=document.createElementNS(B,"g");return t.setAttribute("id",e),t},gt=function(e,t){const n=document.createElementNS(B,"path");return A(n,{d:e,stroke:t||"#666",fill:"none","stroke-linecap":"round","stroke-width":"2"}),n},Qn=e=>e.parentElement.parentElement,eo=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},Oe=function(e,t){const{id:n,label:o,parent:i,start:s,end:l,style:r}=t,{nodes:c,theme:a,summarySvg:d}=e,f=e.findEle(i).nodeObj,y=eo(e,t);let v=1/0,p=0,m=0,g=0;for(let u=s;u<=l;u++){const w=f.children?.[u];if(!w)return e.removeSummary(n),null;const k=Qn(e.findEle(w.id)),{offsetLeft:O,offsetTop:W}=R(c,k),M=s===l?10:20;u===s&&(m=W+M),u===l&&(g=W+k.offsetHeight-M),O<v&&(v=O),k.offsetWidth+O>p&&(p=k.offsetWidth+O)}let b,x;const L=f.parent?10:0,_=m+L,C=g+L,E=(_+C)/2,S=r?.stroke||a.cssVar["--color"],N=r?.labelColor||a.cssVar["--color"],$="s-"+n,T=e.markdown?e.markdown(o,t):o;y===I.LHS?(b=gt(`M ${v+10} ${_} c -5 0 -10 5 -10 10 L ${v} ${C-10} c 0 5 5 10 10 10 M ${v} ${E} h -10`,S),x=_e(T,v-20,E,{anchor:"end",color:N,dataType:"summary",svgId:$})):(b=gt(`M ${p-10} ${_} c 5 0 10 5 10 10 L ${p} ${C-10} c 0 5 -5 10 -10 10 M ${p} ${E} h 10`,S),x=_e(T,p+20,E,{anchor:"start",color:N,dataType:"summary",svgId:$}));const F=Zn($);return F.appendChild(b),e.labelContainer.appendChild(x),de(x),F.summaryObj=t,F.labelEl=x,d.appendChild(F),F},to=Object.freeze(Object.defineProperty({__proto__:null,createSummary:function(e={}){if(!this.currentNodes)return;const{currentNodes:t,summaries:n,bus:o}=this,{parent:i,start:s,end:l}=Jn(t),r={id:K(),parent:i,start:s,end:l,label:"summary",style:e.style},c=Oe(this,r);n.push(r),this.editSummary(c),o.fire("operation",{name:"createSummary",obj:r})},createSummaryFrom:function(e){const t=K(),n={...e,id:t};Oe(this,n),this.summaries.push(n),this.bus.fire("operation",{name:"createSummary",obj:n})},editSummary:function(e){e&&e.labelEl&&Ve(this,e.labelEl,e.summaryObj)},removeSummary:function(e){const t=this.summaries.findIndex(n=>n.id===e);t>-1&&(this.summaries.splice(t,1),this.nodes.querySelector("#s-"+e)?.remove(),this.nodes.querySelector("#label-s-"+e)?.remove()),this.bus.fire("operation",{name:"removeSummary",obj:{id:e}})},renderSummary:function(){this.summarySvg.innerHTML="",this.summaries.forEach(e=>{try{Oe(this,e)}catch{}}),this.nodes.insertAdjacentElement("beforeend",this.summarySvg)},selectSummary:function(e){const t=e.labelEl;t&&t.classList.add("selected"),this.currentSummary=e},unselectSummary:function(){this.currentSummary?.labelEl?.classList.remove("selected"),this.currentSummary=null}},Symbol.toStringTag,{value:"Module"})),P="http://www.w3.org/2000/svg";function no(e,t){const n=document.createElementNS(P,"svg");return A(n,{version:"1.1",xmlns:P,height:e,width:t}),n}function oo(e,t){return(parseInt(e)-parseInt(t))/2}function io(e,t,n,o){const i=document.createElementNS(P,"g");let s="";return e.text?s=e.text.textContent:s=e.childNodes[0].textContent,s.split(`
|
|
16
|
+
`).forEach((r,c)=>{const a=document.createElementNS(P,"text");A(a,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+oo(t.lineHeight,t.fontSize)*(c+1)+parseFloat(t.fontSize)*(c+1)+"","text-anchor":"start","font-family":t.fontFamily,"font-size":`${t.fontSize}`,"font-weight":`${t.fontWeight}`,fill:`${t.color}`}),a.innerHTML=r,i.appendChild(a)}),i}function so(e,t,n,o){let i="";e.nodeObj?.dangerouslySetInnerHTML?i=e.nodeObj.dangerouslySetInnerHTML:e.text?i=e.text.textContent:i=e.childNodes[0].textContent;const s=document.createElementNS(P,"foreignObject");A(s,{x:n+parseInt(t.paddingLeft)+"",y:o+parseInt(t.paddingTop)+"",width:t.width,height:t.height});const l=document.createElement("div");return A(l,{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;`}),l.innerHTML=i,s.appendChild(l),s}function ro(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=document.createElementNS(P,"rect");return A(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 ge(e,t,n=!1){const o=getComputedStyle(t),{offsetLeft:i,offsetTop:s}=R(e.nodes,t),l=document.createElementNS(P,"rect");A(l,{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 r=document.createElementNS(P,"g");r.appendChild(l);let c;return n?c=so(t,o,i,s):c=io(t,o,i,s),r.appendChild(c),r}function lo(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=document.createElementNS(P,"a"),l=document.createElementNS(P,"text");return A(l,{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}`}),l.innerHTML=t.textContent,s.appendChild(l),s.setAttribute("href",t.href),s}function co(e,t){const n=getComputedStyle(t),{offsetLeft:o,offsetTop:i}=R(e.nodes,t),s=document.createElementNS(P,"image");return A(s,{x:o+"",y:i+"",width:n.width+"",height:n.height+"",href:t.src}),s}const me=100,ao='<?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">',ho=(e,t=!1)=>{const n=e.nodes,o=n.offsetHeight+me*2,i=n.offsetWidth+me*2,s=no(o+"px",i+"px"),l=document.createElementNS(P,"svg"),r=document.createElementNS(P,"rect");A(r,{x:"0",y:"0",width:`${i}`,height:`${o}`,fill:e.theme.cssVar["--bgcolor"]}),s.appendChild(r),n.querySelectorAll(".subLines").forEach(h=>{const f=h.cloneNode(!0),{offsetLeft:y,offsetTop:v}=R(n,h.parentElement);f.setAttribute("x",`${y}`),f.setAttribute("y",`${v}`),l.appendChild(f)});const c=n.querySelector(".lines")?.cloneNode(!0);c&&l.appendChild(c);const a=n.querySelector(".topiclinks")?.cloneNode(!0);a&&l.appendChild(a);const d=n.querySelector(".summary")?.cloneNode(!0);return d&&l.appendChild(d),n.querySelectorAll("me-tpc").forEach(h=>{h.nodeObj.dangerouslySetInnerHTML?l.appendChild(ge(e,h,!t)):(l.appendChild(ro(e,h)),l.appendChild(ge(e,h.text,!t)))}),n.querySelectorAll(".tags > span").forEach(h=>{l.appendChild(ge(e,h))}),n.querySelectorAll(".icons > span").forEach(h=>{l.appendChild(ge(e,h))}),n.querySelectorAll(".hyper-link").forEach(h=>{l.appendChild(lo(e,h))}),n.querySelectorAll("img").forEach(h=>{l.appendChild(co(e,h))}),A(l,{x:me+"",y:me+"",overflow:"visible"}),s.appendChild(l),s},uo=(e,t)=>(t&&e.insertAdjacentHTML("afterbegin","<style>"+t+"</style>"),ao+e.outerHTML);function fo(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 po=Object.freeze(Object.defineProperty({__proto__:null,exportPng:async function(e=!1,t){const n=this.exportSvg(e,t),o=await fo(n);return new Promise((i,s)=>{const l=new Image;l.setAttribute("crossOrigin","anonymous"),l.onload=()=>{const r=document.createElement("canvas");r.width=l.width,r.height=l.height,r.getContext("2d").drawImage(l,0,0),r.toBlob(i,"image/png",1)},l.src=o,l.onerror=s})},exportSvg:function(e=!1,t){const n=ho(this,e),o=uo(n,t);return new Blob([o],{type:"image/svg+xml"})}},Symbol.toStringTag,{value:"Module"}));function go(e,t){return async function(...n){const o=this.before[t];o&&!await o.apply(this,n)||e.apply(this,n)}}const mt=Object.keys(dt),yt={};for(let e=0;e<mt.length;e++){const t=mt[e];yt[t]=go(dt[t],t)}const mo={getObjById:se,generateNewObj:vt,layout:Ot,linkDiv:Wt,editTopic:Yt,createWrapper:It,createParent:Bt,createChildren:Rt,createTopic:Ft,findEle:Ge,changeTheme:rn,...jn,...yt,...Un,...to,...po,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,G(this.nodeData),this.arrows=e.arrows||[],this.summaries=e.summaries||[],this.tidyArrow(),this.toolBar&&Jt(this),this.keypress&&St(this,this.keypress),this.editable&&sn(this),this.contextMenu&&this.disposable.push(Gt(this,this.contextMenu)),this.draggable&&this.disposable.push(Dt()),this.allowUndo&&this.disposable.push(Xt(this)),this.layout(),this.linkDiv(),this.toCenter()},destroy(){this.disposable.forEach(e=>e()),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,this.selection?.destroy(),this.selection=void 0}};function yo({pT:e,pL:t,pW:n,pH:o,cT:i,cL:s,cW:l,cH:r,direction:c,containerHeight:a}){let d=t+n/2;const h=e+o/2;let f;c===I.LHS?f=s+l:f=s;const y=i+r/2,p=(1-Math.abs(y-h)/a)*.25*(n/2);return c===I.LHS?d=d-n/10-p:d=d+n/10+p,`M ${d} ${h} Q ${d} ${y} ${f} ${y}`}function vo({pT:e,pL:t,pW:n,pH:o,cT:i,cL:s,cW:l,cH:r,direction:c,isFirst:a}){const d=parseInt(this.container.style.getPropertyValue("--node-gap-x"));let h=0,f=0;a?h=e+o/2:h=e+o;const y=i+r;let v=0,p=0,m=0;const g=Math.abs(h-y)/300*d;return c===I.LHS?(m=t,v=m+d,p=m-d,f=s+d,`M ${v} ${h} C ${m} ${h} ${m+g} ${y} ${p} ${y} H ${f}`):(m=t+n,v=m-d,p=m+d,f=s+l-d,`M ${v} ${h} C ${m} ${h} ${m-g} ${y} ${p} ${y} H ${f}`)}const bo="5.5.0";function wo(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}}}const te=document;function H({el:e,direction:t,locale:n,draggable:o,editable:i,contextMenu:s,toolBar:l,keypress:r,mouseSelectionButton:c,selectionContainer:a,before:d,newTopicName:h,allowUndo:f,generateMainBranch:y,generateSubBranch:v,overflowHidden:p,theme:m,alignment:g,scaleSensitivity:b,scaleMax:x,scaleMin:L,handleWheel:_,markdown:C,imageProxy:E}){let S=null;const N=Object.prototype.toString.call(e);if(N==="[object HTMLDivElement]"?S=e:N==="[object String]"&&(S=document.querySelector(e)),!S)throw new Error("MindElixir: el is not a valid element");S.style.position="relative",S.innerHTML="",this.el=S,this.disposable=[],this.before=d||{},this.locale=n||"en",this.newTopicName=h||"New Node",this.contextMenu=s??!0,this.toolBar=l??!0,this.keypress=r??!0,this.mouseSelectionButton=c??0,this.direction=t??1,this.draggable=o??!0,this.editable=i??!0,this.allowUndo=f??!0,this.scaleSensitivity=b??.1,this.scaleMax=x??1.4,this.scaleMin=L??.2,this.generateMainBranch=y||yo,this.generateSubBranch=v||vo,this.overflowHidden=p??!1,this.alignment=g??"root",this.handleWheel=_??!0,this.markdown=C||void 0,this.imageProxy=E||void 0,this.currentNodes=[],this.currentArrow=null,this.scaleVal=1,this.tempDirection=null,this.dragMoveHelper=wo(this),this.bus=$t(),this.container=te.createElement("div"),this.selectionContainer=a||this.container,this.container.className="map-container";const $=window.matchMedia("(prefers-color-scheme: dark)");this.theme=m||($.matches?be:ve);const T=te.createElement("div");T.className="map-canvas",this.map=T,this.container.setAttribute("tabindex","0"),this.container.appendChild(this.map),this.el.appendChild(this.container),this.nodes=te.createElement("me-nodes"),this.lines=ne("lines"),this.summarySvg=ne("summary"),this.linkController=ne("linkcontroller"),this.P2=te.createElement("div"),this.P3=te.createElement("div"),this.P2.className=this.P3.className="circle",this.P2.style.display=this.P3.style.display="none",this.line1=qe(),this.line2=qe(),this.linkController.appendChild(this.line1),this.linkController.appendChild(this.line2),this.linkSvgGroup=ne("topiclinks"),this.labelContainer=te.createElement("div"),this.labelContainer.className="label-container",this.map.appendChild(this.nodes),this.overflowHidden?this.container.style.overflow="hidden":this.disposable.push(Pt(this))}return H.prototype=mo,Object.defineProperty(H.prototype,"currentNode",{get(){return this.currentNodes[this.currentNodes.length-1]},enumerable:!0}),H.LEFT=0,H.RIGHT=1,H.SIDE=2,H.THEME=ve,H.DARK_THEME=be,H.version=bo,H.E=Ge,H.new=e=>({nodeData:{id:K(),topic:e||"new topic",children:[]}}),H})();
|