@layers-app/shared 0.0.39-comments.1 → 0.0.39-comments.2

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 (124) hide show
  1. package/dist/{KanbanLayout-Zrp-GCX5.js → KanbanLayout-DGHT9E0N.js} +1 -1
  2. package/dist/components/CommentsPanel/types.d.ts +8 -0
  3. package/dist/{index-DaGcVdf6.js → index-BI1_FPl_.js} +15999 -42223
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +188 -187
  6. package/dist/index.umd.cjs +59 -59
  7. package/package.json +1 -1
  8. package/dist/layers.0M7J0esZ-Dv4LR3AD.js +0 -320
  9. package/dist/layers.3NbRpYmD-DseHenG9.js +0 -58
  10. package/dist/layers.4JzCVvMZ-CAL5es51.js +0 -37
  11. package/dist/layers.5o5xs_By-C3uBAi0o.js +0 -39
  12. package/dist/layers.7JqFgE4--yD2PijdI.js +0 -15
  13. package/dist/layers.9jp0zT5p-BtaIXduC.js +0 -793
  14. package/dist/layers.9tX9hjoM-DA5HvLtX.js +0 -11692
  15. package/dist/layers.B3J_fZyl-DcnuDTZ5.js +0 -40
  16. package/dist/layers.BBDEec2--Dgr5PeNA.js +0 -373
  17. package/dist/layers.BBSSuOTj-CuN5vcAP.js +0 -42
  18. package/dist/layers.BDdKUJAF-DDrAkmpE.js +0 -299
  19. package/dist/layers.BE7tt6pj-Bc0RkfNx.js +0 -5
  20. package/dist/layers.BH7NG-CF-DKNcXdtY.js +0 -21749
  21. package/dist/layers.BHn7KE3K-DIYBx7kU.js +0 -44
  22. package/dist/layers.BIpZCj8M-z5qcwvbl.js +0 -268
  23. package/dist/layers.BKG94O1d-C8RNLGVB.js +0 -84
  24. package/dist/layers.BQqf-9pt-QHnFZUGU.js +0 -803
  25. package/dist/layers.BRBfASmX-USmRfq3F.js +0 -40
  26. package/dist/layers.BRbnbv5Q-CsWD-MMk.js +0 -1580
  27. package/dist/layers.BTupUEAy-DFIwfzXW.js +0 -48147
  28. package/dist/layers.BUuzLIhn-DZiZma1Z.js +0 -41
  29. package/dist/layers.BVCGdqMm-DZpx5RRd.js +0 -65
  30. package/dist/layers.BXs8FHo3-Y6_UOUED.js +0 -33
  31. package/dist/layers.BXy4JdMT-DsfgtmoG.js +0 -41
  32. package/dist/layers.BYLivd1X-C6JfjRfy.js +0 -2235
  33. package/dist/layers.B_o0dZtI-Dp1RhKA2.js +0 -1034
  34. package/dist/layers.BbCfEXyj-BOPI71G1.js +0 -55
  35. package/dist/layers.BiJ8hfRt-eHla4UVc.js +0 -1510
  36. package/dist/layers.Bj5NYX-j-BpCPKRpy.js +0 -437
  37. package/dist/layers.Bj_ndfrI-CPtrGiLq.js +0 -32
  38. package/dist/layers.BkJp445q-DLv-fFAB.js +0 -32
  39. package/dist/layers.Bksb2QPF-2VbJoHGP.js +0 -904
  40. package/dist/layers.Bn8Vcr4Q-BLfsio_2.js +0 -32
  41. package/dist/layers.Bp7MmS3R-D_U1dPcA.js +0 -1283
  42. package/dist/layers.BpilXLfW-D9liKMYh.js +0 -6
  43. package/dist/layers.BsI9FWV9-D91Uedml.js +0 -501
  44. package/dist/layers.BsUd5wPr-Dy2CbdUO.js +0 -41
  45. package/dist/layers.Bt9pP_ty-Fm_beroO.js +0 -40
  46. package/dist/layers.Bxn6DnFg-DHhrOEX5.js +0 -40
  47. package/dist/layers.Bz-WSBaO-WlzUugyF.js +0 -6
  48. package/dist/layers.C-5qA4v3-CJ-zWxVv.js +0 -233
  49. package/dist/layers.C-ywNW9b-B03y0zYk.js +0 -42
  50. package/dist/layers.C0ZjQj3k-CFZofYjh.js +0 -19
  51. package/dist/layers.C1GWZnVU-Dd4ayASu.js +0 -33
  52. package/dist/layers.C1vp8FgL-Cgpiz8-D.js +0 -36
  53. package/dist/layers.C6lulNcA-yqYL2yrL.js +0 -2965
  54. package/dist/layers.C7lIplJU-BUFD8jZ2.js +0 -247
  55. package/dist/layers.C8_lu5UH-C8_lu5UH.js +0 -23
  56. package/dist/layers.CAu-WZjA-DPZBCz-V.js +0 -42
  57. package/dist/layers.CBtJbAdN-Cj-KUdzm.js +0 -8
  58. package/dist/layers.CDx2AjoG-DccLfWpq.js +0 -1126
  59. package/dist/layers.CFPFCyEq-CDEmpSN_.js +0 -40
  60. package/dist/layers.CJ1_gd8f-DDnsWfSX.js +0 -1089
  61. package/dist/layers.CNQjoJj3-DH6vx-SD.js +0 -319
  62. package/dist/layers.CQA6RMRE-BXEAZne3.js +0 -2479
  63. package/dist/layers.CS9Nkea7-CRl9CnU-.js +0 -41
  64. package/dist/layers.CXdn1lVd-kkhttCdF.js +0 -39
  65. package/dist/layers.CYgM6mK1-VfuzQGi8.js +0 -40
  66. package/dist/layers.Cbh0ZnrP-0bHy381n.js +0 -38
  67. package/dist/layers.CeaPTZ2b-BLOSgXUN.js +0 -802
  68. package/dist/layers.ClCdq2Hz-Nq33obP6.js +0 -6
  69. package/dist/layers.CqVTtuYm-CX5ThAMt.js +0 -6
  70. package/dist/layers.Ct4LHLoS-DsVYHOuQ.js +0 -39
  71. package/dist/layers.CuMp_mh8-Ds0LPYTb.js +0 -1359
  72. package/dist/layers.Cv-reM2z-Duq6rT7O.js +0 -41
  73. package/dist/layers.CwjkRMPg-Cs6ZNi1L.js +0 -38
  74. package/dist/layers.CxOmTN2J-CdMKWYMB.js +0 -202
  75. package/dist/layers.D0_qLxH6-xyCj286F.js +0 -1555
  76. package/dist/layers.D2-u1Bp8-BDRrMvg0.js +0 -42
  77. package/dist/layers.D4fGb2cV-BUFIHFI0.js +0 -1269
  78. package/dist/layers.D6Dbhm1Q-BzmYrtHw.js +0 -40
  79. package/dist/layers.D7W7Lzv2-CxXoeMp1.js +0 -790
  80. package/dist/layers.D7jGxypv-IWOh3OLf.js +0 -8
  81. package/dist/layers.DA9ck-MO-Cqd6OW0D.js +0 -36
  82. package/dist/layers.DBYXAcOz-BX_F26c6.js +0 -40
  83. package/dist/layers.DCSgw3lU-B9bKZvhj.js +0 -39
  84. package/dist/layers.DGuOiUst-BwSsM2E8.js +0 -40
  85. package/dist/layers.DIIFfMQs-D-Dbci1v.js +0 -41
  86. package/dist/layers.DLvGOLBc-JWyXkvEo.js +0 -1265
  87. package/dist/layers.DLwuMfdd-DpWVWJIn.js +0 -84
  88. package/dist/layers.DN9HoVxI-BHiOHhvL.js +0 -18
  89. package/dist/layers.DPAgpxzn-DcZCtAnG.js +0 -32
  90. package/dist/layers.DQS5qUUh-DIFojcoA.js +0 -36
  91. package/dist/layers.DSKtAtTl-DSDuMwGr.js +0 -423
  92. package/dist/layers.DTdQRt9t-Bz7R9Vhf.js +0 -21938
  93. package/dist/layers.DYdc5q0J-i8MJJ9aQ.js +0 -38
  94. package/dist/layers.DZPFx0xX-vBQA4TBy.js +0 -41
  95. package/dist/layers.DjUOC4st-BkHeCwco.js +0 -16
  96. package/dist/layers.DjqQyNcM-iwW8wIPQ.js +0 -40
  97. package/dist/layers.DovN5XJl-Dd2wMX5W.js +0 -35
  98. package/dist/layers.Dv3Sj2XI-DVTxuZIa.js +0 -769
  99. package/dist/layers.DwEKp0yH-B27p8CS8.js +0 -39
  100. package/dist/layers.DwuzMny7-sTqt8umI.js +0 -37
  101. package/dist/layers.DxA6ocdw-DxA6ocdw.js +0 -70
  102. package/dist/layers.Dy1naDTQ-D-9Lu-r_.js +0 -14
  103. package/dist/layers.Gt5A3tMM-4pNWGwHY.js +0 -931
  104. package/dist/layers.K-7Gu1_x-CNULEfQY.js +0 -960
  105. package/dist/layers.KyTKOuZZ-f-ZzX8_u.js +0 -42
  106. package/dist/layers.U97Ybm7Q-ZO6PKDFe.js +0 -14
  107. package/dist/layers.VyaHkISm-DijGN0L3.js +0 -220
  108. package/dist/layers.ZGBCn3zX-CgKiMp5K.js +0 -41
  109. package/dist/layers.Zy6ZgZiH-BQgnY83P.js +0 -39
  110. package/dist/layers.b0h5ZBmD-D13KqT9v.js +0 -61
  111. package/dist/layers.bLwsNWeP-DN6v6o8z.js +0 -36
  112. package/dist/layers.bxNX0iN9-CDrSOhta.js +0 -37
  113. package/dist/layers.i787zp_7-CdmHpv2W.js +0 -35
  114. package/dist/layers.lCpg7dOn-DZXcjLcw.js +0 -21
  115. package/dist/layers.mpMlUsl6-DPrPAW4a.js +0 -37
  116. package/dist/layers.nlKwIrbC-CGIhMVFp.js +0 -34
  117. package/dist/layers.pGa4_XI1-QfsNs9ym.js +0 -32
  118. package/dist/layers.q6HEryYi-BfQFMIuE.js +0 -39
  119. package/dist/layers.qApELtc--BF8AQB24.js +0 -39
  120. package/dist/layers.sIRS0zFx-8Y7Eyk8H.js +0 -1088
  121. package/dist/layers.sP0b2kja-Cqui1r6E.js +0 -32
  122. package/dist/layers.uMXcx8OG-CU69bWSU.js +0 -186
  123. package/dist/layers.v5s2UJIr-BPieEBx3.js +0 -39
  124. package/dist/layers.vjG7fiQ8-z8OCuiMk.js +0 -9140
