@brainfish-ai/components 0.18.0 → 0.18.4-alpha.2

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