@kabmo-labs/kabmo 0.59.1 → 0.61.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 (372) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +397 -397
  3. package/dist/client/static/js/{Body-5yedtmnk.js → Body-ab8wswhm.js} +3 -3
  4. package/dist/client/static/js/{CsvGrid-39m8pp1c.js → CsvGrid-czssywvz.js} +2 -2
  5. package/dist/client/static/js/{DocxView-vd99cv12.js → DocxView-ke0dwdmt.js} +3 -3
  6. package/dist/client/static/js/{DrawioView-6nq4412n.js → DrawioView-a1whhy84.js} +2 -2
  7. package/dist/client/static/js/{HtmlPreview-cs51gszy.js → HtmlPreview-dr32dwjy.js} +1 -1
  8. package/dist/client/static/js/ImageView-zf4kh5wp.js +1 -0
  9. package/dist/client/static/js/LayoutWrapper-dncbzcea.js +2 -0
  10. package/dist/client/static/js/MergeDiffView-btdx9yb9.js +1 -0
  11. package/dist/client/static/js/Modal-5cxfw2rv.js +60 -0
  12. package/dist/client/static/js/{PdfView-0zab721q.js → PdfView-2kdn91f9.js} +1 -1
  13. package/dist/client/static/js/SessionsView-vbn0nvx4.js +1 -0
  14. package/dist/client/static/js/{SheetView-2wdn5hkd.js → SheetView-ettr9pdw.js} +9 -9
  15. package/dist/client/static/js/{SvgPreview-fmrfxd7z.js → SvgPreview-hzcejjry.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-41scfh9v.js → abnfDiagram-O67JEVCF-kdmv4y72.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-sxrkxwbq.js +1 -0
  18. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-fp6etjvt.js → architectureDiagram-NJMV4G6O-qyrwaq0x.js} +11 -11
  19. package/dist/client/static/js/{astro-ryr2ajmg.js → astro-yphdvdty.js} +1 -1
  20. package/dist/client/static/js/bash-bcbct9gc.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-pespk9mt.js → blockDiagram-BEXU5L5S-tszxy2g7.js} +8 -8
  22. package/dist/client/static/js/c-fn9jz26e.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-rt4z91dx.js → c4Diagram-YGBWAQC7-0ye36hhv.js} +5 -5
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-6bzaq8sd.js → classDiagram-v2-NBCMYWYE-szgk1shv.js} +6 -6
  25. package/dist/client/static/js/{cose-bilkent-JH36ORCC-z3fhgcba.js → cose-bilkent-JH36ORCC-0s9s4mmv.js} +1 -1
  26. package/dist/client/static/js/cpp-a1q64mke.js +1 -0
  27. package/dist/client/static/js/css-b92azee8.js +1 -0
  28. package/dist/client/static/js/cynefin-OW5HDTMX-g1xwa8b9.js +1 -0
  29. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-8endeh4p.js → cynefinDiagram-VND7K2PF-664g28ze.js} +2 -2
  30. package/dist/client/static/js/{dagre-6A5THRUB-2a2f32dv.js → dagre-6A5THRUB-ga4rp1jx.js} +2 -2
  31. package/dist/client/static/js/{diagram-22UHCM2B-wgbyr6b7.js → diagram-22UHCM2B-aagj46ty.js} +15 -15
  32. package/dist/client/static/js/{diagram-3UASUU5V-5122b41x.js → diagram-3UASUU5V-20qk6whk.js} +2 -2
  33. package/dist/client/static/js/{diagram-ATOU4E4O-1gt9fr7e.js → diagram-ATOU4E4O-1vg1tfca.js} +2 -2
  34. package/dist/client/static/js/{diagram-CDSNMT55-v6hs59jb.js → diagram-CDSNMT55-90d6jrqs.js} +4 -4
  35. package/dist/client/static/js/{diagram-MLGK6HIB-yey2m5nm.js → diagram-MLGK6HIB-8je4z8m1.js} +2 -2
  36. package/dist/client/static/js/{diagram-MPIPVDR6-hg4f3q4d.js → diagram-MPIPVDR6-0kzpexsj.js} +2 -2
  37. package/dist/client/static/js/{dockerfile-56tfnp5r.js → dockerfile-5nrbr0ef.js} +1 -1
  38. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-2mhc9aar.js → ebnfDiagram-ZINNZB2B-47yg36zx.js} +1 -1
  39. package/dist/client/static/js/{elixir-fyxw6d70.js → elixir-3nwnd9yw.js} +1 -1
  40. package/dist/client/static/js/{elk-276RUBZZ-wedtvz9y.js → elk-276RUBZZ-5hqp6r2d.js} +1 -1
  41. package/dist/client/static/js/{erDiagram-OPXOYQCR-1kysnby9.js → erDiagram-OPXOYQCR-bt9te7r0.js} +3 -3
  42. package/dist/client/static/js/{erlang-97ayje6m.js → erlang-p5c4n3t0.js} +1 -1
  43. package/dist/client/static/js/eventmodeling-NTZA5JFV-05p61bka.js +1 -0
  44. package/dist/client/static/js/flowDiagram-KWPJA3E3-500fcx2a.js +1 -0
  45. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-j4g65rpm.js → ganttDiagram-FUAMR5RP-kzc13swm.js} +5 -5
  46. package/dist/client/static/js/gitGraph-4MIJSDKK-z1yehwys.js +1 -0
  47. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-vcwmj4b3.js → gitGraphDiagram-X574FWY7-bjf8aa3j.js} +14 -14
  48. package/dist/client/static/js/graphql-8d8bn59j.js +1 -0
  49. package/dist/client/static/js/html-6hdrwtz2.js +1 -0
  50. package/dist/client/static/js/{index-5e4e18tg.js → index-025s3fp8.js} +2 -2
  51. package/dist/client/static/js/{index-jaf968hx.js → index-0kcnghxn.js} +4 -4
  52. package/dist/client/static/js/{index-8tzt0dek.js → index-11qn05g9.js} +2 -2
  53. package/dist/client/static/js/{index-sqyvj03y.js → index-1fmjhm2d.js} +9 -9
  54. package/dist/client/static/js/{index-42q5gg7t.js → index-24a40rw8.js} +1 -1
  55. package/dist/client/static/js/{index-np2rfq06.js → index-2dmew334.js} +2 -2
  56. package/dist/client/static/js/{index-wkxsypj1.js → index-2zhmmtye.js} +2 -2
  57. package/dist/client/static/js/{index-m62sf9wn.js → index-3x7cbxwq.js} +1 -1
  58. package/dist/client/static/js/{index-fg0ne74z.js → index-475dc6h9.js} +2 -2
  59. package/dist/client/static/js/{index-1mkn5fbf.js → index-4vtc4xct.js} +197 -197
  60. package/dist/client/static/js/{index-spnrx2c0.js → index-5srvxsht.js} +1 -1
  61. package/dist/client/static/js/{index-tz5ewsza.js → index-653x8zdq.js} +9 -9
  62. package/dist/client/static/js/index-6c1s0v4b.js +1 -0
  63. package/dist/client/static/js/{index-hgzf4ask.js → index-776n5n29.js} +5 -5
  64. package/dist/client/static/js/{index-a70sk36c.js → index-85jfn1fz.js} +2 -2
  65. package/dist/client/static/js/{index-yrwm437g.js → index-97sw4d9n.js} +2 -2
  66. package/dist/client/static/js/{index-csxnqgzw.js → index-9g2nzgpx.js} +6 -6
  67. package/dist/client/static/js/{index-y4cx8cqf.js → index-a145x0w2.js} +2 -2
  68. package/dist/client/static/js/{index-mhrkjbjq.js → index-bdtftrym.js} +2 -2
  69. package/dist/client/static/js/{index-db6s66jr.js → index-bkn6jtn1.js} +2 -2
  70. package/dist/client/static/js/{index-kt77dwsg.js → index-bq9f0mxp.js} +7 -7
  71. package/dist/client/static/js/{index-ndqtff48.js → index-ca6tmamh.js} +2 -2
  72. package/dist/client/static/js/index-cvm2ha01.js +1 -0
  73. package/dist/client/static/js/index-d11mbz2q.js +4 -0
  74. package/dist/client/static/js/{index-3kedv94b.js → index-dabnbvbc.js} +2 -2
  75. package/dist/client/static/js/{index-sg65xdey.js → index-enm77k5z.js} +2 -2
  76. package/dist/client/static/js/{index-nf4hq5tg.js → index-excgtjhx.js} +14 -14
  77. package/dist/client/static/js/{index-51rbgeh9.js → index-fb2fjndj.js} +5 -5
  78. package/dist/client/static/js/index-fen0x3qh.js +1 -0
  79. package/dist/client/static/js/{index-vs2y8gxr.js → index-fr6wsqk8.js} +2 -2
  80. package/dist/client/static/js/{index-xqz7bqcn.js → index-gwgh27h3.js} +87 -87
  81. package/dist/client/static/js/{index-2h7xh93h.js → index-h7agc069.js} +1 -1
  82. package/dist/client/static/js/{index-69mnn71v.js → index-hwv7bfxc.js} +2 -2
  83. package/dist/client/static/js/{index-461ga40v.js → index-hxy1sadd.js} +2 -2
  84. package/dist/client/static/js/{index-s7p2wdr1.js → index-jz4012t5.js} +1 -1
  85. package/dist/client/static/js/{index-gajpd90b.js → index-k9yf2txw.js} +2 -2
  86. package/dist/client/static/js/{index-dw9epydj.js → index-kj70d2q9.js} +2 -2
  87. package/dist/client/static/js/{index-7enfdvh0.js → index-krdz5vby.js} +2 -2
  88. package/dist/client/static/js/{index-42k78whj.js → index-kyr612aa.js} +1 -1
  89. package/dist/client/static/js/{index-fvphmwkf.js → index-m24sebb0.js} +2 -2
  90. package/dist/client/static/js/{index-d9sfavx1.js → index-mtav0rpf.js} +2 -2
  91. package/dist/client/static/js/{index-58z2hatp.js → index-n8r7r86r.js} +1 -1
  92. package/dist/client/static/js/index-pg87cgpy.js +2 -0
  93. package/dist/client/static/js/{index-r42f3r1p.js → index-q1a40v20.js} +2 -2
  94. package/dist/client/static/js/{index-jct0jryd.js → index-qccydkze.js} +2 -2
  95. package/dist/client/static/js/index-qmvstmvh.js +1 -0
  96. package/dist/client/static/js/{index-pn0ja904.js → index-r38e0rya.js} +2 -2
  97. package/dist/client/static/js/{index-92h38pwg.js → index-s4j2ghmx.js} +2 -2
  98. package/dist/client/static/js/index-sr14vwn5.js +2 -0
  99. package/dist/client/static/js/{index-z82nd2bd.js → index-sx83ans2.js} +2 -2
  100. package/dist/client/static/js/index-t6nqy2n5.css +1 -0
  101. package/dist/client/static/js/{index-fsa18ns9.js → index-twwsn91p.js} +2 -2
  102. package/dist/client/static/js/{index-nwbr15b3.js → index-v88m5sva.js} +2 -2
  103. package/dist/client/static/js/{index-qc3de995.js → index-vgcw01yk.js} +1 -1
  104. package/dist/client/static/js/{index-pr8wsq24.js → index-vn59zz0k.js} +2 -2
  105. package/dist/client/static/js/{index-hrez92pw.js → index-wf5j0009.js} +7 -7
  106. package/dist/client/static/js/{index-q3k8r0ms.js → index-wsy6y5em.js} +9 -9
  107. package/dist/client/static/js/{index-d201jvs9.js → index-xy0m8te9.js} +1 -1
  108. package/dist/client/static/js/index-y6zbkh4p.js +2 -0
  109. package/dist/client/static/js/{index-h1xbx74w.js → index-yfcy4cf6.js} +2 -2
  110. package/dist/client/static/js/{index-y5pkqrga.js → index-z5s9tmj8.js} +2 -2
  111. package/dist/client/static/js/{index-vs3g6njv.js → index-zr3965k9.js} +1 -1
  112. package/dist/client/static/js/info-A6RAGUB7-dqyaxjc1.js +1 -0
  113. package/dist/client/static/js/{infoDiagram-VRGFBTTK-7craq9x2.js → infoDiagram-VRGFBTTK-jy5zvvj8.js} +1 -1
  114. package/dist/client/static/js/ini-g6a5xsaw.js +1 -0
  115. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ncjty2re.js → ishikawaDiagram-OU5B5YK6-pfky1nnf.js} +3 -3
  116. package/dist/client/static/js/java-n596am4c.js +1 -0
  117. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-yx222bzt.js → journeyDiagram-ZHPQQLJL-mvaf7rfh.js} +4 -4
  118. package/dist/client/static/js/json-7k70qbkj.js +1 -0
  119. package/dist/client/static/js/jsx-sndenqrc.js +1 -0
  120. package/dist/client/static/js/{julia-agc5kfvg.js → julia-rpd1y9vh.js} +1 -1
  121. package/dist/client/static/js/{kanban-definition-PNTS6WVX-a2f84qmn.js → kanban-definition-PNTS6WVX-hw2xwe6e.js} +5 -5
  122. package/dist/client/static/js/lua-djd3g9q5.js +1 -0
  123. package/dist/client/static/js/markdown-r2tpvxpn.js +1 -0
  124. package/dist/client/static/js/{mermaid.core-9vfwthw3.js → mermaid.core-hsw87hmq.js} +6 -6
  125. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-fsxysg6f.js → mindmap-definition-NLK3R4M7-wfe4d846.js} +7 -7
  126. package/dist/client/static/js/one-dark-pro-ckq5capv.js +1 -0
  127. package/dist/client/static/js/one-light-a908z398.js +1 -0
  128. package/dist/client/static/js/packet-AYTQ26CC-7jxzax4z.js +1 -0
  129. package/dist/client/static/js/{pegDiagram-GJSIUBJH-77wxmp9g.js → pegDiagram-GJSIUBJH-cvnmxgst.js} +1 -1
  130. package/dist/client/static/js/{perl-v5vbtzgf.js → perl-kmtz9dnv.js} +1 -1
  131. package/dist/client/static/js/{php-83qwy98t.js → php-bttrsbxy.js} +1 -1
  132. package/dist/client/static/js/pie-WAS4IAKB-wc9wxr7f.js +1 -0
  133. package/dist/client/static/js/{pieDiagram-5QR66LMP-gvgfhez0.js → pieDiagram-5QR66LMP-0n3gz7sv.js} +2 -2
  134. package/dist/client/static/js/properties-brn72zdk.js +1 -0
  135. package/dist/client/static/js/python-g9mghwgm.js +1 -0
  136. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-9zkbt5h8.js → quadrantDiagram-O4NWA36T-9qqh6xvv.js} +4 -4
  137. package/dist/client/static/js/r-e247x4mw.js +1 -0
  138. package/dist/client/static/js/radar-RG4KPBEZ-kwj5padj.js +1 -0
  139. package/dist/client/static/js/railroad-74A4TZTK-h8sdx3w5.js +1 -0
  140. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2wmwx246.js +1 -0
  141. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-h4cdgw3y.js +1 -0
  142. package/dist/client/static/js/railroad-peg-WCYAUIDC-q7m0tfd0.js +1 -0
  143. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-w55bsyw6.js → railroadDiagram-XR7U4H2S-5f3x3762.js} +1 -1
  144. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-828s1e5g.js → requirementDiagram-PLB6GJNP-a68bv6kh.js} +12 -12
  145. package/dist/client/static/js/{ruby-994n5j6e.js → ruby-dve3y59w.js} +1 -1
  146. package/dist/client/static/js/{rust-csv5f258.js → rust-qjhdt4b0.js} +1 -1
  147. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-34f3fyvg.js → sankeyDiagram-IPEJSGJF-ry7xcphh.js} +4 -4
  148. package/dist/client/static/js/{sass-p6g7qdv2.js → sass-emxqt5p2.js} +1 -1
  149. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-nnta2hn0.js → sequenceDiagram-PO4LG4MO-mekzzhet.js} +21 -21
  150. package/dist/client/static/js/{sizeCapture-INFHLROL-gpcramga.js → sizeCapture-INFHLROL-pvc16ame.js} +1 -1
  151. package/dist/client/static/js/sql-0kar81jy.js +1 -0
  152. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-3f2en220.js → stateDiagram-v2-GCMORJYK-3ytxby83.js} +3 -3
  153. package/dist/client/static/js/{svelte-bek3h1sz.js → svelte-dbsx1ehx.js} +1 -1
  154. package/dist/client/static/js/{swimlanes-2SLR337P-jgqt12z9.js → swimlanes-2SLR337P-c2zfp416.js} +1 -1
  155. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-9gm67sq4.js +8 -0
  156. package/dist/client/static/js/{timeline-definition-EJHVYXUP-sgchcs11.js → timeline-definition-EJHVYXUP-xtvv4za2.js} +6 -6
  157. package/dist/client/static/js/treeView-Q6P3EWNA-yv9640h3.js +1 -0
  158. package/dist/client/static/js/treemap-WGGIJYW6-7kpzjg21.js +1 -0
  159. package/dist/client/static/js/typescript-bm89v3gk.js +1 -0
  160. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-znkg9pkq.js → usecaseDiagram-POWQR4AR-sz6b7bnv.js} +51 -51
  161. package/dist/client/static/js/{vennDiagram-UO4OBE2U-dncg96ej.js → vennDiagram-UO4OBE2U-56q0qs51.js} +5 -5
  162. package/dist/client/static/js/{vue-y44m889c.js → vue-hyr58df9.js} +1 -1
  163. package/dist/client/static/js/wardley-WFR3VGLG-mggay64p.js +1 -0
  164. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-77xz2d49.js → wardleyDiagram-VNRHLVJA-xvtyvde9.js} +5 -5
  165. package/dist/client/static/js/xml-b7824nx0.js +1 -0
  166. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-40j1aqyf.js → xychartDiagram-PMCCYNJV-jcs20s84.js} +6 -6
  167. package/dist/client/static/js/yaml-kqqktdv1.js +1 -0
  168. package/package.json +4 -4
  169. package/src/client/borders.css +28 -15
  170. package/src/client/components/common/Modal.tsx +10 -2
  171. package/src/client/components/common/Toast.tsx +8 -3
  172. package/src/client/components/common/anchored-menu/index.tsx +10 -3
  173. package/src/client/components/common/command-palette/index.tsx +9 -3
  174. package/src/client/components/common/fullscreen-viewer/index.tsx +1 -1
  175. package/src/client/components/common/header-controls/index.test.tsx +40 -3
  176. package/src/client/components/common/header-controls/index.tsx +106 -56
  177. package/src/client/components/common/search-select/search-select.test.tsx +10 -1
  178. package/src/client/components/common/workspace-mark/index.test.tsx +67 -0
  179. package/src/client/components/common/workspace-mark/index.tsx +48 -0
  180. package/src/client/components/layout/ActivityBar.test.ts +1 -1
  181. package/src/client/components/layout/ActivityBarDrag.test.ts +1 -1
  182. package/src/client/components/layout/LeftActivityBar.test.ts +48 -3
  183. package/src/client/components/layout/LeftDock.tsx +33 -14
  184. package/src/client/components/layout/PanelButton.test.tsx +119 -0
  185. package/src/client/components/layout/PanelButton.tsx +2 -4
  186. package/src/client/components/layout/activity-bar/Row.tsx +125 -0
  187. package/src/client/components/layout/{ActivityBar.tsx → activity-bar/index.tsx} +81 -20
  188. package/src/client/components/layout/controls-bar/index.tsx +183 -0
  189. package/src/client/components/layout/desktop-layout/BarSlot.tsx +18 -0
  190. package/src/client/components/layout/desktop-layout/LeftColumn.test.tsx +187 -0
  191. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +81 -64
  192. package/src/client/components/layout/desktop-layout/LeftRail.tsx +60 -0
  193. package/src/client/components/layout/desktop-layout/LeftTabsColumn.tsx +91 -0
  194. package/src/client/components/layout/desktop-layout/ResizeHandle.tsx +19 -3
  195. package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +60 -0
  196. package/src/client/components/layout/desktop-layout/RightColumn.tsx +77 -28
  197. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +114 -104
  198. package/src/client/components/layout/desktop-layout/index.tsx +48 -45
  199. package/src/client/components/layout/desktop-layout/resizer/index.tsx +25 -83
  200. package/src/client/components/layout/desktop-layout/resizer/panel-motion.ts +61 -0
  201. package/src/client/components/layout/desktop-layout/resizer/panel.test.ts +40 -2
  202. package/src/client/components/layout/desktop-layout/resizer/separator.tsx +89 -0
  203. package/src/client/components/layout/left-bar/index.tsx +88 -0
  204. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +5 -2
  205. package/src/client/components/layout/session-sidebar/Footer.tsx +28 -11
  206. package/src/client/components/layout/session-sidebar/FooterHost.tsx +167 -0
  207. package/src/client/components/layout/session-sidebar/SessionItem.tsx +2 -2
  208. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +8 -3
  209. package/src/client/components/layout/session-sidebar/footer-host.test.tsx +133 -0
  210. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +5 -2
  211. package/src/client/components/layout/session-title-bar/index.tsx +199 -0
  212. package/src/client/components/layout/top-bars.test.tsx +338 -0
  213. package/src/client/components/mobile/LayoutWrapper.tsx +13 -2
  214. package/src/client/components/mobile/SessionSidebar.tsx +10 -8
  215. package/src/client/components/mobile/drawer-layout.test.tsx +67 -0
  216. package/src/client/components/mobile/drawer-strip.tsx +37 -14
  217. package/src/client/components/mobile/left-drawer-nav.test.tsx +19 -127
  218. package/src/client/components/settings/LazyModal.tsx +8 -2
  219. package/src/client/components/settings/Modal.tsx +6 -2
  220. package/src/client/components/settings/apply-side-effects.ts +5 -0
  221. package/src/client/components/settings/categories/AppearanceSettings.test.tsx +1 -0
  222. package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
  223. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +6 -5
  224. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +2 -2
  225. package/src/client/components/settings/categories/appearance-settings/ChromeStyleSection.tsx +105 -0
  226. package/src/client/components/settings/categories/appearance-settings/groups.ts +3 -2
  227. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +1 -1
  228. package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +2 -2
  229. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
  230. package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +2 -2
  231. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +1 -1
  232. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +1 -1
  233. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +1 -1
  234. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +8 -1
  235. package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +8 -1
  236. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +9 -2
  237. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -25
  238. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +1 -1
  239. package/src/client/components/workspace/editor/Tab.tsx +160 -0
  240. package/src/client/components/workspace/editor/Tabs.test.ts +40 -0
  241. package/src/client/components/workspace/editor/Tabs.tsx +52 -102
  242. package/src/client/components/workspace/editor/index.tsx +2 -0
  243. package/src/client/components/workspace/editor/props.ts +6 -0
  244. package/src/client/components/workspace/file-explorer/OutlineResize.test.tsx +225 -0
  245. package/src/client/components/workspace/file-explorer/OutlineSection.tsx +43 -3
  246. package/src/client/components/workspace/file-explorer/index.tsx +1 -1
  247. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  248. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
  249. package/src/client/components/workspace/panel-tabs/TabChip.tsx +50 -20
  250. package/src/client/components/workspace/panel-tabs/TabStrip.connected.test.tsx +172 -0
  251. package/src/client/components/workspace/panel-tabs/TabStrip.tsx +18 -9
  252. package/src/client/components/workspace/search-panel/Body.tsx +3 -3
  253. package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +1 -1
  254. package/src/client/data/settings/omp-schema.json +205 -9
  255. package/src/client/floating.css +276 -0
  256. package/src/client/floating.test.ts +151 -0
  257. package/src/client/hooks/chat/timeline/session-pagination.ts +13 -9
  258. package/src/client/hooks/editor/use-outline-resize.ts +145 -0
  259. package/src/client/hooks/ui/border-style.test.ts +19 -7
  260. package/src/client/hooks/ui/border-style.ts +2 -3
  261. package/src/client/hooks/ui/chrome-style.test.ts +140 -0
  262. package/src/client/hooks/ui/chrome-style.ts +75 -0
  263. package/src/client/hooks/ui/media-query.ts +29 -0
  264. package/src/client/hooks/ui/presence.test.ts +104 -0
  265. package/src/client/hooks/ui/presence.ts +62 -0
  266. package/src/client/hooks/ui/style-attributes.test.ts +7 -6
  267. package/src/client/hooks/ui/surface-style.ts +2 -2
  268. package/src/client/hooks/ui/titlebar-inset.test.ts +56 -0
  269. package/src/client/hooks/ui/titlebar-inset.ts +31 -0
  270. package/src/client/hooks/workspace/available-width.ts +25 -1
  271. package/src/client/hooks/workspace/panel-peek.test.ts +124 -0
  272. package/src/client/hooks/workspace/panel-peek.ts +151 -0
  273. package/src/client/hooks/workspace/panel-rail.test.ts +86 -0
  274. package/src/client/hooks/workspace/panel-rail.ts +108 -0
  275. package/src/client/hooks/workspace/panel-resize.ts +8 -2
  276. package/src/client/hooks/workspace/rail-peek.test.ts +119 -0
  277. package/src/client/hooks/workspace/rail-peek.ts +68 -0
  278. package/src/client/hooks/workspace/right-panel-card.test.ts +71 -0
  279. package/src/client/hooks/workspace/right-panel-card.ts +69 -0
  280. package/src/client/hooks/workspace/right-panel-geometry.ts +172 -0
  281. package/src/client/hooks/workspace/right-side.ts +7 -0
  282. package/src/client/lib/desktop/titlebar.test.ts +6 -0
  283. package/src/client/lib/desktop/titlebar.ts +16 -0
  284. package/src/client/main.tsx +11 -0
  285. package/src/client/motion.test.ts +36 -0
  286. package/src/client/tailwind.css +67 -0
  287. package/src/server/lib/assets/shell-attributes.server.ts +14 -4
  288. package/src/server/lib/assets/shell-attributes.test.ts +35 -21
  289. package/src/server/lib/bundler/titlebar-css.test.ts +3 -2
  290. package/src/server/lib/realtime/topics/peer-relay.server.test.ts +19 -3
  291. package/src/server/lib/updates/omp.test.ts +40 -1
  292. package/src/server/lib/updates/omp.ts +29 -2
  293. package/src/server/plugins/ssr.ts +2 -0
  294. package/src/server/routes/settings/mcp.test.ts +16 -0
  295. package/src/server/routes/settings/mcp.ts +4 -0
  296. package/src/shared/lib/code/outline/resize.test.ts +57 -0
  297. package/src/shared/lib/code/outline/resize.ts +67 -0
  298. package/src/shared/lib/models/provider/glyph.test.ts +3 -1
  299. package/src/shared/lib/models/provider/glyph.ts +1 -0
  300. package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +103 -3
  301. package/src/shared/lib/omp/config/schema.test.ts +9 -0
  302. package/src/shared/lib/omp/config/schema.ts +8 -0
  303. package/src/shared/lib/settings/defaults.ts +2 -0
  304. package/src/shared/lib/theme/border-style.test.ts +12 -14
  305. package/src/shared/lib/theme/border-style.ts +25 -18
  306. package/src/shared/lib/theme/chrome-style.test.ts +31 -0
  307. package/src/shared/lib/theme/chrome-style.ts +74 -0
  308. package/src/shared/lib/theme/surface-style.test.ts +4 -5
  309. package/src/shared/lib/theme/surface-style.ts +6 -5
  310. package/src/shared/lib/ui/motion.ts +29 -0
  311. package/src/shared/lib/workspace/floating-chrome.ts +23 -0
  312. package/src/shared/lib/workspace/session-state/store.ts +3 -0
  313. package/src/shared/lib/workspace/workspace-panel-widths.test.ts +73 -0
  314. package/src/shared/lib/workspace/workspace-panel-widths.ts +79 -17
  315. package/src/shared/types/settings/state.ts +10 -9
  316. package/src/test-support/left-drawer-harness.test-util.ts +169 -0
  317. package/src/test-support/peer-harness.ts +44 -36
  318. package/dist/client/static/js/ImageView-nc2n0w6s.js +0 -1
  319. package/dist/client/static/js/LayoutWrapper-j7786frq.js +0 -2
  320. package/dist/client/static/js/MergeDiffView-0rn5zsy5.js +0 -1
  321. package/dist/client/static/js/Modal-7ag7a9qq.js +0 -60
  322. package/dist/client/static/js/SessionsView-t9rhx472.js +0 -1
  323. package/dist/client/static/js/architecture-7GRP2DOG-bwn1drdz.js +0 -1
  324. package/dist/client/static/js/bash-zknkkwkw.js +0 -1
  325. package/dist/client/static/js/c-0w02jkxb.js +0 -1
  326. package/dist/client/static/js/cpp-p5b4vean.js +0 -1
  327. package/dist/client/static/js/css-9jzbvdyz.js +0 -1
  328. package/dist/client/static/js/cynefin-OW5HDTMX-jbc50ks8.js +0 -1
  329. package/dist/client/static/js/eventmodeling-NTZA5JFV-b37ey01t.js +0 -1
  330. package/dist/client/static/js/flowDiagram-KWPJA3E3-vd4z6bvy.js +0 -1
  331. package/dist/client/static/js/gitGraph-4MIJSDKK-mvqq7tcs.js +0 -1
  332. package/dist/client/static/js/graphql-xzykn0ba.js +0 -1
  333. package/dist/client/static/js/html-2zc3shky.js +0 -1
  334. package/dist/client/static/js/index-6vbra7p9.js +0 -1
  335. package/dist/client/static/js/index-9mgpbwfr.js +0 -1
  336. package/dist/client/static/js/index-c5401dqs.js +0 -4
  337. package/dist/client/static/js/index-dbsy29gn.js +0 -2
  338. package/dist/client/static/js/index-e39m185a.js +0 -2
  339. package/dist/client/static/js/index-fnaq8baz.js +0 -1
  340. package/dist/client/static/js/index-mttx9327.css +0 -1
  341. package/dist/client/static/js/index-n7bmqeqz.js +0 -1
  342. package/dist/client/static/js/index-skp6991n.js +0 -2
  343. package/dist/client/static/js/info-A6RAGUB7-zkv4crz7.js +0 -1
  344. package/dist/client/static/js/ini-62r3vxaf.js +0 -1
  345. package/dist/client/static/js/java-kacycary.js +0 -1
  346. package/dist/client/static/js/json-yrwpn6bd.js +0 -1
  347. package/dist/client/static/js/jsx-b40ag8q1.js +0 -1
  348. package/dist/client/static/js/lua-bk961f37.js +0 -1
  349. package/dist/client/static/js/markdown-b7rgzgd6.js +0 -1
  350. package/dist/client/static/js/one-dark-pro-7v4by00h.js +0 -1
  351. package/dist/client/static/js/one-light-5rfzh8p4.js +0 -1
  352. package/dist/client/static/js/packet-AYTQ26CC-dgpge627.js +0 -1
  353. package/dist/client/static/js/pie-WAS4IAKB-b8pgsqrd.js +0 -1
  354. package/dist/client/static/js/properties-k8gbzggp.js +0 -1
  355. package/dist/client/static/js/python-343tspad.js +0 -1
  356. package/dist/client/static/js/r-ycdwmv8g.js +0 -1
  357. package/dist/client/static/js/radar-RG4KPBEZ-fmfe5y27.js +0 -1
  358. package/dist/client/static/js/railroad-74A4TZTK-b5tks4ce.js +0 -1
  359. package/dist/client/static/js/railroad-abnf-HS5TGJTU-0sf4m0ze.js +0 -1
  360. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-pjfy3pt7.js +0 -1
  361. package/dist/client/static/js/railroad-peg-WCYAUIDC-nr8ngt42.js +0 -1
  362. package/dist/client/static/js/sql-kwpd5w07.js +0 -1
  363. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xx1z57df.js +0 -8
  364. package/dist/client/static/js/treeView-Q6P3EWNA-23r9fa68.js +0 -1
  365. package/dist/client/static/js/treemap-WGGIJYW6-mxxzdrj6.js +0 -1
  366. package/dist/client/static/js/typescript-4dchbnya.js +0 -1
  367. package/dist/client/static/js/wardley-WFR3VGLG-cbqtax1x.js +0 -1
  368. package/dist/client/static/js/xml-xs6qz3ya.js +0 -1
  369. package/dist/client/static/js/yaml-174nk5bn.js +0 -1
  370. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +0 -238
  371. package/src/client/components/layout/session-sidebar/Header.test.ts +0 -98
  372. package/src/client/components/layout/session-sidebar/Header.tsx +0 -60