@@ -1,1269 +0,0 @@
1
- import * as t from "lodash-es";
2
- import { m } from "./layers.C7lIplJU-BUFD8jZ2.js";
3
- class ae {
4
- constructor() {
5
- var n = {};
6
- n._next = n._prev = n, this._sentinel = n;
7
- }
8
- dequeue() {
9
- var n = this._sentinel, r = n._prev;
10
- if (r !== n)
11
- return P(r), r;
12
- }
13
- enqueue(n) {
14
- var r = this._sentinel;
15
- n._prev && n._next && P(n), n._next = r._next, r._next._prev = n, r._next = n, n._prev = r;
16
- }
17
- toString() {
18
- for (var n = [], r = this._sentinel, a = r._prev; a !== r; )
19
- n.push(JSON.stringify(a, oe)), a = a._prev;
20
- return "[" + n.join(", ") + "]";
21
- }
22
- }
23
- function P(e) {
24
- e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
25
- }
26
- function oe(e, n) {
27
- if (e !== "_next" && e !== "_prev")
28
- return n;
29
- }
30
- var te = t.constant(1);
31
- function ie(e, n) {
32
- if (e.nodeCount() <= 1)
33
- return [];
34
- var r = ue(e, n || te), a = fe(r.graph, r.buckets, r.zeroIdx);
35
- return t.flatten(
36
- t.map(a, function(o) {
37
- return e.outEdges(o.v, o.w);
38
- })
39
- );
40
- }
41
- function fe(e, n, r) {
42
- for (var a = [], o = n[n.length - 1], f = n[0], i; e.nodeCount(); ) {
43
- for (; i = f.dequeue(); )
44
- y(e, n, r, i);
45
- for (; i = o.dequeue(); )
46
- y(e, n, r, i);
47
- if (e.nodeCount()) {
48
- for (var u = n.length - 2; u > 0; --u)
49
- if (i = n[u].dequeue(), i) {
50
- a = a.concat(y(e, n, r, i, true));
51
- break;
52
- }
53
- }
54
- }
55
- return a;
56
- }
57
- function y(e, n, r, a, o) {
58
- var f = o ? [] : void 0;
59
- return t.forEach(e.inEdges(a.v), function(i) {
60
- var u = e.edge(i), d = e.node(i.v);
61
- o && f.push({ v: i.v, w: i.w }), d.out -= u, R(n, r, d);
62
- }), t.forEach(e.outEdges(a.v), function(i) {
63
- var u = e.edge(i), d = i.w, s = e.node(d);
64
- s.in -= u, R(n, r, s);
65
- }), e.removeNode(a.v), f;
66
- }
67
- function ue(e, n) {
68
- var r = new m(), a = 0, o = 0;
69
- t.forEach(e.nodes(), function(u) {
70
- r.setNode(u, { v: u, in: 0, out: 0 });
71
- }), t.forEach(e.edges(), function(u) {
72
- var d = r.edge(u.v, u.w) || 0, s = n(u), c = d + s;
73
- r.setEdge(u.v, u.w, c), o = Math.max(o, r.node(u.v).out += s), a = Math.max(a, r.node(u.w).in += s);
74
- });
75
- var f = t.range(o + a + 3).map(function() {
76
- return new ae();
77
- }), i = a + 1;
78
- return t.forEach(r.nodes(), function(u) {
79
- R(f, i, r.node(u));
80
- }), { graph: r, buckets: f, zeroIdx: i };
81
- }
82
- function R(e, n, r) {
83
- r.out ? r.in ? e[r.out - r.in + n].enqueue(r) : e[e.length - 1].enqueue(r) : e[0].enqueue(r);
84
- }
85
- function de(e) {
86
- var n = e.graph().acyclicer === "greedy" ? ie(e, r(e)) : se(e);
87
- t.forEach(n, function(a) {
88
- var o = e.edge(a);
89
- e.removeEdge(a), o.forwardName = a.name, o.reversed = true, e.setEdge(a.w, a.v, o, t.uniqueId("rev"));
90
- });
91
- function r(a) {
92
- return function(o) {
93
- return a.edge(o).weight;
94
- };
95
- }
96
- }
97
- function se(e) {
98
- var n = [], r = {}, a = {};
99
- function o(f) {
100
- t.has(a, f) || (a[f] = true, r[f] = true, t.forEach(e.outEdges(f), function(i) {
101
- t.has(r, i.w) ? n.push(i) : o(i.w);
102
- }), delete r[f]);
103
- }
104
- return t.forEach(e.nodes(), o), n;
105
- }
106
- function ce(e) {
107
- t.forEach(e.edges(), function(n) {
108
- var r = e.edge(n);
109
- if (r.reversed) {
110
- e.removeEdge(n);
111
- var a = r.forwardName;
112
- delete r.reversed, delete r.forwardName, e.setEdge(n.w, n.v, r, a);
113
- }
114
- });
115
- }
116
- function b(e, n, r, a) {
117
- var o;
118
- do
119
- o = t.uniqueId(a);
120
- while (e.hasNode(o));
121
- return r.dummy = n, e.setNode(o, r), o;
122
- }
123
- function he(e) {
124
- var n = new m().setGraph(e.graph());
125
- return t.forEach(e.nodes(), function(r) {
126
- n.setNode(r, e.node(r));
127
- }), t.forEach(e.edges(), function(r) {
128
- var a = n.edge(r.v, r.w) || { weight: 0, minlen: 1 }, o = e.edge(r);
129
- n.setEdge(r.v, r.w, {
130
- weight: a.weight + o.weight,
131
- minlen: Math.max(a.minlen, o.minlen)
132
- });
133
- }), n;
134
- }
135
- function j(e) {
136
- var n = new m({ multigraph: e.isMultigraph() }).setGraph(e.graph());
137
- return t.forEach(e.nodes(), function(r) {
138
- e.children(r).length || n.setNode(r, e.node(r));
139
- }), t.forEach(e.edges(), function(r) {
140
- n.setEdge(r, e.edge(r));
141
- }), n;
142
- }
143
- function V(e, n) {
144
- var r = e.x, a = e.y, o = n.x - r, f = n.y - a, i = e.width / 2, u = e.height / 2;
145
- if (!o && !f)
146
- throw new Error("Not possible to find intersection inside of the rectangle");
147
- var d, s;
148
- return Math.abs(f) * i > Math.abs(o) * u ? (f < 0 && (u = -u), d = u * o / f, s = u) : (o < 0 && (i = -i), d = i, s = i * f / o), { x: r + d, y: a + s };
149
- }
150
- function x(e) {
151
- var n = t.map(t.range(q(e) + 1), function() {
152
- return [];
153
- });
154
- return t.forEach(e.nodes(), function(r) {
155
- var a = e.node(r), o = a.rank;
156
- t.isUndefined(o) || (n[o][a.order] = r);
157
- }), n;
158
- }
159
- function le(e) {
160
- var n = t.min(
161
- t.map(e.nodes(), function(r) {
162
- return e.node(r).rank;
163
- })
164
- );
165
- t.forEach(e.nodes(), function(r) {
166
- var a = e.node(r);
167
- t.has(a, "rank") && (a.rank -= n);
168
- });
169
- }
170
- function ve(e) {
171
- var n = t.min(
172
- t.map(e.nodes(), function(f) {
173
- return e.node(f).rank;
174
- })
175
- ), r = [];
176
- t.forEach(e.nodes(), function(f) {
177
- var i = e.node(f).rank - n;
178
- r[i] || (r[i] = []), r[i].push(f);
179
- });
180
- var a = 0, o = e.graph().nodeRankFactor;
181
- t.forEach(r, function(f, i) {
182
- t.isUndefined(f) && i % o !== 0 ? --a : a && t.forEach(f, function(u) {
183
- e.node(u).rank += a;
184
- });
185
- });
186
- }
187
- function B(e, n, r, a) {
188
- var o = {
189
- width: 0,
190
- height: 0
191
- };
192
- return arguments.length >= 4 && (o.rank = r, o.order = a), b(e, "border", o, n);
193
- }
194
- function q(e) {
195
- return t.max(
196
- t.map(e.nodes(), function(n) {
197
- var r = e.node(n).rank;
198
- if (!t.isUndefined(r))
199
- return r;
200
- })
201
- );
202
- }
203
- function pe(e, n) {
204
- var r = { lhs: [], rhs: [] };
205
- return t.forEach(e, function(a) {
206
- n(a) ? r.lhs.push(a) : r.rhs.push(a);
207
- }), r;
208
- }
209
- function me(e, n) {
210
- return n();
211
- }
212
- function we(e) {
213
- function n(r) {
214
- var a = e.children(r), o = e.node(r);
215
- if (a.length && t.forEach(a, n), t.has(o, "minRank")) {
216
- o.borderLeft = [], o.borderRight = [];
217
- for (var f = o.minRank, i = o.maxRank + 1; f < i; ++f)
218
- O(e, "borderLeft", "_bl", r, o, f), O(e, "borderRight", "_br", r, o, f);
219
- }
220
- }
221
- t.forEach(e.children(), n);
222
- }
223
- function O(e, n, r, a, o, f) {
224
- var i = { width: 0, height: 0, rank: f, borderType: n }, u = o[n][f - 1], d = b(e, "border", i, r);
225
- o[n][f] = d, e.setParent(d, a), u && e.setEdge(u, d, { weight: 1 });
226
- }
227
- function Ee(e) {
228
- var n = e.graph().rankdir.toLowerCase();
229
- (n === "lr" || n === "rl") && W(e);
230
- }
231
- function be(e) {
232
- var n = e.graph().rankdir.toLowerCase();
233
- (n === "bt" || n === "rl") && ge(e), (n === "lr" || n === "rl") && (ke(e), W(e));
234
- }
235
- function W(e) {
236
- t.forEach(e.nodes(), function(n) {
237
- F(e.node(n));
238
- }), t.forEach(e.edges(), function(n) {
239
- F(e.edge(n));
240
- });
241
- }
242
- function F(e) {
243
- var n = e.width;
244
- e.width = e.height, e.height = n;
245
- }
246
- function ge(e) {
247
- t.forEach(e.nodes(), function(n) {
248
- N(e.node(n));
249
- }), t.forEach(e.edges(), function(n) {
250
- var r = e.edge(n);
251
- t.forEach(r.points, N), t.has(r, "y") && N(r);
252
- });
253
- }
254
- function N(e) {
255
- e.y = -e.y;
256
- }
257
- function ke(e) {
258
- t.forEach(e.nodes(), function(n) {
259
- L(e.node(n));
260
- }), t.forEach(e.edges(), function(n) {
261
- var r = e.edge(n);
262
- t.forEach(r.points, L), t.has(r, "x") && L(r);
263
- });
264
- }
265
- function L(e) {
266
- var n = e.x;
267
- e.x = e.y, e.y = n;
268
- }
269
- function xe(e) {
270
- e.graph().dummyChains = [], t.forEach(e.edges(), function(n) {
271
- ye(e, n);
272
- });
273
- }
274
- function ye(e, n) {
275
- var r = n.v, a = e.node(r).rank, o = n.w, f = e.node(o).rank, i = n.name, u = e.edge(n), d = u.labelRank;
276
- if (f !== a + 1) {
277
- e.removeEdge(n);
278
- var s, c, h;
279
- for (h = 0, ++a; a < f; ++h, ++a)
280
- u.points = [], c = {
281
- width: 0,
282
- height: 0,
283
- edgeLabel: u,
284
- edgeObj: n,
285
- rank: a
286
- }, s = b(e, "edge", c, "_d"), a === d && (c.width = u.width, c.height = u.height, c.dummy = "edge-label", c.labelpos = u.labelpos), e.setEdge(r, s, { weight: u.weight }, i), h === 0 && e.graph().dummyChains.push(s), r = s;
287
- e.setEdge(r, o, { weight: u.weight }, i);
288
- }
289
- }
290
- function Ne(e) {
291
- t.forEach(e.graph().dummyChains, function(n) {
292
- var r = e.node(n), a = r.edgeLabel, o;
293
- for (e.setEdge(r.edgeObj, a); r.dummy; )
294
- o = e.successors(n)[0], e.removeNode(n), a.points.push({ x: r.x, y: r.y }), r.dummy === "edge-label" && (a.x = r.x, a.y = r.y, a.width = r.width, a.height = r.height), n = o, r = e.node(n);
295
- });
296
- }
297
- function C(e) {
298
- var n = {};
299
- function r(a) {
300
- var o = e.node(a);
301
- if (t.has(n, a))
302
- return o.rank;
303
- n[a] = true;
304
- var f = t.min(
305
- t.map(e.outEdges(a), function(i) {
306
- return r(i.w) - e.edge(i).minlen;
307
- })
308
- );
309
- return (f === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
310
- f === void 0 || // return value of _.map([]) for Lodash 4
311
- f === null) && (f = 0), o.rank = f;
312
- }
313
- t.forEach(e.sources(), r);
314
- }
315
- function k(e, n) {
316
- return e.node(n.w).rank - e.node(n.v).rank - e.edge(n).minlen;
317
- }
318
- function $(e) {
319
- var n = new m({ directed: false }), r = e.nodes()[0], a = e.nodeCount();
320
- n.setNode(r, {});
321
- for (var o, f; Le(n, e) < a; )
322
- o = Ie(n, e), f = n.hasNode(o.v) ? k(e, o) : -k(e, o), _e(n, e, f);
323
- return n;
324
- }
325
- function Le(e, n) {
326
- function r(a) {
327
- t.forEach(n.nodeEdges(a), function(o) {
328
- var f = o.v, i = a === f ? o.w : f;
329
- !e.hasNode(i) && !k(n, o) && (e.setNode(i, {}), e.setEdge(a, i, {}), r(i));
330
- });
331
- }
332
- return t.forEach(e.nodes(), r), e.nodeCount();
333
- }
334
- function Ie(e, n) {
335
- return t.minBy(n.edges(), function(r) {
336
- if (e.hasNode(r.v) !== e.hasNode(r.w))
337
- return k(n, r);
338
- });
339
- }
340
- function _e(e, n, r) {
341
- t.forEach(e.nodes(), function(a) {
342
- n.node(a).rank += r;
343
- });
344
- }
345
- t.constant(1);
346
- t.constant(1);
347
- function z(e, n, r) {
348
- t.isArray(n) || (n = [n]);
349
- var a = (e.isDirected() ? e.successors : e.neighbors).bind(e), o = [], f = {};
350
- return t.each(n, function(i) {
351
- if (!e.hasNode(i))
352
- throw new Error("Graph does not have node: " + i);
353
- X(e, i, r === "post", f, a, o);
354
- }), o;
355
- }
356
- function X(e, n, r, a, o, f) {
357
- t.has(a, n) || (a[n] = true, r || f.push(n), t.each(o(n), function(i) {
358
- X(e, i, r, a, o, f);
359
- }), r && f.push(n));
360
- }
361
- function Ce(e, n) {
362
- return z(e, n, "post");
363
- }
364
- function Te(e, n) {
365
- return z(e, n, "pre");
366
- }
367
- E.initLowLimValues = S;
368
- E.initCutValues = T;
369
- E.calcCutValue = H;
370
- E.leaveEdge = K;
371
- E.enterEdge = Q;
372
- E.exchangeEdges = Z;
373
- function E(e) {
374
- e = he(e), C(e);
375
- var n = $(e);
376
- S(n), T(n, e);
377
- for (var r, a; r = K(n); )
378
- a = Q(n, e, r), Z(n, e, r, a);
379
- }
380
- function T(e, n) {
381
- var r = Ce(e, e.nodes());
382
- r = r.slice(0, r.length - 1), t.forEach(r, function(a) {
383
- Se(e, n, a);
384
- });
385
- }
386
- function Se(e, n, r) {
387
- var a = e.node(r), o = a.parent;
388
- e.edge(r, o).cutvalue = H(e, n, r);
389
- }
390
- function H(e, n, r) {
391
- var a = e.node(r), o = a.parent, f = true, i = n.edge(r, o), u = 0;
392
- return i || (f = false, i = n.edge(o, r)), u = i.weight, t.forEach(n.nodeEdges(r), function(d) {
393
- var s = d.v === r, c = s ? d.w : d.v;
394
- if (c !== o) {
395
- var h = s === f, l = n.edge(d).weight;
396
- if (u += h ? l : -l, Pe(e, r, c)) {
397
- var v = e.edge(r, c).cutvalue;
398
- u += h ? -v : v;
399
- }
400
- }
401
- }), u;
402
- }
403
- function S(e, n) {
404
- arguments.length < 2 && (n = e.nodes()[0]), J(e, {}, 1, n);
405
- }
406
- function J(e, n, r, a, o) {
407
- var f = r, i = e.node(a);
408
- return n[a] = true, t.forEach(e.neighbors(a), function(u) {
409
- t.has(n, u) || (r = J(e, n, r, u, a));
410
- }), i.low = f, i.lim = r++, o ? i.parent = o : delete i.parent, r;
411
- }
412
- function K(e) {
413
- return t.find(e.edges(), function(n) {
414
- return e.edge(n).cutvalue < 0;
415
- });
416
- }
417
- function Q(e, n, r) {
418
- var a = r.v, o = r.w;
419
- n.hasEdge(a, o) || (a = r.w, o = r.v);
420
- var f = e.node(a), i = e.node(o), u = f, d = false;
421
- f.lim > i.lim && (u = i, d = true);
422
- var s = t.filter(n.edges(), function(c) {
423
- return d === A(e, e.node(c.v), u) && d !== A(e, e.node(c.w), u);
424
- });
425
- return t.minBy(s, function(c) {
426
- return k(n, c);
427
- });
428
- }
429
- function Z(e, n, r, a) {
430
- var o = r.v, f = r.w;
431
- e.removeEdge(o, f), e.setEdge(a.v, a.w, {}), S(e), T(e, n), Me(e, n);
432
- }
433
- function Me(e, n) {
434
- var r = t.find(e.nodes(), function(o) {
435
- return !n.node(o).parent;
436
- }), a = Te(e, r);
437
- a = a.slice(1), t.forEach(a, function(o) {
438
- var f = e.node(o).parent, i = n.edge(o, f), u = false;
439
- i || (i = n.edge(f, o), u = true), n.node(o).rank = n.node(f).rank + (u ? i.minlen : -i.minlen);
440
- });
441
- }
442
- function Pe(e, n, r) {
443
- return e.hasEdge(n, r);
444
- }
445
- function A(e, n, r) {
446
- return r.low <= n.lim && n.lim <= r.lim;
447
- }
448
- function Ve(e) {
449
- switch (e.graph().ranker) {
450
- case "network-simplex":
451
- Y(e);
452
- break;
453
- case "tight-tree":
454
- Oe(e);
455
- break;
456
- case "longest-path":
457
- Be(e);
458
- break;
459
- default:
460
- Y(e);
461
- }
462
- }
463
- var Be = C;
464
- function Oe(e) {
465
- C(e), $(e);
466
- }
467
- function Y(e) {
468
- E(e);
469
- }
470
- function Fe(e) {
471
- var n = b(e, "root", {}, "_root"), r = Ae(e), a = t.max(t.values(r)) - 1, o = 2 * a + 1;
472
- e.graph().nestingRoot = n, t.forEach(e.edges(), function(i) {
473
- e.edge(i).minlen *= o;
474
- });
475
- var f = Ye(e) + 1;
476
- t.forEach(e.children(), function(i) {
477
- ee(e, n, o, f, a, r, i);
478
- }), e.graph().nodeRankFactor = o;
479
- }
480
- function ee(e, n, r, a, o, f, i) {
481
- var u = e.children(i);
482
- if (!u.length) {
483
- i !== n && e.setEdge(n, i, { weight: 0, minlen: r });
484
- return;
485
- }
486
- var d = B(e, "_bt"), s = B(e, "_bb"), c = e.node(i);
487
- e.setParent(d, i), c.borderTop = d, e.setParent(s, i), c.borderBottom = s, t.forEach(u, function(h) {
488
- ee(e, n, r, a, o, f, h);
489
- var l = e.node(h), v = l.borderTop ? l.borderTop : h, p = l.borderBottom ? l.borderBottom : h, m2 = l.borderTop ? a : 2 * a, g = v !== p ? 1 : o - f[i] + 1;
490
- e.setEdge(d, v, {
491
- weight: m2,
492
- minlen: g,
493
- nestingEdge: true
494
- }), e.setEdge(p, s, {
495
- weight: m2,
496
- minlen: g,
497
- nestingEdge: true
498
- });
499
- }), e.parent(i) || e.setEdge(n, d, { weight: 0, minlen: o + f[i] });
500
- }
501
- function Ae(e) {
502
- var n = {};
503
- function r(a, o) {
504
- var f = e.children(a);
505
- f && f.length && t.forEach(f, function(i) {
506
- r(i, o + 1);
507
- }), n[a] = o;
508
- }
509
- return t.forEach(e.children(), function(a) {
510
- r(a, 1);
511
- }), n;
512
- }
513
- function Ye(e) {
514
- return t.reduce(
515
- e.edges(),
516
- function(n, r) {
517
- return n + e.edge(r).weight;
518
- },
519
- 0
520
- );
521
- }
522
- function De(e) {
523
- var n = e.graph();
524
- e.removeNode(n.nestingRoot), delete n.nestingRoot, t.forEach(e.edges(), function(r) {
525
- var a = e.edge(r);
526
- a.nestingEdge && e.removeEdge(r);
527
- });
528
- }
529
- function Ge(e, n, r) {
530
- var a = {}, o;
531
- t.forEach(r, function(f) {
532
- for (var i = e.parent(f), u, d; i; ) {
533
- if (u = e.parent(i), u ? (d = a[u], a[u] = i) : (d = o, o = i), d && d !== i) {
534
- n.setEdge(d, i);
535
- return;
536
- }
537
- i = u;
538
- }
539
- });
540
- }
541
- function Ue(e, n, r) {
542
- var a = je(e), o = new m({ compound: true }).setGraph({ root: a }).setDefaultNodeLabel(function(f) {
543
- return e.node(f);
544
- });
545
- return t.forEach(e.nodes(), function(f) {
546
- var i = e.node(f), u = e.parent(f);
547
- (i.rank === n || i.minRank <= n && n <= i.maxRank) && (o.setNode(f), o.setParent(f, u || a), t.forEach(e[r](f), function(d) {
548
- var s = d.v === f ? d.w : d.v, c = o.edge(s, f), h = t.isUndefined(c) ? 0 : c.weight;
549
- o.setEdge(s, f, { weight: e.edge(d).weight + h });
550
- }), t.has(i, "minRank") && o.setNode(f, {
551
- borderLeft: i.borderLeft[n],
552
- borderRight: i.borderRight[n]
553
- }));
554
- }), o;
555
- }
556
- function je(e) {
557
- for (var n; e.hasNode(n = t.uniqueId("_root")); ) ;
558
- return n;
559
- }
560
- function qe(e, n) {
561
- for (var r = 0, a = 1; a < n.length; ++a)
562
- r += We(e, n[a - 1], n[a]);
563
- return r;
564
- }
565
- function We(e, n, r) {
566
- for (var a = t.zipObject(
567
- r,
568
- t.map(r, function(s, c) {
569
- return c;
570
- })
571
- ), o = t.flatten(
572
- t.map(n, function(s) {
573
- return t.sortBy(
574
- t.map(e.outEdges(s), function(c) {
575
- return { pos: a[c.w], weight: e.edge(c).weight };
576
- }),
577
- "pos"
578
- );
579
- })
580
- ), f = 1; f < r.length; ) f <<= 1;
581
- var i = 2 * f - 1;
582
- f -= 1;
583
- var u = t.map(new Array(i), function() {
584
- return 0;
585
- }), d = 0;
586
- return t.forEach(
587
- // @ts-expect-error
588
- o.forEach(function(s) {
589
- var c = s.pos + f;
590
- u[c] += s.weight;
591
- for (var h = 0; c > 0; )
592
- c % 2 && (h += u[c + 1]), c = c - 1 >> 1, u[c] += s.weight;
593
- d += s.weight * h;
594
- })
595
- ), d;
596
- }
597
- function $e(e) {
598
- var n = {}, r = t.filter(e.nodes(), function(u) {
599
- return !e.children(u).length;
600
- }), a = t.max(
601
- t.map(r, function(u) {
602
- return e.node(u).rank;
603
- })
604
- ), o = t.map(t.range(a + 1), function() {
605
- return [];
606
- });
607
- function f(u) {
608
- if (!t.has(n, u)) {
609
- n[u] = true;
610
- var d = e.node(u);
611
- o[d.rank].push(u), t.forEach(e.successors(u), f);
612
- }
613
- }
614
- var i = t.sortBy(r, function(u) {
615
- return e.node(u).rank;
616
- });
617
- return t.forEach(i, f), o;
618
- }
619
- function ze(e, n) {
620
- return t.map(n, function(r) {
621
- var a = e.inEdges(r);
622
- if (a.length) {
623
- var o = t.reduce(
624
- a,
625
- function(f, i) {
626
- var u = e.edge(i), d = e.node(i.v);
627
- return {
628
- sum: f.sum + u.weight * d.order,
629
- weight: f.weight + u.weight
630
- };
631
- },
632
- { sum: 0, weight: 0 }
633
- );
634
- return {
635
- v: r,
636
- barycenter: o.sum / o.weight,
637
- weight: o.weight
638
- };
639
- } else
640
- return { v: r };
641
- });
642
- }
643
- function Xe(e, n) {
644
- var r = {};
645
- t.forEach(e, function(o, f) {
646
- var i = r[o.v] = {
647
- indegree: 0,
648
- in: [],
649
- out: [],
650
- vs: [o.v],
651
- i: f
652
- };
653
- t.isUndefined(o.barycenter) || (i.barycenter = o.barycenter, i.weight = o.weight);
654
- }), t.forEach(n.edges(), function(o) {
655
- var f = r[o.v], i = r[o.w];
656
- !t.isUndefined(f) && !t.isUndefined(i) && (i.indegree++, f.out.push(r[o.w]));
657
- });
658
- var a = t.filter(r, function(o) {
659
- return !o.indegree;
660
- });
661
- return He(a);
662
- }
663
- function He(e) {
664
- var n = [];
665
- function r(f) {
666
- return function(i) {
667
- i.merged || (t.isUndefined(i.barycenter) || t.isUndefined(f.barycenter) || i.barycenter >= f.barycenter) && Je(f, i);
668
- };
669
- }
670
- function a(f) {
671
- return function(i) {
672
- i.in.push(f), --i.indegree === 0 && e.push(i);
673
- };
674
- }
675
- for (; e.length; ) {
676
- var o = e.pop();
677
- n.push(o), t.forEach(o.in.reverse(), r(o)), t.forEach(o.out, a(o));
678
- }
679
- return t.map(
680
- t.filter(n, function(f) {
681
- return !f.merged;
682
- }),
683
- function(f) {
684
- return t.pick(f, ["vs", "i", "barycenter", "weight"]);
685
- }
686
- );
687
- }
688
- function Je(e, n) {
689
- var r = 0, a = 0;
690
- e.weight && (r += e.barycenter * e.weight, a += e.weight), n.weight && (r += n.barycenter * n.weight, a += n.weight), e.vs = n.vs.concat(e.vs), e.barycenter = r / a, e.weight = a, e.i = Math.min(n.i, e.i), n.merged = true;
691
- }
692
- function Ke(e, n) {
693
- var r = pe(e, function(c) {
694
- return t.has(c, "barycenter");
695
- }), a = r.lhs, o = t.sortBy(r.rhs, function(c) {
696
- return -c.i;
697
- }), f = [], i = 0, u = 0, d = 0;
698
- a.sort(Qe(!!n)), d = D(f, o, d), t.forEach(a, function(c) {
699
- d += c.vs.length, f.push(c.vs), i += c.barycenter * c.weight, u += c.weight, d = D(f, o, d);
700
- });
701
- var s = { vs: t.flatten(f) };
702
- return u && (s.barycenter = i / u, s.weight = u), s;
703
- }
704
- function D(e, n, r) {
705
- for (var a; n.length && (a = t.last(n)).i <= r; )
706
- n.pop(), e.push(a.vs), r++;
707
- return r;
708
- }
709
- function Qe(e) {
710
- return function(n, r) {
711
- return n.barycenter < r.barycenter ? -1 : n.barycenter > r.barycenter ? 1 : e ? r.i - n.i : n.i - r.i;
712
- };
713
- }
714
- function ne(e, n, r, a) {
715
- var o = e.children(n), f = e.node(n), i = f ? f.borderLeft : void 0, u = f ? f.borderRight : void 0, d = {};
716
- i && (o = t.filter(o, function(p) {
717
- return p !== i && p !== u;
718
- }));
719
- var s = ze(e, o);
720
- t.forEach(s, function(p) {
721
- if (e.children(p.v).length) {
722
- var m2 = ne(e, p.v, r, a);
723
- d[p.v] = m2, t.has(m2, "barycenter") && en(p, m2);
724
- }
725
- });
726
- var c = Xe(s, r);
727
- Ze(c, d);
728
- var h = Ke(c, a);
729
- if (i && (h.vs = t.flatten([i, h.vs, u]), e.predecessors(i).length)) {
730
- var l = e.node(e.predecessors(i)[0]), v = e.node(e.predecessors(u)[0]);
731
- t.has(h, "barycenter") || (h.barycenter = 0, h.weight = 0), h.barycenter = (h.barycenter * h.weight + l.order + v.order) / (h.weight + 2), h.weight += 2;
732
- }
733
- return h;
734
- }
735
- function Ze(e, n) {
736
- t.forEach(e, function(r) {
737
- r.vs = t.flatten(
738
- r.vs.map(function(a) {
739
- return n[a] ? n[a].vs : a;
740
- })
741
- );
742
- });
743
- }
744
- function en(e, n) {
745
- t.isUndefined(e.barycenter) ? (e.barycenter = n.barycenter, e.weight = n.weight) : (e.barycenter = (e.barycenter * e.weight + n.barycenter * n.weight) / (e.weight + n.weight), e.weight += n.weight);
746
- }
747
- function nn(e) {
748
- var n = q(e), r = G(e, t.range(1, n + 1), "inEdges"), a = G(e, t.range(n - 1, -1, -1), "outEdges"), o = $e(e);
749
- U(e, o);
750
- for (var f = Number.POSITIVE_INFINITY, i, u = 0, d = 0; d < 4; ++u, ++d) {
751
- rn(u % 2 ? r : a, u % 4 >= 2), o = x(e);
752
- var s = qe(e, o);
753
- s < f && (d = 0, i = t.cloneDeep(o), f = s);
754
- }
755
- U(e, i);
756
- }
757
- function G(e, n, r) {
758
- return t.map(n, function(a) {
759
- return Ue(e, a, r);
760
- });
761
- }
762
- function rn(e, n) {
763
- var r = new m();
764
- t.forEach(e, function(a) {
765
- var o = a.graph().root, f = ne(a, o, r, n);
766
- t.forEach(f.vs, function(i, u) {
767
- a.node(i).order = u;
768
- }), Ge(a, r, f.vs);
769
- });
770
- }
771
- function U(e, n) {
772
- t.forEach(n, function(r) {
773
- t.forEach(r, function(a, o) {
774
- e.node(a).order = o;
775
- });
776
- });
777
- }
778
- function an(e) {
779
- var n = tn(e);
780
- t.forEach(e.graph().dummyChains, function(r) {
781
- for (var a = e.node(r), o = a.edgeObj, f = on(e, n, o.v, o.w), i = f.path, u = f.lca, d = 0, s = i[d], c = true; r !== o.w; ) {
782
- if (a = e.node(r), c) {
783
- for (; (s = i[d]) !== u && e.node(s).maxRank < a.rank; )
784
- d++;
785
- s === u && (c = false);
786
- }
787
- if (!c) {
788
- for (; d < i.length - 1 && e.node(s = i[d + 1]).minRank <= a.rank; )
789
- d++;
790
- s = i[d];
791
- }
792
- e.setParent(r, s), r = e.successors(r)[0];
793
- }
794
- });
795
- }
796
- function on(e, n, r, a) {
797
- var o = [], f = [], i = Math.min(n[r].low, n[a].low), u = Math.max(n[r].lim, n[a].lim), d, s;
798
- d = r;
799
- do
800
- d = e.parent(d), o.push(d);
801
- while (d && (n[d].low > i || u > n[d].lim));
802
- for (s = d, d = a; (d = e.parent(d)) !== s; )
803
- f.push(d);
804
- return { path: o.concat(f.reverse()), lca: s };
805
- }
806
- function tn(e) {
807
- var n = {}, r = 0;
808
- function a(o) {
809
- var f = r;
810
- t.forEach(e.children(o), a), n[o] = { low: f, lim: r++ };
811
- }
812
- return t.forEach(e.children(), a), n;
813
- }
814
- function fn(e, n) {
815
- var r = {};
816
- function a(o, f) {
817
- var i = 0, u = 0, d = o.length, s = t.last(f);
818
- return t.forEach(f, function(c, h) {
819
- var l = dn(e, c), v = l ? e.node(l).order : d;
820
- (l || c === s) && (t.forEach(f.slice(u, h + 1), function(p) {
821
- t.forEach(e.predecessors(p), function(m2) {
822
- var g = e.node(m2), M = g.order;
823
- (M < i || v < M) && !(g.dummy && e.node(p).dummy) && re(r, m2, p);
824
- });
825
- }), u = h + 1, i = v);
826
- }), f;
827
- }
828
- return t.reduce(n, a), r;
829
- }
830
- function un(e, n) {
831
- var r = {};
832
- function a(f, i, u, d, s) {
833
- var c;
834
- t.forEach(t.range(i, u), function(h) {
835
- c = f[h], e.node(c).dummy && t.forEach(e.predecessors(c), function(l) {
836
- var v = e.node(l);
837
- v.dummy && (v.order < d || v.order > s) && re(r, l, c);
838
- });
839
- });
840
- }
841
- function o(f, i) {
842
- var u = -1, d, s = 0;
843
- return t.forEach(i, function(c, h) {
844
- if (e.node(c).dummy === "border") {
845
- var l = e.predecessors(c);
846
- l.length && (d = e.node(l[0]).order, a(i, s, h, u, d), s = h, u = d);
847
- }
848
- a(i, s, i.length, d, f.length);
849
- }), i;
850
- }
851
- return t.reduce(n, o), r;
852
- }
853
- function dn(e, n) {
854
- if (e.node(n).dummy)
855
- return t.find(e.predecessors(n), function(r) {
856
- return e.node(r).dummy;
857
- });
858
- }
859
- function re(e, n, r) {
860
- if (n > r) {
861
- var a = n;
862
- n = r, r = a;
863
- }
864
- var o = e[n];
865
- o || (e[n] = o = {}), o[r] = true;
866
- }
867
- function sn(e, n, r) {
868
- if (n > r) {
869
- var a = n;
870
- n = r, r = a;
871
- }
872
- return t.has(e[n], r);
873
- }
874
- function cn(e, n, r, a) {
875
- var o = {}, f = {}, i = {};
876
- return t.forEach(n, function(u) {
877
- t.forEach(u, function(d, s) {
878
- o[d] = d, f[d] = d, i[d] = s;
879
- });
880
- }), t.forEach(n, function(u) {
881
- var d = -1;
882
- t.forEach(u, function(s) {
883
- var c = a(s);
884
- if (c.length) {
885
- c = t.sortBy(c, function(m2) {
886
- return i[m2];
887
- });
888
- for (var h = (c.length - 1) / 2, l = Math.floor(h), v = Math.ceil(h); l <= v; ++l) {
889
- var p = c[l];
890
- f[s] === s && d < i[p] && !sn(r, s, p) && (f[p] = s, f[s] = o[s] = o[p], d = i[p]);
891
- }
892
- }
893
- });
894
- }), { root: o, align: f };
895
- }
896
- function hn(e, n, r, a, o) {
897
- var f = {}, i = ln(e, n, r, o), u = o ? "borderLeft" : "borderRight";
898
- function d(h, l) {
899
- for (var v = i.nodes(), p = v.pop(), m2 = {}; p; )
900
- m2[p] ? h(p) : (m2[p] = true, v.push(p), v = v.concat(l(p))), p = v.pop();
901
- }
902
- function s(h) {
903
- f[h] = i.inEdges(h).reduce(function(l, v) {
904
- return Math.max(l, f[v.v] + i.edge(v));
905
- }, 0);
906
- }
907
- function c(h) {
908
- var l = i.outEdges(h).reduce(function(p, m2) {
909
- return Math.min(p, f[m2.w] - i.edge(m2));
910
- }, Number.POSITIVE_INFINITY), v = e.node(h);
911
- l !== Number.POSITIVE_INFINITY && v.borderType !== u && (f[h] = Math.max(f[h], l));
912
- }
913
- return d(s, i.predecessors.bind(i)), d(c, i.successors.bind(i)), t.forEach(a, function(h) {
914
- f[h] = f[r[h]];
915
- }), f;
916
- }
917
- function ln(e, n, r, a) {
918
- var o = new m(), f = e.graph(), i = En(f.nodesep, f.edgesep, a);
919
- return t.forEach(n, function(u) {
920
- var d;
921
- t.forEach(u, function(s) {
922
- var c = r[s];
923
- if (o.setNode(c), d) {
924
- var h = r[d], l = o.edge(h, c);
925
- o.setEdge(h, c, Math.max(i(e, s, d), l || 0));
926
- }
927
- d = s;
928
- });
929
- }), o;
930
- }
931
- function vn(e, n) {
932
- return t.minBy(t.values(n), function(r) {
933
- var a = Number.NEGATIVE_INFINITY, o = Number.POSITIVE_INFINITY;
934
- return t.forIn(r, function(f, i) {
935
- var u = bn(e, i) / 2;
936
- a = Math.max(f + u, a), o = Math.min(f - u, o);
937
- }), a - o;
938
- });
939
- }
940
- function pn(e, n) {
941
- var r = t.values(n), a = t.min(r), o = t.max(r);
942
- t.forEach(["u", "d"], function(f) {
943
- t.forEach(["l", "r"], function(i) {
944
- var u = f + i, d = e[u], s;
945
- if (d !== n) {
946
- var c = t.values(d);
947
- s = i === "l" ? a - t.min(c) : o - t.max(c), s && (e[u] = t.mapValues(d, function(h) {
948
- return h + s;
949
- }));
950
- }
951
- });
952
- });
953
- }
954
- function mn(e, n) {
955
- return t.mapValues(e.ul, function(r, a) {
956
- if (n)
957
- return e[n.toLowerCase()][a];
958
- var o = t.sortBy(t.map(e, a));
959
- return (o[1] + o[2]) / 2;
960
- });
961
- }
962
- function wn(e) {
963
- var n = x(e), r = t.merge(fn(e, n), un(e, n)), a = {}, o;
964
- t.forEach(["u", "d"], function(i) {
965
- o = i === "u" ? n : t.values(n).reverse(), t.forEach(["l", "r"], function(u) {
966
- u === "r" && (o = t.map(o, function(h) {
967
- return t.values(h).reverse();
968
- }));
969
- var d = (i === "u" ? e.predecessors : e.successors).bind(e), s = cn(e, o, r, d), c = hn(e, o, s.root, s.align, u === "r");
970
- u === "r" && (c = t.mapValues(c, function(h) {
971
- return -h;
972
- })), a[i + u] = c;
973
- });
974
- });
975
- var f = vn(e, a);
976
- return pn(a, f), mn(a, e.graph().align);
977
- }
978
- function En(e, n, r) {
979
- return function(a, o, f) {
980
- var i = a.node(o), u = a.node(f), d = 0, s;
981
- if (d += i.width / 2, t.has(i, "labelpos"))
982
- switch (i.labelpos.toLowerCase()) {
983
- case "l":
984
- s = -i.width / 2;
985
- break;
986
- case "r":
987
- s = i.width / 2;
988
- break;
989
- }
990
- if (s && (d += r ? s : -s), s = 0, d += (i.dummy ? n : e) / 2, d += (u.dummy ? n : e) / 2, d += u.width / 2, t.has(u, "labelpos"))
991
- switch (u.labelpos.toLowerCase()) {
992
- case "l":
993
- s = u.width / 2;
994
- break;
995
- case "r":
996
- s = -u.width / 2;
997
- break;
998
- }
999
- return s && (d += r ? s : -s), s = 0, d;
1000
- };
1001
- }
1002
- function bn(e, n) {
1003
- return e.node(n).width;
1004
- }
1005
- function gn(e) {
1006
- e = j(e), kn(e), t.forOwn(wn(e), function(n, r) {
1007
- e.node(r).x = n;
1008
- });
1009
- }
1010
- function kn(e) {
1011
- var n = x(e), r = e.graph().ranksep, a = 0;
1012
- t.forEach(n, function(o) {
1013
- var f = t.max(
1014
- t.map(o, function(i) {
1015
- return e.node(i).height;
1016
- })
1017
- );
1018
- t.forEach(o, function(i) {
1019
- e.node(i).y = a + f / 2;
1020
- }), a += f + r;
1021
- });
1022
- }
1023
- function $n(e, n) {
1024
- var r = me;
1025
- r("layout", function() {
1026
- var a = r(" buildLayoutGraph", function() {
1027
- return Mn(e);
1028
- });
1029
- r(" runLayout", function() {
1030
- xn(a, r);
1031
- }), r(" updateInputGraph", function() {
1032
- yn(e, a);
1033
- });
1034
- });
1035
- }
1036
- function xn(e, n) {
1037
- n(" makeSpaceForEdgeLabels", function() {
1038
- Pn(e);
1039
- }), n(" removeSelfEdges", function() {
1040
- Un(e);
1041
- }), n(" acyclic", function() {
1042
- de(e);
1043
- }), n(" nestingGraph.run", function() {
1044
- Fe(e);
1045
- }), n(" rank", function() {
1046
- Ve(j(e));
1047
- }), n(" injectEdgeLabelProxies", function() {
1048
- Vn(e);
1049
- }), n(" removeEmptyRanks", function() {
1050
- ve(e);
1051
- }), n(" nestingGraph.cleanup", function() {
1052
- De(e);
1053
- }), n(" normalizeRanks", function() {
1054
- le(e);
1055
- }), n(" assignRankMinMax", function() {
1056
- Bn(e);
1057
- }), n(" removeEdgeLabelProxies", function() {
1058
- On(e);
1059
- }), n(" normalize.run", function() {
1060
- xe(e);
1061
- }), n(" parentDummyChains", function() {
1062
- an(e);
1063
- }), n(" addBorderSegments", function() {
1064
- we(e);
1065
- }), n(" order", function() {
1066
- nn(e);
1067
- }), n(" insertSelfEdges", function() {
1068
- jn(e);
1069
- }), n(" adjustCoordinateSystem", function() {
1070
- Ee(e);
1071
- }), n(" position", function() {
1072
- gn(e);
1073
- }), n(" positionSelfEdges", function() {
1074
- qn(e);
1075
- }), n(" removeBorderNodes", function() {
1076
- Gn(e);
1077
- }), n(" normalize.undo", function() {
1078
- Ne(e);
1079
- }), n(" fixupEdgeLabelCoords", function() {
1080
- Yn(e);
1081
- }), n(" undoCoordinateSystem", function() {
1082
- be(e);
1083
- }), n(" translateGraph", function() {
1084
- Fn(e);
1085
- }), n(" assignNodeIntersects", function() {
1086
- An(e);
1087
- }), n(" reversePoints", function() {
1088
- Dn(e);
1089
- }), n(" acyclic.undo", function() {
1090
- ce(e);
1091
- });
1092
- }
1093
- function yn(e, n) {
1094
- t.forEach(e.nodes(), function(r) {
1095
- var a = e.node(r), o = n.node(r);
1096
- a && (a.x = o.x, a.y = o.y, n.children(r).length && (a.width = o.width, a.height = o.height));
1097
- }), t.forEach(e.edges(), function(r) {
1098
- var a = e.edge(r), o = n.edge(r);
1099
- a.points = o.points, t.has(o, "x") && (a.x = o.x, a.y = o.y);
1100
- }), e.graph().width = n.graph().width, e.graph().height = n.graph().height;
1101
- }
1102
- var Nn = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], Ln = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, In = ["acyclicer", "ranker", "rankdir", "align"], _n = ["width", "height"], Rn = { width: 0, height: 0 }, Cn = ["minlen", "weight", "width", "height", "labeloffset"], Tn = {
1103
- minlen: 1,
1104
- weight: 1,
1105
- width: 0,
1106
- height: 0,
1107
- labeloffset: 10,
1108
- labelpos: "r"
1109
- }, Sn = ["labelpos"];
1110
- function Mn(e) {
1111
- var n = new m({ multigraph: true, compound: true }), r = _(e.graph());
1112
- return n.setGraph(
1113
- t.merge({}, Ln, I(r, Nn), t.pick(r, In))
1114
- ), t.forEach(e.nodes(), function(a) {
1115
- var o = _(e.node(a));
1116
- n.setNode(a, t.defaults(I(o, _n), Rn)), n.setParent(a, e.parent(a));
1117
- }), t.forEach(e.edges(), function(a) {
1118
- var o = _(e.edge(a));
1119
- n.setEdge(
1120
- a,
1121
- t.merge({}, Tn, I(o, Cn), t.pick(o, Sn))
1122
- );
1123
- }), n;
1124
- }
1125
- function Pn(e) {
1126
- var n = e.graph();
1127
- n.ranksep /= 2, t.forEach(e.edges(), function(r) {
1128
- var a = e.edge(r);
1129
- a.minlen *= 2, a.labelpos.toLowerCase() !== "c" && (n.rankdir === "TB" || n.rankdir === "BT" ? a.width += a.labeloffset : a.height += a.labeloffset);
1130
- });
1131
- }
1132
- function Vn(e) {
1133
- t.forEach(e.edges(), function(n) {
1134
- var r = e.edge(n);
1135
- if (r.width && r.height) {
1136
- var a = e.node(n.v), o = e.node(n.w), f = { rank: (o.rank - a.rank) / 2 + a.rank, e: n };
1137
- b(e, "edge-proxy", f, "_ep");
1138
- }
1139
- });
1140
- }
1141
- function Bn(e) {
1142
- var n = 0;
1143
- t.forEach(e.nodes(), function(r) {
1144
- var a = e.node(r);
1145
- a.borderTop && (a.minRank = e.node(a.borderTop).rank, a.maxRank = e.node(a.borderBottom).rank, n = t.max(n, a.maxRank));
1146
- }), e.graph().maxRank = n;
1147
- }
1148
- function On(e) {
1149
- t.forEach(e.nodes(), function(n) {
1150
- var r = e.node(n);
1151
- r.dummy === "edge-proxy" && (e.edge(r.e).labelRank = r.rank, e.removeNode(n));
1152
- });
1153
- }
1154
- function Fn(e) {
1155
- var n = Number.POSITIVE_INFINITY, r = 0, a = Number.POSITIVE_INFINITY, o = 0, f = e.graph(), i = f.marginx || 0, u = f.marginy || 0;
1156
- function d(s) {
1157
- var c = s.x, h = s.y, l = s.width, v = s.height;
1158
- n = Math.min(n, c - l / 2), r = Math.max(r, c + l / 2), a = Math.min(a, h - v / 2), o = Math.max(o, h + v / 2);
1159
- }
1160
- t.forEach(e.nodes(), function(s) {
1161
- d(e.node(s));
1162
- }), t.forEach(e.edges(), function(s) {
1163
- var c = e.edge(s);
1164
- t.has(c, "x") && d(c);
1165
- }), n -= i, a -= u, t.forEach(e.nodes(), function(s) {
1166
- var c = e.node(s);
1167
- c.x -= n, c.y -= a;
1168
- }), t.forEach(e.edges(), function(s) {
1169
- var c = e.edge(s);
1170
- t.forEach(c.points, function(h) {
1171
- h.x -= n, h.y -= a;
1172
- }), t.has(c, "x") && (c.x -= n), t.has(c, "y") && (c.y -= a);
1173
- }), f.width = r - n + i, f.height = o - a + u;
1174
- }
1175
- function An(e) {
1176
- t.forEach(e.edges(), function(n) {
1177
- var r = e.edge(n), a = e.node(n.v), o = e.node(n.w), f, i;
1178
- r.points ? (f = r.points[0], i = r.points[r.points.length - 1]) : (r.points = [], f = o, i = a), r.points.unshift(V(a, f)), r.points.push(V(o, i));
1179
- });
1180
- }
1181
- function Yn(e) {
1182
- t.forEach(e.edges(), function(n) {
1183
- var r = e.edge(n);
1184
- if (t.has(r, "x"))
1185
- switch ((r.labelpos === "l" || r.labelpos === "r") && (r.width -= r.labeloffset), r.labelpos) {
1186
- case "l":
1187
- r.x -= r.width / 2 + r.labeloffset;
1188
- break;
1189
- case "r":
1190
- r.x += r.width / 2 + r.labeloffset;
1191
- break;
1192
- }
1193
- });
1194
- }
1195
- function Dn(e) {
1196
- t.forEach(e.edges(), function(n) {
1197
- var r = e.edge(n);
1198
- r.reversed && r.points.reverse();
1199
- });
1200
- }
1201
- function Gn(e) {
1202
- t.forEach(e.nodes(), function(n) {
1203
- if (e.children(n).length) {
1204
- var r = e.node(n), a = e.node(r.borderTop), o = e.node(r.borderBottom), f = e.node(t.last(r.borderLeft)), i = e.node(t.last(r.borderRight));
1205
- r.width = Math.abs(i.x - f.x), r.height = Math.abs(o.y - a.y), r.x = f.x + r.width / 2, r.y = a.y + r.height / 2;
1206
- }
1207
- }), t.forEach(e.nodes(), function(n) {
1208
- e.node(n).dummy === "border" && e.removeNode(n);
1209
- });
1210
- }
1211
- function Un(e) {
1212
- t.forEach(e.edges(), function(n) {
1213
- if (n.v === n.w) {
1214
- var r = e.node(n.v);
1215
- r.selfEdges || (r.selfEdges = []), r.selfEdges.push({ e: n, label: e.edge(n) }), e.removeEdge(n);
1216
- }
1217
- });
1218
- }
1219
- function jn(e) {
1220
- var n = x(e);
1221
- t.forEach(n, function(r) {
1222
- var a = 0;
1223
- t.forEach(r, function(o, f) {
1224
- var i = e.node(o);
1225
- i.order = f + a, t.forEach(i.selfEdges, function(u) {
1226
- b(
1227
- e,
1228
- "selfedge",
1229
- {
1230
- width: u.label.width,
1231
- height: u.label.height,
1232
- rank: i.rank,
1233
- order: f + ++a,
1234
- e: u.e,
1235
- label: u.label
1236
- },
1237
- "_se"
1238
- );
1239
- }), delete i.selfEdges;
1240
- });
1241
- });
1242
- }
1243
- function qn(e) {
1244
- t.forEach(e.nodes(), function(n) {
1245
- var r = e.node(n);
1246
- if (r.dummy === "selfedge") {
1247
- var a = e.node(r.e.v), o = a.x + a.width / 2, f = a.y, i = r.x - o, u = a.height / 2;
1248
- e.setEdge(r.e, r.label), e.removeNode(n), r.label.points = [
1249
- { x: o + 2 * i / 3, y: f - u },
1250
- { x: o + 5 * i / 6, y: f - u },
1251
- { x: o + i, y: f },
1252
- { x: o + 5 * i / 6, y: f + u },
1253
- { x: o + 2 * i / 3, y: f + u }
1254
- ], r.label.x = r.x, r.label.y = r.y;
1255
- }
1256
- });
1257
- }
1258
- function I(e, n) {
1259
- return t.mapValues(t.pick(e, n), Number);
1260
- }
1261
- function _(e) {
1262
- var n = {};
1263
- return t.forEach(e, function(r, a) {
1264
- n[a.toLowerCase()] = r;
1265
- }), n;
1266
- }
1267
- export {
1268
- $n as $
1269
- };