@layers-app/editor 0.3.11 → 0.4.1
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.
- package/README.md +215 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -6
- package/dist/layers.-23sKdPr.js +10 -0
- package/dist/layers.2Zh_Eqge.js +118 -0
- package/dist/layers.52famHy6.js +1 -0
- package/dist/layers.6xiY7Dmk.js +10 -0
- package/dist/layers.7JqFgE4-.js +15 -0
- package/dist/layers.7aWFCBDk.js +36 -0
- package/dist/layers.9--aZzKT.js +41 -0
- package/dist/layers.99J97lec.js +40 -0
- package/dist/layers.9QK1wiQj.js +1 -0
- package/dist/layers.9pNaFvaX.js +1 -0
- package/dist/layers.B16HCOzz.js +11 -0
- package/dist/layers.B19hGmey.js +1 -0
- package/dist/layers.B1GsQlw2.js +202 -0
- package/dist/layers.B1VWPJr7.js +61 -0
- package/dist/layers.B2AGu32C.js +11692 -0
- package/dist/layers.B3D4g2HH.js +1 -0
- package/dist/layers.B4Jcovwh.js +160 -0
- package/dist/layers.B4o4Yght.js +39 -0
- package/dist/layers.B51TBzz6.js +1 -0
- package/dist/layers.B5HV5CkN.js +6 -0
- package/dist/layers.B5VQ5ysd.js +230 -0
- package/dist/layers.B7uv8aVq.js +39 -0
- package/dist/layers.B9ypkXfB.js +1 -0
- package/dist/layers.BATSJhNp.js +10 -0
- package/dist/layers.BAe6u370.js +793 -0
- package/dist/layers.BAtv1CM7.js +1 -0
- package/dist/layers.BCMyc6dl.js +1 -0
- package/dist/layers.BChBzZgi.js +139 -0
- package/dist/layers.BCtnSgBi.js +139 -0
- package/dist/layers.BGXN8iGN.js +36 -0
- package/dist/layers.BH9NvW2c.js +1 -0
- package/dist/layers.BHEN4Zl8.js +9 -0
- package/dist/layers.BI-S-U1z.js +34 -0
- package/dist/layers.BIATzXuT.js +5 -0
- package/dist/layers.BId9R-tt.js +9 -0
- package/dist/layers.BIeVwYKL.js +1 -0
- package/dist/layers.BIj1zRV6.js +8 -0
- package/dist/layers.BK7Umu5k.js +40 -0
- package/dist/layers.BL7PsAnh.js +40 -0
- package/dist/layers.BLha5Ags.js +1 -0
- package/dist/layers.BNcxqXDY.js +2 -0
- package/dist/layers.BOY6DvLj.js +41 -0
- package/dist/layers.BQ5pHr1t.js +9 -0
- package/dist/layers.BR9erYvc.js +425 -0
- package/dist/layers.BSTBZrFn.js +1 -0
- package/dist/layers.BTjqsj2D.js +32 -0
- package/dist/layers.BU0ouPbJ.js +40 -0
- package/dist/layers.BVLHr0fv.js +21938 -0
- package/dist/layers.BVhV_yLo.js +59 -0
- package/dist/layers.BWppdp8z.js +37 -0
- package/dist/layers.BXGZ-IPG.js +37 -0
- package/dist/layers.BXIQjroR.js +8 -0
- package/dist/layers.BXe2f2v0.js +10 -0
- package/dist/layers.BaREUEpY.js +1 -0
- package/dist/layers.BbCfEXyj.js +55 -0
- package/dist/layers.BdxgA5Mh.js +40 -0
- package/dist/layers.BeXV53PI.js +38 -0
- package/dist/layers.Bf4maS9l.js +41 -0
- package/dist/layers.BgOa2ZQq.js +7 -0
- package/dist/layers.BgXRgBMD.js +9 -0
- package/dist/layers.Bgx4q6Yl.js +1 -0
- package/dist/layers.BiJ8hfRt.js +1510 -0
- package/dist/layers.BiK_NhRx.js +13 -0
- package/dist/layers.BjIrZvhA.js +41 -0
- package/dist/layers.BkDwnhF3.js +39 -0
- package/dist/layers.BkZl0e9Y.js +10 -0
- package/dist/layers.BkkBEMI4.js +122 -0
- package/dist/layers.Bl2uWPK5.js +35 -0
- package/dist/layers.BldgpPoA.js +21763 -0
- package/dist/layers.BmdNYA8O.js +39 -0
- package/dist/layers.BoUDsd20.js +84 -0
- package/dist/layers.BpilXLfW.js +6 -0
- package/dist/layers.Bqy_BDRk.js +960 -0
- package/dist/layers.BvQfT02S.js +9 -0
- package/dist/layers.BxCLnc_z.js +52 -0
- package/dist/layers.Bxuc5Ku1.js +6 -0
- package/dist/layers.Bxx3QiqH.js +5 -0
- package/dist/layers.BzufRV9o.js +4 -0
- package/dist/layers.C-S1uftF.js +1 -0
- package/dist/layers.C00McVdb.js +116 -0
- package/dist/layers.C3-Awt80.js +186 -0
- package/dist/layers.C46xOyCn.js +1 -0
- package/dist/layers.C4Z2eV4H.js +437 -0
- package/dist/layers.C5fqgGR6.js +33 -0
- package/dist/layers.C5pjkDUm.js +8 -0
- package/dist/layers.C5th-3Bk.js +4 -0
- package/dist/layers.C5vdiuk-.js +1 -0
- package/dist/layers.C6FZDcP0.js +5 -0
- package/dist/layers.C6ueRaWn.js +1 -0
- package/dist/layers.C6vMG-T6.js +39 -0
- package/dist/layers.C7lIplJU.js +247 -0
- package/dist/layers.C7md-mpb.js +373 -0
- package/dist/layers.C8Lyyff8.js +39 -0
- package/dist/layers.C8WU47YC.js +7 -0
- package/dist/layers.C8_lu5UH.js +23 -0
- package/dist/layers.CAZF51iw.js +769 -0
- package/dist/layers.CDmsB9ui.js +9 -0
- package/dist/layers.CENOzW4d.js +32 -0
- package/dist/layers.CESONz7C.js +35 -0
- package/dist/layers.CEW7Z5oj.js +40 -0
- package/dist/layers.CHE9Vv0w.js +2966 -0
- package/dist/layers.CHMDrzTP.js +1 -0
- package/dist/layers.CHZsXQcr.js +1 -0
- package/dist/layers.CIkcRflS.js +32 -0
- package/dist/layers.CJdGap0M.js +40 -0
- package/dist/layers.CJgtfrlM.js +9 -0
- package/dist/layers.CK15u90j.js +32 -0
- package/dist/layers.CKyZ6fil.js +220 -0
- package/dist/layers.COAF7f8g.js +1 -0
- package/dist/layers.CP7ZgLdQ.js +802 -0
- package/dist/layers.CQ_KfkMs.js +1 -0
- package/dist/layers.CSKgny-q.js +1359 -0
- package/dist/layers.CX4-2iW9.js +8 -0
- package/dist/layers.CX4mdDUE.js +40 -0
- package/dist/layers.CXFcyuib.js +51 -0
- package/dist/layers.CXnC6LGK.js +1 -0
- package/dist/layers.CXoz8wje.js +11 -0
- package/dist/layers.CZianMah.js +33 -0
- package/dist/layers.CbrkK8Nl.js +6 -0
- package/dist/layers.CdPjGs2x.js +32 -0
- package/dist/layers.CdZEenM8.js +8 -0
- package/dist/layers.CeESKes4.js +37 -0
- package/dist/layers.CebNnxUV.js +185 -0
- package/dist/layers.Cg0Puk92.js +40 -0
- package/dist/layers.ChG4YWfr.js +1034 -0
- package/dist/layers.ChLLCYeV.js +7 -0
- package/dist/layers.Cj5o49qm.js +7 -0
- package/dist/layers.Ck_m9yBu.js +41 -0
- package/dist/layers.Cl9YbTGP.js +1 -0
- package/dist/layers.Clo5oIEO.js +70 -0
- package/dist/layers.Cmeg2JEe.js +10 -0
- package/dist/layers.CqVTtuYm.js +6 -0
- package/dist/layers.Cs24L6er.js +261 -0
- package/dist/layers.Ctcl9I58.js +10 -0
- package/dist/layers.Cuf8LL65.js +4 -0
- package/dist/layers.CusXQPSP.js +41 -0
- package/dist/layers.CyaiBxcg.js +1 -0
- package/dist/layers.D-4MyOv6.js +1126 -0
- package/dist/layers.D0fuzbA_.js +1580 -0
- package/dist/layers.D0t24lyP.js +1619 -0
- package/dist/layers.D0zn4_Mx.js +1 -0
- package/dist/layers.D37kPodI.js +7 -0
- package/dist/layers.D3PBqBbY.js +4 -0
- package/dist/layers.D3eSioXs.js +1 -0
- package/dist/layers.D4fGb2cV.js +1272 -0
- package/dist/layers.D56jgM5P.js +803 -0
- package/dist/layers.D7jGxypv.js +8 -0
- package/dist/layers.DBgQS_TD.js +39 -0
- package/dist/layers.DE8kdoob.js +8 -0
- package/dist/layers.DEMbeDH5.js +96 -0
- package/dist/layers.DGfERl47.js +39 -0
- package/dist/layers.DGhEo4ps.js +6 -0
- package/dist/layers.DHbgl38J.js +1 -0
- package/dist/layers.DIW19mY0.js +2235 -0
- package/dist/layers.DIsd_eLu.js +931 -0
- package/dist/layers.DKhnUElF.js +3 -0
- package/dist/layers.DLwuMfdd.js +84 -0
- package/dist/layers.DMXwnUhk.js +10 -0
- package/dist/layers.DMkBISW1.js +1 -0
- package/dist/layers.DN9HoVxI.js +18 -0
- package/dist/layers.DOjcR2u6.js +44 -0
- package/dist/layers.DOrgOHBr.js +1 -0
- package/dist/layers.DRd1i4Pe.js +2 -0
- package/dist/layers.DSiVxrm-.js +9 -0
- package/dist/layers.DV0u_-wO.js +1 -0
- package/dist/layers.DYJhYqR2.js +1089 -0
- package/dist/layers.DYR-z4Xd.js +65 -0
- package/dist/layers.D_KjhW7m.js +9 -0
- package/dist/layers.DaA4pT9g.js +42 -0
- package/dist/layers.DbaKVP5e.js +1 -0
- package/dist/{layers.C125HTat.js → layers.DcGuLvyP.js} +1 -1
- package/dist/layers.DczwzPio.js +1 -0
- package/dist/layers.DdULzc5-.js +42 -0
- package/dist/layers.De4i5Pzr.js +423 -0
- package/dist/layers.Dg_ubB5o.js +38 -0
- package/dist/layers.DhtUpSvn.js +7 -0
- package/dist/layers.DiAtOpGJ.js +38 -0
- package/dist/layers.DjUOC4st.js +16 -0
- package/dist/layers.DlH0lUyY.js +7 -0
- package/dist/layers.Dms1jgA7.js +7 -0
- package/dist/layers.DnvdN9TC.js +9 -0
- package/dist/layers.Doo3HAhr.js +42 -0
- package/dist/layers.Dpl-_pRd.js +282 -0
- package/dist/layers.Dq7WsWG1.js +8 -0
- package/dist/layers.Dr-_us97.js +5 -0
- package/dist/layers.Dr9AgtBT.js +1265 -0
- package/dist/layers.DsIrXvQc.js +36 -0
- package/dist/layers.DuC5Q-Uc.js +1 -0
- package/dist/layers.Dwrpihyi.js +9148 -0
- package/dist/layers.Dx7QSKbZ.js +257 -0
- package/dist/layers.DxA6ocdw.js +70 -0
- package/dist/layers.Dy1naDTQ.js +14 -0
- package/dist/layers.DyIa2FAJ.js +501 -0
- package/dist/layers.DyrpParn.js +42 -0
- package/dist/layers.G0qyEFRn.js +7 -0
- package/dist/layers.HnnZ9X3g.js +41 -0
- package/dist/layers.Ih_DycCa.js +904 -0
- package/dist/layers.JWCLFILJ.js +1 -0
- package/dist/{layers.YZkXZvVS.js → layers.MXTL7J0X.js} +15133 -14009
- package/dist/layers.N0KTyT8H.js +10 -0
- package/dist/layers.NLvydYLt.js +19 -0
- package/dist/layers.NQOujqxE.js +207 -0
- package/dist/layers.O7rgjuxq.js +35 -0
- package/dist/layers.OF4XgnEn.js +320 -0
- package/dist/layers.OqM7Ogm0.js +6 -0
- package/dist/layers.P0RFt4vw.js +10 -0
- package/dist/layers.PWkD3FXd.js +32 -0
- package/dist/layers.Q933nYVT.js +14 -0
- package/dist/layers.ShoHTpWp.js +11 -0
- package/dist/layers.TP-LPR2e.js +1283 -0
- package/dist/layers.U8d2vvil.js +11 -0
- package/dist/layers.UHdtuNW7.js +6 -0
- package/dist/layers.UPBrkQqm.js +1088 -0
- package/dist/{layers.VK3NB7Nd.js → layers.Y1n_hIuc.js} +1 -1
- package/dist/layers._uHasBFO.js +40 -0
- package/dist/layers._uJVChzG.js +48146 -0
- package/dist/layers.b0h5ZBmD.js +61 -0
- package/dist/{layers.BnjxHNDK.js → layers.b_l02tem.js} +85 -85
- package/dist/layers.d0donhTp.js +36 -0
- package/dist/layers.fjvgvmUK.js +37 -0
- package/dist/layers.gSOgK4cv.js +41 -0
- package/dist/layers.h2SsCt7w.js +8 -0
- package/dist/layers.hzJoyUwS.js +268 -0
- package/dist/layers.j4D7aRnj.js +42 -0
- package/dist/layers.l7Uj4NoM.js +8 -0
- package/dist/layers.lCpg7dOn.js +21 -0
- package/dist/layers.mS0YwpDF.js +2479 -0
- package/dist/layers.oLym9I6R.js +8 -0
- package/dist/{layers.DPccTctI.js → layers.pGJnLNqj.js} +17 -17
- package/dist/layers.pRFngToG.js +1 -0
- package/dist/layers.rK-vslvx.js +2 -0
- package/dist/layers.rSvdeOjc.js +84 -0
- package/dist/layers.rwvkqrdF.js +11 -0
- package/dist/layers.wRnSjyfZ.js +5 -0
- package/dist/layers.xbymChc4.js +790 -0
- package/dist/layers.xlbtHZsv.js +39 -0
- package/package.json +34 -17
- package/dist/layers.Cjs5EBWM.js +0 -343
- package/dist/layers.DZ8DrrVn.js +0 -53491
- package/dist/layers.QVaGPbs3.js +0 -161
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import * as i from "lodash-es";
|
|
2
|
+
var p = "\0", o = "\0", f = "";
|
|
3
|
+
class m {
|
|
4
|
+
constructor(e = {}) {
|
|
5
|
+
this._isDirected = i.has(e, "directed") ? e.directed : !0, this._isMultigraph = i.has(e, "multigraph") ? e.multigraph : !1, this._isCompound = i.has(e, "compound") ? e.compound : !1, this._label = void 0, this._defaultNodeLabelFn = i.constant(void 0), this._defaultEdgeLabelFn = i.constant(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[o] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
|
|
6
|
+
}
|
|
7
|
+
/* === Graph functions ========= */
|
|
8
|
+
isDirected() {
|
|
9
|
+
return this._isDirected;
|
|
10
|
+
}
|
|
11
|
+
isMultigraph() {
|
|
12
|
+
return this._isMultigraph;
|
|
13
|
+
}
|
|
14
|
+
isCompound() {
|
|
15
|
+
return this._isCompound;
|
|
16
|
+
}
|
|
17
|
+
setGraph(e) {
|
|
18
|
+
return this._label = e, this;
|
|
19
|
+
}
|
|
20
|
+
graph() {
|
|
21
|
+
return this._label;
|
|
22
|
+
}
|
|
23
|
+
/* === Node functions ========== */
|
|
24
|
+
setDefaultNodeLabel(e) {
|
|
25
|
+
return i.isFunction(e) || (e = i.constant(e)), this._defaultNodeLabelFn = e, this;
|
|
26
|
+
}
|
|
27
|
+
nodeCount() {
|
|
28
|
+
return this._nodeCount;
|
|
29
|
+
}
|
|
30
|
+
nodes() {
|
|
31
|
+
return i.keys(this._nodes);
|
|
32
|
+
}
|
|
33
|
+
sources() {
|
|
34
|
+
var e = this;
|
|
35
|
+
return i.filter(this.nodes(), function(t) {
|
|
36
|
+
return i.isEmpty(e._in[t]);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
sinks() {
|
|
40
|
+
var e = this;
|
|
41
|
+
return i.filter(this.nodes(), function(t) {
|
|
42
|
+
return i.isEmpty(e._out[t]);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
setNodes(e, t) {
|
|
46
|
+
var s = arguments, r = this;
|
|
47
|
+
return i.each(e, function(n) {
|
|
48
|
+
s.length > 1 ? r.setNode(n, t) : r.setNode(n);
|
|
49
|
+
}), this;
|
|
50
|
+
}
|
|
51
|
+
setNode(e, t) {
|
|
52
|
+
return i.has(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = t), this) : (this._nodes[e] = arguments.length > 1 ? t : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = o, this._children[e] = {}, this._children[o][e] = !0), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this);
|
|
53
|
+
}
|
|
54
|
+
node(e) {
|
|
55
|
+
return this._nodes[e];
|
|
56
|
+
}
|
|
57
|
+
hasNode(e) {
|
|
58
|
+
return i.has(this._nodes, e);
|
|
59
|
+
}
|
|
60
|
+
removeNode(e) {
|
|
61
|
+
var t = this;
|
|
62
|
+
if (i.has(this._nodes, e)) {
|
|
63
|
+
var s = function(r) {
|
|
64
|
+
t.removeEdge(t._edgeObjs[r]);
|
|
65
|
+
};
|
|
66
|
+
delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], i.each(this.children(e), function(r) {
|
|
67
|
+
t.setParent(r);
|
|
68
|
+
}), delete this._children[e]), i.each(i.keys(this._in[e]), s), delete this._in[e], delete this._preds[e], i.each(i.keys(this._out[e]), s), delete this._out[e], delete this._sucs[e], --this._nodeCount;
|
|
69
|
+
}
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
setParent(e, t) {
|
|
73
|
+
if (!this._isCompound)
|
|
74
|
+
throw new Error("Cannot set parent in a non-compound graph");
|
|
75
|
+
if (i.isUndefined(t))
|
|
76
|
+
t = o;
|
|
77
|
+
else {
|
|
78
|
+
t += "";
|
|
79
|
+
for (var s = t; !i.isUndefined(s); s = this.parent(s))
|
|
80
|
+
if (s === e)
|
|
81
|
+
throw new Error("Setting " + t + " as parent of " + e + " would create a cycle");
|
|
82
|
+
this.setNode(t);
|
|
83
|
+
}
|
|
84
|
+
return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = t, this._children[t][e] = !0, this;
|
|
85
|
+
}
|
|
86
|
+
_removeFromParentsChildList(e) {
|
|
87
|
+
delete this._children[this._parent[e]][e];
|
|
88
|
+
}
|
|
89
|
+
parent(e) {
|
|
90
|
+
if (this._isCompound) {
|
|
91
|
+
var t = this._parent[e];
|
|
92
|
+
if (t !== o)
|
|
93
|
+
return t;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
children(e) {
|
|
97
|
+
if (i.isUndefined(e) && (e = o), this._isCompound) {
|
|
98
|
+
var t = this._children[e];
|
|
99
|
+
if (t)
|
|
100
|
+
return i.keys(t);
|
|
101
|
+
} else {
|
|
102
|
+
if (e === o)
|
|
103
|
+
return this.nodes();
|
|
104
|
+
if (this.hasNode(e))
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
predecessors(e) {
|
|
109
|
+
var t = this._preds[e];
|
|
110
|
+
if (t)
|
|
111
|
+
return i.keys(t);
|
|
112
|
+
}
|
|
113
|
+
successors(e) {
|
|
114
|
+
var t = this._sucs[e];
|
|
115
|
+
if (t)
|
|
116
|
+
return i.keys(t);
|
|
117
|
+
}
|
|
118
|
+
neighbors(e) {
|
|
119
|
+
var t = this.predecessors(e);
|
|
120
|
+
if (t)
|
|
121
|
+
return i.union(t, this.successors(e));
|
|
122
|
+
}
|
|
123
|
+
isLeaf(e) {
|
|
124
|
+
var t;
|
|
125
|
+
return this.isDirected() ? t = this.successors(e) : t = this.neighbors(e), t.length === 0;
|
|
126
|
+
}
|
|
127
|
+
filterNodes(e) {
|
|
128
|
+
var t = new this.constructor({
|
|
129
|
+
directed: this._isDirected,
|
|
130
|
+
multigraph: this._isMultigraph,
|
|
131
|
+
compound: this._isCompound
|
|
132
|
+
});
|
|
133
|
+
t.setGraph(this.graph());
|
|
134
|
+
var s = this;
|
|
135
|
+
i.each(this._nodes, function(h, d) {
|
|
136
|
+
e(d) && t.setNode(d, h);
|
|
137
|
+
}), i.each(this._edgeObjs, function(h) {
|
|
138
|
+
t.hasNode(h.v) && t.hasNode(h.w) && t.setEdge(h, s.edge(h));
|
|
139
|
+
});
|
|
140
|
+
var r = {};
|
|
141
|
+
function n(h) {
|
|
142
|
+
var d = s.parent(h);
|
|
143
|
+
return d === void 0 || t.hasNode(d) ? (r[h] = d, d) : d in r ? r[d] : n(d);
|
|
144
|
+
}
|
|
145
|
+
return this._isCompound && i.each(t.nodes(), function(h) {
|
|
146
|
+
t.setParent(h, n(h));
|
|
147
|
+
}), t;
|
|
148
|
+
}
|
|
149
|
+
/* === Edge functions ========== */
|
|
150
|
+
setDefaultEdgeLabel(e) {
|
|
151
|
+
return i.isFunction(e) || (e = i.constant(e)), this._defaultEdgeLabelFn = e, this;
|
|
152
|
+
}
|
|
153
|
+
edgeCount() {
|
|
154
|
+
return this._edgeCount;
|
|
155
|
+
}
|
|
156
|
+
edges() {
|
|
157
|
+
return i.values(this._edgeObjs);
|
|
158
|
+
}
|
|
159
|
+
setPath(e, t) {
|
|
160
|
+
var s = this, r = arguments;
|
|
161
|
+
return i.reduce(e, function(n, h) {
|
|
162
|
+
return r.length > 1 ? s.setEdge(n, h, t) : s.setEdge(n, h), h;
|
|
163
|
+
}), this;
|
|
164
|
+
}
|
|
165
|
+
/*
|
|
166
|
+
* setEdge(v, w, [value, [name]])
|
|
167
|
+
* setEdge({ v, w, [name] }, [value])
|
|
168
|
+
*/
|
|
169
|
+
setEdge() {
|
|
170
|
+
var e, t, s, r, n = !1, h = arguments[0];
|
|
171
|
+
typeof h == "object" && h !== null && "v" in h ? (e = h.v, t = h.w, s = h.name, arguments.length === 2 && (r = arguments[1], n = !0)) : (e = h, t = arguments[1], s = arguments[3], arguments.length > 2 && (r = arguments[2], n = !0)), e = "" + e, t = "" + t, i.isUndefined(s) || (s = "" + s);
|
|
172
|
+
var d = _(this._isDirected, e, t, s);
|
|
173
|
+
if (i.has(this._edgeLabels, d))
|
|
174
|
+
return n && (this._edgeLabels[d] = r), this;
|
|
175
|
+
if (!i.isUndefined(s) && !this._isMultigraph)
|
|
176
|
+
throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
177
|
+
this.setNode(e), this.setNode(t), this._edgeLabels[d] = n ? r : this._defaultEdgeLabelFn(e, t, s);
|
|
178
|
+
var a = b(this._isDirected, e, t, s);
|
|
179
|
+
return e = a.v, t = a.w, Object.freeze(a), this._edgeObjs[d] = a, c(this._preds[t], e), c(this._sucs[e], t), this._in[t][d] = a, this._out[e][d] = a, this._edgeCount++, this;
|
|
180
|
+
}
|
|
181
|
+
edge(e, t, s) {
|
|
182
|
+
var r = arguments.length === 1 ? l(this._isDirected, arguments[0]) : _(this._isDirected, e, t, s);
|
|
183
|
+
return this._edgeLabels[r];
|
|
184
|
+
}
|
|
185
|
+
hasEdge(e, t, s) {
|
|
186
|
+
var r = arguments.length === 1 ? l(this._isDirected, arguments[0]) : _(this._isDirected, e, t, s);
|
|
187
|
+
return i.has(this._edgeLabels, r);
|
|
188
|
+
}
|
|
189
|
+
removeEdge(e, t, s) {
|
|
190
|
+
var r = arguments.length === 1 ? l(this._isDirected, arguments[0]) : _(this._isDirected, e, t, s), n = this._edgeObjs[r];
|
|
191
|
+
return n && (e = n.v, t = n.w, delete this._edgeLabels[r], delete this._edgeObjs[r], g(this._preds[t], e), g(this._sucs[e], t), delete this._in[t][r], delete this._out[e][r], this._edgeCount--), this;
|
|
192
|
+
}
|
|
193
|
+
inEdges(e, t) {
|
|
194
|
+
var s = this._in[e];
|
|
195
|
+
if (s) {
|
|
196
|
+
var r = i.values(s);
|
|
197
|
+
return t ? i.filter(r, function(n) {
|
|
198
|
+
return n.v === t;
|
|
199
|
+
}) : r;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
outEdges(e, t) {
|
|
203
|
+
var s = this._out[e];
|
|
204
|
+
if (s) {
|
|
205
|
+
var r = i.values(s);
|
|
206
|
+
return t ? i.filter(r, function(n) {
|
|
207
|
+
return n.w === t;
|
|
208
|
+
}) : r;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
nodeEdges(e, t) {
|
|
212
|
+
var s = this.inEdges(e, t);
|
|
213
|
+
if (s)
|
|
214
|
+
return s.concat(this.outEdges(e, t));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
m.prototype._nodeCount = 0;
|
|
218
|
+
m.prototype._edgeCount = 0;
|
|
219
|
+
function c(u, e) {
|
|
220
|
+
u[e] ? u[e]++ : u[e] = 1;
|
|
221
|
+
}
|
|
222
|
+
function g(u, e) {
|
|
223
|
+
--u[e] || delete u[e];
|
|
224
|
+
}
|
|
225
|
+
function _(u, e, t, s) {
|
|
226
|
+
var r = "" + e, n = "" + t;
|
|
227
|
+
if (!u && r > n) {
|
|
228
|
+
var h = r;
|
|
229
|
+
r = n, n = h;
|
|
230
|
+
}
|
|
231
|
+
return r + f + n + f + (i.isUndefined(s) ? p : s);
|
|
232
|
+
}
|
|
233
|
+
function b(u, e, t, s) {
|
|
234
|
+
var r = "" + e, n = "" + t;
|
|
235
|
+
if (!u && r > n) {
|
|
236
|
+
var h = r;
|
|
237
|
+
r = n, n = h;
|
|
238
|
+
}
|
|
239
|
+
var d = { v: r, w: n };
|
|
240
|
+
return s && (d.name = s), d;
|
|
241
|
+
}
|
|
242
|
+
function l(u, e) {
|
|
243
|
+
return _(u, e.v, e.w, e.name);
|
|
244
|
+
}
|
|
245
|
+
export {
|
|
246
|
+
m as G
|
|
247
|
+
};
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import * as v from "lodash-es";
|
|
2
|
+
import { l as M } from "./layers.D4fGb2cV.js";
|
|
3
|
+
import { G as U } from "./layers.C7lIplJU.js";
|
|
4
|
+
import { i as A, u as H, s as V, a as _, b as W, g as D, p as O, c as q, d as z, e as p, f as $, h as K, j as Q } from "./layers.UPBrkQqm.js";
|
|
5
|
+
import { l as s, g as T, t as S, d as J } from "./layers.Dwrpihyi.js";
|
|
6
|
+
import { c as Y } from "./layers.CHE9Vv0w.js";
|
|
7
|
+
function m(e) {
|
|
8
|
+
var t = {
|
|
9
|
+
options: {
|
|
10
|
+
directed: e.isDirected(),
|
|
11
|
+
multigraph: e.isMultigraph(),
|
|
12
|
+
compound: e.isCompound()
|
|
13
|
+
},
|
|
14
|
+
nodes: Z(e),
|
|
15
|
+
edges: I(e)
|
|
16
|
+
};
|
|
17
|
+
return v.isUndefined(e.graph()) || (t.value = v.clone(e.graph())), t;
|
|
18
|
+
}
|
|
19
|
+
function Z(e) {
|
|
20
|
+
return v.map(e.nodes(), function(t) {
|
|
21
|
+
var n = e.node(t), r = e.parent(t), i = { v: t };
|
|
22
|
+
return v.isUndefined(n) || (i.value = n), v.isUndefined(r) || (i.parent = r), i;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function I(e) {
|
|
26
|
+
return v.map(e.edges(), function(t) {
|
|
27
|
+
var n = e.edge(t), r = { v: t.v, w: t.w };
|
|
28
|
+
return v.isUndefined(t.name) || (r.name = t.name), v.isUndefined(n) || (r.value = n), r;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
let l = {}, g = {}, L = {};
|
|
32
|
+
const tt = () => {
|
|
33
|
+
g = {}, L = {}, l = {};
|
|
34
|
+
}, B = (e, t) => (s.trace("In isDescendant", t, " ", e, " = ", g[t].includes(e)), !!g[t].includes(e)), et = (e, t) => (s.info("Descendants of ", t, " is ", g[t]), s.info("Edge is ", e), e.v === t || e.w === t ? !1 : g[t] ? g[t].includes(e.v) || B(e.v, t) || B(e.w, t) || g[t].includes(e.w) : (s.debug("Tilt, ", t, ",not in descendants"), !1)), R = (e, t, n, r) => {
|
|
35
|
+
s.warn(
|
|
36
|
+
"Copying children of ",
|
|
37
|
+
e,
|
|
38
|
+
"root",
|
|
39
|
+
r,
|
|
40
|
+
"data",
|
|
41
|
+
t.node(e),
|
|
42
|
+
r
|
|
43
|
+
);
|
|
44
|
+
const i = t.children(e) || [];
|
|
45
|
+
e !== r && i.push(e), s.warn("Copying (nodes) clusterId", e, "nodes", i), i.forEach((a) => {
|
|
46
|
+
if (t.children(a).length > 0)
|
|
47
|
+
R(a, t, n, r);
|
|
48
|
+
else {
|
|
49
|
+
const d = t.node(a);
|
|
50
|
+
s.info("cp ", a, " to ", r, " with parent ", e), n.setNode(a, d), r !== t.parent(a) && (s.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== r && a !== e ? (s.debug("Setting parent", a, e), n.setParent(a, e)) : (s.info("In copy ", e, "root", r, "data", t.node(e), r), s.debug(
|
|
51
|
+
"Not Setting parent for node=",
|
|
52
|
+
a,
|
|
53
|
+
"cluster!==rootId",
|
|
54
|
+
e !== r,
|
|
55
|
+
"node!==clusterId",
|
|
56
|
+
a !== e
|
|
57
|
+
));
|
|
58
|
+
const u = t.edges(a);
|
|
59
|
+
s.debug("Copying Edges", u), u.forEach((f) => {
|
|
60
|
+
s.info("Edge", f);
|
|
61
|
+
const h = t.edge(f.v, f.w, f.name);
|
|
62
|
+
s.info("Edge data", h, r);
|
|
63
|
+
try {
|
|
64
|
+
et(f, r) ? (s.info("Copying as ", f.v, f.w, h, f.name), n.setEdge(f.v, f.w, h, f.name), s.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : s.info(
|
|
65
|
+
"Skipping copy of edge ",
|
|
66
|
+
f.v,
|
|
67
|
+
"-->",
|
|
68
|
+
f.w,
|
|
69
|
+
" rootId: ",
|
|
70
|
+
r,
|
|
71
|
+
" clusterId:",
|
|
72
|
+
e
|
|
73
|
+
);
|
|
74
|
+
} catch (w) {
|
|
75
|
+
s.error(w);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
s.debug("Removing node", a), t.removeNode(a);
|
|
80
|
+
});
|
|
81
|
+
}, P = (e, t) => {
|
|
82
|
+
const n = t.children(e);
|
|
83
|
+
let r = [...n];
|
|
84
|
+
for (const i of n)
|
|
85
|
+
L[i] = e, r = [...r, ...P(i, t)];
|
|
86
|
+
return r;
|
|
87
|
+
}, C = (e, t) => {
|
|
88
|
+
s.trace("Searching", e);
|
|
89
|
+
const n = t.children(e);
|
|
90
|
+
if (s.trace("Searching children of id ", e, n), n.length < 1)
|
|
91
|
+
return s.trace("This is a valid node", e), e;
|
|
92
|
+
for (const r of n) {
|
|
93
|
+
const i = C(r, t);
|
|
94
|
+
if (i)
|
|
95
|
+
return s.trace("Found replacement for", e, " => ", i), i;
|
|
96
|
+
}
|
|
97
|
+
}, X = (e) => !l[e] || !l[e].externalConnections ? e : l[e] ? l[e].id : e, nt = (e, t) => {
|
|
98
|
+
if (!e || t > 10) {
|
|
99
|
+
s.debug("Opting out, no graph ");
|
|
100
|
+
return;
|
|
101
|
+
} else
|
|
102
|
+
s.debug("Opting in, graph ");
|
|
103
|
+
e.nodes().forEach(function(n) {
|
|
104
|
+
e.children(n).length > 0 && (s.warn(
|
|
105
|
+
"Cluster identified",
|
|
106
|
+
n,
|
|
107
|
+
" Replacement id in edges: ",
|
|
108
|
+
C(n, e)
|
|
109
|
+
), g[n] = P(n, e), l[n] = { id: C(n, e), clusterData: e.node(n) });
|
|
110
|
+
}), e.nodes().forEach(function(n) {
|
|
111
|
+
const r = e.children(n), i = e.edges();
|
|
112
|
+
r.length > 0 ? (s.debug("Cluster identified", n, g), i.forEach((a) => {
|
|
113
|
+
if (a.v !== n && a.w !== n) {
|
|
114
|
+
const d = B(a.v, n), u = B(a.w, n);
|
|
115
|
+
d ^ u && (s.warn("Edge: ", a, " leaves cluster ", n), s.warn("Descendants of XXX ", n, ": ", g[n]), l[n].externalConnections = !0);
|
|
116
|
+
}
|
|
117
|
+
})) : s.debug("Not a cluster ", n, g);
|
|
118
|
+
});
|
|
119
|
+
for (let n of Object.keys(l)) {
|
|
120
|
+
const r = l[n].id, i = e.parent(r);
|
|
121
|
+
i !== n && l[i] && !l[i].externalConnections && (l[n].id = i);
|
|
122
|
+
}
|
|
123
|
+
e.edges().forEach(function(n) {
|
|
124
|
+
const r = e.edge(n);
|
|
125
|
+
s.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), s.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
|
|
126
|
+
let i = n.v, a = n.w;
|
|
127
|
+
if (s.warn(
|
|
128
|
+
"Fix XXX",
|
|
129
|
+
l,
|
|
130
|
+
"ids:",
|
|
131
|
+
n.v,
|
|
132
|
+
n.w,
|
|
133
|
+
"Translating: ",
|
|
134
|
+
l[n.v],
|
|
135
|
+
" --- ",
|
|
136
|
+
l[n.w]
|
|
137
|
+
), l[n.v] && l[n.w] && l[n.v] === l[n.w]) {
|
|
138
|
+
s.warn("Fixing and trixing link to self - removing XXX", n.v, n.w, n.name), s.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), i = X(n.v), a = X(n.w), e.removeEdge(n.v, n.w, n.name);
|
|
139
|
+
const d = n.w + "---" + n.v;
|
|
140
|
+
e.setNode(d, {
|
|
141
|
+
domId: d,
|
|
142
|
+
id: d,
|
|
143
|
+
labelStyle: "",
|
|
144
|
+
labelText: r.label,
|
|
145
|
+
padding: 0,
|
|
146
|
+
shape: "labelRect",
|
|
147
|
+
style: ""
|
|
148
|
+
});
|
|
149
|
+
const u = structuredClone(r), f = structuredClone(r);
|
|
150
|
+
u.label = "", u.arrowTypeEnd = "none", f.label = "", u.fromCluster = n.v, f.toCluster = n.v, e.setEdge(i, d, u, n.name + "-cyclic-special"), e.setEdge(d, a, f, n.name + "-cyclic-special");
|
|
151
|
+
} else if (l[n.v] || l[n.w]) {
|
|
152
|
+
if (s.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), i = X(n.v), a = X(n.w), e.removeEdge(n.v, n.w, n.name), i !== n.v) {
|
|
153
|
+
const d = e.parent(i);
|
|
154
|
+
l[d].externalConnections = !0, r.fromCluster = n.v;
|
|
155
|
+
}
|
|
156
|
+
if (a !== n.w) {
|
|
157
|
+
const d = e.parent(a);
|
|
158
|
+
l[d].externalConnections = !0, r.toCluster = n.w;
|
|
159
|
+
}
|
|
160
|
+
s.warn("Fix Replacing with XXX", i, a, n.name), e.setEdge(i, a, r, n.name);
|
|
161
|
+
}
|
|
162
|
+
}), s.warn("Adjusted Graph", m(e)), k(e, 0), s.trace(l);
|
|
163
|
+
}, k = (e, t) => {
|
|
164
|
+
if (s.warn("extractor - ", t, m(e), e.children("D")), t > 10) {
|
|
165
|
+
s.error("Bailing out");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let n = e.nodes(), r = !1;
|
|
169
|
+
for (const i of n) {
|
|
170
|
+
const a = e.children(i);
|
|
171
|
+
r = r || a.length > 0;
|
|
172
|
+
}
|
|
173
|
+
if (!r) {
|
|
174
|
+
s.debug("Done, no node has children", e.nodes());
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
s.debug("Nodes = ", n, t);
|
|
178
|
+
for (const i of n)
|
|
179
|
+
if (s.debug(
|
|
180
|
+
"Extracting node",
|
|
181
|
+
i,
|
|
182
|
+
l,
|
|
183
|
+
l[i] && !l[i].externalConnections,
|
|
184
|
+
!e.parent(i),
|
|
185
|
+
e.node(i),
|
|
186
|
+
e.children("D"),
|
|
187
|
+
" Depth ",
|
|
188
|
+
t
|
|
189
|
+
), !l[i])
|
|
190
|
+
s.debug("Not a cluster", i, t);
|
|
191
|
+
else if (!l[i].externalConnections && // !graph.parent(node) &&
|
|
192
|
+
e.children(i) && e.children(i).length > 0) {
|
|
193
|
+
s.warn(
|
|
194
|
+
"Cluster without external connections, without a parent and with children",
|
|
195
|
+
i,
|
|
196
|
+
t
|
|
197
|
+
);
|
|
198
|
+
let d = e.graph().rankdir === "TB" ? "LR" : "TB";
|
|
199
|
+
l[i] && l[i].clusterData && l[i].clusterData.dir && (d = l[i].clusterData.dir, s.warn("Fixing dir", l[i].clusterData.dir, d));
|
|
200
|
+
const u = new U({
|
|
201
|
+
multigraph: !0,
|
|
202
|
+
compound: !0
|
|
203
|
+
}).setGraph({
|
|
204
|
+
rankdir: d,
|
|
205
|
+
// Todo: set proper spacing
|
|
206
|
+
nodesep: 50,
|
|
207
|
+
ranksep: 50,
|
|
208
|
+
marginx: 8,
|
|
209
|
+
marginy: 8
|
|
210
|
+
}).setDefaultEdgeLabel(function() {
|
|
211
|
+
return {};
|
|
212
|
+
});
|
|
213
|
+
s.warn("Old graph before copy", m(e)), R(i, e, u, i), e.setNode(i, {
|
|
214
|
+
clusterNode: !0,
|
|
215
|
+
id: i,
|
|
216
|
+
clusterData: l[i].clusterData,
|
|
217
|
+
labelText: l[i].labelText,
|
|
218
|
+
graph: u
|
|
219
|
+
}), s.warn("New graph after copy node: (", i, ")", m(u)), s.debug("Old graph after copy", m(e));
|
|
220
|
+
} else
|
|
221
|
+
s.warn(
|
|
222
|
+
"Cluster ** ",
|
|
223
|
+
i,
|
|
224
|
+
" **not meeting the criteria !externalConnections:",
|
|
225
|
+
!l[i].externalConnections,
|
|
226
|
+
" no parent: ",
|
|
227
|
+
!e.parent(i),
|
|
228
|
+
" children ",
|
|
229
|
+
e.children(i) && e.children(i).length > 0,
|
|
230
|
+
e.children("D"),
|
|
231
|
+
t
|
|
232
|
+
), s.debug(l);
|
|
233
|
+
n = e.nodes(), s.warn("New list of nodes", n);
|
|
234
|
+
for (const i of n) {
|
|
235
|
+
const a = e.node(i);
|
|
236
|
+
s.warn(" Now next level", i, a), a.clusterNode && k(a.graph, t + 1);
|
|
237
|
+
}
|
|
238
|
+
}, F = (e, t) => {
|
|
239
|
+
if (t.length === 0)
|
|
240
|
+
return [];
|
|
241
|
+
let n = Object.assign(t);
|
|
242
|
+
return t.forEach((r) => {
|
|
243
|
+
const i = e.children(r), a = F(e, i);
|
|
244
|
+
n = [...n, ...a];
|
|
245
|
+
}), n;
|
|
246
|
+
}, it = (e) => F(e, e.children()), st = (e, t) => {
|
|
247
|
+
s.info("Creating subgraph rect for ", t.id, t);
|
|
248
|
+
const n = T(), r = e.insert("g").attr("class", "cluster" + (t.class ? " " + t.class : "")).attr("id", t.id), i = r.insert("rect", ":first-child"), a = S(n.flowchart.htmlLabels), d = r.insert("g").attr("class", "cluster-label"), u = t.labelType === "markdown" ? Y(d, t.labelText, { style: t.labelStyle, useHtmlLabels: a }) : d.node().appendChild($(t.labelText, t.labelStyle, void 0, !0));
|
|
249
|
+
let f = u.getBBox();
|
|
250
|
+
if (S(n.flowchart.htmlLabels)) {
|
|
251
|
+
const c = u.children[0], o = J(u);
|
|
252
|
+
f = c.getBoundingClientRect(), o.attr("width", f.width), o.attr("height", f.height);
|
|
253
|
+
}
|
|
254
|
+
const h = 0 * t.padding, w = h / 2, x = t.width <= f.width + h ? f.width + h : t.width;
|
|
255
|
+
t.width <= f.width + h ? t.diff = (f.width - t.width) / 2 - t.padding / 2 : t.diff = -t.padding / 2, s.trace("Data ", t, JSON.stringify(t)), i.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - x / 2).attr("y", t.y - t.height / 2 - w).attr("width", x).attr("height", t.height + h);
|
|
256
|
+
const { subGraphTitleTopMargin: E } = D(n);
|
|
257
|
+
a ? d.attr(
|
|
258
|
+
"transform",
|
|
259
|
+
// This puts the label on top of the box instead of inside it
|
|
260
|
+
`translate(${t.x - f.width / 2}, ${t.y - t.height / 2 + E})`
|
|
261
|
+
) : d.attr(
|
|
262
|
+
"transform",
|
|
263
|
+
// This puts the label on top of the box instead of inside it
|
|
264
|
+
`translate(${t.x}, ${t.y - t.height / 2 + E})`
|
|
265
|
+
);
|
|
266
|
+
const y = i.node().getBBox();
|
|
267
|
+
return t.width = y.width, t.height = y.height, t.intersect = function(c) {
|
|
268
|
+
return p(t, c);
|
|
269
|
+
}, r;
|
|
270
|
+
}, rt = (e, t) => {
|
|
271
|
+
const n = e.insert("g").attr("class", "note-cluster").attr("id", t.id), r = n.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
|
|
272
|
+
r.attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2 - a).attr("width", t.width + i).attr("height", t.height + i).attr("fill", "none");
|
|
273
|
+
const d = r.node().getBBox();
|
|
274
|
+
return t.width = d.width, t.height = d.height, t.intersect = function(u) {
|
|
275
|
+
return p(t, u);
|
|
276
|
+
}, n;
|
|
277
|
+
}, at = (e, t) => {
|
|
278
|
+
const n = T(), r = e.insert("g").attr("class", t.classes).attr("id", t.id), i = r.insert("rect", ":first-child"), a = r.insert("g").attr("class", "cluster-label"), d = r.append("rect"), u = a.node().appendChild($(t.labelText, t.labelStyle, void 0, !0));
|
|
279
|
+
let f = u.getBBox();
|
|
280
|
+
if (S(n.flowchart.htmlLabels)) {
|
|
281
|
+
const c = u.children[0], o = J(u);
|
|
282
|
+
f = c.getBoundingClientRect(), o.attr("width", f.width), o.attr("height", f.height);
|
|
283
|
+
}
|
|
284
|
+
f = u.getBBox();
|
|
285
|
+
const h = 0 * t.padding, w = h / 2, x = t.width <= f.width + t.padding ? f.width + t.padding : t.width;
|
|
286
|
+
t.width <= f.width + t.padding ? t.diff = (f.width + t.padding * 0 - t.width) / 2 : t.diff = -t.padding / 2, i.attr("class", "outer").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w).attr("width", x + h).attr("height", t.height + h), d.attr("class", "inner").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w + f.height - 1).attr("width", x + h).attr("height", t.height + h - f.height - 3);
|
|
287
|
+
const { subGraphTitleTopMargin: E } = D(n);
|
|
288
|
+
a.attr(
|
|
289
|
+
"transform",
|
|
290
|
+
`translate(${t.x - f.width / 2}, ${t.y - t.height / 2 - t.padding / 3 + (S(n.flowchart.htmlLabels) ? 5 : 3) + E})`
|
|
291
|
+
);
|
|
292
|
+
const y = i.node().getBBox();
|
|
293
|
+
return t.height = y.height, t.intersect = function(c) {
|
|
294
|
+
return p(t, c);
|
|
295
|
+
}, r;
|
|
296
|
+
}, ct = (e, t) => {
|
|
297
|
+
const n = e.insert("g").attr("class", t.classes).attr("id", t.id), r = n.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
|
|
298
|
+
r.attr("class", "divider").attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2).attr("width", t.width + i).attr("height", t.height + i);
|
|
299
|
+
const d = r.node().getBBox();
|
|
300
|
+
return t.width = d.width, t.height = d.height, t.diff = -t.padding / 2, t.intersect = function(u) {
|
|
301
|
+
return p(t, u);
|
|
302
|
+
}, n;
|
|
303
|
+
}, ot = { rect: st, roundedWithTitle: at, noteGroup: rt, divider: ct };
|
|
304
|
+
let G = {};
|
|
305
|
+
const lt = (e, t) => {
|
|
306
|
+
s.trace("Inserting cluster");
|
|
307
|
+
const n = t.shape || "rect";
|
|
308
|
+
G[t.id] = ot[n](e, t);
|
|
309
|
+
}, ft = () => {
|
|
310
|
+
G = {};
|
|
311
|
+
}, j = async (e, t, n, r, i, a) => {
|
|
312
|
+
s.info("Graph in recursive render: XXX", m(t), i);
|
|
313
|
+
const d = t.graph().rankdir;
|
|
314
|
+
s.trace("Dir in recursive render - dir:", d);
|
|
315
|
+
const u = e.insert("g").attr("class", "root");
|
|
316
|
+
t.nodes() ? s.info("Recursive render XXX", t.nodes()) : s.info("No nodes found for", t), t.edges().length > 0 && s.trace("Recursive edges", t.edge(t.edges()[0]));
|
|
317
|
+
const f = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), w = u.insert("g").attr("class", "edgeLabels"), x = u.insert("g").attr("class", "nodes");
|
|
318
|
+
await Promise.all(
|
|
319
|
+
t.nodes().map(async function(c) {
|
|
320
|
+
const o = t.node(c);
|
|
321
|
+
if (i !== void 0) {
|
|
322
|
+
const b = JSON.parse(JSON.stringify(i.clusterData));
|
|
323
|
+
s.info("Setting data for cluster XXX (", c, ") ", b, i), t.setNode(i.id, b), t.parent(c) || (s.trace("Setting parent", c, i.id), t.setParent(c, i.id, b));
|
|
324
|
+
}
|
|
325
|
+
if (s.info("(Insert) Node XXX" + c + ": " + JSON.stringify(t.node(c))), o && o.clusterNode) {
|
|
326
|
+
s.info("Cluster identified", c, o.width, t.node(c));
|
|
327
|
+
const b = await j(
|
|
328
|
+
x,
|
|
329
|
+
o.graph,
|
|
330
|
+
n,
|
|
331
|
+
r,
|
|
332
|
+
t.node(c),
|
|
333
|
+
a
|
|
334
|
+
), N = b.elem;
|
|
335
|
+
H(o, N), o.diff = b.diff || 0, s.info("Node bounds (abc123)", c, o, o.width, o.x, o.y), V(N, o), s.warn("Recursive render complete ", N, o);
|
|
336
|
+
} else
|
|
337
|
+
t.children(c).length > 0 ? (s.info("Cluster - the non recursive path XXX", c, o.id, o, t), s.info(C(o.id, t)), l[o.id] = { id: C(o.id, t), node: o }) : (s.info("Node - the non recursive path", c, o.id, o), await _(x, t.node(c), d));
|
|
338
|
+
})
|
|
339
|
+
), t.edges().forEach(function(c) {
|
|
340
|
+
const o = t.edge(c.v, c.w, c.name);
|
|
341
|
+
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c)), s.info("Edge " + c.v + " -> " + c.w + ": ", c, " ", JSON.stringify(t.edge(c))), s.info("Fix", l, "ids:", c.v, c.w, "Translating: ", l[c.v], l[c.w]), W(w, o);
|
|
342
|
+
}), t.edges().forEach(function(c) {
|
|
343
|
+
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c));
|
|
344
|
+
}), s.info("#############################################"), s.info("### Layout ###"), s.info("#############################################"), s.info(t), M(t), s.info("Graph after layout:", m(t));
|
|
345
|
+
let E = 0;
|
|
346
|
+
const { subGraphTitleTotalMargin: y } = D(a);
|
|
347
|
+
return it(t).forEach(function(c) {
|
|
348
|
+
const o = t.node(c);
|
|
349
|
+
s.info("Position " + c + ": " + JSON.stringify(t.node(c))), s.info(
|
|
350
|
+
"Position " + c + ": (" + o.x,
|
|
351
|
+
"," + o.y,
|
|
352
|
+
") width: ",
|
|
353
|
+
o.width,
|
|
354
|
+
" height: ",
|
|
355
|
+
o.height
|
|
356
|
+
), o && o.clusterNode ? (o.y += y, O(o)) : t.children(c).length > 0 ? (o.height += y, lt(f, o), l[o.id].node = o) : (o.y += y / 2, O(o));
|
|
357
|
+
}), t.edges().forEach(function(c) {
|
|
358
|
+
const o = t.edge(c);
|
|
359
|
+
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(o), o), o.points.forEach((N) => N.y += y / 2);
|
|
360
|
+
const b = q(h, c, o, l, n, t, r);
|
|
361
|
+
z(o, b);
|
|
362
|
+
}), t.nodes().forEach(function(c) {
|
|
363
|
+
const o = t.node(c);
|
|
364
|
+
s.info(c, o.type, o.diff), o.type === "group" && (E = o.diff);
|
|
365
|
+
}), { elem: u, diff: E };
|
|
366
|
+
}, xt = async (e, t, n, r, i) => {
|
|
367
|
+
A(e, n, r, i), K(), Q(), ft(), tt(), s.warn("Graph at first:", JSON.stringify(m(t))), nt(t), s.warn("Graph after:", JSON.stringify(m(t)));
|
|
368
|
+
const a = T();
|
|
369
|
+
await j(e, t, r, i, void 0, a);
|
|
370
|
+
};
|
|
371
|
+
export {
|
|
372
|
+
xt as r
|
|
373
|
+
};
|