mind-elixir 4.0.4 → 4.1.1

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.
@@ -29,7 +29,7 @@
29
29
  s.readyState == "complete" && (s.onreadystatechange = null, h());
30
30
  });
31
31
  })(window);
32
- const T = 0, z = 1, ie = 2, D = 30, De = {
32
+ const k = 0, z = 1, re = 2, D = 30, De = {
33
33
  name: "Latte",
34
34
  palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
35
35
  cssVar: {
@@ -54,15 +54,15 @@ const T = 0, z = 1, ie = 2, D = 30, De = {
54
54
  "--panel-border-color": "#696969"
55
55
  }
56
56
  };
57
- function te(e) {
57
+ function ne(e) {
58
58
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
59
59
  }
60
- const et = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), ne = function(e, t) {
60
+ const et = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), oe = function(e, t) {
61
61
  if (t.id === e)
62
62
  return t;
63
63
  if (t.children && t.children.length) {
64
64
  for (let n = 0; n < t.children.length; n++) {
65
- const o = ne(e, t.children[n]);
65
+ const o = oe(e, t.children[n]);
66
66
  if (o)
67
67
  return o;
68
68
  }
@@ -120,10 +120,10 @@ const O = (e, t) => {
120
120
  for (; t && t !== e; )
121
121
  n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
122
122
  return { offsetLeft: n, offsetTop: o };
123
- }, C = (e, t) => {
123
+ }, N = (e, t) => {
124
124
  for (const n in t)
125
125
  e.setAttribute(n, t[n]);
126
- }, le = (e) => e ? e.tagName === "ME-TPC" : !1, re = (e) => e.filter((t) => {
126
+ }, le = (e) => e ? e.tagName === "ME-TPC" : !1, ce = (e) => e.filter((t) => {
127
127
  for (let n = 0; n < e.length; n++) {
128
128
  if (t === e[n])
129
129
  continue;
@@ -221,38 +221,38 @@ const st = {
221
221
  }
222
222
  };
223
223
  }
224
- }, oe = document, it = function() {
224
+ }, se = document, it = function() {
225
225
  this.nodes.innerHTML = "";
226
226
  const e = this.createTopic(this.nodeData);
227
227
  fe(e, this.nodeData), e.draggable = !1;
228
- const t = oe.createElement("me-root");
228
+ const t = se.createElement("me-root");
229
229
  t.appendChild(e);
230
230
  const n = this.nodeData.children || [];
231
- if (this.direction === ie) {
231
+ if (this.direction === re) {
232
232
  let o = 0, s = 0;
233
233
  n.map((i) => {
234
- i.direction === T ? o += 1 : i.direction === z ? s += 1 : o <= s ? (i.direction = T, o += 1) : (i.direction = z, s += 1);
234
+ i.direction === k ? o += 1 : i.direction === z ? s += 1 : o <= s ? (i.direction = k, o += 1) : (i.direction = z, s += 1);
235
235
  });
236
236
  }
237
237
  rt(this, n, t);
238
238
  }, rt = function(e, t, n) {
239
- const o = oe.createElement("me-main");
239
+ const o = se.createElement("me-main");
240
240
  o.className = "lhs";
241
- const s = oe.createElement("me-main");
241
+ const s = se.createElement("me-main");
242
242
  s.className = "rhs";
243
243
  for (let i = 0; i < t.length; i++) {
244
244
  const r = t[i], { grp: c } = e.createWrapper(r);
245
- e.direction === ie ? r.direction === T ? o.appendChild(c) : s.appendChild(c) : e.direction === T ? o.appendChild(c) : s.appendChild(c);
245
+ e.direction === re ? r.direction === k ? o.appendChild(c) : s.appendChild(c) : e.direction === k ? o.appendChild(c) : s.appendChild(c);
246
246
  }
247
247
  e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
248
248
  }, ct = function(e, t) {
249
- const n = oe.createElement("me-children");
249
+ const n = se.createElement("me-children");
250
250
  for (let o = 0; o < t.length; o++) {
251
251
  const s = t[o], { grp: i } = e.createWrapper(s);
252
252
  n.appendChild(i);
253
253
  }
254
254
  return n;
255
- }, S = document, N = (e, t) => {
255
+ }, S = document, C = (e, t) => {
256
256
  const o = (t ? t.mindElixirBox : S).querySelector(`[data-nodeid=me${e}]`);
257
257
  if (!o)
258
258
  throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
@@ -281,12 +281,12 @@ const st = {
281
281
  e.linkContainer && (e.linkContainer = void 0);
282
282
  if (t.icons && t.icons.length) {
283
283
  const n = S.createElement("span");
284
- n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
284
+ n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${ne(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
285
285
  } else
286
286
  e.icons && (e.icons = void 0);
287
287
  if (t.tags && t.tags.length) {
288
288
  const n = S.createElement("div");
289
- n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
289
+ n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${ne(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
290
290
  } else
291
291
  e.tags && (e.tags = void 0);
292
292
  }, lt = function(e, t) {
@@ -319,7 +319,7 @@ const ut = function(e) {
319
319
  if (!e)
320
320
  return;
321
321
  const t = S.createElement("div"), n = e.text.textContent;
322
- e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "true", t.spellcheck = !1, t.style.cssText = `min-width:${e.offsetWidth - 8}px;`, this.direction === T && (t.style.right = "0"), t.focus(), Pe(t), this.bus.fire("operation", {
322
+ e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "true", t.spellcheck = !1, t.style.cssText = `min-width:${e.offsetWidth - 8}px;`, this.direction === k && (t.style.right = "0"), t.focus(), Pe(t), this.bus.fire("operation", {
323
323
  name: "beginEdit",
324
324
  obj: e.nodeObj
325
325
  }), t.addEventListener("keydown", (o) => {
@@ -346,7 +346,7 @@ const ut = function(e) {
346
346
  return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
347
347
  }, K = document, V = "http://www.w3.org/2000/svg", He = function(e, t, n) {
348
348
  const o = K.createElementNS(V, "path");
349
- return C(o, {
349
+ return N(o, {
350
350
  d: e,
351
351
  stroke: t || "#666",
352
352
  fill: "none",
@@ -365,10 +365,10 @@ const ut = function(e) {
365
365
  "stroke-linecap": "cap",
366
366
  "stroke-width": "2"
367
367
  }, o = K.createElementNS(V, "g"), s = K.createElementNS(V, "path"), i = K.createElementNS(V, "path");
368
- return C(i, {
368
+ return N(i, {
369
369
  d: t,
370
370
  ...n
371
- }), C(s, {
371
+ }), N(s, {
372
372
  d: e,
373
373
  ...n,
374
374
  "stroke-dasharray": "8,2"
@@ -395,22 +395,25 @@ const ut = function(e) {
395
395
  o && n(o);
396
396
  });
397
397
  }, pt = function(e) {
398
- this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.nodes.style.left = `${1e4 - this.nodes.offsetWidth / 2}px`;
399
- const t = this.map.querySelectorAll("me-main > me-wrapper");
398
+ const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight;
399
+ this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.nodes.style.left = `${1e4 - o - s / 2}px`;
400
+ const r = this.map.querySelectorAll("me-main > me-wrapper");
400
401
  this.lines.innerHTML = "";
401
- const n = this.map.querySelector("me-root"), o = n.offsetTop, s = n.offsetLeft, i = n.offsetWidth, r = n.offsetHeight;
402
- for (let c = 0; c < t.length; c++) {
403
- const l = t[c], h = l.querySelector("me-tpc"), { offsetLeft: a, offsetTop: u } = O(this.nodes, h), d = h.offsetWidth, m = h.offsetHeight, g = l.parentNode.className, p = this.generateMainBranch({ pT: o, pL: s, pW: i, pH: r, cT: u, cL: a, cW: d, cH: m, direction: g, containerHeight: this.nodes.offsetHeight }), f = this.theme.palette, v = h.nodeObj.branchColor || f[c % f.length];
402
+ for (let c = 0; c < r.length; c++) {
403
+ const l = r[c], h = l.querySelector("me-tpc"), { offsetLeft: a, offsetTop: u } = O(this.nodes, h), d = h.offsetWidth, m = h.offsetHeight, g = l.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: u, cL: a, cW: d, cH: m, direction: g, containerHeight: this.nodes.offsetHeight }), f = this.theme.palette, v = h.nodeObj.branchColor || f[c % f.length];
404
404
  h.style.borderColor = v, this.lines.appendChild(He(p, v, "3"));
405
405
  const b = l.children[0].children[1];
406
- if (b && (b.style.top = (b.parentNode.offsetHeight - b.offsetHeight) / 2 + "px", g === "lhs" ? b.style.left = "-10px" : b.style.right = "-10px"), !(e && e !== l) && l.childElementCount) {
407
- const y = X("subLines"), x = l.lastChild;
408
- x.tagName === "svg" && x.remove(), l.appendChild(y), ze(this, y, v, l, g, !0);
409
- }
406
+ if (b && (b.style.top = (b.parentNode.offsetHeight - b.offsetHeight) / 2 + "px", g === "lhs" ? b.style.left = "-10px" : b.style.right = "-10px"), e && e !== l)
407
+ continue;
408
+ const y = X("subLines"), x = l.lastChild;
409
+ x.tagName === "svg" && x.remove(), l.appendChild(y), ze(this, y, v, l, g, !0);
410
410
  }
411
411
  this.renderArrow(), this.renderSummary();
412
412
  }, ze = function(e, t, n, o, s, i) {
413
- const r = o.firstChild, c = o.children[1].children, l = r.offsetTop, h = r.offsetLeft, a = r.offsetWidth, u = r.offsetHeight;
413
+ const r = o.firstChild, c = o.children[1].children;
414
+ if (c.length === 0)
415
+ return;
416
+ const l = r.offsetTop, h = r.offsetLeft, a = r.offsetWidth, u = r.offsetHeight;
414
417
  for (let d = 0; d < c.length; d++) {
415
418
  const m = c[d], g = m.firstChild, p = g.offsetTop, f = g.offsetLeft, v = g.offsetWidth, b = g.offsetHeight, y = g.firstChild.nodeObj.branchColor || n, x = e.generateSubBranch({ pT: l, pL: h, pW: a, pH: u, cT: p, cL: f, cW: v, cH: b, direction: s, isFirst: i });
416
419
  t.appendChild(He(x, y, "2"));
@@ -420,7 +423,7 @@ const ut = function(e) {
420
423
  continue;
421
424
  } else
422
425
  continue;
423
- m.children[1].children.length > 0 && ze(e, t, y, m, s);
426
+ ze(e, t, y, m, s);
424
427
  }
425
428
  }, ye = {
426
429
  addChild: "插入子节点",
@@ -535,8 +538,8 @@ function mt(e, t) {
535
538
  return x.innerText = y, x.className = "tips", x;
536
539
  }, o = (y, x, w) => {
537
540
  const _ = document.createElement("li");
538
- return _.id = y, _.innerHTML = `<span>${te(x)}</span><span>${te(w)}</span>`, _;
539
- }, s = xe[e.locale] ? e.locale : "en", i = xe[s], r = o("cm-add_child", i.addChild, "tab"), c = o("cm-add_parent", i.addParent, ""), l = o("cm-add_sibling", i.addSibling, "enter"), h = o("cm-remove_child", i.removeNode, "delete"), a = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), d = o("cm-up", i.moveUp, "PgUp"), m = o("cm-down", i.moveDown, "Pgdn"), g = o("cm-down", i.link, ""), p = o("cm-down", i.summary, ""), f = document.createElement("ul");
541
+ return _.id = y, _.innerHTML = `<span>${ne(x)}</span><span>${ne(w)}</span>`, _;
542
+ }, s = xe[e.locale] ? e.locale : "en", i = xe[s], r = o("cm-add_child", i.addChild, "tab"), c = o("cm-add_parent", i.addParent, ""), l = o("cm-add_sibling", i.addSibling, "enter"), h = o("cm-remove_child", i.removeNode, "delete"), a = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), d = o("cm-up", i.moveUp, "PgUp"), m = o("cm-down", i.moveDown, "Pgdn"), g = o("cm-link", i.link, ""), p = o("cm-summary", i.summary, ""), f = document.createElement("ul");
540
543
  if (f.className = "menu-list", f.appendChild(r), f.appendChild(c), f.appendChild(l), f.appendChild(h), (!t || t.focus) && (f.appendChild(a), f.appendChild(u)), f.appendChild(d), f.appendChild(m), f.appendChild(p), (!t || t.link) && f.appendChild(g), t && t.extend)
541
544
  for (let y = 0; y < t.extend.length; y++) {
542
545
  const x = t.extend[y], w = o(x.name, x.name, x.key || "");
@@ -547,7 +550,7 @@ function mt(e, t) {
547
550
  const v = document.createElement("div");
548
551
  v.className = "context-menu", v.appendChild(f), v.hidden = !0, e.container.append(v);
549
552
  let b = !0;
550
- e.container.oncontextmenu = function(y) {
553
+ return e.container.oncontextmenu = function(y) {
551
554
  if (y.preventDefault(), !e.editable)
552
555
  return;
553
556
  const x = y.target;
@@ -590,6 +593,8 @@ function mt(e, t) {
590
593
  );
591
594
  }, p.onclick = () => {
592
595
  v.hidden = !0, e.createSummary(), e.unselectNodes();
596
+ }, () => {
597
+ r.onclick = null, c.onclick = null, l.onclick = null, h.onclick = null, a.onclick = null, u.onclick = null, d.onclick = null, m.onclick = null, g.onclick = null, p.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
593
598
  };
594
599
  }
595
600
  const gt = (e) => {
@@ -618,11 +623,11 @@ const gt = (e) => {
618
623
  if (!n)
619
624
  return;
620
625
  const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
621
- o.root ? t === "lhs" ? gt(e) : vt(e) : s.className === t ? xt(e, n) : (r = o.parent) != null && r.root ? bt(e) : yt(e, n);
626
+ o.parent ? s.className === t ? xt(e, n) : (r = o.parent) != null && r.parent ? yt(e, n) : bt(e) : t === "lhs" ? gt(e) : vt(e);
622
627
  }, Ee = function(e, t) {
623
628
  var r;
624
629
  const n = e.currentNode || ((r = e.currentNodes) == null ? void 0 : r[0]);
625
- if (!n || n.nodeObj.root)
630
+ if (!n || !n.nodeObj.parent)
626
631
  return;
627
632
  const s = t + "Sibling", i = n.parentElement.parentElement[s];
628
633
  i && e.selectNode(i.firstChild.firstChild);
@@ -728,7 +733,7 @@ function Et(e, t) {
728
733
  e.bus.addListener("unselectNode", function() {
729
734
  a.hidden = !0;
730
735
  }), e.bus.addListener("selectNode", function(d) {
731
- a.hidden = !1, d.root ? u = !0 : u = !1;
736
+ a.hidden = !1, d.parent ? u = !1 : u = !0;
732
737
  }), a.onclick = (d) => {
733
738
  d.target === a && (a.hidden = !0);
734
739
  }, o.onclick = () => {
@@ -745,7 +750,7 @@ function Et(e, t) {
745
750
  e.beginEdit();
746
751
  };
747
752
  }
748
- const ae = document, Ct = function(e, t) {
753
+ const ae = document, Nt = function(e, t) {
749
754
  if (!t)
750
755
  return de(e), e;
751
756
  let n = e.querySelector(".insert-preview");
@@ -757,20 +762,20 @@ const ae = document, Ct = function(e, t) {
757
762
  const t = e.querySelectorAll(".insert-preview");
758
763
  for (const n of t || [])
759
764
  n.remove();
760
- }, Ce = function(e, t) {
765
+ }, Ne = function(e, t) {
761
766
  for (const n of t) {
762
767
  const o = n.parentElement.parentElement.contains(e);
763
- if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.root !== !0))
768
+ if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent))
764
769
  return !1;
765
770
  }
766
771
  return !0;
767
- }, Nt = function(e) {
772
+ }, Ct = function(e) {
768
773
  const t = document.createElement("div");
769
774
  return t.className = "mind-elixir-ghost", e.map.appendChild(t), t;
770
775
  };
771
776
  function _t(e) {
772
777
  let t = null, n = null, o = null;
773
- const s = Nt(e), i = 12;
778
+ const s = Ct(e), i = 12;
774
779
  e.map.addEventListener("dragstart", (r) => {
775
780
  var l, h;
776
781
  const c = r.target;
@@ -796,20 +801,20 @@ function _t(e) {
796
801
  return;
797
802
  de(o);
798
803
  const c = ae.elementFromPoint(r.clientX, r.clientY - i);
799
- if (Ce(c, t)) {
804
+ if (Ne(c, t)) {
800
805
  o = c;
801
806
  const l = c.getBoundingClientRect().y;
802
807
  r.clientY > l + c.clientHeight ? n = "after" : n = "in";
803
808
  } else {
804
809
  const l = ae.elementFromPoint(r.clientX, r.clientY + i);
805
- if (Ce(l, t)) {
810
+ if (Ne(l, t)) {
806
811
  o = l;
807
812
  const h = l.getBoundingClientRect().y;
808
813
  r.clientY < h ? n = "before" : n = "in";
809
814
  } else
810
815
  n = o = null;
811
816
  }
812
- o && Ct(o, n);
817
+ o && Nt(o, n);
813
818
  }, 100)
814
819
  );
815
820
  }
@@ -839,13 +844,19 @@ function Mt(e) {
839
844
  }), e.undo = function() {
840
845
  if (n > -1) {
841
846
  const s = t[n];
842
- o = s.prev, e.refresh(s.prev), s.currentObject.type === "node" ? e.selectNode(N(s.currentObject.value)) : s.currentObject.type === "nodes" && e.selectNodes(s.currentObject.value.map((i) => N(i))), n--;
847
+ o = s.prev, e.refresh(s.prev);
848
+ try {
849
+ s.currentObject.type === "node" ? e.selectNode(C(s.currentObject.value)) : s.currentObject.type === "nodes" && e.selectNodes(s.currentObject.value.map((i) => C(i)));
850
+ } catch {
851
+ } finally {
852
+ n--;
853
+ }
843
854
  }
844
855
  }, e.redo = function() {
845
856
  if (n < t.length - 1) {
846
857
  n++;
847
858
  const s = t[n];
848
- o = s.next, e.refresh(s.next), s.currentObject.type === "node" ? e.selectNode(N(s.currentObject.value)) : s.currentObject.type === "nodes" && e.selectNodes(s.currentObject.value.map((i) => N(i)));
859
+ o = s.next, e.refresh(s.next), s.currentObject.type === "node" ? e.selectNode(C(s.currentObject.value)) : s.currentObject.type === "nodes" && e.selectNodes(s.currentObject.value.map((i) => C(i)));
849
860
  }
850
861
  }, e.map.addEventListener("keydown", (s) => {
851
862
  (s.metaKey || s.ctrlKey) && s.shiftKey && s.key === "Z" ? e.redo() : (s.metaKey || s.ctrlKey) && s.key === "z" && e.undo();
@@ -860,7 +871,7 @@ const R = (e, t) => {
860
871
  function Lt(e) {
861
872
  const t = document.createElement("div"), n = R("fullscreen", "full"), o = R("toCenter", "living"), s = R("zoomout", "move"), i = R("zoomin", "add"), r = document.createElement("span");
862
873
  return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
863
- e.container.requestFullscreen();
874
+ e.mindElixirBox.requestFullscreen();
864
875
  }, o.onclick = () => {
865
876
  e.toCenter();
866
877
  }, s.onclick = () => {
@@ -869,7 +880,7 @@ function Lt(e) {
869
880
  e.scaleVal > 1.6 || e.scale(e.scaleVal += 0.2);
870
881
  }, t;
871
882
  }
872
- function Tt(e) {
883
+ function kt(e) {
873
884
  const t = document.createElement("div"), n = R("tbltl", "left"), o = R("tbltr", "right"), s = R("tblts", "side");
874
885
  return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
875
886
  e.initLeft();
@@ -879,8 +890,8 @@ function Tt(e) {
879
890
  e.initSide();
880
891
  }, t;
881
892
  }
882
- function kt(e) {
883
- e.container.append(Lt(e)), e.container.append(Tt(e));
893
+ function Tt(e) {
894
+ e.container.append(Lt(e)), e.container.append(kt(e));
884
895
  }
885
896
  /*! @viselect/vanilla v3.5.1 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
886
897
  var At = Object.defineProperty, jt = (e, t, n) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, E = (e, t, n) => (jt(e, typeof t != "symbol" ? t + "" : t, n), n);
@@ -906,13 +917,13 @@ class Dt {
906
917
  this._listeners.clear();
907
918
  }
908
919
  }
909
- const Ne = (e, t = "px") => typeof e == "number" ? e + t : e;
920
+ const Ce = (e, t = "px") => typeof e == "number" ? e + t : e;
910
921
  function A({ style: e }, t, n) {
911
922
  if (typeof t == "object")
912
923
  for (const [o, s] of Object.entries(t))
913
- s !== void 0 && (e[o] = Ne(s));
924
+ s !== void 0 && (e[o] = Ce(s));
914
925
  else
915
- n !== void 0 && (e[t] = Ne(n));
926
+ n !== void 0 && (e[t] = Ce(n));
916
927
  }
917
928
  const Re = (e) => (t, n, o, s = {}) => {
918
929
  t instanceof HTMLCollection || t instanceof NodeList ? t = Array.from(t) : Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
@@ -921,7 +932,7 @@ const Re = (e) => (t, n, o, s = {}) => {
921
932
  for (const r of n)
922
933
  i[e](r, o, { capture: !1, ...s });
923
934
  return [t, n, o, s];
924
- }, q = Re("addEventListener"), j = Re("removeEventListener"), Q = (e) => {
935
+ }, q = Re("addEventListener"), j = Re("removeEventListener"), Z = (e) => {
925
936
  var t;
926
937
  const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
927
938
  return { x: n, y: o, target: s };
@@ -1057,7 +1068,7 @@ class qe extends Dt {
1057
1068
  });
1058
1069
  }
1059
1070
  _onTapStart(t, n = !1) {
1060
- const { x: o, y: s, target: i } = Q(t), { _options: r } = this, { document: c } = this._options, l = i.getBoundingClientRect();
1071
+ const { x: o, y: s, target: i } = Z(t), { _options: r } = this, { document: c } = this._options, l = i.getBoundingClientRect();
1061
1072
  if (t instanceof MouseEvent && !Ht(t, r.behaviour.triggers))
1062
1073
  return;
1063
1074
  const h = F(r.startAreas, r.document), a = F(r.boundaries, r.document);
@@ -1072,7 +1083,7 @@ class qe extends Dt {
1072
1083
  this._scrollDelta = { x: d.scrollLeft, y: d.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), q(c, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), q(c, ["mouseup", "touchcancel", "touchend"], this._onTapStop), q(c, "scroll", this._onScroll);
1073
1084
  }
1074
1085
  _onSingleTap(t) {
1075
- const { singleTap: { intersect: n }, range: o } = this._options.features, s = Q(t);
1086
+ const { singleTap: { intersect: n }, range: o } = this._options.features, s = Z(t);
1076
1087
  let i;
1077
1088
  if (n === "native")
1078
1089
  i = s.target;
@@ -1101,7 +1112,7 @@ class qe extends Dt {
1101
1112
  r.includes(i) && (r.length === 1 || t.ctrlKey || r.every((c) => this._selection.stored.includes(c))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
1102
1113
  }
1103
1114
  _delayedTapMove(t) {
1104
- const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: c, y: l } = Q(t);
1115
+ const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: c, y: l } = Z(t);
1105
1116
  if (
1106
1117
  // Single number for both coordinates
1107
1118
  typeof s == "number" && B(c + l - (i + r)) >= s || // Different x and y threshold
@@ -1136,7 +1147,7 @@ class qe extends Dt {
1136
1147
  }));
1137
1148
  }
1138
1149
  _onTapMove(t) {
1139
- const { x: n, y: o } = Q(t), { _scrollSpeed: s, _areaLocation: i, _options: r, _frame: c } = this, { speedDivider: l } = r.behaviour.scrolling, h = this._targetElement;
1150
+ const { x: n, y: o } = Z(t), { _scrollSpeed: s, _areaLocation: i, _options: r, _frame: c } = this, { speedDivider: l } = r.behaviour.scrolling, h = this._targetElement;
1140
1151
  if (i.x2 = n, i.y2 = o, this._scrollAvailable && !this._scrollingActive && (s.y || s.x)) {
1141
1152
  this._scrollingActive = !0;
1142
1153
  const a = () => {
@@ -1378,122 +1389,16 @@ const zt = function(e, t = !0) {
1378
1389
  this.mindElixirBox.style.setProperty(i, n[i]);
1379
1390
  }
1380
1391
  t && this.refresh();
1381
- };
1382
- function Fe(e) {
1383
- return {
1384
- nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
1385
- arrows: e.arrows,
1386
- summaries: e.summaries,
1387
- direction: e.direction,
1388
- theme: e.theme
1389
- };
1390
- }
1391
- const Rt = function(e, t, n) {
1392
- if (e) {
1393
- if (this.clearSelection(), typeof e == "string") {
1394
- const o = N(e);
1395
- return o ? this.selectNode(o) : void 0;
1396
- }
1397
- e.className = "selected", e.scrollIntoView({ block: "nearest", inline: "nearest" }), this.currentNode = e, t ? this.bus.fire("selectNewNode", e.nodeObj) : this.bus.fire("selectNode", e.nodeObj, n);
1398
- }
1399
- }, qt = function() {
1400
- this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
1401
- }, Ft = function(e) {
1402
- this.clearSelection();
1403
- for (const t of e)
1404
- t.className = "selected";
1405
- this.currentNodes = e, this.bus.fire(
1406
- "selectNodes",
1407
- e.map((t) => t.nodeObj)
1408
- );
1409
- }, It = function() {
1410
- if (this.currentNodes)
1411
- for (const e of this.currentNodes)
1412
- e.classList.remove("selected");
1413
- this.currentNodes = null, this.bus.fire("unselectNodes");
1414
- }, Kt = function() {
1415
- this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
1416
- }, Vt = function() {
1417
- const e = Fe(this);
1418
- return JSON.stringify(e, (t, n) => {
1419
- if (!(t === "parent" && typeof n != "string"))
1420
- return n;
1421
- });
1422
- }, Wt = function() {
1423
- return JSON.parse(this.getDataString());
1424
- }, Ut = function() {
1425
- const e = Fe(this).nodeData;
1426
- let t = "# " + e.topic + `
1427
-
1428
- `;
1429
- function n(o, s) {
1430
- for (let i = 0; i < o.length; i++)
1431
- s <= 6 ? t += "".padStart(s, "#") + " " + o[i].topic + `
1432
-
1433
- ` : t += "".padStart(s - 7, " ") + "- " + o[i].topic + `
1434
- `, o[i].children && n(o[i].children || [], s + 1);
1435
- }
1436
- return n(e.children || [], 2), t;
1437
- }, Yt = function() {
1438
- this.editable = !0;
1439
- }, Xt = function() {
1440
- this.editable = !1;
1441
- }, Gt = function(e) {
1442
- this.scaleVal = e, this.map.style.transform = "scale(" + e + ")";
1443
- }, Jt = function() {
1444
- this.container.scrollTo(1e4 - this.container.offsetWidth / 2, 1e4 - this.container.offsetHeight / 2);
1445
- }, Qt = function(e) {
1446
- e(this);
1447
- }, Zt = function(e) {
1448
- e.nodeObj.root || (this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.nodeData.root = !0, this.initRight(), this.toCenter());
1449
- }, en = function() {
1450
- this.isFocusMode = !1, this.tempDirection !== null && (delete this.nodeData.root, this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
1451
- }, tn = function() {
1452
- this.direction = 0, this.refresh();
1453
- }, nn = function() {
1454
- this.direction = 1, this.refresh();
1455
- }, on = function() {
1456
- this.direction = 2, this.refresh();
1457
- }, sn = function(e) {
1458
- this.locale = e, this.refresh();
1459
- }, rn = function(e, t) {
1460
- const n = e.nodeObj;
1461
- typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0, this.layout(), this.linkDiv(), this.bus.fire("expandNode", n);
1462
- }, cn = function(e) {
1463
- e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), $(this.nodeData), this.layout(), this.linkDiv();
1464
- }, ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1465
- __proto__: null,
1466
- cancelFocus: en,
1467
- clearSelection: Kt,
1468
- disableEdit: Xt,
1469
- enableEdit: Yt,
1470
- expandNode: rn,
1471
- focusNode: Zt,
1472
- getData: Wt,
1473
- getDataMd: Ut,
1474
- getDataString: Vt,
1475
- initLeft: tn,
1476
- initRight: nn,
1477
- initSide: on,
1478
- install: Qt,
1479
- refresh: cn,
1480
- scale: Gt,
1481
- selectNode: Rt,
1482
- selectNodes: Ft,
1483
- setLocale: sn,
1484
- toCenter: Jt,
1485
- unselectNode: qt,
1486
- unselectNodes: It
1487
- }, Symbol.toStringTag, { value: "Module" })), W = (e) => {
1392
+ }, W = (e) => {
1488
1393
  var o;
1489
1394
  const t = (o = e.parent) == null ? void 0 : o.children, n = t.indexOf(e);
1490
1395
  return { siblings: t, index: n };
1491
1396
  };
1492
- function an(e) {
1397
+ function Rt(e) {
1493
1398
  const { siblings: t, index: n } = W(e), o = t[n];
1494
1399
  n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
1495
1400
  }
1496
- function dn(e) {
1401
+ function qt(e) {
1497
1402
  const { siblings: t, index: n } = W(e), o = t[n];
1498
1403
  n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
1499
1404
  }
@@ -1501,15 +1406,15 @@ function me(e) {
1501
1406
  const { siblings: t, index: n } = W(e);
1502
1407
  return t.splice(n, 1), t.length;
1503
1408
  }
1504
- function hn(e, t, n) {
1409
+ function Ft(e, t, n) {
1505
1410
  const { siblings: o, index: s } = W(n);
1506
1411
  t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e);
1507
1412
  }
1508
- function un(e, t) {
1413
+ function It(e, t) {
1509
1414
  const { siblings: n, index: o } = W(e);
1510
1415
  n[o] = t, t.children = [e];
1511
1416
  }
1512
- function Ie(e, t, n) {
1417
+ function Fe(e, t, n) {
1513
1418
  if (me(t), e === "in")
1514
1419
  n.children ? n.children.push(t) : n.children = [t];
1515
1420
  else {
@@ -1518,21 +1423,21 @@ function Ie(e, t, n) {
1518
1423
  e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
1519
1424
  }
1520
1425
  }
1521
- const fn = function(e, t) {
1426
+ const Kt = function(e, t) {
1522
1427
  var n, o;
1523
- if (e === T)
1524
- return T;
1428
+ if (e === k)
1429
+ return k;
1525
1430
  if (e === z)
1526
1431
  return z;
1527
- if (e === ie) {
1432
+ if (e === re) {
1528
1433
  const s = ((n = document.querySelector(".lhs")) == null ? void 0 : n.childElementCount) || 0, i = ((o = document.querySelector(".rhs")) == null ? void 0 : o.childElementCount) || 0;
1529
- return s <= i ? (t.direction = T, T) : (t.direction = z, z);
1434
+ return s <= i ? (t.direction = k, k) : (t.direction = z, z);
1530
1435
  }
1531
- }, Ke = function(e, t, n) {
1436
+ }, Ie = function(e, t, n) {
1532
1437
  var i, r;
1533
1438
  const o = n.children[0].children[0], s = t.parentElement;
1534
1439
  if (s.tagName === "ME-PARENT") {
1535
- if (ce(o), s.children[1])
1440
+ if (J(o), s.children[1])
1536
1441
  s.nextSibling.appendChild(n);
1537
1442
  else {
1538
1443
  const c = e.createChildren([n]);
@@ -1540,30 +1445,21 @@ const fn = function(e, t) {
1540
1445
  }
1541
1446
  e.linkDiv(n.offsetParent);
1542
1447
  } else
1543
- s.tagName === "ME-ROOT" && (fn(e.direction, o.nodeObj) === T ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
1544
- }, ge = function(e, t, n) {
1545
- if (!t)
1546
- return null;
1547
- const o = t.nodeObj;
1548
- o.expanded === !1 && (e.expandNode(t, !0), t = N(o.id));
1549
- const s = n || e.generateNewObj();
1550
- o.children ? o.children.push(s) : o.children = [s], $(e.nodeData);
1551
- const { grp: i, top: r } = e.createWrapper(s);
1552
- return Ke(e, t, i), { newTop: r, newNodeObj: s };
1553
- }, Ve = function(e, t) {
1448
+ s.tagName === "ME-ROOT" && (Kt(e.direction, o.nodeObj) === k ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
1449
+ }, Ke = function(e, t) {
1554
1450
  const n = e.parentNode;
1555
1451
  if (t === 0) {
1556
1452
  const o = n.parentNode.parentNode;
1557
1453
  o.tagName !== "ME-MAIN" && o.previousSibling.children[1].remove();
1558
1454
  }
1559
1455
  n.parentNode.remove();
1560
- }, We = {
1456
+ }, Ve = {
1561
1457
  before: "beforebegin",
1562
1458
  after: "afterend"
1563
- }, ce = function(e) {
1459
+ }, J = function(e) {
1564
1460
  const n = e.parentElement.parentElement.lastElementChild;
1565
1461
  (n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
1566
- }, pn = function(e, t) {
1462
+ }, Vt = function(e, t) {
1567
1463
  const n = e.nodeObj, o = ue(n);
1568
1464
  o.style && t.style && (t.style = Object.assign(o.style, t.style));
1569
1465
  const s = Object.assign(n, t);
@@ -1572,37 +1468,48 @@ const fn = function(e, t) {
1572
1468
  obj: s,
1573
1469
  origin: o
1574
1470
  });
1575
- }, mn = function(e, t, n) {
1471
+ }, ge = function(e, t, n) {
1472
+ if (!t)
1473
+ return null;
1474
+ const o = t.nodeObj;
1475
+ o.expanded === !1 && (e.expandNode(t, !0), t = C(o.id));
1476
+ const s = n || e.generateNewObj();
1477
+ o.children ? o.children.push(s) : o.children = [s], $(e.nodeData);
1478
+ const { grp: i, top: r } = e.createWrapper(s);
1479
+ return Ie(e, t, i), { newTop: r, newNodeObj: s };
1480
+ }, Wt = function(e, t, n) {
1576
1481
  var h, a, u;
1577
1482
  const o = t || this.currentNode;
1578
1483
  if (!o)
1579
1484
  return;
1580
1485
  const s = o.nodeObj;
1581
- if (s.root === !0) {
1486
+ if (s.parent) {
1487
+ if (!((h = s.parent) != null && h.parent) && ((u = (a = s.parent) == null ? void 0 : a.children) == null ? void 0 : u.length) === 1) {
1488
+ this.addChild(C(s.parent.id), n);
1489
+ return;
1490
+ }
1491
+ } else {
1582
1492
  this.addChild();
1583
1493
  return;
1584
- } else if (((h = s.parent) == null ? void 0 : h.root) === !0 && ((u = (a = s.parent) == null ? void 0 : a.children) == null ? void 0 : u.length) === 1) {
1585
- this.addChild(N(s.parent.id), n);
1586
- return;
1587
1494
  }
1588
1495
  const i = n || this.generateNewObj();
1589
- hn(i, e, s), $(this.nodeData);
1496
+ Ft(i, e, s), $(this.nodeData);
1590
1497
  const r = o.parentElement, { grp: c, top: l } = this.createWrapper(i);
1591
- r.parentElement.insertAdjacentElement(We[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(l.firstChild), this.selectNode(l.firstChild, !0), this.bus.fire("operation", {
1498
+ r.parentElement.insertAdjacentElement(Ve[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(l.firstChild), this.selectNode(l.firstChild, !0), this.bus.fire("operation", {
1592
1499
  name: "insertSibling",
1593
1500
  type: e,
1594
1501
  obj: i
1595
1502
  });
1596
- }, gn = function(e, t) {
1503
+ }, Ut = function(e, t) {
1597
1504
  const n = e || this.currentNode;
1598
1505
  if (!n)
1599
1506
  return;
1600
- ce(n);
1507
+ J(n);
1601
1508
  const o = n.nodeObj;
1602
- if (o.root === !0)
1509
+ if (!o.parent)
1603
1510
  return;
1604
1511
  const s = t || this.generateNewObj();
1605
- un(o, s), $(this.nodeData);
1512
+ It(o, s), $(this.nodeData);
1606
1513
  const i = n.parentElement.parentElement, { grp: r, top: c } = this.createWrapper(s, !0);
1607
1514
  c.appendChild(pe(!0)), i.insertAdjacentElement("afterend", r);
1608
1515
  const l = this.createChildren([i]);
@@ -1610,7 +1517,7 @@ const fn = function(e, t) {
1610
1517
  name: "insertParent",
1611
1518
  obj: s
1612
1519
  });
1613
- }, vn = function(e, t) {
1520
+ }, Yt = function(e, t) {
1614
1521
  const n = e || this.currentNode;
1615
1522
  if (!n)
1616
1523
  return;
@@ -1622,19 +1529,19 @@ const fn = function(e, t) {
1622
1529
  name: "addChild",
1623
1530
  obj: i
1624
1531
  }), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
1625
- }, bn = function(e, t) {
1532
+ }, Xt = function(e, t) {
1626
1533
  const n = ue(e.nodeObj);
1627
1534
  he(n);
1628
1535
  const o = ge(this, t, n);
1629
1536
  if (!o)
1630
1537
  return;
1631
1538
  const { newNodeObj: s } = o;
1632
- this.selectNode(N(s.id)), this.bus.fire("operation", {
1539
+ this.selectNode(C(s.id)), this.bus.fire("operation", {
1633
1540
  name: "copyNode",
1634
1541
  obj: s
1635
1542
  });
1636
- }, yn = function(e, t) {
1637
- e = re(e);
1543
+ }, Gt = function(e, t) {
1544
+ e = ce(e);
1638
1545
  const n = [];
1639
1546
  for (let o = 0; o < e.length; o++) {
1640
1547
  const s = e[o], i = ue(s.nodeObj);
@@ -1645,122 +1552,237 @@ const fn = function(e, t) {
1645
1552
  const { newNodeObj: c } = r;
1646
1553
  n.push(c);
1647
1554
  }
1648
- this.selectNodes(n.map((o) => N(o.id))), this.bus.fire("operation", {
1555
+ this.selectNodes(n.map((o) => C(o.id))), this.bus.fire("operation", {
1649
1556
  name: "copyNodes",
1650
1557
  objs: n
1651
1558
  });
1652
- }, xn = function(e) {
1559
+ }, Jt = function(e) {
1653
1560
  const t = e || this.currentNode;
1654
1561
  if (!t)
1655
1562
  return;
1656
1563
  const n = t.nodeObj;
1657
- an(n);
1564
+ Rt(n);
1658
1565
  const o = t.parentNode.parentNode;
1659
1566
  o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
1660
1567
  name: "moveUpNode",
1661
1568
  obj: n
1662
1569
  });
1663
- }, wn = function(e) {
1570
+ }, Qt = function(e) {
1664
1571
  const t = e || this.currentNode;
1665
1572
  if (!t)
1666
1573
  return;
1667
1574
  const n = t.nodeObj;
1668
- dn(n);
1575
+ qt(n);
1669
1576
  const o = t.parentNode.parentNode;
1670
1577
  o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
1671
1578
  name: "moveDownNode",
1672
1579
  obj: n
1673
1580
  });
1674
- }, En = function(e) {
1581
+ }, Zt = function(e) {
1675
1582
  var r;
1676
1583
  const t = e || this.currentNode;
1677
1584
  if (!t)
1678
1585
  return;
1679
1586
  const n = t.nodeObj;
1680
- if (n.root === !0)
1587
+ if (!n.parent)
1681
1588
  throw new Error("Can not remove root node");
1682
1589
  const o = n.parent.children, s = o.findIndex((c) => c === n), i = me(n);
1683
- if (Ve(t, i), o.length !== 0) {
1590
+ if (Ke(t, i), o.length !== 0) {
1684
1591
  const c = o[s] || o[s - 1];
1685
- this.selectNode(N(c.id));
1592
+ this.selectNode(C(c.id));
1686
1593
  } else
1687
- this.selectNode(N(n.parent.id));
1594
+ this.selectNode(C(n.parent.id));
1688
1595
  this.linkDiv(), this.bus.fire("operation", {
1689
1596
  name: "removeNode",
1690
1597
  obj: n,
1691
1598
  originIndex: s,
1692
1599
  originParentId: (r = n == null ? void 0 : n.parent) == null ? void 0 : r.id
1693
1600
  });
1694
- }, Cn = function(e) {
1695
- e = re(e);
1601
+ }, en = function(e) {
1602
+ e = ce(e);
1696
1603
  for (const t of e) {
1697
1604
  const n = t.nodeObj;
1698
- if (n.root === !0)
1605
+ if (!n.parent)
1699
1606
  continue;
1700
1607
  const o = me(n);
1701
- Ve(t, o);
1608
+ Ke(t, o);
1702
1609
  }
1703
1610
  this.linkDiv(), this.bus.fire("operation", {
1704
1611
  name: "removeNodes",
1705
1612
  objs: e.map((t) => t.nodeObj)
1706
1613
  });
1707
- }, Nn = function(e, t) {
1708
- e = re(e);
1614
+ }, tn = function(e, t) {
1615
+ e = ce(e);
1709
1616
  const n = t.nodeObj;
1710
- n.expanded === !1 && (this.expandNode(t, !0), t = N(n.id));
1617
+ n.expanded === !1 && (this.expandNode(t, !0), t = C(n.id));
1711
1618
  for (const o of e) {
1712
1619
  const s = o.nodeObj;
1713
- Ie("in", s, n), $(this.nodeData);
1620
+ Fe("in", s, n), $(this.nodeData);
1714
1621
  const i = o.parentElement;
1715
- Ke(this, t, i.parentElement);
1622
+ Ie(this, t, i.parentElement);
1716
1623
  }
1717
1624
  this.linkDiv(), this.bus.fire("operation", {
1718
1625
  name: "moveNodeIn",
1719
1626
  objs: e.map((o) => o.nodeObj),
1720
1627
  toObj: n
1721
1628
  });
1722
- }, Ue = (e, t, n, o) => {
1723
- e = re(e), t === "after" && (e = e.reverse());
1629
+ }, We = (e, t, n, o) => {
1630
+ e = ce(e), t === "after" && (e = e.reverse());
1724
1631
  const s = n.nodeObj;
1725
1632
  for (const i of e) {
1726
1633
  const r = i.nodeObj;
1727
- Ie(t, r, s), $(o.nodeData), ce(i);
1634
+ Fe(t, r, s), $(o.nodeData), J(i);
1728
1635
  const c = i.parentElement.parentNode;
1729
- n.parentElement.parentNode.insertAdjacentElement(We[t], c);
1636
+ n.parentElement.parentNode.insertAdjacentElement(Ve[t], c);
1730
1637
  }
1731
1638
  o.linkDiv(), o.bus.fire("operation", {
1732
1639
  name: t === "before" ? "moveNodeBefore" : "moveNodeAfter",
1733
1640
  objs: e.map((i) => i.nodeObj),
1734
1641
  toObj: s
1735
1642
  });
1736
- }, _n = function(e, t) {
1737
- Ue(e, "before", t, this);
1738
- }, Sn = function(e, t) {
1739
- Ue(e, "after", t, this);
1740
- }, Mn = function(e) {
1643
+ }, nn = function(e, t) {
1644
+ We(e, "before", t, this);
1645
+ }, on = function(e, t) {
1646
+ We(e, "after", t, this);
1647
+ }, sn = function(e) {
1741
1648
  const t = e || this.currentNode;
1742
1649
  t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
1743
- }, Ln = function(e, t) {
1650
+ }, rn = function(e, t) {
1744
1651
  e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
1745
- }, Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1652
+ }, Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1746
1653
  __proto__: null,
1747
- addChild: vn,
1748
- beginEdit: Mn,
1749
- copyNode: bn,
1750
- copyNodes: yn,
1751
- insertParent: gn,
1752
- insertSibling: mn,
1753
- mainToSub: ce,
1754
- moveDownNode: wn,
1755
- moveNodeAfter: Sn,
1756
- moveNodeBefore: _n,
1757
- moveNodeIn: Nn,
1758
- moveUpNode: xn,
1759
- removeNode: En,
1760
- removeNodes: Cn,
1761
- reshapeNode: pn,
1762
- setNodeTopic: Ln
1763
- }, Symbol.toStringTag, { value: "Module" })), Tn = function(e) {
1654
+ addChild: Yt,
1655
+ beginEdit: sn,
1656
+ copyNode: Xt,
1657
+ copyNodes: Gt,
1658
+ insertParent: Ut,
1659
+ insertSibling: Wt,
1660
+ moveDownNode: Qt,
1661
+ moveNodeAfter: on,
1662
+ moveNodeBefore: nn,
1663
+ moveNodeIn: tn,
1664
+ moveUpNode: Jt,
1665
+ removeNode: Zt,
1666
+ removeNodes: en,
1667
+ reshapeNode: Vt,
1668
+ rmSubline: J,
1669
+ setNodeTopic: rn
1670
+ }, Symbol.toStringTag, { value: "Module" }));
1671
+ function Ye(e) {
1672
+ return {
1673
+ nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
1674
+ arrows: e.arrows,
1675
+ summaries: e.summaries,
1676
+ direction: e.direction,
1677
+ theme: e.theme
1678
+ };
1679
+ }
1680
+ const cn = function(e, t, n) {
1681
+ if (e) {
1682
+ if (this.clearSelection(), typeof e == "string") {
1683
+ const o = C(e);
1684
+ return o ? this.selectNode(o) : void 0;
1685
+ }
1686
+ e.className = "selected", e.scrollIntoView({ block: "nearest", inline: "nearest" }), this.currentNode = e, t ? this.bus.fire("selectNewNode", e.nodeObj) : this.bus.fire("selectNode", e.nodeObj, n);
1687
+ }
1688
+ }, ln = function() {
1689
+ this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
1690
+ }, an = function(e) {
1691
+ this.clearSelection();
1692
+ for (const t of e)
1693
+ t.className = "selected";
1694
+ this.currentNodes = e, this.bus.fire(
1695
+ "selectNodes",
1696
+ e.map((t) => t.nodeObj)
1697
+ );
1698
+ }, dn = function() {
1699
+ if (this.currentNodes)
1700
+ for (const e of this.currentNodes)
1701
+ e.classList.remove("selected");
1702
+ this.currentNodes = null, this.bus.fire("unselectNodes");
1703
+ }, hn = function() {
1704
+ this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
1705
+ }, un = function() {
1706
+ const e = Ye(this);
1707
+ return JSON.stringify(e, (t, n) => {
1708
+ if (!(t === "parent" && typeof n != "string"))
1709
+ return n;
1710
+ });
1711
+ }, fn = function() {
1712
+ return JSON.parse(this.getDataString());
1713
+ }, pn = function() {
1714
+ const e = Ye(this).nodeData;
1715
+ let t = "# " + e.topic + `
1716
+
1717
+ `;
1718
+ function n(o, s) {
1719
+ for (let i = 0; i < o.length; i++)
1720
+ s <= 6 ? t += "".padStart(s, "#") + " " + o[i].topic + `
1721
+
1722
+ ` : t += "".padStart(s - 7, " ") + "- " + o[i].topic + `
1723
+ `, o[i].children && n(o[i].children || [], s + 1);
1724
+ }
1725
+ return n(e.children || [], 2), t;
1726
+ }, mn = function() {
1727
+ this.editable = !0;
1728
+ }, gn = function() {
1729
+ this.editable = !1;
1730
+ }, vn = function(e) {
1731
+ this.scaleVal = e, this.map.style.transform = "scale(" + e + ")";
1732
+ }, bn = function() {
1733
+ this.container.scrollTo(1e4 - this.container.offsetWidth / 2, 1e4 - this.container.offsetHeight / 2);
1734
+ }, yn = function(e) {
1735
+ e(this);
1736
+ }, xn = function(e) {
1737
+ e.nodeObj.parent && (this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
1738
+ }, wn = function() {
1739
+ this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
1740
+ }, En = function() {
1741
+ this.direction = 0, this.refresh();
1742
+ }, Nn = function() {
1743
+ this.direction = 1, this.refresh();
1744
+ }, Cn = function() {
1745
+ this.direction = 2, this.refresh();
1746
+ }, _n = function(e) {
1747
+ this.locale = e, this.refresh();
1748
+ }, Sn = function(e, t) {
1749
+ const n = e.nodeObj;
1750
+ typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
1751
+ const o = e.parentNode, s = o.children[1];
1752
+ if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "", J(e), n.expanded) {
1753
+ const i = this.createChildren(
1754
+ n.children.map((r) => this.createWrapper(r).grp)
1755
+ );
1756
+ o.parentNode.appendChild(i);
1757
+ } else
1758
+ o.parentNode.children[1].remove();
1759
+ this.linkDiv(), this.bus.fire("expandNode", n);
1760
+ }, Mn = function(e) {
1761
+ e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), $(this.nodeData), this.layout(), this.linkDiv();
1762
+ }, Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1763
+ __proto__: null,
1764
+ cancelFocus: wn,
1765
+ clearSelection: hn,
1766
+ disableEdit: gn,
1767
+ enableEdit: mn,
1768
+ expandNode: Sn,
1769
+ focusNode: xn,
1770
+ getData: fn,
1771
+ getDataMd: pn,
1772
+ getDataString: un,
1773
+ initLeft: En,
1774
+ initRight: Nn,
1775
+ initSide: Cn,
1776
+ install: yn,
1777
+ refresh: Mn,
1778
+ scale: vn,
1779
+ selectNode: cn,
1780
+ selectNodes: an,
1781
+ setLocale: _n,
1782
+ toCenter: bn,
1783
+ unselectNode: ln,
1784
+ unselectNodes: dn
1785
+ }, Symbol.toStringTag, { value: "Module" })), kn = function(e) {
1764
1786
  return {
1765
1787
  dom: e,
1766
1788
  moved: !1,
@@ -1786,10 +1808,10 @@ const fn = function(e, t) {
1786
1808
  this.moved = !1, this.mousedown = !1;
1787
1809
  }
1788
1810
  };
1789
- }, Te = {
1790
- create: Tn
1811
+ }, ke = {
1812
+ create: kn
1791
1813
  };
1792
- function se(e, t, n) {
1814
+ function ie(e, t, n) {
1793
1815
  const { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, c = o + i / 2, l = s + r / 2, h = c + n.x, a = l + n.y;
1794
1816
  return {
1795
1817
  w: i,
@@ -1808,9 +1830,9 @@ function I(e) {
1808
1830
  y: n
1809
1831
  };
1810
1832
  }
1811
- const kn = function(e, t, n, o) {
1833
+ const Tn = function(e, t, n, o) {
1812
1834
  const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
1813
- return C(s, {
1835
+ return N(s, {
1814
1836
  "text-anchor": "middle",
1815
1837
  x: t + "",
1816
1838
  y: n + "",
@@ -1820,10 +1842,10 @@ const kn = function(e, t, n, o) {
1820
1842
  if (!t || !n)
1821
1843
  return;
1822
1844
  performance.now();
1823
- const i = se(e, t, o.delta1), r = se(e, n, o.delta2), { x: c, y: l } = I(i), { ctrlX: h, ctrlY: a } = i, { ctrlX: u, ctrlY: d } = r, { x: m, y: g } = I(r), p = Oe(u, d, m, g), f = ft(
1845
+ const i = ie(e, t, o.delta1), r = ie(e, n, o.delta2), { x: c, y: l } = I(i), { ctrlX: h, ctrlY: a } = i, { ctrlX: u, ctrlY: d } = r, { x: m, y: g } = I(r), p = Oe(u, d, m, g), f = ft(
1824
1846
  `M ${c} ${l} C ${h} ${a} ${u} ${d} ${m} ${g}`,
1825
1847
  `M ${p.x1} ${p.y1} L ${m} ${g} L ${p.x2} ${p.y2}`
1826
- ), v = c / 8 + h * 3 / 8 + u * 3 / 8 + m / 8, b = l / 8 + a * 3 / 8 + d * 3 / 8 + g / 8, y = kn(o.label, v, b, e.theme.cssVar["--color"]);
1848
+ ), v = c / 8 + h * 3 / 8 + u * 3 / 8 + m / 8, b = l / 8 + a * 3 / 8 + d * 3 / 8 + g / 8, y = Tn(o.label, v, b, e.theme.cssVar["--color"]);
1827
1849
  f.appendChild(y), f.arrowObj = o, f.dataset.linkid = o.id, e.linkSvgGroup.appendChild(f), s || (e.arrows.push(o), e.currentArrow = f, Je(e, o, i, r)), performance.now();
1828
1850
  }, An = function(e, t) {
1829
1851
  const n = {
@@ -1858,7 +1880,7 @@ const kn = function(e, t, n, o) {
1858
1880
  });
1859
1881
  }, Dn = function(e) {
1860
1882
  this.currentArrow = e;
1861
- const t = e.arrowObj, n = N(t.from), o = N(t.to), s = se(this, n, t.delta1), i = se(this, o, t.delta2);
1883
+ const t = e.arrowObj, n = C(t.from), o = C(t.to), s = ie(this, n, t.delta1), i = ie(this, o, t.delta2);
1862
1884
  Je(this, t, s, i);
1863
1885
  }, $n = function() {
1864
1886
  this.currentArrow = null, Ge(this);
@@ -1868,26 +1890,26 @@ const kn = function(e, t, n, o) {
1868
1890
  var d;
1869
1891
  e.linkController.style.display = "initial", e.P2.style.display = "initial", e.P3.style.display = "initial", e.nodes.appendChild(e.linkController), e.nodes.appendChild(e.P2), e.nodes.appendChild(e.P3);
1870
1892
  let { x: s, y: i } = I(n), { ctrlX: r, ctrlY: c } = n, { ctrlX: l, ctrlY: h } = o, { x: a, y: u } = I(o);
1871
- e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${h}px;left:${l}px;`, C(e.line1, {
1893
+ e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${h}px;left:${l}px;`, N(e.line1, {
1872
1894
  x1: s + "",
1873
1895
  y1: i + "",
1874
1896
  x2: r + "",
1875
1897
  y2: c + ""
1876
- }), C(e.line2, {
1898
+ }), N(e.line2, {
1877
1899
  x1: l + "",
1878
1900
  y1: h + "",
1879
1901
  x2: a + "",
1880
1902
  y2: u + ""
1881
- }), e.helper1 && (e.helper1.destory(e.map), (d = e.helper2) == null || d.destory(e.map)), e.helper1 = Te.create(e.P2), e.helper2 = Te.create(e.P3), e.helper1.init(e.map, (m, g) => {
1903
+ }), e.helper1 && (e.helper1.destory(e.map), (d = e.helper2) == null || d.destory(e.map)), e.helper1 = ke.create(e.P2), e.helper2 = ke.create(e.P3), e.helper1.init(e.map, (m, g) => {
1882
1904
  var b;
1883
1905
  r = r + m / e.scaleVal, c = c + g / e.scaleVal;
1884
1906
  const p = I({ ...n, ctrlX: r, ctrlY: c });
1885
1907
  s = p.x, i = p.y;
1886
1908
  const f = s / 8 + r * 3 / 8 + l * 3 / 8 + a / 8, v = i / 8 + c * 3 / 8 + h * 3 / 8 + u / 8;
1887
- e.P2.style.top = c + "px", e.P2.style.left = r + "px", (b = e.currentArrow) == null || b.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${h} ${a} ${u}`), C(e.currentArrow.children[2], {
1909
+ e.P2.style.top = c + "px", e.P2.style.left = r + "px", (b = e.currentArrow) == null || b.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${h} ${a} ${u}`), N(e.currentArrow.children[2], {
1888
1910
  x: f + "",
1889
1911
  y: v + ""
1890
- }), C(e.line1, {
1912
+ }), N(e.line1, {
1891
1913
  x1: s + "",
1892
1914
  y1: i + "",
1893
1915
  x2: r + "",
@@ -1899,10 +1921,10 @@ const kn = function(e, t, n, o) {
1899
1921
  const p = I({ ...o, ctrlX: l, ctrlY: h });
1900
1922
  a = p.x, u = p.y;
1901
1923
  const f = s / 8 + r * 3 / 8 + l * 3 / 8 + a / 8, v = i / 8 + c * 3 / 8 + h * 3 / 8 + u / 8, b = Oe(l, h, a, u);
1902
- e.P3.style.top = h + "px", e.P3.style.left = l + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${h} ${a} ${u}`), (x = e.currentArrow) == null || x.children[1].setAttribute("d", `M ${b.x1} ${b.y1} L ${a} ${u} L ${b.x2} ${b.y2}`), C(e.currentArrow.children[2], {
1924
+ e.P3.style.top = h + "px", e.P3.style.left = l + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${h} ${a} ${u}`), (x = e.currentArrow) == null || x.children[1].setAttribute("d", `M ${b.x1} ${b.y1} L ${a} ${u} L ${b.x2} ${b.y2}`), N(e.currentArrow.children[2], {
1903
1925
  x: f + "",
1904
1926
  y: v + ""
1905
- }), C(e.line2, {
1927
+ }), N(e.line2, {
1906
1928
  x1: l + "",
1907
1929
  y1: h + "",
1908
1930
  x2: a + "",
@@ -1915,7 +1937,7 @@ function On() {
1915
1937
  for (let e = 0; e < this.arrows.length; e++) {
1916
1938
  const t = this.arrows[e];
1917
1939
  try {
1918
- Xe(this, N(t.from), N(t.to), t, !0);
1940
+ Xe(this, C(t.from), C(t.to), t, !0);
1919
1941
  } catch {
1920
1942
  }
1921
1943
  }
@@ -1935,7 +1957,7 @@ function Pn(e) {
1935
1957
  });
1936
1958
  }
1937
1959
  function Hn() {
1938
- this.arrows = this.arrows.filter((e) => ne(e.from, this.nodeData) && ne(e.to, this.nodeData));
1960
+ this.arrows = this.arrows.filter((e) => oe(e.from, this.nodeData) && oe(e.to, this.nodeData));
1939
1961
  }
1940
1962
  const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1941
1963
  __proto__: null,
@@ -1982,7 +2004,7 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1982
2004
  if (!o)
1983
2005
  throw new Error("Can not select root node.");
1984
2006
  const s = n.map((a) => a[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
1985
- if (c.root)
2007
+ if (!c.parent)
1986
2008
  throw new Error("Please select nodes in the same main topic.");
1987
2009
  return {
1988
2010
  parent: c.id,
@@ -1992,9 +2014,9 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1992
2014
  }, Rn = function(e) {
1993
2015
  const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
1994
2016
  return t.setAttribute("id", e), t;
1995
- }, ke = function(e, t) {
2017
+ }, Te = function(e, t) {
1996
2018
  const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
1997
- return C(n, {
2019
+ return N(n, {
1998
2020
  d: e,
1999
2021
  stroke: t || "#666",
2000
2022
  fill: "none",
@@ -2003,31 +2025,31 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2003
2025
  }), n;
2004
2026
  }, Ae = function(e, t, n, o, s) {
2005
2027
  const i = document.createElementNS("http://www.w3.org/2000/svg", "text");
2006
- return C(i, {
2028
+ return N(i, {
2007
2029
  "text-anchor": o,
2008
2030
  x: t + "",
2009
2031
  y: n + "",
2010
2032
  fill: s || "#666"
2011
2033
  }), i.innerHTML = e, i;
2012
- }, qn = (e) => N(e).parentElement.parentElement, Fn = function({ parent: e, start: t }) {
2034
+ }, qn = (e) => C(e).parentElement.parentElement, Fn = function({ parent: e, start: t }) {
2013
2035
  var i, r;
2014
- const n = N(e), o = n.nodeObj;
2036
+ const n = C(e), o = n.nodeObj;
2015
2037
  let s;
2016
- return o.root === !0 ? s = (i = N(o.children[t].id).closest("me-main")) == null ? void 0 : i.className : s = (r = n.closest("me-main")) == null ? void 0 : r.className, s;
2038
+ return o.parent ? s = (i = n.closest("me-main")) == null ? void 0 : i.className : s = (r = C(o.children[t].id).closest("me-main")) == null ? void 0 : r.className, s;
2017
2039
  }, Qe = function(e, t) {
2018
2040
  var _;
2019
- const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes, h = N(s).nodeObj, a = Fn(t);
2041
+ const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes, h = C(s).nodeObj, a = Fn(t);
2020
2042
  let u = 1 / 0, d = 0, m = 0, g = 0;
2021
2043
  for (let P = i; P <= r; P++) {
2022
2044
  const U = (_ = h.children) == null ? void 0 : _[P];
2023
2045
  if (!U)
2024
2046
  return e.removeSummary(n), null;
2025
- const H = qn(U.id), { offsetLeft: J, offsetTop: ve } = O(c, H);
2026
- P === i && (m = ve), P === r && (g = ve + H.offsetHeight), J < u && (u = J), H.offsetWidth + J > d && (d = H.offsetWidth + J);
2047
+ const H = qn(U.id), { offsetLeft: Q, offsetTop: ve } = O(c, H);
2048
+ P === i && (m = ve), P === r && (g = ve + H.offsetHeight), Q < u && (u = Q), H.offsetWidth + Q > d && (d = H.offsetWidth + Q);
2027
2049
  }
2028
2050
  let p, f;
2029
2051
  const v = m + 10, b = g + 10, y = (v + b) / 2, x = e.theme.cssVar["--color"];
2030
- a === "lhs" ? (p = ke(`M ${u + 10} ${v} c -5 0 -10 5 -10 10 L ${u} ${b - 10} c 0 5 5 10 10 10 M ${u} ${y} h -10`, x), f = Ae(o, u - 20, y + 6, "end", x)) : (p = ke(`M ${d - 10} ${v} c 5 0 10 5 10 10 L ${d} ${b - 10} c 0 5 -5 10 -10 10 M ${d} ${y} h 10`, x), f = Ae(o, d + 20, y + 6, "start", x));
2052
+ a === "lhs" ? (p = Te(`M ${u + 10} ${v} c -5 0 -10 5 -10 10 L ${u} ${b - 10} c 0 5 5 10 10 10 M ${u} ${y} h -10`, x), f = Ae(o, u - 20, y + 6, "end", x)) : (p = Te(`M ${d - 10} ${v} c 5 0 10 5 10 10 L ${d} ${b - 10} c 0 5 -5 10 -10 10 M ${d} ${y} h 10`, x), f = Ae(o, d + 20, y + 6, "start", x));
2031
2053
  const w = Rn("s-" + n);
2032
2054
  return w.appendChild(p), w.appendChild(f), w.summaryObj = t, e.summarySvg.appendChild(w), w;
2033
2055
  }, In = function() {
@@ -2047,7 +2069,7 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2047
2069
  });
2048
2070
  }, Vn = function(e) {
2049
2071
  const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2050
- C(s, {
2072
+ N(s, {
2051
2073
  x: t.x - n + "",
2052
2074
  y: t.y - n + "",
2053
2075
  width: t.width + n * 2 + "",
@@ -2090,7 +2112,7 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2090
2112
  }, Symbol.toStringTag, { value: "Module" })), M = "http://www.w3.org/2000/svg";
2091
2113
  function Gn(e, t) {
2092
2114
  const n = document.createElementNS(M, "svg");
2093
- return C(n, {
2115
+ return N(n, {
2094
2116
  version: "1.1",
2095
2117
  xmlns: M,
2096
2118
  height: e,
@@ -2106,7 +2128,7 @@ function Qn(e, t, n, o) {
2106
2128
  return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
2107
2129
  `).forEach((c, l) => {
2108
2130
  const h = document.createElementNS(M, "text");
2109
- C(h, {
2131
+ N(h, {
2110
2132
  x: n + parseInt(t.paddingLeft) + "",
2111
2133
  y: o + parseInt(t.paddingTop) + Jn(t.lineHeight, t.fontSize) * (l + 1) + parseFloat(t.fontSize) * (l + 1) + "",
2112
2134
  "text-anchor": "start",
@@ -2122,21 +2144,21 @@ function Zn(e, t, n, o) {
2122
2144
  let s = "";
2123
2145
  (c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
2124
2146
  const i = document.createElementNS(M, "foreignObject");
2125
- C(i, {
2147
+ N(i, {
2126
2148
  x: n + parseInt(t.paddingLeft) + "",
2127
2149
  y: o + parseInt(t.paddingTop) + "",
2128
2150
  width: t.width,
2129
2151
  height: t.height
2130
2152
  });
2131
2153
  const r = document.createElement("div");
2132
- return C(r, {
2154
+ return N(r, {
2133
2155
  xmlns: "http://www.w3.org/1999/xhtml",
2134
2156
  style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
2135
2157
  }), r.innerHTML = s, i.appendChild(r), i;
2136
2158
  }
2137
2159
  function eo(e, t) {
2138
2160
  const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "rect");
2139
- return C(i, {
2161
+ return N(i, {
2140
2162
  x: o + "",
2141
2163
  y: s + "",
2142
2164
  rx: n.borderRadius,
@@ -2148,9 +2170,9 @@ function eo(e, t) {
2148
2170
  "stroke-width": n.borderWidth
2149
2171
  }), i;
2150
2172
  }
2151
- function Z(e, t, n = !1) {
2173
+ function ee(e, t, n = !1) {
2152
2174
  const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), r = document.createElementNS(M, "rect");
2153
- C(r, {
2175
+ N(r, {
2154
2176
  x: s + "",
2155
2177
  y: i + "",
2156
2178
  rx: o.borderRadius,
@@ -2168,7 +2190,7 @@ function Z(e, t, n = !1) {
2168
2190
  }
2169
2191
  function to(e, t) {
2170
2192
  const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "a"), r = document.createElementNS(M, "text");
2171
- return C(r, {
2193
+ return N(r, {
2172
2194
  x: o + "",
2173
2195
  y: s + parseInt(n.fontSize) + "",
2174
2196
  "text-anchor": "start",
@@ -2180,7 +2202,7 @@ function to(e, t) {
2180
2202
  }
2181
2203
  function no(e, t) {
2182
2204
  const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "image");
2183
- return C(i, {
2205
+ return N(i, {
2184
2206
  x: o + "",
2185
2207
  y: s + "",
2186
2208
  width: n.width + "",
@@ -2188,10 +2210,10 @@ function no(e, t) {
2188
2210
  href: t.src
2189
2211
  }), i;
2190
2212
  }
2191
- const ee = 100, oo = '<?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">', so = (e, t = !1) => {
2213
+ const te = 100, oo = '<?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">', so = (e, t = !1) => {
2192
2214
  var u, d, m;
2193
- const n = e.nodes, o = n.offsetHeight + ee * 2, s = n.offsetWidth + ee * 2, i = Gn(o + "px", s + "px"), r = document.createElementNS(M, "svg"), c = document.createElementNS(M, "rect");
2194
- C(c, {
2215
+ const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = Gn(o + "px", s + "px"), r = document.createElementNS(M, "svg"), c = document.createElementNS(M, "rect");
2216
+ N(c, {
2195
2217
  x: "0",
2196
2218
  y: "0",
2197
2219
  width: `${s}`,
@@ -2207,18 +2229,18 @@ const ee = 100, oo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
2207
2229
  h && r.appendChild(h);
2208
2230
  const a = (m = n.querySelector(".summary")) == null ? void 0 : m.cloneNode(!0);
2209
2231
  return a && r.appendChild(a), n.querySelectorAll("me-tpc").forEach((g) => {
2210
- g.nodeObj.dangerouslySetInnerHTML ? r.appendChild(Z(e, g, !t)) : (r.appendChild(eo(e, g)), r.appendChild(Z(e, g.text, !t)));
2232
+ g.nodeObj.dangerouslySetInnerHTML ? r.appendChild(ee(e, g, !t)) : (r.appendChild(eo(e, g)), r.appendChild(ee(e, g.text, !t)));
2211
2233
  }), n.querySelectorAll(".tags > span").forEach((g) => {
2212
- r.appendChild(Z(e, g));
2234
+ r.appendChild(ee(e, g));
2213
2235
  }), n.querySelectorAll(".icons > span").forEach((g) => {
2214
- r.appendChild(Z(e, g));
2236
+ r.appendChild(ee(e, g));
2215
2237
  }), n.querySelectorAll(".hyper-link").forEach((g) => {
2216
2238
  r.appendChild(to(e, g));
2217
2239
  }), n.querySelectorAll("img").forEach((g) => {
2218
2240
  r.appendChild(no(e, g));
2219
- }), C(r, {
2220
- x: ee + "",
2221
- y: ee + "",
2241
+ }), N(r, {
2242
+ x: te + "",
2243
+ y: te + "",
2222
2244
  overflow: "visible"
2223
2245
  }), i.appendChild(r), i;
2224
2246
  }, io = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), oo + e.outerHTML);
@@ -2255,13 +2277,13 @@ function ho(e, t) {
2255
2277
  o && !await o.apply(this, n) || e.apply(this, n);
2256
2278
  };
2257
2279
  }
2258
- const je = Object.keys(Ye), Ze = {};
2280
+ const je = Object.keys(Ue), Ze = {};
2259
2281
  for (let e = 0; e < je.length; e++) {
2260
2282
  const t = je[e];
2261
- Ze[t] = ho(Ye[t], t);
2283
+ Ze[t] = ho(Ue[t], t);
2262
2284
  }
2263
2285
  const uo = {
2264
- getObjById: ne,
2286
+ getObjById: oe,
2265
2287
  generateNewObj: nt,
2266
2288
  layout: it,
2267
2289
  linkDiv: pt,
@@ -2270,9 +2292,9 @@ const uo = {
2270
2292
  createParent: at,
2271
2293
  createChildren: dt,
2272
2294
  createTopic: ht,
2273
- findEle: N,
2295
+ findEle: C,
2274
2296
  changeTheme: zt,
2275
- ...ln,
2297
+ ...Ln,
2276
2298
  ...Ze,
2277
2299
  ...Bn,
2278
2300
  ...Xn,
@@ -2280,7 +2302,11 @@ const uo = {
2280
2302
  init(e) {
2281
2303
  if (!e || !e.nodeData)
2282
2304
  return new Error("MindElixir: `data` is required");
2283
- e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && kt(this), this.keypress && wt(this), this.editable && Bt(this), et() && this.mobileMenu ? Et(this) : this.contextMenu && mt(this, this.contextMenuOption), this.draggable && _t(this), this.allowUndo && Mt(this), this.toCenter(), this.layout(), this.linkDiv();
2305
+ e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Tt(this), this.keypress && wt(this), this.editable && Bt(this), et() && this.mobileMenu ? Et(this) : this.contextMenu && this.disposable.push(mt(this, this.contextMenuOption)), this.draggable && _t(this), this.allowUndo && Mt(this), this.toCenter(), this.layout(), this.linkDiv();
2306
+ },
2307
+ destroy() {
2308
+ var e, t;
2309
+ this.disposable.forEach((n) => n()), (e = this.mindElixirBox) == null || e.remove(), this.mindElixirBox = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNode = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (t = this.selection) == null || t.destroy(), this.selection = void 0;
2284
2310
  }
2285
2311
  };
2286
2312
  function fo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: h }) {
@@ -2300,7 +2326,7 @@ function po({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
2300
2326
  return l === "lhs" ? (p = t, m = p + D, g = p - D, u = i + D, `M ${m} ${a} C ${p} ${a} ${p + f} ${d} ${g} ${d} H ${u}`) : (p = t + n, m = p - D, g = p + D, u = i + r - D, `M ${m} ${a} C ${p} ${a} ${p - f} ${d} ${g} ${d} H ${u}`);
2301
2327
  }
2302
2328
  const Y = document;
2303
- function k({
2329
+ function T({
2304
2330
  el: e,
2305
2331
  direction: t,
2306
2332
  locale: n,
@@ -2324,28 +2350,27 @@ function k({
2324
2350
  const y = Object.prototype.toString.call(e);
2325
2351
  if (y === "[object HTMLDivElement]" ? b = e : y === "[object String]" && (b = document.querySelector(e)), !b)
2326
2352
  throw new Error("MindElixir: el is not a valid element");
2327
- b.className += " mind-elixir", b.innerHTML = "", b.style.setProperty("--gap", D + "px"), this.mindElixirBox = b, this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = h || 0, this.mobileMenu = f || !1, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = u || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = d === void 0 ? !1 : d, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = m || fo, this.generateSubBranch = g || po, this.overflowHidden = p || !1, this.bus = st.create(), this.container = Y.createElement("div"), this.container.className = "map-container";
2353
+ b.className += " mind-elixir", b.innerHTML = "", b.style.setProperty("--gap", D + "px"), this.mindElixirBox = b, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = h || 0, this.mobileMenu = f || !1, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = u || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = d === void 0 ? !1 : d, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = m || fo, this.generateSubBranch = g || po, this.overflowHidden = p || !1, this.bus = st.create(), this.container = Y.createElement("div"), this.container.className = "map-container";
2328
2354
  const x = window.matchMedia("(prefers-color-scheme: dark)");
2329
2355
  this.theme = v || (x.matches ? $e : De);
2330
2356
  const w = Y.createElement("div");
2331
2357
  w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = Y.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = X("lines"), this.summarySvg = X("summary"), this.linkController = X("linkcontroller"), this.P2 = Y.createElement("div"), this.P3 = Y.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = be(), this.line2 = be(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = X("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : ot(this);
2332
2358
  }
2333
- k.prototype = uo;
2334
- k.LEFT = T;
2335
- k.RIGHT = z;
2336
- k.SIDE = ie;
2337
- k.THEME = De;
2338
- k.DARK_THEME = $e;
2339
- k.version = "4.0.4";
2340
- k.E = N;
2341
- k.new = (e) => ({
2359
+ T.prototype = uo;
2360
+ T.LEFT = k;
2361
+ T.RIGHT = z;
2362
+ T.SIDE = re;
2363
+ T.THEME = De;
2364
+ T.DARK_THEME = $e;
2365
+ T.version = "4.1.1";
2366
+ T.E = C;
2367
+ T.new = (e) => ({
2342
2368
  nodeData: {
2343
2369
  id: G(),
2344
2370
  topic: e || "new topic",
2345
- root: !0,
2346
2371
  children: []
2347
2372
  }
2348
2373
  });
2349
2374
  export {
2350
- k as default
2375
+ T as default
2351
2376
  };