UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

1,265 lines 142 kB
import { n as $ } from "./chunk-Y2CYZVJY-0JxdZxki.js"; import { m as F, p as U } from "./src-DtRLxcYO.js"; import { A as Ps, B as sa, M as jt, T as it, b as Pt, g as mt, x as J, z as ea } from "./chunk-WYO6CB5R-DDHkKowO.js"; import { a as Nt, r as Ct, u as K } from "./chunk-ICXQ74PX-DR8rL-xF.js"; import { t as Rt } from "./chunk-HOUHSVGY-DRQcQeMT.js"; import { n as gt } from "./chunk-Q4XR5HBZ-3BHjjc9u.js"; import { n as ia, t as Ds } from "./chunk-OGEWGWER-BV51ll2w.js"; import { a as H, i as W, r as Bs, t as At } from "./chunk-C7G6YPKG-CA-DNpvI.js"; import { t as I } from "./rough.esm-BWe9E0Nz.js"; var _ = /* @__PURE__ */ $(async (d, t, g) => { let h; const r = t.useHtmlLabels || mt(J()?.htmlLabels); g ? h = g : h = "node default"; const l = d.insert("g").attr("class", h).attr("id", t.domId || t.id), f = l.insert("g").attr("class", "label").attr("style", K(t.labelStyle)); let i; t.label === void 0 ? i = "" : i = typeof t.label == "string" ? t.label : t.label[0]; const n = !!t.icon || !!t.img, e = t.labelType === "markdown", a = await gt(f, ea(Nt(i), J()), { useHtmlLabels: r, width: t.width || J().flowchart?.wrappingWidth, classes: e ? "markdown-node-label" : "", style: t.labelStyle, addSvgBackground: n, markdown: e }, J()); let s = a.getBBox(); const o = (t?.padding ?? 0) / 2; if (r) { const c = a.children[0], y = U(a); await Ds(c, i), s = c.getBoundingClientRect(), y.attr("width", s.width), y.attr("height", s.height); } return r ? f.attr("transform", "translate(" + -s.width / 2 + ", " + -s.height / 2 + ")") : f.attr("transform", "translate(0, " + -s.height / 2 + ")"), t.centerLabel && f.attr("transform", "translate(" + -s.width / 2 + ", " + -s.height / 2 + ")"), f.insert("rect", ":first-child"), { shapeSvg: l, bbox: s, halfPadding: o, label: f }; }, "labelHelper"), Lt = /* @__PURE__ */ $(async (d, t, g) => { const h = g.useHtmlLabels ?? it(J()), r = d.insert("g").attr("class", "label").attr("style", g.labelStyle || ""), l = await gt(r, ea(Nt(t), J()), { useHtmlLabels: h, width: g.width || J()?.flowchart?.wrappingWidth, style: g.labelStyle, addSvgBackground: !!g.icon || !!g.img }); let f = l.getBBox(); const i = g.padding / 2; if (it(J())) { const n = l.children[0], e = U(l); f = n.getBoundingClientRect(), e.attr("width", f.width), e.attr("height", f.height); } return h ? r.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")") : r.attr("transform", "translate(0, " + -f.height / 2 + ")"), g.centerLabel && r.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), r.insert("rect", ":first-child"), { shapeSvg: d, bbox: f, halfPadding: i, label: r }; }, "insertLabel"), E = /* @__PURE__ */ $((d, t) => { const g = t.node().getBBox(); d.width = g.width, d.height = g.height; }, "updateNodeBounds"), Y = /* @__PURE__ */ $((d, t) => (d.look === "handDrawn" ? "rough-node" : "node") + " " + d.cssClasses + " " + (t || ""), "getNodeClasses"); function j(d) { const t = d.map((g, h) => `${h === 0 ? "M" : "L"}${g.x},${g.y}`); return t.push("Z"), t.join(" "); } $(j, "createPathFromPoints"); function pt(d, t, g, h, r, l) { const f = [], n = g - d, e = h - t, a = n / l, s = 2 * Math.PI / a, o = t + e / 2; for (let c = 0; c <= 50; c++) { const y = d + c / 50 * n, p = o + r * Math.sin(s * (y - d)); f.push({ x: y, y: p }); } return f; } $(pt, "generateFullSineWavePoints"); function Dt(d, t, g, h, r, l) { const f = [], i = r * Math.PI / 180, n = (l * Math.PI / 180 - i) / (h - 1); for (let e = 0; e < h; e++) { const a = i + e * n, s = d + g * Math.cos(a), o = t + g * Math.sin(a); f.push({ x: -s, y: -o }); } return f; } $(Dt, "generateCirclePoints"); function Wt(d) { const t = Array.from(d.childNodes).filter((n) => n.tagName === "path"), g = document.createElementNS("http://www.w3.org/2000/svg", "path"), h = t.map((n) => n.getAttribute("d")).filter((n) => n !== null).join(" "); g.setAttribute("d", h); const r = t.find((n) => n.getAttribute("fill") !== "none"), l = t.find((n) => n.getAttribute("stroke") !== "none"), f = /* @__PURE__ */ $((n, e) => n?.getAttribute(e) ?? void 0, "getAttr"); if (r) { const n = { fill: f(r, "fill"), "fill-opacity": f(r, "fill-opacity") ?? "1" }; Object.entries(n).forEach(([e, a]) => { a && g.setAttribute(e, a); }); } if (l) { const n = { stroke: f(l, "stroke"), "stroke-width": f(l, "stroke-width") ?? "1", "stroke-opacity": f(l, "stroke-opacity") ?? "1" }; Object.entries(n).forEach(([e, a]) => { a && g.setAttribute(e, a); }); } const i = document.createElementNS("http://www.w3.org/2000/svg", "g"); return i.appendChild(g), i; } $(Wt, "mergePaths"); var wt = /* @__PURE__ */ $((d, t) => { var g = d.x, h = d.y, r = t.x - g, l = t.y - h, f = d.width / 2, i = d.height / 2, n, e; return Math.abs(l) * f > Math.abs(r) * i ? (l < 0 && (i = -i), n = l === 0 ? 0 : i * r / l, e = i) : (r < 0 && (f = -f), n = f, e = r === 0 ? 0 : f * l / r), { x: g + n, y: h + e }; }, "intersectRect"), Mt = /* @__PURE__ */ $(async (d, t, g, h = !1, r = !1) => { let l = t || ""; typeof l == "object" && (l = l[0]); const f = J(), i = it(f); return await gt(d, l, { style: g, isTitle: h, useHtmlLabels: i, markdown: !1, isNode: r, width: Number.POSITIVE_INFINITY }, f); }, "createLabel"), dt = /* @__PURE__ */ $((d, t, g, h, r) => [ "M", d + r, t, "H", d + g - r, "A", r, r, 0, 0, 1, d + g, t + r, "V", t + h - r, "A", r, r, 0, 0, 1, d + g - r, t + h, "H", d + r, "A", r, r, 0, 0, 1, d, t + h - r, "V", t + r, "A", r, r, 0, 0, 1, d + r, t, "Z" ].join(" "), "createRoundedRectPathD"), Ms = /* @__PURE__ */ $(async (d, t) => { const g = J(), { themeVariables: h, handDrawnSeed: r } = g, { clusterBkg: l, clusterBorder: f } = h, i = f, { labelStyles: n, nodeStyles: e, borderStyles: a, backgroundStyles: s } = W(t), o = d.insert("g").attr("class", "cluster swimlane " + (t.cssClasses || "")).attr("id", t.id).attr("data-id", t.id).attr("data-et", "cluster").attr("data-look", t.look), c = mt(g.flowchart.htmlLabels), y = t.direction === "LR", p = o.insert("g").attr("class", "cluster-label swimlane-label"), w = await gt(p, t.label, { style: t.labelStyle, useHtmlLabels: c, isNode: !0, width: t.width }); let u = w.getBBox(); if (c) { const N = w.children[0], M = U(w); u = N.getBoundingClientRect(), M.attr("width", u.width), M.attr("height", u.height); } const m = t.padding ?? 0, x = t.width <= u.width + m ? u.width + m : t.width; t.width <= u.width + m ? t.diff = (x - t.width) / 2 - m : t.diff = -m; const S = t.height, b = t.y - S / 2, D = t.y + S / 2, k = t.x - x / 2, v = t.swimlaneContentTop !== void 0 ? t.swimlaneContentTop : b + S / 3, B = y ? 4 : 0, A = u.height + 2 * B; let L, X; if (y) { const N = Math.max(A, u.height + 2 * B), M = k + N, P = Math.max(0, x - N); if (t.look === "handDrawn") { const G = I.svg(o), z = H(t, { roughness: 0.7, fill: l, stroke: i, fillWeight: 3, seed: r }), V = H(t, { roughness: 0.7, fill: "none", stroke: i, seed: r }), rt = G.rectangle(k, b, N, S, z); L = o.insert(() => rt, ":first-child"); const st = G.rectangle(M, b, P, S, V); X = o.insert(() => st, ":first-child"), L.select("path:nth-child(2)").attr("style", a.join(";")), L.select("path").attr("style", s.join(";").replace("fill", "stroke")); } else L = o.insert("rect", ":first-child"), X = o.insert("rect", ":first-child"), L.attr("class", "swimlane-title").attr("style", e).attr("x", k).attr("y", b).attr("width", N).attr("height", S).attr("fill", l).attr("stroke", i), X.attr("class", "swimlane-body").attr("style", e).attr("x", M).attr("y", b).attr("width", P).attr("height", S).attr("fill", "none").attr("stroke", i); const T = k + N / 2, C = t.y; p.attr("transform", `translate(${T}, ${C}) rotate(-90) translate(${-u.width / 2}, ${-u.height / 2})`); } else { const N = Math.max(0, v - b), M = Math.min(A, N), P = b + M, T = Math.max(0, D - P), C = t.x - x / 2; if (t.look === "handDrawn") { const V = I.svg(o), rt = H(t, { roughness: 0.7, fill: l, stroke: i, fillWeight: 3, seed: r }), st = H(t, { roughness: 0.7, fill: "none", stroke: i, seed: r }), nt = V.rectangle(C, b, x, M, rt); L = o.insert(() => nt, ":first-child"); const at = V.rectangle(C, P, x, T, st); X = o.insert(() => at, ":first-child"), L.select("path:nth-child(2)").attr("style", a.join(";")), L.select("path").attr("style", s.join(";").replace("fill", "stroke")); } else L = o.insert("rect", ":first-child"), X = o.insert("rect", ":first-child"), L.attr("class", "swimlane-title").attr("style", e).attr("x", C).attr("y", b).attr("width", x).attr("height", M).attr("fill", l).attr("stroke", i), X.attr("class", "swimlane-body").attr("style", e).attr("x", C).attr("y", P).attr("width", x).attr("height", T).attr("fill", "none").attr("stroke", i); const G = t.x - u.width / 2, z = b + (M - u.height) / 2; p.attr("transform", `translate(${G}, ${z})`); } if (F.trace("Swimlane data ", t, JSON.stringify(t)), n) { const N = p.select("span"); N && N.attr("style", n); } return t.offsetX = 0, t.width = x, t.height = S, t.offsetY = u.height - m / 2, t.intersect = function(N) { return wt(t, N); }, { cluster: o, labelBBox: u }; }, "swimlane"), Gt = /* @__PURE__ */ $(async (d, t) => { F.info("Creating subgraph rect for ", t.id, t); const g = J(), { themeVariables: h, handDrawnSeed: r } = g, { clusterBkg: l, clusterBorder: f } = h, { labelStyles: i, nodeStyles: n, borderStyles: e, backgroundStyles: a } = W(t), s = d.insert("g").attr("class", "cluster " + t.cssClasses).attr("id", t.domId).attr("data-look", t.look), o = it(g), c = s.insert("g").attr("class", "cluster-label "); let y; t.labelType === "markdown" ? y = await gt(c, t.label, { style: t.labelStyle, useHtmlLabels: o, isNode: !0, width: t.width }) : y = await Mt(c, t.label, t.labelStyle || "", !1, !0); let p = y.getBBox(); if (it(g)) { const k = y.children[0], v = U(y); p = k.getBoundingClientRect(), v.attr("width", p.width), v.attr("height", p.height); } const w = t.width <= p.width + t.padding ? p.width + t.padding : t.width; t.width <= p.width + t.padding ? t.diff = (w - t.width) / 2 - t.padding : t.diff = -t.padding; const u = t.height, m = t.x - w / 2, x = t.y - u / 2; F.trace("Data ", t, JSON.stringify(t)); let S; if (t.look === "handDrawn") { const k = I.svg(s), v = H(t, { roughness: 0.7, fill: l, stroke: f, fillWeight: 3, seed: r }), B = k.path(dt(m, x, w, u, 0), v); S = s.insert(() => (F.debug("Rough node insert CXC", B), B), ":first-child"), S.select("path:nth-child(2)").attr("style", e.join(";")), S.select("path").attr("style", a.join(";").replace("fill", "stroke")); } else S = s.insert("rect", ":first-child"), S.attr("style", n).attr("rx", t.rx).attr("ry", t.ry).attr("x", m).attr("y", x).attr("width", w).attr("height", u); const { subGraphTitleTopMargin: b } = ia(g); if (c.attr("transform", `translate(${t.x - p.width / 2}, ${t.y - t.height / 2 + b})`), i) { const k = c.select("span"); k && k.attr("style", i); } const D = S.node().getBBox(); return t.offsetX = 0, t.width = D.width, t.height = D.height, t.offsetY = p.height - t.padding / 2, t.intersect = function(k) { return wt(t, k); }, { cluster: s, labelBBox: p }; }, "rect"), Ns = { rect: Gt, squareRect: Gt, roundedWithTitle: /* @__PURE__ */ $(async (d, t) => { const g = J(), { themeVariables: h, handDrawnSeed: r } = g, { altBackground: l, compositeBackground: f, compositeTitleBackground: i, nodeBorder: n } = h, e = d.insert("g").attr("class", t.cssClasses).attr("id", t.domId).attr("data-id", t.id).attr("data-look", t.look), a = e.insert("g", ":first-child"), s = e.insert("g").attr("class", "cluster-label"); let o = e.append("rect"); const c = await Mt(s, t.label, t.labelStyle, void 0, !0); let y = c.getBBox(); if (it(g)) { const v = c.children[0], B = U(c); y = v.getBoundingClientRect(), B.attr("width", y.width), B.attr("height", y.height); } const p = 0 * t.padding, w = p / 2, u = (t.width <= y.width + t.padding ? y.width + t.padding : t.width) + p; t.width <= y.width + t.padding ? t.diff = (u - t.width) / 2 - t.padding : t.diff = -t.padding; const m = t.height + p, x = t.height + p - y.height - 6, S = t.x - u / 2, b = t.y - m / 2; t.width = u; const D = t.y - t.height / 2 - w + y.height + 2; let k; if (t.look === "handDrawn") { const v = t.cssClasses.includes("statediagram-cluster-alt"), B = I.svg(e), A = t.rx || t.ry ? B.path(dt(S, b, u, m, 10), { roughness: 0.7, fill: i, fillStyle: "solid", stroke: n, seed: r }) : B.rectangle(S, b, u, m, { seed: r }); k = e.insert(() => A, ":first-child"); const L = B.rectangle(S, D, u, x, { fill: v ? l : f, fillStyle: v ? "hachure" : "solid", stroke: n, seed: r }); k = e.insert(() => A, ":first-child"), o = e.insert(() => L); } else k = a.insert("rect", ":first-child"), k.attr("class", "outer").attr("x", S).attr("y", b).attr("width", u).attr("height", m).attr("data-look", t.look), o.attr("class", "inner").attr("x", S).attr("y", D).attr("width", u).attr("height", x); return s.attr("transform", `translate(${t.x - y.width / 2}, ${b + 1 - (it(g) ? 0 : 3)})`), t.height = k.node().getBBox().height, t.offsetX = 0, t.offsetY = y.height - t.padding / 2, t.labelBBox = y, t.intersect = function(v) { return wt(t, v); }, { cluster: e, labelBBox: y }; }, "roundedWithTitle"), noteGroup: /* @__PURE__ */ $((d, t) => { const g = d.insert("g").attr("class", "note-cluster").attr("id", t.domId), h = g.insert("rect", ":first-child"), r = 0 * t.padding, l = r / 2; h.attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - t.width / 2 - l).attr("y", t.y - t.height / 2 - l).attr("width", t.width + r).attr("height", t.height + r).attr("fill", "none"); const f = h.node().getBBox(); return t.width = f.width, t.height = f.height, t.intersect = function(i) { return wt(t, i); }, { cluster: g, labelBBox: { width: 0, height: 0 } }; }, "noteGroup"), divider: /* @__PURE__ */ $((d, t) => { const { themeVariables: g, handDrawnSeed: h } = J(), { nodeBorder: r } = g, l = d.insert("g").attr("class", t.cssClasses).attr("id", t.domId).attr("data-look", t.look), f = l.insert("g", ":first-child"), i = 0 * t.padding, n = t.width + i; t.diff = -t.padding; const e = t.height + i, a = t.x - n / 2, s = t.y - e / 2; t.width = n; let o; if (t.look === "handDrawn") { const c = I.svg(l).rectangle(a, s, n, e, { fill: "lightgrey", roughness: 0.5, strokeLineDash: [5], stroke: r, seed: h }); o = l.insert(() => c, ":first-child"); } else { o = f.insert("rect", ":first-child"); let c = "outer"; t.look, c = "divider", o.attr("class", c).attr("x", a).attr("y", s).attr("width", n).attr("height", e).attr("data-look", t.look); } return t.height = o.node().getBBox().height, t.offsetX = 0, t.offsetY = 0, t.intersect = function(c) { return wt(t, c); }, { cluster: l, labelBBox: {} }; }, "divider"), kanbanSection: /* @__PURE__ */ $(async (d, t) => { F.info("Creating subgraph rect for ", t.id, t); const g = J(), { themeVariables: h, handDrawnSeed: r } = g, { clusterBkg: l, clusterBorder: f } = h, { labelStyles: i, nodeStyles: n, borderStyles: e, backgroundStyles: a } = W(t), s = d.insert("g").attr("class", "cluster " + t.cssClasses).attr("id", t.domId).attr("data-look", t.look), o = it(g), c = s.insert("g").attr("class", "cluster-label "), y = await gt(c, t.label, { style: t.labelStyle, useHtmlLabels: o, isNode: !0, width: t.width }); let p = y.getBBox(); if (it(g)) { const k = y.children[0], v = U(y); p = k.getBoundingClientRect(), v.attr("width", p.width), v.attr("height", p.height); } const w = t.width <= p.width + t.padding ? p.width + t.padding : t.width; t.width <= p.width + t.padding ? t.diff = (w - t.width) / 2 - t.padding : t.diff = -t.padding; const u = t.height, m = t.x - w / 2, x = t.y - u / 2; F.trace("Data ", t, JSON.stringify(t)); let S; if (t.look === "handDrawn") { const k = I.svg(s), v = H(t, { roughness: 0.7, fill: l, stroke: f, fillWeight: 4, seed: r }), B = k.path(dt(m, x, w, u, t.rx), v); S = s.insert(() => (F.debug("Rough node insert CXC", B), B), ":first-child"), S.select("path:nth-child(2)").attr("style", e.join(";")), S.select("path").attr("style", a.join(";").replace("fill", "stroke")); } else S = s.insert("rect", ":first-child"), S.attr("style", n).attr("rx", t.rx).attr("ry", t.ry).attr("x", m).attr("y", x).attr("width", w).attr("height", u); const { subGraphTitleTopMargin: b } = ia(g); if (c.attr("transform", `translate(${t.x - p.width / 2}, ${t.y - t.height / 2 + b})`), i) { const k = c.select("span"); k && k.attr("style", i); } const D = S.node().getBBox(); return t.offsetX = 0, t.width = D.width, t.height = D.height, t.offsetY = p.height - t.padding / 2, t.intersect = function(k) { return wt(t, k); }, { cluster: s, labelBBox: p }; }, "kanbanSection"), swimlane: Ms }, la = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ $(async (d, t) => { const g = await Ns[t.shape || "rect"](d, t); return la.set(t.id, g), g; }, "insertCluster"), le = /* @__PURE__ */ $(() => { la = /* @__PURE__ */ new Map(); }, "clear"); function ra(d, t) { return d.intersect(t); } $(ra, "intersectNode"); var Cs = ra; function na(d, t, g, h) { var r = d.x, l = d.y, f = r - h.x, i = l - h.y, n = Math.sqrt(t * t * i * i + g * g * f * f), e = Math.abs(t * g * f / n); h.x < r && (e = -e); var a = Math.abs(t * g * i / n); return h.y < l && (a = -a), { x: r + e, y: l + a }; } $(na, "intersectEllipse"); var ca = na; function oa(d, t, g) { return ca(d, t, t, g); } $(oa, "intersectCircle"); var Rs = oa; function ha(d, t, g, h) { { const r = t.y - d.y, l = d.x - t.x, f = t.x * d.y - d.x * t.y, i = r * g.x + l * g.y + f, n = r * h.x + l * h.y + f, e = 1e-6; if (i !== 0 && n !== 0 && Et(i, n)) return; const a = h.y - g.y, s = g.x - h.x, o = h.x * g.y - g.x * h.y, c = a * d.x + s * d.y + o, y = a * t.x + s * t.y + o; if (Math.abs(c) < e && Math.abs(y) < e && Et(c, y)) return; const p = r * s - a * l; if (p === 0) return; const w = Math.abs(p / 2); let u = l * o - s * f; const m = u < 0 ? (u - w) / p : (u + w) / p; return u = a * f - r * o, { x: m, y: u < 0 ? (u - w) / p : (u + w) / p }; } } $(ha, "intersectLine"); function Et(d, t) { return d * t > 0; } $(Et, "sameSign"); var As = ha; function ga(d, t, g) { let h = d.x, r = d.y, l = [], f = Number.POSITIVE_INFINITY, i = Number.POSITIVE_INFINITY; typeof t.forEach == "function" ? t.forEach(function(a) { f = Math.min(f, a.x), i = Math.min(i, a.y); }) : (f = Math.min(f, t.x), i = Math.min(i, t.y)); let n = h - d.width / 2 - f, e = r - d.height / 2 - i; for (let a = 0; a < t.length; a++) { let s = t[a], o = t[a < t.length - 1 ? a + 1 : 0], c = As(d, g, { x: n + s.x, y: e + s.y }, { x: n + o.x, y: e + o.y }); c && l.push(c); } return l.length ? (l.length > 1 && l.sort(function(a, s) { let o = a.x - g.x, c = a.y - g.y, y = Math.sqrt(o * o + c * c), p = s.x - g.x, w = s.y - g.y, u = Math.sqrt(p * p + w * w); return y < u ? -1 : y === u ? 0 : 1; }), l[0]) : d; } $(ga, "intersectPolygon"); var R = { node: Cs, circle: Rs, ellipse: ca, polygon: ga, rect: wt }; function fa(d, t) { const { labelStyles: g } = W(t); t.labelStyle = g; const h = Y(t); let r = h; h || (r = "anchor"); const l = d.insert("g").attr("class", r).attr("id", t.domId || t.id), f = 1, { cssStyles: i } = t, n = I.svg(l), e = H(t, { fill: "black", stroke: "none", fillStyle: "solid" }); t.look !== "handDrawn" && (e.roughness = 0); const a = n.circle(0, 0, f * 2, e), s = l.insert(() => a, ":first-child"); return s.attr("class", "anchor").attr("style", K(i)), E(t, s), t.intersect = function(o) { return F.info("Circle intersect", t, f, o), R.circle(t, f, o); }, l; } $(fa, "anchor"); function Xt(d, t, g, h, r, l, f) { const n = (d + g) / 2, e = (t + h) / 2, a = Math.atan2(h - t, g - d), s = (g - d) / 2, o = (h - t) / 2, c = s / r, y = o / l, p = Math.sqrt(c ** 2 + y ** 2); if (p > 1) throw new Error("The given radii are too small to create an arc between the points."); const w = Math.sqrt(1 - p ** 2), u = n + w * l * Math.sin(a) * (f ? -1 : 1), m = e - w * r * Math.cos(a) * (f ? -1 : 1), x = Math.atan2((t - m) / l, (d - u) / r); let S = Math.atan2((h - m) / l, (g - u) / r) - x; f && S < 0 && (S += 2 * Math.PI), !f && S > 0 && (S -= 2 * Math.PI); const b = []; for (let D = 0; D < 20; D++) { const k = x + D / 19 * S, v = u + r * Math.cos(k), B = m + l * Math.sin(k); b.push({ x: v, y: B }); } return b; } $(Xt, "generateArcPoints"); function ya(d, t, g) { const [h, r] = [t, g].sort((l, f) => f - l); return r * (1 - Math.sqrt(1 - (d / h / 2) ** 2)); } $(ya, "calculateArcSagitta"); async function pa(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = t.padding ?? 0, l = t.look === "neo" ? 16 : r, f = t.look === "neo" ? 12 : r, i = /* @__PURE__ */ $((v) => v + f, "calcTotalHeight"), n = /* @__PURE__ */ $((v) => { const B = v / 2; return [B / (2.5 + v / 50), B]; }, "calcEllipseRadius"), { shapeSvg: e, bbox: a } = await _(d, t, Y(t)), s = i(t?.height ? t?.height : a.height), [o, c] = n(s), y = ya(s, o, c), p = (t?.width ? t?.width : a.width) + l * 2 + y - y, w = s, { cssStyles: u } = t, m = [ { x: p / 2, y: -w / 2 }, { x: -p / 2, y: -w / 2 }, ...Xt(-p / 2, -w / 2, -p / 2, w / 2, o, c, !1), { x: p / 2, y: w / 2 }, ...Xt(p / 2, w / 2, p / 2, -w / 2, o, c, !0) ], x = I.svg(e), S = H(t, {}); t.look !== "handDrawn" && (S.roughness = 0, S.fillStyle = "solid"); const b = j(m), D = x.path(b, S), k = e.insert(() => D, ":first-child"); return k.attr("class", "basic label-container outer-path"), u && t.look !== "handDrawn" && k.selectAll("path").attr("style", u), h && t.look !== "handDrawn" && k.selectAll("path").attr("style", h), k.attr("transform", `translate(${o / 2}, 0)`), E(t, k), t.intersect = function(v) { return R.polygon(t, m, v); }, e; } $(pa, "bowTieRect"); function ft(d, t, g, h) { return d.insert("polygon", ":first-child").attr("points", h.map(function(r) { return r.x + "," + r.y; }).join(" ")).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + g / 2 + ")"); } $(ft, "insertPolygonShape"); var Bt = 12; async function da(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = t.padding ?? 0, l = t.look === "neo" ? 28 : r, f = t.look === "neo" ? 24 : r, { shapeSvg: i, bbox: n } = await _(d, t, Y(t)), e = (t?.width ?? n.width) + (t.look === "neo" ? l * 2 : l + Bt), a = (t?.height ?? n.height) + (t.look === "neo" ? f * 2 : f), s = 0, o = e, c = -a, y = 0, p = [ { x: s + Bt, y: c }, { x: o, y: c }, { x: o, y }, { x: s, y }, { x: s, y: c + Bt }, { x: s + Bt, y: c } ]; let w; const { cssStyles: u } = t; if (t.look === "handDrawn") { const m = I.svg(i), x = H(t, {}), S = j(p), b = m.path(S, x); w = i.insert(() => b, ":first-child").attr("transform", `translate(${-e / 2}, ${a / 2})`), u && w.attr("style", u); } else w = ft(i, e, a, p); return h && w.attr("style", h), E(t, w), t.intersect = function(m) { return R.polygon(t, p, m); }, i; } $(da, "card"); function ua(d, t) { const { nodeStyles: g } = W(t); t.label = ""; const h = d.insert("g").attr("class", Y(t)).attr("id", t.domId ?? t.id), { cssStyles: r } = t, l = Math.max(28, t.width ?? 0), f = [ { x: 0, y: l / 2 }, { x: l / 2, y: 0 }, { x: 0, y: -l / 2 }, { x: -l / 2, y: 0 } ], i = I.svg(h), n = H(t, {}); t.look !== "handDrawn" && (n.roughness = 0, n.fillStyle = "solid"); const e = j(f), a = i.path(e, n), s = h.insert(() => a, ":first-child"); return r && t.look !== "handDrawn" && s.selectAll("path").attr("style", r), g && t.look !== "handDrawn" && s.selectAll("path").attr("style", g), t.width = 28, t.height = 28, t.intersect = function(o) { return R.polygon(t, f, o); }, h; } $(ua, "choice"); async function Yt(d, t, g) { const { labelStyles: h, nodeStyles: r } = W(t); t.labelStyle = h; const { shapeSvg: l, bbox: f, halfPadding: i } = await _(d, t, Y(t)), n = 16, e = g?.padding ?? i, a = t.look === "neo" ? f.width / 2 + n * 2 : f.width / 2 + e; let s; const { cssStyles: o } = t; if (t.look === "handDrawn") { const c = I.svg(l), y = H(t, {}), p = c.circle(0, 0, a * 2, y); s = l.insert(() => p, ":first-child"), s.attr("class", "basic label-container").attr("style", K(o)); } else s = l.insert("circle", ":first-child").attr("class", "basic label-container").attr("style", r).attr("r", a).attr("cx", 0).attr("cy", 0); return E(t, s), t.calcIntersect = function(c, y) { const p = c.width / 2; return R.circle(c, p, y); }, t.intersect = function(c) { return F.info("Circle intersect", t, a, c), R.circle(t, a, c); }, l; } $(Yt, "circle"); function wa(d) { const t = Math.cos(Math.PI / 4), g = Math.sin(Math.PI / 4), h = d * 2, r = { x: h / 2 * t, y: h / 2 * g }, l = { x: -(h / 2) * t, y: h / 2 * g }, f = { x: -(h / 2) * t, y: -(h / 2) * g }, i = { x: h / 2 * t, y: -(h / 2) * g }; return `M ${l.x},${l.y} L ${i.x},${i.y} M ${r.x},${r.y} L ${f.x},${f.y}`; } $(wa, "createLine"); function ma(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g, t.label = ""; const r = d.insert("g").attr("class", Y(t)).attr("id", t.domId ?? t.id), l = Math.max(30, t?.width ?? 0), { cssStyles: f } = t, i = I.svg(r), n = H(t, {}); t.look !== "handDrawn" && (n.roughness = 0, n.fillStyle = "solid"); const e = i.circle(0, 0, l * 2, n), a = wa(l), s = i.path(a, n), o = r.insert(() => e, ":first-child"); return o.insert(() => s), o.attr("class", "outer-path"), f && t.look !== "handDrawn" && o.selectAll("path").attr("style", f), h && t.look !== "handDrawn" && o.selectAll("path").attr("style", h), E(t, o), t.intersect = function(c) { return F.info("crossedCircle intersect", t, { radius: l, point: c }), R.circle(t, l, c); }, r; } $(ma, "crossedCircle"); function ot(d, t, g, h = 100, r = 0, l = 180) { const f = [], i = r * Math.PI / 180, n = (l * Math.PI / 180 - i) / (h - 1); for (let e = 0; e < h; e++) { const a = i + e * n, s = d + g * Math.cos(a), o = t + g * Math.sin(a); f.push({ x: -s, y: -o }); } return f; } $(ot, "generateCirclePoints"); async function xa(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const { shapeSvg: r, bbox: l, label: f } = await _(d, t, Y(t)), i = t.look === "neo" ? 18 : t.padding ?? 0, n = t.look === "neo" ? 12 : t.padding ?? 0, e = l.width + i, a = l.height + n, s = Math.max(5, a * 0.1), { cssStyles: o } = t, c = [ ...ot(e / 2, -a / 2, s, 30, -90, 0), { x: -e / 2 - s, y: s }, ...ot(e / 2 + s * 2, -s, s, 20, -180, -270), ...ot(e / 2 + s * 2, s, s, 20, -90, -180), { x: -e / 2 - s, y: -a / 2 }, ...ot(e / 2, a / 2, s, 20, 0, 90) ], y = [ { x: e / 2, y: -a / 2 - s }, { x: -e / 2, y: -a / 2 - s }, ...ot(e / 2, -a / 2, s, 20, -90, 0), { x: -e / 2 - s, y: -s }, ...ot(e / 2 + e * 0.1, -s, s, 20, -180, -270), ...ot(e / 2 + e * 0.1, s, s, 20, -90, -180), { x: -e / 2 - s, y: a / 2 }, ...ot(e / 2, a / 2, s, 20, 0, 90), { x: -e / 2, y: a / 2 + s }, { x: e / 2, y: a / 2 + s } ], p = I.svg(r), w = H(t, { fill: "none" }); t.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid"); const u = j(c).replace("Z", ""), m = p.path(u, w), x = j(y), S = p.path(x, { ...w }), b = r.insert("g", ":first-child"); return b.insert(() => S, ":first-child").attr("stroke-opacity", 0), b.insert(() => m, ":first-child"), b.attr("class", "text"), o && t.look !== "handDrawn" && b.selectAll("path").attr("style", o), h && t.look !== "handDrawn" && b.selectAll("path").attr("style", h), b.attr("transform", `translate(${s}, 0)`), f.attr("transform", `translate(${-e / 2 + s - (l.x - (l.left ?? 0))},${-a / 2 + (t.padding ?? 0) / 2 - (l.y - (l.top ?? 0))})`), E(t, b), t.intersect = function(D) { return R.polygon(t, y, D); }, r; } $(xa, "curlyBraceLeft"); function ht(d, t, g, h = 100, r = 0, l = 180) { const f = [], i = r * Math.PI / 180, n = (l * Math.PI / 180 - i) / (h - 1); for (let e = 0; e < h; e++) { const a = i + e * n, s = d + g * Math.cos(a), o = t + g * Math.sin(a); f.push({ x: s, y: o }); } return f; } $(ht, "generateCirclePoints"); async function ba(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const { shapeSvg: r, bbox: l, label: f } = await _(d, t, Y(t)), i = t.look === "neo" ? 18 : t.padding ?? 0, n = t.look === "neo" ? 12 : t.padding ?? 0, e = l.width + (t.look === "neo" ? i * 2 : i), a = l.height + (t.look === "neo" ? n * 2 : n), s = Math.max(5, a * 0.1), { cssStyles: o } = t, c = [ ...ht(e / 2, -a / 2, s, 20, -90, 0), { x: e / 2 + s, y: -s }, ...ht(e / 2 + s * 2, -s, s, 20, -180, -270), ...ht(e / 2 + s * 2, s, s, 20, -90, -180), { x: e / 2 + s, y: a / 2 }, ...ht(e / 2, a / 2, s, 20, 0, 90) ], y = [ { x: -e / 2, y: -a / 2 - s }, { x: e / 2, y: -a / 2 - s }, ...ht(e / 2, -a / 2, s, 20, -90, 0), { x: e / 2 + s, y: -s }, ...ht(e / 2 + s * 2, -s, s, 20, -180, -270), ...ht(e / 2 + s * 2, s, s, 20, -90, -180), { x: e / 2 + s, y: a / 2 }, ...ht(e / 2, a / 2, s, 20, 0, 90), { x: e / 2, y: a / 2 + s }, { x: -e / 2, y: a / 2 + s } ], p = I.svg(r), w = H(t, { fill: "none" }); t.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid"); const u = j(c).replace("Z", ""), m = p.path(u, w), x = j(y), S = p.path(x, { ...w }), b = r.insert("g", ":first-child"); return b.insert(() => S, ":first-child").attr("stroke-opacity", 0), b.insert(() => m, ":first-child"), b.attr("class", "text"), o && t.look !== "handDrawn" && b.selectAll("path").attr("style", o), h && t.look !== "handDrawn" && b.selectAll("path").attr("style", h), b.attr("transform", `translate(${-s}, 0)`), f.attr("transform", `translate(${-e / 2 + (t.padding ?? 0) / 2 - (l.x - (l.left ?? 0))},${-a / 2 + (t.padding ?? 0) / 2 - (l.y - (l.top ?? 0))})`), E(t, b), t.intersect = function(D) { return R.polygon(t, y, D); }, r; } $(ba, "curlyBraceRight"); function Q(d, t, g, h = 100, r = 0, l = 180) { const f = [], i = r * Math.PI / 180, n = (l * Math.PI / 180 - i) / (h - 1); for (let e = 0; e < h; e++) { const a = i + e * n, s = d + g * Math.cos(a), o = t + g * Math.sin(a); f.push({ x: -s, y: -o }); } return f; } $(Q, "generateCirclePoints"); async function Sa(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const { shapeSvg: r, bbox: l, label: f } = await _(d, t, Y(t)), i = t.look === "neo" ? 18 : t.padding ?? 0, n = t.look === "neo" ? 12 : t.padding ?? 0, e = l.width + (t.look === "neo" ? i * 2 : i), a = l.height + (t.look === "neo" ? n * 2 : n), s = Math.max(5, a * 0.1), { cssStyles: o } = t, c = [ ...Q(e / 2, -a / 2, s, 30, -90, 0), { x: -e / 2 - s, y: s }, ...Q(e / 2 + s * 2, -s, s, 20, -180, -270), ...Q(e / 2 + s * 2, s, s, 20, -90, -180), { x: -e / 2 - s, y: -a / 2 }, ...Q(e / 2, a / 2, s, 20, 0, 90) ], y = [ ...Q(-e / 2 + s + s / 2, -a / 2, s, 20, -90, -180), { x: e / 2 - s / 2, y: s }, ...Q(-e / 2 - s / 2, -s, s, 20, 0, 90), ...Q(-e / 2 - s / 2, s, s, 20, -90, 0), { x: e / 2 - s / 2, y: -s }, ...Q(-e / 2 + s + s / 2, a / 2, s, 30, -180, -270) ], p = [ { x: e / 2, y: -a / 2 - s }, { x: -e / 2, y: -a / 2 - s }, ...Q(e / 2, -a / 2, s, 20, -90, 0), { x: -e / 2 - s, y: -s }, ...Q(e / 2 + s * 2, -s, s, 20, -180, -270), ...Q(e / 2 + s * 2, s, s, 20, -90, -180), { x: -e / 2 - s, y: a / 2 }, ...Q(e / 2, a / 2, s, 20, 0, 90), { x: -e / 2, y: a / 2 + s }, { x: e / 2 - s - s / 2, y: a / 2 + s }, ...Q(-e / 2 + s + s / 2, -a / 2, s, 20, -90, -180), { x: e / 2 - s / 2, y: s }, ...Q(-e / 2 - s / 2, -s, s, 20, 0, 90), ...Q(-e / 2 - s / 2, s, s, 20, -90, 0), { x: e / 2 - s / 2, y: -s }, ...Q(-e / 2 + s + s / 2, a / 2, s, 30, -180, -270) ], w = I.svg(r), u = H(t, { fill: "none" }); t.look !== "handDrawn" && (u.roughness = 0, u.fillStyle = "solid"); const m = j(c).replace("Z", ""), x = w.path(m, u), S = j(y).replace("Z", ""), b = w.path(S, u), D = j(p), k = w.path(D, { ...u }), v = r.insert("g", ":first-child"); return v.insert(() => k, ":first-child").attr("stroke-opacity", 0), v.insert(() => x, ":first-child"), v.insert(() => b, ":first-child"), v.attr("class", "text"), o && t.look !== "handDrawn" && v.selectAll("path").attr("style", o), h && t.look !== "handDrawn" && v.selectAll("path").attr("style", h), v.attr("transform", `translate(${s - s / 4}, 0)`), f.attr("transform", `translate(${-e / 2 + (t.padding ?? 0) / 2 - (l.x - (l.left ?? 0))},${-a / 2 + (t.padding ?? 0) / 2 - (l.y - (l.top ?? 0))})`), E(t, v), t.intersect = function(B) { return R.polygon(t, p, B); }, r; } $(Sa, "curlyBraces"); async function $a(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = t.padding ?? 0, l = t.look === "neo" ? 16 : r, f = t.look === "neo" ? 12 : r, i = 20, n = 5, { shapeSvg: e, bbox: a } = await _(d, t, Y(t)), s = Math.max(i, (a.width + l * 2) * 1.25, t?.width ?? 0), o = Math.max(n, a.height + f * 2, t?.height ?? 0), c = o / 2, { cssStyles: y } = t, p = I.svg(e), w = H(t, {}); t.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid"); const u = s, m = o, x = u - c, S = m / 4, b = [ { x, y: 0 }, { x: S, y: 0 }, { x: 0, y: m / 2 }, { x: S, y: m }, { x, y: m }, ...Dt(-x, -m / 2, c, 50, 270, 90) ], D = j(b), k = p.path(D, w), v = e.insert(() => k, ":first-child"); return v.attr("class", "basic label-container outer-path"), y && t.look !== "handDrawn" && v.selectChildren("path").attr("style", y), h && t.look !== "handDrawn" && v.selectChildren("path").attr("style", h), v.attr("transform", `translate(${-s / 2}, ${-o / 2})`), E(t, v), t.intersect = function(B) { return R.polygon(t, b, B); }, e; } $($a, "curvedTrapezoid"); var Hs = /* @__PURE__ */ $((d, t, g, h, r, l) => [ `M${d},${t + l}`, `a${r},${l} 0,0,0 ${g},0`, `a${r},${l} 0,0,0 ${-g},0`, `l0,${h}`, `a${r},${l} 0,0,0 ${g},0`, `l0,${-h}` ].join(" "), "createCylinderPathD"), Is = /* @__PURE__ */ $((d, t, g, h, r, l) => [ `M${d},${t + l}`, `M${d + g},${t + l}`, `a${r},${l} 0,0,0 ${-g},0`, `l0,${h}`, `a${r},${l} 0,0,0 ${g},0`, `l0,${-h}` ].join(" "), "createOuterCylinderPathD"), Ls = /* @__PURE__ */ $((d, t, g, h, r, l) => [`M${d - g / 2},${-h / 2}`, `a${r},${l} 0,0,0 ${g},0`].join(" "), "createInnerCylinderPathD"), qt = 8, Ft = 8; async function ka(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = t.padding ?? 0, l = t.look === "neo" ? 24 : r, f = t.look === "neo" ? 24 : r; if (t.width || t.height) { const w = t.width ?? 0; t.width = (t.width ?? 0) - f, t.width < Ft && (t.width = Ft); const u = w / 2 / (2.5 + w / 50); t.height = (t.height ?? 0) - l - u * 3, t.height < qt && (t.height = qt); } const { shapeSvg: i, bbox: n, label: e } = await _(d, t, Y(t)), a = (t.width ? t.width : n.width) + f, s = a / 2, o = s / (2.5 + a / 50), c = (t.height ? t.height : n.height) + l + o; let y; const { cssStyles: p } = t; if (t.look === "handDrawn") { const w = I.svg(i), u = Is(0, 0, a, c, s, o), m = Ls(0, o, a, c, s, o), x = H(t, {}), S = w.path(u, x), b = w.path(m, H(t, { fill: "none" })); y = i.insert(() => b, ":first-child"), y = i.insert(() => S, ":first-child"), y.attr("class", "basic label-container"), p && y.attr("style", p); } else { const w = Hs(0, 0, a, c, s, o); y = i.insert("path", ":first-child").attr("d", w).attr("class", "basic label-container outer-path").attr("style", K(p)).attr("style", h); } return y.attr("label-offset-y", o), y.attr("transform", `translate(${-a / 2}, ${-(c / 2 + o)})`), E(t, y), e.attr("transform", `translate(${-(n.width / 2) - (n.x - (n.left ?? 0))}, ${-(n.height / 2) + (t.padding ?? 0) / 1.5 - (n.y - (n.top ?? 0))})`), t.intersect = function(w) { const u = R.rect(t, w), m = u.x - (t.x ?? 0); if (s != 0 && (Math.abs(m) < (t.width ?? 0) / 2 || Math.abs(m) == (t.width ?? 0) / 2 && Math.abs(u.y - (t.y ?? 0)) > (t.height ?? 0) / 2 - o)) { let x = o * o * (1 - m * m / (s * s)); x > 0 && (x = Math.sqrt(x)), x = o - x, w.y - (t.y ?? 0) > 0 && (x = -x), u.y += x; } return u; }, i; } $(ka, "cylinder"); async function $t(d, t, g) { const { labelStyles: h, nodeStyles: r } = W(t); t.labelStyle = h; const { shapeSvg: l, bbox: f } = await _(d, t, Y(t)), i = Math.max(f.width + g.labelPaddingX * 2, t?.width || 0), n = Math.max(f.height + g.labelPaddingY * 2, t?.height || 0), e = -i / 2, a = -n / 2; let s, { rx: o, ry: c } = t; const { cssStyles: y } = t; if (g?.rx && g.ry && (o = g.rx, c = g.ry), t.look === "handDrawn") { const p = I.svg(l), w = H(t, {}), u = o || c ? p.path(dt(e, a, i, n, o || 0), w) : p.rectangle(e, a, i, n, w); s = l.insert(() => u, ":first-child"), s.attr("class", "basic label-container").attr("style", K(y)); } else s = l.insert("rect", ":first-child"), s.attr("class", "basic label-container").attr("style", r).attr("rx", K(o)).attr("ry", K(c)).attr("x", e).attr("y", a).attr("width", i).attr("height", n); return E(t, s), t.calcIntersect = function(p, w) { return R.rect(p, w); }, t.intersect = function(p) { return R.rect(t, p); }, l; } $($t, "drawRect"); async function va(d, t) { const { cssClasses: g, labelPaddingX: h, labelPaddingY: r, padding: l, width: f, height: i } = t, n = await $t(d, t, { rx: 0, ry: 0, classes: g ?? "", labelPaddingX: h ?? (l ?? 0) * 2, labelPaddingY: r ?? l ?? 0 }); if (t.look === "handDrawn") { const o = I.svg(n), c = H(t, {}), y = n.select(".basic.label-container > path:nth-child(2)"), p = y.node(); if (!p) return n; let w = null; if (p instanceof SVGGraphicsElement) w = p.getBBox(); else return n; return n.insert(() => o.line(w.x, w.y, w.x + w.width, w.y, c), ".basic.label-container g.label"), n.insert(() => o.line(w.x, w.y + w.height, w.x + w.width, w.y + w.height, c), ".basic.label-container g.label"), y.remove(), n; } const e = n.select(".basic.label-container"), a = (Number(e.attr("width")) || f) ?? 0, s = (Number(e.attr("height")) || i) ?? 0; return a > 0 && s > 0 && e.attr("stroke-dasharray", `${a} ${s}`), n; } $(va, "datastore"); async function Pa(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = t.look === "neo" ? 16 : t.padding ?? 0, l = t.look === "neo" ? 16 : t.padding ?? 0, { shapeSvg: f, bbox: i, label: n } = await _(d, t, Y(t)), e = i.width + r, a = i.height + l, s = a * 0.2, o = -e / 2, c = -a / 2 - s / 2, { cssStyles: y } = t, p = I.svg(f), w = H(t, {}); t.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid"); const u = [ { x: o, y: c + s }, { x: -o, y: c + s }, { x: -o, y: -c }, { x: o, y: -c }, { x: o, y: c }, { x: -o, y: c }, { x: -o, y: c + s } ], m = p.polygon(u.map((S) => [S.x, S.y]), w), x = f.insert(() => m, ":first-child"); return x.attr("class", "basic label-container outer-path"), y && t.look !== "handDrawn" && x.selectAll("path").attr("style", y), h && t.look !== "handDrawn" && x.selectAll("path").attr("style", h), n.attr("transform", `translate(${o + (t.padding ?? 0) / 2 - (i.x - (i.left ?? 0))}, ${c + s + (t.padding ?? 0) / 2 - (i.y - (i.top ?? 0))})`), E(t, x), t.intersect = function(S) { return R.rect(t, S); }, f; } $(Pa, "dividedRectangle"); async function Da(d, t) { const { labelStyles: g, nodeStyles: h } = W(t), r = t.look === "neo" ? 12 : 5; t.labelStyle = g; const l = t.padding ?? 0, f = t.look === "neo" ? 16 : l, { shapeSvg: i, bbox: n } = await _(d, t, Y(t)), e = (t?.width ? t?.width / 2 : n.width / 2) + (f ?? 0), a = e - r; let s; const { cssStyles: o } = t; if (t.look === "handDrawn") { const c = I.svg(i), y = H(t, { roughness: 0.2, strokeWidth: 2.5 }), p = H(t, { roughness: 0.2, strokeWidth: 1.5 }), w = c.circle(0, 0, e * 2, y), u = c.circle(0, 0, a * 2, p); s = i.insert("g", ":first-child"), s.attr("class", K(t.cssClasses)).attr("style", K(o)), s.node()?.appendChild(w), s.node()?.appendChild(u); } else { s = i.insert("g", ":first-child"); const c = s.insert("circle", ":first-child"), y = s.insert("circle"); s.attr("class", "basic label-container").attr("style", h), c.attr("class", "outer-circle").attr("style", h).attr("r", e).attr("cx", 0).attr("cy", 0), y.attr("class", "inner-circle").attr("style", h).attr("r", a).attr("cx", 0).attr("cy", 0); } return E(t, s), t.intersect = function(c) { return F.info("DoubleCircle intersect", t, e, c), R.circle(t, e, c); }, i; } $(Da, "doublecircle"); function Ba(d, t, { config: { themeVariables: g } }) { const { labelStyles: h, nodeStyles: r } = W(t); t.label = "", t.labelStyle = h; const l = d.insert("g").attr("class", Y(t)).attr("id", t.domId ?? t.id), f = 7, { cssStyles: i } = t, n = I.svg(l), { nodeBorder: e } = g, a = H(t, { fillStyle: "solid" }); t.look !== "handDrawn" && (a.roughness = 0); const s = n.circle(0, 0, f * 2, a), o = l.insert(() => s, ":first-child"); return o.selectAll("path").attr("style", `fill: ${e} !important;`), i && i.length > 0 && t.look !== "handDrawn" && o.selectAll("path").attr("style", i), r && t.look !== "handDrawn" && o.selectAll("path").attr("style", r), E(t, o), t.intersect = function(c) { return F.info("filledCircle intersect", t, { radius: f, point: c }), R.circle(t, f, c); }, l; } $(Ba, "filledCircle"); var zt = 10, Vt = 10; async function Ma(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = t.padding ?? 0, l = t.look === "neo" ? r * 2 : r; (t.width || t.height) && (t.height = t?.height ?? 0, t.height < zt && (t.height = zt), t.width = (t?.width ?? 0) - l - l / 2, t.width < Vt && (t.width = Vt)); const { shapeSvg: f, bbox: i, label: n } = await _(d, t, Y(t)), e = (t?.width ? t?.width : i.width) + (l ?? 0), a = t?.height ? t?.height : e + i.height, s = a, o = [ { x: 0, y: -a }, { x: s, y: -a }, { x: s / 2, y: 0 } ], { cssStyles: c } = t, y = I.svg(f), p = H(t, {}); t.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid"); const w = j(o), u = y.path(w, p), m = f.insert(() => u, ":first-child").attr("transform", `translate(${-a / 2}, ${a / 2})`).attr("class", "outer-path"); return c && t.look !== "handDrawn" && m.selectChildren("path").attr("style", c), h && t.look !== "handDrawn" && m.selectChildren("path").attr("style", h), t.width = e, t.height = a, E(t, m), n.attr("transform", `translate(${-i.width / 2 - (i.x - (i.left ?? 0))}, ${-a / 2 + (t.padding ?? 0) / 2 + (i.y - (i.top ?? 0))})`), t.intersect = function(x) { return F.info("Triangle intersect", t, o, x), R.polygon(t, o, x); }, f; } $(Ma, "flippedTriangle"); function Na(d, t, { dir: g, config: { state: h, themeVariables: r } }) { const { nodeStyles: l } = W(t); t.label = ""; const f = d.insert("g").attr("class", Y(t)).attr("id", t.domId ?? t.id), { cssStyles: i } = t; let n = Math.max(70, t?.width ?? 0), e = Math.max(10, t?.height ?? 0); g === "LR" && (n = Math.max(10, t?.width ?? 0), e = Math.max(70, t?.height ?? 0)); const a = -1 * n / 2, s = -1 * e / 2, o = I.svg(f), c = H(t, { stroke: r.lineColor, fill: r.lineColor }); t.look !== "handDrawn" && (c.roughness = 0, c.fillStyle = "solid"); const y = o.rectangle(a, s, n, e, c), p = f.insert(() => y, ":first-child"); i && t.look !== "handDrawn" && p.selectAll("path").attr("style", i), l && t.look !== "handDrawn" && p.selectAll("path").attr("style", l), E(t, p); const w = h?.padding ?? 0; return t.width && t.height && (t.width += w / 2 || 0, t.height += w / 2 || 0), t.intersect = function(u) { return R.rect(t, u); }, f; } $(Na, "forkJoin"); async function Ca(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.labelStyle = g; const r = 15, l = 10, f = t.look === "neo" ? 16 : t.padding ?? 0, i = t.look === "neo" ? 12 : t.padding ?? 0; (t.width || t.height) && (t.height = (t?.height ?? 0) - i * 2, t.height < l && (t.height = l), t.width = (t?.width ?? 0) - f * 2, t.width < r && (t.width = r)); const { shapeSvg: n, bbox: e } = await _(d, t, Y(t)), a = (t?.width ? t?.width : Math.max(r, e.width)) + f * 2, s = (t?.height ? t?.height : Math.max(l, e.height)) + i * 2, o = s / 2, { cssStyles: c } = t, y = I.svg(n), p = H(t, {}); t.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid"); const w = [ { x: -a / 2, y: -s / 2 }, { x: a / 2 - o, y: -s / 2 }, ...Dt(-a / 2 + o, 0, o, 50, 90, 270), { x: a / 2 - o, y: s / 2 }, { x: -a / 2, y: s / 2 } ], u = j(w), m = y.path(u, p), x = n.insert(() => m, ":first-child"); return x.attr("class", "basic label-container outer-path"), c && t.look !== "handDrawn" && x.selectChildren("path").attr("style", c), h && t.look !== "handDrawn" && x.selectChildren("path").attr("style", h), E(t, x), t.intersect = function(S) { return F.info("Pill intersect", t, { radius: o, point: S }), R.polygon(t, w, S); }, n; } $(Ca, "halfRoundedRectangle"); var Ts = /* @__PURE__ */ $((d, t, g, h, r) => [ `M${d + r},${t}`, `L${d + g - r},${t}`, `L${d + g},${t - h / 2}`, `L${d + g - r},${t - h}`, `L${d + r},${t - h}`, `L${d},${t - h / 2}`, "Z" ].join(" "), "createHexagonPathD"); async function Ra(d, t) { const { labelStyles: g, nodeStyles: h } = W(t), r = t.look === "neo" ? 3.5 : 4; t.labelStyle = g; const l = t.padding ?? 0, f = 70, i = 32, n = t.look === "neo" ? f : l, e = t.look === "neo" ? i : l; if (t.width || t.height) { const m = (t.height ?? 0) / r; t.width = (t?.width ?? 0) - 2 * m - e, t.height = (t.height ?? 0) - n; } const { shapeSvg: a, bbox: s } = await _(d, t, Y(t)), o = (t?.height ? t?.height : s.height) + n, c = o / r, y = (t?.width ? t?.width : s.width) + 2 * c + e, p = [ { x: c, y: 0 }, { x: y - c, y: 0 }, { x: y, y: -o / 2 }, { x: y - c, y: -o }, { x: c, y: -o }, { x: 0, y: -o / 2 } ]; let w; const { cssStyles: u } = t; if (t.look === "handDrawn") { const m = I.svg(a), x = H(t, {}), S = Ts(0, 0, y, o, c), b = m.path(S, x); w = a.insert(() => b, ":first-child").attr("transform", `translate(${-y / 2}, ${o / 2})`), u && w.attr("style", u); } else w = ft(a, y, o, p); return h && w.attr("style", h), t.width = y, t.height = o, E(t, w), t.intersect = function(m) { return R.polygon(t, p, m); }, a; } $(Ra, "hexagon"); async function Aa(d, t) { const { labelStyles: g, nodeStyles: h } = W(t); t.label = "", t.labelStyle = g; const { shapeSvg: r } = await _(d, t, Y(t)), l = Math.max(30, t?.width ?? 0), f = Math.max(30, t?.height ?? 0), { cssStyles: i } = t, n = I.svg(r), e = H(t, {}); t.look !== "handDrawn" && (e.roughness = 0, e.fillStyle = "solid"); const a = [ { x: 0, y: 0 }, { x: l, y: 0 }, { x: 0, y: f }, { x: l, y: f } ], s = j(a), o = n.path(s, e), c = r.insert(() => o, ":first-child"); return c.attr("class", "basic label-container outer-path"), i && t.look !== "handDrawn" && c.selectChildren("path").attr("style", i), h && t.look !== "handDrawn" && c.selec