lowcoder-comps 0.0.8 → 0.0.9

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