mind-elixir 5.6.0 → 5.7.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 Se = {
1
+ const os = 0, ss = 1, is = 2, Se = {
2
2
  name: "Latte",
3
3
  type: "light",
4
4
  palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
@@ -23,7 +23,7 @@ const Se = {
23
23
  "--panel-color": "#444446",
24
24
  "--panel-bgcolor": "#ffffff",
25
25
  "--panel-border-color": "#eaeaea",
26
- "--map-padding": "50px"
26
+ "--map-padding": "50px 80px"
27
27
  }
28
28
  }, Ne = {
29
29
  name: "Dark",
@@ -67,10 +67,10 @@ const he = function(e, t) {
67
67
  return null;
68
68
  } else
69
69
  return null;
70
- }, K = (e, t) => {
70
+ }, q = (e, t) => {
71
71
  if (e.parent = t, e.children)
72
72
  for (let n = 0; n < e.children.length; n++)
73
- K(e.children[n], e);
73
+ q(e.children[n], e);
74
74
  }, Q = (e, t, n) => {
75
75
  if (e.expanded = t, e.children)
76
76
  if (n === void 0 || n > 0) {
@@ -84,24 +84,24 @@ const he = function(e, t) {
84
84
  });
85
85
  };
86
86
  function ke(e) {
87
- if (e.id = q(), e.children)
87
+ if (e.id = V(), e.children)
88
88
  for (let t = 0; t < e.children.length; t++)
89
89
  ke(e.children[t]);
90
90
  }
91
91
  function fe(e, t, n, o) {
92
- const s = n - e, i = o - t, r = Math.atan2(i, s) * 180 / Math.PI, c = 12, a = 30, d = (r + 180 - a) * Math.PI / 180, h = (r + 180 + a) * Math.PI / 180;
92
+ const s = n - e, i = o - t, c = Math.atan2(i, s) * 180 / Math.PI, r = 12, a = 30, d = (c + 180 - a) * Math.PI / 180, h = (c + 180 + a) * Math.PI / 180;
93
93
  return {
94
- x1: n + Math.cos(d) * c,
95
- y1: o + Math.sin(d) * c,
96
- x2: n + Math.cos(h) * c,
97
- y2: o + Math.sin(h) * c
94
+ x1: n + Math.cos(d) * r,
95
+ y1: o + Math.sin(d) * r,
96
+ x2: n + Math.cos(h) * r,
97
+ y2: o + Math.sin(h) * r
98
98
  };
99
99
  }
100
- function q() {
100
+ function V() {
101
101
  return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
102
102
  }
103
- const vt = function() {
104
- const e = q();
103
+ const wt = function() {
104
+ const e = V();
105
105
  return {
106
106
  topic: this.newTopicName,
107
107
  id: e
@@ -134,7 +134,7 @@ const H = (e, t) => {
134
134
  }), Le = (e) => {
135
135
  const t = /translate3d\(([^,]+),\s*([^,]+)/, n = e.match(t);
136
136
  return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
137
- }, nt = function(e) {
137
+ }, st = function(e) {
138
138
  for (let t = 0; t < e.length; t++) {
139
139
  const { dom: n, evt: o, func: s } = e[t];
140
140
  n.addEventListener(o, s);
@@ -145,38 +145,575 @@ const H = (e, t) => {
145
145
  o.removeEventListener(s, i);
146
146
  }
147
147
  };
148
- }, He = (e, t) => {
148
+ }, Re = (e, t) => {
149
149
  const n = e.x - t.x, o = e.y - t.y;
150
150
  return Math.sqrt(n * n + o * o);
151
- }, B = {
151
+ }, I = {
152
152
  LHS: "lhs",
153
153
  RHS: "rhs"
154
- }, bt = (e) => {
154
+ }, ue = document, xt = function() {
155
+ this.nodes.innerHTML = "";
156
+ const e = this.createTopic(this.nodeData);
157
+ Ae.call(this, e, this.nodeData), e.draggable = !1;
158
+ const t = ue.createElement("me-root");
159
+ t.appendChild(e);
160
+ const n = this.nodeData.children || [];
161
+ if (this.direction === 2) {
162
+ let o = 0, s = 0;
163
+ n.map((i) => {
164
+ i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
165
+ });
166
+ }
167
+ Ct(this, n, t);
168
+ }, Ct = function(e, t, n) {
169
+ const o = ue.createElement("me-main");
170
+ o.className = I.LHS;
171
+ const s = ue.createElement("me-main");
172
+ s.className = I.RHS;
173
+ for (let i = 0; i < t.length; i++) {
174
+ const l = t[i], { grp: c } = e.createWrapper(l);
175
+ e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
176
+ }
177
+ e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
178
+ }, Et = function(e, t) {
179
+ const n = ue.createElement("me-children");
180
+ for (let o = 0; o < t.length; o++) {
181
+ const s = t[o], { grp: i } = e.createWrapper(s);
182
+ n.appendChild(i);
183
+ }
184
+ return n;
185
+ }, P = document, it = function(e, t) {
186
+ const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
187
+ if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
188
+ return o;
189
+ }, Ae = function(e, t) {
190
+ if (e.innerHTML = "", t.style) {
191
+ const n = t.style;
192
+ for (const o in n)
193
+ e.style[o] = n[o];
194
+ }
195
+ if (t.dangerouslySetInnerHTML) {
196
+ e.innerHTML = t.dangerouslySetInnerHTML;
197
+ return;
198
+ }
199
+ if (t.image) {
200
+ const n = t.image;
201
+ if (n.url && n.width && n.height) {
202
+ const o = P.createElement("img");
203
+ o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
204
+ }
205
+ } else e.image && (e.image = void 0);
206
+ {
207
+ const n = P.createElement("span");
208
+ n.className = "text", this.markdown ? n.innerHTML = this.markdown(t.topic, t) : n.textContent = t.topic, e.appendChild(n), e.text = n;
209
+ }
210
+ if (t.hyperLink) {
211
+ const n = P.createElement("a");
212
+ n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
213
+ } else e.link && (e.link = void 0);
214
+ if (t.icons && t.icons.length) {
215
+ const n = P.createElement("span");
216
+ n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${we(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
217
+ } else e.icons && (e.icons = void 0);
218
+ if (t.tags && t.tags.length) {
219
+ const n = P.createElement("div");
220
+ n.className = "tags", t.tags.forEach((o) => {
221
+ const s = P.createElement("span");
222
+ 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);
223
+ }), e.appendChild(n), e.tags = n;
224
+ } else e.tags && (e.tags = void 0);
225
+ }, St = function(e, t) {
226
+ const n = P.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
227
+ if (n.appendChild(o), !t && e.children && e.children.length > 0) {
228
+ const i = De(e.expanded);
229
+ if (o.appendChild(i), e.expanded !== !1) {
230
+ const l = Et(this, e.children);
231
+ n.appendChild(l);
232
+ }
233
+ }
234
+ return { grp: n, top: o, tpc: s };
235
+ }, Nt = function(e) {
236
+ const t = P.createElement("me-parent"), n = this.createTopic(e);
237
+ return Ae.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
238
+ }, kt = function(e) {
239
+ const t = P.createElement("me-children");
240
+ return t.append(...e), t;
241
+ }, Tt = function(e) {
242
+ const t = P.createElement("me-tpc");
243
+ return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t;
244
+ };
245
+ function rt(e) {
246
+ const t = P.createRange();
247
+ t.selectNodeContents(e);
248
+ const n = window.getSelection();
249
+ n && (n.removeAllRanges(), n.addRange(t));
250
+ }
251
+ const _t = function(e) {
252
+ if (!e) return;
253
+ const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, e);
254
+ this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
255
+ const l = getComputedStyle(e);
256
+ t.style.cssText = `
257
+ left: ${s}px;
258
+ top: ${i}px;
259
+ min-width:${e.offsetWidth - 8}px;
260
+ color:${l.color};
261
+ font-size:${l.fontSize};
262
+ padding:${l.padding};
263
+ margin:${l.margin};
264
+ background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
265
+ border: ${l.border};
266
+ border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), rt(t), this.bus.fire("operation", {
267
+ name: "beginEdit",
268
+ obj: e.nodeObj
269
+ }), t.addEventListener("keydown", (c) => {
270
+ c.stopPropagation();
271
+ const r = c.key;
272
+ if (r === "Enter" || r === "Tab") {
273
+ if (c.shiftKey) return;
274
+ c.preventDefault(), t.blur(), this.container.focus();
275
+ }
276
+ }), t.addEventListener("blur", () => {
277
+ if (!t) return;
278
+ t.remove();
279
+ const c = t.textContent?.trim() || "";
280
+ c === o || c === "" || (n.topic = c, this.markdown ? e.text.innerHTML = this.markdown(n.topic, n) : e.text.textContent = c, this.linkDiv(), this.bus.fire("operation", {
281
+ name: "finishEdit",
282
+ obj: n,
283
+ origin: o
284
+ }));
285
+ });
286
+ }, De = function(e) {
287
+ const t = P.createElement("me-epd");
288
+ return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
289
+ }, te = (e) => {
290
+ const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
291
+ return { siblings: t, index: n };
292
+ };
293
+ function Lt(e) {
294
+ const { siblings: t, index: n } = te(e);
295
+ if (t === void 0) return;
296
+ const o = t[n];
297
+ n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
298
+ }
299
+ function At(e) {
300
+ const { siblings: t, index: n } = te(e);
301
+ if (t === void 0) return;
302
+ const o = t[n];
303
+ n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
304
+ }
305
+ function lt(e) {
306
+ const { siblings: t, index: n } = te(e);
307
+ return t === void 0 ? 0 : (t.splice(n, 1), t.length);
308
+ }
309
+ function Dt(e, t, n) {
310
+ const { siblings: o, index: s } = te(n);
311
+ o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
312
+ }
313
+ function Mt(e, t) {
314
+ const { siblings: n, index: o } = te(e);
315
+ n !== void 0 && (n[o] = t, t.children = [e]);
316
+ }
317
+ function Pt(e, t, n) {
318
+ if (lt(t), n.parent?.parent || (t.direction = n.direction), e === "in")
319
+ n.children ? n.children.push(t) : n.children = [t];
320
+ else {
321
+ t.direction !== void 0 && (t.direction = n.direction);
322
+ const { siblings: o, index: s } = te(n);
323
+ if (o === void 0) return;
324
+ e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
325
+ }
326
+ }
327
+ const Ot = function({ map: e, direction: t }, n) {
328
+ if (t === 0)
329
+ return 0;
330
+ if (t === 1)
331
+ return 1;
332
+ if (t === 2) {
333
+ const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
334
+ return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
335
+ }
336
+ }, ct = function(e, t, n) {
337
+ const o = n.children[0].children[0], s = t.parentElement;
338
+ if (s.tagName === "ME-PARENT") {
339
+ if (se(o), s.children[1])
340
+ s.nextSibling.appendChild(n);
341
+ else {
342
+ const i = e.createChildren([n]);
343
+ s.appendChild(De(!0)), s.insertAdjacentElement("afterend", i);
344
+ }
345
+ e.linkDiv(n.offsetParent);
346
+ } else s.tagName === "ME-ROOT" && (Ot(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
347
+ }, $t = function(e, t) {
348
+ const n = e.parentNode;
349
+ if (t === 0) {
350
+ const o = n.parentNode.parentNode;
351
+ o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
352
+ }
353
+ n.parentNode.remove();
354
+ }, at = {
355
+ before: "beforebegin",
356
+ after: "afterend"
357
+ }, se = function(e) {
358
+ const n = e.parentElement.parentElement.lastElementChild;
359
+ n?.tagName === "svg" && n?.remove();
360
+ }, jt = function(e, t) {
361
+ const n = e.nodeObj, o = Te(n);
362
+ o.style && t.style && (t.style = Object.assign(o.style, t.style));
363
+ const s = Object.assign(n, t);
364
+ Ae.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
365
+ name: "reshapeNode",
366
+ obj: s,
367
+ origin: o
368
+ });
369
+ }, Me = function(e, t, n) {
370
+ if (!t) return null;
371
+ const o = t.nodeObj;
372
+ o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
373
+ const s = n || e.generateNewObj();
374
+ o.children ? o.children.push(s) : o.children = [s], q(e.nodeData);
375
+ const { grp: i, top: l } = e.createWrapper(s);
376
+ return ct(e, t, i), { newTop: l, newNodeObj: s };
377
+ }, Ht = function(e, t, n) {
378
+ const o = t || this.currentNode;
379
+ if (!o) return;
380
+ const s = o.nodeObj;
381
+ if (s.parent) {
382
+ if (!s.parent?.parent && this.direction === 2) {
383
+ const a = this.map.querySelector(".lhs")?.childElementCount || 0, d = this.map.querySelector(".rhs")?.childElementCount || 0;
384
+ if (!a || !d) {
385
+ this.addChild(this.findEle(s.parent.id), n);
386
+ return;
387
+ }
388
+ }
389
+ } else {
390
+ this.addChild();
391
+ return;
392
+ }
393
+ const i = n || this.generateNewObj();
394
+ if (!s.parent?.parent) {
395
+ const a = o.closest("me-main").className === I.LHS ? 0 : 1;
396
+ i.direction = a;
397
+ }
398
+ Dt(i, e, s), q(this.nodeData);
399
+ const l = o.parentElement, { grp: c, top: r } = this.createWrapper(i);
400
+ l.parentElement.insertAdjacentElement(at[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(r.firstChild), this.bus.fire("operation", {
401
+ name: "insertSibling",
402
+ type: e,
403
+ obj: i
404
+ }), this.selectNode(r.firstChild, !0);
405
+ }, Rt = function(e, t) {
406
+ const n = e || this.currentNode;
407
+ if (!n) return;
408
+ se(n);
409
+ const o = n.nodeObj;
410
+ if (!o.parent)
411
+ return;
412
+ const s = t || this.generateNewObj();
413
+ Mt(o, s), q(this.nodeData);
414
+ const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
415
+ c.appendChild(De(!0)), i.insertAdjacentElement("afterend", l);
416
+ const r = this.createChildren([i]);
417
+ c.insertAdjacentElement("afterend", r), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
418
+ name: "insertParent",
419
+ obj: s
420
+ });
421
+ }, It = function(e, t) {
422
+ const n = e || this.currentNode;
423
+ if (!n) return;
424
+ const o = Me(this, n, t);
425
+ if (!o) return;
426
+ const { newTop: s, newNodeObj: i } = o;
427
+ this.bus.fire("operation", {
428
+ name: "addChild",
429
+ obj: i
430
+ }), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
431
+ }, Bt = function(e, t) {
432
+ const n = Te(e.nodeObj);
433
+ ke(n);
434
+ const o = Me(this, t, n);
435
+ if (!o) return;
436
+ const { newNodeObj: s } = o;
437
+ this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
438
+ name: "copyNode",
439
+ obj: s
440
+ });
441
+ }, Ft = function(e, t) {
442
+ const n = [];
443
+ for (let o = 0; o < e.length; o++) {
444
+ const s = e[o], i = Te(s.nodeObj);
445
+ ke(i);
446
+ const l = Me(this, t, i);
447
+ if (!l) return;
448
+ const { newNodeObj: c } = l;
449
+ n.push(c);
450
+ }
451
+ this.unselectNodes(this.currentNodes), this.selectNodes(n.map((o) => this.findEle(o.id))), this.bus.fire("operation", {
452
+ name: "copyNodes",
453
+ objs: n
454
+ });
455
+ }, Yt = function(e) {
456
+ const t = e || this.currentNode;
457
+ if (!t) return;
458
+ const n = t.nodeObj;
459
+ Lt(n);
460
+ const o = t.parentNode.parentNode;
461
+ o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
462
+ name: "moveUpNode",
463
+ obj: n
464
+ });
465
+ }, Wt = function(e) {
466
+ const t = e || this.currentNode;
467
+ if (!t) return;
468
+ const n = t.nodeObj;
469
+ At(n);
470
+ const o = t.parentNode.parentNode;
471
+ o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
472
+ name: "moveDownNode",
473
+ obj: n
474
+ });
475
+ }, Xt = function(e) {
476
+ if (e.length === 0) return;
477
+ e = _e(e);
478
+ for (const n of e) {
479
+ const o = n.nodeObj, s = lt(o);
480
+ $t(n, s);
481
+ }
482
+ const t = e[e.length - 1];
483
+ this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
484
+ name: "removeNodes",
485
+ objs: e.map((n) => n.nodeObj)
486
+ });
487
+ }, Pe = (e, t, n, o) => {
488
+ e = _e(e);
489
+ let s = n.nodeObj;
490
+ t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
491
+ const i = [];
492
+ for (const c of e) {
493
+ const r = c.nodeObj;
494
+ if (Pt(t, r, s), q(o.nodeData), t === "in") {
495
+ const a = c.parentElement;
496
+ ct(o, n, a.parentElement);
497
+ } else {
498
+ se(c);
499
+ const a = c.parentElement.parentNode;
500
+ i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(at[t], a);
501
+ }
502
+ }
503
+ for (const c of i)
504
+ c.childElementCount === 0 && c.tagName !== "ME-MAIN" && (c.previousSibling.children[1].remove(), c.remove());
505
+ o.linkDiv(), o.scrollIntoView(e[e.length - 1]);
506
+ const l = t === "before" ? "moveNodeBefore" : t === "after" ? "moveNodeAfter" : "moveNodeIn";
507
+ o.bus.fire("operation", {
508
+ name: l,
509
+ objs: e.map((c) => c.nodeObj),
510
+ toObj: s
511
+ });
512
+ }, zt = function(e, t) {
513
+ Pe(e, "in", t, this);
514
+ }, Gt = function(e, t) {
515
+ Pe(e, "before", t, this);
516
+ }, qt = function(e, t) {
517
+ Pe(e, "after", t, this);
518
+ }, Vt = function(e) {
519
+ const t = e || this.currentNode;
520
+ t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
521
+ }, Kt = function(e, t) {
522
+ e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
523
+ }, dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
524
+ __proto__: null,
525
+ addChild: It,
526
+ beginEdit: Vt,
527
+ copyNode: Bt,
528
+ copyNodes: Ft,
529
+ insertParent: Rt,
530
+ insertSibling: Ht,
531
+ moveDownNode: Wt,
532
+ moveNodeAfter: qt,
533
+ moveNodeBefore: Gt,
534
+ moveNodeIn: zt,
535
+ moveUpNode: Yt,
536
+ removeNodes: Xt,
537
+ reshapeNode: jt,
538
+ rmSubline: se,
539
+ setNodeTopic: Kt
540
+ }, Symbol.toStringTag, { value: "Module" }));
541
+ function Ut(e) {
542
+ return {
543
+ nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
544
+ arrows: e.arrows,
545
+ summaries: e.summaries,
546
+ direction: e.direction,
547
+ theme: e.theme
548
+ };
549
+ }
550
+ const Jt = function(e) {
551
+ const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
552
+ if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
553
+ const i = n.left + n.width / 2, l = n.top + n.height / 2, c = o.left + o.width / 2, r = o.top + o.height / 2, a = i - c, d = l - r;
554
+ this.move(-a, -d, !0);
555
+ }
556
+ }, Zt = function(e, t, n) {
557
+ this.clearSelection(), this.scrollIntoView(e), this.selection?.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
558
+ }, Qt = function(e) {
559
+ this.selection?.select(e);
560
+ }, en = function(e) {
561
+ this.selection?.deselect(e);
562
+ }, tn = function() {
563
+ this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
564
+ }, Oe = function(e) {
565
+ return JSON.stringify(e, (t, n) => {
566
+ if (!(t === "parent" && typeof n != "string"))
567
+ return n;
568
+ });
569
+ }, nn = function() {
570
+ const e = Ut(this);
571
+ return Oe(e);
572
+ }, on = function() {
573
+ return JSON.parse(this.getDataString());
574
+ }, sn = function() {
575
+ this.editable = !0;
576
+ }, rn = function() {
577
+ this.editable = !1;
578
+ }, ln = function(e, t = { x: 0, y: 0 }) {
579
+ if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
580
+ const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = $e(this), c = this.map.style.transform, { x: r, y: a } = Le(c), d = r - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
581
+ this.map.style.transform = `translate3d(${r - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
582
+ }, cn = function() {
583
+ const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
584
+ this.scaleVal = n;
585
+ const { dx: o, dy: s } = $e(this, !0);
586
+ this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
587
+ }, an = function(e, t, n = !1) {
588
+ const { map: o, scaleVal: s, bus: i, container: l, nodes: c } = this;
589
+ if (n && o.style.transition === "transform 0.3s")
590
+ return;
591
+ const r = o.style.transform;
592
+ let { x: a, y: d } = Le(r);
593
+ const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
594
+ if (y) {
595
+ const p = u.left + e, g = u.right + e;
596
+ (p >= h.right || g <= h.left) && (e = 0);
597
+ }
598
+ if (v) {
599
+ const p = u.top + t, g = u.bottom + t;
600
+ (p >= h.bottom || g <= h.top) && (t = 0);
601
+ }
602
+ a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
603
+ o.style.transition = "none";
604
+ }, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
605
+ }, $e = (e, t = !1) => {
606
+ const { container: n, map: o, nodes: s } = e;
607
+ let i, l;
608
+ if (e.alignment === "nodes" || t)
609
+ i = (n.offsetWidth - s.offsetWidth) / 2, l = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
610
+ else {
611
+ const c = o.querySelector("me-root"), r = c.offsetTop, a = c.offsetLeft, d = c.offsetWidth, h = c.offsetHeight;
612
+ i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - r - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
613
+ }
614
+ return { dx: i, dy: l };
615
+ }, dn = function() {
616
+ const { map: e, container: t } = this, { dx: n, dy: o } = $e(this);
617
+ t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
618
+ }, hn = function(e) {
619
+ e(this);
620
+ }, fn = function(e) {
621
+ e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
622
+ }, un = function() {
623
+ this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
624
+ }, pn = function() {
625
+ this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
626
+ }, gn = function() {
627
+ this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
628
+ }, mn = function() {
629
+ this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
630
+ }, yn = function(e) {
631
+ this.locale = e, this.refresh();
632
+ }, vn = function(e, t) {
633
+ const n = e.nodeObj;
634
+ typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
635
+ const o = e.getBoundingClientRect(), s = {
636
+ x: o.left,
637
+ y: o.top
638
+ }, i = e.parentNode, l = i.children[1];
639
+ if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", se(e), n.expanded) {
640
+ const h = this.createChildren(
641
+ n.children.map((u) => this.createWrapper(u).grp)
642
+ );
643
+ i.parentNode.appendChild(h);
644
+ } else
645
+ i.parentNode.children[1].remove();
646
+ this.linkDiv(e.closest("me-main > me-wrapper"));
647
+ const c = e.getBoundingClientRect(), r = {
648
+ x: c.left,
649
+ y: c.top
650
+ }, a = s.x - r.x, d = s.y - r.y;
651
+ this.move(a, d), this.bus.fire("expandNode", n);
652
+ }, bn = function(e, t) {
653
+ const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
654
+ x: o.left,
655
+ y: o.top
656
+ };
657
+ Q(n, t ?? !n.expanded), this.refresh();
658
+ const i = this.findEle(n.id).getBoundingClientRect(), l = {
659
+ x: i.left,
660
+ y: i.top
661
+ }, c = s.x - l.x, r = s.y - l.y;
662
+ this.move(c, r);
663
+ }, wn = function(e) {
664
+ this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), q(this.nodeData), this.layout(), this.linkDiv();
665
+ }, xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
666
+ __proto__: null,
667
+ cancelFocus: un,
668
+ clearSelection: tn,
669
+ disableEdit: rn,
670
+ enableEdit: sn,
671
+ expandNode: vn,
672
+ expandNodeAll: bn,
673
+ focusNode: fn,
674
+ getData: on,
675
+ getDataString: nn,
676
+ initLeft: pn,
677
+ initRight: gn,
678
+ initSide: mn,
679
+ install: hn,
680
+ move: an,
681
+ refresh: wn,
682
+ scale: ln,
683
+ scaleFit: cn,
684
+ scrollIntoView: Jt,
685
+ selectNode: Zt,
686
+ selectNodes: Qt,
687
+ setLocale: yn,
688
+ stringifyData: Oe,
689
+ toCenter: dn,
690
+ unselectNodes: en
691
+ }, Symbol.toStringTag, { value: "Module" })), Ie = "MIND-ELIXIR-WAIT-COPY", Cn = (e) => {
155
692
  const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
156
693
  e.selectNode(t[Math.ceil(t.length / 2) - 1]);
157
- }, wt = (e) => {
694
+ }, En = (e) => {
158
695
  const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
159
696
  e.selectNode(t[Math.ceil(t.length / 2) - 1]);
160
- }, xt = (e) => {
697
+ }, Sn = (e) => {
161
698
  e.selectNode(e.map.querySelector("me-root>me-tpc"));
162
- }, Ct = function(e, t) {
699
+ }, Nn = function(e, t) {
163
700
  const n = t.parentElement.parentElement.parentElement.previousSibling;
164
701
  if (n) {
165
702
  const o = n.firstChild;
166
703
  e.selectNode(o);
167
704
  }
168
- }, Et = function(e, t) {
705
+ }, kn = function(e, t) {
169
706
  const n = t.parentElement.nextSibling;
170
707
  if (n && n.firstChild) {
171
708
  const o = n.firstChild.firstChild.firstChild;
172
709
  e.selectNode(o);
173
710
  }
174
- }, Re = function(e, t) {
711
+ }, Be = function(e, t) {
175
712
  const n = e.currentNode || e.currentNodes?.[0];
176
713
  if (!n) return;
177
714
  const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
178
- o.parent ? s.className === t ? Et(e, n) : o.parent?.parent ? Ct(e, n) : xt(e) : t === B.LHS ? bt(e) : wt(e);
179
- }, Be = function(e, t) {
715
+ o.parent ? s.className === t ? kn(e, n) : o.parent?.parent ? Nn(e, n) : Sn(e) : t === I.LHS ? Cn(e) : En(e);
716
+ }, Fe = function(e, t) {
180
717
  const n = e.currentNode;
181
718
  if (!n || !n.nodeObj.parent) return;
182
719
  const s = t + "Sibling", i = n.parentElement.parentElement[s];
@@ -191,23 +728,23 @@ const H = (e, t) => {
191
728
  e.scale(o - s, n);
192
729
  }
193
730
  };
