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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +19 -0
  2. package/dist/index.cjs +2 -0
  3. package/dist/index.js +12 -10
  4. package/dist/layers.7jmq6tBR.js +2227 -0
  5. package/dist/layers.B90YwJga.js +4 -0
  6. package/dist/layers.C03OvlLb.js +6 -0
  7. package/dist/layers.CJiIq6YQ.js +1 -0
  8. package/dist/layers.CXffIp2y.js +864 -0
  9. package/dist/layers.CZPeYQ9g.js +3 -0
  10. package/dist/layers.CZ_Lt7IL.js +7 -0
  11. package/dist/layers.Ci1-qkbn.js +341 -0
  12. package/dist/layers.Cnm-pECN.js +2 -0
  13. package/dist/layers.D6d62qQ_.js +6774 -0
  14. package/dist/layers.DNCgFYS7.js +27 -0
  15. package/dist/layers.Dev6Yrwi.js +530 -0
  16. package/dist/layers.Dgok89qX.js +1 -0
  17. package/dist/layers.Dq3o7sh3.js +7723 -0
  18. package/dist/layers.Duy8YzsH.js +2511 -0
  19. package/dist/layers.QjAkD17S.js +3677 -0
  20. package/package.json +73 -17
  21. package/dist/layers.0EAb8Ajx.js +0 -65
  22. package/dist/layers.1Mvzm38Y.js +0 -501
  23. package/dist/layers.2wIERhxO.js +0 -41
  24. package/dist/layers.694DrE1_.js +0 -931
  25. package/dist/layers.7JqFgE4-.js +0 -15
  26. package/dist/layers.B-5aeeDH.js +0 -1359
  27. package/dist/layers.B0winug5.js +0 -59
  28. package/dist/layers.B1S8ufDn.js +0 -40
  29. package/dist/layers.B3JNY9Km.js +0 -42
  30. package/dist/layers.B6W2tqC0.js +0 -40
  31. package/dist/layers.B7Olyhe8.js +0 -1089
  32. package/dist/layers.BCuuRSaf.js +0 -37
  33. package/dist/layers.BESPlBGC.js +0 -32
  34. package/dist/layers.BJDrjORS.js +0 -244
  35. package/dist/layers.BJTh7mUo.js +0 -1265
  36. package/dist/layers.BLL-019k.js +0 -39
  37. package/dist/layers.BNJiP8Pw.js +0 -2966
  38. package/dist/layers.BNvAl5dS.js +0 -14
  39. package/dist/layers.BThP74aw.js +0 -32
  40. package/dist/layers.BZ4laUeR.js +0 -40
  41. package/dist/layers.BZByPNdY.js +0 -37
  42. package/dist/layers.B_5zMrI3.js +0 -38
  43. package/dist/layers.B_7N5yjX.js +0 -32
  44. package/dist/layers.BbCfEXyj.js +0 -55
  45. package/dist/layers.BdvfoI4U.js +0 -44
  46. package/dist/layers.BiJ8hfRt.js +0 -1510
  47. package/dist/layers.BiJBOHr0.js +0 -84
  48. package/dist/layers.Bk3_8qR9.js +0 -48146
  49. package/dist/layers.BkPPOKBy.js +0 -32
  50. package/dist/layers.BnZcjRLr.js +0 -32
  51. package/dist/layers.BpilXLfW.js +0 -6
  52. package/dist/layers.BqpcWKH6.js +0 -2479
  53. package/dist/layers.Br7D0wMN.js +0 -39
  54. package/dist/layers.BsAu1GXs.js +0 -42
  55. package/dist/layers.Bv5sK47C.js +0 -769
  56. package/dist/layers.BxEdkUpI.js +0 -1088
  57. package/dist/layers.BxUBbVsO.js +0 -41
  58. package/dist/layers.Bzalhqz_.js +0 -39
  59. package/dist/layers.C-dS7ntQ.js +0 -41
  60. package/dist/layers.C0Lgw_Sx.js +0 -11688
  61. package/dist/layers.C5BFsvzI.js +0 -803
  62. package/dist/layers.C5WLg9ed.js +0 -21763
  63. package/dist/layers.C6lAFlKZ.js +0 -186
  64. package/dist/layers.C8_lu5UH.js +0 -23
  65. package/dist/layers.CGwNL7dH.js +0 -791
  66. package/dist/layers.CI739wqN.js +0 -39
  67. package/dist/layers.CKaj4dG4.js +0 -41
  68. package/dist/layers.CLRiSwgi.js +0 -904
  69. package/dist/layers.CN1QkD6D.js +0 -38
  70. package/dist/layers.CPY6U3g-.js +0 -1034
  71. package/dist/layers.CRSjdIG6.js +0 -1619
  72. package/dist/layers.CUHkTCid.js +0 -6
  73. package/dist/layers.CUPMw0sy.js +0 -40
  74. package/dist/layers.CWb6LiAY.js +0 -40
  75. package/dist/layers.C_XsSNQo.js +0 -42
  76. package/dist/layers.CbmlFoXt.js +0 -33
  77. package/dist/layers.CfGeHh-g.js +0 -36
  78. package/dist/layers.CiJxVu9b.js +0 -36
  79. package/dist/layers.Cj4ezyVr.js +0 -33
  80. package/dist/layers.Cpb-MRZn.js +0 -960
  81. package/dist/layers.CqVTtuYm.js +0 -6
  82. package/dist/layers.CskURloi.js +0 -39
  83. package/dist/layers.CtTD47i4.js +0 -41
  84. package/dist/layers.CxcvEfKe.js +0 -36
  85. package/dist/layers.D-U9uIsP.js +0 -40
  86. package/dist/layers.D10WeKck.js +0 -2235
  87. package/dist/layers.D4T8fTcj.js +0 -1223
  88. package/dist/layers.D4jK2Tet.js +0 -39
  89. package/dist/layers.D7jGxypv.js +0 -8
  90. package/dist/layers.DBosqi2D.js +0 -19
  91. package/dist/layers.DGtETOVJ.js +0 -304
  92. package/dist/layers.DKENAsMv.js +0 -220
  93. package/dist/layers.DLwuMfdd.js +0 -84
  94. package/dist/layers.DN9HoVxI.js +0 -18
  95. package/dist/layers.DOBSfaUM.js +0 -35
  96. package/dist/layers.DOKLQ6A3.js +0 -373
  97. package/dist/layers.DPuVWH3L.js +0 -40
  98. package/dist/layers.DQVXh43C.js +0 -42
  99. package/dist/layers.DSTh89J8.js +0 -42
  100. package/dist/layers.DUsIfvNt.js +0 -46859
  101. package/dist/layers.DVfpGIrv.js +0 -41
  102. package/dist/layers.DWSkLlGf.js +0 -41
  103. package/dist/layers.DX1RI3m3.js +0 -32
  104. package/dist/layers.DdMwmP4m.js +0 -37
  105. package/dist/layers.DhkyREpW.js +0 -793
  106. package/dist/layers.Dj-f1_6N.js +0 -34
  107. package/dist/layers.DjUOC4st.js +0 -16
  108. package/dist/layers.DjhJT1nZ.js +0 -21938
  109. package/dist/layers.Djl9Gz6s.js +0 -282
  110. package/dist/layers.Dn2AP7iE.js +0 -1283
  111. package/dist/layers.Dqbek_0L.js +0 -40
  112. package/dist/layers.DsDjOLHs.js +0 -437
  113. package/dist/layers.DsOaqGXW.js +0 -8
  114. package/dist/layers.DuE1l7lR.js +0 -41
  115. package/dist/layers.DxA6ocdw.js +0 -70
  116. package/dist/layers.DxHlP7Pb.js +0 -39
  117. package/dist/layers.Dy1naDTQ.js +0 -14
  118. package/dist/layers.DyZ5R-vS.js +0 -37
  119. package/dist/layers.H2Kl_PC2.js +0 -40
  120. package/dist/layers.IW4NBP9k.js +0 -39
  121. package/dist/layers.LGx1jmqd.js +0 -40
  122. package/dist/layers.NABwYdw5.js +0 -35
  123. package/dist/layers.NtwvbkGN.js +0 -1580
  124. package/dist/layers.O-bFTk-n.js +0 -268
  125. package/dist/layers.R_udKe_N.js +0 -38
  126. package/dist/layers.TdTDbIzb.js +0 -1126
  127. package/dist/layers.WLeJl9el.js +0 -202
  128. package/dist/layers.b0h5ZBmD.js +0 -61
  129. package/dist/layers.dEHKcy8J.js +0 -320
  130. package/dist/layers.eTredPK_.js +0 -36
  131. package/dist/layers.gIdzfQAa.js +0 -5
  132. package/dist/layers.huV95Ipe.js +0 -295
  133. package/dist/layers.jU4W5PG5.js +0 -9166
  134. package/dist/layers.lCpg7dOn.js +0 -21
  135. package/dist/layers.mQcENPPW.js +0 -802
  136. package/dist/layers.nPQCmYXI.js +0 -423
  137. package/dist/layers.ntC1foLT.js +0 -39
  138. package/dist/layers.uHy1yMbq.js +0 -6
