mind-elixir 5.2.1 → 5.3.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.
@@ -1,4 +1,4 @@
1
- const nt = {
1
+ const et = {
2
2
  name: "Latte",
3
3
  type: "light",
4
4
  palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
@@ -24,7 +24,7 @@ const nt = {
24
24
  "--panel-border-color": "#eaeaea",
25
25
  "--map-padding": "50px"
26
26
  }
27
- }, ot = {
27
+ }, nt = {
28
28
  name: "Dark",
29
29
  type: "dark",
30
30
  palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
@@ -51,7 +51,7 @@ const nt = {
51
51
  "--map-padding": "50px 80px"
52
52
  }
53
53
  };
54
- function $t(t) {
54
+ function Tt(t) {
55
55
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
56
56
  }
57
57
  const q = function(t, e) {
@@ -60,63 +60,54 @@ const q = function(t, e) {
60
60
  if (e.children && e.children.length) {
61
61
  for (let n = 0; n < e.children.length; n++) {
62
62
  const o = q(t, e.children[n]);
63
- if (o)
64
- return o;
63
+ if (o) return o;
65
64
  }
66
65
  return null;
67
66
  } else
68
67
  return null;
69
- }, st = (t, e) => {
68
+ }, ot = (t, e) => {
70
69
  if (t.parent = e, t.children)
71
70
  for (let n = 0; n < t.children.length; n++)
72
- st(t.children[n], t);
73
- }, tt = (t, e, n) => {
74
- if (t.expanded = e, t.children)
75
- if (n === void 0 || n > 0) {
76
- const o = n !== void 0 ? n - 1 : void 0;
77
- t.children.forEach((s) => {
78
- tt(s, e, o);
79
- });
80
- } else
81
- t.children.forEach((o) => {
82
- tt(o, !1);
83
- });
71
+ ot(t.children[n], t);
72
+ }, gt = (t, e, n) => {
73
+ t.expanded = e, t.children && t.children.forEach((o) => {
74
+ gt(o, e);
75
+ });
84
76
  };
85
77
  function _(t, e, n, o) {
86
78
  const s = o - e, i = t - n;
87
79
  let r = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
88
- if (isNaN(r))
89
- return;
80
+ if (isNaN(r)) return;
90
81
  i < 0 && s > 0 && (r = 180 - r), i < 0 && s < 0 && (r = 180 + r), i > 0 && s < 0 && (r = 360 - r);
91
- const c = 12, a = 30, d = r + a, u = r - a;
82
+ const c = 12, a = 30, h = r + a, f = r - a;
92
83
  return {
93
- x1: n + Math.cos(Math.PI * d / 180) * c,
94
- y1: o - Math.sin(Math.PI * d / 180) * c,
95
- x2: n + Math.cos(Math.PI * u / 180) * c,
96
- y2: o - Math.sin(Math.PI * u / 180) * c
84
+ x1: n + Math.cos(Math.PI * h / 180) * c,
85
+ y1: o - Math.sin(Math.PI * h / 180) * c,
86
+ x2: n + Math.cos(Math.PI * f / 180) * c,
87
+ y2: o - Math.sin(Math.PI * f / 180) * c
97
88
  };
98
89
  }
99
90
  function V() {
100
91
  return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
101
92
  }
102
- const Dt = function() {
93
+ const $t = function() {
103
94
  const t = V();
104
95
  return {
105
96
  topic: this.newTopicName,
106
97
  id: t
107
98
  };
108
- }, A = (t, e) => {
99
+ }, D = (t, e) => {
109
100
  let n = 0, o = 0;
110
101
  for (; e && e !== t; )
111
102
  n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
112
103
  return { offsetLeft: n, offsetTop: o };
113
- }, L = (t, e) => {
104
+ }, E = (t, e) => {
114
105
  for (const n in e)
115
106
  t.setAttribute(n, e[n]);
116
- }, dt = (t) => t ? t.tagName === "ME-TPC" : !1, yt = (t) => {
107
+ }, at = (t) => t ? t.tagName === "ME-TPC" : !1, mt = (t) => {
117
108
  const e = /translate\(([^,]+),\s*([^)]+)\)/, n = t.match(e);
118
109
  return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
119
- }, wt = function(t) {
110
+ }, yt = function(t) {
120
111
  for (let e = 0; e < t.length; e++) {
121
112
  const { dom: n, evt: o, func: s } = t[e];
122
113
  n.addEventListener(o, s);
@@ -127,10 +118,10 @@ const Dt = function() {
127
118
  o.removeEventListener(s, i);
128
119
  }
129
120
  };
130
- }, W = {
121
+ }, I = {
131
122
  LHS: "lhs",
132
123
  RHS: "rhs"
133
- }, ft = function(t, e, n) {
124
+ }, ht = function(t, e, n) {
134
125
  const { scaleVal: o, scaleSensitivity: s } = t;
135
126
  switch (e) {
136
127
  case "in":
@@ -140,19 +131,17 @@ const Dt = function() {
140
131
  t.scale(o - s, n);
141
132
  }
142
133
  };
143
- function At(t) {
134
+ function Dt(t) {
144
135
  const { dragMoveHelper: e } = t;
145
136
  let n = 0;
146
137
  t.spacePressed = !1;
147
138
  const o = (l) => {
148
- var b, C;
149
- if (l.button !== 0)
150
- return;
151
- if ((b = t.helper1) != null && b.moved) {
139
+ if (l.button !== 0) return;
140
+ if (t.helper1?.moved) {
152
141
  t.helper1.clear();
153
142
  return;
154
143
  }
155
- if ((C = t.helper2) != null && C.moved) {
144
+ if (t.helper2?.moved) {
156
145
  t.helper2.clear();
157
146
  return;
158
147
  }
@@ -160,124 +149,119 @@ function At(t) {
160
149
  e.clear();
161
150
  return;
162
151
  }
163
- const h = l.target;
164
- if (h.tagName === "ME-EPD")
165
- l.ctrlKey || l.metaKey ? t.expandNodeAll(h.previousSibling) : t.expandNode(h.previousSibling);
166
- else if (h.tagName === "ME-TPC" && t.currentNodes.length > 1)
167
- t.selectNode(h);
152
+ const d = l.target;
153
+ if (d.tagName === "ME-EPD")
154
+ l.ctrlKey || l.metaKey ? t.expandNodeAll(d.previousSibling) : t.expandNode(d.previousSibling);
155
+ else if (d.tagName === "ME-TPC" && t.currentNodes.length > 1)
156
+ t.selectNode(d);
168
157
  else if (!t.editable)
169
158
  return;
170
- if (h.classList.contains("svg-label")) {
171
- const x = h.dataset.svgId, S = h.dataset.type, E = document.getElementById(x);
172
- if (E) {
173
- if (S === "arrow") {
174
- t.selectArrow(E);
159
+ if (d.classList.contains("svg-label")) {
160
+ const b = d.dataset.svgId, x = d.dataset.type, C = document.getElementById(b);
161
+ if (C) {
162
+ if (x === "arrow") {
163
+ t.selectArrow(C);
175
164
  return;
176
- } else if (S === "summary") {
177
- t.selectSummary(E);
165
+ } else if (x === "summary") {
166
+ t.selectSummary(C);
178
167
  return;
179
168
  }
180
169
  }
181
170
  }
182
- if (h.closest(".topiclinks")) {
183
- const x = h.closest("g");
184
- if (x) {
185
- t.selectArrow(x);
171
+ if (d.closest(".topiclinks")) {
172
+ const b = d.closest("g");
173
+ if (b) {
174
+ t.selectArrow(b);
186
175
  return;
187
176
  }
188
177
  }
189
- if (h.closest(".summary")) {
190
- const x = h.closest("g");
191
- if (x) {
192
- t.selectSummary(x);
178
+ if (d.closest(".summary")) {
179
+ const b = d.closest("g");
180
+ if (b) {
181
+ t.selectSummary(b);
193
182
  return;
194
183
  }
195
184
  }
196
185
  }, s = (l) => {
197
- if (!t.editable)
198
- return;
199
- const h = l.target;
200
- if (dt(h) && t.beginEdit(h), h.classList.contains("svg-label")) {
201
- const b = h.dataset.svgId, C = h.dataset.type, x = document.getElementById(b);
202
- if (x) {
203
- if (C === "arrow") {
204
- t.editArrowLabel(x);
186
+ if (!t.editable) return;
187
+ const d = l.target;
188
+ if (at(d) && t.beginEdit(d), d.classList.contains("svg-label")) {
189
+ const b = d.dataset.svgId, x = d.dataset.type, C = document.getElementById(b);
190
+ if (C) {
191
+ if (x === "arrow") {
192
+ t.editArrowLabel(C);
205
193
  return;
206
- } else if (C === "summary") {
207
- t.editSummary(x);
194
+ } else if (x === "summary") {
195
+ t.editSummary(C);
208
196
  return;
209
197
  }
210
198
  }
211
199
  }
212
- if (h.closest(".topiclinks")) {
213
- const b = h.closest("g");
200
+ if (d.closest(".topiclinks")) {
201
+ const b = d.closest("g");
214
202
  if (b) {
215
203
  t.editArrowLabel(b);
216
204
  return;
217
205
  }
218
206
  }
219
- if (h.closest(".summary")) {
220
- const b = h.closest("g");
207
+ if (d.closest(".summary")) {
208
+ const b = d.closest("g");
221
209
  if (b) {
222
210
  t.editSummary(b);
223
211
  return;
224
212
  }
225
213
  }
226
214
  }, i = (l) => {
227
- if (l.pointerType === "mouse")
228
- return;
229
- const h = (/* @__PURE__ */ new Date()).getTime(), y = h - n;
230
- y < 300 && y > 0 && s(l), n = h;
215
+ if (l.pointerType === "mouse") return;
216
+ const d = (/* @__PURE__ */ new Date()).getTime(), w = d - n;
217
+ w < 300 && w > 0 && s(l), n = d;
231
218
  }, r = (l) => {
232
219
  l.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"), l.preventDefault());
233
220
  }, c = (l) => {
234
221
  l.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
235
222
  }, a = (l) => {
236
223
  e.moved = !1;
237
- const h = t.spacePressed && l.button === 0 && l.pointerType === "mouse", y = t.mouseSelectionButton === 0 ? 2 : 0, v = l.button === y && l.pointerType === "mouse";
238
- if (!h && !v)
239
- return;
224
+ const d = t.spacePressed && l.button === 0 && l.pointerType === "mouse", w = t.mouseSelectionButton === 0 ? 2 : 0, v = l.button === w && l.pointerType === "mouse";
225
+ if (!d && !v) return;
240
226
  e.x = l.clientX, e.y = l.clientY;
241
227
  const b = l.target;
242
- (h || b.className !== "circle" && b.contentEditable !== "plaintext-only") && (e.mousedown = !0, b.setPointerCapture(l.pointerId));
243
- }, d = (l) => {
228
+ (d || b.className !== "circle" && b.contentEditable !== "plaintext-only") && (e.mousedown = !0, b.setPointerCapture(l.pointerId));
229
+ }, h = (l) => {
244
230
  if (l.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
245
- const h = l.clientX - e.x, y = l.clientY - e.y;
246
- e.onMove(h, y);
231
+ const d = l.clientX - e.x, w = l.clientY - e.y;
232
+ e.onMove(d, w);
247
233
  }
248
234
  e.x = l.clientX, e.y = l.clientY;
249
- }, u = (l) => {
250
- if (!e.mousedown)
251
- return;
252
- const h = l.target;
253
- h.hasPointerCapture && h.hasPointerCapture(l.pointerId) && h.releasePointerCapture(l.pointerId), e.clear();
235
+ }, f = (l) => {
236
+ if (!e.mousedown) return;
237
+ const d = l.target;
238
+ d.hasPointerCapture && d.hasPointerCapture(l.pointerId) && d.releasePointerCapture(l.pointerId), e.clear();
254
239
  }, p = () => {
255
240
  e.mousedown && e.clear();
256
- }, g = (l) => {
257
- if (l.preventDefault(), l.button !== 2 || !t.editable)
258
- return;
259
- const h = l.target;
260
- dt(h) && !h.classList.contains("selected") && t.selectNode(h), setTimeout(() => {
241
+ }, m = (l) => {
242
+ if (l.preventDefault(), l.button !== 2 || !t.editable) return;
243
+ const d = l.target;
244
+ at(d) && !d.classList.contains("selected") && t.selectNode(d), setTimeout(() => {
261
245
  t.dragMoveHelper.moved || t.bus.fire("showContextMenu", l);
262
246
  }, 200);
263
- }, w = (l) => {
264
- l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey ? l.deltaY < 0 ? ft(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && ft(t, "out", t.dragMoveHelper) : l.shiftKey ? t.move(-l.deltaY, 0) : t.move(-l.deltaX, -l.deltaY);
265
- }, { container: f } = t;
266
- return wt([
267
- { dom: f, evt: "pointerdown", func: a },
268
- { dom: f, evt: "pointermove", func: d },
269
- { dom: f, evt: "pointerup", func: u },
270
- { dom: f, evt: "pointerup", func: i },
271
- { dom: f, evt: "click", func: o },
272
- { dom: f, evt: "dblclick", func: s },
273
- { dom: f, evt: "contextmenu", func: g },
274
- { dom: f, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : w },
275
- { dom: f, evt: "blur", func: p },
247
+ }, y = (l) => {
248
+ l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey ? l.deltaY < 0 ? ht(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && ht(t, "out", t.dragMoveHelper) : l.shiftKey ? t.move(-l.deltaY, 0) : t.move(-l.deltaX, -l.deltaY);
249
+ }, { container: g } = t;
250
+ return yt([
251
+ { dom: g, evt: "pointerdown", func: a },
252
+ { dom: g, evt: "pointermove", func: h },
253
+ { dom: g, evt: "pointerup", func: f },
254
+ { dom: g, evt: "pointerup", func: i },
255
+ { dom: g, evt: "click", func: o },
256
+ { dom: g, evt: "dblclick", func: s },
257
+ { dom: g, evt: "contextmenu", func: m },
258
+ { dom: g, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : y },
259
+ { dom: g, evt: "blur", func: p },
276
260
  { dom: document, evt: "keydown", func: r },
277
261
  { dom: document, evt: "keyup", func: c }
278
262
  ]);
279
263
  }
280
- function Nt() {
264
+ function At() {
281
265
  return {
282
266
  handlers: {},
283
267
  addListener: function(t, e) {
@@ -291,8 +275,7 @@ function Nt() {
291
275
  }
292
276
  },
293
277
  removeListener: function(t, e) {
294
- if (!this.handlers[t])
295
- return;
278
+ if (!this.handlers[t]) return;
296
279
  const n = this.handlers[t];
297
280
  if (!e)
298
281
  n.length = 0;
@@ -302,10 +285,10 @@ function Nt() {
302
285
  }
303
286
  };
304
287
  }
305
- const U = document, Mt = function() {
288
+ const U = document, Nt = function() {
306
289
  this.nodes.innerHTML = "";
307
290
  const t = this.createTopic(this.nodeData);
308
- vt.call(this, t, this.nodeData), t.draggable = !1;
291
+ bt.call(this, t, this.nodeData), t.draggable = !1;
309
292
  const e = U.createElement("me-root");
310
293
  e.appendChild(t);
311
294
  const n = this.nodeData.children || [];
@@ -315,30 +298,29 @@ const U = document, Mt = function() {
315
298
  i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
316
299
  });
317
300
  }
318
- Pt(this, n, e);
319
- }, Pt = function(t, e, n) {
301
+ Mt(this, n, e);
302
+ }, Mt = function(t, e, n) {
320
303
  const o = U.createElement("me-main");
321
- o.className = W.LHS;
304
+ o.className = I.LHS;
322
305
  const s = U.createElement("me-main");
323
- s.className = W.RHS;
306
+ s.className = I.RHS;
324
307
  for (let i = 0; i < e.length; i++) {
325
308
  const r = e[i], { grp: c } = t.createWrapper(r);
326
309
  t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
327
310
  }
328
311
  t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
329
- }, Ht = function(t, e) {
312
+ }, Pt = function(t, e) {
330
313
  const n = U.createElement("me-children");
331
314
  for (let o = 0; o < e.length; o++) {
332
315
  const s = e[o], { grp: i } = t.createWrapper(s);
333
316
  n.appendChild(i);
334
317
  }
335
318
  return n;
336
- }, k = document, bt = function(t, e) {
337
- const o = (this != null && this.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
338
- if (!o)
339
- throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
319
+ }, k = document, wt = function(t, e) {
320
+ const o = (this?.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
321
+ if (!o) throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
340
322
  return o;
341
- }, vt = function(t, e) {
323
+ }, bt = function(t, e) {
342
324
  if (t.innerHTML = "", e.style) {
343
325
  const n = e.style;
344
326
  for (const o in n)
@@ -354,8 +336,7 @@ const U = document, Mt = function() {
354
336
  const o = k.createElement("img");
355
337
  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), t.appendChild(o), t.image = o;
356
338
  }
357
- } else
358
- t.image && (t.image = void 0);
339
+ } else t.image && (t.image = void 0);
359
340
  {
360
341
  const n = k.createElement("span");
361
342
  n.className = "text", this.markdown ? n.innerHTML = this.markdown(e.topic, e) : n.textContent = e.topic, t.appendChild(n), t.text = n;
@@ -363,51 +344,47 @@ const U = document, Mt = function() {
363
344
  if (e.hyperLink) {
364
345
  const n = k.createElement("a");
365
346
  n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = e.hyperLink, t.appendChild(n), t.link = n;
366
- } else
367
- t.link && (t.link = void 0);
347
+ } else t.link && (t.link = void 0);
368
348
  if (e.icons && e.icons.length) {
369
349
  const n = k.createElement("span");
370
- n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${$t(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
371
- } else
372
- t.icons && (t.icons = void 0);
350
+ n.className = "icons", n.innerHTML = e.icons.map((o) => `<span>${Tt(o)}</span>`).join(""), t.appendChild(n), t.icons = n;
351
+ } else t.icons && (t.icons = void 0);
373
352
  if (e.tags && e.tags.length) {
374
353
  const n = k.createElement("div");
375
354
  n.className = "tags", e.tags.forEach((o) => {
376
355
  const s = k.createElement("span");
377
356
  typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
378
357
  }), t.appendChild(n), t.tags = n;
379
- } else
380
- t.tags && (t.tags = void 0);
381
- }, Bt = function(t, e) {
358
+ } else t.tags && (t.tags = void 0);
359
+ }, Ht = function(t, e) {
382
360
  const n = k.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
383
361
  if (n.appendChild(o), !e && t.children && t.children.length > 0) {
384
- const i = Ft(t.expanded);
362
+ const i = Gt(t.expanded);
385
363
  if (o.appendChild(i), t.expanded !== !1) {
386
- const r = Ht(this, t.children);
364
+ const r = Pt(this, t.children);
387
365
  n.appendChild(r);
388
366
  }
389
367
  }
390
368
  return { grp: n, top: o, tpc: s };
391
- }, It = function(t) {
369
+ }, Bt = function(t) {
392
370
  const e = k.createElement("me-parent"), n = this.createTopic(t);
393
- return vt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
394
- }, Wt = function(t) {
371
+ return bt.call(this, n, t), e.appendChild(n), { p: e, tpc: n };
372
+ }, It = function(t) {
395
373
  const e = k.createElement("me-children");
396
374
  return e.append(...t), e;
397
- }, Ot = function(t) {
375
+ }, Wt = function(t) {
398
376
  const e = k.createElement("me-tpc");
399
377
  return e.nodeObj = t, e.dataset.nodeid = "me" + t.id, e.draggable = this.draggable, e;
400
378
  };
401
- function xt(t) {
379
+ function vt(t) {
402
380
  const e = k.createRange();
403
381
  e.selectNodeContents(t);
404
382
  const n = window.getSelection();
405
383
  n && (n.removeAllRanges(), n.addRange(e));
406
384
  }
407
- const Gt = function(t) {
408
- if (!t)
409
- return;
410
- const e = k.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = A(this.nodes, t);
385
+ const Ot = function(t) {
386
+ if (!t) return;
387
+ const e = k.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = D(this.nodes, t);
411
388
  this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
412
389
  const r = getComputedStyle(t);
413
390
  e.style.cssText = `
@@ -419,57 +396,54 @@ const Gt = function(t) {
419
396
  margin:${r.margin};
420
397
  background-color:${r.backgroundColor !== "rgba(0, 0, 0, 0)" && r.backgroundColor};
421
398
  border: ${r.border};
422
- border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), xt(e), this.bus.fire("operation", {
399
+ border-radius:${r.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), vt(e), this.bus.fire("operation", {
423
400
  name: "beginEdit",
424
401
  obj: t.nodeObj
425
402
  }), e.addEventListener("keydown", (c) => {
426
403
  c.stopPropagation();
427
404
  const a = c.key;
428
405
  if (a === "Enter" || a === "Tab") {
429
- if (c.shiftKey)
430
- return;
406
+ if (c.shiftKey) return;
431
407
  c.preventDefault(), e.blur(), this.container.focus();
432
408
  }
433
409
  }), e.addEventListener("blur", () => {
434
- var a;
435
- if (!e)
436
- return;
410
+ if (!e) return;
437
411
  e.remove();
438
- const c = ((a = e.textContent) == null ? void 0 : a.trim()) || "";
412
+ const c = e.textContent?.trim() || "";
439
413
  c === o || c === "" || (n.topic = c, this.markdown ? t.text.innerHTML = this.markdown(n.topic, n) : t.text.textContent = c, this.linkDiv(), this.bus.fire("operation", {
440
414
  name: "finishEdit",
441
415
  obj: n,
442
416
  origin: o
443
417
  }));
444
418
  });
445
- }, Ft = function(t) {
419
+ }, Gt = function(t) {
446
420
  const e = k.createElement("me-epd");
447
421
  return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
448
- }, I = document, D = "http://www.w3.org/2000/svg", J = function(t) {
422
+ }, B = document, $ = "http://www.w3.org/2000/svg", J = function(t) {
449
423
  const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), i = Number(o.y), r = o.anchor;
450
424
  let c = s;
451
425
  r === "middle" ? c = s - e / 2 : r === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
452
- }, et = function(t, e, n, o) {
426
+ }, tt = function(t, e, n, o) {
453
427
  const { anchor: s = "middle", color: i, dataType: r, svgId: c } = o, a = document.createElement("div");
454
428
  a.className = "svg-label", a.style.color = i || "#666";
455
- const d = "label-" + c;
456
- return a.id = d, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = c, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
457
- }, Ct = function(t, e, n) {
458
- const o = I.createElementNS(D, "path");
459
- return L(o, {
429
+ const h = "label-" + c;
430
+ return a.id = h, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = c, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
431
+ }, xt = function(t, e, n) {
432
+ const o = B.createElementNS($, "path");
433
+ return E(o, {
460
434
  d: t,
461
435
  stroke: e || "#666",
462
436
  fill: "none",
463
437
  "stroke-width": n
464
438
  }), o;
465
439
  }, F = function(t) {
466
- const e = I.createElementNS(D, "svg");
440
+ const e = B.createElementNS($, "svg");
467
441
  return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
468
- }, ut = function() {
469
- const t = I.createElementNS(D, "line");
442
+ }, dt = function() {
443
+ const t = B.createElementNS($, "line");
470
444
  return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
471
- }, Vt = function(t, e, n, o) {
472
- const s = I.createElementNS(D, "g");
445
+ }, Ft = function(t, e, n, o) {
446
+ const s = B.createElementNS($, "g");
473
447
  return [
474
448
  {
475
449
  name: "line",
@@ -484,43 +458,39 @@ const Gt = function(t) {
484
458
  d: n
485
459
  }
486
460
  ].forEach((r, c) => {
487
- const a = r.d, d = I.createElementNS(D, "path"), u = {
461
+ const a = r.d, h = B.createElementNS($, "path"), f = {
488
462
  d: a,
489
- stroke: (o == null ? void 0 : o.stroke) || "rgb(227, 125, 116)",
463
+ stroke: o?.stroke || "rgb(227, 125, 116)",
490
464
  fill: "none",
491
- "stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
492
- "stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
465
+ "stroke-linecap": o?.strokeLinecap || "cap",
466
+ "stroke-width": String(o?.strokeWidth || "2")
493
467
  };
494
- (o == null ? void 0 : o.opacity) !== void 0 && (u.opacity = String(o.opacity)), L(d, u), c === 0 && d.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
495
- const p = I.createElementNS(D, "path");
496
- L(p, {
468
+ o?.opacity !== void 0 && (f.opacity = String(o.opacity)), E(h, f), c === 0 && h.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
469
+ const p = B.createElementNS($, "path");
470
+ E(p, {
497
471
  d: a,
498
472
  stroke: "transparent",
499
473
  fill: "none",
500
474
  "stroke-width": "15"
501
- }), s.appendChild(p), s.appendChild(d), s[r.name] = d;
475
+ }), s.appendChild(p), s.appendChild(h), s[r.name] = h;
502
476
  }), s;
503
- }, St = function(t, e, n) {
504
- if (!e)
505
- return;
477
+ }, Ct = function(t, e, n) {
478
+ if (!e) return;
506
479
  const o = n.label, s = e.cloneNode(!0);
507
480
  t.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
508
481
  left:${e.style.left};
509
482
  top:${e.style.top};
510
483
  max-width: 200px;
511
- `, xt(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
484
+ `, vt(s), t.scrollIntoView(s), s.addEventListener("keydown", (i) => {
512
485
  i.stopPropagation();
513
486
  const r = i.key;
514
487
  if (r === "Enter" || r === "Tab") {
515
- if (i.shiftKey)
516
- return;
488
+ if (i.shiftKey) return;
517
489
  i.preventDefault(), s.blur(), t.container.focus();
518
490
  }
519
491
  }), s.addEventListener("blur", () => {
520
- var r;
521
- if (!s)
522
- return;
523
- const i = ((r = s.textContent) == null ? void 0 : r.trim()) || "";
492
+ if (!s) return;
493
+ const i = s.textContent?.trim() || "";
524
494
  i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (e.textContent = n.label, J(e), "parent" in n ? t.bus.fire("operation", {
525
495
  name: "finishEditSummary",
526
496
  obj: n
@@ -529,49 +499,45 @@ const Gt = function(t) {
529
499
  obj: n
530
500
  }));
531
501
  });
532
- }, Rt = function(t) {
502
+ }, Vt = function(t) {
533
503
  const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
534
504
  this.lines.innerHTML = "";
535
505
  for (let c = 0; c < r.length; c++) {
536
- const a = r[c], d = a.querySelector("me-tpc"), { offsetLeft: u, offsetTop: p } = A(this.nodes, d), g = d.offsetWidth, w = d.offsetHeight, f = a.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: p, cL: u, cW: g, cH: w, direction: f, containerHeight: this.nodes.offsetHeight }), l = this.theme.palette, h = d.nodeObj.branchColor || l[c % l.length];
537
- if (d.style.borderColor = h, this.lines.appendChild(Ct(m, h, "3")), t && t !== a)
506
+ const a = r[c], h = a.querySelector("me-tpc"), { offsetLeft: f, offsetTop: p } = D(this.nodes, h), m = h.offsetWidth, y = h.offsetHeight, g = a.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: p, cL: f, cW: m, cH: y, direction: g, containerHeight: this.nodes.offsetHeight }), l = this.theme.palette, d = h.nodeObj.branchColor || l[c % l.length];
507
+ if (h.style.borderColor = d, this.lines.appendChild(xt(u, d, "3")), t && t !== a)
538
508
  continue;
539
- const y = F("subLines"), v = a.lastChild;
540
- v.tagName === "svg" && v.remove(), a.appendChild(y), Et(this, y, h, a, f, !0);
509
+ const w = F("subLines"), v = a.lastChild;
510
+ v.tagName === "svg" && v.remove(), a.appendChild(w), St(this, w, d, a, g, !0);
541
511
  }
542
512
  this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
543
- }, Et = function(t, e, n, o, s, i) {
513
+ }, St = function(t, e, n, o, s, i) {
544
514
  const r = o.firstChild, c = o.children[1].children;
545
- if (c.length === 0)
546
- return;
547
- const a = r.offsetTop, d = r.offsetLeft, u = r.offsetWidth, p = r.offsetHeight;
548
- for (let g = 0; g < c.length; g++) {
549
- const w = c[g], f = w.firstChild, m = f.offsetTop, l = f.offsetLeft, h = f.offsetWidth, y = f.offsetHeight, v = f.firstChild.nodeObj.branchColor || n, b = t.generateSubBranch({ pT: a, pL: d, pW: u, pH: p, cT: m, cL: l, cW: h, cH: y, direction: s, isFirst: i });
550
- e.appendChild(Ct(b, v, "2"));
551
- const C = f.children[1];
552
- if (C) {
553
- if (!C.expanded)
554
- continue;
515
+ if (c.length === 0) return;
516
+ const a = r.offsetTop, h = r.offsetLeft, f = r.offsetWidth, p = r.offsetHeight;
517
+ for (let m = 0; m < c.length; m++) {
518
+ const y = c[m], g = y.firstChild, u = g.offsetTop, l = g.offsetLeft, d = g.offsetWidth, w = g.offsetHeight, v = g.firstChild.nodeObj.branchColor || n, b = t.generateSubBranch({ pT: a, pL: h, pW: f, pH: p, cT: u, cL: l, cW: d, cH: w, direction: s, isFirst: i });
519
+ e.appendChild(xt(b, v, "2"));
520
+ const x = g.children[1];
521
+ if (x) {
522
+ if (!x.expanded) continue;
555
523
  } else
556
524
  continue;
557
- Et(t, e, v, w, s);
525
+ St(t, e, v, y, s);
558
526
  }
559
- };
560
- const Yt = '<?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>', zt = '<?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>', jt = '<?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>', Xt = '<?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>', qt = '<?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>', _t = '<?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>', Ut = '<?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>';
561
- const Kt = {
562
- side: Yt,
563
- left: zt,
564
- right: jt,
565
- full: Xt,
566
- living: qt,
567
- zoomin: _t,
568
- zoomout: Ut
569
- }, P = (t, e) => {
527
+ }, Rt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', Yt = '<?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>', zt = '<?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>', jt = '<?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>', Xt = '<?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>', qt = '<?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>', _t = '<?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>', Ut = {
528
+ side: Rt,
529
+ left: Yt,
530
+ right: zt,
531
+ full: jt,
532
+ living: Xt,
533
+ zoomin: qt,
534
+ zoomout: _t
535
+ }, M = (t, e) => {
570
536
  const n = document.createElement("span");
571
- return n.id = t, n.innerHTML = Kt[e], n;
537
+ return n.id = t, n.innerHTML = Ut[e], n;
572
538
  };
573
- function Jt(t) {
574
- const e = document.createElement("div"), n = P("fullscreen", "full"), o = P("toCenter", "living"), s = P("zoomout", "zoomout"), i = P("zoomin", "zoomin"), r = document.createElement("span");
539
+ function Kt(t) {
540
+ const e = document.createElement("div"), n = M("fullscreen", "full"), o = M("toCenter", "living"), s = M("zoomout", "zoomout"), i = M("zoomin", "zoomin"), r = document.createElement("span");
575
541
  return r.innerText = "100%", e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb", n.onclick = () => {
576
542
  document.fullscreenElement === t.el ? document.exitFullscreen() : t.el.requestFullscreen();
577
543
  }, o.onclick = () => {
@@ -582,8 +548,8 @@ function Jt(t) {
582
548
  t.scale(t.scaleVal + t.scaleSensitivity);
583
549
  }, e;
584
550
  }
585
- function Qt(t) {
586
- const e = document.createElement("div"), n = P("tbltl", "left"), o = P("tbltr", "right"), s = P("tblts", "side");
551
+ function Jt(t) {
552
+ const e = document.createElement("div"), n = M("tbltl", "left"), o = M("tbltr", "right"), s = M("tblts", "side");
587
553
  return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
588
554
  t.initLeft();
589
555
  }, o.onclick = () => {
@@ -592,13 +558,13 @@ function Qt(t) {
592
558
  t.initSide();
593
559
  }, e;
594
560
  }
595
- function Zt(t) {
596
- t.container.append(Jt(t)), t.container.append(Qt(t));
561
+ function Qt(t) {
562
+ t.container.append(Kt(t)), t.container.append(Jt(t));
597
563
  }
598
- const te = function(t, e = !0) {
564
+ const Zt = function(t, e = !0) {
599
565
  this.theme = t;
600
566
  const o = {
601
- ...(t.type === "dark" ? ot : nt).cssVar,
567
+ ...(t.type === "dark" ? nt : et).cssVar,
602
568
  ...t.cssVar
603
569
  }, s = Object.keys(o);
604
570
  for (let i = 0; i < s.length; i++) {
@@ -606,11 +572,11 @@ const te = function(t, e = !0) {
606
572
  this.container.style.setProperty(r, o[r]);
607
573
  }
608
574
  e && this.refresh();
609
- }, ee = function(t) {
575
+ }, te = function(t) {
610
576
  const n = t.parentElement.parentElement.lastElementChild;
611
- (n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
577
+ n?.tagName === "svg" && n?.remove();
612
578
  };
613
- function ne(t) {
579
+ function ee(t) {
614
580
  return {
615
581
  nodeData: t.isFocusMode ? t.nodeDataBackup : t.nodeData,
616
582
  arrows: t.arrows,
@@ -619,77 +585,76 @@ function ne(t) {
619
585
  theme: t.theme
620
586
  };
621
587
  }
622
- const oe = function(t) {
588
+ const ne = function(t) {
623
589
  const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
624
590
  if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
625
- const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, a = o.top + o.height / 2, d = i - c, u = r - a;
626
- this.move(-d, -u, !0);
591
+ const i = n.left + n.width / 2, r = n.top + n.height / 2, c = o.left + o.width / 2, a = o.top + o.height / 2, h = i - c, f = r - a;
592
+ this.move(-h, -f, !0);
627
593
  }
628
- }, se = function(t, e, n) {
594
+ }, oe = function(t, e, n) {
629
595
  this.clearSelection(), this.scrollIntoView(t), this.selection.select(t), e && this.bus.fire("selectNewNode", t.nodeObj);
630
- }, ie = function(t) {
596
+ }, se = function(t) {
631
597
  this.selection.select(t);
632
- }, re = function(t) {
598
+ }, ie = function(t) {
633
599
  this.selection.deselect(t);
634
- }, ce = function() {
600
+ }, re = function() {
635
601
  this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
636
- }, le = function() {
637
- const t = ne(this);
602
+ }, ce = function() {
603
+ const t = ee(this);
638
604
  return JSON.stringify(t, (e, n) => {
639
605
  if (!(e === "parent" && typeof n != "string"))
640
606
  return n;
641
607
  });
642
- }, ae = function() {
608
+ }, le = function() {
643
609
  return JSON.parse(this.getDataString());
644
- }, he = function() {
610
+ }, ae = function() {
645
611
  this.editable = !0;
646
- }, de = function() {
612
+ }, he = function() {
647
613
  this.editable = !1;
648
- }, fe = function(t, e = { x: 0, y: 0 }) {
649
- if (t < this.scaleMin || t > this.scaleMax)
650
- return;
651
- const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = Lt(this), c = this.map.style.transform, { x: a, y: d } = yt(c), u = a - i, p = d - r, g = this.scaleVal, w = (-o + u) * (1 - t / g), f = (-s + p) * (1 - t / g);
652
- this.map.style.transform = `translate(${a - w}px, ${d - f}px) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
653
- }, ue = function() {
614
+ }, de = function(t, e = { x: 0, y: 0 }) {
615
+ if (t < this.scaleMin || t > this.scaleMax) return;
616
+ const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: i, dy: r } = Et(this), c = this.map.style.transform, { x: a, y: h } = mt(c), f = a - i, p = h - r, m = this.scaleVal, y = (-o + f) * (1 - t / m), g = (-s + p) * (1 - t / m);
617
+ this.map.style.transform = `translate(${a - y}px, ${h - g}px) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
618
+ }, fe = function() {
654
619
  const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
655
620
  this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
656
621
  }, pe = function(t, e, n = !1) {
657
622
  const { map: o, scaleVal: s, bus: i } = this, r = o.style.transform;
658
- let { x: c, y: a } = yt(r);
623
+ let { x: c, y: a } = mt(r);
659
624
  c += t, a += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
660
625
  o.style.transition = "none";
661
626
  }, 300)), o.style.transform = `translate(${c}px, ${a}px) scale(${s})`, i.fire("move", { dx: t, dy: e });
662
- }, Lt = (t) => {
627
+ }, Et = (t) => {
663
628
  const { container: e, map: n, nodes: o } = t, s = n.querySelector("me-root"), i = s.offsetTop, r = s.offsetLeft, c = s.offsetWidth, a = s.offsetHeight;
664
- let d, u;
665
- return t.alignment === "root" ? (d = e.offsetWidth / 2 - r - c / 2, u = e.offsetHeight / 2 - i - a / 2, n.style.transformOrigin = `${r + c / 2}px 50%`) : (d = (e.offsetWidth - o.offsetWidth) / 2, u = (e.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: d, dy: u };
666
- }, ge = function() {
667
- const { map: t } = this, { dx: e, dy: n } = Lt(this);
629
+ let h, f;
630
+ return t.alignment === "root" ? (h = e.offsetWidth / 2 - r - c / 2, f = e.offsetHeight / 2 - i - a / 2, n.style.transformOrigin = `${r + c / 2}px 50%`) : (h = (e.offsetWidth - o.offsetWidth) / 2, f = (e.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: h, dy: f };
631
+ }, ue = function() {
632
+ const { map: t } = this, { dx: e, dy: n } = Et(this);
668
633
  t.style.transform = `translate(${e}px, ${n}px) scale(${this.scaleVal})`;
669
- }, me = function(t) {
634
+ }, ge = function(t) {
670
635
  t(this);
671
- }, ye = function(t) {
636
+ }, me = function(t) {
672
637
  t.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = t.nodeObj, this.initRight(), this.toCenter());
673
- }, we = function() {
638
+ }, ye = function() {
674
639
  this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
675
- }, be = function() {
640
+ }, we = function() {
676
641
  this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
677
- }, ve = function() {
642
+ }, be = function() {
678
643
  this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
679
- }, xe = function() {
644
+ }, ve = function() {
680
645
  this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
681
- }, Ce = function(t) {
646
+ }, xe = function(t) {
682
647
  this.locale = t, this.refresh();
683
- }, Se = function(t, e) {
648
+ }, Ce = function(t, e) {
684
649
  const n = t.nodeObj;
685
650
  typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
686
651
  const o = t.getBoundingClientRect(), s = {
687
652
  x: o.left,
688
653
  y: o.top
689
654
  }, i = t.parentNode, r = i.children[1];
690
- if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", ee(t), n.expanded) {
655
+ if (r.expanded = n.expanded, r.className = n.expanded ? "minus" : "", te(t), n.expanded) {
691
656
  const p = this.createChildren(
692
- n.children.map((g) => this.createWrapper(g).grp)
657
+ n.children.map((m) => this.createWrapper(m).grp)
693
658
  );
694
659
  i.parentNode.appendChild(p);
695
660
  } else
@@ -698,47 +663,47 @@ const oe = function(t) {
698
663
  const c = t.getBoundingClientRect(), a = {
699
664
  x: c.left,
700
665
  y: c.top
701
- }, d = s.x - a.x, u = s.y - a.y;
702
- this.move(d, u), this.bus.fire("expandNode", n);
703
- }, Ee = function(t, e) {
666
+ }, h = s.x - a.x, f = s.y - a.y;
667
+ this.move(h, f), this.bus.fire("expandNode", n);
668
+ }, Se = function(t, e) {
704
669
  const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
705
670
  x: o.left,
706
671
  y: o.top
707
672
  };
708
- tt(n, e ?? !n.expanded), this.refresh();
673
+ gt(n, e ?? !n.expanded), this.refresh();
709
674
  const i = this.findEle(n.id).getBoundingClientRect(), r = {
710
675
  x: i.left,
711
676
  y: i.top
712
677
  }, c = s.x - r.x, a = s.y - r.y;
713
678
  this.move(c, a);
714
- }, Le = function(t) {
715
- this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), st(this.nodeData), this.layout(), this.linkDiv();
716
- }, ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
679
+ }, Ee = function(t) {
680
+ this.clearSelection(), t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), ot(this.nodeData), this.layout(), this.linkDiv();
681
+ }, Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
717
682
  __proto__: null,
718
- cancelFocus: we,
719
- clearSelection: ce,
720
- disableEdit: de,
721
- enableEdit: he,
722
- expandNode: Se,
723
- expandNodeAll: Ee,
724
- focusNode: ye,
725
- getData: ae,
726
- getDataString: le,
727
- initLeft: be,
728
- initRight: ve,
729
- initSide: xe,
730
- install: me,
683
+ cancelFocus: ye,
684
+ clearSelection: re,
685
+ disableEdit: he,
686
+ enableEdit: ae,
687
+ expandNode: Ce,
688
+ expandNodeAll: Se,
689
+ focusNode: me,
690
+ getData: le,
691
+ getDataString: ce,
692
+ initLeft: we,
693
+ initRight: be,
694
+ initSide: ve,
695
+ install: ge,
731
696
  move: pe,
732
- refresh: Le,
733
- scale: fe,
734
- scaleFit: ue,
735
- scrollIntoView: oe,
736
- selectNode: se,
737
- selectNodes: ie,
738
- setLocale: Ce,
739
- toCenter: ge,
740
- unselectNodes: re
741
- }, Symbol.toStringTag, { value: "Module" })), Te = function(t) {
697
+ refresh: Ee,
698
+ scale: de,
699
+ scaleFit: fe,
700
+ scrollIntoView: ne,
701
+ selectNode: oe,
702
+ selectNodes: se,
703
+ setLocale: xe,
704
+ toCenter: ue,
705
+ unselectNodes: ie
706
+ }, Symbol.toStringTag, { value: "Module" })), ke = function(t) {
742
707
  return {
743
708
  dom: t,
744
709
  moved: !1,
@@ -761,7 +726,7 @@ const oe = function(t) {
761
726
  },
762
727
  cb: null,
763
728
  init(e, n) {
764
- this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = wt([
729
+ this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = yt([
765
730
  { dom: e, evt: "pointermove", func: this.handlePointerMove },
766
731
  { dom: e, evt: "pointerleave", func: this.handleClear },
767
732
  { dom: e, evt: "pointerup", func: this.handleClear },
@@ -773,72 +738,71 @@ const oe = function(t) {
773
738
  this.moved = !1, this.pointerdown = !1;
774
739
  }
775
740
  };
776
- }, pt = {
777
- create: Te
778
- }, $e = "#4dc4ff";
779
- function kt(t, e, n, o, s, i, r, c) {
741
+ }, ft = {
742
+ create: ke
743
+ }, Te = "#4dc4ff";
744
+ function Lt(t, e, n, o, s, i, r, c) {
780
745
  return {
781
746
  x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
782
747
  y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
783
748
  };
784
749
  }
785
- function De(t, e, n) {
750
+ function $e(t, e, n) {
786
751
  t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), J(t));
787
752
  }
788
753
  function z(t, e, n, o, s) {
789
- L(t, {
754
+ E(t, {
790
755
  x1: e + "",
791
756
  y1: n + "",
792
757
  x2: o + "",
793
758
  y2: s + ""
794
759
  });
795
760
  }
796
- function gt(t, e, n, o, s, i, r, c, a, d) {
797
- var m;
798
- const u = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${a}`;
799
- if (t.line.setAttribute("d", u), d.style) {
800
- const l = d.style;
801
- l.stroke && t.line.setAttribute("stroke", l.stroke), l.strokeWidth && t.line.setAttribute("stroke-width", String(l.strokeWidth)), l.strokeDasharray && t.line.setAttribute("stroke-dasharray", l.strokeDasharray), l.strokeLinecap && t.line.setAttribute("stroke-linecap", l.strokeLinecap), l.opacity !== void 0 && t.line.setAttribute("opacity", String(l.opacity));
761
+ function pt(t, e, n, o, s, i, r, c, a, h) {
762
+ const f = `M ${e} ${n} C ${o} ${s} ${i} ${r} ${c} ${a}`;
763
+ if (t.line.setAttribute("d", f), h.style) {
764
+ const u = h.style;
765
+ u.stroke && t.line.setAttribute("stroke", u.stroke), u.strokeWidth && t.line.setAttribute("stroke-width", String(u.strokeWidth)), u.strokeDasharray && t.line.setAttribute("stroke-dasharray", u.strokeDasharray), u.strokeLinecap && t.line.setAttribute("stroke-linecap", u.strokeLinecap), u.opacity !== void 0 && t.line.setAttribute("opacity", String(u.opacity));
802
766
  }
803
767
  const p = t.querySelectorAll('path[stroke="transparent"]');
804
- p.length > 0 && p[0].setAttribute("d", u);
805
- const g = _(i, r, c, a);
806
- if (g) {
807
- const l = `M ${g.x1} ${g.y1} L ${c} ${a} L ${g.x2} ${g.y2}`;
808
- if (t.arrow1.setAttribute("d", l), p.length > 1 && p[1].setAttribute("d", l), d.style) {
809
- const h = d.style;
810
- h.stroke && t.arrow1.setAttribute("stroke", h.stroke), h.strokeWidth && t.arrow1.setAttribute("stroke-width", String(h.strokeWidth)), h.strokeLinecap && t.arrow1.setAttribute("stroke-linecap", h.strokeLinecap), h.opacity !== void 0 && t.arrow1.setAttribute("opacity", String(h.opacity));
768
+ p.length > 0 && p[0].setAttribute("d", f);
769
+ const m = _(i, r, c, a);
770
+ if (m) {
771
+ const u = `M ${m.x1} ${m.y1} L ${c} ${a} L ${m.x2} ${m.y2}`;
772
+ if (t.arrow1.setAttribute("d", u), p.length > 1 && p[1].setAttribute("d", u), h.style) {
773
+ const l = h.style;
774
+ l.stroke && t.arrow1.setAttribute("stroke", l.stroke), l.strokeWidth && t.arrow1.setAttribute("stroke-width", String(l.strokeWidth)), l.strokeLinecap && t.arrow1.setAttribute("stroke-linecap", l.strokeLinecap), l.opacity !== void 0 && t.arrow1.setAttribute("opacity", String(l.opacity));
811
775
  }
812
776
  }
813
- if (d.bidirectional) {
814
- const l = _(o, s, e, n);
815
- if (l) {
816
- const h = `M ${l.x1} ${l.y1} L ${e} ${n} L ${l.x2} ${l.y2}`;
817
- if (t.arrow2.setAttribute("d", h), p.length > 2 && p[2].setAttribute("d", h), d.style) {
818
- const y = d.style;
819
- y.stroke && t.arrow2.setAttribute("stroke", y.stroke), y.strokeWidth && t.arrow2.setAttribute("stroke-width", String(y.strokeWidth)), y.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", y.strokeLinecap), y.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(y.opacity));
777
+ if (h.bidirectional) {
778
+ const u = _(o, s, e, n);
779
+ if (u) {
780
+ const l = `M ${u.x1} ${u.y1} L ${e} ${n} L ${u.x2} ${u.y2}`;
781
+ if (t.arrow2.setAttribute("d", l), p.length > 2 && p[2].setAttribute("d", l), h.style) {
782
+ const d = h.style;
783
+ d.stroke && t.arrow2.setAttribute("stroke", d.stroke), d.strokeWidth && t.arrow2.setAttribute("stroke-width", String(d.strokeWidth)), d.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", d.strokeLinecap), d.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(d.opacity));
820
784
  }
821
785
  }
822
786
  }
823
- const { x: w, y: f } = kt(e, n, o, s, i, r, c, a);
824
- if (t.labelEl && De(t.labelEl, w, f), (m = d.style) != null && m.labelColor) {
825
- const l = t.labelEl;
826
- l && (l.style.color = d.style.labelColor);
787
+ const { x: y, y: g } = Lt(e, n, o, s, i, r, c, a);
788
+ if (t.labelEl && $e(t.labelEl, y, g), h.style?.labelColor) {
789
+ const u = t.labelEl;
790
+ u && (u.style.color = h.style.labelColor);
827
791
  }
828
- We(t);
792
+ Ie(t);
829
793
  }
830
794
  function K(t, e, n) {
831
- const { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, a = s + r / 2, d = c + n.x, u = a + n.y;
795
+ const { offsetLeft: o, offsetTop: s } = D(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, a = s + r / 2, h = c + n.x, f = a + n.y;
832
796
  return {
833
797
  w: i,
834
798
  h: r,
835
799
  cx: c,
836
800
  cy: a,
837
- ctrlX: d,
838
- ctrlY: u
801
+ ctrlX: h,
802
+ ctrlY: f
839
803
  };
840
804
  }
841
- function B(t) {
805
+ function H(t) {
842
806
  let e, n;
843
807
  const o = (t.cy - t.ctrlY) / (t.ctrlX - t.cx);
844
808
  return o > t.h / t.w || o < -t.h / t.w ? t.cy - t.ctrlY < 0 ? (e = t.cx - t.h / 2 / o, n = t.cy + t.h / 2) : (e = t.cx + t.h / 2 / o, n = t.cy - t.h / 2) : t.cx - t.ctrlX < 0 ? (e = t.cx + t.w / 2, n = t.cy - t.w * o / 2) : (e = t.cx - t.w / 2, n = t.cy + t.w * o / 2), {
@@ -846,31 +810,28 @@ function B(t) {
846
810
  y: n
847
811
  };
848
812
  }
849
- const it = function(t, e, n, o, s) {
850
- var E;
813
+ const st = function(t, e, n, o, s) {
851
814
  if (!e || !n)
852
815
  return;
853
- const i = K(t, e, o.delta1), r = K(t, n, o.delta2), { x: c, y: a } = B(i), { ctrlX: d, ctrlY: u } = i, { ctrlX: p, ctrlY: g } = r, { x: w, y: f } = B(r), m = _(p, g, w, f);
854
- if (!m)
855
- return;
856
- const l = `M ${m.x1} ${m.y1} L ${w} ${f} L ${m.x2} ${m.y2}`;
857
- let h = "";
816
+ const i = K(t, e, o.delta1), r = K(t, n, o.delta2), { x: c, y: a } = H(i), { ctrlX: h, ctrlY: f } = i, { ctrlX: p, ctrlY: m } = r, { x: y, y: g } = H(r), u = _(p, m, y, g);
817
+ if (!u) return;
818
+ const l = `M ${u.x1} ${u.y1} L ${y} ${g} L ${u.x2} ${u.y2}`;
819
+ let d = "";
858
820
  if (o.bidirectional) {
859
- const $ = _(d, u, c, a);
860
- if (!$)
861
- return;
862
- h = `M ${$.x1} ${$.y1} L ${c} ${a} L ${$.x2} ${$.y2}`;
821
+ const L = _(h, f, c, a);
822
+ if (!L) return;
823
+ d = `M ${L.x1} ${L.y1} L ${c} ${a} L ${L.x2} ${L.y2}`;
863
824
  }
864
- const y = Vt(`M ${c} ${a} C ${d} ${u} ${p} ${g} ${w} ${f}`, l, h, o.style), { x: v, y: b } = kt(c, a, d, u, p, g, w, f), C = ((E = o.style) == null ? void 0 : E.labelColor) || "rgb(235, 95, 82)", x = "arrow-" + o.id;
865
- y.id = x;
866
- const S = et(o.label, v, b, {
825
+ const w = Ft(`M ${c} ${a} C ${h} ${f} ${p} ${m} ${y} ${g}`, l, d, o.style), { x: v, y: b } = Lt(c, a, h, f, p, m, y, g), x = o.style?.labelColor || "rgb(235, 95, 82)", C = "arrow-" + o.id;
826
+ w.id = C;
827
+ const S = tt(o.label, v, b, {
867
828
  anchor: "middle",
868
- color: C,
829
+ color: x,
869
830
  dataType: "arrow",
870
- svgId: x
831
+ svgId: C
871
832
  });
872
- y.labelEl = S, y.arrowObj = o, y.dataset.linkid = o.id, t.labelContainer.appendChild(S), t.linkSvgGroup.appendChild(y), J(S), s || (t.arrows.push(o), t.currentArrow = y, Tt(t, o, i, r));
873
- }, Ae = function(t, e, n = {}) {
833
+ w.labelEl = S, w.arrowObj = o, w.dataset.linkid = o.id, t.labelContainer.appendChild(S), t.linkSvgGroup.appendChild(w), J(S), s || (t.arrows.push(o), t.currentArrow = w, kt(t, o, i, r));
834
+ }, De = function(t, e, n = {}) {
874
835
  const o = {
875
836
  id: V(),
876
837
  label: "Custom Link",
@@ -886,21 +847,20 @@ const it = function(t, e, n, o, s) {
886
847
  },
887
848
  ...n
888
849
  };
889
- it(this, t, e, o), this.bus.fire("operation", {
850
+ st(this, t, e, o), this.bus.fire("operation", {
890
851
  name: "createArrow",
891
852
  obj: o
892
853
  });
893
- }, Ne = function(t) {
854
+ }, Ae = function(t) {
894
855
  Q(this);
895
856
  const e = { ...t, id: V() };
896
- it(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
857
+ st(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
897
858
  name: "createArrow",
898
859
  obj: e
899
860
  });
900
- }, Me = function(t) {
861
+ }, Ne = function(t) {
901
862
  let e;
902
- if (t ? e = t : e = this.currentArrow, !e)
903
- return;
863
+ if (t ? e = t : e = this.currentArrow, !e) return;
904
864
  Q(this);
905
865
  const n = e.arrowObj.id;
906
866
  this.arrows = this.arrows.filter((o) => o.id !== n), e.remove(), this.bus.fire("operation", {
@@ -909,15 +869,15 @@ const it = function(t, e, n, o, s) {
909
869
  id: n
910
870
  }
911
871
  });
912
- }, Pe = function(t) {
872
+ }, Me = function(t) {
913
873
  this.currentArrow = t;
914
874
  const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = K(this, n, e.delta1), i = K(this, o, e.delta2);
915
- Tt(this, e, s, i);
916
- }, He = function() {
875
+ kt(this, e, s, i);
876
+ }, Pe = function() {
917
877
  Q(this), this.currentArrow = null;
918
878
  }, Z = function(t, e) {
919
- const n = document.createElementNS(D, "path");
920
- return L(n, {
879
+ const n = document.createElementNS($, "path");
880
+ return E(n, {
921
881
  d: t,
922
882
  stroke: e,
923
883
  fill: "none",
@@ -925,8 +885,8 @@ const it = function(t, e, n, o, s) {
925
885
  "stroke-linecap": "round",
926
886
  "stroke-linejoin": "round"
927
887
  }), n;
928
- }, Be = function(t, e) {
929
- const n = document.createElementNS(D, "g");
888
+ }, He = function(t, e) {
889
+ const n = document.createElementNS($, "g");
930
890
  n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
931
891
  const o = Z(t.line.getAttribute("d"), e);
932
892
  n.appendChild(o);
@@ -936,231 +896,217 @@ const it = function(t, e, n, o, s) {
936
896
  n.appendChild(i);
937
897
  }
938
898
  t.insertBefore(n, t.firstChild);
939
- }, Ie = function(t) {
899
+ }, Be = function(t) {
940
900
  const e = t.querySelector(".arrow-highlight");
941
901
  e && e.remove();
942
- }, We = function(t) {
902
+ }, Ie = function(t) {
943
903
  const e = t.querySelector(".arrow-highlight");
944
- if (!e)
945
- return;
904
+ if (!e) return;
946
905
  const n = e.querySelectorAll("path");
947
906
  n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
948
907
  }, Q = function(t) {
949
- var e, n;
950
- (e = t.helper1) == null || e.destroy(), (n = t.helper2) == null || n.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Ie(t.currentArrow);
951
- }, Tt = function(t, e, n, o) {
952
- const { linkController: s, P2: i, P3: r, line1: c, line2: a, nodes: d, map: u, currentArrow: p, bus: g } = t;
953
- if (!p)
954
- return;
955
- s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", d.appendChild(s), d.appendChild(i), d.appendChild(r), Be(p, $e);
956
- let { x: w, y: f } = B(n), { ctrlX: m, ctrlY: l } = n, { ctrlX: h, ctrlY: y } = o, { x: v, y: b } = B(o);
957
- i.style.cssText = `top:${l}px;left:${m}px;`, r.style.cssText = `top:${y}px;left:${h}px;`, z(c, w, f, m, l), z(a, h, y, v, b), t.helper1 = pt.create(i), t.helper2 = pt.create(r), t.helper1.init(u, (C, x) => {
958
- m = m + C / t.scaleVal, l = l + x / t.scaleVal;
959
- const S = B({ ...n, ctrlX: m, ctrlY: l });
960
- w = S.x, f = S.y, i.style.top = l + "px", i.style.left = m + "px", gt(p, w, f, m, l, h, y, v, b, e), z(c, w, f, m, l), e.delta1.x = m - n.cx, e.delta1.y = l - n.cy, g.fire("updateArrowDelta", e);
961
- }), t.helper2.init(u, (C, x) => {
962
- h = h + C / t.scaleVal, y = y + x / t.scaleVal;
963
- const S = B({ ...o, ctrlX: h, ctrlY: y });
964
- v = S.x, b = S.y, r.style.top = y + "px", r.style.left = h + "px", gt(p, w, f, m, l, h, y, v, b, e), z(a, h, y, v, b), e.delta2.x = h - o.cx, e.delta2.y = y - o.cy, g.fire("updateArrowDelta", e);
908
+ t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Be(t.currentArrow);
909
+ }, kt = function(t, e, n, o) {
910
+ const { linkController: s, P2: i, P3: r, line1: c, line2: a, nodes: h, map: f, currentArrow: p, bus: m } = t;
911
+ if (!p) return;
912
+ s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", h.appendChild(s), h.appendChild(i), h.appendChild(r), He(p, Te);
913
+ let { x: y, y: g } = H(n), { ctrlX: u, ctrlY: l } = n, { ctrlX: d, ctrlY: w } = o, { x: v, y: b } = H(o);
914
+ i.style.cssText = `top:${l}px;left:${u}px;`, r.style.cssText = `top:${w}px;left:${d}px;`, z(c, y, g, u, l), z(a, d, w, v, b), t.helper1 = ft.create(i), t.helper2 = ft.create(r), t.helper1.init(f, (x, C) => {
915
+ u = u + x / t.scaleVal, l = l + C / t.scaleVal;
916
+ const S = H({ ...n, ctrlX: u, ctrlY: l });
917
+ y = S.x, g = S.y, i.style.top = l + "px", i.style.left = u + "px", pt(p, y, g, u, l, d, w, v, b, e), z(c, y, g, u, l), e.delta1.x = u - n.cx, e.delta1.y = l - n.cy, m.fire("updateArrowDelta", e);
918
+ }), t.helper2.init(f, (x, C) => {
919
+ d = d + x / t.scaleVal, w = w + C / t.scaleVal;
920
+ const S = H({ ...o, ctrlX: d, ctrlY: w });
921
+ v = S.x, b = S.y, r.style.top = w + "px", r.style.left = d + "px", pt(p, y, g, u, l, d, w, v, b, e), z(a, d, w, v, b), e.delta2.x = d - o.cx, e.delta2.y = w - o.cy, m.fire("updateArrowDelta", e);
965
922
  });
966
923
  };
967
- function Oe() {
924
+ function We() {
968
925
  this.linkSvgGroup.innerHTML = "";
969
926
  for (let t = 0; t < this.arrows.length; t++) {
970
927
  const e = this.arrows[t];
971
928
  try {
972
- it(this, this.findEle(e.from), this.findEle(e.to), e, !0);
929
+ st(this, this.findEle(e.from), this.findEle(e.to), e, !0);
973
930
  } catch {
974
931
  }
975
932
  }
976
933
  this.nodes.appendChild(this.linkSvgGroup);
977
934
  }
978
- function Ge(t) {
979
- Q(this), t && t.labelEl && St(this, t.labelEl, t.arrowObj);
935
+ function Oe(t) {
936
+ Q(this), t && t.labelEl && Ct(this, t.labelEl, t.arrowObj);
980
937
  }
981
- function Fe() {
938
+ function Ge() {
982
939
  this.arrows = this.arrows.filter((t) => q(t.from, this.nodeData) && q(t.to, this.nodeData));
983
940
  }
984
- const Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
941
+ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
985
942
  __proto__: null,
986
- createArrow: Ae,
987
- createArrowFrom: Ne,
988
- editArrowLabel: Ge,
989
- removeArrow: Me,
990
- renderArrow: Oe,
991
- selectArrow: Pe,
992
- tidyArrow: Fe,
993
- unselectArrow: He
994
- }, Symbol.toStringTag, { value: "Module" })), Re = function(t) {
995
- var a, d;
996
- if (t.length === 0)
997
- throw new Error("No selected node.");
943
+ createArrow: De,
944
+ createArrowFrom: Ae,
945
+ editArrowLabel: Oe,
946
+ removeArrow: Ne,
947
+ renderArrow: We,
948
+ selectArrow: Me,
949
+ tidyArrow: Ge,
950
+ unselectArrow: Pe
951
+ }, Symbol.toStringTag, { value: "Module" })), Ve = function(t) {
952
+ if (t.length === 0) throw new Error("No selected node.");
998
953
  if (t.length === 1) {
999
- const u = t[0].nodeObj, p = t[0].nodeObj.parent;
1000
- if (!p)
1001
- throw new Error("Can not select root node.");
1002
- const g = p.children.findIndex((w) => u === w);
954
+ const a = t[0].nodeObj, h = t[0].nodeObj.parent;
955
+ if (!h) throw new Error("Can not select root node.");
956
+ const f = h.children.findIndex((p) => a === p);
1003
957
  return {
1004
- parent: p.id,
1005
- start: g,
1006
- end: g
958
+ parent: h.id,
959
+ start: f,
960
+ end: f
1007
961
  };
1008
962
  }
1009
963
  let e = 0;
1010
- const n = t.map((u) => {
1011
- let p = u.nodeObj;
1012
- const g = [];
1013
- for (; p.parent; ) {
1014
- const w = p.parent, f = w.children, m = f == null ? void 0 : f.indexOf(p);
1015
- p = w, g.unshift({ node: p, index: m });
964
+ const n = t.map((a) => {
965
+ let h = a.nodeObj;
966
+ const f = [];
967
+ for (; h.parent; ) {
968
+ const p = h.parent, y = p.children?.indexOf(h);
969
+ h = p, f.unshift({ node: h, index: y });
1016
970
  }
1017
- return g.length > e && (e = g.length), g;
971
+ return f.length > e && (e = f.length), f;
1018
972
  });
1019
973
  let o = 0;
1020
- t:
1021
- for (; o < e; o++) {
1022
- const u = (a = n[0][o]) == null ? void 0 : a.node;
1023
- for (let p = 1; p < n.length; p++)
1024
- if (((d = n[p][o]) == null ? void 0 : d.node) !== u)
1025
- break t;
1026
- }
1027
- if (!o)
1028
- throw new Error("Can not select root node.");
1029
- const s = n.map((u) => u[o - 1].index).sort(), i = s[0] || 0, r = s[s.length - 1] || 0, c = n[0][o - 1].node;
1030
- if (!c.parent)
1031
- throw new Error("Please select nodes in the same main topic.");
974
+ t: for (; o < e; o++) {
975
+ const a = n[0][o]?.node;
976
+ for (let h = 1; h < n.length; h++)
977
+ if (n[h][o]?.node !== a)
978
+ break t;
979
+ }
980
+ if (!o) throw new Error("Can not select root node.");
981
+ 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;
982
+ if (!c.parent) throw new Error("Please select nodes in the same main topic.");
1032
983
  return {
1033
984
  parent: c.id,
1034
985
  start: i,
1035
986
  end: r
1036
987
  };
1037
- }, Ye = function(t) {
1038
- const e = document.createElementNS(D, "g");
988
+ }, Re = function(t) {
989
+ const e = document.createElementNS($, "g");
1039
990
  return e.setAttribute("id", t), e;
1040
- }, mt = function(t, e) {
1041
- const n = document.createElementNS(D, "path");
1042
- return L(n, {
991
+ }, ut = function(t, e) {
992
+ const n = document.createElementNS($, "path");
993
+ return E(n, {
1043
994
  d: t,
1044
995
  stroke: e || "#666",
1045
996
  fill: "none",
1046
997
  "stroke-linecap": "round",
1047
998
  "stroke-width": "2"
1048
999
  }), n;
1049
- }, ze = (t) => t.parentElement.parentElement, je = function(t, { parent: e, start: n }) {
1000
+ }, Ye = (t) => t.parentElement.parentElement, ze = function(t, { parent: e, start: n }) {
1050
1001
  const o = t.findEle(e), s = o.nodeObj;
1051
1002
  let i;
1052
1003
  return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
1053
- }, rt = function(t, e) {
1054
- var ct;
1055
- const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: d, summarySvg: u } = t, g = t.findEle(s).nodeObj, w = je(t, e);
1056
- let f = 1 / 0, m = 0, l = 0, h = 0;
1004
+ }, it = function(t, e) {
1005
+ const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: h, summarySvg: f } = t, m = t.findEle(s).nodeObj, y = ze(t, e);
1006
+ let g = 1 / 0, u = 0, l = 0, d = 0;
1057
1007
  for (let G = i; G <= r; G++) {
1058
- const lt = (ct = g.children) == null ? void 0 : ct[G];
1059
- if (!lt)
1008
+ const rt = m.children?.[G];
1009
+ if (!rt)
1060
1010
  return t.removeSummary(n), null;
1061
- const R = ze(t.findEle(lt.id)), { offsetLeft: Y, offsetTop: at } = A(a, R), ht = i === r ? 10 : 20;
1062
- G === i && (l = at + ht), G === r && (h = at + R.offsetHeight - ht), Y < f && (f = Y), R.offsetWidth + Y > m && (m = R.offsetWidth + Y);
1011
+ const R = Ye(t.findEle(rt.id)), { offsetLeft: Y, offsetTop: ct } = D(a, R), lt = i === r ? 10 : 20;
1012
+ G === i && (l = ct + lt), G === r && (d = ct + R.offsetHeight - lt), Y < g && (g = Y), R.offsetWidth + Y > u && (u = R.offsetWidth + Y);
1063
1013
  }
1064
- let y, v;
1065
- const b = g.parent ? 10 : 0, C = l + b, x = h + b, S = (C + x) / 2, E = (c == null ? void 0 : c.stroke) || d.cssVar["--color"], $ = (c == null ? void 0 : c.labelColor) || d.cssVar["--color"], O = "s-" + n;
1066
- w === W.LHS ? (y = mt(`M ${f + 10} ${C} c -5 0 -10 5 -10 10 L ${f} ${x - 10} c 0 5 5 10 10 10 M ${f} ${S} h -10`, E), v = et(o, f - 20, S, { anchor: "end", color: $, dataType: "summary", svgId: O })) : (y = mt(`M ${m - 10} ${C} c 5 0 10 5 10 10 L ${m} ${x - 10} c 0 5 -5 10 -10 10 M ${m} ${S} h 10`, E), v = et(o, m + 20, S, { anchor: "start", color: $, dataType: "summary", svgId: O }));
1067
- const M = Ye(O);
1068
- return M.appendChild(y), t.labelContainer.appendChild(v), J(v), M.summaryObj = e, M.labelEl = v, u.appendChild(M), M;
1069
- }, Xe = function(t = {}) {
1070
- if (!this.currentNodes)
1071
- return;
1072
- const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = Re(e), c = { id: V(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = rt(this, c);
1014
+ let w, v;
1015
+ const b = m.parent ? 10 : 0, x = l + b, C = d + b, S = (x + C) / 2, L = c?.stroke || h.cssVar["--color"], W = c?.labelColor || h.cssVar["--color"], O = "s-" + n;
1016
+ y === I.LHS ? (w = ut(`M ${g + 10} ${x} c -5 0 -10 5 -10 10 L ${g} ${C - 10} c 0 5 5 10 10 10 M ${g} ${S} h -10`, L), v = tt(o, g - 20, S, { anchor: "end", color: W, dataType: "summary", svgId: O })) : (w = ut(`M ${u - 10} ${x} c 5 0 10 5 10 10 L ${u} ${C - 10} c 0 5 -5 10 -10 10 M ${u} ${S} h 10`, L), v = tt(o, u + 20, S, { anchor: "start", color: W, dataType: "summary", svgId: O }));
1017
+ const N = Re(O);
1018
+ return N.appendChild(w), t.labelContainer.appendChild(v), J(v), N.summaryObj = e, N.labelEl = v, f.appendChild(N), N;
1019
+ }, je = function(t = {}) {
1020
+ if (!this.currentNodes) return;
1021
+ const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = Ve(e), c = { id: V(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = it(this, c);
1073
1022
  n.push(c), this.editSummary(a), o.fire("operation", {
1074
1023
  name: "createSummary",
1075
1024
  obj: c
1076
1025
  });
1077
- }, qe = function(t) {
1026
+ }, Xe = function(t) {
1078
1027
  const e = V(), n = { ...t, id: e };
1079
- rt(this, n), this.summaries.push(n), this.bus.fire("operation", {
1028
+ it(this, n), this.summaries.push(n), this.bus.fire("operation", {
1080
1029
  name: "createSummary",
1081
1030
  obj: n
1082
1031
  });
1083
- }, _e = function(t) {
1084
- var n, o;
1085
- const e = this.summaries.findIndex((s) => s.id === t);
1086
- e > -1 && (this.summaries.splice(e, 1), (n = this.nodes.querySelector("#s-" + t)) == null || n.remove(), (o = this.nodes.querySelector("#label-s-" + t)) == null || o.remove()), this.bus.fire("operation", {
1032
+ }, qe = function(t) {
1033
+ const e = this.summaries.findIndex((n) => n.id === t);
1034
+ e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
1087
1035
  name: "removeSummary",
1088
1036
  obj: { id: t }
1089
1037
  });
1090
- }, Ue = function(t) {
1038
+ }, _e = function(t) {
1091
1039
  const e = t.labelEl;
1092
1040
  e && e.classList.add("selected"), this.currentSummary = t;
1041
+ }, Ue = function() {
1042
+ this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
1093
1043
  }, Ke = function() {
1094
- var t, e;
1095
- (e = (t = this.currentSummary) == null ? void 0 : t.labelEl) == null || e.classList.remove("selected"), this.currentSummary = null;
1096
- }, Je = function() {
1097
1044
  this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
1098
1045
  try {
1099
- rt(this, t);
1046
+ it(this, t);
1100
1047
  } catch {
1101
1048
  }
1102
1049
  }), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
1103
- }, Qe = function(t) {
1104
- t && t.labelEl && St(this, t.labelEl, t.summaryObj);
1105
- }, Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1050
+ }, Je = function(t) {
1051
+ t && t.labelEl && Ct(this, t.labelEl, t.summaryObj);
1052
+ }, Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1106
1053
  __proto__: null,
1107
- createSummary: Xe,
1108
- createSummaryFrom: qe,
1109
- editSummary: Qe,
1110
- removeSummary: _e,
1111
- renderSummary: Je,
1112
- selectSummary: Ue,
1113
- unselectSummary: Ke
1054
+ createSummary: je,
1055
+ createSummaryFrom: Xe,
1056
+ editSummary: Je,
1057
+ removeSummary: qe,
1058
+ renderSummary: Ke,
1059
+ selectSummary: _e,
1060
+ unselectSummary: Ue
1114
1061
  }, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
1115
- function tn(t, e) {
1062
+ function Ze(t, e) {
1116
1063
  const n = document.createElementNS(T, "svg");
1117
- return L(n, {
1064
+ return E(n, {
1118
1065
  version: "1.1",
1119
1066
  xmlns: T,
1120
1067
  height: t,
1121
1068
  width: e
1122
1069
  }), n;
1123
1070
  }
1124
- function en(t, e) {
1071
+ function tn(t, e) {
1125
1072
  return (parseInt(t) - parseInt(e)) / 2;
1126
1073
  }
1127
- function nn(t, e, n, o) {
1074
+ function en(t, e, n, o) {
1128
1075
  const s = document.createElementNS(T, "g");
1129
1076
  let i = "";
1130
1077
  return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
1131
1078
  `).forEach((c, a) => {
1132
- const d = document.createElementNS(T, "text");
1133
- L(d, {
1079
+ const h = document.createElementNS(T, "text");
1080
+ E(h, {
1134
1081
  x: n + parseInt(e.paddingLeft) + "",
1135
- y: o + parseInt(e.paddingTop) + en(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
1082
+ y: o + parseInt(e.paddingTop) + tn(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
1136
1083
  "text-anchor": "start",
1137
1084
  "font-family": e.fontFamily,
1138
1085
  "font-size": `${e.fontSize}`,
1139
1086
  "font-weight": `${e.fontWeight}`,
1140
1087
  fill: `${e.color}`
1141
- }), d.innerHTML = c, s.appendChild(d);
1088
+ }), h.innerHTML = c, s.appendChild(h);
1142
1089
  }), s;
1143
1090
  }
1144
- function on(t, e, n, o) {
1145
- var c;
1091
+ function nn(t, e, n, o) {
1146
1092
  let s = "";
1147
- (c = t.nodeObj) != null && c.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
1093
+ t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
1148
1094
  const i = document.createElementNS(T, "foreignObject");
1149
- L(i, {
1095
+ E(i, {
1150
1096
  x: n + parseInt(e.paddingLeft) + "",
1151
1097
  y: o + parseInt(e.paddingTop) + "",
1152
1098
  width: e.width,
1153
1099
  height: e.height
1154
1100
  });
1155
1101
  const r = document.createElement("div");
1156
- return L(r, {
1102
+ return E(r, {
1157
1103
  xmlns: "http://www.w3.org/1999/xhtml",
1158
1104
  style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
1159
1105
  }), r.innerHTML = s, i.appendChild(r), i;
1160
1106
  }
1161
- function sn(t, e) {
1162
- const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = document.createElementNS(T, "rect");
1163
- return L(i, {
1107
+ function on(t, e) {
1108
+ const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = D(t.nodes, e), i = document.createElementNS(T, "rect");
1109
+ return E(i, {
1164
1110
  x: o + "",
1165
1111
  y: s + "",
1166
1112
  rx: n.borderRadius,
@@ -1173,8 +1119,8 @@ function sn(t, e) {
1173
1119
  }), i;
1174
1120
  }
1175
1121
  function j(t, e, n = !1) {
1176
- const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = A(t.nodes, e), r = document.createElementNS(T, "rect");
1177
- L(r, {
1122
+ const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = D(t.nodes, e), r = document.createElementNS(T, "rect");
1123
+ E(r, {
1178
1124
  x: s + "",
1179
1125
  y: i + "",
1180
1126
  rx: o.borderRadius,
@@ -1188,11 +1134,11 @@ function j(t, e, n = !1) {
1188
1134
  const c = document.createElementNS(T, "g");
1189
1135
  c.appendChild(r);
1190
1136
  let a;
1191
- return n ? a = on(e, o, s, i) : a = nn(e, o, s, i), c.appendChild(a), c;
1137
+ return n ? a = nn(e, o, s, i) : a = en(e, o, s, i), c.appendChild(a), c;
1192
1138
  }
1193
- function rn(t, e) {
1194
- const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = document.createElementNS(T, "a"), r = document.createElementNS(T, "text");
1195
- return L(r, {
1139
+ function sn(t, e) {
1140
+ const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = D(t.nodes, e), i = document.createElementNS(T, "a"), r = document.createElementNS(T, "text");
1141
+ return E(r, {
1196
1142
  x: o + "",
1197
1143
  y: s + parseInt(n.fontSize) + "",
1198
1144
  "text-anchor": "start",
@@ -1202,9 +1148,9 @@ function rn(t, e) {
1202
1148
  fill: `${n.color}`
1203
1149
  }), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
1204
1150
  }
1205
- function cn(t, e) {
1206
- const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = A(t.nodes, e), i = document.createElementNS(T, "image");
1207
- return L(i, {
1151
+ function rn(t, e) {
1152
+ const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = D(t.nodes, e), i = document.createElementNS(T, "image");
1153
+ return E(i, {
1208
1154
  x: o + "",
1209
1155
  y: s + "",
1210
1156
  width: n.width + "",
@@ -1212,41 +1158,40 @@ function cn(t, e) {
1212
1158
  href: e.src
1213
1159
  }), i;
1214
1160
  }
1215
- const X = 100, ln = '<?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">', an = (t, e = !1) => {
1216
- var p, g, w;
1217
- const n = t.nodes, o = n.offsetHeight + X * 2, s = n.offsetWidth + X * 2, i = tn(o + "px", s + "px"), r = document.createElementNS(T, "svg"), c = document.createElementNS(T, "rect");
1218
- L(c, {
1161
+ const X = 100, cn = '<?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">', ln = (t, e = !1) => {
1162
+ const n = t.nodes, o = n.offsetHeight + X * 2, s = n.offsetWidth + X * 2, i = Ze(o + "px", s + "px"), r = document.createElementNS(T, "svg"), c = document.createElementNS(T, "rect");
1163
+ E(c, {
1219
1164
  x: "0",
1220
1165
  y: "0",
1221
1166
  width: `${s}`,
1222
1167
  height: `${o}`,
1223
1168
  fill: t.theme.cssVar["--bgcolor"]
1224
- }), i.appendChild(c), n.querySelectorAll(".subLines").forEach((f) => {
1225
- const m = f.cloneNode(!0), { offsetLeft: l, offsetTop: h } = A(n, f.parentElement);
1226
- m.setAttribute("x", `${l}`), m.setAttribute("y", `${h}`), r.appendChild(m);
1169
+ }), i.appendChild(c), n.querySelectorAll(".subLines").forEach((p) => {
1170
+ const m = p.cloneNode(!0), { offsetLeft: y, offsetTop: g } = D(n, p.parentElement);
1171
+ m.setAttribute("x", `${y}`), m.setAttribute("y", `${g}`), r.appendChild(m);
1227
1172
  });
1228
- const a = (p = n.querySelector(".lines")) == null ? void 0 : p.cloneNode(!0);
1173
+ const a = n.querySelector(".lines")?.cloneNode(!0);
1229
1174
  a && r.appendChild(a);
1230
- const d = (g = n.querySelector(".topiclinks")) == null ? void 0 : g.cloneNode(!0);
1231
- d && r.appendChild(d);
1232
- const u = (w = n.querySelector(".summary")) == null ? void 0 : w.cloneNode(!0);
1233
- return u && r.appendChild(u), n.querySelectorAll("me-tpc").forEach((f) => {
1234
- f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(j(t, f, !e)) : (r.appendChild(sn(t, f)), r.appendChild(j(t, f.text, !e)));
1235
- }), n.querySelectorAll(".tags > span").forEach((f) => {
1236
- r.appendChild(j(t, f));
1237
- }), n.querySelectorAll(".icons > span").forEach((f) => {
1238
- r.appendChild(j(t, f));
1239
- }), n.querySelectorAll(".hyper-link").forEach((f) => {
1240
- r.appendChild(rn(t, f));
1241
- }), n.querySelectorAll("img").forEach((f) => {
1242
- r.appendChild(cn(t, f));
1243
- }), L(r, {
1175
+ const h = n.querySelector(".topiclinks")?.cloneNode(!0);
1176
+ h && r.appendChild(h);
1177
+ const f = n.querySelector(".summary")?.cloneNode(!0);
1178
+ return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((p) => {
1179
+ p.nodeObj.dangerouslySetInnerHTML ? r.appendChild(j(t, p, !e)) : (r.appendChild(on(t, p)), r.appendChild(j(t, p.text, !e)));
1180
+ }), n.querySelectorAll(".tags > span").forEach((p) => {
1181
+ r.appendChild(j(t, p));
1182
+ }), n.querySelectorAll(".icons > span").forEach((p) => {
1183
+ r.appendChild(j(t, p));
1184
+ }), n.querySelectorAll(".hyper-link").forEach((p) => {
1185
+ r.appendChild(sn(t, p));
1186
+ }), n.querySelectorAll("img").forEach((p) => {
1187
+ r.appendChild(rn(t, p));
1188
+ }), E(r, {
1244
1189
  x: X + "",
1245
1190
  y: X + "",
1246
1191
  overflow: "visible"
1247
1192
  }), i.appendChild(r), i;
1248
- }, hn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), ln + t.outerHTML);
1249
- function dn(t) {
1193
+ }, an = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), cn + t.outerHTML);
1194
+ function hn(t) {
1250
1195
  return new Promise((e, n) => {
1251
1196
  const o = new FileReader();
1252
1197
  o.onload = (s) => {
@@ -1256,11 +1201,11 @@ function dn(t) {
1256
1201
  }, o.readAsDataURL(t);
1257
1202
  });
1258
1203
  }
1259
- const fn = function(t = !1, e) {
1260
- const n = an(this, t), o = hn(n, e);
1204
+ const dn = function(t = !1, e) {
1205
+ const n = ln(this, t), o = an(n, e);
1261
1206
  return new Blob([o], { type: "image/svg+xml" });
1262
- }, un = async function(t = !1, e) {
1263
- const n = this.exportSvg(t, e), o = await dn(n);
1207
+ }, fn = async function(t = !1, e) {
1208
+ const n = this.exportSvg(t, e), o = await hn(n);
1264
1209
  return new Promise((s, i) => {
1265
1210
  const r = new Image();
1266
1211
  r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
@@ -1270,54 +1215,52 @@ const fn = function(t = !1, e) {
1270
1215
  });
1271
1216
  }, pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1272
1217
  __proto__: null,
1273
- exportPng: un,
1274
- exportSvg: fn
1275
- }, Symbol.toStringTag, { value: "Module" })), gn = {}, mn = {
1218
+ exportPng: fn,
1219
+ exportSvg: dn
1220
+ }, Symbol.toStringTag, { value: "Module" })), un = {}, gn = {
1276
1221
  getObjById: q,
1277
- generateNewObj: Dt,
1278
- layout: Mt,
1279
- linkDiv: Rt,
1280
- editTopic: Gt,
1281
- createWrapper: Bt,
1282
- createParent: It,
1283
- createChildren: Wt,
1284
- createTopic: Ot,
1285
- findEle: bt,
1286
- changeTheme: te,
1287
- ...ke,
1288
- ...gn,
1289
- ...Ve,
1290
- ...Ze,
1222
+ generateNewObj: $t,
1223
+ layout: Nt,
1224
+ linkDiv: Vt,
1225
+ editTopic: Ot,
1226
+ createWrapper: Ht,
1227
+ createParent: Bt,
1228
+ createChildren: It,
1229
+ createTopic: Wt,
1230
+ findEle: wt,
1231
+ changeTheme: Zt,
1232
+ ...Le,
1233
+ ...un,
1234
+ ...Fe,
1235
+ ...Qe,
1291
1236
  ...pn,
1292
1237
  init(t) {
1293
- if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData)
1294
- return new Error("MindElixir: `data` is required");
1295
- t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, st(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Zt(this), this.layout(), this.linkDiv(), this.toCenter();
1238
+ if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
1239
+ t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, ot(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Qt(this), this.layout(), this.linkDiv(), this.toCenter();
1296
1240
  },
1297
1241
  destroy() {
1298
- var t;
1299
- 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, (t = this.selection) == null || t.destroy(), this.selection = void 0;
1242
+ this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
1300
1243
  }
1301
1244
  };
1302
- function yn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, containerHeight: d }) {
1303
- let u = e + n / 2;
1245
+ function mn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, containerHeight: h }) {
1246
+ let f = e + n / 2;
1304
1247
  const p = t + o / 2;
1305
- let g;
1306
- a === W.LHS ? g = i + r : g = i;
1307
- const w = s + c / 2, m = (1 - Math.abs(w - p) / d) * 0.25 * (n / 2);
1308
- return a === W.LHS ? u = u - n / 10 - m : u = u + n / 10 + m, `M ${u} ${p} Q ${u} ${w} ${g} ${w}`;
1248
+ let m;
1249
+ a === I.LHS ? m = i + r : m = i;
1250
+ const y = s + c / 2, u = (1 - Math.abs(y - p) / h) * 0.25 * (n / 2);
1251
+ return a === I.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${p} Q ${f} ${y} ${m} ${y}`;
1309
1252
  }
1310
- function wn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, isFirst: d }) {
1311
- const u = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
1312
- let p = 0, g = 0;
1313
- d ? p = t + o / 2 : p = t + o;
1314
- const w = s + c;
1315
- let f = 0, m = 0, l = 0;
1316
- const h = Math.abs(p - w) / 300 * u;
1317
- return a === W.LHS ? (l = e, f = l + u, m = l - u, g = i + u, `M ${f} ${p} C ${l} ${p} ${l + h} ${w} ${m} ${w} H ${g}`) : (l = e + n, f = l - u, m = l + u, g = i + r - u, `M ${f} ${p} C ${l} ${p} ${l - h} ${w} ${m} ${w} H ${g}`);
1253
+ function yn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, isFirst: h }) {
1254
+ const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
1255
+ let p = 0, m = 0;
1256
+ h ? p = t + o / 2 : p = t + o;
1257
+ const y = s + c;
1258
+ let g = 0, u = 0, l = 0;
1259
+ const d = Math.abs(p - y) / 300 * f;
1260
+ return a === I.LHS ? (l = e, g = l + f, u = l - f, m = i + f, `M ${g} ${p} C ${l} ${p} ${l + d} ${y} ${u} ${y} H ${m}`) : (l = e + n, g = l - f, u = l + f, m = i + r - f, `M ${g} ${p} C ${l} ${p} ${l - d} ${y} ${u} ${y} H ${m}`);
1318
1261
  }
1319
- const bn = "5.2.1";
1320
- function vn(t) {
1262
+ const wn = "5.3.0";
1263
+ function bn(t) {
1321
1264
  return {
1322
1265
  x: 0,
1323
1266
  y: 0,
@@ -1332,8 +1275,8 @@ function vn(t) {
1332
1275
  }
1333
1276
  };
1334
1277
  }
1335
- const H = document;
1336
- function N({
1278
+ const P = document;
1279
+ function A({
1337
1280
  el: t,
1338
1281
  direction: e,
1339
1282
  locale: n,
@@ -1343,46 +1286,45 @@ function N({
1343
1286
  toolBar: r,
1344
1287
  keypress: c,
1345
1288
  mouseSelectionButton: a,
1346
- selectionContainer: d,
1347
- before: u,
1289
+ selectionContainer: h,
1290
+ before: f,
1348
1291
  newTopicName: p,
1349
- allowUndo: g,
1350
- generateMainBranch: w,
1351
- generateSubBranch: f,
1352
- overflowHidden: m,
1292
+ allowUndo: m,
1293
+ generateMainBranch: y,
1294
+ generateSubBranch: g,
1295
+ overflowHidden: u,
1353
1296
  theme: l,
1354
- alignment: h,
1355
- scaleSensitivity: y,
1297
+ alignment: d,
1298
+ scaleSensitivity: w,
1356
1299
  scaleMax: v,
1357
1300
  scaleMin: b,
1358
- handleWheel: C,
1359
- markdown: x,
1301
+ handleWheel: x,
1302
+ markdown: C,
1360
1303
  imageProxy: S
1361
1304
  }) {
1362
- let E = null;
1363
- const $ = Object.prototype.toString.call(t);
1364
- if ($ === "[object HTMLDivElement]" ? E = t : $ === "[object String]" && (E = document.querySelector(t)), !E)
1365
- throw new Error("MindElixir: el is not a valid element");
1366
- E.style.position = "relative", E.innerHTML = "", this.el = E, this.disposable = [], this.before = u || {}, this.locale = n || "en", this.newTopicName = p || "New Node", this.contextMenu = i ?? !0, this.toolBar = r ?? !0, this.keypress = c ?? !0, this.mouseSelectionButton = a ?? 0, this.direction = e ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = g ?? !0, this.scaleSensitivity = y ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = b ?? 0.2, this.generateMainBranch = w || yn, this.generateSubBranch = f || wn, this.overflowHidden = m ?? !1, this.alignment = h ?? "root", this.handleWheel = C ?? !0, this.markdown = x || void 0, this.imageProxy = S || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = vn(this), this.bus = Nt(), this.container = H.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
1305
+ let L = null;
1306
+ const W = Object.prototype.toString.call(t);
1307
+ if (W === "[object HTMLDivElement]" ? L = t : W === "[object String]" && (L = document.querySelector(t)), !L) throw new Error("MindElixir: el is not a valid element");
1308
+ L.style.position = "relative", L.innerHTML = "", this.el = L, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = p || "New Node", this.contextMenu = i ?? !0, this.toolBar = r ?? !0, this.keypress = c ?? !0, this.mouseSelectionButton = a ?? 0, this.direction = e ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = m ?? !0, this.scaleSensitivity = w ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = b ?? 0.2, this.generateMainBranch = y || mn, this.generateSubBranch = g || yn, this.overflowHidden = u ?? !1, this.alignment = d ?? "root", this.handleWheel = x ?? !0, this.markdown = C || void 0, this.imageProxy = S || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = bn(this), this.bus = At(), this.container = P.createElement("div"), this.selectionContainer = h || this.container, this.container.className = "map-container";
1367
1309
  const O = window.matchMedia("(prefers-color-scheme: dark)");
1368
- this.theme = l || (O.matches ? ot : nt);
1369
- const M = H.createElement("div");
1370
- M.className = "map-canvas", this.map = M, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = H.createElement("me-nodes"), this.lines = F("lines"), this.summarySvg = F("summary"), this.linkController = F("linkcontroller"), this.P2 = H.createElement("div"), this.P3 = H.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ut(), this.line2 = ut(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = F("topiclinks"), this.labelContainer = H.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(At(this));
1310
+ this.theme = l || (O.matches ? nt : et);
1311
+ const N = P.createElement("div");
1312
+ N.className = "map-canvas", this.map = N, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = P.createElement("me-nodes"), this.lines = F("lines"), this.summarySvg = F("summary"), this.linkController = F("linkcontroller"), this.P2 = P.createElement("div"), this.P3 = P.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = dt(), this.line2 = dt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = F("topiclinks"), this.labelContainer = P.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Dt(this));
1371
1313
  }
1372
- N.prototype = mn;
1373
- Object.defineProperty(N.prototype, "currentNode", {
1314
+ A.prototype = gn;
1315
+ Object.defineProperty(A.prototype, "currentNode", {
1374
1316
  get() {
1375
1317
  return this.currentNodes[this.currentNodes.length - 1];
1376
1318
  },
1377
1319
  enumerable: !0
1378
1320
  });
1379
- N.LEFT = 0;
1380
- N.RIGHT = 1;
1381
- N.SIDE = 2;
1382
- N.THEME = nt;
1383
- N.DARK_THEME = ot;
1384
- N.version = bn;
1385
- N.E = bt;
1321
+ A.LEFT = 0;
1322
+ A.RIGHT = 1;
1323
+ A.SIDE = 2;
1324
+ A.THEME = et;
1325
+ A.DARK_THEME = nt;
1326
+ A.version = wn;
1327
+ A.E = wt;
1386
1328
  export {
1387
- N as default
1329
+ A as default
1388
1330
  };