@yiyi_zhang/reactflow-ui 0.5.0-beta.0 → 1.1.0

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