@peasant-labs/fairtrade 0.0.51 → 0.0.52

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