@zjlab-frontier/markdown 1.0.4

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