mind-elixir 4.2.4 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +5 -5
- package/dist/MindElixir.js +552 -549
- package/dist/MindElixirLite.iife.js +5 -5
- package/dist/MindElixirLite.js +354 -351
- package/dist/types/const.d.ts +0 -1
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/readme.md +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
} catch {
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function u() {
|
|
14
14
|
i || (i = !0, o());
|
|
15
15
|
}
|
|
16
16
|
t = function() {
|
|
17
|
-
var d, a,
|
|
18
|
-
(g = document.createElement("div")).innerHTML = c, c = null, (
|
|
17
|
+
var d, a, p, g;
|
|
18
|
+
(g = document.createElement("div")).innerHTML = c, c = null, (p = g.getElementsByTagName("svg")[0]) && (p.setAttribute("aria-hidden", "true"), p.style.position = "absolute", p.style.width = 0, p.style.height = 0, p.style.overflow = "hidden", d = p, (a = document.body).firstChild ? (g = d, (p = a.firstChild).parentNode.insertBefore(g, p)) : a.appendChild(d));
|
|
19
19
|
}, document.addEventListener ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) ? setTimeout(t, 0) : (n = function() {
|
|
20
20
|
document.removeEventListener("DOMContentLoaded", n, !1), t();
|
|
21
21
|
}, document.addEventListener("DOMContentLoaded", n, !1)) : document.attachEvent && (o = t, s = e.document, i = !1, (r = function() {
|
|
@@ -24,15 +24,16 @@
|
|
|
24
24
|
} catch {
|
|
25
25
|
return void setTimeout(r, 50);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
u();
|
|
28
28
|
})(), s.onreadystatechange = function() {
|
|
29
|
-
s.readyState == "complete" && (s.onreadystatechange = null,
|
|
29
|
+
s.readyState == "complete" && (s.onreadystatechange = null, u());
|
|
30
30
|
});
|
|
31
31
|
})(window);
|
|
32
|
-
const T = 0,
|
|
32
|
+
const T = 0, z = 1, re = 2, $e = {
|
|
33
33
|
name: "Latte",
|
|
34
34
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
35
35
|
cssVar: {
|
|
36
|
+
"--gap": "30px",
|
|
36
37
|
"--main-color": "#444446",
|
|
37
38
|
"--main-bgcolor": "#ffffff",
|
|
38
39
|
"--color": "#777777",
|
|
@@ -41,7 +42,7 @@ const T = 0, R = 1, ce = 2, D = 30, Oe = {
|
|
|
41
42
|
"--panel-bgcolor": "#ffffff",
|
|
42
43
|
"--panel-border-color": "#eaeaea"
|
|
43
44
|
}
|
|
44
|
-
},
|
|
45
|
+
}, Oe = {
|
|
45
46
|
name: "Dark",
|
|
46
47
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
47
48
|
cssVar: {
|
|
@@ -54,60 +55,60 @@ const T = 0, R = 1, ce = 2, D = 30, Oe = {
|
|
|
54
55
|
"--panel-border-color": "#696969"
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
|
-
function
|
|
58
|
+
function ne(e) {
|
|
58
59
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
59
60
|
}
|
|
60
|
-
const
|
|
61
|
+
const oe = function(e, t) {
|
|
61
62
|
if (t.id === e)
|
|
62
63
|
return t;
|
|
63
64
|
if (t.children && t.children.length) {
|
|
64
65
|
for (let n = 0; n < t.children.length; n++) {
|
|
65
|
-
const o =
|
|
66
|
+
const o = oe(e, t.children[n]);
|
|
66
67
|
if (o)
|
|
67
68
|
return o;
|
|
68
69
|
}
|
|
69
70
|
return null;
|
|
70
71
|
} else
|
|
71
72
|
return null;
|
|
72
|
-
},
|
|
73
|
+
}, D = (e, t) => {
|
|
73
74
|
if (e.parent = t, e.children)
|
|
74
75
|
for (let n = 0; n < e.children.length; n++)
|
|
75
|
-
|
|
76
|
+
D(e.children[n], e);
|
|
76
77
|
};
|
|
77
|
-
function
|
|
78
|
-
if (e.id =
|
|
78
|
+
function he(e) {
|
|
79
|
+
if (e.id = X(), e.children)
|
|
79
80
|
for (let t = 0; t < e.children.length; t++)
|
|
80
|
-
|
|
81
|
+
he(e.children[t]);
|
|
81
82
|
}
|
|
82
|
-
const
|
|
83
|
+
const tt = (e, t) => {
|
|
83
84
|
let n = Date.now();
|
|
84
85
|
return function(...o) {
|
|
85
86
|
Date.now() - n < t || (e(...o), n = Date.now());
|
|
86
87
|
};
|
|
87
88
|
};
|
|
88
|
-
function
|
|
89
|
+
function Pe(e, t, n, o) {
|
|
89
90
|
const s = o - t, i = e - n;
|
|
90
91
|
let r = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
91
92
|
i < 0 && s > 0 && (r = 180 - r), i < 0 && s < 0 && (r = 180 + r), i > 0 && s < 0 && (r = 360 - r);
|
|
92
|
-
const c = 15, l = 30,
|
|
93
|
+
const c = 15, l = 30, u = r + l, d = r - l;
|
|
93
94
|
return {
|
|
94
|
-
x1: n + Math.cos(Math.PI *
|
|
95
|
-
y1: o - Math.sin(Math.PI *
|
|
95
|
+
x1: n + Math.cos(Math.PI * u / 180) * c,
|
|
96
|
+
y1: o - Math.sin(Math.PI * u / 180) * c,
|
|
96
97
|
x2: n + Math.cos(Math.PI * d / 180) * c,
|
|
97
98
|
y2: o - Math.sin(Math.PI * d / 180) * c
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function X() {
|
|
101
102
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
102
103
|
}
|
|
103
|
-
const
|
|
104
|
-
const e =
|
|
104
|
+
const nt = function() {
|
|
105
|
+
const e = X();
|
|
105
106
|
return {
|
|
106
107
|
topic: this.newTopicName,
|
|
107
108
|
id: e
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
|
-
function
|
|
111
|
+
function ue(e) {
|
|
111
112
|
return JSON.parse(
|
|
112
113
|
JSON.stringify(e, (n, o) => {
|
|
113
114
|
if (n !== "parent")
|
|
@@ -115,7 +116,7 @@ function fe(e) {
|
|
|
115
116
|
})
|
|
116
117
|
);
|
|
117
118
|
}
|
|
118
|
-
const
|
|
119
|
+
const $ = (e, t) => {
|
|
119
120
|
let n = 0, o = 0;
|
|
120
121
|
for (; t && t !== e; )
|
|
121
122
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -123,7 +124,7 @@ const O = (e, t) => {
|
|
|
123
124
|
}, N = (e, t) => {
|
|
124
125
|
for (const n in t)
|
|
125
126
|
e.setAttribute(n, t[n]);
|
|
126
|
-
},
|
|
127
|
+
}, le = (e) => e ? e.tagName === "ME-TPC" : !1, ce = (e) => e.filter((t) => {
|
|
127
128
|
for (let n = 0; n < e.length; n++) {
|
|
128
129
|
if (t === e[n])
|
|
129
130
|
continue;
|
|
@@ -146,7 +147,7 @@ const O = (e, t) => {
|
|
|
146
147
|
this.moved = !1, this.mousedown = !1;
|
|
147
148
|
}
|
|
148
149
|
};
|
|
149
|
-
function
|
|
150
|
+
function ot(e) {
|
|
150
151
|
e.map.addEventListener("click", (t) => {
|
|
151
152
|
var o, s;
|
|
152
153
|
if (t.button !== 0)
|
|
@@ -167,7 +168,7 @@ function st(e) {
|
|
|
167
168
|
const n = t.target;
|
|
168
169
|
if (n.tagName === "ME-EPD")
|
|
169
170
|
e.expandNode(n.previousSibling);
|
|
170
|
-
else if (
|
|
171
|
+
else if (le(n))
|
|
171
172
|
e.selectNode(n, !1, t);
|
|
172
173
|
else if (e.editable)
|
|
173
174
|
n.tagName === "text" ? n.dataset.type === "custom-link" ? e.selectArrow(n.parentElement) : e.selectSummary(n.parentElement) : n.className;
|
|
@@ -177,7 +178,7 @@ function st(e) {
|
|
|
177
178
|
if (!e.editable)
|
|
178
179
|
return;
|
|
179
180
|
const n = t.target;
|
|
180
|
-
|
|
181
|
+
le(n) ? e.beginEdit(n) : n.tagName === "text" && (n.dataset.type === "custom-link" ? e.editArrowLabel(n.parentElement) : e.editSummary(n.parentElement));
|
|
181
182
|
}), e.map.addEventListener("mousemove", (t) => {
|
|
182
183
|
t.target.contentEditable !== "true" && k.onMove(t, e.container);
|
|
183
184
|
}), e.map.addEventListener("mousedown", (t) => {
|
|
@@ -191,7 +192,7 @@ function st(e) {
|
|
|
191
192
|
t.button === n && k.clear();
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
|
-
const
|
|
195
|
+
const st = {
|
|
195
196
|
create() {
|
|
196
197
|
return {
|
|
197
198
|
handlers: {},
|
|
@@ -219,32 +220,32 @@ const it = {
|
|
|
219
220
|
}
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
|
-
},
|
|
223
|
+
}, se = document, it = function() {
|
|
223
224
|
this.nodes.innerHTML = "";
|
|
224
225
|
const e = this.createTopic(this.nodeData);
|
|
225
|
-
|
|
226
|
-
const t =
|
|
226
|
+
fe(e, this.nodeData), e.draggable = !1;
|
|
227
|
+
const t = se.createElement("me-root");
|
|
227
228
|
t.appendChild(e);
|
|
228
229
|
const n = this.nodeData.children || [];
|
|
229
|
-
if (this.direction ===
|
|
230
|
+
if (this.direction === re) {
|
|
230
231
|
let o = 0, s = 0;
|
|
231
232
|
n.map((i) => {
|
|
232
|
-
i.direction === T ? o += 1 : i.direction ===
|
|
233
|
+
i.direction === T ? o += 1 : i.direction === z ? s += 1 : o <= s ? (i.direction = T, o += 1) : (i.direction = z, s += 1);
|
|
233
234
|
});
|
|
234
235
|
}
|
|
235
|
-
|
|
236
|
-
},
|
|
237
|
-
const o =
|
|
236
|
+
rt(this, n, t);
|
|
237
|
+
}, rt = function(e, t, n) {
|
|
238
|
+
const o = se.createElement("me-main");
|
|
238
239
|
o.className = "lhs";
|
|
239
|
-
const s =
|
|
240
|
+
const s = se.createElement("me-main");
|
|
240
241
|
s.className = "rhs";
|
|
241
242
|
for (let i = 0; i < t.length; i++) {
|
|
242
243
|
const r = t[i], { grp: c } = e.createWrapper(r);
|
|
243
|
-
e.direction ===
|
|
244
|
+
e.direction === re ? r.direction === T ? o.appendChild(c) : s.appendChild(c) : e.direction === T ? o.appendChild(c) : s.appendChild(c);
|
|
244
245
|
}
|
|
245
246
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
|
|
246
|
-
},
|
|
247
|
-
const n =
|
|
247
|
+
}, ct = function(e, t) {
|
|
248
|
+
const n = se.createElement("me-children");
|
|
248
249
|
for (let o = 0; o < t.length; o++) {
|
|
249
250
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
250
251
|
n.appendChild(i);
|
|
@@ -255,7 +256,7 @@ const it = {
|
|
|
255
256
|
if (!o)
|
|
256
257
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
257
258
|
return o;
|
|
258
|
-
},
|
|
259
|
+
}, fe = function(e, t) {
|
|
259
260
|
if (e.innerHTML = "", t.style && (e.style.color = t.style.color || "", e.style.background = t.style.background || "", e.style.fontSize = t.style.fontSize + "px", e.style.fontWeight = t.style.fontWeight || "normal"), t.dangerouslySetInnerHTML) {
|
|
260
261
|
e.innerHTML = t.dangerouslySetInnerHTML;
|
|
261
262
|
return;
|
|
@@ -279,31 +280,31 @@ const it = {
|
|
|
279
280
|
e.linkContainer && (e.linkContainer = void 0);
|
|
280
281
|
if (t.icons && t.icons.length) {
|
|
281
282
|
const n = _.createElement("span");
|
|
282
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
283
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${ne(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
283
284
|
} else
|
|
284
285
|
e.icons && (e.icons = void 0);
|
|
285
286
|
if (t.tags && t.tags.length) {
|
|
286
287
|
const n = _.createElement("div");
|
|
287
|
-
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${
|
|
288
|
+
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${ne(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
|
|
288
289
|
} else
|
|
289
290
|
e.tags && (e.tags = void 0);
|
|
290
|
-
},
|
|
291
|
+
}, lt = function(e, t) {
|
|
291
292
|
const n = _.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
292
293
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
293
|
-
const i =
|
|
294
|
+
const i = pe(e.expanded);
|
|
294
295
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
295
|
-
const r =
|
|
296
|
+
const r = ct(this, e.children);
|
|
296
297
|
n.appendChild(r);
|
|
297
298
|
}
|
|
298
299
|
}
|
|
299
300
|
return { grp: n, top: o, tpc: s };
|
|
300
|
-
},
|
|
301
|
+
}, at = function(e) {
|
|
301
302
|
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
302
|
-
return
|
|
303
|
-
},
|
|
303
|
+
return fe(n, e), t.appendChild(n), { p: t, tpc: n };
|
|
304
|
+
}, dt = function(e) {
|
|
304
305
|
const t = _.createElement("me-children");
|
|
305
306
|
return t.append(...e), t;
|
|
306
|
-
},
|
|
307
|
+
}, ht = function(e) {
|
|
307
308
|
const t = _.createElement("me-tpc");
|
|
308
309
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
309
310
|
};
|
|
@@ -313,7 +314,7 @@ function Be(e) {
|
|
|
313
314
|
const n = window.getSelection();
|
|
314
315
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
315
316
|
}
|
|
316
|
-
const
|
|
317
|
+
const ut = function(e) {
|
|
317
318
|
if (!e)
|
|
318
319
|
return;
|
|
319
320
|
const t = _.createElement("div"), n = e.text.textContent;
|
|
@@ -347,30 +348,30 @@ const ft = function(e) {
|
|
|
347
348
|
origin: n
|
|
348
349
|
}));
|
|
349
350
|
});
|
|
350
|
-
},
|
|
351
|
+
}, pe = function(e) {
|
|
351
352
|
const t = _.createElement("me-epd");
|
|
352
353
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
353
|
-
},
|
|
354
|
-
const o =
|
|
354
|
+
}, I = document, K = "http://www.w3.org/2000/svg", He = function(e, t, n) {
|
|
355
|
+
const o = I.createElementNS(K, "path");
|
|
355
356
|
return N(o, {
|
|
356
357
|
d: e,
|
|
357
358
|
stroke: t || "#666",
|
|
358
359
|
fill: "none",
|
|
359
360
|
"stroke-width": n
|
|
360
361
|
}), o;
|
|
361
|
-
},
|
|
362
|
-
const t =
|
|
362
|
+
}, Y = function(e) {
|
|
363
|
+
const t = I.createElementNS(K, "svg");
|
|
363
364
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
364
|
-
},
|
|
365
|
-
const e =
|
|
365
|
+
}, ye = function() {
|
|
366
|
+
const e = I.createElementNS(K, "line");
|
|
366
367
|
return e.setAttribute("stroke", "#bbb"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e;
|
|
367
|
-
},
|
|
368
|
+
}, ft = function(e, t) {
|
|
368
369
|
const n = {
|
|
369
370
|
stroke: "rgb(235, 95, 82)",
|
|
370
371
|
fill: "none",
|
|
371
372
|
"stroke-linecap": "cap",
|
|
372
373
|
"stroke-width": "2"
|
|
373
|
-
}, o =
|
|
374
|
+
}, o = I.createElementNS(K, "g"), s = I.createElementNS(K, "path"), i = I.createElementNS(K, "path");
|
|
374
375
|
return N(i, {
|
|
375
376
|
d: t,
|
|
376
377
|
...n
|
|
@@ -379,7 +380,7 @@ const ft = function(e) {
|
|
|
379
380
|
...n,
|
|
380
381
|
"stroke-dasharray": "8,2"
|
|
381
382
|
}), o.appendChild(s), o.appendChild(i), o;
|
|
382
|
-
},
|
|
383
|
+
}, ze = function(e, t, n) {
|
|
383
384
|
if (!t)
|
|
384
385
|
return;
|
|
385
386
|
const o = document.createElement("div");
|
|
@@ -391,8 +392,8 @@ const ft = function(e) {
|
|
|
391
392
|
const c = t.getAttribute("text-anchor");
|
|
392
393
|
c === "end" ? o.style.cssText += "transform: translate(-100%, -100%);" : c === "middle" ? o.style.cssText += "transform: translate(-50%, -100%);" : o.style.cssText += "transform: translate(0, -100%);", o.focus(), Be(o), o.addEventListener("keydown", (l) => {
|
|
393
394
|
l.stopPropagation();
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
395
|
+
const u = l.key;
|
|
396
|
+
if (u === "Enter" || u === "Tab") {
|
|
396
397
|
if (l.shiftKey)
|
|
397
398
|
return;
|
|
398
399
|
l.preventDefault(), o.blur(), e.map.focus();
|
|
@@ -400,38 +401,38 @@ const ft = function(e) {
|
|
|
400
401
|
}), o.addEventListener("blur", () => {
|
|
401
402
|
o && n(o);
|
|
402
403
|
});
|
|
403
|
-
},
|
|
404
|
+
}, pt = function(e) {
|
|
404
405
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight;
|
|
405
406
|
this.nodes.style.top = `${1e4 - this.nodes.offsetHeight / 2}px`, this.nodes.style.left = `${1e4 - o - s / 2}px`;
|
|
406
407
|
const r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
407
408
|
this.lines.innerHTML = "";
|
|
408
409
|
for (let c = 0; c < r.length; c++) {
|
|
409
|
-
const l = r[c],
|
|
410
|
-
|
|
410
|
+
const l = r[c], u = l.querySelector("me-tpc"), { offsetLeft: d, offsetTop: a } = $(this.nodes, u), p = u.offsetWidth, g = u.offsetHeight, f = l.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: a, cL: d, cW: p, cH: g, direction: f, containerHeight: this.nodes.offsetHeight }), h = this.theme.palette, v = u.nodeObj.branchColor || h[c % h.length];
|
|
411
|
+
u.style.borderColor = v, this.lines.appendChild(He(m, v, "3"));
|
|
411
412
|
const y = l.children[0].children[1];
|
|
412
|
-
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px",
|
|
413
|
+
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px", f === "lhs" ? y.style.left = "-10px" : y.style.right = "-10px"), e && e !== l)
|
|
413
414
|
continue;
|
|
414
|
-
const b =
|
|
415
|
-
x.tagName === "svg" && x.remove(), l.appendChild(b),
|
|
415
|
+
const b = Y("subLines"), x = l.lastChild;
|
|
416
|
+
x.tagName === "svg" && x.remove(), l.appendChild(b), Re(this, b, v, l, f, !0);
|
|
416
417
|
}
|
|
417
418
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
418
|
-
},
|
|
419
|
+
}, Re = function(e, t, n, o, s, i) {
|
|
419
420
|
const r = o.firstChild, c = o.children[1].children;
|
|
420
421
|
if (c.length === 0)
|
|
421
422
|
return;
|
|
422
|
-
const l = r.offsetTop,
|
|
423
|
-
for (let
|
|
424
|
-
const g = c[
|
|
425
|
-
t.appendChild(
|
|
426
|
-
const w =
|
|
423
|
+
const l = r.offsetTop, u = r.offsetLeft, d = r.offsetWidth, a = r.offsetHeight;
|
|
424
|
+
for (let p = 0; p < c.length; p++) {
|
|
425
|
+
const g = c[p], f = g.firstChild, m = f.offsetTop, h = f.offsetLeft, v = f.offsetWidth, y = f.offsetHeight, b = f.firstChild.nodeObj.branchColor || n, x = e.generateSubBranch({ pT: l, pL: u, pW: d, pH: a, cT: m, cL: h, cW: v, cH: y, direction: s, isFirst: i });
|
|
426
|
+
t.appendChild(He(x, b, "2"));
|
|
427
|
+
const w = f.children[1];
|
|
427
428
|
if (w) {
|
|
428
429
|
if (w.style.bottom = -(w.offsetHeight / 2) + "px", s === "lhs" ? w.style.left = "10px" : s === "rhs" && (w.style.right = "10px"), !w.expanded)
|
|
429
430
|
continue;
|
|
430
431
|
} else
|
|
431
432
|
continue;
|
|
432
|
-
|
|
433
|
+
Re(e, t, b, g, s);
|
|
433
434
|
}
|
|
434
|
-
},
|
|
435
|
+
}, be = {
|
|
435
436
|
addChild: "插入子节点",
|
|
436
437
|
addParent: "插入父节点",
|
|
437
438
|
addSibling: "插入同级节点",
|
|
@@ -443,9 +444,9 @@ const ft = function(e) {
|
|
|
443
444
|
link: "连接",
|
|
444
445
|
clickTips: "请点击目标节点",
|
|
445
446
|
summary: "摘要"
|
|
446
|
-
},
|
|
447
|
-
cn:
|
|
448
|
-
zh_CN:
|
|
447
|
+
}, xe = {
|
|
448
|
+
cn: be,
|
|
449
|
+
zh_CN: be,
|
|
449
450
|
zh_TW: {
|
|
450
451
|
addChild: "插入子節點",
|
|
451
452
|
addParent: "插入父節點",
|
|
@@ -564,32 +565,32 @@ const ft = function(e) {
|
|
|
564
565
|
summary: "요약"
|
|
565
566
|
}
|
|
566
567
|
};
|
|
567
|
-
function
|
|
568
|
+
function mt(e, t) {
|
|
568
569
|
const n = (b) => {
|
|
569
570
|
const x = document.createElement("div");
|
|
570
571
|
return x.innerText = b, x.className = "tips", x;
|
|
571
572
|
}, o = (b, x, w) => {
|
|
572
573
|
const S = document.createElement("li");
|
|
573
|
-
return S.id = b, S.innerHTML = `<span>${
|
|
574
|
-
}, s =
|
|
575
|
-
if (
|
|
574
|
+
return S.id = b, S.innerHTML = `<span>${ne(x)}</span><span ${w ? 'class="key"' : ""}>${ne(w)}</span>`, S;
|
|
575
|
+
}, s = xe[e.locale] ? e.locale : "en", i = xe[s], r = o("cm-add_child", i.addChild, "Tab"), c = o("cm-add_parent", i.addParent, "Ctrl + Enter"), l = o("cm-add_sibling", i.addSibling, "Enter"), u = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), a = o("cm-unfucus", i.cancelFocus, ""), p = o("cm-up", i.moveUp, "PgUp"), g = o("cm-down", i.moveDown, "Pgdn"), f = o("cm-link", i.link, ""), m = o("cm-summary", i.summary, ""), h = document.createElement("ul");
|
|
576
|
+
if (h.className = "menu-list", h.appendChild(r), h.appendChild(c), h.appendChild(l), h.appendChild(u), (!t || t.focus) && (h.appendChild(d), h.appendChild(a)), h.appendChild(p), h.appendChild(g), h.appendChild(m), (!t || t.link) && h.appendChild(f), t && t.extend)
|
|
576
577
|
for (let b = 0; b < t.extend.length; b++) {
|
|
577
578
|
const x = t.extend[b], w = o(x.name, x.name, x.key || "");
|
|
578
|
-
|
|
579
|
+
h.appendChild(w), w.onclick = (S) => {
|
|
579
580
|
x.onclick(S);
|
|
580
581
|
};
|
|
581
582
|
}
|
|
582
583
|
const v = document.createElement("div");
|
|
583
|
-
v.className = "context-menu", v.appendChild(
|
|
584
|
+
v.className = "context-menu", v.appendChild(h), v.hidden = !0, e.container.append(v);
|
|
584
585
|
let y = !0;
|
|
585
586
|
return e.container.oncontextmenu = function(b) {
|
|
586
587
|
if (b.preventDefault(), !e.editable)
|
|
587
588
|
return;
|
|
588
589
|
const x = b.target;
|
|
589
|
-
if (
|
|
590
|
-
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (d.className = "disabled",
|
|
591
|
-
const w =
|
|
592
|
-
S +
|
|
590
|
+
if (le(x)) {
|
|
591
|
+
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (d.className = "disabled", p.className = "disabled", g.className = "disabled", c.className = "disabled", l.className = "disabled", u.className = "disabled") : (d.className = "", p.className = "", g.className = "", c.className = "", l.className = "", u.className = ""), e.currentNodes || e.selectNode(x), v.hidden = !1, k.mousedown && (k.mousedown = !1), h.style.top = "", h.style.bottom = "", h.style.left = "", h.style.right = "";
|
|
592
|
+
const w = h.getBoundingClientRect(), S = h.offsetHeight, O = h.offsetWidth, W = b.clientY - w.top, P = b.clientX - w.left;
|
|
593
|
+
S + W > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = W + 15 + "px"), O + P > window.innerWidth ? (h.style.left = "", h.style.right = "0px") : (h.style.right = "", h.style.left = P + 10 + "px");
|
|
593
594
|
}
|
|
594
595
|
}, v.onclick = (b) => {
|
|
595
596
|
b.target === v && (v.hidden = !0);
|
|
@@ -599,17 +600,17 @@ function gt(e, t) {
|
|
|
599
600
|
e.insertParent(), v.hidden = !0;
|
|
600
601
|
}, l.onclick = () => {
|
|
601
602
|
y || (e.insertSibling("after"), v.hidden = !0);
|
|
602
|
-
},
|
|
603
|
+
}, u.onclick = () => {
|
|
603
604
|
y || (e.removeNode(), v.hidden = !0);
|
|
604
605
|
}, d.onclick = () => {
|
|
605
606
|
y || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
606
607
|
}, a.onclick = () => {
|
|
607
608
|
e.cancelFocus(), v.hidden = !0;
|
|
608
|
-
},
|
|
609
|
+
}, p.onclick = () => {
|
|
609
610
|
y || (e.moveUpNode(), v.hidden = !0);
|
|
610
611
|
}, g.onclick = () => {
|
|
611
612
|
y || (e.moveDownNode(), v.hidden = !0);
|
|
612
|
-
},
|
|
613
|
+
}, f.onclick = () => {
|
|
613
614
|
v.hidden = !0;
|
|
614
615
|
const b = e.currentNode, x = n(i.clickTips);
|
|
615
616
|
e.container.appendChild(x), e.map.addEventListener(
|
|
@@ -626,44 +627,44 @@ function gt(e, t) {
|
|
|
626
627
|
}, m.onclick = () => {
|
|
627
628
|
v.hidden = !0, e.createSummary(), e.unselectNodes();
|
|
628
629
|
}, () => {
|
|
629
|
-
r.onclick = null, c.onclick = null, l.onclick = null,
|
|
630
|
+
r.onclick = null, c.onclick = null, l.onclick = null, u.onclick = null, d.onclick = null, a.onclick = null, p.onclick = null, g.onclick = null, f.onclick = null, m.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
|
|
630
631
|
};
|
|
631
632
|
}
|
|
632
|
-
const
|
|
633
|
+
const gt = (e) => {
|
|
633
634
|
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
|
|
634
635
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
635
|
-
},
|
|
636
|
+
}, vt = (e) => {
|
|
636
637
|
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
637
638
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
638
|
-
},
|
|
639
|
+
}, yt = (e) => {
|
|
639
640
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
640
|
-
},
|
|
641
|
+
}, bt = function(e, t) {
|
|
641
642
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
642
643
|
if (n) {
|
|
643
644
|
const o = n.firstChild;
|
|
644
645
|
e.selectNode(o);
|
|
645
646
|
}
|
|
646
|
-
},
|
|
647
|
+
}, xt = function(e, t) {
|
|
647
648
|
const n = t.parentElement.nextSibling;
|
|
648
649
|
if (n && n.firstChild) {
|
|
649
650
|
const o = n.firstChild.firstChild.firstChild;
|
|
650
651
|
e.selectNode(o);
|
|
651
652
|
}
|
|
652
|
-
},
|
|
653
|
+
}, we = function(e, t) {
|
|
653
654
|
var i, r;
|
|
654
655
|
const n = e.currentNode || ((i = e.currentNodes) == null ? void 0 : i[0]);
|
|
655
656
|
if (!n)
|
|
656
657
|
return;
|
|
657
658
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
658
|
-
o.parent ? s.className === t ?
|
|
659
|
-
},
|
|
659
|
+
o.parent ? s.className === t ? xt(e, n) : (r = o.parent) != null && r.parent ? bt(e, n) : yt(e) : t === "lhs" ? gt(e) : vt(e);
|
|
660
|
+
}, Ee = function(e, t) {
|
|
660
661
|
var r;
|
|
661
662
|
const n = e.currentNode || ((r = e.currentNodes) == null ? void 0 : r[0]);
|
|
662
663
|
if (!n || !n.nodeObj.parent)
|
|
663
664
|
return;
|
|
664
665
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
665
666
|
i && e.selectNode(i.firstChild.firstChild);
|
|
666
|
-
},
|
|
667
|
+
}, Z = function(e, t, n = 1) {
|
|
667
668
|
switch (t) {
|
|
668
669
|
case "in":
|
|
669
670
|
if (e.scaleVal * n > 1.6)
|
|
@@ -676,7 +677,7 @@ const vt = (e) => {
|
|
|
676
677
|
e.scale(e.scaleVal -= 0.2);
|
|
677
678
|
}
|
|
678
679
|
};
|
|
679
|
-
function
|
|
680
|
+
function wt(e) {
|
|
680
681
|
const t = () => {
|
|
681
682
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNode ? e.removeNode() : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
682
683
|
}, n = {
|
|
@@ -698,21 +699,21 @@ function Et(e) {
|
|
|
698
699
|
else {
|
|
699
700
|
if (o.metaKey || o.ctrlKey)
|
|
700
701
|
return e.initSide();
|
|
701
|
-
|
|
702
|
+
Ee(e, "previous");
|
|
702
703
|
}
|
|
703
704
|
},
|
|
704
705
|
ArrowDown: (o) => {
|
|
705
|
-
o.altKey ? e.moveDownNode() :
|
|
706
|
+
o.altKey ? e.moveDownNode() : Ee(e, "next");
|
|
706
707
|
},
|
|
707
708
|
ArrowLeft: (o) => {
|
|
708
709
|
if (o.metaKey || o.ctrlKey)
|
|
709
710
|
return e.initLeft();
|
|
710
|
-
|
|
711
|
+
we(e, "lhs");
|
|
711
712
|
},
|
|
712
713
|
ArrowRight: (o) => {
|
|
713
714
|
if (o.metaKey || o.ctrlKey)
|
|
714
715
|
return e.initRight();
|
|
715
|
-
|
|
716
|
+
we(e, "rhs");
|
|
716
717
|
},
|
|
717
718
|
PageUp: () => e.moveUpNode(),
|
|
718
719
|
PageDown: () => {
|
|
@@ -728,10 +729,10 @@ function Et(e) {
|
|
|
728
729
|
!e.waitCopy || !e.currentNode || (o.metaKey || o.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
|
|
729
730
|
},
|
|
730
731
|
"+": (o) => {
|
|
731
|
-
(o.metaKey || o.ctrlKey) &&
|
|
732
|
+
(o.metaKey || o.ctrlKey) && Z(e, "in");
|
|
732
733
|
},
|
|
733
734
|
"-": (o) => {
|
|
734
|
-
(o.metaKey || o.ctrlKey) &&
|
|
735
|
+
(o.metaKey || o.ctrlKey) && Z(e, "out");
|
|
735
736
|
},
|
|
736
737
|
0: (o) => {
|
|
737
738
|
(o.metaKey || o.ctrlKey) && e.scale(1);
|
|
@@ -748,38 +749,38 @@ function Et(e) {
|
|
|
748
749
|
if (o.ctrlKey || o.metaKey) {
|
|
749
750
|
o.preventDefault();
|
|
750
751
|
const s = Math.abs(o.deltaY / 100);
|
|
751
|
-
o.deltaY < 0 ?
|
|
752
|
+
o.deltaY < 0 ? Z(e, "in", s) : e.scaleVal - 0.2 > 0 && Z(e, "out", s), o.stopPropagation();
|
|
752
753
|
}
|
|
753
754
|
};
|
|
754
755
|
}
|
|
755
|
-
const
|
|
756
|
+
const ae = document, Et = function(e, t) {
|
|
756
757
|
if (!t)
|
|
757
|
-
return
|
|
758
|
+
return de(e), e;
|
|
758
759
|
let n = e.querySelector(".insert-preview");
|
|
759
760
|
const o = `insert-preview ${t} show`;
|
|
760
|
-
return n || (n =
|
|
761
|
-
},
|
|
761
|
+
return n || (n = ae.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
762
|
+
}, de = function(e) {
|
|
762
763
|
if (!e)
|
|
763
764
|
return;
|
|
764
765
|
const t = e.querySelectorAll(".insert-preview");
|
|
765
766
|
for (const n of t || [])
|
|
766
767
|
n.remove();
|
|
767
|
-
},
|
|
768
|
+
}, Ne = function(e, t) {
|
|
768
769
|
for (const n of t) {
|
|
769
770
|
const o = n.parentElement.parentElement.contains(e);
|
|
770
771
|
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent))
|
|
771
772
|
return !1;
|
|
772
773
|
}
|
|
773
774
|
return !0;
|
|
774
|
-
},
|
|
775
|
+
}, Nt = function(e) {
|
|
775
776
|
const t = document.createElement("div");
|
|
776
777
|
return t.className = "mind-elixir-ghost", e.map.appendChild(t), t;
|
|
777
778
|
};
|
|
778
|
-
function
|
|
779
|
+
function Ct(e) {
|
|
779
780
|
let t = null, n = null, o = null;
|
|
780
|
-
const s =
|
|
781
|
+
const s = Nt(e), i = 12;
|
|
781
782
|
e.map.addEventListener("dragstart", (r) => {
|
|
782
|
-
var l,
|
|
783
|
+
var l, u;
|
|
783
784
|
const c = r.target;
|
|
784
785
|
if ((c == null ? void 0 : c.tagName) !== "ME-TPC") {
|
|
785
786
|
r.preventDefault();
|
|
@@ -788,39 +789,39 @@ function St(e) {
|
|
|
788
789
|
(l = e.currentNodes) != null && l.includes(c) || (e.unselectNodes(), e.selectNode(c)), e.currentNodes ? (t = e.currentNodes, s.innerHTML = e.currentNodes.length + " nodes") : (t = [c], s.innerHTML = c.innerHTML);
|
|
789
790
|
for (const d of t)
|
|
790
791
|
d.parentElement.parentElement.style.opacity = "0.5";
|
|
791
|
-
(
|
|
792
|
+
(u = r.dataTransfer) == null || u.setDragImage(s, 0, 0), k.clear();
|
|
792
793
|
}), e.map.addEventListener("dragend", async (r) => {
|
|
793
794
|
if (!t)
|
|
794
795
|
return;
|
|
795
796
|
for (const l of t)
|
|
796
797
|
l.parentElement.parentElement.style.opacity = "1";
|
|
797
798
|
const c = r.target;
|
|
798
|
-
c.style.opacity = "", o && (
|
|
799
|
+
c.style.opacity = "", o && (de(o), n === "before" ? e.moveNodeBefore(t, o) : n === "after" ? e.moveNodeAfter(t, o) : n === "in" && e.moveNodeIn(t, o), t = null);
|
|
799
800
|
}), e.map.addEventListener(
|
|
800
801
|
"dragover",
|
|
801
|
-
|
|
802
|
+
tt(function(r) {
|
|
802
803
|
if (!t)
|
|
803
804
|
return;
|
|
804
|
-
|
|
805
|
-
const c =
|
|
806
|
-
if (
|
|
805
|
+
de(o);
|
|
806
|
+
const c = ae.elementFromPoint(r.clientX, r.clientY - i);
|
|
807
|
+
if (Ne(c, t)) {
|
|
807
808
|
o = c;
|
|
808
809
|
const l = c.getBoundingClientRect().y;
|
|
809
810
|
r.clientY > l + c.clientHeight ? n = "after" : n = "in";
|
|
810
811
|
} else {
|
|
811
|
-
const l =
|
|
812
|
-
if (
|
|
812
|
+
const l = ae.elementFromPoint(r.clientX, r.clientY + i);
|
|
813
|
+
if (Ne(l, t)) {
|
|
813
814
|
o = l;
|
|
814
|
-
const
|
|
815
|
-
r.clientY <
|
|
815
|
+
const u = l.getBoundingClientRect().y;
|
|
816
|
+
r.clientY < u ? n = "before" : n = "in";
|
|
816
817
|
} else
|
|
817
818
|
n = o = null;
|
|
818
819
|
}
|
|
819
|
-
o &&
|
|
820
|
+
o && Et(o, n);
|
|
820
821
|
}, 100)
|
|
821
822
|
);
|
|
822
823
|
}
|
|
823
|
-
const
|
|
824
|
+
const St = function(e) {
|
|
824
825
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
825
826
|
type: "summary",
|
|
826
827
|
value: e.obj.id
|
|
@@ -835,14 +836,14 @@ const _t = function(e) {
|
|
|
835
836
|
value: e.obj.id
|
|
836
837
|
};
|
|
837
838
|
};
|
|
838
|
-
function
|
|
839
|
+
function _t(e) {
|
|
839
840
|
let t = [], n = -1, o = e.getData();
|
|
840
841
|
e.bus.addListener("operation", (s) => {
|
|
841
842
|
if (s.name === "beginEdit")
|
|
842
843
|
return;
|
|
843
844
|
t = t.slice(0, n + 1);
|
|
844
845
|
const i = e.getData();
|
|
845
|
-
t.push({ prev: o, currentObject:
|
|
846
|
+
t.push({ prev: o, currentObject: St(s), next: i }), o = i, n = t.length - 1;
|
|
846
847
|
}), e.undo = function() {
|
|
847
848
|
if (n > -1) {
|
|
848
849
|
const s = t[n];
|
|
@@ -864,14 +865,14 @@ function Mt(e) {
|
|
|
864
865
|
(s.metaKey || s.ctrlKey) && s.shiftKey && s.key === "Z" ? e.redo() : (s.metaKey || s.ctrlKey) && s.key === "z" && e.undo();
|
|
865
866
|
});
|
|
866
867
|
}
|
|
867
|
-
const
|
|
868
|
+
const R = (e, t) => {
|
|
868
869
|
const n = document.createElement("span");
|
|
869
870
|
return n.id = e, n.innerHTML = `<svg class="icon" aria-hidden="true">
|
|
870
871
|
<use xlink:href="#icon-${t}"></use>
|
|
871
872
|
</svg>`, n;
|
|
872
873
|
};
|
|
873
|
-
function
|
|
874
|
-
const t = document.createElement("div"), n =
|
|
874
|
+
function Mt(e) {
|
|
875
|
+
const t = document.createElement("div"), n = R("fullscreen", "full"), o = R("toCenter", "living"), s = R("zoomout", "move"), i = R("zoomin", "add"), r = document.createElement("span");
|
|
875
876
|
return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
876
877
|
e.mindElixirBox.requestFullscreen();
|
|
877
878
|
}, o.onclick = () => {
|
|
@@ -882,8 +883,8 @@ function kt(e) {
|
|
|
882
883
|
e.scaleVal > 1.6 || e.scale(e.scaleVal + 0.2);
|
|
883
884
|
}, t;
|
|
884
885
|
}
|
|
885
|
-
function
|
|
886
|
-
const t = document.createElement("div"), n =
|
|
886
|
+
function kt(e) {
|
|
887
|
+
const t = document.createElement("div"), n = R("tbltl", "left"), o = R("tbltr", "right"), s = R("tblts", "side");
|
|
887
888
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
888
889
|
e.initLeft();
|
|
889
890
|
}, o.onclick = () => {
|
|
@@ -892,12 +893,12 @@ function Tt(e) {
|
|
|
892
893
|
e.initSide();
|
|
893
894
|
}, t;
|
|
894
895
|
}
|
|
895
|
-
function
|
|
896
|
-
e.container.append(
|
|
896
|
+
function Tt(e) {
|
|
897
|
+
e.container.append(Mt(e)), e.container.append(kt(e));
|
|
897
898
|
}
|
|
898
899
|
/*! @viselect/vanilla v3.6.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
|
|
899
|
-
var
|
|
900
|
-
class
|
|
900
|
+
var Lt = Object.defineProperty, At = (e, t, n) => t in e ? Lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, E = (e, t, n) => At(e, typeof t != "symbol" ? t + "" : t, n);
|
|
901
|
+
class jt {
|
|
901
902
|
constructor() {
|
|
902
903
|
E(this, "_listeners", /* @__PURE__ */ new Map()), E(this, "on", this.addEventListener), E(this, "off", this.removeEventListener), E(this, "emit", this.dispatchEvent);
|
|
903
904
|
}
|
|
@@ -919,27 +920,27 @@ class Dt {
|
|
|
919
920
|
this._listeners.clear();
|
|
920
921
|
}
|
|
921
922
|
}
|
|
922
|
-
const
|
|
923
|
+
const Ce = (e, t = "px") => typeof e == "number" ? e + t : e;
|
|
923
924
|
function j({ style: e }, t, n) {
|
|
924
925
|
if (typeof t == "object")
|
|
925
926
|
for (const [o, s] of Object.entries(t))
|
|
926
|
-
s !== void 0 && (e[o] =
|
|
927
|
+
s !== void 0 && (e[o] = Ce(s));
|
|
927
928
|
else
|
|
928
|
-
n !== void 0 && (e[t] =
|
|
929
|
+
n !== void 0 && (e[t] = Ce(n));
|
|
929
930
|
}
|
|
930
|
-
const
|
|
931
|
+
const Fe = (e) => (t, n, o, s = {}) => {
|
|
931
932
|
t instanceof HTMLCollection || t instanceof NodeList ? t = Array.from(t) : Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]);
|
|
932
933
|
for (const i of t)
|
|
933
934
|
if (i)
|
|
934
935
|
for (const r of n)
|
|
935
936
|
i[e](r, o, { capture: !1, ...s });
|
|
936
937
|
return [t, n, o, s];
|
|
937
|
-
}, B =
|
|
938
|
+
}, B = Fe("addEventListener"), L = Fe("removeEventListener"), Q = (e) => {
|
|
938
939
|
var t;
|
|
939
940
|
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
940
941
|
return { x: n, y: o, target: s };
|
|
941
942
|
};
|
|
942
|
-
function
|
|
943
|
+
function Se(e, t, n = "touch") {
|
|
943
944
|
switch (n) {
|
|
944
945
|
case "center": {
|
|
945
946
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -951,7 +952,7 @@ function _e(e, t, n = "touch") {
|
|
|
951
952
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
952
953
|
}
|
|
953
954
|
}
|
|
954
|
-
function
|
|
955
|
+
function F(e, t = document) {
|
|
955
956
|
const n = Array.isArray(e) ? e : [e];
|
|
956
957
|
let o = [];
|
|
957
958
|
for (let s = 0, i = n.length; s < i; s++) {
|
|
@@ -960,7 +961,7 @@ function q(e, t = document) {
|
|
|
960
961
|
}
|
|
961
962
|
return o;
|
|
962
963
|
}
|
|
963
|
-
const
|
|
964
|
+
const Dt = () => matchMedia("(hover: none), (pointer: coarse)").matches, $t = () => "safari" in window, Ot = (e) => {
|
|
964
965
|
let t, n = -1, o = !1;
|
|
965
966
|
return {
|
|
966
967
|
next(...s) {
|
|
@@ -973,7 +974,7 @@ const $t = () => matchMedia("(hover: none), (pointer: coarse)").matches, Ot = ()
|
|
|
973
974
|
}
|
|
974
975
|
};
|
|
975
976
|
};
|
|
976
|
-
function
|
|
977
|
+
function Pt(e, t) {
|
|
977
978
|
for (const n of t) {
|
|
978
979
|
if (typeof n == "number")
|
|
979
980
|
return e.button === n;
|
|
@@ -993,16 +994,16 @@ function Ht(e, t) {
|
|
|
993
994
|
}
|
|
994
995
|
return !1;
|
|
995
996
|
}
|
|
996
|
-
const { abs:
|
|
997
|
+
const { abs: H, max: _e, min: Me, ceil: ke } = Math, Te = (e = []) => ({
|
|
997
998
|
stored: e,
|
|
998
999
|
selected: [],
|
|
999
1000
|
touched: [],
|
|
1000
1001
|
changed: { added: [], removed: [] }
|
|
1001
1002
|
});
|
|
1002
|
-
class
|
|
1003
|
+
class qe extends jt {
|
|
1003
1004
|
constructor(t) {
|
|
1004
1005
|
var n, o, s, i, r;
|
|
1005
|
-
super(), E(this, "_options"), E(this, "_selection",
|
|
1006
|
+
super(), E(this, "_options"), E(this, "_selection", Te()), E(this, "_area"), E(this, "_clippingElement"), E(this, "_targetElement"), E(this, "_targetBoundary"), E(this, "_targetBoundaryScrolled", !0), E(this, "_targetRect"), E(this, "_selectables", []), E(this, "_latestElement"), E(this, "_areaLocation", { y1: 0, x2: 0, y2: 0, x1: 0 }), E(this, "_areaRect", new DOMRect()), E(this, "_singleClick", !0), E(this, "_frame"), E(this, "_scrollAvailable", !0), E(this, "_scrollingActive", !1), E(this, "_scrollSpeed", { x: 0, y: 0 }), E(this, "_scrollDelta", { x: 0, y: 0 }), E(this, "disable", this._toggleStartEvents.bind(this, !1)), E(this, "enable", this._toggleStartEvents), this._options = {
|
|
1006
1007
|
selectionAreaClass: "selection-area",
|
|
1007
1008
|
selectionContainerClass: void 0,
|
|
1008
1009
|
selectables: [],
|
|
@@ -1042,8 +1043,8 @@ class Ie extends Dt {
|
|
|
1042
1043
|
};
|
|
1043
1044
|
for (const d of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1044
1045
|
typeof this[d] == "function" && (this[d] = this[d].bind(this));
|
|
1045
|
-
const { document: c, selectionAreaClass: l, selectionContainerClass:
|
|
1046
|
-
this._area = c.createElement("div"), this._clippingElement = c.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(l),
|
|
1046
|
+
const { document: c, selectionAreaClass: l, selectionContainerClass: u } = this._options;
|
|
1047
|
+
this._area = c.createElement("div"), this._clippingElement = c.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(l), u && this._clippingElement.classList.add(u), j(this._area, {
|
|
1047
1048
|
willChange: "top, left, bottom, right, width, height",
|
|
1048
1049
|
top: 0,
|
|
1049
1050
|
left: 0,
|
|
@@ -1055,7 +1056,7 @@ class Ie extends Dt {
|
|
|
1055
1056
|
// https://stackoverflow.com/a/38268846
|
|
1056
1057
|
pointerEvents: "none",
|
|
1057
1058
|
zIndex: "1"
|
|
1058
|
-
}), this._frame =
|
|
1059
|
+
}), this._frame = Ot((d) => {
|
|
1059
1060
|
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", d), this._redrawSelectionArea();
|
|
1060
1061
|
}), this.enable();
|
|
1061
1062
|
}
|
|
@@ -1064,31 +1065,31 @@ class Ie extends Dt {
|
|
|
1064
1065
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1065
1066
|
}
|
|
1066
1067
|
_onTapStart(t, n = !1) {
|
|
1067
|
-
const { x: o, y: s, target: i } =
|
|
1068
|
-
if (t instanceof MouseEvent && !
|
|
1068
|
+
const { x: o, y: s, target: i } = Q(t), { document: r, startAreas: c, boundaries: l, features: u, behaviour: d } = this._options, a = i.getBoundingClientRect();
|
|
1069
|
+
if (t instanceof MouseEvent && !Pt(t, d.triggers))
|
|
1069
1070
|
return;
|
|
1070
|
-
const
|
|
1071
|
+
const p = F(c, r), g = F(l, r);
|
|
1071
1072
|
this._targetElement = g.find(
|
|
1072
|
-
(v) =>
|
|
1073
|
+
(v) => Se(v.getBoundingClientRect(), a)
|
|
1073
1074
|
);
|
|
1074
|
-
const
|
|
1075
|
-
if (this._targetBoundary = g.find((v) =>
|
|
1075
|
+
const f = t.composedPath(), m = p.find((v) => f.includes(v));
|
|
1076
|
+
if (this._targetBoundary = g.find((v) => f.includes(v)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1076
1077
|
return;
|
|
1077
1078
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1078
|
-
const
|
|
1079
|
-
this._scrollDelta = { x:
|
|
1079
|
+
const h = r.scrollingElement ?? r.body;
|
|
1080
|
+
this._scrollDelta = { x: h.scrollLeft, y: h.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), B(r, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), B(r, ["mouseup", "touchcancel", "touchend"], this._onTapStop), B(r, "scroll", this._onScroll), u.deselectOnBlur && (this._targetBoundaryScrolled = !1, B(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1080
1081
|
}
|
|
1081
1082
|
_onSingleTap(t) {
|
|
1082
|
-
const { singleTap: { intersect: n }, range: o } = this._options.features, s =
|
|
1083
|
+
const { singleTap: { intersect: n }, range: o } = this._options.features, s = Q(t);
|
|
1083
1084
|
let i;
|
|
1084
1085
|
if (n === "native")
|
|
1085
1086
|
i = s.target;
|
|
1086
1087
|
else if (n === "touch") {
|
|
1087
1088
|
this.resolveSelectables();
|
|
1088
1089
|
const { x: c, y: l } = s;
|
|
1089
|
-
i = this._selectables.find((
|
|
1090
|
-
const { right: d, left: a, top:
|
|
1091
|
-
return c < d && c > a && l < g && l >
|
|
1090
|
+
i = this._selectables.find((u) => {
|
|
1091
|
+
const { right: d, left: a, top: p, bottom: g } = u.getBoundingClientRect();
|
|
1092
|
+
return c < d && c > a && l < g && l > p;
|
|
1092
1093
|
});
|
|
1093
1094
|
}
|
|
1094
1095
|
if (!i)
|
|
@@ -1102,25 +1103,25 @@ class Ie extends Dt {
|
|
|
1102
1103
|
}
|
|
1103
1104
|
const { stored: r } = this._selection;
|
|
1104
1105
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1105
|
-
const c = this._latestElement, [l,
|
|
1106
|
-
(a) => a.compareDocumentPosition(l) & 4 && a.compareDocumentPosition(
|
|
1107
|
-
), l,
|
|
1106
|
+
const c = this._latestElement, [l, u] = c.compareDocumentPosition(i) & 4 ? [i, c] : [c, i], d = [...this._selectables.filter(
|
|
1107
|
+
(a) => a.compareDocumentPosition(l) & 4 && a.compareDocumentPosition(u) & 2
|
|
1108
|
+
), l, u];
|
|
1108
1109
|
this.select(d), this._latestElement = c;
|
|
1109
1110
|
} else
|
|
1110
1111
|
r.includes(i) && (r.length === 1 || t.ctrlKey || r.every((c) => this._selection.stored.includes(c))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1111
1112
|
}
|
|
1112
1113
|
_delayedTapMove(t) {
|
|
1113
|
-
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: c, y: l } =
|
|
1114
|
+
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: c, y: l } = Q(t);
|
|
1114
1115
|
if (
|
|
1115
1116
|
// Single number for both coordinates
|
|
1116
|
-
typeof s == "number" &&
|
|
1117
|
-
typeof s == "object" &&
|
|
1117
|
+
typeof s == "number" && H(c + l - (i + r)) >= s || // Different x and y threshold
|
|
1118
|
+
typeof s == "object" && H(c - i) >= s.x || H(l - r) >= s.y
|
|
1118
1119
|
) {
|
|
1119
1120
|
if (L(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1120
1121
|
L(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1121
1122
|
return;
|
|
1122
1123
|
}
|
|
1123
|
-
B(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"),
|
|
1124
|
+
B(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"), F(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 && (B(this._targetElement, "wheel", this._manualScroll, { passive: !1 }), this._selectables = this._selectables.filter((u) => this._targetElement.contains(u))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1124
1125
|
}
|
|
1125
1126
|
this._handleMoveEvent(t);
|
|
1126
1127
|
}
|
|
@@ -1145,16 +1146,16 @@ class Ie extends Dt {
|
|
|
1145
1146
|
}));
|
|
1146
1147
|
}
|
|
1147
1148
|
_onTapMove(t) {
|
|
1148
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: r } = s.behaviour.scrolling, c = this._targetElement, { x: l, y:
|
|
1149
|
-
if (o.x2 = l, o.y2 =
|
|
1149
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: r } = s.behaviour.scrolling, c = this._targetElement, { x: l, y: u } = Q(t);
|
|
1150
|
+
if (o.x2 = l, o.y2 = u, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1150
1151
|
this._scrollingActive = !0;
|
|
1151
1152
|
const d = () => {
|
|
1152
1153
|
if (!n.x && !n.y) {
|
|
1153
1154
|
this._scrollingActive = !1;
|
|
1154
1155
|
return;
|
|
1155
1156
|
}
|
|
1156
|
-
const { scrollTop: a, scrollLeft:
|
|
1157
|
-
n.y && (c.scrollTop +=
|
|
1157
|
+
const { scrollTop: a, scrollLeft: p } = c;
|
|
1158
|
+
n.y && (c.scrollTop += ke(n.y / r), o.y1 -= c.scrollTop - a), n.x && (c.scrollLeft += ke(n.x / r), o.x1 -= c.scrollLeft - p), i.next(t), requestAnimationFrame(d);
|
|
1158
1159
|
};
|
|
1159
1160
|
requestAnimationFrame(d);
|
|
1160
1161
|
} else
|
|
@@ -1163,7 +1164,7 @@ class Ie extends Dt {
|
|
|
1163
1164
|
}
|
|
1164
1165
|
_handleMoveEvent(t) {
|
|
1165
1166
|
const { features: n } = this._options;
|
|
1166
|
-
(n.touch &&
|
|
1167
|
+
(n.touch && Dt() || this._scrollAvailable && $t()) && t.preventDefault();
|
|
1167
1168
|
}
|
|
1168
1169
|
_onScroll() {
|
|
1169
1170
|
const { _scrollDelta: t, _options: { document: n } } = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
|
|
@@ -1177,11 +1178,11 @@ class Ie extends Dt {
|
|
|
1177
1178
|
this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
|
|
1178
1179
|
}
|
|
1179
1180
|
_recalculateSelectionAreaRect() {
|
|
1180
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: r, clientHeight: c, scrollLeft: l, scrollWidth:
|
|
1181
|
-
let { x2:
|
|
1182
|
-
const { behaviour: { scrolling: { startScrollMargins:
|
|
1183
|
-
|
|
1184
|
-
const v =
|
|
1181
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: r, clientHeight: c, scrollLeft: l, scrollWidth: u, clientWidth: d } = o, a = this._targetRect, { x1: p, y1: g } = n;
|
|
1182
|
+
let { x2: f, y2: m } = n;
|
|
1183
|
+
const { behaviour: { scrolling: { startScrollMargins: h } } } = s;
|
|
1184
|
+
f < a.left + h.x ? (t.x = l ? -H(a.left - f + h.x) : 0, f = f < a.left ? a.left : f) : f > a.right - h.x ? (t.x = u - l - d ? H(a.left + a.width - f - h.x) : 0, f = f > a.right ? a.right : f) : t.x = 0, m < a.top + h.y ? (t.y = i ? -H(a.top - m + h.y) : 0, m = m < a.top ? a.top : m) : m > a.bottom - h.y ? (t.y = r - i - c ? H(a.top + a.height - m - h.y) : 0, m = m > a.bottom ? a.bottom : m) : t.y = 0;
|
|
1185
|
+
const v = Me(p, f), y = Me(g, m), b = _e(p, f), x = _e(g, m);
|
|
1185
1186
|
this._areaRect = new DOMRect(v, y, b - v, x - y);
|
|
1186
1187
|
}
|
|
1187
1188
|
_redrawSelectionArea() {
|
|
@@ -1194,29 +1195,29 @@ class Ie extends Dt {
|
|
|
1194
1195
|
L(this._targetElement, "scroll", this._onStartAreaScroll), L(s, ["mousemove", "touchmove"], this._delayedTapMove), L(s, ["touchmove", "mousemove"], this._onTapMove), L(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), L(s, "scroll", this._onScroll), this._keepSelection(), t && r && i.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, L(this._targetElement, "wheel", this._manualScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
|
|
1195
1196
|
}
|
|
1196
1197
|
_updateElementSelection() {
|
|
1197
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: c } = o, { intersect: l, overlap:
|
|
1198
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: c } = o, { intersect: l, overlap: u } = n.behaviour, d = u === "invert", a = [], p = [], g = [];
|
|
1198
1199
|
for (let m = 0; m < t.length; m++) {
|
|
1199
|
-
const
|
|
1200
|
-
if (
|
|
1201
|
-
if (r.includes(
|
|
1202
|
-
i.includes(
|
|
1203
|
-
else if (d && i.includes(
|
|
1204
|
-
g.push(
|
|
1200
|
+
const h = t[m];
|
|
1201
|
+
if (Se(s, h.getBoundingClientRect(), l)) {
|
|
1202
|
+
if (r.includes(h))
|
|
1203
|
+
i.includes(h) && !c.includes(h) && c.push(h);
|
|
1204
|
+
else if (d && i.includes(h)) {
|
|
1205
|
+
g.push(h);
|
|
1205
1206
|
continue;
|
|
1206
1207
|
} else
|
|
1207
|
-
|
|
1208
|
-
a.push(
|
|
1208
|
+
p.push(h);
|
|
1209
|
+
a.push(h);
|
|
1209
1210
|
}
|
|
1210
1211
|
}
|
|
1211
|
-
d &&
|
|
1212
|
-
const
|
|
1212
|
+
d && p.push(...i.filter((m) => !r.includes(m)));
|
|
1213
|
+
const f = u === "keep";
|
|
1213
1214
|
for (let m = 0; m < r.length; m++) {
|
|
1214
|
-
const
|
|
1215
|
-
!a.includes(
|
|
1215
|
+
const h = r[m];
|
|
1216
|
+
!a.includes(h) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1216
1217
|
// not make them part of the current selection as soon as they're touched.
|
|
1217
|
-
(
|
|
1218
|
+
(f && i.includes(h)) && g.push(h);
|
|
1218
1219
|
}
|
|
1219
|
-
o.selected = a, o.changed = { added:
|
|
1220
|
+
o.selected = a, o.changed = { added: p, removed: g }, this._latestElement = void 0;
|
|
1220
1221
|
}
|
|
1221
1222
|
_emitEvent(t, n) {
|
|
1222
1223
|
return this.emit(t, {
|
|
@@ -1267,7 +1268,7 @@ class Ie extends Dt {
|
|
|
1267
1268
|
* Will update everything that can be selected.
|
|
1268
1269
|
*/
|
|
1269
1270
|
resolveSelectables() {
|
|
1270
|
-
this._selectables =
|
|
1271
|
+
this._selectables = F(this._options.selectables, this._options.document);
|
|
1271
1272
|
}
|
|
1272
1273
|
/**
|
|
1273
1274
|
* Same as deselecting, but for all elements currently selected.
|
|
@@ -1279,7 +1280,7 @@ class Ie extends Dt {
|
|
|
1279
1280
|
i.added = [], i.removed.push(
|
|
1280
1281
|
...o,
|
|
1281
1282
|
...t ? s : []
|
|
1282
|
-
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection =
|
|
1283
|
+
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Te(t ? [] : s);
|
|
1283
1284
|
}
|
|
1284
1285
|
/**
|
|
1285
1286
|
* @returns {Array} Selected elements
|
|
@@ -1311,7 +1312,7 @@ class Ie extends Dt {
|
|
|
1311
1312
|
* @param quiet - If this should not trigger the move event
|
|
1312
1313
|
*/
|
|
1313
1314
|
select(t, n = !1) {
|
|
1314
|
-
const { changed: o, selected: s, stored: i } = this._selection, r =
|
|
1315
|
+
const { changed: o, selected: s, stored: i } = this._selection, r = F(t, this._options.document).filter(
|
|
1315
1316
|
(c) => !s.includes(c) && !i.includes(c)
|
|
1316
1317
|
);
|
|
1317
1318
|
return i.push(...r), s.push(...r), o.added.push(...r), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), r;
|
|
@@ -1322,7 +1323,7 @@ class Ie extends Dt {
|
|
|
1322
1323
|
* @param quiet - If this should not trigger the move event
|
|
1323
1324
|
*/
|
|
1324
1325
|
deselect(t, n = !1) {
|
|
1325
|
-
const { selected: o, stored: s, changed: i } = this._selection, r =
|
|
1326
|
+
const { selected: o, stored: s, changed: i } = this._selection, r = F(t, this._options.document).filter(
|
|
1326
1327
|
(c) => o.includes(c) || s.includes(c)
|
|
1327
1328
|
);
|
|
1328
1329
|
r.length && (this._selection.stored = s.filter((c) => !r.includes(c)), this._selection.selected = o.filter((c) => !r.includes(c)), this._selection.changed.added = [], this._selection.changed.removed.push(
|
|
@@ -1330,9 +1331,9 @@ class Ie extends Dt {
|
|
|
1330
1331
|
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)));
|
|
1331
1332
|
}
|
|
1332
1333
|
}
|
|
1333
|
-
E(
|
|
1334
|
+
E(qe, "version", "3.6.0");
|
|
1334
1335
|
function Bt(e) {
|
|
1335
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new
|
|
1336
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new qe({
|
|
1336
1337
|
selectables: [".map-container me-tpc"],
|
|
1337
1338
|
boundaries: [e.container],
|
|
1338
1339
|
container: e.selectionContainer,
|
|
@@ -1377,118 +1378,119 @@ function Bt(e) {
|
|
|
1377
1378
|
});
|
|
1378
1379
|
e.selection = n;
|
|
1379
1380
|
}
|
|
1380
|
-
const
|
|
1381
|
+
const Ht = function(e, t = !0) {
|
|
1381
1382
|
this.theme = e;
|
|
1382
1383
|
const n = this.theme.cssVar, o = Object.keys(n);
|
|
1384
|
+
this.mindElixirBox.style.cssText = "";
|
|
1383
1385
|
for (let s = 0; s < o.length; s++) {
|
|
1384
1386
|
const i = o[s];
|
|
1385
1387
|
this.mindElixirBox.style.setProperty(i, n[i]);
|
|
1386
1388
|
}
|
|
1387
|
-
t && this.refresh();
|
|
1388
|
-
},
|
|
1389
|
+
e.cssVar["--gap"] || this.mindElixirBox.style.setProperty("--gap", "30px"), t && this.refresh();
|
|
1390
|
+
}, V = (e) => {
|
|
1389
1391
|
var o;
|
|
1390
1392
|
const t = (o = e.parent) == null ? void 0 : o.children, n = (t == null ? void 0 : t.indexOf(e)) ?? 0;
|
|
1391
1393
|
return { siblings: t, index: n };
|
|
1392
1394
|
};
|
|
1393
|
-
function
|
|
1394
|
-
const { siblings: t, index: n } =
|
|
1395
|
+
function zt(e) {
|
|
1396
|
+
const { siblings: t, index: n } = V(e);
|
|
1395
1397
|
if (t === void 0)
|
|
1396
1398
|
return;
|
|
1397
1399
|
const o = t[n];
|
|
1398
1400
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
1399
1401
|
}
|
|
1400
|
-
function
|
|
1401
|
-
const { siblings: t, index: n } =
|
|
1402
|
+
function Rt(e) {
|
|
1403
|
+
const { siblings: t, index: n } = V(e);
|
|
1402
1404
|
if (t === void 0)
|
|
1403
1405
|
return;
|
|
1404
1406
|
const o = t[n];
|
|
1405
1407
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
1406
1408
|
}
|
|
1407
|
-
function
|
|
1408
|
-
const { siblings: t, index: n } =
|
|
1409
|
+
function me(e) {
|
|
1410
|
+
const { siblings: t, index: n } = V(e);
|
|
1409
1411
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1410
1412
|
}
|
|
1411
|
-
function
|
|
1412
|
-
const { siblings: o, index: s } =
|
|
1413
|
+
function Ft(e, t, n) {
|
|
1414
|
+
const { siblings: o, index: s } = V(n);
|
|
1413
1415
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
1414
1416
|
}
|
|
1415
|
-
function
|
|
1416
|
-
const { siblings: n, index: o } =
|
|
1417
|
+
function qt(e, t) {
|
|
1418
|
+
const { siblings: n, index: o } = V(e);
|
|
1417
1419
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
1418
1420
|
}
|
|
1419
|
-
function
|
|
1420
|
-
if (
|
|
1421
|
+
function Ie(e, t, n) {
|
|
1422
|
+
if (me(t), e === "in")
|
|
1421
1423
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1422
1424
|
else {
|
|
1423
1425
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
1424
|
-
const { siblings: o, index: s } =
|
|
1426
|
+
const { siblings: o, index: s } = V(n);
|
|
1425
1427
|
if (o === void 0)
|
|
1426
1428
|
return;
|
|
1427
1429
|
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
1428
1430
|
}
|
|
1429
1431
|
}
|
|
1430
|
-
const
|
|
1432
|
+
const It = function(e, t) {
|
|
1431
1433
|
var n, o;
|
|
1432
1434
|
if (e === T)
|
|
1433
1435
|
return T;
|
|
1434
|
-
if (e ===
|
|
1435
|
-
return
|
|
1436
|
-
if (e ===
|
|
1436
|
+
if (e === z)
|
|
1437
|
+
return z;
|
|
1438
|
+
if (e === re) {
|
|
1437
1439
|
const s = ((n = document.querySelector(".lhs")) == null ? void 0 : n.childElementCount) || 0, i = ((o = document.querySelector(".rhs")) == null ? void 0 : o.childElementCount) || 0;
|
|
1438
|
-
return s <= i ? (t.direction = T, T) : (t.direction =
|
|
1440
|
+
return s <= i ? (t.direction = T, T) : (t.direction = z, z);
|
|
1439
1441
|
}
|
|
1440
|
-
},
|
|
1442
|
+
}, Ke = function(e, t, n) {
|
|
1441
1443
|
var i, r;
|
|
1442
1444
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
1443
1445
|
if (s.tagName === "ME-PARENT") {
|
|
1444
|
-
if (
|
|
1446
|
+
if (G(o), s.children[1])
|
|
1445
1447
|
s.nextSibling.appendChild(n);
|
|
1446
1448
|
else {
|
|
1447
1449
|
const c = e.createChildren([n]);
|
|
1448
|
-
s.appendChild(
|
|
1450
|
+
s.appendChild(pe(!0)), s.insertAdjacentElement("afterend", c);
|
|
1449
1451
|
}
|
|
1450
1452
|
e.linkDiv(n.offsetParent);
|
|
1451
1453
|
} else
|
|
1452
|
-
s.tagName === "ME-ROOT" && (
|
|
1453
|
-
},
|
|
1454
|
+
s.tagName === "ME-ROOT" && (It(e.direction, o.nodeObj) === T ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
|
|
1455
|
+
}, Ve = function(e, t) {
|
|
1454
1456
|
const n = e.parentNode;
|
|
1455
1457
|
if (t === 0) {
|
|
1456
1458
|
const o = n.parentNode.parentNode;
|
|
1457
1459
|
o.tagName !== "ME-MAIN" && o.previousSibling.children[1].remove();
|
|
1458
1460
|
}
|
|
1459
1461
|
n.parentNode.remove();
|
|
1460
|
-
},
|
|
1462
|
+
}, We = {
|
|
1461
1463
|
before: "beforebegin",
|
|
1462
1464
|
after: "afterend"
|
|
1463
|
-
},
|
|
1465
|
+
}, G = function(e) {
|
|
1464
1466
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1465
1467
|
(n == null ? void 0 : n.tagName) === "svg" && (n == null || n.remove());
|
|
1466
|
-
},
|
|
1467
|
-
const n = e.nodeObj, o =
|
|
1468
|
+
}, Kt = function(e, t) {
|
|
1469
|
+
const n = e.nodeObj, o = ue(n);
|
|
1468
1470
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1469
1471
|
const s = Object.assign(n, t);
|
|
1470
|
-
|
|
1472
|
+
fe(e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
1471
1473
|
name: "reshapeNode",
|
|
1472
1474
|
obj: s,
|
|
1473
1475
|
origin: o
|
|
1474
1476
|
});
|
|
1475
|
-
},
|
|
1477
|
+
}, ge = function(e, t, n) {
|
|
1476
1478
|
if (!t)
|
|
1477
1479
|
return null;
|
|
1478
1480
|
const o = t.nodeObj;
|
|
1479
1481
|
o.expanded === !1 && (e.expandNode(t, !0), t = C(o.id));
|
|
1480
1482
|
const s = n || e.generateNewObj();
|
|
1481
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
1483
|
+
o.children ? o.children.push(s) : o.children = [s], D(e.nodeData);
|
|
1482
1484
|
const { grp: i, top: r } = e.createWrapper(s);
|
|
1483
|
-
return
|
|
1484
|
-
},
|
|
1485
|
-
var
|
|
1485
|
+
return Ke(e, t, i), { newTop: r, newNodeObj: s };
|
|
1486
|
+
}, Vt = function(e, t, n) {
|
|
1487
|
+
var u, d, a;
|
|
1486
1488
|
const o = t || this.currentNode;
|
|
1487
1489
|
if (!o)
|
|
1488
1490
|
return;
|
|
1489
1491
|
const s = o.nodeObj;
|
|
1490
1492
|
if (s.parent) {
|
|
1491
|
-
if (!((
|
|
1493
|
+
if (!((u = s.parent) != null && u.parent) && ((a = (d = s.parent) == null ? void 0 : d.children) == null ? void 0 : a.length) === 1) {
|
|
1492
1494
|
this.addChild(C(s.parent.id), n);
|
|
1493
1495
|
return;
|
|
1494
1496
|
}
|
|
@@ -1497,35 +1499,35 @@ const Kt = function(e, t) {
|
|
|
1497
1499
|
return;
|
|
1498
1500
|
}
|
|
1499
1501
|
const i = n || this.generateNewObj();
|
|
1500
|
-
|
|
1502
|
+
Ft(i, e, s), D(this.nodeData);
|
|
1501
1503
|
const r = o.parentElement, { grp: c, top: l } = this.createWrapper(i);
|
|
1502
|
-
r.parentElement.insertAdjacentElement(
|
|
1504
|
+
r.parentElement.insertAdjacentElement(We[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(l.firstChild), this.selectNode(l.firstChild, !0), this.bus.fire("operation", {
|
|
1503
1505
|
name: "insertSibling",
|
|
1504
1506
|
type: e,
|
|
1505
1507
|
obj: i
|
|
1506
1508
|
});
|
|
1507
|
-
},
|
|
1509
|
+
}, Wt = function(e, t) {
|
|
1508
1510
|
const n = e || this.currentNode;
|
|
1509
1511
|
if (!n)
|
|
1510
1512
|
return;
|
|
1511
|
-
|
|
1513
|
+
G(n);
|
|
1512
1514
|
const o = n.nodeObj;
|
|
1513
1515
|
if (!o.parent)
|
|
1514
1516
|
return;
|
|
1515
1517
|
const s = t || this.generateNewObj();
|
|
1516
|
-
|
|
1518
|
+
qt(o, s), D(this.nodeData);
|
|
1517
1519
|
const i = n.parentElement.parentElement, { grp: r, top: c } = this.createWrapper(s, !0);
|
|
1518
|
-
c.appendChild(
|
|
1520
|
+
c.appendChild(pe(!0)), i.insertAdjacentElement("afterend", r);
|
|
1519
1521
|
const l = this.createChildren([i]);
|
|
1520
1522
|
c.insertAdjacentElement("afterend", l), this.linkDiv(), t || this.editTopic(c.firstChild), this.selectNode(c.firstChild, !0), this.bus.fire("operation", {
|
|
1521
1523
|
name: "insertParent",
|
|
1522
1524
|
obj: s
|
|
1523
1525
|
});
|
|
1524
|
-
},
|
|
1526
|
+
}, Ut = function(e, t) {
|
|
1525
1527
|
const n = e || this.currentNode;
|
|
1526
1528
|
if (!n)
|
|
1527
1529
|
return;
|
|
1528
|
-
const o =
|
|
1530
|
+
const o = ge(this, n, t);
|
|
1529
1531
|
if (!o)
|
|
1530
1532
|
return;
|
|
1531
1533
|
const { newTop: s, newNodeObj: i } = o;
|
|
@@ -1533,10 +1535,10 @@ const Kt = function(e, t) {
|
|
|
1533
1535
|
name: "addChild",
|
|
1534
1536
|
obj: i
|
|
1535
1537
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1536
|
-
},
|
|
1537
|
-
const n =
|
|
1538
|
-
|
|
1539
|
-
const o =
|
|
1538
|
+
}, Yt = function(e, t) {
|
|
1539
|
+
const n = ue(e.nodeObj);
|
|
1540
|
+
he(n);
|
|
1541
|
+
const o = ge(this, t, n);
|
|
1540
1542
|
if (!o)
|
|
1541
1543
|
return;
|
|
1542
1544
|
const { newNodeObj: s } = o;
|
|
@@ -1544,13 +1546,13 @@ const Kt = function(e, t) {
|
|
|
1544
1546
|
name: "copyNode",
|
|
1545
1547
|
obj: s
|
|
1546
1548
|
});
|
|
1547
|
-
},
|
|
1548
|
-
e =
|
|
1549
|
+
}, Xt = function(e, t) {
|
|
1550
|
+
e = ce(e);
|
|
1549
1551
|
const n = [];
|
|
1550
1552
|
for (let o = 0; o < e.length; o++) {
|
|
1551
|
-
const s = e[o], i =
|
|
1552
|
-
|
|
1553
|
-
const r =
|
|
1553
|
+
const s = e[o], i = ue(s.nodeObj);
|
|
1554
|
+
he(i);
|
|
1555
|
+
const r = ge(this, t, i);
|
|
1554
1556
|
if (!r)
|
|
1555
1557
|
return;
|
|
1556
1558
|
const { newNodeObj: c } = r;
|
|
@@ -1560,29 +1562,29 @@ const Kt = function(e, t) {
|
|
|
1560
1562
|
name: "copyNodes",
|
|
1561
1563
|
objs: n
|
|
1562
1564
|
});
|
|
1563
|
-
},
|
|
1565
|
+
}, Gt = function(e) {
|
|
1564
1566
|
const t = e || this.currentNode;
|
|
1565
1567
|
if (!t)
|
|
1566
1568
|
return;
|
|
1567
1569
|
const n = t.nodeObj;
|
|
1568
|
-
|
|
1570
|
+
zt(n);
|
|
1569
1571
|
const o = t.parentNode.parentNode;
|
|
1570
1572
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
1571
1573
|
name: "moveUpNode",
|
|
1572
1574
|
obj: n
|
|
1573
1575
|
});
|
|
1574
|
-
},
|
|
1576
|
+
}, Jt = function(e) {
|
|
1575
1577
|
const t = e || this.currentNode;
|
|
1576
1578
|
if (!t)
|
|
1577
1579
|
return;
|
|
1578
1580
|
const n = t.nodeObj;
|
|
1579
|
-
|
|
1581
|
+
Rt(n);
|
|
1580
1582
|
const o = t.parentNode.parentNode;
|
|
1581
1583
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
1582
1584
|
name: "moveDownNode",
|
|
1583
1585
|
obj: n
|
|
1584
1586
|
});
|
|
1585
|
-
},
|
|
1587
|
+
}, Zt = function(e) {
|
|
1586
1588
|
var r;
|
|
1587
1589
|
const t = e || this.currentNode;
|
|
1588
1590
|
if (!t)
|
|
@@ -1590,8 +1592,8 @@ const Kt = function(e, t) {
|
|
|
1590
1592
|
const n = t.nodeObj;
|
|
1591
1593
|
if (!n.parent)
|
|
1592
1594
|
throw new Error("Can not remove root node");
|
|
1593
|
-
const o = n.parent.children, s = o.findIndex((c) => c === n), i =
|
|
1594
|
-
if (
|
|
1595
|
+
const o = n.parent.children, s = o.findIndex((c) => c === n), i = me(n);
|
|
1596
|
+
if (Ve(t, i), o.length !== 0) {
|
|
1595
1597
|
const c = o[s] || o[s - 1];
|
|
1596
1598
|
this.selectNode(C(c.id));
|
|
1597
1599
|
} else
|
|
@@ -1602,77 +1604,77 @@ const Kt = function(e, t) {
|
|
|
1602
1604
|
originIndex: s,
|
|
1603
1605
|
originParentId: (r = n == null ? void 0 : n.parent) == null ? void 0 : r.id
|
|
1604
1606
|
});
|
|
1605
|
-
},
|
|
1606
|
-
e =
|
|
1607
|
+
}, Qt = function(e) {
|
|
1608
|
+
e = ce(e);
|
|
1607
1609
|
for (const t of e) {
|
|
1608
1610
|
const n = t.nodeObj;
|
|
1609
1611
|
if (!n.parent)
|
|
1610
1612
|
continue;
|
|
1611
|
-
const o =
|
|
1612
|
-
|
|
1613
|
+
const o = me(n);
|
|
1614
|
+
Ve(t, o);
|
|
1613
1615
|
}
|
|
1614
1616
|
this.linkDiv(), this.bus.fire("operation", {
|
|
1615
1617
|
name: "removeNodes",
|
|
1616
1618
|
objs: e.map((t) => t.nodeObj)
|
|
1617
1619
|
});
|
|
1618
|
-
},
|
|
1619
|
-
e =
|
|
1620
|
+
}, en = function(e, t) {
|
|
1621
|
+
e = ce(e);
|
|
1620
1622
|
const n = t.nodeObj;
|
|
1621
1623
|
n.expanded === !1 && (this.expandNode(t, !0), t = C(n.id));
|
|
1622
1624
|
for (const o of e) {
|
|
1623
1625
|
const s = o.nodeObj;
|
|
1624
|
-
|
|
1626
|
+
Ie("in", s, n), D(this.nodeData);
|
|
1625
1627
|
const i = o.parentElement;
|
|
1626
|
-
|
|
1628
|
+
Ke(this, t, i.parentElement);
|
|
1627
1629
|
}
|
|
1628
1630
|
this.linkDiv(), this.bus.fire("operation", {
|
|
1629
1631
|
name: "moveNodeIn",
|
|
1630
1632
|
objs: e.map((o) => o.nodeObj),
|
|
1631
1633
|
toObj: n
|
|
1632
1634
|
});
|
|
1633
|
-
},
|
|
1634
|
-
e =
|
|
1635
|
+
}, Ue = (e, t, n, o) => {
|
|
1636
|
+
e = ce(e), t === "after" && (e = e.reverse());
|
|
1635
1637
|
const s = n.nodeObj;
|
|
1636
1638
|
for (const i of e) {
|
|
1637
1639
|
const r = i.nodeObj;
|
|
1638
|
-
|
|
1640
|
+
Ie(t, r, s), D(o.nodeData), G(i);
|
|
1639
1641
|
const c = i.parentElement.parentNode;
|
|
1640
|
-
n.parentElement.parentNode.insertAdjacentElement(
|
|
1642
|
+
n.parentElement.parentNode.insertAdjacentElement(We[t], c);
|
|
1641
1643
|
}
|
|
1642
1644
|
o.linkDiv(), o.bus.fire("operation", {
|
|
1643
1645
|
name: t === "before" ? "moveNodeBefore" : "moveNodeAfter",
|
|
1644
1646
|
objs: e.map((i) => i.nodeObj),
|
|
1645
1647
|
toObj: s
|
|
1646
1648
|
});
|
|
1649
|
+
}, tn = function(e, t) {
|
|
1650
|
+
Ue(e, "before", t, this);
|
|
1647
1651
|
}, nn = function(e, t) {
|
|
1648
|
-
|
|
1649
|
-
}, on = function(e
|
|
1650
|
-
Ye(e, "after", t, this);
|
|
1651
|
-
}, sn = function(e) {
|
|
1652
|
+
Ue(e, "after", t, this);
|
|
1653
|
+
}, on = function(e) {
|
|
1652
1654
|
const t = e || this.currentNode;
|
|
1653
1655
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
1654
|
-
},
|
|
1656
|
+
}, sn = function(e, t) {
|
|
1655
1657
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
1656
|
-
},
|
|
1658
|
+
}, Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1657
1659
|
__proto__: null,
|
|
1658
|
-
addChild:
|
|
1659
|
-
beginEdit:
|
|
1660
|
-
copyNode:
|
|
1661
|
-
copyNodes:
|
|
1662
|
-
insertParent:
|
|
1663
|
-
insertSibling:
|
|
1664
|
-
moveDownNode:
|
|
1665
|
-
moveNodeAfter:
|
|
1666
|
-
moveNodeBefore:
|
|
1667
|
-
moveNodeIn:
|
|
1668
|
-
moveUpNode:
|
|
1669
|
-
removeNode:
|
|
1670
|
-
removeNodes:
|
|
1671
|
-
reshapeNode:
|
|
1672
|
-
rmSubline:
|
|
1673
|
-
setNodeTopic:
|
|
1660
|
+
addChild: Ut,
|
|
1661
|
+
beginEdit: on,
|
|
1662
|
+
copyNode: Yt,
|
|
1663
|
+
copyNodes: Xt,
|
|
1664
|
+
insertParent: Wt,
|
|
1665
|
+
insertSibling: Vt,
|
|
1666
|
+
moveDownNode: Jt,
|
|
1667
|
+
moveNodeAfter: nn,
|
|
1668
|
+
moveNodeBefore: tn,
|
|
1669
|
+
moveNodeIn: en,
|
|
1670
|
+
moveUpNode: Gt,
|
|
1671
|
+
removeNode: Zt,
|
|
1672
|
+
removeNodes: Qt,
|
|
1673
|
+
reshapeNode: Kt,
|
|
1674
|
+
rmSubline: G,
|
|
1675
|
+
setNodeTopic: sn
|
|
1674
1676
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1675
|
-
function
|
|
1677
|
+
function Xe(e) {
|
|
1676
1678
|
return {
|
|
1677
1679
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
1678
1680
|
arrows: e.arrows,
|
|
@@ -1681,7 +1683,7 @@ function Ge(e) {
|
|
|
1681
1683
|
theme: e.theme
|
|
1682
1684
|
};
|
|
1683
1685
|
}
|
|
1684
|
-
const
|
|
1686
|
+
const rn = function(e, t, n) {
|
|
1685
1687
|
if (e) {
|
|
1686
1688
|
if (this.clearSelection(), typeof e == "string") {
|
|
1687
1689
|
const o = C(e);
|
|
@@ -1689,9 +1691,9 @@ const cn = function(e, t, n) {
|
|
|
1689
1691
|
}
|
|
1690
1692
|
e.className = "selected", e.scrollIntoView({ block: "nearest", inline: "nearest" }), this.currentNode = e, t ? this.bus.fire("selectNewNode", e.nodeObj) : this.bus.fire("selectNode", e.nodeObj, n);
|
|
1691
1693
|
}
|
|
1692
|
-
},
|
|
1694
|
+
}, cn = function() {
|
|
1693
1695
|
this.currentNode && (this.currentNode.className = ""), this.currentNode = null, this.bus.fire("unselectNode");
|
|
1694
|
-
},
|
|
1696
|
+
}, ln = function(e) {
|
|
1695
1697
|
this.clearSelection();
|
|
1696
1698
|
for (const t of e)
|
|
1697
1699
|
t.className = "selected";
|
|
@@ -1699,23 +1701,23 @@ const cn = function(e, t, n) {
|
|
|
1699
1701
|
"selectNodes",
|
|
1700
1702
|
e.map((t) => t.nodeObj)
|
|
1701
1703
|
);
|
|
1702
|
-
},
|
|
1704
|
+
}, an = function() {
|
|
1703
1705
|
if (this.currentNodes)
|
|
1704
1706
|
for (const e of this.currentNodes)
|
|
1705
1707
|
e.classList.remove("selected");
|
|
1706
1708
|
this.currentNodes = null, this.bus.fire("unselectNodes");
|
|
1707
|
-
},
|
|
1709
|
+
}, dn = function() {
|
|
1708
1710
|
this.unselectNode(), this.unselectNodes(), this.unselectSummary(), this.unselectArrow();
|
|
1709
|
-
},
|
|
1710
|
-
const e =
|
|
1711
|
+
}, hn = function() {
|
|
1712
|
+
const e = Xe(this);
|
|
1711
1713
|
return JSON.stringify(e, (t, n) => {
|
|
1712
1714
|
if (!(t === "parent" && typeof n != "string"))
|
|
1713
1715
|
return n;
|
|
1714
1716
|
});
|
|
1715
|
-
},
|
|
1717
|
+
}, un = function() {
|
|
1716
1718
|
return JSON.parse(this.getDataString());
|
|
1717
|
-
},
|
|
1718
|
-
const e =
|
|
1719
|
+
}, fn = function() {
|
|
1720
|
+
const e = Xe(this).nodeData;
|
|
1719
1721
|
let t = "# " + e.topic + `
|
|
1720
1722
|
|
|
1721
1723
|
`;
|
|
@@ -1727,33 +1729,33 @@ const cn = function(e, t, n) {
|
|
|
1727
1729
|
`, o[i].children && n(o[i].children || [], s + 1);
|
|
1728
1730
|
}
|
|
1729
1731
|
return n(e.children || [], 2), t;
|
|
1730
|
-
},
|
|
1732
|
+
}, pn = function() {
|
|
1731
1733
|
this.editable = !0;
|
|
1732
|
-
},
|
|
1734
|
+
}, mn = function() {
|
|
1733
1735
|
this.editable = !1;
|
|
1734
|
-
},
|
|
1736
|
+
}, gn = function(e) {
|
|
1735
1737
|
this.scaleVal = e, this.map.style.transform = "scale(" + e + ")", this.bus.fire("scale", e);
|
|
1736
|
-
},
|
|
1738
|
+
}, vn = function() {
|
|
1737
1739
|
this.container.scrollTo(1e4 - this.container.offsetWidth / 2, 1e4 - this.container.offsetHeight / 2);
|
|
1738
|
-
},
|
|
1740
|
+
}, yn = function(e) {
|
|
1739
1741
|
e(this);
|
|
1740
|
-
},
|
|
1742
|
+
}, bn = function(e) {
|
|
1741
1743
|
e.nodeObj.parent && (this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
1742
|
-
},
|
|
1744
|
+
}, xn = function() {
|
|
1743
1745
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1744
|
-
},
|
|
1746
|
+
}, wn = function() {
|
|
1745
1747
|
this.direction = 0, this.refresh();
|
|
1746
|
-
},
|
|
1748
|
+
}, En = function() {
|
|
1747
1749
|
this.direction = 1, this.refresh();
|
|
1748
|
-
},
|
|
1750
|
+
}, Nn = function() {
|
|
1749
1751
|
this.direction = 2, this.refresh();
|
|
1750
|
-
},
|
|
1752
|
+
}, Cn = function(e) {
|
|
1751
1753
|
this.locale = e, this.refresh();
|
|
1752
|
-
},
|
|
1754
|
+
}, Sn = function(e, t) {
|
|
1753
1755
|
const n = e.nodeObj;
|
|
1754
1756
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
1755
1757
|
const o = e.parentNode, s = o.children[1];
|
|
1756
|
-
if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "",
|
|
1758
|
+
if (s.expanded = n.expanded, s.className = n.expanded ? "minus" : "", G(e), n.expanded) {
|
|
1757
1759
|
const i = this.createChildren(
|
|
1758
1760
|
n.children.map((r) => this.createWrapper(r).grp)
|
|
1759
1761
|
);
|
|
@@ -1761,32 +1763,32 @@ const cn = function(e, t, n) {
|
|
|
1761
1763
|
} else
|
|
1762
1764
|
o.parentNode.children[1].remove();
|
|
1763
1765
|
this.linkDiv(), this.bus.fire("expandNode", n);
|
|
1764
|
-
},
|
|
1765
|
-
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []),
|
|
1766
|
-
},
|
|
1766
|
+
}, _n = function(e) {
|
|
1767
|
+
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), D(this.nodeData), this.layout(), this.linkDiv();
|
|
1768
|
+
}, Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1767
1769
|
__proto__: null,
|
|
1768
|
-
cancelFocus:
|
|
1769
|
-
clearSelection:
|
|
1770
|
-
disableEdit:
|
|
1771
|
-
enableEdit:
|
|
1772
|
-
expandNode:
|
|
1773
|
-
focusNode:
|
|
1774
|
-
getData:
|
|
1775
|
-
getDataMd:
|
|
1776
|
-
getDataString:
|
|
1777
|
-
initLeft:
|
|
1778
|
-
initRight:
|
|
1779
|
-
initSide:
|
|
1780
|
-
install:
|
|
1781
|
-
refresh:
|
|
1782
|
-
scale:
|
|
1783
|
-
selectNode:
|
|
1784
|
-
selectNodes:
|
|
1785
|
-
setLocale:
|
|
1786
|
-
toCenter:
|
|
1787
|
-
unselectNode:
|
|
1788
|
-
unselectNodes:
|
|
1789
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1770
|
+
cancelFocus: xn,
|
|
1771
|
+
clearSelection: dn,
|
|
1772
|
+
disableEdit: mn,
|
|
1773
|
+
enableEdit: pn,
|
|
1774
|
+
expandNode: Sn,
|
|
1775
|
+
focusNode: bn,
|
|
1776
|
+
getData: un,
|
|
1777
|
+
getDataMd: fn,
|
|
1778
|
+
getDataString: hn,
|
|
1779
|
+
initLeft: wn,
|
|
1780
|
+
initRight: En,
|
|
1781
|
+
initSide: Nn,
|
|
1782
|
+
install: yn,
|
|
1783
|
+
refresh: _n,
|
|
1784
|
+
scale: gn,
|
|
1785
|
+
selectNode: rn,
|
|
1786
|
+
selectNodes: ln,
|
|
1787
|
+
setLocale: Cn,
|
|
1788
|
+
toCenter: vn,
|
|
1789
|
+
unselectNode: cn,
|
|
1790
|
+
unselectNodes: an
|
|
1791
|
+
}, Symbol.toStringTag, { value: "Module" })), kn = function(e) {
|
|
1790
1792
|
return {
|
|
1791
1793
|
dom: e,
|
|
1792
1794
|
moved: !1,
|
|
@@ -1812,21 +1814,21 @@ const cn = function(e, t, n) {
|
|
|
1812
1814
|
this.moved = !1, this.mousedown = !1;
|
|
1813
1815
|
}
|
|
1814
1816
|
};
|
|
1815
|
-
},
|
|
1816
|
-
create:
|
|
1817
|
+
}, Le = {
|
|
1818
|
+
create: kn
|
|
1817
1819
|
};
|
|
1818
|
-
function
|
|
1819
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
1820
|
+
function ie(e, t, n) {
|
|
1821
|
+
const { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, c = o + i / 2, l = s + r / 2, u = c + n.x, d = l + n.y;
|
|
1820
1822
|
return {
|
|
1821
1823
|
w: i,
|
|
1822
1824
|
h: r,
|
|
1823
1825
|
cx: c,
|
|
1824
1826
|
cy: l,
|
|
1825
|
-
ctrlX:
|
|
1827
|
+
ctrlX: u,
|
|
1826
1828
|
ctrlY: d
|
|
1827
1829
|
};
|
|
1828
1830
|
}
|
|
1829
|
-
function
|
|
1831
|
+
function q(e) {
|
|
1830
1832
|
let t, n;
|
|
1831
1833
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
1832
1834
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -1834,7 +1836,7 @@ function I(e) {
|
|
|
1834
1836
|
y: n
|
|
1835
1837
|
};
|
|
1836
1838
|
}
|
|
1837
|
-
const
|
|
1839
|
+
const Tn = function(e, t, n, o) {
|
|
1838
1840
|
const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1839
1841
|
return N(s, {
|
|
1840
1842
|
"text-anchor": "middle",
|
|
@@ -1842,18 +1844,18 @@ const Ln = function(e, t, n, o) {
|
|
|
1842
1844
|
y: n + "",
|
|
1843
1845
|
fill: o || "#666"
|
|
1844
1846
|
}), s.dataset.type = "custom-link", s.innerHTML = e, s;
|
|
1845
|
-
},
|
|
1847
|
+
}, Ge = function(e, t, n, o, s) {
|
|
1846
1848
|
if (!t || !n)
|
|
1847
1849
|
return;
|
|
1848
1850
|
performance.now();
|
|
1849
|
-
const i =
|
|
1850
|
-
`M ${c} ${l} C ${
|
|
1851
|
-
`M ${m.x1} ${m.y1} L ${g} ${
|
|
1852
|
-
), v = c / 8 +
|
|
1853
|
-
|
|
1854
|
-
},
|
|
1851
|
+
const i = ie(e, t, o.delta1), r = ie(e, n, o.delta2), { x: c, y: l } = q(i), { ctrlX: u, ctrlY: d } = i, { ctrlX: a, ctrlY: p } = r, { x: g, y: f } = q(r), m = Pe(a, p, g, f), h = ft(
|
|
1852
|
+
`M ${c} ${l} C ${u} ${d} ${a} ${p} ${g} ${f}`,
|
|
1853
|
+
`M ${m.x1} ${m.y1} L ${g} ${f} L ${m.x2} ${m.y2}`
|
|
1854
|
+
), v = c / 8 + u * 3 / 8 + a * 3 / 8 + g / 8, y = l / 8 + d * 3 / 8 + p * 3 / 8 + f / 8, b = Tn(o.label, v, y, e.theme.cssVar["--color"]);
|
|
1855
|
+
h.appendChild(b), h.arrowObj = o, h.dataset.linkid = o.id, e.linkSvgGroup.appendChild(h), s || (e.arrows.push(o), e.currentArrow = h, Ze(e, o, i, r)), performance.now();
|
|
1856
|
+
}, Ln = function(e, t) {
|
|
1855
1857
|
const n = {
|
|
1856
|
-
id:
|
|
1858
|
+
id: X(),
|
|
1857
1859
|
label: "Custom Link",
|
|
1858
1860
|
from: e.nodeObj.id,
|
|
1859
1861
|
to: t.nodeObj.id,
|
|
@@ -1866,15 +1868,15 @@ const Ln = function(e, t, n, o) {
|
|
|
1866
1868
|
y: -200
|
|
1867
1869
|
}
|
|
1868
1870
|
};
|
|
1869
|
-
|
|
1871
|
+
Ge(this, e, t, n), this.bus.fire("operation", {
|
|
1870
1872
|
name: "createArrow",
|
|
1871
1873
|
obj: n
|
|
1872
1874
|
});
|
|
1873
|
-
},
|
|
1875
|
+
}, An = function(e) {
|
|
1874
1876
|
let t;
|
|
1875
1877
|
if (e ? t = e : t = this.currentArrow, !t)
|
|
1876
1878
|
return;
|
|
1877
|
-
|
|
1879
|
+
Je(this);
|
|
1878
1880
|
const n = t.arrowObj.id;
|
|
1879
1881
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
1880
1882
|
name: "removeArrow",
|
|
@@ -1882,36 +1884,36 @@ const Ln = function(e, t, n, o) {
|
|
|
1882
1884
|
id: n
|
|
1883
1885
|
}
|
|
1884
1886
|
});
|
|
1885
|
-
},
|
|
1887
|
+
}, jn = function(e) {
|
|
1886
1888
|
this.currentArrow = e;
|
|
1887
|
-
const t = e.arrowObj, n = C(t.from), o = C(t.to), s =
|
|
1888
|
-
|
|
1889
|
-
},
|
|
1890
|
-
this.currentArrow = null,
|
|
1891
|
-
},
|
|
1889
|
+
const t = e.arrowObj, n = C(t.from), o = C(t.to), s = ie(this, n, t.delta1), i = ie(this, o, t.delta2);
|
|
1890
|
+
Ze(this, t, s, i);
|
|
1891
|
+
}, Dn = function() {
|
|
1892
|
+
this.currentArrow = null, Je(this);
|
|
1893
|
+
}, Je = function(e) {
|
|
1892
1894
|
e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none";
|
|
1893
|
-
},
|
|
1894
|
-
var
|
|
1895
|
+
}, Ze = function(e, t, n, o) {
|
|
1896
|
+
var p;
|
|
1895
1897
|
e.linkController.style.display = "initial", e.P2.style.display = "initial", e.P3.style.display = "initial", e.nodes.appendChild(e.linkController), e.nodes.appendChild(e.P2), e.nodes.appendChild(e.P3);
|
|
1896
|
-
let { x: s, y: i } =
|
|
1897
|
-
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${
|
|
1898
|
+
let { x: s, y: i } = q(n), { ctrlX: r, ctrlY: c } = n, { ctrlX: l, ctrlY: u } = o, { x: d, y: a } = q(o);
|
|
1899
|
+
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${u}px;left:${l}px;`, N(e.line1, {
|
|
1898
1900
|
x1: s + "",
|
|
1899
1901
|
y1: i + "",
|
|
1900
1902
|
x2: r + "",
|
|
1901
1903
|
y2: c + ""
|
|
1902
1904
|
}), N(e.line2, {
|
|
1903
1905
|
x1: l + "",
|
|
1904
|
-
y1:
|
|
1906
|
+
y1: u + "",
|
|
1905
1907
|
x2: d + "",
|
|
1906
1908
|
y2: a + ""
|
|
1907
|
-
}), e.helper1 && (e.helper1.destory(e.map), (
|
|
1909
|
+
}), e.helper1 && (e.helper1.destory(e.map), (p = e.helper2) == null || p.destory(e.map)), e.helper1 = Le.create(e.P2), e.helper2 = Le.create(e.P3), e.helper1.init(e.map, (g, f) => {
|
|
1908
1910
|
var y;
|
|
1909
|
-
r = r + g / e.scaleVal, c = c +
|
|
1910
|
-
const m =
|
|
1911
|
+
r = r + g / e.scaleVal, c = c + f / e.scaleVal;
|
|
1912
|
+
const m = q({ ...n, ctrlX: r, ctrlY: c });
|
|
1911
1913
|
s = m.x, i = m.y;
|
|
1912
|
-
const
|
|
1913
|
-
e.P2.style.top = c + "px", e.P2.style.left = r + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${
|
|
1914
|
-
x:
|
|
1914
|
+
const h = s / 8 + r * 3 / 8 + l * 3 / 8 + d / 8, v = i / 8 + c * 3 / 8 + u * 3 / 8 + a / 8;
|
|
1915
|
+
e.P2.style.top = c + "px", e.P2.style.left = r + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${u} ${d} ${a}`), N(e.currentArrow.children[2], {
|
|
1916
|
+
x: h + "",
|
|
1915
1917
|
y: v + ""
|
|
1916
1918
|
}), N(e.line1, {
|
|
1917
1919
|
x1: s + "",
|
|
@@ -1919,39 +1921,39 @@ const Ln = function(e, t, n, o) {
|
|
|
1919
1921
|
x2: r + "",
|
|
1920
1922
|
y2: c + ""
|
|
1921
1923
|
}), t.delta1.x = r - n.cx, t.delta1.y = c - n.cy;
|
|
1922
|
-
}), e.helper2.init(e.map, (g,
|
|
1924
|
+
}), e.helper2.init(e.map, (g, f) => {
|
|
1923
1925
|
var b, x;
|
|
1924
|
-
l = l + g / e.scaleVal,
|
|
1925
|
-
const m =
|
|
1926
|
+
l = l + g / e.scaleVal, u = u + f / e.scaleVal;
|
|
1927
|
+
const m = q({ ...o, ctrlX: l, ctrlY: u });
|
|
1926
1928
|
d = m.x, a = m.y;
|
|
1927
|
-
const
|
|
1928
|
-
e.P3.style.top =
|
|
1929
|
-
x:
|
|
1929
|
+
const h = s / 8 + r * 3 / 8 + l * 3 / 8 + d / 8, v = i / 8 + c * 3 / 8 + u * 3 / 8 + a / 8, y = Pe(l, u, d, a);
|
|
1930
|
+
e.P3.style.top = u + "px", e.P3.style.left = l + "px", (b = e.currentArrow) == null || b.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${u} ${d} ${a}`), (x = e.currentArrow) == null || x.children[1].setAttribute("d", `M ${y.x1} ${y.y1} L ${d} ${a} L ${y.x2} ${y.y2}`), N(e.currentArrow.children[2], {
|
|
1931
|
+
x: h + "",
|
|
1930
1932
|
y: v + ""
|
|
1931
1933
|
}), N(e.line2, {
|
|
1932
1934
|
x1: l + "",
|
|
1933
|
-
y1:
|
|
1935
|
+
y1: u + "",
|
|
1934
1936
|
x2: d + "",
|
|
1935
1937
|
y2: a + ""
|
|
1936
|
-
}), t.delta2.x = l - o.cx, t.delta2.y =
|
|
1938
|
+
}), t.delta2.x = l - o.cx, t.delta2.y = u - o.cy;
|
|
1937
1939
|
});
|
|
1938
1940
|
};
|
|
1939
|
-
function
|
|
1941
|
+
function $n() {
|
|
1940
1942
|
this.linkSvgGroup.innerHTML = "";
|
|
1941
1943
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1942
1944
|
const t = this.arrows[e];
|
|
1943
1945
|
try {
|
|
1944
|
-
|
|
1946
|
+
Ge(this, C(t.from), C(t.to), t, !0);
|
|
1945
1947
|
} catch {
|
|
1946
1948
|
}
|
|
1947
1949
|
}
|
|
1948
1950
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
1949
1951
|
}
|
|
1950
|
-
function
|
|
1952
|
+
function On(e) {
|
|
1951
1953
|
if (!e)
|
|
1952
1954
|
return;
|
|
1953
1955
|
const t = e.children[2];
|
|
1954
|
-
|
|
1956
|
+
ze(this, t, (n) => {
|
|
1955
1957
|
var i;
|
|
1956
1958
|
const o = e.arrowObj, s = ((i = n.textContent) == null ? void 0 : i.trim()) || "";
|
|
1957
1959
|
s === "" ? o.label = origin : o.label = s, n.remove(), s !== origin && (t.innerHTML = o.label, this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -1960,49 +1962,49 @@ function Pn(e) {
|
|
|
1960
1962
|
}));
|
|
1961
1963
|
});
|
|
1962
1964
|
}
|
|
1963
|
-
function
|
|
1964
|
-
this.arrows = this.arrows.filter((e) =>
|
|
1965
|
+
function Pn() {
|
|
1966
|
+
this.arrows = this.arrows.filter((e) => oe(e.from, this.nodeData) && oe(e.to, this.nodeData));
|
|
1965
1967
|
}
|
|
1966
1968
|
const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1967
1969
|
__proto__: null,
|
|
1968
|
-
createArrow:
|
|
1969
|
-
editArrowLabel:
|
|
1970
|
-
removeArrow:
|
|
1971
|
-
renderArrow:
|
|
1972
|
-
selectArrow:
|
|
1973
|
-
tidyArrow:
|
|
1974
|
-
unselectArrow:
|
|
1975
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1976
|
-
var l,
|
|
1970
|
+
createArrow: Ln,
|
|
1971
|
+
editArrowLabel: On,
|
|
1972
|
+
removeArrow: An,
|
|
1973
|
+
renderArrow: $n,
|
|
1974
|
+
selectArrow: jn,
|
|
1975
|
+
tidyArrow: Pn,
|
|
1976
|
+
unselectArrow: Dn
|
|
1977
|
+
}, Symbol.toStringTag, { value: "Module" })), Hn = function(e) {
|
|
1978
|
+
var l, u;
|
|
1977
1979
|
if (e.length === 0)
|
|
1978
1980
|
throw new Error("No selected node.");
|
|
1979
1981
|
if (e.length === 1) {
|
|
1980
1982
|
const d = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
1981
1983
|
if (!a)
|
|
1982
1984
|
throw new Error("Can not select root node.");
|
|
1983
|
-
const
|
|
1985
|
+
const p = a.children.findIndex((g) => d === g);
|
|
1984
1986
|
return {
|
|
1985
1987
|
parent: a.id,
|
|
1986
|
-
start:
|
|
1987
|
-
end:
|
|
1988
|
+
start: p,
|
|
1989
|
+
end: p
|
|
1988
1990
|
};
|
|
1989
1991
|
}
|
|
1990
1992
|
let t = 0;
|
|
1991
1993
|
const n = e.map((d) => {
|
|
1992
1994
|
let a = d.nodeObj;
|
|
1993
|
-
const
|
|
1995
|
+
const p = [];
|
|
1994
1996
|
for (; a.parent; ) {
|
|
1995
|
-
const g = a.parent,
|
|
1996
|
-
a = g,
|
|
1997
|
+
const g = a.parent, f = g.children, m = f == null ? void 0 : f.indexOf(a);
|
|
1998
|
+
a = g, p.unshift({ node: a, index: m });
|
|
1997
1999
|
}
|
|
1998
|
-
return
|
|
2000
|
+
return p.length > t && (t = p.length), p;
|
|
1999
2001
|
});
|
|
2000
2002
|
let o = 0;
|
|
2001
2003
|
e:
|
|
2002
2004
|
for (; o < t; o++) {
|
|
2003
2005
|
const d = (l = n[0][o]) == null ? void 0 : l.node;
|
|
2004
2006
|
for (let a = 1; a < n.length; a++)
|
|
2005
|
-
if (((
|
|
2007
|
+
if (((u = n[a][o]) == null ? void 0 : u.node) !== d)
|
|
2006
2008
|
break e;
|
|
2007
2009
|
}
|
|
2008
2010
|
if (!o)
|
|
@@ -2015,10 +2017,10 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2015
2017
|
start: i,
|
|
2016
2018
|
end: r
|
|
2017
2019
|
};
|
|
2018
|
-
},
|
|
2020
|
+
}, zn = function(e) {
|
|
2019
2021
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2020
2022
|
return t.setAttribute("id", e), t;
|
|
2021
|
-
},
|
|
2023
|
+
}, Ae = function(e, t) {
|
|
2022
2024
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2023
2025
|
return N(n, {
|
|
2024
2026
|
d: e,
|
|
@@ -2027,7 +2029,7 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2027
2029
|
"stroke-linecap": "round",
|
|
2028
2030
|
"stroke-width": "2"
|
|
2029
2031
|
}), n;
|
|
2030
|
-
},
|
|
2032
|
+
}, je = function(e, t, n, o, s) {
|
|
2031
2033
|
const i = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
2032
2034
|
return N(i, {
|
|
2033
2035
|
"text-anchor": o,
|
|
@@ -2035,43 +2037,43 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2035
2037
|
y: n + "",
|
|
2036
2038
|
fill: s || "#666"
|
|
2037
2039
|
}), i.innerHTML = e, i;
|
|
2038
|
-
},
|
|
2040
|
+
}, Rn = (e) => C(e).parentElement.parentElement, Fn = function({ parent: e, start: t }) {
|
|
2039
2041
|
var i, r;
|
|
2040
2042
|
const n = C(e), o = n.nodeObj;
|
|
2041
2043
|
let s;
|
|
2042
2044
|
return o.parent ? s = (i = n.closest("me-main")) == null ? void 0 : i.className : s = (r = C(o.children[t].id).closest("me-main")) == null ? void 0 : r.className, s;
|
|
2043
|
-
},
|
|
2045
|
+
}, Qe = function(e, t) {
|
|
2044
2046
|
var S;
|
|
2045
|
-
const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes,
|
|
2046
|
-
let a = 1 / 0,
|
|
2047
|
-
for (let
|
|
2048
|
-
const
|
|
2049
|
-
if (!
|
|
2047
|
+
const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes, u = C(s).nodeObj, d = Fn(t);
|
|
2048
|
+
let a = 1 / 0, p = 0, g = 0, f = 0;
|
|
2049
|
+
for (let O = i; O <= r; O++) {
|
|
2050
|
+
const W = (S = u.children) == null ? void 0 : S[O];
|
|
2051
|
+
if (!W)
|
|
2050
2052
|
return e.removeSummary(n), null;
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2053
|
-
}
|
|
2054
|
-
let m,
|
|
2055
|
-
const v = g + 10, y =
|
|
2056
|
-
d === "lhs" ? (m =
|
|
2057
|
-
const w =
|
|
2058
|
-
return w.appendChild(m), w.appendChild(
|
|
2059
|
-
},
|
|
2053
|
+
const P = Rn(W.id), { offsetLeft: J, offsetTop: ve } = $(c, P);
|
|
2054
|
+
O === i && (g = ve + 20), O === r && (f = ve + P.offsetHeight - 20), J < a && (a = J), P.offsetWidth + J > p && (p = P.offsetWidth + J);
|
|
2055
|
+
}
|
|
2056
|
+
let m, h;
|
|
2057
|
+
const v = g + 10, y = f + 10, b = (v + y) / 2, x = e.theme.cssVar["--color"];
|
|
2058
|
+
d === "lhs" ? (m = Ae(`M ${a + 10} ${v} c -5 0 -10 5 -10 10 L ${a} ${y - 10} c 0 5 5 10 10 10 M ${a} ${b} h -10`, x), h = je(o, a - 20, b + 6, "end", x)) : (m = Ae(`M ${p - 10} ${v} c 5 0 10 5 10 10 L ${p} ${y - 10} c 0 5 -5 10 -10 10 M ${p} ${b} h 10`, x), h = je(o, p + 20, b + 6, "start", x));
|
|
2059
|
+
const w = zn("s-" + n);
|
|
2060
|
+
return w.appendChild(m), w.appendChild(h), w.summaryObj = t, e.summarySvg.appendChild(w), w;
|
|
2061
|
+
}, qn = function() {
|
|
2060
2062
|
let e = [];
|
|
2061
2063
|
this.currentNode ? e = [this.currentNode] : this.currentNodes && (e = this.currentNodes);
|
|
2062
|
-
const { parent: t, start: n, end: o } =
|
|
2064
|
+
const { parent: t, start: n, end: o } = Hn(e), s = { id: X(), parent: t, start: n, end: o, text: "summary" }, i = Qe(this, s);
|
|
2063
2065
|
this.summaries.push(s), this.editSummary(i), this.bus.fire("operation", {
|
|
2064
2066
|
name: "createSummary",
|
|
2065
2067
|
obj: s
|
|
2066
2068
|
});
|
|
2067
|
-
},
|
|
2069
|
+
}, In = function(e) {
|
|
2068
2070
|
var n;
|
|
2069
2071
|
const t = this.summaries.findIndex((o) => o.id === e);
|
|
2070
2072
|
t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
|
|
2071
2073
|
name: "removeSummary",
|
|
2072
2074
|
obj: { id: e }
|
|
2073
2075
|
});
|
|
2074
|
-
},
|
|
2076
|
+
}, Kn = function(e) {
|
|
2075
2077
|
const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2076
2078
|
N(s, {
|
|
2077
2079
|
x: t.x - n + "",
|
|
@@ -2083,21 +2085,21 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2083
2085
|
"stroke-width": "2",
|
|
2084
2086
|
fill: "none"
|
|
2085
2087
|
}), s.classList.add("selected"), e.appendChild(s), this.currentSummary = e;
|
|
2086
|
-
},
|
|
2088
|
+
}, Vn = function() {
|
|
2087
2089
|
var e, t;
|
|
2088
2090
|
(t = (e = this.currentSummary) == null ? void 0 : e.querySelector("rect")) == null || t.remove(), this.currentSummary = null;
|
|
2089
|
-
},
|
|
2091
|
+
}, Wn = function() {
|
|
2090
2092
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2091
2093
|
try {
|
|
2092
|
-
|
|
2094
|
+
Qe(this, e);
|
|
2093
2095
|
} catch {
|
|
2094
2096
|
}
|
|
2095
2097
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2096
|
-
},
|
|
2098
|
+
}, Un = function(e) {
|
|
2097
2099
|
if (!e)
|
|
2098
2100
|
return;
|
|
2099
2101
|
const t = e.childNodes[1];
|
|
2100
|
-
|
|
2102
|
+
ze(this, t, (n) => {
|
|
2101
2103
|
var i;
|
|
2102
2104
|
const o = e.summaryObj, s = ((i = n.textContent) == null ? void 0 : i.trim()) || "";
|
|
2103
2105
|
s === "" ? o.text = origin : o.text = s, n.remove(), s !== origin && (t.innerHTML = o.text, this.linkDiv(), this.bus.fire("operation", {
|
|
@@ -2105,16 +2107,16 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2105
2107
|
obj: o
|
|
2106
2108
|
}));
|
|
2107
2109
|
});
|
|
2108
|
-
},
|
|
2110
|
+
}, Yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2109
2111
|
__proto__: null,
|
|
2110
|
-
createSummary:
|
|
2111
|
-
editSummary:
|
|
2112
|
-
removeSummary:
|
|
2113
|
-
renderSummary:
|
|
2114
|
-
selectSummary:
|
|
2115
|
-
unselectSummary:
|
|
2112
|
+
createSummary: qn,
|
|
2113
|
+
editSummary: Un,
|
|
2114
|
+
removeSummary: In,
|
|
2115
|
+
renderSummary: Wn,
|
|
2116
|
+
selectSummary: Kn,
|
|
2117
|
+
unselectSummary: Vn
|
|
2116
2118
|
}, Symbol.toStringTag, { value: "Module" })), M = "http://www.w3.org/2000/svg";
|
|
2117
|
-
function
|
|
2119
|
+
function Xn(e, t) {
|
|
2118
2120
|
const n = document.createElementNS(M, "svg");
|
|
2119
2121
|
return N(n, {
|
|
2120
2122
|
version: "1.1",
|
|
@@ -2123,27 +2125,27 @@ function Gn(e, t) {
|
|
|
2123
2125
|
width: t
|
|
2124
2126
|
}), n;
|
|
2125
2127
|
}
|
|
2126
|
-
function
|
|
2128
|
+
function Gn(e, t) {
|
|
2127
2129
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2128
2130
|
}
|
|
2129
|
-
function
|
|
2131
|
+
function Jn(e, t, n, o) {
|
|
2130
2132
|
const s = document.createElementNS(M, "g");
|
|
2131
2133
|
let i = "";
|
|
2132
2134
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2133
2135
|
`).forEach((c, l) => {
|
|
2134
|
-
const
|
|
2135
|
-
N(
|
|
2136
|
+
const u = document.createElementNS(M, "text");
|
|
2137
|
+
N(u, {
|
|
2136
2138
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2137
|
-
y: o + parseInt(t.paddingTop) +
|
|
2139
|
+
y: o + parseInt(t.paddingTop) + Gn(t.lineHeight, t.fontSize) * (l + 1) + parseFloat(t.fontSize) * (l + 1) + "",
|
|
2138
2140
|
"text-anchor": "start",
|
|
2139
2141
|
"font-family": t.fontFamily,
|
|
2140
2142
|
"font-size": `${t.fontSize}`,
|
|
2141
2143
|
"font-weight": `${t.fontWeight}`,
|
|
2142
2144
|
fill: `${t.color}`
|
|
2143
|
-
}),
|
|
2145
|
+
}), u.innerHTML = c, s.appendChild(u);
|
|
2144
2146
|
}), s;
|
|
2145
2147
|
}
|
|
2146
|
-
function
|
|
2148
|
+
function Zn(e, t, n, o) {
|
|
2147
2149
|
var c;
|
|
2148
2150
|
let s = "";
|
|
2149
2151
|
(c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
@@ -2160,8 +2162,8 @@ function Qn(e, t, n, o) {
|
|
|
2160
2162
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2161
2163
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
2162
2164
|
}
|
|
2163
|
-
function
|
|
2164
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2165
|
+
function Qn(e, t) {
|
|
2166
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(M, "rect");
|
|
2165
2167
|
return N(i, {
|
|
2166
2168
|
x: o + "",
|
|
2167
2169
|
y: s + "",
|
|
@@ -2174,8 +2176,8 @@ function eo(e, t) {
|
|
|
2174
2176
|
"stroke-width": n.borderWidth
|
|
2175
2177
|
}), i;
|
|
2176
2178
|
}
|
|
2177
|
-
function
|
|
2178
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2179
|
+
function ee(e, t, n = !1) {
|
|
2180
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = $(e.nodes, t), r = document.createElementNS(M, "rect");
|
|
2179
2181
|
N(r, {
|
|
2180
2182
|
x: s + "",
|
|
2181
2183
|
y: i + "",
|
|
@@ -2190,10 +2192,10 @@ function te(e, t, n = !1) {
|
|
|
2190
2192
|
const c = document.createElementNS(M, "g");
|
|
2191
2193
|
c.appendChild(r);
|
|
2192
2194
|
let l;
|
|
2193
|
-
return n ? l =
|
|
2195
|
+
return n ? l = Zn(t, o, s, i) : l = Jn(t, o, s, i), c.appendChild(l), c;
|
|
2194
2196
|
}
|
|
2195
|
-
function
|
|
2196
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2197
|
+
function eo(e, t) {
|
|
2198
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(M, "a"), r = document.createElementNS(M, "text");
|
|
2197
2199
|
return N(r, {
|
|
2198
2200
|
x: o + "",
|
|
2199
2201
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2204,8 +2206,8 @@ function to(e, t) {
|
|
|
2204
2206
|
fill: `${n.color}`
|
|
2205
2207
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
2206
2208
|
}
|
|
2207
|
-
function
|
|
2208
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2209
|
+
function to(e, t) {
|
|
2210
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = $(e.nodes, t), i = document.createElementNS(M, "image");
|
|
2209
2211
|
return N(i, {
|
|
2210
2212
|
x: o + "",
|
|
2211
2213
|
y: s + "",
|
|
@@ -2214,41 +2216,41 @@ function no(e, t) {
|
|
|
2214
2216
|
href: t.src
|
|
2215
2217
|
}), i;
|
|
2216
2218
|
}
|
|
2217
|
-
const
|
|
2218
|
-
var a,
|
|
2219
|
-
const n = e.nodes, o = n.offsetHeight +
|
|
2219
|
+
const te = 100, no = '<?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">', oo = (e, t = !1) => {
|
|
2220
|
+
var a, p, g;
|
|
2221
|
+
const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = Xn(o + "px", s + "px"), r = document.createElementNS(M, "svg"), c = document.createElementNS(M, "rect");
|
|
2220
2222
|
N(c, {
|
|
2221
2223
|
x: "0",
|
|
2222
2224
|
y: "0",
|
|
2223
2225
|
width: `${s}`,
|
|
2224
2226
|
height: `${o}`,
|
|
2225
2227
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2226
|
-
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((
|
|
2227
|
-
const m =
|
|
2228
|
-
m.setAttribute("x", `${
|
|
2228
|
+
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((f) => {
|
|
2229
|
+
const m = f.cloneNode(!0), { offsetLeft: h, offsetTop: v } = $(n, f.parentElement);
|
|
2230
|
+
m.setAttribute("x", `${h}`), m.setAttribute("y", `${v}`), r.appendChild(m);
|
|
2229
2231
|
});
|
|
2230
2232
|
const l = (a = n.querySelector(".lines")) == null ? void 0 : a.cloneNode(!0);
|
|
2231
2233
|
l && r.appendChild(l);
|
|
2232
|
-
const
|
|
2233
|
-
|
|
2234
|
+
const u = (p = n.querySelector(".topiclinks")) == null ? void 0 : p.cloneNode(!0);
|
|
2235
|
+
u && r.appendChild(u);
|
|
2234
2236
|
const d = (g = n.querySelector(".summary")) == null ? void 0 : g.cloneNode(!0);
|
|
2235
|
-
return d && r.appendChild(d), n.querySelectorAll("me-tpc").forEach((
|
|
2236
|
-
|
|
2237
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2238
|
-
r.appendChild(
|
|
2239
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2240
|
-
r.appendChild(
|
|
2241
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2242
|
-
r.appendChild(
|
|
2243
|
-
}), n.querySelectorAll("img").forEach((
|
|
2244
|
-
r.appendChild(
|
|
2237
|
+
return d && r.appendChild(d), n.querySelectorAll("me-tpc").forEach((f) => {
|
|
2238
|
+
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(ee(e, f, !t)) : (r.appendChild(Qn(e, f)), r.appendChild(ee(e, f.text, !t)));
|
|
2239
|
+
}), n.querySelectorAll(".tags > span").forEach((f) => {
|
|
2240
|
+
r.appendChild(ee(e, f));
|
|
2241
|
+
}), n.querySelectorAll(".icons > span").forEach((f) => {
|
|
2242
|
+
r.appendChild(ee(e, f));
|
|
2243
|
+
}), n.querySelectorAll(".hyper-link").forEach((f) => {
|
|
2244
|
+
r.appendChild(eo(e, f));
|
|
2245
|
+
}), n.querySelectorAll("img").forEach((f) => {
|
|
2246
|
+
r.appendChild(to(e, f));
|
|
2245
2247
|
}), N(r, {
|
|
2246
|
-
x:
|
|
2247
|
-
y:
|
|
2248
|
+
x: te + "",
|
|
2249
|
+
y: te + "",
|
|
2248
2250
|
overflow: "visible"
|
|
2249
2251
|
}), i.appendChild(r), i;
|
|
2250
|
-
},
|
|
2251
|
-
function
|
|
2252
|
+
}, so = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), no + e.outerHTML);
|
|
2253
|
+
function io(e) {
|
|
2252
2254
|
return new Promise((t, n) => {
|
|
2253
2255
|
const o = new FileReader();
|
|
2254
2256
|
o.onload = (s) => {
|
|
@@ -2258,11 +2260,11 @@ function ro(e) {
|
|
|
2258
2260
|
}, o.readAsDataURL(e);
|
|
2259
2261
|
});
|
|
2260
2262
|
}
|
|
2261
|
-
const
|
|
2262
|
-
const n =
|
|
2263
|
+
const ro = function(e = !1, t) {
|
|
2264
|
+
const n = oo(this, e), o = so(n, t);
|
|
2263
2265
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2264
|
-
},
|
|
2265
|
-
const n = this.exportSvg(e, t), o = await
|
|
2266
|
+
}, co = async function(e = !1, t) {
|
|
2267
|
+
const n = this.exportSvg(e, t), o = await io(n);
|
|
2266
2268
|
return new Promise((s, i) => {
|
|
2267
2269
|
const r = new Image();
|
|
2268
2270
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -2270,66 +2272,67 @@ const co = function(e = !1, t) {
|
|
|
2270
2272
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2271
2273
|
}, r.src = o, r.onerror = i;
|
|
2272
2274
|
});
|
|
2273
|
-
},
|
|
2275
|
+
}, lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2274
2276
|
__proto__: null,
|
|
2275
|
-
exportPng:
|
|
2276
|
-
exportSvg:
|
|
2277
|
+
exportPng: co,
|
|
2278
|
+
exportSvg: ro
|
|
2277
2279
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2278
|
-
function
|
|
2280
|
+
function ao(e, t) {
|
|
2279
2281
|
return async function(...n) {
|
|
2280
2282
|
const o = this.before[t];
|
|
2281
2283
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2282
2284
|
};
|
|
2283
2285
|
}
|
|
2284
|
-
const
|
|
2285
|
-
for (let e = 0; e <
|
|
2286
|
-
const t =
|
|
2287
|
-
|
|
2286
|
+
const De = Object.keys(Ye), et = {};
|
|
2287
|
+
for (let e = 0; e < De.length; e++) {
|
|
2288
|
+
const t = De[e];
|
|
2289
|
+
et[t] = ao(Ye[t], t);
|
|
2288
2290
|
}
|
|
2289
|
-
const
|
|
2290
|
-
getObjById:
|
|
2291
|
-
generateNewObj:
|
|
2292
|
-
layout:
|
|
2293
|
-
linkDiv:
|
|
2294
|
-
editTopic:
|
|
2295
|
-
createWrapper:
|
|
2296
|
-
createParent:
|
|
2297
|
-
createChildren:
|
|
2298
|
-
createTopic:
|
|
2291
|
+
const ho = {
|
|
2292
|
+
getObjById: oe,
|
|
2293
|
+
generateNewObj: nt,
|
|
2294
|
+
layout: it,
|
|
2295
|
+
linkDiv: pt,
|
|
2296
|
+
editTopic: ut,
|
|
2297
|
+
createWrapper: lt,
|
|
2298
|
+
createParent: at,
|
|
2299
|
+
createChildren: dt,
|
|
2300
|
+
createTopic: ht,
|
|
2299
2301
|
findEle: C,
|
|
2300
|
-
changeTheme:
|
|
2301
|
-
...
|
|
2302
|
-
...
|
|
2302
|
+
changeTheme: Ht,
|
|
2303
|
+
...Mn,
|
|
2304
|
+
...et,
|
|
2303
2305
|
...Bn,
|
|
2304
|
-
...
|
|
2305
|
-
...
|
|
2306
|
+
...Yn,
|
|
2307
|
+
...lo,
|
|
2306
2308
|
init(e) {
|
|
2307
2309
|
if (!e || !e.nodeData)
|
|
2308
2310
|
return new Error("MindElixir: `data` is required");
|
|
2309
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2311
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, D(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Tt(this), this.keypress && wt(this), this.editable && Bt(this), this.contextMenu && this.disposable.push(mt(this, this.contextMenuOption)), this.draggable && Ct(this), this.allowUndo && _t(this), this.toCenter(), this.layout(), this.linkDiv();
|
|
2310
2312
|
},
|
|
2311
2313
|
destroy() {
|
|
2312
2314
|
var e, t;
|
|
2313
2315
|
this.disposable.forEach((n) => n()), (e = this.mindElixirBox) == null || e.remove(), this.mindElixirBox = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNode = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (t = this.selection) == null || t.destroy(), this.selection = void 0;
|
|
2314
2316
|
}
|
|
2315
2317
|
};
|
|
2316
|
-
function
|
|
2318
|
+
function uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: u }) {
|
|
2317
2319
|
let d = t + n / 2;
|
|
2318
2320
|
const a = e + o / 2;
|
|
2319
|
-
let
|
|
2320
|
-
l === "lhs" ?
|
|
2321
|
-
const g = s + c / 2, m = (1 - Math.abs(g - a) /
|
|
2322
|
-
return l === "lhs" ? d = d - n / 10 - m : d = d + n / 10 + m, `M ${d} ${a} Q ${d} ${g} ${
|
|
2321
|
+
let p;
|
|
2322
|
+
l === "lhs" ? p = i + r : p = i;
|
|
2323
|
+
const g = s + c / 2, m = (1 - Math.abs(g - a) / u) * 0.25 * (n / 2);
|
|
2324
|
+
return l === "lhs" ? d = d - n / 10 - m : d = d + n / 10 + m, `M ${d} ${a} Q ${d} ${g} ${p} ${g}`;
|
|
2323
2325
|
}
|
|
2324
|
-
function
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2326
|
+
function fo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: u }) {
|
|
2327
|
+
const d = parseInt(this.mindElixirBox.style.getPropertyValue("--gap"));
|
|
2328
|
+
let a = 0, p = 0;
|
|
2329
|
+
u ? a = e + o / 2 : a = e + o;
|
|
2330
|
+
const g = s + c;
|
|
2331
|
+
let f = 0, m = 0, h = 0;
|
|
2332
|
+
const v = Math.abs(a - g) / 300 * d;
|
|
2333
|
+
return l === "lhs" ? (h = t, f = h + d, m = h - d, p = i + d, `M ${f} ${a} C ${h} ${a} ${h + v} ${g} ${m} ${g} H ${p}`) : (h = t + n, f = h - d, m = h + d, p = i + r - d, `M ${f} ${a} C ${h} ${a} ${h - v} ${g} ${m} ${g} H ${p}`);
|
|
2331
2334
|
}
|
|
2332
|
-
const
|
|
2335
|
+
const po = "4.3.0", U = document;
|
|
2333
2336
|
function A({
|
|
2334
2337
|
el: e,
|
|
2335
2338
|
direction: t,
|
|
@@ -2340,37 +2343,37 @@ function A({
|
|
|
2340
2343
|
contextMenuOption: r,
|
|
2341
2344
|
toolBar: c,
|
|
2342
2345
|
keypress: l,
|
|
2343
|
-
mouseSelectionButton:
|
|
2346
|
+
mouseSelectionButton: u,
|
|
2344
2347
|
selectionContainer: d,
|
|
2345
2348
|
before: a,
|
|
2346
|
-
newTopicName:
|
|
2349
|
+
newTopicName: p,
|
|
2347
2350
|
allowUndo: g,
|
|
2348
|
-
generateMainBranch:
|
|
2351
|
+
generateMainBranch: f,
|
|
2349
2352
|
generateSubBranch: m,
|
|
2350
|
-
overflowHidden:
|
|
2353
|
+
overflowHidden: h,
|
|
2351
2354
|
theme: v
|
|
2352
2355
|
}) {
|
|
2353
2356
|
let y = null;
|
|
2354
2357
|
const b = Object.prototype.toString.call(e);
|
|
2355
2358
|
if (b === "[object HTMLDivElement]" ? y = e : b === "[object String]" && (y = document.querySelector(e)), !y)
|
|
2356
2359
|
throw new Error("MindElixir: el is not a valid element");
|
|
2357
|
-
y.className += " mind-elixir", y.innerHTML = "",
|
|
2360
|
+
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = u || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = p || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = g === void 0 ? !1 : g, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = f || uo, this.generateSubBranch = m || fo, this.overflowHidden = h || !1, this.bus = st.create(), this.container = U.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
2358
2361
|
const x = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2359
|
-
this.theme = v || (x.matches ?
|
|
2360
|
-
const w =
|
|
2361
|
-
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes =
|
|
2362
|
+
this.theme = v || (x.matches ? Oe : $e);
|
|
2363
|
+
const w = U.createElement("div");
|
|
2364
|
+
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = Y("lines"), this.summarySvg = Y("summary"), this.linkController = Y("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 = Y("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : ot(this);
|
|
2362
2365
|
}
|
|
2363
|
-
A.prototype =
|
|
2366
|
+
A.prototype = ho;
|
|
2364
2367
|
A.LEFT = T;
|
|
2365
|
-
A.RIGHT =
|
|
2366
|
-
A.SIDE =
|
|
2367
|
-
A.THEME =
|
|
2368
|
-
A.DARK_THEME =
|
|
2369
|
-
A.version =
|
|
2368
|
+
A.RIGHT = z;
|
|
2369
|
+
A.SIDE = re;
|
|
2370
|
+
A.THEME = $e;
|
|
2371
|
+
A.DARK_THEME = Oe;
|
|
2372
|
+
A.version = po;
|
|
2370
2373
|
A.E = C;
|
|
2371
2374
|
A.new = (e) => ({
|
|
2372
2375
|
nodeData: {
|
|
2373
|
-
id:
|
|
2376
|
+
id: X(),
|
|
2374
2377
|
topic: e || "new topic",
|
|
2375
2378
|
children: []
|
|
2376
2379
|
}
|