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