@marimo-team/islands 0.12.1-dev2 → 0.12.1-dev21

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 (92) hide show
  1. package/dist/{ConnectedDataExplorerComponent-BUkHSSQ3.js → ConnectedDataExplorerComponent-DNQoDjFe.js} +8 -8
  2. package/dist/{VegaLite-D2gsHKuf.js → VegaLite-C61XFnJy.js} +2456 -2455
  3. package/dist/{_baseUniq-CGdEI3Nv.js → _baseUniq-BVJ8xAuG.js} +1 -1
  4. package/dist/{any-language-editor-CKyudq2-.js → any-language-editor-OJReD1ph.js} +176 -177
  5. package/dist/architectureDiagram-IEHRJDOE-C5szj5L-.js +4634 -0
  6. package/dist/assets/{save-worker-J2nVA3vw.js → save-worker-CYdkP5Ic.js} +5 -5
  7. package/dist/assets/{worker-6ypxTHEH.js → worker-CH7zxkMA.js} +5 -5
  8. package/dist/assets/{worker-0hM8VAjI.js → worker-DEw2ZetQ.js} +5 -5
  9. package/dist/{blockDiagram-ZHA2E4KO-BlCDChLH.js → blockDiagram-JOT3LUYC-6huJKNk4.js} +4 -4
  10. package/dist/{c4Diagram-6F5ED5ID-niLscHfK.js → c4Diagram-VJAJSXHY-DLdlB4_f.js} +2 -2
  11. package/dist/{channel-Bt8mGm9q.js → channel-C4MpN-FJ.js} +1 -1
  12. package/dist/{chunk-TMUBEWPD-CQLP9BEl.js → chunk-4BMEZGHF-CczBKfna.js} +1 -1
  13. package/dist/chunk-A2AXSNBT-BsMPztSQ.js +1372 -0
  14. package/dist/chunk-AEK57VVT-B6c3n8K2.js +1415 -0
  15. package/dist/{chunk-ASOPGD6M-DCxLLtgf.js → chunk-D6G4REZN-X8xBS5rG.js} +1 -1
  16. package/dist/{chunk-5HRBRIJM-DjjlC6eW.js → chunk-RZ5BOZE2-CUqnF2K6.js} +1 -1
  17. package/dist/{chunk-KFBOBJHC-DPkQurpv.js → chunk-XZIHB7SX-CSouwcyb.js} +1 -1
  18. package/dist/classDiagram-GIVACNV2-CG_R_HQh.js +16 -0
  19. package/dist/classDiagram-v2-COTLJTTW-CG_R_HQh.js +16 -0
  20. package/dist/{clike-BLr83cjT.js → clike-BUuHEmgZ.js} +19 -17
  21. package/dist/{clone-COI_V4qE.js → clone-DK3J-MiR.js} +1 -1
  22. package/dist/{dagre-4EVJKHTY-DPsWdzds.js → dagre-OKDRZEBW-D8zhCeNW.js} +46 -46
  23. package/dist/{data-editor-D2rMsHxb.js → data-editor-BHWBseKi.js} +27 -22
  24. package/dist/diagram-SSKATNLV-pHZ4gvQ1.js +221 -0
  25. package/dist/{diagram-QW4FP2JN-D4dzrYii.js → diagram-VNBRO52H-D5_43LWo.js} +28 -28
  26. package/dist/{dockerfile-CFG_IPGn.js → dockerfile-DIy8NleC.js} +1 -1
  27. package/dist/erDiagram-Q7BY3M3F-CqUXZyK-.js +841 -0
  28. package/dist/{factor-DJHfQ4a1.js → factor-DDOC7X6P.js} +1 -1
  29. package/dist/flowDiagram-4HSFHLVR-DwhP_PW-.js +1622 -0
  30. package/dist/ganttDiagram-APWFNJXF-Coo7g8mK.js +1681 -0
  31. package/dist/{gitGraphDiagram-NRZ2UAAF-CO9Yfk-1.js → gitGraphDiagram-7IBYFJ6S-CJM5LDZc.js} +55 -55
  32. package/dist/{graph-j21MX5m5.js → graph-DXseY-wc.js} +3 -3
  33. package/dist/{groovy-CdgvOO23.js → groovy-DZeT_VM-.js} +1 -1
  34. package/dist/{index-DwhNQhNY.js → index-B-lvhTmE.js} +1 -1
  35. package/dist/{index-CZoype9l.js → index-B4nMPVvH.js} +1 -1
  36. package/dist/{index-C-FP0asF.js → index-BJcH72DF.js} +1 -1
  37. package/dist/{index-DATq7mzH.js → index-BUjAylGO.js} +1 -1
  38. package/dist/{index-CNYIP8n0.js → index-BeNQgFqm.js} +1 -1
  39. package/dist/{index-CqtUFj8g.js → index-BfQvDHaW.js} +1 -1
  40. package/dist/{index-D83p58Zi.js → index-BnGDaicg.js} +1 -1
  41. package/dist/{index-CxqVUOhW.js → index-C2ispfH7.js} +1 -1
  42. package/dist/{index-Cr0IVnKP.js → index-C31uOHRg.js} +3 -3
  43. package/dist/{index-4YXC3aOd.js → index-CwJWNsd3.js} +1 -1
  44. package/dist/{index-Wlh2yRsy.js → index-DC3Cnx5t.js} +1 -1
  45. package/dist/{index-_v--1fvH.js → index-DCcdmTNw.js} +1 -1
  46. package/dist/{index-Ec1JnxMr.js → index-DMfwuBgb.js} +1 -1
  47. package/dist/{index-VZAogpU3.js → index-DWPlo8vh.js} +1 -1
  48. package/dist/{index-B8argTgS.js → index-DYFTJIXf.js} +1 -1
  49. package/dist/{infoDiagram-A4XQUW5V-D6HtVB0K.js → infoDiagram-PH2N3AL5-CAFARnGi.js} +5 -5
  50. package/dist/{journeyDiagram-G5WM74LC-DMj7UaUs.js → journeyDiagram-U35MCT3I-CxCG-gu9.js} +34 -35
  51. package/dist/{kanban-definition-QRCXZQQD-C9sAvwvv.js → kanban-definition-NDS4AKOZ-DXWk4fBs.js} +26 -25
  52. package/dist/{layout-DnpJ8ssh.js → layout-DCbiAC-B.js} +4 -4
  53. package/dist/{linear-C7S_zUSg.js → linear-C-BjrWtA.js} +1 -1
  54. package/dist/{main-jjvPwD9F.js → main-VRYALaFR.js} +31084 -30575
  55. package/dist/main.js +1 -1
  56. package/dist/mermaid-3srgUkji.js +11991 -0
  57. package/dist/{min-DNi_26db.js → min-C6jNU-8q.js} +2 -2
  58. package/dist/{mindmap-definition-GWI6TPTV-Bbg64FAI.js → mindmap-definition-ALO5MXBD-ItSGCYxS.js} +3 -2
  59. package/dist/{nsis-BtA0qkjU.js → nsis-fePjrhq7.js} +1 -1
  60. package/dist/{pascal-ixanSKUz.js → pascal-De0D6mP7.js} +1 -1
  61. package/dist/{pieDiagram-YF2LJOPJ-Cr3o9epk.js → pieDiagram-IB7DONF6-DvX9YZO3.js} +38 -38
  62. package/dist/{quadrantDiagram-OS5C2QUG-CTdokV-X.js → quadrantDiagram-7GDLP6J5-BbXv1kiZ.js} +2 -2
  63. package/dist/{gitGraph-YCYPL57B-C6vjpJLv.js → radar-MK3ICKWK-Chc5umY2.js} +3259 -2897
  64. package/dist/{react-plotly-D7fFNQUF.js → react-plotly--Re2eJt2.js} +1 -1
  65. package/dist/requirementDiagram-KVF5MWMF-0r_3Jc_R.js +851 -0
  66. package/dist/{sankeyDiagram-Y46BX6SQ-CtGs7dt9.js → sankeyDiagram-QLVOVGJD-eycVAOR9.js} +152 -149
  67. package/dist/sequenceDiagram-X6HHIX6F-DQpYFs9_.js +2281 -0
  68. package/dist/{simple-mode-HGTvdazT.js → simple-mode-B0dvCdAA.js} +15 -14
  69. package/dist/slides-component-BM71y3QA.js +3782 -0
  70. package/dist/{stateDiagram-MAYHULR4-HCOwrhPJ.js → stateDiagram-DGXRK772--5awulBB.js} +41 -39
  71. package/dist/stateDiagram-v2-YXO3MK2T-CrxS4RqA.js +16 -0
  72. package/dist/style.css +1 -1
  73. package/dist/{time-Cf454IRV.js → time-aNhcx3m7.js} +2 -2
  74. package/dist/{timeline-definition-U7ZMHBDA-AcXJneLr.js → timeline-definition-BDJGKUSR-D5qQYaXU.js} +25 -25
  75. package/dist/{vega-component-DN01b8IT.js → vega-component-IC6ZSnx9.js} +2 -2
  76. package/dist/{xquery-xQxle02u.js → xquery-BUQdORAS.js} +72 -76
  77. package/dist/{xychartDiagram-6QU3TZC5-B3SwzwIL.js → xychartDiagram-VJFVF3MP-Ceb_sCs0.js} +11 -11
  78. package/package.json +25 -23
  79. package/dist/architectureDiagram-UYN6MBPD-C8FCwy4e.js +0 -4595
  80. package/dist/chunk-7U56Z5CX-D1T9hvBU.js +0 -1215
  81. package/dist/chunk-T2TOU4HS-DcM_xxju.js +0 -1303
  82. package/dist/classDiagram-LNE6IOMH-XbDq3sOW.js +0 -14
  83. package/dist/classDiagram-v2-MQ7JQ4JX-XbDq3sOW.js +0 -14
  84. package/dist/erDiagram-6RL3IURR-13ULGiOU.js +0 -938
  85. package/dist/flowDiagram-7ASYPVHJ-CMtLojGE.js +0 -1484
  86. package/dist/ganttDiagram-NTVNEXSI-Crv4rrPG.js +0 -1679
  87. package/dist/mermaid-BwpuxK20.js +0 -12937
  88. package/dist/requirementDiagram-MIRIMTAZ-Bz15K_7J.js +0 -769
  89. package/dist/sequenceDiagram-G6AWOVSC-D0hnYjDZ.js +0 -2274
  90. package/dist/slides-component-DM7nuuqG.js +0 -3776
  91. package/dist/stateDiagram-v2-4JROLMXI-Cj6uqksM.js +0 -14
  92. package/dist/stex-92raWT1r.js +0 -129
