mind-elixir
Version:
Mind elixir is a free open source mind map core.
1,151 lines • 107 kB
JavaScript
var lt = Object.defineProperty;
var at = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var q = (e, t, n) => (at(e, typeof t != "symbol" ? t + "" : t, n), n);
const pe = {
name: "Latte",
type: "light",
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
cssVar: {
"--node-gap-x": "30px",
"--node-gap-y": "10px",
"--main-gap-x": "65px",
"--main-gap-y": "45px",
"--root-radius": "30px",
"--main-radius": "20px",
"--root-color": "#ffffff",
"--root-bgcolor": "#4c4f69",
"--root-border-color": "rgba(0, 0, 0, 0)",
"--main-color": "#444446",
"--main-bgcolor": "#ffffff",
"--topic-padding": "3px",
"--color": "#777777",
"--bgcolor": "#f6f6f6",
"--selected": "#4dc4ff",
"--panel-color": "#444446",
"--panel-bgcolor": "#ffffff",
"--panel-border-color": "#eaeaea",
"--map-padding": "50px"
}
}, ge = {
name: "Dark",
type: "dark",
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
cssVar: {
"--node-gap-x": "30px",
"--node-gap-y": "10px",
"--main-gap-x": "65px",
"--main-gap-y": "45px",
"--root-radius": "30px",
"--main-radius": "20px",
"--root-color": "#ffffff",
"--root-bgcolor": "#2d3748",
"--root-border-color": "rgba(255, 255, 255, 0.1)",
"--main-color": "#ffffff",
"--main-bgcolor": "#4c4f69",
"--topic-padding": "3px",
"--color": "#cccccc",
"--bgcolor": "#252526",
"--selected": "#4dc4ff",
"--panel-color": "#ffffff",
"--panel-bgcolor": "#2d3748",
"--panel-border-color": "#696969",
"--map-padding": "50px 80px"
}
};
function te(e) {
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
}
const ne = function(e, t) {
if (t.id === e)
return t;
if (t.children && t.children.length) {
for (let n = 0; n < t.children.length; n++) {
const o = ne(e, t.children[n]);
if (o)
return o;
}
return null;
} else
return null;
}, $ = (e, t) => {
if (e.parent = t, e.children)
for (let n = 0; n < e.children.length; n++)
$(e.children[n], e);
};
function me(e) {
if (e.id = V(), e.children)
for (let t = 0; t < e.children.length; t++)
me(e.children[t]);
}
function oe(e, t, n, o) {
const i = o - t, s = e - n;
let r = Math.atan(Math.abs(i) / Math.abs(s)) / 3.14 * 180;
if (isNaN(r))
return;
s < 0 && i > 0 && (r = 180 - r), s < 0 && i < 0 && (r = 180 + r), s > 0 && i < 0 && (r = 360 - r);
const c = 12, u = 30, a = r + u, f = r - u;
return {
x1: n + Math.cos(Math.PI * a / 180) * c,
y1: o - Math.sin(Math.PI * a / 180) * c,
x2: n + Math.cos(Math.PI * f / 180) * c,
y2: o - Math.sin(Math.PI * f / 180) * c
};
}
function V() {
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
}
const dt = function() {
const e = V();
return {
topic: this.newTopicName,
id: e
};
};
function ve(e) {
return JSON.parse(
JSON.stringify(e, (n, o) => {
if (n !== "parent")
return o;
})
);
}
const H = (e, t) => {
let n = 0, o = 0;
for (; t && t !== e; )
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
return { offsetLeft: n, offsetTop: o };
}, S = (e, t) => {
for (const n in t)
e.setAttribute(n, t[n]);
}, de = (e) => e ? e.tagName === "ME-TPC" : !1, ce = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
for (let i = 0; i < o.length; i++) {
if (t === o[i])
continue;
const { parent: s } = t.nodeObj;
if (s === o[i].nodeObj)
return !1;
}
return !0;
}), Ye = (e) => {
const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
}, be = function(e) {
for (let t = 0; t < e.length; t++) {
const { dom: n, evt: o, func: i } = e[t];
n.addEventListener(o, i);
}
return function() {
for (let n = 0; n < e.length; n++) {
const { dom: o, evt: i, func: s } = e[n];
o.removeEventListener(i, s);
}
};
};
var M = /* @__PURE__ */ ((e) => (e.LHS = "lhs", e.RHS = "rhs", e))(M || {});
const ht = (e) => {
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
}, ut = (e) => {
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
}, ft = (e) => {
e.selectNode(e.map.querySelector("me-root>me-tpc"));
}, pt = function(e, t) {
const n = t.parentElement.parentElement.parentElement.previousSibling;
if (n) {
const o = n.firstChild;
e.selectNode(o);
}
}, gt = function(e, t) {
const n = t.parentElement.nextSibling;
if (n && n.firstChild) {
const o = n.firstChild.firstChild.firstChild;
e.selectNode(o);
}
}, _e = function(e, t) {
var s, r;
const n = e.currentNode || ((s = e.currentNodes) == null ? void 0 : s[0]);
if (!n)
return;
const o = n.nodeObj, i = n.offsetParent.offsetParent.parentElement;
o.parent ? i.className === t ? gt(e, n) : (r = o.parent) != null && r.parent ? pt(e, n) : ft(e) : t === M.LHS ? ht(e) : ut(e);
}, ke = function(e, t) {
const n = e.currentNode;
if (!n || !n.nodeObj.parent)
return;
const i = t + "Sibling", s = n.parentElement.parentElement[i];
s ? e.selectNode(s.firstChild.firstChild) : e.selectNode(n);
}, ie = function(e, t, n) {
const { scaleVal: o, scaleSensitivity: i } = e;
switch (t) {
case "in":
if (o > 1.6)
return;
e.scale(o + i, n);
break;
case "out":
if (o < 0.6)
return;
e.scale(o - i, n);
}
};
function mt(e, t) {
t = t === !0 ? {} : t;
const n = () => {
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
}, o = {
Enter: (i) => {
i.shiftKey ? e.insertSibling("before") : i.ctrlKey ? e.insertParent() : e.insertSibling("after");
},
Tab: () => {
e.addChild();
},
F1: () => {
e.toCenter();
},
F2: () => {
e.beginEdit();
},
ArrowUp: (i) => {
if (i.altKey)
e.moveUpNode();
else {
if (i.metaKey || i.ctrlKey)
return e.initSide();
ke(e, "previous");
}
},
ArrowDown: (i) => {
i.altKey ? e.moveDownNode() : ke(e, "next");
},
ArrowLeft: (i) => {
if (i.metaKey || i.ctrlKey)
return e.initLeft();
_e(e, M.LHS);
},
ArrowRight: (i) => {
if (i.metaKey || i.ctrlKey)
return e.initRight();
_e(e, M.RHS);
},
PageUp: () => e.moveUpNode(),
PageDown: () => {
e.moveDownNode();
},
c: (i) => {
(i.metaKey || i.ctrlKey) && (e.waitCopy = e.currentNodes);
},
x: (i) => {
(i.metaKey || i.ctrlKey) && (e.waitCopy = e.currentNodes, n());
},
v: (i) => {
!e.waitCopy || !e.currentNode || (i.metaKey || i.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
},
"=": (i) => {
(i.metaKey || i.ctrlKey) && ie(e, "in");
},
"-": (i) => {
(i.metaKey || i.ctrlKey) && ie(e, "out");
},
0: (i) => {
(i.metaKey || i.ctrlKey) && e.scale(1);
},
Delete: n,
Backspace: n,
...t
};
e.container.onkeydown = (i) => {
if (i.preventDefault(), !e.editable)
return;
const s = o[i.key];
s && s(i);
};
}
function vt(e) {
const { dragMoveHelper: t } = e, n = (d) => {
var m, v, b;
if (d.button !== 0)
return;
if ((m = e.helper1) != null && m.moved) {
e.helper1.clear();
return;
}
if ((v = e.helper2) != null && v.moved) {
e.helper2.clear();
return;
}
if (t.moved) {
t.clear();
return;
}
const l = d.target;
if (l.tagName === "ME-EPD")
d.ctrlKey || d.metaKey ? e.expandNodeAll(l.previousSibling) : e.expandNode(l.previousSibling);
else if (l.tagName === "ME-TPC" && e.currentNodes.length > 1)
e.selectNode(l);
else if (!e.editable)
return;
const p = (b = l.parentElement) == null ? void 0 : b.parentElement;
p.getAttribute("class") === "topiclinks" ? e.selectArrow(l.parentElement) : p.getAttribute("class") === "summary" && e.selectSummary(l.parentElement);
}, o = (d) => {
var m;
if (!e.editable)
return;
const l = d.target;
de(l) && e.beginEdit(l);
const p = (m = l.parentElement) == null ? void 0 : m.parentElement;
p.getAttribute("class") === "topiclinks" ? e.editArrowLabel(l.parentElement) : p.getAttribute("class") === "summary" && e.editSummary(l.parentElement);
};
let i = 0;
const s = (d) => {
if (d.pointerType === "mouse")
return;
const l = (/* @__PURE__ */ new Date()).getTime(), p = l - i;
p < 300 && p > 0 && o(d), i = l;
}, r = (d) => {
t.moved = !1;
const l = e.mouseSelectionButton === 0 ? 2 : 0;
if (d.button !== l && d.pointerType === "mouse")
return;
t.x = d.clientX, t.y = d.clientY;
const p = d.target;
p.className !== "circle" && p.contentEditable !== "plaintext-only" && (t.mousedown = !0, e.map.style.transition = "none", p.setPointerCapture(d.pointerId));
}, c = (d) => {
if (d.target.contentEditable !== "plaintext-only") {
const l = d.clientX - t.x, p = d.clientY - t.y;
t.onMove(l, p);
}
t.x = d.clientX, t.y = d.clientY;
}, u = (d) => {
const l = e.mouseSelectionButton === 0 ? 2 : 0;
if (d.button !== l && d.pointerType === "mouse")
return;
const p = d.target;
p.hasPointerCapture && p.hasPointerCapture(d.pointerId) && p.releasePointerCapture(d.pointerId), t.clear();
}, a = (d) => {
if (d.preventDefault(), d.button !== 2 || !e.editable)
return;
const l = d.target;
de(l) && !l.classList.contains("selected") && e.selectNode(l), setTimeout(() => {
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", d);
}, 200);
}, f = (d) => {
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? ie(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && ie(e, "out", e.dragMoveHelper) : d.shiftKey ? e.move(-d.deltaY, 0) : (e.map.style.transition = "none", e.move(-d.deltaX, -d.deltaY), e.map.style.transition = "transform 0.3s");
}, { container: h } = e;
return be([
{ dom: h, evt: "pointerdown", func: r },
{ dom: h, evt: "pointermove", func: c },
{ dom: h, evt: "pointerup", func: u },
{ dom: h, evt: "pointerup", func: s },
{ dom: h, evt: "click", func: n },
{ dom: h, evt: "dblclick", func: o },
{ dom: h, evt: "contextmenu", func: a },
{ dom: h, evt: "wheel", func: f }
]);
}
function bt() {
return {
handlers: {},
addListener: function(e, t) {
this.handlers[e] === void 0 && (this.handlers[e] = []), this.handlers[e].push(t);
},
fire: function(e, ...t) {
if (this.handlers[e] instanceof Array) {
const n = this.handlers[e];
for (let o = 0; o < n.length; o++)
n[o](...t);
}
},
removeListener: function(e, t) {
if (!this.handlers[e])
return;
const n = this.handlers[e];
if (!t)
n.length = 0;
else if (n.length)
for (let o = 0; o < n.length; o++)
n[o] === t && this.handlers[e].splice(o, 1);
}
};
}
const se = document, yt = function() {
this.nodes.innerHTML = "";
const e = this.createTopic(this.nodeData);
ye(e, this.nodeData), e.draggable = !1;
const t = se.createElement("me-root");
t.appendChild(e);
const n = this.nodeData.children || [];
if (this.direction === 2) {
let o = 0, i = 0;
n.map((s) => {
s.direction === 0 ? o += 1 : s.direction === 1 ? i += 1 : o <= i ? (s.direction = 0, o += 1) : (s.direction = 1, i += 1);
});
}
wt(this, n, t);
}, wt = function(e, t, n) {
const o = se.createElement("me-main");
o.className = M.LHS;
const i = se.createElement("me-main");
i.className = M.RHS;
for (let s = 0; s < t.length; s++) {
const r = t[s], { grp: c } = e.createWrapper(r);
e.direction === 2 ? r.direction === 0 ? o.appendChild(c) : i.appendChild(c) : e.direction === 0 ? o.appendChild(c) : i.appendChild(c);
}
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(i), e.nodes.appendChild(e.lines);
}, xt = function(e, t) {
const n = se.createElement("me-children");
for (let o = 0; o < t.length; o++) {
const i = t[o], { grp: s } = e.createWrapper(i);
n.appendChild(s);
}
return n;
}, A = document, Ge = function(e, t) {
const o = (this != null && this.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
if (!o)
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
return o;
}, ye = function(e, t) {
if (e.innerHTML = "", t.style) {
const n = t.style;
for (const o in n)
e.style[o] = n[o];
}
if (t.dangerouslySetInnerHTML) {
e.innerHTML = t.dangerouslySetInnerHTML;
return;
}
if (t.image) {
const n = t.image;
if (n.url && n.width && n.height) {
const o = A.createElement("img");
o.src = n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
}
} else
e.image && (e.image = void 0);
{
const n = A.createElement("span");
n.className = "text", n.textContent = t.topic, e.appendChild(n), e.text = n;
}
if (t.hyperLink) {
const n = A.createElement("a");
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
} else
e.link && (e.link = void 0);
if (t.icons && t.icons.length) {
const n = A.createElement("span");
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
} else
e.icons && (e.icons = void 0);
if (t.tags && t.tags.length) {
const n = A.createElement("div");
n.className = "tags", n.innerHTML = t.tags.map((o) => `<span>${te(o)}</span>`).join(""), e.appendChild(n), e.tags = n;
} else
e.tags && (e.tags = void 0);
}, Et = function(e, t) {
const n = A.createElement("me-wrapper"), { p: o, tpc: i } = this.createParent(e);
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
const s = we(e.expanded);
if (o.appendChild(s), e.expanded !== !1) {
const r = xt(this, e.children);
n.appendChild(r);
}
}
return { grp: n, top: o, tpc: i };
}, Ct = function(e) {
const t = A.createElement("me-parent"), n = this.createTopic(e);
return ye(n, e), t.appendChild(n), { p: t, tpc: n };
}, St = function(e) {
const t = A.createElement("me-children");
return t.append(...e), t;
}, Nt = function(e) {
const t = A.createElement("me-tpc");
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
};
function Ke(e) {
const t = A.createRange();
t.selectNodeContents(e);
const n = window.getSelection();
n && (n.removeAllRanges(), n.addRange(t));
}
const _t = function(e) {
if (!e)
return;
const t = A.createElement("div"), n = e.text.textContent;
e.appendChild(t), t.id = "input-box", t.textContent = n, t.contentEditable = "plaintext-only", t.spellcheck = !1;
const o = getComputedStyle(e);
t.style.cssText = `min-width:${e.offsetWidth - 8}px;
color:${o.color};
padding:${o.padding};
margin:${o.margin};
font:${o.font};
background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
border-radius:${o.borderRadius};`, this.direction === 0 && (t.style.right = "0"), Ke(t), this.bus.fire("operation", {
name: "beginEdit",
obj: e.nodeObj
}), t.addEventListener("keydown", (i) => {
i.stopPropagation();
const s = i.key;
if (s === "Enter" || s === "Tab") {
if (i.shiftKey)
return;
i.preventDefault(), t.blur(), this.container.focus();
}
}), t.addEventListener("blur", () => {
var r;
if (!t)
return;
const i = e.nodeObj, s = ((r = t.textContent) == null ? void 0 : r.trim()) || "";
s === "" ? i.topic = n : i.topic = s, t.remove(), s !== n && (e.text.textContent = i.topic, this.linkDiv(), this.bus.fire("operation", {
name: "finishEdit",
obj: i,
origin: n
}));
});
}, we = function(e) {
const t = A.createElement("me-epd");
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
}, W = document, k = "http://www.w3.org/2000/svg", qe = function(e, t, n) {
const o = W.createElementNS(k, "path");
return S(o, {
d: e,
stroke: t || "#666",
fill: "none",
"stroke-width": n
}), o;
}, U = function(e) {
const t = W.createElementNS(k, "svg");
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
}, Te = function() {
const e = W.createElementNS(k, "line");
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
}, kt = function(e, t, n, o) {
const i = W.createElementNS(k, "g");
return [
{
name: "line",
d: e
},
{
name: "arrow1",
d: t
},
{
name: "arrow2",
d: n
}
].forEach((r, c) => {
const u = r.d, a = W.createElementNS(k, "path"), f = {
d: u,
stroke: (o == null ? void 0 : o.stroke) || "rgb(235, 95, 82)",
fill: "none",
"stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
"stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
};
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), S(a, f), c === 0 && a.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
const h = W.createElementNS(k, "path");
S(h, {
d: u,
stroke: "transparent",
fill: "none",
"stroke-width": "15"
}), i.appendChild(h), i.appendChild(a), i[r.name] = a;
}), i;
}, ze = function(e, t, n) {
if (!t)
return;
const o = W.createElement("div");
e.nodes.appendChild(o);
const i = t.innerHTML;
o.id = "input-box", o.textContent = i, o.contentEditable = "plaintext-only", o.spellcheck = !1;
const s = t.getBBox();
o.style.cssText = `
min-width:${Math.max(88, s.width)}px;
position:absolute;
left:${s.x}px;
top:${s.y}px;
padding: 2px 4px;
margin: -2px -4px;
`, Ke(o), e.scrollIntoView(o), o.addEventListener("keydown", (r) => {
r.stopPropagation();
const c = r.key;
if (c === "Enter" || c === "Tab") {
if (r.shiftKey)
return;
r.preventDefault(), o.blur(), e.container.focus();
}
}), o.addEventListener("blur", () => {
var c;
if (!o)
return;
const r = ((c = o.textContent) == null ? void 0 : c.trim()) || "";
r === "" ? n.label = i : n.label = r, o.remove(), r !== i && (t.innerHTML = n.label, e.linkDiv(), "parent" in n ? e.bus.fire("operation", {
name: "finishEditSummary",
obj: n
}) : e.bus.fire("operation", {
name: "finishEditArrowLabel",
obj: n
}));
});
}, Tt = function(e) {
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, i = t.offsetWidth, s = t.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
this.lines.innerHTML = "";
for (let c = 0; c < r.length; c++) {
const u = r[c], a = u.querySelector("me-tpc"), { offsetLeft: f, offsetTop: h } = H(this.nodes, a), g = a.offsetWidth, d = a.offsetHeight, l = u.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: h, cL: f, cW: g, cH: d, direction: l, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, v = a.nodeObj.branchColor || m[c % m.length];
if (a.style.borderColor = v, this.lines.appendChild(qe(p, v, "3")), e && e !== u)
continue;
const b = U("subLines"), y = u.lastChild;
y.tagName === "svg" && y.remove(), u.appendChild(b), Ue(this, b, v, u, l, !0);
}
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
}, Ue = function(e, t, n, o, i, s) {
const r = o.firstChild, c = o.children[1].children;
if (c.length === 0)
return;
const u = r.offsetTop, a = r.offsetLeft, f = r.offsetWidth, h = r.offsetHeight;
for (let g = 0; g < c.length; g++) {
const d = c[g], l = d.firstChild, p = l.offsetTop, m = l.offsetLeft, v = l.offsetWidth, b = l.offsetHeight, y = l.firstChild.nodeObj.branchColor || n, E = e.generateSubBranch({ pT: u, pL: a, pW: f, pH: h, cT: p, cL: m, cW: v, cH: b, direction: i, isFirst: s });
t.appendChild(qe(E, y, "2"));
const N = l.children[1];
if (N) {
if (!N.expanded)
continue;
} else
continue;
Ue(e, t, y, d, i);
}
}, Ae = {
addChild: "插入子节点",
addParent: "插入父节点",
addSibling: "插入同级节点",
removeNode: "删除节点",
focus: "专注",
cancelFocus: "取消专注",
moveUp: "上移",
moveDown: "下移",
link: "连接",
clickTips: "请点击目标节点",
summary: "摘要"
}, Le = {
cn: Ae,
zh_CN: Ae,
zh_TW: {
addChild: "插入子節點",
addParent: "插入父節點",
addSibling: "插入同級節點",
removeNode: "刪除節點",
focus: "專注",
cancelFocus: "取消專注",
moveUp: "上移",
moveDown: "下移",
link: "連接",
clickTips: "請點擊目標節點",
summary: "摘要"
},
en: {
addChild: "Add child",
addParent: "Add parent",
addSibling: "Add sibling",
removeNode: "Remove node",
focus: "Focus Mode",
cancelFocus: "Cancel Focus Mode",
moveUp: "Move up",
moveDown: "Move down",
link: "Link",
clickTips: "Please click the target node",
summary: "Summary"
},
ru: {
addChild: "Добавить дочерний элемент",
addParent: "Добавить родительский элемент",
addSibling: "Добавить на этом уровне",
removeNode: "Удалить узел",
focus: "Режим фокусировки",
cancelFocus: "Отменить режим фокусировки",
moveUp: "Поднять выше",
moveDown: "Опустить ниже",
link: "Ссылка",
clickTips: "Пожалуйста, нажмите на целевой узел",
summary: "Описание"
},
ja: {
addChild: "子ノードを追加する",
addParent: "親ノードを追加します",
addSibling: "兄弟ノードを追加する",
removeNode: "ノードを削除",
focus: "集中",
cancelFocus: "集中解除",
moveUp: "上へ移動",
moveDown: "下へ移動",
link: "コネクト",
clickTips: "ターゲットノードをクリックしてください",
summary: "概要"
},
pt: {
addChild: "Adicionar item filho",
addParent: "Adicionar item pai",
addSibling: "Adicionar item irmao",
removeNode: "Remover item",
focus: "Modo Foco",
cancelFocus: "Cancelar Modo Foco",
moveUp: "Mover para cima",
moveDown: "Mover para baixo",
link: "Link",
clickTips: "Favor clicar no item alvo",
summary: "Resumo"
},
it: {
addChild: "Aggiungi figlio",
addParent: "Aggiungi genitore",
addSibling: "Aggiungi fratello",
removeNode: "Rimuovi nodo",
focus: "Modalità Focus",
cancelFocus: "Annulla Modalità Focus",
moveUp: "Sposta su",
moveDown: "Sposta giù",
link: "Collega",
clickTips: "Si prega di fare clic sul nodo di destinazione",
summary: "Unisci nodi"
},
es: {
addChild: "Agregar hijo",
addParent: "Agregar padre",
addSibling: "Agregar hermano",
removeNode: "Eliminar nodo",
focus: "Modo Enfoque",
cancelFocus: "Cancelar Modo Enfoque",
moveUp: "Mover hacia arriba",
moveDown: "Mover hacia abajo",
link: "Enlace",
clickTips: "Por favor haga clic en el nodo de destino",
summary: "Resumen"
},
fr: {
addChild: "Ajout enfant",
addParent: "Ajout parent",
addSibling: "Ajout voisin",
removeNode: "Supprimer",
focus: "Cibler",
cancelFocus: "Retour",
moveUp: "Monter",
moveDown: "Descendre",
link: "Lier",
clickTips: "Cliquer sur le noeud cible",
summary: "Annoter"
},
ko: {
addChild: "자식 추가",
addParent: "부모 추가",
addSibling: "형제 추가",
removeNode: "노드 삭제",
focus: "포커스 모드",
cancelFocus: "포커스 모드 취소",
moveUp: "위로 이동",
moveDown: "아래로 이동",
link: "연결",
clickTips: "대상 노드를 클릭하십시오",
summary: "요약"
}
};
function At(e, t) {
t = t === !0 ? {
focus: !0,
link: !0
} : t;
const n = (w) => {
const x = document.createElement("div");
return x.innerText = w, x.className = "tips", x;
}, o = (w, x, C) => {
const _ = document.createElement("li");
return _.id = w, _.innerHTML = `<span>${te(x)}</span><span ${C ? 'class="key"' : ""}>${te(C)}</span>`, _;
}, i = Le[e.locale] ? e.locale : "en", s = Le[i], r = o("cm-add_child", s.addChild, "Tab"), c = o("cm-add_parent", s.addParent, "Ctrl + Enter"), u = o("cm-add_sibling", s.addSibling, "Enter"), a = o("cm-remove_child", s.removeNode, "Delete"), f = o("cm-fucus", s.focus, ""), h = o("cm-unfucus", s.cancelFocus, ""), g = o("cm-up", s.moveUp, "PgUp"), d = o("cm-down", s.moveDown, "Pgdn"), l = o("cm-link", s.link, ""), p = o("cm-link-bidirectional", "Bidirectional Link", ""), m = o("cm-summary", s.summary, ""), v = document.createElement("ul");
if (v.className = "menu-list", v.appendChild(r), v.appendChild(c), v.appendChild(u), v.appendChild(a), t.focus && (v.appendChild(f), v.appendChild(h)), v.appendChild(g), v.appendChild(d), v.appendChild(m), t.link && (v.appendChild(l), v.appendChild(p)), t && t.extend)
for (let w = 0; w < t.extend.length; w++) {
const x = t.extend[w], C = o(x.name, x.name, x.key || "");
v.appendChild(C), C.onclick = (_) => {
x.onclick(_);
};
}
const b = document.createElement("div");
b.className = "context-menu", b.appendChild(v), b.hidden = !0, e.container.append(b);
let y = !0;
const E = (w) => {
const x = w.target;
if (de(x)) {
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (f.className = "disabled", g.className = "disabled", d.className = "disabled", c.className = "disabled", u.className = "disabled", a.className = "disabled") : (f.className = "", g.className = "", d.className = "", c.className = "", u.className = "", a.className = ""), b.hidden = !1, v.style.top = "", v.style.bottom = "", v.style.left = "", v.style.right = "";
const C = v.getBoundingClientRect(), _ = v.offsetHeight, O = v.offsetWidth, B = w.clientY - C.top, R = w.clientX - C.left;
_ + B > window.innerHeight ? (v.style.top = "", v.style.bottom = "0px") : (v.style.bottom = "", v.style.top = B + 15 + "px"), O + R > window.innerWidth ? (v.style.left = "", v.style.right = "0px") : (v.style.right = "", v.style.left = R + 10 + "px");
}
};
e.bus.addListener("showContextMenu", E), b.onclick = (w) => {
w.target === b && (b.hidden = !0);
}, r.onclick = () => {
e.addChild(), b.hidden = !0;
}, c.onclick = () => {
e.insertParent(), b.hidden = !0;
}, u.onclick = () => {
y || (e.insertSibling("after"), b.hidden = !0);
}, a.onclick = () => {
y || (e.removeNodes(e.currentNodes || []), b.hidden = !0);
}, f.onclick = () => {
y || (e.focusNode(e.currentNode), b.hidden = !0);
}, h.onclick = () => {
e.cancelFocus(), b.hidden = !0;
}, g.onclick = () => {
y || (e.moveUpNode(), b.hidden = !0);
}, d.onclick = () => {
y || (e.moveDownNode(), b.hidden = !0);
};
const N = (w) => {
b.hidden = !0;
const x = e.currentNode, C = n(s.clickTips);
e.container.appendChild(C), e.map.addEventListener(
"click",
(_) => {
_.preventDefault(), C.remove();
const O = _.target;
(O.parentElement.tagName === "ME-PARENT" || O.parentElement.tagName === "ME-ROOT") && e.createArrow(x, O, w);
},
{
once: !0
}
);
};
return l.onclick = () => N(), p.onclick = () => N({ bidirectional: !0 }), m.onclick = () => {
b.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
}, () => {
r.onclick = null, c.onclick = null, u.onclick = null, a.onclick = null, f.onclick = null, h.onclick = null, g.onclick = null, d.onclick = null, l.onclick = null, m.onclick = null, b.onclick = null, e.container.oncontextmenu = null;
};
}
const he = document, Lt = function(e, t) {
if (!t)
return ue(e), e;
let n = e.querySelector(".insert-preview");
const o = `insert-preview ${t} show`;
return n || (n = he.createElement("div"), e.appendChild(n)), n.className = o, e;
}, ue = function(e) {
if (!e)
return;
const t = e.querySelectorAll(".insert-preview");
for (const n of t || [])
n.remove();
}, Me = function(e, t) {
for (const n of t) {
const o = n.parentElement.parentElement.contains(e);
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent))
return !1;
}
return !0;
}, Mt = function(e) {
const t = document.createElement("div");
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
};
class Dt {
constructor(t) {
q(this, "mind");
q(this, "isMoving", !1);
q(this, "interval", null);
q(this, "speed", 20);
this.mind = t;
}
move(t, n) {
this.isMoving || (this.isMoving = !0, this.interval = setInterval(() => {
this.mind.move(t * this.speed * this.mind.scaleVal, n * this.speed * this.mind.scaleVal);
}, 100));
}
stop() {
this.isMoving = !1, clearInterval(this.interval);
}
}
function Ot(e) {
let t = null, n = null;
const o = Mt(e), i = new Dt(e), s = (a) => {
e.selection.cancel();
const f = a.target;
if ((f == null ? void 0 : f.tagName) !== "ME-TPC") {
a.preventDefault();
return;
}
let h = e.currentNodes;
h != null && h.includes(f) || (e.selectNode(f), h = e.currentNodes), e.dragged = h, h.length > 1 ? o.innerHTML = h.length + "" : o.innerHTML = f.innerHTML;
for (const g of h)
g.parentElement.parentElement.style.opacity = "0.5";
a.dataTransfer.setDragImage(o, 0, 0), a.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
}, r = (a) => {
const { dragged: f } = e;
if (!f)
return;
i.stop();
for (const g of f)
g.parentElement.parentElement.style.opacity = "1";
const h = a.target;
h.style.opacity = "", n && (ue(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null);
}, c = (a) => {
a.preventDefault();
const f = 12 * e.scaleVal, { dragged: h } = e;
if (!h)
return;
const g = e.container.getBoundingClientRect();
a.clientX < g.x + 50 ? i.move(1, 0) : a.clientX > g.x + g.width - 50 ? i.move(-1, 0) : a.clientY < g.y + 50 ? i.move(0, 1) : a.clientY > g.y + g.height - 50 ? i.move(0, -1) : i.stop(), ue(n);
const d = he.elementFromPoint(a.clientX, a.clientY - f);
if (Me(d, h)) {
n = d;
const l = d.getBoundingClientRect(), p = l.y;
a.clientY > p + l.height ? t = "after" : t = "in";
} else {
const l = he.elementFromPoint(a.clientX, a.clientY + f), p = l.getBoundingClientRect();
if (Me(l, h)) {
n = l;
const m = p.y;
a.clientY < m ? t = "before" : t = "in";
} else
t = n = null;
}
n && Lt(n, t);
};
return be([
{ dom: e.map, evt: "dragstart", func: s },
{ dom: e.map, evt: "dragend", func: r },
{ dom: e.map, evt: "dragover", func: c }
]);
}
const jt = function(e) {
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
type: "summary",
value: e.obj.id
} : ["createArrow", "removeArrow", "finishEditArrowLabel"].includes(e.name) ? {
type: "arrow",
value: e.obj.id
} : ["removeNodes", "copyNodes", "moveNodeBefore", "moveNodeAfter", "moveNodeIn"].includes(e.name) ? {
type: "nodes",
value: e.objs.map((t) => t.id)
} : {
type: "node",
value: e.obj.id
};
};
function Pt(e) {
let t = [], n = -1, o = e.getData();
e.undo = function() {
if (n > -1) {
const r = t[n];
o = r.prev, e.refresh(r.prev);
try {
r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && e.selectNodes(r.currentObject.value.map((c) => this.findEle(c)));
} catch {
} finally {
n--;
}
}
}, e.redo = function() {
if (n < t.length - 1) {
n++;
const r = t[n];
o = r.next, e.refresh(r.next), r.currentObject.type === "node" ? e.selectNode(this.findEle(r.currentObject.value)) : r.currentObject.type === "nodes" && (e.unselectNodes(this.currentNodes), e.selectNodes(r.currentObject.value.map((c) => this.findEle(c))));
}
};
const i = function(r) {
if (r.name === "beginEdit")
return;
t = t.slice(0, n + 1);
const c = e.getData();
t.push({ prev: o, currentObject: jt(r), next: c }), o = c, n = t.length - 1;
}, s = function(r) {
(r.metaKey || r.ctrlKey) && (r.shiftKey && r.key === "Z" || r.key === "y") ? e.redo() : (r.metaKey || r.ctrlKey) && r.key === "z" && e.undo();
};
return e.bus.addListener("operation", i), e.map.addEventListener("keydown", s), () => {
e.bus.removeListener("operation", i), e.map.removeEventListener("keydown", s);
};
}
const $t = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', Ht = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Bt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', Rt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Ft = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', It = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', Wt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>';
const Vt = {
side: $t,
left: Ht,
right: Bt,
full: Rt,
living: Ft,
zoomin: It,
zoomout: Wt
}, I = (e, t) => {
const n = document.createElement("span");
return n.id = e, n.innerHTML = Vt[t], n;
};
function Yt(e) {
const t = document.createElement("div"), n = I("fullscreen", "full"), o = I("toCenter", "living"), i = I("zoomout", "zoomout"), s = I("zoomin", "zoomin"), r = document.createElement("span");
return r.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(i), t.appendChild(s), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
}, o.onclick = () => {
e.toCenter();
}, i.onclick = () => {
e.scaleVal < 0.6 || e.scale(e.scaleVal - e.scaleSensitivity);
}, s.onclick = () => {
e.scaleVal > 1.6 || e.scale(e.scaleVal + e.scaleSensitivity);
}, t;
}
function Gt(e) {
const t = document.createElement("div"), n = I("tbltl", "left"), o = I("tbltr", "right"), i = I("tblts", "side");
return t.appendChild(n), t.appendChild(o), t.appendChild(i), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
e.initLeft();
}, o.onclick = () => {
e.initRight();
}, i.onclick = () => {
e.initSide();
}, t;
}
function Kt(e) {
e.container.append(Yt(e)), e.container.append(Gt(e));
}
/*! @viselect/vanilla v3.9.0 MIT | https://github.com/Simonwep/selection/tree/master/packages/vanilla */
class qt {
constructor() {
this._listeners = /* @__PURE__ */ new Map(), this.on = this.addEventListener, this.off = this.removeEventListener, this.emit = this.dispatchEvent;
}
addEventListener(t, n) {
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
return this._listeners.set(t, o), o.add(n), this;
}
removeEventListener(t, n) {
var o;
return (o = this._listeners.get(t)) == null || o.delete(n), this;
}
dispatchEvent(t, ...n) {
let o = !0;
for (const i of this._listeners.get(t) ?? [])
o = i(...n) !== !1 && o;
return o;
}
unbindAllListeners() {
this._listeners.clear();
}
}
const De = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e }, t, n) => {
if (typeof t == "object")
for (const [o, i] of Object.entries(t))
i !== void 0 && (e[o] = De(i));
else
n !== void 0 && (e[t] = De(n));
}, Oe = (e = 0, t = 0, n = 0, o = 0) => {
const i = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
return { ...i, toJSON: () => JSON.stringify(i) };
}, zt = (e) => {
let t, n = -1, o = !1;
return {
next: (...i) => {
t = i, o || (o = !0, n = requestAnimationFrame(() => {
e(...t), o = !1;
}));
},
cancel: () => {
cancelAnimationFrame(n), o = !1;
}
};
}, je = (e, t, n = "touch") => {
switch (n) {
case "center": {
const o = t.left + t.width / 2, i = t.top + t.height / 2;
return o >= e.left && o <= e.right && i >= e.top && i <= e.bottom;
}
case "cover":
return t.left >= e.left && t.top >= e.top && t.right <= e.right && t.bottom <= e.bottom;
case "touch":
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
}
}, Ut = () => matchMedia("(hover: none), (pointer: coarse)").matches, Xt = () => "safari" in window, fe = (e) => Array.isArray(e) ? e : [e], Xe = (e) => (t, n, o, i = {}) => {
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = fe(n), t = fe(t);
for (const s of t)
if (s)
for (const r of n)
s[e](r, o, { capture: !1, ...i });
}, P = Xe("addEventListener"), L = Xe("removeEventListener"), J = (e) => {
var t;
const { clientX: n, clientY: o, target: i } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
return { x: n, y: o, target: i };
}, Y = (e, t = document) => fe(e).map(
(n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
).flat().filter(Boolean), Jt = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
switch (o) {
case "alt":
return e.altKey;
case "ctrl":
return e.ctrlKey || e.metaKey;
case "shift":
return e.shiftKey;
}
}) : !1), { abs: F, max: Pe, min: $e, ceil: He } = Math, Be = (e = []) => ({
stored: e,
selected: [],
touched: [],
changed: { added: [], removed: [] }
}), Je = class extends qt {
constructor(t) {
var n, o, i, s, r;
super(), this._selection = Be(), this._targetBoundaryScrolled = !0, this._selectables = [], this._areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 }, this._areaRect = Oe(), this._singleClick = !0, this._scrollAvailable = !0, this._scrollingActive = !1, this._scrollSpeed = { x: 0, y: 0 }, this._scrollDelta = { x: 0, y: 0 }, this._lastMousePosition = { x: 0, y: 0 }, this.enable = this._toggleStartEvents, this.disable = this._toggleStartEvents.bind(this, !1), this._options = {
selectionAreaClass: "selection-area",
selectionContainerClass: void 0,
selectables: [],
document: window.document,
startAreas: ["html"],
boundaries: ["html"],
container: "body",
...t,
behaviour: {
overlap: "invert",
intersect: "touch",
triggers: [0],
...t.behaviour,
startThreshold: (n = t.behaviour) != null && n.startThreshold ? typeof t.behaviour.startThreshold == "number" ? t.behaviour.startThreshold : { x: 10, y: 10, ...t.behaviour.startThreshold } : { x: 10, y: 10 },
scrolling: {
speedDivider: 10,
manualSpeed: 750,
...(o = t.behaviour) == null ? void 0 : o.scrolling,
startScrollMargins: {
x: 0,
y: 0,
...(s = (i = t.behaviour) == null ? void 0 : i.scrolling) == null ? void 0 : s.startScrollMargins
}
}
},
features: {
range: !0,
touch: !0,
deselectOnBlur: !1,
...t.features,
singleTap: {
allow: !0,
intersect: "native",
...(r = t.features) == null ? void 0 : r.singleTap
}
}
};
for (const f of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
typeof this[f] == "function" && (this[f] = this[f].bind(this));
const { document: c, selectionAreaClass: u, selectionContainerClass: a } = this._options;
this._area = c.createElement("div"), this._clippingElement = c.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(u), a && this._clippingElement.classList.add(a), j(this._area, {
willChange: "top, left, bottom, right, width, height",
top: 0,
left: 0,
position: "fixed"
}), j(this._clippingElement, {
overflow: "hidden",
position: "fixed",
transform: "translate3d(0, 0, 0)",
// https://stackoverflow.com/a/38268846
pointerEvents: "none",
zIndex: "1"
}), this._frame = zt((f) => {
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", f), this._redrawSelectionArea();
}), this.enable();
}
_toggleStartEvents(t = !0) {
const { document: n, features: o } = this._options, i = t ? P : L;
i(n, "mousedown", this._onTapStart), o.touch && i(n, "touchstart", this._onTapStart, { passive: !1 });
}
_onTapStart(t, n = !1) {
const { x: o, y: i, target: s } = J(t), { document: r, startAreas: c, boundaries: u, features: a, behaviour: f } = this._options, h = s.getBoundingClientRect();
if (t instanceof MouseEvent && !Jt(t, f.triggers))
return;
const g = Y(c, r), d = Y(u, r);
this._targetElement = d.find(
(v) => je(v.getBoundingClientRect(), h)
);
const l = t.composedPath(), p = g.find((v) => l.includes(v));
if (this._targetBoundary = d.find((v) => l.includes(v)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("be