1 | import { p as Lt, f as V } from "./flowDb-9a89ea33.js";
|
2 | import { h as S, f as tt, G as _t } from "./graph-0ee63739.js";
|
3 | import { j as x, n as U, o as Y, p as et, c as G, r as rt, f as at, l as R, q as z, t as Et } from "./mermaid-9f2aa176.js";
|
4 | import { u as Tt, r as Nt, p as At, l as Ct, d as M } from "./layout-fd473db2.js";
|
5 | import { a as N, b as nt, i as st, c as E, e as it, d as ot, s as It, f as Bt, g as Mt } from "./styles-e75131e4.js";
|
6 | import { l as Dt } from "./line-24d93f1b.js";
|
7 | import "./index-bb6d8841.js";
|
8 | import "./clone-afc2f047.js";
|
9 | import "./edges-16357fde.js";
|
10 | import "./createText-03b82060.js";
|
11 | import "./channel-ebbc4130.js";
|
12 | import "./array-2ff2c7a6.js";
|
13 | import "./path-428ebac9.js";
|
14 | function Rt(r) {
|
15 | if (!r.ok)
|
16 | throw new Error(r.status + " " + r.statusText);
|
17 | return r.text();
|
18 | }
|
19 | function Gt(r, e) {
|
20 | return fetch(r, e).then(Rt);
|
21 | }
|
22 | function Pt(r) {
|
23 | return (e, t) => Gt(e, t).then((n) => new DOMParser().parseFromString(n, r));
|
24 | }
|
25 | var Ut = Pt("image/svg+xml"), H = {
|
26 | normal: $t,
|
27 | vee: Vt,
|
28 | undirected: zt
|
29 | };
|
30 | function Wt(r) {
|
31 | H = r;
|
32 | }
|
33 | function $t(r, e, t, n) {
|
34 | var a = r.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = a.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
35 | N(s, t[n + "Style"]), t[n + "Class"] && s.attr("class", t[n + "Class"]);
|
36 | }
|
37 | function Vt(r, e, t, n) {
|
38 | var a = r.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = a.append("path").attr("d", "M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
39 | N(s, t[n + "Style"]), t[n + "Class"] && s.attr("class", t[n + "Class"]);
|
40 | }
|
41 | function zt(r, e, t, n) {
|
42 | var a = r.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = a.append("path").attr("d", "M 0 5 L 10 5").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
43 | N(s, t[n + "Style"]), t[n + "Class"] && s.attr("class", t[n + "Class"]);
|
44 | }
|
45 | function Yt(r, e) {
|
46 | var t = r;
|
47 | return t.node().appendChild(e.label), N(t, e.labelStyle), t;
|
48 | }
|
49 | function Ht(r, e) {
|
50 | for (var t = r.append("text"), n = Xt(e.label).split(`
|
51 | `), a = 0; a < n.length; a++)
|
52 | t.append("tspan").attr("xml:space", "preserve").attr("dy", "1em").attr("x", "1").text(n[a]);
|
53 | return N(t, e.labelStyle), t;
|
54 | }
|
55 | function Xt(r) {
|
56 | for (var e = "", t = !1, n, a = 0; a < r.length; ++a)
|
57 | if (n = r[a], t) {
|
58 | switch (n) {
|
59 | case "n":
|
60 | e += `
|
61 | `;
|
62 | break;
|
63 | default:
|
64 | e += n;
|
65 | }
|
66 | t = !1;
|
67 | } else
|
68 | n === "\\" ? t = !0 : e += n;
|
69 | return e;
|
70 | }
|
71 | function J(r, e, t) {
|
72 | var n = e.label, a = r.append("g");
|
73 | e.labelType === "svg" ? Yt(a, e) : typeof n != "string" || e.labelType === "html" ? nt(a, e) : Ht(a, e);
|
74 | var s = a.node().getBBox(), i;
|
75 | switch (t) {
|
76 | case "top":
|
77 | i = -e.height / 2;
|
78 | break;
|
79 | case "bottom":
|
80 | i = e.height / 2 - s.height;
|
81 | break;
|
82 | default:
|
83 | i = -s.height / 2;
|
84 | }
|
85 | return a.attr("transform", "translate(" + -s.width / 2 + "," + i + ")"), a;
|
86 | }
|
87 | var X = function(r, e) {
|
88 | var t = e.nodes().filter(function(s) {
|
89 | return st(e, s);
|
90 | }), n = r.selectAll("g.cluster").data(t, function(s) {
|
91 | return s;
|
92 | });
|
93 | E(n.exit(), e).style("opacity", 0).remove();
|
94 | var a = n.enter().append("g").attr("class", "cluster").attr("id", function(s) {
|
95 | var i = e.node(s);
|
96 | return i.id;
|
97 | }).style("opacity", 0).each(function(s) {
|
98 | var i = e.node(s), o = x(this);
|
99 | x(this).append("rect");
|
100 | var c = o.append("g").attr("class", "label");
|
101 | J(c, i, i.clusterLabelPos);
|
102 | });
|
103 | return n = n.merge(a), n = E(n, e).style("opacity", 1), n.selectAll("rect").each(function(s) {
|
104 | var i = e.node(s), o = x(this);
|
105 | N(o, i.style);
|
106 | }), n;
|
107 | };
|
108 | function Ft(r) {
|
109 | X = r;
|
110 | }
|
111 | let F = function(r, e) {
|
112 | var t = r.selectAll("g.edgeLabel").data(e.edges(), function(a) {
|
113 | return it(a);
|
114 | }).classed("update", !0);
|
115 | t.exit().remove(), t.enter().append("g").classed("edgeLabel", !0).style("opacity", 0), t = r.selectAll("g.edgeLabel"), t.each(function(a) {
|
116 | var s = x(this);
|
117 | s.select(".label").remove();
|
118 | var i = e.edge(a), o = J(s, e.edge(a), 0).classed("label", !0), c = o.node().getBBox();
|
119 | i.labelId && o.attr("id", i.labelId), S(i, "width") || (i.width = c.width), S(i, "height") || (i.height = c.height);
|
120 | });
|
121 | var n;
|
122 | return t.exit ? n = t.exit() : n = t.selectAll(null), E(n, e).style("opacity", 0).remove(), t;
|
123 | };
|
124 | function qt(r) {
|
125 | F = r;
|
126 | }
|
127 | function O(r, e) {
|
128 | return r.intersect(e);
|
129 | }
|
130 | var q = function(r, e, t) {
|
131 | var n = r.selectAll("g.edgePath").data(e.edges(), function(i) {
|
132 | return it(i);
|
133 | }).classed("update", !0), a = Ot(n, e);
|
134 | jt(n, e);
|
135 | var s = n.merge !== void 0 ? n.merge(a) : n;
|
136 | return E(s, e).style("opacity", 1), s.each(function(i) {
|
137 | var o = x(this), c = e.edge(i);
|
138 | c.elem = this, c.id && o.attr("id", c.id), ot(
|
139 | o,
|
140 | c.class,
|
141 | (o.classed("update") ? "update " : "") + "edgePath"
|
142 | );
|
143 | }), s.selectAll("path.path").each(function(i) {
|
144 | var o = e.edge(i);
|
145 | o.arrowheadId = Tt("arrowhead");
|
146 | var c = x(this).attr("marker-end", function() {
|
147 | return "url(" + Kt(location.href, o.arrowheadId) + ")";
|
148 | }).style("fill", "none");
|
149 | E(c, e).attr("d", function(d) {
|
150 | return Jt(e, d);
|
151 | }), N(c, o.style);
|
152 | }), s.selectAll("defs *").remove(), s.selectAll("defs").each(function(i) {
|
153 | var o = e.edge(i), c = t[o.arrowhead];
|
154 | c(x(this), o.arrowheadId, o, "arrowhead");
|
155 | }), s;
|
156 | };
|
157 | function Qt(r) {
|
158 | q = r;
|
159 | }
|
160 | function Kt(r, e) {
|
161 | var t = r.split("#")[0];
|
162 | return t + "#" + e;
|
163 | }
|
164 | function Jt(r, e) {
|
165 | var t = r.edge(e), n = r.node(e.v), a = r.node(e.w), s = t.points.slice(1, t.points.length - 1);
|
166 | return s.unshift(O(n, s[0])), s.push(O(a, s[s.length - 1])), lt(t, s);
|
167 | }
|
168 | function lt(r, e) {
|
169 | var t = (Dt || Ut.line)().x(function(n) {
|
170 | return n.x;
|
171 | }).y(function(n) {
|
172 | return n.y;
|
173 | });
|
174 | return (t.curve || t.interpolate)(r.curve), t(e);
|
175 | }
|
176 | function Zt(r) {
|
177 | var e = r.getBBox(), t = r.ownerSVGElement.getScreenCTM().inverse().multiply(r.getScreenCTM()).translate(e.width / 2, e.height / 2);
|
178 | return { x: t.e, y: t.f };
|
179 | }
|
180 | function Ot(r, e) {
|
181 | var t = r.enter().append("g").attr("class", "edgePath").style("opacity", 0);
|
182 | return t.append("path").attr("class", "path").attr("d", function(n) {
|
183 | var a = e.edge(n), s = e.node(n.v).elem, i = Nt(a.points.length).map(function() {
|
184 | return Zt(s);
|
185 | });
|
186 | return lt(a, i);
|
187 | }), t.append("defs"), t;
|
188 | }
|
189 | function jt(r, e) {
|
190 | var t = r.exit();
|
191 | E(t, e).style("opacity", 0).remove();
|
192 | }
|
193 | var Q = function(r, e, t) {
|
194 | var n = e.nodes().filter(function(i) {
|
195 | return !st(e, i);
|
196 | }), a = r.selectAll("g.node").data(n, function(i) {
|
197 | return i;
|
198 | }).classed("update", !0);
|
199 | a.exit().remove(), a.enter().append("g").attr("class", "node").style("opacity", 0), a = r.selectAll("g.node"), a.each(function(i) {
|
200 | var o = e.node(i), c = x(this);
|
201 | ot(
|
202 | c,
|
203 | o.class,
|
204 | (c.classed("update") ? "update " : "") + "node"
|
205 | ), c.select("g.label").remove();
|
206 | var d = c.append("g").attr("class", "label"), l = J(d, o), g = t[o.shape], h = At(l.node().getBBox(), "width", "height");
|
207 | o.elem = this, o.id && c.attr("id", o.id), o.labelId && d.attr("id", o.labelId), S(o, "width") && (h.width = o.width), S(o, "height") && (h.height = o.height), h.width += o.paddingLeft + o.paddingRight, h.height += o.paddingTop + o.paddingBottom, d.attr(
|
208 | "transform",
|
209 | "translate(" + (o.paddingLeft - o.paddingRight) / 2 + "," + (o.paddingTop - o.paddingBottom) / 2 + ")"
|
210 | );
|
211 | var u = x(this);
|
212 | u.select(".label-container").remove();
|
213 | var p = g(u, h, o).classed("label-container", !0);
|
214 | N(p, o.style);
|
215 | var v = p.node().getBBox();
|
216 | o.width = v.width, o.height = v.height;
|
217 | });
|
218 | var s;
|
219 | return a.exit ? s = a.exit() : s = a.selectAll(null), E(s, e).style("opacity", 0).remove(), a;
|
220 | };
|
221 | function te(r) {
|
222 | Q = r;
|
223 | }
|
224 | function ee(r, e) {
|
225 | var t = r.filter(function() {
|
226 | return !x(this).classed("update");
|
227 | });
|
228 | function n(a) {
|
229 | var s = e.node(a);
|
230 | return "translate(" + s.x + "," + s.y + ")";
|
231 | }
|
232 | t.attr("transform", n), E(r, e).style("opacity", 1).attr("transform", n), E(t.selectAll("rect"), e).attr("width", function(a) {
|
233 | return e.node(a).width;
|
234 | }).attr("height", function(a) {
|
235 | return e.node(a).height;
|
236 | }).attr("x", function(a) {
|
237 | var s = e.node(a);
|
238 | return -s.width / 2;
|
239 | }).attr("y", function(a) {
|
240 | var s = e.node(a);
|
241 | return -s.height / 2;
|
242 | });
|
243 | }
|
244 | function re(r, e) {
|
245 | var t = r.filter(function() {
|
246 | return !x(this).classed("update");
|
247 | });
|
248 | function n(a) {
|
249 | var s = e.edge(a);
|
250 | return S(s, "x") ? "translate(" + s.x + "," + s.y + ")" : "";
|
251 | }
|
252 | t.attr("transform", n), E(r, e).style("opacity", 1).attr("transform", n);
|
253 | }
|
254 | function ae(r, e) {
|
255 | var t = r.filter(function() {
|
256 | return !x(this).classed("update");
|
257 | });
|
258 | function n(a) {
|
259 | var s = e.node(a);
|
260 | return "translate(" + s.x + "," + s.y + ")";
|
261 | }
|
262 | t.attr("transform", n), E(r, e).style("opacity", 1).attr("transform", n);
|
263 | }
|
264 | function ct(r, e, t, n) {
|
265 | var a = r.x, s = r.y, i = a - n.x, o = s - n.y, c = Math.sqrt(e * e * o * o + t * t * i * i), d = Math.abs(e * t * i / c);
|
266 | n.x < a && (d = -d);
|
267 | var l = Math.abs(e * t * o / c);
|
268 | return n.y < s && (l = -l), { x: a + d, y: s + l };
|
269 | }
|
270 | function ne(r, e, t) {
|
271 | return ct(r, e, e, t);
|
272 | }
|
273 | function se(r, e, t, n) {
|
274 | var a, s, i, o, c, d, l, g, h, u, p, v, f, y, k;
|
275 | if (a = e.y - r.y, i = r.x - e.x, c = e.x * r.y - r.x * e.y, h = a * t.x + i * t.y + c, u = a * n.x + i * n.y + c, !(h !== 0 && u !== 0 && j(h, u)) && (s = n.y - t.y, o = t.x - n.x, d = n.x * t.y - t.x * n.y, l = s * r.x + o * r.y + d, g = s * e.x + o * e.y + d, !(l !== 0 && g !== 0 && j(l, g)) && (p = a * o - s * i, p !== 0)))
|
276 | return v = Math.abs(p / 2), f = i * d - o * c, y = f < 0 ? (f - v) / p : (f + v) / p, f = s * c - a * d, k = f < 0 ? (f - v) / p : (f + v) / p, { x: y, y: k };
|
277 | }
|
278 | function j(r, e) {
|
279 | return r * e > 0;
|
280 | }
|
281 | function T(r, e, t) {
|
282 | var n = r.x, a = r.y, s = [], i = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY;
|
283 | e.forEach(function(p) {
|
284 | i = Math.min(i, p.x), o = Math.min(o, p.y);
|
285 | });
|
286 | for (var c = n - r.width / 2 - i, d = a - r.height / 2 - o, l = 0; l < e.length; l++) {
|
287 | var g = e[l], h = e[l < e.length - 1 ? l + 1 : 0], u = se(
|
288 | r,
|
289 | t,
|
290 | { x: c + g.x, y: d + g.y },
|
291 | { x: c + h.x, y: d + h.y }
|
292 | );
|
293 | u && s.push(u);
|
294 | }
|
295 | return s.length ? (s.length > 1 && s.sort(function(p, v) {
|
296 | var f = p.x - t.x, y = p.y - t.y, k = Math.sqrt(f * f + y * y), I = v.x - t.x, _ = v.y - t.y, W = Math.sqrt(I * I + _ * _);
|
297 | return k < W ? -1 : k === W ? 0 : 1;
|
298 | }), s[0]) : (console.log("NO INTERSECTION FOUND, RETURN NODE CENTER", r), r);
|
299 | }
|
300 | function Z(r, e) {
|
301 | var t = r.x, n = r.y, a = e.x - t, s = e.y - n, i = r.width / 2, o = r.height / 2, c, d;
|
302 | return Math.abs(s) * i > Math.abs(a) * o ? (s < 0 && (o = -o), c = s === 0 ? 0 : o * a / s, d = o) : (a < 0 && (i = -i), c = i, d = a === 0 ? 0 : i * s / a), { x: t + c, y: n + d };
|
303 | }
|
304 | var K = {
|
305 | rect: oe,
|
306 | ellipse: le,
|
307 | circle: ce,
|
308 | diamond: de
|
309 | };
|
310 | function ie(r) {
|
311 | K = r;
|
312 | }
|
313 | function oe(r, e, t) {
|
314 | var n = r.insert("rect", ":first-child").attr("rx", t.rx).attr("ry", t.ry).attr("x", -e.width / 2).attr("y", -e.height / 2).attr("width", e.width).attr("height", e.height);
|
315 | return t.intersect = function(a) {
|
316 | return Z(t, a);
|
317 | }, n;
|
318 | }
|
319 | function le(r, e, t) {
|
320 | var n = e.width / 2, a = e.height / 2, s = r.insert("ellipse", ":first-child").attr("x", -e.width / 2).attr("y", -e.height / 2).attr("rx", n).attr("ry", a);
|
321 | return t.intersect = function(i) {
|
322 | return ct(t, n, a, i);
|
323 | }, s;
|
324 | }
|
325 | function ce(r, e, t) {
|
326 | var n = Math.max(e.width, e.height) / 2, a = r.insert("circle", ":first-child").attr("x", -e.width / 2).attr("y", -e.height / 2).attr("r", n);
|
327 | return t.intersect = function(s) {
|
328 | return ne(t, n, s);
|
329 | }, a;
|
330 | }
|
331 | function de(r, e, t) {
|
332 | var n = e.width * Math.SQRT2 / 2, a = e.height * Math.SQRT2 / 2, s = [
|
333 | { x: 0, y: -a },
|
334 | { x: -n, y: 0 },
|
335 | { x: 0, y: a },
|
336 | { x: n, y: 0 }
|
337 | ], i = r.insert("polygon", ":first-child").attr(
|
338 | "points",
|
339 | s.map(function(o) {
|
340 | return o.x + "," + o.y;
|
341 | }).join(" ")
|
342 | );
|
343 | return t.intersect = function(o) {
|
344 | return T(t, s, o);
|
345 | }, i;
|
346 | }
|
347 | function he() {
|
348 | var r = function(e, t) {
|
349 | pe(t);
|
350 | var n = D(e, "output"), a = D(n, "clusters"), s = D(n, "edgePaths"), i = F(D(n, "edgeLabels"), t), o = Q(D(n, "nodes"), t, K);
|
351 | Ct(t), ae(o, t), re(i, t), q(s, t, H);
|
352 | var c = X(a, t);
|
353 | ee(c, t), ge(t);
|
354 | };
|
355 | return r.createNodes = function(e) {
|
356 | return arguments.length ? (te(e), r) : Q;
|
357 | }, r.createClusters = function(e) {
|
358 | return arguments.length ? (Ft(e), r) : X;
|
359 | }, r.createEdgeLabels = function(e) {
|
360 | return arguments.length ? (qt(e), r) : F;
|
361 | }, r.createEdgePaths = function(e) {
|
362 | return arguments.length ? (Qt(e), r) : q;
|
363 | }, r.shapes = function(e) {
|
364 | return arguments.length ? (ie(e), r) : K;
|
365 | }, r.arrows = function(e) {
|
366 | return arguments.length ? (Wt(e), r) : H;
|
367 | }, r;
|
368 | }
|
369 | var ue = {
|
370 | paddingLeft: 10,
|
371 | paddingRight: 10,
|
372 | paddingTop: 10,
|
373 | paddingBottom: 10,
|
374 | rx: 0,
|
375 | ry: 0,
|
376 | shape: "rect"
|
377 | }, fe = {
|
378 | arrowhead: "normal",
|
379 | curve: U
|
380 | };
|
381 | function pe(r) {
|
382 | r.nodes().forEach(function(e) {
|
383 | var t = r.node(e);
|
384 | !S(t, "label") && !r.children(e).length && (t.label = e), S(t, "paddingX") && M(t, {
|
385 | paddingLeft: t.paddingX,
|
386 | paddingRight: t.paddingX
|
387 | }), S(t, "paddingY") && M(t, {
|
388 | paddingTop: t.paddingY,
|
389 | paddingBottom: t.paddingY
|
390 | }), S(t, "padding") && M(t, {
|
391 | paddingLeft: t.padding,
|
392 | paddingRight: t.padding,
|
393 | paddingTop: t.padding,
|
394 | paddingBottom: t.padding
|
395 | }), M(t, ue), tt(["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"], function(n) {
|
396 | t[n] = Number(t[n]);
|
397 | }), S(t, "width") && (t._prevWidth = t.width), S(t, "height") && (t._prevHeight = t.height);
|
398 | }), r.edges().forEach(function(e) {
|
399 | var t = r.edge(e);
|
400 | S(t, "label") || (t.label = ""), M(t, fe);
|
401 | });
|
402 | }
|
403 | function ge(r) {
|
404 | tt(r.nodes(), function(e) {
|
405 | var t = r.node(e);
|
406 | S(t, "_prevWidth") ? t.width = t._prevWidth : delete t.width, S(t, "_prevHeight") ? t.height = t._prevHeight : delete t.height, delete t._prevWidth, delete t._prevHeight;
|
407 | });
|
408 | }
|
409 | function D(r, e) {
|
410 | var t = r.select("g." + e);
|
411 | return t.empty() && (t = r.append("g").attr("class", e)), t;
|
412 | }
|
413 | function dt(r, e, t) {
|
414 | const n = e.width, a = e.height, s = (n + a) * 0.9, i = [
|
415 | { x: s / 2, y: 0 },
|
416 | { x: s, y: -s / 2 },
|
417 | { x: s / 2, y: -s },
|
418 | { x: 0, y: -s / 2 }
|
419 | ], o = A(r, s, s, i);
|
420 | return t.intersect = function(c) {
|
421 | return T(t, i, c);
|
422 | }, o;
|
423 | }
|
424 | function ht(r, e, t) {
|
425 | const a = e.height, s = a / 4, i = e.width + 2 * s, o = [
|
426 | { x: s, y: 0 },
|
427 | { x: i - s, y: 0 },
|
428 | { x: i, y: -a / 2 },
|
429 | { x: i - s, y: -a },
|
430 | { x: s, y: -a },
|
431 | { x: 0, y: -a / 2 }
|
432 | ], c = A(r, i, a, o);
|
433 | return t.intersect = function(d) {
|
434 | return T(t, o, d);
|
435 | }, c;
|
436 | }
|
437 | function ut(r, e, t) {
|
438 | const n = e.width, a = e.height, s = [
|
439 | { x: -a / 2, y: 0 },
|
440 | { x: n, y: 0 },
|
441 | { x: n, y: -a },
|
442 | { x: -a / 2, y: -a },
|
443 | { x: 0, y: -a / 2 }
|
444 | ], i = A(r, n, a, s);
|
445 | return t.intersect = function(o) {
|
446 | return T(t, s, o);
|
447 | }, i;
|
448 | }
|
449 | function ft(r, e, t) {
|
450 | const n = e.width, a = e.height, s = [
|
451 | { x: -2 * a / 6, y: 0 },
|
452 | { x: n - a / 6, y: 0 },
|
453 | { x: n + 2 * a / 6, y: -a },
|
454 | { x: a / 6, y: -a }
|
455 | ], i = A(r, n, a, s);
|
456 | return t.intersect = function(o) {
|
457 | return T(t, s, o);
|
458 | }, i;
|
459 | }
|
460 | function pt(r, e, t) {
|
461 | const n = e.width, a = e.height, s = [
|
462 | { x: 2 * a / 6, y: 0 },
|
463 | { x: n + a / 6, y: 0 },
|
464 | { x: n - 2 * a / 6, y: -a },
|
465 | { x: -a / 6, y: -a }
|
466 | ], i = A(r, n, a, s);
|
467 | return t.intersect = function(o) {
|
468 | return T(t, s, o);
|
469 | }, i;
|
470 | }
|
471 | function gt(r, e, t) {
|
472 | const n = e.width, a = e.height, s = [
|
473 | { x: -2 * a / 6, y: 0 },
|
474 | { x: n + 2 * a / 6, y: 0 },
|
475 | { x: n - a / 6, y: -a },
|
476 | { x: a / 6, y: -a }
|
477 | ], i = A(r, n, a, s);
|
478 | return t.intersect = function(o) {
|
479 | return T(t, s, o);
|
480 | }, i;
|
481 | }
|
482 | function yt(r, e, t) {
|
483 | const n = e.width, a = e.height, s = [
|
484 | { x: a / 6, y: 0 },
|
485 | { x: n - a / 6, y: 0 },
|
486 | { x: n + 2 * a / 6, y: -a },
|
487 | { x: -2 * a / 6, y: -a }
|
488 | ], i = A(r, n, a, s);
|
489 | return t.intersect = function(o) {
|
490 | return T(t, s, o);
|
491 | }, i;
|
492 | }
|
493 | function vt(r, e, t) {
|
494 | const n = e.width, a = e.height, s = [
|
495 | { x: 0, y: 0 },
|
496 | { x: n + a / 2, y: 0 },
|
497 | { x: n, y: -a / 2 },
|
498 | { x: n + a / 2, y: -a },
|
499 | { x: 0, y: -a }
|
500 | ], i = A(r, n, a, s);
|
501 | return t.intersect = function(o) {
|
502 | return T(t, s, o);
|
503 | }, i;
|
504 | }
|
505 | function wt(r, e, t) {
|
506 | const n = e.height, a = e.width + n / 4, s = r.insert("rect", ":first-child").attr("rx", n / 2).attr("ry", n / 2).attr("x", -a / 2).attr("y", -n / 2).attr("width", a).attr("height", n);
|
507 | return t.intersect = function(i) {
|
508 | return Z(t, i);
|
509 | }, s;
|
510 | }
|
511 | function mt(r, e, t) {
|
512 | const n = e.width, a = e.height, s = [
|
513 | { x: 0, y: 0 },
|
514 | { x: n, y: 0 },
|
515 | { x: n, y: -a },
|
516 | { x: 0, y: -a },
|
517 | { x: 0, y: 0 },
|
518 | { x: -8, y: 0 },
|
519 | { x: n + 8, y: 0 },
|
520 | { x: n + 8, y: -a },
|
521 | { x: -8, y: -a },
|
522 | { x: -8, y: 0 }
|
523 | ], i = A(r, n, a, s);
|
524 | return t.intersect = function(o) {
|
525 | return T(t, s, o);
|
526 | }, i;
|
527 | }
|
528 | function xt(r, e, t) {
|
529 | const n = e.width, a = n / 2, s = a / (2.5 + n / 50), i = e.height + s, o = "M 0," + s + " a " + a + "," + s + " 0,0,0 " + n + " 0 a " + a + "," + s + " 0,0,0 " + -n + " 0 l 0," + i + " a " + a + "," + s + " 0,0,0 " + n + " 0 l 0," + -i, c = r.attr("label-offset-y", s).insert("path", ":first-child").attr("d", o).attr("transform", "translate(" + -n / 2 + "," + -(i / 2 + s) + ")");
|
530 | return t.intersect = function(d) {
|
531 | const l = Z(t, d), g = l.x - t.x;
|
532 | if (a != 0 && (Math.abs(g) < t.width / 2 || Math.abs(g) == t.width / 2 && Math.abs(l.y - t.y) > t.height / 2 - s)) {
|
533 | let h = s * s * (1 - g * g / (a * a));
|
534 | h != 0 && (h = Math.sqrt(h)), h = s - h, d.y - t.y > 0 && (h = -h), l.y += h;
|
535 | }
|
536 | return l;
|
537 | }, c;
|
538 | }
|
539 | function ye(r) {
|
540 | r.shapes().question = dt, r.shapes().hexagon = ht, r.shapes().stadium = wt, r.shapes().subroutine = mt, r.shapes().cylinder = xt, r.shapes().rect_left_inv_arrow = ut, r.shapes().lean_right = ft, r.shapes().lean_left = pt, r.shapes().trapezoid = gt, r.shapes().inv_trapezoid = yt, r.shapes().rect_right_inv_arrow = vt;
|
541 | }
|
542 | function ve(r) {
|
543 | r({ question: dt }), r({ hexagon: ht }), r({ stadium: wt }), r({ subroutine: mt }), r({ cylinder: xt }), r({ rect_left_inv_arrow: ut }), r({ lean_right: ft }), r({ lean_left: pt }), r({ trapezoid: gt }), r({ inv_trapezoid: yt }), r({ rect_right_inv_arrow: vt });
|
544 | }
|
545 | function A(r, e, t, n) {
|
546 | return r.insert("polygon", ":first-child").attr(
|
547 | "points",
|
548 | n.map(function(a) {
|
549 | return a.x + "," + a.y;
|
550 | }).join(" ")
|
551 | ).attr("transform", "translate(" + -e / 2 + "," + t / 2 + ")");
|
552 | }
|
553 | const we = {
|
554 | addToRender: ye,
|
555 | addToRenderV2: ve
|
556 | }, bt = {}, me = function(r) {
|
557 | const e = Object.keys(r);
|
558 | for (const t of e)
|
559 | bt[t] = r[t];
|
560 | }, kt = async function(r, e, t, n, a, s) {
|
561 | const i = n ? n.select(`[id="${t}"]`) : x(`[id="${t}"]`), o = a || document, c = Object.keys(r);
|
562 | for (const d of c) {
|
563 | const l = r[d];
|
564 | let g = "default";
|
565 | l.classes.length > 0 && (g = l.classes.join(" "));
|
566 | const h = Y(l.styles);
|
567 | let u = l.text !== void 0 ? l.text : l.id, p;
|
568 | if (et(G().flowchart.htmlLabels)) {
|
569 | const y = {
|
570 | label: await rt(
|
571 | u.replace(
|
572 | /fa[blrs]?:fa-[\w-]+/g,
|
573 |
|
574 | (k) => `<i class='${k.replace(":", " ")}'></i>`
|
575 | ),
|
576 | G()
|
577 | )
|
578 | };
|
579 | p = nt(i, y).node(), p.parentNode.removeChild(p);
|
580 | } else {
|
581 | const y = o.createElementNS("http://www.w3.org/2000/svg", "text");
|
582 | y.setAttribute("style", h.labelStyle.replace("color:", "fill:"));
|
583 | const k = u.split(at.lineBreakRegex);
|
584 | for (const I of k) {
|
585 | const _ = o.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
586 | _.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), _.setAttribute("dy", "1em"), _.setAttribute("x", "1"), _.textContent = I, y.appendChild(_);
|
587 | }
|
588 | p = y;
|
589 | }
|
590 | let v = 0, f = "";
|
591 | switch (l.type) {
|
592 | case "round":
|
593 | v = 5, f = "rect";
|
594 | break;
|
595 | case "square":
|
596 | f = "rect";
|
597 | break;
|
598 | case "diamond":
|
599 | f = "question";
|
600 | break;
|
601 | case "hexagon":
|
602 | f = "hexagon";
|
603 | break;
|
604 | case "odd":
|
605 | f = "rect_left_inv_arrow";
|
606 | break;
|
607 | case "lean_right":
|
608 | f = "lean_right";
|
609 | break;
|
610 | case "lean_left":
|
611 | f = "lean_left";
|
612 | break;
|
613 | case "trapezoid":
|
614 | f = "trapezoid";
|
615 | break;
|
616 | case "inv_trapezoid":
|
617 | f = "inv_trapezoid";
|
618 | break;
|
619 | case "odd_right":
|
620 | f = "rect_left_inv_arrow";
|
621 | break;
|
622 | case "circle":
|
623 | f = "circle";
|
624 | break;
|
625 | case "ellipse":
|
626 | f = "ellipse";
|
627 | break;
|
628 | case "stadium":
|
629 | f = "stadium";
|
630 | break;
|
631 | case "subroutine":
|
632 | f = "subroutine";
|
633 | break;
|
634 | case "cylinder":
|
635 | f = "cylinder";
|
636 | break;
|
637 | case "group":
|
638 | f = "rect";
|
639 | break;
|
640 | default:
|
641 | f = "rect";
|
642 | }
|
643 | R.warn("Adding node", l.id, l.domId), e.setNode(s.db.lookUpDomId(l.id), {
|
644 | labelType: "svg",
|
645 | labelStyle: h.labelStyle,
|
646 | shape: f,
|
647 | label: p,
|
648 | rx: v,
|
649 | ry: v,
|
650 | class: g,
|
651 | style: h.style,
|
652 | id: s.db.lookUpDomId(l.id)
|
653 | });
|
654 | }
|
655 | }, St = async function(r, e, t) {
|
656 | let n = 0, a, s;
|
657 | if (r.defaultStyle !== void 0) {
|
658 | const i = Y(r.defaultStyle);
|
659 | a = i.style, s = i.labelStyle;
|
660 | }
|
661 | for (const i of r) {
|
662 | n++;
|
663 | const o = "L-" + i.start + "-" + i.end, c = "LS-" + i.start, d = "LE-" + i.end, l = {};
|
664 | i.type === "arrow_open" ? l.arrowhead = "none" : l.arrowhead = "normal";
|
665 | let g = "", h = "";
|
666 | if (i.style !== void 0) {
|
667 | const u = Y(i.style);
|
668 | g = u.style, h = u.labelStyle;
|
669 | } else
|
670 | switch (i.stroke) {
|
671 | case "normal":
|
672 | g = "fill:none", a !== void 0 && (g = a), s !== void 0 && (h = s);
|
673 | break;
|
674 | case "dotted":
|
675 | g = "fill:none;stroke-width:2px;stroke-dasharray:3;";
|
676 | break;
|
677 | case "thick":
|
678 | g = " stroke-width: 3.5px;fill:none";
|
679 | break;
|
680 | }
|
681 | l.style = g, l.labelStyle = h, i.interpolate !== void 0 ? l.curve = z(i.interpolate, U) : r.defaultInterpolate !== void 0 ? l.curve = z(r.defaultInterpolate, U) : l.curve = z(bt.curve, U), i.text === void 0 ? i.style !== void 0 && (l.arrowheadStyle = "fill: #333") : (l.arrowheadStyle = "fill: #333", l.labelpos = "c", et(G().flowchart.htmlLabels) ? (l.labelType = "html", l.label = `<span id="L-${o}" class="edgeLabel L-${c}' L-${d}" style="${l.labelStyle}">${await rt(
|
682 | i.text.replace(
|
683 | /fa[blrs]?:fa-[\w-]+/g,
|
684 | // cspell:disable-line
|
685 | (u) => `<i class='${u.replace(":", " ")}'></i>`
|
686 | ),
|
687 | G()
|
688 | )}</span>`) : (l.labelType = "text", l.label = i.text.replace(at.lineBreakRegex, `
|
689 | `), i.style === void 0 && (l.style = l.style || "stroke: #333; stroke-width: 1.5px;fill:none"), l.labelStyle = l.labelStyle.replace("color:", "fill:"))), l.id = o, l.class = c + " " + d, l.minlen = i.length || 1, e.setEdge(t.db.lookUpDomId(i.start), t.db.lookUpDomId(i.end), l, n);
|
690 | }
|
691 | }, xe = function(r, e) {
|
692 | return R.info("Extracting classes"), e.db.getClasses();
|
693 | }, be = async function(r, e, t, n) {
|
694 | R.info("Drawing flowchart");
|
695 | const { securityLevel: a, flowchart: s } = G();
|
696 | let i;
|
697 | a === "sandbox" && (i = x("#i" + e));
|
698 | const o = a === "sandbox" ? x(i.nodes()[0].contentDocument.body) : x("body"), c = a === "sandbox" ? i.nodes()[0].contentDocument : document;
|
699 | let d = n.db.getDirection();
|
700 | d === void 0 && (d = "TD");
|
701 | const l = s.nodeSpacing || 50, g = s.rankSpacing || 50, h = new _t({
|
702 | multigraph: !0,
|
703 | compound: !0
|
704 | }).setGraph({
|
705 | rankdir: d,
|
706 | nodesep: l,
|
707 | ranksep: g,
|
708 | marginx: 8,
|
709 | marginy: 8
|
710 | }).setDefaultEdgeLabel(function() {
|
711 | return {};
|
712 | });
|
713 | let u;
|
714 | const p = n.db.getSubGraphs();
|
715 | for (let w = p.length - 1; w >= 0; w--)
|
716 | u = p[w], n.db.addVertex(u.id, u.title, "group", void 0, u.classes);
|
717 | const v = n.db.getVertices();
|
718 | R.warn("Get vertices", v);
|
719 | const f = n.db.getEdges();
|
720 | let y = 0;
|
721 | for (y = p.length - 1; y >= 0; y--) {
|
722 | u = p[y], It("cluster").append("text");
|
723 | for (let w = 0; w < u.nodes.length; w++)
|
724 | R.warn(
|
725 | "Setting subgraph",
|
726 | u.nodes[w],
|
727 | n.db.lookUpDomId(u.nodes[w]),
|
728 | n.db.lookUpDomId(u.id)
|
729 | ), h.setParent(n.db.lookUpDomId(u.nodes[w]), n.db.lookUpDomId(u.id));
|
730 | }
|
731 | await kt(v, h, e, o, c, n), await St(f, h, n);
|
732 | const k = new he();
|
733 | we.addToRender(k), k.arrows().none = function(b, L, m, B) {
|
734 | const C = b.append("marker").attr("id", L).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
|
735 | N(C, m[B + "Style"]);
|
736 | }, k.arrows().normal = function(b, L) {
|
737 | b.append("marker").attr("id", L).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
738 | };
|
739 | const I = o.select(`[id="${e}"]`), _ = o.select("#" + e + " g");
|
740 | for (k(_, h), _.selectAll("g.node").attr("title", function() {
|
741 | return n.db.getTooltip(this.id);
|
742 | }), n.db.indexNodes("subGraph" + y), y = 0; y < p.length; y++)
|
743 | if (u = p[y], u.title !== "undefined") {
|
744 | const w = c.querySelectorAll(
|
745 | "#" + e + ' [id="' + n.db.lookUpDomId(u.id) + '"] rect'
|
746 | ), b = c.querySelectorAll(
|
747 | "#" + e + ' [id="' + n.db.lookUpDomId(u.id) + '"]'
|
748 | ), L = w[0].x.baseVal.value, m = w[0].y.baseVal.value, B = w[0].width.baseVal.value, C = x(b[0]).select(".label");
|
749 | C.attr("transform", `translate(${L + B / 2}, ${m + 14})`), C.attr("id", e + "Text");
|
750 | for (let $ = 0; $ < u.classes.length; $++)
|
751 | b[0].classList.add(u.classes[$]);
|
752 | }
|
753 | if (!s.htmlLabels) {
|
754 | const w = c.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
|
755 | for (const b of w) {
|
756 | const L = b.getBBox(), m = c.createElementNS("http://www.w3.org/2000/svg", "rect");
|
757 | m.setAttribute("rx", 0), m.setAttribute("ry", 0), m.setAttribute("width", L.width), m.setAttribute("height", L.height), b.insertBefore(m, b.firstChild);
|
758 | }
|
759 | }
|
760 | Et(h, I, s.diagramPadding, s.useMaxWidth), Object.keys(v).forEach(function(w) {
|
761 | const b = v[w];
|
762 | if (b.link) {
|
763 | const L = o.select("#" + e + ' [id="' + n.db.lookUpDomId(w) + '"]');
|
764 | if (L) {
|
765 | const m = c.createElementNS("http://www.w3.org/2000/svg", "a");
|
766 | m.setAttributeNS("http://www.w3.org/2000/svg", "class", b.classes.join(" ")), m.setAttributeNS("http://www.w3.org/2000/svg", "href", b.link), m.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener"), a === "sandbox" ? m.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top") : b.linkTarget && m.setAttributeNS("http://www.w3.org/2000/svg", "target", b.linkTarget);
|
767 | const B = L.insert(function() {
|
768 | return m;
|
769 | }, ":first-child"), P = L.select(".label-container");
|
770 | P && B.append(function() {
|
771 | return P.node();
|
772 | });
|
773 | const C = L.select(".label");
|
774 | C && B.append(function() {
|
775 | return C.node();
|
776 | });
|
777 | }
|
778 | }
|
779 | });
|
780 | }, ke = {
|
781 | setConf: me,
|
782 | addVertices: kt,
|
783 | addEdges: St,
|
784 | getClasses: xe,
|
785 | draw: be
|
786 | }, Ge = {
|
787 | parser: Lt,
|
788 | db: V,
|
789 | renderer: Bt,
|
790 | styles: Mt,
|
791 | init: (r) => {
|
792 | r.flowchart || (r.flowchart = {}), r.flowchart.arrowMarkerAbsolute = r.arrowMarkerAbsolute, ke.setConf(r.flowchart), V.clear(), V.setGen("gen-1");
|
793 | }
|
794 | };
|
795 | export {
|
796 | Ge as diagram
|
797 | };
|