@layers-app/editor 0.5.4-optimization → 0.5.6-optimization

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