@otto-code/server 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/dist/server/server/agent/agent-manager.d.ts +28 -2
  2. package/dist/server/server/agent/agent-manager.js +31 -4
  3. package/dist/server/server/agent/lifecycle-command.d.ts +1 -1
  4. package/dist/server/server/agent/lifecycle-command.js +7 -6
  5. package/dist/server/server/agent/providers/claude/agent.js +48 -20
  6. package/dist/server/server/agent/providers/claude/claude-pricing.js +4 -0
  7. package/dist/server/server/agent/providers/claude/model-manifest.d.ts +44 -30
  8. package/dist/server/server/agent/providers/claude/model-manifest.js +62 -35
  9. package/dist/server/server/speech/providers/local/sherpa/sherpa-runtime-env.d.ts +20 -0
  10. package/dist/server/server/speech/providers/local/sherpa/sherpa-runtime-env.js +29 -1
  11. package/dist/server/web-ui/_expo/static/css/xterm-568e87a1b494979da9e20c7259569fdf.css +1 -0
  12. package/dist/server/web-ui/_expo/static/css/xterm-568e87a1b494979da9e20c7259569fdf.css.br +0 -0
  13. package/dist/server/web-ui/_expo/static/css/xterm-568e87a1b494979da9e20c7259569fdf.css.gz +0 -0
  14. package/dist/server/web-ui/_expo/static/js/web/{__common-7f812a4abec3faf5a84ebc3af41b28f3.js → __common-6d2299ed037bec2393245a7c0bf1c643.js} +1855 -1855
  15. package/dist/server/web-ui/_expo/static/js/web/__common-6d2299ed037bec2393245a7c0bf1c643.js.br +0 -0
  16. package/dist/server/web-ui/_expo/static/js/web/__common-6d2299ed037bec2393245a7c0bf1c643.js.gz +0 -0
  17. package/dist/server/web-ui/_expo/static/js/web/{abnfDiagram-VRR7QNED-e9fb7d5220ffa58505df502db144abe5.js → abnfDiagram-VRR7QNED-c3c2ca327b2d7ad9af3caa1cba884908.js} +1 -1
  18. package/dist/server/web-ui/_expo/static/js/web/abnfDiagram-VRR7QNED-c3c2ca327b2d7ad9af3caa1cba884908.js.br +0 -0
  19. package/dist/server/web-ui/_expo/static/js/web/abnfDiagram-VRR7QNED-c3c2ca327b2d7ad9af3caa1cba884908.js.gz +0 -0
  20. package/dist/server/web-ui/_expo/static/js/web/{architecture-TIHT7OUA-baad05ec450eac37a8547e19e44a63f4.js → architecture-TIHT7OUA-0cf23d3dc9775f216c01daae4aae250a.js} +1 -1
  21. package/dist/server/web-ui/_expo/static/js/web/architecture-TIHT7OUA-0cf23d3dc9775f216c01daae4aae250a.js.br +0 -0
  22. package/dist/server/web-ui/_expo/static/js/web/architecture-TIHT7OUA-0cf23d3dc9775f216c01daae4aae250a.js.gz +0 -0
  23. package/dist/server/web-ui/_expo/static/js/web/{architectureDiagram-ZJ3FMSHR-6c624bf41f92ed009a48f1c139dbba92.js → architectureDiagram-ZJ3FMSHR-f3bce96124559dc19faa4d90aca4afd4.js} +4 -4
  24. package/dist/server/web-ui/_expo/static/js/web/architectureDiagram-ZJ3FMSHR-f3bce96124559dc19faa4d90aca4afd4.js.br +0 -0
  25. package/dist/server/web-ui/_expo/static/js/web/architectureDiagram-ZJ3FMSHR-f3bce96124559dc19faa4d90aca4afd4.js.gz +0 -0
  26. package/dist/server/web-ui/_expo/static/js/web/{blockDiagram-677ZJIJ3-8de7625a6784c5b0a0a9529179af8125.js → blockDiagram-677ZJIJ3-839486928c0f151128a5e2836aa07080.js} +1 -1
  27. package/dist/server/web-ui/_expo/static/js/web/blockDiagram-677ZJIJ3-839486928c0f151128a5e2836aa07080.js.br +0 -0
  28. package/dist/server/web-ui/_expo/static/js/web/{blockDiagram-677ZJIJ3-8de7625a6784c5b0a0a9529179af8125.js.gz → blockDiagram-677ZJIJ3-839486928c0f151128a5e2836aa07080.js.gz} +0 -0
  29. package/dist/server/web-ui/_expo/static/js/web/{c4Diagram-LMCZKHZV-39d3cdad6d10a237a6b5e49414622a25.js → c4Diagram-LMCZKHZV-197212c21520a6b659a5649e683619d0.js} +1 -1
  30. package/dist/server/web-ui/_expo/static/js/web/c4Diagram-LMCZKHZV-197212c21520a6b659a5649e683619d0.js.br +0 -0
  31. package/dist/server/web-ui/_expo/static/js/web/{c4Diagram-LMCZKHZV-39d3cdad6d10a237a6b5e49414622a25.js.gz → c4Diagram-LMCZKHZV-197212c21520a6b659a5649e683619d0.js.gz} +0 -0
  32. package/dist/server/web-ui/_expo/static/js/web/{classDiagram-OUVF2IWQ-e8e649cc6e60036f959cc7f3a0513885.js → classDiagram-OUVF2IWQ-a0a0fbefc96d14b6619c84fc4f92a39a.js} +1 -1
  33. package/dist/server/web-ui/_expo/static/js/web/classDiagram-OUVF2IWQ-a0a0fbefc96d14b6619c84fc4f92a39a.js.br +0 -0
  34. package/dist/server/web-ui/_expo/static/js/web/classDiagram-OUVF2IWQ-a0a0fbefc96d14b6619c84fc4f92a39a.js.gz +0 -0
  35. package/dist/server/web-ui/_expo/static/js/web/{classDiagram-v2-EOCWNBFH-780d19f73ba2334de64f4ae4e4e212a8.js → classDiagram-v2-EOCWNBFH-e979239c6d160123d5b4847253a8a70e.js} +1 -1
  36. package/dist/server/web-ui/_expo/static/js/web/classDiagram-v2-EOCWNBFH-e979239c6d160123d5b4847253a8a70e.js.br +0 -0
  37. package/dist/server/web-ui/_expo/static/js/web/classDiagram-v2-EOCWNBFH-e979239c6d160123d5b4847253a8a70e.js.gz +0 -0
  38. package/dist/server/web-ui/_expo/static/js/web/{cose-bilkent-JH36ORCC-77d512732017c5bbd4650482be1c2f8f.js → cose-bilkent-JH36ORCC-bbc39a6bb062ba85e433f91becc37a65.js} +4 -4
  39. package/dist/server/web-ui/_expo/static/js/web/cose-bilkent-JH36ORCC-bbc39a6bb062ba85e433f91becc37a65.js.br +0 -0
  40. package/dist/server/web-ui/_expo/static/js/web/cose-bilkent-JH36ORCC-bbc39a6bb062ba85e433f91becc37a65.js.gz +0 -0
  41. package/dist/server/web-ui/_expo/static/js/web/{cynefin-VYW2F7L2-a88cfd594091ceee1efbadf37afff948.js → cynefin-VYW2F7L2-ea0e514652627740f5a2ed32b027a164.js} +1 -1
  42. package/dist/server/web-ui/_expo/static/js/web/cynefin-VYW2F7L2-ea0e514652627740f5a2ed32b027a164.js.br +0 -0
  43. package/dist/server/web-ui/_expo/static/js/web/cynefin-VYW2F7L2-ea0e514652627740f5a2ed32b027a164.js.gz +0 -0
  44. package/dist/server/web-ui/_expo/static/js/web/{cynefinDiagram-TSTJHNR4-5833a2b8b3df6daeec088690d52dac39.js → cynefinDiagram-TSTJHNR4-0446f9b57ba778e5883d93e24692ffce.js} +1 -1
  45. package/dist/server/web-ui/_expo/static/js/web/cynefinDiagram-TSTJHNR4-0446f9b57ba778e5883d93e24692ffce.js.br +0 -0
  46. package/dist/server/web-ui/_expo/static/js/web/cynefinDiagram-TSTJHNR4-0446f9b57ba778e5883d93e24692ffce.js.gz +0 -0
  47. package/dist/server/web-ui/_expo/static/js/web/{dagre-VKFMJZFB-8370cb48129c037fd127b9f1e39ea2a9.js → dagre-VKFMJZFB-69f7aa52521b06a95874b1ac67508def.js} +1 -1
  48. package/dist/server/web-ui/_expo/static/js/web/dagre-VKFMJZFB-69f7aa52521b06a95874b1ac67508def.js.br +0 -0
  49. package/dist/server/web-ui/_expo/static/js/web/dagre-VKFMJZFB-69f7aa52521b06a95874b1ac67508def.js.gz +0 -0
  50. package/dist/server/web-ui/_expo/static/js/web/{desktop-attachment-bridge-fd825b89c935a0512740145024470f4d.js → desktop-attachment-bridge-0ae8aadd6e53625f59d62eceb1f06ede.js} +1 -1
  51. package/dist/server/web-ui/_expo/static/js/web/{desktop-attachment-bridge-fd825b89c935a0512740145024470f4d.js.br → desktop-attachment-bridge-0ae8aadd6e53625f59d62eceb1f06ede.js.br} +0 -0
  52. package/dist/server/web-ui/_expo/static/js/web/desktop-attachment-bridge-0ae8aadd6e53625f59d62eceb1f06ede.js.gz +0 -0
  53. package/dist/server/web-ui/_expo/static/js/web/{desktop-attachment-store-8c0bfc01f75c01be14a9b8e3194d8964.js → desktop-attachment-store-ecd775c6aee79778f49274a5bffadc5a.js} +1 -1
  54. package/dist/server/web-ui/_expo/static/js/web/{desktop-attachment-store-8c0bfc01f75c01be14a9b8e3194d8964.js.br → desktop-attachment-store-ecd775c6aee79778f49274a5bffadc5a.js.br} +0 -0
  55. package/dist/server/web-ui/_expo/static/js/web/desktop-attachment-store-ecd775c6aee79778f49274a5bffadc5a.js.gz +0 -0
  56. package/dist/server/web-ui/_expo/static/js/web/{diagram-FQU43EPY-8498706cd9b49524f6691758ecae2eb4.js → diagram-FQU43EPY-bd0940835ccad031627e285aaba6d5ec.js} +1 -1
  57. package/dist/server/web-ui/_expo/static/js/web/diagram-FQU43EPY-bd0940835ccad031627e285aaba6d5ec.js.br +0 -0
  58. package/dist/server/web-ui/_expo/static/js/web/diagram-FQU43EPY-bd0940835ccad031627e285aaba6d5ec.js.gz +0 -0
  59. package/dist/server/web-ui/_expo/static/js/web/{diagram-G47NLZAW-597bc7059fc5285e8369a7c885ebe847.js → diagram-G47NLZAW-217e2cd3275924bc08fc6ebe79e95e48.js} +1 -1
  60. package/dist/server/web-ui/_expo/static/js/web/diagram-G47NLZAW-217e2cd3275924bc08fc6ebe79e95e48.js.br +0 -0
  61. package/dist/server/web-ui/_expo/static/js/web/diagram-G47NLZAW-217e2cd3275924bc08fc6ebe79e95e48.js.gz +0 -0
  62. package/dist/server/web-ui/_expo/static/js/web/{diagram-NH7WQ7WH-c2c6b683bd29936bf7d31b3fc2cf621a.js → diagram-NH7WQ7WH-fbd3aa35ca68df15ee378fb63241b333.js} +1 -1
  63. package/dist/server/web-ui/_expo/static/js/web/diagram-NH7WQ7WH-fbd3aa35ca68df15ee378fb63241b333.js.br +0 -0
  64. package/dist/server/web-ui/_expo/static/js/web/diagram-NH7WQ7WH-fbd3aa35ca68df15ee378fb63241b333.js.gz +0 -0
  65. package/dist/server/web-ui/_expo/static/js/web/{diagram-OA4YK3LP-b9b6f76223fd43c88400f013b149d341.js → diagram-OA4YK3LP-48ebb0ba6bcb34417649bd55070542ad.js} +1 -1
  66. package/dist/server/web-ui/_expo/static/js/web/diagram-OA4YK3LP-48ebb0ba6bcb34417649bd55070542ad.js.br +0 -0
  67. package/dist/server/web-ui/_expo/static/js/web/diagram-OA4YK3LP-48ebb0ba6bcb34417649bd55070542ad.js.gz +0 -0
  68. package/dist/server/web-ui/_expo/static/js/web/{diagram-WEI45ONY-754f2b4fbeac3f550acefb7cbbd0c08e.js → diagram-WEI45ONY-2be85db5396495fa970419f77587cf14.js} +1 -1
  69. package/dist/server/web-ui/_expo/static/js/web/diagram-WEI45ONY-2be85db5396495fa970419f77587cf14.js.br +0 -0
  70. package/dist/server/web-ui/_expo/static/js/web/diagram-WEI45ONY-2be85db5396495fa970419f77587cf14.js.gz +0 -0
  71. package/dist/server/web-ui/_expo/static/js/web/{ebnfDiagram-CCIWWBDH-fdf4e805004091ce5c03abb1c3db051c.js → ebnfDiagram-CCIWWBDH-3c5c44cf8340b641d13076adab77967b.js} +1 -1
  72. package/dist/server/web-ui/_expo/static/js/web/ebnfDiagram-CCIWWBDH-3c5c44cf8340b641d13076adab77967b.js.br +0 -0
  73. package/dist/server/web-ui/_expo/static/js/web/ebnfDiagram-CCIWWBDH-3c5c44cf8340b641d13076adab77967b.js.gz +0 -0
  74. package/dist/server/web-ui/_expo/static/js/web/{erDiagram-Q63AITRT-a43a5042f4e2c804e1e681caf9ec1a9a.js → erDiagram-Q63AITRT-81762a72bd33bf1042e4cad4f688abf2.js} +1 -1
  75. package/dist/server/web-ui/_expo/static/js/web/erDiagram-Q63AITRT-81762a72bd33bf1042e4cad4f688abf2.js.br +0 -0
  76. package/dist/server/web-ui/_expo/static/js/web/erDiagram-Q63AITRT-81762a72bd33bf1042e4cad4f688abf2.js.gz +0 -0
  77. package/dist/server/web-ui/_expo/static/js/web/{eventmodeling-45OFAUF4-a087e1cea5a1dbfd5543dda165a5deec.js → eventmodeling-45OFAUF4-11d7615d746c5304c28d4931ec9ca5f7.js} +1 -1
  78. package/dist/server/web-ui/_expo/static/js/web/{eventmodeling-45OFAUF4-a087e1cea5a1dbfd5543dda165a5deec.js.br → eventmodeling-45OFAUF4-11d7615d746c5304c28d4931ec9ca5f7.js.br} +0 -0
  79. package/dist/server/web-ui/_expo/static/js/web/eventmodeling-45OFAUF4-11d7615d746c5304c28d4931ec9ca5f7.js.gz +0 -0
  80. package/dist/server/web-ui/_expo/static/js/web/{flowDiagram-23GEKE2U-37fc4906caf7b017a490d14be1fc651f.js → flowDiagram-23GEKE2U-5a2af608a9500bb36da0595c3464a562.js} +1 -1
  81. package/dist/server/web-ui/_expo/static/js/web/flowDiagram-23GEKE2U-5a2af608a9500bb36da0595c3464a562.js.br +0 -0
  82. package/dist/server/web-ui/_expo/static/js/web/flowDiagram-23GEKE2U-5a2af608a9500bb36da0595c3464a562.js.gz +0 -0
  83. package/dist/server/web-ui/_expo/static/js/web/{ganttDiagram-NO4QXBWP-55762209837da2c4e82e6395b527cc77.js → ganttDiagram-NO4QXBWP-379aae0f5fb2652d90827c7f8b2472d2.js} +5 -5
  84. package/dist/server/web-ui/_expo/static/js/web/ganttDiagram-NO4QXBWP-379aae0f5fb2652d90827c7f8b2472d2.js.br +0 -0
  85. package/dist/server/web-ui/_expo/static/js/web/ganttDiagram-NO4QXBWP-379aae0f5fb2652d90827c7f8b2472d2.js.gz +0 -0
  86. package/dist/server/web-ui/_expo/static/js/web/{gitGraph-TEB2WS4Q-dcf4944f6bd6770c7d72148542d13210.js → gitGraph-TEB2WS4Q-d978b8a2d1fd8fcc132b16ef8d57dd7c.js} +1 -1
  87. package/dist/server/web-ui/_expo/static/js/web/gitGraph-TEB2WS4Q-d978b8a2d1fd8fcc132b16ef8d57dd7c.js.br +0 -0
  88. package/dist/server/web-ui/_expo/static/js/web/gitGraph-TEB2WS4Q-d978b8a2d1fd8fcc132b16ef8d57dd7c.js.gz +0 -0
  89. package/dist/server/web-ui/_expo/static/js/web/{gitGraphDiagram-IHSO6WYX-174e7b61ddcbabfeb5892c447ff93324.js → gitGraphDiagram-IHSO6WYX-6cb31a37312da231b8f10f86b0d4de52.js} +1 -1
  90. package/dist/server/web-ui/_expo/static/js/web/gitGraphDiagram-IHSO6WYX-6cb31a37312da231b8f10f86b0d4de52.js.br +0 -0
  91. package/dist/server/web-ui/_expo/static/js/web/gitGraphDiagram-IHSO6WYX-6cb31a37312da231b8f10f86b0d4de52.js.gz +0 -0
  92. package/dist/server/web-ui/_expo/static/js/web/{index-ab103a332d12b791ca2d8630c459db1c.js → index-4c86d3c14df18b18b3b9a6329b896faf.js} +446 -444
  93. package/dist/server/web-ui/_expo/static/js/web/index-4c86d3c14df18b18b3b9a6329b896faf.js.br +0 -0
  94. package/dist/server/web-ui/_expo/static/js/web/index-4c86d3c14df18b18b3b9a6329b896faf.js.gz +0 -0
  95. package/dist/server/web-ui/_expo/static/js/web/{indexeddb-attachment-store-6977b09ab1b56a2280e036326e24c5f7.js → indexeddb-attachment-store-5a90994af83f12740a986d9f1cb55cc9.js} +1 -1
  96. package/dist/server/web-ui/_expo/static/js/web/{indexeddb-attachment-store-6977b09ab1b56a2280e036326e24c5f7.js.br → indexeddb-attachment-store-5a90994af83f12740a986d9f1cb55cc9.js.br} +0 -0
  97. package/dist/server/web-ui/_expo/static/js/web/indexeddb-attachment-store-5a90994af83f12740a986d9f1cb55cc9.js.gz +0 -0
  98. package/dist/server/web-ui/_expo/static/js/web/{info-DKCQHKI2-b203539356a9c56c3389acbb272dbdb6.js → info-DKCQHKI2-b59d0dbb9a30d361ddc796a5cfa7fc41.js} +1 -1
  99. package/dist/server/web-ui/_expo/static/js/web/{info-DKCQHKI2-b203539356a9c56c3389acbb272dbdb6.js.br → info-DKCQHKI2-b59d0dbb9a30d361ddc796a5cfa7fc41.js.br} +0 -0
  100. package/dist/server/web-ui/_expo/static/js/web/info-DKCQHKI2-b59d0dbb9a30d361ddc796a5cfa7fc41.js.gz +0 -0
  101. package/dist/server/web-ui/_expo/static/js/web/{infoDiagram-FWYZ7A6U-2da45c52fdb46101cbc725879fc776ca.js → infoDiagram-FWYZ7A6U-0c4368de61a3bdbfbc73b143423981d9.js} +1 -1
  102. package/dist/server/web-ui/_expo/static/js/web/infoDiagram-FWYZ7A6U-0c4368de61a3bdbfbc73b143423981d9.js.br +0 -0
  103. package/dist/server/web-ui/_expo/static/js/web/infoDiagram-FWYZ7A6U-0c4368de61a3bdbfbc73b143423981d9.js.gz +0 -0
  104. package/dist/server/web-ui/_expo/static/js/web/{ishikawaDiagram-FXEZZL3T-b1da9dd4765e6f3378d0d5be1443354b.js → ishikawaDiagram-FXEZZL3T-1474e73532a16148b7944d3b0f896197.js} +1 -1
  105. package/dist/server/web-ui/_expo/static/js/web/ishikawaDiagram-FXEZZL3T-1474e73532a16148b7944d3b0f896197.js.br +0 -0
  106. package/dist/server/web-ui/_expo/static/js/web/ishikawaDiagram-FXEZZL3T-1474e73532a16148b7944d3b0f896197.js.gz +0 -0
  107. package/dist/server/web-ui/_expo/static/js/web/{journeyDiagram-5HDEW3XC-8be414aba07996a355005210e4a4cb94.js → journeyDiagram-5HDEW3XC-13df6cce9cb7f0e6ffbaa9a614feeee4.js} +1 -1
  108. package/dist/server/web-ui/_expo/static/js/web/journeyDiagram-5HDEW3XC-13df6cce9cb7f0e6ffbaa9a614feeee4.js.br +0 -0
  109. package/dist/server/web-ui/_expo/static/js/web/{journeyDiagram-5HDEW3XC-8be414aba07996a355005210e4a4cb94.js.gz → journeyDiagram-5HDEW3XC-13df6cce9cb7f0e6ffbaa9a614feeee4.js.gz} +0 -0
  110. package/dist/server/web-ui/_expo/static/js/web/{kanban-definition-HUTT4EX6-9e57662fb254b84a11dc0a576b6e94e9.js → kanban-definition-HUTT4EX6-6b56c0da5302838e7e1c46bf7460ea35.js} +1 -1
  111. package/dist/server/web-ui/_expo/static/js/web/kanban-definition-HUTT4EX6-6b56c0da5302838e7e1c46bf7460ea35.js.br +0 -0
  112. package/dist/server/web-ui/_expo/static/js/web/{kanban-definition-HUTT4EX6-9e57662fb254b84a11dc0a576b6e94e9.js.gz → kanban-definition-HUTT4EX6-6b56c0da5302838e7e1c46bf7460ea35.js.gz} +0 -0
  113. package/dist/server/web-ui/_expo/static/js/web/{katex-d9fc4f556c2d2a983ed4a8c9e23a1dd9.js → katex-7f6ac23f118e6e9264fdfa96e335134f.js} +1 -1
  114. package/dist/server/web-ui/_expo/static/js/web/katex-7f6ac23f118e6e9264fdfa96e335134f.js.br +0 -0
  115. package/dist/server/web-ui/_expo/static/js/web/{katex-d9fc4f556c2d2a983ed4a8c9e23a1dd9.js.gz → katex-7f6ac23f118e6e9264fdfa96e335134f.js.gz} +0 -0
  116. package/dist/server/web-ui/_expo/static/js/web/{mermaid-e774f93ec3cd59dc4ecad4701477430c.js → mermaid-75931b049ce3e66af3cd8ddf01e1cd23.js} +9 -9
  117. package/dist/server/web-ui/_expo/static/js/web/mermaid-75931b049ce3e66af3cd8ddf01e1cd23.js.br +0 -0
  118. package/dist/server/web-ui/_expo/static/js/web/{mermaid-e774f93ec3cd59dc4ecad4701477430c.js.gz → mermaid-75931b049ce3e66af3cd8ddf01e1cd23.js.gz} +0 -0
  119. package/dist/server/web-ui/_expo/static/js/web/{mindmap-definition-LN4V7U3C-7a58ef8b8e2eb9a3e19d2adbb9507a81.js → mindmap-definition-LN4V7U3C-fafde693a329ca39007debdd961134b4.js} +21 -21
  120. package/dist/server/web-ui/_expo/static/js/web/mindmap-definition-LN4V7U3C-fafde693a329ca39007debdd961134b4.js.br +0 -0
  121. package/dist/server/web-ui/_expo/static/js/web/{mindmap-definition-LN4V7U3C-7a58ef8b8e2eb9a3e19d2adbb9507a81.js.gz → mindmap-definition-LN4V7U3C-fafde693a329ca39007debdd961134b4.js.gz} +0 -0
  122. package/dist/server/web-ui/_expo/static/js/web/{native-file-attachment-store-1889954e9a9bec442e274003c294996e.js → native-file-attachment-store-645b8ffe39c60c05c0a224e6efcb5a9c.js} +3 -3
  123. package/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-645b8ffe39c60c05c0a224e6efcb5a9c.js.br +0 -0
  124. package/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-645b8ffe39c60c05c0a224e6efcb5a9c.js.gz +0 -0
  125. package/dist/server/web-ui/_expo/static/js/web/{orchestration-graph-panel-cb9c04891d9d1aae34efd26bb9f2551b.js → orchestration-graph-panel-2d117a5764d11c411d707e37fba93a1b.js} +5 -5
  126. package/dist/server/web-ui/_expo/static/js/web/orchestration-graph-panel-2d117a5764d11c411d707e37fba93a1b.js.br +0 -0
  127. package/dist/server/web-ui/_expo/static/js/web/orchestration-graph-panel-2d117a5764d11c411d707e37fba93a1b.js.gz +0 -0
  128. package/dist/server/web-ui/_expo/static/js/web/{packet-7NZHBO7P-b3e37876c15ad5c09649121bec058b0a.js → packet-7NZHBO7P-61a485e09ee448c823fffbdfc588826d.js} +1 -1
  129. package/dist/server/web-ui/_expo/static/js/web/{packet-7NZHBO7P-b3e37876c15ad5c09649121bec058b0a.js.br → packet-7NZHBO7P-61a485e09ee448c823fffbdfc588826d.js.br} +1 -1
  130. package/dist/server/web-ui/_expo/static/js/web/packet-7NZHBO7P-61a485e09ee448c823fffbdfc588826d.js.gz +0 -0
  131. package/dist/server/web-ui/_expo/static/js/web/{pegDiagram-2B236MQR-ec32f92e29007730d1ec5cb1f9262526.js → pegDiagram-2B236MQR-035fe1b93f90f4775e99aea533552b42.js} +1 -1
  132. package/dist/server/web-ui/_expo/static/js/web/{pegDiagram-2B236MQR-ec32f92e29007730d1ec5cb1f9262526.js.br → pegDiagram-2B236MQR-035fe1b93f90f4775e99aea533552b42.js.br} +0 -0
  133. package/dist/server/web-ui/_expo/static/js/web/pegDiagram-2B236MQR-035fe1b93f90f4775e99aea533552b42.js.gz +0 -0
  134. package/dist/server/web-ui/_expo/static/js/web/{pie-RZYD4A2V-0cff7c6972d3420b6f5567c9ca000364.js → pie-RZYD4A2V-f6208df18db61d490f4811b192b77dec.js} +1 -1
  135. package/dist/server/web-ui/_expo/static/js/web/{pie-RZYD4A2V-0cff7c6972d3420b6f5567c9ca000364.js.br → pie-RZYD4A2V-f6208df18db61d490f4811b192b77dec.js.br} +0 -0
  136. package/dist/server/web-ui/_expo/static/js/web/pie-RZYD4A2V-f6208df18db61d490f4811b192b77dec.js.gz +0 -0
  137. package/dist/server/web-ui/_expo/static/js/web/{pieDiagram-ENE6RG2P-1fd55d1071310f157f026844ebfae9ef.js → pieDiagram-ENE6RG2P-c78c82bf26f51acb7b7c44ae51eba9c6.js} +1 -1
  138. package/dist/server/web-ui/_expo/static/js/web/pieDiagram-ENE6RG2P-c78c82bf26f51acb7b7c44ae51eba9c6.js.br +0 -0
  139. package/dist/server/web-ui/_expo/static/js/web/pieDiagram-ENE6RG2P-c78c82bf26f51acb7b7c44ae51eba9c6.js.gz +0 -0
  140. package/dist/server/web-ui/_expo/static/js/web/{quadrantDiagram-ABIIQ3AL-8cc6610d633a7b5c5ec3638a2c7aa2b5.js → quadrantDiagram-ABIIQ3AL-efff1486187742fe8683a966651df92f.js} +1 -1
  141. package/dist/server/web-ui/_expo/static/js/web/quadrantDiagram-ABIIQ3AL-efff1486187742fe8683a966651df92f.js.br +0 -0
  142. package/dist/server/web-ui/_expo/static/js/web/{quadrantDiagram-ABIIQ3AL-8cc6610d633a7b5c5ec3638a2c7aa2b5.js.gz → quadrantDiagram-ABIIQ3AL-efff1486187742fe8683a966651df92f.js.gz} +0 -0
  143. package/dist/server/web-ui/_expo/static/js/web/{radar-I7S5WNFK-5778f2584049a7a7d0ceb5f439e8350b.js → radar-I7S5WNFK-0150ed7f0d337fc7ec70638a3656ea06.js} +1 -1
  144. package/dist/server/web-ui/_expo/static/js/web/{radar-I7S5WNFK-5778f2584049a7a7d0ceb5f439e8350b.js.br → radar-I7S5WNFK-0150ed7f0d337fc7ec70638a3656ea06.js.br} +0 -0
  145. package/dist/server/web-ui/_expo/static/js/web/radar-I7S5WNFK-0150ed7f0d337fc7ec70638a3656ea06.js.gz +0 -0
  146. package/dist/server/web-ui/_expo/static/js/web/{railroad-3IZDKUUU-ca56ff1ad41a71a0236a70cf85d6c90e.js → railroad-3IZDKUUU-c6e94ec81a88c02cb339de59f29386f5.js} +1 -1
  147. package/dist/server/web-ui/_expo/static/js/web/{railroad-3IZDKUUU-ca56ff1ad41a71a0236a70cf85d6c90e.js.br → railroad-3IZDKUUU-c6e94ec81a88c02cb339de59f29386f5.js.br} +1 -1
  148. package/dist/server/web-ui/_expo/static/js/web/railroad-3IZDKUUU-c6e94ec81a88c02cb339de59f29386f5.js.gz +0 -0
  149. package/dist/server/web-ui/_expo/static/js/web/{railroad-abnf-AHOZXSZD-db0e4b822aa907a0123e2ff035557340.js → railroad-abnf-AHOZXSZD-627ed129da90b5e1d371bd2c3b9db457.js} +1 -1
  150. package/dist/server/web-ui/_expo/static/js/web/{railroad-abnf-AHOZXSZD-db0e4b822aa907a0123e2ff035557340.js.br → railroad-abnf-AHOZXSZD-627ed129da90b5e1d371bd2c3b9db457.js.br} +1 -1
  151. package/dist/server/web-ui/_expo/static/js/web/railroad-abnf-AHOZXSZD-627ed129da90b5e1d371bd2c3b9db457.js.gz +0 -0
  152. package/dist/server/web-ui/_expo/static/js/web/{railroad-ebnf-EBAXGLYW-cf7f1831ebb5ea6c207428716b160d6c.js → railroad-ebnf-EBAXGLYW-1b7ec12d3b92be4e181971b21f01f3f8.js} +1 -1
  153. package/dist/server/web-ui/_expo/static/js/web/{railroad-ebnf-EBAXGLYW-cf7f1831ebb5ea6c207428716b160d6c.js.br → railroad-ebnf-EBAXGLYW-1b7ec12d3b92be4e181971b21f01f3f8.js.br} +1 -1
  154. package/dist/server/web-ui/_expo/static/js/web/railroad-ebnf-EBAXGLYW-1b7ec12d3b92be4e181971b21f01f3f8.js.gz +0 -0
  155. package/dist/server/web-ui/_expo/static/js/web/{railroad-peg-LSFZ7HO6-7c20b50c4c8f51c2ffcf4bf35a0a7636.js → railroad-peg-LSFZ7HO6-8a8e027f4141d16a12c15223da966d7d.js} +1 -1
  156. package/dist/server/web-ui/_expo/static/js/web/railroad-peg-LSFZ7HO6-8a8e027f4141d16a12c15223da966d7d.js.br +0 -0
  157. package/dist/server/web-ui/_expo/static/js/web/railroad-peg-LSFZ7HO6-8a8e027f4141d16a12c15223da966d7d.js.gz +0 -0
  158. package/dist/server/web-ui/_expo/static/js/web/{railroadDiagram-RFXS5EU6-b757f4db949dc35ae1c47ab3e94a7537.js → railroadDiagram-RFXS5EU6-499f36fe78b07e5558063f963a47a474.js} +1 -1
  159. package/dist/server/web-ui/_expo/static/js/web/railroadDiagram-RFXS5EU6-499f36fe78b07e5558063f963a47a474.js.br +0 -0
  160. package/dist/server/web-ui/_expo/static/js/web/railroadDiagram-RFXS5EU6-499f36fe78b07e5558063f963a47a474.js.gz +0 -0
  161. package/dist/server/web-ui/_expo/static/js/web/{requirementDiagram-TGXJPOKE-e4f0df6458cf6654ef5fa9dd6d105866.js → requirementDiagram-TGXJPOKE-9aaddb885fc59873a8f89cd7550c2c43.js} +1 -1
  162. package/dist/server/web-ui/_expo/static/js/web/requirementDiagram-TGXJPOKE-9aaddb885fc59873a8f89cd7550c2c43.js.br +0 -0
  163. package/dist/server/web-ui/_expo/static/js/web/requirementDiagram-TGXJPOKE-9aaddb885fc59873a8f89cd7550c2c43.js.gz +0 -0
  164. package/dist/server/web-ui/_expo/static/js/web/{sankeyDiagram-HTMAVEWB-351ac8fc52f6092f8670a4eed5500d86.js → sankeyDiagram-HTMAVEWB-3fa66fe414adce7a50e31551c059f99c.js} +120 -120
  165. package/dist/server/web-ui/_expo/static/js/web/sankeyDiagram-HTMAVEWB-3fa66fe414adce7a50e31551c059f99c.js.br +0 -0
  166. package/dist/server/web-ui/_expo/static/js/web/sankeyDiagram-HTMAVEWB-3fa66fe414adce7a50e31551c059f99c.js.gz +0 -0
  167. package/dist/server/web-ui/_expo/static/js/web/{sequenceDiagram-DBY2YBRQ-bb599498dd8766fee5330d400bce0905.js → sequenceDiagram-DBY2YBRQ-856a29fb0507a2dcb697a2aa29cd0b7a.js} +1 -1
  168. package/dist/server/web-ui/_expo/static/js/web/sequenceDiagram-DBY2YBRQ-856a29fb0507a2dcb697a2aa29cd0b7a.js.br +0 -0
  169. package/dist/server/web-ui/_expo/static/js/web/{sequenceDiagram-DBY2YBRQ-bb599498dd8766fee5330d400bce0905.js.gz → sequenceDiagram-DBY2YBRQ-856a29fb0507a2dcb697a2aa29cd0b7a.js.gz} +0 -0
  170. package/dist/server/web-ui/_expo/static/js/web/{sizeCapture-X5ZJPWSS-204a0c7899e4f53f494516c2a59f19d7.js → sizeCapture-X5ZJPWSS-388b849b33073b8202dd9ca50038b1c7.js} +1 -1
  171. package/dist/server/web-ui/_expo/static/js/web/sizeCapture-X5ZJPWSS-388b849b33073b8202dd9ca50038b1c7.js.br +0 -0
  172. package/dist/server/web-ui/_expo/static/js/web/sizeCapture-X5ZJPWSS-388b849b33073b8202dd9ca50038b1c7.js.gz +0 -0
  173. package/dist/server/web-ui/_expo/static/js/web/{stateDiagram-2N3HPSRC-90141f3463cbed48ea84769e6a4d2b34.js → stateDiagram-2N3HPSRC-9ca22d078d9922ddcb54ba7bb389c734.js} +1 -1
  174. package/dist/server/web-ui/_expo/static/js/web/stateDiagram-2N3HPSRC-9ca22d078d9922ddcb54ba7bb389c734.js.br +0 -0
  175. package/dist/server/web-ui/_expo/static/js/web/{stateDiagram-2N3HPSRC-90141f3463cbed48ea84769e6a4d2b34.js.gz → stateDiagram-2N3HPSRC-9ca22d078d9922ddcb54ba7bb389c734.js.gz} +0 -0
  176. package/dist/server/web-ui/_expo/static/js/web/{stateDiagram-v2-6OUMAXLB-76c6daaf6dbf8f2f25178c66b4d31d8b.js → stateDiagram-v2-6OUMAXLB-4357e7143c73859f6b4858ba72acb5aa.js} +1 -1
  177. package/dist/server/web-ui/_expo/static/js/web/stateDiagram-v2-6OUMAXLB-4357e7143c73859f6b4858ba72acb5aa.js.br +0 -0
  178. package/dist/server/web-ui/_expo/static/js/web/stateDiagram-v2-6OUMAXLB-4357e7143c73859f6b4858ba72acb5aa.js.gz +0 -0
  179. package/dist/server/web-ui/_expo/static/js/web/{swimlanes-5IMT3BWC-445936c4472d66f94b005f2b1536e864.js → swimlanes-5IMT3BWC-d737ca408a7a2b82f7419141456d28e4.js} +1 -1
  180. package/dist/server/web-ui/_expo/static/js/web/swimlanes-5IMT3BWC-d737ca408a7a2b82f7419141456d28e4.js.br +0 -0
  181. package/dist/server/web-ui/_expo/static/js/web/{swimlanes-5IMT3BWC-445936c4472d66f94b005f2b1536e864.js.gz → swimlanes-5IMT3BWC-d737ca408a7a2b82f7419141456d28e4.js.gz} +0 -0
  182. package/dist/server/web-ui/_expo/static/js/web/{swimlanesDiagram-G3AALYLV-184f47b5e9bfb221d673f668d88adf76.js → swimlanesDiagram-G3AALYLV-0bf2ac58b338c2aeb33213ff1a57983a.js} +1 -1
  183. package/dist/server/web-ui/_expo/static/js/web/swimlanesDiagram-G3AALYLV-0bf2ac58b338c2aeb33213ff1a57983a.js.br +0 -0
  184. package/dist/server/web-ui/_expo/static/js/web/swimlanesDiagram-G3AALYLV-0bf2ac58b338c2aeb33213ff1a57983a.js.gz +0 -0
  185. package/dist/server/web-ui/_expo/static/js/web/{timeline-definition-FHXFAJF6-c5b0064dc55e9cf5b7b8fc9069d2e9f6.js → timeline-definition-FHXFAJF6-1130419ca563266603c98f1b2148a154.js} +1 -1
  186. package/dist/server/web-ui/_expo/static/js/web/timeline-definition-FHXFAJF6-1130419ca563266603c98f1b2148a154.js.br +0 -0
  187. package/dist/server/web-ui/_expo/static/js/web/{timeline-definition-FHXFAJF6-c5b0064dc55e9cf5b7b8fc9069d2e9f6.js.gz → timeline-definition-FHXFAJF6-1130419ca563266603c98f1b2148a154.js.gz} +0 -0
  188. package/dist/server/web-ui/_expo/static/js/web/{treeView-QDETBFTQ-ed6e58337f84b4dec2e46c640336e569.js → treeView-QDETBFTQ-4f6ec9b592731c21dee99264fa638554.js} +1 -1
  189. package/dist/server/web-ui/_expo/static/js/web/treeView-QDETBFTQ-4f6ec9b592731c21dee99264fa638554.js.br +0 -0
  190. package/dist/server/web-ui/_expo/static/js/web/treeView-QDETBFTQ-4f6ec9b592731c21dee99264fa638554.js.gz +0 -0
  191. package/dist/server/web-ui/_expo/static/js/web/{treemap-6X3UGDF4-692708563c87ba520d1a998d7d5eea29.js → treemap-6X3UGDF4-39eb6ec2c19a5de9242fd28aa26dcf5b.js} +1 -1
  192. package/dist/server/web-ui/_expo/static/js/web/{treemap-6X3UGDF4-692708563c87ba520d1a998d7d5eea29.js.br → treemap-6X3UGDF4-39eb6ec2c19a5de9242fd28aa26dcf5b.js.br} +0 -0
  193. package/dist/server/web-ui/_expo/static/js/web/treemap-6X3UGDF4-39eb6ec2c19a5de9242fd28aa26dcf5b.js.gz +0 -0
  194. package/dist/server/web-ui/_expo/static/js/web/{vennDiagram-L72KCM5P-80fb8735c2ef8627d53a07e9fe88b690.js → vennDiagram-L72KCM5P-4c15b392e9de3fdc472b53cbdf8e7558.js} +2 -2
  195. package/dist/server/web-ui/_expo/static/js/web/vennDiagram-L72KCM5P-4c15b392e9de3fdc472b53cbdf8e7558.js.br +0 -0
  196. package/dist/server/web-ui/_expo/static/js/web/{vennDiagram-L72KCM5P-80fb8735c2ef8627d53a07e9fe88b690.js.gz → vennDiagram-L72KCM5P-4c15b392e9de3fdc472b53cbdf8e7558.js.gz} +0 -0
  197. package/dist/server/web-ui/_expo/static/js/web/{visualizer-bundle-1c8903c8cecd270f312da5dd4afb1dd8.js → visualizer-bundle-b0af8f4f1ab8d4029f3f21236df43f7f.js} +1 -1
  198. package/dist/server/web-ui/_expo/static/js/web/visualizer-bundle-b0af8f4f1ab8d4029f3f21236df43f7f.js.br +0 -0
  199. package/dist/server/web-ui/_expo/static/js/web/{visualizer-bundle-1c8903c8cecd270f312da5dd4afb1dd8.js.gz → visualizer-bundle-b0af8f4f1ab8d4029f3f21236df43f7f.js.gz} +0 -0
  200. package/dist/server/web-ui/_expo/static/js/web/{visualizer-panel-1e103135cbcfcc99175d1240df666db3.js → visualizer-panel-3fbc1337bb844d7163cbdb418a4dfd53.js} +1 -1
  201. package/dist/server/web-ui/_expo/static/js/web/visualizer-panel-3fbc1337bb844d7163cbdb418a4dfd53.js.br +3 -0
  202. package/dist/server/web-ui/_expo/static/js/web/{visualizer-panel-1e103135cbcfcc99175d1240df666db3.js.gz → visualizer-panel-3fbc1337bb844d7163cbdb418a4dfd53.js.gz} +0 -0
  203. package/dist/server/web-ui/_expo/static/js/web/{visualizer-pip-e6783cac3c7464db7248acfcb5738c5f.js → visualizer-pip-de03996e25ac5d8a11d723ea90b2f9a3.js} +2 -2
  204. package/dist/server/web-ui/_expo/static/js/web/visualizer-pip-de03996e25ac5d8a11d723ea90b2f9a3.js.br +0 -0
  205. package/dist/server/web-ui/_expo/static/js/web/{visualizer-pip-e6783cac3c7464db7248acfcb5738c5f.js.gz → visualizer-pip-de03996e25ac5d8a11d723ea90b2f9a3.js.gz} +0 -0
  206. package/dist/server/web-ui/_expo/static/js/web/{wardley-OPB4EBWU-834716fbe0913781631fc4e0a871ffe7.js → wardley-OPB4EBWU-b075ee9680ce77acf211a0fb1e63cca8.js} +1 -1
  207. package/dist/server/web-ui/_expo/static/js/web/{wardley-OPB4EBWU-834716fbe0913781631fc4e0a871ffe7.js.br → wardley-OPB4EBWU-b075ee9680ce77acf211a0fb1e63cca8.js.br} +0 -0
  208. package/dist/server/web-ui/_expo/static/js/web/wardley-OPB4EBWU-b075ee9680ce77acf211a0fb1e63cca8.js.gz +0 -0
  209. package/dist/server/web-ui/_expo/static/js/web/{wardleyDiagram-EHGQE667-37784a7cbc79aaa235b0fd479ff29a92.js → wardleyDiagram-EHGQE667-a93bc6a6a1e80adcb9a740a2ea3d1676.js} +1 -1
  210. package/dist/server/web-ui/_expo/static/js/web/wardleyDiagram-EHGQE667-a93bc6a6a1e80adcb9a740a2ea3d1676.js.br +0 -0
  211. package/dist/server/web-ui/_expo/static/js/web/wardleyDiagram-EHGQE667-a93bc6a6a1e80adcb9a740a2ea3d1676.js.gz +0 -0
  212. package/dist/server/web-ui/_expo/static/js/web/{xychartDiagram-FW5EYKEG-6923fcfd900a3a3f96b656f01f7d466c.js → xychartDiagram-FW5EYKEG-ec54fa07a12c5792d0bb7b65deaff05b.js} +1 -1
  213. package/dist/server/web-ui/_expo/static/js/web/xychartDiagram-FW5EYKEG-ec54fa07a12c5792d0bb7b65deaff05b.js.br +0 -0
  214. package/dist/server/web-ui/_expo/static/js/web/{xychartDiagram-FW5EYKEG-6923fcfd900a3a3f96b656f01f7d466c.js.gz → xychartDiagram-FW5EYKEG-ec54fa07a12c5792d0bb7b65deaff05b.js.gz} +0 -0
  215. package/dist/server/web-ui/index.html +2 -2
  216. package/dist/server/web-ui/index.html.br +0 -0
  217. package/dist/server/web-ui/index.html.gz +0 -0
  218. package/dist/src/server/speech/providers/local/sherpa/sherpa-runtime-env.js +29 -1
  219. package/package.json +5 -5
  220. package/dist/server/web-ui/_expo/static/css/xterm-3bb1704bf6cb0876640973dc0244b4cb.css +0 -1
  221. package/dist/server/web-ui/_expo/static/css/xterm-3bb1704bf6cb0876640973dc0244b4cb.css.br +0 -0
  222. package/dist/server/web-ui/_expo/static/css/xterm-3bb1704bf6cb0876640973dc0244b4cb.css.gz +0 -0
  223. package/dist/server/web-ui/_expo/static/js/web/__common-7f812a4abec3faf5a84ebc3af41b28f3.js.br +0 -0
  224. package/dist/server/web-ui/_expo/static/js/web/__common-7f812a4abec3faf5a84ebc3af41b28f3.js.gz +0 -0
  225. package/dist/server/web-ui/_expo/static/js/web/abnfDiagram-VRR7QNED-e9fb7d5220ffa58505df502db144abe5.js.br +0 -0
  226. package/dist/server/web-ui/_expo/static/js/web/abnfDiagram-VRR7QNED-e9fb7d5220ffa58505df502db144abe5.js.gz +0 -0
  227. package/dist/server/web-ui/_expo/static/js/web/architecture-TIHT7OUA-baad05ec450eac37a8547e19e44a63f4.js.br +0 -1
  228. package/dist/server/web-ui/_expo/static/js/web/architecture-TIHT7OUA-baad05ec450eac37a8547e19e44a63f4.js.gz +0 -0
  229. package/dist/server/web-ui/_expo/static/js/web/architectureDiagram-ZJ3FMSHR-6c624bf41f92ed009a48f1c139dbba92.js.br +0 -0
  230. package/dist/server/web-ui/_expo/static/js/web/architectureDiagram-ZJ3FMSHR-6c624bf41f92ed009a48f1c139dbba92.js.gz +0 -0
  231. package/dist/server/web-ui/_expo/static/js/web/blockDiagram-677ZJIJ3-8de7625a6784c5b0a0a9529179af8125.js.br +0 -0
  232. package/dist/server/web-ui/_expo/static/js/web/c4Diagram-LMCZKHZV-39d3cdad6d10a237a6b5e49414622a25.js.br +0 -0
  233. package/dist/server/web-ui/_expo/static/js/web/classDiagram-OUVF2IWQ-e8e649cc6e60036f959cc7f3a0513885.js.br +0 -0
  234. package/dist/server/web-ui/_expo/static/js/web/classDiagram-OUVF2IWQ-e8e649cc6e60036f959cc7f3a0513885.js.gz +0 -0
  235. package/dist/server/web-ui/_expo/static/js/web/classDiagram-v2-EOCWNBFH-780d19f73ba2334de64f4ae4e4e212a8.js.br +0 -0
  236. package/dist/server/web-ui/_expo/static/js/web/classDiagram-v2-EOCWNBFH-780d19f73ba2334de64f4ae4e4e212a8.js.gz +0 -0
  237. package/dist/server/web-ui/_expo/static/js/web/cose-bilkent-JH36ORCC-77d512732017c5bbd4650482be1c2f8f.js.br +0 -0
  238. package/dist/server/web-ui/_expo/static/js/web/cose-bilkent-JH36ORCC-77d512732017c5bbd4650482be1c2f8f.js.gz +0 -0
  239. package/dist/server/web-ui/_expo/static/js/web/cynefin-VYW2F7L2-a88cfd594091ceee1efbadf37afff948.js.br +0 -0
  240. package/dist/server/web-ui/_expo/static/js/web/cynefin-VYW2F7L2-a88cfd594091ceee1efbadf37afff948.js.gz +0 -0
  241. package/dist/server/web-ui/_expo/static/js/web/cynefinDiagram-TSTJHNR4-5833a2b8b3df6daeec088690d52dac39.js.br +0 -0
  242. package/dist/server/web-ui/_expo/static/js/web/cynefinDiagram-TSTJHNR4-5833a2b8b3df6daeec088690d52dac39.js.gz +0 -0
  243. package/dist/server/web-ui/_expo/static/js/web/dagre-VKFMJZFB-8370cb48129c037fd127b9f1e39ea2a9.js.br +0 -0
  244. package/dist/server/web-ui/_expo/static/js/web/dagre-VKFMJZFB-8370cb48129c037fd127b9f1e39ea2a9.js.gz +0 -0
  245. package/dist/server/web-ui/_expo/static/js/web/desktop-attachment-bridge-fd825b89c935a0512740145024470f4d.js.gz +0 -0
  246. package/dist/server/web-ui/_expo/static/js/web/desktop-attachment-store-8c0bfc01f75c01be14a9b8e3194d8964.js.gz +0 -0
  247. package/dist/server/web-ui/_expo/static/js/web/diagram-FQU43EPY-8498706cd9b49524f6691758ecae2eb4.js.br +0 -0
  248. package/dist/server/web-ui/_expo/static/js/web/diagram-FQU43EPY-8498706cd9b49524f6691758ecae2eb4.js.gz +0 -0
  249. package/dist/server/web-ui/_expo/static/js/web/diagram-G47NLZAW-597bc7059fc5285e8369a7c885ebe847.js.br +0 -0
  250. package/dist/server/web-ui/_expo/static/js/web/diagram-G47NLZAW-597bc7059fc5285e8369a7c885ebe847.js.gz +0 -0
  251. package/dist/server/web-ui/_expo/static/js/web/diagram-NH7WQ7WH-c2c6b683bd29936bf7d31b3fc2cf621a.js.br +0 -0
  252. package/dist/server/web-ui/_expo/static/js/web/diagram-NH7WQ7WH-c2c6b683bd29936bf7d31b3fc2cf621a.js.gz +0 -0
  253. package/dist/server/web-ui/_expo/static/js/web/diagram-OA4YK3LP-b9b6f76223fd43c88400f013b149d341.js.br +0 -0
  254. package/dist/server/web-ui/_expo/static/js/web/diagram-OA4YK3LP-b9b6f76223fd43c88400f013b149d341.js.gz +0 -0
  255. package/dist/server/web-ui/_expo/static/js/web/diagram-WEI45ONY-754f2b4fbeac3f550acefb7cbbd0c08e.js.br +0 -0
  256. package/dist/server/web-ui/_expo/static/js/web/diagram-WEI45ONY-754f2b4fbeac3f550acefb7cbbd0c08e.js.gz +0 -0
  257. package/dist/server/web-ui/_expo/static/js/web/ebnfDiagram-CCIWWBDH-fdf4e805004091ce5c03abb1c3db051c.js.br +0 -0
  258. package/dist/server/web-ui/_expo/static/js/web/ebnfDiagram-CCIWWBDH-fdf4e805004091ce5c03abb1c3db051c.js.gz +0 -0
  259. package/dist/server/web-ui/_expo/static/js/web/erDiagram-Q63AITRT-a43a5042f4e2c804e1e681caf9ec1a9a.js.br +0 -0
  260. package/dist/server/web-ui/_expo/static/js/web/erDiagram-Q63AITRT-a43a5042f4e2c804e1e681caf9ec1a9a.js.gz +0 -0
  261. package/dist/server/web-ui/_expo/static/js/web/eventmodeling-45OFAUF4-a087e1cea5a1dbfd5543dda165a5deec.js.gz +0 -0
  262. package/dist/server/web-ui/_expo/static/js/web/flowDiagram-23GEKE2U-37fc4906caf7b017a490d14be1fc651f.js.br +0 -0
  263. package/dist/server/web-ui/_expo/static/js/web/flowDiagram-23GEKE2U-37fc4906caf7b017a490d14be1fc651f.js.gz +0 -0
  264. package/dist/server/web-ui/_expo/static/js/web/ganttDiagram-NO4QXBWP-55762209837da2c4e82e6395b527cc77.js.br +0 -0
  265. package/dist/server/web-ui/_expo/static/js/web/ganttDiagram-NO4QXBWP-55762209837da2c4e82e6395b527cc77.js.gz +0 -0
  266. package/dist/server/web-ui/_expo/static/js/web/gitGraph-TEB2WS4Q-dcf4944f6bd6770c7d72148542d13210.js.br +0 -0
  267. package/dist/server/web-ui/_expo/static/js/web/gitGraph-TEB2WS4Q-dcf4944f6bd6770c7d72148542d13210.js.gz +0 -0
  268. package/dist/server/web-ui/_expo/static/js/web/gitGraphDiagram-IHSO6WYX-174e7b61ddcbabfeb5892c447ff93324.js.br +0 -0
  269. package/dist/server/web-ui/_expo/static/js/web/gitGraphDiagram-IHSO6WYX-174e7b61ddcbabfeb5892c447ff93324.js.gz +0 -0
  270. package/dist/server/web-ui/_expo/static/js/web/index-ab103a332d12b791ca2d8630c459db1c.js.br +0 -0
  271. package/dist/server/web-ui/_expo/static/js/web/index-ab103a332d12b791ca2d8630c459db1c.js.gz +0 -0
  272. package/dist/server/web-ui/_expo/static/js/web/indexeddb-attachment-store-6977b09ab1b56a2280e036326e24c5f7.js.gz +0 -0
  273. package/dist/server/web-ui/_expo/static/js/web/info-DKCQHKI2-b203539356a9c56c3389acbb272dbdb6.js.gz +0 -0
  274. package/dist/server/web-ui/_expo/static/js/web/infoDiagram-FWYZ7A6U-2da45c52fdb46101cbc725879fc776ca.js.br +0 -0
  275. package/dist/server/web-ui/_expo/static/js/web/infoDiagram-FWYZ7A6U-2da45c52fdb46101cbc725879fc776ca.js.gz +0 -0
  276. package/dist/server/web-ui/_expo/static/js/web/ishikawaDiagram-FXEZZL3T-b1da9dd4765e6f3378d0d5be1443354b.js.br +0 -0
  277. package/dist/server/web-ui/_expo/static/js/web/ishikawaDiagram-FXEZZL3T-b1da9dd4765e6f3378d0d5be1443354b.js.gz +0 -0
  278. package/dist/server/web-ui/_expo/static/js/web/journeyDiagram-5HDEW3XC-8be414aba07996a355005210e4a4cb94.js.br +0 -0
  279. package/dist/server/web-ui/_expo/static/js/web/kanban-definition-HUTT4EX6-9e57662fb254b84a11dc0a576b6e94e9.js.br +0 -0
  280. package/dist/server/web-ui/_expo/static/js/web/katex-d9fc4f556c2d2a983ed4a8c9e23a1dd9.js.br +0 -0
  281. package/dist/server/web-ui/_expo/static/js/web/mermaid-e774f93ec3cd59dc4ecad4701477430c.js.br +0 -0
  282. package/dist/server/web-ui/_expo/static/js/web/mindmap-definition-LN4V7U3C-7a58ef8b8e2eb9a3e19d2adbb9507a81.js.br +0 -0
  283. package/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-1889954e9a9bec442e274003c294996e.js.br +0 -0
  284. package/dist/server/web-ui/_expo/static/js/web/native-file-attachment-store-1889954e9a9bec442e274003c294996e.js.gz +0 -0
  285. package/dist/server/web-ui/_expo/static/js/web/orchestration-graph-panel-cb9c04891d9d1aae34efd26bb9f2551b.js.br +0 -0
  286. package/dist/server/web-ui/_expo/static/js/web/orchestration-graph-panel-cb9c04891d9d1aae34efd26bb9f2551b.js.gz +0 -0
  287. package/dist/server/web-ui/_expo/static/js/web/packet-7NZHBO7P-b3e37876c15ad5c09649121bec058b0a.js.gz +0 -0
  288. package/dist/server/web-ui/_expo/static/js/web/pegDiagram-2B236MQR-ec32f92e29007730d1ec5cb1f9262526.js.gz +0 -0
  289. package/dist/server/web-ui/_expo/static/js/web/pie-RZYD4A2V-0cff7c6972d3420b6f5567c9ca000364.js.gz +0 -0
  290. package/dist/server/web-ui/_expo/static/js/web/pieDiagram-ENE6RG2P-1fd55d1071310f157f026844ebfae9ef.js.br +0 -0
  291. package/dist/server/web-ui/_expo/static/js/web/pieDiagram-ENE6RG2P-1fd55d1071310f157f026844ebfae9ef.js.gz +0 -0
  292. package/dist/server/web-ui/_expo/static/js/web/quadrantDiagram-ABIIQ3AL-8cc6610d633a7b5c5ec3638a2c7aa2b5.js.br +0 -0
  293. package/dist/server/web-ui/_expo/static/js/web/radar-I7S5WNFK-5778f2584049a7a7d0ceb5f439e8350b.js.gz +0 -0
  294. package/dist/server/web-ui/_expo/static/js/web/railroad-3IZDKUUU-ca56ff1ad41a71a0236a70cf85d6c90e.js.gz +0 -0
  295. package/dist/server/web-ui/_expo/static/js/web/railroad-abnf-AHOZXSZD-db0e4b822aa907a0123e2ff035557340.js.gz +0 -0
  296. package/dist/server/web-ui/_expo/static/js/web/railroad-ebnf-EBAXGLYW-cf7f1831ebb5ea6c207428716b160d6c.js.gz +0 -0
  297. package/dist/server/web-ui/_expo/static/js/web/railroad-peg-LSFZ7HO6-7c20b50c4c8f51c2ffcf4bf35a0a7636.js.br +0 -0
  298. package/dist/server/web-ui/_expo/static/js/web/railroad-peg-LSFZ7HO6-7c20b50c4c8f51c2ffcf4bf35a0a7636.js.gz +0 -0
  299. package/dist/server/web-ui/_expo/static/js/web/railroadDiagram-RFXS5EU6-b757f4db949dc35ae1c47ab3e94a7537.js.br +0 -0
  300. package/dist/server/web-ui/_expo/static/js/web/railroadDiagram-RFXS5EU6-b757f4db949dc35ae1c47ab3e94a7537.js.gz +0 -0
  301. package/dist/server/web-ui/_expo/static/js/web/requirementDiagram-TGXJPOKE-e4f0df6458cf6654ef5fa9dd6d105866.js.br +0 -0
  302. package/dist/server/web-ui/_expo/static/js/web/requirementDiagram-TGXJPOKE-e4f0df6458cf6654ef5fa9dd6d105866.js.gz +0 -0
  303. package/dist/server/web-ui/_expo/static/js/web/sankeyDiagram-HTMAVEWB-351ac8fc52f6092f8670a4eed5500d86.js.br +0 -0
  304. package/dist/server/web-ui/_expo/static/js/web/sankeyDiagram-HTMAVEWB-351ac8fc52f6092f8670a4eed5500d86.js.gz +0 -0
  305. package/dist/server/web-ui/_expo/static/js/web/sequenceDiagram-DBY2YBRQ-bb599498dd8766fee5330d400bce0905.js.br +0 -0
  306. package/dist/server/web-ui/_expo/static/js/web/sizeCapture-X5ZJPWSS-204a0c7899e4f53f494516c2a59f19d7.js.br +0 -0
  307. package/dist/server/web-ui/_expo/static/js/web/sizeCapture-X5ZJPWSS-204a0c7899e4f53f494516c2a59f19d7.js.gz +0 -0
  308. package/dist/server/web-ui/_expo/static/js/web/stateDiagram-2N3HPSRC-90141f3463cbed48ea84769e6a4d2b34.js.br +0 -0
  309. package/dist/server/web-ui/_expo/static/js/web/stateDiagram-v2-6OUMAXLB-76c6daaf6dbf8f2f25178c66b4d31d8b.js.br +0 -0
  310. package/dist/server/web-ui/_expo/static/js/web/stateDiagram-v2-6OUMAXLB-76c6daaf6dbf8f2f25178c66b4d31d8b.js.gz +0 -0
  311. package/dist/server/web-ui/_expo/static/js/web/swimlanes-5IMT3BWC-445936c4472d66f94b005f2b1536e864.js.br +0 -0
  312. package/dist/server/web-ui/_expo/static/js/web/swimlanesDiagram-G3AALYLV-184f47b5e9bfb221d673f668d88adf76.js.br +0 -0
  313. package/dist/server/web-ui/_expo/static/js/web/swimlanesDiagram-G3AALYLV-184f47b5e9bfb221d673f668d88adf76.js.gz +0 -0
  314. package/dist/server/web-ui/_expo/static/js/web/timeline-definition-FHXFAJF6-c5b0064dc55e9cf5b7b8fc9069d2e9f6.js.br +0 -0
  315. package/dist/server/web-ui/_expo/static/js/web/treeView-QDETBFTQ-ed6e58337f84b4dec2e46c640336e569.js.br +0 -0
  316. package/dist/server/web-ui/_expo/static/js/web/treeView-QDETBFTQ-ed6e58337f84b4dec2e46c640336e569.js.gz +0 -0
  317. package/dist/server/web-ui/_expo/static/js/web/treemap-6X3UGDF4-692708563c87ba520d1a998d7d5eea29.js.gz +0 -0
  318. package/dist/server/web-ui/_expo/static/js/web/vennDiagram-L72KCM5P-80fb8735c2ef8627d53a07e9fe88b690.js.br +0 -0
  319. package/dist/server/web-ui/_expo/static/js/web/visualizer-bundle-1c8903c8cecd270f312da5dd4afb1dd8.js.br +0 -0
  320. package/dist/server/web-ui/_expo/static/js/web/visualizer-panel-1e103135cbcfcc99175d1240df666db3.js.br +0 -0
  321. package/dist/server/web-ui/_expo/static/js/web/visualizer-pip-e6783cac3c7464db7248acfcb5738c5f.js.br +0 -0
  322. package/dist/server/web-ui/_expo/static/js/web/wardley-OPB4EBWU-834716fbe0913781631fc4e0a871ffe7.js.gz +0 -0
  323. package/dist/server/web-ui/_expo/static/js/web/wardleyDiagram-EHGQE667-37784a7cbc79aaa235b0fd479ff29a92.js.br +0 -0
  324. package/dist/server/web-ui/_expo/static/js/web/wardleyDiagram-EHGQE667-37784a7cbc79aaa235b0fd479ff29a92.js.gz +0 -0
  325. package/dist/server/web-ui/_expo/static/js/web/xychartDiagram-FW5EYKEG-6923fcfd900a3a3f96b656f01f7d466c.js.br +0 -0
@@ -1 +1 @@
1
- __d(function(t,e,n,o,r,s,a){"use strict";Object.defineProperty(s,'__esModule',{value:!0}),Object.defineProperty(s,"render",{enumerable:!0,get:function(){return _o}});var i=e(a[0]),c=e(a[1]),f=e(a[2]);e(a[3]);var d=e(a[4]),l=e(a[5]);e(a[6]),e(a[7]);var u=e(a[8]),h=e(a[9]),g=e(a[10]),m=e(a[11]),p=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),e.default=t,e})(e(a[12]));async function x(t,n){const o=new p.Graph({multigraph:!0,compound:!0}),r=[...n.edges],s=(0,h.getConfig2)(),i=t.insert("g").attr("class","root"),c=i.insert("g").attr("class","clusters"),d=i.insert("g").attr("class","edges edgePath"),l=i.insert("g").attr("class","edgeLabels"),u=i.insert("g").attr("class","nodes"),g=new Map,m=null!=t.node();await Promise.all(n.nodes.map(async t=>{if(t.isGroup)o.setNode(t.id,Object.assign({},t));else{if(m){const e=await(0,f.insertNode)(u,t,{config:s,dir:t.dir}),n=e.node()?.getBBox()??{width:0,height:0};g.set(t.id,e),t.width=n.width,t.height=n.height}o.setNode(t.id,Object.assign({},t))}}));for(const t of r){o.setEdge(t.start,t.end,Object.assign({},t),t.id);n.edges.some(e=>e.id===t.id)||n.edges.push(t)}if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:o}=await e(a[14])(a[13],a.paths);o(t,n)}return{graph:o,groups:{clusters:c,edgePaths:d,edgeLabels:l,nodes:u,rootGroups:i},nodeElements:g}}(0,m.__name)(x,"createGraphWithElements");var y=5,_=1e-5,b=1e-6;function M(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}function I(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,a=o.x-n.x,i=o.y-n.y,c=r*i-s*a;if(0===c)return null;const f=n.x-t.x,d=n.y-t.y,l=(f*i-d*a)/c,u=(f*s-d*r)/c;return l<=b||l>=.999999||u<=b||u>=.999999?null:{point:{x:t.x+l*r,y:t.y+l*s},tA:l,tB:u}}function S(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}function w(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],r=M(o.points);for(let s=n+1;s<t.length;s++){const n=t[s],a=M(n.points);for(const[t,s]of r.entries())for(const[r,i]of a.entries()){const a=I(s.a,s.b,i.a,i.b);if(!a)continue;const c=S(s);!!(c!==S(i))&&c?e.push({jumpEdgeId:o.id,otherEdgeId:n.id,segIndex:t,t:a.tA,point:a.point}):e.push({jumpEdgeId:n.id,otherEdgeId:o.id,segIndex:r,t:a.tB,point:a.point})}}}return e}function v(t){const e=Math.round(1e3*t)/1e3;return Number.isInteger(e),`${e}`}function L(t){return`${v(t.x)},${v(t.y)}`}function C(t){const e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}(0,m.__name)(M,"buildSegmentList"),(0,m.__name)(I,"segmentIntersection"),(0,m.__name)(S,"isHorizontalSeg"),(0,m.__name)(w,"findEdgeIntersections"),(0,m.__name)(v,"fmt"),(0,m.__name)(L,"pointToString"),(0,m.__name)(C,"getArcSweepFlag");var O=.001;function T(t,e){if(t.length<2)return t.map(t=>Object.assign({},t));const n=t.map(t=>Object.assign({},t)),o=e.arrowTypeStart&&d.markerOffsets[e.arrowTypeStart];if(o){const e=t[0],r=t[1],s=Math.atan2(r.y-e.y,r.x-e.x);n[0].x=e.x+o*Math.cos(s),n[0].y=e.y+o*Math.sin(s)}const r=e.arrowTypeEnd&&d.markerOffsets[e.arrowTypeEnd];if(r){const e=t.length,o=t[e-2],s=t[e-1],a=Math.atan2(s.y-o.y,s.x-o.x);n[e-1].x=s.x-r*Math.cos(a),n[e-1].y=s.y-r*Math.sin(a)}return n}function k(t,e,n,o,r){const s=t.point.x,a=t.point.y,i={x:s-e*t.r,y:a-n*t.r},c={x:s+e*t.r,y:a+n*t.r},f=[`L${L(i)}`];return"arc"===r?f.push(`A${v(t.r)},${v(t.r)} 0 0 ${o} ${L(c)}`):f.push(`M${L(c)}`),f}function N(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,a=n.x-e.x,i=n.y-e.y,c=Math.hypot(r,s),f=Math.hypot(a,i);if(c<_||f<_)return null;const d=r/c,l=s/c,u=a/f,h=i/f,g=d*u+l*h,m=Math.max(-1,Math.min(1,g)),p=Math.acos(m);if(p<_||Math.abs(Math.PI-p)<_)return null;const x=Math.min(o/Math.sin(p/2),c/2,f/2);return{startX:e.x-d*x,startY:e.y-l*x,endX:e.x+u*x,endY:e.y+h*x,ctrlX:e.x,ctrlY:e.y,cutLen:x}}function E(t,e,n){const o=t.points;if(o.length<2)return"";const r=T(o,t),s="rounded"===t.curve,a=M(r),i=new Map;for(const t of e){const e=a[t.segIndex];if(!e)continue;const o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),r=i.get(t.segIndex)??[];r.push({t:t.t,point:t.point,d:t.t*o,r:n.jumpRadius}),i.set(t.segIndex,r)}const c=[`M${L(r[0])}`];for(let t=0;t<a.length;t++){const e=a[t],o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),f=0===o?0:(e.b.x-e.a.x)/o,d=0===o?0:(e.b.y-e.a.y)/o,l=C(e);let u=0;if(s&&t>0){const e=N(r[t-1],r[t],r[t+1]??r[t],y);e&&(u=e.cutLen)}let h=o,g=null;s&&t<a.length-1&&(g=N(r[t],r[t+1],r[t+2]??r[t+1],y),g&&(h=o-g.cutLen));const m=[...i.get(t)??[]].sort((t,e)=>t.t-e.t);for(const t of m)t.r=Math.min(t.r,t.d-u,h-t.d);for(let t=0;t<m.length-1;t++){const e=m[t+1].d-m[t].d;if(m[t].r+m[t+1].r>e){const n=e/2;m[t].r=Math.min(m[t].r,n),m[t+1].r=Math.min(m[t+1].r,n)}}for(const t of m)t.r<O||c.push(...k(t,f,d,l,n.jumpStyle));s&&g?(c.push(`L${v(g.startX)},${v(g.startY)}`),c.push(`Q${v(g.ctrlX)},${v(g.ctrlY)} ${v(g.endX)},${v(g.endY)}`)):c.push(`L${L(e.b)}`)}return c.join(" ")}function R(t){return/^[\d\s+,.LMelm-]*$/.test(t)}function $(t){return!t||("linear"===t||"rounded"===t||"step"===t||"stepBefore"===t||"stepAfter"===t)}function B(t){if(!t)return null;try{const e="function"==typeof atob?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const t of n)t&&"number"==typeof t.x&&"number"==typeof t.y&&o.push({x:t.x,y:t.y});return o.length>=2?o:null}catch{return null}}function F(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const r=new Map;for(const t of e)r.set(t.id,t);const s=[],a=new Map;for(const t of e){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(t.id):t.id,n=o.querySelector(`path[data-id="${e}"]`);if(!n)continue;a.set(t.id,n);const r=B(n.getAttribute("data-points"))??t.points;s.push(Object.assign({},t,{points:r}))}const i=w(s);if(0===i.length)return;const c=new Map;for(const t of i){const e=c.get(t.jumpEdgeId)??[];e.push(t),c.set(t.jumpEdgeId,e)}for(const t of s){const e=c.get(t.id);if(!e||0===e.length)continue;const o=r.get(t.id),s=o?.curve;if(void 0!==s&&!$(s))continue;const i=a.get(t.id);if(!i)continue;if(void 0===s){if(!R(i.getAttribute("d")??""))continue}const f=i.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),l=d?Number.parseFloat(d[1]):null,u=d?Number.parseFloat(d[2]):null,h=E(t,e,n);if(i.setAttribute("d",h),null!==l&&null!==u&&"function"==typeof i.getTotalLength){const t=i.getTotalLength(),e=`0 ${l} ${Math.max(0,t-l-u)} ${u}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${e};`).replace(/;\s*;+/g,";");i.setAttribute("style",n)}}}async function P(t,e){for(const n of t.nodes)n.isGroup?await(0,f.insertCluster)(e.clusters,n):(0,f.positionNode)(n);const n=new Map;for(const e of t.nodes)e?.id&&n.set(e.id,e);for(const o of t.edges){const r=o.start?n.get(o.start)??{}:{},s=o.end?n.get(o.end)??{}:{},a=(0,c.insertEdge)(e.edgePaths,Object.assign({},o),{},t.type,r,s,t.diagramId);o.label&&await(0,c.insertEdgeLabel)(e.rootGroups,o),o.label&&A(o,a)}const o=t.config?.swimlane?.lineHops;if(!1!==o){const n="gap"===o?"gap":"arc",r=t.edges.filter(t=>Array.isArray(t.points)&&t.points.length>=2).map(t=>({id:t.id,points:t.points,curve:t.curve,arrowTypeStart:t.arrowTypeStart,arrowTypeEnd:t.arrowTypeEnd}));F(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:n})}}function A(t,e){const n=e?.updatedPath??e?.originalPath,o=(0,h.getConfig)(),{subGraphTitleTotalMargin:r}=(0,l.getSubGraphTitleMargins)({flowchart:o.flowchart??{}});if(t.label){const o=c.edgeLabels.get(t.id);let s=t.x,a=t.y;if(n){const o=u.utils_default.calcLabelPosition(n);g.log.debug("Moving label "+t.label+" from (",s,",",a,") to (",o.x,",",o.y,") abc88"),e&&(s=o.x,a=o.y)}o.attr("transform",`translate(${s}, ${a+r/2})`)}if(t?.startLabelLeft){const e=c.terminalLabels.get(t.id).startLeft;let o=t?.x,r=t?.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}if(t.startLabelRight){const e=c.terminalLabels.get(t.id).startRight;let o=t.x,r=t.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}if(t.endLabelLeft){const e=c.terminalLabels.get(t.id).endLeft;let o=t.x,r=t.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}if(t.endLabelRight){const e=c.terminalLabels.get(t.id).endRight;let o=t.x,r=t.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}}(0,m.__name)(T,"applyMarkerOffsets"),(0,m.__name)(k,"emitJump"),(0,m.__name)(N,"computeRoundedCorner"),(0,m.__name)(E,"rewriteEdgePath"),(0,m.__name)(R,"isStraightPath"),(0,m.__name)($,"curveSupportsLineHops"),(0,m.__name)(B,"decodeDataPoints"),(0,m.__name)(F,"applyLineJumpsToSvg"),(0,m.__name)(P,"adjustLayout"),(0,m.__name)(A,"positionEdgeLabel");var Y="__swimlane_default__",X=21,G=20;function z(t){return Math.max(t.padding??G,G)}function j(t){const{x:e,y:n,width:o,height:r}=t,s=t.swimlaneContentTop;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof o||"number"!=typeof r||"number"!=typeof s||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(s)||o<=0||r<=0)return void delete t.groupTitleRect;const a=n-r/2,i=Math.min(s,n+r/2),c=a+Math.min(X,Math.max(0,i-a));c<=a?delete t.groupTitleRect:t.groupTitleRect={left:e-o/2,right:e+o/2,top:a,bottom:c}}function D(t){const e=t.direction,n=t.nodes??=[];for(const n of t.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",e&&(n.direction=e));const o=n.filter(t=>!t.isGroup&&!t.parentId);if(0===o.length)return;let r=n.find(t=>t.id===Y);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r=Object.assign({id:Y,label:"",isGroup:!0,shape:"swimlane",padding:20},e?{direction:e}:{}),n.push(r));for(const t of o)t.parentId=Y}function H(t){const e=new Map;for(const n of t.nodes??[])e.set(n.id,n);const n=[];for(const e of t.edges??[]){const t="string"==typeof e.start?e.start:void 0,o="string"==typeof e.end?e.end:void 0;t&&o&&(e.labelNodeId||n.push({id:e.id,src:t,dst:o,ref:e}))}const o=t.nodes??[],r=o.filter(t=>t.isGroup),s=o.filter(t=>!t.isGroup);return{nodes:[...[...r].reverse(),...s].map(t=>t.id),edges:n,layout:t,nodeById:e}}function V(t,e,n,o){const{layout:r}=t,s=t.nodeById,a=o?.layerGap??100,i=o?.nodeGap??40;let c=0;for(const t of e.layers){let e=0;for(const o of t){const t=s.get(o);if(!t){e++;continue}t.layer=c,t.order=e;const r=n.x[o]??e*i,f=n.y[o]??c*a;t.x=r,t.y=f,e++}c++}const f=r.nodes??[],d=new Map,l=[];for(const t of f){if(!t?.isGroup)continue;t.parentId||l.push(t);const e=f.filter(e=>e.parentId===t.id);let o=1/0,r=-1/0,s=1/0,a=-1/0;for(const t of e){const e=t.x??n.x[t.id],i=t.y??n.y[t.id],c=t.width??0,f=t.height??0;null!=e&&null!=i&&(o=Math.min(o,e-c/2),r=Math.max(r,e+c/2),s=Math.min(s,i-f/2),a=Math.max(a,i+f/2))}if(o===1/0||s===1/0)t.x=t.x??0,t.y=t.y??0,t.width=t.width??0,t.height=t.height??0;else{const e=t.padding??20,n=t.parentId?e:2*z(t),i=e,c=Math.max(0,r-o)+n,f=Math.max(0,a-s)+i,l=(o+r)/2,u=(s+a)/2;t.x=l,t.y=u,t.width=c,t.height=f,d.set(t.id,{minX:o,maxX:r,minY:s,maxY:a})}}if(l.length>0&&d.size>0){let t=1/0,e=-1/0,n=0;for(const o of l){const r=o.padding??20;r>n&&(n=r);const s=d.get(o.id);s&&(t=Math.min(t,s.minY),e=Math.max(e,s.maxY))}if(t!==1/0&&e!==-1/0){const o=36,r=Math.max(0,e-t)+2*Math.max(n,o),s=(t+e)/2;for(const e of l)e.y=s,e.height=r,e.swimlaneContentTop=t;const a=[...l].sort((t,e)=>(t.x??0)-(e.x??0)),i=[],c=[],f=[];for(const t of a){const e=d.get(t.id);if(!e)continue;const n=Math.max(0,e.maxX-e.minX)+2*z(t),o=(e.minX+e.maxX)/2;i.push(t.id),c.push(o),f.push(n)}const u=i.length;if(u>0){const t=new Map;if(1===u)t.set(i[0],f[0]);else{const e=[];for(let t=0;t<u-1;t++)e.push(c[t+1]-c[t]);const n=new Array(u);n[0]=0;for(let t=0;t<u-1;t++)n[t+1]=2*e[t]-n[t];let o=0,r=Number.POSITIVE_INFINITY;for(let t=0;t<u;t++){const e=f[t];t%2==0?o=Math.max(o,e-n[t]):r=Math.min(r,n[t]-e)}let s=o;s=o<=r?(o+r)/2:o;for(let e=0;e<u;e++){const o=n[e]+(e%2==0?s:-s),r=Math.max(f[e],o);t.set(i[e],r)}}for(const e of l){const n=t.get(e.id);null!=n&&(e.width=n),j(e)}}}}}(0,m.__name)(z,"topLaneHorizontalPadding"),(0,m.__name)(j,"assignTopLaneTitleRect"),(0,m.__name)(D,"prepareLayoutForSwimlanes"),(0,m.__name)(H,"toGraphView"),(0,m.__name)(V,"writeBackToLayoutData");var W="[EdgeLabelNodes]";function U(t){const e=[],n=[],o=new Map;for(const e of t.nodes)o.set(e.id,e);for(const r of t.edges){if(!r.label||0===r.label.length)continue;if(r.isLayoutOnly)continue;if(r.labelNodeId)continue;const t=r.start?o.get(r.start):void 0,s=r.end?o.get(r.end):void 0;if(!t||!s){g.log.warn(W,`Edge ${r.id} has missing source or target node`);continue}const a=`edge-label-${r.start}-${r.end}-${r.id}`,i=t.parentId!==s.parentId?s.parentId:t.parentId,c=Object.assign({id:a,label:r.label,edgeStart:r.start??"",edgeEnd:r.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:i,isGroup:!1,labelStyle:Array.isArray(r.labelStyle)?r.labelStyle[0]:r.labelStyle??""},t.dir?{dir:t.dir}:{});e.push(c),r.labelNodeId=a,r.label=void 0,r.text=void 0;const f={id:`${r.id}-to-label`,start:r.start,end:a,type:"normal",isLayoutOnly:!0},d={id:`${r.id}-from-label`,start:a,end:r.end,type:"normal",isLayoutOnly:!0};n.push(f,d)}const r=[...t.nodes,...e],s=[...t.edges,...n];return Object.assign({},t,{nodes:r,edges:s})}(0,m.__name)(U,"createEdgeLabelNodes");var q=.001;function J(t){const e=t.x??0,n=t.y??0,o=t.width??0,r=t.height??0;return o>0&&r>0?{cx:e,cy:n,rect:gt(e,n,o,r)}:void 0}function K(t){if(t.isGroup)return;const e=J(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function Z(t,e,n=q){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function Q(t,e,n=q){return Math.abs(t.x-e.x)<n}function tt(t,e,n=q){return Math.abs(t.y-e.y)<n}function et(t,e,n=q){return tt(t,e,n)&&Math.abs(t.x-e.x)>n}function nt(t,e,n=q){return Q(t,e,n)&&Math.abs(t.y-e.y)>n}function ot(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}function rt(t,e,n=q){return t.horizontal&&e.horizontal&&tt(t.a,e.a,n)?ot(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&Q(t.a,e.a,n)?ot(t.a.y,t.b.y,e.a.y,e.b.y):0}function st(t,e=q){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],a=et(r,s,e),i=nt(r,s,e);(a||i)&&n.push({index:o,a:r,b:s,horizontal:a,vertical:i})}return n}function at(t,e=q){const n=st(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function it(t,e=q){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&Z(t,o,e)||n.push({x:o.x,y:o.y})}return n}function ct(t,e=q){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(et(n,o,e)&&nt(o,r,e)&&et(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return nt(n,o,e)&&et(o,r,e)&&nt(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function ft(t,e,n,o=0){const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),a=Math.min(t.y,e.y),i=Math.max(t.y,e.y);return s>n.left-o&&r<n.right+o&&i>n.top-o&&a<n.bottom+o}function dt(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}function lt(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function ut(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function ht(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function gt(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function mt(t){return J(t)?.rect}function pt(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}function xt(t,e,n,o,r,s=q){const a="left"===e||"right"===e,i="left"===o||"right"===o;if(a&&i){if("right"===e&&"left"===o&&t.x<n.x||"left"===e&&"right"===o&&t.x>n.x){if(tt(t,n,s))return[t,n];const e=(t.x+n.x)/2;return[t,{x:e,y:t.y},{x:e,y:n.y},n]}if(e===o){if(tt(t,n,s))return;const o="left"===e?Math.min(t.x,n.x)-r:Math.max(t.x,n.x)+r;return[t,{x:o,y:t.y},{x:o,y:n.y},n]}return}if(!a&&!i){if(e===o){if(Q(t,n,s))return;const o="top"===e?Math.min(t.y,n.y)-r:Math.max(t.y,n.y)+r;return[t,{x:t.x,y:o},{x:n.x,y:o},n]}if(!("bottom"===e&&"top"===o&&t.y<n.y||"top"===e&&"bottom"===o&&t.y>n.y))return;if(Q(t,n,s))return[t,n];const a=(t.y+n.y)/2;return[t,{x:t.x,y:a},{x:n.x,y:a},n]}if(a&&!i){const r="right"===e&&n.x>t.x||"left"===e&&n.x<t.x,s="top"===o&&t.y<n.y||"bottom"===o&&t.y>n.y;return r&&s?[t,{x:n.x,y:t.y},n]:void 0}const c="bottom"===e&&n.y>t.y||"top"===e&&n.y<t.y,f="left"===o&&t.x<n.x||"right"===o&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}function yt(t,e,n,o){return"left"===e||"right"===e?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}function _t(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=K(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function bt(t){const e=[],n=[];for(const o of t){const t=K(o);if(!t)continue;const r={id:t.id,rect:t.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}function Mt(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const t=o.x??0,r=o.y??0,s=o.width??0,a=o.height??0;n.push(Object.assign({nodeId:o.id},gt(t,r,s,a)))}return n}function It(t,e,n=q){const o=t.start,r=t.end;if(!o||!r)return;const s=e.get(o),a=e.get(r);return s&&a?{srcId:o,dstId:r,srcInfo:s,dstInfo:a,collinearX:Math.abs(s.cx-a.cx)<n,collinearY:Math.abs(s.cy-a.cy)<n}:void 0}function St(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&ft(t,e,s.rect,-r))return!0;return!1}function wt(t,e,n,o,r=q,s=1e-6){const a=tt(t,e,r),i=Q(t,e,r),c=tt(n,o,r),f=Q(n,o,r);if(a&&c||i&&f)return!1;if(!a&&!i||!c&&!f)return!1;const d=a?{a:t,b:e}:{a:n,b:o},l=i?{a:t,b:e}:{a:n,b:o},u=d.a.y,h=Math.min(d.a.x,d.b.x),g=Math.max(d.a.x,d.b.x),m=l.a.x,p=Math.min(l.a.y,l.b.y),x=Math.max(l.a.y,l.b.y);if(m<h||m>g||u<p||u>x)return!1;const y=Math.abs(m-d.a.x)<s&&Math.abs(u-d.a.y)<s||Math.abs(m-d.b.x)<s&&Math.abs(u-d.b.y)<s,_=Math.abs(m-l.a.x)<s&&Math.abs(u-l.a.y)<s||Math.abs(m-l.b.x)<s&&Math.abs(u-l.b.y)<s;return!(y&&_)}function vt(t,e,n,o,r=q){const s=tt(t,e,r),a=Q(t,e,r),i=tt(n,o,r),c=Q(n,o,r);return a&&c&&Q(t,n,r)?ot(t.y,e.y,n.y,o.y)>r:!!(s&&i&&tt(t,n,r))&&ot(t.x,e.x,n.x,o.x)>r}function Lt(t,e,n,o,{epsilon:r=q,skipDegenerateOther:s=!1}={}){for(const a of n){if(a===o||a.isLayoutOnly)continue;const n=a.points;if(n&&!(n.length<2))for(let o=0;o<n.length-1;o++){const a=n[o],i=n[o+1];if((!s||!Z(a,i,r))&&(wt(t,e,a,i,r)||vt(t,e,a,i,r)))return!0}}return!1}function Ct(t,e,n,o,r=q){const s=tt(t,e,r),a=Q(t,e,r),i=tt(n,o,r),c=Q(n,o,r);if(!(s&&c||a&&i))return!1;const f=s?{a:t,b:e}:{a:n,b:o},d=s?{a:n,b:o}:{a:t,b:e},l=f.a.y,u=Math.min(f.a.x,f.b.x),h=Math.max(f.a.x,f.b.x),g=d.a.x,m=Math.min(d.a.y,d.b.y),p=Math.max(d.a.y,d.b.y);return g>u+r&&g<h-r&&l>m+r&&l<p-r}function Ot(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+q&&t<r-q}function Tt(t,e,n){return Q(t,e)&&Q(e,n)?Ot(e.y,t.y,n.y):!(!tt(t,e)||!tt(e,n))&&Ot(e.x,t.x,n.x)}function kt(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const r=n[n.length-1],s=t[o],a=o+1<t.length?t[o+1]:void 0;if(r&&a){if(Z(r,a)){o++,e=!0;continue}if(Tt(r,s,a)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function Nt(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!Q(o,r)&&!tt(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&Q(t,o)?{x:o.x,y:r.y}:{x:r.x,y:o.y};e.push(n)}e.push(r)}const n=[];for(const t of e){const e=n[n.length-1];e&&Z(e,t)||n.push(t)}return n}function Et(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=kt(e);if(e=t.points,!t.changed)break}return e}(0,m.__name)(J,"measuredNodeRect"),(0,m.__name)(K,"nodeBoundsInfoFor"),(0,m.__name)(Z,"samePoint"),(0,m.__name)(Q,"sameX"),(0,m.__name)(tt,"sameY"),(0,m.__name)(et,"isHorizontalSegment"),(0,m.__name)(nt,"isVerticalSegment"),(0,m.__name)(ot,"overlapLength"),(0,m.__name)(rt,"sameAxisSegmentOverlapLength"),(0,m.__name)(st,"orthogonalSegmentsForPoints"),(0,m.__name)(at,"countOrthogonalBends"),(0,m.__name)(it,"dedupeConsecutivePoints"),(0,m.__name)(ct,"classifyThreeSegmentRoute"),(0,m.__name)(ft,"segmentBoundsOverlapRect"),(0,m.__name)(dt,"pointInsideRect"),(0,m.__name)(lt,"rectContainsRect"),(0,m.__name)(ut,"rectsOverlap"),(0,m.__name)(ht,"inflateRect"),(0,m.__name)(gt,"rectFromCenterSize"),(0,m.__name)(mt,"rectOfNodeBounds"),(0,m.__name)(pt,"portForRectSide"),(0,m.__name)(xt,"buildOrthogonalPortPath"),(0,m.__name)(yt,"buildSameSideTrackPath"),(0,m.__name)(_t,"collectRealNodeBounds"),(0,m.__name)(bt,"collectNodeRectEntries"),(0,m.__name)(Mt,"collectLayoutNodeRects"),(0,m.__name)(It,"getNodePairGeometry"),(0,m.__name)(St,"segmentHitsAnyRect"),(0,m.__name)(wt,"orthogonalSegmentsCross"),(0,m.__name)(vt,"sameAxisSegmentsOverlap"),(0,m.__name)(Lt,"segmentConflictsWithAnyEdge"),(0,m.__name)(Ct,"orthogonalSegmentsStrictlyCross"),(0,m.__name)(Ot,"strictlyBetween"),(0,m.__name)(Tt,"isCollinearIntermediate"),(0,m.__name)(kt,"simplifyPolylineOnce"),(0,m.__name)(Nt,"orthogonalizePolyline"),(0,m.__name)(Et,"simplifyPolyline");var Rt=.001,$t=.5,Bt=4;function Ft(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const r=o.start?e.get(o.start):void 0,s=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:r?mt(r):void 0,dstRect:s?mt(s):void 0}}function Pt(t,e,n){if(tt(t,e,Rt)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(Q(t,e,Rt)){const e=t.y<n.top?n.top:n.bottom;return{x:t.x,y:e}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}function At(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&dt(t[r],e,$t);)r+=o;if(r<0||r>=t.length)return t;const s=r-o;if(s<0||s>=t.length)return t;const a=Pt(t[r],t[s],e);return n?[a,...t.slice(r)]:[...t.slice(0,r+1),a]}function Yt(t,e){for(const n of t){const t=Ft(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=At(o,t.srcRect,!0)),t.dstRect&&(o=At(o,t.dstRect,!1)),o=Et(Nt(o)),o=Jt(o,t.srcRect,t.dstRect),t.edge.points=Et(Nt(o))}}function Xt(t,e,n,o=!1){if(tt(t,e,Rt)){if(e.y<n.top-Rt||e.y>n.bottom+Rt)return e;if(o){if(t.x<n.left-Rt)return{x:n.left,y:t.y};if(t.x>n.right+Rt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(Q(t,e,Rt)){if(e.x<n.left-Rt||e.x>n.right+Rt)return e;if(o){if(t.y<n.top-Rt)return{x:t.x,y:n.top};if(t.y>n.bottom+Rt)return{x:t.x,y:n.bottom}}const r=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:r?n.top:n.bottom}}return e}function Gt(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!Z(e,o,Rt))return e}return t[e+n]}function zt(t,e){const n=t+Bt,o=e-Bt;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}function jt(t,e,n){const{lo:o,hi:r}=zt(e,n);return Math.min(r,Math.max(o,t))}function Dt(t){const e=Math.max(...t.map(t=>t.lo)),n=Math.min(...t.map(t=>t.hi));if(!(e>n))return{lo:e,hi:n}}function Ht(t,e){return"left"===e||"right"===e?zt(t.top,t.bottom):zt(t.left,t.right)}function Vt(t,e,n){const o=t.y>=n.top-Rt&&t.y<=n.bottom+Rt,r=t.x>=n.left-Rt&&t.x<=n.right+Rt;if(tt(t,e,Rt)&&o){if(Math.abs(t.x-n.left)<Rt)return"left";if(Math.abs(t.x-n.right)<Rt)return"right"}if(Q(t,e,Rt)&&r){if(Math.abs(t.y-n.top)<Rt)return"top";if(Math.abs(t.y-n.bottom)<Rt)return"bottom"}}function Wt(t){return"left"===t||"right"===t}function Ut(t,e,n,o,r){const s=[],a=n?Vt(t,e,n):void 0,i=o?Vt(e,t,o):void 0;return n&&a&&Wt(a)===r&&s.push(Ht(n,a)),o&&i&&Wt(i)===r&&s.push(Ht(o,i)),s.length>0?Dt(s):void 0}function qt(t,e,n,o,r){const s=Ut(t,e,n,o,r);if(!s)return;const a=r?t.y:t.x,i=Math.min(s.hi,Math.max(s.lo,a));return Math.abs(i-a)<Rt?void 0:r?[{x:t.x,y:i},{x:e.x,y:i}]:[{x:i,y:t.y},{x:i,y:e.y}]}function Jt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return tt(o,r,Rt)?qt(o,r,e,n,!0)??t:Q(o,r,Rt)?qt(o,r,e,n,!1)??t:t}function Kt(t,e,n){return Wt(n)?{x:t.x,y:jt(t.y,e.top,e.bottom)}:{x:jt(t.x,e.left,e.right),y:t.y}}function Zt(t,e,n,o,r,s){const a=t.map(t=>Object.assign({},t));for(let i=e;i>=0&&i<t.length;i+=n){const e=t[i];if(s&&!tt(e,o,Rt))break;if(!s&&!Q(e,o,Rt))break;s?a[i].y=r.y:a[i].x=r.x}return a}function Qt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],a=Gt(t,o,r);if(!a)return t;const i=Vt(s,a,e);if(!i)return t;const c=Wt(i),f=Kt(s,e,i);return Z(s,f,Rt)?t:Zt(t,o,r,s,f,c)}function te(t,e,n){const o=Math.min(t.x,e.x)>=n.left-Rt&&Math.max(t.x,e.x)<=n.right+Rt,r=Math.min(t.y,e.y)>=n.top-Rt&&Math.max(t.y,e.y)<=n.bottom+Rt;return Math.abs(t.y-n.top)<Rt&&Math.abs(e.y-n.top)<Rt&&o?"top":Math.abs(t.y-n.bottom)<Rt&&Math.abs(e.y-n.bottom)<Rt&&o?"bottom":Math.abs(t.x-n.left)<Rt&&Math.abs(e.x-n.left)<Rt&&r?"left":Math.abs(t.x-n.right)<Rt&&Math.abs(e.x-n.right)<Rt&&r?"right":void 0}function ee(t,e,n,o){switch(t){case"top":return Q(e,n,Rt)&&n.y<o.top-Rt;case"bottom":return Q(e,n,Rt)&&n.y>o.bottom+Rt;case"left":return tt(e,n,Rt)&&n.x<o.left-Rt;case"right":return tt(e,n,Rt)&&n.x>o.right+Rt}}function ne(t,e,n){if(t.length<3)return t;if(n){const n=te(t[0],t[1],e);return n&&ee(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=te(t[o-1],t[o],e);return r&&ee(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function oe(t,e,n){let o=t;if(e){const t=Gt(o,0,1);if(t){const n=Xt(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=ne(o,e,!0)}if(n){const t=o.length-1,e=Gt(o,t,-1);if(e){const r=Xt(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=ne(o,n,!1)}const r=Jt(o,e,n);return r!==o||2===o.length?r:(e&&(o=Qt(o,e,!0)),n&&(o=Qt(o,n,!1)),o)}function re(t,e){for(const n of t){const t=Ft(n,e,2);if(!t)continue;const o=oe(it(t.points,Rt),t.srcRect,t.dstRect);if(o.length<3){t.edge.points=o;continue}const r=[o[0],Object.assign({},o[0]),...o.slice(1,-1),o[o.length-1],Object.assign({},o[o.length-1])];t.edge.points=r}}function se(t){return new Map(t.map(t=>[t.id,t]))}function ae(t,e){let n=t.parentId,o=null;for(;n;){const t=e.get(n);if(!t?.isGroup)break;o=t.id,n=t.parentId}return o}function ie(t,e){let n=0,o=t.parentId;for(;o;){const t=e.get(o);if(!t?.isGroup)break;n++,o=t.parentId}return n}function ce(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const s of t){const t=s.x,a=s.y;if("number"!=typeof t||"number"!=typeof a)continue;const i=s.width??0,c=s.height??0;e=Math.min(e,t-i/2),n=Math.max(n,t+i/2),o=Math.min(o,a-c/2),r=Math.max(r,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:r}}function fe(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}function de(t){const e=se(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>ie(n,e)-ie(t,e));for(const e of n){const n=ce(t.filter(t=>t.parentId===e.id));n&&fe(e,n)}}function le(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,a=-1/0;for(const t of r){const n=t[e];"number"==typeof n&&(s=Math.min(s,n),a=Math.max(a,n))}if(!Number.isFinite(s)||!Number.isFinite(a))return!1;const i=(0,m.__name)(t=>s+a-t,"mirror");for(const t of n){const n=t[e];"number"==typeof n&&(t[e]=i(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?Object.assign({},o,{left:i(o.right),right:i(o.left)}):Object.assign({},o,{top:i(o.bottom),bottom:i(o.top)}))}for(const t of o)for(const n of t.points??[])n[e]=i(n[e]);return!0}function ue(t){return!(t.nodes??[]).some(t=>!t.isGroup)||le(t,"y")}function he(t,e="LR"){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,a=1/0;for(const t of r){const e=t.x??0,n=t.y??0;e<s&&(s=e),n<a&&(a=n)}if(!Number.isFinite(s)||!Number.isFinite(a))return!1;const i=36;let c=0,f=0;for(const t of r)c+=t.width??0,f+=t.height??0;const d=c/r.length,l=f/r.length,u=l>0?Math.max(1,d/l):1;for(const t of r){const e=t.x??0,n=((t.y??0)-a)*u+i,o=e-s;t.x=n,t.y=o}for(const t of o)if(t.points)for(const e of t.points){const t=e.x,n=(e.y-a)*u+i,o=t-s;e.x=n,e.y=o}de(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&le(t,"x"),!0;const g=se(n),m=new Map;for(const t of n){if(t.isGroup)continue;const e=ae(t,g);if(!e)continue;const n=m.get(e)??[];n.push(t),m.set(e,n)}let p=0;for(const t of h){const e=t.padding??0;e>p&&(p=e)}const x=[];let y=1/0,_=-1/0;for(const t of h){const e=ce(m.get(t.id)??[]);e&&(y=Math.min(y,e.minX),_=Math.max(_,e.maxX),x.push({lane:t,contentTop:e.minY,contentBottom:e.maxY,centerY:(e.minY+e.maxY)/2}))}if(y===1/0||_===-1/0)return!0;const b=Math.max(0,_-y)+2*Math.max(p,10),M=i+b,I=(y+_)/2-b/2-i,S=I+M/2,w=Math.max(p,i);x.sort((t,e)=>t.centerY-e.centerY);for(let t=0;t<x.length;t++){const e=x[t];let n,o;if(0===t)n=e.contentTop-w;else{n=(x[t-1].contentBottom+e.contentTop)/2}if(t===x.length-1)o=e.contentBottom+w;else{const n=x[t+1];o=(e.contentBottom+n.contentTop)/2}const r=Math.max(0,o-n),s=(n+o)/2;e.lane.x=S,e.lane.y=s,e.lane.width=M,e.lane.height=r,e.lane.swimlaneContentTop=e.contentTop,e.lane.groupTitleRect={left:I,right:I+i,top:n,bottom:o}}return"RL"===e&&le(t,"x"),!0}(0,m.__name)(Ft,"endpointContextFor"),(0,m.__name)(Pt,"segmentEnterPoint"),(0,m.__name)(At,"clipEndpoint"),(0,m.__name)(Yt,"clipEdgeEndpointsToNodeBoundaries"),(0,m.__name)(Xt,"snapEndpointToBoundary"),(0,m.__name)(Gt,"firstDistinctAdjacent"),(0,m.__name)(zt,"cornerClearanceRange"),(0,m.__name)(jt,"clampToCornerClearance"),(0,m.__name)(Dt,"intersectRanges"),(0,m.__name)(Ht,"clearanceRangeForSide"),(0,m.__name)(Vt,"terminalSideForSegment"),(0,m.__name)(Wt,"isHorizontalSide"),(0,m.__name)(Ut,"straightClearanceRange"),(0,m.__name)(qt,"clearStraightEndpointCornerAxis"),(0,m.__name)(Jt,"clearStraightEndpointCornerConnections"),(0,m.__name)(Kt,"cornerClearedEndpoint"),(0,m.__name)(Zt,"moveCollinearEndpointRun"),(0,m.__name)(Qt,"clearEndpointCornerConnection"),(0,m.__name)(te,"borderSideForSegment"),(0,m.__name)(ee,"leavesOutward"),(0,m.__name)(ne,"collapseOwnBorderStub"),(0,m.__name)(oe,"snapAndCollapseEndpoints"),(0,m.__name)(re,"prepareEdgeEndpointsForRenderer"),(0,m.__name)(se,"buildNodeMap"),(0,m.__name)(ae,"resolveTopLevelGroupId"),(0,m.__name)(ie,"groupDepth"),(0,m.__name)(ce,"boundsForChildren"),(0,m.__name)(fe,"applyGroupBounds"),(0,m.__name)(de,"recomputeNestedGroupBounds"),(0,m.__name)(le,"mirrorAxis"),(0,m.__name)(ue,"applyBtDirectionTransform"),(0,m.__name)(he,"applyLrDirectionTransform");var ge=1e-6,me=[0,8,-8,16,-16];function pe(t,e){const{nodeInfoById:n,realNodeRects:o}=_t(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=ct(it(r,ge),ge);if(!s)continue;const{p3:a}=s,i="HVH"===s.kind,c=It(e,n,ge);if(!c)continue;const{srcId:f,dstId:d,srcInfo:l,dstInfo:u,collinearX:h,collinearY:g}=c;if(h||g)continue;let m;const p=l.rect;for(const n of me){let r,s,c;if(i){const t=u.cy>l.cy?p.bottom:p.top,e=l.cx+n;if(e<=p.left+ge||e>=p.right-ge)continue;r={x:e,y:t},s={x:e,y:a.y},c={x:a.x,y:a.y}}else{const t=u.cx>l.cx?p.right:p.left,e=l.cy+n;if(e<=p.top+ge||e>=p.bottom-ge)continue;r={x:t,y:e},s={x:a.x,y:e},c={x:a.x,y:a.y}}const h=Z(r,s,ge),g=Z(s,c,ge);if(h&&g)continue;if(!h&&St(r,s,o,[f],1))continue;if(!g&&St(s,c,o,[d],1))continue;const x=!h&&Lt(r,s,t,e,{epsilon:ge,skipDegenerateOther:!0}),y=!g&&Lt(s,c,t,e,{epsilon:ge,skipDegenerateOther:!0});if(!x&&!y){m=h?[s,c]:g?[r,s]:[r,s,c];break}}m&&(e.points=m)}}function xe(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=bt(e.values());for(const s of t){if(s.isLayoutOnly)continue;const a=s.points;if(!a||a.length<4)continue;const i=it(a,n);if(i.length<4)continue;const c=i.length-1,f=i[c],d=i[c-1],l=i[c-2],u=f.x-d.x,h=f.y-d.y,g=Math.hypot(u,h);if(g>=10||g<n)continue;const p=d.x-l.x,x=d.y-l.y;if(Math.hypot(p,x)<n)continue;const y=et(d,f,n),_=nt(d,f,n),b=et(l,d,n),M=nt(l,d,n);if(!(y&&M||_&&b))continue;const I=s.end,S=s.start,w=I?e.get(I):void 0;if(!w)continue;const v=w.x??0,L=w.y??0,C=mt(w);if(!C)continue;let O,T;if(M){const t=x<0;O={x:v,y:l.y},T={x:v,y:t?C.bottom:C.top}}else{const t=p>0;O={x:l.x,y:L},T={x:t?C.right:C.left,y:L}}if(St(O,T,o,I?[I]:[],-2))continue;if(St(O,T,r,[],-2))continue;if(S){const t=e.get(S),n=t?mt(t):void 0;if(n&&dt(O,n,2))continue}const k=(0,m.__name)((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),N=new Set;for(let t=0;t<i.length-1;t++)N.add(k(i[t],i[t+1]));const E=(0,m.__name)((e,o)=>{for(const r of t){if(r===s)continue;if(r.isLayoutOnly)continue;const t=r.points;if(t&&!(t.length<2))for(let r=0;r<t.length-1;r++){const s=t[r],a=t[r+1];if(!N.has(k(s,a))&&Ct(e,o,s,a,n))return!0}}return!1},"segmentCrossesOtherEdge");if(E(O,T))continue;if(c-3>=0){const t=i[c-3];if(St(t,O,o,[S,I].filter(t=>Boolean(t)),-2))continue;if(E(t,O))continue}const R=[...i.slice(0,c-2),O,T];s.points=R;const $=s.labelNodeId;if($){const t=e.get($);if(t){const e=t.width??0,o=t.height??0;if(e>0&&o>0){let r,s,a=-1;for(let t=0;t<R.length-1;t++){const i=R[t],c=R[t+1],f=Math.hypot(c.x-i.x,c.y-i.y),d=tt(i,c,n),l=Q(i,c,n);(d&&f>=e+2||l&&f>=o+2)&&(f>a&&(a=f,r=(i.x+c.x)/2,s=(i.y+c.y)/2))}void 0!==r&&void 0!==s&&(t.x=r,t.y=s)}}}}}(0,m.__name)(pe,"portSwapToLShape"),(0,m.__name)(xe,"collapseShortTerminalStub");var ye=.001,_e=8,be=st,Me=(0,m.__name)((t,e)=>Q(t,e,ye)||tt(t,e,ye),"orthogonallyAligned");function Ie(t,e){const n=(0,m.__name)((t,e)=>{const n=t.x??0,o=t.y??0,r=e.x-n,s=e.y-o;let a=(t.width??0)/2,i=(t.height??0)/2;return Math.abs(s)*a>Math.abs(r)*i?(s<0&&(i=-i),{x:n+(0===s?0:i*r/s),y:o+i}):(r<0&&(a=-a),{x:n+a,y:o+(0===r?0:a*s/r)})},"rectIntersect"),o=(0,m.__name)((t,o)=>{const r=it(t.points??[]);if(r.length<2)return;const s=o?t.start:t.end,a=s?e.get(s):void 0,i=a?mt(a):void 0;if(!a||!s||!i)return;const c=o?r[0]:r[r.length-1],f=o?r[1]:r[r.length-2],d=n(a,c);let l=c;return Me(f,d)&&(l=f),Q(d,l,ye)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"V",coord:d.x,min:Math.min(d.y,l.y),max:Math.max(d.y,l.y),boundary:d,railEnd:l,rect:i}:tt(d,l,ye)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"H",coord:d.y,min:Math.min(d.x,l.x),max:Math.max(d.x,l.x),boundary:d,railEnd:l,rect:i}:void 0},"terminalLaneFor"),r=(0,m.__name)((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),s=(0,m.__name)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;if("H"===t.orientation){return(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&Q(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&tt(t.boundary,e.boundary,1)},"sameTerminalFace"),a=(0,m.__name)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;return r(t,e)>=_e&&Math.abs(t.coord-e.coord)<.5},"exactTerminalLaneConflict"),i=(0,m.__name)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation||"H"!==t.orientation||t.atStart===e.atStart)return!1;const n=r(t,e);if(n<_e)return!1;const o=t.rect.bottom-t.rect.top;return!(n<o||n>2*o)&&(s(t,e)&&Math.abs(t.coord-e.coord)<16)},"nearTerminalLaneConflict"),c=(0,m.__name)((t,e)=>{const n=it(t.edge.points??[]);if(n.length<2)return;const o="V"===t.orientation?{x:t.boundary.x+e,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+e},r="V"===t.orientation?{x:t.railEnd.x+e,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+e};if(!(0,m.__name)(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?tt(o,t.boundary,ye)&&o.x>=t.rect.left+1&&o.x<=t.rect.right-1:(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&(Q(o,t.boundary,ye)&&o.y>=t.rect.top+1&&o.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=n.length>1&&Z(n[1],t.railEnd,ye),s=n.slice(e?2:1),a=s[0];if(a&&!Me(a,r))return;return[o,r,...s]}const s=n.length>1&&Z(n[n.length-2],t.railEnd,ye),a=n.slice(0,s?-2:-1),i=a[a.length-1];return!i||Me(i,r)?[...a,r,o]:void 0},"shiftedCandidate"),f=(0,m.__name)(t=>{const n=t.edge,o=it(n.points??[]);if(2!==o.length)return!1;const r=n.start,s=n.end,a=r?e.get(r):void 0,i=s?e.get(s):void 0;if(!a||!i)return!1;const c=a.x??0,f=a.y??0,d=i.x??0,l=i.y??0,[u,h]=o;return tt(u,h,ye)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||Q(u,h,ye)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),d=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){const e=t.filter(t=>!t.isLayoutOnly).flatMap(t=>[o(t,!0),o(t,!1)]).filter(t=>Boolean(t));let n=!1;for(let t=0;t<e.length&&!n;t++)for(let r=t+1;r<e.length&&!n;r++){const s=e[t],l=e[r];if(s.edge===l.edge||!a(s,l)&&!i(s,l))continue;const u=!a(s,l),h=[s,l].sort((t,e)=>{const n=f(t),o=f(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const r of d){const s=c(t,r);if(!s)continue;const f=o(Object.assign({},t.edge,{points:s}),t.atStart);if(f&&!e.some(e=>e.edge!==t.edge&&(a(f,e)||u&&i(f,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function Se(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=(0,m.__name)((e,r)=>{const s=e.start,a=e.end,i=be(r);if(i.length!==r.length-1)return!1;const c=[s,a].filter(t=>Boolean(t));for(const t of i){if(St(t.a,t.b,n,c,-2))return!1;if(St(t.a,t.b,o,[],-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of i)for(const n of be(it(t))){if(rt(e,n,.5)>=_e)return!1;if(Ct(e.a,e.b,n.a,n.b,ye))return!1}}return!0},"candidateIsSafe"),s=(0,m.__name)((t,e)=>{if(e+4>=t.length)return;const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],a=t[e+4],i=et(n,o)&&nt(o,r)&&et(r,s)&&nt(s,a)&&Q(n,s,ye)&&Q(n,a,ye)&&Q(o,r,ye)&&(o.x-n.x)*(s.x-r.x)<0,c=nt(n,o)&&et(o,r)&&nt(r,s)&&et(s,a)&&tt(n,s,ye)&&tt(n,a,ye)&&tt(o,r,ye)&&(o.y-n.y)*(s.y-r.y)<0;if(i||c)return it([...t.slice(0,e+1),a,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=nt(n,o)&&et(o,r)&&nt(r,s)&&et(s,a)&&nt(a,f)&&Q(n,a,ye)&&Q(n,f,ye)&&Q(r,s,ye)&&(r.x-o.x)*(a.x-s.x)<0,l=et(n,o)&&nt(o,r)&&et(r,s)&&nt(s,a)&&et(a,f)&&tt(n,a,ye)&&tt(n,f,ye)&&tt(r,s,ye)&&(r.y-o.y)*(a.y-s.y)<0;return d||l?it([...t.slice(0,e+1),f,...t.slice(e+6)]):void 0},"withoutDogleg");for(let e=0;e<8;e++){let e=!1;for(const n of t){if(n.isLayoutOnly)continue;const t=it(n.points??[]);for(let o=0;o<=t.length-5;o++){const a=s(t,o);if(a&&r(n,a)){n.points=a,e=!0;break}}if(e)break}if(!e)return}}function we(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,m.__name)((t,e,n)=>it(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,m.__name)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const a=be(s(r[o],t,e));for(let i=o+1;i<r.length;i++){const o=be(s(r[i],t,e));for(const t of a)for(const e of o)Ct(t.a,t.b,e.a,e.b,ye)&&n++}}return n},"strictCrossingCount"),i=(0,m.__name)(t=>{const e=be(t);if(3!==e.length)return;const n=e[1];return e[0].horizontal!==n.horizontal&&e[2].horizontal!==n.horizontal?{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}:void 0},"middleRail"),c=(0,m.__name)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));return n.filter(t=>{if(o.includes(t.id))return!1;const n=t.rect;if(e.horizontal){return ot(e.a.x,e.b.x,n.left,n.right)>=_e&&e.a.y>=n.top-2&&e.a.y<=n.bottom+2}return ot(e.a.y,e.b.y,n.top,n.bottom)>=_e&&e.a.x>=n.left-2&&e.a.x<=n.right+2})},"blockingRectsFor"),f=(0,m.__name)((t,e,n)=>{const o=t.map(t=>Object.assign({},t));if(e.horizontal)o[e.index].y=n,o[e.index+1].y=n;else{if(!e.vertical)return;o[e.index].x=n,o[e.index+1].x=n}const r=Et(it(o));return be(r).length===r.length-1?r:void 0},"candidateByMovingRail"),d=(0,m.__name)((t,e,i)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=be(e);if(f.length!==e.length-1)return!1;for(const t of f){if(St(t.a,t.b,n,c,-2))return!1;if(St(t.a,t.b,o,[],-2))return!1}for(const e of r)if(e!==t)for(const t of f)for(const n of be(s(e)))if(rt(t,n,.5)>=_e)return!1;return a(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e=!1;for(const n of r){const o=s(n),r=i(o);if(!r)continue;const a=c(n,r.segment);if(0===a.length)continue;const l=r.horizontal?[Math.min(...a.map(t=>t.rect.top))-20,Math.max(...a.map(t=>t.rect.bottom))+20]:[Math.min(...a.map(t=>t.rect.left))-20,Math.max(...a.map(t=>t.rect.right))+20];for(const s of l){const a=f(o,r.segment,s);if(a&&d(n,a,t)){n.points=a,e=!0;break}}if(e)break}if(!e)return}}function ve(t,e){const n=(0,m.__name)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,m.__name)(t=>{if(!t.isGroup||t.parentId)return;const e=t.direction,o="string"==typeof e?e.toUpperCase():"";if("LR"===o||"RL"===o||"BT"===o)return;const r=n(t),s=t.y,a=t.height;if(!r||"number"!=typeof s||"number"!=typeof a||!Number.isFinite(s)||!Number.isFinite(a)||a<=0)return;const i=r.right-r.left,c=r.bottom-r.top;return c<=0||i<c?void 0:{node:t,rect:r}},"topLaneTitleFor"),r=(0,m.__name)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+ye||n>=e.bottom-ye)&&ot(t.a.x,t.b.x,e.left,e.right)>=_e},"horizontalSegmentIntersectsTitle"),s=[...e.values()].map(o).filter(t=>Boolean(t));if(0===s.length)return;let a=0;for(const e of t){if(e.isLayoutOnly)continue;const t=it(e.points??[]);for(const e of be(t))for(const t of s)r(e,t.rect)&&(a=Math.max(a,t.rect.bottom-e.a.y+4))}if(!(a<=ye))for(const t of s){const e=t.node.y,n=t.node.height;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.y=e-a/2,t.node.height=n+a,t.node.groupTitleRect=Object.assign({},t.rect,{top:t.rect.top-a,bottom:t.rect.bottom-a}))}}function Le(t,e){const n=(0,m.__name)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,m.__name)(t=>{if(!t.isGroup||t.parentId)return;if("LR"!==t.direction)return;const e=n(t),o=t.x,r=t.width;if(!e||"number"!=typeof o||"number"!=typeof r||!Number.isFinite(o)||!Number.isFinite(r)||r<=0)return;const s=e.right-e.left,a=e.bottom-e.top;return s<=0||a<s?void 0:{node:t,rect:e}},"leftLaneTitleFor"),r=(0,m.__name)((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<=e.left+ye||n>=e.right-ye)&&ot(t.a.y,t.b.y,e.top,e.bottom)>=_e},"verticalSegmentIntersectsTitle"),s=(0,m.__name)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+ye||n>=e.bottom-ye)&&ot(t.a.x,t.b.x,e.left,e.right)>=_e},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(o).filter(t=>Boolean(t));if(0===a.length)return;let i=0;for(const e of t){if(e.isLayoutOnly)continue;const t=it(e.points??[]);for(const e of be(t))for(const t of a)if(r(e,t.rect))i=Math.max(i,t.rect.right-e.a.x+4);else if(s(e,t.rect)){const n=Math.min(e.a.x,e.b.x);i=Math.max(i,t.rect.right-n+4)}}if(!(i<=ye))for(const t of a){const e=t.node.x,n=t.node.width;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.x=e-i/2,t.node.width=n+i,t.node.groupTitleRect=Object.assign({},t.rect,{left:t.rect.left-i,right:t.rect.right-i}))}}function Ce(t,e){const{realNodeRects:n}=bt(e.values()),o=t.filter(t=>!t.isLayoutOnly),r=(0,m.__name)((t,e=new Map)=>it(e.get(t)??t.points??[]),"replacementPointsFor"),s=(0,m.__name)((t=new Map)=>{let e=0;for(let n=0;n<o.length;n++){const s=be(r(o[n],t));for(let a=n+1;a<o.length;a++){const n=be(r(o[a],t));for(const t of s)for(const o of n)Ct(t.a,t.b,o.a,o.b,ye)&&e++}}return e},"crossingCount"),a=(0,m.__name)((t=new Map)=>o.reduce((e,n)=>e+at(r(n,t)),0),"totalBends"),i=(0,m.__name)(t=>{const e=r(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return et(n,o,ye)||nt(n,o,ye)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),c=(0,m.__name)((t,e)=>{const n=r(t);if(n.length<3)return;const o=n[0],s=n[1];let a;if(et(o,s,ye))a={x:s.x,y:e.tailStart.y};else{if(!nt(o,s,ye))return;a={x:e.tailStart.x,y:s.y}}const i=Et(it([o,s,a,e.tailStart,e.terminal]));return be(i).length===i.length-1?i:void 0},"candidateWithDestinationTail"),f=(0,m.__name)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));for(const t of be(e))if(St(t.a,t.b,n,o,-2))return!0;return!1},"pathHasNodeHit"),d=(0,m.__name)((t,e,n)=>{for(const s of o)if(s!==t)for(const t of be(e))for(const e of be(r(s,n)))if(rt(t,e,.5)>=_e)return!0;return!1},"pathHasSharedTrack"),l=(0,m.__name)((t,e,n)=>!f(t,e)&&!d(t,e,n),"candidateIsSafe"),u=(0,m.__name)(()=>{const t=new Map;for(const n of o){const o=n.end;if(!o||!e.has(o))continue;if(r(n).length<4)continue;const s=t.get(o)??[];s.push(n),t.set(o,s)}return t},"edgesByDestination");for(let t=0;t<4;t++){const t=s();if(0===t)return;let e,n=t,o=a();for(const r of u().values())for(let f=0;f<r.length;f++)for(let d=f+1;d<r.length;d++){const u=r[f],h=r[d],g=i(u),m=i(h);if(!g||!m)continue;const p=c(u,m),x=c(h,g);if(!p||!x)continue;const y=new Map([[u,p],[h,x]]);if(!l(u,p,y)||!l(h,x,y))continue;const _=s(y),b=a(y);_>=t||(_>n||_===n&&b>=o||(e=y,n=_,o=b))}if(!e)return;for(const[t,n]of e)t.points=n}}function Oe(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,m.__name)((t,e=new Map)=>it(e.get(t)??t.points??[]),"replacementPointsFor"),a=(0,m.__name)((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=be(s(r[n],t));for(let a=n+1;a<r.length;a++){const n=be(s(r[a],t));for(const t of o)for(const o of n)Ct(t.a,t.b,o.a,o.b,ye)&&e++}}return e},"strictCrossingCount"),i=(0,m.__name)((t=new Map)=>r.reduce((e,n)=>e+at(s(n,t)),0),"totalBends"),c=(0,m.__name)(t=>{const n=t.start,o=t.end,r=n?e.get(n):void 0,s=o?e.get(o):void 0,a=r?mt(r):void 0,i=s?mt(s):void 0;return a&&i?{src:a,dst:i}:void 0},"endpointRectsFor"),f=(0,m.__name)((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=c(t);if(o){if(n.vertical){const r=n.a.x,s=Math.min(o.src.left,o.dst.left),a=Math.max(o.src.right,o.dst.right),i=r<s-ye?"left":r>a+ye?"right":void 0;if(!i)return;return{edge:t,points:e,segmentIndex:n.index,axis:"vertical",side:i,coord:r,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){const r=n.a.y,s=Math.min(o.src.top,o.dst.top),a=Math.max(o.src.bottom,o.dst.bottom),i=r<s-ye?"top":r>a+ye?"bottom":void 0;if(!i)return;return{edge:t,points:e,segmentIndex:n.index,axis:"horizontal",side:i,coord:r,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),d=(0,m.__name)(()=>{const t=[];for(const e of r){const n=s(e);for(const o of be(n)){const r=f(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),l=(0,m.__name)((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&ot(t.min,t.max,e.min,e.max)>=_e,"railsInteract"),u=(0,m.__name)(t=>{const e=[],n=new Set;for(const o of t){if(n.has(o))continue;const r=[o],s=[];for(n.add(o);r.length>0;){const e=r.pop();s.push(e);for(const o of t)!n.has(o)&&l(e,o)&&(n.add(o),r.push(o))}s.length>1&&e.push(s)}return e},"connectedComponents"),h=(0,m.__name)(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<ye)||e.push(n.coord);for(;e.length<t.length;){const n=Math.min(...e),o=Math.max(...e),r=t[0].side;e.push("left"===r||"top"===r?n-12*(t.length-e.length):o+12*(t.length-e.length))}return e},"uniqueCoordsFor"),g=(0,m.__name)(t=>{const e=t.map(t=>t.coord),n=h(t),o=[];if(t.length<=6){const r=new Array(n.length).fill(!1),s=[],a=(0,m.__name)(()=>{if(s.length!==t.length)for(const[t,e]of n.entries())r[t]||(r[t]=!0,s.push(e),a(),s.pop(),r[t]=!1);else s.some((t,n)=>Math.abs(t-e[n])>=ye)&&o.push([...s])},"visit");return a(),o}for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){const r=[...e];[r[t],r[n]]=[r[n],r[t]],o.push(r)}return o},"coordinateAssignmentsFor"),p=(0,m.__name)((t,e)=>{const n=new Map;for(const[o,r]of t.entries()){const t=e[o],s=n.get(r.edge)??r.points.map(t=>({x:t.x,y:t.y}));"vertical"===r.axis?(s[r.segmentIndex].x=t,s[r.segmentIndex+1].x=t):(s[r.segmentIndex].y=t,s[r.segmentIndex+1].y=t),n.set(r.edge,s)}const o=new Map;for(const[t,e]of n){const n=Et(it(e));if(be(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),x=(0,m.__name)(t=>{for(const[e,r]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of be(r)){if(St(e.a,e.b,n,t,-2))return!1;if(St(e.a,e.b,o,[],-2))return!1}}for(let e=0;e<r.length;e++){const n=r[e],o=t.has(n),a=be(s(n,t));for(let n=e+1;n<r.length;n++){const e=r[n];if(!o&&!t.has(e))continue;const i=be(s(e,t));for(const t of a)for(const e of i)if(rt(t,e,.5)>=_e)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=a();if(0===t)return;let e,n=t,o=i(),r=Number.POSITIVE_INFINITY;for(const s of u(d()))for(const c of g(s)){const f=p(s,c);if(!f||!x(f))continue;const d=a(f);if(d>=t)continue;const l=i(f),u=s.reduce((t,e,n)=>t+Math.abs(c[n]-e.coord),0);d>n||d===n&&(l>o||l===o&&u>=r)||(e=f,n=d,o=l,r=u)}if(!e)return;for(const[t,n]of e)t.points=n}}function Te(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,m.__name)((t,e,n)=>it(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,m.__name)(t=>be(t).reduce((t,e)=>{const n=e.a.x-e.b.x,o=e.a.y-e.b.y;return t+Math.hypot(n,o)},0),"pathLength"),i=(0,m.__name)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const a=be(s(r[o],t,e));for(let i=o+1;i<r.length;i++){const o=be(s(r[i],t,e));for(const t of a)for(const e of o)Ct(t.a,t.b,e.a,e.b,ye)&&n++}}return n},"strictCrossingCount"),c=(0,m.__name)((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&ot(t.a.x,t.b.x,e.left,e.right)>=_e}if(t.vertical){const n=t.a.x;return(Math.abs(n-e.left)<1||Math.abs(n-e.right)<1)&&ot(t.a.y,t.b.y,e.top,e.bottom)>=_e}return!1},"segmentRunsAlongRectBorder"),f=(0,m.__name)(t=>{const n=[t.start,t.end].filter(t=>Boolean(t)),o=[];for(const t of n){const n=e.get(t),r=n?mt(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),d=(0,m.__name)((t,e)=>{if(e+3>=t.length)return[];const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],a=et(n,o,ye)&&nt(o,r,ye)&&et(r,s,ye),i=nt(n,o,ye)&&et(o,r,ye)&&nt(r,s,ye);if(!a&&!i)return[];if(!(a?Math.sign(o.x-n.x)!==Math.sign(s.x-r.x):Math.sign(o.y-n.y)!==Math.sign(s.y-r.y)))return[];const c=Q(n,s,ye)||tt(n,s,ye)?[]:[{x:n.x,y:s.y},{x:s.x,y:n.y}],f=0===c.length?[[...t.slice(0,e+1),...t.slice(e+3)]]:c.map(n=>[...t.slice(0,e+1),n,...t.slice(e+3)]),d=new Set;return f.map(t=>Et(it(t))).filter(t=>{if(be(t).length!==t.length-1)return!1;if(!t.some(t=>Z(t,s,ye)))return!1;const e=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!d.has(e)&&(d.add(e),!0)})},"shortcutCandidatesAt"),l=(0,m.__name)((t,e,a)=>{const d=[t.start,t.end].filter(t=>Boolean(t)),l=f(t);for(const t of be(e)){if(St(t.a,t.b,n,d,-2))return!1;if(St(t.a,t.b,o,[],-2))return!1;if(l.some(e=>c(t,e)))return!1}for(const n of r)if(n!==t)for(const t of be(e))for(const e of be(s(n)))if(rt(t,e,.5)>=_e)return!1;return i(t,e)<=a},"candidateIsSafe");for(let t=0;t<8;t++){const t=i();let e,n,o=t,c=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const u of r){const r=s(u),h=at(r,ye),g=a(r);for(let s=0;s<=r.length-4;s++)for(const m of d(r,s)){const r=at(m,ye),s=a(m);if(!(r<h||r===h&&s<g-ye)||!l(u,m,t))continue;const d=i(u,m);d>o||d===o&&(r>c||r===c&&s>=f)||(e=u,n=m,o=d,c=r,f=s)}}if(!e||!n)return;e.points=n}}function ke(t,e){const n=20,o=[];for(const t of e.values()){if(t.isGroup||t.isEdgeLabel)continue;const e=t.x??0,n=t.y??0,r=mt(t);r&&o.push({id:String(t.id??""),cx:e,cy:n,rect:r})}if(0===o.length)return;const r=new Map(o.map(t=>[t.id,t])),s=o.map(t=>({id:t.id,rect:t.rect})),a=["top","bottom","left","right"],i={top:Math.min(...o.map(t=>t.rect.top))-n,bottom:Math.max(...o.map(t=>t.rect.bottom))+n,left:Math.min(...o.map(t=>t.rect.left))-n,right:Math.max(...o.map(t=>t.rect.right))+n},c=t.filter(t=>!t.isLayoutOnly),f=new Map(c.map((t,e)=>[t,e])),d=(0,m.__name)(t=>{const e="left"===t||"top"===t?-1:1,o=[];for(let r=0;r<=2;r++)o.push(i[t]+e*n*r);return o},"outwardTracksForSide"),l=(0,m.__name)((t,e=new Map)=>it(e.get(t)??t.points??[]),"replacementPointsFor"),u=(0,m.__name)((t,e)=>{let n=0;for(const o of t)for(const t of e)Ct(o.a,o.b,t.a,t.b,ye)&&n++;return n},"crossingCountBetweenSegments"),h=(0,m.__name)((t,e)=>u(be(t),be(e)),"crossingCountBetweenPaths"),g=(0,m.__name)((t=new Map)=>{let e=0;const n=[],o=new Set,r=[],s=(0,m.__name)(t=>{o.has(t)||(o.add(t),r.push(t))},"addEdge");for(let o=0;o<c.length;o++){const r=c[o],a=l(r,t);for(let i=o+1;i<c.length;i++){const o=c[i],f=h(a,l(o,t));f>0&&(e+=f,n.push({first:r,second:o,count:f}),s(r),s(o))}}return r.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),{count:e,pairs:n,edgeSet:o,edges:r}},"crossingSnapshot"),p=(0,m.__name)((t,e)=>{const n=new Set(e.keys());if(0===n.size)return t.count;let o=0;for(const e of t.pairs)(n.has(e.first)||n.has(e.second))&&(o+=e.count);let r=0;for(let t=0;t<c.length;t++){const o=c[t],s=n.has(o),a=l(o,e);for(let o=t+1;o<c.length;o++){const t=c[o];(s||n.has(t))&&(r+=h(a,l(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),x=(0,m.__name)(t=>{const e=new Map;for(const n of t.pairs){const t=e.get(n.first)??new Set;t.add(n.second),e.set(n.first,t);const o=e.get(n.second)??new Set;o.add(n.first),e.set(n.second,o)}const n=[],o=new Set;for(const r of t.edges){if(o.has(r))continue;const t=[r],s=[];for(o.add(r);t.length>0;){const n=t.pop();s.push(n);for(const r of e.get(n)??[])o.has(r)||(o.add(r),t.push(r))}s.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),y=(0,m.__name)(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),_=(0,m.__name)(t=>{const e=[];for(const n of x(t)){const t=new Set(n),o=new Set(n.flatMap(t=>y(t))),r=[...n];for(const e of c)t.has(e)||y(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),b=(0,m.__name)((t,e,n)=>p(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),M=(0,m.__name)(t=>{const e=new Map;for(const n of t.pairs)e.set(n.first,(e.get(n.first)??0)+n.count),e.set(n.second,(e.get(n.second)??0)+n.count);return e},"currentCrossingsByEdge"),I=(0,m.__name)(t=>t.slice(1).reduce((e,n,o)=>{const r=t[o];return e+Math.abs(n.x-r.x)+Math.abs(n.y-r.y)},0),"pathLength"),S=(0,m.__name)((t=new Map)=>c.reduce((e,n)=>e+at(l(n,t)),0),"totalBends"),w=(0,m.__name)((t=new Map)=>c.reduce((e,n)=>e+I(l(n,t)),0),"totalLength"),v=(0,m.__name)((t,e,n=new Map)=>{const o=be(e);for(const e of c)if(e!==t)for(const t of o)for(const o of be(l(e,n)))if(rt(t,o,.5)>=_e)return!0;return!1},"pathHasSegmentConflict"),L=(0,m.__name)((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of be(e))if(St(t.a,t.b,s,n,-2))return!0;return!1},"pathHitsNode"),C=(0,m.__name)((t,e)=>{const n=Et(it(e));be(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),O=(0,m.__name)(t=>"left"===t||"right"===t,"sideIsHorizontal"),T=(0,m.__name)((t,e,o)=>{switch(e){case"left":return Math.min(t.x,o.x)-n;case"right":return Math.max(t.x,o.x)+n;case"top":return Math.min(t.y,o.y)-n;case"bottom":return Math.max(t.y,o.y)+n}},"localTrackForSameSide"),k=(0,m.__name)((t,e,o,r)=>{const s="left"===o||"top"===o?-1:1,a=[T(e,o,r),i[o]];for(const i of a)for(let a=0;a<=2;a++)C(t,yt(e,o,r,i+s*n*a))},"addSameSideCandidates"),N=(0,m.__name)((t,e,n,o,r)=>{for(const s of d(n))for(const n of d(r))C(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),E=(0,m.__name)((t,e,n,o,r)=>{for(const s of d(n))for(const n of d(r))C(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),R=(0,m.__name)((t,e,n,o,r)=>{const s=[...d("top"),...d("bottom")];for(const a of d(n))for(const n of d(r))for(const r of s)C(t,[e,{x:a,y:e.y},{x:a,y:r},{x:n,y:r},{x:n,y:o.y},o])},"addHorizontalPairCandidates"),$=(0,m.__name)((t,e,n,o,r)=>{const s=[...d("left"),...d("right")];for(const a of d(n))for(const n of d(r))for(const r of s)C(t,[e,{x:e.x,y:a},{x:r,y:a},{x:r,y:n},{x:o.x,y:n},o])},"addVerticalPairCandidates"),B=(0,m.__name)(t=>{const e=new Set;return t.map(t=>it(t)).filter(t=>{const n=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(e.has(n)||t.length<2)&&(e.add(n),!0)})},"dedupeCandidatePaths"),F=(0,m.__name)((t,e,o,r)=>{const s=[],a=xt(t,e,o,r,n,ye);a&&C(s,a),e===r&&k(s,t,e,o);const i=O(e),c=O(r);return i&&!c?N(s,t,e,o,r):!i&&c?E(s,t,e,o,r):i?R(s,t,e,o,r):$(s,t,e,o,r),B(s)},"buildCandidatesForSides"),P=(0,m.__name)((t,e,n,o)=>{const r=[...d("left"),...d("right")],s=[...d("top"),...d("bottom")];for(const i of a){const a=pt(o,i),c="top"===i||"bottom"===i?d(i):s;for(const o of r){C(t,[e,n,{x:o,y:n.y},{x:o,y:a.y},a]);for(const r of c)C(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:a.x,y:r},a])}}},"addVerticalDepartureOuterTrackCandidates"),A=(0,m.__name)((t,e,n,o)=>{const r=[...d("left"),...d("right")],s=[...d("top"),...d("bottom")];for(const i of a){const a=pt(o,i),c="left"===i||"right"===i?d(i):r;for(const o of s){C(t,[e,n,{x:n.x,y:o},{x:a.x,y:o},a]);for(const r of c)C(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:a.y},a])}}},"addHorizontalDepartureOuterTrackCandidates"),Y=(0,m.__name)(t=>{const e=t.start,n=t.end,o=n?r.get(n):void 0;if(!e||!o)return[];const s=it(t.points??[]);if(s.length<4)return[];const a=s[0],i=s[1],c=[];return nt(a,i,ye)?P(c,a,i,o):et(a,i,ye)&&A(c,a,i,o),c},"terminalPreservingOuterTrackCandidates"),X=(0,m.__name)(t=>{const e=t.start,n=t.end,o=e?r.get(e):void 0,s=n?r.get(n):void 0;if(!o||!s)return[];const i=[];for(const t of a){const e=pt(o,t);for(const n of a)i.push(...F(e,t,pt(s,n),n))}return i.push(...Y(t)),i},"candidatePathsFor"),G=(0,m.__name)(()=>new Map(c.map(t=>[t,be(l(t))])),"currentSegmentsByEdge"),z=(0,m.__name)((t,e,n)=>{const o=new Set;for(const r of c){if(r===t)continue;const s=n.get(r)??be(l(r));e.some(t=>s.some(e=>rt(t,e,.5)>=_e))&&o.add(r)}return o},"sharedTrackConflictsFor"),j=(0,m.__name)((t,e,n,o)=>{const r=new Set;return X(t).map(t=>Et(it(t))).filter(e=>{if(L(t,e))return!1;const n=e.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(r.has(n)||e.length<2)&&(r.add(n),!0)}).map(r=>{const s=be(r);let a=0;for(const e of c)e!==t&&(a+=u(s,n.get(e)??be(l(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+a,bends:at(r,ye),totalBends:at(r),length:I(r)}}).filter(({crossings:t})=>t<=e.count).sort((t,e)=>t.crossings-e.crossings||t.bends-e.bends||t.length-e.length).slice(0,48).map(e=>({path:e.candidate,segments:e.candidateSegments,sharedTrackConflicts:z(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),D=(0,m.__name)((t,e,n,o,r,s)=>{let a=0;for(const n of t.pairs)n.first!==e&&n.second!==e&&n.first!==o&&n.second!==o||(a+=n.count);let i=u(n.segments,r.segments);for(const t of c){if(t===e||t===o)continue;const a=s.get(t)??be(l(t));i+=u(n.segments,a)+u(r.segments,a)}return t.count-a+i},"pairCrossingCount"),H=(0,m.__name)((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),V=(0,m.__name)((t,e)=>t.segments.some(t=>e.segments.some(e=>rt(t,e,.5)>=_e)),"candidatesShareTrack"),W=(0,m.__name)((t,e,n,o)=>H(e,n.edge)&&H(o,t.edge)&&!V(e,o),"pairCandidatesAreCompatible"),U=(0,m.__name)((t,e,n,o,r)=>{const s=D(t.current,e.edge,n,o.edge,r,t.baseSegments);if(!(s>=t.current.count))return{replacements:new Map([[e.edge,n.path],[o.edge,r.path]]),crossings:s,bends:t.currentBends-(t.baseBendsByEdge.get(e.edge)??0)-(t.baseBendsByEdge.get(o.edge)??0)+n.totalBends+r.totalBends,length:t.currentLength-(t.baseLengthByEdge.get(e.edge)??0)-(t.baseLengthByEdge.get(o.edge)??0)+n.length+r.length}},"scorePairReplacement"),q=(0,m.__name)((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),J=(0,m.__name)((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!W(e,o,n,s))continue;const a=U(t,e,o,n,s);a&&q(a,r)&&(r=a)}return r},"bestScoreForOptionPair"),K=(0,m.__name)(t=>{const e=S(),n=w(),o=G(),r=M(t),s=new Map(c.map(t=>[t,at(l(t))])),a=new Map(c.map(t=>[t,I(l(t))])),i=new Map,f=_(t);for(const e of f)for(const n of e){if(i.has(n))continue;const e=j(n,t,o,r);e.length>0&&i.set(n,{edge:n,candidates:e})}let d={replacements:new Map,crossings:t.count,bends:e,length:n};const u={current:t,currentBends:e,currentLength:n,baseBendsByEdge:s,baseLengthByEdge:a,baseSegments:o};for(const e of f){const n=new Set(e.filter(e=>t.edgeSet.has(e))),o=e.map(t=>i.get(t)).filter(t=>Boolean(t));for(let t=0;t<o.length;t++){const e=o[t];for(let r=t+1;r<o.length;r++){const t=o[r];(n.has(e.edge)||n.has(t.edge))&&(d=J(u,e,t,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let t=0;t<4;t++){const t=g(),e=t.count;if(0===e)return;let n,o,r=e,s=Number.POSITIVE_INFINITY;for(const a of t.edges){const i=at(l(a),ye);for(const c of X(a)){const f=L(a,c),d=!f&&v(a,c),l=b(t,a,c),u=at(c,ye);if(f||d)continue;(l<e||l===e&&u<i)&&(l>r||l===r&&u>=s||(n=a,o=c,r=l,s=u))}}if(n&&o){n.points=o;continue}const a=K(t);if(!a)return;for(const[t,e]of a)t.points=e}}(0,m.__name)(Ie,"separateSharedRenderedTerminalLanes"),(0,m.__name)(Se,"collapseRedundantRectangularDoglegs"),(0,m.__name)(we,"liftObstacleHuggingSameSideRails"),(0,m.__name)(ve,"liftTopLaneTitleBandsAboveRails"),(0,m.__name)(Le,"shiftLeftLaneTitleBandsLeftOfRails"),(0,m.__name)(Ce,"swapDestinationTerminalTailsToReduceCrossings"),(0,m.__name)(Oe,"reassignCrossingExternalRailChannels"),(0,m.__name)(Te,"shortcutRedundantOrthogonalJogs"),(0,m.__name)(ke,"resolveRenderedOrthogonalCrossings");var Ne=.001,Ee=8;function Re(t,e){const{nodeInfoById:n,realNodeRects:o}=_t(e),r=["top","bottom","left","right"],s={top:Math.min(...o.map(t=>t.rect.top))-20,bottom:Math.max(...o.map(t=>t.rect.bottom))+20,left:Math.min(...o.map(t=>t.rect.left))-20,right:Math.max(...o.map(t=>t.rect.right))+20},a=(0,m.__name)((t,e,n,o)=>{const r=[],a=xt(t,e,n,o,20,Ne);return a&&r.push(a),e===o&&r.push(yt(t,e,n,s[e])),r},"buildOrthogonalPathCandidates"),i=(0,m.__name)((t,e)=>{for(let n=0;n<t.length-1;n++){if(St(t[n],t[n+1],o,e,1))return!0}return!1},"pathHitsNode"),c=(0,m.__name)((e,n,o=!1)=>{let r=0;const s=st(e,Ne),a=n.start,i=n.end;for(const e of t){if(e===n||e.isLayoutOnly)continue;const t=e.start,c=e.end;if(!o&&a&&i&&(t===a||t===i||c===a||c===i))continue;const f=e.points;if(f&&!(f.length<2))for(const t of s)for(const e of st(f,Ne))(wt(t.a,t.b,e.a,e.b,Ne,Ne)||rt(t,e,Ne)>=Ee)&&r++}return r},"pathConflictCount"),f=(0,m.__name)((t,e)=>{const n=Math.abs(t.y-e.rect.top),o=Math.abs(t.y-e.rect.bottom),r=Math.abs(t.x-e.rect.left),s=Math.abs(t.x-e.rect.right);let a="top",i=n;return o<i&&(a="bottom",i=o),r<i&&(a="left",i=r),s<i&&(a="right",i=s),a},"nearestSideOfRect"),d=new Map,l=(0,m.__name)((t,e,n)=>{const o=d.get(t)??[];o.push({side:e,edgeId:n}),d.set(t,o)},"addFaceClaim");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points??[];if(t.length<1)continue;const o=e.id??"",r=e.start,s=e.end;if(r){const e=n.get(r);e&&l(r,f(t[0],e),o)}if(s){const e=n.get(s);e&&l(s,f(t[t.length-1],e),o)}}const u=(0,m.__name)((t,e,n)=>d.get(t)?.some(t=>t.edgeId!==n&&t.side===e)??!1,"faceIsClaimed");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(!t||t.length<2)continue;const o=at(t,Ne);if(o<4)continue;const s=e.start,h=e.end;if(!s||!h)continue;const g=n.get(s),m=n.get(h);if(!g||!m)continue;const p=e.id??"",x=c(t,e,!0),y=c(t,e);let _,b=x,M=o;for(const t of r){if(u(s,t,p))continue;const n=pt(g,t);for(const o of r){if(u(h,o,p))continue;const r=pt(m,o);for(const f of a(n,t,r,o)){if(i(f,[s,h]))continue;const t=at(f,Ne);if(x>0){const n=c(f,e,!0);if(n>b||n===b&&t>=M)continue;b=n,M=t,_=f;continue}c(f,e)>y||t<M&&(M=t,_=f)}}}if(_){e.points=_;const t=d.get(s);t&&d.set(s,t.filter(t=>t.edgeId!==p));const n=d.get(h);n&&d.set(h,n.filter(t=>t.edgeId!==p)),l(s,f(_[0],g),p),l(h,f(_[_.length-1],m),p)}}}(0,m.__name)(Re,"simplifyDetouredEdges");var $e=.001,Be=10,Fe=7;function Pe(t,e){const n=e?0:t.length-1,o=e?1:-1,r=t[n],s=t[n+o];if(!r||!s)return;const a=s.x-r.x,i=s.y-r.y;if(!(Math.abs(a)+Math.abs(i)<$e)){if(Math.abs(i)<=$e){const t=r.x+Math.sign(a)*Be;return{left:Math.min(r.x,t),right:Math.max(r.x,t),top:r.y-Fe,bottom:r.y+Fe}}if(Math.abs(a)<=$e){const t=r.y+Math.sign(i)*Be;return{left:r.x-Fe,right:r.x+Fe,top:Math.min(r.y,t),bottom:Math.max(r.y,t)}}return{left:Math.min(r.x,s.x),right:Math.max(r.x,s.x),top:Math.min(r.y,s.y),bottom:Math.max(r.y,s.y)}}}function Ae(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}function Ye(t,e){const n=it(e);return[Pe(n,!0),Pe(n,!1)].some(e=>e&&ut(t,Ae(e)))}function Xe(t,e){const n=[];for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(t&&!(t.length<2))for(let o=0;o<t.length-1;o++)n.push({edgeId:e.id,p1:t[o],p2:t[o+1]})}const o=[],r=[];for(const t of e.values()){const e=t.isGroup,n=t.parentId;if(e&&!n){const e=mt(t);e&&r.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const s=mt(t);s&&o.push({nodeId:t.id,rect:s})}const s=(0,m.__name)((t,e)=>{const n=ht(e,3);for(const{nodeId:e,rect:r}of o)if(e!==t&&ut(n,r))return!0;return!1},"labelOverlapsForeignNode"),a=(0,m.__name)((t,e)=>{const o=ht(e,3);for(const e of n)if(e.edgeId!==t&&ft(e.p1,e.p2,o))return!0;return!1},"labelOverlapsForeignEdge"),i=(0,m.__name)((t,e,n)=>s(t,n)||a(e,n),"labelOverlapsAnything"),c=[],f=(0,m.__name)(t=>{for(const{id:e,rect:n}of r)if(lt(n,t))return e},"findContainingLane"),d=(0,m.__name)((t,e)=>c.some(n=>n.labelId!==t&&ut(e,n.rect)),"overlapsPlacedLabel");for(const n of t){if(n.isLayoutOnly)continue;const t=n.labelNodeId;if(!t)continue;const o=e.get(t);if(!o)continue;const l=n.points;if(!l||l.length<2)continue;const u=o.width??0,h=o.height??0;if(u<=0||h<=0)continue;const g=[];for(let t=0;t<l.length-1;t++){const e=l[t],n=l[t+1],o=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);o<$e&&r<$e||(o>=$e&&r>=$e||g.push({idx:t,length:o+r,orientation:o>=$e?"horizontal":"vertical",midX:(e.x+n.x)/2,midY:(e.y+n.y)/2}))}if(0===g.length)continue;const p=g.length>=3?g.filter(t=>t.idx>0&&t.idx<g.length-1):g,x=p.length>0?p:g,y=u>=h?"horizontal":"vertical",_=(0,m.__name)(t=>[...t].sort((t,e)=>{const n=t.orientation===y;if(n!==(e.orientation===y))return n?-1:1;const o=t.length>=("horizontal"===t.orientation?u:h)+2;return o!==e.length>=("horizontal"===e.orientation?u:h)+2?o?-1:1:e.length-t.length}),"rankSegments"),b=g[0],M=g[g.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],S=(0,m.__name)((t,e)=>{const n=l[t.idx],o=l[t.idx+1];return{midX:n.x+(o.x-n.x)*e,midY:n.y+(o.y-n.y)*e}},"anchorAtT"),w=(0,m.__name)((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),v=(0,m.__name)((t,e)=>t.midX>=e.left-$e&&t.midX<=e.right+$e&&t.midY>=e.top-$e&&t.midY<=e.bottom+$e,"pointInsideRectInclusive"),L=(0,m.__name)(t=>{const e=gt(t.midX,t.midY,u,h),n=f(e);if(n)return{laneId:n,anchor:t,rect:e};const o=r.find(({rect:e})=>v(t,e));if(!o)return;const s=o.rect.left+u/2+1,a=o.rect.right-u/2-1,i=o.rect.top+h/2+1,c=o.rect.bottom-h/2-1;if(s>a||i>c)return;const d={midX:w(t.midX,s,a),midY:w(t.midY,i,c)},l=gt(d.midX,d.midY,u,h);return v(t,l)?{laneId:o.id,anchor:d,rect:l}:void 0},"placementForAnchor"),C=(0,m.__name)((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),O=(0,m.__name)((t,e)=>{const n=("horizontal"===t.orientation?u/2:h/2)+12;if(t===b){const o=l[t.idx];if(C(t,e,o)+$e<n)return!1}if(t===M){const o=l[t.idx+1];if(C(t,e,o)+$e<n)return!1}return!0},"labelClearsTerminalEndpoints"),T=(0,m.__name)(e=>{const o=_(e);for(const e of o)for(const o of I){const r=S(e,o);if(!O(e,r))continue;const s=L(r);if(s&&(!Ye(s.rect,l)&&!d(t,s.rect)&&!i(t,n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),k=(0,m.__name)((e,o,r=!1)=>{const i=_(e);for(const e of i){const i={midX:e.midX,midY:e.midY};if(o&&!O(e,i))continue;const c=L(i);if(c&&!Ye(c.rect,l)&&!d(t,c.rect)&&!s(t,c.rect)&&(r||!a(n.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),N=T(x)??(x.length<g.length?T(g):void 0)??k(g,!0)??k(g,!1)??k(g,!1,!0);if(N){o.x=N.anchor.midX,o.y=N.anchor.midY,o.parentId=N.laneId;const e=gt(N.anchor.midX,N.anchor.midY,u,h),n=c.findIndex(e=>e.labelId===t);n>=0?c[n]={labelId:t,rect:e}:c.push({labelId:t,rect:e})}}}(0,m.__name)(Pe,"markerClearanceRectFor"),(0,m.__name)(Ae,"normalizeRect"),(0,m.__name)(Ye,"labelOverlapsOwnMarker"),(0,m.__name)(Xe,"anchorLabelsToPolyline");var Ge=1e-6,ze=4,je=3;function De(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function He(t,e){const{nodeInfoById:n,realNodeRects:o}=_t(e),r=new Map;for(const t of e){const e=t.id;t.isGroup||t.isEdgeLabel&&r.set(e,{w:t.width??0,h:t.height??0})}const s=(0,m.__name)((e,n,o,s)=>{const a=De(n,o);let i=0;const c=(0,m.__name)(t=>{if(!t)return;const e=r.get(t);if(!e)return;const n="x"===s?e.w/2:e.h/2;n>i&&(i=n)},"consider");c(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(De(t,o)===a&&c(n.labelNodeId))}return i>0?i+je:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!ct(e.points,Ge))continue;const r=It(e,n,Ge);if(!r)continue;const{srcId:a,dstId:i,srcInfo:c,dstInfo:f,collinearX:d,collinearY:l}=r;if(d===l)continue;let u,h;if(d){const t=f.cy>c.cy;u={x:c.cx,y:t?c.rect.bottom:c.rect.top},h={x:f.cx,y:t?f.rect.top:f.rect.bottom}}else{const t=f.cx>c.cx;u={x:t?c.rect.right:c.rect.left,y:c.cy},h={x:t?f.rect.left:f.rect.right,y:f.cy}}if(St(u,h,o,[a,i],1))continue;const g=s(e,a,i,d?"x":"y"),m=g>ze?g:ze,p=[0,m,-m];for(const n of p){const r=Object.assign({},u),s=Object.assign({},h);if(d){if(r.x+=n,s.x+=n,r.x<=c.rect.left||r.x>=c.rect.right)continue;if(s.x<=f.rect.left||s.x>=f.rect.right)continue}else{if(r.y+=n,s.y+=n,r.y<=c.rect.top||r.y>=c.rect.bottom)continue;if(s.y<=f.rect.top||s.y>=f.rect.bottom)continue}if(!St(r,s,o,[a,i],1)&&!Lt(r,s,t,e,{epsilon:Ge})){e.points=[r,s];break}}}}function Ve(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=bt(e.values()),s=(0,m.__name)((t,e)=>st(e,n).map(n=>Object.assign({},n,{edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),a=(0,m.__name)(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...s(n,it(t)))}return e},"allSegments"),i=(0,m.__name)((t,e)=>t.horizontal&&e.horizontal?ot(t.a.x,t.b.x,e.a.x,e.b.x)>=8&&Math.abs(t.a.y-e.a.y)<7:!(!t.vertical||!e.vertical)&&(ot(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),c=(0,m.__name)((e,a)=>{const c=e.start,f=e.end,d=s(e,a);if(d.length!==a.length-1)return!1;const l=[c,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(St(t.a,t.b,o,l,-2))return!1;if(St(t.a,t.b,r,u,-2))return!1}for(const o of t){if(o===e||o.isLayoutOnly)continue;const t=o.points;if(t&&!(t.length<2))for(const e of d)for(const r of s(o,it(t))){if(i(e,r))return!1;if(Ct(e.a,e.b,r.a,r.b,n))return!1}}return!0},"candidateIsSafe"),f=(0,m.__name)((t,e)=>{const n=it(t.edge.points??[]);if(n.length<4||t.index>=n.length-1)return;const o=n.map(t=>Object.assign({},t));if(t.horizontal)o[t.index].y+=e,o[t.index+1].y+=e;else{if(!t.vertical)return;o[t.index].x+=e,o[t.index+1].x+=e}return s(t.edge,o).length===o.length-1?o:void 0},"shiftedCandidate"),d=(0,m.__name)((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),l=(0,m.__name)(t=>{const n=t.edge,o=it(n.points??[]);if(4!==o.length||1!==t.index)return;const r=n.start?e.get(n.start):void 0,s=n.end?e.get(n.end):void 0,a=r?mt(r):void 0,i=s?mt(s):void 0,c=o.slice(t.index+2);return r&&s&&a&&i&&0!==c.length?{sourceCenter:d(r,a),targetCenter:d(s,i),sourceRect:a,tail:c}:void 0},"sourceDetourContextFor"),u=(0,m.__name)((t,e,o,r,s,a)=>{const i=r.y>=o.y,c=i?s.bottom:s.top,f=c+(i?20:-20);if(i&&t.b.y<=f+n||!i&&t.b.y>=f-n)return;const d=t.a.x+e;return it([{x:o.x,y:c},{x:o.x,y:f},{x:d,y:f},{x:d,y:t.b.y},...a],n)},"verticalSourceDetour"),h=(0,m.__name)((t,e,o,r,s,a)=>{const i=r.x>=o.x,c=i?s.right:s.left,f=c+(i?20:-20);if(i&&t.b.x<=f+n||!i&&t.b.x>=f-n)return;const d=t.a.y+e;return it([{x:c,y:o.y},{x:f,y:o.y},{x:f,y:d},{x:t.b.x,y:d},...a],n)},"horizontalSourceDetour"),g=(0,m.__name)((t,e)=>{const n=l(t);if(n)return t.vertical?u(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):t.horizontal?h(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):void 0},"sourceDetourCandidate"),p=[-7,7,-14,14,-21,21];for(let t=0;t<12;t++){const t=a();let e=!1;for(let n=0;n<t.length&&!e;n++)for(let o=n+1;o<t.length&&!e;o++){const r=t[n],s=t[o];if(r.edge===s.edge||!i(r,s))continue;const a=[r,s].filter(t=>t.interior);for(const t of a){for(const n of p){const o=f(t,n);if(o&&c(t.edge,o)){t.edge.points=o,e=!0;break}const r=g(t,n);if(r&&c(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function We(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,a=o.x-n.x,i=o.y-n.y,c=r*i-s*a;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,d=n.y-t.y,l=(f*i-d*a)/c,u=(f*s-d*r)/c;return l>.01&&l<.99&&u>.01&&u<.99}function Ue(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const r=Mt(e),s=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,a=t.end,i=t.labelNodeId,c=t.id??`${n}->${a}`;for(const t of r)if(t.nodeId!==n&&t.nodeId!==a&&(!i||t.nodeId!==i))for(let n=0;n<e.length-1;n++)if(ft(e[n],e[n+1],t,-1)){o.push({type:"edge-node-overlap",edgeId:c,targetId:t.nodeId,detail:`segment ${n} passes through node "${t.nodeId}"`});break}for(let t=0;t<e.length-1;t++)s.push({edgeId:c,start:n,end:a,p1:e[t],p2:e[t+1]})}const a=new Set;for(let t=0;t<s.length;t++)for(let e=t+1;e<s.length;e++){const n=s[t],r=s[e];if(n.edgeId!==r.edgeId&&(n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&We(n.p1,n.p2,r.p1,r.p2))){const t=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;a.has(t)||(a.add(t),o.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(o.length>0){const t=o.filter(t=>"edge-node-overlap"===t.type).length,e=o.filter(t=>"edge-edge-crossing"===t.type).length;g.log.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of o)g.log.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return o}function qe(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&r.length>0&&!he(t,e))return;if("BT"===e&&r.length>0&&!ue(t))return;for(const t of o){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=Et(Nt(e)))}Re(o,n),He(o,n),pe(o,n);const s=new Map;for(const t of n)s.set(String(t.id),t);Xe(o,s),Yt(o,s),xe(o,s),Ve(o,s),Ie(o,s),Se(o,s),we(o,s),Ce(o,s);const a=(0,m.__name)(()=>{ke(o,s),Oe(o,s),Te(o,s),Xe(o,s),re(o,s),we(o,s),Xe(o,s),re(o,s)},"finalizeRenderedEdges");a(),Ve(o,s),a(),ve(o,s),Le(o,s),ve(o,s),Le(o,s)}function Je(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const t=`${r.id}:${r.src}->${r.dst}`;n.has(t)||(n.add(t),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}function Ke(t,e){return t.edges.filter(t=>t.dst===e)}function Ze(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}function Qe(t){const e=Ze(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function tn(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}function en(t){return[...t.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e))}function nn(t,e=()=>!0){const n=new Map,o=new Map;for(const e of t.nodes)n.set(e,[]),o.set(e,[]);for(const r of t.edges)e(r)&&(o.get(r.src).push(r.dst),n.get(r.dst).push(r.src));return{preds:n,succs:o}}function on(t,e,n,o){let r=0;for(const e of t.nodes)o?.skipGroups&&t.nodeById.get(e)?.isGroup||(r=Math.max(r,n[e]??0));const s=Array.from({length:r+1},()=>[]);for(const r of e)o?.skipGroups&&t.nodeById.get(r)?.isGroup||s[Math.max(0,n[r]??0)].push(r);return s}function rn(t){const e=tn(t),n=en(e),o=[],r=Qe(t);for(;n.length;){const t=n.shift();o.push(t);for(const o of r.get(t)??[])if(e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)){let t=0;for(;t<n.length&&n[t]<o;)t++;n.splice(t,0,o)}}return o.length===t.nodes.length?o:null}function sn(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function an(t){const e=new Array(t.length),n=(0,m.__name)((o,r)=>{if(r-o<=1)return 0;const s=o+r>>1;let a=n(o,s)+n(s,r),i=o,c=s,f=o;for(;i<s||c<r;)c>=r||i<s&&t[i]<=t[c]?e[f++]=t[i++]:(e[f++]=t[c++],a+=s-i);for(let n=o;n<r;n++)t[n]=e[n];return a},"count");return n(0,t.length)}function cn(t){const e=Je(t),n=new Map;for(const t of e.nodes)n.set(t,[]);for(const t of e.edges)n.get(t.src).push(t);for(const t of n.values())t.sort((t,e)=>t.dst===e.dst?t.id.localeCompare(e.id):t.dst.localeCompare(e.dst));const o=Object.create(null);for(const t of e.nodes)o[t]=0;const r=[],s=(0,m.__name)(t=>{o[t]=1;for(const e of n.get(t)??[]){const t=e.dst;0===o[t]?s(t):1===o[t]&&r.push(e)}o[t]=2},"dfs"),a=[...e.nodes].sort((t,e)=>t.localeCompare(e));for(const t of a)0===o[t]&&s(t);const i=new Set(r.map(t=>`${t.id}:${t.src}->${t.dst}`)),c=e.edges.map(t=>i.has(`${t.id}:${t.src}->${t.dst}`)?{id:t.id,src:t.dst,dst:t.src,weight:t.weight,ref:t.ref}:t);return{acyclic:{nodes:[...e.nodes],edges:c,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:r}}function fn(t){const e=new Map,n=(0,m.__name)(o=>{if(e.has(o))return e.get(o);const r=t.nodeById.get(o);if(!r)return e.set(o,null),null;const s=r.parentId;if(!s)return e.set(o,null),null;const a=n(s)??s;return e.set(o,a),a},"resolve");for(const e of t.nodes)n(e);return e}function dn(t){const e=fn(t);return t=>e.get(t)??null}function ln(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function un(t,e){const n=ln(t);if(!e||0===e.length)return n;const o=new Set(n),r=new Set,s=[];for(const t of e)o.has(t)&&!r.has(t)&&(r.add(t),s.push(t));for(const t of n)r.has(t)||s.push(t);return s}(0,m.__name)(De,"pairKey"),(0,m.__name)(He,"straightenCollinearSiblingDetours"),(0,m.__name)(Ve,"nudgeSharedInteriorSubpaths"),(0,m.__name)(We,"segmentsIntersect"),(0,m.__name)(Ue,"validateSwimlanesLayout"),(0,m.__name)(qe,"postProcessSwimlaneLayout"),(0,m.__name)(Je,"normalizeGraph"),(0,m.__name)(Ke,"incoming"),(0,m.__name)(Ze,"buildSuccessorMap"),(0,m.__name)(Qe,"buildSortedSuccessorMap"),(0,m.__name)(tn,"buildInDegreeMap"),(0,m.__name)(en,"sortedZeroInDegreeNodes"),(0,m.__name)(nn,"buildPredecessorSuccessorMaps"),(0,m.__name)(on,"buildLayersFromRanks"),(0,m.__name)(rn,"topoSortIfAcyclic"),(0,m.__name)(sn,"buildLayerIndex"),(0,m.__name)(an,"countInversions"),(0,m.__name)(cn,"removeCycles_DFS"),(0,m.__name)(fn,"buildTopLaneMap"),(0,m.__name)(dn,"createTopLaneResolver"),(0,m.__name)(ln,"buildTopLaneOrder"),(0,m.__name)(un,"resolveTopLaneOrder");var hn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},gn={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function mn(t,e){const n=Je(t),o=e?.laneOf??(()=>null),r=e?.rankHint,{preds:s}=nn(n);for(const t of s.values())t.sort((t,e)=>t.localeCompare(e));const a=rn(n)??[...n.nodes].sort((t,e)=>t.localeCompare(e)),i=new Map;for(const[t,e]of a.entries())i.set(e,t);const c=new Map,f=new Map;for(const t of n.nodes)f.set(t,[]);for(const t of a){const e=(s.get(t)??[]).filter(t=>c.has(t));if(e.length>0){const n=pn(t,e,{laneOf:o,rankHint:r,topoIndex:i});c.set(t,n),f.get(n).push(t)}else c.has(t)||c.set(t,null)}for(const t of n.nodes)c.has(t)||c.set(t,null);const d=new Set;for(const t of n.nodes)null===(c.get(t)??null)&&d.add(t);const l=[...d].sort((t,e)=>{const n=i.get(t)??0,o=i.get(e)??0;return n===o?t.localeCompare(e):n-o}),u=xn(n),h=new Map;for(const[t,e]of u.entries())h.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const g=yn(h),p=_n(h),x=new Map;for(const t of n.nodes)x.set(t,[]);for(const t of p)for(const e of t.nodes){const n=x.get(e);n?n.push(t.id):x.set(e,[t.id])}const y=[],_=[],b=new Set,M=(0,m.__name)(t=>{if(!b.has(t)){b.add(t),y.push(t);for(const e of f.get(t)??[])M(e);_.push(t)}},"walk");for(const t of l)M(t);for(const t of a)M(t);return{parent:c,children:f,roots:l,componentOf:g,blocks:p,nodeBlocks:x,adjacency:h,preorder:y,postorder:_,topologicalOrder:a}}function pn(t,e,n){const o=n.laneOf(t);return[...e].sort((t,e)=>{const r=n.laneOf(t),s=n.laneOf(e),a=null!=r&&r===o;if(a!==(null!=s&&s===o))return a?-1:1;const i=n.rankHint?.[t],c=n.rankHint?.[e];if(null!=i&&null!=c&&i!==c)return c-i;const f=n.topoIndex.get(t)??0,d=n.topoIndex.get(e)??0;return f!==d?f-d:t.localeCompare(e)})[0]}function xn(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}function yn(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const r=[o];for(;r.length>0;){const o=r.pop();if(!e.has(o)){e.set(o,n);for(const n of t.get(o)??[])e.has(n)||r.push(n)}}n++}return e}function _n(t){const e=new Map,n=new Map,o=[],r=[];let s=0;const a=(0,m.__name)((i,c)=>{e.set(i,++s),n.set(i,s);for(const f of t.get(i)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(i)??0)&&(o.push([i,f]),n.set(i,Math.min(n.get(i)??s,e.get(f)??s))):(o.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??s,n.get(f)??s)),(n.get(f)??0)>=(e.get(i)??0)&&r.push(bn(i,f,o,r.length))))},"visit");for(const n of t.keys())e.has(n)||a(n,null);return r}function bn(t,e,n,o){const r=[],s=new Set;for(;n.length>0;){const o=n.pop();if(r.push(o),s.add(o[0]),s.add(o[1]),o[0]===t&&o[1]===e||o[0]===e&&o[1]===t)break}return{id:o,edges:r,nodes:[...s]}}function Mn(t,e,n){const o=[...t.nodes],r=new Map;for(const[t,e]of o.entries())r.set(e,t);const s=o.length,a=new Array(s).fill(-1),i=new Array(s).fill(0),c=[],f=new Set;for(const t of o){const e=n.parent.get(t)??null,o=r.get(t);null!=o&&(null==e&&(a[o]=-1,i[o]=0,f.has(t)||(f.add(t),c.push(t))))}for(;c.length>0;){const t=c.shift(),e=r.get(t);if(null==e)continue;const o=n.children.get(t)??[];for(const t of o){if(f.has(t))continue;const n=r.get(t);null!=n&&(a[n]=e,i[n]=i[e]+1,f.add(t),c.push(t))}}for(const t of o){if(f.has(t))continue;const e=r.get(t);null!=e&&(a[e]=-1,i[e]=0,f.add(t))}const d=Math.max(1,Math.ceil(Math.log2(Math.max(1,s)))+1),l=Array.from({length:d},()=>new Array(s).fill(-1));for(let t=0;t<s;t++)l[0][t]=a[t];for(let t=1;t<d;t++)for(let e=0;e<s;e++){const n=l[t-1][e];l[t][e]=-1===n?-1:l[t-1][n]}const u=(0,m.__name)((t,e)=>{if(-1===t||-1===e)return-1;i[t]<i[e]&&([t,e]=[e,t]);const n=i[t]-i[e];for(let e=0;e<d;e++)if(n>>e&1&&-1===(t=l[e][t]))return-1;if(t===e)return t;for(let n=d-1;n>=0;n--){const o=l[n][t],r=l[n][e];-1!==o&&-1!==r&&(o!==r&&(t=o,e=r))}return l[0][t]},"lcaIndex"),h=Array.from({length:s},()=>new Map);for(const n of t.edges){let t=n.src,o=n.dst,s=e[t],a=e[o];if(null==s||null==a)continue;if(s>a&&([t,o]=[o,t],[s,a]=[a,s]),null==s||null==a||s===a)continue;const i=r.get(t),c=r.get(o);if(null==i||null==c)continue;const f=u(i,c);if(-1===f)continue;const d=h[f];for(let t=s;t<a;t++)d.set(t,(d.get(t)??0)+1)}const g=new Map,p=(0,m.__name)((t,e)=>{if(0!==e.size)for(const[n,o]of e)t.set(n,(t.get(n)??0)+o)},"mergeInto"),x=new Set,y=(0,m.__name)(t=>{const o=r.get(t);x.add(t);const s=null==o?void 0:h[o],a=s?new Map(s):new Map,i=n.children.get(t)??[];for(const n of i){const o=y(n),r=e[t];if(null!=r){let s=g.get(t);s||(s=new Map,g.set(t,s));let a=o.get(r)??0;const i=e[n];null!=i&&i>r&&(a+=1),s.set(n,a)}p(a,o)}return a},"dfs");for(const t of n.roots)x.has(t)||y(t);for(const t of o)x.has(t)||y(t);return g}function In(t,e,n){const o=new Map,r=(0,m.__name)(t=>{let s=n[t]??0;const a=[...e.get(t)??[]];a.sort(Sn(n));for(const t of a){r(t);const e=o.get(t);null!=e&&(s=Math.min(s,e))}o.set(t,s)},"annotate");for(const e of t)r(e);return o}function Sn(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function wn(t,e,n,o){let r=0;for(const t of e){const e=n[t]??0;e>r&&(r=e)}const s=Array.from({length:r+1},()=>[]),a=new Set,i=(0,m.__name)(t=>{if(a.has(t))return;a.add(t);const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t);for(const e of o(t))i(e)},"emit");for(const e of t)i(e);for(const t of e)if(!a.has(t)){const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t),a.add(t)}return s}function vn(t){const e=[];for(const n of t){const t=new Set,o=[];for(const e of n)t.has(e)||(t.add(e),o.push(e));e.push(o)}return e}function Ln(t,e,n,o){return r=>{const s=t.get(r)??[];if(0===s.length)return[];const a=e[r]??0,i=[],c=[],f=n.get(r);for(const t of s){const e=o.get(t)??a;e>a?i.push({child:t,min:e}):c.push(t)}return i.sort((t,e)=>t.min===e.min?t.child.localeCompare(e.child):t.min-e.min),c.sort((t,e)=>{const n=f?.get(t)??0,r=f?.get(e)??0;if(n!==r)return n-r;const s=o.get(t)??a,i=o.get(e)??a;return s!==i?s-i:t.localeCompare(e)}),[...i.map(t=>t.child),...c]}}function Cn(t,e,n){const o=mn(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const a=Mn(t,e,o),i=[...s].sort(Sn(e)),c=Ln(r,e,a,In(i,r,e));let f=wn(i,t.nodes,e,c);return f=vn(f),f}function On(t,e,n){const o=new Set(t),r=new Set(e),s=sn(e),a=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&a.push(s.get(t.dst));return an(a)}function Tn(t,e,n){const o=[];for(const t of e){const e=n[t.src],r=n[t.dst];if(null==e||null==r||e===r)continue;let s=t.src,a=t.dst,i=e,c=r;e>r&&(s=t.dst,a=t.src,i=r,c=e);for(let e=i;e<c;e++)o.push({id:`${t.id}@${e}`,src:s,dst:a,ref:t.ref})}let r=0;for(let e=0;e+1<t.length;e++)r+=On(t[e],t[e+1],o);return r}function kn(t,e){const n=Object.assign({},e),{preds:o}=nn(t),r=dn(t);let s=Tn(Cn(t,n,r),t.edges,n);const a=hn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let e=0;e<a;e++){let e=!1;const a=[...t.nodes].sort((t,e)=>(n[e]??0)-(n[t]??0));for(const i of a){const a=n[i]??0;if(0===a)continue;let c=0;for(const t of o.get(i)??[])c=Math.max(c,(n[t]??0)+1);if(c>=a)continue;const f=a;n[i]=c;const d=Tn(Cn(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[i]=f}if(!e)break}return n}function Nn(t,e){const n=dn(t),o=[...t.nodes].sort((t,n)=>(e[t]??0)-(e[n]??0)||t.localeCompare(n));for(const r of o){const o=n(r);if(!o)continue;const s=t.edges.filter(t=>t.src===r);if(0===s.length)continue;let a=!1,i=0;for(const t of s){const e=n(t.dst);null==e||e===o?a=!0:i++}if(0===i||a)continue;let c=0,f=!1;for(const e of t.edges){if(e.dst!==r)continue;const t=n(e.src);t&&(t===o?f=!0:c++)}if(c>0||!f)continue;const d=e[r]??0,l=d+i;let u=0;for(const n of t.edges)n.dst===r&&(u=Math.max(u,(e[n.src]??0)+1));const h=Math.max(d,u,l);h!==d&&(e[r]=h)}}function En(t,e){const n=Je(t),o=rn(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=dn(n);let a=Object.create(null);for(const t of o){const o=Ke(n,t),i=e?.ignoreCrossLaneEdges?o.filter(e=>{const n=s(e.src),o=s(t);return!n||!o||n===o}):o;if(0===i.length)a[t]=0;else if(r&&1===i.length){const e=i[0].src,n=s(e),o=s(t);a[t]=n!==o?a[e]??0:(a[e]??0)+1}else{let e=-1/0;for(const t of i)e=Math.max(e,(a[t.src]??0)+1);a[t]=e===-1/0?0:e}}e?.optimizeRanksByCrossings&&(a=kn(n,a)),e?.ignoreCrossLaneEdges&&Nn(n,a);return{layers:Cn(n,a,s),rankOf:a,dummy:new Set}}function Rn(t,e){const n=Je(t),o=En(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}),r=Object.assign({},o.rankOf),s=dn(n),{preds:a,succs:i}=nn(n,t=>{if(e?.ignoreCrossLaneEdges){const e=s(t.src),n=s(t.dst);if(e&&n&&e!==n)return!1}return!0}),c=rn(n)??[...n.nodes],f=[...c].reverse(),d=(0,m.__name)((t,e)=>{let n=0;for(const e of a.get(t)??[])n=Math.max(n,(r[e]??0)+1);let o=Number.POSITIVE_INFINITY;const s=i.get(t)??[];return s.length>0&&(o=Math.min(...s.map(t=>(r[t]??0)-1))),Number.isFinite(o)||(o=Math.max(n,e)),Math.min(Math.max(e,n),o)},"clampFeasible"),l=hn.GRAVITY_ITERATIONS,u=(0,m.__name)(t=>{let e=!1;for(const n of t){const t=a.get(n)??[],o=i.get(n)??[];if(0===t.length&&0===o.length)continue;const s=t.length>0?t.reduce((t,e)=>t+(r[e]??0)+1,0)/t.length:r[n]??0,c=o.length>0?o.reduce((t,e)=>t+(r[e]??0)-1,0)/o.length:r[n]??0,f=Math.round((s+c)/2),l=d(n,f);l!==r[n]&&(r[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<l;t++){const t=u(c),e=u(f);if(!t&&!e)break}for(const t of c){let e=0;for(const n of a.get(t)??[])e=Math.max(e,(r[n]??0)+1);(r[t]??0)<e&&(r[t]=e)}for(const t of f){const e=i.get(t)??[];if(e.length>0){const n=Math.min(...e.map(t=>(r[t]??0)-1));(r[t]??0)>n&&(r[t]=n)}}return{layers:on(n,c,r),rankOf:r,dummy:new Set}}function $n(t){const e=tn(t),n=Qe(t);let o=en(e);const r=[];for(;o.length>0;){const t=[];for(const s of o){r.push(s);for(const o of n.get(s)??[])e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)&&t.push(o)}o=t.sort((t,e)=>t.localeCompare(e))}return r.length===t.nodes.length?r:null}function Bn(t,e){const n=Je(t),o="LR"===e?.direction?$n(n)??[...n.nodes].sort():rn(n)??[...n.nodes].sort(),r=dn(n),s=(0,m.__name)(t=>r(t)??t,"laneOf"),a=Object.create(null),i=new Map,c=(0,m.__name)((t,n)=>e?.ignoreCrossLaneEdges??!0?s(t)===s(n)?1:0:1,"edgeWeight");for(const t of o){const e=n.nodeById.get(t);if(e?.isGroup)continue;const o=Ke(n,t);let r=0;if(o.length>0)for(const e of o){const n=e.src,o=a[n]??0;r=Math.max(r,o+c(n,t))}const f=s(t),d=i.get(f)??0,l=Math.max(r,d);a[t]=l,i.set(f,l+1)}return{layers:on(n,o,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function Fn(t,e){const n=Je(e),{rankOf:o}=t,r=t.layers.map(t=>[...t]),s=new Set(t.dummy?[...t.dummy]:[]);let a=0;const i=new Map(n.nodeById),c=(0,m.__name)(t=>{const e="placeholder-"+a++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(i.set(e,n),s.add(e);r.length<=t;)r.push([]);return r[t].push(e),o[e]=t,e},"addDummyAt"),f=[...n.edges].sort((t,e)=>t.id===e.id?t.src===e.src?t.dst.localeCompare(e.dst):t.src.localeCompare(e.src):t.id.localeCompare(e.id)),d=[];for(const t of f){const e=o[t.src]??0,n=o[t.dst]??0;if(n-e<=1){d.push(t);continue}let r=t.src;for(let o=e+1,s=0;o<n;o++,s++){const e=c(o);d.push({id:`${t.id}#${s}`,src:r,dst:e,weight:t.weight,ref:t.ref}),r=e}const s=n-e-2;d.push({id:`${t.id}#${Math.max(s+1,0)}`,src:r,dst:t.dst,weight:t.weight,ref:t.ref})}const l={nodes:[...n.nodes,...[...s].filter(t=>!n.nodes.includes(t))],edges:d,layout:n.layout,nodeById:i};return{layering:{layers:r,rankOf:o,dummy:s},graphWithDummies:l}}function Pn(t){const e=t.length;if(0===e)return Number.POSITIVE_INFINITY;const n=[...t].sort((t,e)=>t-e);return e%2==1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}function An(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function Yn(t,e,n,o){const r=new Map;for(const e of t)r.set(e,[]);for(const t of n)"down"===o?e.has(t.src)&&r.has(t.dst)&&r.get(t.dst).push(e.get(t.src)):e.has(t.dst)&&r.has(t.src)&&r.get(t.src).push(e.get(t.dst));return r}function Xn(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function Gn(t,e,n){const o=new Set(t),r=new Set(e),s=sn(t),a=sn(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push({u:s.get(t.src),v:a.get(t.dst)});i.sort((t,e)=>t.u===e.u?t.v-e.v:t.u-e.u);return an(i.map(t=>t.v))}function zn(t,e,n){return[...t].sort((t,o)=>{const r=Pn(e.get(t)??[]),s=Pn(e.get(o)??[]);return r===s?Xn(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function jn(t,e,n,o,r,s){const a=sn(t),i=sn(e),c=Yn(e,a,n,o);if(!r||!s||0===s.length)return zn(e,c,i);const f=new Map;for(const t of e){const e=r(t),n=f.get(e)??[];n.push(t),f.set(e,n)}const d=[];for(const t of s){const e=f.get(t);if(!e||0===e.length)continue;const n=zn(e,c,i);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=zn(l,c,i);for(const e of t){const t=An(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<An(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function Dn(t,e,n,o,r){const s=[...e],a=new Set(t),i=new Set(e),c=o?new Set(o):null,f=n.filter(t=>a.has(t.src)&&i.has(t.dst)),d=c?n.filter(t=>i.has(t.src)&&c.has(t.dst)):void 0,l=(0,m.__name)(e=>{let n=Gn(t,e,f);return d&&o&&(n+=Gn(e,o,d)),n},"crossingScore"),u=r?new Map:null;if(r&&u)for(const t of e)u.set(t,r(t));let h=!0,g=l(s);for(;h;){h=!1;for(let t=0;t+1<s.length;t++){if(u){if(u.get(s[t])!==u.get(s[t+1]))continue}const e=g;[s[t],s[t+1]]=[s[t+1],s[t]];const n=l(s);n<e?(g=n,h=!0):[s[t],s[t+1]]=[s[t+1],s[t]]}}return s}function Hn(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=dn(e),a=un(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=jn(o[t-1],o[t],r,"down",s,a),o[t]=Dn(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=jn(o[t+1],o[t],r,"up",s,a),o[t]=Dn(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function Vn(t,e,n){const o=n?.layerGap??gn.DEFAULT_LAYER_GAP,r=n?.nodeGap??gn.DEFAULT_NODE_GAP,s=n?.laneGap??2*r,a=n?.direction??"TB",i="LR"===a||"RL"===a,c=t.layers,f=Object.create(null),d=Object.create(null),l=(0,m.__name)(t=>e.nodeById.get(t),"getNode"),u=(0,m.__name)(t=>l(t)?.width??0,"getWidth"),h=(0,m.__name)(t=>l(t)?.height??0,"getHeight"),g=dn(e),p=un(e,n?.laneOrder),x=c.map(t=>t.reduce((t,e)=>Math.max(t,h(e)),0)),y=[];if(i)for(let t=0;t+1<c.length;t++){const e=c[t].reduce((t,e)=>Math.max(t,u(e)),0),n=c[t+1].reduce((t,e)=>Math.max(t,u(e)),0),r=x[t]/2+x[t+1]/2,s=(e+n)/2,a=Math.max(0,s-r-o);y.push(a)}const _=new Set;for(const t of c)for(const e of t)_.add(g(e));const b=_.has(null),M=p.filter(t=>_.has(t)),I=[...b?[null]:[],...M],S=Object.create(null);for(const t of M)S[t]=0;b&&(S.null=0);for(const t of c){const e=Object.create(null),n=[];for(const o of t){const t=g(o);null===t?n.push(o):(e[t]||=[]).push(o)}for(const[t,n]of Object.entries(e)){const e=n.reduce((t,e)=>t+u(e),0)+r*Math.max(0,n.length-1);S[t]=Math.max(S[t]??0,e)}if(b&&n.length){const t=n.reduce((t,e)=>t+u(e),0)+r*Math.max(0,n.length-1);S.null=Math.max(S.null??0,t)}}const w=new Map;{const t=I.map(t=>(null===t?S.null:S[t])??0);let e=-(t.reduce((t,e)=>t+e,0)+s*Math.max(0,I.length-1))/2;for(let n=0;n<I.length;n++){const o=I[n],r=t[n]??0,a=e+r/2;w.set(o,a),e+=r,n<I.length-1&&(e+=s)}}let v=0;for(const[t,e]of c.entries()){const n=x[t]??0,s=new Map;for(const t of e){const e=g(t),n=s.get(e)??[];n.push(t),s.set(e,n)}for(const t of I){const e=s.get(t)??[];if(0===e.length)continue;const o=w.get(t);if(1===e.length){const t=e[0];f[t]=o,d[t]=v+n/2}else{const t=e.map(t=>u(t));let s=o-(t.reduce((t,e)=>t+e,0)+r*(e.length-1))/2;for(const[o,a]of e.entries()){const e=t[o];f[a]=s+e/2,d[a]=v+n/2,s+=e+r}}}v+=n+o+(y[t]??0)}const L=new Map;for(const t of e.edges){const e=t.ref.id;L.has(e)||L.set(e,[]),L.get(e).push(t)}for(const[,t]of L){if(0===t.length)continue;const n=t[0].ref,o=n.start,r=n.end;if(null==o||null==r)continue;const s=Math.round(((f[o]??0)+(f[r]??0))/2),a=new Set;for(const e of t)a.add(e.src),a.add(e.dst);for(const t of a){if(t===o||t===r)continue;const n=e.nodeById.get(t);n?.isDummy&&(f[t]=s)}}return{x:f,y:d}}(0,m.__name)(mn,"buildDrivingTree"),(0,m.__name)(pn,"chooseParent"),(0,m.__name)(xn,"buildAdjacency"),(0,m.__name)(yn,"assignComponents"),(0,m.__name)(_n,"computeBlocks"),(0,m.__name)(bn,"popBlock"),(0,m.__name)(Mn,"computeSubtreeCrossCounts"),(0,m.__name)(In,"annotateMinimumLayers"),(0,m.__name)(Sn,"compareByRankThenId"),(0,m.__name)(wn,"emitNodesInTreeOrder"),(0,m.__name)(vn,"deduplicateLayers"),(0,m.__name)(Ln,"createChildOrderer"),(0,m.__name)(Cn,"buildMultitreeLayerOrder"),(0,m.__name)(On,"countCrossingsBetweenAdjacent"),(0,m.__name)(Tn,"totalCrossings"),(0,m.__name)(kn,"optimizeRanksByCrossings"),(0,m.__name)(Nn,"adjustCrossLaneSources"),(0,m.__name)(En,"assignLayers_LongestPath"),(0,m.__name)(Rn,"assignLayers_Gravity"),(0,m.__name)($n,"topoSortByGenerationIfAcyclic"),(0,m.__name)(Bn,"assignLayers_LaneAwareCompact"),(0,m.__name)(Fn,"makeProperLayering"),(0,m.__name)(Pn,"median"),(0,m.__name)(An,"barycenter"),(0,m.__name)(Yn,"neighborPositionsFor"),(0,m.__name)(Xn,"currentOrderTieBreak"),(0,m.__name)(Gn,"countCrossingsBetweenAdjacent"),(0,m.__name)(zn,"sortByHeuristic"),(0,m.__name)(jn,"reorderLayer"),(0,m.__name)(Dn,"transposeImprove"),(0,m.__name)(Hn,"orderLayers"),(0,m.__name)(Vn,"assignCoordinates");var Wn=8;function Un(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function qn(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function Jn(t,e){const n=[...t],o=qn(e);for(let t=n.length-1;t>0;t--){const e=Math.floor(o()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n}function Kn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function Zn(t,e){const n=new Map;for(const[e,o]of t.entries())n.set(o,e);let o=0;for(const{a:t,b:r,weight:s}of e){const e=n.get(t),a=n.get(r);null!=e&&null!=a&&(o+=s*Math.abs(e-a))}return o}function Qn(t){const e=ln(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=dn(t),r=new Map;for(const e of t.layout.edges??[]){if(e.isLayoutOnly)continue;const s="string"==typeof e.start?e.start:void 0,a="string"==typeof e.end?e.end:void 0;if(!(s&&a&&t.nodeById.has(s)&&t.nodeById.has(a)))continue;const i=o(s),c=o(a);if(!i||!c||i===c)continue;const f=n.get(i),d=n.get(c);if(null==f||null==d)continue;const[l,u]=f<=d?[i,c]:[c,i],h=`${l}\0${u}`,g=r.get(h);g?g.weight++:r.set(h,{a:l,b:u,weight:1})}return[...r.values()]}function to(t,e,n){const o=[...t];let r=Zn(o,e),s=!0,a=0;const i=Math.max(1,o.length);for(;s&&a<i;){s=!1,a++;for(let t=0;t+1<o.length;t++){[o[t],o[t+1]]=[o[t+1],o[t]];const n=Zn(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:Kn(o,n)}}function eo(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function no(t,e,n){const o=[...e].sort((t,e)=>t.a===e.a?t.b.localeCompare(e.b):t.a.localeCompare(e.a)).map(({a:t,b:e,weight:n})=>`${t}:${e}:${n}`).join("|");return Un(`${t.join("|")}#${o}#${n}`)}function oo(t,e={}){const n=ln(t);if(n.length<2)return n;const o=Qn(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=to(n,o,r);const a=Math.max(0,e.restarts??Wn);for(let t=0;t<a;t++){const e=to(Jn(n,no(n,o,t)),o,r);eo(e,s)&&(s=e)}return s.order}function ro(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=Je(t),s=e?.automaticLaneOrdering?oo(r,{restarts:Wn}):void 0,a=cn(r),i=a.acyclic,c=n?Bn(i,{compactSingleInput:e?.compactSingleInput??hn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):Rn(i,{compactSingleInput:e?.compactSingleInput??hn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=Fn(c,i),l=Hn(f,d,{laneOrder:s}),u=Vn(l,d,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:s});return{acyclic:i,reversed:a.reversed,layering:f,ordered:l,coordinates:u}}(0,m.__name)(Un,"hashString"),(0,m.__name)(qn,"mulberry32"),(0,m.__name)(Jn,"deterministicShuffle"),(0,m.__name)(Kn,"sourceDistance"),(0,m.__name)(Zn,"laneArrangementCost"),(0,m.__name)(Qn,"buildWeightedLaneEdges"),(0,m.__name)(to,"greedySwitch"),(0,m.__name)(eo,"isBetterCandidate"),(0,m.__name)(no,"seedForRestart"),(0,m.__name)(oo,"optimizeTopLaneOrder"),(0,m.__name)(ro,"sugiyamaLayout");var so=1e-6,ao=8,io=15,co=15,fo=25,lo=20,uo=10;function ho(t,e,n){const o=t.x??0,r=t.y??0,s=e.x-o,a=e.y-r,i=Math.abs(s),c=Math.abs(a);if(i<so&&c<so)return n;return c>so&&3*c>=i?a>0?"bottom":"top":i>so?s>0?"right":"left":n}function go(t,e){return Math.abs(t.to-e.from)<so||Math.abs(t.to-e.to)<so?t.to:t.from}function mo(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function po(t,e){const n=t.nodes??[],o=t.edges??[],r=[];for(const t of o)t.isLayoutOnly||r.push(Object.assign({},t,{__originalEdge:t}));const s=new Map,a=new Map,i=[],c="LR"===e;for(const t of n)s.set(t.id,t);const f=n.filter(t=>t.isGroup&&!t.parentId);for(const t of f){const e={id:t.id},o=(0,m.__name)(t=>{a.set(t.id,e),n.filter(e=>e.parentId===t.id).forEach(o)},"assignLane");o(t)}const d=n.filter(t=>!t.isGroup&&!t.isEdgeLabel).map(t=>{const e=t.width??10,n=t.height??10,o=t.x??0,r=t.y??0,s=ao;return{nodeId:t.id,minX:o-e/2-s,maxX:o+e/2+s,minY:r-n/2-s,maxY:r+n/2+s,visualXHalfExtent:c?n/2+s:e/2+s}}),l=(0,m.__name)((t,e,n,o)=>{let r=i.find(n=>n.orientation===t&&Math.abs(n.coord-e)<1);return r||(r={id:`pipe-${t}-${e.toFixed(0)}`,orientation:t,coord:e,spanMin:n,spanMax:o,tracks:[]},i.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),u=(0,m.__name)((t,e)=>{const n=t.width??10,o=t.height??10,r=t.x??0,s=t.y??0;switch(e){case"top":return{x:r,y:s-o/2};case"bottom":return{x:r,y:s+o/2};case"left":return{x:r-n/2,y:s};case"right":return{x:r+n/2,y:s}}},"portForSide"),h=(0,m.__name)((t,e,n)=>u(t,ho(t,e,n?"bottom":"top")),"getOrthogonalPort"),g=[],p=[],x=new Set,y=(0,m.__name)((t,e,n)=>{if(0===g.length)return 0;const o=Math.abs(e.y-n.y)<so,r=Math.abs(e.x-n.x)<so;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-so,a=Math.max(e.x,n.x)+so;if(a<=r)return 0;for(const e of g)e.edgeIndex!==t&&"vertical"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>a||e.from-so<=o&&e.to+so>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-so,a=Math.max(e.y,n.y)+so;if(a<=r)return 0;for(const e of g)e.edgeIndex!==t&&"horizontal"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>a||e.from-so<=o&&e.to+so>=o&&(s+=1e3))}return s},"crossingPenalty"),_=r.map((t,e)=>{if(!t.start||!t.end)return{idx:e,crossLane:0,dx:0,dy:0};const n=s.get(t.start),o=s.get(t.end),r=a.get(t.start),i=a.get(t.end);return{idx:e,crossLane:r&&i&&r.id!==i.id?1:0,dx:n&&o?Math.abs((o.x??0)-(n.x??0)):0,dy:n&&o?Math.abs((o.y??0)-(n.y??0)):0}}).sort((t,e)=>{if(t.crossLane!==e.crossLane)return e.crossLane-t.crossLane;const n=t.dx+t.dy,o=e.dx+e.dy;return Math.abs(n-o)>1?n-o:t.idx-e.idx}).map(t=>t.idx),b=(0,m.__name)((t,e,n,o)=>{const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),a=Math.min(t.y,e.y),i=Math.max(t.y,e.y);return!!d.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>so?c.minY<t.y&&c.maxY>t.y&&c.maxX>r&&c.minX<s:c.minX<t.x&&c.maxX>t.x&&c.maxY>a&&c.minY<i)))},"isSegmentBlocked"),M=new Map,I=new Map;for(const t of r)t.start&&t.end&&t.start!==t.end&&(I.set(t.start,(I.get(t.start)??0)+1),I.set(t.end,(I.get(t.end)??0)+1));const S=(0,m.__name)((t,e)=>ho(t,e,"bottom"),"determineSide"),w=new Map;for(const[t,e]of r.entries()){if(!e.start||!e.end||e.start===e.end)continue;if(e.points&&e.points.length>0)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const r=(o.x??0)-(n.x??0),a=(o.y??0)-(n.y??0);w.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:S(n,{x:o.x??0,y:o.y??0}),dstSide:S(o,{x:n.x??0,y:n.y??0}),absDx:Math.abs(r),absDy:Math.abs(a),dxSign:Math.sign(r),dySign:Math.sign(a)})}const v=(0,m.__name)(t=>"top"===t.srcSide||"bottom"===t.srcSide?0===t.absDx?1/0:t.absDy/t.absDx:0===t.absDy?1/0:t.absDx/t.absDy,"preferenceStrength"),L=(0,m.__name)(t=>"top"===t.srcSide||"bottom"===t.srcSide?t.dxSign>=0?"right":"left":t.dySign>=0?"bottom":"top","secondarySide"),C=new Map;for(const t of w.values()){const e=`${t.srcId}:${t.srcSide}`;C.has(e)||C.set(e,[]),C.get(e).push(t)}const O=new Map,T=(0,m.__name)((t,e)=>`${t}:${e}`,"loadKey");for(const t of w.values())O.set(T(t.srcId,t.srcSide),(O.get(T(t.srcId,t.srcSide))??0)+1),O.set(T(t.dstId,t.dstSide),(O.get(T(t.dstId,t.dstSide))??0)+1);for(const t of C.values())if(!(t.length<2)){t.sort((t,e)=>{const n=v(t),o=v(e);return Math.abs(n-o)>1e-9?o-n:t.edgeIdx-e.edgeIdx});for(let e=1;e<t.length;e++){const n=t[e],o=L(n),r=O.get(T(n.srcId,n.srcSide))??0,s=O.get(T(n.srcId,o))??0;s>=r||(O.set(T(n.srcId,n.srcSide),r-1),O.set(T(n.srcId,o),s+1),n.srcSide=o)}}const k=(0,m.__name)(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),N=new Map;for(const t of w.values())N.has(t.dstId)||N.set(t.dstId,new Set),N.get(t.dstId).add(t.dstSide);for(const t of w.values()){if(!k(s.get(t.srcId)))continue;const e=N.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=L(t);if(e.has(n)||(O.get(T(t.srcId,n))??0)>0)continue;const o=O.get(T(t.srcId,t.srcSide))??0;O.set(T(t.srcId,t.srcSide),Math.max(0,o-1)),O.set(T(t.srcId,n),1),t.srcSide=n}for(const t of w.values()){const{edgeIdx:e,srcId:n,dstId:o,srcSide:r,dstSide:a}=t,i=s.get(n),c=s.get(o),f=`${n}:${r}:src`,d="top"===r||"bottom"===r?c.x??0:c.y??0;M.has(f)||M.set(f,[]),M.get(f).push({edgeIdx:e,oppositeCoord:d});const l=`${o}:${a}:dst`,u="top"===a||"bottom"===a?i.x??0:i.y??0;M.has(l)||M.set(l,[]),M.get(l).push({edgeIdx:e,oppositeCoord:u})}const E=new Map;for(const[t,e]of M){if(e.length<2)continue;e.sort((t,e)=>t.oppositeCoord-e.oppositeCoord);const n=t.split(":"),o=n.slice(0,-2).join(":"),r=n[n.length-2],a=n[n.length-1],i=s.get(o);if(!i)continue;const c="left"===r||"right"===r?i.height??10:i.width??10,f=i.shape,d="question"===f||"diamond"===f?.3*c:c,l=20,u=Math.min(l,Math.max(8,d/(e.length+1))),h=-(u*(e.length-1))/2;for(const[t,n]of e.entries()){const e=h+t*u,o=`${n.edgeIdx}:${a}`;E.set(o,e)}}const R=(0,m.__name)(t=>Boolean(r[t]?.labelNodeId),"edgeHasLabelNode"),$=(0,m.__name)((t,e)=>!!t&&((M.get(`${t}:${e}:src`)??[]).some(({edgeIdx:t})=>R(t))||(M.get(`${t}:${e}:dst`)??[]).some(({edgeIdx:t})=>R(t))),"faceHasLabelNode"),B=(0,m.__name)((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),F=(0,m.__name)((t,e,n)=>{const o=w.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},a=o?.srcSide??S(e,r),i=o?.dstSide??S(n,s);let c=o?u(e,o.srcSide):h(e,r,!0),f=o?u(n,o.dstSide):h(n,s,!1);const d=E.get(`${t}:src`),l=E.get(`${t}:dst`);return void 0!==d&&(c=B(c,a,d)),void 0!==l&&(f=B(f,i,l)),{pSrcPort:c,pDstPort:f,srcSide:a,dstSide:i}},"portsForEdge");for(const t of _){const e=r[t];if(p[t]=[],!e.start||!e.end)continue;if(e.points&&e.points.length>0)continue;if(e.start===e.end)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const{pSrcPort:a,pDstPort:f,srcSide:u,dstSide:h}=F(t,n,o),_=Object.assign({},a),S=Object.assign({},f),w="top"===u||"bottom"===u,v="top"===h||"bottom"===h;if(w){const t=a.y>(n.y??0);_.y=t?a.y+lo:a.y-lo}else{const t=a.x>(n.x??0);_.x=t?a.x+lo:a.x-lo}if(v){const t=f.y>(o.y??0);S.y=t?f.y+lo:f.y-lo}else{const t=f.x>(o.x??0);S.x=t?f.x+lo:f.x-lo}const L=(0,m.__name)((t,e)=>{for(const n of d)if(!e.includes(n.nodeId)&&t.x>n.minX&&t.x<n.maxX&&t.y>n.minY&&t.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),C=(0,m.__name)((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+io:o.minX-io,y:r?o.maxY+co:o.minY-co,leavesPositiveSide:r}}const s=t.x>(e.x??0),a=(n.y??0)>=t.y;return{x:s?o.maxX+io:o.minX-io,y:a?o.maxY+co:o.minY-co,leavesPositiveSide:s}},"obstacleDetour");let O=[];const T=[e.start,e.end],k=L(_,T);if(k.inside&&k.obstacle){const t=k.obstacle;if(w){const e=C(a,n,o,t,!0);_.x=e.x,_.y=e.y;const r=e.leavesPositiveSide?Math.min(t.minY-2,a.y+lo):Math.max(t.maxY+2,a.y-lo);O=[{x:a.x,y:r},{x:e.x,y:r},{x:e.x,y:e.y}]}else{const e=C(a,n,o,t,!1),r=e.leavesPositiveSide?Math.min(t.minX-2,a.x+lo):Math.max(t.maxX+2,a.x-lo);_.x=e.x,_.y=e.y,O=[{x:r,y:a.y},{x:r,y:e.y},{x:e.x,y:e.y}]}}let N=[];const R=L(S,T);if(R.inside&&R.obstacle){const t=R.obstacle;if(v){const e=C(f,o,n,t,!0);S.x=e.x,S.y=e.y,N=[{x:e.x,y:e.y},{x:f.x,y:e.y}]}else{const e=C(f,o,n,t,!1);S.x=e.x,S.y=e.y,N=[{x:e.x,y:e.y},{x:e.x,y:f.y}]}}if(0===O.length&&0===N.length){const n=io,o=Math.abs(_.x-S.x)<n,r=Math.abs(_.y-S.y)<n,s=void 0!==E.get(`${t}:src`)||void 0!==E.get(`${t}:dst`),i=(M.get(`${e.start??""}:${u}:src`)?.length??0)+(M.get(`${e.start??""}:${u}:dst`)?.length??0),c=(M.get(`${e.end??""}:${h}:src`)?.length??0)+(M.get(`${e.end??""}:${h}:dst`)?.length??0),d=i>1||c>1,l=I.get(e.start??"")??0,m=I.get(e.end??"")??0,p=i>1&&$(e.start,u)||c>1&&$(e.end,h);if((o||r)&&!s&&(!d||d&&!p&&(i<=1||l<=2)&&(c<=1||m<=2))){if(!b(a,f,e.start,e.end)){e.points=[Object.assign({},a),Object.assign({},_),Object.assign({},S),Object.assign({},f)],x.add(t);const n=r?"horizontal":"vertical",o=r?a.y:a.x,s=r?Math.min(a.x,f.x):Math.min(a.y,f.y),i=r?Math.max(a.x,f.x):Math.max(a.y,f.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:i,tracks:[]};g.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:i});continue}}}const B=l("vertical",_.x,_.y,_.y);_.x=B.coord;const P=l("vertical",S.x,S.y,S.y);S.x=P.coord;let A=Math.min(_.x,S.x)-50,Y=Math.max(_.x,S.x)+50,X=Math.min(_.y,S.y)-50,G=Math.max(_.y,S.y)+50;for(const t of d){const e=Math.min(_.x,S.x),n=Math.max(_.x,S.x),o=Math.min(_.y,S.y),r=Math.max(_.y,S.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(A=Math.min(A,t.minX-fo),Y=Math.max(Y,t.maxX+fo),X=Math.min(X,t.minY-fo),G=Math.max(G,t.maxY+fo))}for(const t of d){if(t.maxX<A||t.minX>Y||t.maxY<X||t.minY>G)continue;const e=io;l("horizontal",t.minY-e,A,Y),l("horizontal",t.maxY+e,A,Y);const n=co;l("vertical",t.minX-n,X,G),l("vertical",t.maxX+n,X,G)}l("horizontal",_.y,A,Y),l("horizontal",S.y,A,Y);const z=i.filter(t=>"horizontal"===t.orientation&&t.coord>=X&&t.coord<=G),j=i.filter(t=>"vertical"===t.orientation&&t.coord>=A&&t.coord<=Y),D=(0,m.__name)((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),H=D(_.x,_.y),V=D(S.x,S.y),W=new Map,U=new Map,q=new Map,J=new Set,K=[];W.set(H,0),q.set(H,"n"),K.push({key:H,f:Math.hypot(S.x-_.x,S.y-_.y),pt:_}),J.add(H);let Z=[];const Q=(0,m.__name)((t,n)=>b(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:S.x,y:_.y},et=Q(_,tt),nt=Q(tt,S),ot=et||nt,rt={x:_.x,y:S.y},st=Q(_,rt),at=Q(rt,S);if(ot?st||at||(Z=Math.abs(_.x-S.x)<so?[_,S]:[_,rt,S]):Z=Math.abs(_.y-S.y)<so||Math.abs(_.x-S.x)<so?[_,S]:[_,tt,S],0===Z.length)for(;K.length>0;){K.sort((t,e)=>t.f-e.f);const n=K.shift();if(J.delete(n.key),n.key===V){let t=V,e=S;for(Z=[e];U.has(t);){const n=U.get(t);Z.unshift(n),e=n,t=D(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=j.sort((t,e)=>t.coord-e.coord),a=s.findIndex(t=>Math.abs(t.coord-o)<1),i=z.sort((t,e)=>t.coord-e.coord),c=i.findIndex(t=>Math.abs(t.coord-r)<1),f=[];a>0&&f.push({x:s[a-1].coord,y:r}),a>=0&&a<s.length-1&&f.push({x:s[a+1].coord,y:r}),c>0&&f.push({x:o,y:i[c-1].coord}),c>=0&&c<i.length-1&&f.push({x:o,y:i[c+1].coord});for(const s of f){const a=Math.min(o,s.x),i=Math.max(o,s.x),c=Math.min(r,s.y),f=Math.max(r,s.y);if(d.some(t=>t.nodeId!==e.start&&t.nodeId!==e.end&&(a!==i?t.minY<r&&t.maxY>r&&t.maxX>a&&t.minX<i:t.minX<o&&t.maxX>o&&t.maxY>c&&t.minY<f)))continue;const l=D(s.x,s.y),u=Math.abs(s.x-o)+Math.abs(s.y-r),h=y(t,n.pt,s);let g=0;const m=S.x-_.x,p=S.y-_.y,x=s.x-o,b=s.y-r;(p>10&&b<-5||p<-10&&b>5)&&(g=100*Math.abs(b)),(m>10&&x<-5||m<-10&&x>5)&&(g+=50*Math.abs(x));let M=0;const I=q.get(n.key)??"n",w=Math.abs(x)>so?"h":"v";"n"!==I&&I!==w&&(M=50);const v=u+h+g+M,L=(W.get(n.key)??1/0)+v,C=Math.abs(S.x-s.x)+Math.abs(S.y-s.y);if(L<(W.get(l)??1/0))if(U.set(l,n.pt),W.set(l,L),q.set(l,w),J.has(l)){const t=K.findIndex(t=>t.key===l);-1!==t&&(K[t].f=L+C)}else K.push({key:l,f:L+C,pt:s}),J.add(l)}}if(0===Z.length&&(Z=[_,{x:_.x,y:S.y},S]),Z.length>4){const t=Z[0],e=Z[Z.length-1];let n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y);for(const t of Z)n=Math.min(n,t.x),o=Math.max(o,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y);const a=o>Math.max(t.x,e.x),i=n<Math.min(t.x,e.x);if(c){const r=co;if(a){const n=Math.max(t.x,e.x),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),i=d.filter(t=>t.minX<n&&t.maxX>n&&t.minY<a&&t.maxY>s);if(i.length>0){let n=Math.max(t.x,e.x);for(const t of i){const e=(t.minX+t.maxX)/2;if(void 0===t.visualXHalfExtent||isNaN(t.visualXHalfExtent))continue;const o=e+t.visualXHalfExtent+r;n=Math.max(n,o)}isNaN(n)||(o=n)}}if(i){const o=d.filter(n=>n.minX<Math.min(t.x,e.x)+r&&n.minY<Math.max(t.y,e.y)&&n.maxY>Math.min(t.y,e.y));if(o.length>0){let s=Math.min(t.x,e.x);for(const t of o){const e=(t.minX+t.maxX)/2-t.visualXHalfExtent-r;s=Math.min(s,e)}n=s}}}const f=(0,m.__name)(n=>{const o=e.y>t.y,r=d.filter(n=>{const o=Math.min(t.x,e.x)<n.maxX&&Math.max(t.x,e.x)>n.minX,r=Math.min(t.y,e.y)<n.maxY&&Math.max(t.y,e.y)>n.minY;return o&&r});let s=r;if(c&&r.length>0){const t=r.filter(t=>t.minX<n&&t.maxX>n);t.length>0&&(s=t)}if(0===s.length)return e.y;const a=io;if(o){const t=Math.max(...s.map(t=>t.maxY))+a;if(t<e.y-so)return t}else{const t=Math.min(...s.map(t=>t.minY))-a;if(t>e.y+so)return t}return e.y},"findBestReturnY"),l=(0,m.__name)(n=>{const o=f(n),r={x:n,y:t.y},s={x:n,y:o},a={x:e.x,y:o},i=Q(t,r),c=Q(r,s),d=Q(s,a),l=o!==e.y&&Q(a,e);return i||c||d||l?null:Math.abs(o-e.y)<so?[t,r,s,e]:[t,r,s,a,e]},"trySimplifyWithDetourX"),u=a&&!i?l(o):i&&!a?l(n):null;u&&(Z=u)}const it=[a,...O,...Z,...N.reverse(),f];if(it.length>=3){const t=it[it.length-1],e=it[it.length-2],n=it[it.length-3],o=Math.abs(n.y-e.y)<so&&Math.abs(e.y-t.y)<so,r=Math.abs(n.x-e.x)<so&&Math.abs(e.x-t.x)<so;if(o){const o=Math.sign(e.x-n.x),r=Math.sign(t.x-n.x);0!==o&&o===r&&Math.abs(e.x-n.x)>Math.abs(t.x-n.x)&&it.splice(-2,1)}else if(r){const o=Math.sign(e.y-n.y),r=Math.sign(t.y-n.y);0!==o&&o===r&&Math.abs(e.y-n.y)>Math.abs(t.y-n.y)&&it.splice(-2,1)}}const ct=[it[0]];for(let t=1;t<it.length-1;t++){if(1===t){ct.push(it[t]);continue}const e=ct[ct.length-1],n=it[t],o=it[t+1];if(Math.abs(e.y-n.y)<so&&Math.abs(n.y-o.y)<so){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<so&&Math.abs(n.x-o.x)<so){if(n.y>e.y!==o.y>n.y){ct.push(n);continue}continue}ct.push(n)}ct.push(it[it.length-1]);for(let e=0;e<ct.length-1;e++){const n=ct[e],o=ct[e+1],r=Math.abs(n.x-o.x)<so?"vertical":"horizontal",s="vertical"===r?n.x:n.y,a="vertical"===r?Math.min(n.y,o.y):Math.min(n.x,o.x),i="vertical"===r?Math.max(n.y,o.y):Math.max(n.x,o.x),c=l(r,s,a,i),f={edgeIndex:t,segmentIndex:e,orientation:r,pipe:c,trackIndex:0,from:a,to:i};g.push(f),p[t].push(g.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:a,to:i})}}const P=(0,m.__name)((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),A=(0,m.__name)((t,e,n,o)=>{const r=!o.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&P(n,t)),s=!n.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&P(n,e));return!(!r||!s)&&(t.trackIndex=o.index,e.trackIndex=n.index,n.segments=[...n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],o.segments=[...o.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],!0)},"trySwapSegmentsAcrossTracks"),Y=(0,m.__name)(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),X=(0,m.__name)((t,e)=>{const n=t.pipe.tracks[t.trackIndex];n.segments=n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),t.trackIndex=e;t.pipe.tracks[e].segments.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to})},"moveSegmentToTrack"),G=(0,m.__name)((t,e)=>{const n=p[t.edgeIndex];for(const o of n){const n=g[o];n.pipe===t.pipe&&X(n,e)}},"moveSegmentChainToTrack"),z=(0,m.__name)(t=>{const e=p[t.edgeIndex],n=e.indexOf(g.indexOf(t)),o=[];return n>0&&o.push(g[e[n-1]]),n<e.length-1&&o.push(g[e[n+1]]),o},"getAdjacentSegmentsAlongEdge"),j=(0,m.__name)((t,e)=>{if(t.orientation===e.orientation)return!1;const n="horizontal"===t.orientation?t:e,o="horizontal"===t.orientation?e:t;return o.pipe.coord>n.from&&o.pipe.coord<n.to&&n.pipe.coord>o.from&&n.pipe.coord<o.to},"haveAnyCrossing"),D=(0,m.__name)((t,e)=>{for(const n of t.tracks){if(!n.segments.some(t=>(t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex)&&P(t,e)))return n.index}return-1},"findAvailableTrack"),H=(0,m.__name)((t,e)=>{if(t.trackIndex===e.trackIndex)return P(t,e);const n=z(t),o=z(e);return n.some(t=>o.some(e=>j(t,e)))},"segmentsConflict"),V=(0,m.__name)((t,e,n)=>{if(A(t,e,t.pipe.tracks[t.trackIndex],e.pipe.tracks[e.trackIndex]))return;const o=D(t.pipe,e);n(e,-1!==o?o:Y(t.pipe))},"resolveTrackConflict"),W=(0,m.__name)(t=>{let e=0;for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=t[n],s=t[o];r.pipe===s.pipe&&(H(r,s)&&(e++,V(r,s,G)))}return e},"resolveHandleConflicts"),U=new Map,q=(0,m.__name)(t=>{if(U.has(t))return U.get(t);const e=p[t];if(0===e.length){const e={dest:0,deviation:0,base:0,delta:0};return U.set(t,e),e}const n=g[e[0]].pipe.coord;let o=n;for(let t=1;t<e.length;t++){const r=g[e[t]];if("horizontal"===r.orientation){const t=r.from,e=r.to;o=Math.abs(t-n)>Math.abs(e-n)?t:e;break}}const r={dest:o,deviation:Math.abs(o-n),base:n,delta:o-n};return U.set(t,r),r},"getDestInfo"),J=(0,m.__name)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries())0!==p[t].length&&n.start&&(e.has(n.start)||e.set(n.start,[]),e.get(n.start).push(t));const n=(0,m.__name)(t=>{const e=r[t];if(!e.start||!e.end)return 0;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)return 0;const a=(o.x??0)-(n.x??0),i=(o.y??0)-(n.y??0);return Math.abs(a)+Math.abs(i)},"getEdgeDistance");for(const o of e.values()){o.sort((t,e)=>{const o=q(t),r=q(e);if(Math.abs(o.deviation-r.deviation)>1)return o.deviation-r.deviation;if(Math.abs(o.dest-r.dest)>1)return o.dest-r.dest;const s=n(t),a=n(e);if(Math.abs(s-a)>1)return a-s;const i=p[t].length,c=p[e].length;if(i!==c)return i-c;if(1===i){const n=p[t][0],o=p[e][0];if(g[n]&&g[o]){const t=g[n],e=g[o],r=Math.abs(t.to-t.from),s=Math.abs(e.to-e.from);if(Math.abs(r-s)>1)return r-s}}return 0});const e=o.map(t=>g[p[t][0]]);t+=W(e)}return t},"fixSourceHandleCrossings"),K=(0,m.__name)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries()){0!==p[t].length&&(n.end&&(e.has(n.end)||e.set(n.end,[]),e.get(n.end).push(t)))}for(const n of e.values()){n.sort((t,e)=>{const n=(0,m.__name)(t=>{const e=p[t];if(e.length<2)return 0;const n=g[e[e.length-2]];return Math.abs(n.to-n.from)},"getDist"),o=n(t),r=n(e);return Math.abs(o-r)>.1?o-r:t-e});const e=n.map(t=>g[p[t][p[t].length-1]]);t+=W(e)}return t},"fixTargetHandleCrossings"),Z=(0,m.__name)(()=>{let t=0;for(const e of i){const n=[];for(const t of e.tracks)for(const e of t.segments){const t=p[e.edgeIndex].find(t=>g[t].segmentIndex===e.segmentIndex);void 0!==t&&n.push(g[t])}n.sort((t,e)=>t.edgeIndex-e.edgeIndex||t.segmentIndex-e.segmentIndex);for(let e=0;e<n.length;e++)for(let o=e+1;o<n.length;o++){const r=n[e],s=n[o];H(r,s)&&(t++,V(r,s,X))}}return t},"fixPipeCrossings");let Q=0;for(;Q<10;){let t=0;if(t+=J(),t+=K(),t+=Z(),0===t)break;Q++}const tt=new Map;for(const t of i){const e=[];t.tracks.forEach(t=>{t.segments.forEach(n=>{e.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:t.index,from:n.from,to:n.to})})}),e.sort((t,e)=>t.from-e.from);const n=[];if(e.length>0){let t=[e[0]],o=e[0].to;for(let r=1;r<e.length;r++){const s=e[r];s.from<o?(t.push(s),o=Math.max(o,s.to)):(n.push(t),t=[s],o=s.to)}n.push(t)}for(const e of n){const n=new Set;e.forEach(t=>n.add(t.trackIndex));const o=new Map;e.forEach(t=>{const e=q(t.edgeIndex);o.set(t.trackIndex,(o.get(t.trackIndex)??0)+e.delta)});const r=[...n].filter(t=>(o.get(t)??0)<-1),s=[...n].filter(t=>(o.get(t)??0)>1),a=[...n].filter(t=>Math.abs(o.get(t)??0)<=1);r.sort((t,e)=>(o.get(e)??0)-(o.get(t)??0)),s.sort((t,e)=>(o.get(t)??0)-(o.get(e)??0));const i=(0,m.__name)((n,o)=>{e.filter(t=>t.trackIndex===n).forEach(e=>{const n=x.has(e.edgeIndex)?t.coord:o;tt.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},"assignCoord");let c=0;for(const e of r)c++,i(e,t.coord-c*uo);if(0===a.length&&n.size>0){const t=[...n].sort((t,e)=>Math.abs(o.get(t)??0)-Math.abs(o.get(e)??0))[0],e=r.indexOf(t);-1!==e&&r.splice(e,1);const i=s.indexOf(t);-1!==i&&s.splice(i,1),a.push(t)}let f=0;for(const e of a){if(0===f)i(e,t.coord);else{const n=f%2==1?1:-1,o=Math.ceil(f/2);i(e,t.coord+n*o*uo*.5)}f++}let d=0;for(const e of s)d++,i(e,t.coord+d*uo)}}for(const[t,e]of r.entries()){const n=p[t]??[];if(0===n.length)continue;const o=[],r=s.get(e.start),a=s.get(e.end),{pSrcPort:i,pDstPort:c}=F(t,r,a),f=n.map(t=>{const e=g[t],n=tt.get(`${e.edgeIndex}-${e.segmentIndex}`)??e.pipe.coord;return{orient:e.orientation,coord:n,from:e.from,to:e.to}});o.push(i);for(let t=0;t<f.length;t++){const e=f[t],n=o[o.length-1],r="vertical"===e.orient?n.y:n.x,s="vertical"===e.orient?n.x:n.y,a=f[t+1],i=t<f.length-1;if(Math.abs(s-e.coord)>so&&o.push(mo(e,r)),i&&a.orient===e.orient)if(Math.abs(e.coord-a.coord)>so){const t="vertical"===e.orient?(r+a.from)/2:go(e,a);o.push(mo(e,t),mo(a,t))}else 0!==t&&t!==f.length-2||o.push(mo(e,go(e,a)));else if(i)o.push(mo(e,a.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(mo(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>so||Math.abs(d.y-c.y)>so)&&o.push(c);const l=[];o.length>0&&l.push(o[0]);for(let t=1;t<o.length;t++){const e=o[t],n=l[l.length-1];(Math.abs(e.x-n.x)>so||Math.abs(e.y-n.y)>so)&&l.push(e)}e.points=l}for(const t of r){const e=t.__originalEdge;e&&t.points&&(e.points=t.points)}t.edges=(t.edges??[]).filter(t=>!t.isLayoutOnly);const et=(0,m.__name)((t,e)=>{const n=e.x??0,o=e.y??0,r=e.width??0,s=e.height??0;if(r<=0||s<=0)return t;const a=n-r/2,i=n+r/2,c=o-s/2,f=o+s/2;if(t.x<a||t.x>i||t.y<c||t.y>f)return t;const d=t.x-a,l=i-t.x,u=t.y-c,h=f-t.y,g=Math.min(d,l,u,h);return g===d?{x:a,y:t.y}:g===l?{x:i,y:t.y}:g===u?{x:t.x,y:c}:{x:t.x,y:f}},"nodeBoundaryClamp");for(const e of t.edges){const t=e.points;if(!t||t.length<2)continue;const n=e.start,o=e.end,r=n?s.get(n):void 0,a=o?s.get(o):void 0;r&&(t[0]=et(t[0],r)),a&&(t[t.length-1]=et(t[t.length-1],a))}return t}function xo(t){return t.direction??"TB"}function yo(t){const e=H(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,r=t.config.swimlane?.ignoreCrossLaneEdges??!0,s=t.config.swimlane?.optimizeRanksByCrossings??!0,a=t.config.swimlane?.automaticLaneOrdering??!1,i=xo(t),{ordered:c,coordinates:f}=ro(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:a,direction:i});V(e,c,f,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;po(t,i);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return qe(t,i),Ue(t),i}async function _o(t,e){const n=e.select("g");(0,c.markers_default)(n,t.markers,t.type,t.diagramId),(0,f.clear2)(),(0,c.clear)(),(0,f.clear)(),(0,i.clear)(),D(t);const o=U(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:r}=await x(n,t);yo(t),await P(t,r)}(0,m.__name)(ho,"chooseOrthogonalSide"),(0,m.__name)(go,"sharedLineEndpointCoord"),(0,m.__name)(mo,"pointOnLine"),(0,m.__name)(po,"routeEdgesOrthogonal"),(0,m.__name)(xo,"getSwimlaneDirection"),(0,m.__name)(yo,"runSwimlaneLayoutCore"),(0,m.__name)(_o,"render")},5166,{"0":4444,"1":3268,"2":3269,"3":3270,"4":3271,"5":3272,"6":3273,"7":3274,"8":3275,"9":3276,"10":3277,"11":3278,"12":4445,"13":5331,"14":2334,"paths":{"5331":"/_expo/static/js/web/sizeCapture-X5ZJPWSS-204a0c7899e4f53f494516c2a59f19d7.js"}});
1
+ __d(function(t,e,n,o,r,s,a){"use strict";Object.defineProperty(s,'__esModule',{value:!0}),Object.defineProperty(s,"render",{enumerable:!0,get:function(){return _o}});var i=e(a[0]),c=e(a[1]),f=e(a[2]);e(a[3]);var d=e(a[4]),l=e(a[5]);e(a[6]),e(a[7]);var u=e(a[8]),h=e(a[9]),g=e(a[10]),m=e(a[11]),p=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),e.default=t,e})(e(a[12]));async function x(t,n){const o=new p.Graph({multigraph:!0,compound:!0}),r=[...n.edges],s=(0,h.getConfig2)(),i=t.insert("g").attr("class","root"),c=i.insert("g").attr("class","clusters"),d=i.insert("g").attr("class","edges edgePath"),l=i.insert("g").attr("class","edgeLabels"),u=i.insert("g").attr("class","nodes"),g=new Map,m=null!=t.node();await Promise.all(n.nodes.map(async t=>{if(t.isGroup)o.setNode(t.id,Object.assign({},t));else{if(m){const e=await(0,f.insertNode)(u,t,{config:s,dir:t.dir}),n=e.node()?.getBBox()??{width:0,height:0};g.set(t.id,e),t.width=n.width,t.height=n.height}o.setNode(t.id,Object.assign({},t))}}));for(const t of r){o.setEdge(t.start,t.end,Object.assign({},t),t.id);n.edges.some(e=>e.id===t.id)||n.edges.push(t)}if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:o}=await e(a[14])(a[13],a.paths);o(t,n)}return{graph:o,groups:{clusters:c,edgePaths:d,edgeLabels:l,nodes:u,rootGroups:i},nodeElements:g}}(0,m.__name)(x,"createGraphWithElements");var y=5,_=1e-5,b=1e-6;function M(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}function I(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,a=o.x-n.x,i=o.y-n.y,c=r*i-s*a;if(0===c)return null;const f=n.x-t.x,d=n.y-t.y,l=(f*i-d*a)/c,u=(f*s-d*r)/c;return l<=b||l>=.999999||u<=b||u>=.999999?null:{point:{x:t.x+l*r,y:t.y+l*s},tA:l,tB:u}}function S(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}function w(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],r=M(o.points);for(let s=n+1;s<t.length;s++){const n=t[s],a=M(n.points);for(const[t,s]of r.entries())for(const[r,i]of a.entries()){const a=I(s.a,s.b,i.a,i.b);if(!a)continue;const c=S(s);!!(c!==S(i))&&c?e.push({jumpEdgeId:o.id,otherEdgeId:n.id,segIndex:t,t:a.tA,point:a.point}):e.push({jumpEdgeId:n.id,otherEdgeId:o.id,segIndex:r,t:a.tB,point:a.point})}}}return e}function v(t){const e=Math.round(1e3*t)/1e3;return Number.isInteger(e),`${e}`}function L(t){return`${v(t.x)},${v(t.y)}`}function C(t){const e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}(0,m.__name)(M,"buildSegmentList"),(0,m.__name)(I,"segmentIntersection"),(0,m.__name)(S,"isHorizontalSeg"),(0,m.__name)(w,"findEdgeIntersections"),(0,m.__name)(v,"fmt"),(0,m.__name)(L,"pointToString"),(0,m.__name)(C,"getArcSweepFlag");var O=.001;function T(t,e){if(t.length<2)return t.map(t=>Object.assign({},t));const n=t.map(t=>Object.assign({},t)),o=e.arrowTypeStart&&d.markerOffsets[e.arrowTypeStart];if(o){const e=t[0],r=t[1],s=Math.atan2(r.y-e.y,r.x-e.x);n[0].x=e.x+o*Math.cos(s),n[0].y=e.y+o*Math.sin(s)}const r=e.arrowTypeEnd&&d.markerOffsets[e.arrowTypeEnd];if(r){const e=t.length,o=t[e-2],s=t[e-1],a=Math.atan2(s.y-o.y,s.x-o.x);n[e-1].x=s.x-r*Math.cos(a),n[e-1].y=s.y-r*Math.sin(a)}return n}function k(t,e,n,o,r){const s=t.point.x,a=t.point.y,i={x:s-e*t.r,y:a-n*t.r},c={x:s+e*t.r,y:a+n*t.r},f=[`L${L(i)}`];return"arc"===r?f.push(`A${v(t.r)},${v(t.r)} 0 0 ${o} ${L(c)}`):f.push(`M${L(c)}`),f}function N(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,a=n.x-e.x,i=n.y-e.y,c=Math.hypot(r,s),f=Math.hypot(a,i);if(c<_||f<_)return null;const d=r/c,l=s/c,u=a/f,h=i/f,g=d*u+l*h,m=Math.max(-1,Math.min(1,g)),p=Math.acos(m);if(p<_||Math.abs(Math.PI-p)<_)return null;const x=Math.min(o/Math.sin(p/2),c/2,f/2);return{startX:e.x-d*x,startY:e.y-l*x,endX:e.x+u*x,endY:e.y+h*x,ctrlX:e.x,ctrlY:e.y,cutLen:x}}function E(t,e,n){const o=t.points;if(o.length<2)return"";const r=T(o,t),s="rounded"===t.curve,a=M(r),i=new Map;for(const t of e){const e=a[t.segIndex];if(!e)continue;const o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),r=i.get(t.segIndex)??[];r.push({t:t.t,point:t.point,d:t.t*o,r:n.jumpRadius}),i.set(t.segIndex,r)}const c=[`M${L(r[0])}`];for(let t=0;t<a.length;t++){const e=a[t],o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),f=0===o?0:(e.b.x-e.a.x)/o,d=0===o?0:(e.b.y-e.a.y)/o,l=C(e);let u=0;if(s&&t>0){const e=N(r[t-1],r[t],r[t+1]??r[t],y);e&&(u=e.cutLen)}let h=o,g=null;s&&t<a.length-1&&(g=N(r[t],r[t+1],r[t+2]??r[t+1],y),g&&(h=o-g.cutLen));const m=[...i.get(t)??[]].sort((t,e)=>t.t-e.t);for(const t of m)t.r=Math.min(t.r,t.d-u,h-t.d);for(let t=0;t<m.length-1;t++){const e=m[t+1].d-m[t].d;if(m[t].r+m[t+1].r>e){const n=e/2;m[t].r=Math.min(m[t].r,n),m[t+1].r=Math.min(m[t+1].r,n)}}for(const t of m)t.r<O||c.push(...k(t,f,d,l,n.jumpStyle));s&&g?(c.push(`L${v(g.startX)},${v(g.startY)}`),c.push(`Q${v(g.ctrlX)},${v(g.ctrlY)} ${v(g.endX)},${v(g.endY)}`)):c.push(`L${L(e.b)}`)}return c.join(" ")}function R(t){return/^[\d\s+,.LMelm-]*$/.test(t)}function $(t){return!t||("linear"===t||"rounded"===t||"step"===t||"stepBefore"===t||"stepAfter"===t)}function B(t){if(!t)return null;try{const e="function"==typeof atob?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const t of n)t&&"number"==typeof t.x&&"number"==typeof t.y&&o.push({x:t.x,y:t.y});return o.length>=2?o:null}catch{return null}}function F(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const r=new Map;for(const t of e)r.set(t.id,t);const s=[],a=new Map;for(const t of e){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(t.id):t.id,n=o.querySelector(`path[data-id="${e}"]`);if(!n)continue;a.set(t.id,n);const r=B(n.getAttribute("data-points"))??t.points;s.push(Object.assign({},t,{points:r}))}const i=w(s);if(0===i.length)return;const c=new Map;for(const t of i){const e=c.get(t.jumpEdgeId)??[];e.push(t),c.set(t.jumpEdgeId,e)}for(const t of s){const e=c.get(t.id);if(!e||0===e.length)continue;const o=r.get(t.id),s=o?.curve;if(void 0!==s&&!$(s))continue;const i=a.get(t.id);if(!i)continue;if(void 0===s){if(!R(i.getAttribute("d")??""))continue}const f=i.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),l=d?Number.parseFloat(d[1]):null,u=d?Number.parseFloat(d[2]):null,h=E(t,e,n);if(i.setAttribute("d",h),null!==l&&null!==u&&"function"==typeof i.getTotalLength){const t=i.getTotalLength(),e=`0 ${l} ${Math.max(0,t-l-u)} ${u}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${e};`).replace(/;\s*;+/g,";");i.setAttribute("style",n)}}}async function P(t,e){for(const n of t.nodes)n.isGroup?await(0,f.insertCluster)(e.clusters,n):(0,f.positionNode)(n);const n=new Map;for(const e of t.nodes)e?.id&&n.set(e.id,e);for(const o of t.edges){const r=o.start?n.get(o.start)??{}:{},s=o.end?n.get(o.end)??{}:{},a=(0,c.insertEdge)(e.edgePaths,Object.assign({},o),{},t.type,r,s,t.diagramId);o.label&&await(0,c.insertEdgeLabel)(e.rootGroups,o),o.label&&A(o,a)}const o=t.config?.swimlane?.lineHops;if(!1!==o){const n="gap"===o?"gap":"arc",r=t.edges.filter(t=>Array.isArray(t.points)&&t.points.length>=2).map(t=>({id:t.id,points:t.points,curve:t.curve,arrowTypeStart:t.arrowTypeStart,arrowTypeEnd:t.arrowTypeEnd}));F(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:n})}}function A(t,e){const n=e?.updatedPath??e?.originalPath,o=(0,h.getConfig)(),{subGraphTitleTotalMargin:r}=(0,l.getSubGraphTitleMargins)({flowchart:o.flowchart??{}});if(t.label){const o=c.edgeLabels.get(t.id);let s=t.x,a=t.y;if(n){const o=u.utils_default.calcLabelPosition(n);g.log.debug("Moving label "+t.label+" from (",s,",",a,") to (",o.x,",",o.y,") abc88"),e&&(s=o.x,a=o.y)}o.attr("transform",`translate(${s}, ${a+r/2})`)}if(t?.startLabelLeft){const e=c.terminalLabels.get(t.id).startLeft;let o=t?.x,r=t?.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}if(t.startLabelRight){const e=c.terminalLabels.get(t.id).startRight;let o=t.x,r=t.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}if(t.endLabelLeft){const e=c.terminalLabels.get(t.id).endLeft;let o=t.x,r=t.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}if(t.endLabelRight){const e=c.terminalLabels.get(t.id).endRight;let o=t.x,r=t.y;if(n){const e=u.utils_default.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);o=e.x,r=e.y}e.attr("transform",`translate(${o}, ${r})`)}}(0,m.__name)(T,"applyMarkerOffsets"),(0,m.__name)(k,"emitJump"),(0,m.__name)(N,"computeRoundedCorner"),(0,m.__name)(E,"rewriteEdgePath"),(0,m.__name)(R,"isStraightPath"),(0,m.__name)($,"curveSupportsLineHops"),(0,m.__name)(B,"decodeDataPoints"),(0,m.__name)(F,"applyLineJumpsToSvg"),(0,m.__name)(P,"adjustLayout"),(0,m.__name)(A,"positionEdgeLabel");var Y="__swimlane_default__",X=21,G=20;function z(t){return Math.max(t.padding??G,G)}function j(t){const{x:e,y:n,width:o,height:r}=t,s=t.swimlaneContentTop;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof o||"number"!=typeof r||"number"!=typeof s||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(s)||o<=0||r<=0)return void delete t.groupTitleRect;const a=n-r/2,i=Math.min(s,n+r/2),c=a+Math.min(X,Math.max(0,i-a));c<=a?delete t.groupTitleRect:t.groupTitleRect={left:e-o/2,right:e+o/2,top:a,bottom:c}}function D(t){const e=t.direction,n=t.nodes??=[];for(const n of t.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",e&&(n.direction=e));const o=n.filter(t=>!t.isGroup&&!t.parentId);if(0===o.length)return;let r=n.find(t=>t.id===Y);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r=Object.assign({id:Y,label:"",isGroup:!0,shape:"swimlane",padding:20},e?{direction:e}:{}),n.push(r));for(const t of o)t.parentId=Y}function H(t){const e=new Map;for(const n of t.nodes??[])e.set(n.id,n);const n=[];for(const e of t.edges??[]){const t="string"==typeof e.start?e.start:void 0,o="string"==typeof e.end?e.end:void 0;t&&o&&(e.labelNodeId||n.push({id:e.id,src:t,dst:o,ref:e}))}const o=t.nodes??[],r=o.filter(t=>t.isGroup),s=o.filter(t=>!t.isGroup);return{nodes:[...[...r].reverse(),...s].map(t=>t.id),edges:n,layout:t,nodeById:e}}function V(t,e,n,o){const{layout:r}=t,s=t.nodeById,a=o?.layerGap??100,i=o?.nodeGap??40;let c=0;for(const t of e.layers){let e=0;for(const o of t){const t=s.get(o);if(!t){e++;continue}t.layer=c,t.order=e;const r=n.x[o]??e*i,f=n.y[o]??c*a;t.x=r,t.y=f,e++}c++}const f=r.nodes??[],d=new Map,l=[];for(const t of f){if(!t?.isGroup)continue;t.parentId||l.push(t);const e=f.filter(e=>e.parentId===t.id);let o=1/0,r=-1/0,s=1/0,a=-1/0;for(const t of e){const e=t.x??n.x[t.id],i=t.y??n.y[t.id],c=t.width??0,f=t.height??0;null!=e&&null!=i&&(o=Math.min(o,e-c/2),r=Math.max(r,e+c/2),s=Math.min(s,i-f/2),a=Math.max(a,i+f/2))}if(o===1/0||s===1/0)t.x=t.x??0,t.y=t.y??0,t.width=t.width??0,t.height=t.height??0;else{const e=t.padding??20,n=t.parentId?e:2*z(t),i=e,c=Math.max(0,r-o)+n,f=Math.max(0,a-s)+i,l=(o+r)/2,u=(s+a)/2;t.x=l,t.y=u,t.width=c,t.height=f,d.set(t.id,{minX:o,maxX:r,minY:s,maxY:a})}}if(l.length>0&&d.size>0){let t=1/0,e=-1/0,n=0;for(const o of l){const r=o.padding??20;r>n&&(n=r);const s=d.get(o.id);s&&(t=Math.min(t,s.minY),e=Math.max(e,s.maxY))}if(t!==1/0&&e!==-1/0){const o=36,r=Math.max(0,e-t)+2*Math.max(n,o),s=(t+e)/2;for(const e of l)e.y=s,e.height=r,e.swimlaneContentTop=t;const a=[...l].sort((t,e)=>(t.x??0)-(e.x??0)),i=[],c=[],f=[];for(const t of a){const e=d.get(t.id);if(!e)continue;const n=Math.max(0,e.maxX-e.minX)+2*z(t),o=(e.minX+e.maxX)/2;i.push(t.id),c.push(o),f.push(n)}const u=i.length;if(u>0){const t=new Map;if(1===u)t.set(i[0],f[0]);else{const e=[];for(let t=0;t<u-1;t++)e.push(c[t+1]-c[t]);const n=new Array(u);n[0]=0;for(let t=0;t<u-1;t++)n[t+1]=2*e[t]-n[t];let o=0,r=Number.POSITIVE_INFINITY;for(let t=0;t<u;t++){const e=f[t];t%2==0?o=Math.max(o,e-n[t]):r=Math.min(r,n[t]-e)}let s=o;s=o<=r?(o+r)/2:o;for(let e=0;e<u;e++){const o=n[e]+(e%2==0?s:-s),r=Math.max(f[e],o);t.set(i[e],r)}}for(const e of l){const n=t.get(e.id);null!=n&&(e.width=n),j(e)}}}}}(0,m.__name)(z,"topLaneHorizontalPadding"),(0,m.__name)(j,"assignTopLaneTitleRect"),(0,m.__name)(D,"prepareLayoutForSwimlanes"),(0,m.__name)(H,"toGraphView"),(0,m.__name)(V,"writeBackToLayoutData");var W="[EdgeLabelNodes]";function U(t){const e=[],n=[],o=new Map;for(const e of t.nodes)o.set(e.id,e);for(const r of t.edges){if(!r.label||0===r.label.length)continue;if(r.isLayoutOnly)continue;if(r.labelNodeId)continue;const t=r.start?o.get(r.start):void 0,s=r.end?o.get(r.end):void 0;if(!t||!s){g.log.warn(W,`Edge ${r.id} has missing source or target node`);continue}const a=`edge-label-${r.start}-${r.end}-${r.id}`,i=t.parentId!==s.parentId?s.parentId:t.parentId,c=Object.assign({id:a,label:r.label,edgeStart:r.start??"",edgeEnd:r.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:i,isGroup:!1,labelStyle:Array.isArray(r.labelStyle)?r.labelStyle[0]:r.labelStyle??""},t.dir?{dir:t.dir}:{});e.push(c),r.labelNodeId=a,r.label=void 0,r.text=void 0;const f={id:`${r.id}-to-label`,start:r.start,end:a,type:"normal",isLayoutOnly:!0},d={id:`${r.id}-from-label`,start:a,end:r.end,type:"normal",isLayoutOnly:!0};n.push(f,d)}const r=[...t.nodes,...e],s=[...t.edges,...n];return Object.assign({},t,{nodes:r,edges:s})}(0,m.__name)(U,"createEdgeLabelNodes");var q=.001;function J(t){const e=t.x??0,n=t.y??0,o=t.width??0,r=t.height??0;return o>0&&r>0?{cx:e,cy:n,rect:gt(e,n,o,r)}:void 0}function K(t){if(t.isGroup)return;const e=J(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function Z(t,e,n=q){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function Q(t,e,n=q){return Math.abs(t.x-e.x)<n}function tt(t,e,n=q){return Math.abs(t.y-e.y)<n}function et(t,e,n=q){return tt(t,e,n)&&Math.abs(t.x-e.x)>n}function nt(t,e,n=q){return Q(t,e,n)&&Math.abs(t.y-e.y)>n}function ot(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}function rt(t,e,n=q){return t.horizontal&&e.horizontal&&tt(t.a,e.a,n)?ot(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&Q(t.a,e.a,n)?ot(t.a.y,t.b.y,e.a.y,e.b.y):0}function st(t,e=q){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],a=et(r,s,e),i=nt(r,s,e);(a||i)&&n.push({index:o,a:r,b:s,horizontal:a,vertical:i})}return n}function at(t,e=q){const n=st(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function it(t,e=q){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&Z(t,o,e)||n.push({x:o.x,y:o.y})}return n}function ct(t,e=q){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(et(n,o,e)&&nt(o,r,e)&&et(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return nt(n,o,e)&&et(o,r,e)&&nt(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function ft(t,e,n,o=0){const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),a=Math.min(t.y,e.y),i=Math.max(t.y,e.y);return s>n.left-o&&r<n.right+o&&i>n.top-o&&a<n.bottom+o}function dt(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}function lt(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function ut(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function ht(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function gt(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function mt(t){return J(t)?.rect}function pt(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}function xt(t,e,n,o,r,s=q){const a="left"===e||"right"===e,i="left"===o||"right"===o;if(a&&i){if("right"===e&&"left"===o&&t.x<n.x||"left"===e&&"right"===o&&t.x>n.x){if(tt(t,n,s))return[t,n];const e=(t.x+n.x)/2;return[t,{x:e,y:t.y},{x:e,y:n.y},n]}if(e===o){if(tt(t,n,s))return;const o="left"===e?Math.min(t.x,n.x)-r:Math.max(t.x,n.x)+r;return[t,{x:o,y:t.y},{x:o,y:n.y},n]}return}if(!a&&!i){if(e===o){if(Q(t,n,s))return;const o="top"===e?Math.min(t.y,n.y)-r:Math.max(t.y,n.y)+r;return[t,{x:t.x,y:o},{x:n.x,y:o},n]}if(!("bottom"===e&&"top"===o&&t.y<n.y||"top"===e&&"bottom"===o&&t.y>n.y))return;if(Q(t,n,s))return[t,n];const a=(t.y+n.y)/2;return[t,{x:t.x,y:a},{x:n.x,y:a},n]}if(a&&!i){const r="right"===e&&n.x>t.x||"left"===e&&n.x<t.x,s="top"===o&&t.y<n.y||"bottom"===o&&t.y>n.y;return r&&s?[t,{x:n.x,y:t.y},n]:void 0}const c="bottom"===e&&n.y>t.y||"top"===e&&n.y<t.y,f="left"===o&&t.x<n.x||"right"===o&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}function yt(t,e,n,o){return"left"===e||"right"===e?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}function _t(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=K(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function bt(t){const e=[],n=[];for(const o of t){const t=K(o);if(!t)continue;const r={id:t.id,rect:t.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}function Mt(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const t=o.x??0,r=o.y??0,s=o.width??0,a=o.height??0;n.push(Object.assign({nodeId:o.id},gt(t,r,s,a)))}return n}function It(t,e,n=q){const o=t.start,r=t.end;if(!o||!r)return;const s=e.get(o),a=e.get(r);return s&&a?{srcId:o,dstId:r,srcInfo:s,dstInfo:a,collinearX:Math.abs(s.cx-a.cx)<n,collinearY:Math.abs(s.cy-a.cy)<n}:void 0}function St(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&ft(t,e,s.rect,-r))return!0;return!1}function wt(t,e,n,o,r=q,s=1e-6){const a=tt(t,e,r),i=Q(t,e,r),c=tt(n,o,r),f=Q(n,o,r);if(a&&c||i&&f)return!1;if(!a&&!i||!c&&!f)return!1;const d=a?{a:t,b:e}:{a:n,b:o},l=i?{a:t,b:e}:{a:n,b:o},u=d.a.y,h=Math.min(d.a.x,d.b.x),g=Math.max(d.a.x,d.b.x),m=l.a.x,p=Math.min(l.a.y,l.b.y),x=Math.max(l.a.y,l.b.y);if(m<h||m>g||u<p||u>x)return!1;const y=Math.abs(m-d.a.x)<s&&Math.abs(u-d.a.y)<s||Math.abs(m-d.b.x)<s&&Math.abs(u-d.b.y)<s,_=Math.abs(m-l.a.x)<s&&Math.abs(u-l.a.y)<s||Math.abs(m-l.b.x)<s&&Math.abs(u-l.b.y)<s;return!(y&&_)}function vt(t,e,n,o,r=q){const s=tt(t,e,r),a=Q(t,e,r),i=tt(n,o,r),c=Q(n,o,r);return a&&c&&Q(t,n,r)?ot(t.y,e.y,n.y,o.y)>r:!!(s&&i&&tt(t,n,r))&&ot(t.x,e.x,n.x,o.x)>r}function Lt(t,e,n,o,{epsilon:r=q,skipDegenerateOther:s=!1}={}){for(const a of n){if(a===o||a.isLayoutOnly)continue;const n=a.points;if(n&&!(n.length<2))for(let o=0;o<n.length-1;o++){const a=n[o],i=n[o+1];if((!s||!Z(a,i,r))&&(wt(t,e,a,i,r)||vt(t,e,a,i,r)))return!0}}return!1}function Ct(t,e,n,o,r=q){const s=tt(t,e,r),a=Q(t,e,r),i=tt(n,o,r),c=Q(n,o,r);if(!(s&&c||a&&i))return!1;const f=s?{a:t,b:e}:{a:n,b:o},d=s?{a:n,b:o}:{a:t,b:e},l=f.a.y,u=Math.min(f.a.x,f.b.x),h=Math.max(f.a.x,f.b.x),g=d.a.x,m=Math.min(d.a.y,d.b.y),p=Math.max(d.a.y,d.b.y);return g>u+r&&g<h-r&&l>m+r&&l<p-r}function Ot(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+q&&t<r-q}function Tt(t,e,n){return Q(t,e)&&Q(e,n)?Ot(e.y,t.y,n.y):!(!tt(t,e)||!tt(e,n))&&Ot(e.x,t.x,n.x)}function kt(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const r=n[n.length-1],s=t[o],a=o+1<t.length?t[o+1]:void 0;if(r&&a){if(Z(r,a)){o++,e=!0;continue}if(Tt(r,s,a)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function Nt(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!Q(o,r)&&!tt(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&Q(t,o)?{x:o.x,y:r.y}:{x:r.x,y:o.y};e.push(n)}e.push(r)}const n=[];for(const t of e){const e=n[n.length-1];e&&Z(e,t)||n.push(t)}return n}function Et(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=kt(e);if(e=t.points,!t.changed)break}return e}(0,m.__name)(J,"measuredNodeRect"),(0,m.__name)(K,"nodeBoundsInfoFor"),(0,m.__name)(Z,"samePoint"),(0,m.__name)(Q,"sameX"),(0,m.__name)(tt,"sameY"),(0,m.__name)(et,"isHorizontalSegment"),(0,m.__name)(nt,"isVerticalSegment"),(0,m.__name)(ot,"overlapLength"),(0,m.__name)(rt,"sameAxisSegmentOverlapLength"),(0,m.__name)(st,"orthogonalSegmentsForPoints"),(0,m.__name)(at,"countOrthogonalBends"),(0,m.__name)(it,"dedupeConsecutivePoints"),(0,m.__name)(ct,"classifyThreeSegmentRoute"),(0,m.__name)(ft,"segmentBoundsOverlapRect"),(0,m.__name)(dt,"pointInsideRect"),(0,m.__name)(lt,"rectContainsRect"),(0,m.__name)(ut,"rectsOverlap"),(0,m.__name)(ht,"inflateRect"),(0,m.__name)(gt,"rectFromCenterSize"),(0,m.__name)(mt,"rectOfNodeBounds"),(0,m.__name)(pt,"portForRectSide"),(0,m.__name)(xt,"buildOrthogonalPortPath"),(0,m.__name)(yt,"buildSameSideTrackPath"),(0,m.__name)(_t,"collectRealNodeBounds"),(0,m.__name)(bt,"collectNodeRectEntries"),(0,m.__name)(Mt,"collectLayoutNodeRects"),(0,m.__name)(It,"getNodePairGeometry"),(0,m.__name)(St,"segmentHitsAnyRect"),(0,m.__name)(wt,"orthogonalSegmentsCross"),(0,m.__name)(vt,"sameAxisSegmentsOverlap"),(0,m.__name)(Lt,"segmentConflictsWithAnyEdge"),(0,m.__name)(Ct,"orthogonalSegmentsStrictlyCross"),(0,m.__name)(Ot,"strictlyBetween"),(0,m.__name)(Tt,"isCollinearIntermediate"),(0,m.__name)(kt,"simplifyPolylineOnce"),(0,m.__name)(Nt,"orthogonalizePolyline"),(0,m.__name)(Et,"simplifyPolyline");var Rt=.001,$t=.5,Bt=4;function Ft(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const r=o.start?e.get(o.start):void 0,s=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:r?mt(r):void 0,dstRect:s?mt(s):void 0}}function Pt(t,e,n){if(tt(t,e,Rt)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(Q(t,e,Rt)){const e=t.y<n.top?n.top:n.bottom;return{x:t.x,y:e}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}function At(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&dt(t[r],e,$t);)r+=o;if(r<0||r>=t.length)return t;const s=r-o;if(s<0||s>=t.length)return t;const a=Pt(t[r],t[s],e);return n?[a,...t.slice(r)]:[...t.slice(0,r+1),a]}function Yt(t,e){for(const n of t){const t=Ft(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=At(o,t.srcRect,!0)),t.dstRect&&(o=At(o,t.dstRect,!1)),o=Et(Nt(o)),o=Jt(o,t.srcRect,t.dstRect),t.edge.points=Et(Nt(o))}}function Xt(t,e,n,o=!1){if(tt(t,e,Rt)){if(e.y<n.top-Rt||e.y>n.bottom+Rt)return e;if(o){if(t.x<n.left-Rt)return{x:n.left,y:t.y};if(t.x>n.right+Rt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(Q(t,e,Rt)){if(e.x<n.left-Rt||e.x>n.right+Rt)return e;if(o){if(t.y<n.top-Rt)return{x:t.x,y:n.top};if(t.y>n.bottom+Rt)return{x:t.x,y:n.bottom}}const r=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:r?n.top:n.bottom}}return e}function Gt(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!Z(e,o,Rt))return e}return t[e+n]}function zt(t,e){const n=t+Bt,o=e-Bt;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}function jt(t,e,n){const{lo:o,hi:r}=zt(e,n);return Math.min(r,Math.max(o,t))}function Dt(t){const e=Math.max(...t.map(t=>t.lo)),n=Math.min(...t.map(t=>t.hi));if(!(e>n))return{lo:e,hi:n}}function Ht(t,e){return"left"===e||"right"===e?zt(t.top,t.bottom):zt(t.left,t.right)}function Vt(t,e,n){const o=t.y>=n.top-Rt&&t.y<=n.bottom+Rt,r=t.x>=n.left-Rt&&t.x<=n.right+Rt;if(tt(t,e,Rt)&&o){if(Math.abs(t.x-n.left)<Rt)return"left";if(Math.abs(t.x-n.right)<Rt)return"right"}if(Q(t,e,Rt)&&r){if(Math.abs(t.y-n.top)<Rt)return"top";if(Math.abs(t.y-n.bottom)<Rt)return"bottom"}}function Wt(t){return"left"===t||"right"===t}function Ut(t,e,n,o,r){const s=[],a=n?Vt(t,e,n):void 0,i=o?Vt(e,t,o):void 0;return n&&a&&Wt(a)===r&&s.push(Ht(n,a)),o&&i&&Wt(i)===r&&s.push(Ht(o,i)),s.length>0?Dt(s):void 0}function qt(t,e,n,o,r){const s=Ut(t,e,n,o,r);if(!s)return;const a=r?t.y:t.x,i=Math.min(s.hi,Math.max(s.lo,a));return Math.abs(i-a)<Rt?void 0:r?[{x:t.x,y:i},{x:e.x,y:i}]:[{x:i,y:t.y},{x:i,y:e.y}]}function Jt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return tt(o,r,Rt)?qt(o,r,e,n,!0)??t:Q(o,r,Rt)?qt(o,r,e,n,!1)??t:t}function Kt(t,e,n){return Wt(n)?{x:t.x,y:jt(t.y,e.top,e.bottom)}:{x:jt(t.x,e.left,e.right),y:t.y}}function Zt(t,e,n,o,r,s){const a=t.map(t=>Object.assign({},t));for(let i=e;i>=0&&i<t.length;i+=n){const e=t[i];if(s&&!tt(e,o,Rt))break;if(!s&&!Q(e,o,Rt))break;s?a[i].y=r.y:a[i].x=r.x}return a}function Qt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],a=Gt(t,o,r);if(!a)return t;const i=Vt(s,a,e);if(!i)return t;const c=Wt(i),f=Kt(s,e,i);return Z(s,f,Rt)?t:Zt(t,o,r,s,f,c)}function te(t,e,n){const o=Math.min(t.x,e.x)>=n.left-Rt&&Math.max(t.x,e.x)<=n.right+Rt,r=Math.min(t.y,e.y)>=n.top-Rt&&Math.max(t.y,e.y)<=n.bottom+Rt;return Math.abs(t.y-n.top)<Rt&&Math.abs(e.y-n.top)<Rt&&o?"top":Math.abs(t.y-n.bottom)<Rt&&Math.abs(e.y-n.bottom)<Rt&&o?"bottom":Math.abs(t.x-n.left)<Rt&&Math.abs(e.x-n.left)<Rt&&r?"left":Math.abs(t.x-n.right)<Rt&&Math.abs(e.x-n.right)<Rt&&r?"right":void 0}function ee(t,e,n,o){switch(t){case"top":return Q(e,n,Rt)&&n.y<o.top-Rt;case"bottom":return Q(e,n,Rt)&&n.y>o.bottom+Rt;case"left":return tt(e,n,Rt)&&n.x<o.left-Rt;case"right":return tt(e,n,Rt)&&n.x>o.right+Rt}}function ne(t,e,n){if(t.length<3)return t;if(n){const n=te(t[0],t[1],e);return n&&ee(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=te(t[o-1],t[o],e);return r&&ee(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function oe(t,e,n){let o=t;if(e){const t=Gt(o,0,1);if(t){const n=Xt(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=ne(o,e,!0)}if(n){const t=o.length-1,e=Gt(o,t,-1);if(e){const r=Xt(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=ne(o,n,!1)}const r=Jt(o,e,n);return r!==o||2===o.length?r:(e&&(o=Qt(o,e,!0)),n&&(o=Qt(o,n,!1)),o)}function re(t,e){for(const n of t){const t=Ft(n,e,2);if(!t)continue;const o=oe(it(t.points,Rt),t.srcRect,t.dstRect);if(o.length<3){t.edge.points=o;continue}const r=[o[0],Object.assign({},o[0]),...o.slice(1,-1),o[o.length-1],Object.assign({},o[o.length-1])];t.edge.points=r}}function se(t){return new Map(t.map(t=>[t.id,t]))}function ae(t,e){let n=t.parentId,o=null;for(;n;){const t=e.get(n);if(!t?.isGroup)break;o=t.id,n=t.parentId}return o}function ie(t,e){let n=0,o=t.parentId;for(;o;){const t=e.get(o);if(!t?.isGroup)break;n++,o=t.parentId}return n}function ce(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const s of t){const t=s.x,a=s.y;if("number"!=typeof t||"number"!=typeof a)continue;const i=s.width??0,c=s.height??0;e=Math.min(e,t-i/2),n=Math.max(n,t+i/2),o=Math.min(o,a-c/2),r=Math.max(r,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:r}}function fe(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}function de(t){const e=se(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>ie(n,e)-ie(t,e));for(const e of n){const n=ce(t.filter(t=>t.parentId===e.id));n&&fe(e,n)}}function le(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,a=-1/0;for(const t of r){const n=t[e];"number"==typeof n&&(s=Math.min(s,n),a=Math.max(a,n))}if(!Number.isFinite(s)||!Number.isFinite(a))return!1;const i=(0,m.__name)(t=>s+a-t,"mirror");for(const t of n){const n=t[e];"number"==typeof n&&(t[e]=i(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?Object.assign({},o,{left:i(o.right),right:i(o.left)}):Object.assign({},o,{top:i(o.bottom),bottom:i(o.top)}))}for(const t of o)for(const n of t.points??[])n[e]=i(n[e]);return!0}function ue(t){return!(t.nodes??[]).some(t=>!t.isGroup)||le(t,"y")}function he(t,e="LR"){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,a=1/0;for(const t of r){const e=t.x??0,n=t.y??0;e<s&&(s=e),n<a&&(a=n)}if(!Number.isFinite(s)||!Number.isFinite(a))return!1;const i=36;let c=0,f=0;for(const t of r)c+=t.width??0,f+=t.height??0;const d=c/r.length,l=f/r.length,u=l>0?Math.max(1,d/l):1;for(const t of r){const e=t.x??0,n=((t.y??0)-a)*u+i,o=e-s;t.x=n,t.y=o}for(const t of o)if(t.points)for(const e of t.points){const t=e.x,n=(e.y-a)*u+i,o=t-s;e.x=n,e.y=o}de(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&le(t,"x"),!0;const g=se(n),m=new Map;for(const t of n){if(t.isGroup)continue;const e=ae(t,g);if(!e)continue;const n=m.get(e)??[];n.push(t),m.set(e,n)}let p=0;for(const t of h){const e=t.padding??0;e>p&&(p=e)}const x=[];let y=1/0,_=-1/0;for(const t of h){const e=ce(m.get(t.id)??[]);e&&(y=Math.min(y,e.minX),_=Math.max(_,e.maxX),x.push({lane:t,contentTop:e.minY,contentBottom:e.maxY,centerY:(e.minY+e.maxY)/2}))}if(y===1/0||_===-1/0)return!0;const b=Math.max(0,_-y)+2*Math.max(p,10),M=i+b,I=(y+_)/2-b/2-i,S=I+M/2,w=Math.max(p,i);x.sort((t,e)=>t.centerY-e.centerY);for(let t=0;t<x.length;t++){const e=x[t];let n,o;if(0===t)n=e.contentTop-w;else{n=(x[t-1].contentBottom+e.contentTop)/2}if(t===x.length-1)o=e.contentBottom+w;else{const n=x[t+1];o=(e.contentBottom+n.contentTop)/2}const r=Math.max(0,o-n),s=(n+o)/2;e.lane.x=S,e.lane.y=s,e.lane.width=M,e.lane.height=r,e.lane.swimlaneContentTop=e.contentTop,e.lane.groupTitleRect={left:I,right:I+i,top:n,bottom:o}}return"RL"===e&&le(t,"x"),!0}(0,m.__name)(Ft,"endpointContextFor"),(0,m.__name)(Pt,"segmentEnterPoint"),(0,m.__name)(At,"clipEndpoint"),(0,m.__name)(Yt,"clipEdgeEndpointsToNodeBoundaries"),(0,m.__name)(Xt,"snapEndpointToBoundary"),(0,m.__name)(Gt,"firstDistinctAdjacent"),(0,m.__name)(zt,"cornerClearanceRange"),(0,m.__name)(jt,"clampToCornerClearance"),(0,m.__name)(Dt,"intersectRanges"),(0,m.__name)(Ht,"clearanceRangeForSide"),(0,m.__name)(Vt,"terminalSideForSegment"),(0,m.__name)(Wt,"isHorizontalSide"),(0,m.__name)(Ut,"straightClearanceRange"),(0,m.__name)(qt,"clearStraightEndpointCornerAxis"),(0,m.__name)(Jt,"clearStraightEndpointCornerConnections"),(0,m.__name)(Kt,"cornerClearedEndpoint"),(0,m.__name)(Zt,"moveCollinearEndpointRun"),(0,m.__name)(Qt,"clearEndpointCornerConnection"),(0,m.__name)(te,"borderSideForSegment"),(0,m.__name)(ee,"leavesOutward"),(0,m.__name)(ne,"collapseOwnBorderStub"),(0,m.__name)(oe,"snapAndCollapseEndpoints"),(0,m.__name)(re,"prepareEdgeEndpointsForRenderer"),(0,m.__name)(se,"buildNodeMap"),(0,m.__name)(ae,"resolveTopLevelGroupId"),(0,m.__name)(ie,"groupDepth"),(0,m.__name)(ce,"boundsForChildren"),(0,m.__name)(fe,"applyGroupBounds"),(0,m.__name)(de,"recomputeNestedGroupBounds"),(0,m.__name)(le,"mirrorAxis"),(0,m.__name)(ue,"applyBtDirectionTransform"),(0,m.__name)(he,"applyLrDirectionTransform");var ge=1e-6,me=[0,8,-8,16,-16];function pe(t,e){const{nodeInfoById:n,realNodeRects:o}=_t(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=ct(it(r,ge),ge);if(!s)continue;const{p3:a}=s,i="HVH"===s.kind,c=It(e,n,ge);if(!c)continue;const{srcId:f,dstId:d,srcInfo:l,dstInfo:u,collinearX:h,collinearY:g}=c;if(h||g)continue;let m;const p=l.rect;for(const n of me){let r,s,c;if(i){const t=u.cy>l.cy?p.bottom:p.top,e=l.cx+n;if(e<=p.left+ge||e>=p.right-ge)continue;r={x:e,y:t},s={x:e,y:a.y},c={x:a.x,y:a.y}}else{const t=u.cx>l.cx?p.right:p.left,e=l.cy+n;if(e<=p.top+ge||e>=p.bottom-ge)continue;r={x:t,y:e},s={x:a.x,y:e},c={x:a.x,y:a.y}}const h=Z(r,s,ge),g=Z(s,c,ge);if(h&&g)continue;if(!h&&St(r,s,o,[f],1))continue;if(!g&&St(s,c,o,[d],1))continue;const x=!h&&Lt(r,s,t,e,{epsilon:ge,skipDegenerateOther:!0}),y=!g&&Lt(s,c,t,e,{epsilon:ge,skipDegenerateOther:!0});if(!x&&!y){m=h?[s,c]:g?[r,s]:[r,s,c];break}}m&&(e.points=m)}}function xe(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=bt(e.values());for(const s of t){if(s.isLayoutOnly)continue;const a=s.points;if(!a||a.length<4)continue;const i=it(a,n);if(i.length<4)continue;const c=i.length-1,f=i[c],d=i[c-1],l=i[c-2],u=f.x-d.x,h=f.y-d.y,g=Math.hypot(u,h);if(g>=10||g<n)continue;const p=d.x-l.x,x=d.y-l.y;if(Math.hypot(p,x)<n)continue;const y=et(d,f,n),_=nt(d,f,n),b=et(l,d,n),M=nt(l,d,n);if(!(y&&M||_&&b))continue;const I=s.end,S=s.start,w=I?e.get(I):void 0;if(!w)continue;const v=w.x??0,L=w.y??0,C=mt(w);if(!C)continue;let O,T;if(M){const t=x<0;O={x:v,y:l.y},T={x:v,y:t?C.bottom:C.top}}else{const t=p>0;O={x:l.x,y:L},T={x:t?C.right:C.left,y:L}}if(St(O,T,o,I?[I]:[],-2))continue;if(St(O,T,r,[],-2))continue;if(S){const t=e.get(S),n=t?mt(t):void 0;if(n&&dt(O,n,2))continue}const k=(0,m.__name)((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),N=new Set;for(let t=0;t<i.length-1;t++)N.add(k(i[t],i[t+1]));const E=(0,m.__name)((e,o)=>{for(const r of t){if(r===s)continue;if(r.isLayoutOnly)continue;const t=r.points;if(t&&!(t.length<2))for(let r=0;r<t.length-1;r++){const s=t[r],a=t[r+1];if(!N.has(k(s,a))&&Ct(e,o,s,a,n))return!0}}return!1},"segmentCrossesOtherEdge");if(E(O,T))continue;if(c-3>=0){const t=i[c-3];if(St(t,O,o,[S,I].filter(t=>Boolean(t)),-2))continue;if(E(t,O))continue}const R=[...i.slice(0,c-2),O,T];s.points=R;const $=s.labelNodeId;if($){const t=e.get($);if(t){const e=t.width??0,o=t.height??0;if(e>0&&o>0){let r,s,a=-1;for(let t=0;t<R.length-1;t++){const i=R[t],c=R[t+1],f=Math.hypot(c.x-i.x,c.y-i.y),d=tt(i,c,n),l=Q(i,c,n);(d&&f>=e+2||l&&f>=o+2)&&(f>a&&(a=f,r=(i.x+c.x)/2,s=(i.y+c.y)/2))}void 0!==r&&void 0!==s&&(t.x=r,t.y=s)}}}}}(0,m.__name)(pe,"portSwapToLShape"),(0,m.__name)(xe,"collapseShortTerminalStub");var ye=.001,_e=8,be=st,Me=(0,m.__name)((t,e)=>Q(t,e,ye)||tt(t,e,ye),"orthogonallyAligned");function Ie(t,e){const n=(0,m.__name)((t,e)=>{const n=t.x??0,o=t.y??0,r=e.x-n,s=e.y-o;let a=(t.width??0)/2,i=(t.height??0)/2;return Math.abs(s)*a>Math.abs(r)*i?(s<0&&(i=-i),{x:n+(0===s?0:i*r/s),y:o+i}):(r<0&&(a=-a),{x:n+a,y:o+(0===r?0:a*s/r)})},"rectIntersect"),o=(0,m.__name)((t,o)=>{const r=it(t.points??[]);if(r.length<2)return;const s=o?t.start:t.end,a=s?e.get(s):void 0,i=a?mt(a):void 0;if(!a||!s||!i)return;const c=o?r[0]:r[r.length-1],f=o?r[1]:r[r.length-2],d=n(a,c);let l=c;return Me(f,d)&&(l=f),Q(d,l,ye)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"V",coord:d.x,min:Math.min(d.y,l.y),max:Math.max(d.y,l.y),boundary:d,railEnd:l,rect:i}:tt(d,l,ye)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"H",coord:d.y,min:Math.min(d.x,l.x),max:Math.max(d.x,l.x),boundary:d,railEnd:l,rect:i}:void 0},"terminalLaneFor"),r=(0,m.__name)((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),s=(0,m.__name)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;if("H"===t.orientation){return(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&Q(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&tt(t.boundary,e.boundary,1)},"sameTerminalFace"),a=(0,m.__name)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;return r(t,e)>=_e&&Math.abs(t.coord-e.coord)<.5},"exactTerminalLaneConflict"),i=(0,m.__name)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation||"H"!==t.orientation||t.atStart===e.atStart)return!1;const n=r(t,e);if(n<_e)return!1;const o=t.rect.bottom-t.rect.top;return!(n<o||n>2*o)&&(s(t,e)&&Math.abs(t.coord-e.coord)<16)},"nearTerminalLaneConflict"),c=(0,m.__name)((t,e)=>{const n=it(t.edge.points??[]);if(n.length<2)return;const o="V"===t.orientation?{x:t.boundary.x+e,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+e},r="V"===t.orientation?{x:t.railEnd.x+e,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+e};if(!(0,m.__name)(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?tt(o,t.boundary,ye)&&o.x>=t.rect.left+1&&o.x<=t.rect.right-1:(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&(Q(o,t.boundary,ye)&&o.y>=t.rect.top+1&&o.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=n.length>1&&Z(n[1],t.railEnd,ye),s=n.slice(e?2:1),a=s[0];if(a&&!Me(a,r))return;return[o,r,...s]}const s=n.length>1&&Z(n[n.length-2],t.railEnd,ye),a=n.slice(0,s?-2:-1),i=a[a.length-1];return!i||Me(i,r)?[...a,r,o]:void 0},"shiftedCandidate"),f=(0,m.__name)(t=>{const n=t.edge,o=it(n.points??[]);if(2!==o.length)return!1;const r=n.start,s=n.end,a=r?e.get(r):void 0,i=s?e.get(s):void 0;if(!a||!i)return!1;const c=a.x??0,f=a.y??0,d=i.x??0,l=i.y??0,[u,h]=o;return tt(u,h,ye)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||Q(u,h,ye)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),d=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){const e=t.filter(t=>!t.isLayoutOnly).flatMap(t=>[o(t,!0),o(t,!1)]).filter(t=>Boolean(t));let n=!1;for(let t=0;t<e.length&&!n;t++)for(let r=t+1;r<e.length&&!n;r++){const s=e[t],l=e[r];if(s.edge===l.edge||!a(s,l)&&!i(s,l))continue;const u=!a(s,l),h=[s,l].sort((t,e)=>{const n=f(t),o=f(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const r of d){const s=c(t,r);if(!s)continue;const f=o(Object.assign({},t.edge,{points:s}),t.atStart);if(f&&!e.some(e=>e.edge!==t.edge&&(a(f,e)||u&&i(f,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function Se(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=(0,m.__name)((e,r)=>{const s=e.start,a=e.end,i=be(r);if(i.length!==r.length-1)return!1;const c=[s,a].filter(t=>Boolean(t));for(const t of i){if(St(t.a,t.b,n,c,-2))return!1;if(St(t.a,t.b,o,[],-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of i)for(const n of be(it(t))){if(rt(e,n,.5)>=_e)return!1;if(Ct(e.a,e.b,n.a,n.b,ye))return!1}}return!0},"candidateIsSafe"),s=(0,m.__name)((t,e)=>{if(e+4>=t.length)return;const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],a=t[e+4],i=et(n,o)&&nt(o,r)&&et(r,s)&&nt(s,a)&&Q(n,s,ye)&&Q(n,a,ye)&&Q(o,r,ye)&&(o.x-n.x)*(s.x-r.x)<0,c=nt(n,o)&&et(o,r)&&nt(r,s)&&et(s,a)&&tt(n,s,ye)&&tt(n,a,ye)&&tt(o,r,ye)&&(o.y-n.y)*(s.y-r.y)<0;if(i||c)return it([...t.slice(0,e+1),a,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=nt(n,o)&&et(o,r)&&nt(r,s)&&et(s,a)&&nt(a,f)&&Q(n,a,ye)&&Q(n,f,ye)&&Q(r,s,ye)&&(r.x-o.x)*(a.x-s.x)<0,l=et(n,o)&&nt(o,r)&&et(r,s)&&nt(s,a)&&et(a,f)&&tt(n,a,ye)&&tt(n,f,ye)&&tt(r,s,ye)&&(r.y-o.y)*(a.y-s.y)<0;return d||l?it([...t.slice(0,e+1),f,...t.slice(e+6)]):void 0},"withoutDogleg");for(let e=0;e<8;e++){let e=!1;for(const n of t){if(n.isLayoutOnly)continue;const t=it(n.points??[]);for(let o=0;o<=t.length-5;o++){const a=s(t,o);if(a&&r(n,a)){n.points=a,e=!0;break}}if(e)break}if(!e)return}}function we(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,m.__name)((t,e,n)=>it(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,m.__name)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const a=be(s(r[o],t,e));for(let i=o+1;i<r.length;i++){const o=be(s(r[i],t,e));for(const t of a)for(const e of o)Ct(t.a,t.b,e.a,e.b,ye)&&n++}}return n},"strictCrossingCount"),i=(0,m.__name)(t=>{const e=be(t);if(3!==e.length)return;const n=e[1];return e[0].horizontal!==n.horizontal&&e[2].horizontal!==n.horizontal?{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}:void 0},"middleRail"),c=(0,m.__name)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));return n.filter(t=>{if(o.includes(t.id))return!1;const n=t.rect;if(e.horizontal){return ot(e.a.x,e.b.x,n.left,n.right)>=_e&&e.a.y>=n.top-2&&e.a.y<=n.bottom+2}return ot(e.a.y,e.b.y,n.top,n.bottom)>=_e&&e.a.x>=n.left-2&&e.a.x<=n.right+2})},"blockingRectsFor"),f=(0,m.__name)((t,e,n)=>{const o=t.map(t=>Object.assign({},t));if(e.horizontal)o[e.index].y=n,o[e.index+1].y=n;else{if(!e.vertical)return;o[e.index].x=n,o[e.index+1].x=n}const r=Et(it(o));return be(r).length===r.length-1?r:void 0},"candidateByMovingRail"),d=(0,m.__name)((t,e,i)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=be(e);if(f.length!==e.length-1)return!1;for(const t of f){if(St(t.a,t.b,n,c,-2))return!1;if(St(t.a,t.b,o,[],-2))return!1}for(const e of r)if(e!==t)for(const t of f)for(const n of be(s(e)))if(rt(t,n,.5)>=_e)return!1;return a(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e=!1;for(const n of r){const o=s(n),r=i(o);if(!r)continue;const a=c(n,r.segment);if(0===a.length)continue;const l=r.horizontal?[Math.min(...a.map(t=>t.rect.top))-20,Math.max(...a.map(t=>t.rect.bottom))+20]:[Math.min(...a.map(t=>t.rect.left))-20,Math.max(...a.map(t=>t.rect.right))+20];for(const s of l){const a=f(o,r.segment,s);if(a&&d(n,a,t)){n.points=a,e=!0;break}}if(e)break}if(!e)return}}function ve(t,e){const n=(0,m.__name)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,m.__name)(t=>{if(!t.isGroup||t.parentId)return;const e=t.direction,o="string"==typeof e?e.toUpperCase():"";if("LR"===o||"RL"===o||"BT"===o)return;const r=n(t),s=t.y,a=t.height;if(!r||"number"!=typeof s||"number"!=typeof a||!Number.isFinite(s)||!Number.isFinite(a)||a<=0)return;const i=r.right-r.left,c=r.bottom-r.top;return c<=0||i<c?void 0:{node:t,rect:r}},"topLaneTitleFor"),r=(0,m.__name)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+ye||n>=e.bottom-ye)&&ot(t.a.x,t.b.x,e.left,e.right)>=_e},"horizontalSegmentIntersectsTitle"),s=[...e.values()].map(o).filter(t=>Boolean(t));if(0===s.length)return;let a=0;for(const e of t){if(e.isLayoutOnly)continue;const t=it(e.points??[]);for(const e of be(t))for(const t of s)r(e,t.rect)&&(a=Math.max(a,t.rect.bottom-e.a.y+4))}if(!(a<=ye))for(const t of s){const e=t.node.y,n=t.node.height;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.y=e-a/2,t.node.height=n+a,t.node.groupTitleRect=Object.assign({},t.rect,{top:t.rect.top-a,bottom:t.rect.bottom-a}))}}function Le(t,e){const n=(0,m.__name)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,m.__name)(t=>{if(!t.isGroup||t.parentId)return;if("LR"!==t.direction)return;const e=n(t),o=t.x,r=t.width;if(!e||"number"!=typeof o||"number"!=typeof r||!Number.isFinite(o)||!Number.isFinite(r)||r<=0)return;const s=e.right-e.left,a=e.bottom-e.top;return s<=0||a<s?void 0:{node:t,rect:e}},"leftLaneTitleFor"),r=(0,m.__name)((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<=e.left+ye||n>=e.right-ye)&&ot(t.a.y,t.b.y,e.top,e.bottom)>=_e},"verticalSegmentIntersectsTitle"),s=(0,m.__name)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+ye||n>=e.bottom-ye)&&ot(t.a.x,t.b.x,e.left,e.right)>=_e},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(o).filter(t=>Boolean(t));if(0===a.length)return;let i=0;for(const e of t){if(e.isLayoutOnly)continue;const t=it(e.points??[]);for(const e of be(t))for(const t of a)if(r(e,t.rect))i=Math.max(i,t.rect.right-e.a.x+4);else if(s(e,t.rect)){const n=Math.min(e.a.x,e.b.x);i=Math.max(i,t.rect.right-n+4)}}if(!(i<=ye))for(const t of a){const e=t.node.x,n=t.node.width;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.x=e-i/2,t.node.width=n+i,t.node.groupTitleRect=Object.assign({},t.rect,{left:t.rect.left-i,right:t.rect.right-i}))}}function Ce(t,e){const{realNodeRects:n}=bt(e.values()),o=t.filter(t=>!t.isLayoutOnly),r=(0,m.__name)((t,e=new Map)=>it(e.get(t)??t.points??[]),"replacementPointsFor"),s=(0,m.__name)((t=new Map)=>{let e=0;for(let n=0;n<o.length;n++){const s=be(r(o[n],t));for(let a=n+1;a<o.length;a++){const n=be(r(o[a],t));for(const t of s)for(const o of n)Ct(t.a,t.b,o.a,o.b,ye)&&e++}}return e},"crossingCount"),a=(0,m.__name)((t=new Map)=>o.reduce((e,n)=>e+at(r(n,t)),0),"totalBends"),i=(0,m.__name)(t=>{const e=r(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return et(n,o,ye)||nt(n,o,ye)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),c=(0,m.__name)((t,e)=>{const n=r(t);if(n.length<3)return;const o=n[0],s=n[1];let a;if(et(o,s,ye))a={x:s.x,y:e.tailStart.y};else{if(!nt(o,s,ye))return;a={x:e.tailStart.x,y:s.y}}const i=Et(it([o,s,a,e.tailStart,e.terminal]));return be(i).length===i.length-1?i:void 0},"candidateWithDestinationTail"),f=(0,m.__name)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));for(const t of be(e))if(St(t.a,t.b,n,o,-2))return!0;return!1},"pathHasNodeHit"),d=(0,m.__name)((t,e,n)=>{for(const s of o)if(s!==t)for(const t of be(e))for(const e of be(r(s,n)))if(rt(t,e,.5)>=_e)return!0;return!1},"pathHasSharedTrack"),l=(0,m.__name)((t,e,n)=>!f(t,e)&&!d(t,e,n),"candidateIsSafe"),u=(0,m.__name)(()=>{const t=new Map;for(const n of o){const o=n.end;if(!o||!e.has(o))continue;if(r(n).length<4)continue;const s=t.get(o)??[];s.push(n),t.set(o,s)}return t},"edgesByDestination");for(let t=0;t<4;t++){const t=s();if(0===t)return;let e,n=t,o=a();for(const r of u().values())for(let f=0;f<r.length;f++)for(let d=f+1;d<r.length;d++){const u=r[f],h=r[d],g=i(u),m=i(h);if(!g||!m)continue;const p=c(u,m),x=c(h,g);if(!p||!x)continue;const y=new Map([[u,p],[h,x]]);if(!l(u,p,y)||!l(h,x,y))continue;const _=s(y),b=a(y);_>=t||(_>n||_===n&&b>=o||(e=y,n=_,o=b))}if(!e)return;for(const[t,n]of e)t.points=n}}function Oe(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,m.__name)((t,e=new Map)=>it(e.get(t)??t.points??[]),"replacementPointsFor"),a=(0,m.__name)((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=be(s(r[n],t));for(let a=n+1;a<r.length;a++){const n=be(s(r[a],t));for(const t of o)for(const o of n)Ct(t.a,t.b,o.a,o.b,ye)&&e++}}return e},"strictCrossingCount"),i=(0,m.__name)((t=new Map)=>r.reduce((e,n)=>e+at(s(n,t)),0),"totalBends"),c=(0,m.__name)(t=>{const n=t.start,o=t.end,r=n?e.get(n):void 0,s=o?e.get(o):void 0,a=r?mt(r):void 0,i=s?mt(s):void 0;return a&&i?{src:a,dst:i}:void 0},"endpointRectsFor"),f=(0,m.__name)((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=c(t);if(o){if(n.vertical){const r=n.a.x,s=Math.min(o.src.left,o.dst.left),a=Math.max(o.src.right,o.dst.right),i=r<s-ye?"left":r>a+ye?"right":void 0;if(!i)return;return{edge:t,points:e,segmentIndex:n.index,axis:"vertical",side:i,coord:r,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){const r=n.a.y,s=Math.min(o.src.top,o.dst.top),a=Math.max(o.src.bottom,o.dst.bottom),i=r<s-ye?"top":r>a+ye?"bottom":void 0;if(!i)return;return{edge:t,points:e,segmentIndex:n.index,axis:"horizontal",side:i,coord:r,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),d=(0,m.__name)(()=>{const t=[];for(const e of r){const n=s(e);for(const o of be(n)){const r=f(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),l=(0,m.__name)((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&ot(t.min,t.max,e.min,e.max)>=_e,"railsInteract"),u=(0,m.__name)(t=>{const e=[],n=new Set;for(const o of t){if(n.has(o))continue;const r=[o],s=[];for(n.add(o);r.length>0;){const e=r.pop();s.push(e);for(const o of t)!n.has(o)&&l(e,o)&&(n.add(o),r.push(o))}s.length>1&&e.push(s)}return e},"connectedComponents"),h=(0,m.__name)(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<ye)||e.push(n.coord);for(;e.length<t.length;){const n=Math.min(...e),o=Math.max(...e),r=t[0].side;e.push("left"===r||"top"===r?n-12*(t.length-e.length):o+12*(t.length-e.length))}return e},"uniqueCoordsFor"),g=(0,m.__name)(t=>{const e=t.map(t=>t.coord),n=h(t),o=[];if(t.length<=6){const r=new Array(n.length).fill(!1),s=[],a=(0,m.__name)(()=>{if(s.length!==t.length)for(const[t,e]of n.entries())r[t]||(r[t]=!0,s.push(e),a(),s.pop(),r[t]=!1);else s.some((t,n)=>Math.abs(t-e[n])>=ye)&&o.push([...s])},"visit");return a(),o}for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){const r=[...e];[r[t],r[n]]=[r[n],r[t]],o.push(r)}return o},"coordinateAssignmentsFor"),p=(0,m.__name)((t,e)=>{const n=new Map;for(const[o,r]of t.entries()){const t=e[o],s=n.get(r.edge)??r.points.map(t=>({x:t.x,y:t.y}));"vertical"===r.axis?(s[r.segmentIndex].x=t,s[r.segmentIndex+1].x=t):(s[r.segmentIndex].y=t,s[r.segmentIndex+1].y=t),n.set(r.edge,s)}const o=new Map;for(const[t,e]of n){const n=Et(it(e));if(be(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),x=(0,m.__name)(t=>{for(const[e,r]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of be(r)){if(St(e.a,e.b,n,t,-2))return!1;if(St(e.a,e.b,o,[],-2))return!1}}for(let e=0;e<r.length;e++){const n=r[e],o=t.has(n),a=be(s(n,t));for(let n=e+1;n<r.length;n++){const e=r[n];if(!o&&!t.has(e))continue;const i=be(s(e,t));for(const t of a)for(const e of i)if(rt(t,e,.5)>=_e)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=a();if(0===t)return;let e,n=t,o=i(),r=Number.POSITIVE_INFINITY;for(const s of u(d()))for(const c of g(s)){const f=p(s,c);if(!f||!x(f))continue;const d=a(f);if(d>=t)continue;const l=i(f),u=s.reduce((t,e,n)=>t+Math.abs(c[n]-e.coord),0);d>n||d===n&&(l>o||l===o&&u>=r)||(e=f,n=d,o=l,r=u)}if(!e)return;for(const[t,n]of e)t.points=n}}function Te(t,e){const{realNodeRects:n,labelNodeRects:o}=bt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,m.__name)((t,e,n)=>it(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,m.__name)(t=>be(t).reduce((t,e)=>{const n=e.a.x-e.b.x,o=e.a.y-e.b.y;return t+Math.hypot(n,o)},0),"pathLength"),i=(0,m.__name)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const a=be(s(r[o],t,e));for(let i=o+1;i<r.length;i++){const o=be(s(r[i],t,e));for(const t of a)for(const e of o)Ct(t.a,t.b,e.a,e.b,ye)&&n++}}return n},"strictCrossingCount"),c=(0,m.__name)((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&ot(t.a.x,t.b.x,e.left,e.right)>=_e}if(t.vertical){const n=t.a.x;return(Math.abs(n-e.left)<1||Math.abs(n-e.right)<1)&&ot(t.a.y,t.b.y,e.top,e.bottom)>=_e}return!1},"segmentRunsAlongRectBorder"),f=(0,m.__name)(t=>{const n=[t.start,t.end].filter(t=>Boolean(t)),o=[];for(const t of n){const n=e.get(t),r=n?mt(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),d=(0,m.__name)((t,e)=>{if(e+3>=t.length)return[];const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],a=et(n,o,ye)&&nt(o,r,ye)&&et(r,s,ye),i=nt(n,o,ye)&&et(o,r,ye)&&nt(r,s,ye);if(!a&&!i)return[];if(!(a?Math.sign(o.x-n.x)!==Math.sign(s.x-r.x):Math.sign(o.y-n.y)!==Math.sign(s.y-r.y)))return[];const c=Q(n,s,ye)||tt(n,s,ye)?[]:[{x:n.x,y:s.y},{x:s.x,y:n.y}],f=0===c.length?[[...t.slice(0,e+1),...t.slice(e+3)]]:c.map(n=>[...t.slice(0,e+1),n,...t.slice(e+3)]),d=new Set;return f.map(t=>Et(it(t))).filter(t=>{if(be(t).length!==t.length-1)return!1;if(!t.some(t=>Z(t,s,ye)))return!1;const e=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!d.has(e)&&(d.add(e),!0)})},"shortcutCandidatesAt"),l=(0,m.__name)((t,e,a)=>{const d=[t.start,t.end].filter(t=>Boolean(t)),l=f(t);for(const t of be(e)){if(St(t.a,t.b,n,d,-2))return!1;if(St(t.a,t.b,o,[],-2))return!1;if(l.some(e=>c(t,e)))return!1}for(const n of r)if(n!==t)for(const t of be(e))for(const e of be(s(n)))if(rt(t,e,.5)>=_e)return!1;return i(t,e)<=a},"candidateIsSafe");for(let t=0;t<8;t++){const t=i();let e,n,o=t,c=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const u of r){const r=s(u),h=at(r,ye),g=a(r);for(let s=0;s<=r.length-4;s++)for(const m of d(r,s)){const r=at(m,ye),s=a(m);if(!(r<h||r===h&&s<g-ye)||!l(u,m,t))continue;const d=i(u,m);d>o||d===o&&(r>c||r===c&&s>=f)||(e=u,n=m,o=d,c=r,f=s)}}if(!e||!n)return;e.points=n}}function ke(t,e){const n=20,o=[];for(const t of e.values()){if(t.isGroup||t.isEdgeLabel)continue;const e=t.x??0,n=t.y??0,r=mt(t);r&&o.push({id:String(t.id??""),cx:e,cy:n,rect:r})}if(0===o.length)return;const r=new Map(o.map(t=>[t.id,t])),s=o.map(t=>({id:t.id,rect:t.rect})),a=["top","bottom","left","right"],i={top:Math.min(...o.map(t=>t.rect.top))-n,bottom:Math.max(...o.map(t=>t.rect.bottom))+n,left:Math.min(...o.map(t=>t.rect.left))-n,right:Math.max(...o.map(t=>t.rect.right))+n},c=t.filter(t=>!t.isLayoutOnly),f=new Map(c.map((t,e)=>[t,e])),d=(0,m.__name)(t=>{const e="left"===t||"top"===t?-1:1,o=[];for(let r=0;r<=2;r++)o.push(i[t]+e*n*r);return o},"outwardTracksForSide"),l=(0,m.__name)((t,e=new Map)=>it(e.get(t)??t.points??[]),"replacementPointsFor"),u=(0,m.__name)((t,e)=>{let n=0;for(const o of t)for(const t of e)Ct(o.a,o.b,t.a,t.b,ye)&&n++;return n},"crossingCountBetweenSegments"),h=(0,m.__name)((t,e)=>u(be(t),be(e)),"crossingCountBetweenPaths"),g=(0,m.__name)((t=new Map)=>{let e=0;const n=[],o=new Set,r=[],s=(0,m.__name)(t=>{o.has(t)||(o.add(t),r.push(t))},"addEdge");for(let o=0;o<c.length;o++){const r=c[o],a=l(r,t);for(let i=o+1;i<c.length;i++){const o=c[i],f=h(a,l(o,t));f>0&&(e+=f,n.push({first:r,second:o,count:f}),s(r),s(o))}}return r.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),{count:e,pairs:n,edgeSet:o,edges:r}},"crossingSnapshot"),p=(0,m.__name)((t,e)=>{const n=new Set(e.keys());if(0===n.size)return t.count;let o=0;for(const e of t.pairs)(n.has(e.first)||n.has(e.second))&&(o+=e.count);let r=0;for(let t=0;t<c.length;t++){const o=c[t],s=n.has(o),a=l(o,e);for(let o=t+1;o<c.length;o++){const t=c[o];(s||n.has(t))&&(r+=h(a,l(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),x=(0,m.__name)(t=>{const e=new Map;for(const n of t.pairs){const t=e.get(n.first)??new Set;t.add(n.second),e.set(n.first,t);const o=e.get(n.second)??new Set;o.add(n.first),e.set(n.second,o)}const n=[],o=new Set;for(const r of t.edges){if(o.has(r))continue;const t=[r],s=[];for(o.add(r);t.length>0;){const n=t.pop();s.push(n);for(const r of e.get(n)??[])o.has(r)||(o.add(r),t.push(r))}s.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),y=(0,m.__name)(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),_=(0,m.__name)(t=>{const e=[];for(const n of x(t)){const t=new Set(n),o=new Set(n.flatMap(t=>y(t))),r=[...n];for(const e of c)t.has(e)||y(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),b=(0,m.__name)((t,e,n)=>p(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),M=(0,m.__name)(t=>{const e=new Map;for(const n of t.pairs)e.set(n.first,(e.get(n.first)??0)+n.count),e.set(n.second,(e.get(n.second)??0)+n.count);return e},"currentCrossingsByEdge"),I=(0,m.__name)(t=>t.slice(1).reduce((e,n,o)=>{const r=t[o];return e+Math.abs(n.x-r.x)+Math.abs(n.y-r.y)},0),"pathLength"),S=(0,m.__name)((t=new Map)=>c.reduce((e,n)=>e+at(l(n,t)),0),"totalBends"),w=(0,m.__name)((t=new Map)=>c.reduce((e,n)=>e+I(l(n,t)),0),"totalLength"),v=(0,m.__name)((t,e,n=new Map)=>{const o=be(e);for(const e of c)if(e!==t)for(const t of o)for(const o of be(l(e,n)))if(rt(t,o,.5)>=_e)return!0;return!1},"pathHasSegmentConflict"),L=(0,m.__name)((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of be(e))if(St(t.a,t.b,s,n,-2))return!0;return!1},"pathHitsNode"),C=(0,m.__name)((t,e)=>{const n=Et(it(e));be(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),O=(0,m.__name)(t=>"left"===t||"right"===t,"sideIsHorizontal"),T=(0,m.__name)((t,e,o)=>{switch(e){case"left":return Math.min(t.x,o.x)-n;case"right":return Math.max(t.x,o.x)+n;case"top":return Math.min(t.y,o.y)-n;case"bottom":return Math.max(t.y,o.y)+n}},"localTrackForSameSide"),k=(0,m.__name)((t,e,o,r)=>{const s="left"===o||"top"===o?-1:1,a=[T(e,o,r),i[o]];for(const i of a)for(let a=0;a<=2;a++)C(t,yt(e,o,r,i+s*n*a))},"addSameSideCandidates"),N=(0,m.__name)((t,e,n,o,r)=>{for(const s of d(n))for(const n of d(r))C(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),E=(0,m.__name)((t,e,n,o,r)=>{for(const s of d(n))for(const n of d(r))C(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),R=(0,m.__name)((t,e,n,o,r)=>{const s=[...d("top"),...d("bottom")];for(const a of d(n))for(const n of d(r))for(const r of s)C(t,[e,{x:a,y:e.y},{x:a,y:r},{x:n,y:r},{x:n,y:o.y},o])},"addHorizontalPairCandidates"),$=(0,m.__name)((t,e,n,o,r)=>{const s=[...d("left"),...d("right")];for(const a of d(n))for(const n of d(r))for(const r of s)C(t,[e,{x:e.x,y:a},{x:r,y:a},{x:r,y:n},{x:o.x,y:n},o])},"addVerticalPairCandidates"),B=(0,m.__name)(t=>{const e=new Set;return t.map(t=>it(t)).filter(t=>{const n=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(e.has(n)||t.length<2)&&(e.add(n),!0)})},"dedupeCandidatePaths"),F=(0,m.__name)((t,e,o,r)=>{const s=[],a=xt(t,e,o,r,n,ye);a&&C(s,a),e===r&&k(s,t,e,o);const i=O(e),c=O(r);return i&&!c?N(s,t,e,o,r):!i&&c?E(s,t,e,o,r):i?R(s,t,e,o,r):$(s,t,e,o,r),B(s)},"buildCandidatesForSides"),P=(0,m.__name)((t,e,n,o)=>{const r=[...d("left"),...d("right")],s=[...d("top"),...d("bottom")];for(const i of a){const a=pt(o,i),c="top"===i||"bottom"===i?d(i):s;for(const o of r){C(t,[e,n,{x:o,y:n.y},{x:o,y:a.y},a]);for(const r of c)C(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:a.x,y:r},a])}}},"addVerticalDepartureOuterTrackCandidates"),A=(0,m.__name)((t,e,n,o)=>{const r=[...d("left"),...d("right")],s=[...d("top"),...d("bottom")];for(const i of a){const a=pt(o,i),c="left"===i||"right"===i?d(i):r;for(const o of s){C(t,[e,n,{x:n.x,y:o},{x:a.x,y:o},a]);for(const r of c)C(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:a.y},a])}}},"addHorizontalDepartureOuterTrackCandidates"),Y=(0,m.__name)(t=>{const e=t.start,n=t.end,o=n?r.get(n):void 0;if(!e||!o)return[];const s=it(t.points??[]);if(s.length<4)return[];const a=s[0],i=s[1],c=[];return nt(a,i,ye)?P(c,a,i,o):et(a,i,ye)&&A(c,a,i,o),c},"terminalPreservingOuterTrackCandidates"),X=(0,m.__name)(t=>{const e=t.start,n=t.end,o=e?r.get(e):void 0,s=n?r.get(n):void 0;if(!o||!s)return[];const i=[];for(const t of a){const e=pt(o,t);for(const n of a)i.push(...F(e,t,pt(s,n),n))}return i.push(...Y(t)),i},"candidatePathsFor"),G=(0,m.__name)(()=>new Map(c.map(t=>[t,be(l(t))])),"currentSegmentsByEdge"),z=(0,m.__name)((t,e,n)=>{const o=new Set;for(const r of c){if(r===t)continue;const s=n.get(r)??be(l(r));e.some(t=>s.some(e=>rt(t,e,.5)>=_e))&&o.add(r)}return o},"sharedTrackConflictsFor"),j=(0,m.__name)((t,e,n,o)=>{const r=new Set;return X(t).map(t=>Et(it(t))).filter(e=>{if(L(t,e))return!1;const n=e.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(r.has(n)||e.length<2)&&(r.add(n),!0)}).map(r=>{const s=be(r);let a=0;for(const e of c)e!==t&&(a+=u(s,n.get(e)??be(l(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+a,bends:at(r,ye),totalBends:at(r),length:I(r)}}).filter(({crossings:t})=>t<=e.count).sort((t,e)=>t.crossings-e.crossings||t.bends-e.bends||t.length-e.length).slice(0,48).map(e=>({path:e.candidate,segments:e.candidateSegments,sharedTrackConflicts:z(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),D=(0,m.__name)((t,e,n,o,r,s)=>{let a=0;for(const n of t.pairs)n.first!==e&&n.second!==e&&n.first!==o&&n.second!==o||(a+=n.count);let i=u(n.segments,r.segments);for(const t of c){if(t===e||t===o)continue;const a=s.get(t)??be(l(t));i+=u(n.segments,a)+u(r.segments,a)}return t.count-a+i},"pairCrossingCount"),H=(0,m.__name)((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),V=(0,m.__name)((t,e)=>t.segments.some(t=>e.segments.some(e=>rt(t,e,.5)>=_e)),"candidatesShareTrack"),W=(0,m.__name)((t,e,n,o)=>H(e,n.edge)&&H(o,t.edge)&&!V(e,o),"pairCandidatesAreCompatible"),U=(0,m.__name)((t,e,n,o,r)=>{const s=D(t.current,e.edge,n,o.edge,r,t.baseSegments);if(!(s>=t.current.count))return{replacements:new Map([[e.edge,n.path],[o.edge,r.path]]),crossings:s,bends:t.currentBends-(t.baseBendsByEdge.get(e.edge)??0)-(t.baseBendsByEdge.get(o.edge)??0)+n.totalBends+r.totalBends,length:t.currentLength-(t.baseLengthByEdge.get(e.edge)??0)-(t.baseLengthByEdge.get(o.edge)??0)+n.length+r.length}},"scorePairReplacement"),q=(0,m.__name)((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),J=(0,m.__name)((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!W(e,o,n,s))continue;const a=U(t,e,o,n,s);a&&q(a,r)&&(r=a)}return r},"bestScoreForOptionPair"),K=(0,m.__name)(t=>{const e=S(),n=w(),o=G(),r=M(t),s=new Map(c.map(t=>[t,at(l(t))])),a=new Map(c.map(t=>[t,I(l(t))])),i=new Map,f=_(t);for(const e of f)for(const n of e){if(i.has(n))continue;const e=j(n,t,o,r);e.length>0&&i.set(n,{edge:n,candidates:e})}let d={replacements:new Map,crossings:t.count,bends:e,length:n};const u={current:t,currentBends:e,currentLength:n,baseBendsByEdge:s,baseLengthByEdge:a,baseSegments:o};for(const e of f){const n=new Set(e.filter(e=>t.edgeSet.has(e))),o=e.map(t=>i.get(t)).filter(t=>Boolean(t));for(let t=0;t<o.length;t++){const e=o[t];for(let r=t+1;r<o.length;r++){const t=o[r];(n.has(e.edge)||n.has(t.edge))&&(d=J(u,e,t,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let t=0;t<4;t++){const t=g(),e=t.count;if(0===e)return;let n,o,r=e,s=Number.POSITIVE_INFINITY;for(const a of t.edges){const i=at(l(a),ye);for(const c of X(a)){const f=L(a,c),d=!f&&v(a,c),l=b(t,a,c),u=at(c,ye);if(f||d)continue;(l<e||l===e&&u<i)&&(l>r||l===r&&u>=s||(n=a,o=c,r=l,s=u))}}if(n&&o){n.points=o;continue}const a=K(t);if(!a)return;for(const[t,e]of a)t.points=e}}(0,m.__name)(Ie,"separateSharedRenderedTerminalLanes"),(0,m.__name)(Se,"collapseRedundantRectangularDoglegs"),(0,m.__name)(we,"liftObstacleHuggingSameSideRails"),(0,m.__name)(ve,"liftTopLaneTitleBandsAboveRails"),(0,m.__name)(Le,"shiftLeftLaneTitleBandsLeftOfRails"),(0,m.__name)(Ce,"swapDestinationTerminalTailsToReduceCrossings"),(0,m.__name)(Oe,"reassignCrossingExternalRailChannels"),(0,m.__name)(Te,"shortcutRedundantOrthogonalJogs"),(0,m.__name)(ke,"resolveRenderedOrthogonalCrossings");var Ne=.001,Ee=8;function Re(t,e){const{nodeInfoById:n,realNodeRects:o}=_t(e),r=["top","bottom","left","right"],s={top:Math.min(...o.map(t=>t.rect.top))-20,bottom:Math.max(...o.map(t=>t.rect.bottom))+20,left:Math.min(...o.map(t=>t.rect.left))-20,right:Math.max(...o.map(t=>t.rect.right))+20},a=(0,m.__name)((t,e,n,o)=>{const r=[],a=xt(t,e,n,o,20,Ne);return a&&r.push(a),e===o&&r.push(yt(t,e,n,s[e])),r},"buildOrthogonalPathCandidates"),i=(0,m.__name)((t,e)=>{for(let n=0;n<t.length-1;n++){if(St(t[n],t[n+1],o,e,1))return!0}return!1},"pathHitsNode"),c=(0,m.__name)((e,n,o=!1)=>{let r=0;const s=st(e,Ne),a=n.start,i=n.end;for(const e of t){if(e===n||e.isLayoutOnly)continue;const t=e.start,c=e.end;if(!o&&a&&i&&(t===a||t===i||c===a||c===i))continue;const f=e.points;if(f&&!(f.length<2))for(const t of s)for(const e of st(f,Ne))(wt(t.a,t.b,e.a,e.b,Ne,Ne)||rt(t,e,Ne)>=Ee)&&r++}return r},"pathConflictCount"),f=(0,m.__name)((t,e)=>{const n=Math.abs(t.y-e.rect.top),o=Math.abs(t.y-e.rect.bottom),r=Math.abs(t.x-e.rect.left),s=Math.abs(t.x-e.rect.right);let a="top",i=n;return o<i&&(a="bottom",i=o),r<i&&(a="left",i=r),s<i&&(a="right",i=s),a},"nearestSideOfRect"),d=new Map,l=(0,m.__name)((t,e,n)=>{const o=d.get(t)??[];o.push({side:e,edgeId:n}),d.set(t,o)},"addFaceClaim");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points??[];if(t.length<1)continue;const o=e.id??"",r=e.start,s=e.end;if(r){const e=n.get(r);e&&l(r,f(t[0],e),o)}if(s){const e=n.get(s);e&&l(s,f(t[t.length-1],e),o)}}const u=(0,m.__name)((t,e,n)=>d.get(t)?.some(t=>t.edgeId!==n&&t.side===e)??!1,"faceIsClaimed");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(!t||t.length<2)continue;const o=at(t,Ne);if(o<4)continue;const s=e.start,h=e.end;if(!s||!h)continue;const g=n.get(s),m=n.get(h);if(!g||!m)continue;const p=e.id??"",x=c(t,e,!0),y=c(t,e);let _,b=x,M=o;for(const t of r){if(u(s,t,p))continue;const n=pt(g,t);for(const o of r){if(u(h,o,p))continue;const r=pt(m,o);for(const f of a(n,t,r,o)){if(i(f,[s,h]))continue;const t=at(f,Ne);if(x>0){const n=c(f,e,!0);if(n>b||n===b&&t>=M)continue;b=n,M=t,_=f;continue}c(f,e)>y||t<M&&(M=t,_=f)}}}if(_){e.points=_;const t=d.get(s);t&&d.set(s,t.filter(t=>t.edgeId!==p));const n=d.get(h);n&&d.set(h,n.filter(t=>t.edgeId!==p)),l(s,f(_[0],g),p),l(h,f(_[_.length-1],m),p)}}}(0,m.__name)(Re,"simplifyDetouredEdges");var $e=.001,Be=10,Fe=7;function Pe(t,e){const n=e?0:t.length-1,o=e?1:-1,r=t[n],s=t[n+o];if(!r||!s)return;const a=s.x-r.x,i=s.y-r.y;if(!(Math.abs(a)+Math.abs(i)<$e)){if(Math.abs(i)<=$e){const t=r.x+Math.sign(a)*Be;return{left:Math.min(r.x,t),right:Math.max(r.x,t),top:r.y-Fe,bottom:r.y+Fe}}if(Math.abs(a)<=$e){const t=r.y+Math.sign(i)*Be;return{left:r.x-Fe,right:r.x+Fe,top:Math.min(r.y,t),bottom:Math.max(r.y,t)}}return{left:Math.min(r.x,s.x),right:Math.max(r.x,s.x),top:Math.min(r.y,s.y),bottom:Math.max(r.y,s.y)}}}function Ae(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}function Ye(t,e){const n=it(e);return[Pe(n,!0),Pe(n,!1)].some(e=>e&&ut(t,Ae(e)))}function Xe(t,e){const n=[];for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(t&&!(t.length<2))for(let o=0;o<t.length-1;o++)n.push({edgeId:e.id,p1:t[o],p2:t[o+1]})}const o=[],r=[];for(const t of e.values()){const e=t.isGroup,n=t.parentId;if(e&&!n){const e=mt(t);e&&r.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const s=mt(t);s&&o.push({nodeId:t.id,rect:s})}const s=(0,m.__name)((t,e)=>{const n=ht(e,3);for(const{nodeId:e,rect:r}of o)if(e!==t&&ut(n,r))return!0;return!1},"labelOverlapsForeignNode"),a=(0,m.__name)((t,e)=>{const o=ht(e,3);for(const e of n)if(e.edgeId!==t&&ft(e.p1,e.p2,o))return!0;return!1},"labelOverlapsForeignEdge"),i=(0,m.__name)((t,e,n)=>s(t,n)||a(e,n),"labelOverlapsAnything"),c=[],f=(0,m.__name)(t=>{for(const{id:e,rect:n}of r)if(lt(n,t))return e},"findContainingLane"),d=(0,m.__name)((t,e)=>c.some(n=>n.labelId!==t&&ut(e,n.rect)),"overlapsPlacedLabel");for(const n of t){if(n.isLayoutOnly)continue;const t=n.labelNodeId;if(!t)continue;const o=e.get(t);if(!o)continue;const l=n.points;if(!l||l.length<2)continue;const u=o.width??0,h=o.height??0;if(u<=0||h<=0)continue;const g=[];for(let t=0;t<l.length-1;t++){const e=l[t],n=l[t+1],o=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);o<$e&&r<$e||(o>=$e&&r>=$e||g.push({idx:t,length:o+r,orientation:o>=$e?"horizontal":"vertical",midX:(e.x+n.x)/2,midY:(e.y+n.y)/2}))}if(0===g.length)continue;const p=g.length>=3?g.filter(t=>t.idx>0&&t.idx<g.length-1):g,x=p.length>0?p:g,y=u>=h?"horizontal":"vertical",_=(0,m.__name)(t=>[...t].sort((t,e)=>{const n=t.orientation===y;if(n!==(e.orientation===y))return n?-1:1;const o=t.length>=("horizontal"===t.orientation?u:h)+2;return o!==e.length>=("horizontal"===e.orientation?u:h)+2?o?-1:1:e.length-t.length}),"rankSegments"),b=g[0],M=g[g.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],S=(0,m.__name)((t,e)=>{const n=l[t.idx],o=l[t.idx+1];return{midX:n.x+(o.x-n.x)*e,midY:n.y+(o.y-n.y)*e}},"anchorAtT"),w=(0,m.__name)((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),v=(0,m.__name)((t,e)=>t.midX>=e.left-$e&&t.midX<=e.right+$e&&t.midY>=e.top-$e&&t.midY<=e.bottom+$e,"pointInsideRectInclusive"),L=(0,m.__name)(t=>{const e=gt(t.midX,t.midY,u,h),n=f(e);if(n)return{laneId:n,anchor:t,rect:e};const o=r.find(({rect:e})=>v(t,e));if(!o)return;const s=o.rect.left+u/2+1,a=o.rect.right-u/2-1,i=o.rect.top+h/2+1,c=o.rect.bottom-h/2-1;if(s>a||i>c)return;const d={midX:w(t.midX,s,a),midY:w(t.midY,i,c)},l=gt(d.midX,d.midY,u,h);return v(t,l)?{laneId:o.id,anchor:d,rect:l}:void 0},"placementForAnchor"),C=(0,m.__name)((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),O=(0,m.__name)((t,e)=>{const n=("horizontal"===t.orientation?u/2:h/2)+12;if(t===b){const o=l[t.idx];if(C(t,e,o)+$e<n)return!1}if(t===M){const o=l[t.idx+1];if(C(t,e,o)+$e<n)return!1}return!0},"labelClearsTerminalEndpoints"),T=(0,m.__name)(e=>{const o=_(e);for(const e of o)for(const o of I){const r=S(e,o);if(!O(e,r))continue;const s=L(r);if(s&&(!Ye(s.rect,l)&&!d(t,s.rect)&&!i(t,n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),k=(0,m.__name)((e,o,r=!1)=>{const i=_(e);for(const e of i){const i={midX:e.midX,midY:e.midY};if(o&&!O(e,i))continue;const c=L(i);if(c&&!Ye(c.rect,l)&&!d(t,c.rect)&&!s(t,c.rect)&&(r||!a(n.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),N=T(x)??(x.length<g.length?T(g):void 0)??k(g,!0)??k(g,!1)??k(g,!1,!0);if(N){o.x=N.anchor.midX,o.y=N.anchor.midY,o.parentId=N.laneId;const e=gt(N.anchor.midX,N.anchor.midY,u,h),n=c.findIndex(e=>e.labelId===t);n>=0?c[n]={labelId:t,rect:e}:c.push({labelId:t,rect:e})}}}(0,m.__name)(Pe,"markerClearanceRectFor"),(0,m.__name)(Ae,"normalizeRect"),(0,m.__name)(Ye,"labelOverlapsOwnMarker"),(0,m.__name)(Xe,"anchorLabelsToPolyline");var Ge=1e-6,ze=4,je=3;function De(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function He(t,e){const{nodeInfoById:n,realNodeRects:o}=_t(e),r=new Map;for(const t of e){const e=t.id;t.isGroup||t.isEdgeLabel&&r.set(e,{w:t.width??0,h:t.height??0})}const s=(0,m.__name)((e,n,o,s)=>{const a=De(n,o);let i=0;const c=(0,m.__name)(t=>{if(!t)return;const e=r.get(t);if(!e)return;const n="x"===s?e.w/2:e.h/2;n>i&&(i=n)},"consider");c(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(De(t,o)===a&&c(n.labelNodeId))}return i>0?i+je:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!ct(e.points,Ge))continue;const r=It(e,n,Ge);if(!r)continue;const{srcId:a,dstId:i,srcInfo:c,dstInfo:f,collinearX:d,collinearY:l}=r;if(d===l)continue;let u,h;if(d){const t=f.cy>c.cy;u={x:c.cx,y:t?c.rect.bottom:c.rect.top},h={x:f.cx,y:t?f.rect.top:f.rect.bottom}}else{const t=f.cx>c.cx;u={x:t?c.rect.right:c.rect.left,y:c.cy},h={x:t?f.rect.left:f.rect.right,y:f.cy}}if(St(u,h,o,[a,i],1))continue;const g=s(e,a,i,d?"x":"y"),m=g>ze?g:ze,p=[0,m,-m];for(const n of p){const r=Object.assign({},u),s=Object.assign({},h);if(d){if(r.x+=n,s.x+=n,r.x<=c.rect.left||r.x>=c.rect.right)continue;if(s.x<=f.rect.left||s.x>=f.rect.right)continue}else{if(r.y+=n,s.y+=n,r.y<=c.rect.top||r.y>=c.rect.bottom)continue;if(s.y<=f.rect.top||s.y>=f.rect.bottom)continue}if(!St(r,s,o,[a,i],1)&&!Lt(r,s,t,e,{epsilon:Ge})){e.points=[r,s];break}}}}function Ve(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=bt(e.values()),s=(0,m.__name)((t,e)=>st(e,n).map(n=>Object.assign({},n,{edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),a=(0,m.__name)(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...s(n,it(t)))}return e},"allSegments"),i=(0,m.__name)((t,e)=>t.horizontal&&e.horizontal?ot(t.a.x,t.b.x,e.a.x,e.b.x)>=8&&Math.abs(t.a.y-e.a.y)<7:!(!t.vertical||!e.vertical)&&(ot(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),c=(0,m.__name)((e,a)=>{const c=e.start,f=e.end,d=s(e,a);if(d.length!==a.length-1)return!1;const l=[c,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(St(t.a,t.b,o,l,-2))return!1;if(St(t.a,t.b,r,u,-2))return!1}for(const o of t){if(o===e||o.isLayoutOnly)continue;const t=o.points;if(t&&!(t.length<2))for(const e of d)for(const r of s(o,it(t))){if(i(e,r))return!1;if(Ct(e.a,e.b,r.a,r.b,n))return!1}}return!0},"candidateIsSafe"),f=(0,m.__name)((t,e)=>{const n=it(t.edge.points??[]);if(n.length<4||t.index>=n.length-1)return;const o=n.map(t=>Object.assign({},t));if(t.horizontal)o[t.index].y+=e,o[t.index+1].y+=e;else{if(!t.vertical)return;o[t.index].x+=e,o[t.index+1].x+=e}return s(t.edge,o).length===o.length-1?o:void 0},"shiftedCandidate"),d=(0,m.__name)((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),l=(0,m.__name)(t=>{const n=t.edge,o=it(n.points??[]);if(4!==o.length||1!==t.index)return;const r=n.start?e.get(n.start):void 0,s=n.end?e.get(n.end):void 0,a=r?mt(r):void 0,i=s?mt(s):void 0,c=o.slice(t.index+2);return r&&s&&a&&i&&0!==c.length?{sourceCenter:d(r,a),targetCenter:d(s,i),sourceRect:a,tail:c}:void 0},"sourceDetourContextFor"),u=(0,m.__name)((t,e,o,r,s,a)=>{const i=r.y>=o.y,c=i?s.bottom:s.top,f=c+(i?20:-20);if(i&&t.b.y<=f+n||!i&&t.b.y>=f-n)return;const d=t.a.x+e;return it([{x:o.x,y:c},{x:o.x,y:f},{x:d,y:f},{x:d,y:t.b.y},...a],n)},"verticalSourceDetour"),h=(0,m.__name)((t,e,o,r,s,a)=>{const i=r.x>=o.x,c=i?s.right:s.left,f=c+(i?20:-20);if(i&&t.b.x<=f+n||!i&&t.b.x>=f-n)return;const d=t.a.y+e;return it([{x:c,y:o.y},{x:f,y:o.y},{x:f,y:d},{x:t.b.x,y:d},...a],n)},"horizontalSourceDetour"),g=(0,m.__name)((t,e)=>{const n=l(t);if(n)return t.vertical?u(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):t.horizontal?h(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):void 0},"sourceDetourCandidate"),p=[-7,7,-14,14,-21,21];for(let t=0;t<12;t++){const t=a();let e=!1;for(let n=0;n<t.length&&!e;n++)for(let o=n+1;o<t.length&&!e;o++){const r=t[n],s=t[o];if(r.edge===s.edge||!i(r,s))continue;const a=[r,s].filter(t=>t.interior);for(const t of a){for(const n of p){const o=f(t,n);if(o&&c(t.edge,o)){t.edge.points=o,e=!0;break}const r=g(t,n);if(r&&c(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function We(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,a=o.x-n.x,i=o.y-n.y,c=r*i-s*a;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,d=n.y-t.y,l=(f*i-d*a)/c,u=(f*s-d*r)/c;return l>.01&&l<.99&&u>.01&&u<.99}function Ue(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const r=Mt(e),s=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,a=t.end,i=t.labelNodeId,c=t.id??`${n}->${a}`;for(const t of r)if(t.nodeId!==n&&t.nodeId!==a&&(!i||t.nodeId!==i))for(let n=0;n<e.length-1;n++)if(ft(e[n],e[n+1],t,-1)){o.push({type:"edge-node-overlap",edgeId:c,targetId:t.nodeId,detail:`segment ${n} passes through node "${t.nodeId}"`});break}for(let t=0;t<e.length-1;t++)s.push({edgeId:c,start:n,end:a,p1:e[t],p2:e[t+1]})}const a=new Set;for(let t=0;t<s.length;t++)for(let e=t+1;e<s.length;e++){const n=s[t],r=s[e];if(n.edgeId!==r.edgeId&&(n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&We(n.p1,n.p2,r.p1,r.p2))){const t=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;a.has(t)||(a.add(t),o.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(o.length>0){const t=o.filter(t=>"edge-node-overlap"===t.type).length,e=o.filter(t=>"edge-edge-crossing"===t.type).length;g.log.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of o)g.log.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return o}function qe(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&r.length>0&&!he(t,e))return;if("BT"===e&&r.length>0&&!ue(t))return;for(const t of o){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=Et(Nt(e)))}Re(o,n),He(o,n),pe(o,n);const s=new Map;for(const t of n)s.set(String(t.id),t);Xe(o,s),Yt(o,s),xe(o,s),Ve(o,s),Ie(o,s),Se(o,s),we(o,s),Ce(o,s);const a=(0,m.__name)(()=>{ke(o,s),Oe(o,s),Te(o,s),Xe(o,s),re(o,s),we(o,s),Xe(o,s),re(o,s)},"finalizeRenderedEdges");a(),Ve(o,s),a(),ve(o,s),Le(o,s),ve(o,s),Le(o,s)}function Je(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const t=`${r.id}:${r.src}->${r.dst}`;n.has(t)||(n.add(t),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}function Ke(t,e){return t.edges.filter(t=>t.dst===e)}function Ze(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}function Qe(t){const e=Ze(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function tn(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}function en(t){return[...t.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e))}function nn(t,e=()=>!0){const n=new Map,o=new Map;for(const e of t.nodes)n.set(e,[]),o.set(e,[]);for(const r of t.edges)e(r)&&(o.get(r.src).push(r.dst),n.get(r.dst).push(r.src));return{preds:n,succs:o}}function on(t,e,n,o){let r=0;for(const e of t.nodes)o?.skipGroups&&t.nodeById.get(e)?.isGroup||(r=Math.max(r,n[e]??0));const s=Array.from({length:r+1},()=>[]);for(const r of e)o?.skipGroups&&t.nodeById.get(r)?.isGroup||s[Math.max(0,n[r]??0)].push(r);return s}function rn(t){const e=tn(t),n=en(e),o=[],r=Qe(t);for(;n.length;){const t=n.shift();o.push(t);for(const o of r.get(t)??[])if(e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)){let t=0;for(;t<n.length&&n[t]<o;)t++;n.splice(t,0,o)}}return o.length===t.nodes.length?o:null}function sn(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function an(t){const e=new Array(t.length),n=(0,m.__name)((o,r)=>{if(r-o<=1)return 0;const s=o+r>>1;let a=n(o,s)+n(s,r),i=o,c=s,f=o;for(;i<s||c<r;)c>=r||i<s&&t[i]<=t[c]?e[f++]=t[i++]:(e[f++]=t[c++],a+=s-i);for(let n=o;n<r;n++)t[n]=e[n];return a},"count");return n(0,t.length)}function cn(t){const e=Je(t),n=new Map;for(const t of e.nodes)n.set(t,[]);for(const t of e.edges)n.get(t.src).push(t);for(const t of n.values())t.sort((t,e)=>t.dst===e.dst?t.id.localeCompare(e.id):t.dst.localeCompare(e.dst));const o=Object.create(null);for(const t of e.nodes)o[t]=0;const r=[],s=(0,m.__name)(t=>{o[t]=1;for(const e of n.get(t)??[]){const t=e.dst;0===o[t]?s(t):1===o[t]&&r.push(e)}o[t]=2},"dfs"),a=[...e.nodes].sort((t,e)=>t.localeCompare(e));for(const t of a)0===o[t]&&s(t);const i=new Set(r.map(t=>`${t.id}:${t.src}->${t.dst}`)),c=e.edges.map(t=>i.has(`${t.id}:${t.src}->${t.dst}`)?{id:t.id,src:t.dst,dst:t.src,weight:t.weight,ref:t.ref}:t);return{acyclic:{nodes:[...e.nodes],edges:c,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:r}}function fn(t){const e=new Map,n=(0,m.__name)(o=>{if(e.has(o))return e.get(o);const r=t.nodeById.get(o);if(!r)return e.set(o,null),null;const s=r.parentId;if(!s)return e.set(o,null),null;const a=n(s)??s;return e.set(o,a),a},"resolve");for(const e of t.nodes)n(e);return e}function dn(t){const e=fn(t);return t=>e.get(t)??null}function ln(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function un(t,e){const n=ln(t);if(!e||0===e.length)return n;const o=new Set(n),r=new Set,s=[];for(const t of e)o.has(t)&&!r.has(t)&&(r.add(t),s.push(t));for(const t of n)r.has(t)||s.push(t);return s}(0,m.__name)(De,"pairKey"),(0,m.__name)(He,"straightenCollinearSiblingDetours"),(0,m.__name)(Ve,"nudgeSharedInteriorSubpaths"),(0,m.__name)(We,"segmentsIntersect"),(0,m.__name)(Ue,"validateSwimlanesLayout"),(0,m.__name)(qe,"postProcessSwimlaneLayout"),(0,m.__name)(Je,"normalizeGraph"),(0,m.__name)(Ke,"incoming"),(0,m.__name)(Ze,"buildSuccessorMap"),(0,m.__name)(Qe,"buildSortedSuccessorMap"),(0,m.__name)(tn,"buildInDegreeMap"),(0,m.__name)(en,"sortedZeroInDegreeNodes"),(0,m.__name)(nn,"buildPredecessorSuccessorMaps"),(0,m.__name)(on,"buildLayersFromRanks"),(0,m.__name)(rn,"topoSortIfAcyclic"),(0,m.__name)(sn,"buildLayerIndex"),(0,m.__name)(an,"countInversions"),(0,m.__name)(cn,"removeCycles_DFS"),(0,m.__name)(fn,"buildTopLaneMap"),(0,m.__name)(dn,"createTopLaneResolver"),(0,m.__name)(ln,"buildTopLaneOrder"),(0,m.__name)(un,"resolveTopLaneOrder");var hn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},gn={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function mn(t,e){const n=Je(t),o=e?.laneOf??(()=>null),r=e?.rankHint,{preds:s}=nn(n);for(const t of s.values())t.sort((t,e)=>t.localeCompare(e));const a=rn(n)??[...n.nodes].sort((t,e)=>t.localeCompare(e)),i=new Map;for(const[t,e]of a.entries())i.set(e,t);const c=new Map,f=new Map;for(const t of n.nodes)f.set(t,[]);for(const t of a){const e=(s.get(t)??[]).filter(t=>c.has(t));if(e.length>0){const n=pn(t,e,{laneOf:o,rankHint:r,topoIndex:i});c.set(t,n),f.get(n).push(t)}else c.has(t)||c.set(t,null)}for(const t of n.nodes)c.has(t)||c.set(t,null);const d=new Set;for(const t of n.nodes)null===(c.get(t)??null)&&d.add(t);const l=[...d].sort((t,e)=>{const n=i.get(t)??0,o=i.get(e)??0;return n===o?t.localeCompare(e):n-o}),u=xn(n),h=new Map;for(const[t,e]of u.entries())h.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const g=yn(h),p=_n(h),x=new Map;for(const t of n.nodes)x.set(t,[]);for(const t of p)for(const e of t.nodes){const n=x.get(e);n?n.push(t.id):x.set(e,[t.id])}const y=[],_=[],b=new Set,M=(0,m.__name)(t=>{if(!b.has(t)){b.add(t),y.push(t);for(const e of f.get(t)??[])M(e);_.push(t)}},"walk");for(const t of l)M(t);for(const t of a)M(t);return{parent:c,children:f,roots:l,componentOf:g,blocks:p,nodeBlocks:x,adjacency:h,preorder:y,postorder:_,topologicalOrder:a}}function pn(t,e,n){const o=n.laneOf(t);return[...e].sort((t,e)=>{const r=n.laneOf(t),s=n.laneOf(e),a=null!=r&&r===o;if(a!==(null!=s&&s===o))return a?-1:1;const i=n.rankHint?.[t],c=n.rankHint?.[e];if(null!=i&&null!=c&&i!==c)return c-i;const f=n.topoIndex.get(t)??0,d=n.topoIndex.get(e)??0;return f!==d?f-d:t.localeCompare(e)})[0]}function xn(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}function yn(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const r=[o];for(;r.length>0;){const o=r.pop();if(!e.has(o)){e.set(o,n);for(const n of t.get(o)??[])e.has(n)||r.push(n)}}n++}return e}function _n(t){const e=new Map,n=new Map,o=[],r=[];let s=0;const a=(0,m.__name)((i,c)=>{e.set(i,++s),n.set(i,s);for(const f of t.get(i)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(i)??0)&&(o.push([i,f]),n.set(i,Math.min(n.get(i)??s,e.get(f)??s))):(o.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??s,n.get(f)??s)),(n.get(f)??0)>=(e.get(i)??0)&&r.push(bn(i,f,o,r.length))))},"visit");for(const n of t.keys())e.has(n)||a(n,null);return r}function bn(t,e,n,o){const r=[],s=new Set;for(;n.length>0;){const o=n.pop();if(r.push(o),s.add(o[0]),s.add(o[1]),o[0]===t&&o[1]===e||o[0]===e&&o[1]===t)break}return{id:o,edges:r,nodes:[...s]}}function Mn(t,e,n){const o=[...t.nodes],r=new Map;for(const[t,e]of o.entries())r.set(e,t);const s=o.length,a=new Array(s).fill(-1),i=new Array(s).fill(0),c=[],f=new Set;for(const t of o){const e=n.parent.get(t)??null,o=r.get(t);null!=o&&(null==e&&(a[o]=-1,i[o]=0,f.has(t)||(f.add(t),c.push(t))))}for(;c.length>0;){const t=c.shift(),e=r.get(t);if(null==e)continue;const o=n.children.get(t)??[];for(const t of o){if(f.has(t))continue;const n=r.get(t);null!=n&&(a[n]=e,i[n]=i[e]+1,f.add(t),c.push(t))}}for(const t of o){if(f.has(t))continue;const e=r.get(t);null!=e&&(a[e]=-1,i[e]=0,f.add(t))}const d=Math.max(1,Math.ceil(Math.log2(Math.max(1,s)))+1),l=Array.from({length:d},()=>new Array(s).fill(-1));for(let t=0;t<s;t++)l[0][t]=a[t];for(let t=1;t<d;t++)for(let e=0;e<s;e++){const n=l[t-1][e];l[t][e]=-1===n?-1:l[t-1][n]}const u=(0,m.__name)((t,e)=>{if(-1===t||-1===e)return-1;i[t]<i[e]&&([t,e]=[e,t]);const n=i[t]-i[e];for(let e=0;e<d;e++)if(n>>e&1&&-1===(t=l[e][t]))return-1;if(t===e)return t;for(let n=d-1;n>=0;n--){const o=l[n][t],r=l[n][e];-1!==o&&-1!==r&&(o!==r&&(t=o,e=r))}return l[0][t]},"lcaIndex"),h=Array.from({length:s},()=>new Map);for(const n of t.edges){let t=n.src,o=n.dst,s=e[t],a=e[o];if(null==s||null==a)continue;if(s>a&&([t,o]=[o,t],[s,a]=[a,s]),null==s||null==a||s===a)continue;const i=r.get(t),c=r.get(o);if(null==i||null==c)continue;const f=u(i,c);if(-1===f)continue;const d=h[f];for(let t=s;t<a;t++)d.set(t,(d.get(t)??0)+1)}const g=new Map,p=(0,m.__name)((t,e)=>{if(0!==e.size)for(const[n,o]of e)t.set(n,(t.get(n)??0)+o)},"mergeInto"),x=new Set,y=(0,m.__name)(t=>{const o=r.get(t);x.add(t);const s=null==o?void 0:h[o],a=s?new Map(s):new Map,i=n.children.get(t)??[];for(const n of i){const o=y(n),r=e[t];if(null!=r){let s=g.get(t);s||(s=new Map,g.set(t,s));let a=o.get(r)??0;const i=e[n];null!=i&&i>r&&(a+=1),s.set(n,a)}p(a,o)}return a},"dfs");for(const t of n.roots)x.has(t)||y(t);for(const t of o)x.has(t)||y(t);return g}function In(t,e,n){const o=new Map,r=(0,m.__name)(t=>{let s=n[t]??0;const a=[...e.get(t)??[]];a.sort(Sn(n));for(const t of a){r(t);const e=o.get(t);null!=e&&(s=Math.min(s,e))}o.set(t,s)},"annotate");for(const e of t)r(e);return o}function Sn(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function wn(t,e,n,o){let r=0;for(const t of e){const e=n[t]??0;e>r&&(r=e)}const s=Array.from({length:r+1},()=>[]),a=new Set,i=(0,m.__name)(t=>{if(a.has(t))return;a.add(t);const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t);for(const e of o(t))i(e)},"emit");for(const e of t)i(e);for(const t of e)if(!a.has(t)){const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t),a.add(t)}return s}function vn(t){const e=[];for(const n of t){const t=new Set,o=[];for(const e of n)t.has(e)||(t.add(e),o.push(e));e.push(o)}return e}function Ln(t,e,n,o){return r=>{const s=t.get(r)??[];if(0===s.length)return[];const a=e[r]??0,i=[],c=[],f=n.get(r);for(const t of s){const e=o.get(t)??a;e>a?i.push({child:t,min:e}):c.push(t)}return i.sort((t,e)=>t.min===e.min?t.child.localeCompare(e.child):t.min-e.min),c.sort((t,e)=>{const n=f?.get(t)??0,r=f?.get(e)??0;if(n!==r)return n-r;const s=o.get(t)??a,i=o.get(e)??a;return s!==i?s-i:t.localeCompare(e)}),[...i.map(t=>t.child),...c]}}function Cn(t,e,n){const o=mn(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const a=Mn(t,e,o),i=[...s].sort(Sn(e)),c=Ln(r,e,a,In(i,r,e));let f=wn(i,t.nodes,e,c);return f=vn(f),f}function On(t,e,n){const o=new Set(t),r=new Set(e),s=sn(e),a=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&a.push(s.get(t.dst));return an(a)}function Tn(t,e,n){const o=[];for(const t of e){const e=n[t.src],r=n[t.dst];if(null==e||null==r||e===r)continue;let s=t.src,a=t.dst,i=e,c=r;e>r&&(s=t.dst,a=t.src,i=r,c=e);for(let e=i;e<c;e++)o.push({id:`${t.id}@${e}`,src:s,dst:a,ref:t.ref})}let r=0;for(let e=0;e+1<t.length;e++)r+=On(t[e],t[e+1],o);return r}function kn(t,e){const n=Object.assign({},e),{preds:o}=nn(t),r=dn(t);let s=Tn(Cn(t,n,r),t.edges,n);const a=hn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let e=0;e<a;e++){let e=!1;const a=[...t.nodes].sort((t,e)=>(n[e]??0)-(n[t]??0));for(const i of a){const a=n[i]??0;if(0===a)continue;let c=0;for(const t of o.get(i)??[])c=Math.max(c,(n[t]??0)+1);if(c>=a)continue;const f=a;n[i]=c;const d=Tn(Cn(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[i]=f}if(!e)break}return n}function Nn(t,e){const n=dn(t),o=[...t.nodes].sort((t,n)=>(e[t]??0)-(e[n]??0)||t.localeCompare(n));for(const r of o){const o=n(r);if(!o)continue;const s=t.edges.filter(t=>t.src===r);if(0===s.length)continue;let a=!1,i=0;for(const t of s){const e=n(t.dst);null==e||e===o?a=!0:i++}if(0===i||a)continue;let c=0,f=!1;for(const e of t.edges){if(e.dst!==r)continue;const t=n(e.src);t&&(t===o?f=!0:c++)}if(c>0||!f)continue;const d=e[r]??0,l=d+i;let u=0;for(const n of t.edges)n.dst===r&&(u=Math.max(u,(e[n.src]??0)+1));const h=Math.max(d,u,l);h!==d&&(e[r]=h)}}function En(t,e){const n=Je(t),o=rn(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=dn(n);let a=Object.create(null);for(const t of o){const o=Ke(n,t),i=e?.ignoreCrossLaneEdges?o.filter(e=>{const n=s(e.src),o=s(t);return!n||!o||n===o}):o;if(0===i.length)a[t]=0;else if(r&&1===i.length){const e=i[0].src,n=s(e),o=s(t);a[t]=n!==o?a[e]??0:(a[e]??0)+1}else{let e=-1/0;for(const t of i)e=Math.max(e,(a[t.src]??0)+1);a[t]=e===-1/0?0:e}}e?.optimizeRanksByCrossings&&(a=kn(n,a)),e?.ignoreCrossLaneEdges&&Nn(n,a);return{layers:Cn(n,a,s),rankOf:a,dummy:new Set}}function Rn(t,e){const n=Je(t),o=En(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}),r=Object.assign({},o.rankOf),s=dn(n),{preds:a,succs:i}=nn(n,t=>{if(e?.ignoreCrossLaneEdges){const e=s(t.src),n=s(t.dst);if(e&&n&&e!==n)return!1}return!0}),c=rn(n)??[...n.nodes],f=[...c].reverse(),d=(0,m.__name)((t,e)=>{let n=0;for(const e of a.get(t)??[])n=Math.max(n,(r[e]??0)+1);let o=Number.POSITIVE_INFINITY;const s=i.get(t)??[];return s.length>0&&(o=Math.min(...s.map(t=>(r[t]??0)-1))),Number.isFinite(o)||(o=Math.max(n,e)),Math.min(Math.max(e,n),o)},"clampFeasible"),l=hn.GRAVITY_ITERATIONS,u=(0,m.__name)(t=>{let e=!1;for(const n of t){const t=a.get(n)??[],o=i.get(n)??[];if(0===t.length&&0===o.length)continue;const s=t.length>0?t.reduce((t,e)=>t+(r[e]??0)+1,0)/t.length:r[n]??0,c=o.length>0?o.reduce((t,e)=>t+(r[e]??0)-1,0)/o.length:r[n]??0,f=Math.round((s+c)/2),l=d(n,f);l!==r[n]&&(r[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<l;t++){const t=u(c),e=u(f);if(!t&&!e)break}for(const t of c){let e=0;for(const n of a.get(t)??[])e=Math.max(e,(r[n]??0)+1);(r[t]??0)<e&&(r[t]=e)}for(const t of f){const e=i.get(t)??[];if(e.length>0){const n=Math.min(...e.map(t=>(r[t]??0)-1));(r[t]??0)>n&&(r[t]=n)}}return{layers:on(n,c,r),rankOf:r,dummy:new Set}}function $n(t){const e=tn(t),n=Qe(t);let o=en(e);const r=[];for(;o.length>0;){const t=[];for(const s of o){r.push(s);for(const o of n.get(s)??[])e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)&&t.push(o)}o=t.sort((t,e)=>t.localeCompare(e))}return r.length===t.nodes.length?r:null}function Bn(t,e){const n=Je(t),o="LR"===e?.direction?$n(n)??[...n.nodes].sort():rn(n)??[...n.nodes].sort(),r=dn(n),s=(0,m.__name)(t=>r(t)??t,"laneOf"),a=Object.create(null),i=new Map,c=(0,m.__name)((t,n)=>e?.ignoreCrossLaneEdges??!0?s(t)===s(n)?1:0:1,"edgeWeight");for(const t of o){const e=n.nodeById.get(t);if(e?.isGroup)continue;const o=Ke(n,t);let r=0;if(o.length>0)for(const e of o){const n=e.src,o=a[n]??0;r=Math.max(r,o+c(n,t))}const f=s(t),d=i.get(f)??0,l=Math.max(r,d);a[t]=l,i.set(f,l+1)}return{layers:on(n,o,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function Fn(t,e){const n=Je(e),{rankOf:o}=t,r=t.layers.map(t=>[...t]),s=new Set(t.dummy?[...t.dummy]:[]);let a=0;const i=new Map(n.nodeById),c=(0,m.__name)(t=>{const e="placeholder-"+a++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(i.set(e,n),s.add(e);r.length<=t;)r.push([]);return r[t].push(e),o[e]=t,e},"addDummyAt"),f=[...n.edges].sort((t,e)=>t.id===e.id?t.src===e.src?t.dst.localeCompare(e.dst):t.src.localeCompare(e.src):t.id.localeCompare(e.id)),d=[];for(const t of f){const e=o[t.src]??0,n=o[t.dst]??0;if(n-e<=1){d.push(t);continue}let r=t.src;for(let o=e+1,s=0;o<n;o++,s++){const e=c(o);d.push({id:`${t.id}#${s}`,src:r,dst:e,weight:t.weight,ref:t.ref}),r=e}const s=n-e-2;d.push({id:`${t.id}#${Math.max(s+1,0)}`,src:r,dst:t.dst,weight:t.weight,ref:t.ref})}const l={nodes:[...n.nodes,...[...s].filter(t=>!n.nodes.includes(t))],edges:d,layout:n.layout,nodeById:i};return{layering:{layers:r,rankOf:o,dummy:s},graphWithDummies:l}}function Pn(t){const e=t.length;if(0===e)return Number.POSITIVE_INFINITY;const n=[...t].sort((t,e)=>t-e);return e%2==1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}function An(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function Yn(t,e,n,o){const r=new Map;for(const e of t)r.set(e,[]);for(const t of n)"down"===o?e.has(t.src)&&r.has(t.dst)&&r.get(t.dst).push(e.get(t.src)):e.has(t.dst)&&r.has(t.src)&&r.get(t.src).push(e.get(t.dst));return r}function Xn(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function Gn(t,e,n){const o=new Set(t),r=new Set(e),s=sn(t),a=sn(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push({u:s.get(t.src),v:a.get(t.dst)});i.sort((t,e)=>t.u===e.u?t.v-e.v:t.u-e.u);return an(i.map(t=>t.v))}function zn(t,e,n){return[...t].sort((t,o)=>{const r=Pn(e.get(t)??[]),s=Pn(e.get(o)??[]);return r===s?Xn(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function jn(t,e,n,o,r,s){const a=sn(t),i=sn(e),c=Yn(e,a,n,o);if(!r||!s||0===s.length)return zn(e,c,i);const f=new Map;for(const t of e){const e=r(t),n=f.get(e)??[];n.push(t),f.set(e,n)}const d=[];for(const t of s){const e=f.get(t);if(!e||0===e.length)continue;const n=zn(e,c,i);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=zn(l,c,i);for(const e of t){const t=An(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<An(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function Dn(t,e,n,o,r){const s=[...e],a=new Set(t),i=new Set(e),c=o?new Set(o):null,f=n.filter(t=>a.has(t.src)&&i.has(t.dst)),d=c?n.filter(t=>i.has(t.src)&&c.has(t.dst)):void 0,l=(0,m.__name)(e=>{let n=Gn(t,e,f);return d&&o&&(n+=Gn(e,o,d)),n},"crossingScore"),u=r?new Map:null;if(r&&u)for(const t of e)u.set(t,r(t));let h=!0,g=l(s);for(;h;){h=!1;for(let t=0;t+1<s.length;t++){if(u){if(u.get(s[t])!==u.get(s[t+1]))continue}const e=g;[s[t],s[t+1]]=[s[t+1],s[t]];const n=l(s);n<e?(g=n,h=!0):[s[t],s[t+1]]=[s[t+1],s[t]]}}return s}function Hn(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=dn(e),a=un(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=jn(o[t-1],o[t],r,"down",s,a),o[t]=Dn(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=jn(o[t+1],o[t],r,"up",s,a),o[t]=Dn(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function Vn(t,e,n){const o=n?.layerGap??gn.DEFAULT_LAYER_GAP,r=n?.nodeGap??gn.DEFAULT_NODE_GAP,s=n?.laneGap??2*r,a=n?.direction??"TB",i="LR"===a||"RL"===a,c=t.layers,f=Object.create(null),d=Object.create(null),l=(0,m.__name)(t=>e.nodeById.get(t),"getNode"),u=(0,m.__name)(t=>l(t)?.width??0,"getWidth"),h=(0,m.__name)(t=>l(t)?.height??0,"getHeight"),g=dn(e),p=un(e,n?.laneOrder),x=c.map(t=>t.reduce((t,e)=>Math.max(t,h(e)),0)),y=[];if(i)for(let t=0;t+1<c.length;t++){const e=c[t].reduce((t,e)=>Math.max(t,u(e)),0),n=c[t+1].reduce((t,e)=>Math.max(t,u(e)),0),r=x[t]/2+x[t+1]/2,s=(e+n)/2,a=Math.max(0,s-r-o);y.push(a)}const _=new Set;for(const t of c)for(const e of t)_.add(g(e));const b=_.has(null),M=p.filter(t=>_.has(t)),I=[...b?[null]:[],...M],S=Object.create(null);for(const t of M)S[t]=0;b&&(S.null=0);for(const t of c){const e=Object.create(null),n=[];for(const o of t){const t=g(o);null===t?n.push(o):(e[t]||=[]).push(o)}for(const[t,n]of Object.entries(e)){const e=n.reduce((t,e)=>t+u(e),0)+r*Math.max(0,n.length-1);S[t]=Math.max(S[t]??0,e)}if(b&&n.length){const t=n.reduce((t,e)=>t+u(e),0)+r*Math.max(0,n.length-1);S.null=Math.max(S.null??0,t)}}const w=new Map;{const t=I.map(t=>(null===t?S.null:S[t])??0);let e=-(t.reduce((t,e)=>t+e,0)+s*Math.max(0,I.length-1))/2;for(let n=0;n<I.length;n++){const o=I[n],r=t[n]??0,a=e+r/2;w.set(o,a),e+=r,n<I.length-1&&(e+=s)}}let v=0;for(const[t,e]of c.entries()){const n=x[t]??0,s=new Map;for(const t of e){const e=g(t),n=s.get(e)??[];n.push(t),s.set(e,n)}for(const t of I){const e=s.get(t)??[];if(0===e.length)continue;const o=w.get(t);if(1===e.length){const t=e[0];f[t]=o,d[t]=v+n/2}else{const t=e.map(t=>u(t));let s=o-(t.reduce((t,e)=>t+e,0)+r*(e.length-1))/2;for(const[o,a]of e.entries()){const e=t[o];f[a]=s+e/2,d[a]=v+n/2,s+=e+r}}}v+=n+o+(y[t]??0)}const L=new Map;for(const t of e.edges){const e=t.ref.id;L.has(e)||L.set(e,[]),L.get(e).push(t)}for(const[,t]of L){if(0===t.length)continue;const n=t[0].ref,o=n.start,r=n.end;if(null==o||null==r)continue;const s=Math.round(((f[o]??0)+(f[r]??0))/2),a=new Set;for(const e of t)a.add(e.src),a.add(e.dst);for(const t of a){if(t===o||t===r)continue;const n=e.nodeById.get(t);n?.isDummy&&(f[t]=s)}}return{x:f,y:d}}(0,m.__name)(mn,"buildDrivingTree"),(0,m.__name)(pn,"chooseParent"),(0,m.__name)(xn,"buildAdjacency"),(0,m.__name)(yn,"assignComponents"),(0,m.__name)(_n,"computeBlocks"),(0,m.__name)(bn,"popBlock"),(0,m.__name)(Mn,"computeSubtreeCrossCounts"),(0,m.__name)(In,"annotateMinimumLayers"),(0,m.__name)(Sn,"compareByRankThenId"),(0,m.__name)(wn,"emitNodesInTreeOrder"),(0,m.__name)(vn,"deduplicateLayers"),(0,m.__name)(Ln,"createChildOrderer"),(0,m.__name)(Cn,"buildMultitreeLayerOrder"),(0,m.__name)(On,"countCrossingsBetweenAdjacent"),(0,m.__name)(Tn,"totalCrossings"),(0,m.__name)(kn,"optimizeRanksByCrossings"),(0,m.__name)(Nn,"adjustCrossLaneSources"),(0,m.__name)(En,"assignLayers_LongestPath"),(0,m.__name)(Rn,"assignLayers_Gravity"),(0,m.__name)($n,"topoSortByGenerationIfAcyclic"),(0,m.__name)(Bn,"assignLayers_LaneAwareCompact"),(0,m.__name)(Fn,"makeProperLayering"),(0,m.__name)(Pn,"median"),(0,m.__name)(An,"barycenter"),(0,m.__name)(Yn,"neighborPositionsFor"),(0,m.__name)(Xn,"currentOrderTieBreak"),(0,m.__name)(Gn,"countCrossingsBetweenAdjacent"),(0,m.__name)(zn,"sortByHeuristic"),(0,m.__name)(jn,"reorderLayer"),(0,m.__name)(Dn,"transposeImprove"),(0,m.__name)(Hn,"orderLayers"),(0,m.__name)(Vn,"assignCoordinates");var Wn=8;function Un(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function qn(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function Jn(t,e){const n=[...t],o=qn(e);for(let t=n.length-1;t>0;t--){const e=Math.floor(o()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n}function Kn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function Zn(t,e){const n=new Map;for(const[e,o]of t.entries())n.set(o,e);let o=0;for(const{a:t,b:r,weight:s}of e){const e=n.get(t),a=n.get(r);null!=e&&null!=a&&(o+=s*Math.abs(e-a))}return o}function Qn(t){const e=ln(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=dn(t),r=new Map;for(const e of t.layout.edges??[]){if(e.isLayoutOnly)continue;const s="string"==typeof e.start?e.start:void 0,a="string"==typeof e.end?e.end:void 0;if(!(s&&a&&t.nodeById.has(s)&&t.nodeById.has(a)))continue;const i=o(s),c=o(a);if(!i||!c||i===c)continue;const f=n.get(i),d=n.get(c);if(null==f||null==d)continue;const[l,u]=f<=d?[i,c]:[c,i],h=`${l}\0${u}`,g=r.get(h);g?g.weight++:r.set(h,{a:l,b:u,weight:1})}return[...r.values()]}function to(t,e,n){const o=[...t];let r=Zn(o,e),s=!0,a=0;const i=Math.max(1,o.length);for(;s&&a<i;){s=!1,a++;for(let t=0;t+1<o.length;t++){[o[t],o[t+1]]=[o[t+1],o[t]];const n=Zn(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:Kn(o,n)}}function eo(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function no(t,e,n){const o=[...e].sort((t,e)=>t.a===e.a?t.b.localeCompare(e.b):t.a.localeCompare(e.a)).map(({a:t,b:e,weight:n})=>`${t}:${e}:${n}`).join("|");return Un(`${t.join("|")}#${o}#${n}`)}function oo(t,e={}){const n=ln(t);if(n.length<2)return n;const o=Qn(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=to(n,o,r);const a=Math.max(0,e.restarts??Wn);for(let t=0;t<a;t++){const e=to(Jn(n,no(n,o,t)),o,r);eo(e,s)&&(s=e)}return s.order}function ro(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=Je(t),s=e?.automaticLaneOrdering?oo(r,{restarts:Wn}):void 0,a=cn(r),i=a.acyclic,c=n?Bn(i,{compactSingleInput:e?.compactSingleInput??hn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):Rn(i,{compactSingleInput:e?.compactSingleInput??hn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=Fn(c,i),l=Hn(f,d,{laneOrder:s}),u=Vn(l,d,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:s});return{acyclic:i,reversed:a.reversed,layering:f,ordered:l,coordinates:u}}(0,m.__name)(Un,"hashString"),(0,m.__name)(qn,"mulberry32"),(0,m.__name)(Jn,"deterministicShuffle"),(0,m.__name)(Kn,"sourceDistance"),(0,m.__name)(Zn,"laneArrangementCost"),(0,m.__name)(Qn,"buildWeightedLaneEdges"),(0,m.__name)(to,"greedySwitch"),(0,m.__name)(eo,"isBetterCandidate"),(0,m.__name)(no,"seedForRestart"),(0,m.__name)(oo,"optimizeTopLaneOrder"),(0,m.__name)(ro,"sugiyamaLayout");var so=1e-6,ao=8,io=15,co=15,fo=25,lo=20,uo=10;function ho(t,e,n){const o=t.x??0,r=t.y??0,s=e.x-o,a=e.y-r,i=Math.abs(s),c=Math.abs(a);if(i<so&&c<so)return n;return c>so&&3*c>=i?a>0?"bottom":"top":i>so?s>0?"right":"left":n}function go(t,e){return Math.abs(t.to-e.from)<so||Math.abs(t.to-e.to)<so?t.to:t.from}function mo(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function po(t,e){const n=t.nodes??[],o=t.edges??[],r=[];for(const t of o)t.isLayoutOnly||r.push(Object.assign({},t,{__originalEdge:t}));const s=new Map,a=new Map,i=[],c="LR"===e;for(const t of n)s.set(t.id,t);const f=n.filter(t=>t.isGroup&&!t.parentId);for(const t of f){const e={id:t.id},o=(0,m.__name)(t=>{a.set(t.id,e),n.filter(e=>e.parentId===t.id).forEach(o)},"assignLane");o(t)}const d=n.filter(t=>!t.isGroup&&!t.isEdgeLabel).map(t=>{const e=t.width??10,n=t.height??10,o=t.x??0,r=t.y??0,s=ao;return{nodeId:t.id,minX:o-e/2-s,maxX:o+e/2+s,minY:r-n/2-s,maxY:r+n/2+s,visualXHalfExtent:c?n/2+s:e/2+s}}),l=(0,m.__name)((t,e,n,o)=>{let r=i.find(n=>n.orientation===t&&Math.abs(n.coord-e)<1);return r||(r={id:`pipe-${t}-${e.toFixed(0)}`,orientation:t,coord:e,spanMin:n,spanMax:o,tracks:[]},i.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),u=(0,m.__name)((t,e)=>{const n=t.width??10,o=t.height??10,r=t.x??0,s=t.y??0;switch(e){case"top":return{x:r,y:s-o/2};case"bottom":return{x:r,y:s+o/2};case"left":return{x:r-n/2,y:s};case"right":return{x:r+n/2,y:s}}},"portForSide"),h=(0,m.__name)((t,e,n)=>u(t,ho(t,e,n?"bottom":"top")),"getOrthogonalPort"),g=[],p=[],x=new Set,y=(0,m.__name)((t,e,n)=>{if(0===g.length)return 0;const o=Math.abs(e.y-n.y)<so,r=Math.abs(e.x-n.x)<so;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-so,a=Math.max(e.x,n.x)+so;if(a<=r)return 0;for(const e of g)e.edgeIndex!==t&&"vertical"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>a||e.from-so<=o&&e.to+so>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-so,a=Math.max(e.y,n.y)+so;if(a<=r)return 0;for(const e of g)e.edgeIndex!==t&&"horizontal"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>a||e.from-so<=o&&e.to+so>=o&&(s+=1e3))}return s},"crossingPenalty"),_=r.map((t,e)=>{if(!t.start||!t.end)return{idx:e,crossLane:0,dx:0,dy:0};const n=s.get(t.start),o=s.get(t.end),r=a.get(t.start),i=a.get(t.end);return{idx:e,crossLane:r&&i&&r.id!==i.id?1:0,dx:n&&o?Math.abs((o.x??0)-(n.x??0)):0,dy:n&&o?Math.abs((o.y??0)-(n.y??0)):0}}).sort((t,e)=>{if(t.crossLane!==e.crossLane)return e.crossLane-t.crossLane;const n=t.dx+t.dy,o=e.dx+e.dy;return Math.abs(n-o)>1?n-o:t.idx-e.idx}).map(t=>t.idx),b=(0,m.__name)((t,e,n,o)=>{const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),a=Math.min(t.y,e.y),i=Math.max(t.y,e.y);return!!d.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>so?c.minY<t.y&&c.maxY>t.y&&c.maxX>r&&c.minX<s:c.minX<t.x&&c.maxX>t.x&&c.maxY>a&&c.minY<i)))},"isSegmentBlocked"),M=new Map,I=new Map;for(const t of r)t.start&&t.end&&t.start!==t.end&&(I.set(t.start,(I.get(t.start)??0)+1),I.set(t.end,(I.get(t.end)??0)+1));const S=(0,m.__name)((t,e)=>ho(t,e,"bottom"),"determineSide"),w=new Map;for(const[t,e]of r.entries()){if(!e.start||!e.end||e.start===e.end)continue;if(e.points&&e.points.length>0)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const r=(o.x??0)-(n.x??0),a=(o.y??0)-(n.y??0);w.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:S(n,{x:o.x??0,y:o.y??0}),dstSide:S(o,{x:n.x??0,y:n.y??0}),absDx:Math.abs(r),absDy:Math.abs(a),dxSign:Math.sign(r),dySign:Math.sign(a)})}const v=(0,m.__name)(t=>"top"===t.srcSide||"bottom"===t.srcSide?0===t.absDx?1/0:t.absDy/t.absDx:0===t.absDy?1/0:t.absDx/t.absDy,"preferenceStrength"),L=(0,m.__name)(t=>"top"===t.srcSide||"bottom"===t.srcSide?t.dxSign>=0?"right":"left":t.dySign>=0?"bottom":"top","secondarySide"),C=new Map;for(const t of w.values()){const e=`${t.srcId}:${t.srcSide}`;C.has(e)||C.set(e,[]),C.get(e).push(t)}const O=new Map,T=(0,m.__name)((t,e)=>`${t}:${e}`,"loadKey");for(const t of w.values())O.set(T(t.srcId,t.srcSide),(O.get(T(t.srcId,t.srcSide))??0)+1),O.set(T(t.dstId,t.dstSide),(O.get(T(t.dstId,t.dstSide))??0)+1);for(const t of C.values())if(!(t.length<2)){t.sort((t,e)=>{const n=v(t),o=v(e);return Math.abs(n-o)>1e-9?o-n:t.edgeIdx-e.edgeIdx});for(let e=1;e<t.length;e++){const n=t[e],o=L(n),r=O.get(T(n.srcId,n.srcSide))??0,s=O.get(T(n.srcId,o))??0;s>=r||(O.set(T(n.srcId,n.srcSide),r-1),O.set(T(n.srcId,o),s+1),n.srcSide=o)}}const k=(0,m.__name)(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),N=new Map;for(const t of w.values())N.has(t.dstId)||N.set(t.dstId,new Set),N.get(t.dstId).add(t.dstSide);for(const t of w.values()){if(!k(s.get(t.srcId)))continue;const e=N.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=L(t);if(e.has(n)||(O.get(T(t.srcId,n))??0)>0)continue;const o=O.get(T(t.srcId,t.srcSide))??0;O.set(T(t.srcId,t.srcSide),Math.max(0,o-1)),O.set(T(t.srcId,n),1),t.srcSide=n}for(const t of w.values()){const{edgeIdx:e,srcId:n,dstId:o,srcSide:r,dstSide:a}=t,i=s.get(n),c=s.get(o),f=`${n}:${r}:src`,d="top"===r||"bottom"===r?c.x??0:c.y??0;M.has(f)||M.set(f,[]),M.get(f).push({edgeIdx:e,oppositeCoord:d});const l=`${o}:${a}:dst`,u="top"===a||"bottom"===a?i.x??0:i.y??0;M.has(l)||M.set(l,[]),M.get(l).push({edgeIdx:e,oppositeCoord:u})}const E=new Map;for(const[t,e]of M){if(e.length<2)continue;e.sort((t,e)=>t.oppositeCoord-e.oppositeCoord);const n=t.split(":"),o=n.slice(0,-2).join(":"),r=n[n.length-2],a=n[n.length-1],i=s.get(o);if(!i)continue;const c="left"===r||"right"===r?i.height??10:i.width??10,f=i.shape,d="question"===f||"diamond"===f?.3*c:c,l=20,u=Math.min(l,Math.max(8,d/(e.length+1))),h=-(u*(e.length-1))/2;for(const[t,n]of e.entries()){const e=h+t*u,o=`${n.edgeIdx}:${a}`;E.set(o,e)}}const R=(0,m.__name)(t=>Boolean(r[t]?.labelNodeId),"edgeHasLabelNode"),$=(0,m.__name)((t,e)=>!!t&&((M.get(`${t}:${e}:src`)??[]).some(({edgeIdx:t})=>R(t))||(M.get(`${t}:${e}:dst`)??[]).some(({edgeIdx:t})=>R(t))),"faceHasLabelNode"),B=(0,m.__name)((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),F=(0,m.__name)((t,e,n)=>{const o=w.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},a=o?.srcSide??S(e,r),i=o?.dstSide??S(n,s);let c=o?u(e,o.srcSide):h(e,r,!0),f=o?u(n,o.dstSide):h(n,s,!1);const d=E.get(`${t}:src`),l=E.get(`${t}:dst`);return void 0!==d&&(c=B(c,a,d)),void 0!==l&&(f=B(f,i,l)),{pSrcPort:c,pDstPort:f,srcSide:a,dstSide:i}},"portsForEdge");for(const t of _){const e=r[t];if(p[t]=[],!e.start||!e.end)continue;if(e.points&&e.points.length>0)continue;if(e.start===e.end)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const{pSrcPort:a,pDstPort:f,srcSide:u,dstSide:h}=F(t,n,o),_=Object.assign({},a),S=Object.assign({},f),w="top"===u||"bottom"===u,v="top"===h||"bottom"===h;if(w){const t=a.y>(n.y??0);_.y=t?a.y+lo:a.y-lo}else{const t=a.x>(n.x??0);_.x=t?a.x+lo:a.x-lo}if(v){const t=f.y>(o.y??0);S.y=t?f.y+lo:f.y-lo}else{const t=f.x>(o.x??0);S.x=t?f.x+lo:f.x-lo}const L=(0,m.__name)((t,e)=>{for(const n of d)if(!e.includes(n.nodeId)&&t.x>n.minX&&t.x<n.maxX&&t.y>n.minY&&t.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),C=(0,m.__name)((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+io:o.minX-io,y:r?o.maxY+co:o.minY-co,leavesPositiveSide:r}}const s=t.x>(e.x??0),a=(n.y??0)>=t.y;return{x:s?o.maxX+io:o.minX-io,y:a?o.maxY+co:o.minY-co,leavesPositiveSide:s}},"obstacleDetour");let O=[];const T=[e.start,e.end],k=L(_,T);if(k.inside&&k.obstacle){const t=k.obstacle;if(w){const e=C(a,n,o,t,!0);_.x=e.x,_.y=e.y;const r=e.leavesPositiveSide?Math.min(t.minY-2,a.y+lo):Math.max(t.maxY+2,a.y-lo);O=[{x:a.x,y:r},{x:e.x,y:r},{x:e.x,y:e.y}]}else{const e=C(a,n,o,t,!1),r=e.leavesPositiveSide?Math.min(t.minX-2,a.x+lo):Math.max(t.maxX+2,a.x-lo);_.x=e.x,_.y=e.y,O=[{x:r,y:a.y},{x:r,y:e.y},{x:e.x,y:e.y}]}}let N=[];const R=L(S,T);if(R.inside&&R.obstacle){const t=R.obstacle;if(v){const e=C(f,o,n,t,!0);S.x=e.x,S.y=e.y,N=[{x:e.x,y:e.y},{x:f.x,y:e.y}]}else{const e=C(f,o,n,t,!1);S.x=e.x,S.y=e.y,N=[{x:e.x,y:e.y},{x:e.x,y:f.y}]}}if(0===O.length&&0===N.length){const n=io,o=Math.abs(_.x-S.x)<n,r=Math.abs(_.y-S.y)<n,s=void 0!==E.get(`${t}:src`)||void 0!==E.get(`${t}:dst`),i=(M.get(`${e.start??""}:${u}:src`)?.length??0)+(M.get(`${e.start??""}:${u}:dst`)?.length??0),c=(M.get(`${e.end??""}:${h}:src`)?.length??0)+(M.get(`${e.end??""}:${h}:dst`)?.length??0),d=i>1||c>1,l=I.get(e.start??"")??0,m=I.get(e.end??"")??0,p=i>1&&$(e.start,u)||c>1&&$(e.end,h);if((o||r)&&!s&&(!d||d&&!p&&(i<=1||l<=2)&&(c<=1||m<=2))){if(!b(a,f,e.start,e.end)){e.points=[Object.assign({},a),Object.assign({},_),Object.assign({},S),Object.assign({},f)],x.add(t);const n=r?"horizontal":"vertical",o=r?a.y:a.x,s=r?Math.min(a.x,f.x):Math.min(a.y,f.y),i=r?Math.max(a.x,f.x):Math.max(a.y,f.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:i,tracks:[]};g.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:i});continue}}}const B=l("vertical",_.x,_.y,_.y);_.x=B.coord;const P=l("vertical",S.x,S.y,S.y);S.x=P.coord;let A=Math.min(_.x,S.x)-50,Y=Math.max(_.x,S.x)+50,X=Math.min(_.y,S.y)-50,G=Math.max(_.y,S.y)+50;for(const t of d){const e=Math.min(_.x,S.x),n=Math.max(_.x,S.x),o=Math.min(_.y,S.y),r=Math.max(_.y,S.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(A=Math.min(A,t.minX-fo),Y=Math.max(Y,t.maxX+fo),X=Math.min(X,t.minY-fo),G=Math.max(G,t.maxY+fo))}for(const t of d){if(t.maxX<A||t.minX>Y||t.maxY<X||t.minY>G)continue;const e=io;l("horizontal",t.minY-e,A,Y),l("horizontal",t.maxY+e,A,Y);const n=co;l("vertical",t.minX-n,X,G),l("vertical",t.maxX+n,X,G)}l("horizontal",_.y,A,Y),l("horizontal",S.y,A,Y);const z=i.filter(t=>"horizontal"===t.orientation&&t.coord>=X&&t.coord<=G),j=i.filter(t=>"vertical"===t.orientation&&t.coord>=A&&t.coord<=Y),D=(0,m.__name)((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),H=D(_.x,_.y),V=D(S.x,S.y),W=new Map,U=new Map,q=new Map,J=new Set,K=[];W.set(H,0),q.set(H,"n"),K.push({key:H,f:Math.hypot(S.x-_.x,S.y-_.y),pt:_}),J.add(H);let Z=[];const Q=(0,m.__name)((t,n)=>b(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:S.x,y:_.y},et=Q(_,tt),nt=Q(tt,S),ot=et||nt,rt={x:_.x,y:S.y},st=Q(_,rt),at=Q(rt,S);if(ot?st||at||(Z=Math.abs(_.x-S.x)<so?[_,S]:[_,rt,S]):Z=Math.abs(_.y-S.y)<so||Math.abs(_.x-S.x)<so?[_,S]:[_,tt,S],0===Z.length)for(;K.length>0;){K.sort((t,e)=>t.f-e.f);const n=K.shift();if(J.delete(n.key),n.key===V){let t=V,e=S;for(Z=[e];U.has(t);){const n=U.get(t);Z.unshift(n),e=n,t=D(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=j.sort((t,e)=>t.coord-e.coord),a=s.findIndex(t=>Math.abs(t.coord-o)<1),i=z.sort((t,e)=>t.coord-e.coord),c=i.findIndex(t=>Math.abs(t.coord-r)<1),f=[];a>0&&f.push({x:s[a-1].coord,y:r}),a>=0&&a<s.length-1&&f.push({x:s[a+1].coord,y:r}),c>0&&f.push({x:o,y:i[c-1].coord}),c>=0&&c<i.length-1&&f.push({x:o,y:i[c+1].coord});for(const s of f){const a=Math.min(o,s.x),i=Math.max(o,s.x),c=Math.min(r,s.y),f=Math.max(r,s.y);if(d.some(t=>t.nodeId!==e.start&&t.nodeId!==e.end&&(a!==i?t.minY<r&&t.maxY>r&&t.maxX>a&&t.minX<i:t.minX<o&&t.maxX>o&&t.maxY>c&&t.minY<f)))continue;const l=D(s.x,s.y),u=Math.abs(s.x-o)+Math.abs(s.y-r),h=y(t,n.pt,s);let g=0;const m=S.x-_.x,p=S.y-_.y,x=s.x-o,b=s.y-r;(p>10&&b<-5||p<-10&&b>5)&&(g=100*Math.abs(b)),(m>10&&x<-5||m<-10&&x>5)&&(g+=50*Math.abs(x));let M=0;const I=q.get(n.key)??"n",w=Math.abs(x)>so?"h":"v";"n"!==I&&I!==w&&(M=50);const v=u+h+g+M,L=(W.get(n.key)??1/0)+v,C=Math.abs(S.x-s.x)+Math.abs(S.y-s.y);if(L<(W.get(l)??1/0))if(U.set(l,n.pt),W.set(l,L),q.set(l,w),J.has(l)){const t=K.findIndex(t=>t.key===l);-1!==t&&(K[t].f=L+C)}else K.push({key:l,f:L+C,pt:s}),J.add(l)}}if(0===Z.length&&(Z=[_,{x:_.x,y:S.y},S]),Z.length>4){const t=Z[0],e=Z[Z.length-1];let n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y);for(const t of Z)n=Math.min(n,t.x),o=Math.max(o,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y);const a=o>Math.max(t.x,e.x),i=n<Math.min(t.x,e.x);if(c){const r=co;if(a){const n=Math.max(t.x,e.x),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),i=d.filter(t=>t.minX<n&&t.maxX>n&&t.minY<a&&t.maxY>s);if(i.length>0){let n=Math.max(t.x,e.x);for(const t of i){const e=(t.minX+t.maxX)/2;if(void 0===t.visualXHalfExtent||isNaN(t.visualXHalfExtent))continue;const o=e+t.visualXHalfExtent+r;n=Math.max(n,o)}isNaN(n)||(o=n)}}if(i){const o=d.filter(n=>n.minX<Math.min(t.x,e.x)+r&&n.minY<Math.max(t.y,e.y)&&n.maxY>Math.min(t.y,e.y));if(o.length>0){let s=Math.min(t.x,e.x);for(const t of o){const e=(t.minX+t.maxX)/2-t.visualXHalfExtent-r;s=Math.min(s,e)}n=s}}}const f=(0,m.__name)(n=>{const o=e.y>t.y,r=d.filter(n=>{const o=Math.min(t.x,e.x)<n.maxX&&Math.max(t.x,e.x)>n.minX,r=Math.min(t.y,e.y)<n.maxY&&Math.max(t.y,e.y)>n.minY;return o&&r});let s=r;if(c&&r.length>0){const t=r.filter(t=>t.minX<n&&t.maxX>n);t.length>0&&(s=t)}if(0===s.length)return e.y;const a=io;if(o){const t=Math.max(...s.map(t=>t.maxY))+a;if(t<e.y-so)return t}else{const t=Math.min(...s.map(t=>t.minY))-a;if(t>e.y+so)return t}return e.y},"findBestReturnY"),l=(0,m.__name)(n=>{const o=f(n),r={x:n,y:t.y},s={x:n,y:o},a={x:e.x,y:o},i=Q(t,r),c=Q(r,s),d=Q(s,a),l=o!==e.y&&Q(a,e);return i||c||d||l?null:Math.abs(o-e.y)<so?[t,r,s,e]:[t,r,s,a,e]},"trySimplifyWithDetourX"),u=a&&!i?l(o):i&&!a?l(n):null;u&&(Z=u)}const it=[a,...O,...Z,...N.reverse(),f];if(it.length>=3){const t=it[it.length-1],e=it[it.length-2],n=it[it.length-3],o=Math.abs(n.y-e.y)<so&&Math.abs(e.y-t.y)<so,r=Math.abs(n.x-e.x)<so&&Math.abs(e.x-t.x)<so;if(o){const o=Math.sign(e.x-n.x),r=Math.sign(t.x-n.x);0!==o&&o===r&&Math.abs(e.x-n.x)>Math.abs(t.x-n.x)&&it.splice(-2,1)}else if(r){const o=Math.sign(e.y-n.y),r=Math.sign(t.y-n.y);0!==o&&o===r&&Math.abs(e.y-n.y)>Math.abs(t.y-n.y)&&it.splice(-2,1)}}const ct=[it[0]];for(let t=1;t<it.length-1;t++){if(1===t){ct.push(it[t]);continue}const e=ct[ct.length-1],n=it[t],o=it[t+1];if(Math.abs(e.y-n.y)<so&&Math.abs(n.y-o.y)<so){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<so&&Math.abs(n.x-o.x)<so){if(n.y>e.y!==o.y>n.y){ct.push(n);continue}continue}ct.push(n)}ct.push(it[it.length-1]);for(let e=0;e<ct.length-1;e++){const n=ct[e],o=ct[e+1],r=Math.abs(n.x-o.x)<so?"vertical":"horizontal",s="vertical"===r?n.x:n.y,a="vertical"===r?Math.min(n.y,o.y):Math.min(n.x,o.x),i="vertical"===r?Math.max(n.y,o.y):Math.max(n.x,o.x),c=l(r,s,a,i),f={edgeIndex:t,segmentIndex:e,orientation:r,pipe:c,trackIndex:0,from:a,to:i};g.push(f),p[t].push(g.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:a,to:i})}}const P=(0,m.__name)((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),A=(0,m.__name)((t,e,n,o)=>{const r=!o.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&P(n,t)),s=!n.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&P(n,e));return!(!r||!s)&&(t.trackIndex=o.index,e.trackIndex=n.index,n.segments=[...n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],o.segments=[...o.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],!0)},"trySwapSegmentsAcrossTracks"),Y=(0,m.__name)(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),X=(0,m.__name)((t,e)=>{const n=t.pipe.tracks[t.trackIndex];n.segments=n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),t.trackIndex=e;t.pipe.tracks[e].segments.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to})},"moveSegmentToTrack"),G=(0,m.__name)((t,e)=>{const n=p[t.edgeIndex];for(const o of n){const n=g[o];n.pipe===t.pipe&&X(n,e)}},"moveSegmentChainToTrack"),z=(0,m.__name)(t=>{const e=p[t.edgeIndex],n=e.indexOf(g.indexOf(t)),o=[];return n>0&&o.push(g[e[n-1]]),n<e.length-1&&o.push(g[e[n+1]]),o},"getAdjacentSegmentsAlongEdge"),j=(0,m.__name)((t,e)=>{if(t.orientation===e.orientation)return!1;const n="horizontal"===t.orientation?t:e,o="horizontal"===t.orientation?e:t;return o.pipe.coord>n.from&&o.pipe.coord<n.to&&n.pipe.coord>o.from&&n.pipe.coord<o.to},"haveAnyCrossing"),D=(0,m.__name)((t,e)=>{for(const n of t.tracks){if(!n.segments.some(t=>(t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex)&&P(t,e)))return n.index}return-1},"findAvailableTrack"),H=(0,m.__name)((t,e)=>{if(t.trackIndex===e.trackIndex)return P(t,e);const n=z(t),o=z(e);return n.some(t=>o.some(e=>j(t,e)))},"segmentsConflict"),V=(0,m.__name)((t,e,n)=>{if(A(t,e,t.pipe.tracks[t.trackIndex],e.pipe.tracks[e.trackIndex]))return;const o=D(t.pipe,e);n(e,-1!==o?o:Y(t.pipe))},"resolveTrackConflict"),W=(0,m.__name)(t=>{let e=0;for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=t[n],s=t[o];r.pipe===s.pipe&&(H(r,s)&&(e++,V(r,s,G)))}return e},"resolveHandleConflicts"),U=new Map,q=(0,m.__name)(t=>{if(U.has(t))return U.get(t);const e=p[t];if(0===e.length){const e={dest:0,deviation:0,base:0,delta:0};return U.set(t,e),e}const n=g[e[0]].pipe.coord;let o=n;for(let t=1;t<e.length;t++){const r=g[e[t]];if("horizontal"===r.orientation){const t=r.from,e=r.to;o=Math.abs(t-n)>Math.abs(e-n)?t:e;break}}const r={dest:o,deviation:Math.abs(o-n),base:n,delta:o-n};return U.set(t,r),r},"getDestInfo"),J=(0,m.__name)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries())0!==p[t].length&&n.start&&(e.has(n.start)||e.set(n.start,[]),e.get(n.start).push(t));const n=(0,m.__name)(t=>{const e=r[t];if(!e.start||!e.end)return 0;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)return 0;const a=(o.x??0)-(n.x??0),i=(o.y??0)-(n.y??0);return Math.abs(a)+Math.abs(i)},"getEdgeDistance");for(const o of e.values()){o.sort((t,e)=>{const o=q(t),r=q(e);if(Math.abs(o.deviation-r.deviation)>1)return o.deviation-r.deviation;if(Math.abs(o.dest-r.dest)>1)return o.dest-r.dest;const s=n(t),a=n(e);if(Math.abs(s-a)>1)return a-s;const i=p[t].length,c=p[e].length;if(i!==c)return i-c;if(1===i){const n=p[t][0],o=p[e][0];if(g[n]&&g[o]){const t=g[n],e=g[o],r=Math.abs(t.to-t.from),s=Math.abs(e.to-e.from);if(Math.abs(r-s)>1)return r-s}}return 0});const e=o.map(t=>g[p[t][0]]);t+=W(e)}return t},"fixSourceHandleCrossings"),K=(0,m.__name)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries()){0!==p[t].length&&(n.end&&(e.has(n.end)||e.set(n.end,[]),e.get(n.end).push(t)))}for(const n of e.values()){n.sort((t,e)=>{const n=(0,m.__name)(t=>{const e=p[t];if(e.length<2)return 0;const n=g[e[e.length-2]];return Math.abs(n.to-n.from)},"getDist"),o=n(t),r=n(e);return Math.abs(o-r)>.1?o-r:t-e});const e=n.map(t=>g[p[t][p[t].length-1]]);t+=W(e)}return t},"fixTargetHandleCrossings"),Z=(0,m.__name)(()=>{let t=0;for(const e of i){const n=[];for(const t of e.tracks)for(const e of t.segments){const t=p[e.edgeIndex].find(t=>g[t].segmentIndex===e.segmentIndex);void 0!==t&&n.push(g[t])}n.sort((t,e)=>t.edgeIndex-e.edgeIndex||t.segmentIndex-e.segmentIndex);for(let e=0;e<n.length;e++)for(let o=e+1;o<n.length;o++){const r=n[e],s=n[o];H(r,s)&&(t++,V(r,s,X))}}return t},"fixPipeCrossings");let Q=0;for(;Q<10;){let t=0;if(t+=J(),t+=K(),t+=Z(),0===t)break;Q++}const tt=new Map;for(const t of i){const e=[];t.tracks.forEach(t=>{t.segments.forEach(n=>{e.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:t.index,from:n.from,to:n.to})})}),e.sort((t,e)=>t.from-e.from);const n=[];if(e.length>0){let t=[e[0]],o=e[0].to;for(let r=1;r<e.length;r++){const s=e[r];s.from<o?(t.push(s),o=Math.max(o,s.to)):(n.push(t),t=[s],o=s.to)}n.push(t)}for(const e of n){const n=new Set;e.forEach(t=>n.add(t.trackIndex));const o=new Map;e.forEach(t=>{const e=q(t.edgeIndex);o.set(t.trackIndex,(o.get(t.trackIndex)??0)+e.delta)});const r=[...n].filter(t=>(o.get(t)??0)<-1),s=[...n].filter(t=>(o.get(t)??0)>1),a=[...n].filter(t=>Math.abs(o.get(t)??0)<=1);r.sort((t,e)=>(o.get(e)??0)-(o.get(t)??0)),s.sort((t,e)=>(o.get(t)??0)-(o.get(e)??0));const i=(0,m.__name)((n,o)=>{e.filter(t=>t.trackIndex===n).forEach(e=>{const n=x.has(e.edgeIndex)?t.coord:o;tt.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},"assignCoord");let c=0;for(const e of r)c++,i(e,t.coord-c*uo);if(0===a.length&&n.size>0){const t=[...n].sort((t,e)=>Math.abs(o.get(t)??0)-Math.abs(o.get(e)??0))[0],e=r.indexOf(t);-1!==e&&r.splice(e,1);const i=s.indexOf(t);-1!==i&&s.splice(i,1),a.push(t)}let f=0;for(const e of a){if(0===f)i(e,t.coord);else{const n=f%2==1?1:-1,o=Math.ceil(f/2);i(e,t.coord+n*o*uo*.5)}f++}let d=0;for(const e of s)d++,i(e,t.coord+d*uo)}}for(const[t,e]of r.entries()){const n=p[t]??[];if(0===n.length)continue;const o=[],r=s.get(e.start),a=s.get(e.end),{pSrcPort:i,pDstPort:c}=F(t,r,a),f=n.map(t=>{const e=g[t],n=tt.get(`${e.edgeIndex}-${e.segmentIndex}`)??e.pipe.coord;return{orient:e.orientation,coord:n,from:e.from,to:e.to}});o.push(i);for(let t=0;t<f.length;t++){const e=f[t],n=o[o.length-1],r="vertical"===e.orient?n.y:n.x,s="vertical"===e.orient?n.x:n.y,a=f[t+1],i=t<f.length-1;if(Math.abs(s-e.coord)>so&&o.push(mo(e,r)),i&&a.orient===e.orient)if(Math.abs(e.coord-a.coord)>so){const t="vertical"===e.orient?(r+a.from)/2:go(e,a);o.push(mo(e,t),mo(a,t))}else 0!==t&&t!==f.length-2||o.push(mo(e,go(e,a)));else if(i)o.push(mo(e,a.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(mo(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>so||Math.abs(d.y-c.y)>so)&&o.push(c);const l=[];o.length>0&&l.push(o[0]);for(let t=1;t<o.length;t++){const e=o[t],n=l[l.length-1];(Math.abs(e.x-n.x)>so||Math.abs(e.y-n.y)>so)&&l.push(e)}e.points=l}for(const t of r){const e=t.__originalEdge;e&&t.points&&(e.points=t.points)}t.edges=(t.edges??[]).filter(t=>!t.isLayoutOnly);const et=(0,m.__name)((t,e)=>{const n=e.x??0,o=e.y??0,r=e.width??0,s=e.height??0;if(r<=0||s<=0)return t;const a=n-r/2,i=n+r/2,c=o-s/2,f=o+s/2;if(t.x<a||t.x>i||t.y<c||t.y>f)return t;const d=t.x-a,l=i-t.x,u=t.y-c,h=f-t.y,g=Math.min(d,l,u,h);return g===d?{x:a,y:t.y}:g===l?{x:i,y:t.y}:g===u?{x:t.x,y:c}:{x:t.x,y:f}},"nodeBoundaryClamp");for(const e of t.edges){const t=e.points;if(!t||t.length<2)continue;const n=e.start,o=e.end,r=n?s.get(n):void 0,a=o?s.get(o):void 0;r&&(t[0]=et(t[0],r)),a&&(t[t.length-1]=et(t[t.length-1],a))}return t}function xo(t){return t.direction??"TB"}function yo(t){const e=H(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,r=t.config.swimlane?.ignoreCrossLaneEdges??!0,s=t.config.swimlane?.optimizeRanksByCrossings??!0,a=t.config.swimlane?.automaticLaneOrdering??!1,i=xo(t),{ordered:c,coordinates:f}=ro(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:a,direction:i});V(e,c,f,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;po(t,i);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return qe(t,i),Ue(t),i}async function _o(t,e){const n=e.select("g");(0,c.markers_default)(n,t.markers,t.type,t.diagramId),(0,f.clear2)(),(0,c.clear)(),(0,f.clear)(),(0,i.clear)(),D(t);const o=U(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:r}=await x(n,t);yo(t),await P(t,r)}(0,m.__name)(ho,"chooseOrthogonalSide"),(0,m.__name)(go,"sharedLineEndpointCoord"),(0,m.__name)(mo,"pointOnLine"),(0,m.__name)(po,"routeEdgesOrthogonal"),(0,m.__name)(xo,"getSwimlaneDirection"),(0,m.__name)(yo,"runSwimlaneLayoutCore"),(0,m.__name)(_o,"render")},5168,{"0":4446,"1":3270,"2":3271,"3":3272,"4":3273,"5":3274,"6":3275,"7":3276,"8":3277,"9":3278,"10":3279,"11":3280,"12":4447,"13":5333,"14":2334,"paths":{"5333":"/_expo/static/js/web/sizeCapture-X5ZJPWSS-388b849b33073b8202dd9ca50038b1c7.js"}});