194
- function St(e, t) {
731
+ function Tn(e, t) {
195
732
  t = t === !0 ? {} : t;
196
733
  const n = () => {
197
734
  e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
198
735
  };
199
736
  let o = !1, s = null;
200
737
  const i = (r) => {
201
- const c = e.nodeData;
738
+ const a = e.nodeData;
202
739
  if (r.key === "0")
203
- for (const a of c.children)
204
- Q(a, !1);
740
+ for (const d of a.children)
741
+ Q(d, !1);
205
742
  if (r.key === "=")
206
- for (const a of c.children)
207
- Q(a, !0);
743
+ for (const d of a.children)
744
+ Q(d, !0);
208
745
  if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
209
- for (const a of c.children)
210
- Q(a, !0, Number(r.key) - 1);
746
+ for (const d of a.children)
747
+ Q(d, !0, Number(r.key) - 1);
211
748
  e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
212
749
  }, l = {
213
750
  Enter: (r) => {
@@ -228,35 +765,26 @@ function St(e, t) {
228
765
  else {
229
766
  if (r.metaKey || r.ctrlKey)
230
767
  return e.initSide();
231
- Be(e, "previous");
768
+ Fe(e, "previous");
232
769
  }
233
770
  },
234
771
  ArrowDown: (r) => {
235
- r.altKey ? e.moveDownNode() : Be(e, "next");
772
+ r.altKey ? e.moveDownNode() : Fe(e, "next");
236
773
  },
237
774
  ArrowLeft: (r) => {
238
775
  if (r.metaKey || r.ctrlKey)
239
776
  return e.initLeft();
240
- Re(e, B.LHS);
777
+ Be(e, I.LHS);
241
778
  },
242
779
  ArrowRight: (r) => {
243
780
  if (r.metaKey || r.ctrlKey)
244
781
  return e.initRight();
245
- Re(e, B.RHS);
782
+ Be(e, I.RHS);
246
783
  },
247
784
  PageUp: () => e.moveUpNode(),
248
785
  PageDown: () => {
249
786
  e.moveDownNode();
250
787
  },
251
- c: (r) => {
252
- (r.metaKey || r.ctrlKey) && (e.waitCopy = e.currentNodes);
253
- },
254
- x: (r) => {
255
- (r.metaKey || r.ctrlKey) && (e.waitCopy = e.currentNodes, n());
256
- },
257
- v: (r) => {
258
- !e.waitCopy || !e.currentNode || (r.metaKey || r.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
259
- },
260
788
  "=": (r) => {
261
789
  (r.metaKey || r.ctrlKey) && J(e, "in");
262
790
  },
@@ -280,12 +808,39 @@ function St(e, t) {
280
808
  ...t
281
809
  };
282
810
  e.container.onkeydown = (r) => {
283
- if (r.preventDefault(), !e.editable) return;
284
- const c = l[r.key];
285
- c && c(r);
811
+ if ((r.ctrlKey || r.metaKey) && ["c", "v", "x"].includes(r.key) || r.preventDefault(), !e.editable) return;
812
+ const d = l[r.key];
813
+ d && d(r);
814
+ };
815
+ const c = (r) => {
816
+ if (e.currentNodes.length === 0) return !1;
817
+ if (r.clipboardData) {
818
+ const a = _e(e.currentNodes).map((h) => h.nodeObj), d = Oe({
819
+ magic: Ie,
820
+ data: a
821
+ });
822
+ return r.clipboardData.setData("text/plain", d), r.preventDefault(), !0;
823
+ }
824
+ return !1;
286
825
  };
826
+ e.container.addEventListener("copy", c), e.container.addEventListener("cut", (r) => {
827
+ c(r) && n();
828
+ }), e.container.addEventListener("paste", (r) => {
829
+ const a = r.clipboardData?.getData("text/plain");
830
+ if (a)
831
+ try {
832
+ const d = JSON.parse(a);
833
+ if (d && d.magic === Ie && Array.isArray(d.data)) {
834
+ const h = d.data, u = h.map((y) => ({ nodeObj: y }));
835
+ h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
836
+ return;
837
+ }
838
+ } catch {
839
+ }
840
+ e.pasteHandler && e.pasteHandler(r);
841
+ });
287
842
  }
288
- const xe = document, Nt = function(e, t) {
843
+ const xe = document, _n = function(e, t) {
289
844
  if (!t)
290
845
  return ge(e), e;
291
846
  let n = e.querySelector(".insert-preview");
@@ -296,17 +851,17 @@ const xe = document, Nt = function(e, t) {
296
851
  const t = e.querySelectorAll(".insert-preview");
297
852
  for (const n of t || [])
298
853
  n.remove();
299
- }, Ie = function(e, t) {
854
+ }, Ye = function(e, t) {
300
855
  for (const n of t) {
301
856
  const o = n.parentElement.parentElement.contains(e);
302
857
  if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
303
858
  }
304
859
  return !0;
305
- }, kt = function(e) {
860
+ }, Ln = function(e) {
306
861
  const t = document.createElement("div");
307
862
  return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
308
863
  };
309
- class Tt {
864
+ class An {
310
865
  mind;
311
866
  isMoving = !1;
312
867
  interval = null;
@@ -323,31 +878,31 @@ class Tt {
323
878
  this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
324
879
  }
325
880
  }
326
- function _t(e) {
881
+ function Dn(e) {
327
882
  return {
328
883
  isDragging: !1,
329
884
  insertType: null,
330
885
  meet: null,
331
- ghost: kt(e),
332
- edgeMoveController: new Tt(e),
886
+ ghost: Ln(e),
887
+ edgeMoveController: new An(e),
333
888
  startX: 0,
334
889
  startY: 0,
335
890
  pointerId: null
336
891
  };
337
892
  }
338
- const Lt = 5;
339
- function Fe(e, t, n, o = !1) {
893
+ const Mn = 5;
894
+ function We(e, t, n, o = !1) {
340
895
  if (e.spacePressed) return !1;
341
896
  const s = n.target;
342
897
  if (s?.tagName !== "ME-TPC" || !s.nodeObj.parent) return !1;
343
- t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection.cancel();
898
+ t.startX = n.clientX, t.startY = n.clientY, t.pointerId = n.pointerId, e.selection?.cancel();
344
899
  let i = e.currentNodes;
345
- return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && st(e, t), !0;
900
+ return i?.includes(s) || (e.selectNode(s), i = e.currentNodes), e.dragged = i, o && ft(e, t), !0;
346
901
  }
347
- function ot(e, t, n) {
902
+ function ht(e, t, n) {
348
903
  e.style.transform = `translate(${t + 10}px, ${n + 10}px)`, e.style.display = "block";
349
904
  }
350
- function st(e, t) {
905
+ function ft(e, t) {
351
906
  const { dragged: n } = e;
352
907
  if (!n) return;
353
908
  const o = document.activeElement;
@@ -356,31 +911,31 @@ function st(e, t) {
356
911
  s.parentElement.parentElement.style.opacity = "0.5";
357
912
  e.dragMoveHelper.clear();
358
913
  }
359
- function At(e, t, n) {
914
+ function Pn(e, t, n) {
360
915
  const { dragged: o } = e;
361
916
  if (!o || t.pointerId !== n.pointerId) return;
362
917
  const s = n.clientX - t.startX, i = n.clientY - t.startY, l = Math.sqrt(s * s + i * i);
363
- if (!t.isDragging && l > Lt && st(e, t), !t.isDragging) return;
364
- ot(t.ghost, n.clientX, n.clientY);
365
- const r = e.container.getBoundingClientRect();
366
- n.clientX < r.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > r.x + r.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < r.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > r.y + r.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), ge(t.meet);
367
- const c = 12 * e.scaleVal, a = xe.elementFromPoint(n.clientX, n.clientY - c);
368
- if (Ie(a, o)) {
918
+ if (!t.isDragging && l > Mn && ft(e, t), !t.isDragging) return;
919
+ ht(t.ghost, n.clientX, n.clientY);
920
+ const c = e.container.getBoundingClientRect();
921
+ n.clientX < c.x + 50 ? t.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? t.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? t.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? t.edgeMoveController.move(0, -1) : t.edgeMoveController.stop(), ge(t.meet);
922
+ const r = 12 * e.scaleVal, a = xe.elementFromPoint(n.clientX, n.clientY - r);
923
+ if (Ye(a, o)) {
369
924
  t.meet = a;
370
925
  const d = a.getBoundingClientRect(), h = d.y;
371
926
  n.clientY > h + d.height ? t.insertType = "after" : t.insertType = "in";
372
927
  } else {
373
- const d = xe.elementFromPoint(n.clientX, n.clientY + c);
374
- if (Ie(d, o)) {
928
+ const d = xe.elementFromPoint(n.clientX, n.clientY + r);
929
+ if (Ye(d, o)) {
375
930
  t.meet = d;
376
931
  const u = d.getBoundingClientRect().y;
377
932
  n.clientY < u ? t.insertType = "before" : t.insertType = "in";
378
933
  } else
379
934
  t.insertType = null, t.meet = null;
380
935
  }
381
- t.meet && Nt(t.meet, t.insertType);
936
+ t.meet && _n(t.meet, t.insertType);
382
937
  }
383
- function Mt(e, t, n) {
938
+ function On(e, t, n) {
384
939
  const { dragged: o } = e;
385
940
  if (!(!o || t.pointerId !== n.pointerId)) {
386
941
  t.edgeMoveController.stop();
@@ -398,25 +953,25 @@ function ve(e, t) {
398
953
  t.meet && ge(t.meet), t.ghost.style.display = "none", t.ghost.innerHTML = "", e.dragged = null, t.isDragging = !1, t.insertType = null, t.meet = null, t.pointerId = null;
399
954
  }
400
955
  }
401
- function Dt(e) {
956
+ function $n(e) {
402
957
  return () => {
403
958
  };
404
959
  }
405
- function Pt(e) {
960
+ function jn(e) {
406
961
  const { dragMoveHelper: t } = e;
407
962
  let n = 0;
408
963
  e.spacePressed = !1;
409
964
  let o = null;
410
- const s = /* @__PURE__ */ new Map(), i = e.draggable ? _t(e) : null;
411
- let l = null, r = null, c = null, a = null;
965
+ const s = /* @__PURE__ */ new Map(), i = e.editable ? Dn(e) : null;
966
+ let l = null, c = null, r = null, a = null;
412
967
  const d = 500, h = 10, u = () => {
413
- l !== null && (clearTimeout(l), l = null, r = null, c = null, a = null);
968
+ l !== null && (clearTimeout(l), l = null, c = null, r = null, a = null);
414
969
  }, y = (f, w) => {
415
970
  f.hasPointerCapture && f.hasPointerCapture(w) && f.releasePointerCapture(w);
416
971
  }, v = (f, w) => {
417
972
  const k = f.closest(".svg-label");
418
973
  if (k) {
419
- const M = k.dataset.svgId, ie = k.dataset.type, ne = document.getElementById(M);
974
+ const D = k.dataset.svgId, ie = k.dataset.type, ne = document.getElementById(D);
420
975
  if (ne) {
421
976
  if (ie === "arrow")
422
977
  return w ? e.editArrowLabel(ne) : e.selectArrow(ne), !0;
@@ -425,14 +980,14 @@ function Pt(e) {
425
980
  }
426
981
  }
427
982
  if (f.closest(".topiclinks")) {
428
- const M = f.closest("g");
429
- if (M)
430
- return w ? e.editArrowLabel(M) : e.selectArrow(M), !0;
983
+ const D = f.closest("g");
984
+ if (D)
985
+ return w ? e.editArrowLabel(D) : e.selectArrow(D), !0;
431
986
  }
432
987
  if (f.closest(".summary")) {
433
- const M = f.closest("g");
434
- if (M)
435
- return w ? e.editSummary(M) : e.selectSummary(M), !0;
988
+ const D = f.closest("g");
989
+ if (D)
990
+ return w ? e.editSummary(D) : e.selectSummary(D), !0;
436
991
  }
437
992
  return !1;
438
993
  }, p = (f) => {
@@ -473,8 +1028,8 @@ function Pt(e) {
473
1028
  f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
474
1029
  }, L = (f) => {
475
1030
  if (f.pointerType === "touch" && (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), s.size === 2)) {
476
- const [M, ie] = Array.from(s.values());
477
- o = He(M, ie), u();
1031
+ const [D, ie] = Array.from(s.values());
1032
+ o = Re(D, ie), u();
478
1033
  }
479
1034
  t.moved = !1;
480
1035
  const w = f.target, k = e.mouseSelectionButton === 0 ? 2 : 0;
@@ -482,10 +1037,10 @@ function Pt(e) {
482
1037
  if (f.pointerType === "touch" && s.size > 1)
483
1038
  (i.isDragging || i.pointerId !== null) && ve(e, i);
484
1039
  else if (f.pointerType === "touch" && s.size === 1)
485
- (de(w) || w.closest("me-tpc")) && (r = { x: f.clientX, y: f.clientY }, c = w, a = f.pointerId, l = window.setTimeout(() => {
486
- Fe(e, i, f, !0) && (c && c.setPointerCapture(f.pointerId), ot(i.ghost, f.clientX, f.clientY)), l = null, r = null, c = null, a = null;
1040
+ (de(w) || w.closest("me-tpc")) && (c = { x: f.clientX, y: f.clientY }, r = w, a = f.pointerId, l = window.setTimeout(() => {
1041
+ We(e, i, f, !0) && (r && r.setPointerCapture(f.pointerId), ht(i.ghost, f.clientX, f.clientY)), l = null, c = null, r = null, a = null;
487
1042
  }, d));
488
- else if (f.pointerType === "mouse" && Fe(e, i, f, !1)) {
1043
+ else if (f.pointerType === "mouse" && We(e, i, f, !1)) {
489
1044
  w.setPointerCapture(f.pointerId);
490
1045
  return;
491
1046
  }
@@ -494,12 +1049,12 @@ function Pt(e) {
494
1049
  !$ && !Y || (t.x = f.clientX, t.y = f.clientY, w.className !== "circle" && w.contentEditable !== "plaintext-only" && (t.mousedown = !0, w.setPointerCapture(f.pointerId)));
495
1050
  }, T = (f) => {
496
1051
  if (f.pointerType === "touch" && s.has(f.pointerId)) {
497
- if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && r !== null && f.pointerId === a) {
498
- const w = f.clientX - r.x, k = f.clientY - r.y;
1052
+ if (s.set(f.pointerId, { x: f.clientX, y: f.clientY }), l !== null && c !== null && f.pointerId === a) {
1053
+ const w = f.clientX - c.x, k = f.clientY - c.y;
499
1054
  Math.sqrt(w * w + k * k) > h && u();
500
1055
  }
501
1056
  if (s.size >= 2) {
502
- const [w, k] = Array.from(s.values()), $ = He(w, k);
1057
+ const [w, k] = Array.from(s.values()), $ = Re(w, k);
503
1058
  if (o == null)
504
1059
  o = $;
505
1060
  else {
@@ -515,7 +1070,7 @@ function Pt(e) {
515
1070
  return;
516
1071
  }
517
1072
  }
518
- if (!(i && i.pointerId !== null && (At(e, i, f), i.isDragging))) {
1073
+ if (!(i && i.pointerId !== null && (Pn(e, i, f), i.isDragging))) {
519
1074
  if (f.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
520
1075
  const w = f.clientX - t.x, k = f.clientY - t.y;
521
1076
  t.onMove(w, k);
@@ -525,7 +1080,7 @@ function Pt(e) {
525
1080
  }, E = (f) => {
526
1081
  if (f.pointerType === "touch" && (s.delete(f.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
527
1082
  const w = i.isDragging;
528
- if (Mt(e, i, f), y(f.target, f.pointerId), w)
1083
+ if (On(e, i, f), y(f.target, f.pointerId), w)
529
1084
  return;
530
1085
  }
531
1086
  t.mousedown && (y(f.target, f.pointerId), t.clear());
@@ -539,10 +1094,10 @@ function Pt(e) {
539
1094
  de(w) && !w.classList.contains("selected") && e.selectNode(w), setTimeout(() => {
540
1095
  e.dragMoveHelper.moved || e.bus.fire("showContextMenu", f);
541
1096
  }, 200);
542
- }, D = (f) => {
1097
+ }, M = (f) => {
543
1098
  f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey ? f.deltaY < 0 ? J(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && J(e, "out", e.dragMoveHelper) : f.shiftKey ? e.move(-f.deltaY, 0) : e.move(-f.deltaX, -f.deltaY);
544
1099
  }, { container: _ } = e;
545
- return nt([
1100
+ return st([
546
1101
  { dom: _, evt: "pointerdown", func: L },
547
1102
  { dom: _, evt: "pointermove", func: T },
548
1103
  { dom: _, evt: "pointerup", func: E },
@@ -551,13 +1106,13 @@ function Pt(e) {
551
1106
  { dom: _, evt: "click", func: p },
552
1107
  { dom: _, evt: "dblclick", func: g },
553
1108
  { dom: _, evt: "contextmenu", func: N },
554
- { dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : D },
1109
+ { dom: _, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : M },
555
1110
  { dom: _, evt: "blur", func: C },
556
1111
  { dom: _, evt: "keydown", func: b },
557
1112
  { dom: _, evt: "keyup", func: x }
558
1113
  ]);
559
1114
  }
560
- function Ot() {
1115
+ function Hn() {
561
1116
  return {
562
1117
  handlers: {},
563
1118
  addListener: function(e, t) {
@@ -574,158 +1129,23 @@ function Ot() {
574
1129
  if (!this.handlers[e]) return;
575
1130
  const n = this.handlers[e];
576
1131
  if (!t)
577
- n.length = 0;
578
- else if (n.length)
579
- for (let o = 0; o < n.length; o++)
580
- n[o] === t && this.handlers[e].splice(o, 1);
581
- }
582
- };
583
- }
584
- const ue = document, $t = function() {
585
- this.nodes.innerHTML = "";
586
- const e = this.createTopic(this.nodeData);
587
- Ae.call(this, e, this.nodeData), e.draggable = !1;
588
- const t = ue.createElement("me-root");
589
- t.appendChild(e);
590
- const n = this.nodeData.children || [];
591
- if (this.direction === 2) {
592
- let o = 0, s = 0;
593
- n.map((i) => {
594
- i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
595
- });
596
- }
597
- jt(this, n, t);
598
- }, jt = function(e, t, n) {
599
- const o = ue.createElement("me-main");
600
- o.className = B.LHS;
601
- const s = ue.createElement("me-main");
602
- s.className = B.RHS;
603
- for (let i = 0; i < t.length; i++) {
604
- const l = t[i], { grp: r } = e.createWrapper(l);
605
- e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : s.appendChild(r) : e.direction === 0 ? o.appendChild(r) : s.appendChild(r);
606
- }
607
- e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
608
- }, Ht = function(e, t) {
609
- const n = ue.createElement("me-children");
610
- for (let o = 0; o < t.length; o++) {
611
- const s = t[o], { grp: i } = e.createWrapper(s);
612
- n.appendChild(i);
613
- }
614
- return n;
615
- }, P = document, it = function(e, t) {
616
- const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
617
- if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
618
- return o;
619
- }, Ae = function(e, t) {
620
- if (e.innerHTML = "", t.style) {
621
- const n = t.style;
622
- for (const o in n)
623
- e.style[o] = n[o];
624
- }
625
- if (t.dangerouslySetInnerHTML) {
626
- e.innerHTML = t.dangerouslySetInnerHTML;
627
- return;
628
- }
629
- if (t.image) {
630
- const n = t.image;
631
- if (n.url && n.width && n.height) {
632
- const o = P.createElement("img");
633
- o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
634
- }
635
- } else e.image && (e.image = void 0);
636
- {
637
- const n = P.createElement("span");
638
- n.className = "text", this.markdown ? n.innerHTML = this.markdown(t.topic, t) : n.textContent = t.topic, e.appendChild(n), e.text = n;
639
- }
640
- if (t.hyperLink) {
641
- const n = P.createElement("a");
642
- n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
643
- } else e.link && (e.link = void 0);
644
- if (t.icons && t.icons.length) {
645
- const n = P.createElement("span");
646
- n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${we(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
647
- } else e.icons && (e.icons = void 0);
648
- if (t.tags && t.tags.length) {
649
- const n = P.createElement("div");
650
- n.className = "tags", t.tags.forEach((o) => {
651
- const s = P.createElement("span");
652
- 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);
653
- }), e.appendChild(n), e.tags = n;
654
- } else e.tags && (e.tags = void 0);
655
- }, Rt = function(e, t) {
656
- const n = P.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
657
- if (n.appendChild(o), !t && e.children && e.children.length > 0) {
658
- const i = Me(e.expanded);
659
- if (o.appendChild(i), e.expanded !== !1) {
660
- const l = Ht(this, e.children);
661
- n.appendChild(l);
662
- }
663
- }
664
- return { grp: n, top: o, tpc: s };
665
- }, Bt = function(e) {
666
- const t = P.createElement("me-parent"), n = this.createTopic(e);
667
- return Ae.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
668
- }, It = function(e) {
669
- const t = P.createElement("me-children");
670
- return t.append(...e), t;
671
- }, Ft = function(e) {
672
- const t = P.createElement("me-tpc");
673
- return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t;
674
- };
675
- function rt(e) {
676
- const t = P.createRange();
677
- t.selectNodeContents(e);
678
- const n = window.getSelection();
679
- n && (n.removeAllRanges(), n.addRange(t));
680
- }
681
- const Yt = function(e) {
682
- if (!e) return;
683
- const t = P.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = H(this.nodes, e);
684
- this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
685
- const l = getComputedStyle(e);
686
- t.style.cssText = `
687
- left: ${s}px;
688
- top: ${i}px;
689
- min-width:${e.offsetWidth - 8}px;
690
- color:${l.color};
691
- font-size:${l.fontSize};
692
- padding:${l.padding};
693
- margin:${l.margin};
694
- background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
695
- border: ${l.border};
696
- border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), rt(t), this.bus.fire("operation", {
697
- name: "beginEdit",
698
- obj: e.nodeObj
699
- }), t.addEventListener("keydown", (r) => {
700
- r.stopPropagation();
701
- const c = r.key;
702
- if (c === "Enter" || c === "Tab") {
703
- if (r.shiftKey) return;
704
- r.preventDefault(), t.blur(), this.container.focus();
705
- }
706
- }), t.addEventListener("blur", () => {
707
- if (!t) return;
708
- t.remove();
709
- const r = t.textContent?.trim() || "";
710
- r === o || r === "" || (n.topic = r, this.markdown ? e.text.innerHTML = this.markdown(n.topic, n) : e.text.textContent = r, this.linkDiv(), this.bus.fire("operation", {
711
- name: "finishEdit",
712
- obj: n,
713
- origin: o
714
- }));
715
- });
716
- }, Me = function(e) {
717
- const t = P.createElement("me-epd");
718
- return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
719
- }, ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
1132
+ n.length = 0;
1133
+ else if (n.length)
1134
+ for (let o = 0; o < n.length; o++)
1135
+ n[o] === t && this.handlers[e].splice(o, 1);
1136
+ }
1137
+ };
1138
+ }
1139
+ const ee = document, R = "http://www.w3.org/2000/svg", me = function(e) {
720
1140
  const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
721
- let r = s;
722
- l === "middle" ? r = s - t / 2 : l === "end" && (r = s - t), e.style.left = `${r}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
1141
+ let c = s;
1142
+ l === "middle" ? c = s - t / 2 : l === "end" && (c = s - t), e.style.left = `${c}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
723
1143
  }, Ce = function(e, t, n, o) {
724
- const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
725
- c.className = "svg-label", c.style.color = i || "#666";
726
- const a = "label-" + r;
727
- return c.id = a, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor = s, c;
728
- }, lt = function(e, t, n) {
1144
+ const { anchor: s = "middle", color: i, dataType: l, svgId: c } = o, r = document.createElement("div");
1145
+ r.className = "svg-label", r.style.color = i || "#666";
1146
+ const a = "label-" + c;
1147
+ return r.id = a, r.innerHTML = e, r.dataset.type = l, r.dataset.svgId = c, r.dataset.x = t.toString(), r.dataset.y = n.toString(), r.dataset.anchor = s, r;
1148
+ }, ut = function(e, t, n) {
729
1149
  const o = ee.createElementNS(R, "path");
730
1150
  return A(o, {
731
1151
  d: e,
@@ -736,10 +1156,10 @@ const Yt = function(e) {
736
1156
  }, oe = function(e) {
737
1157
  const t = ee.createElementNS(R, "svg");
738
1158
  return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
739
- }, Ye = function() {
1159
+ }, Xe = function() {
740
1160
  const e = ee.createElementNS(R, "line");
741
1161
  return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
742
- }, Wt = function(e, t, n, o) {
1162
+ }, Rn = function(e, t, n, o) {
743
1163
  const s = ee.createElementNS(R, "g");
744
1164
  return [
745
1165
  {
@@ -754,24 +1174,24 @@ const Yt = function(e) {
754
1174
  name: "arrow2",
755
1175
  d: n
756
1176
  }
757
- ].forEach((l, r) => {
758
- const c = l.d, a = ee.createElementNS(R, "path"), d = {
759
- d: c,
1177
+ ].forEach((l, c) => {
1178
+ const r = l.d, a = ee.createElementNS(R, "path"), d = {
1179
+ d: r,
760
1180
  stroke: o?.stroke || "rgb(227, 125, 116)",
761
1181
  fill: "none",
762
1182
  "stroke-linecap": o?.strokeLinecap || "cap",
763
1183
  "stroke-width": String(o?.strokeWidth || "2")
764
1184
  };
765
- o?.opacity !== void 0 && (d.opacity = String(o.opacity)), A(a, d), r === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
1185
+ o?.opacity !== void 0 && (d.opacity = String(o.opacity)), A(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
766
1186
  const h = ee.createElementNS(R, "path");
767
1187
  A(h, {
768
- d: c,
1188
+ d: r,
769
1189
  stroke: "transparent",
770
1190
  fill: "none",
771
1191
  "stroke-width": "15"
772
1192
  }), s.appendChild(h), s.appendChild(a), s[l.name] = a;
773
1193
  }), s;
774
- }, ct = function(e, t, n) {
1194
+ }, pt = function(e, t, n) {
775
1195
  if (!t) return;
776
1196
  const o = n.label, s = t.cloneNode(!0);
777
1197
  e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
@@ -796,32 +1216,32 @@ const Yt = function(e) {
796
1216
  obj: n
797
1217
  }));
798
1218
  });
799
- }, Xt = function(e) {
1219
+ }, In = function(e) {
800
1220
  const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
801
1221
  this.lines.innerHTML = "";
802
- for (let r = 0; r < l.length; r++) {
803
- const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = H(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, v = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[r % g.length];
804
- if (a.style.borderColor = m, this.lines.appendChild(lt(p, m, "3")), e && e !== c)
1222
+ for (let c = 0; c < l.length; c++) {
1223
+ const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = H(this.nodes, a), u = a.offsetWidth, y = a.offsetHeight, v = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: y, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length];
1224
+ if (a.style.borderColor = m, this.lines.appendChild(ut(p, m, "3")), e && e !== r)
805
1225
  continue;
806
- const b = oe("subLines"), x = c.lastChild;
807
- x.tagName === "svg" && x.remove(), c.appendChild(b), at(this, b, m, c, v, !0);
1226
+ const b = oe("subLines"), x = r.lastChild;
1227
+ x.tagName === "svg" && x.remove(), r.appendChild(b), gt(this, b, m, r, v, !0);
808
1228
  }
809
1229
  this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
810
- }, at = function(e, t, n, o, s, i) {
811
- const l = o.firstChild, r = o.children[1].children;
812
- if (r.length === 0) return;
813
- const c = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
814
- for (let u = 0; u < r.length; u++) {
815
- const y = r[u], v = y.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: c, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: b, direction: s, isFirst: i });
816
- t.appendChild(lt(L, x, "2"));
1230
+ }, gt = function(e, t, n, o, s, i) {
1231
+ const l = o.firstChild, c = o.children[1].children;
1232
+ if (c.length === 0) return;
1233
+ const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
1234
+ for (let u = 0; u < c.length; u++) {
1235
+ const y = c[u], v = y.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, b = v.offsetHeight, x = v.firstChild.nodeObj.branchColor || n, L = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: b, direction: s, isFirst: i });
1236
+ t.appendChild(ut(L, x, "2"));
817
1237
  const T = v.children[1];
818
1238
  if (T) {
819
1239
  if (!T.expanded) continue;
820
1240
  } else
821
1241
  continue;
822
- at(e, t, x, y, s);
1242
+ gt(e, t, x, y, s);
823
1243
  }
824
- }, We = {
1244
+ }, ze = {
825
1245
  addChild: "插入子节点",
826
1246
  addParent: "插入父节点",
827
1247
  addSibling: "插入同级节点",
@@ -834,9 +1254,9 @@ const Yt = function(e) {
834
1254
  linkBidirectional: "双向连接",
835
1255
  clickTips: "请点击目标节点",
836
1256
  summary: "摘要"
837
- }, Xe = {
838
- cn: We,
839
- zh_CN: We,
1257
+ }, Ge = {
1258
+ cn: ze,
1259
+ zh_CN: ze,
840
1260
  zh_TW: {
841
1261
  addChild: "插入子節點",
842
1262
  addParent: "插入父節點",
@@ -978,7 +1398,7 @@ const Yt = function(e) {
978
1398
  summary: "Rezumat"
979
1399
  }
980
1400
  };
981
- function zt(e, t) {
1401
+ function Bn(e, t) {
982
1402
  t = t === !0 ? {
983
1403
  focus: !0,
984
1404
  link: !0
@@ -989,8 +1409,8 @@ function zt(e, t) {
989
1409
  }, o = (E, C, S) => {
990
1410
  const N = document.createElement("li");
991
1411
  return N.id = E, N.innerHTML = `<span>${we(C)}</span><span ${S ? 'class="key"' : ""}>${we(S)}</span>`, N;
992
- }, s = Xe[e.locale] ? e.locale : "en", i = Xe[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), a = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), h = o("cm-unfucus", i.cancelFocus, ""), u = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), v = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), g = o("cm-summary", i.summary, ""), m = document.createElement("ul");
993
- if (m.className = "menu-list", m.appendChild(l), m.appendChild(r), m.appendChild(c), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(y), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
1412
+ }, s = Ge[e.locale] ? e.locale : "en", i = Ge[s], l = o("cm-add_child", i.addChild, "Tab"), c = o("cm-add_parent", i.addParent, "Ctrl + Enter"), r = o("cm-add_sibling", i.addSibling, "Enter"), a = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), h = o("cm-unfucus", i.cancelFocus, ""), u = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), v = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), g = o("cm-summary", i.summary, ""), m = document.createElement("ul");
1413
+ if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(y), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
994
1414
  for (let E = 0; E < t.extend.length; E++) {
995
1415
  const C = t.extend[E], S = o(C.name, C.name, C.key || "");
996
1416
  m.appendChild(S), S.onclick = (N) => {
@@ -1003,18 +1423,18 @@ function zt(e, t) {
1003
1423
  const L = (E) => {
1004
1424
  const C = E.target;
1005
1425
  if (de(C)) {
1006
- C.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (d.className = "disabled", u.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", y.className = "", r.className = "", c.className = "", a.className = ""), b.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
1007
- const S = m.getBoundingClientRect(), N = m.offsetHeight, D = m.offsetWidth, _ = E.clientY - S.top, F = E.clientX - S.left;
1008
- N + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), D + F > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = F + 10 + "px");
1426
+ C.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (d.className = "disabled", u.className = "disabled", y.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", y.className = "", c.className = "", r.className = "", a.className = ""), b.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
1427
+ const S = m.getBoundingClientRect(), N = m.offsetHeight, M = m.offsetWidth, _ = E.clientY - S.top, F = E.clientX - S.left;
1428
+ N + _ > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = _ + 15 + "px"), M + F > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = F + 10 + "px");
1009
1429
  }
1010
1430
  };
1011
1431
  e.bus.addListener("showContextMenu", L), b.onclick = (E) => {
1012
1432
  E.target === b && (b.hidden = !0);
1013
1433
  }, l.onclick = () => {
1014
1434
  e.addChild(), b.hidden = !0;
1015
- }, r.onclick = () => {
1016
- e.insertParent(), b.hidden = !0;
1017
1435
  }, c.onclick = () => {
1436
+ e.insertParent(), b.hidden = !0;
1437
+ }, r.onclick = () => {
1018
1438
  x || (e.insertSibling("after"), b.hidden = !0);
1019
1439
  }, a.onclick = () => {
1020
1440
  x || (e.removeNodes(e.currentNodes || []), b.hidden = !0);
@@ -1034,8 +1454,8 @@ function zt(e, t) {
1034
1454
  "click",
1035
1455
  (N) => {
1036
1456
  N.preventDefault(), S.remove();
1037
- const D = N.target;
1038
- (D.parentElement.tagName === "ME-PARENT" || D.parentElement.tagName === "ME-ROOT") && e.createArrow(C, D, E);
1457
+ const M = N.target;
1458
+ (M.parentElement.tagName === "ME-PARENT" || M.parentElement.tagName === "ME-ROOT") && e.createArrow(C, M, E);
1039
1459
  },
1040
1460
  {
1041
1461
  once: !0
@@ -1045,10 +1465,10 @@ function zt(e, t) {
1045
1465
  return v.onclick = () => T(), p.onclick = () => T({ bidirectional: !0 }), g.onclick = () => {
1046
1466
  b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
1047
1467
  }, () => {
1048
- l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null, v.onclick = null, g.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
1468
+ l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, y.onclick = null, v.onclick = null, g.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
1049
1469
  };
1050
1470
  }
1051
- const Gt = function(e) {
1471
+ const Fn = function(e) {
1052
1472
  return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
1053
1473
  type: "summary",
1054
1474
  value: e.obj.id
@@ -1063,14 +1483,14 @@ const Gt = function(e) {
1063
1483
  value: [e.obj.id]
1064
1484
  };
1065
1485
  };
1066
- function Kt(e) {
1486
+ function Yn(e) {
1067
1487
  let t = [], n = -1, o = e.getData(), s = [];
1068
1488
  e.undo = function() {
1069
1489
  if (n > -1) {
1070
- const c = t[n];
1071
- o = c.prev, e.refresh(c.prev);
1490
+ const r = t[n];
1491
+ o = r.prev, e.refresh(r.prev);
1072
1492
  try {
1073
- c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentTarget.value.map((a) => this.findEle(a))) : e.selectNodes(c.currentSelected.map((a) => this.findEle(a))));
1493
+ r.currentTarget.type === "nodes" && (r.operation === "removeNodes" ? e.selectNodes(r.currentTarget.value.map((a) => this.findEle(a))) : e.selectNodes(r.currentSelected.map((a) => this.findEle(a))));
1074
1494
  } catch {
1075
1495
  } finally {
1076
1496
  n--;
@@ -1079,51 +1499,51 @@ function Kt(e) {
1079
1499
  }, e.redo = function() {
1080
1500
  if (n < t.length - 1) {
1081
1501
  n++;
1082
- const c = t[n];
1083
- o = c.next, e.refresh(c.next);
1502
+ const r = t[n];
1503
+ o = r.next, e.refresh(r.next);
1084
1504
  try {
1085
- c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentSelected.map((a) => this.findEle(a))) : e.selectNodes(c.currentTarget.value.map((a) => this.findEle(a))));
1505
+ r.currentTarget.type === "nodes" && (r.operation === "removeNodes" ? e.selectNodes(r.currentSelected.map((a) => this.findEle(a))) : e.selectNodes(r.currentTarget.value.map((a) => this.findEle(a))));
1086
1506
  } catch {
1087
1507
  }
1088
1508
  }
1089
1509
  };
1090
- const i = function(c) {
1091
- if (c.name === "beginEdit") return;
1510
+ const i = function(r) {
1511
+ if (r.name === "beginEdit") return;
1092
1512
  t = t.slice(0, n + 1);
1093
1513
  const a = e.getData(), d = {
1094
1514
  prev: o,
1095
- operation: c.name,
1515
+ operation: r.name,
1096
1516
  currentSelected: s.map((h) => h.id),
1097
- currentTarget: Gt(c),
1517
+ currentTarget: Fn(r),
1098
1518
  next: a
1099
1519
  };
1100
1520
  t.push(d), o = a, n = t.length - 1;
1101
- }, l = function(c) {
1102
- (c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
1103
- }, r = function() {
1104
- s = e.currentNodes.map((c) => c.nodeObj);
1521
+ }, l = function(r) {
1522
+ (r.metaKey || r.ctrlKey) && (r.shiftKey && r.key === "Z" || r.key === "y") ? e.redo() : (r.metaKey || r.ctrlKey) && r.key === "z" && e.undo();
1523
+ }, c = function() {
1524
+ s = e.currentNodes.map((r) => r.nodeObj);
1105
1525
  };
1106
- return e.bus.addListener("operation", i), e.bus.addListener("selectNodes", r), e.container.addEventListener("keydown", l), () => {
1107
- e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
1526
+ return e.bus.addListener("operation", i), e.bus.addListener("selectNodes", c), e.container.addEventListener("keydown", l), () => {
1527
+ e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", c), e.container.removeEventListener("keydown", l);
1108
1528
  };
1109
1529
  }
1110
- const 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="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>', Vt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="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>', 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="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>', 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="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>', en = '<?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>', tn = {
1111
- side: qt,
1112
- left: Vt,
1113
- right: Ut,
1114
- full: Jt,
1115
- living: Zt,
1116
- zoomin: Qt,
1117
- zoomout: en
1530
+ const Wn = '<?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>', Xn = '<?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>', zn = '<?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>', Gn = '<?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>', qn = '<?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>', Vn = '<?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>', Kn = '<?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>', Un = {
1531
+ side: Wn,
1532
+ left: Xn,
1533
+ right: zn,
1534
+ full: Gn,
1535
+ living: qn,
1536
+ zoomin: Vn,
1537
+ zoomout: Kn
1118
1538
  }, G = (e, t) => {
1119
1539
  const n = document.createElement("span");
1120
- return n.id = e, n.innerHTML = tn[t], n;
1540
+ return n.id = e, n.innerHTML = Un[t], n;
1121
1541
  };
1122
- function nn(e) {
1542
+ function Jn(e) {
1123
1543
  const t = document.createElement("div"), n = G("fullscreen", "full"), o = G("toCenter", "living"), s = G("zoomout", "zoomout"), i = G("zoomin", "zoomin");
1124
1544
  t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
1125
1545
  let l = null;
1126
- const r = () => {
1546
+ const c = () => {
1127
1547
  const a = e.container.getBoundingClientRect(), d = Le(e.map.style.transform), h = a.width / 2, u = a.height / 2, y = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
1128
1548
  l = {
1129
1549
  containerRect: a,
@@ -1131,14 +1551,14 @@ function nn(e) {
1131
1551
  mapCenterX: y,
1132
1552
  mapCenterY: v
1133
1553
  };
1134
- }, c = () => {
1554
+ }, r = () => {
1135
1555
  if (l) {
1136
1556
  const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, y = h - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, p = y - l.currentTransform.y;
1137
1557
  e.move(v, p);
1138
1558
  }
1139
1559
  };
1140
- return e.el.addEventListener("fullscreenchange", c), n.onclick = () => {
1141
- r(), document.fullscreenElement !== e.el ? e.el.requestFullscreen() : document.exitFullscreen();
1560
+ return e.el.addEventListener("fullscreenchange", r), n.onclick = () => {
1561
+ c(), document.fullscreenElement !== e.el ? e.el.requestFullscreen() : document.exitFullscreen();
1142
1562
  }, o.onclick = () => {
1143
1563
  e.toCenter();
1144
1564
  }, s.onclick = () => {
@@ -1147,7 +1567,7 @@ function nn(e) {
1147
1567
  e.scale(e.scaleVal + e.scaleSensitivity);
1148
1568
  }, t;
1149
1569
  }
1150
- function on(e) {
1570
+ function Zn(e) {
1151
1571
  const t = document.createElement("div"), n = G("tbltl", "left"), o = G("tbltr", "right"), s = G("tblts", "side");
1152
1572
  return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
1153
1573
  e.initLeft();
@@ -1157,10 +1577,10 @@ function on(e) {
1157
1577
  e.initSide();
1158
1578
  }, t;
1159
1579
  }
1160
- function sn(e) {
1161
- e.container.append(nn(e)), e.container.append(on(e));
1580
+ function Qn(e) {
1581
+ e.container.append(Jn(e)), e.container.append(Zn(e));
1162
1582
  }
1163
- class rn {
1583
+ class eo {
1164
1584
  _listeners = /* @__PURE__ */ new Map();
1165
1585
  addEventListener(t, n) {
1166
1586
  const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
@@ -1183,15 +1603,15 @@ class rn {
1183
1603
  off = this.removeEventListener;
1184
1604
  emit = this.dispatchEvent;
1185
1605
  }
1186
- const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e }, t, n) => {
1606
+ const qe = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e }, t, n) => {
1187
1607
  if (typeof t == "object")
1188
1608
  for (const [o, s] of Object.entries(t))
1189
- s !== void 0 && (e[o] = ze(s));
1190
- else n !== void 0 && (e[t] = ze(n));
1191
- }, Ge = (e = 0, t = 0, n = 0, o = 0) => {
1609
+ s !== void 0 && (e[o] = qe(s));
1610
+ else n !== void 0 && (e[t] = qe(n));
1611
+ }, Ve = (e = 0, t = 0, n = 0, o = 0) => {
1192
1612
  const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
1193
1613
  return { ...s, toJSON: () => JSON.stringify(s) };
1194
- }, ln = (e) => {
1614
+ }, to = (e) => {
1195
1615
  let t, n = -1, o = !1;
1196
1616
  return {
1197
1617
  next: (...s) => {
@@ -1214,16 +1634,16 @@ const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
1214
1634
  case "touch":
1215
1635
  return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
1216
1636
  }
1217
- }, cn = () => matchMedia("(hover: none), (pointer: coarse)").matches, an = () => "safari" in window, Ee = (e) => Array.isArray(e) ? e : [e], dt = (e) => (t, n, o, s = {}) => {
1637
+ }, no = () => matchMedia("(hover: none), (pointer: coarse)").matches, oo = () => "safari" in window, Ee = (e) => Array.isArray(e) ? e : [e], mt = (e) => (t, n, o, s = {}) => {
1218
1638
  (t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = Ee(n), t = Ee(t);
1219
1639
  for (const i of t)
1220
1640
  if (i)
1221
1641
  for (const l of n)
1222
1642
  i[e](l, o, { capture: !1, ...s });
1223
- }, X = dt("addEventListener"), j = dt("removeEventListener"), re = (e) => {
1643
+ }, X = mt("addEventListener"), j = mt("removeEventListener"), re = (e) => {
1224
1644
  const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
1225
1645
  return { x: t, y: n, target: o };
1226
- }, V = (e, t = document) => Ee(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), dn = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
1646
+ }, K = (e, t = document) => Ee(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), so = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
1227
1647
  switch (o) {
1228
1648
  case "alt":
1229
1649
  return e.altKey;
@@ -1232,18 +1652,18 @@ const ze = (e, t = "px") => typeof e == "number" ? e + t : e, W = ({ style: e },
1232
1652
  case "shift":
1233
1653
  return e.shiftKey;
1234
1654
  }
1235
- }) : !1), { abs: z, max: qe, min: Ve, ceil: Ue } = Math, Je = (e = []) => ({
1655
+ }) : !1), { abs: z, max: Ue, min: Je, ceil: Ze } = Math, Qe = (e = []) => ({
1236
1656
  stored: e,
1237
1657
  selected: [],
1238
1658
  touched: [],
1239
1659
  changed: { added: [], removed: [] }
1240
1660
  });
1241
- class hn extends rn {
1661
+ class io extends eo {
1242
1662
  static version = "mind-elixir-fork";
1243
1663
  // Options
1244
1664
  _options;
1245
1665
  // Selection store
1246
- _selection = Je();
1666
+ _selection = Qe();
1247
1667
  // Area element and clipping element
1248
1668
  _area;
1249
1669
  _clippingElement;
@@ -1256,7 +1676,7 @@ class hn extends rn {
1256
1676
  _latestElement;
1257
1677
  // Dynamically constructed area rect
1258
1678
  _areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
1259
- _areaRect = Ge();
1679
+ _areaRect = Ve();
1260
1680
  // If a single click is being performed, it's a single-click until the user dragged the mouse
1261
1681
  _singleClick = !0;
1262
1682
  _frame;
@@ -1323,7 +1743,7 @@ class hn extends rn {
1323
1743
  // https://stackoverflow.com/a/38268846
1324
1744
  pointerEvents: "none",
1325
1745
  zIndex: "1"
1326
- }), this._frame = ln((i) => {
1746
+ }), this._frame = to((i) => {
1327
1747
  this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
1328
1748
  }), this.enable();
1329
1749
  }
@@ -1332,10 +1752,10 @@ class hn extends rn {
1332
1752
  s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
1333
1753
  }
1334
1754
  _onTapStart(t, n = !1) {
1335
- const { x: o, y: s, target: i } = re(t), { document: l, startAreas: r, boundaries: c, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
1336
- if (t instanceof MouseEvent && !dn(t, d.triggers))
1755
+ const { x: o, y: s, target: i } = re(t), { document: l, startAreas: c, boundaries: r, features: a, behaviour: d } = this._options, h = i.getBoundingClientRect();
1756
+ if (t instanceof MouseEvent && !so(t, d.triggers))
1337
1757
  return;
1338
- const u = V(r, l), y = V(c, l);
1758
+ const u = K(c, l), y = K(r, l);
1339
1759
  this._targetElement = y.find((m) => Ke(m.getBoundingClientRect(), h));
1340
1760
  const v = t.composedPath(), p = u.find((m) => v.includes(m));
1341
1761
  if (this._targetBoundary = y.find((m) => v.includes(m)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
@@ -1354,10 +1774,10 @@ class hn extends rn {
1354
1774
  i = s.target;
1355
1775
  else if (n === "touch") {
1356
1776
  this.resolveSelectables();
1357
- const { x: r, y: c } = s;
1777
+ const { x: c, y: r } = s;
1358
1778
  i = this._selectables.find((a) => {
1359
1779
  const { right: d, left: h, top: u, bottom: y } = a.getBoundingClientRect();
1360
- return r < d && r > h && c < y && c > u;
1780
+ return c < d && c > h && r < y && r > u;
1361
1781
  });
1362
1782
  }
1363
1783
  if (!i)
@@ -1371,30 +1791,30 @@ class hn extends rn {
1371
1791
  }
1372
1792
  const { stored: l } = this._selection;
1373
1793
  if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
1374
- const r = this._latestElement, [c, a] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], d = [
1375
- ...this._selectables.filter((h) => h.compareDocumentPosition(c) & 4 && h.compareDocumentPosition(a) & 2),
1376
- c,
1794
+ const c = this._latestElement, [r, a] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i], d = [
1795
+ ...this._selectables.filter((h) => h.compareDocumentPosition(r) & 4 && h.compareDocumentPosition(a) & 2),
1796
+ r,
1377
1797
  a
1378
1798
  ];
1379
- this.select(d), this._latestElement = r;
1380
- } else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
1799
+ this.select(d), this._latestElement = c;
1800
+ } else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((c) => this._selection.stored.includes(c))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
1381
1801
  }
1382
1802
  _delayedTapMove(t) {
1383
1803
  const {
1384
1804
  container: n,
1385
1805
  document: o,
1386
1806
  behaviour: { startThreshold: s }
1387
- } = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } = re(t);
1807
+ } = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = re(t);
1388
1808
  if (
1389
1809
  // Single number for both coordinates
1390
- typeof s == "number" && z(r + c - (i + l)) >= s || // Different x and y threshold
1391
- typeof s == "object" && z(r - i) >= s.x || z(c - l) >= s.y
1810
+ typeof s == "number" && z(c + r - (i + l)) >= s || // Different x and y threshold
1811
+ typeof s == "object" && z(c - i) >= s.x || z(r - l) >= s.y
1392
1812
  ) {
1393
1813
  if (j(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
1394
1814
  j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
1395
1815
  return;
1396
1816
  }
1397
- X(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), W(this._area, "display", "block"), V(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (X(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), X(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
1817
+ X(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), W(this._area, "display", "block"), K(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (X(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), X(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
1398
1818
  }
1399
1819
  this._handleMoveEvent(t);
1400
1820
  }
@@ -1421,8 +1841,8 @@ class hn extends rn {
1421
1841
  _onTapMove(t) {
1422
1842
  const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
1423
1843
  this._targetElement;
1424
- const { x: r, y: c } = re(t);
1425
- if (o.x2 = r, o.y2 = c, this._lastMousePosition.x = r, this._lastMousePosition.y = c, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
1844
+ const { x: c, y: r } = re(t);
1845
+ if (o.x2 = c, o.y2 = r, this._lastMousePosition.x = c, this._lastMousePosition.y = r, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
1426
1846
  this._scrollingActive = !0;
1427
1847
  const a = () => {
1428
1848
  if (!n.x && !n.y) {
@@ -1431,7 +1851,7 @@ class hn extends rn {
1431
1851
  }
1432
1852
  const d = this._options.mindElixirInstance;
1433
1853
  if (d && d.move) {
1434
- const h = n.x ? Ue(n.x / l) : 0, u = n.y ? Ue(n.y / l) : 0;
1854
+ const h = n.x ? Ze(n.x / l) : 0, u = n.y ? Ze(n.y / l) : 0;
1435
1855
  (h || u) && (d.move(-h, -u), o.x1 -= h, o.y1 -= u);
1436
1856
  }
1437
1857
  i.next(t), requestAnimationFrame(a);
@@ -1443,7 +1863,7 @@ class hn extends rn {
1443
1863
  }
1444
1864
  _handleMoveEvent(t) {
1445
1865
  const { features: n } = this._options;
1446
- (n.touch && cn() || this._scrollAvailable && an()) && t.preventDefault();
1866
+ (n.touch && no() || this._scrollAvailable && oo()) && t.preventDefault();
1447
1867
  }
1448
1868
  _onScroll() {
1449
1869
  const {
@@ -1469,16 +1889,16 @@ class hn extends rn {
1469
1889
  });
1470
1890
  }
1471
1891
  _recalculateSelectionAreaRect() {
1472
- const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: r } = n;
1473
- let { x2: c, y2: a } = n;
1892
+ const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: c } = n;
1893
+ let { x2: r, y2: a } = n;
1474
1894
  const {
1475
1895
  behaviour: {
1476
1896
  scrolling: { startScrollMargins: d }
1477
1897
  }
1478
1898
  } = s;
1479
- c < i.left + d.x ? (t.x = -z(i.left - c + d.x), c = c < i.left ? i.left : c) : c > i.right - d.x ? (t.x = z(i.left + i.width - c - d.x), c = c > i.right ? i.right : c) : t.x = 0, a < i.top + d.y ? (t.y = -z(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = z(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
1480
- const h = Ve(l, c), u = Ve(r, a), y = qe(l, c), v = qe(r, a);
1481
- this._areaRect = Ge(h, u, y - h, v - u);
1899
+ r < i.left + d.x ? (t.x = -z(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = z(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -z(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = z(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
1900
+ const h = Je(l, r), u = Je(c, a), y = Ue(l, r), v = Ue(c, a);
1901
+ this._areaRect = Ve(h, u, y - h, v - u);
1482
1902
  }
1483
1903
  _redrawSelectionArea() {
1484
1904
  const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
@@ -1489,12 +1909,12 @@ class hn extends rn {
1489
1909
  j(this._targetElement, "scroll", this._onStartAreaScroll), j(o, ["mousemove", "touchmove"], this._delayedTapMove), j(o, ["touchmove", "mousemove"], this._onTapMove), j(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), j(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, j(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), j(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), W(this._area, "display", "none");
1490
1910
  }
1491
1911
  _updateElementSelection() {
1492
- const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], y = [];
1912
+ const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], y = [];
1493
1913
  for (let p = 0; p < t.length; p++) {
1494
1914
  const g = t[p];
1495
- if (Ke(s, g.getBoundingClientRect(), c)) {
1915
+ if (Ke(s, g.getBoundingClientRect(), r)) {
1496
1916
  if (l.includes(g))
1497
- i.includes(g) && !r.includes(g) && r.push(g);
1917
+ i.includes(g) && !c.includes(g) && c.push(g);
1498
1918
  else if (d && i.includes(g)) {
1499
1919
  y.push(g);
1500
1920
  continue;
@@ -1521,20 +1941,20 @@ class hn extends rn {
1521
1941
  });
1522
1942
  }
1523
1943
  _keepSelection() {
1524
- const { _options: t, _selection: n } = this, { selected: o, changed: s, touched: i, stored: l } = n, r = o.filter((c) => !l.includes(c));
1944
+ const { _options: t, _selection: n } = this, { selected: o, changed: s, touched: i, stored: l } = n, c = o.filter((r) => !l.includes(r));
1525
1945
  switch (t.behaviour.overlap) {
1526
1946
  case "drop": {
1527
1947
  n.stored = [
1528
- ...r,
1529
- ...l.filter((c) => !i.includes(c))
1948
+ ...c,
1949
+ ...l.filter((r) => !i.includes(r))
1530
1950
  // Elements not touched
1531
1951
  ];
1532
1952
  break;
1533
1953
  }
1534
1954
  case "invert": {
1535
1955
  n.stored = [
1536
- ...r,
1537
- ...l.filter((c) => !s.removed.includes(c))
1956
+ ...c,
1957
+ ...l.filter((r) => !s.removed.includes(r))
1538
1958
  // Elements not removed from selection
1539
1959
  ];
1540
1960
  break;
@@ -1542,7 +1962,7 @@ class hn extends rn {
1542
1962
  case "keep": {
1543
1963
  n.stored = [
1544
1964
  ...l,
1545
- ...o.filter((c) => !l.includes(c))
1965
+ ...o.filter((r) => !l.includes(r))
1546
1966
  // Newly added
1547
1967
  ];
1548
1968
  break;
@@ -1562,7 +1982,7 @@ class hn extends rn {
1562
1982
  * Will update everything that can be selected
1563
1983
  */
1564
1984
  resolveSelectables() {
1565
- this._selectables = V(this._options.selectables, this._options.document);
1985
+ this._selectables = K(this._options.selectables, this._options.document);
1566
1986
  }
1567
1987
  /**
1568
1988
  * Same as deselecting, but for all elements currently selected
@@ -1571,7 +1991,7 @@ class hn extends rn {
1571
1991
  */
1572
1992
  clearSelection(t = !0, n = !1) {
1573
1993
  const { selected: o, stored: s, changed: i } = this._selection;
1574
- i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Je(t ? [] : s);
1994
+ i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Qe(t ? [] : s);
1575
1995
  }
1576
1996
  /**
1577
1997
  * @returns {Array} Selected elements
@@ -1593,529 +2013,129 @@ class hn extends rn {
1593
2013
  }
1594
2014
  /**
1595
2015
  * Set the location of the selection area
1596
- * @param location A partial AreaLocation object
1597
- */
1598
- setAreaLocation(t) {
1599
- Object.assign(this._areaLocation, t), this._redrawSelectionArea();
1600
- }
1601
- /**
1602
- * @returns {AreaLocation} The current location of the selection area
1603
- */
1604
- getAreaLocation() {
1605
- return this._areaLocation;
1606
- }
1607
- /**
1608
- * Cancel the current selection process, pass true to fire a stop event after cancel
1609
- * @param keepEvent If a stop event should be fired
1610
- */
1611
- cancel(t = !1) {
1612
- this._onTapStop(null, !t);
1613
- }
1614
- /**
1615
- * Unbinds all events and removes the area-element.
1616
- */
1617
- destroy() {
1618
- this.cancel(), this.disable(), this._clippingElement.remove(), super.unbindAllListeners();
1619
- }
1620
- /**
1621
- * Enable selecting elements
1622
- */
1623
- enable = this._toggleStartEvents;
1624
- /**
1625
- * Disable selecting elements
1626
- */
1627
- disable = this._toggleStartEvents.bind(this, !1);
1628
- /**
1629
- * Adds elements to the selection
1630
- * @param query CSS Query, can be an array of queries
1631
- * @param quiet If this should not trigger the move event
1632
- */
1633
- select(t, n = !1) {
1634
- const { changed: o, selected: s, stored: i } = this._selection, l = V(t, this._options.document).filter((r) => !s.includes(r) && !i.includes(r));
1635
- return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
1636
- }
1637
- /**
1638
- * Removes a particular element from the selection
1639
- * @param query CSS Query, can be an array of queries
1640
- * @param quiet If this should not trigger the move event
1641
- */
1642
- deselect(t, n = !1) {
1643
- const { selected: o, stored: s, changed: i } = this._selection, l = V(t, this._options.document).filter((r) => o.includes(r) || s.includes(r));
1644
- this._selection.stored = s.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((r) => !i.removed.includes(r))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
1645
- }
1646
- }
1647
- function fn(e) {
1648
- const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new hn({
1649
- selectables: [".map-container me-tpc"],
1650
- boundaries: [e.container],
1651
- container: e.selectionContainer,
1652
- mindElixirInstance: e,
1653
- // 传递 MindElixir 实例
1654
- features: {
1655
- // deselectOnBlur: true,
1656
- touch: !1
1657
- },
1658
- behaviour: {
1659
- triggers: t,
1660
- // Scroll configuration.
1661
- scrolling: {
1662
- // On scrollable areas the number on px per frame is devided by this amount.
1663
- // Default is 10 to provide a enjoyable scroll experience.
1664
- speedDivider: 10,
1665
- startScrollMargins: { x: 50, y: 50 }
1666
- }
1667
- }
1668
- }).on("beforestart", ({ event: o }) => {
1669
- if (e.spacePressed) return !1;
1670
- const s = o.target;
1671
- if (s.id === "input-box" || s.className === "circle" || e.container.querySelector(".context-menu")?.contains(s))
1672
- return !1;
1673
- if (!o.ctrlKey && !o.metaKey) {
1674
- if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
1675
- return !1;
1676
- e.clearSelection();
1677
- }
1678
- const i = n.getSelectionArea();
1679
- return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
1680
- }).on(
1681
- "move",
1682
- ({
1683
- store: {
1684
- changed: { added: o, removed: s }
1685
- }
1686
- }) => {
1687
- if (o.length > 0 || s.length > 0, o.length > 0) {
1688
- for (const i of o)
1689
- i.className = "selected";
1690
- e.currentNodes = [...e.currentNodes, ...o], e.bus.fire(
1691
- "selectNodes",
1692
- o.map((i) => i.nodeObj)
1693
- );
1694
- }
1695
- if (s.length > 0) {
1696
- for (const i of s)
1697
- i.classList.remove("selected");
1698
- e.currentNodes = e.currentNodes.filter((i) => !s?.includes(i)), e.bus.fire(
1699
- "unselectNodes",
1700
- s.map((i) => i.nodeObj)
1701
- );
1702
- }
1703
- }
1704
- );
1705
- e.selection = n;
1706
- }
1707
- const un = function(e, t = !0) {
1708
- this.theme = e;
1709
- const o = {
1710
- ...(e.type === "dark" ? Ne : Se).cssVar,
1711
- ...e.cssVar
1712
- }, s = Object.keys(o);
1713
- for (let i = 0; i < s.length; i++) {
1714
- const l = s[i];
1715
- this.container.style.setProperty(l, o[l]);
1716
- }
1717
- t && this.refresh();
1718
- }, te = (e) => {
1719
- const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
1720
- return { siblings: t, index: n };
1721
- };
1722
- function pn(e) {
1723
- const { siblings: t, index: n } = te(e);
1724
- if (t === void 0) return;
1725
- const o = t[n];
1726
- n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
1727
- }
1728
- function gn(e) {
1729
- const { siblings: t, index: n } = te(e);
1730
- if (t === void 0) return;
1731
- const o = t[n];
1732
- n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
1733
- }
1734
- function ht(e) {
1735
- const { siblings: t, index: n } = te(e);
1736
- return t === void 0 ? 0 : (t.splice(n, 1), t.length);
1737
- }
1738
- function mn(e, t, n) {
1739
- const { siblings: o, index: s } = te(n);
1740
- o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
1741
- }
1742
- function yn(e, t) {
1743
- const { siblings: n, index: o } = te(e);
1744
- n !== void 0 && (n[o] = t, t.children = [e]);
1745
- }
1746
- function vn(e, t, n) {
1747
- if (ht(t), n.parent?.parent || (t.direction = n.direction), e === "in")
1748
- n.children ? n.children.push(t) : n.children = [t];
1749
- else {
1750
- t.direction !== void 0 && (t.direction = n.direction);
1751
- const { siblings: o, index: s } = te(n);
1752
- if (o === void 0) return;
1753
- e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
1754
- }
1755
- }
1756
- const bn = function({ map: e, direction: t }, n) {
1757
- if (t === 0)
1758
- return 0;
1759
- if (t === 1)
1760
- return 1;
1761
- if (t === 2) {
1762
- const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
1763
- return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
1764
- }
1765
- }, ft = function(e, t, n) {
1766
- const o = n.children[0].children[0], s = t.parentElement;
1767
- if (s.tagName === "ME-PARENT") {
1768
- if (se(o), s.children[1])
1769
- s.nextSibling.appendChild(n);
1770
- else {
1771
- const i = e.createChildren([n]);
1772
- s.appendChild(Me(!0)), s.insertAdjacentElement("afterend", i);
1773
- }
1774
- e.linkDiv(n.offsetParent);
1775
- } else s.tagName === "ME-ROOT" && (bn(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
1776
- }, wn = function(e, t) {
1777
- const n = e.parentNode;
1778
- if (t === 0) {
1779
- const o = n.parentNode.parentNode;
1780
- o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
1781
- }
1782
- n.parentNode.remove();
1783
- }, ut = {
1784
- before: "beforebegin",
1785
- after: "afterend"
1786
- }, se = function(e) {
1787
- const n = e.parentElement.parentElement.lastElementChild;
1788
- n?.tagName === "svg" && n?.remove();
1789
- }, xn = function(e, t) {
1790
- const n = e.nodeObj, o = Te(n);
1791
- o.style && t.style && (t.style = Object.assign(o.style, t.style));
1792
- const s = Object.assign(n, t);
1793
- Ae.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
1794
- name: "reshapeNode",
1795
- obj: s,
1796
- origin: o
1797
- });
1798
- }, De = function(e, t, n) {
1799
- if (!t) return null;
1800
- const o = t.nodeObj;
1801
- o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
1802
- const s = n || e.generateNewObj();
1803
- o.children ? o.children.push(s) : o.children = [s], K(e.nodeData);
1804
- const { grp: i, top: l } = e.createWrapper(s);
1805
- return ft(e, t, i), { newTop: l, newNodeObj: s };
1806
- }, Cn = function(e, t, n) {
1807
- const o = t || this.currentNode;
1808
- if (!o) return;
1809
- const s = o.nodeObj;
1810
- if (s.parent) {
1811
- if (!s.parent?.parent && this.direction === 2) {
1812
- const a = this.map.querySelector(".lhs")?.childElementCount || 0, d = this.map.querySelector(".rhs")?.childElementCount || 0;
1813
- if (!a || !d) {
1814
- this.addChild(this.findEle(s.parent.id), n);
1815
- return;
1816
- }
1817
- }
1818
- } else {
1819
- this.addChild();
1820
- return;
1821
- }
1822
- const i = n || this.generateNewObj();
1823
- if (!s.parent?.parent) {
1824
- const a = o.closest("me-main").className === B.LHS ? 0 : 1;
1825
- i.direction = a;
1826
- }
1827
- mn(i, e, s), K(this.nodeData);
1828
- const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
1829
- l.parentElement.insertAdjacentElement(ut[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
1830
- name: "insertSibling",
1831
- type: e,
1832
- obj: i
1833
- }), this.selectNode(c.firstChild, !0);
1834
- }, En = function(e, t) {
1835
- const n = e || this.currentNode;
1836
- if (!n) return;
1837
- se(n);
1838
- const o = n.nodeObj;
1839
- if (!o.parent)
1840
- return;
1841
- const s = t || this.generateNewObj();
1842
- yn(o, s), K(this.nodeData);
1843
- const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
1844
- r.appendChild(Me(!0)), i.insertAdjacentElement("afterend", l);
1845
- const c = this.createChildren([i]);
1846
- r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
1847
- name: "insertParent",
1848
- obj: s
1849
- });
1850
- }, Sn = function(e, t) {
1851
- const n = e || this.currentNode;
1852
- if (!n) return;
1853
- const o = De(this, n, t);
1854
- if (!o) return;
1855
- const { newTop: s, newNodeObj: i } = o;
1856
- this.bus.fire("operation", {
1857
- name: "addChild",
1858
- obj: i
1859
- }), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
1860
- }, Nn = function(e, t) {
1861
- const n = Te(e.nodeObj);
1862
- ke(n);
1863
- const o = De(this, t, n);
1864
- if (!o) return;
1865
- const { newNodeObj: s } = o;
1866
- this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
1867
- name: "copyNode",
1868
- obj: s
1869
- });
1870
- }, kn = function(e, t) {
1871
- e = _e(e);
1872
- const n = [];
1873
- for (let o = 0; o < e.length; o++) {
1874
- const s = e[o], i = Te(s.nodeObj);
1875
- ke(i);
1876
- const l = De(this, t, i);
1877
- if (!l) return;
1878
- const { newNodeObj: r } = l;
1879
- n.push(r);
2016
+ * @param location A partial AreaLocation object
2017
+ */
2018
+ setAreaLocation(t) {
2019
+ Object.assign(this._areaLocation, t), this._redrawSelectionArea();
1880
2020
  }
1881
- this.unselectNodes(this.currentNodes), this.selectNodes(n.map((o) => this.findEle(o.id))), this.bus.fire("operation", {
1882
- name: "copyNodes",
1883
- objs: n
1884
- });
1885
- }, Tn = function(e) {
1886
- const t = e || this.currentNode;
1887
- if (!t) return;
1888
- const n = t.nodeObj;
1889
- pn(n);
1890
- const o = t.parentNode.parentNode;
1891
- o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
1892
- name: "moveUpNode",
1893
- obj: n
1894
- });
1895
- }, _n = function(e) {
1896
- const t = e || this.currentNode;
1897
- if (!t) return;
1898
- const n = t.nodeObj;
1899
- gn(n);
1900
- const o = t.parentNode.parentNode;
1901
- o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
1902
- name: "moveDownNode",
1903
- obj: n
1904
- });
1905
- }, Ln = function(e) {
1906
- if (e.length === 0) return;
1907
- e = _e(e);
1908
- for (const n of e) {
1909
- const o = n.nodeObj, s = ht(o);
1910
- wn(n, s);
2021
+ /**
2022
+ * @returns {AreaLocation} The current location of the selection area
2023
+ */
2024
+ getAreaLocation() {
2025
+ return this._areaLocation;
1911
2026
  }
1912
- const t = e[e.length - 1];
1913
- this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
1914
- name: "removeNodes",
1915
- objs: e.map((n) => n.nodeObj)
1916
- });
1917
- }, Pe = (e, t, n, o) => {
1918
- e = _e(e);
1919
- let s = n.nodeObj;
1920
- t === "in" && s.expanded === !1 && (o.expandNode(n, !0), n = o.findEle(s.id), s = n.nodeObj), t === "after" && (e = e.reverse());
1921
- const i = [];
1922
- for (const r of e) {
1923
- const c = r.nodeObj;
1924
- if (vn(t, c, s), K(o.nodeData), t === "in") {
1925
- const a = r.parentElement;
1926
- ft(o, n, a.parentElement);
1927
- } else {
1928
- se(r);
1929
- const a = r.parentElement.parentNode;
1930
- i.includes(a.parentElement) || i.push(a.parentElement), n.parentElement.parentNode.insertAdjacentElement(ut[t], a);
1931
- }
2027
+ /**
2028
+ * Cancel the current selection process, pass true to fire a stop event after cancel
2029
+ * @param keepEvent If a stop event should be fired
2030
+ */
2031
+ cancel(t = !1) {
2032
+ this._onTapStop(null, !t);
1932
2033
  }
1933
- for (const r of i)
1934
- r.childElementCount === 0 && r.tagName !== "ME-MAIN" && (r.previousSibling.children[1].remove(), r.remove());
1935
- o.linkDiv(), o.scrollIntoView(e[e.length - 1]);
1936
- const l = t === "before" ? "moveNodeBefore" : t === "after" ? "moveNodeAfter" : "moveNodeIn";
1937
- o.bus.fire("operation", {
1938
- name: l,
1939
- objs: e.map((r) => r.nodeObj),
1940
- toObj: s
1941
- });
1942
- }, An = function(e, t) {
1943
- Pe(e, "in", t, this);
1944
- }, Mn = function(e, t) {
1945
- Pe(e, "before", t, this);
1946
- }, Dn = function(e, t) {
1947
- Pe(e, "after", t, this);
1948
- }, Pn = function(e) {
1949
- const t = e || this.currentNode;
1950
- t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
1951
- }, On = function(e, t) {
1952
- e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
1953
- }, pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1954
- __proto__: null,
1955
- addChild: Sn,
1956
- beginEdit: Pn,
1957
- copyNode: Nn,
1958
- copyNodes: kn,
1959
- insertParent: En,
1960
- insertSibling: Cn,
1961
- moveDownNode: _n,
1962
- moveNodeAfter: Dn,
1963
- moveNodeBefore: Mn,
1964
- moveNodeIn: An,
1965
- moveUpNode: Tn,
1966
- removeNodes: Ln,
1967
- reshapeNode: xn,
1968
- rmSubline: se,
1969
- setNodeTopic: On
1970
- }, Symbol.toStringTag, { value: "Module" }));
1971
- function $n(e) {
1972
- return {
1973
- nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
1974
- arrows: e.arrows,
1975
- summaries: e.summaries,
1976
- direction: e.direction,
1977
- theme: e.theme
1978
- };
1979
- }
1980
- const jn = function(e) {
1981
- const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
1982
- if (n.top > o.bottom - 50 || n.bottom < o.top + 50 || n.left > o.right - 50 || n.right < o.left + 50) {
1983
- const i = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2, a = i - r, d = l - c;
1984
- this.move(-a, -d, !0);
2034
+ /**
2035
+ * Unbinds all events and removes the area-element.
2036
+ */
2037
+ destroy() {
2038
+ this.cancel(), this.disable(), this._clippingElement.remove(), super.unbindAllListeners();
1985
2039
  }
1986
- }, Hn = function(e, t, n) {
1987
- this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
1988
- }, Rn = function(e) {
1989
- this.selection.select(e);
1990
- }, Bn = function(e) {
1991
- this.selection?.deselect(e);
1992
- }, In = function() {
1993
- this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
1994
- }, Fn = function() {
1995
- const e = $n(this);
1996
- return JSON.stringify(e, (t, n) => {
1997
- if (!(t === "parent" && typeof n != "string"))
1998
- return n;
1999
- });
2000
- }, Yn = function() {
2001
- return JSON.parse(this.getDataString());
2002
- }, Wn = function() {
2003
- this.editable = !0;
2004
- }, Xn = function() {
2005
- this.editable = !1;
2006
- }, zn = function(e, t = { x: 0, y: 0 }) {
2007
- if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
2008
- const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Oe(this), r = this.map.style.transform, { x: c, y: a } = Le(r), d = c - i, h = a - l, u = this.scaleVal, y = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
2009
- this.map.style.transform = `translate3d(${c - y}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
2010
- }, Gn = function() {
2011
- const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
2012
- this.scaleVal = n;
2013
- const { dx: o, dy: s } = Oe(this, !0);
2014
- this.map.style.transform = `translate3d(${o}px, ${s}px, 0) scale(${n})`, this.bus.fire("scale", n);
2015
- }, Kn = function(e, t, n = !1) {
2016
- const { map: o, scaleVal: s, bus: i, container: l, nodes: r } = this;
2017
- if (n && o.style.transition === "transform 0.3s")
2018
- return;
2019
- const c = o.style.transform;
2020
- let { x: a, y: d } = Le(c);
2021
- const h = l.getBoundingClientRect(), u = r.getBoundingClientRect(), y = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
2022
- if (y) {
2023
- const p = u.left + e, g = u.right + e;
2024
- (p >= h.right || g <= h.left) && (e = 0);
2040
+ /**
2041
+ * Enable selecting elements
2042
+ */
2043
+ enable = this._toggleStartEvents;
2044
+ /**
2045
+ * Disable selecting elements
2046
+ */
2047
+ disable = this._toggleStartEvents.bind(this, !1);
2048
+ /**
2049
+ * Adds elements to the selection
2050
+ * @param query CSS Query, can be an array of queries
2051
+ * @param quiet If this should not trigger the move event
2052
+ */
2053
+ select(t, n = !1) {
2054
+ const { changed: o, selected: s, stored: i } = this._selection, l = K(t, this._options.document).filter((c) => !s.includes(c) && !i.includes(c));
2055
+ return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
2025
2056
  }
2026
- if (v) {
2027
- const p = u.top + t, g = u.bottom + t;
2028
- (p >= h.bottom || g <= h.top) && (t = 0);
2057
+ /**
2058
+ * Removes a particular element from the selection
2059
+ * @param query CSS Query, can be an array of queries
2060
+ * @param quiet If this should not trigger the move event
2061
+ */
2062
+ deselect(t, n = !1) {
2063
+ const { selected: o, stored: s, changed: i } = this._selection, l = K(t, this._options.document).filter((c) => o.includes(c) || s.includes(c));
2064
+ this._selection.stored = s.filter((c) => !l.includes(c)), this._selection.selected = o.filter((c) => !l.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((c) => !i.removed.includes(c))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
2029
2065
  }
2030
- a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
2031
- o.style.transition = "none";
2032
- }, 300)), o.style.transform = `translate3d(${a}px, ${d}px, 0) scale(${s})`, i.fire("move", { dx: e, dy: t });
2033
- }, Oe = (e, t = !1) => {
2034
- const { container: n, map: o, nodes: s } = e;
2035
- let i, l;
2036
- if (e.alignment === "nodes" || t)
2037
- i = (n.offsetWidth - s.offsetWidth) / 2, l = (n.offsetHeight - s.offsetHeight) / 2, o.style.transformOrigin = "50% 50%";
2038
- else {
2039
- const r = o.querySelector("me-root"), c = r.offsetTop, a = r.offsetLeft, d = r.offsetWidth, h = r.offsetHeight;
2040
- i = n.offsetWidth / 2 - a - d / 2, l = n.offsetHeight / 2 - c - h / 2, o.style.transformOrigin = `${a + d / 2}px 50%`;
2066
+ }
2067
+ function ro(e) {
2068
+ const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new io({
2069
+ selectables: [".map-container me-tpc"],
2070
+ boundaries: [e.container],
2071
+ container: e.selectionContainer,
2072
+ mindElixirInstance: e,
2073
+ // 传递 MindElixir 实例
2074
+ features: {
2075
+ // deselectOnBlur: true,
2076
+ touch: !1
2077
+ },
2078
+ behaviour: {
2079
+ triggers: t,
2080
+ // Scroll configuration.
2081
+ scrolling: {
2082
+ // On scrollable areas the number on px per frame is devided by this amount.
2083
+ // Default is 10 to provide a enjoyable scroll experience.
2084
+ speedDivider: 10,
2085
+ startScrollMargins: { x: 50, y: 50 }
2086
+ }
2087
+ }
2088
+ }).on("beforestart", ({ event: o }) => {
2089
+ if (e.spacePressed) return !1;
2090
+ const s = o.target;
2091
+ if (s.id === "input-box" || s.className === "circle" || e.container.querySelector(".context-menu")?.contains(s))
2092
+ return !1;
2093
+ if (!o.ctrlKey && !o.metaKey) {
2094
+ if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
2095
+ return !1;
2096
+ e.clearSelection();
2097
+ }
2098
+ const i = n.getSelectionArea();
2099
+ return i.style.background = "#4f90f22d", i.style.border = "1px solid #4f90f2", i.parentElement && (i.parentElement.style.zIndex = "9999"), !0;
2100
+ }).on(
2101
+ "move",
2102
+ ({
2103
+ store: {
2104
+ changed: { added: o, removed: s }
2105
+ }
2106
+ }) => {
2107
+ if (o.length > 0 || s.length > 0, o.length > 0) {
2108
+ for (const i of o)
2109
+ i.className = "selected";
2110
+ e.currentNodes = [...e.currentNodes, ...o], e.bus.fire(
2111
+ "selectNodes",
2112
+ o.map((i) => i.nodeObj)
2113
+ );
2114
+ }
2115
+ if (s.length > 0) {
2116
+ for (const i of s)
2117
+ i.classList.remove("selected");
2118
+ e.currentNodes = e.currentNodes.filter((i) => !s?.includes(i)), e.bus.fire(
2119
+ "unselectNodes",
2120
+ s.map((i) => i.nodeObj)
2121
+ );
2122
+ }
2123
+ }
2124
+ );
2125
+ e.selection = n;
2126
+ }
2127
+ const lo = function(e, t = !0) {
2128
+ this.theme = e;
2129
+ const o = {
2130
+ ...(e.type === "dark" ? Ne : Se).cssVar,
2131
+ ...e.cssVar
2132
+ }, s = Object.keys(o);
2133
+ for (let i = 0; i < s.length; i++) {
2134
+ const l = s[i];
2135
+ this.container.style.setProperty(l, o[l]);
2041
2136
  }
2042
- return { dx: i, dy: l };
2043
- }, qn = function() {
2044
- const { map: e, container: t } = this, { dx: n, dy: o } = Oe(this);
2045
- t.scrollTop = 0, t.scrollLeft = 0, e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(${this.scaleVal})`;
2046
- }, Vn = function(e) {
2047
- e(this);
2048
- }, Un = function(e) {
2049
- e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
2050
- }, Jn = function() {
2051
- this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
2052
- }, Zn = function() {
2053
- this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
2054
- }, Qn = function() {
2055
- this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
2056
- }, eo = function() {
2057
- this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
2058
- }, to = function(e) {
2059
- this.locale = e, this.refresh();
2060
- }, no = function(e, t) {
2061
- const n = e.nodeObj;
2062
- typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
2063
- const o = e.getBoundingClientRect(), s = {
2064
- x: o.left,
2065
- y: o.top
2066
- }, i = e.parentNode, l = i.children[1];
2067
- if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", se(e), n.expanded) {
2068
- const h = this.createChildren(
2069
- n.children.map((u) => this.createWrapper(u).grp)
2070
- );
2071
- i.parentNode.appendChild(h);
2072
- } else
2073
- i.parentNode.children[1].remove();
2074
- this.linkDiv(e.closest("me-main > me-wrapper"));
2075
- const r = e.getBoundingClientRect(), c = {
2076
- x: r.left,
2077
- y: r.top
2078
- }, a = s.x - c.x, d = s.y - c.y;
2079
- this.move(a, d), this.bus.fire("expandNode", n);
2080
- }, oo = function(e, t) {
2081
- const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
2082
- x: o.left,
2083
- y: o.top
2084
- };
2085
- Q(n, t ?? !n.expanded), this.refresh();
2086
- const i = this.findEle(n.id).getBoundingClientRect(), l = {
2087
- x: i.left,
2088
- y: i.top
2089
- }, r = s.x - l.x, c = s.y - l.y;
2090
- this.move(r, c);
2091
- }, so = function(e) {
2092
- this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), K(this.nodeData), this.layout(), this.linkDiv();
2093
- }, io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2094
- __proto__: null,
2095
- cancelFocus: Jn,
2096
- clearSelection: In,
2097
- disableEdit: Xn,
2098
- enableEdit: Wn,
2099
- expandNode: no,
2100
- expandNodeAll: oo,
2101
- focusNode: Un,
2102
- getData: Yn,
2103
- getDataString: Fn,
2104
- initLeft: Zn,
2105
- initRight: Qn,
2106
- initSide: eo,
2107
- install: Vn,
2108
- move: Kn,
2109
- refresh: so,
2110
- scale: zn,
2111
- scaleFit: Gn,
2112
- scrollIntoView: jn,
2113
- selectNode: Hn,
2114
- selectNodes: Rn,
2115
- setLocale: to,
2116
- toCenter: qn,
2117
- unselectNodes: Bn
2118
- }, Symbol.toStringTag, { value: "Module" })), ro = function(e) {
2137
+ t && this.refresh();
2138
+ }, co = function(e) {
2119
2139
  return {
2120
2140
  dom: e,
2121
2141
  moved: !1,
@@ -2138,7 +2158,7 @@ const jn = function(e) {
2138
2158
  },
2139
2159
  cb: null,
2140
2160
  init(t, n) {
2141
- this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = nt([
2161
+ this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = st([
2142
2162
  { dom: t, evt: "pointermove", func: this.handlePointerMove },
2143
2163
  { dom: t, evt: "pointerleave", func: this.handleClear },
2144
2164
  { dom: t, evt: "pointerup", func: this.handleClear },
@@ -2150,16 +2170,16 @@ const jn = function(e) {
2150
2170
  this.moved = !1, this.pointerdown = !1;
2151
2171
  }
2152
2172
  };
2153
- }, Ze = {
2154
- create: ro
2155
- }, lo = "#4dc4ff";
2156
- function gt(e, t, n, o, s, i, l, r) {
2173
+ }, et = {
2174
+ create: co
2175
+ }, ao = "#4dc4ff";
2176
+ function yt(e, t, n, o, s, i, l, c) {
2157
2177
  return {
2158
2178
  x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
2159
- y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
2179
+ y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
2160
2180
  };
2161
2181
  }
2162
- function co(e, t, n) {
2182
+ function ho(e, t, n) {
2163
2183
  e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), me(e));
2164
2184
  }
2165
2185
  function le(e, t, n, o, s) {
@@ -2170,17 +2190,17 @@ function le(e, t, n, o, s) {
2170
2190
  y2: s + ""
2171
2191
  });
2172
2192
  }
2173
- function Qe(e, t, n, o, s, i, l, r, c, a) {
2174
- const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${r} ${c}`;
2193
+ function tt(e, t, n, o, s, i, l, c, r, a) {
2194
+ const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
2175
2195
  if (e.line.setAttribute("d", d), a.style) {
2176
2196
  const p = a.style;
2177
2197
  p.stroke && e.line.setAttribute("stroke", p.stroke), p.strokeWidth && e.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && e.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && e.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.line.setAttribute("opacity", String(p.opacity));
2178
2198
  }
2179
2199
  const h = e.querySelectorAll('path[stroke="transparent"]');
2180
2200
  h.length > 0 && h[0].setAttribute("d", d);
2181
- const u = fe(i, l, r, c);
2201
+ const u = fe(i, l, c, r);
2182
2202
  if (u) {
2183
- const p = `M ${u.x1} ${u.y1} L ${r} ${c} L ${u.x2} ${u.y2}`;
2203
+ const p = `M ${u.x1} ${u.y1} L ${c} ${r} L ${u.x2} ${u.y2}`;
2184
2204
  if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
2185
2205
  const g = a.style;
2186
2206
  g.stroke && e.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && e.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(g.opacity));
@@ -2196,20 +2216,20 @@ function Qe(e, t, n, o, s, i, l, r, c, a) {
2196
2216
  }
2197
2217
  }
2198
2218
  }
2199
- const { x: y, y: v } = gt(t, n, o, s, i, l, r, c);
2200
- if (e.labelEl && co(e.labelEl, y, v), a.style?.labelColor) {
2219
+ const { x: y, y: v } = yt(t, n, o, s, i, l, c, r);
2220
+ if (e.labelEl && ho(e.labelEl, y, v), a.style?.labelColor) {
2201
2221
  const p = e.labelEl;
2202
2222
  p && (p.style.color = a.style.labelColor);
2203
2223
  }
2204
- yo(e);
2224
+ wo(e);
2205
2225
  }
2206
2226
  function pe(e, t, n) {
2207
- const { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2, a = r + n.x, d = c + n.y;
2227
+ const { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, c = o + i / 2, r = s + l / 2, a = c + n.x, d = r + n.y;
2208
2228
  return {
2209
2229
  w: i,
2210
2230
  h: l,
2211
- cx: r,
2212
- cy: c,
2231
+ cx: c,
2232
+ cy: r,
2213
2233
  ctrlX: a,
2214
2234
  ctrlY: d
2215
2235
  };
@@ -2222,19 +2242,40 @@ function Z(e) {
2222
2242
  y: n
2223
2243
  };
2224
2244
  }
2225
- const $e = function(e, t, n, o, s) {
2245
+ const fo = function(e, t, n) {
2246
+ const o = H(e.nodes, t), s = H(e.nodes, n), i = o.offsetLeft + t.offsetWidth / 2, l = o.offsetTop + t.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, r = s.offsetTop + n.offsetHeight / 2, a = c - i, d = r - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), y = Math.abs(a), v = Math.abs(d);
2247
+ let p, g;
2248
+ if (h < 150) {
2249
+ const b = t.closest("me-main").className === "lhs" ? -1 : 1;
2250
+ p = { x: 200 * b, y: 0 }, g = { x: 200 * b, y: 0 };
2251
+ } else if (y > v * 1.5) {
2252
+ const b = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, x = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
2253
+ p = { x: b + (a > 0 ? u : -u), y: 0 }, g = { x: x + (a > 0 ? -u : u), y: 0 };
2254
+ } else if (v > y * 1.5) {
2255
+ const b = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, x = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
2256
+ p = { x: 0, y: b + (d > 0 ? u : -u) }, g = { x: 0, y: x + (d > 0 ? -u : u) };
2257
+ } else {
2258
+ const b = Math.atan2(d, a), x = t.offsetWidth / 2 * Math.cos(b), L = t.offsetHeight / 2 * Math.sin(b), T = -(n.offsetWidth / 2) * Math.cos(b), E = -(n.offsetHeight / 2) * Math.sin(b), C = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
2259
+ p = { x: x + C, y: L + S }, g = { x: T - C, y: E - S };
2260
+ }
2261
+ return { delta1: p, delta2: g };
2262
+ }, je = function(e, t, n, o, s) {
2226
2263
  if (!t || !n)
2227
2264
  return;
2228
- const i = pe(e, t, o.delta1), l = pe(e, n, o.delta2), { x: r, y: c } = Z(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: y, y: v } = Z(l), p = fe(h, u, y, v);
2265
+ if (!o.delta1 || !o.delta2) {
2266
+ const N = fo(e, t, n);
2267
+ o.delta1 = N.delta1, o.delta2 = N.delta2;
2268
+ }
2269
+ const i = pe(e, t, o.delta1), l = pe(e, n, o.delta2), { x: c, y: r } = Z(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: y, y: v } = Z(l), p = fe(h, u, y, v);
2229
2270
  if (!p) return;
2230
2271
  const g = `M ${p.x1} ${p.y1} L ${y} ${v} L ${p.x2} ${p.y2}`;
2231
2272
  let m = "";
2232
2273
  if (o.bidirectional) {
2233
- const N = fe(a, d, r, c);
2274
+ const N = fe(a, d, c, r);
2234
2275
  if (!N) return;
2235
- m = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
2276
+ m = `M ${N.x1} ${N.y1} L ${c} ${r} L ${N.x2} ${N.y2}`;
2236
2277
  }
2237
- const b = Wt(`M ${r} ${c} C ${a} ${d} ${h} ${u} ${y} ${v}`, g, m, o.style), { x, y: L } = gt(r, c, a, d, h, u, y, v), T = o.style?.labelColor || "rgb(235, 95, 82)", E = "arrow-" + o.id;
2278
+ const b = Rn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${y} ${v}`, g, m, o.style), { x, y: L } = yt(c, r, a, d, h, u, y, v), T = o.style?.labelColor || "rgb(235, 95, 82)", E = "arrow-" + o.id;
2238
2279
  b.id = E;
2239
2280
  const C = e.markdown ? e.markdown(o.label, o) : o.label, S = Ce(C, x, L, {
2240
2281
  anchor: "middle",
@@ -2242,41 +2283,27 @@ const $e = function(e, t, n, o, s) {
2242
2283
  dataType: "arrow",
2243
2284
  svgId: E
2244
2285
  });
2245
- b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), me(S), s || (e.arrows.push(o), e.currentArrow = b, mt(e, o, i, l));
2246
- }, ao = function(e, t, n = {}) {
2247
- const o = H(this.nodes, e), s = H(this.nodes, t), i = o.offsetLeft + e.offsetWidth / 2, l = o.offsetTop + e.offsetHeight / 2, r = s.offsetLeft + t.offsetWidth / 2, c = s.offsetTop + t.offsetHeight / 2, a = r - i, d = c - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), y = Math.abs(a), v = Math.abs(d);
2248
- let p, g;
2249
- if (y > v * 1.5) {
2250
- const b = a > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, x = a > 0 ? -t.offsetWidth / 2 : t.offsetWidth / 2;
2251
- p = { x: b + (a > 0 ? u : -u), y: 0 }, g = { x: x + (a > 0 ? -u : u), y: 0 };
2252
- } else if (v > y * 1.5) {
2253
- const b = d > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, x = d > 0 ? -t.offsetHeight / 2 : t.offsetHeight / 2;
2254
- p = { x: 0, y: b + (d > 0 ? u : -u) }, g = { x: 0, y: x + (d > 0 ? -u : u) };
2255
- } else {
2256
- const b = Math.atan2(d, a), x = e.offsetWidth / 2 * Math.cos(b), L = e.offsetHeight / 2 * Math.sin(b), T = -(t.offsetWidth / 2) * Math.cos(b), E = -(t.offsetHeight / 2) * Math.sin(b), C = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
2257
- p = { x: x + C, y: L + S }, g = { x: T - C, y: E - S };
2258
- }
2259
- const m = {
2260
- id: q(),
2286
+ b.labelEl = S, b.arrowObj = o, b.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.linkSvgGroup.appendChild(b), me(S), s || (e.arrows.push(o), e.currentArrow = b, vt(e, o, i, l));
2287
+ }, uo = function(e, t, n = {}) {
2288
+ const o = {
2289
+ id: V(),
2261
2290
  label: "Custom Link",
2262
2291
  from: e.nodeObj.id,
2263
2292
  to: t.nodeObj.id,
2264
- delta1: p,
2265
- delta2: g,
2266
2293
  ...n
2267
2294
  };
2268
- $e(this, e, t, m), this.bus.fire("operation", {
2295
+ je(this, e, t, o), this.bus.fire("operation", {
2269
2296
  name: "createArrow",
2270
- obj: m
2297
+ obj: o
2271
2298
  });
2272
- }, ho = function(e) {
2299
+ }, po = function(e) {
2273
2300
  ye(this);
2274
- const t = { ...e, id: q() };
2275
- $e(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
2301
+ const t = { ...e, id: V() };
2302
+ je(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
2276
2303
  name: "createArrow",
2277
2304
  obj: t
2278
2305
  });
2279
- }, fo = function(e) {
2306
+ }, go = function(e) {
2280
2307
  let t;
2281
2308
  if (e ? t = e : t = this.currentArrow, !t) return;
2282
2309
  ye(this);
@@ -2287,11 +2314,11 @@ const $e = function(e, t, n, o, s) {
2287
2314
  id: n
2288
2315
  }
2289
2316
  });
2290
- }, uo = function(e) {
2317
+ }, mo = function(e) {
2291
2318
  this.currentArrow = e;
2292
2319
  const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = pe(this, n, t.delta1), i = pe(this, o, t.delta2);
2293
- mt(this, t, s, i);
2294
- }, po = function() {
2320
+ vt(this, t, s, i);
2321
+ }, yo = function() {
2295
2322
  ye(this), this.currentArrow = null;
2296
2323
  }, be = function(e, t) {
2297
2324
  const n = document.createElementNS(R, "path");
@@ -2303,7 +2330,7 @@ const $e = function(e, t, n, o, s) {
2303
2330
  "stroke-linecap": "round",
2304
2331
  "stroke-linejoin": "round"
2305
2332
  }), n;
2306
- }, go = function(e, t) {
2333
+ }, vo = function(e, t) {
2307
2334
  const n = document.createElementNS(R, "g");
2308
2335
  n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
2309
2336
  const o = be(e.line.getAttribute("d"), t);
@@ -2314,64 +2341,64 @@ const $e = function(e, t, n, o, s) {
2314
2341
  n.appendChild(i);
2315
2342
  }
2316
2343
  e.insertBefore(n, e.firstChild);
2317
- }, mo = function(e) {
2344
+ }, bo = function(e) {
2318
2345
  const t = e.querySelector(".arrow-highlight");
2319
2346
  t && t.remove();
2320
- }, yo = function(e) {
2347
+ }, wo = function(e) {
2321
2348
  const t = e.querySelector(".arrow-highlight");
2322
2349
  if (!t) return;
2323
2350
  const n = t.querySelectorAll("path");
2324
2351
  n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
2325
2352
  }, ye = function(e) {
2326
- e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && mo(e.currentArrow);
2327
- }, mt = function(e, t, n, o) {
2328
- const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: a, map: d, currentArrow: h, bus: u } = e;
2353
+ e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && bo(e.currentArrow);
2354
+ }, vt = function(e, t, n, o) {
2355
+ const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
2329
2356
  if (!h) return;
2330
- s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), go(h, lo);
2357
+ s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), vo(h, ao);
2331
2358
  let { x: y, y: v } = Z(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: b } = o, { x, y: L } = Z(o);
2332
- i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${m}px;`, le(r, y, v, p, g), le(c, m, b, x, L), e.helper1 = Ze.create(i), e.helper2 = Ze.create(l), e.helper1.init(d, (T, E) => {
2359
+ i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${b}px;left:${m}px;`, le(c, y, v, p, g), le(r, m, b, x, L), e.helper1 = et.create(i), e.helper2 = et.create(l), e.helper1.init(d, (T, E) => {
2333
2360
  p = p + T / e.scaleVal, g = g + E / e.scaleVal;
2334
2361
  const C = Z({ ...n, ctrlX: p, ctrlY: g });
2335
- y = C.x, v = C.y, i.style.top = g + "px", i.style.left = p + "px", Qe(h, y, v, p, g, m, b, x, L, t), le(r, y, v, p, g), t.delta1.x = p - n.cx, t.delta1.y = g - n.cy, u.fire("updateArrowDelta", t);
2362
+ y = C.x, v = C.y, i.style.top = g + "px", i.style.left = p + "px", tt(h, y, v, p, g, m, b, x, L, t), le(c, y, v, p, g), t.delta1.x = p - n.cx, t.delta1.y = g - n.cy, u.fire("updateArrowDelta", t);
2336
2363
  }), e.helper2.init(d, (T, E) => {
2337
2364
  m = m + T / e.scaleVal, b = b + E / e.scaleVal;
2338
2365
  const C = Z({ ...o, ctrlX: m, ctrlY: b });
2339
- x = C.x, L = C.y, l.style.top = b + "px", l.style.left = m + "px", Qe(h, y, v, p, g, m, b, x, L, t), le(c, m, b, x, L), t.delta2.x = m - o.cx, t.delta2.y = b - o.cy, u.fire("updateArrowDelta", t);
2366
+ x = C.x, L = C.y, l.style.top = b + "px", l.style.left = m + "px", tt(h, y, v, p, g, m, b, x, L, t), le(r, m, b, x, L), t.delta2.x = m - o.cx, t.delta2.y = b - o.cy, u.fire("updateArrowDelta", t);
2340
2367
  });
2341
2368
  };
2342
- function vo() {
2369
+ function xo() {
2343
2370
  this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
2344
2371
  for (let t = 0; t < this.arrows.length; t++) {
2345
2372
  const n = this.arrows[t];
2346
2373
  try {
2347
- $e(this, this.findEle(n.from), this.findEle(n.to), n, !0);
2374
+ je(this, this.findEle(n.from), this.findEle(n.to), n, !0);
2348
2375
  } catch {
2349
2376
  }
2350
2377
  }
2351
2378
  this.nodes.appendChild(this.linkSvgGroup);
2352
2379
  }
2353
- function bo(e) {
2354
- ye(this), e && e.labelEl && ct(this, e.labelEl, e.arrowObj);
2380
+ function Co(e) {
2381
+ ye(this), e && e.labelEl && pt(this, e.labelEl, e.arrowObj);
2355
2382
  }
2356
- function wo() {
2383
+ function Eo() {
2357
2384
  this.arrows = this.arrows.filter((e) => he(e.from, this.nodeData) && he(e.to, this.nodeData));
2358
2385
  }
2359
- const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2386
+ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2360
2387
  __proto__: null,
2361
- createArrow: ao,
2362
- createArrowFrom: ho,
2363
- editArrowLabel: bo,
2364
- removeArrow: fo,
2365
- renderArrow: vo,
2366
- selectArrow: uo,
2367
- tidyArrow: wo,
2368
- unselectArrow: po
2369
- }, Symbol.toStringTag, { value: "Module" })), Co = function(e) {
2388
+ createArrow: uo,
2389
+ createArrowFrom: po,
2390
+ editArrowLabel: Co,
2391
+ removeArrow: go,
2392
+ renderArrow: xo,
2393
+ selectArrow: mo,
2394
+ tidyArrow: Eo,
2395
+ unselectArrow: yo
2396
+ }, Symbol.toStringTag, { value: "Module" })), No = function(e) {
2370
2397
  if (e.length === 0) throw new Error("No selected node.");
2371
2398
  if (e.length === 1) {
2372
- const c = e[0].nodeObj, a = e[0].nodeObj.parent;
2399
+ const r = e[0].nodeObj, a = e[0].nodeObj.parent;
2373
2400
  if (!a) throw new Error("Can not select root node.");
2374
- const d = a.children.findIndex((h) => c === h);
2401
+ const d = a.children.findIndex((h) => r === h);
2375
2402
  return {
2376
2403
  parent: a.id,
2377
2404
  start: d,
@@ -2379,8 +2406,8 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2379
2406
  };
2380
2407
  }
2381
2408
  let t = 0;
2382
- const n = e.map((c) => {
2383
- let a = c.nodeObj;
2409
+ const n = e.map((r) => {
2410
+ let a = r.nodeObj;
2384
2411
  const d = [];
2385
2412
  for (; a.parent; ) {
2386
2413
  const h = a.parent, y = h.children?.indexOf(a);
@@ -2390,23 +2417,23 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2390
2417
  });
2391
2418
  let o = 0;
2392
2419
  e: for (; o < t; o++) {
2393
- const c = n[0][o]?.node;
2420
+ const r = n[0][o]?.node;
2394
2421
  for (let a = 1; a < n.length; a++)
2395
- if (n[a][o]?.node !== c)
2422
+ if (n[a][o]?.node !== r)
2396
2423
  break e;
2397
2424
  }
2398
2425
  if (!o) throw new Error("Can not select root node.");
2399
- const s = n.map((c) => c[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, r = n[0][o - 1].node;
2400
- if (!r.parent) throw new Error("Please select nodes in the same main topic.");
2426
+ const s = n.map((r) => r[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, c = n[0][o - 1].node;
2427
+ if (!c.parent) throw new Error("Please select nodes in the same main topic.");
2401
2428
  return {
2402
- parent: r.id,
2429
+ parent: c.id,
2403
2430
  start: i,
2404
2431
  end: l
2405
2432
  };
2406
- }, Eo = function(e) {
2433
+ }, ko = function(e) {
2407
2434
  const t = document.createElementNS(R, "g");
2408
2435
  return t.setAttribute("id", e), t;
2409
- }, et = function(e, t) {
2436
+ }, nt = function(e, t) {
2410
2437
  const n = document.createElementNS(R, "path");
2411
2438
  return A(n, {
2412
2439
  d: e,
@@ -2415,69 +2442,69 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2415
2442
  "stroke-linecap": "round",
2416
2443
  "stroke-width": "2"
2417
2444
  }), n;
2418
- }, So = (e) => e.parentElement.parentElement, No = function(e, { parent: t, start: n }) {
2445
+ }, To = (e) => e.parentElement.parentElement, _o = function(e, { parent: t, start: n }) {
2419
2446
  const o = e.findEle(t), s = o.nodeObj;
2420
2447
  let i;
2421
2448
  return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
2422
- }, je = function(e, t) {
2423
- const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y = No(e, t);
2449
+ }, He = function(e, t) {
2450
+ const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, y = _o(e, t);
2424
2451
  let v = 1 / 0, p = 0, g = 0, m = 0;
2425
2452
  for (let f = i; f <= l; f++) {
2426
2453
  const w = u.children?.[f];
2427
2454
  if (!w)
2428
2455
  return e.removeSummary(n), null;
2429
- const k = So(e.findEle(w.id)), { offsetLeft: $, offsetTop: Y } = H(c, k), M = i === l ? 10 : 20;
2430
- f === i && (g = Y + M), f === l && (m = Y + k.offsetHeight - M), $ < v && (v = $), k.offsetWidth + $ > p && (p = k.offsetWidth + $);
2456
+ const k = To(e.findEle(w.id)), { offsetLeft: $, offsetTop: Y } = H(r, k), D = i === l ? 10 : 20;
2457
+ f === i && (g = Y + D), f === l && (m = Y + k.offsetHeight - D), $ < v && (v = $), k.offsetWidth + $ > p && (p = k.offsetWidth + $);
2431
2458
  }
2432
2459
  let b, x;
2433
- const L = u.parent ? 10 : 0, T = g + L, E = m + L, C = (T + E) / 2, S = r?.stroke || a.cssVar["--color"], N = r?.labelColor || a.cssVar["--color"], D = "s-" + n, _ = e.markdown ? e.markdown(o, t) : o;
2434
- y === B.LHS ? (b = et(`M ${v + 10} ${T} c -5 0 -10 5 -10 10 L ${v} ${E - 10} c 0 5 5 10 10 10 M ${v} ${C} h -10`, S), x = Ce(_, v - 20, C, { anchor: "end", color: N, dataType: "summary", svgId: D })) : (b = et(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${E - 10} c 0 5 -5 10 -10 10 M ${p} ${C} h 10`, S), x = Ce(_, p + 20, C, { anchor: "start", color: N, dataType: "summary", svgId: D }));
2435
- const F = Eo(D);
2460
+ const L = u.parent ? 10 : 0, T = g + L, E = m + L, C = (T + E) / 2, S = c?.stroke || a.cssVar["--color"], N = c?.labelColor || a.cssVar["--color"], M = "s-" + n, _ = e.markdown ? e.markdown(o, t) : o;
2461
+ y === I.LHS ? (b = nt(`M ${v + 10} ${T} c -5 0 -10 5 -10 10 L ${v} ${E - 10} c 0 5 5 10 10 10 M ${v} ${C} h -10`, S), x = Ce(_, v - 20, C, { anchor: "end", color: N, dataType: "summary", svgId: M })) : (b = nt(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${E - 10} c 0 5 -5 10 -10 10 M ${p} ${C} h 10`, S), x = Ce(_, p + 20, C, { anchor: "start", color: N, dataType: "summary", svgId: M }));
2462
+ const F = ko(M);
2436
2463
  return F.appendChild(b), e.labelContainer.appendChild(x), me(x), F.summaryObj = t, F.labelEl = x, d.appendChild(F), F;
2437
- }, ko = function(e = {}) {
2464
+ }, Lo = function(e = {}) {
2438
2465
  if (!this.currentNodes) return;
2439
- const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = Co(t), r = { id: q(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = je(this, r);
2440
- n.push(r), this.editSummary(c), o.fire("operation", {
2466
+ const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = No(t), c = { id: V(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = He(this, c);
2467
+ n.push(c), this.editSummary(r), o.fire("operation", {
2441
2468
  name: "createSummary",
2442
- obj: r
2469
+ obj: c
2443
2470
  });
2444
- }, To = function(e) {
2445
- const t = q(), n = { ...e, id: t };
2446
- je(this, n), this.summaries.push(n), this.bus.fire("operation", {
2471
+ }, Ao = function(e) {
2472
+ const t = V(), n = { ...e, id: t };
2473
+ He(this, n), this.summaries.push(n), this.bus.fire("operation", {
2447
2474
  name: "createSummary",
2448
2475
  obj: n
2449
2476
  });
2450
- }, _o = function(e) {
2477
+ }, Do = function(e) {
2451
2478
  const t = this.summaries.findIndex((n) => n.id === e);
2452
2479
  t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
2453
2480
  name: "removeSummary",
2454
2481
  obj: { id: e }
2455
2482
  });
2456
- }, Lo = function(e) {
2483
+ }, Mo = function(e) {
2457
2484
  const t = e.labelEl;
2458
2485
  t && t.classList.add("selected"), this.currentSummary = e;
2459
- }, Ao = function() {
2486
+ }, Po = function() {
2460
2487
  this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
2461
- }, Mo = function() {
2488
+ }, Oo = function() {
2462
2489
  this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
2463
2490
  try {
2464
- je(this, e);
2491
+ He(this, e);
2465
2492
  } catch {
2466
2493
  }
2467
2494
  }), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
2468
- }, Do = function(e) {
2469
- e && e.labelEl && ct(this, e.labelEl, e.summaryObj);
2470
- }, Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2495
+ }, $o = function(e) {
2496
+ e && e.labelEl && pt(this, e.labelEl, e.summaryObj);
2497
+ }, jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2471
2498
  __proto__: null,
2472
- createSummary: ko,
2473
- createSummaryFrom: To,
2474
- editSummary: Do,
2475
- removeSummary: _o,
2476
- renderSummary: Mo,
2477
- selectSummary: Lo,
2478
- unselectSummary: Ao
2499
+ createSummary: Lo,
2500
+ createSummaryFrom: Ao,
2501
+ editSummary: $o,
2502
+ removeSummary: Do,
2503
+ renderSummary: Oo,
2504
+ selectSummary: Mo,
2505
+ unselectSummary: Po
2479
2506
  }, Symbol.toStringTag, { value: "Module" })), O = "http://www.w3.org/2000/svg";
2480
- function Oo(e, t) {
2507
+ function Ho(e, t) {
2481
2508
  const n = document.createElementNS(O, "svg");
2482
2509
  return A(n, {
2483
2510
  version: "1.1",
@@ -2486,27 +2513,27 @@ function Oo(e, t) {
2486
2513
  width: t
2487
2514
  }), n;
2488
2515
  }
2489
- function $o(e, t) {
2516
+ function Ro(e, t) {
2490
2517
  return (parseInt(e) - parseInt(t)) / 2;
2491
2518
  }
2492
- function jo(e, t, n, o) {
2519
+ function Io(e, t, n, o) {
2493
2520
  const s = document.createElementNS(O, "g");
2494
2521
  let i = "";
2495
2522
  return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
2496
- `).forEach((r, c) => {
2523
+ `).forEach((c, r) => {
2497
2524
  const a = document.createElementNS(O, "text");
2498
2525
  A(a, {
2499
2526
  x: n + parseInt(t.paddingLeft) + "",
2500
- y: o + parseInt(t.paddingTop) + $o(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
2527
+ y: o + parseInt(t.paddingTop) + Ro(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
2501
2528
  "text-anchor": "start",
2502
2529
  "font-family": t.fontFamily,
2503
2530
  "font-size": `${t.fontSize}`,
2504
2531
  "font-weight": `${t.fontWeight}`,
2505
2532
  fill: `${t.color}`
2506
- }), a.innerHTML = r, s.appendChild(a);
2533
+ }), a.innerHTML = c, s.appendChild(a);
2507
2534
  }), s;
2508
2535
  }
2509
- function Ho(e, t, n, o) {
2536
+ function Bo(e, t, n, o) {
2510
2537
  let s = "";
2511
2538
  e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
2512
2539
  const i = document.createElementNS(O, "foreignObject");
@@ -2522,7 +2549,7 @@ function Ho(e, t, n, o) {
2522
2549
  style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
2523
2550
  }), l.innerHTML = s, i.appendChild(l), i;
2524
2551
  }
2525
- function Ro(e, t) {
2552
+ function Fo(e, t) {
2526
2553
  const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "rect");
2527
2554
  return A(i, {
2528
2555
  x: o + "",
@@ -2549,12 +2576,12 @@ function ce(e, t, n = !1) {
2549
2576
  stroke: o.borderColor,
2550
2577
  "stroke-width": o.borderWidth
2551
2578
  });
2552
- const r = document.createElementNS(O, "g");
2553
- r.appendChild(l);
2554
- let c;
2555
- return n ? c = Ho(t, o, s, i) : c = jo(t, o, s, i), r.appendChild(c), r;
2579
+ const c = document.createElementNS(O, "g");
2580
+ c.appendChild(l);
2581
+ let r;
2582
+ return n ? r = Bo(t, o, s, i) : r = Io(t, o, s, i), c.appendChild(r), c;
2556
2583
  }
2557
- function Bo(e, t) {
2584
+ function Yo(e, t) {
2558
2585
  const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "a"), l = document.createElementNS(O, "text");
2559
2586
  return A(l, {
2560
2587
  x: o + "",
@@ -2566,7 +2593,7 @@ function Bo(e, t) {
2566
2593
  fill: `${n.color}`
2567
2594
  }), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
2568
2595
  }
2569
- function Io(e, t) {
2596
+ function Wo(e, t) {
2570
2597
  const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = H(e.nodes, t), i = document.createElementNS(O, "image");
2571
2598
  return A(i, {
2572
2599
  x: o + "",
@@ -2576,40 +2603,40 @@ function Io(e, t) {
2576
2603
  href: t.src
2577
2604
  }), i;
2578
2605
  }
2579
- const ae = 100, Fo = '<?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">', Yo = (e, t = !1) => {
2580
- const n = e.nodes, o = n.offsetHeight + ae * 2, s = n.offsetWidth + ae * 2, i = Oo(o + "px", s + "px"), l = document.createElementNS(O, "svg"), r = document.createElementNS(O, "rect");
2581
- A(r, {
2606
+ const ae = 100, Xo = '<?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">', zo = (e, t = !1) => {
2607
+ const n = e.nodes, o = n.offsetHeight + ae * 2, s = n.offsetWidth + ae * 2, i = Ho(o + "px", s + "px"), l = document.createElementNS(O, "svg"), c = document.createElementNS(O, "rect");
2608
+ A(c, {
2582
2609
  x: "0",
2583
2610
  y: "0",
2584
2611
  width: `${s}`,
2585
2612
  height: `${o}`,
2586
2613
  fill: e.theme.cssVar["--bgcolor"]
2587
- }), i.appendChild(r), n.querySelectorAll(".subLines").forEach((h) => {
2614
+ }), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
2588
2615
  const u = h.cloneNode(!0), { offsetLeft: y, offsetTop: v } = H(n, h.parentElement);
2589
2616
  u.setAttribute("x", `${y}`), u.setAttribute("y", `${v}`), l.appendChild(u);
2590
2617
  });
2591
- const c = n.querySelector(".lines")?.cloneNode(!0);
2592
- c && l.appendChild(c);
2618
+ const r = n.querySelector(".lines")?.cloneNode(!0);
2619
+ r && l.appendChild(r);
2593
2620
  const a = n.querySelector(".topiclinks")?.cloneNode(!0);
2594
2621
  a && l.appendChild(a);
2595
2622
  const d = n.querySelector(".summary")?.cloneNode(!0);
2596
2623
  return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
2597
- h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ce(e, h, !t)) : (l.appendChild(Ro(e, h)), l.appendChild(ce(e, h.text, !t)));
2624
+ h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(ce(e, h, !t)) : (l.appendChild(Fo(e, h)), l.appendChild(ce(e, h.text, !t)));
2598
2625
  }), n.querySelectorAll(".tags > span").forEach((h) => {
2599
2626
  l.appendChild(ce(e, h));
2600
2627
  }), n.querySelectorAll(".icons > span").forEach((h) => {
2601
2628
  l.appendChild(ce(e, h));
2602
2629
  }), n.querySelectorAll(".hyper-link").forEach((h) => {
2603
- l.appendChild(Bo(e, h));
2630
+ l.appendChild(Yo(e, h));
2604
2631
  }), n.querySelectorAll("img").forEach((h) => {
2605
- l.appendChild(Io(e, h));
2632
+ l.appendChild(Wo(e, h));
2606
2633
  }), A(l, {
2607
2634
  x: ae + "",
2608
2635
  y: ae + "",
2609
2636
  overflow: "visible"
2610
2637
  }), i.appendChild(l), i;
2611
- }, Wo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Fo + e.outerHTML);
2612
- function Xo(e) {
2638
+ }, Go = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Xo + e.outerHTML);
2639
+ function qo(e) {
2613
2640
  return new Promise((t, n) => {
2614
2641
  const o = new FileReader();
2615
2642
  o.onload = (s) => {
@@ -2619,78 +2646,78 @@ function Xo(e) {
2619
2646
  }, o.readAsDataURL(e);
2620
2647
  });
2621
2648
  }
2622
- const zo = function(e = !1, t) {
2623
- const n = Yo(this, e), o = Wo(n, t);
2649
+ const Vo = function(e = !1, t) {
2650
+ const n = zo(this, e), o = Go(n, t);
2624
2651
  return new Blob([o], { type: "image/svg+xml" });
2625
- }, Go = async function(e = !1, t) {
2626
- const n = this.exportSvg(e, t), o = await Xo(n);
2652
+ }, Ko = async function(e = !1, t) {
2653
+ const n = this.exportSvg(e, t), o = await qo(n);
2627
2654
  return new Promise((s, i) => {
2628
2655
  const l = new Image();
2629
2656
  l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
2630
- const r = document.createElement("canvas");
2631
- r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
2657
+ const c = document.createElement("canvas");
2658
+ c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
2632
2659
  }, l.src = o, l.onerror = i;
2633
2660
  });
2634
- }, Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2661
+ }, Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2635
2662
  __proto__: null,
2636
- exportPng: Go,
2637
- exportSvg: zo
2663
+ exportPng: Ko,
2664
+ exportSvg: Vo
2638
2665
  }, Symbol.toStringTag, { value: "Module" }));
2639
- function qo(e, t) {
2666
+ function Jo(e, t) {
2640
2667
  return async function(...n) {
2641
2668
  const o = this.before[t];
2642
2669
  o && !await o.apply(this, n) || e.apply(this, n);
2643
2670
  };
2644
2671
  }
2645
- const tt = Object.keys(pt), yt = {};
2646
- for (let e = 0; e < tt.length; e++) {
2647
- const t = tt[e];
2648
- yt[t] = qo(pt[t], t);
2672
+ const ot = Object.keys(dt), bt = {};
2673
+ for (let e = 0; e < ot.length; e++) {
2674
+ const t = ot[e];
2675
+ bt[t] = Jo(dt[t], t);
2649
2676
  }
2650
- const Vo = {
2677
+ const Zo = {
2651
2678
  getObjById: he,
2652
- generateNewObj: vt,
2653
- layout: $t,
2654
- linkDiv: Xt,
2655
- editTopic: Yt,
2656
- createWrapper: Rt,
2657
- createParent: Bt,
2658
- createChildren: It,
2659
- createTopic: Ft,
2679
+ generateNewObj: wt,
2680
+ layout: xt,
2681
+ linkDiv: In,
2682
+ editTopic: _t,
2683
+ createWrapper: St,
2684
+ createParent: Nt,
2685
+ createChildren: kt,
2686
+ createTopic: Tt,
2660
2687
  findEle: it,
2661
- changeTheme: un,
2662
- ...io,
2663
- ...yt,
2664
- ...xo,
2665
- ...Po,
2666
- ...Ko,
2688
+ changeTheme: lo,
2689
+ ...xn,
2690
+ ...bt,
2691
+ ...So,
2692
+ ...jo,
2693
+ ...Uo,
2667
2694
  init(e) {
2668
2695
  if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
2669
- e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, K(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && sn(this), this.keypress && St(this, this.keypress), this.editable && fn(this), this.contextMenu && this.disposable.push(zt(this, this.contextMenu)), this.draggable && this.disposable.push(Dt()), this.allowUndo && this.disposable.push(Kt(this)), this.layout(), this.linkDiv(), this.toCenter();
2696
+ e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, q(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Qn(this), this.keypress && Tn(this, this.keypress), this.editable && (ro(this), this.disposable.push($n())), this.contextMenu && this.disposable.push(Bn(this, this.contextMenu)), this.allowUndo && this.disposable.push(Yn(this)), this.layout(), this.linkDiv(), this.toCenter();
2670
2697
  },
2671
2698
  destroy() {
2672
- this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
2699
+ 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.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;
2673
2700
  }
2674
2701
  };
2675
- function Uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: a }) {
2702
+ function Qo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
2676
2703
  let d = t + n / 2;
2677
2704
  const h = e + o / 2;
2678
2705
  let u;
2679
- c === B.LHS ? u = i + l : u = i;
2680
- const y = s + r / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
2681
- return c === B.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
2706
+ r === I.LHS ? u = i + l : u = i;
2707
+ const y = s + c / 2, p = (1 - Math.abs(y - h) / a) * 0.25 * (n / 2);
2708
+ return r === I.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${y} ${u} ${y}`;
2682
2709
  }
2683
- function Jo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: a }) {
2710
+ function es({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
2684
2711
  const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
2685
2712
  let h = 0, u = 0;
2686
2713
  a ? h = e + o / 2 : h = e + o;
2687
- const y = s + r;
2714
+ const y = s + c;
2688
2715
  let v = 0, p = 0, g = 0;
2689
2716
  const m = Math.abs(h - y) / 300 * d;
2690
- return c === B.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
2717
+ return r === I.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${y} ${p} ${y} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${y} ${p} ${y} H ${u}`);
2691
2718
  }
2692
- const Zo = "5.6.0";
2693
- function Qo(e) {
2719
+ const ts = "5.7.0";
2720
+ function ns(e) {
2694
2721
  return {
2695
2722
  x: 0,
2696
2723
  y: 0,
@@ -2706,62 +2733,67 @@ function Qo(e) {
2706
2733
  };
2707
2734
  }
2708
2735
  const U = document;
2709
- function I({
2736
+ function B({
2710
2737
  el: e,
2711
2738
  direction: t,
2712
2739
  locale: n,
2713
- draggable: o,
2714
- editable: s,
2715
- contextMenu: i,
2716
- toolBar: l,
2717
- keypress: r,
2740
+ editable: o,
2741
+ contextMenu: s,
2742
+ toolBar: i,
2743
+ keypress: l,
2718
2744
  mouseSelectionButton: c,
2719
- selectionContainer: a,
2720
- before: d,
2721
- newTopicName: h,
2722
- allowUndo: u,
2723
- generateMainBranch: y,
2724
- generateSubBranch: v,
2725
- overflowHidden: p,
2726
- theme: g,
2727
- alignment: m,
2728
- scaleSensitivity: b,
2729
- scaleMax: x,
2730
- scaleMin: L,
2731
- handleWheel: T,
2732
- markdown: E,
2733
- imageProxy: C
2745
+ selectionContainer: r,
2746
+ before: a,
2747
+ newTopicName: d,
2748
+ allowUndo: h,
2749
+ generateMainBranch: u,
2750
+ generateSubBranch: y,
2751
+ overflowHidden: v,
2752
+ theme: p,
2753
+ alignment: g,
2754
+ scaleSensitivity: m,
2755
+ scaleMax: b,
2756
+ scaleMin: x,
2757
+ handleWheel: L,
2758
+ markdown: T,
2759
+ imageProxy: E,
2760
+ pasteHandler: C
2734
2761
  }) {
2735
2762
  let S = null;
2736
2763
  const N = Object.prototype.toString.call(e);
2737
2764
  if (N === "[object HTMLDivElement]" ? S = e : N === "[object String]" && (S = document.querySelector(e)), !S) throw new Error("MindElixir: el is not a valid element");
2738
- S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = d || {}, this.locale = n || "en", this.newTopicName = h || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = u ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = L ?? 0.2, this.generateMainBranch = y || Uo, this.generateSubBranch = v || Jo, this.overflowHidden = p ?? !1, this.alignment = m ?? "root", this.handleWheel = T ?? !0, this.markdown = E || void 0, this.imageProxy = C || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Qo(this), this.bus = Ot(), this.container = U.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
2739
- const D = window.matchMedia("(prefers-color-scheme: dark)");
2740
- this.theme = g || (D.matches ? Ne : Se);
2765
+ S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.newTopicName = d || "New Node", this.contextMenu = s ?? !0, this.toolBar = i ?? !0, this.keypress = l ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.editable = o ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = m ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = x ?? 0.2, this.generateMainBranch = u || Qo, this.generateSubBranch = y || es, this.overflowHidden = v ?? !1, this.alignment = g ?? "root", this.handleWheel = L ?? !0, this.markdown = T || void 0, this.imageProxy = E || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = ns(this), this.bus = Hn(), this.container = U.createElement("div"), this.selectionContainer = r || this.container, this.container.className = "map-container";
2766
+ const M = window.matchMedia("(prefers-color-scheme: dark)");
2767
+ this.theme = p || (M.matches ? Ne : Se);
2741
2768
  const _ = U.createElement("div");
2742
- _.className = "map-canvas", this.map = _, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = oe("lines"), this.summarySvg = oe("summary"), this.linkController = oe("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Ye(), this.line2 = Ye(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = oe("topiclinks"), this.labelContainer = U.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Pt(this));
2769
+ _.className = "map-canvas", this.map = _, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.lines = oe("lines"), this.summarySvg = oe("summary"), this.linkController = oe("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Xe(), this.line2 = Xe(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = oe("topiclinks"), this.labelContainer = U.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(jn(this)), C && (this.pasteHandler = C);
2743
2770
  }
2744
- I.prototype = Vo;
2745
- Object.defineProperty(I.prototype, "currentNode", {
2771
+ B.prototype = Zo;
2772
+ Object.defineProperty(B.prototype, "currentNode", {
2746
2773
  get() {
2747
2774
  return this.currentNodes[this.currentNodes.length - 1];
2748
2775
  },
2749
2776
  enumerable: !0
2750
2777
  });
2751
- I.LEFT = 0;
2752
- I.RIGHT = 1;
2753
- I.SIDE = 2;
2754
- I.THEME = Se;
2755
- I.DARK_THEME = Ne;
2756
- I.version = Zo;
2757
- I.E = it;
2758
- I.new = (e) => ({
2778
+ B.LEFT = 0;
2779
+ B.RIGHT = 1;
2780
+ B.SIDE = 2;
2781
+ B.THEME = Se;
2782
+ B.DARK_THEME = Ne;
2783
+ B.version = ts;
2784
+ B.E = it;
2785
+ B.new = (e) => ({
2759
2786
  nodeData: {
2760
- id: q(),
2787
+ id: V(),
2761
2788
  topic: e || "new topic",
2762
2789
  children: []
2763
2790
  }
2764
2791
  });
2765
2792
  export {
2766
- I as default
2793
+ Ne as DARK_THEME,
2794
+ os as LEFT,
2795
+ ss as RIGHT,
2796
+ is as SIDE,
2797
+ Se as THEME,
2798
+ B as default
2767
2799
  };