@n8n-zengchao/chat 0.62.0

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