@@ -1,1223 +0,0 @@
1
- import * as i from "lodash-es";
2
- import { G as w } from "./layers.BJDrjORS.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 j(r), r;
12
- }
13
- enqueue(n) {
14
- var r = this._sentinel;
15
- n._prev && n._next && j(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, te)), a = a._prev;
20
- return "[" + n.join(", ") + "]";
21
- }
22
- }
23
- function j(e) {
24
- e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
25
- }
26
- function te(e, n) {
27
- if (e !== "_next" && e !== "_prev")
28
- return n;
29
- }
30
- var oe = i.constant(1);
31
- function ie(e, n) {
32
- if (e.nodeCount() <= 1)
33
- return [];
34
- var r = fe(e, n || oe), a = de(r.graph, r.buckets, r.zeroIdx);
35
- return i.flatten(
36
- i.map(a, function(t) {
37
- return e.outEdges(t.v, t.w);
38
- })
39
- );
40
- }
41
- function de(e, n, r) {
42
- for (var a = [], t = n[n.length - 1], d = n[0], o; e.nodeCount(); ) {
43
- for (; o = d.dequeue(); )
44
- x(e, n, r, o);
45
- for (; o = t.dequeue(); )
46
- x(e, n, r, o);
47
- if (e.nodeCount()) {
48
- for (var f = n.length - 2; f > 0; --f)
49
- if (o = n[f].dequeue(), o) {
50
- a = a.concat(x(e, n, r, o, !0));
51
- break;
52
- }
53
- }
54
- }
55
- return a;
56
- }
57
- function x(e, n, r, a, t) {
58
- var d = t ? [] : void 0;
59
- return i.forEach(e.inEdges(a.v), function(o) {
60
- var f = e.edge(o), u = e.node(o.v);
61
- t && d.push({ v: o.v, w: o.w }), u.out -= f, P(n, r, u);
62
- }), i.forEach(e.outEdges(a.v), function(o) {
63
- var f = e.edge(o), u = o.w, c = e.node(u);
64
- c.in -= f, P(n, r, c);
65
- }), e.removeNode(a.v), d;
66
- }
67
- function fe(e, n) {
68
- var r = new w(), a = 0, t = 0;
69
- i.forEach(e.nodes(), function(f) {
70
- r.setNode(f, { v: f, in: 0, out: 0 });
71
- }), i.forEach(e.edges(), function(f) {
72
- var u = r.edge(f.v, f.w) || 0, c = n(f), s = u + c;
73
- r.setEdge(f.v, f.w, s), t = Math.max(t, r.node(f.v).out += c), a = Math.max(a, r.node(f.w).in += c);
74
- });
75
- var d = i.range(t + a + 3).map(function() {
76
- return new ae();
77
- }), o = a + 1;
78
- return i.forEach(r.nodes(), function(f) {
79
- P(d, o, r.node(f));
80
- }), { graph: r, buckets: d, zeroIdx: o };
81
- }
82
- function P(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 ue(e) {
86
- var n = e.graph().acyclicer === "greedy" ? ie(e, r(e)) : ce(e);
87
- i.forEach(n, function(a) {
88
- var t = e.edge(a);
89
- e.removeEdge(a), t.forwardName = a.name, t.reversed = !0, e.setEdge(a.w, a.v, t, i.uniqueId("rev"));
90
- });
91
- function r(a) {
92
- return function(t) {
93
- return a.edge(t).weight;
94
- };
95
- }
96
- }
97
- function ce(e) {
98
- var n = [], r = {}, a = {};
99
- function t(d) {
100
- Object.prototype.hasOwnProperty.call(a, d) || (a[d] = !0, r[d] = !0, i.forEach(e.outEdges(d), function(o) {
101
- Object.prototype.hasOwnProperty.call(r, o.w) ? n.push(o) : t(o.w);
102
- }), delete r[d]);
103
- }
104
- return i.forEach(e.nodes(), t), n;
105
- }
106
- function se(e) {
107
- i.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 E(e, n, r, a) {
117
- var t;
118
- do
119
- t = i.uniqueId(a);
120
- while (e.hasNode(t));
121
- return r.dummy = n, e.setNode(t, r), t;
122
- }
123
- function he(e) {
124
- var n = new w().setGraph(e.graph());
125
- return i.forEach(e.nodes(), function(r) {
126
- n.setNode(r, e.node(r));
127
- }), i.forEach(e.edges(), function(r) {
128
- var a = n.edge(r.v, r.w) || { weight: 0, minlen: 1 }, t = e.edge(r);
129
- n.setEdge(r.v, r.w, {
130
- weight: a.weight + t.weight,
131
- minlen: Math.max(a.minlen, t.minlen)
132
- });
133
- }), n;
134
- }
135
- function U(e) {
136
- var n = new w({ multigraph: e.isMultigraph() }).setGraph(e.graph());
137
- return i.forEach(e.nodes(), function(r) {
138
- e.children(r).length || n.setNode(r, e.node(r));
139
- }), i.forEach(e.edges(), function(r) {
140
- n.setEdge(r, e.edge(r));
141
- }), n;
142
- }
143
- function S(e, n) {
144
- var r = e.x, a = e.y, t = n.x - r, d = n.y - a, o = e.width / 2, f = e.height / 2;
145
- if (!t && !d)
146
- throw new Error("Not possible to find intersection inside of the rectangle");
147
- var u, c;
148
- return Math.abs(d) * o > Math.abs(t) * f ? (d < 0 && (f = -f), u = f * t / d, c = f) : (t < 0 && (o = -o), u = o, c = o * d / t), { x: r + u, y: a + c };
149
- }
150
- function k(e) {
151
- var n = i.map(i.range(q(e) + 1), function() {
152
- return [];
153
- });
154
- return i.forEach(e.nodes(), function(r) {
155
- var a = e.node(r), t = a.rank;
156
- i.isUndefined(t) || (n[t][a.order] = r);
157
- }), n;
158
- }
159
- function le(e) {
160
- var n = i.min(
161
- i.map(e.nodes(), function(r) {
162
- return e.node(r).rank;
163
- })
164
- );
165
- i.forEach(e.nodes(), function(r) {
166
- var a = e.node(r);
167
- i.has(a, "rank") && (a.rank -= n);
168
- });
169
- }
170
- function ve(e) {
171
- var n = i.min(
172
- i.map(e.nodes(), function(d) {
173
- return e.node(d).rank;
174
- })
175
- ), r = [];
176
- i.forEach(e.nodes(), function(d) {
177
- var o = e.node(d).rank - n;
178
- r[o] || (r[o] = []), r[o].push(d);
179
- });
180
- var a = 0, t = e.graph().nodeRankFactor;
181
- i.forEach(r, function(d, o) {
182
- i.isUndefined(d) && o % t !== 0 ? --a : a && i.forEach(d, function(f) {
183
- e.node(f).rank += a;
184
- });
185
- });
186
- }
187
- function M(e, n, r, a) {
188
- var t = {
189
- width: 0,
190
- height: 0
191
- };
192
- return arguments.length >= 4 && (t.rank = r, t.order = a), E(e, "border", t, n);
193
- }
194
- function q(e) {
195
- return i.max(
196
- i.map(e.nodes(), function(n) {
197
- var r = e.node(n).rank;
198
- if (!i.isUndefined(r))
199
- return r;
200
- })
201
- );
202
- }
203
- function pe(e, n) {
204
- var r = { lhs: [], rhs: [] };
205
- return i.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), t = e.node(r);
215
- if (a.length && i.forEach(a, n), Object.prototype.hasOwnProperty.call(t, "minRank")) {
216
- t.borderLeft = [], t.borderRight = [];
217
- for (var d = t.minRank, o = t.maxRank + 1; d < o; ++d)
218
- V(e, "borderLeft", "_bl", r, t, d), V(e, "borderRight", "_br", r, t, d);
219
- }
220
- }
221
- i.forEach(e.children(), n);
222
- }
223
- function V(e, n, r, a, t, d) {
224
- var o = { width: 0, height: 0, rank: d, borderType: n }, f = t[n][d - 1], u = E(e, "border", o, r);
225
- t[n][d] = u, e.setParent(u, a), f && e.setEdge(f, u, { weight: 1 });
226
- }
227
- function be(e) {
228
- var n = e.graph().rankdir.toLowerCase();
229
- (n === "lr" || n === "rl") && W(e);
230
- }
231
- function Ee(e) {
232
- var n = e.graph().rankdir.toLowerCase();
233
- (n === "bt" || n === "rl") && ye(e), (n === "lr" || n === "rl") && (ge(e), W(e));
234
- }
235
- function W(e) {
236
- i.forEach(e.nodes(), function(n) {
237
- B(e.node(n));
238
- }), i.forEach(e.edges(), function(n) {
239
- B(e.edge(n));
240
- });
241
- }
242
- function B(e) {
243
- var n = e.width;
244
- e.width = e.height, e.height = n;
245
- }
246
- function ye(e) {
247
- i.forEach(e.nodes(), function(n) {
248
- O(e.node(n));
249
- }), i.forEach(e.edges(), function(n) {
250
- var r = e.edge(n);
251
- i.forEach(r.points, O), Object.prototype.hasOwnProperty.call(r, "y") && O(r);
252
- });
253
- }
254
- function O(e) {
255
- e.y = -e.y;
256
- }
257
- function ge(e) {
258
- i.forEach(e.nodes(), function(n) {
259
- N(e.node(n));
260
- }), i.forEach(e.edges(), function(n) {
261
- var r = e.edge(n);
262
- i.forEach(r.points, N), Object.prototype.hasOwnProperty.call(r, "x") && N(r);
263
- });
264
- }
265
- function N(e) {
266
- var n = e.x;
267
- e.x = e.y, e.y = n;
268
- }
269
- function ke(e) {
270
- e.graph().dummyChains = [], i.forEach(e.edges(), function(n) {
271
- xe(e, n);
272
- });
273
- }
274
- function xe(e, n) {
275
- var r = n.v, a = e.node(r).rank, t = n.w, d = e.node(t).rank, o = n.name, f = e.edge(n), u = f.labelRank;
276
- if (d !== a + 1) {
277
- e.removeEdge(n);
278
- var c = void 0, s, h;
279
- for (h = 0, ++a; a < d; ++h, ++a)
280
- f.points = [], c = {
281
- width: 0,
282
- height: 0,
283
- edgeLabel: f,
284
- edgeObj: n,
285
- rank: a
286
- }, s = E(e, "edge", c, "_d"), a === u && (c.width = f.width, c.height = f.height, c.dummy = "edge-label", c.labelpos = f.labelpos), e.setEdge(r, s, { weight: f.weight }, o), h === 0 && e.graph().dummyChains.push(s), r = s;
287
- e.setEdge(r, t, { weight: f.weight }, o);
288
- }
289
- }
290
- function Oe(e) {
291
- i.forEach(e.graph().dummyChains, function(n) {
292
- var r = e.node(n), a = r.edgeLabel, t;
293
- for (e.setEdge(r.edgeObj, a); r.dummy; )
294
- t = 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 = t, r = e.node(n);
295
- });
296
- }
297
- function _(e) {
298
- var n = {};
299
- function r(a) {
300
- var t = e.node(a);
301
- if (Object.prototype.hasOwnProperty.call(n, a))
302
- return t.rank;
303
- n[a] = !0;
304
- var d = i.min(
305
- i.map(e.outEdges(a), function(o) {
306
- return r(o.w) - e.edge(o).minlen;
307
- })
308
- );
309
- return (d === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
310
- d === void 0 || // return value of _.map([]) for Lodash 4
311
- d === null) && (d = 0), t.rank = d;
312
- }
313
- i.forEach(e.sources(), r);
314
- }
315
- function g(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 w({ directed: !1 }), r = e.nodes()[0], a = e.nodeCount();
320
- n.setNode(r, {});
321
- for (var t, d; Ne(n, e) < a; )
322
- t = Le(n, e), d = n.hasNode(t.v) ? g(e, t) : -g(e, t), Ie(n, e, d);
323
- return n;
324
- }
325
- function Ne(e, n) {
326
- function r(a) {
327
- i.forEach(n.nodeEdges(a), function(t) {
328
- var d = t.v, o = a === d ? t.w : d;
329
- !e.hasNode(o) && !g(n, t) && (e.setNode(o, {}), e.setEdge(a, o, {}), r(o));
330
- });
331
- }
332
- return i.forEach(e.nodes(), r), e.nodeCount();
333
- }
334
- function Le(e, n) {
335
- return i.minBy(n.edges(), function(r) {
336
- if (e.hasNode(r.v) !== e.hasNode(r.w))
337
- return g(n, r);
338
- });
339
- }
340
- function Ie(e, n, r) {
341
- i.forEach(e.nodes(), function(a) {
342
- n.node(a).rank += r;
343
- });
344
- }
345
- i.constant(1);
346
- i.constant(1);
347
- function Pe() {
348
- }
349
- Pe.prototype = new Error();
350
- function z(e, n, r) {
351
- i.isArray(n) || (n = [n]);
352
- var a = (e.isDirected() ? e.successors : e.neighbors).bind(e), t = [], d = {};
353
- return i.each(n, function(o) {
354
- if (!e.hasNode(o))
355
- throw new Error("Graph does not have node: " + o);
356
- X(e, o, r === "post", d, a, t);
357
- }), t;
358
- }
359
- function X(e, n, r, a, t, d) {
360
- Object.prototype.hasOwnProperty.call(a, n) || (a[n] = !0, r || d.push(n), i.each(t(n), function(o) {
361
- X(e, o, r, a, t, d);
362
- }), r && d.push(n));
363
- }
364
- function _e(e, n) {
365
- return z(e, n, "post");
366
- }
367
- function Re(e, n) {
368
- return z(e, n, "pre");
369
- }
370
- b.initLowLimValues = C;
371
- b.initCutValues = R;
372
- b.calcCutValue = H;
373
- b.leaveEdge = K;
374
- b.enterEdge = Q;
375
- b.exchangeEdges = Z;
376
- function b(e) {
377
- e = he(e), _(e);
378
- var n = $(e);
379
- C(n), R(n, e);
380
- for (var r, a; r = K(n); )
381
- a = Q(n, e, r), Z(n, e, r, a);
382
- }
383
- function R(e, n) {
384
- var r = _e(e, e.nodes());
385
- r = r.slice(0, r.length - 1), i.forEach(r, function(a) {
386
- Ce(e, n, a);
387
- });
388
- }
389
- function Ce(e, n, r) {
390
- var a = e.node(r), t = a.parent;
391
- e.edge(r, t).cutvalue = H(e, n, r);
392
- }
393
- function H(e, n, r) {
394
- var a = e.node(r), t = a.parent, d = !0, o = n.edge(r, t), f = 0;
395
- return o || (d = !1, o = n.edge(t, r)), f = o.weight, i.forEach(n.nodeEdges(r), function(u) {
396
- var c = u.v === r, s = c ? u.w : u.v;
397
- if (s !== t) {
398
- var h = c === d, l = n.edge(u).weight;
399
- if (f += h ? l : -l, je(e, r, s)) {
400
- var v = e.edge(r, s).cutvalue;
401
- f += h ? -v : v;
402
- }
403
- }
404
- }), f;
405
- }
406
- function C(e, n) {
407
- arguments.length < 2 && (n = e.nodes()[0]), J(e, {}, 1, n);
408
- }
409
- function J(e, n, r, a, t) {
410
- var d = r, o = e.node(a);
411
- return n[a] = !0, i.forEach(e.neighbors(a), function(f) {
412
- Object.prototype.hasOwnProperty.call(n, f) || (r = J(e, n, r, f, a));
413
- }), o.low = d, o.lim = r++, t ? o.parent = t : delete o.parent, r;
414
- }
415
- function K(e) {
416
- return i.find(e.edges(), function(n) {
417
- return e.edge(n).cutvalue < 0;
418
- });
419
- }
420
- function Q(e, n, r) {
421
- var a = r.v, t = r.w;
422
- n.hasEdge(a, t) || (a = r.w, t = r.v);
423
- var d = e.node(a), o = e.node(t), f = d, u = !1;
424
- d.lim > o.lim && (f = o, u = !0);
425
- var c = i.filter(n.edges(), function(s) {
426
- return u === F(e, e.node(s.v), f) && u !== F(e, e.node(s.w), f);
427
- });
428
- return i.minBy(c, function(s) {
429
- return g(n, s);
430
- });
431
- }
432
- function Z(e, n, r, a) {
433
- var t = r.v, d = r.w;
434
- e.removeEdge(t, d), e.setEdge(a.v, a.w, {}), C(e), R(e, n), Te(e, n);
435
- }
436
- function Te(e, n) {
437
- var r = i.find(e.nodes(), function(t) {
438
- return !n.node(t).parent;
439
- }), a = Re(e, r);
440
- a = a.slice(1), i.forEach(a, function(t) {
441
- var d = e.node(t).parent, o = n.edge(t, d), f = !1;
442
- o || (o = n.edge(d, t), f = !0), n.node(t).rank = n.node(d).rank + (f ? o.minlen : -o.minlen);
443
- });
444
- }
445
- function je(e, n, r) {
446
- return e.hasEdge(n, r);
447
- }
448
- function F(e, n, r) {
449
- return r.low <= n.lim && n.lim <= r.lim;
450
- }
451
- function Se(e) {
452
- switch (e.graph().ranker) {
453
- case "network-simplex":
454
- A(e);
455
- break;
456
- case "tight-tree":
457
- Ve(e);
458
- break;
459
- case "longest-path":
460
- Me(e);
461
- break;
462
- default:
463
- A(e);
464
- }
465
- }
466
- var Me = _;
467
- function Ve(e) {
468
- _(e), $(e);
469
- }
470
- function A(e) {
471
- b(e);
472
- }
473
- function Be(e) {
474
- var n = E(e, "root", {}, "_root"), r = Fe(e), a = i.max(i.values(r)) - 1, t = 2 * a + 1;
475
- e.graph().nestingRoot = n, i.forEach(e.edges(), function(o) {
476
- e.edge(o).minlen *= t;
477
- });
478
- var d = Ae(e) + 1;
479
- i.forEach(e.children(), function(o) {
480
- ee(e, n, t, d, a, r, o);
481
- }), e.graph().nodeRankFactor = t;
482
- }
483
- function ee(e, n, r, a, t, d, o) {
484
- var f = e.children(o);
485
- if (!f.length) {
486
- o !== n && e.setEdge(n, o, { weight: 0, minlen: r });
487
- return;
488
- }
489
- var u = M(e, "_bt"), c = M(e, "_bb"), s = e.node(o);
490
- e.setParent(u, o), s.borderTop = u, e.setParent(c, o), s.borderBottom = c, i.forEach(f, function(h) {
491
- ee(e, n, r, a, t, d, h);
492
- var l = e.node(h), v = l.borderTop ? l.borderTop : h, p = l.borderBottom ? l.borderBottom : h, m = l.borderTop ? a : 2 * a, y = v !== p ? 1 : t - d[o] + 1;
493
- e.setEdge(u, v, {
494
- weight: m,
495
- minlen: y,
496
- nestingEdge: !0
497
- }), e.setEdge(p, c, {
498
- weight: m,
499
- minlen: y,
500
- nestingEdge: !0
501
- });
502
- }), e.parent(o) || e.setEdge(n, u, { weight: 0, minlen: t + d[o] });
503
- }
504
- function Fe(e) {
505
- var n = {};
506
- function r(a, t) {
507
- var d = e.children(a);
508
- d && d.length && i.forEach(d, function(o) {
509
- r(o, t + 1);
510
- }), n[a] = t;
511
- }
512
- return i.forEach(e.children(), function(a) {
513
- r(a, 1);
514
- }), n;
515
- }
516
- function Ae(e) {
517
- return i.reduce(
518
- e.edges(),
519
- function(n, r) {
520
- return n + e.edge(r).weight;
521
- },
522
- 0
523
- );
524
- }
525
- function Ye(e) {
526
- var n = e.graph();
527
- e.removeNode(n.nestingRoot), delete n.nestingRoot, i.forEach(e.edges(), function(r) {
528
- var a = e.edge(r);
529
- a.nestingEdge && e.removeEdge(r);
530
- });
531
- }
532
- function De(e, n, r) {
533
- var a = {}, t;
534
- i.forEach(r, function(d) {
535
- for (var o = e.parent(d), f, u; o; ) {
536
- if (f = e.parent(o), f ? (u = a[f], a[f] = o) : (u = t, t = o), u && u !== o) {
537
- n.setEdge(u, o);
538
- return;
539
- }
540
- o = f;
541
- }
542
- });
543
- }
544
- function Ge(e, n, r) {
545
- var a = Ue(e), t = new w({ compound: !0 }).setGraph({ root: a }).setDefaultNodeLabel(function(d) {
546
- return e.node(d);
547
- });
548
- return i.forEach(e.nodes(), function(d) {
549
- var o = e.node(d), f = e.parent(d);
550
- (o.rank === n || o.minRank <= n && n <= o.maxRank) && (t.setNode(d), t.setParent(d, f || a), i.forEach(e[r](d), function(u) {
551
- var c = u.v === d ? u.w : u.v, s = t.edge(c, d), h = i.isUndefined(s) ? 0 : s.weight;
552
- t.setEdge(c, d, { weight: e.edge(u).weight + h });
553
- }), Object.prototype.hasOwnProperty.call(o, "minRank") && t.setNode(d, {
554
- borderLeft: o.borderLeft[n],
555
- borderRight: o.borderRight[n]
556
- }));
557
- }), t;
558
- }
559
- function Ue(e) {
560
- for (var n; e.hasNode(n = i.uniqueId("_root")); ) ;
561
- return n;
562
- }
563
- function qe(e, n) {
564
- for (var r = 0, a = 1; a < n.length; ++a)
565
- r += We(e, n[a - 1], n[a]);
566
- return r;
567
- }
568
- function We(e, n, r) {
569
- for (var a = i.zipObject(
570
- r,
571
- i.map(r, function(c, s) {
572
- return s;
573
- })
574
- ), t = i.flatten(
575
- i.map(n, function(c) {
576
- return i.sortBy(
577
- i.map(e.outEdges(c), function(s) {
578
- return { pos: a[s.w], weight: e.edge(s).weight };
579
- }),
580
- "pos"
581
- );
582
- })
583
- ), d = 1; d < r.length; ) d <<= 1;
584
- var o = 2 * d - 1;
585
- d -= 1;
586
- var f = i.map(new Array(o), function() {
587
- return 0;
588
- }), u = 0;
589
- return i.forEach(
590
- // @ts-expect-error
591
- t.forEach(function(c) {
592
- var s = c.pos + d;
593
- f[s] += c.weight;
594
- for (var h = 0; s > 0; )
595
- s % 2 && (h += f[s + 1]), s = s - 1 >> 1, f[s] += c.weight;
596
- u += c.weight * h;
597
- })
598
- ), u;
599
- }
600
- function $e(e) {
601
- var n = {}, r = i.filter(e.nodes(), function(f) {
602
- return !e.children(f).length;
603
- }), a = i.max(
604
- i.map(r, function(f) {
605
- return e.node(f).rank;
606
- })
607
- ), t = i.map(i.range(a + 1), function() {
608
- return [];
609
- });
610
- function d(f) {
611
- if (!i.has(n, f)) {
612
- n[f] = !0;
613
- var u = e.node(f);
614
- t[u.rank].push(f), i.forEach(e.successors(f), d);
615
- }
616
- }
617
- var o = i.sortBy(r, function(f) {
618
- return e.node(f).rank;
619
- });
620
- return i.forEach(o, d), t;
621
- }
622
- function ze(e, n) {
623
- return i.map(n, function(r) {
624
- var a = e.inEdges(r);
625
- if (a.length) {
626
- var t = i.reduce(
627
- a,
628
- function(d, o) {
629
- var f = e.edge(o), u = e.node(o.v);
630
- return {
631
- sum: d.sum + f.weight * u.order,
632
- weight: d.weight + f.weight
633
- };
634
- },
635
- { sum: 0, weight: 0 }
636
- );
637
- return {
638
- v: r,
639
- barycenter: t.sum / t.weight,
640
- weight: t.weight
641
- };
642
- } else
643
- return { v: r };
644
- });
645
- }
646
- function Xe(e, n) {
647
- var r = {};
648
- i.forEach(e, function(t, d) {
649
- var o = r[t.v] = {
650
- indegree: 0,
651
- in: [],
652
- out: [],
653
- vs: [t.v],
654
- i: d
655
- };
656
- i.isUndefined(t.barycenter) || (o.barycenter = t.barycenter, o.weight = t.weight);
657
- }), i.forEach(n.edges(), function(t) {
658
- var d = r[t.v], o = r[t.w];
659
- !i.isUndefined(d) && !i.isUndefined(o) && (o.indegree++, d.out.push(r[t.w]));
660
- });
661
- var a = i.filter(r, function(t) {
662
- return !t.indegree;
663
- });
664
- return He(a);
665
- }
666
- function He(e) {
667
- var n = [];
668
- function r(d) {
669
- return function(o) {
670
- o.merged || (i.isUndefined(o.barycenter) || i.isUndefined(d.barycenter) || o.barycenter >= d.barycenter) && Je(d, o);
671
- };
672
- }
673
- function a(d) {
674
- return function(o) {
675
- o.in.push(d), --o.indegree === 0 && e.push(o);
676
- };
677
- }
678
- for (; e.length; ) {
679
- var t = e.pop();
680
- n.push(t), i.forEach(t.in.reverse(), r(t)), i.forEach(t.out, a(t));
681
- }
682
- return i.map(
683
- i.filter(n, function(d) {
684
- return !d.merged;
685
- }),
686
- function(d) {
687
- return i.pick(d, ["vs", "i", "barycenter", "weight"]);
688
- }
689
- );
690
- }
691
- function Je(e, n) {
692
- var r = 0, a = 0;
693
- 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 = !0;
694
- }
695
- function Ke(e, n) {
696
- var r = pe(e, function(s) {
697
- return Object.prototype.hasOwnProperty.call(s, "barycenter");
698
- }), a = r.lhs, t = i.sortBy(r.rhs, function(s) {
699
- return -s.i;
700
- }), d = [], o = 0, f = 0, u = 0;
701
- a.sort(Qe(!!n)), u = Y(d, t, u), i.forEach(a, function(s) {
702
- u += s.vs.length, d.push(s.vs), o += s.barycenter * s.weight, f += s.weight, u = Y(d, t, u);
703
- });
704
- var c = { vs: i.flatten(d) };
705
- return f && (c.barycenter = o / f, c.weight = f), c;
706
- }
707
- function Y(e, n, r) {
708
- for (var a; n.length && (a = i.last(n)).i <= r; )
709
- n.pop(), e.push(a.vs), r++;
710
- return r;
711
- }
712
- function Qe(e) {
713
- return function(n, r) {
714
- return n.barycenter < r.barycenter ? -1 : n.barycenter > r.barycenter ? 1 : e ? r.i - n.i : n.i - r.i;
715
- };
716
- }
717
- function ne(e, n, r, a) {
718
- var t = e.children(n), d = e.node(n), o = d ? d.borderLeft : void 0, f = d ? d.borderRight : void 0, u = {};
719
- o && (t = i.filter(t, function(p) {
720
- return p !== o && p !== f;
721
- }));
722
- var c = ze(e, t);
723
- i.forEach(c, function(p) {
724
- if (e.children(p.v).length) {
725
- var m = ne(e, p.v, r, a);
726
- u[p.v] = m, Object.prototype.hasOwnProperty.call(m, "barycenter") && en(p, m);
727
- }
728
- });
729
- var s = Xe(c, r);
730
- Ze(s, u);
731
- var h = Ke(s, a);
732
- if (o && (h.vs = i.flatten([o, h.vs, f]), e.predecessors(o).length)) {
733
- var l = e.node(e.predecessors(o)[0]), v = e.node(e.predecessors(f)[0]);
734
- Object.prototype.hasOwnProperty.call(h, "barycenter") || (h.barycenter = 0, h.weight = 0), h.barycenter = (h.barycenter * h.weight + l.order + v.order) / (h.weight + 2), h.weight += 2;
735
- }
736
- return h;
737
- }
738
- function Ze(e, n) {
739
- i.forEach(e, function(r) {
740
- r.vs = i.flatten(
741
- r.vs.map(function(a) {
742
- return n[a] ? n[a].vs : a;
743
- })
744
- );
745
- });
746
- }
747
- function en(e, n) {
748
- i.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);
749
- }
750
- function nn(e) {
751
- var n = q(e), r = D(e, i.range(1, n + 1), "inEdges"), a = D(e, i.range(n - 1, -1, -1), "outEdges"), t = $e(e);
752
- G(e, t);
753
- for (var d = Number.POSITIVE_INFINITY, o, f = 0, u = 0; u < 4; ++f, ++u) {
754
- rn(f % 2 ? r : a, f % 4 >= 2), t = k(e);
755
- var c = qe(e, t);
756
- c < d && (u = 0, o = i.cloneDeep(t), d = c);
757
- }
758
- G(e, o);
759
- }
760
- function D(e, n, r) {
761
- return i.map(n, function(a) {
762
- return Ge(e, a, r);
763
- });
764
- }
765
- function rn(e, n) {
766
- var r = new w();
767
- i.forEach(e, function(a) {
768
- var t = a.graph().root, d = ne(a, t, r, n);
769
- i.forEach(d.vs, function(o, f) {
770
- a.node(o).order = f;
771
- }), De(a, r, d.vs);
772
- });
773
- }
774
- function G(e, n) {
775
- i.forEach(n, function(r) {
776
- i.forEach(r, function(a, t) {
777
- e.node(a).order = t;
778
- });
779
- });
780
- }
781
- function an(e) {
782
- var n = on(e);
783
- i.forEach(e.graph().dummyChains, function(r) {
784
- for (var a = e.node(r), t = a.edgeObj, d = tn(e, n, t.v, t.w), o = d.path, f = d.lca, u = 0, c = o[u], s = !0; r !== t.w; ) {
785
- if (a = e.node(r), s) {
786
- for (; (c = o[u]) !== f && e.node(c).maxRank < a.rank; )
787
- u++;
788
- c === f && (s = !1);
789
- }
790
- if (!s) {
791
- for (; u < o.length - 1 && e.node(c = o[u + 1]).minRank <= a.rank; )
792
- u++;
793
- c = o[u];
794
- }
795
- e.setParent(r, c), r = e.successors(r)[0];
796
- }
797
- });
798
- }
799
- function tn(e, n, r, a) {
800
- var t = [], d = [], o = Math.min(n[r].low, n[a].low), f = Math.max(n[r].lim, n[a].lim), u, c;
801
- u = r;
802
- do
803
- u = e.parent(u), t.push(u);
804
- while (u && (n[u].low > o || f > n[u].lim));
805
- for (c = u, u = a; (u = e.parent(u)) !== c; )
806
- d.push(u);
807
- return { path: t.concat(d.reverse()), lca: c };
808
- }
809
- function on(e) {
810
- var n = {}, r = 0;
811
- function a(t) {
812
- var d = r;
813
- i.forEach(e.children(t), a), n[t] = { low: d, lim: r++ };
814
- }
815
- return i.forEach(e.children(), a), n;
816
- }
817
- function dn(e, n) {
818
- var r = {};
819
- function a(t, d) {
820
- var o = 0, f = 0, u = t.length, c = i.last(d);
821
- return i.forEach(d, function(s, h) {
822
- var l = un(e, s), v = l ? e.node(l).order : u;
823
- (l || s === c) && (i.forEach(d.slice(f, h + 1), function(p) {
824
- i.forEach(e.predecessors(p), function(m) {
825
- var y = e.node(m), T = y.order;
826
- (T < o || v < T) && !(y.dummy && e.node(p).dummy) && re(r, m, p);
827
- });
828
- }), f = h + 1, o = v);
829
- }), d;
830
- }
831
- return i.reduce(n, a), r;
832
- }
833
- function fn(e, n) {
834
- var r = {};
835
- function a(d, o, f, u, c) {
836
- var s;
837
- i.forEach(i.range(o, f), function(h) {
838
- s = d[h], e.node(s).dummy && i.forEach(e.predecessors(s), function(l) {
839
- var v = e.node(l);
840
- v.dummy && (v.order < u || v.order > c) && re(r, l, s);
841
- });
842
- });
843
- }
844
- function t(d, o) {
845
- var f = -1, u, c = 0;
846
- return i.forEach(o, function(s, h) {
847
- if (e.node(s).dummy === "border") {
848
- var l = e.predecessors(s);
849
- l.length && (u = e.node(l[0]).order, a(o, c, h, f, u), c = h, f = u);
850
- }
851
- a(o, c, o.length, u, d.length);
852
- }), o;
853
- }
854
- return i.reduce(n, t), r;
855
- }
856
- function un(e, n) {
857
- if (e.node(n).dummy)
858
- return i.find(e.predecessors(n), function(r) {
859
- return e.node(r).dummy;
860
- });
861
- }
862
- function re(e, n, r) {
863
- if (n > r) {
864
- var a = n;
865
- n = r, r = a;
866
- }
867
- Object.prototype.hasOwnProperty.call(e, n) || Object.defineProperty(e, n, {
868
- enumerable: !0,
869
- configurable: !0,
870
- value: {},
871
- writable: !0
872
- });
873
- var t = e[n];
874
- Object.defineProperty(t, r, {
875
- enumerable: !0,
876
- configurable: !0,
877
- value: !0,
878
- writable: !0
879
- });
880
- }
881
- function cn(e, n, r) {
882
- if (n > r) {
883
- var a = n;
884
- n = r, r = a;
885
- }
886
- return !!e[n] && Object.prototype.hasOwnProperty.call(e[n], r);
887
- }
888
- function sn(e, n, r, a) {
889
- var t = {}, d = {}, o = {};
890
- return i.forEach(n, function(f) {
891
- i.forEach(f, function(u, c) {
892
- t[u] = u, d[u] = u, o[u] = c;
893
- });
894
- }), i.forEach(n, function(f) {
895
- var u = -1;
896
- i.forEach(f, function(c) {
897
- var s = a(c);
898
- if (s.length) {
899
- s = i.sortBy(s, function(m) {
900
- return o[m];
901
- });
902
- for (var h = (s.length - 1) / 2, l = Math.floor(h), v = Math.ceil(h); l <= v; ++l) {
903
- var p = s[l];
904
- d[c] === c && u < o[p] && !cn(r, c, p) && (d[p] = c, d[c] = t[c] = t[p], u = o[p]);
905
- }
906
- }
907
- });
908
- }), { root: t, align: d };
909
- }
910
- function hn(e, n, r, a, t) {
911
- var d = {}, o = ln(e, n, r, t), f = t ? "borderLeft" : "borderRight";
912
- function u(h, l) {
913
- for (var v = o.nodes(), p = v.pop(), m = {}; p; )
914
- m[p] ? h(p) : (m[p] = !0, v.push(p), v = v.concat(l(p))), p = v.pop();
915
- }
916
- function c(h) {
917
- d[h] = o.inEdges(h).reduce(function(l, v) {
918
- return Math.max(l, d[v.v] + o.edge(v));
919
- }, 0);
920
- }
921
- function s(h) {
922
- var l = o.outEdges(h).reduce(function(p, m) {
923
- return Math.min(p, d[m.w] - o.edge(m));
924
- }, Number.POSITIVE_INFINITY), v = e.node(h);
925
- l !== Number.POSITIVE_INFINITY && v.borderType !== f && (d[h] = Math.max(d[h], l));
926
- }
927
- return u(c, o.predecessors.bind(o)), u(s, o.successors.bind(o)), i.forEach(a, function(h) {
928
- d[h] = d[r[h]];
929
- }), d;
930
- }
931
- function ln(e, n, r, a) {
932
- var t = new w(), d = e.graph(), o = bn(d.nodesep, d.edgesep, a);
933
- return i.forEach(n, function(f) {
934
- var u;
935
- i.forEach(f, function(c) {
936
- var s = r[c];
937
- if (t.setNode(s), u) {
938
- var h = r[u], l = t.edge(h, s);
939
- t.setEdge(h, s, Math.max(o(e, c, u), l || 0));
940
- }
941
- u = c;
942
- });
943
- }), t;
944
- }
945
- function vn(e, n) {
946
- return i.minBy(i.values(n), function(r) {
947
- var a = Number.NEGATIVE_INFINITY, t = Number.POSITIVE_INFINITY;
948
- return i.forIn(r, function(d, o) {
949
- var f = En(e, o) / 2;
950
- a = Math.max(d + f, a), t = Math.min(d - f, t);
951
- }), a - t;
952
- });
953
- }
954
- function pn(e, n) {
955
- var r = i.values(n), a = i.min(r), t = i.max(r);
956
- i.forEach(["u", "d"], function(d) {
957
- i.forEach(["l", "r"], function(o) {
958
- var f = d + o, u = e[f], c;
959
- if (u !== n) {
960
- var s = i.values(u);
961
- c = o === "l" ? a - i.min(s) : t - i.max(s), c && (e[f] = i.mapValues(u, function(h) {
962
- return h + c;
963
- }));
964
- }
965
- });
966
- });
967
- }
968
- function mn(e, n) {
969
- return i.mapValues(e.ul, function(r, a) {
970
- if (n)
971
- return e[n.toLowerCase()][a];
972
- var t = i.sortBy(i.map(e, a));
973
- return (t[1] + t[2]) / 2;
974
- });
975
- }
976
- function wn(e) {
977
- var n = k(e), r = i.merge(dn(e, n), fn(e, n)), a = {}, t;
978
- i.forEach(["u", "d"], function(o) {
979
- t = o === "u" ? n : i.values(n).reverse(), i.forEach(["l", "r"], function(f) {
980
- f === "r" && (t = i.map(t, function(h) {
981
- return i.values(h).reverse();
982
- }));
983
- var u = (o === "u" ? e.predecessors : e.successors).bind(e), c = sn(e, t, r, u), s = hn(e, t, c.root, c.align, f === "r");
984
- f === "r" && (s = i.mapValues(s, function(h) {
985
- return -h;
986
- })), a[o + f] = s;
987
- });
988
- });
989
- var d = vn(e, a);
990
- return pn(a, d), mn(a, e.graph().align);
991
- }
992
- function bn(e, n, r) {
993
- return function(a, t, d) {
994
- var o = a.node(t), f = a.node(d), u = 0, c;
995
- if (u += o.width / 2, Object.prototype.hasOwnProperty.call(o, "labelpos"))
996
- switch (o.labelpos.toLowerCase()) {
997
- case "l":
998
- c = -o.width / 2;
999
- break;
1000
- case "r":
1001
- c = o.width / 2;
1002
- break;
1003
- }
1004
- if (c && (u += r ? c : -c), c = 0, u += (o.dummy ? n : e) / 2, u += (f.dummy ? n : e) / 2, u += f.width / 2, Object.prototype.hasOwnProperty.call(f, "labelpos"))
1005
- switch (f.labelpos.toLowerCase()) {
1006
- case "l":
1007
- c = f.width / 2;
1008
- break;
1009
- case "r":
1010
- c = -f.width / 2;
1011
- break;
1012
- }
1013
- return c && (u += r ? c : -c), c = 0, u;
1014
- };
1015
- }
1016
- function En(e, n) {
1017
- return e.node(n).width;
1018
- }
1019
- function yn(e) {
1020
- e = U(e), gn(e), i.forOwn(wn(e), function(n, r) {
1021
- e.node(r).x = n;
1022
- });
1023
- }
1024
- function gn(e) {
1025
- var n = k(e), r = e.graph().ranksep, a = 0;
1026
- i.forEach(n, function(t) {
1027
- var d = i.max(
1028
- i.map(t, function(o) {
1029
- return e.node(o).height;
1030
- })
1031
- );
1032
- i.forEach(t, function(o) {
1033
- e.node(o).y = a + d / 2;
1034
- }), a += d + r;
1035
- });
1036
- }
1037
- function $n(e, n) {
1038
- var r = me;
1039
- r("layout", () => {
1040
- var a = r(" buildLayoutGraph", () => Tn(e));
1041
- r(" runLayout", () => kn(a, r)), r(" updateInputGraph", () => xn(e, a));
1042
- });
1043
- }
1044
- function kn(e, n) {
1045
- n(" makeSpaceForEdgeLabels", () => jn(e)), n(" removeSelfEdges", () => Gn(e)), n(" acyclic", () => ue(e)), n(" nestingGraph.run", () => Be(e)), n(" rank", () => Se(U(e))), n(" injectEdgeLabelProxies", () => Sn(e)), n(" removeEmptyRanks", () => ve(e)), n(" nestingGraph.cleanup", () => Ye(e)), n(" normalizeRanks", () => le(e)), n(" assignRankMinMax", () => Mn(e)), n(" removeEdgeLabelProxies", () => Vn(e)), n(" normalize.run", () => ke(e)), n(" parentDummyChains", () => an(e)), n(" addBorderSegments", () => we(e)), n(" order", () => nn(e)), n(" insertSelfEdges", () => Un(e)), n(" adjustCoordinateSystem", () => be(e)), n(" position", () => yn(e)), n(" positionSelfEdges", () => qn(e)), n(" removeBorderNodes", () => Dn(e)), n(" normalize.undo", () => Oe(e)), n(" fixupEdgeLabelCoords", () => An(e)), n(" undoCoordinateSystem", () => Ee(e)), n(" translateGraph", () => Bn(e)), n(" assignNodeIntersects", () => Fn(e)), n(" reversePoints", () => Yn(e)), n(" acyclic.undo", () => se(e));
1046
- }
1047
- function xn(e, n) {
1048
- i.forEach(e.nodes(), function(r) {
1049
- var a = e.node(r), t = n.node(r);
1050
- a && (a.x = t.x, a.y = t.y, n.children(r).length && (a.width = t.width, a.height = t.height));
1051
- }), i.forEach(e.edges(), function(r) {
1052
- var a = e.edge(r), t = n.edge(r);
1053
- a.points = t.points, Object.prototype.hasOwnProperty.call(t, "x") && (a.x = t.x, a.y = t.y);
1054
- }), e.graph().width = n.graph().width, e.graph().height = n.graph().height;
1055
- }
1056
- var On = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], Nn = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, Ln = ["acyclicer", "ranker", "rankdir", "align"], In = ["width", "height"], Pn = { width: 0, height: 0 }, _n = ["minlen", "weight", "width", "height", "labeloffset"], Rn = {
1057
- minlen: 1,
1058
- weight: 1,
1059
- width: 0,
1060
- height: 0,
1061
- labeloffset: 10,
1062
- labelpos: "r"
1063
- }, Cn = ["labelpos"];
1064
- function Tn(e) {
1065
- var n = new w({ multigraph: !0, compound: !0 }), r = I(e.graph());
1066
- return n.setGraph(
1067
- i.merge({}, Nn, L(r, On), i.pick(r, Ln))
1068
- ), i.forEach(e.nodes(), function(a) {
1069
- var t = I(e.node(a));
1070
- n.setNode(a, i.defaults(L(t, In), Pn)), n.setParent(a, e.parent(a));
1071
- }), i.forEach(e.edges(), function(a) {
1072
- var t = I(e.edge(a));
1073
- n.setEdge(
1074
- a,
1075
- i.merge({}, Rn, L(t, _n), i.pick(t, Cn))
1076
- );
1077
- }), n;
1078
- }
1079
- function jn(e) {
1080
- var n = e.graph();
1081
- n.ranksep /= 2, i.forEach(e.edges(), function(r) {
1082
- var a = e.edge(r);
1083
- a.minlen *= 2, a.labelpos.toLowerCase() !== "c" && (n.rankdir === "TB" || n.rankdir === "BT" ? a.width += a.labeloffset : a.height += a.labeloffset);
1084
- });
1085
- }
1086
- function Sn(e) {
1087
- i.forEach(e.edges(), function(n) {
1088
- var r = e.edge(n);
1089
- if (r.width && r.height) {
1090
- var a = e.node(n.v), t = e.node(n.w), d = { rank: (t.rank - a.rank) / 2 + a.rank, e: n };
1091
- E(e, "edge-proxy", d, "_ep");
1092
- }
1093
- });
1094
- }
1095
- function Mn(e) {
1096
- var n = 0;
1097
- i.forEach(e.nodes(), function(r) {
1098
- var a = e.node(r);
1099
- a.borderTop && (a.minRank = e.node(a.borderTop).rank, a.maxRank = e.node(a.borderBottom).rank, n = i.max(n, a.maxRank));
1100
- }), e.graph().maxRank = n;
1101
- }
1102
- function Vn(e) {
1103
- i.forEach(e.nodes(), function(n) {
1104
- var r = e.node(n);
1105
- r.dummy === "edge-proxy" && (e.edge(r.e).labelRank = r.rank, e.removeNode(n));
1106
- });
1107
- }
1108
- function Bn(e) {
1109
- var n = Number.POSITIVE_INFINITY, r = 0, a = Number.POSITIVE_INFINITY, t = 0, d = e.graph(), o = d.marginx || 0, f = d.marginy || 0;
1110
- function u(c) {
1111
- var s = c.x, h = c.y, l = c.width, v = c.height;
1112
- n = Math.min(n, s - l / 2), r = Math.max(r, s + l / 2), a = Math.min(a, h - v / 2), t = Math.max(t, h + v / 2);
1113
- }
1114
- i.forEach(e.nodes(), function(c) {
1115
- u(e.node(c));
1116
- }), i.forEach(e.edges(), function(c) {
1117
- var s = e.edge(c);
1118
- Object.prototype.hasOwnProperty.call(s, "x") && u(s);
1119
- }), n -= o, a -= f, i.forEach(e.nodes(), function(c) {
1120
- var s = e.node(c);
1121
- s.x -= n, s.y -= a;
1122
- }), i.forEach(e.edges(), function(c) {
1123
- var s = e.edge(c);
1124
- i.forEach(s.points, function(h) {
1125
- h.x -= n, h.y -= a;
1126
- }), Object.prototype.hasOwnProperty.call(s, "x") && (s.x -= n), Object.prototype.hasOwnProperty.call(s, "y") && (s.y -= a);
1127
- }), d.width = r - n + o, d.height = t - a + f;
1128
- }
1129
- function Fn(e) {
1130
- i.forEach(e.edges(), function(n) {
1131
- var r = e.edge(n), a = e.node(n.v), t = e.node(n.w), d, o;
1132
- r.points ? (d = r.points[0], o = r.points[r.points.length - 1]) : (r.points = [], d = t, o = a), r.points.unshift(S(a, d)), r.points.push(S(t, o));
1133
- });
1134
- }
1135
- function An(e) {
1136
- i.forEach(e.edges(), function(n) {
1137
- var r = e.edge(n);
1138
- if (Object.prototype.hasOwnProperty.call(r, "x"))
1139
- switch ((r.labelpos === "l" || r.labelpos === "r") && (r.width -= r.labeloffset), r.labelpos) {
1140
- case "l":
1141
- r.x -= r.width / 2 + r.labeloffset;
1142
- break;
1143
- case "r":
1144
- r.x += r.width / 2 + r.labeloffset;
1145
- break;
1146
- }
1147
- });
1148
- }
1149
- function Yn(e) {
1150
- i.forEach(e.edges(), function(n) {
1151
- var r = e.edge(n);
1152
- r.reversed && r.points.reverse();
1153
- });
1154
- }
1155
- function Dn(e) {
1156
- i.forEach(e.nodes(), function(n) {
1157
- if (e.children(n).length) {
1158
- var r = e.node(n), a = e.node(r.borderTop), t = e.node(r.borderBottom), d = e.node(i.last(r.borderLeft)), o = e.node(i.last(r.borderRight));
1159
- r.width = Math.abs(o.x - d.x), r.height = Math.abs(t.y - a.y), r.x = d.x + r.width / 2, r.y = a.y + r.height / 2;
1160
- }
1161
- }), i.forEach(e.nodes(), function(n) {
1162
- e.node(n).dummy === "border" && e.removeNode(n);
1163
- });
1164
- }
1165
- function Gn(e) {
1166
- i.forEach(e.edges(), function(n) {
1167
- if (n.v === n.w) {
1168
- var r = e.node(n.v);
1169
- r.selfEdges || (r.selfEdges = []), r.selfEdges.push({ e: n, label: e.edge(n) }), e.removeEdge(n);
1170
- }
1171
- });
1172
- }
1173
- function Un(e) {
1174
- var n = k(e);
1175
- i.forEach(n, function(r) {
1176
- var a = 0;
1177
- i.forEach(r, function(t, d) {
1178
- var o = e.node(t);
1179
- o.order = d + a, i.forEach(o.selfEdges, function(f) {
1180
- E(
1181
- e,
1182
- "selfedge",
1183
- {
1184
- width: f.label.width,
1185
- height: f.label.height,
1186
- rank: o.rank,
1187
- order: d + ++a,
1188
- e: f.e,
1189
- label: f.label
1190
- },
1191
- "_se"
1192
- );
1193
- }), delete o.selfEdges;
1194
- });
1195
- });
1196
- }
1197
- function qn(e) {
1198
- i.forEach(e.nodes(), function(n) {
1199
- var r = e.node(n);
1200
- if (r.dummy === "selfedge") {
1201
- var a = e.node(r.e.v), t = a.x + a.width / 2, d = a.y, o = r.x - t, f = a.height / 2;
1202
- e.setEdge(r.e, r.label), e.removeNode(n), r.label.points = [
1203
- { x: t + 2 * o / 3, y: d - f },
1204
- { x: t + 5 * o / 6, y: d - f },
1205
- { x: t + o, y: d },
1206
- { x: t + 5 * o / 6, y: d + f },
1207
- { x: t + 2 * o / 3, y: d + f }
1208
- ], r.label.x = r.x, r.label.y = r.y;
1209
- }
1210
- });
1211
- }
1212
- function L(e, n) {
1213
- return i.mapValues(i.pick(e, n), Number);
1214
- }
1215
- function I(e) {
1216
- var n = {};
1217
- return i.forEach(e, function(r, a) {
1218
- n[a.toLowerCase()] = r;
1219
- }), n;
1220
- }
1221
- export {
1222
- $n as l
1223
- };