@@ -1,4 +1,4 @@
1
- import{t,l,m,W,Ea,Ih,oa,Ro,Ia,Al,Lo}from"./index-xqz7bqcn.js";import{Yt,Rn,fr,cn,Jr,Co,we,Rt,Dr,Eo,Nr,lc,Up,Gp,jp,Wi,va,Hp,Ki,Ln,Vi,eo,ka,Yi,Bo,Ji,qp,Wp,cc,Jt,Kp,Zi,Io,Xi,uc,dc,_o,Vp,pc,Yp,hd,Zr,mc,Jp,Zp,Xp,tr,fc,gc,es,em,Ac,v,gr,Xr,Zt,So,et}from"./index-461ga40v.js";import{Pp,Op,ve,ul,gh,$p,di}from"./index-a70sk36c.js";import{Sn}from"./index-nwbr15b3.js";var ur={};Sn(ur,{default:()=>Z});var Nn=/\s/;function Pn(r){var e=r.length;while(e--&&Nn.test(r.charAt(e)));return e}var Hr=Pn;var kn=/^\s+/;function Tn(r){return r?r.slice(0,Hr(r)+1).replace(kn,""):r}var Kr=Tn;var $r=NaN,Cn=/^[-+]0x[0-9a-f]+$/i,An=/^0b[01]+$/i,Mn=/^0o[0-7]+$/i,jn=parseInt;function Bn(r){if(typeof r=="number")return r;if(Jr(r))return $r;if(Rt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Rt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Kr(r);var n=An.test(r);return n||Mn.test(r)?jn(r.slice(2),n?2:8):Cn.test(r)?$r:+r}var Qr=Bn;var re=1/0,Dn=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function Fn(r){if(!r)return r===0?r:0;if(r=Qr(r),r===re||r===-re){var e=r<0?-1:1;return e*Dn}return r===r?r:0}var U=Fn;function Gn(r){var e=U(r),n=e%1;return e===e?n?e-n:e:0}var ee=Gn;var te=Object.create,Xn=function(){function r(){}return function(e){if(!Rt(e))return{};if(te)return te(e);r.prototype=e;var n=new r;return r.prototype=void 0,n}}(),ne=Xn;function Un(r,e){var n=-1,o=r.length;e||(e=Array(o));while(++n<o)e[n]=r[n];return e}var ar=Un;function Vn(r,e,n){if(e=="__proto__"&&lc)lc(r,e,{configurable:!0,enumerable:!0,value:n,writable:!0});else r[e]=n}var R=Vn;var Yn=Object.prototype,zn=Yn.hasOwnProperty;function Wn(r,e,n){var o=r[e];if(!(zn.call(r,e)&&va(o,n))||n===void 0&&!(e in r))R(r,e,n)}var M=Wn;function qn(r,e,n,o){var i=!n;n||(n={});var a=-1,f=e.length;while(++a<f){var s=e[a],u=o?o(n[s],r[s],s,n,r):void 0;if(u===void 0)u=r[s];if(i)R(n,s,u);else M(n,s,u)}return n}var P=qn;function Hn(r,e,n){if(!Rt(n))return!1;var o=typeof e;if(o=="number"?Ln(n)&&Wi(e,n.length):o=="string"&&(e in n))return va(n[e],r);return!1}var T=Hn;function Kn(r){return Ki(function(e,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;if(a=r.length>3&&typeof a=="function"?(i--,a):void 0,f&&T(n[0],n[1],f))a=i<3?void 0:a,i=1;e=Object(e);while(++o<i){var s=n[o];if(s)r(e,s,o,a)}return e})}var oe=Kn;function Jn(r){var e=[];if(r!=null)for(var n in Object(r))e.push(n);return e}var ie=Jn;var Zn=Object.prototype,$n=Zn.hasOwnProperty;function Qn(r){if(!Rt(r))return ie(r);var e=Vi(r),n=[];for(var o in r)if(!(o=="constructor"&&(e||!$n.call(r,o))))n.push(o);return n}var ae=Qn;function ro(r){return Ln(r)?qp(r,!0):ae(r)}var L=ro;function to(r){var e=r==null?0:r.length;return e?dc(r,1):[]}var S=to;function no(r){return Up(Hp(r,void 0,S),r+"")}var fe=no;var oo=Wp(Object.getPrototypeOf,Object),V=oo;var io="[object Object]",ao=Function.prototype,fo=Object.prototype,se=ao.toString,so=fo.hasOwnProperty,uo=se.call(Object);function co(r){if(!cn(r)||fr(r)!=io)return!1;var e=V(r);if(e===null)return!0;var n=so.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&se.call(n)==uo}var ue=co;var po="\\ud800-\\udfff",lo="\\u0300-\\u036f",mo="\\ufe20-\\ufe2f",ho="\\u20d0-\\u20ff",go=lo+mo+ho,vo="\\ufe0e\\ufe0f",bo="\\u200d",yo=RegExp("["+bo+po+go+vo+"]");function wo(r){return yo.test(r)}var de=wo;function xo(r,e){return r&&P(e,Jt(e),r)}var ce=xo;function Oo(r,e){return r&&P(e,L(e),r)}var pe=Oo;var ge=typeof ur=="object"&&ur&&!ur.nodeType&&ur,le=ge&&typeof sr=="object"&&sr&&!sr.nodeType&&sr,No=le&&le.exports===ge,me=No?Yt.Buffer:void 0,he=me?me.allocUnsafe:void 0;function Po(r,e){if(e)return r.slice();var n=r.length,o=he?he(n):new r.constructor(n);return r.copy(o),o}var Z=Po;function ko(r,e){return P(r,pc(r),e)}var be=ko;var To=Object.getOwnPropertySymbols,Ao=!To?Vp:function(r){var e=[];while(r)uc(e,pc(r)),r=V(r);return e},dr=Ao;function Mo(r,e){return P(r,dr(r),e)}var ye=Mo;function jo(r){return Yp(r,L,dr)}var _e=jo;var Do=Object.prototype,Fo=Do.hasOwnProperty;function Go(r){var e=r.length,n=new r.constructor(e);if(e&&typeof r[0]=="string"&&Fo.call(r,"index"))n.index=r.index,n.input=r.input;return n}var Ee=Go;function Xo(r){var e=new r.constructor(r.byteLength);return new mc(e).set(new mc(r)),e}var Y=Xo;function Uo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.byteLength)}var xe=Uo;var Vo=/\w*$/;function Yo(r){var e=new r.constructor(r.source,Vo.exec(r));return e.lastIndex=r.lastIndex,e}var Oe=Yo;var Le=Rn?Rn.prototype:void 0,Ie=Le?Le.valueOf:void 0;function zo(r){return Ie?Object(Ie.call(r)):{}}var Se=zo;function Wo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.length)}var cr=Wo;var qo="[object Boolean]",Ho="[object Date]",Ko="[object Map]",Jo="[object Number]",Zo="[object RegExp]",$o="[object Set]",Qo="[object String]",ri="[object Symbol]",ei="[object ArrayBuffer]",ti="[object DataView]",ni="[object Float32Array]",oi="[object Float64Array]",ii="[object Int8Array]",ai="[object Int16Array]",fi="[object Int32Array]",si="[object Uint8Array]",ui="[object Uint8ClampedArray]",ci="[object Uint16Array]",pi="[object Uint32Array]";function li(r,e,n){var o=r.constructor;switch(e){case ei:return Y(r);case qo:case Ho:return new o(+r);case ti:return xe(r,n);case ni:case oi:case ii:case ai:case fi:case si:case ui:case ci:case pi:return cr(r,n);case Ko:return new o;case Jo:case Qo:return new o(r);case Zo:return Oe(r);case $o:return new o;case ri:return Se(r)}}var Ne=li;function mi(r){return typeof r.constructor=="function"&&!Vi(r)?ne(V(r)):{}}var pr=mi;var hi="[object Map]";function gi(r){return cn(r)&&Zr(r)==hi}var Pe=gi;var ke=Bo&&Bo.isMap,vi=ke?Yi(ke):Pe,Te=vi;var bi="[object Set]";function yi(r){return cn(r)&&Zr(r)==bi}var Ce=yi;var Ae=Bo&&Bo.isSet,wi=Ae?Yi(Ae):Ce,Re=wi;var _i=1,Ei=2,xi=4,Me="[object Arguments]",Oi="[object Array]",Li="[object Boolean]",Ii="[object Date]",Si="[object Error]",je="[object Function]",Ni="[object GeneratorFunction]",Pi="[object Map]",ki="[object Number]",Be="[object Object]",Ti="[object RegExp]",Ci="[object Set]",Ai="[object String]",Ri="[object Symbol]",Mi="[object WeakMap]",ji="[object ArrayBuffer]",Bi="[object DataView]",Di="[object Float32Array]",Fi="[object Float64Array]",Gi="[object Int8Array]",Ui="[object Int16Array]",zi="[object Int32Array]",qi="[object Uint8Array]",Hi="[object Uint8ClampedArray]",$i="[object Uint16Array]",Qi="[object Uint32Array]",x={};x[Me]=x[Oi]=x[ji]=x[Bi]=x[Li]=x[Ii]=x[Di]=x[Fi]=x[Gi]=x[Ui]=x[zi]=x[Pi]=x[ki]=x[Be]=x[Ti]=x[Ci]=x[Ai]=x[Ri]=x[qi]=x[Hi]=x[$i]=x[Qi]=!0;x[Si]=x[je]=x[Mi]=!1;function lr(r,e,n,o,i,a){var f,s=e&_i,u=e&Ei,d=e&xi;if(n)f=i?n(r,o,i,a):n(r);if(f!==void 0)return f;if(!Rt(r))return r;var c=we(r);if(c){if(f=Ee(r),!s)return ar(r,f)}else{var p=Zr(r),h=p==je||p==Ni;if(ka(r))return Z(r,s);if(p==Be||p==Me||h&&!i){if(f=u||h?{}:pr(r),!s)return u?ye(r,pe(f,r)):be(r,ce(f,r))}else{if(!x[p])return i?r:{};f=Ne(r,p,s)}}a||(a=new _o);var b=a.get(r);if(b)return b;if(a.set(r,f),Re(r))r.forEach(function(g){f.add(lr(g,e,n,g,r,a))});else if(Te(r))r.forEach(function(g,_){f.set(_,lr(g,e,n,_,r,a))});var w=d?u?_e:hd:u?L:Jt,y=c?void 0:w(r);return Gp(y||r,function(g,_){if(y)_=g,g=r[_];M(f,_,lr(g,e,n,_,r,a))}),f}var De=lr;var ra=1,ea=4;function ta(r){return De(r,ra|ea)}var Fe=ta;var na=function(){return Yt.Date.now()},_r=na;var Ge=Object.prototype,ia=Ge.hasOwnProperty,aa=Ki(function(r,e){r=Object(r);var n=-1,o=e.length,i=o>2?e[2]:void 0;if(i&&T(e[0],e[1],i))o=1;while(++n<o){var a=e[n],f=L(a),s=-1,u=f.length;while(++s<u){var d=f[s],c=r[d];if(c===void 0||va(c,Ge[d])&&!ia.call(r,d))r[d]=a[d]}}return r}),Xe=aa;function fa(r,e,n){if(n!==void 0&&!va(r[e],n)||n===void 0&&!(e in r))R(r,e,n)}var Q=fa;function sa(r,e){if(e==="constructor"&&typeof r[e]==="function")return;if(e=="__proto__")return;return r[e]}var rr=sa;function ua(r){return P(r,L(r))}var Ue=ua;function da(r,e,n,o,i,a,f){var s=rr(r,n),u=rr(e,n),d=f.get(u);if(d){Q(r,n,d);return}var c=a?a(s,u,n+"",r,e,f):void 0,p=c===void 0;if(p){var h=we(u),b=!h&&ka(u),w=!h&&!b&&Ji(u);if(c=u,h||b||w)if(we(s))c=s;else if(em(s))c=ar(s);else if(b)p=!1,c=Z(u,!0);else if(w)p=!1,c=cr(u,!0);else c=[];else if(ue(u)||eo(u)){if(c=s,eo(s))c=Ue(s);else if(!Rt(s)||Eo(s))c=pr(u)}else p=!1}if(p)f.set(u,c),i(c,u,o,a,f),f.delete(u);Q(r,n,c)}var Ve=da;function Ye(r,e,n,o,i){if(r===e)return;fc(e,function(a,f){if(i||(i=new _o),Rt(a))Ve(r,e,f,n,Ye,o,i);else{var s=o?o(rr(r,f),a,f+"",r,e,i):void 0;if(s===void 0)s=a;Q(r,f,s)}},L)}var ze=Ye;function ca(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var G=ca;function pa(r){return function(e,n,o){var i=Object(e);if(!Ln(e)){var a=tr(n,3);e=Jt(e),n=function(s){return a(i[s],s,i)}}var f=r(e,n,o);return f>-1?i[a?e[f]:f]:void 0}}var We=pa;var la=Math.max;function ma(r,e,n){var o=r==null?0:r.length;if(!o)return-1;var i=n==null?0:ee(n);if(i<0)i=la(o+i,0);return jp(r,tr(e,3),i)}var qe=ma;var ha=We(qe),er=ha;function ga(r,e){var n=-1,o=Ln(r)?Array(r.length):[];return es(r,function(i,a,f){o[++n]=e(i,a,f)}),o}var mr=ga;function ba(r,e){var n=we(r)?Co:mr;return n(r,tr(e,3))}var E=ba;function ya(r,e){return r==null?r:fc(r,Ac(e),L)}var He=ya;function wa(r,e){return r&&gc(r,Ac(e))}var Ke=wa;function _a(r,e){return r>e}var Je=_a;var xa=Object.prototype,Oa=xa.hasOwnProperty;function La(r,e){return r!=null&&Oa.call(r,e)}var Ze=La;function Sa(r,e){return r!=null&&Jp(r,e,Ze)}var hr=Sa;var Na="[object String]";function Pa(r){return typeof r=="string"||!we(r)&&cn(r)&&fr(r)==Na}var $e=Pa;function Ta(r,e){return r<e}var vr=Ta;function Ca(r,e){var n={};return e=tr(e,3),gc(r,function(o,i,a){R(n,i,e(o,i,a))}),n}var z=Ca;function Aa(r,e,n){var o=-1,i=r.length;while(++o<i){var a=r[o],f=e(a);if(f!=null&&(s===void 0?f===f&&!Jr(f):n(f,s)))var s=f,u=a}return u}var q=Aa;function Ra(r){return r&&r.length?q(r,Dr,Je):void 0}var I=Ra;var Ma=oe(function(r,e,n){ze(r,e,n)}),nr=Ma;function ja(r){return r&&r.length?q(r,Dr,vr):void 0}var j=ja;function Ba(r,e){return r&&r.length?q(r,tr(e,2),vr):void 0}var H=Ba;function Da(r,e,n,o){if(!Rt(r))return r;e=Zi(e,r);var i=-1,a=e.length,f=a-1,s=r;while(s!=null&&++i<a){var u=Io(e[i]),d=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=f){var c=s[u];if(d=o?o(c,u,s):void 0,d===void 0)d=Rt(c)?c:Wi(e[i+1])?[]:{}}M(s,u,d),s=s[u]}return r}var Qe=Da;function Fa(r,e,n){var o=-1,i=e.length,a={};while(++o<i){var f=e[o],s=Xi(r,f);if(n(s,f))Qe(a,Zi(f,r),s)}return a}var rt=Fa;function Ga(r,e){var n=r.length;r.sort(e);while(n--)r[n]=r[n].value;return r}var tt=Ga;function Xa(r,e){if(r!==e){var n=r!==void 0,o=r===null,i=r===r,a=Jr(r),f=e!==void 0,s=e===null,u=e===e,d=Jr(e);if(!s&&!d&&!a&&r>e||a&&f&&u&&!s&&!d||o&&f&&u||!n&&u||!i)return 1;if(!o&&!a&&!d&&r<e||d&&n&&i&&!o&&!a||s&&n&&i||!f&&i||!u)return-1}return 0}var nt=Xa;function Ua(r,e,n){var o=-1,i=r.criteria,a=e.criteria,f=i.length,s=n.length;while(++o<f){var u=nt(i[o],a[o]);if(u){if(o>=s)return u;var d=n[o];return u*(d=="desc"?-1:1)}}return r.index-e.index}var ot=Ua;function Va(r,e,n){if(e.length)e=Co(e,function(a){if(we(a))return function(f){return Xi(f,a.length===1?a[0]:a)};return a});else e=[Dr];var o=-1;e=Co(e,Yi(tr));var i=mr(r,function(a,f,s){var u=Co(e,function(d){return d(a)});return{criteria:u,index:++o,value:a}});return tt(i,function(a,f){return ot(a,f,n)})}var it=Va;var Ya=Xp("length"),at=Ya;var st="\\ud800-\\udfff",za="\\u0300-\\u036f",Wa="\\ufe20-\\ufe2f",qa="\\u20d0-\\u20ff",Ha=za+Wa+qa,Ka="\\ufe0e\\ufe0f",Ja="["+st+"]",Er="["+Ha+"]",xr="\\ud83c[\\udffb-\\udfff]",Za="(?:"+Er+"|"+xr+")",ut="[^"+st+"]",dt="(?:\\ud83c[\\udde6-\\uddff]){2}",ct="[\\ud800-\\udbff][\\udc00-\\udfff]",$a="\\u200d",pt=Za+"?",lt="["+Ka+"]?",Qa="(?:"+$a+"(?:"+[ut,dt,ct].join("|")+")"+lt+pt+")*",rf=lt+pt+Qa,ef="(?:"+[ut+Er+"?",Er,dt,ct,Ja].join("|")+")",ft=RegExp(xr+"(?="+xr+")|"+ef+rf,"g");function tf(r){var e=ft.lastIndex=0;while(ft.test(r))++e;return e}var mt=tf;function nf(r){return de(r)?mt(r):at(r)}var ht=nf;function of(r,e){return rt(r,e,function(n,o){return Zp(r,o)})}var gt=of;var af=fe(function(r,e){return r==null?{}:gt(r,e)}),K=af;var{ceil:ff,max:sf}=Math;function uf(r,e,n,o){var i=-1,a=sf(ff((e-r)/(n||1)),0),f=Array(a);while(a--)f[o?a:++i]=r,r+=n;return f}var vt=uf;function df(r){return function(e,n,o){if(o&&typeof o!="number"&&T(e,n,o))n=o=void 0;if(e=U(e),n===void 0)n=e,e=0;else n=U(n);return o=o===void 0?e<n?1:-1:U(o),vt(e,n,o,r)}}var bt=df;var cf=bt(),N=cf;var pf="[object Map]",lf="[object Set]";function mf(r){if(r==null)return 0;if(Ln(r))return $e(r)?ht(r):r.length;var e=Zr(r);if(e==pf||e==lf)return r.size;return cc(r).length}var yt=mf;var hf=Ki(function(r,e){if(r==null)return[];var n=e.length;if(n>1&&T(r,e[0],e[1]))e=[];else if(n>2&&T(e[0],e[1],e[2]))e=[e[0]];return it(r,dc(e,1),[])}),C=hf;var gf=0;function vf(r){var e=++gf;return Kp(r)+e}var J=vf;function bf(r,e,n){var o=-1,i=r.length,a=e.length,f={};while(++o<i){var s=o<a?e[o]:void 0;n(f,r[o],s)}return f}var wt=bf;function yf(r,e){return wt(r||[],e||[],M)}var Or=yf;class Lr{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,e=r._prev;if(e!==r)return _t(e),e}enqueue(r){var e=this._sentinel;if(r._prev&&r._next)_t(r);r._next=e._next,e._next._prev=r,e._next=r,r._prev=e}toString(){var r=[],e=this._sentinel,n=e._prev;while(n!==e)r.push(JSON.stringify(n,wf)),n=n._prev;return"["+r.join(", ")+"]"}}function _t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function wf(r,e){if(r!=="_next"&&r!=="_prev")return e}var _f=Nr(1);function Et(r,e){if(r.nodeCount()<=1)return[];var n=xf(r,e||_f),o=Ef(n.graph,n.buckets,n.zeroIdx);return S(E(o,function(i){return r.outEdges(i.v,i.w)}))}function Ef(r,e,n){var o=[],i=e[e.length-1],a=e[0],f;while(r.nodeCount()){while(f=a.dequeue())Ir(r,e,n,f);while(f=i.dequeue())Ir(r,e,n,f);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(f=e[s].dequeue(),f){o=o.concat(Ir(r,e,n,f,!0));break}}}return o}function Ir(r,e,n,o,i){var a=i?[]:void 0;return v(r.inEdges(o.v),function(f){var s=r.edge(f),u=r.node(f.v);if(i)a.push({v:f.v,w:f.w});u.out-=s,Sr(e,n,u)}),v(r.outEdges(o.v),function(f){var s=r.edge(f),u=f.w,d=r.node(u);d.in-=s,Sr(e,n,d)}),r.removeNode(o.v),a}function xf(r,e){var n=new et,o=0,i=0;v(r.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),v(r.edges(),function(s){var u=n.edge(s.v,s.w)||0,d=e(s),c=u+d;n.setEdge(s.v,s.w,c),i=Math.max(i,n.node(s.v).out+=d),o=Math.max(o,n.node(s.w).in+=d)});var a=N(i+o+3).map(function(){return new Lr}),f=o+1;return v(n.nodes(),function(s){Sr(a,f,n.node(s))}),{graph:n,buckets:a,zeroIdx:f}}function Sr(r,e,n){if(!n.out)r[0].enqueue(n);else if(!n.in)r[r.length-1].enqueue(n);else r[n.out-n.in+e].enqueue(n)}function xt(r){var e=r.graph().acyclicer==="greedy"?Et(r,n(r)):Of(r);v(e,function(o){var i=r.edge(o);r.removeEdge(o),i.forwardName=o.name,i.reversed=!0,r.setEdge(o.w,o.v,i,J("rev"))});function n(o){return function(i){return o.edge(i).weight}}}function Of(r){var e=[],n={},o={};function i(a){if(Object.prototype.hasOwnProperty.call(o,a))return;o[a]=!0,n[a]=!0,v(r.outEdges(a),function(f){if(Object.prototype.hasOwnProperty.call(n,f.w))e.push(f);else i(f.w)}),delete n[a]}return v(r.nodes(),i),e}function Ot(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var o=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,o)}})}function k(r,e,n,o){var i;do i=J(o);while(r.hasNode(i));return n.dummy=e,r.setNode(i,n),i}function It(r){var e=new et().setGraph(r.graph());return v(r.nodes(),function(n){e.setNode(n,r.node(n))}),v(r.edges(),function(n){var o=e.edge(n.v,n.w)||{weight:0,minlen:1},i=r.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+i.weight,minlen:Math.max(o.minlen,i.minlen)})}),e}function br(r){var e=new et({multigraph:r.isMultigraph()}).setGraph(r.graph());return v(r.nodes(),function(n){if(!r.children(n).length)e.setNode(n,r.node(n))}),v(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}function Pr(r,e){var{x:n,y:o}=r,i=e.x-n,a=e.y-o,f=r.width/2,s=r.height/2;if(!i&&!a)throw Error("Not possible to find intersection inside of the rectangle");var u,d;if(Math.abs(a)*f>Math.abs(i)*s){if(a<0)s=-s;u=s*i/a,d=s}else{if(i<0)f=-f;u=f,d=f*a/i}return{x:n+u,y:o+d}}function B(r){var e=E(N(Tr(r)+1),function(){return[]});return v(r.nodes(),function(n){var o=r.node(n),i=o.rank;if(!Zt(i))e[i][o.order]=n}),e}function St(r){var e=j(E(r.nodes(),function(n){return r.node(n).rank}));v(r.nodes(),function(n){var o=r.node(n);if(hr(o,"rank"))o.rank-=e})}function Nt(r){var e=j(E(r.nodes(),function(a){return r.node(a).rank})),n=[];v(r.nodes(),function(a){var f=r.node(a).rank-e;if(!n[f])n[f]=[];n[f].push(a)});var o=0,i=r.graph().nodeRankFactor;v(n,function(a,f){if(Zt(a)&&f%i!==0)--o;else if(o)v(a,function(s){r.node(s).rank+=o})})}function kr(r,e,n,o){var i={width:0,height:0};if(arguments.length>=4)i.rank=n,i.order=o;return k(r,"border",i,e)}function Tr(r){return I(E(r.nodes(),function(e){var n=r.node(e).rank;if(!Zt(n))return n}))}function Pt(r,e){var n={lhs:[],rhs:[]};return v(r,function(o){if(e(o))n.lhs.push(o);else n.rhs.push(o)}),n}function kt(r,e){var n=_r();try{return e()}finally{console.log(r+" time: "+(_r()-n)+"ms")}}function Tt(r,e){return e()}function At(r){function e(n){var o=r.children(n),i=r.node(n);if(o.length)v(o,e);if(Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,f=i.maxRank+1;a<f;++a)Ct(r,"borderLeft","_bl",n,i,a),Ct(r,"borderRight","_br",n,i,a)}}v(r.children(),e)}function Ct(r,e,n,o,i,a){var f={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=k(r,"border",f,n);if(i[e][a]=u,r.setParent(u,o),s)r.setEdge(s,u,{weight:1})}function jt(r){var e=r.graph().rankdir.toLowerCase();if(e==="lr"||e==="rl")Dt(r)}function Bt(r){var e=r.graph().rankdir.toLowerCase();if(e==="bt"||e==="rl")Lf(r);if(e==="lr"||e==="rl")If(r),Dt(r)}function Dt(r){v(r.nodes(),function(e){Mt(r.node(e))}),v(r.edges(),function(e){Mt(r.edge(e))})}function Mt(r){var e=r.width;r.width=r.height,r.height=e}function Lf(r){v(r.nodes(),function(e){Cr(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Cr),Object.prototype.hasOwnProperty.call(n,"y"))Cr(n)})}function Cr(r){r.y=-r.y}function If(r){v(r.nodes(),function(e){Ar(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Ar),Object.prototype.hasOwnProperty.call(n,"x"))Ar(n)})}function Ar(r){var e=r.x;r.x=r.y,r.y=e}function Ft(r){r.graph().dummyChains=[],v(r.edges(),function(e){Nf(r,e)})}function Nf(r,e){var n=e.v,o=r.node(n).rank,i=e.w,a=r.node(i).rank,f=e.name,s=r.edge(e),u=s.labelRank;if(a===o+1)return;r.removeEdge(e);var d=void 0,c,p;for(p=0,++o;o<a;++p,++o){if(s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:o},c=k(r,"edge",d,"_d"),o===u)d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos;if(r.setEdge(n,c,{weight:s.weight},f),p===0)r.graph().dummyChains.push(c);n=c}r.setEdge(n,i,{weight:s.weight},f)}function Gt(r){v(r.graph().dummyChains,function(e){var n=r.node(e),o=n.edgeLabel,i;r.setEdge(n.edgeObj,o);while(n.dummy){if(i=r.successors(e)[0],r.removeNode(e),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label")o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height;e=i,n=r.node(e)}})}function or(r){var e={};function n(o){var i=r.node(o);if(Object.prototype.hasOwnProperty.call(e,o))return i.rank;e[o]=!0;var a=j(E(r.outEdges(o),function(f){return n(f.w)-r.edge(f).minlen}));if(a===Number.POSITIVE_INFINITY||a===void 0||a===null)a=0;return i.rank=a}v(r.sources(),n)}function X(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen}function yr(r){var e=new et({directed:!1}),n=r.nodes()[0],o=r.nodeCount();e.setNode(n,{});var i,a;while(Pf(e,r)<o)i=kf(e,r),a=e.hasNode(i.v)?X(r,i):-X(r,i),Tf(e,r,a);return e}function Pf(r,e){function n(o){v(e.nodeEdges(o),function(i){var a=i.v,f=o===a?i.w:a;if(!r.hasNode(f)&&!X(e,i))r.setNode(f,{}),r.setEdge(o,f,{}),n(f)})}return v(r.nodes(),n),r.nodeCount()}function kf(r,e){return H(e.edges(),function(n){if(r.hasNode(n.v)!==r.hasNode(n.w))return X(e,n)})}function Tf(r,e,n){v(r.nodes(),function(o){e.node(o).rank+=n})}var fh=Nr(1);var mh=Nr(1);Rr.CycleException=ir;function Rr(r){var e={},n={},o=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new ir;if(!Object.prototype.hasOwnProperty.call(e,a))n[a]=!0,e[a]=!0,v(r.predecessors(a),i),delete n[a],o.push(a)}if(v(r.sinks(),i),yt(e)!==r.nodeCount())throw new ir;return o}function ir(){}ir.prototype=Error();function wr(r,e,n){if(!we(e))e=[e];var o=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return v(e,function(f){if(!r.hasNode(f))throw Error("Graph does not have node: "+f);Ut(r,f,n==="post",a,o,i)}),i}function Ut(r,e,n,o,i,a){if(!Object.prototype.hasOwnProperty.call(o,e)){if(o[e]=!0,!n)a.push(e);if(v(i(e),function(f){Ut(r,f,n,o,i,a)}),n)a.push(e)}}function Mr(r,e){return wr(r,e,"post")}function jr(r,e){return wr(r,e,"pre")}F.initLowLimValues=Fr;F.initCutValues=Br;F.calcCutValue=zt;F.leaveEdge=qt;F.enterEdge=Ht;F.exchangeEdges=Kt;function F(r){r=It(r),or(r);var e=yr(r);Fr(e),Br(e,r);var n,o;while(n=qt(e))o=Ht(e,r,n),Kt(e,r,n,o)}function Br(r,e){var n=Mr(r,r.nodes());n=n.slice(0,n.length-1),v(n,function(o){jf(r,e,o)})}function jf(r,e,n){var o=r.node(n),i=o.parent;r.edge(n,i).cutvalue=zt(r,e,n)}function zt(r,e,n){var o=r.node(n),i=o.parent,a=!0,f=e.edge(n,i),s=0;if(!f)a=!1,f=e.edge(i,n);return s=f.weight,v(e.nodeEdges(n),function(u){var d=u.v===n,c=d?u.w:u.v;if(c!==i){var p=d===a,h=e.edge(u).weight;if(s+=p?h:-h,Df(r,n,c)){var b=r.edge(n,c).cutvalue;s+=p?-b:b}}}),s}function Fr(r,e){if(arguments.length<2)e=r.nodes()[0];Wt(r,{},1,e)}function Wt(r,e,n,o,i){var a=n,f=r.node(o);if(e[o]=!0,v(r.neighbors(o),function(s){if(!Object.prototype.hasOwnProperty.call(e,s))n=Wt(r,e,n,s,o)}),f.low=a,f.lim=n++,i)f.parent=i;else delete f.parent;return n}function qt(r){return er(r.edges(),function(e){return r.edge(e).cutvalue<0})}function Ht(r,e,n){var{v:o,w:i}=n;if(!e.hasEdge(o,i))o=n.w,i=n.v;var a=r.node(o),f=r.node(i),s=a,u=!1;if(a.lim>f.lim)s=f,u=!0;var d=gr(e.edges(),function(c){return u===Vt(r,r.node(c.v),s)&&u!==Vt(r,r.node(c.w),s)});return H(d,function(c){return X(e,c)})}function Kt(r,e,n,o){var{v:i,w:a}=n;r.removeEdge(i,a),r.setEdge(o.v,o.w,{}),Fr(r),Br(r,e),Bf(r,e)}function Bf(r,e){var n=er(r.nodes(),function(i){return!e.node(i).parent}),o=jr(r,n);o=o.slice(1),v(o,function(i){var a=r.node(i).parent,f=e.edge(i,a),s=!1;if(!f)f=e.edge(a,i),s=!0;e.node(i).rank=e.node(a).rank+(s?f.minlen:-f.minlen)})}function Df(r,e,n){return r.hasEdge(e,n)}function Vt(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}function Gr(r){switch(r.graph().ranker){case"network-simplex":$t(r);break;case"tight-tree":Gf(r);break;case"longest-path":Ff(r);break;default:$t(r)}}var Ff=or;function Gf(r){or(r),yr(r)}function $t(r){F(r)}function Qt(r){var e=k(r,"root",{},"_root"),n=Xf(r),o=I(Xr(n))-1,i=2*o+1;r.graph().nestingRoot=e,v(r.edges(),function(f){r.edge(f).minlen*=i});var a=Uf(r)+1;v(r.children(),function(f){rn(r,e,i,a,o,n,f)}),r.graph().nodeRankFactor=i}function rn(r,e,n,o,i,a,f){var s=r.children(f);if(!s.length){if(f!==e)r.setEdge(e,f,{weight:0,minlen:n});return}var u=kr(r,"_bt"),d=kr(r,"_bb"),c=r.node(f);if(r.setParent(u,f),c.borderTop=u,r.setParent(d,f),c.borderBottom=d,v(s,function(p){rn(r,e,n,o,i,a,p);var h=r.node(p),b=h.borderTop?h.borderTop:p,w=h.borderBottom?h.borderBottom:p,y=h.borderTop?o:2*o,g=b!==w?1:i-a[f]+1;r.setEdge(u,b,{weight:y,minlen:g,nestingEdge:!0}),r.setEdge(w,d,{weight:y,minlen:g,nestingEdge:!0})}),!r.parent(f))r.setEdge(e,u,{weight:0,minlen:i+a[f]})}function Xf(r){var e={};function n(o,i){var a=r.children(o);if(a&&a.length)v(a,function(f){n(f,i+1)});e[o]=i}return v(r.children(),function(o){n(o,1)}),e}function Uf(r){return So(r.edges(),function(e,n){return e+r.edge(n).weight},0)}function en(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,v(r.edges(),function(n){var o=r.edge(n);if(o.nestingEdge)r.removeEdge(n)})}function tn(r,e,n){var o={},i;v(n,function(a){var f=r.parent(a),s,u;while(f){if(s=r.parent(f),s)u=o[s],o[s]=f;else u=i,i=f;if(u&&u!==f){e.setEdge(u,f);return}f=s}})}function nn(r,e,n){var o=Yf(r),i=new et({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(a){return r.node(a)});return v(r.nodes(),function(a){var f=r.node(a),s=r.parent(a);if(f.rank===e||f.minRank<=e&&e<=f.maxRank){if(i.setNode(a),i.setParent(a,s||o),v(r[n](a),function(u){var d=u.v===a?u.w:u.v,c=i.edge(d,a),p=!Zt(c)?c.weight:0;i.setEdge(d,a,{weight:r.edge(u).weight+p})}),Object.prototype.hasOwnProperty.call(f,"minRank"))i.setNode(a,{borderLeft:f.borderLeft[e],borderRight:f.borderRight[e]})}}),i}function Yf(r){var e;while(r.hasNode(e=J("_root")));return e}function on(r,e){var n=0;for(var o=1;o<e.length;++o)n+=zf(r,e[o-1],e[o]);return n}function zf(r,e,n){var o=Or(n,E(n,function(d,c){return c})),i=S(E(e,function(d){return C(E(r.outEdges(d),function(c){return{pos:o[c.w],weight:r.edge(c).weight}}),"pos")})),a=1;while(a<n.length)a<<=1;var f=2*a-1;a-=1;var s=E(Array(f),function(){return 0}),u=0;return v(i.forEach(function(d){var c=d.pos+a;s[c]+=d.weight;var p=0;while(c>0){if(c%2)p+=s[c+1];c=c-1>>1,s[c]+=d.weight}u+=d.weight*p})),u}function an(r){var e={},n=gr(r.nodes(),function(s){return!r.children(s).length}),o=I(E(n,function(s){return r.node(s).rank})),i=E(N(o+1),function(){return[]});function a(s){if(hr(e,s))return;e[s]=!0;var u=r.node(s);i[u.rank].push(s),v(r.successors(s),a)}var f=C(n,function(s){return r.node(s).rank});return v(f,a),i}function fn(r,e){return E(e,function(n){var o=r.inEdges(n);if(!o.length)return{v:n};else{var i=So(o,function(a,f){var s=r.edge(f),u=r.node(f.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function sn(r,e){var n={};v(r,function(i,a){var f=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};if(!Zt(i.barycenter))f.barycenter=i.barycenter,f.weight=i.weight}),v(e.edges(),function(i){var a=n[i.v],f=n[i.w];if(!Zt(a)&&!Zt(f))f.indegree++,a.out.push(n[i.w])});var o=gr(n,function(i){return!i.indegree});return Wf(o)}function Wf(r){var e=[];function n(a){return function(f){if(f.merged)return;if(Zt(f.barycenter)||Zt(a.barycenter)||f.barycenter>=a.barycenter)qf(a,f)}}function o(a){return function(f){if(f.in.push(a),--f.indegree===0)r.push(f)}}while(r.length){var i=r.pop();e.push(i),v(i.in.reverse(),n(i)),v(i.out,o(i))}return E(gr(e,function(a){return!a.merged}),function(a){return K(a,["vs","i","barycenter","weight"])})}function qf(r,e){var n=0,o=0;if(r.weight)n+=r.barycenter*r.weight,o+=r.weight;if(e.weight)n+=e.barycenter*e.weight,o+=e.weight;r.vs=e.vs.concat(r.vs),r.barycenter=n/o,r.weight=o,r.i=Math.min(e.i,r.i),e.merged=!0}function dn(r,e){var n=Pt(r,function(c){return Object.prototype.hasOwnProperty.call(c,"barycenter")}),o=n.lhs,i=C(n.rhs,function(c){return-c.i}),a=[],f=0,s=0,u=0;o.sort(Hf(!!e)),u=un(a,i,u),v(o,function(c){u+=c.vs.length,a.push(c.vs),f+=c.barycenter*c.weight,s+=c.weight,u=un(a,i,u)});var d={vs:S(a)};if(s)d.barycenter=f/s,d.weight=s;return d}function un(r,e,n){var o;while(e.length&&(o=G(e)).i<=n)e.pop(),r.push(o.vs),n++;return n}function Hf(r){return function(e,n){if(e.barycenter<n.barycenter)return-1;else if(e.barycenter>n.barycenter)return 1;return!r?e.i-n.i:n.i-e.i}}function Ur(r,e,n,o){var i=r.children(e),a=r.node(e),f=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,u={};if(f)i=gr(i,function(w){return w!==f&&w!==s});var d=fn(r,i);v(d,function(w){if(r.children(w.v).length){var y=Ur(r,w.v,n,o);if(u[w.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter"))Jf(w,y)}});var c=sn(d,n);Kf(c,u);var p=dn(c,o);if(f){if(p.vs=S([f,p.vs,s]),r.predecessors(f).length){var h=r.node(r.predecessors(f)[0]),b=r.node(r.predecessors(s)[0]);if(!Object.prototype.hasOwnProperty.call(p,"barycenter"))p.barycenter=0,p.weight=0;p.barycenter=(p.barycenter*p.weight+h.order+b.order)/(p.weight+2),p.weight+=2}}return p}function Kf(r,e){v(r,function(n){n.vs=S(n.vs.map(function(o){if(e[o])return e[o].vs;return o}))})}function Jf(r,e){if(!Zt(r.barycenter))r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight;else r.barycenter=e.barycenter,r.weight=e.weight}function mn(r){var e=Tr(r),n=pn(r,N(1,e+1),"inEdges"),o=pn(r,N(e-1,-1,-1),"outEdges"),i=an(r);ln(r,i);var a=Number.POSITIVE_INFINITY,f;for(var s=0,u=0;u<4;++s,++u){Zf(s%2?n:o,s%4>=2),i=B(r);var d=on(r,i);if(d<a)u=0,f=Fe(i),a=d}ln(r,f)}function pn(r,e,n){return E(e,function(o){return nn(r,o,n)})}function Zf(r,e){var n=new et;v(r,function(o){var i=o.graph().root,a=Ur(o,i,n,e);v(a.vs,function(f,s){o.node(f).order=s}),tn(o,n,a.vs)})}function ln(r,e){v(e,function(n){v(n,function(o,i){r.node(o).order=i})})}function hn(r){var e=Qf(r);v(r.graph().dummyChains,function(n){var o=r.node(n),i=o.edgeObj,a=$f(r,e,i.v,i.w),{path:f,lca:s}=a,u=0,d=f[u],c=!0;while(n!==i.w){if(o=r.node(n),c){while((d=f[u])!==s&&r.node(d).maxRank<o.rank)u++;if(d===s)c=!1}if(!c){while(u<f.length-1&&r.node(d=f[u+1]).minRank<=o.rank)u++;d=f[u]}r.setParent(n,d),n=r.successors(n)[0]}})}function $f(r,e,n,o){var i=[],a=[],f=Math.min(e[n].low,e[o].low),s=Math.max(e[n].lim,e[o].lim),u,d;u=n;do u=r.parent(u),i.push(u);while(u&&(e[u].low>f||s>e[u].lim));d=u,u=o;while((u=r.parent(u))!==d)a.push(u);return{path:i.concat(a.reverse()),lca:d}}function Qf(r){var e={},n=0;function o(i){var a=n;v(r.children(i),o),e[i]={low:a,lim:n++}}return v(r.children(),o),e}function rs(r,e){var n={};function o(i,a){var f=0,s=0,u=i.length,d=G(a);return v(a,function(c,p){var h=ns(r,c),b=h?r.node(h).order:u;if(h||c===d)v(a.slice(s,p+1),function(w){v(r.predecessors(w),function(y){var g=r.node(y),_=g.order;if((_<f||b<_)&&!(g.dummy&&r.node(w).dummy))gn(n,y,w)})}),s=p+1,f=b}),a}return So(e,o),n}function ts(r,e){var n={};function o(a,f,s,u,d){var c;v(N(f,s),function(p){if(c=a[p],r.node(c).dummy)v(r.predecessors(c),function(h){var b=r.node(h);if(b.dummy&&(b.order<u||b.order>d))gn(n,h,c)})})}function i(a,f){var s=-1,u,d=0;return v(f,function(c,p){if(r.node(c).dummy==="border"){var h=r.predecessors(c);if(h.length)u=r.node(h[0]).order,o(f,d,p,s,u),d=p,s=u}o(f,d,f.length,u,a.length)}),f}return So(e,i),n}function ns(r,e){if(r.node(e).dummy)return er(r.predecessors(e),function(n){return r.node(n).dummy})}function gn(r,e,n){if(e>n){var o=e;e=n,n=o}if(!Object.prototype.hasOwnProperty.call(r,e))Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=r[e];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function os(r,e,n){if(e>n){var o=e;e=n,n=o}return!!r[e]&&Object.prototype.hasOwnProperty.call(r[e],n)}function is(r,e,n,o){var i={},a={},f={};return v(e,function(s){v(s,function(u,d){i[u]=u,a[u]=u,f[u]=d})}),v(e,function(s){var u=-1;v(s,function(d){var c=o(d);if(c.length){c=C(c,function(y){return f[y]});var p=(c.length-1)/2;for(var h=Math.floor(p),b=Math.ceil(p);h<=b;++h){var w=c[h];if(a[d]===d&&u<f[w]&&!os(n,d,w))a[w]=d,a[d]=i[d]=i[w],u=f[w]}}})}),{root:i,align:a}}function as(r,e,n,o,i){var a={},f=fs(r,e,n,i),s=i?"borderLeft":"borderRight";function u(p,h){var b=f.nodes(),w=b.pop(),y={};while(w){if(y[w])p(w);else y[w]=!0,b.push(w),b=b.concat(h(w));w=b.pop()}}function d(p){a[p]=f.inEdges(p).reduce(function(h,b){return Math.max(h,a[b.v]+f.edge(b))},0)}function c(p){var h=f.outEdges(p).reduce(function(w,y){return Math.min(w,a[y.w]-f.edge(y))},Number.POSITIVE_INFINITY),b=r.node(p);if(h!==Number.POSITIVE_INFINITY&&b.borderType!==s)a[p]=Math.max(a[p],h)}return u(d,f.predecessors.bind(f)),u(c,f.successors.bind(f)),v(o,function(p){a[p]=a[n[p]]}),a}function fs(r,e,n,o){var i=new et,a=r.graph(),f=cs(a.nodesep,a.edgesep,o);return v(e,function(s){var u;v(s,function(d){var c=n[d];if(i.setNode(c),u){var p=n[u],h=i.edge(p,c);i.setEdge(p,c,Math.max(f(r,d,u),h||0))}u=d})}),i}function ss(r,e){return H(Xr(e),function(n){var{NEGATIVE_INFINITY:o,POSITIVE_INFINITY:i}=Number;return He(n,function(a,f){var s=ps(r,f)/2;o=Math.max(a+s,o),i=Math.min(a-s,i)}),o-i})}function us(r,e){var n=Xr(e),o=j(n),i=I(n);v(["u","d"],function(a){v(["l","r"],function(f){var s=a+f,u=r[s],d;if(u===e)return;var c=Xr(u);if(d=f==="l"?o-j(c):i-I(c),d)r[s]=z(u,function(p){return p+d})})})}function ds(r,e){return z(r.ul,function(n,o){if(e)return r[e.toLowerCase()][o];else{var i=C(E(r,o));return(i[1]+i[2])/2}})}function vn(r){var e=B(r),n=nr(rs(r,e),ts(r,e)),o={},i;v(["u","d"],function(f){i=f==="u"?e:Xr(e).reverse(),v(["l","r"],function(s){if(s==="r")i=E(i,function(p){return Xr(p).reverse()});var u=(f==="u"?r.predecessors:r.successors).bind(r),d=is(r,i,n,u),c=as(r,i,d.root,d.align,s==="r");if(s==="r")c=z(c,function(p){return-p});o[f+s]=c})});var a=ss(r,o);return us(o,a),ds(o,r.graph().align)}function cs(r,e,n){return function(o,i,a){var f=o.node(i),s=o.node(a),u=0,d;if(u+=f.width/2,Object.prototype.hasOwnProperty.call(f,"labelpos"))switch(f.labelpos.toLowerCase()){case"l":d=-f.width/2;break;case"r":d=f.width/2;break}if(d)u+=n?d:-d;if(d=0,u+=(f.dummy?e:r)/2,u+=(s.dummy?e:r)/2,u+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=s.width/2;break;case"r":d=-s.width/2;break}if(d)u+=n?d:-d;return d=0,u}}function ps(r,e){return r.node(e).width}function bn(r){r=br(r),ls(r),Ke(vn(r),function(e,n){r.node(n).x=e})}function ls(r){var e=B(r),n=r.graph().ranksep,o=0;v(e,function(i){var a=I(E(i,function(f){return r.node(f).height}));v(i,function(f){r.node(f).y=o+a/2}),o+=a+n})}function zr(r,e){var n=e&&e.debugTiming?kt:Tt;n("layout",()=>{var o=n(" buildLayoutGraph",()=>Os(r));n(" runLayout",()=>ms(o,n)),n(" updateInputGraph",()=>hs(r,o))})}function ms(r,e){e(" makeSpaceForEdgeLabels",()=>Ls(r)),e(" removeSelfEdges",()=>Rs(r)),e(" acyclic",()=>xt(r)),e(" nestingGraph.run",()=>Qt(r)),e(" rank",()=>Gr(br(r))),e(" injectEdgeLabelProxies",()=>Is(r)),e(" removeEmptyRanks",()=>Nt(r)),e(" nestingGraph.cleanup",()=>en(r)),e(" normalizeRanks",()=>St(r)),e(" assignRankMinMax",()=>Ss(r)),e(" removeEdgeLabelProxies",()=>Ns(r)),e(" normalize.run",()=>Ft(r)),e(" parentDummyChains",()=>hn(r)),e(" addBorderSegments",()=>At(r)),e(" order",()=>mn(r)),e(" insertSelfEdges",()=>Ms(r)),e(" adjustCoordinateSystem",()=>jt(r)),e(" position",()=>bn(r)),e(" positionSelfEdges",()=>js(r)),e(" removeBorderNodes",()=>As(r)),e(" normalize.undo",()=>Gt(r)),e(" fixupEdgeLabelCoords",()=>Ts(r)),e(" undoCoordinateSystem",()=>Bt(r)),e(" translateGraph",()=>Ps(r)),e(" assignNodeIntersects",()=>ks(r)),e(" reversePoints",()=>Cs(r)),e(" acyclic.undo",()=>Ot(r))}function hs(r,e){v(r.nodes(),function(n){var o=r.node(n),i=e.node(n);if(o){if(o.x=i.x,o.y=i.y,e.children(n).length)o.width=i.width,o.height=i.height}}),v(r.edges(),function(n){var o=r.edge(n),i=e.edge(n);if(o.points=i.points,Object.prototype.hasOwnProperty.call(i,"x"))o.x=i.x,o.y=i.y}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}var gs=["nodesep","edgesep","ranksep","marginx","marginy"],vs={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},bs=["acyclicer","ranker","rankdir","align"],ys=["width","height"],ws={width:0,height:0},_s=["minlen","weight","width","height","labeloffset"],Es={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xs=["labelpos"];function Os(r){var e=new et({multigraph:!0,compound:!0}),n=Yr(r.graph());return e.setGraph(nr({},vs,Vr(n,gs),K(n,bs))),v(r.nodes(),function(o){var i=Yr(r.node(o));e.setNode(o,Xe(Vr(i,ys),ws)),e.setParent(o,r.parent(o))}),v(r.edges(),function(o){var i=Yr(r.edge(o));e.setEdge(o,nr({},Es,Vr(i,_s),K(i,xs)))}),e}function Ls(r){var e=r.graph();e.ranksep/=2,v(r.edges(),function(n){var o=r.edge(n);if(o.minlen*=2,o.labelpos.toLowerCase()!=="c")if(e.rankdir==="TB"||e.rankdir==="BT")o.width+=o.labeloffset;else o.height+=o.labeloffset})}function Is(r){v(r.edges(),function(e){var n=r.edge(e);if(n.width&&n.height){var o=r.node(e.v),i=r.node(e.w),a={rank:(i.rank-o.rank)/2+o.rank,e};k(r,"edge-proxy",a,"_ep")}})}function Ss(r){var e=0;v(r.nodes(),function(n){var o=r.node(n);if(o.borderTop)o.minRank=r.node(o.borderTop).rank,o.maxRank=r.node(o.borderBottom).rank,e=I(e,o.maxRank)}),r.graph().maxRank=e}function Ns(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="edge-proxy")r.edge(n.e).labelRank=n.rank,r.removeNode(e)})}function Ps(r){var e=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,a=r.graph(),f=a.marginx||0,s=a.marginy||0;function u(d){var{x:c,y:p,width:h,height:b}=d;e=Math.min(e,c-h/2),n=Math.max(n,c+h/2),o=Math.min(o,p-b/2),i=Math.max(i,p+b/2)}v(r.nodes(),function(d){u(r.node(d))}),v(r.edges(),function(d){var c=r.edge(d);if(Object.prototype.hasOwnProperty.call(c,"x"))u(c)}),e-=f,o-=s,v(r.nodes(),function(d){var c=r.node(d);c.x-=e,c.y-=o}),v(r.edges(),function(d){var c=r.edge(d);if(v(c.points,function(p){p.x-=e,p.y-=o}),Object.prototype.hasOwnProperty.call(c,"x"))c.x-=e;if(Object.prototype.hasOwnProperty.call(c,"y"))c.y-=o}),a.width=n-e+f,a.height=i-o+s}function ks(r){v(r.edges(),function(e){var n=r.edge(e),o=r.node(e.v),i=r.node(e.w),a,f;if(!n.points)n.points=[],a=i,f=o;else a=n.points[0],f=n.points[n.points.length-1];n.points.unshift(Pr(o,a)),n.points.push(Pr(i,f))})}function Ts(r){v(r.edges(),function(e){var n=r.edge(e);if(Object.prototype.hasOwnProperty.call(n,"x")){if(n.labelpos==="l"||n.labelpos==="r")n.width-=n.labeloffset;switch(n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}}})}function Cs(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed)n.points.reverse()})}function As(r){v(r.nodes(),function(e){if(r.children(e).length){var n=r.node(e),o=r.node(n.borderTop),i=r.node(n.borderBottom),a=r.node(G(n.borderLeft)),f=r.node(G(n.borderRight));n.width=Math.abs(f.x-a.x),n.height=Math.abs(i.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}}),v(r.nodes(),function(e){if(r.node(e).dummy==="border")r.removeNode(e)})}function Rs(r){v(r.edges(),function(e){if(e.v===e.w){var n=r.node(e.v);if(!n.selfEdges)n.selfEdges=[];n.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}function Ms(r){var e=B(r);v(e,function(n){var o=0;v(n,function(i,a){var f=r.node(i);f.order=a+o,v(f.selfEdges,function(s){k(r,"selfedge",{width:s.label.width,height:s.label.height,rank:f.rank,order:a+ ++o,e:s.e,label:s.label},"_se")}),delete f.selfEdges})})}function js(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="selfedge"){var o=r.node(n.e.v),i=o.x+o.width/2,a=o.y,f=n.x-i,s=o.height/2;r.setEdge(n.e,n.label),r.removeNode(e),n.label.points=[{x:i+2*f/3,y:a-s},{x:i+5*f/6,y:a-s},{x:i+f,y:a},{x:i+5*f/6,y:a+s},{x:i+2*f/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Vr(r,e){return z(K(r,e),Number)}function Yr(r){var e={};return v(r,function(n,o){e[o.toLowerCase()]=n}),e}var yn=t((r,e,n)=>Math.max(e,Math.min(n,r)),"clamp"),wn=t((r="TB")=>{switch(r){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Bs=t((r)=>r==="flowchart"||r==="flowchart-v2"||r==="stateDiagram"||r==="er"||r==="classDiagram","shouldMergeSelfLoopSegments"),Ds=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Fs=t((r,e,n,o,i)=>{let a=[],f=new Set;if(n.forEach(({start:c,end:p})=>{if(c!==o)f.add(c);if(p!==o)f.add(p)}),f.forEach((c)=>{let p=r.node(c);if(typeof p?.x==="number"&&typeof p?.y==="number")a.push(p)}),a.length===0)n.forEach(({edge:c})=>{(c.points??[]).forEach((p)=>{if(typeof p?.x==="number"&&typeof p?.y==="number")a.push(p)})});if(a.length===0)return wn(i);let s=a.reduce((c,p)=>({x:c.x+p.x/a.length,y:c.y+p.y/a.length}),{x:0,y:0}),u=s.x-e.x,d=s.y-e.y;if(Math.abs(u)>Math.abs(d))return u>0?"right":"left";if(Math.abs(d)>0)return d>0?"bottom":"top";return wn(i)},"getSelfLoopSide"),Gs=t((r,e="top",n=0,o=0)=>{let i=r.x,a=r.y-n,f=r.width/2,s=r.height/2,u=Math.max(36,Math.min(100,r.width*0.8)),d=yn(Math.max(o,r.width*0.35),36,u),c=yn(Math.min(r.width,r.height)*0.45,24,48);switch(e){case"bottom":{let p=a+s;return[{x:i-d/2,y:p},{x:i-d/2,y:p+c},{x:i+d/2,y:p+c},{x:i+d/2,y:p}]}case"right":{let p=i+f;return[{x:p,y:a-d/2},{x:p+c,y:a-d/2},{x:p+c,y:a+d/2},{x:p,y:a+d/2}]}case"left":{let p=i-f;return[{x:p,y:a-d/2},{x:p-c,y:a-d/2},{x:p-c,y:a+d/2},{x:p,y:a+d/2}]}case"top":default:{let p=a-s;return[{x:i-d/2,y:p},{x:i-d/2,y:p-c},{x:i+d/2,y:p-c},{x:i+d/2,y:p}]}}},"getSelfLoopPoints"),Xs=t((r,e,n="top",o=0,i={})=>{let f=r.x,s=r.y-o,u=i.width??0,d=i.height??0;switch(n){case"bottom":return{x:f,y:Math.max(...e.map((c)=>c.y))+d/2+4};case"right":return{x:Math.max(...e.map((c)=>c.x))+u/2+4,y:s};case"left":return{x:Math.min(...e.map((c)=>c.x))-u/2-4,y:s};case"top":default:return{x:f,y:Math.min(...e.map((c)=>c.y))-d/2-4}}},"getSelfLoopLabelPosition"),En=t((r,e=0,{mergeSelfLoops:n=!0}={})=>{let o=new Map,i=[],a=r.graph()?.rankdir;return r.edges().forEach((f)=>{let s=r.edge(f);if(n&&s.selfLoop){let u=s.selfLoop.id;if(!o.has(u))o.set(u,[]);o.get(u).push({edge:s,start:f.v,end:f.w})}else i.push({edge:s,start:f.v,end:f.w})}),o.forEach((f)=>{if(f.length!==3){f.forEach((_)=>i.push(_));return}f.sort((_,A)=>_.edge.selfLoop.order-A.edge.selfLoop.order);let[s,u,d]=f,c=s.edge.originalEdge??u.edge.originalEdge??d.edge.originalEdge??u.edge,p=r.node(c.start);if(!p){f.forEach((_)=>i.push(_));return}let h={width:u.edge.width,height:u.edge.height},b=Fs(r,p,f,c.start,a),w=Gs(p,b,e,h.width??0),y=Xs(p,w,b,e,h),g={...u.edge,...c,id:c.id,points:w,start:c.start,end:c.end,x:y.x,y:y.y,width:h.width,height:h.height,labelStyle:u.edge.labelStyle,fromCluster:s.edge.fromCluster??u.edge.fromCluster??d.edge.fromCluster,toCluster:s.edge.toCluster??u.edge.toCluster??d.edge.toCluster};delete g.selfLoop,delete g.originalEdge,i.push({edge:g,start:g.start,end:g.end})}),i},"getEdgesToRender"),xn=t(async({element:r,graph:e,diagramType:n,id:o,parentCluster:i,siteConfig:a})=>{let f=e.graph().rankdir;l.trace("Dir in recursive render - dir:",f);let{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:p}=Pp(r,{edgePathsClass:"edgePaths"});if(!e.nodes())l.info("No nodes found for",e);else l.info("Recursive render XXX",e.nodes());if(e.edges().length>0)l.info("Recursive edges",e.edge(e.edges()[0]));let h=Bs(n);await Promise.all(e.nodes().map(async function(y){let g=e.node(y);if(i!==void 0){let _=JSON.parse(JSON.stringify(i.clusterData));if(l.trace(`Setting data for parent cluster XXX
1
+ import{t,l,m,K,_a,Nh,la,Fo,Ta,gl,Po}from"./index-gwgh27h3.js";import{Jt,Rn,fr,un,ea,Io,we,Rt,Nr,_o,Qr,lc,Hp,qp,Wp,Ki,wa,Kp,Vi,Ln,Yi,no,Ca,Ji,So,Zi,Vp,Yp,cc,Zt,Jp,Xi,To,es,uc,dc,Do,Zp,pc,Xp,hd,ta,mc,em,tm,nm,nr,fc,gc,ts,rm,Ac,v,gr,na,Xt,No,et}from"./index-hxy1sadd.js";import{zp,Up,ve,cl,vh,Gp,gi}from"./index-85jfn1fz.js";import{Sn}from"./index-v88m5sva.js";var ur={};Sn(ur,{default:()=>Z});var xn=/\s/;function On(r){var e=r.length;while(e--&&xn.test(r.charAt(e)));return e}var Wr=On;var In=/^\s+/;function Nn(r){return r?r.slice(0,Wr(r)+1).replace(In,""):r}var qr=Nn;var Hr=NaN,Pn=/^[-+]0x[0-9a-f]+$/i,kn=/^0b[01]+$/i,Tn=/^0o[0-7]+$/i,Cn=parseInt;function An(r){if(typeof r=="number")return r;if(ea(r))return Hr;if(Rt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Rt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=qr(r);var n=kn.test(r);return n||Tn.test(r)?Cn(r.slice(2),n?2:8):Pn.test(r)?Hr:+r}var Kr=An;var Jr=1/0,Mn=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function jn(r){if(!r)return r===0?r:0;if(r=Kr(r),r===Jr||r===-Jr){var e=r<0?-1:1;return e*Mn}return r===r?r:0}var U=jn;function Bn(r){var e=U(r),n=e%1;return e===e?n?e-n:e:0}var Zr=Bn;var $r=Object.create,Dn=function(){function r(){}return function(e){if(!Rt(e))return{};if($r)return $r(e);r.prototype=e;var n=new r;return r.prototype=void 0,n}}(),re=Dn;function Fn(r,e){var n=-1,o=r.length;e||(e=Array(o));while(++n<o)e[n]=r[n];return e}var ar=Fn;function Gn(r,e,n){if(e=="__proto__"&&lc)lc(r,e,{configurable:!0,enumerable:!0,value:n,writable:!0});else r[e]=n}var R=Gn;var Xn=Object.prototype,Un=Xn.hasOwnProperty;function Vn(r,e,n){var o=r[e];if(!(Un.call(r,e)&&wa(o,n))||n===void 0&&!(e in r))R(r,e,n)}var M=Vn;function Yn(r,e,n,o){var i=!n;n||(n={});var a=-1,f=e.length;while(++a<f){var s=e[a],u=o?o(n[s],r[s],s,n,r):void 0;if(u===void 0)u=r[s];if(i)R(n,s,u);else M(n,s,u)}return n}var P=Yn;function zn(r,e,n){if(!Rt(n))return!1;var o=typeof e;if(o=="number"?Ln(n)&&Ki(e,n.length):o=="string"&&(e in n))return wa(n[e],r);return!1}var T=zn;function Wn(r){return Vi(function(e,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;if(a=r.length>3&&typeof a=="function"?(i--,a):void 0,f&&T(n[0],n[1],f))a=i<3?void 0:a,i=1;e=Object(e);while(++o<i){var s=n[o];if(s)r(e,s,o,a)}return e})}var ee=Wn;function qn(r){var e=[];if(r!=null)for(var n in Object(r))e.push(n);return e}var te=qn;var Hn=Object.prototype,Kn=Hn.hasOwnProperty;function Jn(r){if(!Rt(r))return te(r);var e=Yi(r),n=[];for(var o in r)if(!(o=="constructor"&&(e||!Kn.call(r,o))))n.push(o);return n}var ne=Jn;function Zn(r){return Ln(r)?Vp(r,!0):ne(r)}var L=Zn;function $n(r){var e=r==null?0:r.length;return e?dc(r,1):[]}var S=$n;function Qn(r){return Hp(Kp(r,void 0,S),r+"")}var oe=Qn;var ro=Yp(Object.getPrototypeOf,Object),V=ro;var eo="[object Object]",to=Function.prototype,oo=Object.prototype,ie=to.toString,io=oo.hasOwnProperty,ao=ie.call(Object);function fo(r){if(!un(r)||fr(r)!=eo)return!1;var e=V(r);if(e===null)return!0;var n=io.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&ie.call(n)==ao}var ae=fo;var so="\\ud800-\\udfff",uo="\\u0300-\\u036f",co="\\ufe20-\\ufe2f",po="\\u20d0-\\u20ff",lo=uo+co+po,mo="\\ufe0e\\ufe0f",ho="\\u200d",go=RegExp("["+ho+so+lo+mo+"]");function vo(r){return go.test(r)}var fe=vo;function bo(r,e){return r&&P(e,Zt(e),r)}var se=bo;function yo(r,e){return r&&P(e,L(e),r)}var ue=yo;var le=typeof ur=="object"&&ur&&!ur.nodeType&&ur,de=le&&typeof sr=="object"&&sr&&!sr.nodeType&&sr,wo=de&&de.exports===le,ce=wo?Jt.Buffer:void 0,pe=ce?ce.allocUnsafe:void 0;function Eo(r,e){if(e)return r.slice();var n=r.length,o=pe?pe(n):new r.constructor(n);return r.copy(o),o}var Z=Eo;function xo(r,e){return P(r,pc(r),e)}var me=xo;var Oo=Object.getOwnPropertySymbols,Lo=!Oo?Zp:function(r){var e=[];while(r)uc(e,pc(r)),r=V(r);return e},dr=Lo;function ko(r,e){return P(r,dr(r),e)}var he=ko;function Co(r){return Xp(r,L,dr)}var ge=Co;var Ao=Object.prototype,Ro=Ao.hasOwnProperty;function Mo(r){var e=r.length,n=new r.constructor(e);if(e&&typeof r[0]=="string"&&Ro.call(r,"index"))n.index=r.index,n.input=r.input;return n}var be=Mo;function jo(r){var e=new r.constructor(r.byteLength);return new mc(e).set(new mc(r)),e}var Y=jo;function Bo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.byteLength)}var ye=Bo;var Go=/\w*$/;function Xo(r){var e=new r.constructor(r.source,Go.exec(r));return e.lastIndex=r.lastIndex,e}var _e=Xo;var Ee=Rn?Rn.prototype:void 0,xe=Ee?Ee.valueOf:void 0;function Uo(r){return xe?Object(xe.call(r)):{}}var Oe=Uo;function Vo(r,e){var n=e?Y(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.length)}var cr=Vo;var Yo="[object Boolean]",zo="[object Date]",Wo="[object Map]",qo="[object Number]",Ho="[object RegExp]",Ko="[object Set]",Jo="[object String]",Zo="[object Symbol]",$o="[object ArrayBuffer]",Qo="[object DataView]",ri="[object Float32Array]",ei="[object Float64Array]",ti="[object Int8Array]",ni="[object Int16Array]",oi="[object Int32Array]",ii="[object Uint8Array]",ai="[object Uint8ClampedArray]",fi="[object Uint16Array]",si="[object Uint32Array]";function ui(r,e,n){var o=r.constructor;switch(e){case $o:return Y(r);case Yo:case zo:return new o(+r);case Qo:return ye(r,n);case ri:case ei:case ti:case ni:case oi:case ii:case ai:case fi:case si:return cr(r,n);case Wo:return new o;case qo:case Jo:return new o(r);case Ho:return _e(r);case Ko:return new o;case Zo:return Oe(r)}}var Le=ui;function di(r){return typeof r.constructor=="function"&&!Yi(r)?re(V(r)):{}}var pr=di;var ci="[object Map]";function pi(r){return un(r)&&ta(r)==ci}var Ie=pi;var Se=So&&So.isMap,li=Se?Ji(Se):Ie,Ne=li;var mi="[object Set]";function hi(r){return un(r)&&ta(r)==mi}var Pe=hi;var ke=So&&So.isSet,vi=ke?Ji(ke):Pe,Te=vi;var bi=1,yi=2,wi=4,Ce="[object Arguments]",_i="[object Array]",Ei="[object Boolean]",xi="[object Date]",Oi="[object Error]",Ae="[object Function]",Li="[object GeneratorFunction]",Ii="[object Map]",Si="[object Number]",Re="[object Object]",Ni="[object RegExp]",Pi="[object Set]",ki="[object String]",Ti="[object Symbol]",Ci="[object WeakMap]",Ai="[object ArrayBuffer]",Ri="[object DataView]",Mi="[object Float32Array]",ji="[object Float64Array]",Bi="[object Int8Array]",Di="[object Int16Array]",Fi="[object Int32Array]",Gi="[object Uint8Array]",Ui="[object Uint8ClampedArray]",zi="[object Uint16Array]",Wi="[object Uint32Array]",x={};x[Ce]=x[_i]=x[Ai]=x[Ri]=x[Ei]=x[xi]=x[Mi]=x[ji]=x[Bi]=x[Di]=x[Fi]=x[Ii]=x[Si]=x[Re]=x[Ni]=x[Pi]=x[ki]=x[Ti]=x[Gi]=x[Ui]=x[zi]=x[Wi]=!0;x[Oi]=x[Ae]=x[Ci]=!1;function lr(r,e,n,o,i,a){var f,s=e&bi,u=e&yi,d=e&wi;if(n)f=i?n(r,o,i,a):n(r);if(f!==void 0)return f;if(!Rt(r))return r;var c=we(r);if(c){if(f=be(r),!s)return ar(r,f)}else{var p=ta(r),h=p==Ae||p==Li;if(Ca(r))return Z(r,s);if(p==Re||p==Ce||h&&!i){if(f=u||h?{}:pr(r),!s)return u?he(r,ue(f,r)):me(r,se(f,r))}else{if(!x[p])return i?r:{};f=Le(r,p,s)}}a||(a=new Do);var b=a.get(r);if(b)return b;if(a.set(r,f),Te(r))r.forEach(function(g){f.add(lr(g,e,n,g,r,a))});else if(Ne(r))r.forEach(function(g,_){f.set(_,lr(g,e,n,_,r,a))});var w=d?u?ge:hd:u?L:Zt,y=c?void 0:w(r);return qp(y||r,function(g,_){if(y)_=g,g=r[_];M(f,_,lr(g,e,n,_,r,a))}),f}var Me=lr;var qi=1,Hi=4;function $i(r){return Me(r,qi|Hi)}var je=$i;var Qi=function(){return Jt.Date.now()},_r=Qi;var Be=Object.prototype,ra=Be.hasOwnProperty,oa=Vi(function(r,e){r=Object(r);var n=-1,o=e.length,i=o>2?e[2]:void 0;if(i&&T(e[0],e[1],i))o=1;while(++n<o){var a=e[n],f=L(a),s=-1,u=f.length;while(++s<u){var d=f[s],c=r[d];if(c===void 0||wa(c,Be[d])&&!ra.call(r,d))r[d]=a[d]}}return r}),De=oa;function ia(r,e,n){if(n!==void 0&&!wa(r[e],n)||n===void 0&&!(e in r))R(r,e,n)}var Q=ia;function aa(r,e){if(e==="constructor"&&typeof r[e]==="function")return;if(e=="__proto__")return;return r[e]}var rr=aa;function fa(r){return P(r,L(r))}var Fe=fa;function sa(r,e,n,o,i,a,f){var s=rr(r,n),u=rr(e,n),d=f.get(u);if(d){Q(r,n,d);return}var c=a?a(s,u,n+"",r,e,f):void 0,p=c===void 0;if(p){var h=we(u),b=!h&&Ca(u),w=!h&&!b&&Zi(u);if(c=u,h||b||w)if(we(s))c=s;else if(rm(s))c=ar(s);else if(b)p=!1,c=Z(u,!0);else if(w)p=!1,c=cr(u,!0);else c=[];else if(ae(u)||no(u)){if(c=s,no(s))c=Fe(s);else if(!Rt(s)||_o(s))c=pr(u)}else p=!1}if(p)f.set(u,c),i(c,u,o,a,f),f.delete(u);Q(r,n,c)}var Ge=sa;function Xe(r,e,n,o,i){if(r===e)return;fc(e,function(a,f){if(i||(i=new Do),Rt(a))Ge(r,e,f,n,Xe,o,i);else{var s=o?o(rr(r,f),a,f+"",r,e,i):void 0;if(s===void 0)s=a;Q(r,f,s)}},L)}var Ue=Xe;function ua(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var G=ua;function da(r){return function(e,n,o){var i=Object(e);if(!Ln(e)){var a=nr(n,3);e=Zt(e),n=function(s){return a(i[s],s,i)}}var f=r(e,n,o);return f>-1?i[a?e[f]:f]:void 0}}var Ve=da;var ca=Math.max;function pa(r,e,n){var o=r==null?0:r.length;if(!o)return-1;var i=n==null?0:Zr(n);if(i<0)i=ca(o+i,0);return Wp(r,nr(e,3),i)}var Ye=pa;var ma=Ve(Ye),er=ma;function ha(r,e){var n=-1,o=Ln(r)?Array(r.length):[];return ts(r,function(i,a,f){o[++n]=e(i,a,f)}),o}var mr=ha;function ga(r,e){var n=we(r)?Io:mr;return n(r,nr(e,3))}var E=ga;function va(r,e){return r==null?r:fc(r,Ac(e),L)}var ze=va;function ba(r,e){return r&&gc(r,Ac(e))}var We=ba;function ya(r,e){return r>e}var qe=ya;var Ea=Object.prototype,xa=Ea.hasOwnProperty;function Oa(r,e){return r!=null&&xa.call(r,e)}var He=Oa;function La(r,e){return r!=null&&em(r,e,He)}var hr=La;var Ia="[object String]";function Sa(r){return typeof r=="string"||!we(r)&&un(r)&&fr(r)==Ia}var Ke=Sa;function Na(r,e){return r<e}var vr=Na;function Pa(r,e){var n={};return e=nr(e,3),gc(r,function(o,i,a){R(n,i,e(o,i,a))}),n}var z=Pa;function ka(r,e,n){var o=-1,i=r.length;while(++o<i){var a=r[o],f=e(a);if(f!=null&&(s===void 0?f===f&&!ea(f):n(f,s)))var s=f,u=a}return u}var W=ka;function Aa(r){return r&&r.length?W(r,Nr,qe):void 0}var I=Aa;var Ra=ee(function(r,e,n){Ue(r,e,n)}),tr=Ra;function Ma(r){return r&&r.length?W(r,Nr,vr):void 0}var j=Ma;function ja(r,e){return r&&r.length?W(r,nr(e,2),vr):void 0}var q=ja;function Ba(r,e,n,o){if(!Rt(r))return r;e=Xi(e,r);var i=-1,a=e.length,f=a-1,s=r;while(s!=null&&++i<a){var u=To(e[i]),d=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=f){var c=s[u];if(d=o?o(c,u,s):void 0,d===void 0)d=Rt(c)?c:Ki(e[i+1])?[]:{}}M(s,u,d),s=s[u]}return r}var Je=Ba;function Da(r,e,n){var o=-1,i=e.length,a={};while(++o<i){var f=e[o],s=es(r,f);if(n(s,f))Je(a,Xi(f,r),s)}return a}var Ze=Da;function Fa(r,e){var n=r.length;r.sort(e);while(n--)r[n]=r[n].value;return r}var $e=Fa;function Ga(r,e){if(r!==e){var n=r!==void 0,o=r===null,i=r===r,a=ea(r),f=e!==void 0,s=e===null,u=e===e,d=ea(e);if(!s&&!d&&!a&&r>e||a&&f&&u&&!s&&!d||o&&f&&u||!n&&u||!i)return 1;if(!o&&!a&&!d&&r<e||d&&n&&i&&!o&&!a||s&&n&&i||!f&&i||!u)return-1}return 0}var Qe=Ga;function Xa(r,e,n){var o=-1,i=r.criteria,a=e.criteria,f=i.length,s=n.length;while(++o<f){var u=Qe(i[o],a[o]);if(u){if(o>=s)return u;var d=n[o];return u*(d=="desc"?-1:1)}}return r.index-e.index}var rt=Xa;function Ua(r,e,n){if(e.length)e=Io(e,function(a){if(we(a))return function(f){return es(f,a.length===1?a[0]:a)};return a});else e=[Nr];var o=-1;e=Io(e,Ji(nr));var i=mr(r,function(a,f,s){var u=Io(e,function(d){return d(a)});return{criteria:u,index:++o,value:a}});return $e(i,function(a,f){return rt(a,f,n)})}var tt=Ua;var Va=nm("length"),nt=Va;var it="\\ud800-\\udfff",Ya="\\u0300-\\u036f",za="\\ufe20-\\ufe2f",Wa="\\u20d0-\\u20ff",qa=Ya+za+Wa,Ha="\\ufe0e\\ufe0f",Ka="["+it+"]",Er="["+qa+"]",xr="\\ud83c[\\udffb-\\udfff]",Ja="(?:"+Er+"|"+xr+")",at="[^"+it+"]",ft="(?:\\ud83c[\\udde6-\\uddff]){2}",st="[\\ud800-\\udbff][\\udc00-\\udfff]",Za="\\u200d",ut=Ja+"?",dt="["+Ha+"]?",$a="(?:"+Za+"(?:"+[at,ft,st].join("|")+")"+dt+ut+")*",Qa=dt+ut+$a,rf="(?:"+[at+Er+"?",Er,ft,st,Ka].join("|")+")",ot=RegExp(xr+"(?="+xr+")|"+rf+Qa,"g");function ef(r){var e=ot.lastIndex=0;while(ot.test(r))++e;return e}var ct=ef;function tf(r){return fe(r)?ct(r):nt(r)}var pt=tf;function nf(r,e){return Ze(r,e,function(n,o){return tm(r,o)})}var lt=nf;var of=oe(function(r,e){return r==null?{}:lt(r,e)}),H=of;var{ceil:af,max:ff}=Math;function sf(r,e,n,o){var i=-1,a=ff(af((e-r)/(n||1)),0),f=Array(a);while(a--)f[o?a:++i]=r,r+=n;return f}var mt=sf;function uf(r){return function(e,n,o){if(o&&typeof o!="number"&&T(e,n,o))n=o=void 0;if(e=U(e),n===void 0)n=e,e=0;else n=U(n);return o=o===void 0?e<n?1:-1:U(o),mt(e,n,o,r)}}var ht=uf;var df=ht(),N=df;var cf="[object Map]",pf="[object Set]";function lf(r){if(r==null)return 0;if(Ln(r))return Ke(r)?pt(r):r.length;var e=ta(r);if(e==cf||e==pf)return r.size;return cc(r).length}var gt=lf;var mf=Vi(function(r,e){if(r==null)return[];var n=e.length;if(n>1&&T(r,e[0],e[1]))e=[];else if(n>2&&T(e[0],e[1],e[2]))e=[e[0]];return tt(r,dc(e,1),[])}),C=mf;var hf=0;function gf(r){var e=++hf;return Jp(r)+e}var J=gf;function vf(r,e,n){var o=-1,i=r.length,a=e.length,f={};while(++o<i){var s=o<a?e[o]:void 0;n(f,r[o],s)}return f}var vt=vf;function bf(r,e){return vt(r||[],e||[],M)}var Or=bf;class Lr{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,e=r._prev;if(e!==r)return bt(e),e}enqueue(r){var e=this._sentinel;if(r._prev&&r._next)bt(r);r._next=e._next,e._next._prev=r,e._next=r,r._prev=e}toString(){var r=[],e=this._sentinel,n=e._prev;while(n!==e)r.push(JSON.stringify(n,yf)),n=n._prev;return"["+r.join(", ")+"]"}}function bt(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function yf(r,e){if(r!=="_next"&&r!=="_prev")return e}var wf=Qr(1);function yt(r,e){if(r.nodeCount()<=1)return[];var n=Ef(r,e||wf),o=_f(n.graph,n.buckets,n.zeroIdx);return S(E(o,function(i){return r.outEdges(i.v,i.w)}))}function _f(r,e,n){var o=[],i=e[e.length-1],a=e[0],f;while(r.nodeCount()){while(f=a.dequeue())Ir(r,e,n,f);while(f=i.dequeue())Ir(r,e,n,f);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(f=e[s].dequeue(),f){o=o.concat(Ir(r,e,n,f,!0));break}}}return o}function Ir(r,e,n,o,i){var a=i?[]:void 0;return v(r.inEdges(o.v),function(f){var s=r.edge(f),u=r.node(f.v);if(i)a.push({v:f.v,w:f.w});u.out-=s,Sr(e,n,u)}),v(r.outEdges(o.v),function(f){var s=r.edge(f),u=f.w,d=r.node(u);d.in-=s,Sr(e,n,d)}),r.removeNode(o.v),a}function Ef(r,e){var n=new et,o=0,i=0;v(r.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),v(r.edges(),function(s){var u=n.edge(s.v,s.w)||0,d=e(s),c=u+d;n.setEdge(s.v,s.w,c),i=Math.max(i,n.node(s.v).out+=d),o=Math.max(o,n.node(s.w).in+=d)});var a=N(i+o+3).map(function(){return new Lr}),f=o+1;return v(n.nodes(),function(s){Sr(a,f,n.node(s))}),{graph:n,buckets:a,zeroIdx:f}}function Sr(r,e,n){if(!n.out)r[0].enqueue(n);else if(!n.in)r[r.length-1].enqueue(n);else r[n.out-n.in+e].enqueue(n)}function wt(r){var e=r.graph().acyclicer==="greedy"?yt(r,n(r)):xf(r);v(e,function(o){var i=r.edge(o);r.removeEdge(o),i.forwardName=o.name,i.reversed=!0,r.setEdge(o.w,o.v,i,J("rev"))});function n(o){return function(i){return o.edge(i).weight}}}function xf(r){var e=[],n={},o={};function i(a){if(Object.prototype.hasOwnProperty.call(o,a))return;o[a]=!0,n[a]=!0,v(r.outEdges(a),function(f){if(Object.prototype.hasOwnProperty.call(n,f.w))e.push(f);else i(f.w)}),delete n[a]}return v(r.nodes(),i),e}function _t(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var o=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,o)}})}function k(r,e,n,o){var i;do i=J(o);while(r.hasNode(i));return n.dummy=e,r.setNode(i,n),i}function xt(r){var e=new et().setGraph(r.graph());return v(r.nodes(),function(n){e.setNode(n,r.node(n))}),v(r.edges(),function(n){var o=e.edge(n.v,n.w)||{weight:0,minlen:1},i=r.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+i.weight,minlen:Math.max(o.minlen,i.minlen)})}),e}function br(r){var e=new et({multigraph:r.isMultigraph()}).setGraph(r.graph());return v(r.nodes(),function(n){if(!r.children(n).length)e.setNode(n,r.node(n))}),v(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}function Pr(r,e){var{x:n,y:o}=r,i=e.x-n,a=e.y-o,f=r.width/2,s=r.height/2;if(!i&&!a)throw Error("Not possible to find intersection inside of the rectangle");var u,d;if(Math.abs(a)*f>Math.abs(i)*s){if(a<0)s=-s;u=s*i/a,d=s}else{if(i<0)f=-f;u=f,d=f*a/i}return{x:n+u,y:o+d}}function B(r){var e=E(N(Tr(r)+1),function(){return[]});return v(r.nodes(),function(n){var o=r.node(n),i=o.rank;if(!Xt(i))e[i][o.order]=n}),e}function Ot(r){var e=j(E(r.nodes(),function(n){return r.node(n).rank}));v(r.nodes(),function(n){var o=r.node(n);if(hr(o,"rank"))o.rank-=e})}function Lt(r){var e=j(E(r.nodes(),function(a){return r.node(a).rank})),n=[];v(r.nodes(),function(a){var f=r.node(a).rank-e;if(!n[f])n[f]=[];n[f].push(a)});var o=0,i=r.graph().nodeRankFactor;v(n,function(a,f){if(Xt(a)&&f%i!==0)--o;else if(o)v(a,function(s){r.node(s).rank+=o})})}function kr(r,e,n,o){var i={width:0,height:0};if(arguments.length>=4)i.rank=n,i.order=o;return k(r,"border",i,e)}function Tr(r){return I(E(r.nodes(),function(e){var n=r.node(e).rank;if(!Xt(n))return n}))}function It(r,e){var n={lhs:[],rhs:[]};return v(r,function(o){if(e(o))n.lhs.push(o);else n.rhs.push(o)}),n}function St(r,e){var n=_r();try{return e()}finally{console.log(r+" time: "+(_r()-n)+"ms")}}function Nt(r,e){return e()}function kt(r){function e(n){var o=r.children(n),i=r.node(n);if(o.length)v(o,e);if(Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,f=i.maxRank+1;a<f;++a)Pt(r,"borderLeft","_bl",n,i,a),Pt(r,"borderRight","_br",n,i,a)}}v(r.children(),e)}function Pt(r,e,n,o,i,a){var f={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=k(r,"border",f,n);if(i[e][a]=u,r.setParent(u,o),s)r.setEdge(s,u,{weight:1})}function Ct(r){var e=r.graph().rankdir.toLowerCase();if(e==="lr"||e==="rl")Mt(r)}function At(r){var e=r.graph().rankdir.toLowerCase();if(e==="bt"||e==="rl")Of(r);if(e==="lr"||e==="rl")Lf(r),Mt(r)}function Mt(r){v(r.nodes(),function(e){Tt(r.node(e))}),v(r.edges(),function(e){Tt(r.edge(e))})}function Tt(r){var e=r.width;r.width=r.height,r.height=e}function Of(r){v(r.nodes(),function(e){Cr(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Cr),Object.prototype.hasOwnProperty.call(n,"y"))Cr(n)})}function Cr(r){r.y=-r.y}function Lf(r){v(r.nodes(),function(e){Ar(r.node(e))}),v(r.edges(),function(e){var n=r.edge(e);if(v(n.points,Ar),Object.prototype.hasOwnProperty.call(n,"x"))Ar(n)})}function Ar(r){var e=r.x;r.x=r.y,r.y=e}function jt(r){r.graph().dummyChains=[],v(r.edges(),function(e){Sf(r,e)})}function Sf(r,e){var n=e.v,o=r.node(n).rank,i=e.w,a=r.node(i).rank,f=e.name,s=r.edge(e),u=s.labelRank;if(a===o+1)return;r.removeEdge(e);var d=void 0,c,p;for(p=0,++o;o<a;++p,++o){if(s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:o},c=k(r,"edge",d,"_d"),o===u)d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos;if(r.setEdge(n,c,{weight:s.weight},f),p===0)r.graph().dummyChains.push(c);n=c}r.setEdge(n,i,{weight:s.weight},f)}function Bt(r){v(r.graph().dummyChains,function(e){var n=r.node(e),o=n.edgeLabel,i;r.setEdge(n.edgeObj,o);while(n.dummy){if(i=r.successors(e)[0],r.removeNode(e),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label")o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height;e=i,n=r.node(e)}})}function or(r){var e={};function n(o){var i=r.node(o);if(Object.prototype.hasOwnProperty.call(e,o))return i.rank;e[o]=!0;var a=j(E(r.outEdges(o),function(f){return n(f.w)-r.edge(f).minlen}));if(a===Number.POSITIVE_INFINITY||a===void 0||a===null)a=0;return i.rank=a}v(r.sources(),n)}function X(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen}function yr(r){var e=new et({directed:!1}),n=r.nodes()[0],o=r.nodeCount();e.setNode(n,{});var i,a;while(Nf(e,r)<o)i=Pf(e,r),a=e.hasNode(i.v)?X(r,i):-X(r,i),kf(e,r,a);return e}function Nf(r,e){function n(o){v(e.nodeEdges(o),function(i){var a=i.v,f=o===a?i.w:a;if(!r.hasNode(f)&&!X(e,i))r.setNode(f,{}),r.setEdge(o,f,{}),n(f)})}return v(r.nodes(),n),r.nodeCount()}function Pf(r,e){return q(e.edges(),function(n){if(r.hasNode(n.v)!==r.hasNode(n.w))return X(e,n)})}function kf(r,e,n){v(r.nodes(),function(o){e.node(o).rank+=n})}var fh=Qr(1);var mh=Qr(1);Rr.CycleException=ir;function Rr(r){var e={},n={},o=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new ir;if(!Object.prototype.hasOwnProperty.call(e,a))n[a]=!0,e[a]=!0,v(r.predecessors(a),i),delete n[a],o.push(a)}if(v(r.sinks(),i),gt(e)!==r.nodeCount())throw new ir;return o}function ir(){}ir.prototype=Error();function wr(r,e,n){if(!we(e))e=[e];var o=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return v(e,function(f){if(!r.hasNode(f))throw Error("Graph does not have node: "+f);Ft(r,f,n==="post",a,o,i)}),i}function Ft(r,e,n,o,i,a){if(!Object.prototype.hasOwnProperty.call(o,e)){if(o[e]=!0,!n)a.push(e);if(v(i(e),function(f){Ft(r,f,n,o,i,a)}),n)a.push(e)}}function Mr(r,e){return wr(r,e,"post")}function jr(r,e){return wr(r,e,"pre")}F.initLowLimValues=Dr;F.initCutValues=Br;F.calcCutValue=Ut;F.leaveEdge=Yt;F.enterEdge=zt;F.exchangeEdges=Wt;function F(r){r=xt(r),or(r);var e=yr(r);Dr(e),Br(e,r);var n,o;while(n=Yt(e))o=zt(e,r,n),Wt(e,r,n,o)}function Br(r,e){var n=Mr(r,r.nodes());n=n.slice(0,n.length-1),v(n,function(o){Mf(r,e,o)})}function Mf(r,e,n){var o=r.node(n),i=o.parent;r.edge(n,i).cutvalue=Ut(r,e,n)}function Ut(r,e,n){var o=r.node(n),i=o.parent,a=!0,f=e.edge(n,i),s=0;if(!f)a=!1,f=e.edge(i,n);return s=f.weight,v(e.nodeEdges(n),function(u){var d=u.v===n,c=d?u.w:u.v;if(c!==i){var p=d===a,h=e.edge(u).weight;if(s+=p?h:-h,Bf(r,n,c)){var b=r.edge(n,c).cutvalue;s+=p?-b:b}}}),s}function Dr(r,e){if(arguments.length<2)e=r.nodes()[0];Vt(r,{},1,e)}function Vt(r,e,n,o,i){var a=n,f=r.node(o);if(e[o]=!0,v(r.neighbors(o),function(s){if(!Object.prototype.hasOwnProperty.call(e,s))n=Vt(r,e,n,s,o)}),f.low=a,f.lim=n++,i)f.parent=i;else delete f.parent;return n}function Yt(r){return er(r.edges(),function(e){return r.edge(e).cutvalue<0})}function zt(r,e,n){var{v:o,w:i}=n;if(!e.hasEdge(o,i))o=n.w,i=n.v;var a=r.node(o),f=r.node(i),s=a,u=!1;if(a.lim>f.lim)s=f,u=!0;var d=gr(e.edges(),function(c){return u===Gt(r,r.node(c.v),s)&&u!==Gt(r,r.node(c.w),s)});return q(d,function(c){return X(e,c)})}function Wt(r,e,n,o){var{v:i,w:a}=n;r.removeEdge(i,a),r.setEdge(o.v,o.w,{}),Dr(r),Br(r,e),jf(r,e)}function jf(r,e){var n=er(r.nodes(),function(i){return!e.node(i).parent}),o=jr(r,n);o=o.slice(1),v(o,function(i){var a=r.node(i).parent,f=e.edge(i,a),s=!1;if(!f)f=e.edge(a,i),s=!0;e.node(i).rank=e.node(a).rank+(s?f.minlen:-f.minlen)})}function Bf(r,e,n){return r.hasEdge(e,n)}function Gt(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}function Fr(r){switch(r.graph().ranker){case"network-simplex":qt(r);break;case"tight-tree":Ff(r);break;case"longest-path":Df(r);break;default:qt(r)}}var Df=or;function Ff(r){or(r),yr(r)}function qt(r){F(r)}function Ht(r){var e=k(r,"root",{},"_root"),n=Gf(r),o=I(na(n))-1,i=2*o+1;r.graph().nestingRoot=e,v(r.edges(),function(f){r.edge(f).minlen*=i});var a=Xf(r)+1;v(r.children(),function(f){Kt(r,e,i,a,o,n,f)}),r.graph().nodeRankFactor=i}function Kt(r,e,n,o,i,a,f){var s=r.children(f);if(!s.length){if(f!==e)r.setEdge(e,f,{weight:0,minlen:n});return}var u=kr(r,"_bt"),d=kr(r,"_bb"),c=r.node(f);if(r.setParent(u,f),c.borderTop=u,r.setParent(d,f),c.borderBottom=d,v(s,function(p){Kt(r,e,n,o,i,a,p);var h=r.node(p),b=h.borderTop?h.borderTop:p,w=h.borderBottom?h.borderBottom:p,y=h.borderTop?o:2*o,g=b!==w?1:i-a[f]+1;r.setEdge(u,b,{weight:y,minlen:g,nestingEdge:!0}),r.setEdge(w,d,{weight:y,minlen:g,nestingEdge:!0})}),!r.parent(f))r.setEdge(e,u,{weight:0,minlen:i+a[f]})}function Gf(r){var e={};function n(o,i){var a=r.children(o);if(a&&a.length)v(a,function(f){n(f,i+1)});e[o]=i}return v(r.children(),function(o){n(o,1)}),e}function Xf(r){return No(r.edges(),function(e,n){return e+r.edge(n).weight},0)}function $t(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,v(r.edges(),function(n){var o=r.edge(n);if(o.nestingEdge)r.removeEdge(n)})}function Qt(r,e,n){var o={},i;v(n,function(a){var f=r.parent(a),s,u;while(f){if(s=r.parent(f),s)u=o[s],o[s]=f;else u=i,i=f;if(u&&u!==f){e.setEdge(u,f);return}f=s}})}function rn(r,e,n){var o=Vf(r),i=new et({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(a){return r.node(a)});return v(r.nodes(),function(a){var f=r.node(a),s=r.parent(a);if(f.rank===e||f.minRank<=e&&e<=f.maxRank){if(i.setNode(a),i.setParent(a,s||o),v(r[n](a),function(u){var d=u.v===a?u.w:u.v,c=i.edge(d,a),p=!Xt(c)?c.weight:0;i.setEdge(d,a,{weight:r.edge(u).weight+p})}),Object.prototype.hasOwnProperty.call(f,"minRank"))i.setNode(a,{borderLeft:f.borderLeft[e],borderRight:f.borderRight[e]})}}),i}function Vf(r){var e;while(r.hasNode(e=J("_root")));return e}function en(r,e){var n=0;for(var o=1;o<e.length;++o)n+=Yf(r,e[o-1],e[o]);return n}function Yf(r,e,n){var o=Or(n,E(n,function(d,c){return c})),i=S(E(e,function(d){return C(E(r.outEdges(d),function(c){return{pos:o[c.w],weight:r.edge(c).weight}}),"pos")})),a=1;while(a<n.length)a<<=1;var f=2*a-1;a-=1;var s=E(Array(f),function(){return 0}),u=0;return v(i.forEach(function(d){var c=d.pos+a;s[c]+=d.weight;var p=0;while(c>0){if(c%2)p+=s[c+1];c=c-1>>1,s[c]+=d.weight}u+=d.weight*p})),u}function tn(r){var e={},n=gr(r.nodes(),function(s){return!r.children(s).length}),o=I(E(n,function(s){return r.node(s).rank})),i=E(N(o+1),function(){return[]});function a(s){if(hr(e,s))return;e[s]=!0;var u=r.node(s);i[u.rank].push(s),v(r.successors(s),a)}var f=C(n,function(s){return r.node(s).rank});return v(f,a),i}function nn(r,e){return E(e,function(n){var o=r.inEdges(n);if(!o.length)return{v:n};else{var i=No(o,function(a,f){var s=r.edge(f),u=r.node(f.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function on(r,e){var n={};v(r,function(i,a){var f=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};if(!Xt(i.barycenter))f.barycenter=i.barycenter,f.weight=i.weight}),v(e.edges(),function(i){var a=n[i.v],f=n[i.w];if(!Xt(a)&&!Xt(f))f.indegree++,a.out.push(n[i.w])});var o=gr(n,function(i){return!i.indegree});return zf(o)}function zf(r){var e=[];function n(a){return function(f){if(f.merged)return;if(Xt(f.barycenter)||Xt(a.barycenter)||f.barycenter>=a.barycenter)Wf(a,f)}}function o(a){return function(f){if(f.in.push(a),--f.indegree===0)r.push(f)}}while(r.length){var i=r.pop();e.push(i),v(i.in.reverse(),n(i)),v(i.out,o(i))}return E(gr(e,function(a){return!a.merged}),function(a){return H(a,["vs","i","barycenter","weight"])})}function Wf(r,e){var n=0,o=0;if(r.weight)n+=r.barycenter*r.weight,o+=r.weight;if(e.weight)n+=e.barycenter*e.weight,o+=e.weight;r.vs=e.vs.concat(r.vs),r.barycenter=n/o,r.weight=o,r.i=Math.min(e.i,r.i),e.merged=!0}function fn(r,e){var n=It(r,function(c){return Object.prototype.hasOwnProperty.call(c,"barycenter")}),o=n.lhs,i=C(n.rhs,function(c){return-c.i}),a=[],f=0,s=0,u=0;o.sort(qf(!!e)),u=an(a,i,u),v(o,function(c){u+=c.vs.length,a.push(c.vs),f+=c.barycenter*c.weight,s+=c.weight,u=an(a,i,u)});var d={vs:S(a)};if(s)d.barycenter=f/s,d.weight=s;return d}function an(r,e,n){var o;while(e.length&&(o=G(e)).i<=n)e.pop(),r.push(o.vs),n++;return n}function qf(r){return function(e,n){if(e.barycenter<n.barycenter)return-1;else if(e.barycenter>n.barycenter)return 1;return!r?e.i-n.i:n.i-e.i}}function Gr(r,e,n,o){var i=r.children(e),a=r.node(e),f=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,u={};if(f)i=gr(i,function(w){return w!==f&&w!==s});var d=nn(r,i);v(d,function(w){if(r.children(w.v).length){var y=Gr(r,w.v,n,o);if(u[w.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter"))Kf(w,y)}});var c=on(d,n);Hf(c,u);var p=fn(c,o);if(f){if(p.vs=S([f,p.vs,s]),r.predecessors(f).length){var h=r.node(r.predecessors(f)[0]),b=r.node(r.predecessors(s)[0]);if(!Object.prototype.hasOwnProperty.call(p,"barycenter"))p.barycenter=0,p.weight=0;p.barycenter=(p.barycenter*p.weight+h.order+b.order)/(p.weight+2),p.weight+=2}}return p}function Hf(r,e){v(r,function(n){n.vs=S(n.vs.map(function(o){if(e[o])return e[o].vs;return o}))})}function Kf(r,e){if(!Xt(r.barycenter))r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight;else r.barycenter=e.barycenter,r.weight=e.weight}function cn(r){var e=Tr(r),n=sn(r,N(1,e+1),"inEdges"),o=sn(r,N(e-1,-1,-1),"outEdges"),i=tn(r);dn(r,i);var a=Number.POSITIVE_INFINITY,f;for(var s=0,u=0;u<4;++s,++u){Jf(s%2?n:o,s%4>=2),i=B(r);var d=en(r,i);if(d<a)u=0,f=je(i),a=d}dn(r,f)}function sn(r,e,n){return E(e,function(o){return rn(r,o,n)})}function Jf(r,e){var n=new et;v(r,function(o){var i=o.graph().root,a=Gr(o,i,n,e);v(a.vs,function(f,s){o.node(f).order=s}),Qt(o,n,a.vs)})}function dn(r,e){v(e,function(n){v(n,function(o,i){r.node(o).order=i})})}function pn(r){var e=$f(r);v(r.graph().dummyChains,function(n){var o=r.node(n),i=o.edgeObj,a=Zf(r,e,i.v,i.w),{path:f,lca:s}=a,u=0,d=f[u],c=!0;while(n!==i.w){if(o=r.node(n),c){while((d=f[u])!==s&&r.node(d).maxRank<o.rank)u++;if(d===s)c=!1}if(!c){while(u<f.length-1&&r.node(d=f[u+1]).minRank<=o.rank)u++;d=f[u]}r.setParent(n,d),n=r.successors(n)[0]}})}function Zf(r,e,n,o){var i=[],a=[],f=Math.min(e[n].low,e[o].low),s=Math.max(e[n].lim,e[o].lim),u,d;u=n;do u=r.parent(u),i.push(u);while(u&&(e[u].low>f||s>e[u].lim));d=u,u=o;while((u=r.parent(u))!==d)a.push(u);return{path:i.concat(a.reverse()),lca:d}}function $f(r){var e={},n=0;function o(i){var a=n;v(r.children(i),o),e[i]={low:a,lim:n++}}return v(r.children(),o),e}function Qf(r,e){var n={};function o(i,a){var f=0,s=0,u=i.length,d=G(a);return v(a,function(c,p){var h=ns(r,c),b=h?r.node(h).order:u;if(h||c===d)v(a.slice(s,p+1),function(w){v(r.predecessors(w),function(y){var g=r.node(y),_=g.order;if((_<f||b<_)&&!(g.dummy&&r.node(w).dummy))ln(n,y,w)})}),s=p+1,f=b}),a}return No(e,o),n}function rs(r,e){var n={};function o(a,f,s,u,d){var c;v(N(f,s),function(p){if(c=a[p],r.node(c).dummy)v(r.predecessors(c),function(h){var b=r.node(h);if(b.dummy&&(b.order<u||b.order>d))ln(n,h,c)})})}function i(a,f){var s=-1,u,d=0;return v(f,function(c,p){if(r.node(c).dummy==="border"){var h=r.predecessors(c);if(h.length)u=r.node(h[0]).order,o(f,d,p,s,u),d=p,s=u}o(f,d,f.length,u,a.length)}),f}return No(e,i),n}function ns(r,e){if(r.node(e).dummy)return er(r.predecessors(e),function(n){return r.node(n).dummy})}function ln(r,e,n){if(e>n){var o=e;e=n,n=o}if(!Object.prototype.hasOwnProperty.call(r,e))Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=r[e];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function os(r,e,n){if(e>n){var o=e;e=n,n=o}return!!r[e]&&Object.prototype.hasOwnProperty.call(r[e],n)}function is(r,e,n,o){var i={},a={},f={};return v(e,function(s){v(s,function(u,d){i[u]=u,a[u]=u,f[u]=d})}),v(e,function(s){var u=-1;v(s,function(d){var c=o(d);if(c.length){c=C(c,function(y){return f[y]});var p=(c.length-1)/2;for(var h=Math.floor(p),b=Math.ceil(p);h<=b;++h){var w=c[h];if(a[d]===d&&u<f[w]&&!os(n,d,w))a[w]=d,a[d]=i[d]=i[w],u=f[w]}}})}),{root:i,align:a}}function as(r,e,n,o,i){var a={},f=fs(r,e,n,i),s=i?"borderLeft":"borderRight";function u(p,h){var b=f.nodes(),w=b.pop(),y={};while(w){if(y[w])p(w);else y[w]=!0,b.push(w),b=b.concat(h(w));w=b.pop()}}function d(p){a[p]=f.inEdges(p).reduce(function(h,b){return Math.max(h,a[b.v]+f.edge(b))},0)}function c(p){var h=f.outEdges(p).reduce(function(w,y){return Math.min(w,a[y.w]-f.edge(y))},Number.POSITIVE_INFINITY),b=r.node(p);if(h!==Number.POSITIVE_INFINITY&&b.borderType!==s)a[p]=Math.max(a[p],h)}return u(d,f.predecessors.bind(f)),u(c,f.successors.bind(f)),v(o,function(p){a[p]=a[n[p]]}),a}function fs(r,e,n,o){var i=new et,a=r.graph(),f=cs(a.nodesep,a.edgesep,o);return v(e,function(s){var u;v(s,function(d){var c=n[d];if(i.setNode(c),u){var p=n[u],h=i.edge(p,c);i.setEdge(p,c,Math.max(f(r,d,u),h||0))}u=d})}),i}function ss(r,e){return q(na(e),function(n){var{NEGATIVE_INFINITY:o,POSITIVE_INFINITY:i}=Number;return ze(n,function(a,f){var s=ps(r,f)/2;o=Math.max(a+s,o),i=Math.min(a-s,i)}),o-i})}function us(r,e){var n=na(e),o=j(n),i=I(n);v(["u","d"],function(a){v(["l","r"],function(f){var s=a+f,u=r[s],d;if(u===e)return;var c=na(u);if(d=f==="l"?o-j(c):i-I(c),d)r[s]=z(u,function(p){return p+d})})})}function ds(r,e){return z(r.ul,function(n,o){if(e)return r[e.toLowerCase()][o];else{var i=C(E(r,o));return(i[1]+i[2])/2}})}function mn(r){var e=B(r),n=tr(Qf(r,e),rs(r,e)),o={},i;v(["u","d"],function(f){i=f==="u"?e:na(e).reverse(),v(["l","r"],function(s){if(s==="r")i=E(i,function(p){return na(p).reverse()});var u=(f==="u"?r.predecessors:r.successors).bind(r),d=is(r,i,n,u),c=as(r,i,d.root,d.align,s==="r");if(s==="r")c=z(c,function(p){return-p});o[f+s]=c})});var a=ss(r,o);return us(o,a),ds(o,r.graph().align)}function cs(r,e,n){return function(o,i,a){var f=o.node(i),s=o.node(a),u=0,d;if(u+=f.width/2,Object.prototype.hasOwnProperty.call(f,"labelpos"))switch(f.labelpos.toLowerCase()){case"l":d=-f.width/2;break;case"r":d=f.width/2;break}if(d)u+=n?d:-d;if(d=0,u+=(f.dummy?e:r)/2,u+=(s.dummy?e:r)/2,u+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":d=s.width/2;break;case"r":d=-s.width/2;break}if(d)u+=n?d:-d;return d=0,u}}function ps(r,e){return r.node(e).width}function hn(r){r=br(r),ls(r),We(mn(r),function(e,n){r.node(n).x=e})}function ls(r){var e=B(r),n=r.graph().ranksep,o=0;v(e,function(i){var a=I(E(i,function(f){return r.node(f).height}));v(i,function(f){r.node(f).y=o+a/2}),o+=a+n})}function Vr(r,e){var n=e&&e.debugTiming?St:Nt;n("layout",()=>{var o=n(" buildLayoutGraph",()=>Os(r));n(" runLayout",()=>ms(o,n)),n(" updateInputGraph",()=>hs(r,o))})}function ms(r,e){e(" makeSpaceForEdgeLabels",()=>Ls(r)),e(" removeSelfEdges",()=>Rs(r)),e(" acyclic",()=>wt(r)),e(" nestingGraph.run",()=>Ht(r)),e(" rank",()=>Fr(br(r))),e(" injectEdgeLabelProxies",()=>Is(r)),e(" removeEmptyRanks",()=>Lt(r)),e(" nestingGraph.cleanup",()=>$t(r)),e(" normalizeRanks",()=>Ot(r)),e(" assignRankMinMax",()=>Ss(r)),e(" removeEdgeLabelProxies",()=>Ns(r)),e(" normalize.run",()=>jt(r)),e(" parentDummyChains",()=>pn(r)),e(" addBorderSegments",()=>kt(r)),e(" order",()=>cn(r)),e(" insertSelfEdges",()=>Ms(r)),e(" adjustCoordinateSystem",()=>Ct(r)),e(" position",()=>hn(r)),e(" positionSelfEdges",()=>js(r)),e(" removeBorderNodes",()=>As(r)),e(" normalize.undo",()=>Bt(r)),e(" fixupEdgeLabelCoords",()=>Ts(r)),e(" undoCoordinateSystem",()=>At(r)),e(" translateGraph",()=>Ps(r)),e(" assignNodeIntersects",()=>ks(r)),e(" reversePoints",()=>Cs(r)),e(" acyclic.undo",()=>_t(r))}function hs(r,e){v(r.nodes(),function(n){var o=r.node(n),i=e.node(n);if(o){if(o.x=i.x,o.y=i.y,e.children(n).length)o.width=i.width,o.height=i.height}}),v(r.edges(),function(n){var o=r.edge(n),i=e.edge(n);if(o.points=i.points,Object.prototype.hasOwnProperty.call(i,"x"))o.x=i.x,o.y=i.y}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}var gs=["nodesep","edgesep","ranksep","marginx","marginy"],vs={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},bs=["acyclicer","ranker","rankdir","align"],ys=["width","height"],ws={width:0,height:0},_s=["minlen","weight","width","height","labeloffset"],Es={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xs=["labelpos"];function Os(r){var e=new et({multigraph:!0,compound:!0}),n=Ur(r.graph());return e.setGraph(tr({},vs,Xr(n,gs),H(n,bs))),v(r.nodes(),function(o){var i=Ur(r.node(o));e.setNode(o,De(Xr(i,ys),ws)),e.setParent(o,r.parent(o))}),v(r.edges(),function(o){var i=Ur(r.edge(o));e.setEdge(o,tr({},Es,Xr(i,_s),H(i,xs)))}),e}function Ls(r){var e=r.graph();e.ranksep/=2,v(r.edges(),function(n){var o=r.edge(n);if(o.minlen*=2,o.labelpos.toLowerCase()!=="c")if(e.rankdir==="TB"||e.rankdir==="BT")o.width+=o.labeloffset;else o.height+=o.labeloffset})}function Is(r){v(r.edges(),function(e){var n=r.edge(e);if(n.width&&n.height){var o=r.node(e.v),i=r.node(e.w),a={rank:(i.rank-o.rank)/2+o.rank,e};k(r,"edge-proxy",a,"_ep")}})}function Ss(r){var e=0;v(r.nodes(),function(n){var o=r.node(n);if(o.borderTop)o.minRank=r.node(o.borderTop).rank,o.maxRank=r.node(o.borderBottom).rank,e=I(e,o.maxRank)}),r.graph().maxRank=e}function Ns(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="edge-proxy")r.edge(n.e).labelRank=n.rank,r.removeNode(e)})}function Ps(r){var e=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,a=r.graph(),f=a.marginx||0,s=a.marginy||0;function u(d){var{x:c,y:p,width:h,height:b}=d;e=Math.min(e,c-h/2),n=Math.max(n,c+h/2),o=Math.min(o,p-b/2),i=Math.max(i,p+b/2)}v(r.nodes(),function(d){u(r.node(d))}),v(r.edges(),function(d){var c=r.edge(d);if(Object.prototype.hasOwnProperty.call(c,"x"))u(c)}),e-=f,o-=s,v(r.nodes(),function(d){var c=r.node(d);c.x-=e,c.y-=o}),v(r.edges(),function(d){var c=r.edge(d);if(v(c.points,function(p){p.x-=e,p.y-=o}),Object.prototype.hasOwnProperty.call(c,"x"))c.x-=e;if(Object.prototype.hasOwnProperty.call(c,"y"))c.y-=o}),a.width=n-e+f,a.height=i-o+s}function ks(r){v(r.edges(),function(e){var n=r.edge(e),o=r.node(e.v),i=r.node(e.w),a,f;if(!n.points)n.points=[],a=i,f=o;else a=n.points[0],f=n.points[n.points.length-1];n.points.unshift(Pr(o,a)),n.points.push(Pr(i,f))})}function Ts(r){v(r.edges(),function(e){var n=r.edge(e);if(Object.prototype.hasOwnProperty.call(n,"x")){if(n.labelpos==="l"||n.labelpos==="r")n.width-=n.labeloffset;switch(n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}}})}function Cs(r){v(r.edges(),function(e){var n=r.edge(e);if(n.reversed)n.points.reverse()})}function As(r){v(r.nodes(),function(e){if(r.children(e).length){var n=r.node(e),o=r.node(n.borderTop),i=r.node(n.borderBottom),a=r.node(G(n.borderLeft)),f=r.node(G(n.borderRight));n.width=Math.abs(f.x-a.x),n.height=Math.abs(i.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}}),v(r.nodes(),function(e){if(r.node(e).dummy==="border")r.removeNode(e)})}function Rs(r){v(r.edges(),function(e){if(e.v===e.w){var n=r.node(e.v);if(!n.selfEdges)n.selfEdges=[];n.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}function Ms(r){var e=B(r);v(e,function(n){var o=0;v(n,function(i,a){var f=r.node(i);f.order=a+o,v(f.selfEdges,function(s){k(r,"selfedge",{width:s.label.width,height:s.label.height,rank:f.rank,order:a+ ++o,e:s.e,label:s.label},"_se")}),delete f.selfEdges})})}function js(r){v(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="selfedge"){var o=r.node(n.e.v),i=o.x+o.width/2,a=o.y,f=n.x-i,s=o.height/2;r.setEdge(n.e,n.label),r.removeNode(e),n.label.points=[{x:i+2*f/3,y:a-s},{x:i+5*f/6,y:a-s},{x:i+f,y:a},{x:i+5*f/6,y:a+s},{x:i+2*f/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Xr(r,e){return z(H(r,e),Number)}function Ur(r){var e={};return v(r,function(n,o){e[o.toLowerCase()]=n}),e}var gn=t((r,e,n)=>Math.max(e,Math.min(n,r)),"clamp"),vn=t((r="TB")=>{switch(r){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),Bs=t((r)=>r==="flowchart"||r==="flowchart-v2"||r==="stateDiagram"||r==="er"||r==="classDiagram","shouldMergeSelfLoopSegments"),Ds=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Fs=t((r,e,n,o,i)=>{let a=[],f=new Set;if(n.forEach(({start:c,end:p})=>{if(c!==o)f.add(c);if(p!==o)f.add(p)}),f.forEach((c)=>{let p=r.node(c);if(typeof p?.x==="number"&&typeof p?.y==="number")a.push(p)}),a.length===0)n.forEach(({edge:c})=>{(c.points??[]).forEach((p)=>{if(typeof p?.x==="number"&&typeof p?.y==="number")a.push(p)})});if(a.length===0)return vn(i);let s=a.reduce((c,p)=>({x:c.x+p.x/a.length,y:c.y+p.y/a.length}),{x:0,y:0}),u=s.x-e.x,d=s.y-e.y;if(Math.abs(u)>Math.abs(d))return u>0?"right":"left";if(Math.abs(d)>0)return d>0?"bottom":"top";return vn(i)},"getSelfLoopSide"),Gs=t((r,e="top",n=0,o=0)=>{let i=r.x,a=r.y-n,f=r.width/2,s=r.height/2,u=Math.max(36,Math.min(100,r.width*0.8)),d=gn(Math.max(o,r.width*0.35),36,u),c=gn(Math.min(r.width,r.height)*0.45,24,48);switch(e){case"bottom":{let p=a+s;return[{x:i-d/2,y:p},{x:i-d/2,y:p+c},{x:i+d/2,y:p+c},{x:i+d/2,y:p}]}case"right":{let p=i+f;return[{x:p,y:a-d/2},{x:p+c,y:a-d/2},{x:p+c,y:a+d/2},{x:p,y:a+d/2}]}case"left":{let p=i-f;return[{x:p,y:a-d/2},{x:p-c,y:a-d/2},{x:p-c,y:a+d/2},{x:p,y:a+d/2}]}case"top":default:{let p=a-s;return[{x:i-d/2,y:p},{x:i-d/2,y:p-c},{x:i+d/2,y:p-c},{x:i+d/2,y:p}]}}},"getSelfLoopPoints"),Xs=t((r,e,n="top",o=0,i={})=>{let f=r.x,s=r.y-o,u=i.width??0,d=i.height??0;switch(n){case"bottom":return{x:f,y:Math.max(...e.map((c)=>c.y))+d/2+4};case"right":return{x:Math.max(...e.map((c)=>c.x))+u/2+4,y:s};case"left":return{x:Math.min(...e.map((c)=>c.x))-u/2-4,y:s};case"top":default:return{x:f,y:Math.min(...e.map((c)=>c.y))-d/2-4}}},"getSelfLoopLabelPosition"),yn=t((r,e=0,{mergeSelfLoops:n=!0}={})=>{let o=new Map,i=[],a=r.graph()?.rankdir;return r.edges().forEach((f)=>{let s=r.edge(f);if(n&&s.selfLoop){let u=s.selfLoop.id;if(!o.has(u))o.set(u,[]);o.get(u).push({edge:s,start:f.v,end:f.w})}else i.push({edge:s,start:f.v,end:f.w})}),o.forEach((f)=>{if(f.length!==3){f.forEach((_)=>i.push(_));return}f.sort((_,A)=>_.edge.selfLoop.order-A.edge.selfLoop.order);let[s,u,d]=f,c=s.edge.originalEdge??u.edge.originalEdge??d.edge.originalEdge??u.edge,p=r.node(c.start);if(!p){f.forEach((_)=>i.push(_));return}let h={width:u.edge.width,height:u.edge.height},b=Fs(r,p,f,c.start,a),w=Gs(p,b,e,h.width??0),y=Xs(p,w,b,e,h),g={...u.edge,...c,id:c.id,points:w,start:c.start,end:c.end,x:y.x,y:y.y,width:h.width,height:h.height,labelStyle:u.edge.labelStyle,fromCluster:s.edge.fromCluster??u.edge.fromCluster??d.edge.fromCluster,toCluster:s.edge.toCluster??u.edge.toCluster??d.edge.toCluster};delete g.selfLoop,delete g.originalEdge,i.push({edge:g,start:g.start,end:g.end})}),i},"getEdgesToRender"),wn=t(async({element:r,graph:e,diagramType:n,id:o,parentCluster:i,siteConfig:a})=>{let f=e.graph().rankdir;l.trace("Dir in recursive render - dir:",f);let{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:p}=zp(r,{edgePathsClass:"edgePaths"});if(!e.nodes())l.info("No nodes found for",e);else l.info("Recursive render XXX",e.nodes());if(e.edges().length>0)l.info("Recursive edges",e.edge(e.edges()[0]));let h=Bs(n);await Promise.all(e.nodes().map(async function(y){let g=e.node(y);if(i!==void 0){let _=JSON.parse(JSON.stringify(i.clusterData));if(l.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,y,`
3
3
  data=`,_.height,`
4
- Parent cluster`,i.height),e.setNode(i.id,_),!e.parent(y))l.trace("Setting parent",y,i.id),e.setParent(y,i.id,_)}if(l.info("(Insert) Node XXX"+y+": "+JSON.stringify(e.node(y))),g?.clusterNode){l.info("Cluster identified XBX",y,g.width,e.node(y));let{ranksep:_,nodesep:A}=e.graph();g.graph.setGraph({...g.graph.graph(),ranksep:_+25,nodesep:A});let Wr=await Ws({element:c,graph:g.graph,diagramType:n,id:o,parentCluster:e.node(y),siteConfig:a}),qr=Wr.elem;W(g,qr),g.diff=Wr.diff||0,l.info("New compound node after recursive render XAX",y,"width",g.width,"height",g.height),Ih(qr,g)}else if(e.children(y).length>0)l.trace("Cluster - the non recursive path XBX",y,g.id,g,g.width,"Graph:",e),l.trace(ul(g.id,e)),ve.set(g.id,{id:ul(g.id,e),node:g});else l.trace("Node - the non recursive path XAX",y,c,e.node(y),f),await Op(c,e.node(y),{config:a,dir:f})})),await t(async()=>{let y=e.edges().map(async function(g){let _=e.edge(g.v,g.w,g.name);if(l.info("Edge "+g.v+" -> "+g.w+": "+JSON.stringify(g)),l.info("Edge "+g.v+" -> "+g.w+": ",g," ",JSON.stringify(e.edge(g))),l.info("Fix",ve,"ids:",g.v,g.w,"Translating: ",ve.get(g.v),ve.get(g.w)),h&&_.selfLoop){if(_.selfLoop.order!==1)return;let A={..._.originalEdge,..._,id:_.selfLoop.id,startLabelLeft:_.originalEdge?.startLabelLeft??_.startLabelLeft,startLabelRight:_.originalEdge?.startLabelRight??_.startLabelRight,endLabelLeft:_.originalEdge?.endLabelLeft??_.endLabelLeft,endLabelRight:_.originalEdge?.endLabelRight??_.endLabelRight};await Ia(d,A),_.width=A.width,_.height=A.height,_.labelStyle=A.labelStyle;return}await Ia(d,_)});await Promise.all(y)},"processEdges")();let{subGraphTitleTotalMargin:w}=Ea(a);return{elem:p,graph:e,groups:{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:p},diagramType:n,id:o,mergeSelfLoops:h,subGraphTitleTotalMargin:w}},"measureDagreGraph"),On=t((r)=>{l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),zr(r)},"runDagreGraphLayout"),Us=t((r,e,n)=>{let o=r.node(e);if(!o)return;let i={...o};if(o?.clusterNode)i.y=(o.y??0)+n;else if(r.children(e).length>0)i.height=(o.height??0)+n;else i.y=(o.y??0)+n/2;return i},"normalizeDagreNode"),_n=t((r,e)=>{Ds.forEach((n)=>{if(e[n]!==void 0)r[n]=e[n]})},"applyDagreNodeLayout"),Vs=t((r,e,n,o)=>({...r,start:r.start??e,end:r.end??n,points:(r.points??[]).map((i)=>({...i,y:typeof i.y==="number"?i.y+o:i.y}))}),"normalizeDagreEdge"),Ys=t((r,e)=>{let{graph:n,mergeSelfLoops:o,subGraphTitleTotalMargin:i=0}=e,a=new Map(r.nodes.map((s)=>[s.id,s]));$p(n).forEach((s)=>{let u=Us(n,s,i);if(!u)return;_n(n.node(s),u);let d=a.get(s);if(d)_n(d,u)});let f=i/2;return r.edges=En(n,f,{mergeSelfLoops:o}).map(({edge:s,start:u,end:d})=>Vs(s,u,d,f)),r},"applyDagreLayoutResult"),zs=t(async({elem:r,graph:e,groups:{clusters:n,edgePaths:o},diagramType:i,id:a,mergeSelfLoops:f,subGraphTitleTotalMargin:s})=>{let u=0;await Promise.all($p(e).map(async function(p){let h=e.node(p);if(l.info("Position XBX => "+p+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,l.info("A tainted cluster node XBX1",p,h.id,h.width,h.height,h.x,h.y,e.parent(p)),ve.get(h.id).node=h,oa(h);else if(e.children(p).length>0){l.info("A pure cluster node XBX1",p,h.id,h.x,h.y,h.width,h.height,e.parent(p)),h.height+=s,e.node(h.parentId);let b=h?.padding/2||0,w=h?.labelBBox?.height||0,y=w-b||0;l.debug("OffsetY",y,"labelHeight",w,"halfPadding",b),await Ro(n,h),ve.get(h.id).node=h}else{let b=e.node(h.parentId);h.y+=s/2,l.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",b,b?.offsetY,h),oa(h)}}));let d=s/2;return En(e,d,{mergeSelfLoops:f}).forEach(function({edge:p,start:h,end:b}){l.info("Edge "+h+" -> "+b+": "+JSON.stringify(p),p),p.points.forEach((_)=>_.y+=d);let w=e.node(h),y=e.node(b),g=Lo(o,p,ve,i,w,y,a);Al(p,g)}),e.nodes().forEach(function(p){let h=e.node(p);if(l.info(p,h.type,h.diff),h.isGroup)u=h.diff}),l.warn("Returning from recursive render XAX",r,u),{elem:r,diff:u}},"paintDagreLayoutCore"),Ws=t(async(r)=>{let e=await xn(r);return On(e.graph),await zs(e)},"renderDagreSubgraph"),In=t((r)=>{let e=new et({multigraph:!0,compound:!0}).setGraph({rankdir:r.direction,nodesep:r.config?.nodeSpacing||r.nodeSpacing||r.config?.flowchart?.nodeSpacing,ranksep:r.config?.rankSpacing||r.rankSpacing||r.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return r.nodes.forEach((n)=>{if(e.setNode(n.id,{...n}),n.parentId)e.setParent(n.id,n.parentId)}),l.debug("Edges:",r.edges),r.edges.forEach((n)=>{if(n.start===n.end){let o=n.start,i=o+"---"+o+"---1",a=o+"---"+o+"---2",f=e.node(o);e.setNode(i,{domId:i,id:i,parentId:f.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(i,f.parentId),e.setNode(a,{domId:a,id:a,parentId:f.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(a,f.parentId);let s=structuredClone(n),u=structuredClone(n),d=structuredClone(n),c=structuredClone(n);if(u.originalEdge=s,u.selfLoop={id:s.id,order:0},d.originalEdge=s,d.selfLoop={id:s.id,order:1},c.originalEdge=s,c.selfLoop={id:s.id,order:2},u.label="",u.arrowTypeEnd="none",u.endLabelLeft="",u.endLabelRight="",u.startLabelLeft="",u.id=o+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=o+"-cyclic-special-mid",c.label="",c.startLabelRight="",c.startLabelLeft="",c.arrowTypeStart="none",f.isGroup)u.fromCluster=o,c.toCluster=o;c.id=o+"-cyclic-special-2",c.arrowTypeStart="none",e.setEdge(o,i,u,o+"-cyclic-special-0"),e.setEdge(i,a,d,o+"-cyclic-special-1"),e.setEdge(a,o,c,o+"-cyclic-special-2")}else e.setEdge(n.start,n.end,{...n},n.id)}),gh(e),{graph:e}},"prepareLayoutForDagre"),qs=t(async(r,{element:e,preparedLayout:n})=>{let o=n??In(r),i=m(),a=await xn({element:e,graph:o.graph,diagramType:r.type,id:r.diagramId,parentCluster:void 0,siteConfig:i});return o.measuredLayout=a,a},"measureDagreLayout"),Hs=t((r,e)=>{let n=e.preparedLayout?.measuredLayout;if(!n)throw Error("runDagreLayoutCore requires measureDagreLayout to run first");return On(n.graph),Ys(r,n),n},"runDagreLayoutCore"),Ks=t((r,{measure:e})=>$p(e.graph).map((n)=>e.graph.node(n)).filter(Boolean),"getDagrePaintNodes"),Js=t((r,e,{measure:n})=>r?n.graph.node(r):void 0,"getDagreEdgeNode"),Kg=di({prepareLayout:In,measureLayout:qs,runLayoutCore:Hs,paintOptions:{clusterDb:ve,getNodes:Ks,getEdgeNode:Js,skipNode:t((r,{measure:e})=>!e.graph.hasNode(r.id),"skipNode"),isCluster:t((r,{measure:e})=>e.graph.hasNode(r.id)&&(e.graph.children(r.id)??[]).length>0,"isCluster")}});export{Ys as applyDagreLayoutResult,En as getEdgesToRender,qs as measureDagreLayout,In as prepareLayoutForDagre,Kg as render,Hs as runDagreLayoutCore};
4
+ Parent cluster`,i.height),e.setNode(i.id,_),!e.parent(y))l.trace("Setting parent",y,i.id),e.setParent(y,i.id,_)}if(l.info("(Insert) Node XXX"+y+": "+JSON.stringify(e.node(y))),g?.clusterNode){l.info("Cluster identified XBX",y,g.width,e.node(y));let{ranksep:_,nodesep:A}=e.graph();g.graph.setGraph({...g.graph.graph(),ranksep:_+25,nodesep:A});let Yr=await Ws({element:c,graph:g.graph,diagramType:n,id:o,parentCluster:e.node(y),siteConfig:a}),zr=Yr.elem;K(g,zr),g.diff=Yr.diff||0,l.info("New compound node after recursive render XAX",y,"width",g.width,"height",g.height),Nh(zr,g)}else if(e.children(y).length>0)l.trace("Cluster - the non recursive path XBX",y,g.id,g,g.width,"Graph:",e),l.trace(cl(g.id,e)),ve.set(g.id,{id:cl(g.id,e),node:g});else l.trace("Node - the non recursive path XAX",y,c,e.node(y),f),await Up(c,e.node(y),{config:a,dir:f})})),await t(async()=>{let y=e.edges().map(async function(g){let _=e.edge(g.v,g.w,g.name);if(l.info("Edge "+g.v+" -> "+g.w+": "+JSON.stringify(g)),l.info("Edge "+g.v+" -> "+g.w+": ",g," ",JSON.stringify(e.edge(g))),l.info("Fix",ve,"ids:",g.v,g.w,"Translating: ",ve.get(g.v),ve.get(g.w)),h&&_.selfLoop){if(_.selfLoop.order!==1)return;let A={..._.originalEdge,..._,id:_.selfLoop.id,startLabelLeft:_.originalEdge?.startLabelLeft??_.startLabelLeft,startLabelRight:_.originalEdge?.startLabelRight??_.startLabelRight,endLabelLeft:_.originalEdge?.endLabelLeft??_.endLabelLeft,endLabelRight:_.originalEdge?.endLabelRight??_.endLabelRight};await Ta(d,A),_.width=A.width,_.height=A.height,_.labelStyle=A.labelStyle;return}await Ta(d,_)});await Promise.all(y)},"processEdges")();let{subGraphTitleTotalMargin:w}=_a(a);return{elem:p,graph:e,groups:{clusters:s,edgePaths:u,edgeLabels:d,nodes:c,rootGroups:p},diagramType:n,id:o,mergeSelfLoops:h,subGraphTitleTotalMargin:w}},"measureDagreGraph"),_n=t((r)=>{l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),Vr(r)},"runDagreGraphLayout"),Us=t((r,e,n)=>{let o=r.node(e);if(!o)return;let i={...o};if(o?.clusterNode)i.y=(o.y??0)+n;else if(r.children(e).length>0)i.height=(o.height??0)+n;else i.y=(o.y??0)+n/2;return i},"normalizeDagreNode"),bn=t((r,e)=>{Ds.forEach((n)=>{if(e[n]!==void 0)r[n]=e[n]})},"applyDagreNodeLayout"),Vs=t((r,e,n,o)=>({...r,start:r.start??e,end:r.end??n,points:(r.points??[]).map((i)=>({...i,y:typeof i.y==="number"?i.y+o:i.y}))}),"normalizeDagreEdge"),Ys=t((r,e)=>{let{graph:n,mergeSelfLoops:o,subGraphTitleTotalMargin:i=0}=e,a=new Map(r.nodes.map((s)=>[s.id,s]));Gp(n).forEach((s)=>{let u=Us(n,s,i);if(!u)return;bn(n.node(s),u);let d=a.get(s);if(d)bn(d,u)});let f=i/2;return r.edges=yn(n,f,{mergeSelfLoops:o}).map(({edge:s,start:u,end:d})=>Vs(s,u,d,f)),r},"applyDagreLayoutResult"),zs=t(async({elem:r,graph:e,groups:{clusters:n,edgePaths:o},diagramType:i,id:a,mergeSelfLoops:f,subGraphTitleTotalMargin:s})=>{let u=0;await Promise.all(Gp(e).map(async function(p){let h=e.node(p);if(l.info("Position XBX => "+p+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,l.info("A tainted cluster node XBX1",p,h.id,h.width,h.height,h.x,h.y,e.parent(p)),ve.get(h.id).node=h,la(h);else if(e.children(p).length>0){l.info("A pure cluster node XBX1",p,h.id,h.x,h.y,h.width,h.height,e.parent(p)),h.height+=s,e.node(h.parentId);let b=h?.padding/2||0,w=h?.labelBBox?.height||0,y=w-b||0;l.debug("OffsetY",y,"labelHeight",w,"halfPadding",b),await Fo(n,h),ve.get(h.id).node=h}else{let b=e.node(h.parentId);h.y+=s/2,l.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",b,b?.offsetY,h),la(h)}}));let d=s/2;return yn(e,d,{mergeSelfLoops:f}).forEach(function({edge:p,start:h,end:b}){l.info("Edge "+h+" -> "+b+": "+JSON.stringify(p),p),p.points.forEach((_)=>_.y+=d);let w=e.node(h),y=e.node(b),g=Po(o,p,ve,i,w,y,a);gl(p,g)}),e.nodes().forEach(function(p){let h=e.node(p);if(l.info(p,h.type,h.diff),h.isGroup)u=h.diff}),l.warn("Returning from recursive render XAX",r,u),{elem:r,diff:u}},"paintDagreLayoutCore"),Ws=t(async(r)=>{let e=await wn(r);return _n(e.graph),await zs(e)},"renderDagreSubgraph"),En=t((r)=>{let e=new et({multigraph:!0,compound:!0}).setGraph({rankdir:r.direction,nodesep:r.config?.nodeSpacing||r.nodeSpacing||r.config?.flowchart?.nodeSpacing,ranksep:r.config?.rankSpacing||r.rankSpacing||r.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return r.nodes.forEach((n)=>{if(e.setNode(n.id,{...n}),n.parentId)e.setParent(n.id,n.parentId)}),l.debug("Edges:",r.edges),r.edges.forEach((n)=>{if(n.start===n.end){let o=n.start,i=o+"---"+o+"---1",a=o+"---"+o+"---2",f=e.node(o);e.setNode(i,{domId:i,id:i,parentId:f.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(i,f.parentId),e.setNode(a,{domId:a,id:a,parentId:f.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(a,f.parentId);let s=structuredClone(n),u=structuredClone(n),d=structuredClone(n),c=structuredClone(n);if(u.originalEdge=s,u.selfLoop={id:s.id,order:0},d.originalEdge=s,d.selfLoop={id:s.id,order:1},c.originalEdge=s,c.selfLoop={id:s.id,order:2},u.label="",u.arrowTypeEnd="none",u.endLabelLeft="",u.endLabelRight="",u.startLabelLeft="",u.id=o+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=o+"-cyclic-special-mid",c.label="",c.startLabelRight="",c.startLabelLeft="",c.arrowTypeStart="none",f.isGroup)u.fromCluster=o,c.toCluster=o;c.id=o+"-cyclic-special-2",c.arrowTypeStart="none",e.setEdge(o,i,u,o+"-cyclic-special-0"),e.setEdge(i,a,d,o+"-cyclic-special-1"),e.setEdge(a,o,c,o+"-cyclic-special-2")}else e.setEdge(n.start,n.end,{...n},n.id)}),vh(e),{graph:e}},"prepareLayoutForDagre"),qs=t(async(r,{element:e,preparedLayout:n})=>{let o=n??En(r),i=m(),a=await wn({element:e,graph:o.graph,diagramType:r.type,id:r.diagramId,parentCluster:void 0,siteConfig:i});return o.measuredLayout=a,a},"measureDagreLayout"),Hs=t((r,e)=>{let n=e.preparedLayout?.measuredLayout;if(!n)throw Error("runDagreLayoutCore requires measureDagreLayout to run first");return _n(n.graph),Ys(r,n),n},"runDagreLayoutCore"),Ks=t((r,{measure:e})=>Gp(e.graph).map((n)=>e.graph.node(n)).filter(Boolean),"getDagrePaintNodes"),Js=t((r,e,{measure:n})=>r?n.graph.node(r):void 0,"getDagreEdgeNode"),Kg=gi({prepareLayout:En,measureLayout:qs,runLayoutCore:Hs,paintOptions:{clusterDb:ve,getNodes:Ks,getEdgeNode:Js,skipNode:t((r,{measure:e})=>!e.graph.hasNode(r.id),"skipNode"),isCluster:t((r,{measure:e})=>e.graph.hasNode(r.id)&&(e.graph.children(r.id)??[]).length>0,"isCluster")}});export{Ys as applyDagreLayoutResult,yn as getEdgesToRender,qs as measureDagreLayout,En as prepareLayoutForDagre,Kg as render,Hs as runDagreLayoutCore};