@@ -1,4595 +0,0 @@
1
- import { _ as nt, g as ke, s as qe, a as Je, b as Qe, o as Ke, p as je, I as _e, S as tr, x as er, l as Fe, a4 as Ne, c as ge, ak as me, d as rr, G as ir, al as ar, am as nr } from "./mermaid-BwpuxK20.js";
2
- import { p as or } from "./chunk-TMUBEWPD-CQLP9BEl.js";
3
- import { I as sr } from "./chunk-KFBOBJHC-DPkQurpv.js";
4
- import { p as hr } from "./gitGraph-YCYPL57B-C6vjpJLv.js";
5
- import { c as be } from "./cytoscape.esm-DAyNQ0qu.js";
6
- import { S as lr } from "./main-jjvPwD9F.js";
7
- var le = { exports: {} }, fe = { exports: {} }, ce = { exports: {} }, fr = ce.exports, Oe;
8
- function cr() {
9
- return Oe || (Oe = 1, function(C, Y) {
10
- (function(G, N) {
11
- C.exports = N();
12
- })(fr, function() {
13
- return (
14
- /******/
15
- function(A) {
16
- var G = {};
17
- function N(u) {
18
- if (G[u])
19
- return G[u].exports;
20
- var s = G[u] = {
21
- /******/
22
- i: u,
23
- /******/
24
- l: !1,
25
- /******/
26
- exports: {}
27
- /******/
28
- };
29
- return A[u].call(s.exports, s, s.exports, N), s.l = !0, s.exports;
30
- }
31
- return N.m = A, N.c = G, N.i = function(u) {
32
- return u;
33
- }, N.d = function(u, s, i) {
34
- N.o(u, s) || Object.defineProperty(u, s, {
35
- /******/
36
- configurable: !1,
37
- /******/
38
- enumerable: !0,
39
- /******/
40
- get: i
41
- /******/
42
- });
43
- }, N.n = function(u) {
44
- var s = u && u.__esModule ? (
45
- /******/
46
- function() {
47
- return u.default;
48
- }
49
- ) : (
50
- /******/
51
- function() {
52
- return u;
53
- }
54
- );
55
- return N.d(s, "a", s), s;
56
- }, N.o = function(u, s) {
57
- return Object.prototype.hasOwnProperty.call(u, s);
58
- }, N.p = "", N(N.s = 28);
59
- }([
60
- /* 0 */
61
- /***/
62
- function(A, G, N) {
63
- function u() {
64
- }
65
- u.QUALITY = 1, u.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, u.DEFAULT_INCREMENTAL = !1, u.DEFAULT_ANIMATION_ON_LAYOUT = !0, u.DEFAULT_ANIMATION_DURING_LAYOUT = !1, u.DEFAULT_ANIMATION_PERIOD = 50, u.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, u.DEFAULT_GRAPH_MARGIN = 15, u.NODE_DIMENSIONS_INCLUDE_LABELS = !1, u.SIMPLE_NODE_SIZE = 40, u.SIMPLE_NODE_HALF_SIZE = u.SIMPLE_NODE_SIZE / 2, u.EMPTY_COMPOUND_NODE_SIZE = 40, u.MIN_EDGE_LENGTH = 1, u.WORLD_BOUNDARY = 1e6, u.INITIAL_WORLD_BOUNDARY = u.WORLD_BOUNDARY / 1e3, u.WORLD_CENTER_X = 1200, u.WORLD_CENTER_Y = 900, A.exports = u;
66
- },
67
- /* 1 */
68
- /***/
69
- function(A, G, N) {
70
- var u = N(2), s = N(8), i = N(9);
71
- function r(f, a, y) {
72
- u.call(this, y), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = y, this.bendpoints = [], this.source = f, this.target = a;
73
- }
74
- r.prototype = Object.create(u.prototype);
75
- for (var e in u)
76
- r[e] = u[e];
77
- r.prototype.getSource = function() {
78
- return this.source;
79
- }, r.prototype.getTarget = function() {
80
- return this.target;
81
- }, r.prototype.isInterGraph = function() {
82
- return this.isInterGraph;
83
- }, r.prototype.getLength = function() {
84
- return this.length;
85
- }, r.prototype.isOverlapingSourceAndTarget = function() {
86
- return this.isOverlapingSourceAndTarget;
87
- }, r.prototype.getBendpoints = function() {
88
- return this.bendpoints;
89
- }, r.prototype.getLca = function() {
90
- return this.lca;
91
- }, r.prototype.getSourceInLca = function() {
92
- return this.sourceInLca;
93
- }, r.prototype.getTargetInLca = function() {
94
- return this.targetInLca;
95
- }, r.prototype.getOtherEnd = function(f) {
96
- if (this.source === f)
97
- return this.target;
98
- if (this.target === f)
99
- return this.source;
100
- throw "Node is not incident with this edge";
101
- }, r.prototype.getOtherEndInGraph = function(f, a) {
102
- for (var y = this.getOtherEnd(f), t = a.getGraphManager().getRoot(); ; ) {
103
- if (y.getOwner() == a)
104
- return y;
105
- if (y.getOwner() == t)
106
- break;
107
- y = y.getOwner().getParent();
108
- }
109
- return null;
110
- }, r.prototype.updateLength = function() {
111
- var f = new Array(4);
112
- this.isOverlapingSourceAndTarget = s.getIntersection(this.target.getRect(), this.source.getRect(), f), this.isOverlapingSourceAndTarget || (this.lengthX = f[0] - f[2], this.lengthY = f[1] - f[3], Math.abs(this.lengthX) < 1 && (this.lengthX = i.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = i.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY));
113
- }, r.prototype.updateLengthSimple = function() {
114
- this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = i.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = i.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
115
- }, A.exports = r;
116
- },
117
- /* 2 */
118
- /***/
119
- function(A, G, N) {
120
- function u(s) {
121
- this.vGraphObject = s;
122
- }
123
- A.exports = u;
124
- },
125
- /* 3 */
126
- /***/
127
- function(A, G, N) {
128
- var u = N(2), s = N(10), i = N(13), r = N(0), e = N(16), f = N(5);
129
- function a(t, h, o, c) {
130
- o == null && c == null && (c = h), u.call(this, c), t.graphManager != null && (t = t.graphManager), this.estimatedSize = s.MIN_VALUE, this.inclusionTreeDepth = s.MAX_VALUE, this.vGraphObject = c, this.edges = [], this.graphManager = t, o != null && h != null ? this.rect = new i(h.x, h.y, o.width, o.height) : this.rect = new i();
131
- }
132
- a.prototype = Object.create(u.prototype);
133
- for (var y in u)
134
- a[y] = u[y];
135
- a.prototype.getEdges = function() {
136
- return this.edges;
137
- }, a.prototype.getChild = function() {
138
- return this.child;
139
- }, a.prototype.getOwner = function() {
140
- return this.owner;
141
- }, a.prototype.getWidth = function() {
142
- return this.rect.width;
143
- }, a.prototype.setWidth = function(t) {
144
- this.rect.width = t;
145
- }, a.prototype.getHeight = function() {
146
- return this.rect.height;
147
- }, a.prototype.setHeight = function(t) {
148
- this.rect.height = t;
149
- }, a.prototype.getCenterX = function() {
150
- return this.rect.x + this.rect.width / 2;
151
- }, a.prototype.getCenterY = function() {
152
- return this.rect.y + this.rect.height / 2;
153
- }, a.prototype.getCenter = function() {
154
- return new f(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
155
- }, a.prototype.getLocation = function() {
156
- return new f(this.rect.x, this.rect.y);
157
- }, a.prototype.getRect = function() {
158
- return this.rect;
159
- }, a.prototype.getDiagonal = function() {
160
- return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
161
- }, a.prototype.getHalfTheDiagonal = function() {
162
- return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
163
- }, a.prototype.setRect = function(t, h) {
164
- this.rect.x = t.x, this.rect.y = t.y, this.rect.width = h.width, this.rect.height = h.height;
165
- }, a.prototype.setCenter = function(t, h) {
166
- this.rect.x = t - this.rect.width / 2, this.rect.y = h - this.rect.height / 2;
167
- }, a.prototype.setLocation = function(t, h) {
168
- this.rect.x = t, this.rect.y = h;
169
- }, a.prototype.moveBy = function(t, h) {
170
- this.rect.x += t, this.rect.y += h;
171
- }, a.prototype.getEdgeListToNode = function(t) {
172
- var h = [], o = this;
173
- return o.edges.forEach(function(c) {
174
- if (c.target == t) {
175
- if (c.source != o) throw "Incorrect edge source!";
176
- h.push(c);
177
- }
178
- }), h;
179
- }, a.prototype.getEdgesBetween = function(t) {
180
- var h = [], o = this;
181
- return o.edges.forEach(function(c) {
182
- if (!(c.source == o || c.target == o)) throw "Incorrect edge source and/or target";
183
- (c.target == t || c.source == t) && h.push(c);
184
- }), h;
185
- }, a.prototype.getNeighborsList = function() {
186
- var t = /* @__PURE__ */ new Set(), h = this;
187
- return h.edges.forEach(function(o) {
188
- if (o.source == h)
189
- t.add(o.target);
190
- else {
191
- if (o.target != h)
192
- throw "Incorrect incidency!";
193
- t.add(o.source);
194
- }
195
- }), t;
196
- }, a.prototype.withChildren = function() {
197
- var t = /* @__PURE__ */ new Set(), h, o;
198
- if (t.add(this), this.child != null)
199
- for (var c = this.child.getNodes(), l = 0; l < c.length; l++)
200
- h = c[l], o = h.withChildren(), o.forEach(function(T) {
201
- t.add(T);
202
- });
203
- return t;
204
- }, a.prototype.getNoOfChildren = function() {
205
- var t = 0, h;
206
- if (this.child == null)
207
- t = 1;
208
- else
209
- for (var o = this.child.getNodes(), c = 0; c < o.length; c++)
210
- h = o[c], t += h.getNoOfChildren();
211
- return t == 0 && (t = 1), t;
212
- }, a.prototype.getEstimatedSize = function() {
213
- if (this.estimatedSize == s.MIN_VALUE)
214
- throw "assert failed";
215
- return this.estimatedSize;
216
- }, a.prototype.calcEstimatedSize = function() {
217
- return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize);
218
- }, a.prototype.scatter = function() {
219
- var t, h, o = -r.INITIAL_WORLD_BOUNDARY, c = r.INITIAL_WORLD_BOUNDARY;
220
- t = r.WORLD_CENTER_X + e.nextDouble() * (c - o) + o;
221
- var l = -r.INITIAL_WORLD_BOUNDARY, T = r.INITIAL_WORLD_BOUNDARY;
222
- h = r.WORLD_CENTER_Y + e.nextDouble() * (T - l) + l, this.rect.x = t, this.rect.y = h;
223
- }, a.prototype.updateBounds = function() {
224
- if (this.getChild() == null)
225
- throw "assert failed";
226
- if (this.getChild().getNodes().length != 0) {
227
- var t = this.getChild();
228
- if (t.updateBounds(!0), this.rect.x = t.getLeft(), this.rect.y = t.getTop(), this.setWidth(t.getRight() - t.getLeft()), this.setHeight(t.getBottom() - t.getTop()), r.NODE_DIMENSIONS_INCLUDE_LABELS) {
229
- var h = t.getRight() - t.getLeft(), o = t.getBottom() - t.getTop();
230
- this.labelWidth && (this.labelPosHorizontal == "left" ? (this.rect.x -= this.labelWidth, this.setWidth(h + this.labelWidth)) : this.labelPosHorizontal == "center" && this.labelWidth > h ? (this.rect.x -= (this.labelWidth - h) / 2, this.setWidth(this.labelWidth)) : this.labelPosHorizontal == "right" && this.setWidth(h + this.labelWidth)), this.labelHeight && (this.labelPosVertical == "top" ? (this.rect.y -= this.labelHeight, this.setHeight(o + this.labelHeight)) : this.labelPosVertical == "center" && this.labelHeight > o ? (this.rect.y -= (this.labelHeight - o) / 2, this.setHeight(this.labelHeight)) : this.labelPosVertical == "bottom" && this.setHeight(o + this.labelHeight));
231
- }
232
- }
233
- }, a.prototype.getInclusionTreeDepth = function() {
234
- if (this.inclusionTreeDepth == s.MAX_VALUE)
235
- throw "assert failed";
236
- return this.inclusionTreeDepth;
237
- }, a.prototype.transform = function(t) {
238
- var h = this.rect.x;
239
- h > r.WORLD_BOUNDARY ? h = r.WORLD_BOUNDARY : h < -r.WORLD_BOUNDARY && (h = -r.WORLD_BOUNDARY);
240
- var o = this.rect.y;
241
- o > r.WORLD_BOUNDARY ? o = r.WORLD_BOUNDARY : o < -r.WORLD_BOUNDARY && (o = -r.WORLD_BOUNDARY);
242
- var c = new f(h, o), l = t.inverseTransformPoint(c);
243
- this.setLocation(l.x, l.y);
244
- }, a.prototype.getLeft = function() {
245
- return this.rect.x;
246
- }, a.prototype.getRight = function() {
247
- return this.rect.x + this.rect.width;
248
- }, a.prototype.getTop = function() {
249
- return this.rect.y;
250
- }, a.prototype.getBottom = function() {
251
- return this.rect.y + this.rect.height;
252
- }, a.prototype.getParent = function() {
253
- return this.owner == null ? null : this.owner.getParent();
254
- }, A.exports = a;
255
- },
256
- /* 4 */
257
- /***/
258
- function(A, G, N) {
259
- var u = N(0);
260
- function s() {
261
- }
262
- for (var i in u)
263
- s[i] = u[i];
264
- s.MAX_ITERATIONS = 2500, s.DEFAULT_EDGE_LENGTH = 50, s.DEFAULT_SPRING_STRENGTH = 0.45, s.DEFAULT_REPULSION_STRENGTH = 4500, s.DEFAULT_GRAVITY_STRENGTH = 0.4, s.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, s.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, s.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3, s.COOLING_ADAPTATION_FACTOR = 0.33, s.ADAPTATION_LOWER_NODE_LIMIT = 1e3, s.ADAPTATION_UPPER_NODE_LIMIT = 5e3, s.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, s.MAX_NODE_DISPLACEMENT = s.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, s.MIN_REPULSION_DIST = s.DEFAULT_EDGE_LENGTH / 10, s.CONVERGENCE_CHECK_PERIOD = 100, s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1, s.MIN_EDGE_LENGTH = 1, s.GRID_CALCULATION_CHECK_PERIOD = 10, A.exports = s;
265
- },
266
- /* 5 */
267
- /***/
268
- function(A, G, N) {
269
- function u(s, i) {
270
- s == null && i == null ? (this.x = 0, this.y = 0) : (this.x = s, this.y = i);
271
- }
272
- u.prototype.getX = function() {
273
- return this.x;
274
- }, u.prototype.getY = function() {
275
- return this.y;
276
- }, u.prototype.setX = function(s) {
277
- this.x = s;
278
- }, u.prototype.setY = function(s) {
279
- this.y = s;
280
- }, u.prototype.getDifference = function(s) {
281
- return new DimensionD(this.x - s.x, this.y - s.y);
282
- }, u.prototype.getCopy = function() {
283
- return new u(this.x, this.y);
284
- }, u.prototype.translate = function(s) {
285
- return this.x += s.width, this.y += s.height, this;
286
- }, A.exports = u;
287
- },
288
- /* 6 */
289
- /***/
290
- function(A, G, N) {
291
- var u = N(2), s = N(10), i = N(0), r = N(7), e = N(3), f = N(1), a = N(13), y = N(12), t = N(11);
292
- function h(c, l, T) {
293
- u.call(this, T), this.estimatedSize = s.MIN_VALUE, this.margin = i.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = c, l != null && l instanceof r ? this.graphManager = l : l != null && l instanceof Layout && (this.graphManager = l.graphManager);
294
- }
295
- h.prototype = Object.create(u.prototype);
296
- for (var o in u)
297
- h[o] = u[o];
298
- h.prototype.getNodes = function() {
299
- return this.nodes;
300
- }, h.prototype.getEdges = function() {
301
- return this.edges;
302
- }, h.prototype.getGraphManager = function() {
303
- return this.graphManager;
304
- }, h.prototype.getParent = function() {
305
- return this.parent;
306
- }, h.prototype.getLeft = function() {
307
- return this.left;
308
- }, h.prototype.getRight = function() {
309
- return this.right;
310
- }, h.prototype.getTop = function() {
311
- return this.top;
312
- }, h.prototype.getBottom = function() {
313
- return this.bottom;
314
- }, h.prototype.isConnected = function() {
315
- return this.isConnected;
316
- }, h.prototype.add = function(c, l, T) {
317
- if (l == null && T == null) {
318
- var g = c;
319
- if (this.graphManager == null)
320
- throw "Graph has no graph mgr!";
321
- if (this.getNodes().indexOf(g) > -1)
322
- throw "Node already in graph!";
323
- return g.owner = this, this.getNodes().push(g), g;
324
- } else {
325
- var d = c;
326
- if (!(this.getNodes().indexOf(l) > -1 && this.getNodes().indexOf(T) > -1))
327
- throw "Source or target not in graph!";
328
- if (!(l.owner == T.owner && l.owner == this))
329
- throw "Both owners must be this graph!";
330
- return l.owner != T.owner ? null : (d.source = l, d.target = T, d.isInterGraph = !1, this.getEdges().push(d), l.edges.push(d), T != l && T.edges.push(d), d);
331
- }
332
- }, h.prototype.remove = function(c) {
333
- var l = c;
334
- if (c instanceof e) {
335
- if (l == null)
336
- throw "Node is null!";
337
- if (!(l.owner != null && l.owner == this))
338
- throw "Owner graph is invalid!";
339
- if (this.graphManager == null)
340
- throw "Owner graph manager is invalid!";
341
- for (var T = l.edges.slice(), g, d = T.length, L = 0; L < d; L++)
342
- g = T[L], g.isInterGraph ? this.graphManager.remove(g) : g.source.owner.remove(g);
343
- var F = this.nodes.indexOf(l);
344
- if (F == -1)
345
- throw "Node not in owner node list!";
346
- this.nodes.splice(F, 1);
347
- } else if (c instanceof f) {
348
- var g = c;
349
- if (g == null)
350
- throw "Edge is null!";
351
- if (!(g.source != null && g.target != null))
352
- throw "Source and/or target is null!";
353
- if (!(g.source.owner != null && g.target.owner != null && g.source.owner == this && g.target.owner == this))
354
- throw "Source and/or target owner is invalid!";
355
- var M = g.source.edges.indexOf(g), P = g.target.edges.indexOf(g);
356
- if (!(M > -1 && P > -1))
357
- throw "Source and/or target doesn't know this edge!";
358
- g.source.edges.splice(M, 1), g.target != g.source && g.target.edges.splice(P, 1);
359
- var F = g.source.owner.getEdges().indexOf(g);
360
- if (F == -1)
361
- throw "Not in owner's edge list!";
362
- g.source.owner.getEdges().splice(F, 1);
363
- }
364
- }, h.prototype.updateLeftTop = function() {
365
- for (var c = s.MAX_VALUE, l = s.MAX_VALUE, T, g, d, L = this.getNodes(), F = L.length, M = 0; M < F; M++) {
366
- var P = L[M];
367
- T = P.getTop(), g = P.getLeft(), c > T && (c = T), l > g && (l = g);
368
- }
369
- return c == s.MAX_VALUE ? null : (L[0].getParent().paddingLeft != null ? d = L[0].getParent().paddingLeft : d = this.margin, this.left = l - d, this.top = c - d, new y(this.left, this.top));
370
- }, h.prototype.updateBounds = function(c) {
371
- for (var l = s.MAX_VALUE, T = -s.MAX_VALUE, g = s.MAX_VALUE, d = -s.MAX_VALUE, L, F, M, P, J, V = this.nodes, Q = V.length, D = 0; D < Q; D++) {
372
- var rt = V[D];
373
- c && rt.child != null && rt.updateBounds(), L = rt.getLeft(), F = rt.getRight(), M = rt.getTop(), P = rt.getBottom(), l > L && (l = L), T < F && (T = F), g > M && (g = M), d < P && (d = P);
374
- }
375
- var n = new a(l, g, T - l, d - g);
376
- l == s.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), V[0].getParent().paddingLeft != null ? J = V[0].getParent().paddingLeft : J = this.margin, this.left = n.x - J, this.right = n.x + n.width + J, this.top = n.y - J, this.bottom = n.y + n.height + J;
377
- }, h.calculateBounds = function(c) {
378
- for (var l = s.MAX_VALUE, T = -s.MAX_VALUE, g = s.MAX_VALUE, d = -s.MAX_VALUE, L, F, M, P, J = c.length, V = 0; V < J; V++) {
379
- var Q = c[V];
380
- L = Q.getLeft(), F = Q.getRight(), M = Q.getTop(), P = Q.getBottom(), l > L && (l = L), T < F && (T = F), g > M && (g = M), d < P && (d = P);
381
- }
382
- var D = new a(l, g, T - l, d - g);
383
- return D;
384
- }, h.prototype.getInclusionTreeDepth = function() {
385
- return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
386
- }, h.prototype.getEstimatedSize = function() {
387
- if (this.estimatedSize == s.MIN_VALUE)
388
- throw "assert failed";
389
- return this.estimatedSize;
390
- }, h.prototype.calcEstimatedSize = function() {
391
- for (var c = 0, l = this.nodes, T = l.length, g = 0; g < T; g++) {
392
- var d = l[g];
393
- c += d.calcEstimatedSize();
394
- }
395
- return c == 0 ? this.estimatedSize = i.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = c / Math.sqrt(this.nodes.length), this.estimatedSize;
396
- }, h.prototype.updateConnected = function() {
397
- var c = this;
398
- if (this.nodes.length == 0) {
399
- this.isConnected = !0;
400
- return;
401
- }
402
- var l = new t(), T = /* @__PURE__ */ new Set(), g = this.nodes[0], d, L, F = g.withChildren();
403
- for (F.forEach(function(D) {
404
- l.push(D), T.add(D);
405
- }); l.length !== 0; ) {
406
- g = l.shift(), d = g.getEdges();
407
- for (var M = d.length, P = 0; P < M; P++) {
408
- var J = d[P];
409
- if (L = J.getOtherEndInGraph(g, this), L != null && !T.has(L)) {
410
- var V = L.withChildren();
411
- V.forEach(function(D) {
412
- l.push(D), T.add(D);
413
- });
414
- }
415
- }
416
- }
417
- if (this.isConnected = !1, T.size >= this.nodes.length) {
418
- var Q = 0;
419
- T.forEach(function(D) {
420
- D.owner == c && Q++;
421
- }), Q == this.nodes.length && (this.isConnected = !0);
422
- }
423
- }, A.exports = h;
424
- },
425
- /* 7 */
426
- /***/
427
- function(A, G, N) {
428
- var u, s = N(1);
429
- function i(r) {
430
- u = N(6), this.layout = r, this.graphs = [], this.edges = [];
431
- }
432
- i.prototype.addRoot = function() {
433
- var r = this.layout.newGraph(), e = this.layout.newNode(null), f = this.add(r, e);
434
- return this.setRootGraph(f), this.rootGraph;
435
- }, i.prototype.add = function(r, e, f, a, y) {
436
- if (f == null && a == null && y == null) {
437
- if (r == null)
438
- throw "Graph is null!";
439
- if (e == null)
440
- throw "Parent node is null!";
441
- if (this.graphs.indexOf(r) > -1)
442
- throw "Graph already in this graph mgr!";
443
- if (this.graphs.push(r), r.parent != null)
444
- throw "Already has a parent!";
445
- if (e.child != null)
446
- throw "Already has a child!";
447
- return r.parent = e, e.child = r, r;
448
- } else {
449
- y = f, a = e, f = r;
450
- var t = a.getOwner(), h = y.getOwner();
451
- if (!(t != null && t.getGraphManager() == this))
452
- throw "Source not in this graph mgr!";
453
- if (!(h != null && h.getGraphManager() == this))
454
- throw "Target not in this graph mgr!";
455
- if (t == h)
456
- return f.isInterGraph = !1, t.add(f, a, y);
457
- if (f.isInterGraph = !0, f.source = a, f.target = y, this.edges.indexOf(f) > -1)
458
- throw "Edge already in inter-graph edge list!";
459
- if (this.edges.push(f), !(f.source != null && f.target != null))
460
- throw "Edge source and/or target is null!";
461
- if (!(f.source.edges.indexOf(f) == -1 && f.target.edges.indexOf(f) == -1))
462
- throw "Edge already in source and/or target incidency list!";
463
- return f.source.edges.push(f), f.target.edges.push(f), f;
464
- }
465
- }, i.prototype.remove = function(r) {
466
- if (r instanceof u) {
467
- var e = r;
468
- if (e.getGraphManager() != this)
469
- throw "Graph not in this graph mgr";
470
- if (!(e == this.rootGraph || e.parent != null && e.parent.graphManager == this))
471
- throw "Invalid parent node!";
472
- var f = [];
473
- f = f.concat(e.getEdges());
474
- for (var a, y = f.length, t = 0; t < y; t++)
475
- a = f[t], e.remove(a);
476
- var h = [];
477
- h = h.concat(e.getNodes());
478
- var o;
479
- y = h.length;
480
- for (var t = 0; t < y; t++)
481
- o = h[t], e.remove(o);
482
- e == this.rootGraph && this.setRootGraph(null);
483
- var c = this.graphs.indexOf(e);
484
- this.graphs.splice(c, 1), e.parent = null;
485
- } else if (r instanceof s) {
486
- if (a = r, a == null)
487
- throw "Edge is null!";
488
- if (!a.isInterGraph)
489
- throw "Not an inter-graph edge!";
490
- if (!(a.source != null && a.target != null))
491
- throw "Source and/or target is null!";
492
- if (!(a.source.edges.indexOf(a) != -1 && a.target.edges.indexOf(a) != -1))
493
- throw "Source and/or target doesn't know this edge!";
494
- var c = a.source.edges.indexOf(a);
495
- if (a.source.edges.splice(c, 1), c = a.target.edges.indexOf(a), a.target.edges.splice(c, 1), !(a.source.owner != null && a.source.owner.getGraphManager() != null))
496
- throw "Edge owner graph or owner graph manager is null!";
497
- if (a.source.owner.getGraphManager().edges.indexOf(a) == -1)
498
- throw "Not in owner graph manager's edge list!";
499
- var c = a.source.owner.getGraphManager().edges.indexOf(a);
500
- a.source.owner.getGraphManager().edges.splice(c, 1);
501
- }
502
- }, i.prototype.updateBounds = function() {
503
- this.rootGraph.updateBounds(!0);
504
- }, i.prototype.getGraphs = function() {
505
- return this.graphs;
506
- }, i.prototype.getAllNodes = function() {
507
- if (this.allNodes == null) {
508
- for (var r = [], e = this.getGraphs(), f = e.length, a = 0; a < f; a++)
509
- r = r.concat(e[a].getNodes());
510
- this.allNodes = r;
511
- }
512
- return this.allNodes;
513
- }, i.prototype.resetAllNodes = function() {
514
- this.allNodes = null;
515
- }, i.prototype.resetAllEdges = function() {
516
- this.allEdges = null;
517
- }, i.prototype.resetAllNodesToApplyGravitation = function() {
518
- this.allNodesToApplyGravitation = null;
519
- }, i.prototype.getAllEdges = function() {
520
- if (this.allEdges == null) {
521
- var r = [], e = this.getGraphs();
522
- e.length;
523
- for (var f = 0; f < e.length; f++)
524
- r = r.concat(e[f].getEdges());
525
- r = r.concat(this.edges), this.allEdges = r;
526
- }
527
- return this.allEdges;
528
- }, i.prototype.getAllNodesToApplyGravitation = function() {
529
- return this.allNodesToApplyGravitation;
530
- }, i.prototype.setAllNodesToApplyGravitation = function(r) {
531
- if (this.allNodesToApplyGravitation != null)
532
- throw "assert failed";
533
- this.allNodesToApplyGravitation = r;
534
- }, i.prototype.getRoot = function() {
535
- return this.rootGraph;
536
- }, i.prototype.setRootGraph = function(r) {
537
- if (r.getGraphManager() != this)
538
- throw "Root not in this graph mgr!";
539
- this.rootGraph = r, r.parent == null && (r.parent = this.layout.newNode("Root node"));
540
- }, i.prototype.getLayout = function() {
541
- return this.layout;
542
- }, i.prototype.isOneAncestorOfOther = function(r, e) {
543
- if (!(r != null && e != null))
544
- throw "assert failed";
545
- if (r == e)
546
- return !0;
547
- var f = r.getOwner(), a;
548
- do {
549
- if (a = f.getParent(), a == null)
550
- break;
551
- if (a == e)
552
- return !0;
553
- if (f = a.getOwner(), f == null)
554
- break;
555
- } while (!0);
556
- f = e.getOwner();
557
- do {
558
- if (a = f.getParent(), a == null)
559
- break;
560
- if (a == r)
561
- return !0;
562
- if (f = a.getOwner(), f == null)
563
- break;
564
- } while (!0);
565
- return !1;
566
- }, i.prototype.calcLowestCommonAncestors = function() {
567
- for (var r, e, f, a, y, t = this.getAllEdges(), h = t.length, o = 0; o < h; o++) {
568
- if (r = t[o], e = r.source, f = r.target, r.lca = null, r.sourceInLca = e, r.targetInLca = f, e == f) {
569
- r.lca = e.getOwner();
570
- continue;
571
- }
572
- for (a = e.getOwner(); r.lca == null; ) {
573
- for (r.targetInLca = f, y = f.getOwner(); r.lca == null; ) {
574
- if (y == a) {
575
- r.lca = y;
576
- break;
577
- }
578
- if (y == this.rootGraph)
579
- break;
580
- if (r.lca != null)
581
- throw "assert failed";
582
- r.targetInLca = y.getParent(), y = r.targetInLca.getOwner();
583
- }
584
- if (a == this.rootGraph)
585
- break;
586
- r.lca == null && (r.sourceInLca = a.getParent(), a = r.sourceInLca.getOwner());
587
- }
588
- if (r.lca == null)
589
- throw "assert failed";
590
- }
591
- }, i.prototype.calcLowestCommonAncestor = function(r, e) {
592
- if (r == e)
593
- return r.getOwner();
594
- var f = r.getOwner();
595
- do {
596
- if (f == null)
597
- break;
598
- var a = e.getOwner();
599
- do {
600
- if (a == null)
601
- break;
602
- if (a == f)
603
- return a;
604
- a = a.getParent().getOwner();
605
- } while (!0);
606
- f = f.getParent().getOwner();
607
- } while (!0);
608
- return f;
609
- }, i.prototype.calcInclusionTreeDepths = function(r, e) {
610
- r == null && e == null && (r = this.rootGraph, e = 1);
611
- for (var f, a = r.getNodes(), y = a.length, t = 0; t < y; t++)
612
- f = a[t], f.inclusionTreeDepth = e, f.child != null && this.calcInclusionTreeDepths(f.child, e + 1);
613
- }, i.prototype.includesInvalidEdge = function() {
614
- for (var r, e = [], f = this.edges.length, a = 0; a < f; a++)
615
- r = this.edges[a], this.isOneAncestorOfOther(r.source, r.target) && e.push(r);
616
- for (var a = 0; a < e.length; a++)
617
- this.remove(e[a]);
618
- return !1;
619
- }, A.exports = i;
620
- },
621
- /* 8 */
622
- /***/
623
- function(A, G, N) {
624
- var u = N(12);
625
- function s() {
626
- }
627
- s.calcSeparationAmount = function(i, r, e, f) {
628
- if (!i.intersects(r))
629
- throw "assert failed";
630
- var a = new Array(2);
631
- this.decideDirectionsForOverlappingNodes(i, r, a), e[0] = Math.min(i.getRight(), r.getRight()) - Math.max(i.x, r.x), e[1] = Math.min(i.getBottom(), r.getBottom()) - Math.max(i.y, r.y), i.getX() <= r.getX() && i.getRight() >= r.getRight() ? e[0] += Math.min(r.getX() - i.getX(), i.getRight() - r.getRight()) : r.getX() <= i.getX() && r.getRight() >= i.getRight() && (e[0] += Math.min(i.getX() - r.getX(), r.getRight() - i.getRight())), i.getY() <= r.getY() && i.getBottom() >= r.getBottom() ? e[1] += Math.min(r.getY() - i.getY(), i.getBottom() - r.getBottom()) : r.getY() <= i.getY() && r.getBottom() >= i.getBottom() && (e[1] += Math.min(i.getY() - r.getY(), r.getBottom() - i.getBottom()));
632
- var y = Math.abs((r.getCenterY() - i.getCenterY()) / (r.getCenterX() - i.getCenterX()));
633
- r.getCenterY() === i.getCenterY() && r.getCenterX() === i.getCenterX() && (y = 1);
634
- var t = y * e[0], h = e[1] / y;
635
- e[0] < h ? h = e[0] : t = e[1], e[0] = -1 * a[0] * (h / 2 + f), e[1] = -1 * a[1] * (t / 2 + f);
636
- }, s.decideDirectionsForOverlappingNodes = function(i, r, e) {
637
- i.getCenterX() < r.getCenterX() ? e[0] = -1 : e[0] = 1, i.getCenterY() < r.getCenterY() ? e[1] = -1 : e[1] = 1;
638
- }, s.getIntersection2 = function(i, r, e) {
639
- var f = i.getCenterX(), a = i.getCenterY(), y = r.getCenterX(), t = r.getCenterY();
640
- if (i.intersects(r))
641
- return e[0] = f, e[1] = a, e[2] = y, e[3] = t, !0;
642
- var h = i.getX(), o = i.getY(), c = i.getRight(), l = i.getX(), T = i.getBottom(), g = i.getRight(), d = i.getWidthHalf(), L = i.getHeightHalf(), F = r.getX(), M = r.getY(), P = r.getRight(), J = r.getX(), V = r.getBottom(), Q = r.getRight(), D = r.getWidthHalf(), rt = r.getHeightHalf(), n = !1, m = !1;
643
- if (f === y) {
644
- if (a > t)
645
- return e[0] = f, e[1] = o, e[2] = y, e[3] = V, !1;
646
- if (a < t)
647
- return e[0] = f, e[1] = T, e[2] = y, e[3] = M, !1;
648
- } else if (a === t) {
649
- if (f > y)
650
- return e[0] = h, e[1] = a, e[2] = P, e[3] = t, !1;
651
- if (f < y)
652
- return e[0] = c, e[1] = a, e[2] = F, e[3] = t, !1;
653
- } else {
654
- var v = i.height / i.width, E = r.height / r.width, p = (t - a) / (y - f), I = void 0, w = void 0, R = void 0, H = void 0, x = void 0, k = void 0;
655
- if (-v === p ? f > y ? (e[0] = l, e[1] = T, n = !0) : (e[0] = c, e[1] = o, n = !0) : v === p && (f > y ? (e[0] = h, e[1] = o, n = !0) : (e[0] = g, e[1] = T, n = !0)), -E === p ? y > f ? (e[2] = J, e[3] = V, m = !0) : (e[2] = P, e[3] = M, m = !0) : E === p && (y > f ? (e[2] = F, e[3] = M, m = !0) : (e[2] = Q, e[3] = V, m = !0)), n && m)
656
- return !1;
657
- if (f > y ? a > t ? (I = this.getCardinalDirection(v, p, 4), w = this.getCardinalDirection(E, p, 2)) : (I = this.getCardinalDirection(-v, p, 3), w = this.getCardinalDirection(-E, p, 1)) : a > t ? (I = this.getCardinalDirection(-v, p, 1), w = this.getCardinalDirection(-E, p, 3)) : (I = this.getCardinalDirection(v, p, 2), w = this.getCardinalDirection(E, p, 4)), !n)
658
- switch (I) {
659
- case 1:
660
- H = o, R = f + -L / p, e[0] = R, e[1] = H;
661
- break;
662
- case 2:
663
- R = g, H = a + d * p, e[0] = R, e[1] = H;
664
- break;
665
- case 3:
666
- H = T, R = f + L / p, e[0] = R, e[1] = H;
667
- break;
668
- case 4:
669
- R = l, H = a + -d * p, e[0] = R, e[1] = H;
670
- break;
671
- }
672
- if (!m)
673
- switch (w) {
674
- case 1:
675
- k = M, x = y + -rt / p, e[2] = x, e[3] = k;
676
- break;
677
- case 2:
678
- x = Q, k = t + D * p, e[2] = x, e[3] = k;
679
- break;
680
- case 3:
681
- k = V, x = y + rt / p, e[2] = x, e[3] = k;
682
- break;
683
- case 4:
684
- x = J, k = t + -D * p, e[2] = x, e[3] = k;
685
- break;
686
- }
687
- }
688
- return !1;
689
- }, s.getCardinalDirection = function(i, r, e) {
690
- return i > r ? e : 1 + e % 4;
691
- }, s.getIntersection = function(i, r, e, f) {
692
- if (f == null)
693
- return this.getIntersection2(i, r, e);
694
- var a = i.x, y = i.y, t = r.x, h = r.y, o = e.x, c = e.y, l = f.x, T = f.y, g = void 0, d = void 0, L = void 0, F = void 0, M = void 0, P = void 0, J = void 0, V = void 0, Q = void 0;
695
- return L = h - y, M = a - t, J = t * y - a * h, F = T - c, P = o - l, V = l * c - o * T, Q = L * P - F * M, Q === 0 ? null : (g = (M * V - P * J) / Q, d = (F * J - L * V) / Q, new u(g, d));
696
- }, s.angleOfVector = function(i, r, e, f) {
697
- var a = void 0;
698
- return i !== e ? (a = Math.atan((f - r) / (e - i)), e < i ? a += Math.PI : f < r && (a += this.TWO_PI)) : f < r ? a = this.ONE_AND_HALF_PI : a = this.HALF_PI, a;
699
- }, s.doIntersect = function(i, r, e, f) {
700
- var a = i.x, y = i.y, t = r.x, h = r.y, o = e.x, c = e.y, l = f.x, T = f.y, g = (t - a) * (T - c) - (l - o) * (h - y);
701
- if (g === 0)
702
- return !1;
703
- var d = ((T - c) * (l - a) + (o - l) * (T - y)) / g, L = ((y - h) * (l - a) + (t - a) * (T - y)) / g;
704
- return 0 < d && d < 1 && 0 < L && L < 1;
705
- }, s.findCircleLineIntersections = function(i, r, e, f, a, y, t) {
706
- var h = (e - i) * (e - i) + (f - r) * (f - r), o = 2 * ((i - a) * (e - i) + (r - y) * (f - r)), c = (i - a) * (i - a) + (r - y) * (r - y) - t * t, l = o * o - 4 * h * c;
707
- if (l >= 0) {
708
- var T = (-o + Math.sqrt(o * o - 4 * h * c)) / (2 * h), g = (-o - Math.sqrt(o * o - 4 * h * c)) / (2 * h), d = null;
709
- return T >= 0 && T <= 1 ? [T] : g >= 0 && g <= 1 ? [g] : d;
710
- } else return null;
711
- }, s.HALF_PI = 0.5 * Math.PI, s.ONE_AND_HALF_PI = 1.5 * Math.PI, s.TWO_PI = 2 * Math.PI, s.THREE_PI = 3 * Math.PI, A.exports = s;
712
- },
713
- /* 9 */
714
- /***/
715
- function(A, G, N) {
716
- function u() {
717
- }
718
- u.sign = function(s) {
719
- return s > 0 ? 1 : s < 0 ? -1 : 0;
720
- }, u.floor = function(s) {
721
- return s < 0 ? Math.ceil(s) : Math.floor(s);
722
- }, u.ceil = function(s) {
723
- return s < 0 ? Math.floor(s) : Math.ceil(s);
724
- }, A.exports = u;
725
- },
726
- /* 10 */
727
- /***/
728
- function(A, G, N) {
729
- function u() {
730
- }
731
- u.MAX_VALUE = 2147483647, u.MIN_VALUE = -2147483648, A.exports = u;
732
- },
733
- /* 11 */
734
- /***/
735
- function(A, G, N) {
736
- var u = /* @__PURE__ */ function() {
737
- function a(y, t) {
738
- for (var h = 0; h < t.length; h++) {
739
- var o = t[h];
740
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(y, o.key, o);
741
- }
742
- }
743
- return function(y, t, h) {
744
- return t && a(y.prototype, t), h && a(y, h), y;
745
- };
746
- }();
747
- function s(a, y) {
748
- if (!(a instanceof y))
749
- throw new TypeError("Cannot call a class as a function");
750
- }
751
- var i = function(y) {
752
- return { value: y, next: null, prev: null };
753
- }, r = function(y, t, h, o) {
754
- return y !== null ? y.next = t : o.head = t, h !== null ? h.prev = t : o.tail = t, t.prev = y, t.next = h, o.length++, t;
755
- }, e = function(y, t) {
756
- var h = y.prev, o = y.next;
757
- return h !== null ? h.next = o : t.head = o, o !== null ? o.prev = h : t.tail = h, y.prev = y.next = null, t.length--, y;
758
- }, f = function() {
759
- function a(y) {
760
- var t = this;
761
- s(this, a), this.length = 0, this.head = null, this.tail = null, y != null && y.forEach(function(h) {
762
- return t.push(h);
763
- });
764
- }
765
- return u(a, [{
766
- key: "size",
767
- value: function() {
768
- return this.length;
769
- }
770
- }, {
771
- key: "insertBefore",
772
- value: function(t, h) {
773
- return r(h.prev, i(t), h, this);
774
- }
775
- }, {
776
- key: "insertAfter",
777
- value: function(t, h) {
778
- return r(h, i(t), h.next, this);
779
- }
780
- }, {
781
- key: "insertNodeBefore",
782
- value: function(t, h) {
783
- return r(h.prev, t, h, this);
784
- }
785
- }, {
786
- key: "insertNodeAfter",
787
- value: function(t, h) {
788
- return r(h, t, h.next, this);
789
- }
790
- }, {
791
- key: "push",
792
- value: function(t) {
793
- return r(this.tail, i(t), null, this);
794
- }
795
- }, {
796
- key: "unshift",
797
- value: function(t) {
798
- return r(null, i(t), this.head, this);
799
- }
800
- }, {
801
- key: "remove",
802
- value: function(t) {
803
- return e(t, this);
804
- }
805
- }, {
806
- key: "pop",
807
- value: function() {
808
- return e(this.tail, this).value;
809
- }
810
- }, {
811
- key: "popNode",
812
- value: function() {
813
- return e(this.tail, this);
814
- }
815
- }, {
816
- key: "shift",
817
- value: function() {
818
- return e(this.head, this).value;
819
- }
820
- }, {
821
- key: "shiftNode",
822
- value: function() {
823
- return e(this.head, this);
824
- }
825
- }, {
826
- key: "get_object_at",
827
- value: function(t) {
828
- if (t <= this.length()) {
829
- for (var h = 1, o = this.head; h < t; )
830
- o = o.next, h++;
831
- return o.value;
832
- }
833
- }
834
- }, {
835
- key: "set_object_at",
836
- value: function(t, h) {
837
- if (t <= this.length()) {
838
- for (var o = 1, c = this.head; o < t; )
839
- c = c.next, o++;
840
- c.value = h;
841
- }
842
- }
843
- }]), a;
844
- }();
845
- A.exports = f;
846
- },
847
- /* 12 */
848
- /***/
849
- function(A, G, N) {
850
- function u(s, i, r) {
851
- this.x = null, this.y = null, s == null && i == null && r == null ? (this.x = 0, this.y = 0) : typeof s == "number" && typeof i == "number" && r == null ? (this.x = s, this.y = i) : s.constructor.name == "Point" && i == null && r == null && (r = s, this.x = r.x, this.y = r.y);
852
- }
853
- u.prototype.getX = function() {
854
- return this.x;
855
- }, u.prototype.getY = function() {
856
- return this.y;
857
- }, u.prototype.getLocation = function() {
858
- return new u(this.x, this.y);
859
- }, u.prototype.setLocation = function(s, i, r) {
860
- s.constructor.name == "Point" && i == null && r == null ? (r = s, this.setLocation(r.x, r.y)) : typeof s == "number" && typeof i == "number" && r == null && (parseInt(s) == s && parseInt(i) == i ? this.move(s, i) : (this.x = Math.floor(s + 0.5), this.y = Math.floor(i + 0.5)));
861
- }, u.prototype.move = function(s, i) {
862
- this.x = s, this.y = i;
863
- }, u.prototype.translate = function(s, i) {
864
- this.x += s, this.y += i;
865
- }, u.prototype.equals = function(s) {
866
- if (s.constructor.name == "Point") {
867
- var i = s;
868
- return this.x == i.x && this.y == i.y;
869
- }
870
- return this == s;
871
- }, u.prototype.toString = function() {
872
- return new u().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
873
- }, A.exports = u;
874
- },
875
- /* 13 */
876
- /***/
877
- function(A, G, N) {
878
- function u(s, i, r, e) {
879
- this.x = 0, this.y = 0, this.width = 0, this.height = 0, s != null && i != null && r != null && e != null && (this.x = s, this.y = i, this.width = r, this.height = e);
880
- }
881
- u.prototype.getX = function() {
882
- return this.x;
883
- }, u.prototype.setX = function(s) {
884
- this.x = s;
885
- }, u.prototype.getY = function() {
886
- return this.y;
887
- }, u.prototype.setY = function(s) {
888
- this.y = s;
889
- }, u.prototype.getWidth = function() {
890
- return this.width;
891
- }, u.prototype.setWidth = function(s) {
892
- this.width = s;
893
- }, u.prototype.getHeight = function() {
894
- return this.height;
895
- }, u.prototype.setHeight = function(s) {
896
- this.height = s;
897
- }, u.prototype.getRight = function() {
898
- return this.x + this.width;
899
- }, u.prototype.getBottom = function() {
900
- return this.y + this.height;
901
- }, u.prototype.intersects = function(s) {
902
- return !(this.getRight() < s.x || this.getBottom() < s.y || s.getRight() < this.x || s.getBottom() < this.y);
903
- }, u.prototype.getCenterX = function() {
904
- return this.x + this.width / 2;
905
- }, u.prototype.getMinX = function() {
906
- return this.getX();
907
- }, u.prototype.getMaxX = function() {
908
- return this.getX() + this.width;
909
- }, u.prototype.getCenterY = function() {
910
- return this.y + this.height / 2;
911
- }, u.prototype.getMinY = function() {
912
- return this.getY();
913
- }, u.prototype.getMaxY = function() {
914
- return this.getY() + this.height;
915
- }, u.prototype.getWidthHalf = function() {
916
- return this.width / 2;
917
- }, u.prototype.getHeightHalf = function() {
918
- return this.height / 2;
919
- }, A.exports = u;
920
- },
921
- /* 14 */
922
- /***/
923
- function(A, G, N) {
924
- var u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
925
- return typeof i;
926
- } : function(i) {
927
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
928
- };
929
- function s() {
930
- }
931
- s.lastID = 0, s.createID = function(i) {
932
- return s.isPrimitive(i) ? i : (i.uniqueID != null || (i.uniqueID = s.getString(), s.lastID++), i.uniqueID);
933
- }, s.getString = function(i) {
934
- return i == null && (i = s.lastID), "Object#" + i;
935
- }, s.isPrimitive = function(i) {
936
- var r = typeof i > "u" ? "undefined" : u(i);
937
- return i == null || r != "object" && r != "function";
938
- }, A.exports = s;
939
- },
940
- /* 15 */
941
- /***/
942
- function(A, G, N) {
943
- function u(o) {
944
- if (Array.isArray(o)) {
945
- for (var c = 0, l = Array(o.length); c < o.length; c++)
946
- l[c] = o[c];
947
- return l;
948
- } else
949
- return Array.from(o);
950
- }
951
- var s = N(0), i = N(7), r = N(3), e = N(1), f = N(6), a = N(5), y = N(17), t = N(29);
952
- function h(o) {
953
- t.call(this), this.layoutQuality = s.QUALITY, this.createBendsAsNeeded = s.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = s.DEFAULT_INCREMENTAL, this.animationOnLayout = s.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = s.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = s.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = s.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new i(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, o != null && (this.isRemoteUse = o);
954
- }
955
- h.RANDOM_SEED = 1, h.prototype = Object.create(t.prototype), h.prototype.getGraphManager = function() {
956
- return this.graphManager;
957
- }, h.prototype.getAllNodes = function() {
958
- return this.graphManager.getAllNodes();
959
- }, h.prototype.getAllEdges = function() {
960
- return this.graphManager.getAllEdges();
961
- }, h.prototype.getAllNodesToApplyGravitation = function() {
962
- return this.graphManager.getAllNodesToApplyGravitation();
963
- }, h.prototype.newGraphManager = function() {
964
- var o = new i(this);
965
- return this.graphManager = o, o;
966
- }, h.prototype.newGraph = function(o) {
967
- return new f(null, this.graphManager, o);
968
- }, h.prototype.newNode = function(o) {
969
- return new r(this.graphManager, o);
970
- }, h.prototype.newEdge = function(o) {
971
- return new e(null, null, o);
972
- }, h.prototype.checkLayoutSuccess = function() {
973
- return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
974
- }, h.prototype.runLayout = function() {
975
- this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters();
976
- var o;
977
- return this.checkLayoutSuccess() ? o = !1 : o = this.layout(), s.ANIMATE === "during" ? !1 : (o && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, o);
978
- }, h.prototype.doPostLayout = function() {
979
- this.incremental || this.transform(), this.update();
980
- }, h.prototype.update2 = function() {
981
- if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) {
982
- for (var o = this.graphManager.getAllEdges(), c = 0; c < o.length; c++)
983
- o[c];
984
- for (var l = this.graphManager.getRoot().getNodes(), c = 0; c < l.length; c++)
985
- l[c];
986
- this.update(this.graphManager.getRoot());
987
- }
988
- }, h.prototype.update = function(o) {
989
- if (o == null)
990
- this.update2();
991
- else if (o instanceof r) {
992
- var c = o;
993
- if (c.getChild() != null)
994
- for (var l = c.getChild().getNodes(), T = 0; T < l.length; T++)
995
- update(l[T]);
996
- if (c.vGraphObject != null) {
997
- var g = c.vGraphObject;
998
- g.update(c);
999
- }
1000
- } else if (o instanceof e) {
1001
- var d = o;
1002
- if (d.vGraphObject != null) {
1003
- var L = d.vGraphObject;
1004
- L.update(d);
1005
- }
1006
- } else if (o instanceof f) {
1007
- var F = o;
1008
- if (F.vGraphObject != null) {
1009
- var M = F.vGraphObject;
1010
- M.update(F);
1011
- }
1012
- }
1013
- }, h.prototype.initParameters = function() {
1014
- this.isSubLayout || (this.layoutQuality = s.QUALITY, this.animationDuringLayout = s.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = s.DEFAULT_ANIMATION_PERIOD, this.animationOnLayout = s.DEFAULT_ANIMATION_ON_LAYOUT, this.incremental = s.DEFAULT_INCREMENTAL, this.createBendsAsNeeded = s.DEFAULT_CREATE_BENDS_AS_NEEDED, this.uniformLeafNodeSizes = s.DEFAULT_UNIFORM_LEAF_NODE_SIZES), this.animationDuringLayout && (this.animationOnLayout = !1);
1015
- }, h.prototype.transform = function(o) {
1016
- if (o == null)
1017
- this.transform(new a(0, 0));
1018
- else {
1019
- var c = new y(), l = this.graphManager.getRoot().updateLeftTop();
1020
- if (l != null) {
1021
- c.setWorldOrgX(o.x), c.setWorldOrgY(o.y), c.setDeviceOrgX(l.x), c.setDeviceOrgY(l.y);
1022
- for (var T = this.getAllNodes(), g, d = 0; d < T.length; d++)
1023
- g = T[d], g.transform(c);
1024
- }
1025
- }
1026
- }, h.prototype.positionNodesRandomly = function(o) {
1027
- if (o == null)
1028
- this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0);
1029
- else
1030
- for (var c, l, T = o.getNodes(), g = 0; g < T.length; g++)
1031
- c = T[g], l = c.getChild(), l == null || l.getNodes().length == 0 ? c.scatter() : (this.positionNodesRandomly(l), c.updateBounds());
1032
- }, h.prototype.getFlatForest = function() {
1033
- for (var o = [], c = !0, l = this.graphManager.getRoot().getNodes(), T = !0, g = 0; g < l.length; g++)
1034
- l[g].getChild() != null && (T = !1);
1035
- if (!T)
1036
- return o;
1037
- var d = /* @__PURE__ */ new Set(), L = [], F = /* @__PURE__ */ new Map(), M = [];
1038
- for (M = M.concat(l); M.length > 0 && c; ) {
1039
- for (L.push(M[0]); L.length > 0 && c; ) {
1040
- var P = L[0];
1041
- L.splice(0, 1), d.add(P);
1042
- for (var J = P.getEdges(), g = 0; g < J.length; g++) {
1043
- var V = J[g].getOtherEnd(P);
1044
- if (F.get(P) != V)
1045
- if (!d.has(V))
1046
- L.push(V), F.set(V, P);
1047
- else {
1048
- c = !1;
1049
- break;
1050
- }
1051
- }
1052
- }
1053
- if (!c)
1054
- o = [];
1055
- else {
1056
- var Q = [].concat(u(d));
1057
- o.push(Q);
1058
- for (var g = 0; g < Q.length; g++) {
1059
- var D = Q[g], rt = M.indexOf(D);
1060
- rt > -1 && M.splice(rt, 1);
1061
- }
1062
- d = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Map();
1063
- }
1064
- }
1065
- return o;
1066
- }, h.prototype.createDummyNodesForBendpoints = function(o) {
1067
- for (var c = [], l = o.source, T = this.graphManager.calcLowestCommonAncestor(o.source, o.target), g = 0; g < o.bendpoints.length; g++) {
1068
- var d = this.newNode(null);
1069
- d.setRect(new Point(0, 0), new Dimension(1, 1)), T.add(d);
1070
- var L = this.newEdge(null);
1071
- this.graphManager.add(L, l, d), c.add(d), l = d;
1072
- }
1073
- var L = this.newEdge(null);
1074
- return this.graphManager.add(L, l, o.target), this.edgeToDummyNodes.set(o, c), o.isInterGraph() ? this.graphManager.remove(o) : T.remove(o), c;
1075
- }, h.prototype.createBendpointsFromDummyNodes = function() {
1076
- var o = [];
1077
- o = o.concat(this.graphManager.getAllEdges()), o = [].concat(u(this.edgeToDummyNodes.keys())).concat(o);
1078
- for (var c = 0; c < o.length; c++) {
1079
- var l = o[c];
1080
- if (l.bendpoints.length > 0) {
1081
- for (var T = this.edgeToDummyNodes.get(l), g = 0; g < T.length; g++) {
1082
- var d = T[g], L = new a(d.getCenterX(), d.getCenterY()), F = l.bendpoints.get(g);
1083
- F.x = L.x, F.y = L.y, d.getOwner().remove(d);
1084
- }
1085
- this.graphManager.add(l, l.source, l.target);
1086
- }
1087
- }
1088
- }, h.transform = function(o, c, l, T) {
1089
- if (l != null && T != null) {
1090
- var g = c;
1091
- if (o <= 50) {
1092
- var d = c / l;
1093
- g -= (c - d) / 50 * (50 - o);
1094
- } else {
1095
- var L = c * T;
1096
- g += (L - c) / 50 * (o - 50);
1097
- }
1098
- return g;
1099
- } else {
1100
- var F, M;
1101
- return o <= 50 ? (F = 9 * c / 500, M = c / 10) : (F = 9 * c / 50, M = -8 * c), F * o + M;
1102
- }
1103
- }, h.findCenterOfTree = function(o) {
1104
- var c = [];
1105
- c = c.concat(o);
1106
- var l = [], T = /* @__PURE__ */ new Map(), g = !1, d = null;
1107
- (c.length == 1 || c.length == 2) && (g = !0, d = c[0]);
1108
- for (var L = 0; L < c.length; L++) {
1109
- var F = c[L], M = F.getNeighborsList().size;
1110
- T.set(F, F.getNeighborsList().size), M == 1 && l.push(F);
1111
- }
1112
- var P = [];
1113
- for (P = P.concat(l); !g; ) {
1114
- var J = [];
1115
- J = J.concat(P), P = [];
1116
- for (var L = 0; L < c.length; L++) {
1117
- var F = c[L], V = c.indexOf(F);
1118
- V >= 0 && c.splice(V, 1);
1119
- var Q = F.getNeighborsList();
1120
- Q.forEach(function(n) {
1121
- if (l.indexOf(n) < 0) {
1122
- var m = T.get(n), v = m - 1;
1123
- v == 1 && P.push(n), T.set(n, v);
1124
- }
1125
- });
1126
- }
1127
- l = l.concat(P), (c.length == 1 || c.length == 2) && (g = !0, d = c[0]);
1128
- }
1129
- return d;
1130
- }, h.prototype.setGraphManager = function(o) {
1131
- this.graphManager = o;
1132
- }, A.exports = h;
1133
- },
1134
- /* 16 */
1135
- /***/
1136
- function(A, G, N) {
1137
- function u() {
1138
- }
1139
- u.seed = 1, u.x = 0, u.nextDouble = function() {
1140
- return u.x = Math.sin(u.seed++) * 1e4, u.x - Math.floor(u.x);
1141
- }, A.exports = u;
1142
- },
1143
- /* 17 */
1144
- /***/
1145
- function(A, G, N) {
1146
- var u = N(5);
1147
- function s(i, r) {
1148
- this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1;
1149
- }
1150
- s.prototype.getWorldOrgX = function() {
1151
- return this.lworldOrgX;
1152
- }, s.prototype.setWorldOrgX = function(i) {
1153
- this.lworldOrgX = i;
1154
- }, s.prototype.getWorldOrgY = function() {
1155
- return this.lworldOrgY;
1156
- }, s.prototype.setWorldOrgY = function(i) {
1157
- this.lworldOrgY = i;
1158
- }, s.prototype.getWorldExtX = function() {
1159
- return this.lworldExtX;
1160
- }, s.prototype.setWorldExtX = function(i) {
1161
- this.lworldExtX = i;
1162
- }, s.prototype.getWorldExtY = function() {
1163
- return this.lworldExtY;
1164
- }, s.prototype.setWorldExtY = function(i) {
1165
- this.lworldExtY = i;
1166
- }, s.prototype.getDeviceOrgX = function() {
1167
- return this.ldeviceOrgX;
1168
- }, s.prototype.setDeviceOrgX = function(i) {
1169
- this.ldeviceOrgX = i;
1170
- }, s.prototype.getDeviceOrgY = function() {
1171
- return this.ldeviceOrgY;
1172
- }, s.prototype.setDeviceOrgY = function(i) {
1173
- this.ldeviceOrgY = i;
1174
- }, s.prototype.getDeviceExtX = function() {
1175
- return this.ldeviceExtX;
1176
- }, s.prototype.setDeviceExtX = function(i) {
1177
- this.ldeviceExtX = i;
1178
- }, s.prototype.getDeviceExtY = function() {
1179
- return this.ldeviceExtY;
1180
- }, s.prototype.setDeviceExtY = function(i) {
1181
- this.ldeviceExtY = i;
1182
- }, s.prototype.transformX = function(i) {
1183
- var r = 0, e = this.lworldExtX;
1184
- return e != 0 && (r = this.ldeviceOrgX + (i - this.lworldOrgX) * this.ldeviceExtX / e), r;
1185
- }, s.prototype.transformY = function(i) {
1186
- var r = 0, e = this.lworldExtY;
1187
- return e != 0 && (r = this.ldeviceOrgY + (i - this.lworldOrgY) * this.ldeviceExtY / e), r;
1188
- }, s.prototype.inverseTransformX = function(i) {
1189
- var r = 0, e = this.ldeviceExtX;
1190
- return e != 0 && (r = this.lworldOrgX + (i - this.ldeviceOrgX) * this.lworldExtX / e), r;
1191
- }, s.prototype.inverseTransformY = function(i) {
1192
- var r = 0, e = this.ldeviceExtY;
1193
- return e != 0 && (r = this.lworldOrgY + (i - this.ldeviceOrgY) * this.lworldExtY / e), r;
1194
- }, s.prototype.inverseTransformPoint = function(i) {
1195
- var r = new u(this.inverseTransformX(i.x), this.inverseTransformY(i.y));
1196
- return r;
1197
- }, A.exports = s;
1198
- },
1199
- /* 18 */
1200
- /***/
1201
- function(A, G, N) {
1202
- function u(t) {
1203
- if (Array.isArray(t)) {
1204
- for (var h = 0, o = Array(t.length); h < t.length; h++)
1205
- o[h] = t[h];
1206
- return o;
1207
- } else
1208
- return Array.from(t);
1209
- }
1210
- var s = N(15), i = N(4), r = N(0), e = N(8), f = N(9);
1211
- function a() {
1212
- s.call(this), this.useSmartIdealEdgeLengthCalculation = i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = i.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = i.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = i.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.displacementThresholdPerNode = 3 * i.DEFAULT_EDGE_LENGTH / 100, this.coolingFactor = i.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.initialCoolingFactor = i.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.totalDisplacement = 0, this.oldTotalDisplacement = 0, this.maxIterations = i.MAX_ITERATIONS;
1213
- }
1214
- a.prototype = Object.create(s.prototype);
1215
- for (var y in s)
1216
- a[y] = s[y];
1217
- a.prototype.initParameters = function() {
1218
- s.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = [];
1219
- }, a.prototype.calcIdealEdgeLengths = function() {
1220
- for (var t, h, o, c, l, T, g, d = this.getGraphManager().getAllEdges(), L = 0; L < d.length; L++)
1221
- t = d[L], h = t.idealLength, t.isInterGraph && (c = t.getSource(), l = t.getTarget(), T = t.getSourceInLca().getEstimatedSize(), g = t.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (t.idealLength += T + g - 2 * r.SIMPLE_NODE_SIZE), o = t.getLca().getInclusionTreeDepth(), t.idealLength += h * i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (c.getInclusionTreeDepth() + l.getInclusionTreeDepth() - 2 * o));
1222
- }, a.prototype.initSpringEmbedder = function() {
1223
- var t = this.getAllNodes().length;
1224
- this.incremental ? (t > i.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * i.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (t - i.ADAPTATION_LOWER_NODE_LIMIT) / (i.ADAPTATION_UPPER_NODE_LIMIT - i.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - i.COOLING_ADAPTATION_FACTOR))), this.maxNodeDisplacement = i.MAX_NODE_DISPLACEMENT_INCREMENTAL) : (t > i.ADAPTATION_LOWER_NODE_LIMIT ? this.coolingFactor = Math.max(i.COOLING_ADAPTATION_FACTOR, 1 - (t - i.ADAPTATION_LOWER_NODE_LIMIT) / (i.ADAPTATION_UPPER_NODE_LIMIT - i.ADAPTATION_LOWER_NODE_LIMIT) * (1 - i.COOLING_ADAPTATION_FACTOR)) : this.coolingFactor = 1, this.initialCoolingFactor = this.coolingFactor, this.maxNodeDisplacement = i.MAX_NODE_DISPLACEMENT), this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations), this.displacementThresholdPerNode = 3 * i.DEFAULT_EDGE_LENGTH / 100, this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length, this.repulsionRange = this.calcRepulsionRange();
1225
- }, a.prototype.calcSpringForces = function() {
1226
- for (var t = this.getAllEdges(), h, o = 0; o < t.length; o++)
1227
- h = t[o], this.calcSpringForce(h, h.idealLength);
1228
- }, a.prototype.calcRepulsionForces = function() {
1229
- var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, o, c, l, T, g = this.getAllNodes(), d;
1230
- if (this.useFRGridVariant)
1231
- for (this.totalIterations % i.GRID_CALCULATION_CHECK_PERIOD == 1 && t && this.updateGrid(), d = /* @__PURE__ */ new Set(), o = 0; o < g.length; o++)
1232
- l = g[o], this.calculateRepulsionForceOfANode(l, d, t, h), d.add(l);
1233
- else
1234
- for (o = 0; o < g.length; o++)
1235
- for (l = g[o], c = o + 1; c < g.length; c++)
1236
- T = g[c], l.getOwner() == T.getOwner() && this.calcRepulsionForce(l, T);
1237
- }, a.prototype.calcGravitationalForces = function() {
1238
- for (var t, h = this.getAllNodesToApplyGravitation(), o = 0; o < h.length; o++)
1239
- t = h[o], this.calcGravitationalForce(t);
1240
- }, a.prototype.moveNodes = function() {
1241
- for (var t = this.getAllNodes(), h, o = 0; o < t.length; o++)
1242
- h = t[o], h.move();
1243
- }, a.prototype.calcSpringForce = function(t, h) {
1244
- var o = t.getSource(), c = t.getTarget(), l, T, g, d;
1245
- if (this.uniformLeafNodeSizes && o.getChild() == null && c.getChild() == null)
1246
- t.updateLengthSimple();
1247
- else if (t.updateLength(), t.isOverlapingSourceAndTarget)
1248
- return;
1249
- l = t.getLength(), l != 0 && (T = t.edgeElasticity * (l - h), g = T * (t.lengthX / l), d = T * (t.lengthY / l), o.springForceX += g, o.springForceY += d, c.springForceX -= g, c.springForceY -= d);
1250
- }, a.prototype.calcRepulsionForce = function(t, h) {
1251
- var o = t.getRect(), c = h.getRect(), l = new Array(2), T = new Array(4), g, d, L, F, M, P, J;
1252
- if (o.intersects(c)) {
1253
- e.calcSeparationAmount(o, c, l, i.DEFAULT_EDGE_LENGTH / 2), P = 2 * l[0], J = 2 * l[1];
1254
- var V = t.noOfChildren * h.noOfChildren / (t.noOfChildren + h.noOfChildren);
1255
- t.repulsionForceX -= V * P, t.repulsionForceY -= V * J, h.repulsionForceX += V * P, h.repulsionForceY += V * J;
1256
- } else
1257
- this.uniformLeafNodeSizes && t.getChild() == null && h.getChild() == null ? (g = c.getCenterX() - o.getCenterX(), d = c.getCenterY() - o.getCenterY()) : (e.getIntersection(o, c, T), g = T[2] - T[0], d = T[3] - T[1]), Math.abs(g) < i.MIN_REPULSION_DIST && (g = f.sign(g) * i.MIN_REPULSION_DIST), Math.abs(d) < i.MIN_REPULSION_DIST && (d = f.sign(d) * i.MIN_REPULSION_DIST), L = g * g + d * d, F = Math.sqrt(L), M = (t.nodeRepulsion / 2 + h.nodeRepulsion / 2) * t.noOfChildren * h.noOfChildren / L, P = M * g / F, J = M * d / F, t.repulsionForceX -= P, t.repulsionForceY -= J, h.repulsionForceX += P, h.repulsionForceY += J;
1258
- }, a.prototype.calcGravitationalForce = function(t) {
1259
- var h, o, c, l, T, g, d, L;
1260
- h = t.getOwner(), o = (h.getRight() + h.getLeft()) / 2, c = (h.getTop() + h.getBottom()) / 2, l = t.getCenterX() - o, T = t.getCenterY() - c, g = Math.abs(l) + t.getWidth() / 2, d = Math.abs(T) + t.getHeight() / 2, t.getOwner() == this.graphManager.getRoot() ? (L = h.getEstimatedSize() * this.gravityRangeFactor, (g > L || d > L) && (t.gravitationForceX = -this.gravityConstant * l, t.gravitationForceY = -this.gravityConstant * T)) : (L = h.getEstimatedSize() * this.compoundGravityRangeFactor, (g > L || d > L) && (t.gravitationForceX = -this.gravityConstant * l * this.compoundGravityConstant, t.gravitationForceY = -this.gravityConstant * T * this.compoundGravityConstant));
1261
- }, a.prototype.isConverged = function() {
1262
- var t, h = !1;
1263
- return this.totalIterations > this.maxIterations / 3 && (h = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), t = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, t || h;
1264
- }, a.prototype.animate = function() {
1265
- this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++);
1266
- }, a.prototype.calcNoOfChildrenForAllNodes = function() {
1267
- for (var t, h = this.graphManager.getAllNodes(), o = 0; o < h.length; o++)
1268
- t = h[o], t.noOfChildren = t.getNoOfChildren();
1269
- }, a.prototype.calcGrid = function(t) {
1270
- var h = 0, o = 0;
1271
- h = parseInt(Math.ceil((t.getRight() - t.getLeft()) / this.repulsionRange)), o = parseInt(Math.ceil((t.getBottom() - t.getTop()) / this.repulsionRange));
1272
- for (var c = new Array(h), l = 0; l < h; l++)
1273
- c[l] = new Array(o);
1274
- for (var l = 0; l < h; l++)
1275
- for (var T = 0; T < o; T++)
1276
- c[l][T] = new Array();
1277
- return c;
1278
- }, a.prototype.addNodeToGrid = function(t, h, o) {
1279
- var c = 0, l = 0, T = 0, g = 0;
1280
- c = parseInt(Math.floor((t.getRect().x - h) / this.repulsionRange)), l = parseInt(Math.floor((t.getRect().width + t.getRect().x - h) / this.repulsionRange)), T = parseInt(Math.floor((t.getRect().y - o) / this.repulsionRange)), g = parseInt(Math.floor((t.getRect().height + t.getRect().y - o) / this.repulsionRange));
1281
- for (var d = c; d <= l; d++)
1282
- for (var L = T; L <= g; L++)
1283
- this.grid[d][L].push(t), t.setGridCoordinates(c, l, T, g);
1284
- }, a.prototype.updateGrid = function() {
1285
- var t, h, o = this.getAllNodes();
1286
- for (this.grid = this.calcGrid(this.graphManager.getRoot()), t = 0; t < o.length; t++)
1287
- h = o[t], this.addNodeToGrid(h, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
1288
- }, a.prototype.calculateRepulsionForceOfANode = function(t, h, o, c) {
1289
- if (this.totalIterations % i.GRID_CALCULATION_CHECK_PERIOD == 1 && o || c) {
1290
- var l = /* @__PURE__ */ new Set();
1291
- t.surrounding = new Array();
1292
- for (var T, g = this.grid, d = t.startX - 1; d < t.finishX + 2; d++)
1293
- for (var L = t.startY - 1; L < t.finishY + 2; L++)
1294
- if (!(d < 0 || L < 0 || d >= g.length || L >= g[0].length)) {
1295
- for (var F = 0; F < g[d][L].length; F++)
1296
- if (T = g[d][L][F], !(t.getOwner() != T.getOwner() || t == T) && !h.has(T) && !l.has(T)) {
1297
- var M = Math.abs(t.getCenterX() - T.getCenterX()) - (t.getWidth() / 2 + T.getWidth() / 2), P = Math.abs(t.getCenterY() - T.getCenterY()) - (t.getHeight() / 2 + T.getHeight() / 2);
1298
- M <= this.repulsionRange && P <= this.repulsionRange && l.add(T);
1299
- }
1300
- }
1301
- t.surrounding = [].concat(u(l));
1302
- }
1303
- for (d = 0; d < t.surrounding.length; d++)
1304
- this.calcRepulsionForce(t, t.surrounding[d]);
1305
- }, a.prototype.calcRepulsionRange = function() {
1306
- return 0;
1307
- }, A.exports = a;
1308
- },
1309
- /* 19 */
1310
- /***/
1311
- function(A, G, N) {
1312
- var u = N(1), s = N(4);
1313
- function i(e, f, a) {
1314
- u.call(this, e, f, a), this.idealLength = s.DEFAULT_EDGE_LENGTH, this.edgeElasticity = s.DEFAULT_SPRING_STRENGTH;
1315
- }
1316
- i.prototype = Object.create(u.prototype);
1317
- for (var r in u)
1318
- i[r] = u[r];
1319
- A.exports = i;
1320
- },
1321
- /* 20 */
1322
- /***/
1323
- function(A, G, N) {
1324
- var u = N(3), s = N(4);
1325
- function i(e, f, a, y) {
1326
- u.call(this, e, f, a, y), this.nodeRepulsion = s.DEFAULT_REPULSION_STRENGTH, this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0, this.startX = 0, this.finishX = 0, this.startY = 0, this.finishY = 0, this.surrounding = [];
1327
- }
1328
- i.prototype = Object.create(u.prototype);
1329
- for (var r in u)
1330
- i[r] = u[r];
1331
- i.prototype.setGridCoordinates = function(e, f, a, y) {
1332
- this.startX = e, this.finishX = f, this.startY = a, this.finishY = y;
1333
- }, A.exports = i;
1334
- },
1335
- /* 21 */
1336
- /***/
1337
- function(A, G, N) {
1338
- function u(s, i) {
1339
- this.width = 0, this.height = 0, s !== null && i !== null && (this.height = i, this.width = s);
1340
- }
1341
- u.prototype.getWidth = function() {
1342
- return this.width;
1343
- }, u.prototype.setWidth = function(s) {
1344
- this.width = s;
1345
- }, u.prototype.getHeight = function() {
1346
- return this.height;
1347
- }, u.prototype.setHeight = function(s) {
1348
- this.height = s;
1349
- }, A.exports = u;
1350
- },
1351
- /* 22 */
1352
- /***/
1353
- function(A, G, N) {
1354
- var u = N(14);
1355
- function s() {
1356
- this.map = {}, this.keys = [];
1357
- }
1358
- s.prototype.put = function(i, r) {
1359
- var e = u.createID(i);
1360
- this.contains(e) || (this.map[e] = r, this.keys.push(i));
1361
- }, s.prototype.contains = function(i) {
1362
- return u.createID(i), this.map[i] != null;
1363
- }, s.prototype.get = function(i) {
1364
- var r = u.createID(i);
1365
- return this.map[r];
1366
- }, s.prototype.keySet = function() {
1367
- return this.keys;
1368
- }, A.exports = s;
1369
- },
1370
- /* 23 */
1371
- /***/
1372
- function(A, G, N) {
1373
- var u = N(14);
1374
- function s() {
1375
- this.set = {};
1376
- }
1377
- s.prototype.add = function(i) {
1378
- var r = u.createID(i);
1379
- this.contains(r) || (this.set[r] = i);
1380
- }, s.prototype.remove = function(i) {
1381
- delete this.set[u.createID(i)];
1382
- }, s.prototype.clear = function() {
1383
- this.set = {};
1384
- }, s.prototype.contains = function(i) {
1385
- return this.set[u.createID(i)] == i;
1386
- }, s.prototype.isEmpty = function() {
1387
- return this.size() === 0;
1388
- }, s.prototype.size = function() {
1389
- return Object.keys(this.set).length;
1390
- }, s.prototype.addAllTo = function(i) {
1391
- for (var r = Object.keys(this.set), e = r.length, f = 0; f < e; f++)
1392
- i.push(this.set[r[f]]);
1393
- }, s.prototype.size = function() {
1394
- return Object.keys(this.set).length;
1395
- }, s.prototype.addAll = function(i) {
1396
- for (var r = i.length, e = 0; e < r; e++) {
1397
- var f = i[e];
1398
- this.add(f);
1399
- }
1400
- }, A.exports = s;
1401
- },
1402
- /* 24 */
1403
- /***/
1404
- function(A, G, N) {
1405
- function u() {
1406
- }
1407
- u.multMat = function(s, i) {
1408
- for (var r = [], e = 0; e < s.length; e++) {
1409
- r[e] = [];
1410
- for (var f = 0; f < i[0].length; f++) {
1411
- r[e][f] = 0;
1412
- for (var a = 0; a < s[0].length; a++)
1413
- r[e][f] += s[e][a] * i[a][f];
1414
- }
1415
- }
1416
- return r;
1417
- }, u.transpose = function(s) {
1418
- for (var i = [], r = 0; r < s[0].length; r++) {
1419
- i[r] = [];
1420
- for (var e = 0; e < s.length; e++)
1421
- i[r][e] = s[e][r];
1422
- }
1423
- return i;
1424
- }, u.multCons = function(s, i) {
1425
- for (var r = [], e = 0; e < s.length; e++)
1426
- r[e] = s[e] * i;
1427
- return r;
1428
- }, u.minusOp = function(s, i) {
1429
- for (var r = [], e = 0; e < s.length; e++)
1430
- r[e] = s[e] - i[e];
1431
- return r;
1432
- }, u.dotProduct = function(s, i) {
1433
- for (var r = 0, e = 0; e < s.length; e++)
1434
- r += s[e] * i[e];
1435
- return r;
1436
- }, u.mag = function(s) {
1437
- return Math.sqrt(this.dotProduct(s, s));
1438
- }, u.normalize = function(s) {
1439
- for (var i = [], r = this.mag(s), e = 0; e < s.length; e++)
1440
- i[e] = s[e] / r;
1441
- return i;
1442
- }, u.multGamma = function(s) {
1443
- for (var i = [], r = 0, e = 0; e < s.length; e++)
1444
- r += s[e];
1445
- r *= -1 / s.length;
1446
- for (var f = 0; f < s.length; f++)
1447
- i[f] = r + s[f];
1448
- return i;
1449
- }, u.multL = function(s, i, r) {
1450
- for (var e = [], f = [], a = [], y = 0; y < i[0].length; y++) {
1451
- for (var t = 0, h = 0; h < i.length; h++)
1452
- t += -0.5 * i[h][y] * s[h];
1453
- f[y] = t;
1454
- }
1455
- for (var o = 0; o < r.length; o++) {
1456
- for (var c = 0, l = 0; l < r.length; l++)
1457
- c += r[o][l] * f[l];
1458
- a[o] = c;
1459
- }
1460
- for (var T = 0; T < i.length; T++) {
1461
- for (var g = 0, d = 0; d < i[0].length; d++)
1462
- g += i[T][d] * a[d];
1463
- e[T] = g;
1464
- }
1465
- return e;
1466
- }, A.exports = u;
1467
- },
1468
- /* 25 */
1469
- /***/
1470
- function(A, G, N) {
1471
- var u = /* @__PURE__ */ function() {
1472
- function e(f, a) {
1473
- for (var y = 0; y < a.length; y++) {
1474
- var t = a[y];
1475
- t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(f, t.key, t);
1476
- }
1477
- }
1478
- return function(f, a, y) {
1479
- return a && e(f.prototype, a), y && e(f, y), f;
1480
- };
1481
- }();
1482
- function s(e, f) {
1483
- if (!(e instanceof f))
1484
- throw new TypeError("Cannot call a class as a function");
1485
- }
1486
- var i = N(11), r = function() {
1487
- function e(f, a) {
1488
- s(this, e), (a !== null || a !== void 0) && (this.compareFunction = this._defaultCompareFunction);
1489
- var y = void 0;
1490
- f instanceof i ? y = f.size() : y = f.length, this._quicksort(f, 0, y - 1);
1491
- }
1492
- return u(e, [{
1493
- key: "_quicksort",
1494
- value: function(a, y, t) {
1495
- if (y < t) {
1496
- var h = this._partition(a, y, t);
1497
- this._quicksort(a, y, h), this._quicksort(a, h + 1, t);
1498
- }
1499
- }
1500
- }, {
1501
- key: "_partition",
1502
- value: function(a, y, t) {
1503
- for (var h = this._get(a, y), o = y, c = t; ; ) {
1504
- for (; this.compareFunction(h, this._get(a, c)); )
1505
- c--;
1506
- for (; this.compareFunction(this._get(a, o), h); )
1507
- o++;
1508
- if (o < c)
1509
- this._swap(a, o, c), o++, c--;
1510
- else return c;
1511
- }
1512
- }
1513
- }, {
1514
- key: "_get",
1515
- value: function(a, y) {
1516
- return a instanceof i ? a.get_object_at(y) : a[y];
1517
- }
1518
- }, {
1519
- key: "_set",
1520
- value: function(a, y, t) {
1521
- a instanceof i ? a.set_object_at(y, t) : a[y] = t;
1522
- }
1523
- }, {
1524
- key: "_swap",
1525
- value: function(a, y, t) {
1526
- var h = this._get(a, y);
1527
- this._set(a, y, this._get(a, t)), this._set(a, t, h);
1528
- }
1529
- }, {
1530
- key: "_defaultCompareFunction",
1531
- value: function(a, y) {
1532
- return y > a;
1533
- }
1534
- }]), e;
1535
- }();
1536
- A.exports = r;
1537
- },
1538
- /* 26 */
1539
- /***/
1540
- function(A, G, N) {
1541
- function u() {
1542
- }
1543
- u.svd = function(s) {
1544
- this.U = null, this.V = null, this.s = null, this.m = 0, this.n = 0, this.m = s.length, this.n = s[0].length;
1545
- var i = Math.min(this.m, this.n);
1546
- this.s = function(Nt) {
1547
- for (var Mt = []; Nt-- > 0; )
1548
- Mt.push(0);
1549
- return Mt;
1550
- }(Math.min(this.m + 1, this.n)), this.U = function(Nt) {
1551
- var Mt = function Zt(Gt) {
1552
- if (Gt.length == 0)
1553
- return 0;
1554
- for (var $t = [], Ft = 0; Ft < Gt[0]; Ft++)
1555
- $t.push(Zt(Gt.slice(1)));
1556
- return $t;
1557
- };
1558
- return Mt(Nt);
1559
- }([this.m, i]), this.V = function(Nt) {
1560
- var Mt = function Zt(Gt) {
1561
- if (Gt.length == 0)
1562
- return 0;
1563
- for (var $t = [], Ft = 0; Ft < Gt[0]; Ft++)
1564
- $t.push(Zt(Gt.slice(1)));
1565
- return $t;
1566
- };
1567
- return Mt(Nt);
1568
- }([this.n, this.n]);
1569
- for (var r = function(Nt) {
1570
- for (var Mt = []; Nt-- > 0; )
1571
- Mt.push(0);
1572
- return Mt;
1573
- }(this.n), e = function(Nt) {
1574
- for (var Mt = []; Nt-- > 0; )
1575
- Mt.push(0);
1576
- return Mt;
1577
- }(this.m), f = !0, a = Math.min(this.m - 1, this.n), y = Math.max(0, Math.min(this.n - 2, this.m)), t = 0; t < Math.max(a, y); t++) {
1578
- if (t < a) {
1579
- this.s[t] = 0;
1580
- for (var h = t; h < this.m; h++)
1581
- this.s[t] = u.hypot(this.s[t], s[h][t]);
1582
- if (this.s[t] !== 0) {
1583
- s[t][t] < 0 && (this.s[t] = -this.s[t]);
1584
- for (var o = t; o < this.m; o++)
1585
- s[o][t] /= this.s[t];
1586
- s[t][t] += 1;
1587
- }
1588
- this.s[t] = -this.s[t];
1589
- }
1590
- for (var c = t + 1; c < this.n; c++) {
1591
- if (/* @__PURE__ */ function(Nt, Mt) {
1592
- return Nt && Mt;
1593
- }(t < a, this.s[t] !== 0)) {
1594
- for (var l = 0, T = t; T < this.m; T++)
1595
- l += s[T][t] * s[T][c];
1596
- l = -l / s[t][t];
1597
- for (var g = t; g < this.m; g++)
1598
- s[g][c] += l * s[g][t];
1599
- }
1600
- r[c] = s[t][c];
1601
- }
1602
- if (/* @__PURE__ */ function(Nt, Mt) {
1603
- return Mt;
1604
- }(f, t < a))
1605
- for (var d = t; d < this.m; d++)
1606
- this.U[d][t] = s[d][t];
1607
- if (t < y) {
1608
- r[t] = 0;
1609
- for (var L = t + 1; L < this.n; L++)
1610
- r[t] = u.hypot(r[t], r[L]);
1611
- if (r[t] !== 0) {
1612
- r[t + 1] < 0 && (r[t] = -r[t]);
1613
- for (var F = t + 1; F < this.n; F++)
1614
- r[F] /= r[t];
1615
- r[t + 1] += 1;
1616
- }
1617
- if (r[t] = -r[t], /* @__PURE__ */ function(Nt, Mt) {
1618
- return Nt && Mt;
1619
- }(t + 1 < this.m, r[t] !== 0)) {
1620
- for (var M = t + 1; M < this.m; M++)
1621
- e[M] = 0;
1622
- for (var P = t + 1; P < this.n; P++)
1623
- for (var J = t + 1; J < this.m; J++)
1624
- e[J] += r[P] * s[J][P];
1625
- for (var V = t + 1; V < this.n; V++)
1626
- for (var Q = -r[V] / r[t + 1], D = t + 1; D < this.m; D++)
1627
- s[D][V] += Q * e[D];
1628
- }
1629
- for (var rt = t + 1; rt < this.n; rt++)
1630
- this.V[rt][t] = r[rt];
1631
- }
1632
- }
1633
- var n = Math.min(this.n, this.m + 1);
1634
- a < this.n && (this.s[a] = s[a][a]), this.m < n && (this.s[n - 1] = 0), y + 1 < n && (r[y] = s[y][n - 1]), r[n - 1] = 0;
1635
- {
1636
- for (var m = a; m < i; m++) {
1637
- for (var v = 0; v < this.m; v++)
1638
- this.U[v][m] = 0;
1639
- this.U[m][m] = 1;
1640
- }
1641
- for (var E = a - 1; E >= 0; E--)
1642
- if (this.s[E] !== 0) {
1643
- for (var p = E + 1; p < i; p++) {
1644
- for (var I = 0, w = E; w < this.m; w++)
1645
- I += this.U[w][E] * this.U[w][p];
1646
- I = -I / this.U[E][E];
1647
- for (var R = E; R < this.m; R++)
1648
- this.U[R][p] += I * this.U[R][E];
1649
- }
1650
- for (var H = E; H < this.m; H++)
1651
- this.U[H][E] = -this.U[H][E];
1652
- this.U[E][E] = 1 + this.U[E][E];
1653
- for (var x = 0; x < E - 1; x++)
1654
- this.U[x][E] = 0;
1655
- } else {
1656
- for (var k = 0; k < this.m; k++)
1657
- this.U[k][E] = 0;
1658
- this.U[E][E] = 1;
1659
- }
1660
- }
1661
- for (var W = this.n - 1; W >= 0; W--) {
1662
- if (/* @__PURE__ */ function(Nt, Mt) {
1663
- return Nt && Mt;
1664
- }(W < y, r[W] !== 0))
1665
- for (var U = W + 1; U < i; U++) {
1666
- for (var et = 0, z = W + 1; z < this.n; z++)
1667
- et += this.V[z][W] * this.V[z][U];
1668
- et = -et / this.V[W + 1][W];
1669
- for (var O = W + 1; O < this.n; O++)
1670
- this.V[O][U] += et * this.V[O][W];
1671
- }
1672
- for (var X = 0; X < this.n; X++)
1673
- this.V[X][W] = 0;
1674
- this.V[W][W] = 1;
1675
- }
1676
- for (var B = n - 1, _ = Math.pow(2, -52), lt = Math.pow(2, -966); n > 0; ) {
1677
- var q = void 0, Rt = void 0;
1678
- for (q = n - 2; q >= -1 && q !== -1; q--)
1679
- if (Math.abs(r[q]) <= lt + _ * (Math.abs(this.s[q]) + Math.abs(this.s[q + 1]))) {
1680
- r[q] = 0;
1681
- break;
1682
- }
1683
- if (q === n - 2)
1684
- Rt = 4;
1685
- else {
1686
- var Lt = void 0;
1687
- for (Lt = n - 1; Lt >= q && Lt !== q; Lt--) {
1688
- var vt = (Lt !== n ? Math.abs(r[Lt]) : 0) + (Lt !== q + 1 ? Math.abs(r[Lt - 1]) : 0);
1689
- if (Math.abs(this.s[Lt]) <= lt + _ * vt) {
1690
- this.s[Lt] = 0;
1691
- break;
1692
- }
1693
- }
1694
- Lt === q ? Rt = 3 : Lt === n - 1 ? Rt = 1 : (Rt = 2, q = Lt);
1695
- }
1696
- switch (q++, Rt) {
1697
- case 1:
1698
- {
1699
- var it = r[n - 2];
1700
- r[n - 2] = 0;
1701
- for (var gt = n - 2; gt >= q; gt--) {
1702
- var Tt = u.hypot(this.s[gt], it), At = this.s[gt] / Tt, Dt = it / Tt;
1703
- this.s[gt] = Tt, gt !== q && (it = -Dt * r[gt - 1], r[gt - 1] = At * r[gt - 1]);
1704
- for (var mt = 0; mt < this.n; mt++)
1705
- Tt = At * this.V[mt][gt] + Dt * this.V[mt][n - 1], this.V[mt][n - 1] = -Dt * this.V[mt][gt] + At * this.V[mt][n - 1], this.V[mt][gt] = Tt;
1706
- }
1707
- }
1708
- break;
1709
- case 2:
1710
- {
1711
- var xt = r[q - 1];
1712
- r[q - 1] = 0;
1713
- for (var St = q; St < n; St++) {
1714
- var Vt = u.hypot(this.s[St], xt), Xt = this.s[St] / Vt, Ut = xt / Vt;
1715
- this.s[St] = Vt, xt = -Ut * r[St], r[St] = Xt * r[St];
1716
- for (var bt = 0; bt < this.m; bt++)
1717
- Vt = Xt * this.U[bt][St] + Ut * this.U[bt][q - 1], this.U[bt][q - 1] = -Ut * this.U[bt][St] + Xt * this.U[bt][q - 1], this.U[bt][St] = Vt;
1718
- }
1719
- }
1720
- break;
1721
- case 3:
1722
- {
1723
- var Ht = Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[n - 1]), Math.abs(this.s[n - 2])), Math.abs(r[n - 2])), Math.abs(this.s[q])), Math.abs(r[q])), Bt = this.s[n - 1] / Ht, S = this.s[n - 2] / Ht, b = r[n - 2] / Ht, $ = this.s[q] / Ht, K = r[q] / Ht, Z = ((S + Bt) * (S - Bt) + b * b) / 2, at = Bt * b * (Bt * b), ut = 0;
1724
- /* @__PURE__ */ (function(Nt, Mt) {
1725
- return Nt || Mt;
1726
- })(Z !== 0, at !== 0) && (ut = Math.sqrt(Z * Z + at), Z < 0 && (ut = -ut), ut = at / (Z + ut));
1727
- for (var ot = ($ + Bt) * ($ - Bt) + ut, tt = $ * K, j = q; j < n - 1; j++) {
1728
- var dt = u.hypot(ot, tt), wt = ot / dt, yt = tt / dt;
1729
- j !== q && (r[j - 1] = dt), ot = wt * this.s[j] + yt * r[j], r[j] = wt * r[j] - yt * this.s[j], tt = yt * this.s[j + 1], this.s[j + 1] = wt * this.s[j + 1];
1730
- for (var It = 0; It < this.n; It++)
1731
- dt = wt * this.V[It][j] + yt * this.V[It][j + 1], this.V[It][j + 1] = -yt * this.V[It][j] + wt * this.V[It][j + 1], this.V[It][j] = dt;
1732
- if (dt = u.hypot(ot, tt), wt = ot / dt, yt = tt / dt, this.s[j] = dt, ot = wt * r[j] + yt * this.s[j + 1], this.s[j + 1] = -yt * r[j] + wt * this.s[j + 1], tt = yt * r[j + 1], r[j + 1] = wt * r[j + 1], j < this.m - 1)
1733
- for (var ft = 0; ft < this.m; ft++)
1734
- dt = wt * this.U[ft][j] + yt * this.U[ft][j + 1], this.U[ft][j + 1] = -yt * this.U[ft][j] + wt * this.U[ft][j + 1], this.U[ft][j] = dt;
1735
- }
1736
- r[n - 2] = ot;
1737
- }
1738
- break;
1739
- case 4:
1740
- {
1741
- if (this.s[q] <= 0) {
1742
- this.s[q] = this.s[q] < 0 ? -this.s[q] : 0;
1743
- for (var st = 0; st <= B; st++)
1744
- this.V[st][q] = -this.V[st][q];
1745
- }
1746
- for (; q < B && !(this.s[q] >= this.s[q + 1]); ) {
1747
- var Ct = this.s[q];
1748
- if (this.s[q] = this.s[q + 1], this.s[q + 1] = Ct, q < this.n - 1)
1749
- for (var ct = 0; ct < this.n; ct++)
1750
- Ct = this.V[ct][q + 1], this.V[ct][q + 1] = this.V[ct][q], this.V[ct][q] = Ct;
1751
- if (q < this.m - 1)
1752
- for (var ht = 0; ht < this.m; ht++)
1753
- Ct = this.U[ht][q + 1], this.U[ht][q + 1] = this.U[ht][q], this.U[ht][q] = Ct;
1754
- q++;
1755
- }
1756
- n--;
1757
- }
1758
- break;
1759
- }
1760
- }
1761
- var Wt = { U: this.U, V: this.V, S: this.s };
1762
- return Wt;
1763
- }, u.hypot = function(s, i) {
1764
- var r = void 0;
1765
- return Math.abs(s) > Math.abs(i) ? (r = i / s, r = Math.abs(s) * Math.sqrt(1 + r * r)) : i != 0 ? (r = s / i, r = Math.abs(i) * Math.sqrt(1 + r * r)) : r = 0, r;
1766
- }, A.exports = u;
1767
- },
1768
- /* 27 */
1769
- /***/
1770
- function(A, G, N) {
1771
- var u = /* @__PURE__ */ function() {
1772
- function r(e, f) {
1773
- for (var a = 0; a < f.length; a++) {
1774
- var y = f[a];
1775
- y.enumerable = y.enumerable || !1, y.configurable = !0, "value" in y && (y.writable = !0), Object.defineProperty(e, y.key, y);
1776
- }
1777
- }
1778
- return function(e, f, a) {
1779
- return f && r(e.prototype, f), a && r(e, a), e;
1780
- };
1781
- }();
1782
- function s(r, e) {
1783
- if (!(r instanceof e))
1784
- throw new TypeError("Cannot call a class as a function");
1785
- }
1786
- var i = function() {
1787
- function r(e, f) {
1788
- var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, y = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, t = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
1789
- s(this, r), this.sequence1 = e, this.sequence2 = f, this.match_score = a, this.mismatch_penalty = y, this.gap_penalty = t, this.iMax = e.length + 1, this.jMax = f.length + 1, this.grid = new Array(this.iMax);
1790
- for (var h = 0; h < this.iMax; h++) {
1791
- this.grid[h] = new Array(this.jMax);
1792
- for (var o = 0; o < this.jMax; o++)
1793
- this.grid[h][o] = 0;
1794
- }
1795
- this.tracebackGrid = new Array(this.iMax);
1796
- for (var c = 0; c < this.iMax; c++) {
1797
- this.tracebackGrid[c] = new Array(this.jMax);
1798
- for (var l = 0; l < this.jMax; l++)
1799
- this.tracebackGrid[c][l] = [null, null, null];
1800
- }
1801
- this.alignments = [], this.score = -1, this.computeGrids();
1802
- }
1803
- return u(r, [{
1804
- key: "getScore",
1805
- value: function() {
1806
- return this.score;
1807
- }
1808
- }, {
1809
- key: "getAlignments",
1810
- value: function() {
1811
- return this.alignments;
1812
- }
1813
- // Main dynamic programming procedure
1814
- }, {
1815
- key: "computeGrids",
1816
- value: function() {
1817
- for (var f = 1; f < this.jMax; f++)
1818
- this.grid[0][f] = this.grid[0][f - 1] + this.gap_penalty, this.tracebackGrid[0][f] = [!1, !1, !0];
1819
- for (var a = 1; a < this.iMax; a++)
1820
- this.grid[a][0] = this.grid[a - 1][0] + this.gap_penalty, this.tracebackGrid[a][0] = [!1, !0, !1];
1821
- for (var y = 1; y < this.iMax; y++)
1822
- for (var t = 1; t < this.jMax; t++) {
1823
- var h = void 0;
1824
- this.sequence1[y - 1] === this.sequence2[t - 1] ? h = this.grid[y - 1][t - 1] + this.match_score : h = this.grid[y - 1][t - 1] + this.mismatch_penalty;
1825
- var o = this.grid[y - 1][t] + this.gap_penalty, c = this.grid[y][t - 1] + this.gap_penalty, l = [h, o, c], T = this.arrayAllMaxIndexes(l);
1826
- this.grid[y][t] = l[T[0]], this.tracebackGrid[y][t] = [T.includes(0), T.includes(1), T.includes(2)];
1827
- }
1828
- this.score = this.grid[this.iMax - 1][this.jMax - 1];
1829
- }
1830
- // Gets all possible valid sequence combinations
1831
- }, {
1832
- key: "alignmentTraceback",
1833
- value: function() {
1834
- var f = [];
1835
- for (f.push({
1836
- pos: [this.sequence1.length, this.sequence2.length],
1837
- seq1: "",
1838
- seq2: ""
1839
- }); f[0]; ) {
1840
- var a = f[0], y = this.tracebackGrid[a.pos[0]][a.pos[1]];
1841
- y[0] && f.push({
1842
- pos: [a.pos[0] - 1, a.pos[1] - 1],
1843
- seq1: this.sequence1[a.pos[0] - 1] + a.seq1,
1844
- seq2: this.sequence2[a.pos[1] - 1] + a.seq2
1845
- }), y[1] && f.push({
1846
- pos: [a.pos[0] - 1, a.pos[1]],
1847
- seq1: this.sequence1[a.pos[0] - 1] + a.seq1,
1848
- seq2: "-" + a.seq2
1849
- }), y[2] && f.push({
1850
- pos: [a.pos[0], a.pos[1] - 1],
1851
- seq1: "-" + a.seq1,
1852
- seq2: this.sequence2[a.pos[1] - 1] + a.seq2
1853
- }), a.pos[0] === 0 && a.pos[1] === 0 && this.alignments.push({
1854
- sequence1: a.seq1,
1855
- sequence2: a.seq2
1856
- }), f.shift();
1857
- }
1858
- return this.alignments;
1859
- }
1860
- // Helper Functions
1861
- }, {
1862
- key: "getAllIndexes",
1863
- value: function(f, a) {
1864
- for (var y = [], t = -1; (t = f.indexOf(a, t + 1)) !== -1; )
1865
- y.push(t);
1866
- return y;
1867
- }
1868
- }, {
1869
- key: "arrayAllMaxIndexes",
1870
- value: function(f) {
1871
- return this.getAllIndexes(f, Math.max.apply(null, f));
1872
- }
1873
- }]), r;
1874
- }();
1875
- A.exports = i;
1876
- },
1877
- /* 28 */
1878
- /***/
1879
- function(A, G, N) {
1880
- var u = function() {
1881
- };
1882
- u.FDLayout = N(18), u.FDLayoutConstants = N(4), u.FDLayoutEdge = N(19), u.FDLayoutNode = N(20), u.DimensionD = N(21), u.HashMap = N(22), u.HashSet = N(23), u.IGeometry = N(8), u.IMath = N(9), u.Integer = N(10), u.Point = N(12), u.PointD = N(5), u.RandomSeed = N(16), u.RectangleD = N(13), u.Transform = N(17), u.UniqueIDGeneretor = N(14), u.Quicksort = N(25), u.LinkedList = N(11), u.LGraphObject = N(2), u.LGraph = N(6), u.LEdge = N(1), u.LGraphManager = N(7), u.LNode = N(3), u.Layout = N(15), u.LayoutConstants = N(0), u.NeedlemanWunsch = N(27), u.Matrix = N(24), u.SVD = N(26), A.exports = u;
1883
- },
1884
- /* 29 */
1885
- /***/
1886
- function(A, G, N) {
1887
- function u() {
1888
- this.listeners = [];
1889
- }
1890
- var s = u.prototype;
1891
- s.addListener = function(i, r) {
1892
- this.listeners.push({
1893
- event: i,
1894
- callback: r
1895
- });
1896
- }, s.removeListener = function(i, r) {
1897
- for (var e = this.listeners.length; e >= 0; e--) {
1898
- var f = this.listeners[e];
1899
- f.event === i && f.callback === r && this.listeners.splice(e, 1);
1900
- }
1901
- }, s.emit = function(i, r) {
1902
- for (var e = 0; e < this.listeners.length; e++) {
1903
- var f = this.listeners[e];
1904
- i === f.event && f.callback(r);
1905
- }
1906
- }, A.exports = u;
1907
- }
1908
- /******/
1909
- ])
1910
- );
1911
- });
1912
- }(ce)), ce.exports;
1913
- }
1914
- var ur = fe.exports, De;
1915
- function gr() {
1916
- return De || (De = 1, function(C, Y) {
1917
- (function(G, N) {
1918
- C.exports = N(cr());
1919
- })(ur, function(A) {
1920
- return (
1921
- /******/
1922
- (() => {
1923
- var G = {
1924
- /***/
1925
- 45: (
1926
- /***/
1927
- (i, r, e) => {
1928
- var f = {};
1929
- f.layoutBase = e(551), f.CoSEConstants = e(806), f.CoSEEdge = e(767), f.CoSEGraph = e(880), f.CoSEGraphManager = e(578), f.CoSELayout = e(765), f.CoSENode = e(991), f.ConstraintHandler = e(902), i.exports = f;
1930
- }
1931
- ),
1932
- /***/
1933
- 806: (
1934
- /***/
1935
- (i, r, e) => {
1936
- var f = e(551).FDLayoutConstants;
1937
- function a() {
1938
- }
1939
- for (var y in f)
1940
- a[y] = f[y];
1941
- a.DEFAULT_USE_MULTI_LEVEL_SCALING = !1, a.DEFAULT_RADIAL_SEPARATION = f.DEFAULT_EDGE_LENGTH, a.DEFAULT_COMPONENT_SEPERATION = 60, a.TILE = !0, a.TILING_PADDING_VERTICAL = 10, a.TILING_PADDING_HORIZONTAL = 10, a.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, a.ENFORCE_CONSTRAINTS = !0, a.APPLY_LAYOUT = !0, a.RELAX_MOVEMENT_ON_CONSTRAINTS = !0, a.TREE_REDUCTION_ON_INCREMENTAL = !0, a.PURE_INCREMENTAL = a.DEFAULT_INCREMENTAL, i.exports = a;
1942
- }
1943
- ),
1944
- /***/
1945
- 767: (
1946
- /***/
1947
- (i, r, e) => {
1948
- var f = e(551).FDLayoutEdge;
1949
- function a(t, h, o) {
1950
- f.call(this, t, h, o);
1951
- }
1952
- a.prototype = Object.create(f.prototype);
1953
- for (var y in f)
1954
- a[y] = f[y];
1955
- i.exports = a;
1956
- }
1957
- ),
1958
- /***/
1959
- 880: (
1960
- /***/
1961
- (i, r, e) => {
1962
- var f = e(551).LGraph;
1963
- function a(t, h, o) {
1964
- f.call(this, t, h, o);
1965
- }
1966
- a.prototype = Object.create(f.prototype);
1967
- for (var y in f)
1968
- a[y] = f[y];
1969
- i.exports = a;
1970
- }
1971
- ),
1972
- /***/
1973
- 578: (
1974
- /***/
1975
- (i, r, e) => {
1976
- var f = e(551).LGraphManager;
1977
- function a(t) {
1978
- f.call(this, t);
1979
- }
1980
- a.prototype = Object.create(f.prototype);
1981
- for (var y in f)
1982
- a[y] = f[y];
1983
- i.exports = a;
1984
- }
1985
- ),
1986
- /***/
1987
- 765: (
1988
- /***/
1989
- (i, r, e) => {
1990
- var f = e(551).FDLayout, a = e(578), y = e(880), t = e(991), h = e(767), o = e(806), c = e(902), l = e(551).FDLayoutConstants, T = e(551).LayoutConstants, g = e(551).Point, d = e(551).PointD, L = e(551).DimensionD, F = e(551).Layout, M = e(551).Integer, P = e(551).IGeometry, J = e(551).LGraph, V = e(551).Transform, Q = e(551).LinkedList;
1991
- function D() {
1992
- f.call(this), this.toBeTiled = {}, this.constraints = {};
1993
- }
1994
- D.prototype = Object.create(f.prototype);
1995
- for (var rt in f)
1996
- D[rt] = f[rt];
1997
- D.prototype.newGraphManager = function() {
1998
- var n = new a(this);
1999
- return this.graphManager = n, n;
2000
- }, D.prototype.newGraph = function(n) {
2001
- return new y(null, this.graphManager, n);
2002
- }, D.prototype.newNode = function(n) {
2003
- return new t(this.graphManager, n);
2004
- }, D.prototype.newEdge = function(n) {
2005
- return new h(null, null, n);
2006
- }, D.prototype.initParameters = function() {
2007
- f.prototype.initParameters.call(this, arguments), this.isSubLayout || (o.DEFAULT_EDGE_LENGTH < 10 ? this.idealEdgeLength = 10 : this.idealEdgeLength = o.DEFAULT_EDGE_LENGTH, this.useSmartIdealEdgeLengthCalculation = o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = l.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = l.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = l.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.prunedNodesAll = [], this.growTreeIterations = 0, this.afterGrowthIterations = 0, this.isTreeGrowing = !1, this.isGrowthFinished = !1);
2008
- }, D.prototype.initSpringEmbedder = function() {
2009
- f.prototype.initSpringEmbedder.call(this), this.coolingCycle = 0, this.maxCoolingCycle = this.maxIterations / l.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = 0.04, this.coolingAdjuster = 1;
2010
- }, D.prototype.layout = function() {
2011
- var n = T.DEFAULT_CREATE_BENDS_AS_NEEDED;
2012
- return n && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout();
2013
- }, D.prototype.classicLayout = function() {
2014
- if (this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(), this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity), this.calcNoOfChildrenForAllNodes(), this.graphManager.calcLowestCommonAncestors(), this.graphManager.calcInclusionTreeDepths(), this.graphManager.getRoot().calcEstimatedSize(), this.calcIdealEdgeLengths(), this.incremental) {
2015
- if (o.TREE_REDUCTION_ON_INCREMENTAL) {
2016
- this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
2017
- var m = new Set(this.getAllNodes()), v = this.nodesWithGravity.filter(function(I) {
2018
- return m.has(I);
2019
- });
2020
- this.graphManager.setAllNodesToApplyGravitation(v);
2021
- }
2022
- } else {
2023
- var n = this.getFlatForest();
2024
- if (n.length > 0)
2025
- this.positionNodesRadially(n);
2026
- else {
2027
- this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
2028
- var m = new Set(this.getAllNodes()), v = this.nodesWithGravity.filter(function(E) {
2029
- return m.has(E);
2030
- });
2031
- this.graphManager.setAllNodesToApplyGravitation(v), this.positionNodesRandomly();
2032
- }
2033
- }
2034
- return Object.keys(this.constraints).length > 0 && (c.handleConstraints(this), this.initConstraintVariables()), this.initSpringEmbedder(), o.APPLY_LAYOUT && this.runSpringEmbedder(), !0;
2035
- }, D.prototype.tick = function() {
2036
- if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished)
2037
- if (this.prunedNodesAll.length > 0)
2038
- this.isTreeGrowing = !0;
2039
- else
2040
- return !0;
2041
- if (this.totalIterations % l.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
2042
- if (this.isConverged())
2043
- if (this.prunedNodesAll.length > 0)
2044
- this.isTreeGrowing = !0;
2045
- else
2046
- return !0;
2047
- this.coolingCycle++, this.layoutQuality == 0 ? this.coolingAdjuster = this.coolingCycle : this.layoutQuality == 1 && (this.coolingAdjuster = this.coolingCycle / 3), this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature), this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
2048
- }
2049
- if (this.isTreeGrowing) {
2050
- if (this.growTreeIterations % 10 == 0)
2051
- if (this.prunedNodesAll.length > 0) {
2052
- this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation();
2053
- var n = new Set(this.getAllNodes()), m = this.nodesWithGravity.filter(function(p) {
2054
- return n.has(p);
2055
- });
2056
- this.graphManager.setAllNodesToApplyGravitation(m), this.graphManager.updateBounds(), this.updateGrid(), o.PURE_INCREMENTAL ? this.coolingFactor = l.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 : this.coolingFactor = l.DEFAULT_COOLING_FACTOR_INCREMENTAL;
2057
- } else
2058
- this.isTreeGrowing = !1, this.isGrowthFinished = !0;
2059
- this.growTreeIterations++;
2060
- }
2061
- if (this.isGrowthFinished) {
2062
- if (this.isConverged())
2063
- return !0;
2064
- this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), o.PURE_INCREMENTAL ? this.coolingFactor = l.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100) : this.coolingFactor = l.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++;
2065
- }
2066
- var v = !this.isTreeGrowing && !this.isGrowthFinished, E = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
2067
- return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(v, E), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1;
2068
- }, D.prototype.getPositionsData = function() {
2069
- for (var n = this.graphManager.getAllNodes(), m = {}, v = 0; v < n.length; v++) {
2070
- var E = n[v].rect, p = n[v].id;
2071
- m[p] = {
2072
- id: p,
2073
- x: E.getCenterX(),
2074
- y: E.getCenterY(),
2075
- w: E.width,
2076
- h: E.height
2077
- };
2078
- }
2079
- return m;
2080
- }, D.prototype.runSpringEmbedder = function() {
2081
- this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod;
2082
- var n = !1;
2083
- if (l.ANIMATE === "during")
2084
- this.emit("layoutstarted");
2085
- else {
2086
- for (; !n; )
2087
- n = this.tick();
2088
- this.graphManager.updateBounds();
2089
- }
2090
- }, D.prototype.moveNodes = function() {
2091
- for (var n = this.getAllNodes(), m, v = 0; v < n.length; v++)
2092
- m = n[v], m.calculateDisplacement();
2093
- Object.keys(this.constraints).length > 0 && this.updateDisplacements();
2094
- for (var v = 0; v < n.length; v++)
2095
- m = n[v], m.move();
2096
- }, D.prototype.initConstraintVariables = function() {
2097
- var n = this;
2098
- this.idToNodeMap = /* @__PURE__ */ new Map(), this.fixedNodeSet = /* @__PURE__ */ new Set();
2099
- for (var m = this.graphManager.getAllNodes(), v = 0; v < m.length; v++) {
2100
- var E = m[v];
2101
- this.idToNodeMap.set(E.id, E);
2102
- }
2103
- var p = function O(X) {
2104
- for (var B = X.getChild().getNodes(), _, lt = 0, q = 0; q < B.length; q++)
2105
- _ = B[q], _.getChild() == null ? n.fixedNodeSet.has(_.id) && (lt += 100) : lt += O(_);
2106
- return lt;
2107
- };
2108
- if (this.constraints.fixedNodeConstraint) {
2109
- this.constraints.fixedNodeConstraint.forEach(function(B) {
2110
- n.fixedNodeSet.add(B.nodeId);
2111
- });
2112
- for (var m = this.graphManager.getAllNodes(), E, v = 0; v < m.length; v++)
2113
- if (E = m[v], E.getChild() != null) {
2114
- var I = p(E);
2115
- I > 0 && (E.fixedNodeWeight = I);
2116
- }
2117
- }
2118
- if (this.constraints.relativePlacementConstraint) {
2119
- var w = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
2120
- if (this.dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map(), this.dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map(), this.fixedNodesOnHorizontal = /* @__PURE__ */ new Set(), this.fixedNodesOnVertical = /* @__PURE__ */ new Set(), this.fixedNodeSet.forEach(function(O) {
2121
- n.fixedNodesOnHorizontal.add(O), n.fixedNodesOnVertical.add(O);
2122
- }), this.constraints.alignmentConstraint) {
2123
- if (this.constraints.alignmentConstraint.vertical)
2124
- for (var H = this.constraints.alignmentConstraint.vertical, v = 0; v < H.length; v++)
2125
- this.dummyToNodeForVerticalAlignment.set("dummy" + v, []), H[v].forEach(function(X) {
2126
- w.set(X, "dummy" + v), n.dummyToNodeForVerticalAlignment.get("dummy" + v).push(X), n.fixedNodeSet.has(X) && n.fixedNodesOnHorizontal.add("dummy" + v);
2127
- });
2128
- if (this.constraints.alignmentConstraint.horizontal)
2129
- for (var x = this.constraints.alignmentConstraint.horizontal, v = 0; v < x.length; v++)
2130
- this.dummyToNodeForHorizontalAlignment.set("dummy" + v, []), x[v].forEach(function(X) {
2131
- R.set(X, "dummy" + v), n.dummyToNodeForHorizontalAlignment.get("dummy" + v).push(X), n.fixedNodeSet.has(X) && n.fixedNodesOnVertical.add("dummy" + v);
2132
- });
2133
- }
2134
- if (o.RELAX_MOVEMENT_ON_CONSTRAINTS)
2135
- this.shuffle = function(O) {
2136
- var X, B, _;
2137
- for (_ = O.length - 1; _ >= 2 * O.length / 3; _--)
2138
- X = Math.floor(Math.random() * (_ + 1)), B = O[_], O[_] = O[X], O[X] = B;
2139
- return O;
2140
- }, this.nodesInRelativeHorizontal = [], this.nodesInRelativeVertical = [], this.nodeToRelativeConstraintMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToRelativeConstraintMapVertical = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapVertical = /* @__PURE__ */ new Map(), this.constraints.relativePlacementConstraint.forEach(function(O) {
2141
- if (O.left) {
2142
- var X = w.has(O.left) ? w.get(O.left) : O.left, B = w.has(O.right) ? w.get(O.right) : O.right;
2143
- n.nodesInRelativeHorizontal.includes(X) || (n.nodesInRelativeHorizontal.push(X), n.nodeToRelativeConstraintMapHorizontal.set(X, []), n.dummyToNodeForVerticalAlignment.has(X) ? n.nodeToTempPositionMapHorizontal.set(X, n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()) : n.nodeToTempPositionMapHorizontal.set(X, n.idToNodeMap.get(X).getCenterX())), n.nodesInRelativeHorizontal.includes(B) || (n.nodesInRelativeHorizontal.push(B), n.nodeToRelativeConstraintMapHorizontal.set(B, []), n.dummyToNodeForVerticalAlignment.has(B) ? n.nodeToTempPositionMapHorizontal.set(B, n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(B)[0]).getCenterX()) : n.nodeToTempPositionMapHorizontal.set(B, n.idToNodeMap.get(B).getCenterX())), n.nodeToRelativeConstraintMapHorizontal.get(X).push({ right: B, gap: O.gap }), n.nodeToRelativeConstraintMapHorizontal.get(B).push({ left: X, gap: O.gap });
2144
- } else {
2145
- var _ = R.has(O.top) ? R.get(O.top) : O.top, lt = R.has(O.bottom) ? R.get(O.bottom) : O.bottom;
2146
- n.nodesInRelativeVertical.includes(_) || (n.nodesInRelativeVertical.push(_), n.nodeToRelativeConstraintMapVertical.set(_, []), n.dummyToNodeForHorizontalAlignment.has(_) ? n.nodeToTempPositionMapVertical.set(_, n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(_)[0]).getCenterY()) : n.nodeToTempPositionMapVertical.set(_, n.idToNodeMap.get(_).getCenterY())), n.nodesInRelativeVertical.includes(lt) || (n.nodesInRelativeVertical.push(lt), n.nodeToRelativeConstraintMapVertical.set(lt, []), n.dummyToNodeForHorizontalAlignment.has(lt) ? n.nodeToTempPositionMapVertical.set(lt, n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(lt)[0]).getCenterY()) : n.nodeToTempPositionMapVertical.set(lt, n.idToNodeMap.get(lt).getCenterY())), n.nodeToRelativeConstraintMapVertical.get(_).push({ bottom: lt, gap: O.gap }), n.nodeToRelativeConstraintMapVertical.get(lt).push({ top: _, gap: O.gap });
2147
- }
2148
- });
2149
- else {
2150
- var k = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map();
2151
- this.constraints.relativePlacementConstraint.forEach(function(O) {
2152
- if (O.left) {
2153
- var X = w.has(O.left) ? w.get(O.left) : O.left, B = w.has(O.right) ? w.get(O.right) : O.right;
2154
- k.has(X) ? k.get(X).push(B) : k.set(X, [B]), k.has(B) ? k.get(B).push(X) : k.set(B, [X]);
2155
- } else {
2156
- var _ = R.has(O.top) ? R.get(O.top) : O.top, lt = R.has(O.bottom) ? R.get(O.bottom) : O.bottom;
2157
- W.has(_) ? W.get(_).push(lt) : W.set(_, [lt]), W.has(lt) ? W.get(lt).push(_) : W.set(lt, [_]);
2158
- }
2159
- });
2160
- var U = function(X, B) {
2161
- var _ = [], lt = [], q = new Q(), Rt = /* @__PURE__ */ new Set(), Lt = 0;
2162
- return X.forEach(function(vt, it) {
2163
- if (!Rt.has(it)) {
2164
- _[Lt] = [], lt[Lt] = !1;
2165
- var gt = it;
2166
- for (q.push(gt), Rt.add(gt), _[Lt].push(gt); q.length != 0; ) {
2167
- gt = q.shift(), B.has(gt) && (lt[Lt] = !0);
2168
- var Tt = X.get(gt);
2169
- Tt.forEach(function(At) {
2170
- Rt.has(At) || (q.push(At), Rt.add(At), _[Lt].push(At));
2171
- });
2172
- }
2173
- Lt++;
2174
- }
2175
- }), { components: _, isFixed: lt };
2176
- }, et = U(k, n.fixedNodesOnHorizontal);
2177
- this.componentsOnHorizontal = et.components, this.fixedComponentsOnHorizontal = et.isFixed;
2178
- var z = U(W, n.fixedNodesOnVertical);
2179
- this.componentsOnVertical = z.components, this.fixedComponentsOnVertical = z.isFixed;
2180
- }
2181
- }
2182
- }, D.prototype.updateDisplacements = function() {
2183
- var n = this;
2184
- if (this.constraints.fixedNodeConstraint && this.constraints.fixedNodeConstraint.forEach(function(z) {
2185
- var O = n.idToNodeMap.get(z.nodeId);
2186
- O.displacementX = 0, O.displacementY = 0;
2187
- }), this.constraints.alignmentConstraint) {
2188
- if (this.constraints.alignmentConstraint.vertical)
2189
- for (var m = this.constraints.alignmentConstraint.vertical, v = 0; v < m.length; v++) {
2190
- for (var E = 0, p = 0; p < m[v].length; p++) {
2191
- if (this.fixedNodeSet.has(m[v][p])) {
2192
- E = 0;
2193
- break;
2194
- }
2195
- E += this.idToNodeMap.get(m[v][p]).displacementX;
2196
- }
2197
- for (var I = E / m[v].length, p = 0; p < m[v].length; p++)
2198
- this.idToNodeMap.get(m[v][p]).displacementX = I;
2199
- }
2200
- if (this.constraints.alignmentConstraint.horizontal)
2201
- for (var w = this.constraints.alignmentConstraint.horizontal, v = 0; v < w.length; v++) {
2202
- for (var R = 0, p = 0; p < w[v].length; p++) {
2203
- if (this.fixedNodeSet.has(w[v][p])) {
2204
- R = 0;
2205
- break;
2206
- }
2207
- R += this.idToNodeMap.get(w[v][p]).displacementY;
2208
- }
2209
- for (var H = R / w[v].length, p = 0; p < w[v].length; p++)
2210
- this.idToNodeMap.get(w[v][p]).displacementY = H;
2211
- }
2212
- }
2213
- if (this.constraints.relativePlacementConstraint)
2214
- if (o.RELAX_MOVEMENT_ON_CONSTRAINTS)
2215
- this.totalIterations % 10 == 0 && (this.shuffle(this.nodesInRelativeHorizontal), this.shuffle(this.nodesInRelativeVertical)), this.nodesInRelativeHorizontal.forEach(function(z) {
2216
- if (!n.fixedNodesOnHorizontal.has(z)) {
2217
- var O = 0;
2218
- n.dummyToNodeForVerticalAlignment.has(z) ? O = n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(z)[0]).displacementX : O = n.idToNodeMap.get(z).displacementX, n.nodeToRelativeConstraintMapHorizontal.get(z).forEach(function(X) {
2219
- if (X.right) {
2220
- var B = n.nodeToTempPositionMapHorizontal.get(X.right) - n.nodeToTempPositionMapHorizontal.get(z) - O;
2221
- B < X.gap && (O -= X.gap - B);
2222
- } else {
2223
- var B = n.nodeToTempPositionMapHorizontal.get(z) - n.nodeToTempPositionMapHorizontal.get(X.left) + O;
2224
- B < X.gap && (O += X.gap - B);
2225
- }
2226
- }), n.nodeToTempPositionMapHorizontal.set(z, n.nodeToTempPositionMapHorizontal.get(z) + O), n.dummyToNodeForVerticalAlignment.has(z) ? n.dummyToNodeForVerticalAlignment.get(z).forEach(function(X) {
2227
- n.idToNodeMap.get(X).displacementX = O;
2228
- }) : n.idToNodeMap.get(z).displacementX = O;
2229
- }
2230
- }), this.nodesInRelativeVertical.forEach(function(z) {
2231
- if (!n.fixedNodesOnHorizontal.has(z)) {
2232
- var O = 0;
2233
- n.dummyToNodeForHorizontalAlignment.has(z) ? O = n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(z)[0]).displacementY : O = n.idToNodeMap.get(z).displacementY, n.nodeToRelativeConstraintMapVertical.get(z).forEach(function(X) {
2234
- if (X.bottom) {
2235
- var B = n.nodeToTempPositionMapVertical.get(X.bottom) - n.nodeToTempPositionMapVertical.get(z) - O;
2236
- B < X.gap && (O -= X.gap - B);
2237
- } else {
2238
- var B = n.nodeToTempPositionMapVertical.get(z) - n.nodeToTempPositionMapVertical.get(X.top) + O;
2239
- B < X.gap && (O += X.gap - B);
2240
- }
2241
- }), n.nodeToTempPositionMapVertical.set(z, n.nodeToTempPositionMapVertical.get(z) + O), n.dummyToNodeForHorizontalAlignment.has(z) ? n.dummyToNodeForHorizontalAlignment.get(z).forEach(function(X) {
2242
- n.idToNodeMap.get(X).displacementY = O;
2243
- }) : n.idToNodeMap.get(z).displacementY = O;
2244
- }
2245
- });
2246
- else {
2247
- for (var v = 0; v < this.componentsOnHorizontal.length; v++) {
2248
- var x = this.componentsOnHorizontal[v];
2249
- if (this.fixedComponentsOnHorizontal[v])
2250
- for (var p = 0; p < x.length; p++)
2251
- this.dummyToNodeForVerticalAlignment.has(x[p]) ? this.dummyToNodeForVerticalAlignment.get(x[p]).forEach(function(X) {
2252
- n.idToNodeMap.get(X).displacementX = 0;
2253
- }) : this.idToNodeMap.get(x[p]).displacementX = 0;
2254
- else {
2255
- for (var k = 0, W = 0, p = 0; p < x.length; p++)
2256
- if (this.dummyToNodeForVerticalAlignment.has(x[p])) {
2257
- var U = this.dummyToNodeForVerticalAlignment.get(x[p]);
2258
- k += U.length * this.idToNodeMap.get(U[0]).displacementX, W += U.length;
2259
- } else
2260
- k += this.idToNodeMap.get(x[p]).displacementX, W++;
2261
- for (var et = k / W, p = 0; p < x.length; p++)
2262
- this.dummyToNodeForVerticalAlignment.has(x[p]) ? this.dummyToNodeForVerticalAlignment.get(x[p]).forEach(function(X) {
2263
- n.idToNodeMap.get(X).displacementX = et;
2264
- }) : this.idToNodeMap.get(x[p]).displacementX = et;
2265
- }
2266
- }
2267
- for (var v = 0; v < this.componentsOnVertical.length; v++) {
2268
- var x = this.componentsOnVertical[v];
2269
- if (this.fixedComponentsOnVertical[v])
2270
- for (var p = 0; p < x.length; p++)
2271
- this.dummyToNodeForHorizontalAlignment.has(x[p]) ? this.dummyToNodeForHorizontalAlignment.get(x[p]).forEach(function(B) {
2272
- n.idToNodeMap.get(B).displacementY = 0;
2273
- }) : this.idToNodeMap.get(x[p]).displacementY = 0;
2274
- else {
2275
- for (var k = 0, W = 0, p = 0; p < x.length; p++)
2276
- if (this.dummyToNodeForHorizontalAlignment.has(x[p])) {
2277
- var U = this.dummyToNodeForHorizontalAlignment.get(x[p]);
2278
- k += U.length * this.idToNodeMap.get(U[0]).displacementY, W += U.length;
2279
- } else
2280
- k += this.idToNodeMap.get(x[p]).displacementY, W++;
2281
- for (var et = k / W, p = 0; p < x.length; p++)
2282
- this.dummyToNodeForHorizontalAlignment.has(x[p]) ? this.dummyToNodeForHorizontalAlignment.get(x[p]).forEach(function(q) {
2283
- n.idToNodeMap.get(q).displacementY = et;
2284
- }) : this.idToNodeMap.get(x[p]).displacementY = et;
2285
- }
2286
- }
2287
- }
2288
- }, D.prototype.calculateNodesToApplyGravitationTo = function() {
2289
- var n = [], m, v = this.graphManager.getGraphs(), E = v.length, p;
2290
- for (p = 0; p < E; p++)
2291
- m = v[p], m.updateConnected(), m.isConnected || (n = n.concat(m.getNodes()));
2292
- return n;
2293
- }, D.prototype.createBendpoints = function() {
2294
- var n = [];
2295
- n = n.concat(this.graphManager.getAllEdges());
2296
- var m = /* @__PURE__ */ new Set(), v;
2297
- for (v = 0; v < n.length; v++) {
2298
- var E = n[v];
2299
- if (!m.has(E)) {
2300
- var p = E.getSource(), I = E.getTarget();
2301
- if (p == I)
2302
- E.getBendpoints().push(new d()), E.getBendpoints().push(new d()), this.createDummyNodesForBendpoints(E), m.add(E);
2303
- else {
2304
- var w = [];
2305
- if (w = w.concat(p.getEdgeListToNode(I)), w = w.concat(I.getEdgeListToNode(p)), !m.has(w[0])) {
2306
- if (w.length > 1) {
2307
- var R;
2308
- for (R = 0; R < w.length; R++) {
2309
- var H = w[R];
2310
- H.getBendpoints().push(new d()), this.createDummyNodesForBendpoints(H);
2311
- }
2312
- }
2313
- w.forEach(function(x) {
2314
- m.add(x);
2315
- });
2316
- }
2317
- }
2318
- }
2319
- if (m.size == n.length)
2320
- break;
2321
- }
2322
- }, D.prototype.positionNodesRadially = function(n) {
2323
- for (var m = new g(0, 0), v = Math.ceil(Math.sqrt(n.length)), E = 0, p = 0, I = 0, w = new d(0, 0), R = 0; R < n.length; R++) {
2324
- R % v == 0 && (I = 0, p = E, R != 0 && (p += o.DEFAULT_COMPONENT_SEPERATION), E = 0);
2325
- var H = n[R], x = F.findCenterOfTree(H);
2326
- m.x = I, m.y = p, w = D.radialLayout(H, x, m), w.y > E && (E = Math.floor(w.y)), I = Math.floor(w.x + o.DEFAULT_COMPONENT_SEPERATION);
2327
- }
2328
- this.transform(new d(T.WORLD_CENTER_X - w.x / 2, T.WORLD_CENTER_Y - w.y / 2));
2329
- }, D.radialLayout = function(n, m, v) {
2330
- var E = Math.max(this.maxDiagonalInTree(n), o.DEFAULT_RADIAL_SEPARATION);
2331
- D.branchRadialLayout(m, null, 0, 359, 0, E);
2332
- var p = J.calculateBounds(n), I = new V();
2333
- I.setDeviceOrgX(p.getMinX()), I.setDeviceOrgY(p.getMinY()), I.setWorldOrgX(v.x), I.setWorldOrgY(v.y);
2334
- for (var w = 0; w < n.length; w++) {
2335
- var R = n[w];
2336
- R.transform(I);
2337
- }
2338
- var H = new d(p.getMaxX(), p.getMaxY());
2339
- return I.inverseTransformPoint(H);
2340
- }, D.branchRadialLayout = function(n, m, v, E, p, I) {
2341
- var w = (E - v + 1) / 2;
2342
- w < 0 && (w += 180);
2343
- var R = (w + v) % 360, H = R * P.TWO_PI / 360, x = p * Math.cos(H), k = p * Math.sin(H);
2344
- n.setCenter(x, k);
2345
- var W = [];
2346
- W = W.concat(n.getEdges());
2347
- var U = W.length;
2348
- m != null && U--;
2349
- for (var et = 0, z = W.length, O, X = n.getEdgesBetween(m); X.length > 1; ) {
2350
- var B = X[0];
2351
- X.splice(0, 1);
2352
- var _ = W.indexOf(B);
2353
- _ >= 0 && W.splice(_, 1), z--, U--;
2354
- }
2355
- m != null ? O = (W.indexOf(X[0]) + 1) % z : O = 0;
2356
- for (var lt = Math.abs(E - v) / U, q = O; et != U; q = ++q % z) {
2357
- var Rt = W[q].getOtherEnd(n);
2358
- if (Rt != m) {
2359
- var Lt = (v + et * lt) % 360, vt = (Lt + lt) % 360;
2360
- D.branchRadialLayout(Rt, n, Lt, vt, p + I, I), et++;
2361
- }
2362
- }
2363
- }, D.maxDiagonalInTree = function(n) {
2364
- for (var m = M.MIN_VALUE, v = 0; v < n.length; v++) {
2365
- var E = n[v], p = E.getDiagonal();
2366
- p > m && (m = p);
2367
- }
2368
- return m;
2369
- }, D.prototype.calcRepulsionRange = function() {
2370
- return 2 * (this.level + 1) * this.idealEdgeLength;
2371
- }, D.prototype.groupZeroDegreeMembers = function() {
2372
- var n = this, m = {};
2373
- this.memberGroups = {}, this.idToDummyNode = {};
2374
- for (var v = [], E = this.graphManager.getAllNodes(), p = 0; p < E.length; p++) {
2375
- var I = E[p], w = I.getParent();
2376
- this.getNodeDegreeWithChildren(I) === 0 && (w.id == null || !this.getToBeTiled(w)) && v.push(I);
2377
- }
2378
- for (var p = 0; p < v.length; p++) {
2379
- var I = v[p], R = I.getParent().id;
2380
- typeof m[R] > "u" && (m[R] = []), m[R] = m[R].concat(I);
2381
- }
2382
- Object.keys(m).forEach(function(H) {
2383
- if (m[H].length > 1) {
2384
- var x = "DummyCompound_" + H;
2385
- n.memberGroups[x] = m[H];
2386
- var k = m[H][0].getParent(), W = new t(n.graphManager);
2387
- W.id = x, W.paddingLeft = k.paddingLeft || 0, W.paddingRight = k.paddingRight || 0, W.paddingBottom = k.paddingBottom || 0, W.paddingTop = k.paddingTop || 0, n.idToDummyNode[x] = W;
2388
- var U = n.getGraphManager().add(n.newGraph(), W), et = k.getChild();
2389
- et.add(W);
2390
- for (var z = 0; z < m[H].length; z++) {
2391
- var O = m[H][z];
2392
- et.remove(O), U.add(O);
2393
- }
2394
- }
2395
- });
2396
- }, D.prototype.clearCompounds = function() {
2397
- var n = {}, m = {};
2398
- this.performDFSOnCompounds();
2399
- for (var v = 0; v < this.compoundOrder.length; v++)
2400
- m[this.compoundOrder[v].id] = this.compoundOrder[v], n[this.compoundOrder[v].id] = [].concat(this.compoundOrder[v].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[v].getChild()), this.compoundOrder[v].child = null;
2401
- this.graphManager.resetAllNodes(), this.tileCompoundMembers(n, m);
2402
- }, D.prototype.clearZeroDegreeMembers = function() {
2403
- var n = this, m = this.tiledZeroDegreePack = [];
2404
- Object.keys(this.memberGroups).forEach(function(v) {
2405
- var E = n.idToDummyNode[v];
2406
- if (m[v] = n.tileNodes(n.memberGroups[v], E.paddingLeft + E.paddingRight), E.rect.width = m[v].width, E.rect.height = m[v].height, E.setCenter(m[v].centerX, m[v].centerY), E.labelMarginLeft = 0, E.labelMarginTop = 0, o.NODE_DIMENSIONS_INCLUDE_LABELS) {
2407
- var p = E.rect.width, I = E.rect.height;
2408
- E.labelWidth && (E.labelPosHorizontal == "left" ? (E.rect.x -= E.labelWidth, E.setWidth(p + E.labelWidth), E.labelMarginLeft = E.labelWidth) : E.labelPosHorizontal == "center" && E.labelWidth > p ? (E.rect.x -= (E.labelWidth - p) / 2, E.setWidth(E.labelWidth), E.labelMarginLeft = (E.labelWidth - p) / 2) : E.labelPosHorizontal == "right" && E.setWidth(p + E.labelWidth)), E.labelHeight && (E.labelPosVertical == "top" ? (E.rect.y -= E.labelHeight, E.setHeight(I + E.labelHeight), E.labelMarginTop = E.labelHeight) : E.labelPosVertical == "center" && E.labelHeight > I ? (E.rect.y -= (E.labelHeight - I) / 2, E.setHeight(E.labelHeight), E.labelMarginTop = (E.labelHeight - I) / 2) : E.labelPosVertical == "bottom" && E.setHeight(I + E.labelHeight));
2409
- }
2410
- });
2411
- }, D.prototype.repopulateCompounds = function() {
2412
- for (var n = this.compoundOrder.length - 1; n >= 0; n--) {
2413
- var m = this.compoundOrder[n], v = m.id, E = m.paddingLeft, p = m.paddingTop, I = m.labelMarginLeft, w = m.labelMarginTop;
2414
- this.adjustLocations(this.tiledMemberPack[v], m.rect.x, m.rect.y, E, p, I, w);
2415
- }
2416
- }, D.prototype.repopulateZeroDegreeMembers = function() {
2417
- var n = this, m = this.tiledZeroDegreePack;
2418
- Object.keys(m).forEach(function(v) {
2419
- var E = n.idToDummyNode[v], p = E.paddingLeft, I = E.paddingTop, w = E.labelMarginLeft, R = E.labelMarginTop;
2420
- n.adjustLocations(m[v], E.rect.x, E.rect.y, p, I, w, R);
2421
- });
2422
- }, D.prototype.getToBeTiled = function(n) {
2423
- var m = n.id;
2424
- if (this.toBeTiled[m] != null)
2425
- return this.toBeTiled[m];
2426
- var v = n.getChild();
2427
- if (v == null)
2428
- return this.toBeTiled[m] = !1, !1;
2429
- for (var E = v.getNodes(), p = 0; p < E.length; p++) {
2430
- var I = E[p];
2431
- if (this.getNodeDegree(I) > 0)
2432
- return this.toBeTiled[m] = !1, !1;
2433
- if (I.getChild() == null) {
2434
- this.toBeTiled[I.id] = !1;
2435
- continue;
2436
- }
2437
- if (!this.getToBeTiled(I))
2438
- return this.toBeTiled[m] = !1, !1;
2439
- }
2440
- return this.toBeTiled[m] = !0, !0;
2441
- }, D.prototype.getNodeDegree = function(n) {
2442
- n.id;
2443
- for (var m = n.getEdges(), v = 0, E = 0; E < m.length; E++) {
2444
- var p = m[E];
2445
- p.getSource().id !== p.getTarget().id && (v = v + 1);
2446
- }
2447
- return v;
2448
- }, D.prototype.getNodeDegreeWithChildren = function(n) {
2449
- var m = this.getNodeDegree(n);
2450
- if (n.getChild() == null)
2451
- return m;
2452
- for (var v = n.getChild().getNodes(), E = 0; E < v.length; E++) {
2453
- var p = v[E];
2454
- m += this.getNodeDegreeWithChildren(p);
2455
- }
2456
- return m;
2457
- }, D.prototype.performDFSOnCompounds = function() {
2458
- this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
2459
- }, D.prototype.fillCompexOrderByDFS = function(n) {
2460
- for (var m = 0; m < n.length; m++) {
2461
- var v = n[m];
2462
- v.getChild() != null && this.fillCompexOrderByDFS(v.getChild().getNodes()), this.getToBeTiled(v) && this.compoundOrder.push(v);
2463
- }
2464
- }, D.prototype.adjustLocations = function(n, m, v, E, p, I, w) {
2465
- m += E + I, v += p + w;
2466
- for (var R = m, H = 0; H < n.rows.length; H++) {
2467
- var x = n.rows[H];
2468
- m = R;
2469
- for (var k = 0, W = 0; W < x.length; W++) {
2470
- var U = x[W];
2471
- U.rect.x = m, U.rect.y = v, m += U.rect.width + n.horizontalPadding, U.rect.height > k && (k = U.rect.height);
2472
- }
2473
- v += k + n.verticalPadding;
2474
- }
2475
- }, D.prototype.tileCompoundMembers = function(n, m) {
2476
- var v = this;
2477
- this.tiledMemberPack = [], Object.keys(n).forEach(function(E) {
2478
- var p = m[E];
2479
- if (v.tiledMemberPack[E] = v.tileNodes(n[E], p.paddingLeft + p.paddingRight), p.rect.width = v.tiledMemberPack[E].width, p.rect.height = v.tiledMemberPack[E].height, p.setCenter(v.tiledMemberPack[E].centerX, v.tiledMemberPack[E].centerY), p.labelMarginLeft = 0, p.labelMarginTop = 0, o.NODE_DIMENSIONS_INCLUDE_LABELS) {
2480
- var I = p.rect.width, w = p.rect.height;
2481
- p.labelWidth && (p.labelPosHorizontal == "left" ? (p.rect.x -= p.labelWidth, p.setWidth(I + p.labelWidth), p.labelMarginLeft = p.labelWidth) : p.labelPosHorizontal == "center" && p.labelWidth > I ? (p.rect.x -= (p.labelWidth - I) / 2, p.setWidth(p.labelWidth), p.labelMarginLeft = (p.labelWidth - I) / 2) : p.labelPosHorizontal == "right" && p.setWidth(I + p.labelWidth)), p.labelHeight && (p.labelPosVertical == "top" ? (p.rect.y -= p.labelHeight, p.setHeight(w + p.labelHeight), p.labelMarginTop = p.labelHeight) : p.labelPosVertical == "center" && p.labelHeight > w ? (p.rect.y -= (p.labelHeight - w) / 2, p.setHeight(p.labelHeight), p.labelMarginTop = (p.labelHeight - w) / 2) : p.labelPosVertical == "bottom" && p.setHeight(w + p.labelHeight));
2482
- }
2483
- });
2484
- }, D.prototype.tileNodes = function(n, m) {
2485
- var v = this.tileNodesByFavoringDim(n, m, !0), E = this.tileNodesByFavoringDim(n, m, !1), p = this.getOrgRatio(v), I = this.getOrgRatio(E), w;
2486
- return I < p ? w = E : w = v, w;
2487
- }, D.prototype.getOrgRatio = function(n) {
2488
- var m = n.width, v = n.height, E = m / v;
2489
- return E < 1 && (E = 1 / E), E;
2490
- }, D.prototype.calcIdealRowWidth = function(n, m) {
2491
- var v = o.TILING_PADDING_VERTICAL, E = o.TILING_PADDING_HORIZONTAL, p = n.length, I = 0, w = 0, R = 0;
2492
- n.forEach(function(z) {
2493
- I += z.getWidth(), w += z.getHeight(), z.getWidth() > R && (R = z.getWidth());
2494
- });
2495
- var H = I / p, x = w / p, k = Math.pow(v - E, 2) + 4 * (H + E) * (x + v) * p, W = (E - v + Math.sqrt(k)) / (2 * (H + E)), U;
2496
- m ? (U = Math.ceil(W), U == W && U++) : U = Math.floor(W);
2497
- var et = U * (H + E) - E;
2498
- return R > et && (et = R), et += E * 2, et;
2499
- }, D.prototype.tileNodesByFavoringDim = function(n, m, v) {
2500
- var E = o.TILING_PADDING_VERTICAL, p = o.TILING_PADDING_HORIZONTAL, I = o.TILING_COMPARE_BY, w = {
2501
- rows: [],
2502
- rowWidth: [],
2503
- rowHeight: [],
2504
- width: 0,
2505
- height: m,
2506
- // assume minHeight equals to minWidth
2507
- verticalPadding: E,
2508
- horizontalPadding: p,
2509
- centerX: 0,
2510
- centerY: 0
2511
- };
2512
- I && (w.idealRowWidth = this.calcIdealRowWidth(n, v));
2513
- var R = function(O) {
2514
- return O.rect.width * O.rect.height;
2515
- }, H = function(O, X) {
2516
- return R(X) - R(O);
2517
- };
2518
- n.sort(function(z, O) {
2519
- var X = H;
2520
- return w.idealRowWidth ? (X = I, X(z.id, O.id)) : X(z, O);
2521
- });
2522
- for (var x = 0, k = 0, W = 0; W < n.length; W++) {
2523
- var U = n[W];
2524
- x += U.getCenterX(), k += U.getCenterY();
2525
- }
2526
- w.centerX = x / n.length, w.centerY = k / n.length;
2527
- for (var W = 0; W < n.length; W++) {
2528
- var U = n[W];
2529
- if (w.rows.length == 0)
2530
- this.insertNodeToRow(w, U, 0, m);
2531
- else if (this.canAddHorizontal(w, U.rect.width, U.rect.height)) {
2532
- var et = w.rows.length - 1;
2533
- w.idealRowWidth || (et = this.getShortestRowIndex(w)), this.insertNodeToRow(w, U, et, m);
2534
- } else
2535
- this.insertNodeToRow(w, U, w.rows.length, m);
2536
- this.shiftToLastRow(w);
2537
- }
2538
- return w;
2539
- }, D.prototype.insertNodeToRow = function(n, m, v, E) {
2540
- var p = E;
2541
- if (v == n.rows.length) {
2542
- var I = [];
2543
- n.rows.push(I), n.rowWidth.push(p), n.rowHeight.push(0);
2544
- }
2545
- var w = n.rowWidth[v] + m.rect.width;
2546
- n.rows[v].length > 0 && (w += n.horizontalPadding), n.rowWidth[v] = w, n.width < w && (n.width = w);
2547
- var R = m.rect.height;
2548
- v > 0 && (R += n.verticalPadding);
2549
- var H = 0;
2550
- R > n.rowHeight[v] && (H = n.rowHeight[v], n.rowHeight[v] = R, H = n.rowHeight[v] - H), n.height += H, n.rows[v].push(m);
2551
- }, D.prototype.getShortestRowIndex = function(n) {
2552
- for (var m = -1, v = Number.MAX_VALUE, E = 0; E < n.rows.length; E++)
2553
- n.rowWidth[E] < v && (m = E, v = n.rowWidth[E]);
2554
- return m;
2555
- }, D.prototype.getLongestRowIndex = function(n) {
2556
- for (var m = -1, v = Number.MIN_VALUE, E = 0; E < n.rows.length; E++)
2557
- n.rowWidth[E] > v && (m = E, v = n.rowWidth[E]);
2558
- return m;
2559
- }, D.prototype.canAddHorizontal = function(n, m, v) {
2560
- if (n.idealRowWidth) {
2561
- var E = n.rows.length - 1, p = n.rowWidth[E];
2562
- return p + m + n.horizontalPadding <= n.idealRowWidth;
2563
- }
2564
- var I = this.getShortestRowIndex(n);
2565
- if (I < 0)
2566
- return !0;
2567
- var w = n.rowWidth[I];
2568
- if (w + n.horizontalPadding + m <= n.width) return !0;
2569
- var R = 0;
2570
- n.rowHeight[I] < v && I > 0 && (R = v + n.verticalPadding - n.rowHeight[I]);
2571
- var H;
2572
- n.width - w >= m + n.horizontalPadding ? H = (n.height + R) / (w + m + n.horizontalPadding) : H = (n.height + R) / n.width, R = v + n.verticalPadding;
2573
- var x;
2574
- return n.width < m ? x = (n.height + R) / m : x = (n.height + R) / n.width, x < 1 && (x = 1 / x), H < 1 && (H = 1 / H), H < x;
2575
- }, D.prototype.shiftToLastRow = function(n) {
2576
- var m = this.getLongestRowIndex(n), v = n.rowWidth.length - 1, E = n.rows[m], p = E[E.length - 1], I = p.width + n.horizontalPadding;
2577
- if (n.width - n.rowWidth[v] > I && m != v) {
2578
- E.splice(-1, 1), n.rows[v].push(p), n.rowWidth[m] = n.rowWidth[m] - I, n.rowWidth[v] = n.rowWidth[v] + I, n.width = n.rowWidth[instance.getLongestRowIndex(n)];
2579
- for (var w = Number.MIN_VALUE, R = 0; R < E.length; R++)
2580
- E[R].height > w && (w = E[R].height);
2581
- m > 0 && (w += n.verticalPadding);
2582
- var H = n.rowHeight[m] + n.rowHeight[v];
2583
- n.rowHeight[m] = w, n.rowHeight[v] < p.height + n.verticalPadding && (n.rowHeight[v] = p.height + n.verticalPadding);
2584
- var x = n.rowHeight[m] + n.rowHeight[v];
2585
- n.height += x - H, this.shiftToLastRow(n);
2586
- }
2587
- }, D.prototype.tilingPreLayout = function() {
2588
- o.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers());
2589
- }, D.prototype.tilingPostLayout = function() {
2590
- o.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds());
2591
- }, D.prototype.reduceTrees = function() {
2592
- for (var n = [], m = !0, v; m; ) {
2593
- var E = this.graphManager.getAllNodes(), p = [];
2594
- m = !1;
2595
- for (var I = 0; I < E.length; I++)
2596
- if (v = E[I], v.getEdges().length == 1 && !v.getEdges()[0].isInterGraph && v.getChild() == null) {
2597
- if (o.PURE_INCREMENTAL) {
2598
- var w = v.getEdges()[0].getOtherEnd(v), R = new L(v.getCenterX() - w.getCenterX(), v.getCenterY() - w.getCenterY());
2599
- p.push([v, v.getEdges()[0], v.getOwner(), R]);
2600
- } else
2601
- p.push([v, v.getEdges()[0], v.getOwner()]);
2602
- m = !0;
2603
- }
2604
- if (m == !0) {
2605
- for (var H = [], x = 0; x < p.length; x++)
2606
- p[x][0].getEdges().length == 1 && (H.push(p[x]), p[x][0].getOwner().remove(p[x][0]));
2607
- n.push(H), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
2608
- }
2609
- }
2610
- this.prunedNodesAll = n;
2611
- }, D.prototype.growTree = function(n) {
2612
- for (var m = n.length, v = n[m - 1], E, p = 0; p < v.length; p++)
2613
- E = v[p], this.findPlaceforPrunedNode(E), E[2].add(E[0]), E[2].add(E[1], E[1].source, E[1].target);
2614
- n.splice(n.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
2615
- }, D.prototype.findPlaceforPrunedNode = function(n) {
2616
- var m, v, E = n[0];
2617
- if (E == n[1].source ? v = n[1].target : v = n[1].source, o.PURE_INCREMENTAL)
2618
- E.setCenter(v.getCenterX() + n[3].getWidth(), v.getCenterY() + n[3].getHeight());
2619
- else {
2620
- var p = v.startX, I = v.finishX, w = v.startY, R = v.finishY, H = 0, x = 0, k = 0, W = 0, U = [H, k, x, W];
2621
- if (w > 0)
2622
- for (var et = p; et <= I; et++)
2623
- U[0] += this.grid[et][w - 1].length + this.grid[et][w].length - 1;
2624
- if (I < this.grid.length - 1)
2625
- for (var et = w; et <= R; et++)
2626
- U[1] += this.grid[I + 1][et].length + this.grid[I][et].length - 1;
2627
- if (R < this.grid[0].length - 1)
2628
- for (var et = p; et <= I; et++)
2629
- U[2] += this.grid[et][R + 1].length + this.grid[et][R].length - 1;
2630
- if (p > 0)
2631
- for (var et = w; et <= R; et++)
2632
- U[3] += this.grid[p - 1][et].length + this.grid[p][et].length - 1;
2633
- for (var z = M.MAX_VALUE, O, X, B = 0; B < U.length; B++)
2634
- U[B] < z ? (z = U[B], O = 1, X = B) : U[B] == z && O++;
2635
- if (O == 3 && z == 0)
2636
- U[0] == 0 && U[1] == 0 && U[2] == 0 ? m = 1 : U[0] == 0 && U[1] == 0 && U[3] == 0 ? m = 0 : U[0] == 0 && U[2] == 0 && U[3] == 0 ? m = 3 : U[1] == 0 && U[2] == 0 && U[3] == 0 && (m = 2);
2637
- else if (O == 2 && z == 0) {
2638
- var _ = Math.floor(Math.random() * 2);
2639
- U[0] == 0 && U[1] == 0 ? _ == 0 ? m = 0 : m = 1 : U[0] == 0 && U[2] == 0 ? _ == 0 ? m = 0 : m = 2 : U[0] == 0 && U[3] == 0 ? _ == 0 ? m = 0 : m = 3 : U[1] == 0 && U[2] == 0 ? _ == 0 ? m = 1 : m = 2 : U[1] == 0 && U[3] == 0 ? _ == 0 ? m = 1 : m = 3 : _ == 0 ? m = 2 : m = 3;
2640
- } else if (O == 4 && z == 0) {
2641
- var _ = Math.floor(Math.random() * 4);
2642
- m = _;
2643
- } else
2644
- m = X;
2645
- m == 0 ? E.setCenter(v.getCenterX(), v.getCenterY() - v.getHeight() / 2 - l.DEFAULT_EDGE_LENGTH - E.getHeight() / 2) : m == 1 ? E.setCenter(v.getCenterX() + v.getWidth() / 2 + l.DEFAULT_EDGE_LENGTH + E.getWidth() / 2, v.getCenterY()) : m == 2 ? E.setCenter(v.getCenterX(), v.getCenterY() + v.getHeight() / 2 + l.DEFAULT_EDGE_LENGTH + E.getHeight() / 2) : E.setCenter(v.getCenterX() - v.getWidth() / 2 - l.DEFAULT_EDGE_LENGTH - E.getWidth() / 2, v.getCenterY());
2646
- }
2647
- }, i.exports = D;
2648
- }
2649
- ),
2650
- /***/
2651
- 991: (
2652
- /***/
2653
- (i, r, e) => {
2654
- var f = e(551).FDLayoutNode, a = e(551).IMath;
2655
- function y(h, o, c, l) {
2656
- f.call(this, h, o, c, l);
2657
- }
2658
- y.prototype = Object.create(f.prototype);
2659
- for (var t in f)
2660
- y[t] = f[t];
2661
- y.prototype.calculateDisplacement = function() {
2662
- var h = this.graphManager.getLayout();
2663
- this.getChild() != null && this.fixedNodeWeight ? (this.displacementX += h.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight, this.displacementY += h.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight) : (this.displacementX += h.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY += h.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren), Math.abs(this.displacementX) > h.coolingFactor * h.maxNodeDisplacement && (this.displacementX = h.coolingFactor * h.maxNodeDisplacement * a.sign(this.displacementX)), Math.abs(this.displacementY) > h.coolingFactor * h.maxNodeDisplacement && (this.displacementY = h.coolingFactor * h.maxNodeDisplacement * a.sign(this.displacementY)), this.child && this.child.getNodes().length > 0 && this.propogateDisplacementToChildren(this.displacementX, this.displacementY);
2664
- }, y.prototype.propogateDisplacementToChildren = function(h, o) {
2665
- for (var c = this.getChild().getNodes(), l, T = 0; T < c.length; T++)
2666
- l = c[T], l.getChild() == null ? (l.displacementX += h, l.displacementY += o) : l.propogateDisplacementToChildren(h, o);
2667
- }, y.prototype.move = function() {
2668
- var h = this.graphManager.getLayout();
2669
- (this.child == null || this.child.getNodes().length == 0) && (this.moveBy(this.displacementX, this.displacementY), h.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY)), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0;
2670
- }, y.prototype.setPred1 = function(h) {
2671
- this.pred1 = h;
2672
- }, y.prototype.getPred1 = function() {
2673
- return pred1;
2674
- }, y.prototype.getPred2 = function() {
2675
- return pred2;
2676
- }, y.prototype.setNext = function(h) {
2677
- this.next = h;
2678
- }, y.prototype.getNext = function() {
2679
- return next;
2680
- }, y.prototype.setProcessed = function(h) {
2681
- this.processed = h;
2682
- }, y.prototype.isProcessed = function() {
2683
- return processed;
2684
- }, i.exports = y;
2685
- }
2686
- ),
2687
- /***/
2688
- 902: (
2689
- /***/
2690
- (i, r, e) => {
2691
- function f(c) {
2692
- if (Array.isArray(c)) {
2693
- for (var l = 0, T = Array(c.length); l < c.length; l++)
2694
- T[l] = c[l];
2695
- return T;
2696
- } else
2697
- return Array.from(c);
2698
- }
2699
- var a = e(806), y = e(551).LinkedList, t = e(551).Matrix, h = e(551).SVD;
2700
- function o() {
2701
- }
2702
- o.handleConstraints = function(c) {
2703
- var l = {};
2704
- l.fixedNodeConstraint = c.constraints.fixedNodeConstraint, l.alignmentConstraint = c.constraints.alignmentConstraint, l.relativePlacementConstraint = c.constraints.relativePlacementConstraint;
2705
- for (var T = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), d = [], L = [], F = c.getAllNodes(), M = 0, P = 0; P < F.length; P++) {
2706
- var J = F[P];
2707
- J.getChild() == null && (g.set(J.id, M++), d.push(J.getCenterX()), L.push(J.getCenterY()), T.set(J.id, J));
2708
- }
2709
- l.relativePlacementConstraint && l.relativePlacementConstraint.forEach(function(S) {
2710
- !S.gap && S.gap != 0 && (S.left ? S.gap = a.DEFAULT_EDGE_LENGTH + T.get(S.left).getWidth() / 2 + T.get(S.right).getWidth() / 2 : S.gap = a.DEFAULT_EDGE_LENGTH + T.get(S.top).getHeight() / 2 + T.get(S.bottom).getHeight() / 2);
2711
- });
2712
- var V = function(b, $) {
2713
- return { x: b.x - $.x, y: b.y - $.y };
2714
- }, Q = function(b) {
2715
- var $ = 0, K = 0;
2716
- return b.forEach(function(Z) {
2717
- $ += d[g.get(Z)], K += L[g.get(Z)];
2718
- }), { x: $ / b.size, y: K / b.size };
2719
- }, D = function(b, $, K, Z, at) {
2720
- function ut(ft, st) {
2721
- var Ct = new Set(ft), ct = !0, ht = !1, Wt = void 0;
2722
- try {
2723
- for (var Nt = st[Symbol.iterator](), Mt; !(ct = (Mt = Nt.next()).done); ct = !0) {
2724
- var Zt = Mt.value;
2725
- Ct.add(Zt);
2726
- }
2727
- } catch (Gt) {
2728
- ht = !0, Wt = Gt;
2729
- } finally {
2730
- try {
2731
- !ct && Nt.return && Nt.return();
2732
- } finally {
2733
- if (ht)
2734
- throw Wt;
2735
- }
2736
- }
2737
- return Ct;
2738
- }
2739
- var ot = /* @__PURE__ */ new Map();
2740
- b.forEach(function(ft, st) {
2741
- ot.set(st, 0);
2742
- }), b.forEach(function(ft, st) {
2743
- ft.forEach(function(Ct) {
2744
- ot.set(Ct.id, ot.get(Ct.id) + 1);
2745
- });
2746
- });
2747
- var tt = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), dt = new y();
2748
- ot.forEach(function(ft, st) {
2749
- ft == 0 ? (dt.push(st), K || ($ == "horizontal" ? tt.set(st, g.has(st) ? d[g.get(st)] : Z.get(st)) : tt.set(st, g.has(st) ? L[g.get(st)] : Z.get(st)))) : tt.set(st, Number.NEGATIVE_INFINITY), K && j.set(st, /* @__PURE__ */ new Set([st]));
2750
- }), K && at.forEach(function(ft) {
2751
- var st = [];
2752
- if (ft.forEach(function(ht) {
2753
- K.has(ht) && st.push(ht);
2754
- }), st.length > 0) {
2755
- var Ct = 0;
2756
- st.forEach(function(ht) {
2757
- $ == "horizontal" ? (tt.set(ht, g.has(ht) ? d[g.get(ht)] : Z.get(ht)), Ct += tt.get(ht)) : (tt.set(ht, g.has(ht) ? L[g.get(ht)] : Z.get(ht)), Ct += tt.get(ht));
2758
- }), Ct = Ct / st.length, ft.forEach(function(ht) {
2759
- K.has(ht) || tt.set(ht, Ct);
2760
- });
2761
- } else {
2762
- var ct = 0;
2763
- ft.forEach(function(ht) {
2764
- $ == "horizontal" ? ct += g.has(ht) ? d[g.get(ht)] : Z.get(ht) : ct += g.has(ht) ? L[g.get(ht)] : Z.get(ht);
2765
- }), ct = ct / ft.length, ft.forEach(function(ht) {
2766
- tt.set(ht, ct);
2767
- });
2768
- }
2769
- });
2770
- for (var wt = function() {
2771
- var st = dt.shift(), Ct = b.get(st);
2772
- Ct.forEach(function(ct) {
2773
- if (tt.get(ct.id) < tt.get(st) + ct.gap)
2774
- if (K && K.has(ct.id)) {
2775
- var ht = void 0;
2776
- if ($ == "horizontal" ? ht = g.has(ct.id) ? d[g.get(ct.id)] : Z.get(ct.id) : ht = g.has(ct.id) ? L[g.get(ct.id)] : Z.get(ct.id), tt.set(ct.id, ht), ht < tt.get(st) + ct.gap) {
2777
- var Wt = tt.get(st) + ct.gap - ht;
2778
- j.get(st).forEach(function(Nt) {
2779
- tt.set(Nt, tt.get(Nt) - Wt);
2780
- });
2781
- }
2782
- } else
2783
- tt.set(ct.id, tt.get(st) + ct.gap);
2784
- ot.set(ct.id, ot.get(ct.id) - 1), ot.get(ct.id) == 0 && dt.push(ct.id), K && j.set(ct.id, ut(j.get(st), j.get(ct.id)));
2785
- });
2786
- }; dt.length != 0; )
2787
- wt();
2788
- if (K) {
2789
- var yt = /* @__PURE__ */ new Set();
2790
- b.forEach(function(ft, st) {
2791
- ft.length == 0 && yt.add(st);
2792
- });
2793
- var It = [];
2794
- j.forEach(function(ft, st) {
2795
- if (yt.has(st)) {
2796
- var Ct = !1, ct = !0, ht = !1, Wt = void 0;
2797
- try {
2798
- for (var Nt = ft[Symbol.iterator](), Mt; !(ct = (Mt = Nt.next()).done); ct = !0) {
2799
- var Zt = Mt.value;
2800
- K.has(Zt) && (Ct = !0);
2801
- }
2802
- } catch (Ft) {
2803
- ht = !0, Wt = Ft;
2804
- } finally {
2805
- try {
2806
- !ct && Nt.return && Nt.return();
2807
- } finally {
2808
- if (ht)
2809
- throw Wt;
2810
- }
2811
- }
2812
- if (!Ct) {
2813
- var Gt = !1, $t = void 0;
2814
- It.forEach(function(Ft, qt) {
2815
- Ft.has([].concat(f(ft))[0]) && (Gt = !0, $t = qt);
2816
- }), Gt ? ft.forEach(function(Ft) {
2817
- It[$t].add(Ft);
2818
- }) : It.push(new Set(ft));
2819
- }
2820
- }
2821
- }), It.forEach(function(ft, st) {
2822
- var Ct = Number.POSITIVE_INFINITY, ct = Number.POSITIVE_INFINITY, ht = Number.NEGATIVE_INFINITY, Wt = Number.NEGATIVE_INFINITY, Nt = !0, Mt = !1, Zt = void 0;
2823
- try {
2824
- for (var Gt = ft[Symbol.iterator](), $t; !(Nt = ($t = Gt.next()).done); Nt = !0) {
2825
- var Ft = $t.value, qt = void 0;
2826
- $ == "horizontal" ? qt = g.has(Ft) ? d[g.get(Ft)] : Z.get(Ft) : qt = g.has(Ft) ? L[g.get(Ft)] : Z.get(Ft);
2827
- var _t = tt.get(Ft);
2828
- qt < Ct && (Ct = qt), qt > ht && (ht = qt), _t < ct && (ct = _t), _t > Wt && (Wt = _t);
2829
- }
2830
- } catch (ie) {
2831
- Mt = !0, Zt = ie;
2832
- } finally {
2833
- try {
2834
- !Nt && Gt.return && Gt.return();
2835
- } finally {
2836
- if (Mt)
2837
- throw Zt;
2838
- }
2839
- }
2840
- var de = (Ct + ht) / 2 - (ct + Wt) / 2, Kt = !0, te = !1, ee = void 0;
2841
- try {
2842
- for (var jt = ft[Symbol.iterator](), se; !(Kt = (se = jt.next()).done); Kt = !0) {
2843
- var re = se.value;
2844
- tt.set(re, tt.get(re) + de);
2845
- }
2846
- } catch (ie) {
2847
- te = !0, ee = ie;
2848
- } finally {
2849
- try {
2850
- !Kt && jt.return && jt.return();
2851
- } finally {
2852
- if (te)
2853
- throw ee;
2854
- }
2855
- }
2856
- });
2857
- }
2858
- return tt;
2859
- }, rt = function(b) {
2860
- var $ = 0, K = 0, Z = 0, at = 0;
2861
- if (b.forEach(function(j) {
2862
- j.left ? d[g.get(j.left)] - d[g.get(j.right)] >= 0 ? $++ : K++ : L[g.get(j.top)] - L[g.get(j.bottom)] >= 0 ? Z++ : at++;
2863
- }), $ > K && Z > at)
2864
- for (var ut = 0; ut < g.size; ut++)
2865
- d[ut] = -1 * d[ut], L[ut] = -1 * L[ut];
2866
- else if ($ > K)
2867
- for (var ot = 0; ot < g.size; ot++)
2868
- d[ot] = -1 * d[ot];
2869
- else if (Z > at)
2870
- for (var tt = 0; tt < g.size; tt++)
2871
- L[tt] = -1 * L[tt];
2872
- }, n = function(b) {
2873
- var $ = [], K = new y(), Z = /* @__PURE__ */ new Set(), at = 0;
2874
- return b.forEach(function(ut, ot) {
2875
- if (!Z.has(ot)) {
2876
- $[at] = [];
2877
- var tt = ot;
2878
- for (K.push(tt), Z.add(tt), $[at].push(tt); K.length != 0; ) {
2879
- tt = K.shift();
2880
- var j = b.get(tt);
2881
- j.forEach(function(dt) {
2882
- Z.has(dt.id) || (K.push(dt.id), Z.add(dt.id), $[at].push(dt.id));
2883
- });
2884
- }
2885
- at++;
2886
- }
2887
- }), $;
2888
- }, m = function(b) {
2889
- var $ = /* @__PURE__ */ new Map();
2890
- return b.forEach(function(K, Z) {
2891
- $.set(Z, []);
2892
- }), b.forEach(function(K, Z) {
2893
- K.forEach(function(at) {
2894
- $.get(Z).push(at), $.get(at.id).push({ id: Z, gap: at.gap, direction: at.direction });
2895
- });
2896
- }), $;
2897
- }, v = function(b) {
2898
- var $ = /* @__PURE__ */ new Map();
2899
- return b.forEach(function(K, Z) {
2900
- $.set(Z, []);
2901
- }), b.forEach(function(K, Z) {
2902
- K.forEach(function(at) {
2903
- $.get(at.id).push({ id: Z, gap: at.gap, direction: at.direction });
2904
- });
2905
- }), $;
2906
- }, E = [], p = [], I = !1, w = !1, R = /* @__PURE__ */ new Set(), H = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), k = [];
2907
- if (l.fixedNodeConstraint && l.fixedNodeConstraint.forEach(function(S) {
2908
- R.add(S.nodeId);
2909
- }), l.relativePlacementConstraint && (l.relativePlacementConstraint.forEach(function(S) {
2910
- S.left ? (H.has(S.left) ? H.get(S.left).push({ id: S.right, gap: S.gap, direction: "horizontal" }) : H.set(S.left, [{ id: S.right, gap: S.gap, direction: "horizontal" }]), H.has(S.right) || H.set(S.right, [])) : (H.has(S.top) ? H.get(S.top).push({ id: S.bottom, gap: S.gap, direction: "vertical" }) : H.set(S.top, [{ id: S.bottom, gap: S.gap, direction: "vertical" }]), H.has(S.bottom) || H.set(S.bottom, []));
2911
- }), x = m(H), k = n(x)), a.TRANSFORM_ON_CONSTRAINT_HANDLING) {
2912
- if (l.fixedNodeConstraint && l.fixedNodeConstraint.length > 1)
2913
- l.fixedNodeConstraint.forEach(function(S, b) {
2914
- E[b] = [S.position.x, S.position.y], p[b] = [d[g.get(S.nodeId)], L[g.get(S.nodeId)]];
2915
- }), I = !0;
2916
- else if (l.alignmentConstraint)
2917
- (function() {
2918
- var S = 0;
2919
- if (l.alignmentConstraint.vertical) {
2920
- for (var b = l.alignmentConstraint.vertical, $ = function(tt) {
2921
- var j = /* @__PURE__ */ new Set();
2922
- b[tt].forEach(function(yt) {
2923
- j.add(yt);
2924
- });
2925
- var dt = new Set([].concat(f(j)).filter(function(yt) {
2926
- return R.has(yt);
2927
- })), wt = void 0;
2928
- dt.size > 0 ? wt = d[g.get(dt.values().next().value)] : wt = Q(j).x, b[tt].forEach(function(yt) {
2929
- E[S] = [wt, L[g.get(yt)]], p[S] = [d[g.get(yt)], L[g.get(yt)]], S++;
2930
- });
2931
- }, K = 0; K < b.length; K++)
2932
- $(K);
2933
- I = !0;
2934
- }
2935
- if (l.alignmentConstraint.horizontal) {
2936
- for (var Z = l.alignmentConstraint.horizontal, at = function(tt) {
2937
- var j = /* @__PURE__ */ new Set();
2938
- Z[tt].forEach(function(yt) {
2939
- j.add(yt);
2940
- });
2941
- var dt = new Set([].concat(f(j)).filter(function(yt) {
2942
- return R.has(yt);
2943
- })), wt = void 0;
2944
- dt.size > 0 ? wt = d[g.get(dt.values().next().value)] : wt = Q(j).y, Z[tt].forEach(function(yt) {
2945
- E[S] = [d[g.get(yt)], wt], p[S] = [d[g.get(yt)], L[g.get(yt)]], S++;
2946
- });
2947
- }, ut = 0; ut < Z.length; ut++)
2948
- at(ut);
2949
- I = !0;
2950
- }
2951
- l.relativePlacementConstraint && (w = !0);
2952
- })();
2953
- else if (l.relativePlacementConstraint) {
2954
- for (var W = 0, U = 0, et = 0; et < k.length; et++)
2955
- k[et].length > W && (W = k[et].length, U = et);
2956
- if (W < x.size / 2)
2957
- rt(l.relativePlacementConstraint), I = !1, w = !1;
2958
- else {
2959
- var z = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), X = [];
2960
- k[U].forEach(function(S) {
2961
- H.get(S).forEach(function(b) {
2962
- b.direction == "horizontal" ? (z.has(S) ? z.get(S).push(b) : z.set(S, [b]), z.has(b.id) || z.set(b.id, []), X.push({ left: S, right: b.id })) : (O.has(S) ? O.get(S).push(b) : O.set(S, [b]), O.has(b.id) || O.set(b.id, []), X.push({ top: S, bottom: b.id }));
2963
- });
2964
- }), rt(X), w = !1;
2965
- var B = D(z, "horizontal"), _ = D(O, "vertical");
2966
- k[U].forEach(function(S, b) {
2967
- p[b] = [d[g.get(S)], L[g.get(S)]], E[b] = [], B.has(S) ? E[b][0] = B.get(S) : E[b][0] = d[g.get(S)], _.has(S) ? E[b][1] = _.get(S) : E[b][1] = L[g.get(S)];
2968
- }), I = !0;
2969
- }
2970
- }
2971
- if (I) {
2972
- for (var lt = void 0, q = t.transpose(E), Rt = t.transpose(p), Lt = 0; Lt < q.length; Lt++)
2973
- q[Lt] = t.multGamma(q[Lt]), Rt[Lt] = t.multGamma(Rt[Lt]);
2974
- var vt = t.multMat(q, t.transpose(Rt)), it = h.svd(vt);
2975
- lt = t.multMat(it.V, t.transpose(it.U));
2976
- for (var gt = 0; gt < g.size; gt++) {
2977
- var Tt = [d[gt], L[gt]], At = [lt[0][0], lt[1][0]], Dt = [lt[0][1], lt[1][1]];
2978
- d[gt] = t.dotProduct(Tt, At), L[gt] = t.dotProduct(Tt, Dt);
2979
- }
2980
- w && rt(l.relativePlacementConstraint);
2981
- }
2982
- }
2983
- if (a.ENFORCE_CONSTRAINTS) {
2984
- if (l.fixedNodeConstraint && l.fixedNodeConstraint.length > 0) {
2985
- var mt = { x: 0, y: 0 };
2986
- l.fixedNodeConstraint.forEach(function(S, b) {
2987
- var $ = { x: d[g.get(S.nodeId)], y: L[g.get(S.nodeId)] }, K = S.position, Z = V(K, $);
2988
- mt.x += Z.x, mt.y += Z.y;
2989
- }), mt.x /= l.fixedNodeConstraint.length, mt.y /= l.fixedNodeConstraint.length, d.forEach(function(S, b) {
2990
- d[b] += mt.x;
2991
- }), L.forEach(function(S, b) {
2992
- L[b] += mt.y;
2993
- }), l.fixedNodeConstraint.forEach(function(S) {
2994
- d[g.get(S.nodeId)] = S.position.x, L[g.get(S.nodeId)] = S.position.y;
2995
- });
2996
- }
2997
- if (l.alignmentConstraint) {
2998
- if (l.alignmentConstraint.vertical)
2999
- for (var xt = l.alignmentConstraint.vertical, St = function(b) {
3000
- var $ = /* @__PURE__ */ new Set();
3001
- xt[b].forEach(function(at) {
3002
- $.add(at);
3003
- });
3004
- var K = new Set([].concat(f($)).filter(function(at) {
3005
- return R.has(at);
3006
- })), Z = void 0;
3007
- K.size > 0 ? Z = d[g.get(K.values().next().value)] : Z = Q($).x, $.forEach(function(at) {
3008
- R.has(at) || (d[g.get(at)] = Z);
3009
- });
3010
- }, Vt = 0; Vt < xt.length; Vt++)
3011
- St(Vt);
3012
- if (l.alignmentConstraint.horizontal)
3013
- for (var Xt = l.alignmentConstraint.horizontal, Ut = function(b) {
3014
- var $ = /* @__PURE__ */ new Set();
3015
- Xt[b].forEach(function(at) {
3016
- $.add(at);
3017
- });
3018
- var K = new Set([].concat(f($)).filter(function(at) {
3019
- return R.has(at);
3020
- })), Z = void 0;
3021
- K.size > 0 ? Z = L[g.get(K.values().next().value)] : Z = Q($).y, $.forEach(function(at) {
3022
- R.has(at) || (L[g.get(at)] = Z);
3023
- });
3024
- }, bt = 0; bt < Xt.length; bt++)
3025
- Ut(bt);
3026
- }
3027
- l.relativePlacementConstraint && function() {
3028
- var S = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), at = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Set(), ot = /* @__PURE__ */ new Set();
3029
- if (R.forEach(function(Yt) {
3030
- ut.add(Yt), ot.add(Yt);
3031
- }), l.alignmentConstraint) {
3032
- if (l.alignmentConstraint.vertical)
3033
- for (var tt = l.alignmentConstraint.vertical, j = function(Et) {
3034
- $.set("dummy" + Et, []), tt[Et].forEach(function(Ot) {
3035
- S.set(Ot, "dummy" + Et), $.get("dummy" + Et).push(Ot), R.has(Ot) && ut.add("dummy" + Et);
3036
- }), Z.set("dummy" + Et, d[g.get(tt[Et][0])]);
3037
- }, dt = 0; dt < tt.length; dt++)
3038
- j(dt);
3039
- if (l.alignmentConstraint.horizontal)
3040
- for (var wt = l.alignmentConstraint.horizontal, yt = function(Et) {
3041
- K.set("dummy" + Et, []), wt[Et].forEach(function(Ot) {
3042
- b.set(Ot, "dummy" + Et), K.get("dummy" + Et).push(Ot), R.has(Ot) && ot.add("dummy" + Et);
3043
- }), at.set("dummy" + Et, L[g.get(wt[Et][0])]);
3044
- }, It = 0; It < wt.length; It++)
3045
- yt(It);
3046
- }
3047
- var ft = /* @__PURE__ */ new Map(), st = /* @__PURE__ */ new Map(), Ct = function(Et) {
3048
- H.get(Et).forEach(function(Ot) {
3049
- var Jt = void 0, kt = void 0;
3050
- Ot.direction == "horizontal" ? (Jt = S.get(Et) ? S.get(Et) : Et, S.get(Ot.id) ? kt = { id: S.get(Ot.id), gap: Ot.gap, direction: Ot.direction } : kt = Ot, ft.has(Jt) ? ft.get(Jt).push(kt) : ft.set(Jt, [kt]), ft.has(kt.id) || ft.set(kt.id, [])) : (Jt = b.get(Et) ? b.get(Et) : Et, b.get(Ot.id) ? kt = { id: b.get(Ot.id), gap: Ot.gap, direction: Ot.direction } : kt = Ot, st.has(Jt) ? st.get(Jt).push(kt) : st.set(Jt, [kt]), st.has(kt.id) || st.set(kt.id, []));
3051
- });
3052
- }, ct = !0, ht = !1, Wt = void 0;
3053
- try {
3054
- for (var Nt = H.keys()[Symbol.iterator](), Mt; !(ct = (Mt = Nt.next()).done); ct = !0) {
3055
- var Zt = Mt.value;
3056
- Ct(Zt);
3057
- }
3058
- } catch (Yt) {
3059
- ht = !0, Wt = Yt;
3060
- } finally {
3061
- try {
3062
- !ct && Nt.return && Nt.return();
3063
- } finally {
3064
- if (ht)
3065
- throw Wt;
3066
- }
3067
- }
3068
- var Gt = m(ft), $t = m(st), Ft = n(Gt), qt = n($t), _t = v(ft), de = v(st), Kt = [], te = [];
3069
- Ft.forEach(function(Yt, Et) {
3070
- Kt[Et] = [], Yt.forEach(function(Ot) {
3071
- _t.get(Ot).length == 0 && Kt[Et].push(Ot);
3072
- });
3073
- }), qt.forEach(function(Yt, Et) {
3074
- te[Et] = [], Yt.forEach(function(Ot) {
3075
- de.get(Ot).length == 0 && te[Et].push(Ot);
3076
- });
3077
- });
3078
- var ee = D(ft, "horizontal", ut, Z, Kt), jt = D(st, "vertical", ot, at, te), se = function(Et) {
3079
- $.get(Et) ? $.get(Et).forEach(function(Ot) {
3080
- d[g.get(Ot)] = ee.get(Et);
3081
- }) : d[g.get(Et)] = ee.get(Et);
3082
- }, re = !0, ie = !1, Le = void 0;
3083
- try {
3084
- for (var ve = ee.keys()[Symbol.iterator](), Ce; !(re = (Ce = ve.next()).done); re = !0) {
3085
- var pe = Ce.value;
3086
- se(pe);
3087
- }
3088
- } catch (Yt) {
3089
- ie = !0, Le = Yt;
3090
- } finally {
3091
- try {
3092
- !re && ve.return && ve.return();
3093
- } finally {
3094
- if (ie)
3095
- throw Le;
3096
- }
3097
- }
3098
- var Ze = function(Et) {
3099
- K.get(Et) ? K.get(Et).forEach(function(Ot) {
3100
- L[g.get(Ot)] = jt.get(Et);
3101
- }) : L[g.get(Et)] = jt.get(Et);
3102
- }, ye = !0, Me = !1, Ae = void 0;
3103
- try {
3104
- for (var Ee = jt.keys()[Symbol.iterator](), we; !(ye = (we = Ee.next()).done); ye = !0) {
3105
- var pe = we.value;
3106
- Ze(pe);
3107
- }
3108
- } catch (Yt) {
3109
- Me = !0, Ae = Yt;
3110
- } finally {
3111
- try {
3112
- !ye && Ee.return && Ee.return();
3113
- } finally {
3114
- if (Me)
3115
- throw Ae;
3116
- }
3117
- }
3118
- }();
3119
- }
3120
- for (var Ht = 0; Ht < F.length; Ht++) {
3121
- var Bt = F[Ht];
3122
- Bt.getChild() == null && Bt.setCenter(d[g.get(Bt.id)], L[g.get(Bt.id)]);
3123
- }
3124
- }, i.exports = o;
3125
- }
3126
- ),
3127
- /***/
3128
- 551: (
3129
- /***/
3130
- (i) => {
3131
- i.exports = A;
3132
- }
3133
- )
3134
- /******/
3135
- }, N = {};
3136
- function u(i) {
3137
- var r = N[i];
3138
- if (r !== void 0)
3139
- return r.exports;
3140
- var e = N[i] = {
3141
- /******/
3142
- // no module.id needed
3143
- /******/
3144
- // no module.loaded needed
3145
- /******/
3146
- exports: {}
3147
- /******/
3148
- };
3149
- return G[i](e, e.exports, u), e.exports;
3150
- }
3151
- var s = u(45);
3152
- return s;
3153
- })()
3154
- );
3155
- });
3156
- }(fe)), fe.exports;
3157
- }
3158
- var dr = le.exports, xe;
3159
- function vr() {
3160
- return xe || (xe = 1, function(C, Y) {
3161
- (function(G, N) {
3162
- C.exports = N(gr());
3163
- })(dr, function(A) {
3164
- return (
3165
- /******/
3166
- (() => {
3167
- var G = {
3168
- /***/
3169
- 658: (
3170
- /***/
3171
- (i) => {
3172
- i.exports = Object.assign != null ? Object.assign.bind(Object) : function(r) {
3173
- for (var e = arguments.length, f = Array(e > 1 ? e - 1 : 0), a = 1; a < e; a++)
3174
- f[a - 1] = arguments[a];
3175
- return f.forEach(function(y) {
3176
- Object.keys(y).forEach(function(t) {
3177
- return r[t] = y[t];
3178
- });
3179
- }), r;
3180
- };
3181
- }
3182
- ),
3183
- /***/
3184
- 548: (
3185
- /***/
3186
- (i, r, e) => {
3187
- var f = /* @__PURE__ */ function() {
3188
- function t(h, o) {
3189
- var c = [], l = !0, T = !1, g = void 0;
3190
- try {
3191
- for (var d = h[Symbol.iterator](), L; !(l = (L = d.next()).done) && (c.push(L.value), !(o && c.length === o)); l = !0)
3192
- ;
3193
- } catch (F) {
3194
- T = !0, g = F;
3195
- } finally {
3196
- try {
3197
- !l && d.return && d.return();
3198
- } finally {
3199
- if (T) throw g;
3200
- }
3201
- }
3202
- return c;
3203
- }
3204
- return function(h, o) {
3205
- if (Array.isArray(h))
3206
- return h;
3207
- if (Symbol.iterator in Object(h))
3208
- return t(h, o);
3209
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
3210
- };
3211
- }(), a = e(140).layoutBase.LinkedList, y = {};
3212
- y.getTopMostNodes = function(t) {
3213
- for (var h = {}, o = 0; o < t.length; o++)
3214
- h[t[o].id()] = !0;
3215
- var c = t.filter(function(l, T) {
3216
- typeof l == "number" && (l = T);
3217
- for (var g = l.parent()[0]; g != null; ) {
3218
- if (h[g.id()])
3219
- return !1;
3220
- g = g.parent()[0];
3221
- }
3222
- return !0;
3223
- });
3224
- return c;
3225
- }, y.connectComponents = function(t, h, o, c) {
3226
- var l = new a(), T = /* @__PURE__ */ new Set(), g = [], d = void 0, L = void 0, F = void 0, M = !1, P = 1, J = [], V = [], Q = function() {
3227
- var rt = t.collection();
3228
- V.push(rt);
3229
- var n = o[0], m = t.collection();
3230
- m.merge(n).merge(n.descendants().intersection(h)), g.push(n), m.forEach(function(p) {
3231
- l.push(p), T.add(p), rt.merge(p);
3232
- });
3233
- for (var v = function() {
3234
- n = l.shift();
3235
- var I = t.collection();
3236
- n.neighborhood().nodes().forEach(function(x) {
3237
- h.intersection(n.edgesWith(x)).length > 0 && I.merge(x);
3238
- });
3239
- for (var w = 0; w < I.length; w++) {
3240
- var R = I[w];
3241
- if (d = o.intersection(R.union(R.ancestors())), d != null && !T.has(d[0])) {
3242
- var H = d.union(d.descendants());
3243
- H.forEach(function(x) {
3244
- l.push(x), T.add(x), rt.merge(x), o.has(x) && g.push(x);
3245
- });
3246
- }
3247
- }
3248
- }; l.length != 0; )
3249
- v();
3250
- if (rt.forEach(function(p) {
3251
- h.intersection(p.connectedEdges()).forEach(function(I) {
3252
- rt.has(I.source()) && rt.has(I.target()) && rt.merge(I);
3253
- });
3254
- }), g.length == o.length && (M = !0), !M || M && P > 1) {
3255
- L = g[0], F = L.connectedEdges().length, g.forEach(function(p) {
3256
- p.connectedEdges().length < F && (F = p.connectedEdges().length, L = p);
3257
- }), J.push(L.id());
3258
- var E = t.collection();
3259
- E.merge(g[0]), g.forEach(function(p) {
3260
- E.merge(p);
3261
- }), g = [], o = o.difference(E), P++;
3262
- }
3263
- };
3264
- do
3265
- Q();
3266
- while (!M);
3267
- return c && J.length > 0 && c.set("dummy" + (c.size + 1), J), V;
3268
- }, y.relocateComponent = function(t, h, o) {
3269
- if (!o.fixedNodeConstraint) {
3270
- var c = Number.POSITIVE_INFINITY, l = Number.NEGATIVE_INFINITY, T = Number.POSITIVE_INFINITY, g = Number.NEGATIVE_INFINITY;
3271
- if (o.quality == "draft") {
3272
- var d = !0, L = !1, F = void 0;
3273
- try {
3274
- for (var M = h.nodeIndexes[Symbol.iterator](), P; !(d = (P = M.next()).done); d = !0) {
3275
- var J = P.value, V = f(J, 2), Q = V[0], D = V[1], rt = o.cy.getElementById(Q);
3276
- if (rt) {
3277
- var n = rt.boundingBox(), m = h.xCoords[D] - n.w / 2, v = h.xCoords[D] + n.w / 2, E = h.yCoords[D] - n.h / 2, p = h.yCoords[D] + n.h / 2;
3278
- m < c && (c = m), v > l && (l = v), E < T && (T = E), p > g && (g = p);
3279
- }
3280
- }
3281
- } catch (x) {
3282
- L = !0, F = x;
3283
- } finally {
3284
- try {
3285
- !d && M.return && M.return();
3286
- } finally {
3287
- if (L)
3288
- throw F;
3289
- }
3290
- }
3291
- var I = t.x - (l + c) / 2, w = t.y - (g + T) / 2;
3292
- h.xCoords = h.xCoords.map(function(x) {
3293
- return x + I;
3294
- }), h.yCoords = h.yCoords.map(function(x) {
3295
- return x + w;
3296
- });
3297
- } else {
3298
- Object.keys(h).forEach(function(x) {
3299
- var k = h[x], W = k.getRect().x, U = k.getRect().x + k.getRect().width, et = k.getRect().y, z = k.getRect().y + k.getRect().height;
3300
- W < c && (c = W), U > l && (l = U), et < T && (T = et), z > g && (g = z);
3301
- });
3302
- var R = t.x - (l + c) / 2, H = t.y - (g + T) / 2;
3303
- Object.keys(h).forEach(function(x) {
3304
- var k = h[x];
3305
- k.setCenter(k.getCenterX() + R, k.getCenterY() + H);
3306
- });
3307
- }
3308
- }
3309
- }, y.calcBoundingBox = function(t, h, o, c) {
3310
- for (var l = Number.MAX_SAFE_INTEGER, T = Number.MIN_SAFE_INTEGER, g = Number.MAX_SAFE_INTEGER, d = Number.MIN_SAFE_INTEGER, L = void 0, F = void 0, M = void 0, P = void 0, J = t.descendants().not(":parent"), V = J.length, Q = 0; Q < V; Q++) {
3311
- var D = J[Q];
3312
- L = h[c.get(D.id())] - D.width() / 2, F = h[c.get(D.id())] + D.width() / 2, M = o[c.get(D.id())] - D.height() / 2, P = o[c.get(D.id())] + D.height() / 2, l > L && (l = L), T < F && (T = F), g > M && (g = M), d < P && (d = P);
3313
- }
3314
- var rt = {};
3315
- return rt.topLeftX = l, rt.topLeftY = g, rt.width = T - l, rt.height = d - g, rt;
3316
- }, y.calcParentsWithoutChildren = function(t, h) {
3317
- var o = t.collection();
3318
- return h.nodes(":parent").forEach(function(c) {
3319
- var l = !1;
3320
- c.children().forEach(function(T) {
3321
- T.css("display") != "none" && (l = !0);
3322
- }), l || o.merge(c);
3323
- }), o;
3324
- }, i.exports = y;
3325
- }
3326
- ),
3327
- /***/
3328
- 816: (
3329
- /***/
3330
- (i, r, e) => {
3331
- var f = e(548), a = e(140).CoSELayout, y = e(140).CoSENode, t = e(140).layoutBase.PointD, h = e(140).layoutBase.DimensionD, o = e(140).layoutBase.LayoutConstants, c = e(140).layoutBase.FDLayoutConstants, l = e(140).CoSEConstants, T = function(d, L) {
3332
- var F = d.cy, M = d.eles, P = M.nodes(), J = M.edges(), V = void 0, Q = void 0, D = void 0, rt = {};
3333
- d.randomize && (V = L.nodeIndexes, Q = L.xCoords, D = L.yCoords);
3334
- var n = function(x) {
3335
- return typeof x == "function";
3336
- }, m = function(x, k) {
3337
- return n(x) ? x(k) : x;
3338
- }, v = f.calcParentsWithoutChildren(F, M), E = function H(x, k, W, U) {
3339
- for (var et = k.length, z = 0; z < et; z++) {
3340
- var O = k[z], X = null;
3341
- O.intersection(v).length == 0 && (X = O.children());
3342
- var B = void 0, _ = O.layoutDimensions({
3343
- nodeDimensionsIncludeLabels: U.nodeDimensionsIncludeLabels
3344
- });
3345
- if (O.outerWidth() != null && O.outerHeight() != null)
3346
- if (U.randomize)
3347
- if (!O.isParent())
3348
- B = x.add(new y(W.graphManager, new t(Q[V.get(O.id())] - _.w / 2, D[V.get(O.id())] - _.h / 2), new h(parseFloat(_.w), parseFloat(_.h))));
3349
- else {
3350
- var lt = f.calcBoundingBox(O, Q, D, V);
3351
- O.intersection(v).length == 0 ? B = x.add(new y(W.graphManager, new t(lt.topLeftX, lt.topLeftY), new h(lt.width, lt.height))) : B = x.add(new y(W.graphManager, new t(lt.topLeftX, lt.topLeftY), new h(parseFloat(_.w), parseFloat(_.h))));
3352
- }
3353
- else
3354
- B = x.add(new y(W.graphManager, new t(O.position("x") - _.w / 2, O.position("y") - _.h / 2), new h(parseFloat(_.w), parseFloat(_.h))));
3355
- else
3356
- B = x.add(new y(this.graphManager));
3357
- if (B.id = O.data("id"), B.nodeRepulsion = m(U.nodeRepulsion, O), B.paddingLeft = parseInt(O.css("padding")), B.paddingTop = parseInt(O.css("padding")), B.paddingRight = parseInt(O.css("padding")), B.paddingBottom = parseInt(O.css("padding")), U.nodeDimensionsIncludeLabels && (B.labelWidth = O.boundingBox({ includeLabels: !0, includeNodes: !1, includeOverlays: !1 }).w, B.labelHeight = O.boundingBox({ includeLabels: !0, includeNodes: !1, includeOverlays: !1 }).h, B.labelPosVertical = O.css("text-valign"), B.labelPosHorizontal = O.css("text-halign")), rt[O.data("id")] = B, isNaN(B.rect.x) && (B.rect.x = 0), isNaN(B.rect.y) && (B.rect.y = 0), X != null && X.length > 0) {
3358
- var q = void 0;
3359
- q = W.getGraphManager().add(W.newGraph(), B), H(q, X, W, U);
3360
- }
3361
- }
3362
- }, p = function(x, k, W) {
3363
- for (var U = 0, et = 0, z = 0; z < W.length; z++) {
3364
- var O = W[z], X = rt[O.data("source")], B = rt[O.data("target")];
3365
- if (X && B && X !== B && X.getEdgesBetween(B).length == 0) {
3366
- var _ = k.add(x.newEdge(), X, B);
3367
- _.id = O.id(), _.idealLength = m(d.idealEdgeLength, O), _.edgeElasticity = m(d.edgeElasticity, O), U += _.idealLength, et++;
3368
- }
3369
- }
3370
- d.idealEdgeLength != null && (et > 0 ? l.DEFAULT_EDGE_LENGTH = c.DEFAULT_EDGE_LENGTH = U / et : n(d.idealEdgeLength) ? l.DEFAULT_EDGE_LENGTH = c.DEFAULT_EDGE_LENGTH = 50 : l.DEFAULT_EDGE_LENGTH = c.DEFAULT_EDGE_LENGTH = d.idealEdgeLength, l.MIN_REPULSION_DIST = c.MIN_REPULSION_DIST = c.DEFAULT_EDGE_LENGTH / 10, l.DEFAULT_RADIAL_SEPARATION = c.DEFAULT_EDGE_LENGTH);
3371
- }, I = function(x, k) {
3372
- k.fixedNodeConstraint && (x.constraints.fixedNodeConstraint = k.fixedNodeConstraint), k.alignmentConstraint && (x.constraints.alignmentConstraint = k.alignmentConstraint), k.relativePlacementConstraint && (x.constraints.relativePlacementConstraint = k.relativePlacementConstraint);
3373
- };
3374
- d.nestingFactor != null && (l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = d.nestingFactor), d.gravity != null && (l.DEFAULT_GRAVITY_STRENGTH = c.DEFAULT_GRAVITY_STRENGTH = d.gravity), d.numIter != null && (l.MAX_ITERATIONS = c.MAX_ITERATIONS = d.numIter), d.gravityRange != null && (l.DEFAULT_GRAVITY_RANGE_FACTOR = c.DEFAULT_GRAVITY_RANGE_FACTOR = d.gravityRange), d.gravityCompound != null && (l.DEFAULT_COMPOUND_GRAVITY_STRENGTH = c.DEFAULT_COMPOUND_GRAVITY_STRENGTH = d.gravityCompound), d.gravityRangeCompound != null && (l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = d.gravityRangeCompound), d.initialEnergyOnIncremental != null && (l.DEFAULT_COOLING_FACTOR_INCREMENTAL = c.DEFAULT_COOLING_FACTOR_INCREMENTAL = d.initialEnergyOnIncremental), d.tilingCompareBy != null && (l.TILING_COMPARE_BY = d.tilingCompareBy), d.quality == "proof" ? o.QUALITY = 2 : o.QUALITY = 0, l.NODE_DIMENSIONS_INCLUDE_LABELS = c.NODE_DIMENSIONS_INCLUDE_LABELS = o.NODE_DIMENSIONS_INCLUDE_LABELS = d.nodeDimensionsIncludeLabels, l.DEFAULT_INCREMENTAL = c.DEFAULT_INCREMENTAL = o.DEFAULT_INCREMENTAL = !d.randomize, l.ANIMATE = c.ANIMATE = o.ANIMATE = d.animate, l.TILE = d.tile, l.TILING_PADDING_VERTICAL = typeof d.tilingPaddingVertical == "function" ? d.tilingPaddingVertical.call() : d.tilingPaddingVertical, l.TILING_PADDING_HORIZONTAL = typeof d.tilingPaddingHorizontal == "function" ? d.tilingPaddingHorizontal.call() : d.tilingPaddingHorizontal, l.DEFAULT_INCREMENTAL = c.DEFAULT_INCREMENTAL = o.DEFAULT_INCREMENTAL = !0, l.PURE_INCREMENTAL = !d.randomize, o.DEFAULT_UNIFORM_LEAF_NODE_SIZES = d.uniformNodeDimensions, d.step == "transformed" && (l.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, l.ENFORCE_CONSTRAINTS = !1, l.APPLY_LAYOUT = !1), d.step == "enforced" && (l.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, l.ENFORCE_CONSTRAINTS = !0, l.APPLY_LAYOUT = !1), d.step == "cose" && (l.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, l.ENFORCE_CONSTRAINTS = !1, l.APPLY_LAYOUT = !0), d.step == "all" && (d.randomize ? l.TRANSFORM_ON_CONSTRAINT_HANDLING = !0 : l.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, l.ENFORCE_CONSTRAINTS = !0, l.APPLY_LAYOUT = !0), d.fixedNodeConstraint || d.alignmentConstraint || d.relativePlacementConstraint ? l.TREE_REDUCTION_ON_INCREMENTAL = !1 : l.TREE_REDUCTION_ON_INCREMENTAL = !0;
3375
- var w = new a(), R = w.newGraphManager();
3376
- return E(R.addRoot(), f.getTopMostNodes(P), w, d), p(w, R, J), I(w, d), w.runLayout(), rt;
3377
- };
3378
- i.exports = { coseLayout: T };
3379
- }
3380
- ),
3381
- /***/
3382
- 212: (
3383
- /***/
3384
- (i, r, e) => {
3385
- var f = /* @__PURE__ */ function() {
3386
- function d(L, F) {
3387
- for (var M = 0; M < F.length; M++) {
3388
- var P = F[M];
3389
- P.enumerable = P.enumerable || !1, P.configurable = !0, "value" in P && (P.writable = !0), Object.defineProperty(L, P.key, P);
3390
- }
3391
- }
3392
- return function(L, F, M) {
3393
- return F && d(L.prototype, F), M && d(L, M), L;
3394
- };
3395
- }();
3396
- function a(d, L) {
3397
- if (!(d instanceof L))
3398
- throw new TypeError("Cannot call a class as a function");
3399
- }
3400
- var y = e(658), t = e(548), h = e(657), o = h.spectralLayout, c = e(816), l = c.coseLayout, T = Object.freeze({
3401
- // 'draft', 'default' or 'proof'
3402
- // - 'draft' only applies spectral layout
3403
- // - 'default' improves the quality with subsequent CoSE layout (fast cooling rate)
3404
- // - 'proof' improves the quality with subsequent CoSE layout (slow cooling rate)
3405
- quality: "default",
3406
- // Use random node positions at beginning of layout
3407
- // if this is set to false, then quality option must be "proof"
3408
- randomize: !0,
3409
- // Whether or not to animate the layout
3410
- animate: !0,
3411
- // Duration of animation in ms, if enabled
3412
- animationDuration: 1e3,
3413
- // Easing of animation, if enabled
3414
- animationEasing: void 0,
3415
- // Fit the viewport to the repositioned nodes
3416
- fit: !0,
3417
- // Padding around layout
3418
- padding: 30,
3419
- // Whether to include labels in node dimensions. Valid in "proof" quality
3420
- nodeDimensionsIncludeLabels: !1,
3421
- // Whether or not simple nodes (non-compound nodes) are of uniform dimensions
3422
- uniformNodeDimensions: !1,
3423
- // Whether to pack disconnected components - valid only if randomize: true
3424
- packComponents: !0,
3425
- // Layout step - all, transformed, enforced, cose - for debug purpose only
3426
- step: "all",
3427
- /* spectral layout options */
3428
- // False for random, true for greedy
3429
- samplingType: !0,
3430
- // Sample size to construct distance matrix
3431
- sampleSize: 25,
3432
- // Separation amount between nodes
3433
- nodeSeparation: 75,
3434
- // Power iteration tolerance
3435
- piTol: 1e-7,
3436
- /* CoSE layout options */
3437
- // Node repulsion (non overlapping) multiplier
3438
- nodeRepulsion: function(L) {
3439
- return 4500;
3440
- },
3441
- // Ideal edge (non nested) length
3442
- idealEdgeLength: function(L) {
3443
- return 50;
3444
- },
3445
- // Divisor to compute edge forces
3446
- edgeElasticity: function(L) {
3447
- return 0.45;
3448
- },
3449
- // Nesting factor (multiplier) to compute ideal edge length for nested edges
3450
- nestingFactor: 0.1,
3451
- // Gravity force (constant)
3452
- gravity: 0.25,
3453
- // Maximum number of iterations to perform
3454
- numIter: 2500,
3455
- // For enabling tiling
3456
- tile: !0,
3457
- // The function that specifies the criteria for comparing nodes while sorting them during tiling operation.
3458
- // Takes the node id as a parameter and the default tiling operation is perfomed when this option is not set.
3459
- tilingCompareBy: void 0,
3460
- // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
3461
- tilingPaddingVertical: 10,
3462
- // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
3463
- tilingPaddingHorizontal: 10,
3464
- // Gravity range (constant) for compounds
3465
- gravityRangeCompound: 1.5,
3466
- // Gravity force (constant) for compounds
3467
- gravityCompound: 1,
3468
- // Gravity range (constant)
3469
- gravityRange: 3.8,
3470
- // Initial cooling factor for incremental layout
3471
- initialEnergyOnIncremental: 0.3,
3472
- /* constraint options */
3473
- // Fix required nodes to predefined positions
3474
- // [{nodeId: 'n1', position: {x: 100, y: 200}, {...}]
3475
- fixedNodeConstraint: void 0,
3476
- // Align required nodes in vertical/horizontal direction
3477
- // {vertical: [['n1', 'n2')], ['n3', 'n4']], horizontal: ['n2', 'n4']}
3478
- alignmentConstraint: void 0,
3479
- // Place two nodes relatively in vertical/horizontal direction
3480
- // [{top: 'n1', bottom: 'n2', gap: 100}, {left: 'n3', right: 'n4', gap: 75}]
3481
- relativePlacementConstraint: void 0,
3482
- /* layout event callbacks */
3483
- ready: function() {
3484
- },
3485
- // on layoutready
3486
- stop: function() {
3487
- }
3488
- // on layoutstop
3489
- }), g = function() {
3490
- function d(L) {
3491
- a(this, d), this.options = y({}, T, L);
3492
- }
3493
- return f(d, [{
3494
- key: "run",
3495
- value: function() {
3496
- var F = this, M = this.options, P = M.cy, J = M.eles, V = [], Q = [], D = void 0, rt = [];
3497
- M.fixedNodeConstraint && (!Array.isArray(M.fixedNodeConstraint) || M.fixedNodeConstraint.length == 0) && (M.fixedNodeConstraint = void 0), M.alignmentConstraint && (M.alignmentConstraint.vertical && (!Array.isArray(M.alignmentConstraint.vertical) || M.alignmentConstraint.vertical.length == 0) && (M.alignmentConstraint.vertical = void 0), M.alignmentConstraint.horizontal && (!Array.isArray(M.alignmentConstraint.horizontal) || M.alignmentConstraint.horizontal.length == 0) && (M.alignmentConstraint.horizontal = void 0)), M.relativePlacementConstraint && (!Array.isArray(M.relativePlacementConstraint) || M.relativePlacementConstraint.length == 0) && (M.relativePlacementConstraint = void 0);
3498
- var n = M.fixedNodeConstraint || M.alignmentConstraint || M.relativePlacementConstraint;
3499
- n && (M.tile = !1, M.packComponents = !1);
3500
- var m = void 0, v = !1;
3501
- if (P.layoutUtilities && M.packComponents && (m = P.layoutUtilities("get"), m || (m = P.layoutUtilities()), v = !0), J.nodes().length > 0)
3502
- if (v) {
3503
- var I = t.getTopMostNodes(M.eles.nodes());
3504
- if (D = t.connectComponents(P, M.eles, I), D.forEach(function(vt) {
3505
- var it = vt.boundingBox();
3506
- rt.push({ x: it.x1 + it.w / 2, y: it.y1 + it.h / 2 });
3507
- }), M.randomize && D.forEach(function(vt) {
3508
- M.eles = vt, V.push(o(M));
3509
- }), M.quality == "default" || M.quality == "proof") {
3510
- var w = P.collection();
3511
- if (M.tile) {
3512
- var R = /* @__PURE__ */ new Map(), H = [], x = [], k = 0, W = { nodeIndexes: R, xCoords: H, yCoords: x }, U = [];
3513
- if (D.forEach(function(vt, it) {
3514
- vt.edges().length == 0 && (vt.nodes().forEach(function(gt, Tt) {
3515
- w.merge(vt.nodes()[Tt]), gt.isParent() || (W.nodeIndexes.set(vt.nodes()[Tt].id(), k++), W.xCoords.push(vt.nodes()[0].position().x), W.yCoords.push(vt.nodes()[0].position().y));
3516
- }), U.push(it));
3517
- }), w.length > 1) {
3518
- var et = w.boundingBox();
3519
- rt.push({ x: et.x1 + et.w / 2, y: et.y1 + et.h / 2 }), D.push(w), V.push(W);
3520
- for (var z = U.length - 1; z >= 0; z--)
3521
- D.splice(U[z], 1), V.splice(U[z], 1), rt.splice(U[z], 1);
3522
- }
3523
- }
3524
- D.forEach(function(vt, it) {
3525
- M.eles = vt, Q.push(l(M, V[it])), t.relocateComponent(rt[it], Q[it], M);
3526
- });
3527
- } else
3528
- D.forEach(function(vt, it) {
3529
- t.relocateComponent(rt[it], V[it], M);
3530
- });
3531
- var O = /* @__PURE__ */ new Set();
3532
- if (D.length > 1) {
3533
- var X = [], B = J.filter(function(vt) {
3534
- return vt.css("display") == "none";
3535
- });
3536
- D.forEach(function(vt, it) {
3537
- var gt = void 0;
3538
- if (M.quality == "draft" && (gt = V[it].nodeIndexes), vt.nodes().not(B).length > 0) {
3539
- var Tt = {};
3540
- Tt.edges = [], Tt.nodes = [];
3541
- var At = void 0;
3542
- vt.nodes().not(B).forEach(function(Dt) {
3543
- if (M.quality == "draft")
3544
- if (!Dt.isParent())
3545
- At = gt.get(Dt.id()), Tt.nodes.push({ x: V[it].xCoords[At] - Dt.boundingbox().w / 2, y: V[it].yCoords[At] - Dt.boundingbox().h / 2, width: Dt.boundingbox().w, height: Dt.boundingbox().h });
3546
- else {
3547
- var mt = t.calcBoundingBox(Dt, V[it].xCoords, V[it].yCoords, gt);
3548
- Tt.nodes.push({ x: mt.topLeftX, y: mt.topLeftY, width: mt.width, height: mt.height });
3549
- }
3550
- else
3551
- Q[it][Dt.id()] && Tt.nodes.push({ x: Q[it][Dt.id()].getLeft(), y: Q[it][Dt.id()].getTop(), width: Q[it][Dt.id()].getWidth(), height: Q[it][Dt.id()].getHeight() });
3552
- }), vt.edges().forEach(function(Dt) {
3553
- var mt = Dt.source(), xt = Dt.target();
3554
- if (mt.css("display") != "none" && xt.css("display") != "none")
3555
- if (M.quality == "draft") {
3556
- var St = gt.get(mt.id()), Vt = gt.get(xt.id()), Xt = [], Ut = [];
3557
- if (mt.isParent()) {
3558
- var bt = t.calcBoundingBox(mt, V[it].xCoords, V[it].yCoords, gt);
3559
- Xt.push(bt.topLeftX + bt.width / 2), Xt.push(bt.topLeftY + bt.height / 2);
3560
- } else
3561
- Xt.push(V[it].xCoords[St]), Xt.push(V[it].yCoords[St]);
3562
- if (xt.isParent()) {
3563
- var Ht = t.calcBoundingBox(xt, V[it].xCoords, V[it].yCoords, gt);
3564
- Ut.push(Ht.topLeftX + Ht.width / 2), Ut.push(Ht.topLeftY + Ht.height / 2);
3565
- } else
3566
- Ut.push(V[it].xCoords[Vt]), Ut.push(V[it].yCoords[Vt]);
3567
- Tt.edges.push({ startX: Xt[0], startY: Xt[1], endX: Ut[0], endY: Ut[1] });
3568
- } else
3569
- Q[it][mt.id()] && Q[it][xt.id()] && Tt.edges.push({ startX: Q[it][mt.id()].getCenterX(), startY: Q[it][mt.id()].getCenterY(), endX: Q[it][xt.id()].getCenterX(), endY: Q[it][xt.id()].getCenterY() });
3570
- }), Tt.nodes.length > 0 && (X.push(Tt), O.add(it));
3571
- }
3572
- });
3573
- var _ = m.packComponents(X, M.randomize).shifts;
3574
- if (M.quality == "draft")
3575
- V.forEach(function(vt, it) {
3576
- var gt = vt.xCoords.map(function(At) {
3577
- return At + _[it].dx;
3578
- }), Tt = vt.yCoords.map(function(At) {
3579
- return At + _[it].dy;
3580
- });
3581
- vt.xCoords = gt, vt.yCoords = Tt;
3582
- });
3583
- else {
3584
- var lt = 0;
3585
- O.forEach(function(vt) {
3586
- Object.keys(Q[vt]).forEach(function(it) {
3587
- var gt = Q[vt][it];
3588
- gt.setCenter(gt.getCenterX() + _[lt].dx, gt.getCenterY() + _[lt].dy);
3589
- }), lt++;
3590
- });
3591
- }
3592
- }
3593
- } else {
3594
- var E = M.eles.boundingBox();
3595
- if (rt.push({ x: E.x1 + E.w / 2, y: E.y1 + E.h / 2 }), M.randomize) {
3596
- var p = o(M);
3597
- V.push(p);
3598
- }
3599
- M.quality == "default" || M.quality == "proof" ? (Q.push(l(M, V[0])), t.relocateComponent(rt[0], Q[0], M)) : t.relocateComponent(rt[0], V[0], M);
3600
- }
3601
- var q = function(it, gt) {
3602
- if (M.quality == "default" || M.quality == "proof") {
3603
- typeof it == "number" && (it = gt);
3604
- var Tt = void 0, At = void 0, Dt = it.data("id");
3605
- return Q.forEach(function(xt) {
3606
- Dt in xt && (Tt = { x: xt[Dt].getRect().getCenterX(), y: xt[Dt].getRect().getCenterY() }, At = xt[Dt]);
3607
- }), M.nodeDimensionsIncludeLabels && (At.labelWidth && (At.labelPosHorizontal == "left" ? Tt.x += At.labelWidth / 2 : At.labelPosHorizontal == "right" && (Tt.x -= At.labelWidth / 2)), At.labelHeight && (At.labelPosVertical == "top" ? Tt.y += At.labelHeight / 2 : At.labelPosVertical == "bottom" && (Tt.y -= At.labelHeight / 2))), Tt == null && (Tt = { x: it.position("x"), y: it.position("y") }), {
3608
- x: Tt.x,
3609
- y: Tt.y
3610
- };
3611
- } else {
3612
- var mt = void 0;
3613
- return V.forEach(function(xt) {
3614
- var St = xt.nodeIndexes.get(it.id());
3615
- St != null && (mt = { x: xt.xCoords[St], y: xt.yCoords[St] });
3616
- }), mt == null && (mt = { x: it.position("x"), y: it.position("y") }), {
3617
- x: mt.x,
3618
- y: mt.y
3619
- };
3620
- }
3621
- };
3622
- if (M.quality == "default" || M.quality == "proof" || M.randomize) {
3623
- var Rt = t.calcParentsWithoutChildren(P, J), Lt = J.filter(function(vt) {
3624
- return vt.css("display") == "none";
3625
- });
3626
- M.eles = J.not(Lt), J.nodes().not(":parent").not(Lt).layoutPositions(F, M, q), Rt.length > 0 && Rt.forEach(function(vt) {
3627
- vt.position(q(vt));
3628
- });
3629
- } else
3630
- console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.");
3631
- }
3632
- }]), d;
3633
- }();
3634
- i.exports = g;
3635
- }
3636
- ),
3637
- /***/
3638
- 657: (
3639
- /***/
3640
- (i, r, e) => {
3641
- var f = e(548), a = e(140).layoutBase.Matrix, y = e(140).layoutBase.SVD, t = function(o) {
3642
- var c = o.cy, l = o.eles, T = l.nodes(), g = l.nodes(":parent"), d = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), M = [], P = [], J = [], V = [], Q = [], D = [], rt = [], n = [], m = void 0, v = 1e8, E = 1e-9, p = o.piTol, I = o.samplingType, w = o.nodeSeparation, R = void 0, H = function() {
3643
- for (var b = 0, $ = 0, K = !1; $ < R; ) {
3644
- b = Math.floor(Math.random() * m), K = !1;
3645
- for (var Z = 0; Z < $; Z++)
3646
- if (V[Z] == b) {
3647
- K = !0;
3648
- break;
3649
- }
3650
- if (!K)
3651
- V[$] = b, $++;
3652
- else
3653
- continue;
3654
- }
3655
- }, x = function(b, $, K) {
3656
- for (var Z = [], at = 0, ut = 0, ot = 0, tt = void 0, j = [], dt = 0, wt = 1, yt = 0; yt < m; yt++)
3657
- j[yt] = v;
3658
- for (Z[ut] = b, j[b] = 0; ut >= at; ) {
3659
- ot = Z[at++];
3660
- for (var It = M[ot], ft = 0; ft < It.length; ft++)
3661
- tt = L.get(It[ft]), j[tt] == v && (j[tt] = j[ot] + 1, Z[++ut] = tt);
3662
- D[ot][$] = j[ot] * w;
3663
- }
3664
- if (K) {
3665
- for (var st = 0; st < m; st++)
3666
- D[st][$] < Q[st] && (Q[st] = D[st][$]);
3667
- for (var Ct = 0; Ct < m; Ct++)
3668
- Q[Ct] > dt && (dt = Q[Ct], wt = Ct);
3669
- }
3670
- return wt;
3671
- }, k = function(b) {
3672
- var $ = void 0;
3673
- if (b) {
3674
- $ = Math.floor(Math.random() * m);
3675
- for (var Z = 0; Z < m; Z++)
3676
- Q[Z] = v;
3677
- for (var at = 0; at < R; at++)
3678
- V[at] = $, $ = x($, at, b);
3679
- } else {
3680
- H();
3681
- for (var K = 0; K < R; K++)
3682
- x(V[K], K, b);
3683
- }
3684
- for (var ut = 0; ut < m; ut++)
3685
- for (var ot = 0; ot < R; ot++)
3686
- D[ut][ot] *= D[ut][ot];
3687
- for (var tt = 0; tt < R; tt++)
3688
- rt[tt] = [];
3689
- for (var j = 0; j < R; j++)
3690
- for (var dt = 0; dt < R; dt++)
3691
- rt[j][dt] = D[V[dt]][j];
3692
- }, W = function() {
3693
- for (var b = y.svd(rt), $ = b.S, K = b.U, Z = b.V, at = $[0] * $[0] * $[0], ut = [], ot = 0; ot < R; ot++) {
3694
- ut[ot] = [];
3695
- for (var tt = 0; tt < R; tt++)
3696
- ut[ot][tt] = 0, ot == tt && (ut[ot][tt] = $[ot] / ($[ot] * $[ot] + at / ($[ot] * $[ot])));
3697
- }
3698
- n = a.multMat(a.multMat(Z, ut), a.transpose(K));
3699
- }, U = function() {
3700
- for (var b = void 0, $ = void 0, K = [], Z = [], at = [], ut = [], ot = 0; ot < m; ot++)
3701
- K[ot] = Math.random(), Z[ot] = Math.random();
3702
- K = a.normalize(K), Z = a.normalize(Z);
3703
- for (var tt = E, j = E, dt = void 0; ; ) {
3704
- for (var wt = 0; wt < m; wt++)
3705
- at[wt] = K[wt];
3706
- if (K = a.multGamma(a.multL(a.multGamma(at), D, n)), b = a.dotProduct(at, K), K = a.normalize(K), tt = a.dotProduct(at, K), dt = Math.abs(tt / j), dt <= 1 + p && dt >= 1)
3707
- break;
3708
- j = tt;
3709
- }
3710
- for (var yt = 0; yt < m; yt++)
3711
- at[yt] = K[yt];
3712
- for (j = E; ; ) {
3713
- for (var It = 0; It < m; It++)
3714
- ut[It] = Z[It];
3715
- if (ut = a.minusOp(ut, a.multCons(at, a.dotProduct(at, ut))), Z = a.multGamma(a.multL(a.multGamma(ut), D, n)), $ = a.dotProduct(ut, Z), Z = a.normalize(Z), tt = a.dotProduct(ut, Z), dt = Math.abs(tt / j), dt <= 1 + p && dt >= 1)
3716
- break;
3717
- j = tt;
3718
- }
3719
- for (var ft = 0; ft < m; ft++)
3720
- ut[ft] = Z[ft];
3721
- P = a.multCons(at, Math.sqrt(Math.abs(b))), J = a.multCons(ut, Math.sqrt(Math.abs($)));
3722
- };
3723
- f.connectComponents(c, l, f.getTopMostNodes(T), d), g.forEach(function(S) {
3724
- f.connectComponents(c, l, f.getTopMostNodes(S.descendants().intersection(l)), d);
3725
- });
3726
- for (var et = 0, z = 0; z < T.length; z++)
3727
- T[z].isParent() || L.set(T[z].id(), et++);
3728
- var O = !0, X = !1, B = void 0;
3729
- try {
3730
- for (var _ = d.keys()[Symbol.iterator](), lt; !(O = (lt = _.next()).done); O = !0) {
3731
- var q = lt.value;
3732
- L.set(q, et++);
3733
- }
3734
- } catch (S) {
3735
- X = !0, B = S;
3736
- } finally {
3737
- try {
3738
- !O && _.return && _.return();
3739
- } finally {
3740
- if (X)
3741
- throw B;
3742
- }
3743
- }
3744
- for (var Rt = 0; Rt < L.size; Rt++)
3745
- M[Rt] = [];
3746
- g.forEach(function(S) {
3747
- for (var b = S.children().intersection(l); b.nodes(":childless").length == 0; )
3748
- b = b.nodes()[0].children().intersection(l);
3749
- var $ = 0, K = b.nodes(":childless")[0].connectedEdges().length;
3750
- b.nodes(":childless").forEach(function(Z, at) {
3751
- Z.connectedEdges().length < K && (K = Z.connectedEdges().length, $ = at);
3752
- }), F.set(S.id(), b.nodes(":childless")[$].id());
3753
- }), T.forEach(function(S) {
3754
- var b = void 0;
3755
- S.isParent() ? b = L.get(F.get(S.id())) : b = L.get(S.id()), S.neighborhood().nodes().forEach(function($) {
3756
- l.intersection(S.edgesWith($)).length > 0 && ($.isParent() ? M[b].push(F.get($.id())) : M[b].push($.id()));
3757
- });
3758
- });
3759
- var Lt = function(b) {
3760
- var $ = L.get(b), K = void 0;
3761
- d.get(b).forEach(function(Z) {
3762
- c.getElementById(Z).isParent() ? K = F.get(Z) : K = Z, M[$].push(K), M[L.get(K)].push(b);
3763
- });
3764
- }, vt = !0, it = !1, gt = void 0;
3765
- try {
3766
- for (var Tt = d.keys()[Symbol.iterator](), At; !(vt = (At = Tt.next()).done); vt = !0) {
3767
- var Dt = At.value;
3768
- Lt(Dt);
3769
- }
3770
- } catch (S) {
3771
- it = !0, gt = S;
3772
- } finally {
3773
- try {
3774
- !vt && Tt.return && Tt.return();
3775
- } finally {
3776
- if (it)
3777
- throw gt;
3778
- }
3779
- }
3780
- m = L.size;
3781
- var mt = void 0;
3782
- if (m > 2) {
3783
- R = m < o.sampleSize ? m : o.sampleSize;
3784
- for (var xt = 0; xt < m; xt++)
3785
- D[xt] = [];
3786
- for (var St = 0; St < R; St++)
3787
- n[St] = [];
3788
- return o.quality == "draft" || o.step == "all" ? (k(I), W(), U(), mt = { nodeIndexes: L, xCoords: P, yCoords: J }) : (L.forEach(function(S, b) {
3789
- P.push(c.getElementById(b).position("x")), J.push(c.getElementById(b).position("y"));
3790
- }), mt = { nodeIndexes: L, xCoords: P, yCoords: J }), mt;
3791
- } else {
3792
- var Vt = L.keys(), Xt = c.getElementById(Vt.next().value), Ut = Xt.position(), bt = Xt.outerWidth();
3793
- if (P.push(Ut.x), J.push(Ut.y), m == 2) {
3794
- var Ht = c.getElementById(Vt.next().value), Bt = Ht.outerWidth();
3795
- P.push(Ut.x + bt / 2 + Bt / 2 + o.idealEdgeLength), J.push(Ut.y);
3796
- }
3797
- return mt = { nodeIndexes: L, xCoords: P, yCoords: J }, mt;
3798
- }
3799
- };
3800
- i.exports = { spectralLayout: t };
3801
- }
3802
- ),
3803
- /***/
3804
- 579: (
3805
- /***/
3806
- (i, r, e) => {
3807
- var f = e(212), a = function(t) {
3808
- t && t("layout", "fcose", f);
3809
- };
3810
- typeof cytoscape < "u" && a(cytoscape), i.exports = a;
3811
- }
3812
- ),
3813
- /***/
3814
- 140: (
3815
- /***/
3816
- (i) => {
3817
- i.exports = A;
3818
- }
3819
- )
3820
- /******/
3821
- }, N = {};
3822
- function u(i) {
3823
- var r = N[i];
3824
- if (r !== void 0)
3825
- return r.exports;
3826
- var e = N[i] = {
3827
- /******/
3828
- // no module.id needed
3829
- /******/
3830
- // no module.loaded needed
3831
- /******/
3832
- exports: {}
3833
- /******/
3834
- };
3835
- return G[i](e, e.exports, u), e.exports;
3836
- }
3837
- var s = u(579);
3838
- return s;
3839
- })()
3840
- );
3841
- });
3842
- }(le)), le.exports;
3843
- }
3844
- var pr = vr();
3845
- const yr = /* @__PURE__ */ lr(pr);
3846
- var Ie = {
3847
- L: "left",
3848
- R: "right",
3849
- T: "top",
3850
- B: "bottom"
3851
- }, Re = {
3852
- L: /* @__PURE__ */ nt((C) => `${C},${C / 2} 0,${C} 0,0`, "L"),
3853
- R: /* @__PURE__ */ nt((C) => `0,${C / 2} ${C},0 ${C},${C}`, "R"),
3854
- T: /* @__PURE__ */ nt((C) => `0,0 ${C},0 ${C / 2},${C}`, "T"),
3855
- B: /* @__PURE__ */ nt((C) => `${C / 2},0 ${C},${C} 0,${C}`, "B")
3856
- }, he = {
3857
- L: /* @__PURE__ */ nt((C, Y) => C - Y + 2, "L"),
3858
- R: /* @__PURE__ */ nt((C, Y) => C - 2, "R"),
3859
- T: /* @__PURE__ */ nt((C, Y) => C - Y + 2, "T"),
3860
- B: /* @__PURE__ */ nt((C, Y) => C - 2, "B")
3861
- }, Er = /* @__PURE__ */ nt(function(C) {
3862
- return zt(C) ? C === "L" ? "R" : "L" : C === "T" ? "B" : "T";
3863
- }, "getOppositeArchitectureDirection"), Se = /* @__PURE__ */ nt(function(C) {
3864
- const Y = C;
3865
- return Y === "L" || Y === "R" || Y === "T" || Y === "B";
3866
- }, "isArchitectureDirection"), zt = /* @__PURE__ */ nt(function(C) {
3867
- const Y = C;
3868
- return Y === "L" || Y === "R";
3869
- }, "isArchitectureDirectionX"), Qt = /* @__PURE__ */ nt(function(C) {
3870
- const Y = C;
3871
- return Y === "T" || Y === "B";
3872
- }, "isArchitectureDirectionY"), Pe = /* @__PURE__ */ nt(function(C, Y) {
3873
- const A = zt(C) && Qt(Y), G = Qt(C) && zt(Y);
3874
- return A || G;
3875
- }, "isArchitectureDirectionXY"), mr = /* @__PURE__ */ nt(function(C) {
3876
- const Y = C[0], A = C[1], G = zt(Y) && Qt(A), N = Qt(Y) && zt(A);
3877
- return G || N;
3878
- }, "isArchitecturePairXY"), Tr = /* @__PURE__ */ nt(function(C) {
3879
- return C !== "LL" && C !== "RR" && C !== "TT" && C !== "BB";
3880
- }, "isValidArchitectureDirectionPair"), Te = /* @__PURE__ */ nt(function(C, Y) {
3881
- const A = `${C}${Y}`;
3882
- return Tr(A) ? A : void 0;
3883
- }, "getArchitectureDirectionPair"), Nr = /* @__PURE__ */ nt(function([C, Y], A) {
3884
- const G = A[0], N = A[1];
3885
- return zt(G) ? Qt(N) ? [C + (G === "L" ? -1 : 1), Y + (N === "T" ? 1 : -1)] : [C + (G === "L" ? -1 : 1), Y] : zt(N) ? [C + (N === "L" ? 1 : -1), Y + (G === "T" ? 1 : -1)] : [C, Y + (G === "T" ? 1 : -1)];
3886
- }, "shiftPositionByArchitectureDirectionPair"), Lr = /* @__PURE__ */ nt(function(C) {
3887
- return C === "LT" || C === "TL" ? [1, 1] : C === "BL" || C === "LB" ? [1, -1] : C === "BR" || C === "RB" ? [-1, -1] : [-1, 1];
3888
- }, "getArchitectureDirectionXYFactors"), Cr = /* @__PURE__ */ nt(function(C) {
3889
- return C.type === "service";
3890
- }, "isArchitectureService"), Mr = /* @__PURE__ */ nt(function(C) {
3891
- return C.type === "junction";
3892
- }, "isArchitectureJunction"), Ge = /* @__PURE__ */ nt((C) => C.data(), "edgeData"), ne = /* @__PURE__ */ nt((C) => C.data(), "nodeData"), Ue = ir.architecture, pt = new sr(() => ({
3893
- nodes: {},
3894
- groups: {},
3895
- edges: [],
3896
- registeredIds: {},
3897
- config: Ue,
3898
- dataStructures: void 0,
3899
- elements: {}
3900
- })), Ar = /* @__PURE__ */ nt(() => {
3901
- pt.reset(), er();
3902
- }, "clear"), wr = /* @__PURE__ */ nt(function({
3903
- id: C,
3904
- icon: Y,
3905
- in: A,
3906
- title: G,
3907
- iconText: N
3908
- }) {
3909
- if (pt.records.registeredIds[C] !== void 0)
3910
- throw new Error(
3911
- `The service id [${C}] is already in use by another ${pt.records.registeredIds[C]}`
3912
- );
3913
- if (A !== void 0) {
3914
- if (C === A)
3915
- throw new Error(`The service [${C}] cannot be placed within itself`);
3916
- if (pt.records.registeredIds[A] === void 0)
3917
- throw new Error(
3918
- `The service [${C}]'s parent does not exist. Please make sure the parent is created before this service`
3919
- );
3920
- if (pt.records.registeredIds[A] === "node")
3921
- throw new Error(`The service [${C}]'s parent is not a group`);
3922
- }
3923
- pt.records.registeredIds[C] = "node", pt.records.nodes[C] = {
3924
- id: C,
3925
- type: "service",
3926
- icon: Y,
3927
- iconText: N,
3928
- title: G,
3929
- edges: [],
3930
- in: A
3931
- };
3932
- }, "addService"), Or = /* @__PURE__ */ nt(() => Object.values(pt.records.nodes).filter(Cr), "getServices"), Dr = /* @__PURE__ */ nt(function({ id: C, in: Y }) {
3933
- pt.records.registeredIds[C] = "node", pt.records.nodes[C] = {
3934
- id: C,
3935
- type: "junction",
3936
- edges: [],
3937
- in: Y
3938
- };
3939
- }, "addJunction"), xr = /* @__PURE__ */ nt(() => Object.values(pt.records.nodes).filter(Mr), "getJunctions"), Ir = /* @__PURE__ */ nt(() => Object.values(pt.records.nodes), "getNodes"), Rr = /* @__PURE__ */ nt((C) => pt.records.nodes[C], "getNode"), Sr = /* @__PURE__ */ nt(function({ id: C, icon: Y, in: A, title: G }) {
3940
- if (pt.records.registeredIds[C] !== void 0)
3941
- throw new Error(
3942
- `The group id [${C}] is already in use by another ${pt.records.registeredIds[C]}`
3943
- );
3944
- if (A !== void 0) {
3945
- if (C === A)
3946
- throw new Error(`The group [${C}] cannot be placed within itself`);
3947
- if (pt.records.registeredIds[A] === void 0)
3948
- throw new Error(
3949
- `The group [${C}]'s parent does not exist. Please make sure the parent is created before this group`
3950
- );
3951
- if (pt.records.registeredIds[A] === "node")
3952
- throw new Error(`The group [${C}]'s parent is not a group`);
3953
- }
3954
- pt.records.registeredIds[C] = "group", pt.records.groups[C] = {
3955
- id: C,
3956
- icon: Y,
3957
- title: G,
3958
- in: A
3959
- };
3960
- }, "addGroup"), Fr = /* @__PURE__ */ nt(() => Object.values(pt.records.groups), "getGroups"), br = /* @__PURE__ */ nt(function({
3961
- lhsId: C,
3962
- rhsId: Y,
3963
- lhsDir: A,
3964
- rhsDir: G,
3965
- lhsInto: N,
3966
- rhsInto: u,
3967
- lhsGroup: s,
3968
- rhsGroup: i,
3969
- title: r
3970
- }) {
3971
- if (!Se(A))
3972
- throw new Error(
3973
- `Invalid direction given for left hand side of edge ${C}--${Y}. Expected (L,R,T,B) got ${A}`
3974
- );
3975
- if (!Se(G))
3976
- throw new Error(
3977
- `Invalid direction given for right hand side of edge ${C}--${Y}. Expected (L,R,T,B) got ${G}`
3978
- );
3979
- if (pt.records.nodes[C] === void 0 && pt.records.groups[C] === void 0)
3980
- throw new Error(
3981
- `The left-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`
3982
- );
3983
- if (pt.records.nodes[Y] === void 0 && pt.records.groups[C] === void 0)
3984
- throw new Error(
3985
- `The right-hand id [${Y}] does not yet exist. Please create the service/group before declaring an edge to it.`
3986
- );
3987
- const e = pt.records.nodes[C].in, f = pt.records.nodes[Y].in;
3988
- if (s && e && f && e == f)
3989
- throw new Error(
3990
- `The left-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
3991
- );
3992
- if (i && e && f && e == f)
3993
- throw new Error(
3994
- `The right-hand id [${Y}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
3995
- );
3996
- const a = {
3997
- lhsId: C,
3998
- lhsDir: A,
3999
- lhsInto: N,
4000
- lhsGroup: s,
4001
- rhsId: Y,
4002
- rhsDir: G,
4003
- rhsInto: u,
4004
- rhsGroup: i,
4005
- title: r
4006
- };
4007
- pt.records.edges.push(a), pt.records.nodes[C] && pt.records.nodes[Y] && (pt.records.nodes[C].edges.push(pt.records.edges[pt.records.edges.length - 1]), pt.records.nodes[Y].edges.push(pt.records.edges[pt.records.edges.length - 1]));
4008
- }, "addEdge"), Pr = /* @__PURE__ */ nt(() => pt.records.edges, "getEdges"), Gr = /* @__PURE__ */ nt(() => {
4009
- if (pt.records.dataStructures === void 0) {
4010
- const C = Object.entries(pt.records.nodes).reduce((s, [i, r]) => (s[i] = r.edges.reduce((e, f) => {
4011
- if (f.lhsId === i) {
4012
- const a = Te(f.lhsDir, f.rhsDir);
4013
- a && (e[a] = f.rhsId);
4014
- } else {
4015
- const a = Te(f.rhsDir, f.lhsDir);
4016
- a && (e[a] = f.lhsId);
4017
- }
4018
- return e;
4019
- }, {}), s), {}), Y = Object.keys(C)[0], A = { [Y]: 1 }, G = Object.keys(C).reduce(
4020
- (s, i) => i === Y ? s : { ...s, [i]: 1 },
4021
- {}
4022
- ), N = /* @__PURE__ */ nt((s) => {
4023
- const i = { [s]: [0, 0] }, r = [s];
4024
- for (; r.length > 0; ) {
4025
- const e = r.shift();
4026
- if (e) {
4027
- A[e] = 1, delete G[e];
4028
- const f = C[e], [a, y] = i[e];
4029
- Object.entries(f).forEach(([t, h]) => {
4030
- A[h] || (i[h] = Nr(
4031
- [a, y],
4032
- t
4033
- ), r.push(h));
4034
- });
4035
- }
4036
- }
4037
- return i;
4038
- }, "BFS"), u = [N(Y)];
4039
- for (; Object.keys(G).length > 0; )
4040
- u.push(N(Object.keys(G)[0]));
4041
- pt.records.dataStructures = {
4042
- adjList: C,
4043
- spatialMaps: u
4044
- };
4045
- }
4046
- return pt.records.dataStructures;
4047
- }, "getDataStructures"), Ur = /* @__PURE__ */ nt((C, Y) => {
4048
- pt.records.elements[C] = Y;
4049
- }, "setElementForId"), Yr = /* @__PURE__ */ nt((C) => pt.records.elements[C], "getElementById"), ue = {
4050
- clear: Ar,
4051
- setDiagramTitle: je,
4052
- getDiagramTitle: Ke,
4053
- setAccTitle: Qe,
4054
- getAccTitle: Je,
4055
- setAccDescription: qe,
4056
- getAccDescription: ke,
4057
- addService: wr,
4058
- getServices: Or,
4059
- addJunction: Dr,
4060
- getJunctions: xr,
4061
- getNodes: Ir,
4062
- getNode: Rr,
4063
- addGroup: Sr,
4064
- getGroups: Fr,
4065
- addEdge: br,
4066
- getEdges: Pr,
4067
- setElementForId: Ur,
4068
- getElementById: Yr,
4069
- getDataStructures: Gr
4070
- };
4071
- function Pt(C) {
4072
- const Y = ge().architecture;
4073
- return Y != null && Y[C] ? Y[C] : Ue[C];
4074
- }
4075
- nt(Pt, "getConfigField");
4076
- var Xr = /* @__PURE__ */ nt((C, Y) => {
4077
- or(C, Y), C.groups.map(Y.addGroup), C.services.map((A) => Y.addService({ ...A, type: "service" })), C.junctions.map((A) => Y.addJunction({ ...A, type: "junction" })), C.edges.map(Y.addEdge);
4078
- }, "populateDb"), Hr = {
4079
- parse: /* @__PURE__ */ nt(async (C) => {
4080
- const Y = await hr("architecture", C);
4081
- Fe.debug(Y), Xr(Y, ue);
4082
- }, "parse")
4083
- }, Wr = /* @__PURE__ */ nt((C) => `
4084
- .edge {
4085
- stroke-width: ${C.archEdgeWidth};
4086
- stroke: ${C.archEdgeColor};
4087
- fill: none;
4088
- }
4089
-
4090
- .arrow {
4091
- fill: ${C.archEdgeArrowColor};
4092
- }
4093
-
4094
- .node-bkg {
4095
- fill: none;
4096
- stroke: ${C.archGroupBorderColor};
4097
- stroke-width: ${C.archGroupBorderWidth};
4098
- stroke-dasharray: 8;
4099
- }
4100
- .node-icon-text {
4101
- display: flex;
4102
- align-items: center;
4103
- }
4104
-
4105
- .node-icon-text > div {
4106
- color: #fff;
4107
- margin: 1px;
4108
- height: fit-content;
4109
- text-align: center;
4110
- overflow: hidden;
4111
- display: -webkit-box;
4112
- -webkit-box-orient: vertical;
4113
- }
4114
- `, "getStyles"), Vr = Wr, ae = /* @__PURE__ */ nt((C) => `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${C}</g>`, "wrapIcon"), oe = {
4115
- prefix: "mermaid-architecture",
4116
- height: 80,
4117
- width: 80,
4118
- icons: {
4119
- database: {
4120
- body: ae(
4121
- '<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
4122
- )
4123
- },
4124
- server: {
4125
- body: ae(
4126
- '<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>'
4127
- )
4128
- },
4129
- disk: {
4130
- body: ae(
4131
- '<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>'
4132
- )
4133
- },
4134
- internet: {
4135
- body: ae(
4136
- '<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
4137
- )
4138
- },
4139
- cloud: {
4140
- body: ae(
4141
- '<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
4142
- )
4143
- },
4144
- unknown: nr,
4145
- blank: {
4146
- body: ae("")
4147
- }
4148
- }
4149
- }, zr = /* @__PURE__ */ nt(async function(C, Y) {
4150
- const A = Pt("padding"), G = Pt("iconSize"), N = G / 2, u = G / 6, s = u / 2;
4151
- await Promise.all(
4152
- Y.edges().map(async (i) => {
4153
- var P, J;
4154
- const {
4155
- source: r,
4156
- sourceDir: e,
4157
- sourceArrow: f,
4158
- sourceGroup: a,
4159
- target: y,
4160
- targetDir: t,
4161
- targetArrow: h,
4162
- targetGroup: o,
4163
- label: c
4164
- } = Ge(i);
4165
- let { x: l, y: T } = i[0].sourceEndpoint();
4166
- const { x: g, y: d } = i[0].midpoint();
4167
- let { x: L, y: F } = i[0].targetEndpoint();
4168
- const M = A + 4;
4169
- if (a && (zt(e) ? l += e === "L" ? -M : M : T += e === "T" ? -M : M + 18), o && (zt(t) ? L += t === "L" ? -M : M : F += t === "T" ? -M : M + 18), !a && ((P = ue.getNode(r)) == null ? void 0 : P.type) === "junction" && (zt(e) ? l += e === "L" ? N : -N : T += e === "T" ? N : -N), !o && ((J = ue.getNode(y)) == null ? void 0 : J.type) === "junction" && (zt(t) ? L += t === "L" ? N : -N : F += t === "T" ? N : -N), i[0]._private.rscratch) {
4170
- const V = C.insert("g");
4171
- if (V.insert("path").attr("d", `M ${l},${T} L ${g},${d} L${L},${F} `).attr("class", "edge"), f) {
4172
- const Q = zt(e) ? he[e](l, u) : l - s, D = Qt(e) ? he[e](T, u) : T - s;
4173
- V.insert("polygon").attr("points", Re[e](u)).attr("transform", `translate(${Q},${D})`).attr("class", "arrow");
4174
- }
4175
- if (h) {
4176
- const Q = zt(t) ? he[t](L, u) : L - s, D = Qt(t) ? he[t](F, u) : F - s;
4177
- V.insert("polygon").attr("points", Re[t](u)).attr("transform", `translate(${Q},${D})`).attr("class", "arrow");
4178
- }
4179
- if (c) {
4180
- const Q = Pe(e, t) ? "XY" : zt(e) ? "X" : "Y";
4181
- let D = 0;
4182
- Q === "X" ? D = Math.abs(l - L) : Q === "Y" ? D = Math.abs(T - F) / 1.5 : D = Math.abs(l - L) / 2;
4183
- const rt = V.append("g");
4184
- if (await Ne(
4185
- rt,
4186
- c,
4187
- {
4188
- useHtmlLabels: !1,
4189
- width: D,
4190
- classes: "architecture-service-label"
4191
- },
4192
- ge()
4193
- ), rt.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), Q === "X")
4194
- rt.attr("transform", "translate(" + g + ", " + d + ")");
4195
- else if (Q === "Y")
4196
- rt.attr("transform", "translate(" + g + ", " + d + ") rotate(-90)");
4197
- else if (Q === "XY") {
4198
- const n = Te(e, t);
4199
- if (n && mr(n)) {
4200
- const m = rt.node().getBoundingClientRect(), [v, E] = Lr(n);
4201
- rt.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * v * E * 45})`);
4202
- const p = rt.node().getBoundingClientRect();
4203
- rt.attr(
4204
- "transform",
4205
- `
4206
- translate(${g}, ${d - m.height / 2})
4207
- translate(${v * p.width / 2}, ${E * p.height / 2})
4208
- rotate(${-1 * v * E * 45}, 0, ${m.height / 2})
4209
- `
4210
- );
4211
- }
4212
- }
4213
- }
4214
- }
4215
- })
4216
- );
4217
- }, "drawEdges"), Br = /* @__PURE__ */ nt(async function(C, Y) {
4218
- const G = Pt("padding") * 0.75, N = Pt("fontSize"), s = Pt("iconSize") / 2;
4219
- await Promise.all(
4220
- Y.nodes().map(async (i) => {
4221
- const r = ne(i);
4222
- if (r.type === "group") {
4223
- const { h: e, w: f, x1: a, y1: y } = i.boundingBox();
4224
- C.append("rect").attr("x", a + s).attr("y", y + s).attr("width", f).attr("height", e).attr("class", "node-bkg");
4225
- const t = C.append("g");
4226
- let h = a, o = y;
4227
- if (r.icon) {
4228
- const c = t.append("g");
4229
- c.html(
4230
- `<g>${await me(r.icon, { height: G, width: G, fallbackPrefix: oe.prefix })}</g>`
4231
- ), c.attr(
4232
- "transform",
4233
- "translate(" + (h + s + 1) + ", " + (o + s + 1) + ")"
4234
- ), h += G, o += N / 2 - 1 - 2;
4235
- }
4236
- if (r.label) {
4237
- const c = t.append("g");
4238
- await Ne(
4239
- c,
4240
- r.label,
4241
- {
4242
- useHtmlLabels: !1,
4243
- width: f,
4244
- classes: "architecture-service-label"
4245
- },
4246
- ge()
4247
- ), c.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), c.attr(
4248
- "transform",
4249
- "translate(" + (h + s + 4) + ", " + (o + s + 2) + ")"
4250
- );
4251
- }
4252
- }
4253
- })
4254
- );
4255
- }, "drawGroups"), $r = /* @__PURE__ */ nt(async function(C, Y, A) {
4256
- for (const G of A) {
4257
- const N = Y.append("g"), u = Pt("iconSize");
4258
- if (G.title) {
4259
- const e = N.append("g");
4260
- await Ne(
4261
- e,
4262
- G.title,
4263
- {
4264
- useHtmlLabels: !1,
4265
- width: u * 1.5,
4266
- classes: "architecture-service-label"
4267
- },
4268
- ge()
4269
- ), e.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), e.attr("transform", "translate(" + u / 2 + ", " + u + ")");
4270
- }
4271
- const s = N.append("g");
4272
- if (G.icon)
4273
- s.html(
4274
- `<g>${await me(G.icon, { height: u, width: u, fallbackPrefix: oe.prefix })}</g>`
4275
- );
4276
- else if (G.iconText) {
4277
- s.html(
4278
- `<g>${await me("blank", { height: u, width: u, fallbackPrefix: oe.prefix })}</g>`
4279
- );
4280
- const a = s.append("g").append("foreignObject").attr("width", u).attr("height", u).append("div").attr("class", "node-icon-text").attr("style", `height: ${u}px;`).append("div").html(G.iconText), y = parseInt(
4281
- window.getComputedStyle(a.node(), null).getPropertyValue("font-size").replace(/\D/g, "")
4282
- ) ?? 16;
4283
- a.attr("style", `-webkit-line-clamp: ${Math.floor((u - 2) / y)};`);
4284
- } else
4285
- s.append("path").attr("class", "node-bkg").attr("id", "node-" + G.id).attr(
4286
- "d",
4287
- `M0 ${u} v${-u} q0,-5 5,-5 h${u} q5,0 5,5 v${u} H0 Z`
4288
- );
4289
- N.attr("class", "architecture-service");
4290
- const { width: i, height: r } = N._groups[0][0].getBBox();
4291
- G.width = i, G.height = r, C.setElementForId(G.id, N);
4292
- }
4293
- return 0;
4294
- }, "drawServices"), Zr = /* @__PURE__ */ nt(function(C, Y, A) {
4295
- A.forEach((G) => {
4296
- const N = Y.append("g"), u = Pt("iconSize");
4297
- N.append("g").append("rect").attr("id", "node-" + G.id).attr("fill-opacity", "0").attr("width", u).attr("height", u), N.attr("class", "architecture-junction");
4298
- const { width: i, height: r } = N._groups[0][0].getBBox();
4299
- N.width = i, N.height = r, C.setElementForId(G.id, N);
4300
- });
4301
- }, "drawJunctions");
4302
- ar([
4303
- {
4304
- name: oe.prefix,
4305
- icons: oe
4306
- }
4307
- ]);
4308
- be.use(yr);
4309
- function Ye(C, Y) {
4310
- C.forEach((A) => {
4311
- Y.add({
4312
- group: "nodes",
4313
- data: {
4314
- type: "service",
4315
- id: A.id,
4316
- icon: A.icon,
4317
- label: A.title,
4318
- parent: A.in,
4319
- width: Pt("iconSize"),
4320
- height: Pt("iconSize")
4321
- },
4322
- classes: "node-service"
4323
- });
4324
- });
4325
- }
4326
- nt(Ye, "addServices");
4327
- function Xe(C, Y) {
4328
- C.forEach((A) => {
4329
- Y.add({
4330
- group: "nodes",
4331
- data: {
4332
- type: "junction",
4333
- id: A.id,
4334
- parent: A.in,
4335
- width: Pt("iconSize"),
4336
- height: Pt("iconSize")
4337
- },
4338
- classes: "node-junction"
4339
- });
4340
- });
4341
- }
4342
- nt(Xe, "addJunctions");
4343
- function He(C, Y) {
4344
- Y.nodes().map((A) => {
4345
- const G = ne(A);
4346
- if (G.type === "group")
4347
- return;
4348
- G.x = A.position().x, G.y = A.position().y, C.getElementById(G.id).attr("transform", "translate(" + (G.x || 0) + "," + (G.y || 0) + ")");
4349
- });
4350
- }
4351
- nt(He, "positionNodes");
4352
- function We(C, Y) {
4353
- C.forEach((A) => {
4354
- Y.add({
4355
- group: "nodes",
4356
- data: {
4357
- type: "group",
4358
- id: A.id,
4359
- icon: A.icon,
4360
- label: A.title,
4361
- parent: A.in
4362
- },
4363
- classes: "node-group"
4364
- });
4365
- });
4366
- }
4367
- nt(We, "addGroups");
4368
- function Ve(C, Y) {
4369
- C.forEach((A) => {
4370
- const { lhsId: G, rhsId: N, lhsInto: u, lhsGroup: s, rhsInto: i, lhsDir: r, rhsDir: e, rhsGroup: f, title: a } = A, y = Pe(A.lhsDir, A.rhsDir) ? "segments" : "straight", t = {
4371
- id: `${G}-${N}`,
4372
- label: a,
4373
- source: G,
4374
- sourceDir: r,
4375
- sourceArrow: u,
4376
- sourceGroup: s,
4377
- sourceEndpoint: r === "L" ? "0 50%" : r === "R" ? "100% 50%" : r === "T" ? "50% 0" : "50% 100%",
4378
- target: N,
4379
- targetDir: e,
4380
- targetArrow: i,
4381
- targetGroup: f,
4382
- targetEndpoint: e === "L" ? "0 50%" : e === "R" ? "100% 50%" : e === "T" ? "50% 0" : "50% 100%"
4383
- };
4384
- Y.add({
4385
- group: "edges",
4386
- data: t,
4387
- classes: y
4388
- });
4389
- });
4390
- }
4391
- nt(Ve, "addEdges");
4392
- function ze(C) {
4393
- const Y = C.map((N) => {
4394
- const u = {}, s = {};
4395
- return Object.entries(N).forEach(([i, [r, e]]) => {
4396
- u[e] || (u[e] = []), s[r] || (s[r] = []), u[e].push(i), s[r].push(i);
4397
- }), {
4398
- horiz: Object.values(u).filter((i) => i.length > 1),
4399
- vert: Object.values(s).filter((i) => i.length > 1)
4400
- };
4401
- }), [A, G] = Y.reduce(
4402
- ([N, u], { horiz: s, vert: i }) => [
4403
- [...N, ...s],
4404
- [...u, ...i]
4405
- ],
4406
- [[], []]
4407
- );
4408
- return {
4409
- horizontal: A,
4410
- vertical: G
4411
- };
4412
- }
4413
- nt(ze, "getAlignments");
4414
- function Be(C) {
4415
- const Y = [], A = /* @__PURE__ */ nt((N) => `${N[0]},${N[1]}`, "posToStr"), G = /* @__PURE__ */ nt((N) => N.split(",").map((u) => parseInt(u)), "strToPos");
4416
- return C.forEach((N) => {
4417
- const u = Object.fromEntries(
4418
- Object.entries(N).map(([e, f]) => [A(f), e])
4419
- ), s = [A([0, 0])], i = {}, r = {
4420
- L: [-1, 0],
4421
- R: [1, 0],
4422
- T: [0, 1],
4423
- B: [0, -1]
4424
- };
4425
- for (; s.length > 0; ) {
4426
- const e = s.shift();
4427
- if (e) {
4428
- i[e] = 1;
4429
- const f = u[e];
4430
- if (f) {
4431
- const a = G(e);
4432
- Object.entries(r).forEach(([y, t]) => {
4433
- const h = A([a[0] + t[0], a[1] + t[1]]), o = u[h];
4434
- o && !i[h] && (s.push(h), Y.push({
4435
- [Ie[y]]: o,
4436
- [Ie[Er(y)]]: f,
4437
- gap: 1.5 * Pt("iconSize")
4438
- }));
4439
- });
4440
- }
4441
- }
4442
- }
4443
- }), Y;
4444
- }
4445
- nt(Be, "getRelativeConstraints");
4446
- function $e(C, Y, A, G, { spatialMaps: N }) {
4447
- return new Promise((u) => {
4448
- const s = rr("body").append("div").attr("id", "cy").attr("style", "display:none"), i = be({
4449
- container: document.getElementById("cy"),
4450
- style: [
4451
- {
4452
- selector: "edge",
4453
- style: {
4454
- "curve-style": "straight",
4455
- label: "data(label)",
4456
- "source-endpoint": "data(sourceEndpoint)",
4457
- "target-endpoint": "data(targetEndpoint)"
4458
- }
4459
- },
4460
- {
4461
- selector: "edge.segments",
4462
- style: {
4463
- "curve-style": "segments",
4464
- "segment-weights": "0",
4465
- "segment-distances": [0.5],
4466
- // @ts-ignore Incorrect library types
4467
- "edge-distances": "endpoints",
4468
- "source-endpoint": "data(sourceEndpoint)",
4469
- "target-endpoint": "data(targetEndpoint)"
4470
- }
4471
- },
4472
- {
4473
- selector: "node",
4474
- style: {
4475
- // @ts-ignore Incorrect library types
4476
- "compound-sizing-wrt-labels": "include"
4477
- }
4478
- },
4479
- {
4480
- selector: "node[label]",
4481
- style: {
4482
- "text-valign": "bottom",
4483
- "text-halign": "center",
4484
- "font-size": `${Pt("fontSize")}px`
4485
- }
4486
- },
4487
- {
4488
- selector: ".node-service",
4489
- style: {
4490
- label: "data(label)",
4491
- width: "data(width)",
4492
- height: "data(height)"
4493
- }
4494
- },
4495
- {
4496
- selector: ".node-junction",
4497
- style: {
4498
- width: "data(width)",
4499
- height: "data(height)"
4500
- }
4501
- },
4502
- {
4503
- selector: ".node-group",
4504
- style: {
4505
- // @ts-ignore Incorrect library types
4506
- padding: `${Pt("padding")}px`
4507
- }
4508
- }
4509
- ]
4510
- });
4511
- s.remove(), We(A, i), Ye(C, i), Xe(Y, i), Ve(G, i);
4512
- const r = ze(N), e = Be(N), f = i.layout({
4513
- name: "fcose",
4514
- quality: "proof",
4515
- styleEnabled: !1,
4516
- animate: !1,
4517
- nodeDimensionsIncludeLabels: !1,
4518
- // Adjust the edge parameters if it passes through the border of a group
4519
- // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67
4520
- idealEdgeLength(a) {
4521
- const [y, t] = a.connectedNodes(), { parent: h } = ne(y), { parent: o } = ne(t);
4522
- return h === o ? 1.5 * Pt("iconSize") : 0.5 * Pt("iconSize");
4523
- },
4524
- edgeElasticity(a) {
4525
- const [y, t] = a.connectedNodes(), { parent: h } = ne(y), { parent: o } = ne(t);
4526
- return h === o ? 0.45 : 1e-3;
4527
- },
4528
- alignmentConstraint: r,
4529
- relativePlacementConstraint: e
4530
- });
4531
- f.one("layoutstop", () => {
4532
- var y;
4533
- function a(t, h, o, c) {
4534
- let l, T;
4535
- const { x: g, y: d } = t, { x: L, y: F } = h;
4536
- T = (c - d + (g - o) * (d - F) / (g - L)) / Math.sqrt(1 + Math.pow((d - F) / (g - L), 2)), l = Math.sqrt(Math.pow(c - d, 2) + Math.pow(o - g, 2) - Math.pow(T, 2));
4537
- const M = Math.sqrt(Math.pow(L - g, 2) + Math.pow(F - d, 2));
4538
- l = l / M;
4539
- let P = (L - g) * (c - d) - (F - d) * (o - g);
4540
- switch (!0) {
4541
- case P >= 0:
4542
- P = 1;
4543
- break;
4544
- case P < 0:
4545
- P = -1;
4546
- break;
4547
- }
4548
- let J = (L - g) * (o - g) + (F - d) * (c - d);
4549
- switch (!0) {
4550
- case J >= 0:
4551
- J = 1;
4552
- break;
4553
- case J < 0:
4554
- J = -1;
4555
- break;
4556
- }
4557
- return T = Math.abs(T) * P, l = l * J, {
4558
- distances: T,
4559
- weights: l
4560
- };
4561
- }
4562
- nt(a, "getSegmentWeights"), i.startBatch();
4563
- for (const t of Object.values(i.edges()))
4564
- if ((y = t.data) != null && y.call(t)) {
4565
- const { x: h, y: o } = t.source().position(), { x: c, y: l } = t.target().position();
4566
- if (h !== c && o !== l) {
4567
- const T = t.sourceEndpoint(), g = t.targetEndpoint(), { sourceDir: d } = Ge(t), [L, F] = Qt(d) ? [T.x, g.y] : [g.x, T.y], { weights: M, distances: P } = a(T, g, L, F);
4568
- t.style("segment-distances", P), t.style("segment-weights", M);
4569
- }
4570
- }
4571
- i.endBatch(), f.run();
4572
- }), f.run(), i.ready((a) => {
4573
- Fe.info("Ready", a), u(i);
4574
- });
4575
- });
4576
- }
4577
- nt($e, "layoutArchitecture");
4578
- var kr = /* @__PURE__ */ nt(async (C, Y, A, G) => {
4579
- const N = G.db, u = N.getServices(), s = N.getJunctions(), i = N.getGroups(), r = N.getEdges(), e = N.getDataStructures(), f = _e(Y), a = f.append("g");
4580
- a.attr("class", "architecture-edges");
4581
- const y = f.append("g");
4582
- y.attr("class", "architecture-services");
4583
- const t = f.append("g");
4584
- t.attr("class", "architecture-groups"), await $r(N, y, u), Zr(N, y, s);
4585
- const h = await $e(u, s, i, r, e);
4586
- await zr(a, h), await Br(t, h), He(N, h), tr(void 0, f, Pt("padding"), Pt("useMaxWidth"));
4587
- }, "draw"), qr = { draw: kr }, ei = {
4588
- parser: Hr,
4589
- db: ue,
4590
- renderer: qr,
4591
- styles: Vr
4592
- };
4593
- export {
4594
- ei as diagram
4595
- };