UNPKG

45.8 kBJavaScriptView Raw
1import { l as g, p as H, c as b, b7 as Q, j as B, d as q, A as j, F as lt } from "./mermaid-9f2aa176.js";
2import { a as st } from "./createText-03b82060.js";
3import { l as ct } from "./line-24d93f1b.js";
4const ht = (e, t, a, i) => {
5 t.forEach((l) => {
6 wt[l](e, a, i);
7 });
8}, ot = (e, t, a) => {
9 g.trace("Making markers for ", a), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionStart").attr("class", "marker extension " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionEnd").attr("class", "marker extension " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
10}, yt = (e, t, a) => {
11 e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionStart").attr("class", "marker composition " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionEnd").attr("class", "marker composition " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
12}, ft = (e, t, a) => {
13 e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationStart").attr("class", "marker aggregation " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationEnd").attr("class", "marker aggregation " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
14}, pt = (e, t, a) => {
15 e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyStart").attr("class", "marker dependency " + t).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyEnd").attr("class", "marker dependency " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
16}, dt = (e, t, a) => {
17 e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopStart").attr("class", "marker lollipop " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopEnd").attr("class", "marker lollipop " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
18}, xt = (e, t, a) => {
19 e.append("marker").attr("id", a + "_" + t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
20}, gt = (e, t, a) => {
21 e.append("marker").attr("id", a + "_" + t + "-circleEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-circleStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
22}, ut = (e, t, a) => {
23 e.append("marker").attr("id", a + "_" + t + "-crossEnd").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-crossStart").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
24}, bt = (e, t, a) => {
25 e.append("defs").append("marker").attr("id", a + "_" + t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
26}, wt = {
27 extension: ot,
28 composition: yt,
29 aggregation: ft,
30 dependency: pt,
31 lollipop: dt,
32 point: xt,
33 circle: gt,
34 cross: ut,
35 barb: bt
36}, hr = ht;
37function mt(e, t) {
38 t && e.attr("style", t);
39}
40function kt(e) {
41 const t = B(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), a = t.append("xhtml:div"), i = e.label, l = e.isNode ? "nodeLabel" : "edgeLabel";
42 return a.html(
43 '<span class="' + l + '" ' + (e.labelStyle ? 'style="' + e.labelStyle + '"' : "") + ">" + i + "</span>"
44 ), mt(a, e.labelStyle), a.style("display", "inline-block"), a.style("white-space", "nowrap"), a.attr("xmlns", "http://www.w3.org/1999/xhtml"), t.node();
45}
46const vt = (e, t, a, i) => {
47 let l = e || "";
48 if (typeof l == "object" && (l = l[0]), H(b().flowchart.htmlLabels)) {
49 l = l.replace(/\\n|\n/g, "<br />"), g.debug("vertexText" + l);
50 const r = {
51 isNode: i,
52 label: Q(l).replace(
53 /fa[blrs]?:fa-[\w-]+/g,
54 // cspell: disable-line
55 (n) => `<i class='${n.replace(":", " ")}'></i>`
56 ),
57 labelStyle: t.replace("fill:", "color:")
58 };
59 return kt(r);
60 } else {
61 const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
62 r.setAttribute("style", t.replace("color:", "fill:"));
63 let s = [];
64 typeof l == "string" ? s = l.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(l) ? s = l : s = [];
65 for (const n of s) {
66 const c = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
67 c.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), c.setAttribute("dy", "1em"), c.setAttribute("x", "0"), a ? c.setAttribute("class", "title-row") : c.setAttribute("class", "row"), c.textContent = n.trim(), r.appendChild(c);
68 }
69 return r;
70 }
71}, R = vt, M = async (e, t, a, i) => {
72 let l;
73 const r = t.useHtmlLabels || H(b().flowchart.htmlLabels);
74 a ? l = a : l = "node default";
75 const s = e.insert("g").attr("class", l).attr("id", t.domId || t.id), n = s.insert("g").attr("class", "label").attr("style", t.labelStyle);
76 let c;
77 t.labelText === void 0 ? c = "" : c = typeof t.labelText == "string" ? t.labelText : t.labelText[0];
78 const o = n.node();
79 let h;
80 t.labelType === "markdown" ? h = st(n, q(Q(c), b()), {
81 useHtmlLabels: r,
82 width: t.width || b().flowchart.wrappingWidth,
83 classes: "markdown-node-label"
84 }) : h = o.appendChild(
85 R(
86 q(Q(c), b()),
87 t.labelStyle,
88 !1,
89 i
90 )
91 );
92 let y = h.getBBox();
93 const p = t.padding / 2;
94 if (H(b().flowchart.htmlLabels)) {
95 const f = h.children[0], x = B(h), k = f.getElementsByTagName("img");
96 if (k) {
97 const d = c.replace(/<img[^>]*>/g, "").trim() === "";
98 await Promise.all(
99 [...k].map(
100 (u) => new Promise((S) => {
101 function E() {
102 if (u.style.display = "flex", u.style.flexDirection = "column", d) {
103 const C = b().fontSize ? b().fontSize : window.getComputedStyle(document.body).fontSize, W = 5, A = parseInt(C, 10) * W + "px";
104 u.style.minWidth = A, u.style.maxWidth = A;
105 } else
106 u.style.width = "100%";
107 S(u);
108 }
109 setTimeout(() => {
110 u.complete && E();
111 }), u.addEventListener("error", E), u.addEventListener("load", E);
112 })
113 )
114 );
115 }
116 y = f.getBoundingClientRect(), x.attr("width", y.width), x.attr("height", y.height);
117 }
118 return r ? n.attr("transform", "translate(" + -y.width / 2 + ", " + -y.height / 2 + ")") : n.attr("transform", "translate(0, " + -y.height / 2 + ")"), t.centerLabel && n.attr("transform", "translate(" + -y.width / 2 + ", " + -y.height / 2 + ")"), n.insert("rect", ":first-child"), { shapeSvg: s, bbox: y, halfPadding: p, label: n };
119}, m = (e, t) => {
120 const a = t.node().getBBox();
121 e.width = a.width, e.height = a.height;
122};
123function I(e, t, a, i) {
124 return e.insert("polygon", ":first-child").attr(
125 "points",
126 i.map(function(l) {
127 return l.x + "," + l.y;
128 }).join(" ")
129 ).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + a / 2 + ")");
130}
131function Lt(e, t) {
132 return e.intersect(t);
133}
134function it(e, t, a, i) {
135 var l = e.x, r = e.y, s = l - i.x, n = r - i.y, c = Math.sqrt(t * t * n * n + a * a * s * s), o = Math.abs(t * a * s / c);
136 i.x < l && (o = -o);
137 var h = Math.abs(t * a * n / c);
138 return i.y < r && (h = -h), { x: l + o, y: r + h };
139}
140function St(e, t, a) {
141 return it(e, t, t, a);
142}
143function Mt(e, t, a, i) {
144 var l, r, s, n, c, o, h, y, p, f, x, k, d, u, S;
145 if (l = t.y - e.y, s = e.x - t.x, c = t.x * e.y - e.x * t.y, p = l * a.x + s * a.y + c, f = l * i.x + s * i.y + c, !(p !== 0 && f !== 0 && J(p, f)) && (r = i.y - a.y, n = a.x - i.x, o = i.x * a.y - a.x * i.y, h = r * e.x + n * e.y + o, y = r * t.x + n * t.y + o, !(h !== 0 && y !== 0 && J(h, y)) && (x = l * n - r * s, x !== 0)))
146 return k = Math.abs(x / 2), d = s * o - n * c, u = d < 0 ? (d - k) / x : (d + k) / x, d = r * c - l * o, S = d < 0 ? (d - k) / x : (d + k) / x, { x: u, y: S };
147}
148function J(e, t) {
149 return e * t > 0;
150}
151function Tt(e, t, a) {
152 var i = e.x, l = e.y, r = [], s = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY;
153 typeof t.forEach == "function" ? t.forEach(function(x) {
154 s = Math.min(s, x.x), n = Math.min(n, x.y);
155 }) : (s = Math.min(s, t.x), n = Math.min(n, t.y));
156 for (var c = i - e.width / 2 - s, o = l - e.height / 2 - n, h = 0; h < t.length; h++) {
157 var y = t[h], p = t[h < t.length - 1 ? h + 1 : 0], f = Mt(
158 e,
159 a,
160 { x: c + y.x, y: o + y.y },
161 { x: c + p.x, y: o + p.y }
162 );
163 f && r.push(f);
164 }
165 return r.length ? (r.length > 1 && r.sort(function(x, k) {
166 var d = x.x - a.x, u = x.y - a.y, S = Math.sqrt(d * d + u * u), E = k.x - a.x, C = k.y - a.y, W = Math.sqrt(E * E + C * C);
167 return S < W ? -1 : S === W ? 0 : 1;
168 }), r[0]) : e;
169}
170const Et = (e, t) => {
171 var a = e.x, i = e.y, l = t.x - a, r = t.y - i, s = e.width / 2, n = e.height / 2, c, o;
172 return Math.abs(r) * s > Math.abs(l) * n ? (r < 0 && (n = -n), c = r === 0 ? 0 : n * l / r, o = n) : (l < 0 && (s = -s), c = s, o = l === 0 ? 0 : s * r / l), { x: a + c, y: i + o };
173}, Bt = Et, w = {
174 node: Lt,
175 circle: St,
176 ellipse: it,
177 polygon: Tt,
178 rect: Bt
179}, Ct = async (e, t) => {
180 t.useHtmlLabels || b().flowchart.htmlLabels || (t.centerLabel = !0);
181 const { shapeSvg: i, bbox: l, halfPadding: r } = await M(
182 e,
183 t,
184 "node " + t.classes,
185 !0
186 );
187 g.info("Classes = ", t.classes);
188 const s = i.insert("rect", ":first-child");
189 return s.attr("rx", t.rx).attr("ry", t.ry).attr("x", -l.width / 2 - r).attr("y", -l.height / 2 - r).attr("width", l.width + t.padding).attr("height", l.height + t.padding), m(t, s), t.intersect = function(n) {
190 return w.rect(t, n);
191 }, i;
192}, $t = Ct, _t = (e) => {
193 const t = /* @__PURE__ */ new Set();
194 for (const a of e)
195 switch (a) {
196 case "x":
197 t.add("right"), t.add("left");
198 break;
199 case "y":
200 t.add("up"), t.add("down");
201 break;
202 default:
203 t.add(a);
204 break;
205 }
206 return t;
207}, Rt = (e, t, a) => {
208 const i = _t(e), l = 2, r = t.height + 2 * a.padding, s = r / l, n = t.width + 2 * s + a.padding, c = a.padding / 2;
209 return i.has("right") && i.has("left") && i.has("up") && i.has("down") ? [
210 // Bottom
211 { x: 0, y: 0 },
212 { x: s, y: 0 },
213 { x: n / 2, y: 2 * c },
214 { x: n - s, y: 0 },
215 { x: n, y: 0 },
216 // Right
217 { x: n, y: -r / 3 },
218 { x: n + 2 * c, y: -r / 2 },
219 { x: n, y: -2 * r / 3 },
220 { x: n, y: -r },
221 // Top
222 { x: n - s, y: -r },
223 { x: n / 2, y: -r - 2 * c },
224 { x: s, y: -r },
225 // Left
226 { x: 0, y: -r },
227 { x: 0, y: -2 * r / 3 },
228 { x: -2 * c, y: -r / 2 },
229 { x: 0, y: -r / 3 }
230 ] : i.has("right") && i.has("left") && i.has("up") ? [
231 { x: s, y: 0 },
232 { x: n - s, y: 0 },
233 { x: n, y: -r / 2 },
234 { x: n - s, y: -r },
235 { x: s, y: -r },
236 { x: 0, y: -r / 2 }
237 ] : i.has("right") && i.has("left") && i.has("down") ? [
238 { x: 0, y: 0 },
239 { x: s, y: -r },
240 { x: n - s, y: -r },
241 { x: n, y: 0 }
242 ] : i.has("right") && i.has("up") && i.has("down") ? [
243 { x: 0, y: 0 },
244 { x: n, y: -s },
245 { x: n, y: -r + s },
246 { x: 0, y: -r }
247 ] : i.has("left") && i.has("up") && i.has("down") ? [
248 { x: n, y: 0 },
249 { x: 0, y: -s },
250 { x: 0, y: -r + s },
251 { x: n, y: -r }
252 ] : i.has("right") && i.has("left") ? [
253 { x: s, y: 0 },
254 { x: s, y: -c },
255 { x: n - s, y: -c },
256 { x: n - s, y: 0 },
257 { x: n, y: -r / 2 },
258 { x: n - s, y: -r },
259 { x: n - s, y: -r + c },
260 { x: s, y: -r + c },
261 { x: s, y: -r },
262 { x: 0, y: -r / 2 }
263 ] : i.has("up") && i.has("down") ? [
264 // Bottom center
265 { x: n / 2, y: 0 },
266 // Left pont of bottom arrow
267 { x: 0, y: -c },
268 { x: s, y: -c },
269 // Left top over vertical section
270 { x: s, y: -r + c },
271 { x: 0, y: -r + c },
272 // Top of arrow
273 { x: n / 2, y: -r },
274 { x: n, y: -r + c },
275 // Top of right vertical bar
276 { x: n - s, y: -r + c },
277 { x: n - s, y: -c },
278 { x: n, y: -c }
279 ] : i.has("right") && i.has("up") ? [
280 { x: 0, y: 0 },
281 { x: n, y: -s },
282 { x: 0, y: -r }
283 ] : i.has("right") && i.has("down") ? [
284 { x: 0, y: 0 },
285 { x: n, y: 0 },
286 { x: 0, y: -r }
287 ] : i.has("left") && i.has("up") ? [
288 { x: n, y: 0 },
289 { x: 0, y: -s },
290 { x: n, y: -r }
291 ] : i.has("left") && i.has("down") ? [
292 { x: n, y: 0 },
293 { x: 0, y: 0 },
294 { x: n, y: -r }
295 ] : i.has("right") ? [
296 { x: s, y: -c },
297 { x: s, y: -c },
298 { x: n - s, y: -c },
299 { x: n - s, y: 0 },
300 { x: n, y: -r / 2 },
301 { x: n - s, y: -r },
302 { x: n - s, y: -r + c },
303 // top left corner of arrow
304 { x: s, y: -r + c },
305 { x: s, y: -r + c }
306 ] : i.has("left") ? [
307 { x: s, y: 0 },
308 { x: s, y: -c },
309 // Two points, the right corners
310 { x: n - s, y: -c },
311 { x: n - s, y: -r + c },
312 { x: s, y: -r + c },
313 { x: s, y: -r },
314 { x: 0, y: -r / 2 }
315 ] : i.has("up") ? [
316 // Bottom center
317 { x: s, y: -c },
318 // Left top over vertical section
319 { x: s, y: -r + c },
320 { x: 0, y: -r + c },
321 // Top of arrow
322 { x: n / 2, y: -r },
323 { x: n, y: -r + c },
324 // Top of right vertical bar
325 { x: n - s, y: -r + c },
326 { x: n - s, y: -c }
327 ] : i.has("down") ? [
328 // Bottom center
329 { x: n / 2, y: 0 },
330 // Left pont of bottom arrow
331 { x: 0, y: -c },
332 { x: s, y: -c },
333 // Left top over vertical section
334 { x: s, y: -r + c },
335 { x: n - s, y: -r + c },
336 { x: n - s, y: -c },
337 { x: n, y: -c }
338 ] : [{ x: 0, y: 0 }];
339}, K = (e) => e ? " " + e : "", _ = (e, t) => `${t || "node default"}${K(e.classes)} ${K(
340 e.class
341)}`, P = async (e, t) => {
342 const { shapeSvg: a, bbox: i } = await M(
343 e,
344 t,
345 _(t, void 0),
346 !0
347 ), l = i.width + t.padding, r = i.height + t.padding, s = l + r, n = [
348 { x: s / 2, y: 0 },
349 { x: s, y: -s / 2 },
350 { x: s / 2, y: -s },
351 { x: 0, y: -s / 2 }
352 ];
353 g.info("Question main (Circle)");
354 const c = I(a, s, s, n);
355 return c.attr("style", t.style), m(t, c), t.intersect = function(o) {
356 return g.warn("Intersect called"), w.polygon(t, n, o);
357 }, a;
358}, Ht = (e, t) => {
359 const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), i = 28, l = [
360 { x: 0, y: i / 2 },
361 { x: i / 2, y: 0 },
362 { x: 0, y: -i / 2 },
363 { x: -i / 2, y: 0 }
364 ];
365 return a.insert("polygon", ":first-child").attr(
366 "points",
367 l.map(function(s) {
368 return s.x + "," + s.y;
369 }).join(" ")
370 ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(s) {
371 return w.circle(t, 14, s);
372 }, a;
373}, It = async (e, t) => {
374 const { shapeSvg: a, bbox: i } = await M(
375 e,
376 t,
377 _(t, void 0),
378 !0
379 ), l = 4, r = i.height + t.padding, s = r / l, n = i.width + 2 * s + t.padding, c = [
380 { x: s, y: 0 },
381 { x: n - s, y: 0 },
382 { x: n, y: -r / 2 },
383 { x: n - s, y: -r },
384 { x: s, y: -r },
385 { x: 0, y: -r / 2 }
386 ], o = I(a, n, r, c);
387 return o.attr("style", t.style), m(t, o), t.intersect = function(h) {
388 return w.polygon(t, c, h);
389 }, a;
390}, Nt = async (e, t) => {
391 const { shapeSvg: a, bbox: i } = await M(e, t, void 0, !0), l = 2, r = i.height + 2 * t.padding, s = r / l, n = i.width + 2 * s + t.padding, c = Rt(t.directions, i, t), o = I(a, n, r, c);
392 return o.attr("style", t.style), m(t, o), t.intersect = function(h) {
393 return w.polygon(t, c, h);
394 }, a;
395}, Ot = async (e, t) => {
396 const { shapeSvg: a, bbox: i } = await M(
397 e,
398 t,
399 _(t, void 0),
400 !0
401 ), l = i.width + t.padding, r = i.height + t.padding, s = [
402 { x: -r / 2, y: 0 },
403 { x: l, y: 0 },
404 { x: l, y: -r },
405 { x: -r / 2, y: -r },
406 { x: 0, y: -r / 2 }
407 ];
408 return I(a, l, r, s).attr("style", t.style), t.width = l + r, t.height = r, t.intersect = function(c) {
409 return w.polygon(t, s, c);
410 }, a;
411}, Wt = async (e, t) => {
412 const { shapeSvg: a, bbox: i } = await M(e, t, _(t), !0), l = i.width + t.padding, r = i.height + t.padding, s = [
413 { x: -2 * r / 6, y: 0 },
414 { x: l - r / 6, y: 0 },
415 { x: l + 2 * r / 6, y: -r },
416 { x: r / 6, y: -r }
417 ], n = I(a, l, r, s);
418 return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
419 return w.polygon(t, s, c);
420 }, a;
421}, Xt = async (e, t) => {
422 const { shapeSvg: a, bbox: i } = await M(
423 e,
424 t,
425 _(t, void 0),
426 !0
427 ), l = i.width + t.padding, r = i.height + t.padding, s = [
428 { x: 2 * r / 6, y: 0 },
429 { x: l + r / 6, y: 0 },
430 { x: l - 2 * r / 6, y: -r },
431 { x: -r / 6, y: -r }
432 ], n = I(a, l, r, s);
433 return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
434 return w.polygon(t, s, c);
435 }, a;
436}, Yt = async (e, t) => {
437 const { shapeSvg: a, bbox: i } = await M(
438 e,
439 t,
440 _(t, void 0),
441 !0
442 ), l = i.width + t.padding, r = i.height + t.padding, s = [
443 { x: -2 * r / 6, y: 0 },
444 { x: l + 2 * r / 6, y: 0 },
445 { x: l - r / 6, y: -r },
446 { x: r / 6, y: -r }
447 ], n = I(a, l, r, s);
448 return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
449 return w.polygon(t, s, c);
450 }, a;
451}, At = async (e, t) => {
452 const { shapeSvg: a, bbox: i } = await M(
453 e,
454 t,
455 _(t, void 0),
456 !0
457 ), l = i.width + t.padding, r = i.height + t.padding, s = [
458 { x: r / 6, y: 0 },
459 { x: l - r / 6, y: 0 },
460 { x: l + 2 * r / 6, y: -r },
461 { x: -2 * r / 6, y: -r }
462 ], n = I(a, l, r, s);
463 return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
464 return w.polygon(t, s, c);
465 }, a;
466}, Dt = async (e, t) => {
467 const { shapeSvg: a, bbox: i } = await M(
468 e,
469 t,
470 _(t, void 0),
471 !0
472 ), l = i.width + t.padding, r = i.height + t.padding, s = [
473 { x: 0, y: 0 },
474 { x: l + r / 2, y: 0 },
475 { x: l, y: -r / 2 },
476 { x: l + r / 2, y: -r },
477 { x: 0, y: -r }
478 ], n = I(a, l, r, s);
479 return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
480 return w.polygon(t, s, c);
481 }, a;
482}, jt = async (e, t) => {
483 const { shapeSvg: a, bbox: i } = await M(
484 e,
485 t,
486 _(t, void 0),
487 !0
488 ), l = i.width + t.padding, r = l / 2, s = r / (2.5 + l / 50), n = i.height + s + t.padding, c = "M 0," + s + " a " + r + "," + s + " 0,0,0 " + l + " 0 a " + r + "," + s + " 0,0,0 " + -l + " 0 l 0," + n + " a " + r + "," + s + " 0,0,0 " + l + " 0 l 0," + -n, o = a.attr("label-offset-y", s).insert("path", ":first-child").attr("style", t.style).attr("d", c).attr("transform", "translate(" + -l / 2 + "," + -(n / 2 + s) + ")");
489 return m(t, o), t.intersect = function(h) {
490 const y = w.rect(t, h), p = y.x - t.x;
491 if (r != 0 && (Math.abs(p) < t.width / 2 || Math.abs(p) == t.width / 2 && Math.abs(y.y - t.y) > t.height / 2 - s)) {
492 let f = s * s * (1 - p * p / (r * r));
493 f != 0 && (f = Math.sqrt(f)), f = s - f, h.y - t.y > 0 && (f = -f), y.y += f;
494 }
495 return y;
496 }, a;
497}, Ut = async (e, t) => {
498 const { shapeSvg: a, bbox: i, halfPadding: l } = await M(
499 e,
500 t,
501 "node " + t.classes + " " + t.class,
502 !0
503 ), r = a.insert("rect", ":first-child"), s = t.positioned ? t.width : i.width + t.padding, n = t.positioned ? t.height : i.height + t.padding, c = t.positioned ? -s / 2 : -i.width / 2 - l, o = t.positioned ? -n / 2 : -i.height / 2 - l;
504 if (r.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", c).attr("y", o).attr("width", s).attr("height", n), t.props) {
505 const h = new Set(Object.keys(t.props));
506 t.props.borders && (V(r, t.props.borders, s, n), h.delete("borders")), h.forEach((y) => {
507 g.warn(`Unknown node property ${y}`);
508 });
509 }
510 return m(t, r), t.intersect = function(h) {
511 return w.rect(t, h);
512 }, a;
513}, zt = async (e, t) => {
514 const { shapeSvg: a, bbox: i, halfPadding: l } = await M(
515 e,
516 t,
517 "node " + t.classes,
518 !0
519 ), r = a.insert("rect", ":first-child"), s = t.positioned ? t.width : i.width + t.padding, n = t.positioned ? t.height : i.height + t.padding, c = t.positioned ? -s / 2 : -i.width / 2 - l, o = t.positioned ? -n / 2 : -i.height / 2 - l;
520 if (r.attr("class", "basic cluster composite label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", c).attr("y", o).attr("width", s).attr("height", n), t.props) {
521 const h = new Set(Object.keys(t.props));
522 t.props.borders && (V(r, t.props.borders, s, n), h.delete("borders")), h.forEach((y) => {
523 g.warn(`Unknown node property ${y}`);
524 });
525 }
526 return m(t, r), t.intersect = function(h) {
527 return w.rect(t, h);
528 }, a;
529}, Zt = async (e, t) => {
530 const { shapeSvg: a } = await M(e, t, "label", !0);
531 g.trace("Classes = ", t.class);
532 const i = a.insert("rect", ":first-child"), l = 0, r = 0;
533 if (i.attr("width", l).attr("height", r), a.attr("class", "label edgeLabel"), t.props) {
534 const s = new Set(Object.keys(t.props));
535 t.props.borders && (V(i, t.props.borders, l, r), s.delete("borders")), s.forEach((n) => {
536 g.warn(`Unknown node property ${n}`);
537 });
538 }
539 return m(t, i), t.intersect = function(s) {
540 return w.rect(t, s);
541 }, a;
542};
543function V(e, t, a, i) {
544 const l = [], r = (n) => {
545 l.push(n, 0);
546 }, s = (n) => {
547 l.push(0, n);
548 };
549 t.includes("t") ? (g.debug("add top border"), r(a)) : s(a), t.includes("r") ? (g.debug("add right border"), r(i)) : s(i), t.includes("b") ? (g.debug("add bottom border"), r(a)) : s(a), t.includes("l") ? (g.debug("add left border"), r(i)) : s(i), e.attr("stroke-dasharray", l.join(" "));
550}
551const Gt = (e, t) => {
552 let a;
553 t.classes ? a = "node " + t.classes : a = "node default";
554 const i = e.insert("g").attr("class", a).attr("id", t.domId || t.id), l = i.insert("rect", ":first-child"), r = i.insert("line"), s = i.insert("g").attr("class", "label"), n = t.labelText.flat ? t.labelText.flat() : t.labelText;
555 let c = "";
556 typeof n == "object" ? c = n[0] : c = n, g.info("Label text abc79", c, n, typeof n == "object");
557 const o = s.node().appendChild(R(c, t.labelStyle, !0, !0));
558 let h = { width: 0, height: 0 };
559 if (H(b().flowchart.htmlLabels)) {
560 const k = o.children[0], d = B(o);
561 h = k.getBoundingClientRect(), d.attr("width", h.width), d.attr("height", h.height);
562 }
563 g.info("Text 2", n);
564 const y = n.slice(1, n.length);
565 let p = o.getBBox();
566 const f = s.node().appendChild(
567 R(y.join ? y.join("<br/>") : y, t.labelStyle, !0, !0)
568 );
569 if (H(b().flowchart.htmlLabels)) {
570 const k = f.children[0], d = B(f);
571 h = k.getBoundingClientRect(), d.attr("width", h.width), d.attr("height", h.height);
572 }
573 const x = t.padding / 2;
574 return B(f).attr(
575 "transform",
576 "translate( " + // (titleBox.width - bbox.width) / 2 +
577 (h.width > p.width ? 0 : (p.width - h.width) / 2) + ", " + (p.height + x + 5) + ")"
578 ), B(o).attr(
579 "transform",
580 "translate( " + // (titleBox.width - bbox.width) / 2 +
581 (h.width < p.width ? 0 : -(p.width - h.width) / 2) + ", 0)"
582 ), h = s.node().getBBox(), s.attr(
583 "transform",
584 "translate(" + -h.width / 2 + ", " + (-h.height / 2 - x + 3) + ")"
585 ), l.attr("class", "outer title-state").attr("x", -h.width / 2 - x).attr("y", -h.height / 2 - x).attr("width", h.width + t.padding).attr("height", h.height + t.padding), r.attr("class", "divider").attr("x1", -h.width / 2 - x).attr("x2", h.width / 2 + x).attr("y1", -h.height / 2 - x + p.height + x).attr("y2", -h.height / 2 - x + p.height + x), m(t, l), t.intersect = function(k) {
586 return w.rect(t, k);
587 }, i;
588}, Ft = async (e, t) => {
589 const { shapeSvg: a, bbox: i } = await M(
590 e,
591 t,
592 _(t, void 0),
593 !0
594 ), l = i.height + t.padding, r = i.width + l / 4 + t.padding, s = a.insert("rect", ":first-child").attr("style", t.style).attr("rx", l / 2).attr("ry", l / 2).attr("x", -r / 2).attr("y", -l / 2).attr("width", r).attr("height", l);
595 return m(t, s), t.intersect = function(n) {
596 return w.rect(t, n);
597 }, a;
598}, Qt = async (e, t) => {
599 const { shapeSvg: a, bbox: i, halfPadding: l } = await M(
600 e,
601 t,
602 _(t, void 0),
603 !0
604 ), r = a.insert("circle", ":first-child");
605 return r.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", i.width / 2 + l).attr("width", i.width + t.padding).attr("height", i.height + t.padding), g.info("Circle main"), m(t, r), t.intersect = function(s) {
606 return g.info("Circle intersect", t, i.width / 2 + l, s), w.circle(t, i.width / 2 + l, s);
607 }, a;
608}, Vt = async (e, t) => {
609 const { shapeSvg: a, bbox: i, halfPadding: l } = await M(
610 e,
611 t,
612 _(t, void 0),
613 !0
614 ), r = 5, s = a.insert("g", ":first-child"), n = s.insert("circle"), c = s.insert("circle");
615 return s.attr("class", t.class), n.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", i.width / 2 + l + r).attr("width", i.width + t.padding + r * 2).attr("height", i.height + t.padding + r * 2), c.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", i.width / 2 + l).attr("width", i.width + t.padding).attr("height", i.height + t.padding), g.info("DoubleCircle main"), m(t, n), t.intersect = function(o) {
616 return g.info("DoubleCircle intersect", t, i.width / 2 + l + r, o), w.circle(t, i.width / 2 + l + r, o);
617 }, a;
618}, qt = async (e, t) => {
619 const { shapeSvg: a, bbox: i } = await M(
620 e,
621 t,
622 _(t, void 0),
623 !0
624 ), l = i.width + t.padding, r = i.height + t.padding, s = [
625 { x: 0, y: 0 },
626 { x: l, y: 0 },
627 { x: l, y: -r },
628 { x: 0, y: -r },
629 { x: 0, y: 0 },
630 { x: -8, y: 0 },
631 { x: l + 8, y: 0 },
632 { x: l + 8, y: -r },
633 { x: -8, y: -r },
634 { x: -8, y: 0 }
635 ], n = I(a, l, r, s);
636 return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
637 return w.polygon(t, s, c);
638 }, a;
639}, Jt = (e, t) => {
640 const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), i = a.insert("circle", ":first-child");
641 return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), m(t, i), t.intersect = function(l) {
642 return w.circle(t, 7, l);
643 }, a;
644}, tt = (e, t, a) => {
645 const i = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id);
646 let l = 70, r = 10;
647 a === "LR" && (l = 10, r = 70);
648 const s = i.append("rect").attr("x", -1 * l / 2).attr("y", -1 * r / 2).attr("width", l).attr("height", r).attr("class", "fork-join");
649 return m(t, s), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(n) {
650 return w.rect(t, n);
651 }, i;
652}, Kt = (e, t) => {
653 const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), i = a.insert("circle", ":first-child"), l = a.insert("circle", ":first-child");
654 return l.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), i.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), m(t, l), t.intersect = function(r) {
655 return w.circle(t, 7, r);
656 }, a;
657}, Pt = (e, t) => {
658 const a = t.padding / 2, i = 4, l = 8;
659 let r;
660 t.classes ? r = "node " + t.classes : r = "node default";
661 const s = e.insert("g").attr("class", r).attr("id", t.domId || t.id), n = s.insert("rect", ":first-child"), c = s.insert("line"), o = s.insert("line");
662 let h = 0, y = i;
663 const p = s.insert("g").attr("class", "label");
664 let f = 0;
665 const x = t.classData.annotations && t.classData.annotations[0], k = t.classData.annotations[0] ? "«" + t.classData.annotations[0] + "»" : "", d = p.node().appendChild(R(k, t.labelStyle, !0, !0));
666 let u = d.getBBox();
667 if (H(b().flowchart.htmlLabels)) {
668 const v = d.children[0], L = B(d);
669 u = v.getBoundingClientRect(), L.attr("width", u.width), L.attr("height", u.height);
670 }
671 t.classData.annotations[0] && (y += u.height + i, h += u.width);
672 let S = t.classData.label;
673 t.classData.type !== void 0 && t.classData.type !== "" && (b().flowchart.htmlLabels ? S += "&lt;" + t.classData.type + "&gt;" : S += "<" + t.classData.type + ">");
674 const E = p.node().appendChild(R(S, t.labelStyle, !0, !0));
675 B(E).attr("class", "classTitle");
676 let C = E.getBBox();
677 if (H(b().flowchart.htmlLabels)) {
678 const v = E.children[0], L = B(E);
679 C = v.getBoundingClientRect(), L.attr("width", C.width), L.attr("height", C.height);
680 }
681 y += C.height + i, C.width > h && (h = C.width);
682 const W = [];
683 t.classData.members.forEach((v) => {
684 const L = v.getDisplayDetails();
685 let X = L.displayText;
686 b().flowchart.htmlLabels && (X = X.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
687 const N = p.node().appendChild(
688 R(
689 X,
690 L.cssStyle ? L.cssStyle : t.labelStyle,
691 !0,
692 !0
693 )
694 );
695 let $ = N.getBBox();
696 if (H(b().flowchart.htmlLabels)) {
697 const F = N.children[0], D = B(N);
698 $ = F.getBoundingClientRect(), D.attr("width", $.width), D.attr("height", $.height);
699 }
700 $.width > h && (h = $.width), y += $.height + i, W.push(N);
701 }), y += l;
702 const A = [];
703 if (t.classData.methods.forEach((v) => {
704 const L = v.getDisplayDetails();
705 let X = L.displayText;
706 b().flowchart.htmlLabels && (X = X.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
707 const N = p.node().appendChild(
708 R(
709 X,
710 L.cssStyle ? L.cssStyle : t.labelStyle,
711 !0,
712 !0
713 )
714 );
715 let $ = N.getBBox();
716 if (H(b().flowchart.htmlLabels)) {
717 const F = N.children[0], D = B(N);
718 $ = F.getBoundingClientRect(), D.attr("width", $.width), D.attr("height", $.height);
719 }
720 $.width > h && (h = $.width), y += $.height + i, A.push(N);
721 }), y += l, x) {
722 let v = (h - u.width) / 2;
723 B(d).attr(
724 "transform",
725 "translate( " + (-1 * h / 2 + v) + ", " + -1 * y / 2 + ")"
726 ), f = u.height + i;
727 }
728 let nt = (h - C.width) / 2;
729 return B(E).attr(
730 "transform",
731 "translate( " + (-1 * h / 2 + nt) + ", " + (-1 * y / 2 + f) + ")"
732 ), f += C.height + i, c.attr("class", "divider").attr("x1", -h / 2 - a).attr("x2", h / 2 + a).attr("y1", -y / 2 - a + l + f).attr("y2", -y / 2 - a + l + f), f += l, W.forEach((v) => {
733 B(v).attr(
734 "transform",
735 "translate( " + -h / 2 + ", " + (-1 * y / 2 + f + l / 2) + ")"
736 );
737 const L = v == null ? void 0 : v.getBBox();
738 f += ((L == null ? void 0 : L.height) ?? 0) + i;
739 }), f += l, o.attr("class", "divider").attr("x1", -h / 2 - a).attr("x2", h / 2 + a).attr("y1", -y / 2 - a + l + f).attr("y2", -y / 2 - a + l + f), f += l, A.forEach((v) => {
740 B(v).attr(
741 "transform",
742 "translate( " + -h / 2 + ", " + (-1 * y / 2 + f) + ")"
743 );
744 const L = v == null ? void 0 : v.getBBox();
745 f += ((L == null ? void 0 : L.height) ?? 0) + i;
746 }), n.attr("style", t.style).attr("class", "outer title-state").attr("x", -h / 2 - a).attr("y", -(y / 2) - a).attr("width", h + t.padding).attr("height", y + t.padding), m(t, n), t.intersect = function(v) {
747 return w.rect(t, v);
748 }, s;
749}, rt = {
750 rhombus: P,
751 composite: zt,
752 question: P,
753 rect: Ut,
754 labelRect: Zt,
755 rectWithTitle: Gt,
756 choice: Ht,
757 circle: Qt,
758 doublecircle: Vt,
759 stadium: Ft,
760 hexagon: It,
761 block_arrow: Nt,
762 rect_left_inv_arrow: Ot,
763 lean_right: Wt,
764 lean_left: Xt,
765 trapezoid: Yt,
766 inv_trapezoid: At,
767 rect_right_inv_arrow: Dt,
768 cylinder: jt,
769 start: Jt,
770 end: Kt,
771 note: $t,
772 subroutine: qt,
773 fork: tt,
774 join: tt,
775 class_box: Pt
776};
777let Y = {};
778const or = async (e, t, a) => {
779 let i, l;
780 if (t.link) {
781 let r;
782 b().securityLevel === "sandbox" ? r = "_top" : t.linkTarget && (r = t.linkTarget || "_blank"), i = e.insert("svg:a").attr("xlink:href", t.link).attr("target", r), l = await rt[t.shape](i, t, a);
783 } else
784 l = await rt[t.shape](e, t, a), i = l;
785 return t.tooltip && l.attr("title", t.tooltip), t.class && l.attr("class", "node default " + t.class), i.attr("data-node", "true"), i.attr("data-id", t.id), Y[t.id] = i, t.haveCallback && Y[t.id].attr("class", Y[t.id].attr("class") + " clickable"), i;
786}, yr = (e, t) => {
787 Y[t.id] = e;
788}, fr = () => {
789 Y = {};
790}, pr = (e) => {
791 const t = Y[e.id];
792 g.trace(
793 "Transforming node",
794 e.diff,
795 e,
796 "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")"
797 );
798 const a = 8, i = e.diff || 0;
799 return e.clusterNode ? t.attr(
800 "transform",
801 "translate(" + (e.x + i - e.width / 2) + ", " + (e.y - e.height / 2 - a) + ")"
802 ) : t.attr("transform", "translate(" + e.x + ", " + e.y + ")"), i;
803}, tr = ({
804 flowchart: e
805}) => {
806 var l, r;
807 const t = ((l = e == null ? void 0 : e.subGraphTitleMargin) == null ? void 0 : l.top) ?? 0, a = ((r = e == null ? void 0 : e.subGraphTitleMargin) == null ? void 0 : r.bottom) ?? 0, i = t + a;
808 return {
809 subGraphTitleTopMargin: t,
810 subGraphTitleBottomMargin: a,
811 subGraphTitleTotalMargin: i
812 };
813}, O = {
814 aggregation: 18,
815 extension: 18,
816 composition: 18,
817 dependency: 6,
818 lollipop: 13.5,
819 arrow_point: 5.3
820};
821function U(e, t) {
822 if (e === void 0 || t === void 0)
823 return { angle: 0, deltaX: 0, deltaY: 0 };
824 e = Z(e), t = Z(t);
825 const [a, i] = [e.x, e.y], [l, r] = [t.x, t.y], s = l - a, n = r - i;
826 return { angle: Math.atan(n / s), deltaX: s, deltaY: n };
827}
828const Z = (e) => Array.isArray(e) ? { x: e[0], y: e[1] } : e, rr = (e) => ({
829 x: function(t, a, i) {
830 let l = 0;
831 if (a === 0 && Object.hasOwn(O, e.arrowTypeStart)) {
832 const { angle: r, deltaX: s } = U(i[0], i[1]);
833 l = O[e.arrowTypeStart] * Math.cos(r) * (s >= 0 ? 1 : -1);
834 } else if (a === i.length - 1 && Object.hasOwn(O, e.arrowTypeEnd)) {
835 const { angle: r, deltaX: s } = U(
836 i[i.length - 1],
837 i[i.length - 2]
838 );
839 l = O[e.arrowTypeEnd] * Math.cos(r) * (s >= 0 ? 1 : -1);
840 }
841 return Z(t).x + l;
842 },
843 y: function(t, a, i) {
844 let l = 0;
845 if (a === 0 && Object.hasOwn(O, e.arrowTypeStart)) {
846 const { angle: r, deltaY: s } = U(i[0], i[1]);
847 l = O[e.arrowTypeStart] * Math.abs(Math.sin(r)) * (s >= 0 ? 1 : -1);
848 } else if (a === i.length - 1 && Object.hasOwn(O, e.arrowTypeEnd)) {
849 const { angle: r, deltaY: s } = U(
850 i[i.length - 1],
851 i[i.length - 2]
852 );
853 l = O[e.arrowTypeEnd] * Math.abs(Math.sin(r)) * (s >= 0 ? 1 : -1);
854 }
855 return Z(t).y + l;
856 }
857}), ar = (e, t, a, i, l) => {
858 t.arrowTypeStart && at(e, "start", t.arrowTypeStart, a, i, l), t.arrowTypeEnd && at(e, "end", t.arrowTypeEnd, a, i, l);
859}, er = {
860 arrow_cross: "cross",
861 arrow_point: "point",
862 arrow_barb: "barb",
863 arrow_circle: "circle",
864 aggregation: "aggregation",
865 extension: "extension",
866 composition: "composition",
867 dependency: "dependency",
868 lollipop: "lollipop"
869}, at = (e, t, a, i, l, r) => {
870 const s = er[a];
871 if (!s) {
872 g.warn(`Unknown arrow type: ${a}`);
873 return;
874 }
875 const n = t === "start" ? "Start" : "End";
876 e.attr(`marker-${t}`, `url(${i}#${l}_${r}-${s}${n})`);
877};
878let G = {}, T = {};
879const dr = () => {
880 G = {}, T = {};
881}, xr = (e, t) => {
882 const a = H(b().flowchart.htmlLabels), i = t.labelType === "markdown" ? st(e, t.label, {
883 style: t.labelStyle,
884 useHtmlLabels: a,
885 addSvgBackground: !0
886 }) : R(t.label, t.labelStyle), l = e.insert("g").attr("class", "edgeLabel"), r = l.insert("g").attr("class", "label");
887 r.node().appendChild(i);
888 let s = i.getBBox();
889 if (a) {
890 const c = i.children[0], o = B(i);
891 s = c.getBoundingClientRect(), o.attr("width", s.width), o.attr("height", s.height);
892 }
893 r.attr("transform", "translate(" + -s.width / 2 + ", " + -s.height / 2 + ")"), G[t.id] = l, t.width = s.width, t.height = s.height;
894 let n;
895 if (t.startLabelLeft) {
896 const c = R(t.startLabelLeft, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
897 n = h.node().appendChild(c);
898 const y = c.getBBox();
899 h.attr("transform", "translate(" + -y.width / 2 + ", " + -y.height / 2 + ")"), T[t.id] || (T[t.id] = {}), T[t.id].startLeft = o, z(n, t.startLabelLeft);
900 }
901 if (t.startLabelRight) {
902 const c = R(t.startLabelRight, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
903 n = o.node().appendChild(c), h.node().appendChild(c);
904 const y = c.getBBox();
905 h.attr("transform", "translate(" + -y.width / 2 + ", " + -y.height / 2 + ")"), T[t.id] || (T[t.id] = {}), T[t.id].startRight = o, z(n, t.startLabelRight);
906 }
907 if (t.endLabelLeft) {
908 const c = R(t.endLabelLeft, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
909 n = h.node().appendChild(c);
910 const y = c.getBBox();
911 h.attr("transform", "translate(" + -y.width / 2 + ", " + -y.height / 2 + ")"), o.node().appendChild(c), T[t.id] || (T[t.id] = {}), T[t.id].endLeft = o, z(n, t.endLabelLeft);
912 }
913 if (t.endLabelRight) {
914 const c = R(t.endLabelRight, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
915 n = h.node().appendChild(c);
916 const y = c.getBBox();
917 h.attr("transform", "translate(" + -y.width / 2 + ", " + -y.height / 2 + ")"), o.node().appendChild(c), T[t.id] || (T[t.id] = {}), T[t.id].endRight = o, z(n, t.endLabelRight);
918 }
919 return i;
920};
921function z(e, t) {
922 b().flowchart.htmlLabels && e && (e.style.width = t.length * 9 + "px", e.style.height = "12px");
923}
924const gr = (e, t) => {
925 g.debug("Moving label abc88 ", e.id, e.label, G[e.id], t);
926 let a = t.updatedPath ? t.updatedPath : t.originalPath;
927 const i = b(), { subGraphTitleTotalMargin: l } = tr(i);
928 if (e.label) {
929 const r = G[e.id];
930 let s = e.x, n = e.y;
931 if (a) {
932 const c = j.calcLabelPosition(a);
933 g.debug(
934 "Moving label " + e.label + " from (",
935 s,
936 ",",
937 n,
938 ") to (",
939 c.x,
940 ",",
941 c.y,
942 ") abc88"
943 ), t.updatedPath && (s = c.x, n = c.y);
944 }
945 r.attr("transform", `translate(${s}, ${n + l / 2})`);
946 }
947 if (e.startLabelLeft) {
948 const r = T[e.id].startLeft;
949 let s = e.x, n = e.y;
950 if (a) {
951 const c = j.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", a);
952 s = c.x, n = c.y;
953 }
954 r.attr("transform", `translate(${s}, ${n})`);
955 }
956 if (e.startLabelRight) {
957 const r = T[e.id].startRight;
958 let s = e.x, n = e.y;
959 if (a) {
960 const c = j.calcTerminalLabelPosition(
961 e.arrowTypeStart ? 10 : 0,
962 "start_right",
963 a
964 );
965 s = c.x, n = c.y;
966 }
967 r.attr("transform", `translate(${s}, ${n})`);
968 }
969 if (e.endLabelLeft) {
970 const r = T[e.id].endLeft;
971 let s = e.x, n = e.y;
972 if (a) {
973 const c = j.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", a);
974 s = c.x, n = c.y;
975 }
976 r.attr("transform", `translate(${s}, ${n})`);
977 }
978 if (e.endLabelRight) {
979 const r = T[e.id].endRight;
980 let s = e.x, n = e.y;
981 if (a) {
982 const c = j.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", a);
983 s = c.x, n = c.y;
984 }
985 r.attr("transform", `translate(${s}, ${n})`);
986 }
987}, sr = (e, t) => {
988 const a = e.x, i = e.y, l = Math.abs(t.x - a), r = Math.abs(t.y - i), s = e.width / 2, n = e.height / 2;
989 return l >= s || r >= n;
990}, ir = (e, t, a) => {
991 g.debug(`intersection calc abc89:
992 outsidePoint: ${JSON.stringify(t)}
993 insidePoint : ${JSON.stringify(a)}
994 node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);
995 const i = e.x, l = e.y, r = Math.abs(i - a.x), s = e.width / 2;
996 let n = a.x < t.x ? s - r : s + r;
997 const c = e.height / 2, o = Math.abs(t.y - a.y), h = Math.abs(t.x - a.x);
998 if (Math.abs(l - t.y) * s > Math.abs(i - t.x) * c) {
999 let y = a.y < t.y ? t.y - c - l : l - c - t.y;
1000 n = h * y / o;
1001 const p = {
1002 x: a.x < t.x ? a.x + n : a.x - h + n,
1003 y: a.y < t.y ? a.y + o - y : a.y - o + y
1004 };
1005 return n === 0 && (p.x = t.x, p.y = t.y), h === 0 && (p.x = t.x), o === 0 && (p.y = t.y), g.debug(`abc89 topp/bott calc, Q ${o}, q ${y}, R ${h}, r ${n}`, p), p;
1006 } else {
1007 a.x < t.x ? n = t.x - s - i : n = i - s - t.x;
1008 let y = o * n / h, p = a.x < t.x ? a.x + h - n : a.x - h + n, f = a.y < t.y ? a.y + y : a.y - y;
1009 return g.debug(`sides calc abc89, Q ${o}, q ${y}, R ${h}, r ${n}`, { _x: p, _y: f }), n === 0 && (p = t.x, f = t.y), h === 0 && (p = t.x), o === 0 && (f = t.y), { x: p, y: f };
1010 }
1011}, et = (e, t) => {
1012 g.debug("abc88 cutPathAtIntersect", e, t);
1013 let a = [], i = e[0], l = !1;
1014 return e.forEach((r) => {
1015 if (!sr(t, r) && !l) {
1016 const s = ir(t, i, r);
1017 let n = !1;
1018 a.forEach((c) => {
1019 n = n || c.x === s.x && c.y === s.y;
1020 }), a.some((c) => c.x === s.x && c.y === s.y) || a.push(s), l = !0;
1021 } else
1022 i = r, l || a.push(r);
1023 }), a;
1024}, ur = function(e, t, a, i, l, r, s) {
1025 let n = a.points;
1026 g.debug("abc88 InsertEdge: edge=", a, "e=", t);
1027 let c = !1;
1028 const o = r.node(t.v);
1029 var h = r.node(t.w);
1030 h != null && h.intersect && (o != null && o.intersect) && (n = n.slice(1, a.points.length - 1), n.unshift(o.intersect(n[0])), n.push(h.intersect(n[n.length - 1]))), a.toCluster && (g.debug("to cluster abc88", i[a.toCluster]), n = et(a.points, i[a.toCluster].node), c = !0), a.fromCluster && (g.debug("from cluster abc88", i[a.fromCluster]), n = et(n.reverse(), i[a.fromCluster].node).reverse(), c = !0);
1031 const y = n.filter((C) => !Number.isNaN(C.y));
1032 let p = lt;
1033 a.curve && (l === "graph" || l === "flowchart") && (p = a.curve);
1034 const { x: f, y: x } = rr(a), k = ct().x(f).y(x).curve(p);
1035 let d;
1036 switch (a.thickness) {
1037 case "normal":
1038 d = "edge-thickness-normal";
1039 break;
1040 case "thick":
1041 d = "edge-thickness-thick";
1042 break;
1043 case "invisible":
1044 d = "edge-thickness-thick";
1045 break;
1046 default:
1047 d = "";
1048 }
1049 switch (a.pattern) {
1050 case "solid":
1051 d += " edge-pattern-solid";
1052 break;
1053 case "dotted":
1054 d += " edge-pattern-dotted";
1055 break;
1056 case "dashed":
1057 d += " edge-pattern-dashed";
1058 break;
1059 }
1060 const u = e.append("path").attr("d", k(y)).attr("id", a.id).attr("class", " " + d + (a.classes ? " " + a.classes : "")).attr("style", a.style);
1061 let S = "";
1062 (b().flowchart.arrowMarkerAbsolute || b().state.arrowMarkerAbsolute) && (S = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, S = S.replace(/\(/g, "\\("), S = S.replace(/\)/g, "\\)")), ar(u, a, S, s, l);
1063 let E = {};
1064 return c && (E.updatedPath = n), E.originalPath = a.points, E;
1065};
1066export {
1067 hr as a,
1068 fr as b,
1069 R as c,
1070 dr as d,
1071 or as e,
1072 xr as f,
1073 tr as g,
1074 ur as h,
1075 Bt as i,
1076 gr as j,
1077 rr as k,
1078 M as l,
1079 ar as m,
1080 pr as p,
1081 yr as s,
1082 m as u
1083};