@rudderhq/server 0.6.6-canary.9 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/dist/bootstrap/register-api-routes.d.ts.map +1 -1
  2. package/dist/bootstrap/register-api-routes.js +4 -0
  3. package/dist/bootstrap/register-api-routes.js.map +1 -1
  4. package/dist/bundled-plugins/plugin-linear/dist/worker.js +75 -4
  5. package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +3 -3
  6. package/dist/routes/access.d.ts.map +1 -1
  7. package/dist/routes/access.js +6 -0
  8. package/dist/routes/access.js.map +1 -1
  9. package/dist/routes/agents.management-routes.d.ts.map +1 -1
  10. package/dist/routes/agents.management-routes.js +22 -0
  11. package/dist/routes/agents.management-routes.js.map +1 -1
  12. package/dist/routes/ai-search.d.ts +3 -0
  13. package/dist/routes/ai-search.d.ts.map +1 -0
  14. package/dist/routes/ai-search.js +17 -0
  15. package/dist/routes/ai-search.js.map +1 -0
  16. package/dist/routes/browser.d.ts.map +1 -1
  17. package/dist/routes/browser.js +6 -2
  18. package/dist/routes/browser.js.map +1 -1
  19. package/dist/routes/chats.annotation-routes.d.ts.map +1 -1
  20. package/dist/routes/chats.annotation-routes.js +10 -1
  21. package/dist/routes/chats.annotation-routes.js.map +1 -1
  22. package/dist/routes/chats.d.ts.map +1 -1
  23. package/dist/routes/chats.js +1 -0
  24. package/dist/routes/chats.js.map +1 -1
  25. package/dist/routes/chats.runtime-controls.d.ts +1 -0
  26. package/dist/routes/chats.runtime-controls.d.ts.map +1 -1
  27. package/dist/routes/chats.stream-routes.d.ts.map +1 -1
  28. package/dist/routes/chats.stream-routes.js +52 -4
  29. package/dist/routes/chats.stream-routes.js.map +1 -1
  30. package/dist/routes/chats.stream-support.d.ts +1 -0
  31. package/dist/routes/chats.stream-support.d.ts.map +1 -1
  32. package/dist/routes/chats.stream-support.js +8 -0
  33. package/dist/routes/chats.stream-support.js.map +1 -1
  34. package/dist/routes/index.d.ts +1 -0
  35. package/dist/routes/index.d.ts.map +1 -1
  36. package/dist/routes/index.js +1 -0
  37. package/dist/routes/index.js.map +1 -1
  38. package/dist/routes/issues.mutations.d.ts +1 -1
  39. package/dist/routes/issues.mutations.d.ts.map +1 -1
  40. package/dist/routes/issues.mutations.js +70 -2
  41. package/dist/routes/issues.mutations.js.map +1 -1
  42. package/dist/routes/onboarding.d.ts.map +1 -1
  43. package/dist/routes/onboarding.js +35 -32
  44. package/dist/routes/onboarding.js.map +1 -1
  45. package/dist/routes/orgs.js +1 -1
  46. package/dist/routes/orgs.js.map +1 -1
  47. package/dist/routes/product-analytics-collector.d.ts +10 -0
  48. package/dist/routes/product-analytics-collector.d.ts.map +1 -0
  49. package/dist/routes/product-analytics-collector.js +28 -0
  50. package/dist/routes/product-analytics-collector.js.map +1 -0
  51. package/dist/routes/product-analytics.d.ts +3 -0
  52. package/dist/routes/product-analytics.d.ts.map +1 -0
  53. package/dist/routes/product-analytics.js +169 -0
  54. package/dist/routes/product-analytics.js.map +1 -0
  55. package/dist/routes/website-metadata.d.ts +2 -2
  56. package/dist/routes/website-metadata.d.ts.map +1 -1
  57. package/dist/routes/website-metadata.js +15 -2
  58. package/dist/routes/website-metadata.js.map +1 -1
  59. package/dist/services/activity.d.ts +3 -1
  60. package/dist/services/activity.d.ts.map +1 -1
  61. package/dist/services/activity.js +55 -6
  62. package/dist/services/activity.js.map +1 -1
  63. package/dist/services/agents.d.ts +71 -0
  64. package/dist/services/agents.d.ts.map +1 -1
  65. package/dist/services/agents.js +35 -1
  66. package/dist/services/agents.js.map +1 -1
  67. package/dist/services/ai-search.d.ts +6 -0
  68. package/dist/services/ai-search.d.ts.map +1 -0
  69. package/dist/services/ai-search.js +238 -0
  70. package/dist/services/ai-search.js.map +1 -0
  71. package/dist/services/ai-search.test.d.ts +2 -0
  72. package/dist/services/ai-search.test.d.ts.map +1 -0
  73. package/dist/services/ai-search.test.js +52 -0
  74. package/dist/services/ai-search.test.js.map +1 -0
  75. package/dist/services/automations.d.ts +1 -0
  76. package/dist/services/automations.d.ts.map +1 -1
  77. package/dist/services/automations.js +33 -1
  78. package/dist/services/automations.js.map +1 -1
  79. package/dist/services/browser-broker.d.ts +1 -0
  80. package/dist/services/browser-broker.d.ts.map +1 -1
  81. package/dist/services/browser-broker.js +34 -2
  82. package/dist/services/browser-broker.js.map +1 -1
  83. package/dist/services/browser-broker.test.js +73 -0
  84. package/dist/services/browser-broker.test.js.map +1 -1
  85. package/dist/services/chat-family-groups.d.ts +1 -1
  86. package/dist/services/chat-family-groups.d.ts.map +1 -1
  87. package/dist/services/chat-family-groups.js +17 -1
  88. package/dist/services/chat-family-groups.js.map +1 -1
  89. package/dist/services/chat-inline-annotation-validation.d.ts.map +1 -1
  90. package/dist/services/chat-inline-annotation-validation.js +226 -1
  91. package/dist/services/chat-inline-annotation-validation.js.map +1 -1
  92. package/dist/services/chat-inline-annotations.test.js +136 -1
  93. package/dist/services/chat-inline-annotations.test.js.map +1 -1
  94. package/dist/services/chat-message-branch.d.ts +5 -0
  95. package/dist/services/chat-message-branch.d.ts.map +1 -0
  96. package/dist/services/chat-message-branch.js +9 -0
  97. package/dist/services/chat-message-branch.js.map +1 -0
  98. package/dist/services/chats.create.d.ts +2 -0
  99. package/dist/services/chats.create.d.ts.map +1 -1
  100. package/dist/services/chats.create.js +76 -4
  101. package/dist/services/chats.create.js.map +1 -1
  102. package/dist/services/chats.d.ts +21 -1
  103. package/dist/services/chats.d.ts.map +1 -1
  104. package/dist/services/chats.js +46 -24
  105. package/dist/services/chats.js.map +1 -1
  106. package/dist/services/heartbeat-run-summary.d.ts.map +1 -1
  107. package/dist/services/heartbeat-run-summary.js +6 -0
  108. package/dist/services/heartbeat-run-summary.js.map +1 -1
  109. package/dist/services/index.d.ts +1 -0
  110. package/dist/services/index.d.ts.map +1 -1
  111. package/dist/services/index.js +1 -0
  112. package/dist/services/index.js.map +1 -1
  113. package/dist/services/issues.d.ts.map +1 -1
  114. package/dist/services/issues.js +69 -2
  115. package/dist/services/issues.js.map +1 -1
  116. package/dist/services/knowledge-portability/organization-portability.import.d.ts.map +1 -1
  117. package/dist/services/knowledge-portability/organization-portability.import.js +1 -0
  118. package/dist/services/knowledge-portability/organization-portability.import.js.map +1 -1
  119. package/dist/services/legacy-operator-state.d.ts.map +1 -1
  120. package/dist/services/legacy-operator-state.js +6 -0
  121. package/dist/services/legacy-operator-state.js.map +1 -1
  122. package/dist/services/local-account-auth.d.ts.map +1 -1
  123. package/dist/services/local-account-auth.js +5 -0
  124. package/dist/services/local-account-auth.js.map +1 -1
  125. package/dist/services/messenger-custom-groups.d.ts +15 -0
  126. package/dist/services/messenger-custom-groups.d.ts.map +1 -0
  127. package/dist/services/messenger-custom-groups.js +155 -0
  128. package/dist/services/messenger-custom-groups.js.map +1 -0
  129. package/dist/services/messenger-saved-views.d.ts +32 -8
  130. package/dist/services/messenger-saved-views.d.ts.map +1 -1
  131. package/dist/services/messenger-saved-views.js +67 -2
  132. package/dist/services/messenger-saved-views.js.map +1 -1
  133. package/dist/services/messenger.d.ts.map +1 -1
  134. package/dist/services/messenger.js +110 -166
  135. package/dist/services/messenger.js.map +1 -1
  136. package/dist/services/orgs.d.ts +10 -1
  137. package/dist/services/orgs.d.ts.map +1 -1
  138. package/dist/services/orgs.js +23 -1
  139. package/dist/services/orgs.js.map +1 -1
  140. package/dist/services/product-analytics-collector.d.ts +86 -0
  141. package/dist/services/product-analytics-collector.d.ts.map +1 -0
  142. package/dist/services/product-analytics-collector.js +172 -0
  143. package/dist/services/product-analytics-collector.js.map +1 -0
  144. package/dist/services/product-analytics-collector.test.d.ts +2 -0
  145. package/dist/services/product-analytics-collector.test.d.ts.map +1 -0
  146. package/dist/services/product-analytics-collector.test.js +81 -0
  147. package/dist/services/product-analytics-collector.test.js.map +1 -0
  148. package/dist/services/product-analytics.d.ts +385 -0
  149. package/dist/services/product-analytics.d.ts.map +1 -0
  150. package/dist/services/product-analytics.js +698 -0
  151. package/dist/services/product-analytics.js.map +1 -0
  152. package/dist/services/product-analytics.test.d.ts +2 -0
  153. package/dist/services/product-analytics.test.d.ts.map +1 -0
  154. package/dist/services/product-analytics.test.js +136 -0
  155. package/dist/services/product-analytics.test.js.map +1 -0
  156. package/dist/services/runtime-kernel/heartbeat.d.ts +4 -0
  157. package/dist/services/runtime-kernel/heartbeat.d.ts.map +1 -1
  158. package/dist/services/runtime-kernel/heartbeat.js +53 -1
  159. package/dist/services/runtime-kernel/heartbeat.js.map +1 -1
  160. package/dist/services/runtime-kernel/heartbeat.terminal.d.ts +3 -0
  161. package/dist/services/runtime-kernel/heartbeat.terminal.d.ts.map +1 -1
  162. package/dist/services/runtime-kernel/heartbeat.terminal.js +56 -1
  163. package/dist/services/runtime-kernel/heartbeat.terminal.js.map +1 -1
  164. package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts.map +1 -1
  165. package/dist/services/runtime-kernel/heartbeat.wakeup.js +9 -2
  166. package/dist/services/runtime-kernel/heartbeat.wakeup.js.map +1 -1
  167. package/dist/services/side-chats.d.ts +3 -0
  168. package/dist/services/side-chats.d.ts.map +1 -1
  169. package/dist/services/side-chats.js +12 -5
  170. package/dist/services/side-chats.js.map +1 -1
  171. package/dist/services/website-metadata.d.ts +3 -0
  172. package/dist/services/website-metadata.d.ts.map +1 -1
  173. package/dist/services/website-metadata.js +331 -88
  174. package/dist/services/website-metadata.js.map +1 -1
  175. package/package.json +16 -14
  176. package/resources/bundled-skills/app-builder/SKILL.md +31 -14
  177. package/resources/bundled-skills/app-builder/agents/openai.yaml +2 -2
  178. package/resources/bundled-skills/app-builder/evals/evals.json +12 -0
  179. package/resources/bundled-skills/app-builder/references/scaffold-contract.md +17 -2
  180. package/skills/app-builder/SKILL.md +31 -14
  181. package/skills/app-builder/agents/openai.yaml +2 -2
  182. package/skills/app-builder/evals/evals.json +12 -0
  183. package/skills/app-builder/references/scaffold-contract.md +17 -2
  184. package/ui-dist/assets/LibraryLiveSurface-DeUIV5N_.js +1 -0
  185. package/ui-dist/assets/{abnfDiagram-VRR7QNED-DmSFNqZA.js → abnfDiagram-VRR7QNED-BaoLM9Pd.js} +1 -1
  186. package/ui-dist/assets/{arc-DCySHdMS.js → arc-Cx0L6o2z.js} +1 -1
  187. package/ui-dist/assets/{architectureDiagram-ZJ3FMSHR-BL3egF1t.js → architectureDiagram-ZJ3FMSHR-zVfZP7v4.js} +1 -1
  188. package/ui-dist/assets/{blockDiagram-677ZJIJ3-Bh2L4BGz.js → blockDiagram-677ZJIJ3-BiWWFP9R.js} +1 -1
  189. package/ui-dist/assets/{c4Diagram-LMCZKHZV-BC0tQbna.js → c4Diagram-LMCZKHZV-CX65GSJ6.js} +1 -1
  190. package/ui-dist/assets/channel-CHc3ibOz.js +1 -0
  191. package/ui-dist/assets/{chunk-2Q5K7J3B-Du3BHUuM.js → chunk-2Q5K7J3B-CH6PlelX.js} +1 -1
  192. package/ui-dist/assets/{chunk-32BRIVSS--pEBkzQV.js → chunk-32BRIVSS-C7ZEXYO8.js} +1 -1
  193. package/ui-dist/assets/{chunk-5VM5RSS4-BPlwcWj7.js → chunk-5VM5RSS4-CyInWuue.js} +1 -1
  194. package/ui-dist/assets/{chunk-EX3LRPZG-CMdUJlKy.js → chunk-EX3LRPZG-D58qFIdM.js} +1 -1
  195. package/ui-dist/assets/{chunk-JWPE2WC7-gNumDpip.js → chunk-JWPE2WC7-CJ3Qx30f.js} +1 -1
  196. package/ui-dist/assets/{chunk-MOJQB5TN-D_J2XAWb.js → chunk-MOJQB5TN-BO4bKVLH.js} +1 -1
  197. package/ui-dist/assets/{chunk-RYQCIY6F-HUwWvMk8.js → chunk-RYQCIY6F-DxBmxcYc.js} +1 -1
  198. package/ui-dist/assets/{chunk-V7JOEXUC-BxIq5YO9.js → chunk-V7JOEXUC-Chdnd6Lq.js} +1 -1
  199. package/ui-dist/assets/{chunk-VR4S4FIN-Bt21PgEy.js → chunk-VR4S4FIN-GkW_x_pD.js} +1 -1
  200. package/ui-dist/assets/{chunk-XXDRQBXY-BMQqNb2F.js → chunk-XXDRQBXY-BJyBGcSF.js} +1 -1
  201. package/ui-dist/assets/classDiagram-OUVF2IWQ-9iLZpz3t.js +1 -0
  202. package/ui-dist/assets/classDiagram-v2-EOCWNBFH-9iLZpz3t.js +1 -0
  203. package/ui-dist/assets/{cose-bilkent-JH36ORCC-IdO8qXrd.js → cose-bilkent-JH36ORCC-BWP2r8TX.js} +1 -1
  204. package/ui-dist/assets/{cynefin-VYW2F7L2-lliB__8b.js → cynefin-VYW2F7L2-C08dfI3w.js} +1 -1
  205. package/ui-dist/assets/{cynefinDiagram-TSTJHNR4-D6hYvTa_.js → cynefinDiagram-TSTJHNR4-h6dXjTaO.js} +1 -1
  206. package/ui-dist/assets/{dagre-VKFMJZFB-BvJ54nY-.js → dagre-VKFMJZFB-CWDgoFQD.js} +1 -1
  207. package/ui-dist/assets/{diagram-FQU43EPY-LwGme7tk.js → diagram-FQU43EPY-CK1j48d-.js} +1 -1
  208. package/ui-dist/assets/{diagram-G47NLZAW-DpFi3fY3.js → diagram-G47NLZAW-CoSiG57q.js} +1 -1
  209. package/ui-dist/assets/{diagram-NH7WQ7WH-BT3DHBTZ.js → diagram-NH7WQ7WH-DRG-xXGQ.js} +1 -1
  210. package/ui-dist/assets/{diagram-OA4YK3LP-PVjLB7c8.js → diagram-OA4YK3LP-D04mMwYs.js} +1 -1
  211. package/ui-dist/assets/{diagram-WEI45ONY-BFtM6fa4.js → diagram-WEI45ONY-ZkC1ZQMq.js} +1 -1
  212. package/ui-dist/assets/{ebnfDiagram-CCIWWBDH-cOP8mEWH.js → ebnfDiagram-CCIWWBDH-BxMIw9PZ.js} +1 -1
  213. package/ui-dist/assets/{erDiagram-Q63AITRT-D5Jo2rGL.js → erDiagram-Q63AITRT-B4Zwbn84.js} +1 -1
  214. package/ui-dist/assets/{flowDiagram-23GEKE2U-ywmEM2g3.js → flowDiagram-23GEKE2U-D5pYz8Px.js} +1 -1
  215. package/ui-dist/assets/{ganttDiagram-NO4QXBWP-BU_eZKbI.js → ganttDiagram-NO4QXBWP-RSramodc.js} +1 -1
  216. package/ui-dist/assets/{gitGraphDiagram-IHSO6WYX-BpjiL_Kc.js → gitGraphDiagram-IHSO6WYX-BFQfCkMd.js} +1 -1
  217. package/ui-dist/assets/{graph-Dm9rhfLh.js → graph-DuSS8poS.js} +1 -1
  218. package/ui-dist/assets/{index-Dd2bkmgp.js → index-5tzBDABj.js} +1 -1
  219. package/ui-dist/assets/index-9U78M9Np.js +1 -0
  220. package/ui-dist/assets/index-B-NP8fOI.js +1 -0
  221. package/ui-dist/assets/{index-hi6RkKKV.js → index-BADa8mxG.js} +1 -1
  222. package/ui-dist/assets/index-BGcgy63z.js +1 -0
  223. package/ui-dist/assets/index-BKXUkeeU.js +1 -0
  224. package/ui-dist/assets/{index-CcolbA6z.js → index-BU0KLNTt.js} +578 -550
  225. package/ui-dist/assets/index-BpvytaKr.js +1 -0
  226. package/ui-dist/assets/index-CHbXMgL0.js +7 -0
  227. package/ui-dist/assets/index-Cyq94-QT.js +1 -0
  228. package/ui-dist/assets/{index-Bh9XaX7-.js → index-DRbt_Svi.js} +2 -2
  229. package/ui-dist/assets/index-De3vaw_P.js +1 -0
  230. package/ui-dist/assets/index-DzdRgH-y.js +1 -0
  231. package/ui-dist/assets/index-QrRs-r-4.css +1 -0
  232. package/ui-dist/assets/index-olsHIcXs.js +1 -0
  233. package/ui-dist/assets/index-wZlfBtwh.js +1 -0
  234. package/ui-dist/assets/{infoDiagram-FWYZ7A6U-Cy4F5ZoW.js → infoDiagram-FWYZ7A6U-f5i4pO3J.js} +1 -1
  235. package/ui-dist/assets/{ishikawaDiagram-FXEZZL3T-Dz5yqGu9.js → ishikawaDiagram-FXEZZL3T-CVEdv5i_.js} +1 -1
  236. package/ui-dist/assets/{journeyDiagram-5HDEW3XC-TwWo4pm4.js → journeyDiagram-5HDEW3XC-Cvp7vWcy.js} +1 -1
  237. package/ui-dist/assets/{kanban-definition-HUTT4EX6-DY0NB-vi.js → kanban-definition-HUTT4EX6-C6dURjjK.js} +1 -1
  238. package/ui-dist/assets/{layout-BORuuGEy.js → layout-DxdOu9MY.js} +1 -1
  239. package/ui-dist/assets/{linear-CC_dDONu.js → linear-CRi8RB_7.js} +1 -1
  240. package/ui-dist/assets/{map-CkTs9PaD.js → map-BlpDrw_l.js} +1 -1
  241. package/ui-dist/assets/{mermaid.core-BbvVSKV6.js → mermaid.core-2Gz9YusH.js} +4 -4
  242. package/ui-dist/assets/{mindmap-definition-LN4V7U3C-oEqblcyT.js → mindmap-definition-LN4V7U3C-BmSjJLTI.js} +1 -1
  243. package/ui-dist/assets/{pegDiagram-2B236MQR-Be4dxJHH.js → pegDiagram-2B236MQR-BTUboUw8.js} +1 -1
  244. package/ui-dist/assets/{pieDiagram-ENE6RG2P-DEfT3YEZ.js → pieDiagram-ENE6RG2P-CVPP8SYv.js} +1 -1
  245. package/ui-dist/assets/{quadrantDiagram-ABIIQ3AL-Cb6JOf0G.js → quadrantDiagram-ABIIQ3AL-BG4FmirT.js} +1 -1
  246. package/ui-dist/assets/{railroadDiagram-RFXS5EU6-Cq69PTte.js → railroadDiagram-RFXS5EU6-DFRNo9hF.js} +1 -1
  247. package/ui-dist/assets/{requirementDiagram-TGXJPOKE-uGctx0yQ.js → requirementDiagram-TGXJPOKE-DpnVF9qP.js} +1 -1
  248. package/ui-dist/assets/{sankeyDiagram-HTMAVEWB-D-Jn2GZ3.js → sankeyDiagram-HTMAVEWB-D1ETFdSE.js} +1 -1
  249. package/ui-dist/assets/{sequenceDiagram-DBY2YBRQ-D0PNt4tF.js → sequenceDiagram-DBY2YBRQ-CNqzB_AL.js} +1 -1
  250. package/ui-dist/assets/{sizeCapture-X5ZJPWSS-C5PkxxqV.js → sizeCapture-X5ZJPWSS-DuoMCjdH.js} +1 -1
  251. package/ui-dist/assets/{stateDiagram-2N3HPSRC-CEU6dEp8.js → stateDiagram-2N3HPSRC-fmHeKL8l.js} +1 -1
  252. package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-DajAVikh.js +1 -0
  253. package/ui-dist/assets/swimlanes-5IMT3BWC-hjosaIhT.js +2 -0
  254. package/ui-dist/assets/swimlanesDiagram-G3AALYLV-DJjG9OJ-.js +8 -0
  255. package/ui-dist/assets/{timeline-definition-FHXFAJF6-BzClran5.js → timeline-definition-FHXFAJF6-xoMEClc-.js} +1 -1
  256. package/ui-dist/assets/{vennDiagram-L72KCM5P-DCz0zpBU.js → vennDiagram-L72KCM5P-sdSXQfX-.js} +1 -1
  257. package/ui-dist/assets/{wardleyDiagram-EHGQE667-BCpjHnUs.js → wardleyDiagram-EHGQE667-BbQBSKlD.js} +1 -1
  258. package/ui-dist/assets/{xychartDiagram-FW5EYKEG-PZly8tD0.js → xychartDiagram-FW5EYKEG-BfAtadyK.js} +1 -1
  259. package/ui-dist/index.html +2 -2
  260. package/ui-dist/assets/LibraryLiveSurface-CpsfHfNv.js +0 -1
  261. package/ui-dist/assets/channel-BkaaZhpy.js +0 -1
  262. package/ui-dist/assets/classDiagram-OUVF2IWQ-wAPxgAxC.js +0 -1
  263. package/ui-dist/assets/classDiagram-v2-EOCWNBFH-wAPxgAxC.js +0 -1
  264. package/ui-dist/assets/index-B4-glB0m.js +0 -1
  265. package/ui-dist/assets/index-B77hSKzF.js +0 -1
  266. package/ui-dist/assets/index-BCtddpC-.js +0 -1
  267. package/ui-dist/assets/index-BJsfmJ3d.js +0 -6
  268. package/ui-dist/assets/index-CZQodrD7.js +0 -1
  269. package/ui-dist/assets/index-C_Zqz9dU.js +0 -1
  270. package/ui-dist/assets/index-CjAPsevc.js +0 -1
  271. package/ui-dist/assets/index-CzdqNgTk.js +0 -7
  272. package/ui-dist/assets/index-DPTcb3v2.js +0 -1
  273. package/ui-dist/assets/index-DRSP0xHL.js +0 -1
  274. package/ui-dist/assets/index-DV-n4C-H.js +0 -1
  275. package/ui-dist/assets/index-DryJkjHs.js +0 -1
  276. package/ui-dist/assets/index-TcdPtss-.js +0 -1
  277. package/ui-dist/assets/index-m9ZlZKZy.css +0 -1
  278. package/ui-dist/assets/index-wNtd8gYX.js +0 -1
  279. package/ui-dist/assets/stateDiagram-v2-6OUMAXLB-D13NNkEm.js +0 -1
  280. package/ui-dist/assets/swimlanes-5IMT3BWC-Bh0Yv4dw.js +0 -2
  281. package/ui-dist/assets/swimlanesDiagram-G3AALYLV-Ba5kuBbj.js +0 -8
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-X5ZJPWSS-DuoMCjdH.js","assets/mermaid.core-2Gz9YusH.js","assets/index-BU0KLNTt.js","assets/index-QrRs-r-4.css"])))=>i.map(i=>d[i]);
2
+ import{a3 as Rr}from"./index-BU0KLNTt.js";import{c as Nr}from"./chunk-RYQCIY6F-DxBmxcYc.js";import{al as Or,am as Pr,an as Br,ao as kr,l as Qe,c as _r,af as Fr,ae as Dr,ag as Hr,as as Xr,au as Yr,z as Gr,ar as $r,av as zr,y as _e,aw as Ve,_ as d,ax as Po}from"./mermaid.core-2Gz9YusH.js";import{G as Vr}from"./graph-DuSS8poS.js";import"./map-BlpDrw_l.js";async function Xo(t,e){const n=new Vr({multigraph:!0,compound:!0}),o=[...e.edges],s=_r(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),a=r.insert("g").attr("class","edges edgePath"),c=r.insert("g").attr("class","edgeLabels"),f=r.insert("g").attr("class","nodes"),g=new Map,p=t.node()!=null;await Promise.all(e.nodes.map(async M=>{var u;if(M.isGroup)n.setNode(M.id,{...M});else{if(p){const h=await Fr(f,M,{config:s,dir:M.dir}),l=((u=h.node())==null?void 0:u.getBBox())??{width:0,height:0};g.set(M.id,h),M.width=l.width,M.height=l.height}n.setNode(M.id,{...M})}}));for(const M of o)n.setEdge(M.start,M.end,{...M},M.id),e.edges.some(h=>h.id===M.id)||e.edges.push(M);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:M}=await Rr(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-X5ZJPWSS-DuoMCjdH.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3]));M(t,e)}return{graph:n,groups:{clusters:i,edgePaths:a,edgeLabels:c,nodes:f,rootGroups:r},nodeElements:g}}d(Xo,"createGraphWithElements");var Bo=5,je=1e-5,Ue=1e-6;function tn(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}d(tn,"buildSegmentList");function Yo(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=s*a-r*i;if(c===0)return null;const f=n.x-t.x,g=n.y-t.y,p=(f*a-g*i)/c,M=(f*r-g*s)/c;return p<=Ue||p>=1-Ue||M<=Ue||M>=1-Ue?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:M}}d(Yo,"segmentIntersection");function wn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(wn,"isHorizontalSeg");function Go(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],s=tn(o.points);for(let r=n+1;r<t.length;r++){const i=t[r],a=tn(i.points);for(const[c,f]of s.entries())for(const[g,p]of a.entries()){const M=Yo(f.a,f.b,p.a,p.b);if(!M)continue;const u=wn(f),h=wn(p);(u!==h?u:!1)?e.push({jumpEdgeId:o.id,otherEdgeId:i.id,segIndex:c,t:M.tA,point:M.point}):e.push({jumpEdgeId:i.id,otherEdgeId:o.id,segIndex:g,t:M.tB,point:M.point})}}}return e}d(Go,"findEdgeIntersections");function le(t){const e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}d(le,"fmt");function Oe(t){return`${le(t.x)},${le(t.y)}`}d(Oe,"pointToString");function $o(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}d($o,"getArcSweepFlag");var jr=.001;function zo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&Po[e.arrowTypeStart];if(o){const r=t[0],i=t[1],a=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&Po[e.arrowTypeEnd];if(s){const r=t.length,i=t[r-2],a=t[r-1],c=Math.atan2(a.y-i.y,a.x-i.x);n[r-1].x=a.x-s*Math.cos(c),n[r-1].y=a.y-s*Math.sin(c)}return n}d(zo,"applyMarkerOffsets");function Vo(t,e,n,o,s){const r=t.point.x,i=t.point.y,a={x:r-e*t.r,y:i-n*t.r},c={x:r+e*t.r,y:i+n*t.r},f=[`L${Oe(a)}`];return s==="arc"?f.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(c)}`):f.push(`M${Oe(c)}`),f}d(Vo,"emitJump");function An(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,a=n.y-e.y,c=Math.hypot(s,r),f=Math.hypot(i,a);if(c<je||f<je)return null;const g=s/c,p=r/c,M=i/f,u=a/f,h=g*M+p*u,l=Math.max(-1,Math.min(1,h)),x=Math.acos(l);if(x<je||Math.abs(Math.PI-x)<je)return null;const C=Math.min(o/Math.sin(x/2),c/2,f/2);return{startX:e.x-g*C,startY:e.y-p*C,endX:e.x+M*C,endY:e.y+u*C,ctrlX:e.x,ctrlY:e.y,cutLen:C}}d(An,"computeRoundedCorner");function jo(t,e,n){const o=t.points;if(o.length<2)return"";const s=zo(o,t),r=t.curve==="rounded",i=tn(s),a=new Map;for(const f of e){const g=i[f.segIndex];if(!g)continue;const p=Math.hypot(g.b.x-g.a.x,g.b.y-g.a.y),M=a.get(f.segIndex)??[];M.push({t:f.t,point:f.point,d:f.t*p,r:n.jumpRadius}),a.set(f.segIndex,M)}const c=[`M${Oe(s[0])}`];for(let f=0;f<i.length;f++){const g=i[f],p=Math.hypot(g.b.x-g.a.x,g.b.y-g.a.y),M=p===0?0:(g.b.x-g.a.x)/p,u=p===0?0:(g.b.y-g.a.y)/p,h=$o(g);let l=0;if(r&&f>0){const v=An(s[f-1],s[f],s[f+1]??s[f],Bo);v&&(l=v.cutLen)}let x=p,C=null;r&&f<i.length-1&&(C=An(s[f],s[f+1],s[f+2]??s[f+1],Bo),C&&(x=p-C.cutLen));const b=[...a.get(f)??[]].sort((v,L)=>v.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-l,x-v.d);for(let v=0;v<b.length-1;v++){const L=b[v+1].d-b[v].d;if(b[v].r+b[v+1].r>L){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r<jr||c.push(...Vo(v,M,u,h,n.jumpStyle));r&&C?(c.push(`L${le(C.startX)},${le(C.startY)}`),c.push(`Q${le(C.ctrlX)},${le(C.ctrlY)} ${le(C.endX)},${le(C.endY)}`)):c.push(`L${Oe(g.b)}`)}return c.join(" ")}d(jo,"rewriteEdgePath");function Uo(t){return/^[\d\s+,.LMelm-]*$/.test(t)}d(Uo,"isStraightPath");function Wo(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}d(Wo,"curveSupportsLineHops");function Ko(t){if(!t)return null;try{const e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const s of n)s&&typeof s.x=="number"&&typeof s.y=="number"&&o.push({x:s.x,y:s.y});return o.length>=2?o:null}catch{return null}}d(Ko,"decodeDataPoints");function qo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const f of e)s.set(f.id,f);const r=[],i=new Map;for(const f of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(f.id):f.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;i.set(f.id,p);const u=Ko(p.getAttribute("data-points"))??f.points;r.push({...f,points:u})}const a=Go(r);if(a.length===0)return;const c=new Map;for(const f of a){const g=c.get(f.jumpEdgeId)??[];g.push(f),c.set(f.jumpEdgeId,g)}for(const f of r){const g=c.get(f.id);if(!g||g.length===0)continue;const p=s.get(f.id),M=p==null?void 0:p.curve;if(M!==void 0&&!Wo(M))continue;const u=i.get(f.id);if(!u)continue;if(M===void 0){const v=u.getAttribute("d")??"";if(!Uo(v))continue}const h=u.getAttribute("style")??"",l=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=l?Number.parseFloat(l[1]):null,C=l?Number.parseFloat(l[2]):null,b=jo(f,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,I=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",I)}}}d(qo,"applyLineJumpsToSvg");async function Jo(t,e){var s,r;for(const i of t.nodes)i.isGroup?await Dr(e.clusters,i):Hr(i);const n=new Map;for(const i of t.nodes)i!=null&&i.id&&n.set(i.id,i);for(const i of t.edges){const a=i.start?n.get(i.start)??{}:{},c=i.end?n.get(i.end)??{}:{},f=Xr(e.edgePaths,{...i},{},t.type,a,c,t.diagramId);i.label&&await Yr(e.rootGroups,i),i.label&&Zo(i,f)}const o=(r=(s=t.config)==null?void 0:s.swimlane)==null?void 0:r.lineHops;if(o!==!1){const i=o==="gap"?"gap":"arc",a=t.edges.filter(c=>Array.isArray(c.points)&&c.points.length>=2).map(c=>({id:c.id,points:c.points,curve:c.curve,arrowTypeStart:c.arrowTypeStart,arrowTypeEnd:c.arrowTypeEnd}));qo(e.edgePaths,a,{enabled:!0,jumpRadius:6,jumpStyle:i})}}d(Jo,"adjustLayout");function Zo(t,e){const n=(e==null?void 0:e.updatedPath)??(e==null?void 0:e.originalPath),o=Gr(),{subGraphTitleTotalMargin:s}=$r({flowchart:o.flowchart??{}});if(t.label){const r=zr.get(t.id);let i=t.x,a=t.y;if(n){const c=_e.calcLabelPosition(n);Qe.debug("Moving label "+t.label+" from (",i,",",a,") to (",c.x,",",c.y,") abc88"),e&&(i=c.x,a=c.y)}r.attr("transform",`translate(${i}, ${a+s/2})`)}if(t!=null&&t.startLabelLeft){const r=Ve.get(t.id).startLeft;let i=t==null?void 0:t.x,a=t==null?void 0:t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}if(t.startLabelRight){const r=Ve.get(t.id).startRight;let i=t.x,a=t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}if(t.endLabelLeft){const r=Ve.get(t.id).endLeft;let i=t.x,a=t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}if(t.endLabelRight){const r=Ve.get(t.id).endRight;let i=t.x,a=t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}}d(Zo,"positionEdgeLabel");var vn="__swimlane_default__",Ur=21,ko=20;function Rn(t){return Math.max(t.padding??ko,ko)}d(Rn,"topLaneHorizontalPadding");function Qo(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,a=Math.min(r,n+s/2),c=Math.min(Ur,Math.max(0,a-i)),f=i+c;if(f<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:f}}d(Qo,"assignTopLaneTitleRect");function ts(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===vn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:vn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=vn}d(ts,"prepareLayoutForSwimlanes");function es(t){const e=new Map;for(const c of t.nodes??[])e.set(c.id,c);const n=[];for(const c of t.edges??[]){const f=typeof c.start=="string"?c.start:void 0,g=typeof c.end=="string"?c.end:void 0;!f||!g||c.labelNodeId||n.push({id:c.id,src:f,dst:g,ref:c})}const o=t.nodes??[],s=o.filter(c=>c.isGroup),r=o.filter(c=>!c.isGroup);return{nodes:[...[...s].reverse(),...r].map(c=>c.id),edges:n,layout:t,nodeById:e}}d(es,"toGraphView");function ns(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let c=0;for(const M of e.layers){let u=0;for(const h of M){const l=r.get(h);if(!l){u++;continue}l.layer=c,l.order=u;const x=n.x[h]??u*a,C=n.y[h]??c*i;l.x=x,l.y=C,u++}c++}const f=s.nodes??[],g=new Map,p=[];for(const M of f){if(!(M!=null&&M.isGroup))continue;M.parentId||p.push(M);const u=f.filter(b=>b.parentId===M.id);let h=1/0,l=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,I=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),l=Math.max(l,v+y/2),x=Math.min(x,L-I/2),C=Math.max(C,L+I/2))}if(h===1/0||x===1/0)M.x=M.x??0,M.y=M.y??0,M.width=M.width??0,M.height=M.height??0;else{const b=M.padding??20,v=M.parentId?b:2*Rn(M),L=b,y=Math.max(0,l-h)+v,I=Math.max(0,C-x)+L,E=(h+l)/2,A=(x+C)/2;M.x=E,M.y=A,M.width=y,M.height=I,g.set(M.id,{minX:h,maxX:l,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let M=1/0,u=-1/0,h=0;for(const l of p){const x=l.padding??20;x>h&&(h=x);const C=g.get(l.id);C&&(M=Math.min(M,C.minY),u=Math.max(u,C.maxY))}if(M!==1/0&&u!==-1/0){const l=Math.max(0,u-M),C=Math.max(h,36),b=l+2*C,v=(M+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=M;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],I=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*Rn(B),H=(O.minX+O.maxX)/2;y.push(B.id),I.push(H),E.push(k)}const A=y.length;if(A>0){const B=new Map;if(A===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j<A-1;j++)O.push(I[j+1]-I[j]);const k=new Array(A);k[0]=0;for(let j=0;j<A-1;j++)k[j+1]=2*O[j]-k[j];let H=0,P=Number.POSITIVE_INFINITY;for(let j=0;j<A;j++){const tt=E[j];j%2===0?H=Math.max(H,tt-k[j]):P=Math.min(P,k[j]-tt)}let G=H;H<=P?G=(H+P)/2:G=H;for(let j=0;j<A;j++){const tt=k[j]+(j%2===0?G:-G),ft=Math.max(E[j],tt);B.set(y[j],ft)}}for(const O of p){const k=B.get(O.id);k!=null&&(O.width=k),Qo(O)}}}}}d(ns,"writeBackToLayoutData");var Wr="[EdgeLabelNodes]";function os(t){const e=[],n=[],o=new Map;for(const i of t.nodes)o.set(i.id,i);for(const i of t.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;const a=i.start?o.get(i.start):void 0,c=i.end?o.get(i.end):void 0;if(!a||!c){Qe.warn(Wr,`Edge ${i.id} has missing source or target node`);continue}const f=`edge-label-${i.start}-${i.end}-${i.id}`,p=a.parentId!==c.parentId?c.parentId:a.parentId,M={id:f,label:i.label,edgeStart:i.start??"",edgeEnd:i.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:p,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??"",...a.dir?{dir:a.dir}:{}};e.push(M),i.labelNodeId=f,i.label=void 0,i.text=void 0;const u={id:`${i.id}-to-label`,start:i.start,end:f,type:"normal",isLayoutOnly:!0},h={id:`${i.id}-from-label`,start:f,end:i.end,type:"normal",isLayoutOnly:!0};n.push(u,h)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}d(os,"createEdgeLabelNodes");var Yt=.001;function co(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(co,"measuredNodeRect");function ao(t){if(t.isGroup)return;const e=co(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(ao,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}d(ce,"samePoint");function gt(t,e,n=Yt){return Math.abs(t.x-e.x)<n}d(gt,"sameX");function yt(t,e,n=Yt){return Math.abs(t.y-e.y)<n}d(yt,"sameY");function Nt(t,e,n=Yt){return yt(t,e,n)&&Math.abs(t.x-e.x)>n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(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)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&gt(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],i=Nt(s,r,e),a=Ot(s,r,e);(i||a)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:a})}return n}d(Be,"orthogonalSegmentsForPoints");function oe(t,e=Yt){const n=Be(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}d(oe,"countOrthogonalBends");function xt(t,e=Yt){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function lo(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(lo,"classifyThreeSegmentRoute");function dn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&a>n.top-o&&i<n.bottom+o}d(dn,"segmentBoundsOverlapRect");function fo(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}d(fo,"pointInsideRect");function ss(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ss,"rectContainsRect");function en(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}d(en,"rectsOverlap");function Nn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Nn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=co(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(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}}}d(Le,"portForRectSide");function uo(t,e,n,o,s,r=Yt){const i=e==="left"||e==="right",a=o==="left"||o==="right";if(i&&a){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!i&&!a){if(e===o){if(gt(t,n,r))return;const M=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:M},{x:n.x,y:M},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(i&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,p=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const c=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,f=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}d(uo,"buildOrthogonalPortPath");function ho(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(ho,"buildSameSideTrackPath");function un(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=ao(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(un,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=ao(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function rs(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,i,a)})}return n}d(rs,"collectLayoutNodeRects");function go(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)<n,collinearY:Math.abs(r.cy-i.cy)<n}}d(go,"getNodePairGeometry");function Pt(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&dn(t,e,r.rect,-s))return!0;return!1}d(Pt,"segmentHitsAnyRect");function mo(t,e,n,o,s=Yt,r=1e-6){const i=yt(t,e,s),a=gt(t,e,s),c=yt(n,o,s),f=gt(n,o,s);if(i&&c||a&&f||!(i||a)||!(c||f))return!1;const g=i?{a:t,b:e}:{a:n,b:o},p=a?{a:t,b:e}:{a:n,b:o},M=g.a.y,u=Math.min(g.a.x,g.b.x),h=Math.max(g.a.x,g.b.x),l=p.a.x,x=Math.min(p.a.y,p.b.y),C=Math.max(p.a.y,p.b.y);if(l<u||l>h||M<x||M>C)return!1;const b=Math.abs(l-g.a.x)<r&&Math.abs(M-g.a.y)<r||Math.abs(l-g.b.x)<r&&Math.abs(M-g.b.y)<r,v=Math.abs(l-p.a.x)<r&&Math.abs(M-p.a.y)<r||Math.abs(l-p.b.x)<r&&Math.abs(M-p.b.y)<r;return!(b&&v)}d(mo,"orthogonalSegmentsCross");function is(t,e,n,o,s=Yt){const r=yt(t,e,s),i=gt(t,e,s),a=yt(n,o,s),c=gt(n,o,s);return i&&c&&gt(t,n,s)?Wt(t.y,e.y,n.y,o.y)>s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(is,"sameAxisSegmentsOverlap");function nn(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const a=i.points;if(!(!a||a.length<2))for(let c=0;c<a.length-1;c++){const f=a[c],g=a[c+1];if(!(r&&ce(f,g,s))&&(mo(t,e,f,g,s)||is(t,e,f,g,s)))return!0}}return!1}d(nn,"segmentConflictsWithAnyEdge");function he(t,e,n,o,s=Yt){const r=yt(t,e,s),i=gt(t,e,s),a=yt(n,o,s),c=gt(n,o,s);if(!(r&&c||i&&a))return!1;const f=r?{a:t,b:e}:{a:n,b:o},g=r?{a:n,b:o}:{a:t,b:e},p=f.a.y,M=Math.min(f.a.x,f.b.x),u=Math.max(f.a.x,f.b.x),h=g.a.x,l=Math.min(g.a.y,g.b.y),x=Math.max(g.a.y,g.b.y);return h>M+s&&h<u-s&&p>l+s&&p<x-s}d(he,"orthogonalSegmentsStrictlyCross");function On(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+Yt&&t<s-Yt}d(On,"strictlyBetween");function cs(t,e,n){return gt(t,e)&&gt(e,n)?On(e.y,t.y,n.y):yt(t,e)&&yt(e,n)?On(e.x,t.x,n.x):!1}d(cs,"isCollinearIntermediate");function as(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],i=o+1<t.length?t[o+1]:void 0;if(s&&i){if(ce(s,i)){o++,e=!0;continue}if(cs(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}d(as,"simplifyPolylineOnce");function on(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!gt(s,r)&&!yt(s,r)){const i=e.length>=2?e[e.length-2]:void 0,c=(i?gt(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(c)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(on,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=as(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Kr=.5,_o=4;function yo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?te(s):void 0,dstRect:r?te(r):void 0}}d(yo,"endpointContextFor");function ls(t,e,n){if(yt(t,e,it))return{x:t.x<n.left?n.left:n.right,y:t.y};if(gt(t,e,it)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}d(ls,"segmentEnterPoint");function Pn(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&fo(t[s],e,Kr);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=ls(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}d(Pn,"clipEndpoint");function fs(t,e){for(const n of t){const o=yo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Pn(s,o.srcRect,!0)),o.dstRect&&(s=Pn(s,o.dstRect,!1)),s=ue(on(s)),s=po(s,o.srcRect,o.dstRect),o.edge.points=ue(on(s))}}d(fs,"clipEdgeEndpointsToNodeBoundaries");function Bn(t,e,n,o=!1){if(yt(t,e,it)){if(e.y<n.top-it||e.y>n.bottom+it)return e;if(o){if(t.x<n.left-it)return{x:n.left,y:t.y};if(t.x>n.right+it)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(gt(t,e,it)){if(e.x<n.left-it||e.x>n.right+it)return e;if(o){if(t.y<n.top-it)return{x:t.x,y:n.top};if(t.y>n.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(Bn,"snapEndpointToBoundary");function sn(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!ce(r,o,it))return r}return t[e+n]}d(sn,"firstDistinctAdjacent");function rn(t,e){const n=t+_o,o=e-_o;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}d(rn,"cornerClearanceRange");function kn(t,e,n){const{lo:o,hi:s}=rn(e,n);return Math.min(s,Math.max(o,t))}d(kn,"clampToCornerClearance");function ds(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(ds,"intersectRanges");function _n(t,e){return e==="left"||e==="right"?rn(t.top,t.bottom):rn(t.left,t.right)}d(_n,"clearanceRangeForSide");function cn(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)<it)return"left";if(Math.abs(t.x-n.right)<it)return"right"}if(gt(t,e,it)&&s){if(Math.abs(t.y-n.top)<it)return"top";if(Math.abs(t.y-n.bottom)<it)return"bottom"}}d(cn,"terminalSideForSegment");function Fe(t){return t==="left"||t==="right"}d(Fe,"isHorizontalSide");function us(t,e,n,o,s){const r=[],i=n?cn(t,e,n):void 0,a=o?cn(e,t,o):void 0;return n&&i&&Fe(i)===s&&r.push(_n(n,i)),o&&a&&Fe(a)===s&&r.push(_n(o,a)),r.length>0?ds(r):void 0}d(us,"straightClearanceRange");function Fn(t,e,n,o,s){const r=us(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(a-i)<it))return s?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}d(Fn,"clearStraightEndpointCornerAxis");function po(t,e,n){if(t.length!==2)return t;const[o,s]=t;return yt(o,s,it)?Fn(o,s,e,n,!0)??t:gt(o,s,it)?Fn(o,s,e,n,!1)??t:t}d(po,"clearStraightEndpointCornerConnections");function hs(t,e,n){return Fe(n)?{x:t.x,y:kn(t.y,e.top,e.bottom)}:{x:kn(t.x,e.left,e.right),y:t.y}}d(hs,"cornerClearedEndpoint");function gs(t,e,n,o,s,r){const i=t.map(a=>({...a}));for(let a=e;a>=0&&a<t.length;a+=n){const c=t[a];if(r&&!yt(c,o,it)||!r&&!gt(c,o,it))break;r?i[a].y=s.y:i[a].x=s.x}return i}d(gs,"moveCollinearEndpointRun");function Dn(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],i=sn(t,o,s);if(!i)return t;const a=cn(r,i,e);if(!a)return t;const c=Fe(a),f=hs(r,e,a);return ce(r,f,it)?t:gs(t,o,s,r,f,c)}d(Dn,"clearEndpointCornerConnection");function Hn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)<it&&Math.abs(e.y-n.top)<it&&o)return"top";if(Math.abs(t.y-n.bottom)<it&&Math.abs(e.y-n.bottom)<it&&o)return"bottom";if(Math.abs(t.x-n.left)<it&&Math.abs(e.x-n.left)<it&&s)return"left";if(Math.abs(t.x-n.right)<it&&Math.abs(e.x-n.right)<it&&s)return"right"}d(Hn,"borderSideForSegment");function Xn(t,e,n,o){switch(t){case"top":return gt(e,n,it)&&n.y<o.top-it;case"bottom":return gt(e,n,it)&&n.y>o.bottom+it;case"left":return yt(e,n,it)&&n.x<o.left-it;case"right":return yt(e,n,it)&&n.x>o.right+it}}d(Xn,"leavesOutward");function Yn(t,e,n){if(t.length<3)return t;if(n){const r=Hn(t[0],t[1],e);return r&&Xn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=Hn(t[o-1],t[o],e);return s&&Xn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Yn,"collapseOwnBorderStub");function ms(t,e,n){let o=t;if(e){const r=sn(o,0,1);if(r){const i=Bn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Yn(o,e,!0)}if(n){const r=o.length-1,i=sn(o,r,-1);if(i){const a=Bn(i,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Yn(o,n,!1)}const s=po(o,e,n);return s!==o||o.length===2?s:(e&&(o=Dn(o,e,!0)),n&&(o=Dn(o,n,!1)),o)}d(ms,"snapAndCollapseEndpoints");function Gn(t,e){for(const n of t){const o=yo(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ms(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}d(Gn,"prepareEdgeEndpointsForRenderer");function xo(t){return new Map(t.map(e=>[e.id,e]))}d(xo,"buildNodeMap");function ys(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(ys,"resolveTopLevelGroupId");function $n(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d($n,"groupDepth");function bo(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,a=r.y;if(typeof i!="number"||typeof a!="number")continue;const c=r.width??0,f=r.height??0;e=Math.min(e,i-c/2),n=Math.max(n,i+c/2),o=Math.min(o,a-f/2),s=Math.max(s,a+f/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(bo,"boundsForChildren");function ps(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}d(ps,"applyGroupBounds");function xs(t){const e=xo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>$n(s,e)-$n(o,e));for(const o of n){const s=t.filter(i=>i.parentId===o.id),r=bo(s);r&&ps(o,r)}}d(xs,"recomputeNestedGroupBounds");function an(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);let r=1/0,i=-1/0;for(const c of s){const f=c[e];typeof f=="number"&&(r=Math.min(r,f),i=Math.max(i,f))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const a=d(c=>r+i-c,"mirror");for(const c of n){const f=c[e];typeof f=="number"&&(c[e]=a(f));const g=c.groupTitleRect;g&&(c.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const c of o)for(const f of c.points??[])f[e]=a(f[e]);return!0}d(an,"mirrorAxis");function bs(t){return(t.nodes??[]).some(n=>!n.isGroup)?an(t,"y"):!0}d(bs,"applyBtDirectionTransform");function Ms(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,i=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G<r&&(r=G),j<i&&(i=j)}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const a=36;let c=0,f=0;for(const P of s)c+=P.width??0,f+=P.height??0;const g=c/s.length,p=f/s.length,M=p>0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-i)*M+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-i)*M+a,Mt=j-r;G.x=ft,G.y=Mt}xs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&an(t,"x"),!0;const h=xo(n),l=new Map;for(const P of n){if(P.isGroup)continue;const G=ys(P,h);if(!G)continue;const j=l.get(G)??[];j.push(P),l.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=l.get(P.id)??[],j=bo(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),I=L+2*y,E=a+I,O=(b+v)/2-I/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;P<C.length;P++){const G=C[P];let j,tt;if(P===0?j=G.contentTop-H:j=(C[P-1].contentBottom+G.contentTop)/2,P===C.length-1)tt=G.contentBottom+H;else{const Ht=C[P+1];tt=(G.contentBottom+Ht.contentTop)/2}const ft=Math.max(0,tt-j),Mt=(j+tt)/2;G.lane.x=k,G.lane.y=Mt,G.lane.width=E,G.lane.height=ft,G.lane.swimlaneContentTop=G.contentTop,G.lane.groupTitleRect={left:O,right:O+a,top:j,bottom:tt}}return e==="RL"&&an(t,"x"),!0}d(Ms,"applyLrDirectionTransform");var ae=1e-6,qr=8,We=qr,Jr=[0,We,-We,2*We,-2*We];function Is(t,e){const{nodeInfoById:n,realNodeRects:o}=un(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const i=lo(xt(r,ae),ae);if(!i)continue;const{p3:a}=i,c=i.kind==="HVH",f=go(s,n,ae);if(!f)continue;const{srcId:g,dstId:p,srcInfo:M,dstInfo:u,collinearX:h,collinearY:l}=f;if(h||l)continue;let x;const C=M.rect;for(const b of Jr){let v,L,y;if(c){const k=u.cy>M.cy?C.bottom:C.top,H=M.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>M.cx?C.right:C.left,H=M.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const I=ce(v,L,ae),E=ce(L,y,ae);if(I&&E||!I&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const A=!I&&nn(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&nn(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(A||B)){I?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(Is,"portSwapToLShape");function Ss(t,e){const{realNodeRects:r,labelNodeRects:i}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const c=a.points;if(!c||c.length<4)continue;const f=xt(c,.001);if(f.length<4)continue;const g=f.length-1,p=f[g],M=f[g-1],u=f[g-2],h=p.x-M.x,l=p.y-M.y,x=Math.hypot(h,l);if(x>=10||x<.001)continue;const C=M.x-u.x,b=M.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(M,p,.001),y=Ot(M,p,.001),I=Nt(u,M,.001),E=Ot(u,M,.001);if(!(L&&E||y&&I))continue;const A=a.end,B=a.start,O=A?e.get(A):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,A?[A]:[],-2)||Pt(G,j,i,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&fo(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J<f.length-1;J++)ft.add(tt(f[J],f[J+1]));const Mt=d((J,rt)=>{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St<pt.length-1;St++){const wt=pt[St],Kt=pt[St+1];if(!ft.has(tt(wt,Kt))&&he(J,rt,wt,Kt,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(Mt(G,j))continue;if(g-3>=0){const J=f[g-3],rt=[B,A].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const Ft=[...f.slice(0,g-2),G,j];a.points=Ft;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,wt=-1;for(let Kt=0;Kt<Ft.length-1;Kt++){const qt=Ft[Kt],Jt=Ft[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>wt&&(wt=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(Ss,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Ln=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function Cs(t,e){const s=d((u,h)=>{const l=u.x??0,x=u.y??0,C=h.x-l,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:l+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:l+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const l=xt(u.points??[]);if(l.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?l[0]:l[l.length-1],L=h?l[1]:l[l.length-2],y=s(C,v);let I=v;if(Ln(L,y)&&(I=L),gt(y,I,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,I.y),max:Math.max(y.y,I.y),boundary:y,railEnd:I,rect:b};if(yt(y,I,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,I.x),max:Math.max(y.x,I.x),boundary:y,railEnd:I,rect:b}},"terminalLaneFor"),i=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&gt(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),c=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:i(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),f=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const l=i(u,h);if(l<Xt)return!1;const x=u.rect.bottom-u.rect.top;return l<x||l>2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const l=xt(u.edge.points??[]);if(l.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const I=l.length>1&&ce(l[1],u.railEnd,et),E=l.slice(I?2:1),A=E[0];return A&&!Ln(A,C)?void 0:[x,C,...E]}const v=l.length>1&&ce(l[l.length-2],u.railEnd,et),L=l.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Ln(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,l=xt(h.points??[]);if(l.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,I=v.x??0,E=v.y??0,[A,B]=l;return yt(A,B,et)&&Math.abs(y-E)<1&&Math.abs(L-I)>1||gt(A,B,et)&&Math.abs(L-I)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),M=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let l=!1;for(let x=0;x<h.length&&!l;x++)for(let C=x+1;C<h.length&&!l;C++){const b=h[x],v=h[C];if(b.edge===v.edge||!(c(b,v)||f(b,v)))continue;const L=!c(b,v),y=[b,v].sort((I,E)=>{const A=p(I),B=p(E);return A!==B?Number(A)-Number(B):+!E.atStart-+!I.atStart});for(const I of y){for(const E of M){const A=g(I,E);if(!A)continue;const B=r({...I.edge,points:A},I.atStart);if(!(!B||h.some(O=>O.edge!==I.edge&&(c(B,O)||L&&f(B,O))))){I.edge.points=A,l=!0;break}}if(l)break}}if(!l)return}}d(Cs,"separateSharedRenderedTerminalLanes");function vs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,c)=>{const f=a.start,g=a.end,p=at(c);if(p.length!==c.length-1)return!1;const M=[f,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,M,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const l of p)for(const x of at(xt(h)))if(de(l,x,.5)>=Xt||he(l.a,l.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),i=d((a,c)=>{if(c+4>=a.length)return;const f=a[c],g=a[c+1],p=a[c+2],M=a[c+3],u=a[c+4],h=Nt(f,g)&&Ot(g,p)&&Nt(p,M)&&Ot(M,u)&&gt(f,M,et)&&gt(f,u,et)&&gt(g,p,et)&&(g.x-f.x)*(M.x-p.x)<0,l=Ot(f,g)&&Nt(g,p)&&Ot(p,M)&&Nt(M,u)&&yt(f,M,et)&&yt(f,u,et)&&yt(g,p,et)&&(g.y-f.y)*(M.y-p.y)<0;if(h||l)return xt([...a.slice(0,c+1),u,...a.slice(c+5)]);if(c+5>=a.length)return;const x=a[c+5],C=Ot(f,g)&&Nt(g,p)&&Ot(p,M)&&Nt(M,u)&&Ot(u,x)&&gt(f,u,et)&&gt(f,x,et)&&gt(p,M,et)&&(p.x-g.x)*(u.x-M.x)<0,b=Nt(f,g)&&Ot(g,p)&&Nt(p,M)&&Ot(M,u)&&Nt(u,x)&&yt(f,u,et)&&yt(f,x,et)&&yt(p,M,et)&&(p.y-g.y)*(u.y-M.y)<0;if(!(!C&&!b))return xt([...a.slice(0,c+1),x,...a.slice(c+6)])},"withoutDogleg");for(let a=0;a<8;a++){let c=!1;for(const f of t){if(f.isLayoutOnly)continue;const g=xt(f.points??[]);for(let p=0;p<=g.length-5;p++){const M=i(g,p);if(!(!M||!r(f,M))){f.points=M,c=!0;break}}if(c)break}if(!c)return}}d(vs,"collapseRedundantRectangularDoglegs");function zn(t,e){const{realNodeRects:r,labelNodeRects:i}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),c=d((h,l,x)=>xt(h===l?x??[]:h.points??[]),"pointsFor"),f=d((h,l)=>{let x=0;for(let C=0;C<a.length;C++){const b=at(c(a[C],h,l));for(let v=C+1;v<a.length;v++){const L=at(c(a[v],h,l));for(const y of b)for(const I of L)he(y.a,y.b,I.a,I.b,et)&&x++}}return x},"strictCrossingCount"),g=d(h=>{const l=at(h);if(l.length!==3)return;const x=l[1];if(!(l[0].horizontal===x.horizontal||l[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,l)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return l.horizontal?Wt(l.a.x,l.b.x,b.left,b.right)>=Xt&&l.a.y>=b.top-2&&l.a.y<=b.bottom+2:Wt(l.a.y,l.b.y,b.top,b.bottom)>=Xt&&l.a.x>=b.left-2&&l.a.x<=b.right+2})},"blockingRectsFor"),M=d((h,l,x)=>{const C=h.map(v=>({...v}));if(l.horizontal)C[l.index].y=x,C[l.index+1].y=x;else if(l.vertical)C[l.index].x=x,C[l.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,l,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(l);if(b.length!==l.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,i,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(c(v)))if(de(L,y,.5)>=Xt)return!1}return f(h,l)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const l=f();let x=!1;for(const C of a){const b=c(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(I=>I.rect.top))-20,Math.max(...L.map(I=>I.rect.bottom))+20]:[Math.min(...L.map(I=>I.rect.left))-20,Math.max(...L.map(I=>I.rect.right))+20];for(const I of y){const E=M(b,v.segment,I);if(!(!E||!u(C,E,l))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(zn,"liftObstacleHuggingSameSideRails");function Vn(t,e){const o=d(c=>{const f=c.groupTitleRect;if(!(!f||typeof f.left!="number"||typeof f.right!="number"||typeof f.top!="number"||typeof f.bottom!="number"||!Number.isFinite(f.left)||!Number.isFinite(f.right)||!Number.isFinite(f.top)||!Number.isFinite(f.bottom)||f.right<=f.left||f.bottom<=f.top))return{left:f.left,right:f.right,top:f.top,bottom:f.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId)return;const f=c.direction,g=typeof f=="string"?f.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(c),M=c.y,u=c.height;if(!p||typeof M!="number"||typeof u!="number"||!Number.isFinite(M)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,l=p.bottom-p.top;if(!(l<=0||h<l))return{node:c,rect:p}},"topLaneTitleFor"),r=d((c,f)=>{if(!c.horizontal)return!1;const g=c.a.y;return g<=f.top+et||g>=f.bottom-et?!1:Wt(c.a.x,c.b.x,f.left,f.right)>=Xt},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(c=>!!c);if(i.length===0)return;let a=0;for(const c of t){if(c.isLayoutOnly)continue;const f=xt(c.points??[]);for(const g of at(f))for(const p of i)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const c of i){const f=c.node.y,g=c.node.height;typeof f!="number"||typeof g!="number"||!Number.isFinite(f)||!Number.isFinite(g)||g<=0||(c.node.y=f-a/2,c.node.height=g+a,c.node.groupTitleRect={...c.rect,top:c.rect.top-a,bottom:c.rect.bottom-a})}}d(Vn,"liftTopLaneTitleBandsAboveRails");function jn(t,e){const o=d(f=>{const g=f.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(f=>{if(!f.isGroup||f.parentId||f.direction!=="LR")return;const p=o(f),M=f.x,u=f.width;if(!p||typeof M!="number"||typeof u!="number"||!Number.isFinite(M)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,l=p.bottom-p.top;if(!(h<=0||l<h))return{node:f,rect:p}},"leftLaneTitleFor"),r=d((f,g)=>{if(!f.vertical)return!1;const p=f.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(f.a.y,f.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),i=d((f,g)=>{if(!f.horizontal)return!1;const p=f.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(f.a.x,f.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(f=>!!f);if(a.length===0)return;let c=0;for(const f of t){if(f.isLayoutOnly)continue;const g=xt(f.points??[]);for(const p of at(g))for(const M of a)if(r(p,M.rect))c=Math.max(c,M.rect.right-p.a.x+4);else if(i(p,M.rect)){const u=Math.min(p.a.x,p.b.x);c=Math.max(c,M.rect.right-u+4)}}if(!(c<=et))for(const f of a){const g=f.node.x,p=f.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(f.node.x=g-c/2,f.node.width=p+c,f.node.groupTitleRect={...f.rect,left:f.rect.left-c,right:f.rect.right-c})}}d(jn,"shiftLeftLaneTitleBandsLeftOfRails");function Ls(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,l=new Map)=>xt(l.get(h)??h.points??[]),"replacementPointsFor"),i=d((h=new Map)=>{let l=0;for(let x=0;x<s.length;x++){const C=at(r(s[x],h));for(let b=x+1;b<s.length;b++){const v=at(r(s[b],h));for(const L of C)for(const y of v)he(L.a,L.b,y.a,y.b,et)&&l++}}return l},"crossingCount"),a=d((h=new Map)=>s.reduce((l,x)=>l+oe(r(x,h)),0),"totalBends"),c=d(h=>{const l=r(h);if(l.length<4)return;const x=l[l.length-2],C=l[l.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),f=d((h,l)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:l.tailStart.y};else if(Ot(C,b,et))v={x:l.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,l.tailStart,l.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,l)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(l))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,l,x)=>{for(const C of s)if(C!==h){for(const b of at(l))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),M=d((h,l,x)=>!g(h,l)&&!p(h,l,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const l of s){const x=l.end;if(!x||!e.has(x)||r(l).length<4)continue;const b=h.get(x)??[];b.push(l),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const l=i();if(l===0)return;const x=a();let C,b=l,v=x;for(const L of u().values())for(let y=0;y<L.length;y++)for(let I=y+1;I<L.length;I++){const E=L[y],A=L[I],B=c(E),O=c(A);if(!B||!O)continue;const k=f(E,O),H=f(A,B);if(!k||!H)continue;const P=new Map([[E,k],[A,H]]);if(!M(E,k,P)||!M(A,H,P))continue;const G=i(P),j=a(P);G>=l||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Ls,"swapDestinationTerminalTailsToReduceCrossings");function Es(t,e){const{realNodeRects:r,labelNodeRects:i}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),c=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),f=d((L=new Map)=>{let y=0;for(let I=0;I<a.length;I++){const E=at(c(a[I],L));for(let A=I+1;A<a.length;A++){const B=at(c(a[A],L));for(const O of E)for(const k of B)he(O.a,O.b,k.a,k.b,et)&&y++}}return y},"strictCrossingCount"),g=d((L=new Map)=>a.reduce((y,I)=>y+oe(c(I,L)),0),"totalBends"),p=d(L=>{const y=L.start,I=L.end,E=y?e.get(y):void 0,A=I?e.get(I):void 0,B=E?te(E):void 0,O=A?te(A):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),M=d((L,y,I)=>{if(I.index<=0||I.index+1>=y.length-1)return;const E=p(L);if(E){if(I.vertical){const A=I.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=A<B-et?"left":A>O+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:I.index,axis:"vertical",side:k,coord:A,min:Math.min(I.a.y,I.b.y),max:Math.max(I.a.y,I.b.y)}:void 0}if(I.horizontal){const A=I.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=A<B-et?"top":A>O+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:I.index,axis:"horizontal",side:k,coord:A,min:Math.min(I.a.x,I.b.x),max:Math.max(I.a.x,I.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const I=c(y);for(const E of at(I)){const A=M(y,I,E);A&&L.push(A)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),l=d(L=>{const y=[],I=new Set;for(const E of L){if(I.has(E))continue;const A=[E],B=[];for(I.add(E);A.length>0;){const O=A.pop();B.push(O);for(const k of L)!I.has(k)&&h(O,k)&&(I.add(k),A.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const I of L)y.some(E=>Math.abs(E-I.coord)<et)||y.push(I.coord);for(;y.length<L.length;){const I=Math.min(...y),E=Math.max(...y),A=L[0].side;y.push(A==="left"||A==="top"?I-12*(L.length-y.length):E+12*(L.length-y.length))}return y},"uniqueCoordsFor"),C=d(L=>{const y=L.map(A=>A.coord),I=x(L),E=[];if(L.length<=6){const A=new Array(I.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of I.entries())A[k]||(A[k]=!0,B.push(H),O(),B.pop(),A[k]=!1)},"visit");return O(),E}for(let A=0;A<y.length;A++)for(let B=A+1;B<y.length;B++){const O=[...y];[O[A],O[B]]=[O[B],O[A]],E.push(O)}return E},"coordinateAssignmentsFor"),b=d((L,y)=>{const I=new Map;for(const[A,B]of L.entries()){const O=y[A],k=I.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),I.set(B.edge,k)}const E=new Map;for(const[A,B]of I){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(A,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,I]of L){const E=[y.start,y.end].filter(A=>!!A);for(const A of at(I))if(Pt(A.a,A.b,r,E,-2)||Pt(A.a,A.b,i,[],-2))return!1}for(let y=0;y<a.length;y++){const I=a[y],E=L.has(I),A=at(c(I,L));for(let B=y+1;B<a.length;B++){const O=a[B];if(!E&&!L.has(O))continue;const k=at(c(O,L));for(const H of A)for(const P of k)if(de(H,P,.5)>=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=f();if(y===0)return;let I,E=y,A=g(),B=Number.POSITIVE_INFINITY;for(const O of l(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=f(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>A||G===A&&j>=B)||(I=H,E=P,A=G,B=j)}if(!I)return;for(const[O,k]of I)O.points=k}}d(Es,"reassignCrossingExternalRailChannels");function Ts(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=d((u,h,l)=>xt(u===h?l??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,l)=>{const x=l.a.x-l.b.x,C=l.a.y-l.b.y;return h+Math.hypot(x,C)},0),"pathLength"),c=d((u,h)=>{let l=0;for(let x=0;x<r.length;x++){const C=at(i(r[x],u,h));for(let b=x+1;b<r.length;b++){const v=at(i(r[b],u,h));for(const L of C)for(const y of v)he(L.a,L.b,y.a,y.b,et)&&l++}}return l},"strictCrossingCount"),f=d((u,h)=>{if(u.horizontal){const l=u.a.y;return(Math.abs(l-h.top)<1||Math.abs(l-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const l=u.a.x;return(Math.abs(l-h.left)<1||Math.abs(l-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),l=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&l.push(b)}return l},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const l=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(l,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(l,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-l.x)!==Math.sign(b.x-C.x):Math.sign(x.y-l.y)!==Math.sign(b.y-C.y)))return[];const I=gt(l,b,et)||yt(l,b,et)?[]:[{x:l.x,y:b.y},{x:b.x,y:l.y}],E=I.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:I.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),A=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return A.has(O)?!1:(A.add(O),!0)})},"shortcutCandidatesAt"),M=d((u,h,l)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>f(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(i(b)))if(de(v,L,.5)>=Xt)return!1}return c(u,h)<=l},"candidateIsSafe");for(let u=0;u<8;u++){const h=c();let l,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=i(L),I=oe(y,et),E=a(y);for(let A=0;A<=y.length-4;A++)for(const B of p(y,A)){const O=oe(B,et),k=a(B);if(!(O<I||O===I&&k<E-et)||!M(L,B,h))continue;const P=c(L,B);P>C||P===C&&(O>b||O===b&&k>=v)||(l=L,x=B,C=P,b=O,v=k)}}if(!l||!x)return;l.points=x}}d(Ts,"shortcutRedundantOrthogonalJogs");function ws(t,e){const i=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const _=R.x??0,F=R.y??0,V=te(R);V&&i.push({id:String(R.id??""),cx:_,cy:F,rect:V})}if(i.length===0)return;const a=new Map(i.map(R=>[R.id,R])),c=i.map(R=>({id:R.id,rect:R.rect})),f=["top","bottom","left","right"],g={top:Math.min(...i.map(R=>R.rect.top))-20,bottom:Math.max(...i.map(R=>R.rect.bottom))+20,left:Math.min(...i.map(R=>R.rect.left))-20,right:Math.max(...i.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),M=new Map(p.map((R,_)=>[R,_])),u=d(R=>{const _=R==="left"||R==="top"?-1:1,F=[];for(let V=0;V<=2;V++)F.push(g[R]+_*20*V);return F},"outwardTracksForSide"),h=d((R,_=new Map)=>xt(_.get(R)??R.points??[]),"replacementPointsFor"),l=d((R,_)=>{let F=0;for(const V of R)for(const K of _)he(V.a,V.b,K.a,K.b,et)&&F++;return F},"crossingCountBetweenSegments"),x=d((R,_)=>l(at(R),at(_)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let _=0;const F=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y<p.length;Y++){const q=p[Y],m=h(q,R);for(let S=Y+1;S<p.length;S++){const w=p[S],T=x(m,h(w,R));T>0&&(_+=T,F.push({first:q,second:w,count:T}),Z(q),Z(w))}}return K.sort((Y,q)=>(M.get(Y)??0)-(M.get(q)??0)),{count:_,pairs:F,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,_)=>{const F=new Set(_.keys());if(F.size===0)return R.count;let V=0;for(const Z of R.pairs)(F.has(Z.first)||F.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z<p.length;Z++){const Y=p[Z],q=F.has(Y),m=h(Y,_);for(let S=Z+1;S<p.length;S++){const w=p[S];!q&&!F.has(w)||(K+=x(m,h(w,_)))}}return R.count-V+K},"crossingCountWithReplacements"),v=d(R=>{const _=new Map;for(const K of R.pairs){const Z=_.get(K.first)??new Set;Z.add(K.second),_.set(K.first,Z);const Y=_.get(K.second)??new Set;Y.add(K.first),_.set(K.second,Y)}const F=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of _.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(M.get(q)??0)-(M.get(m)??0)),Y.length>1&&F.push(Y)}return F},"crossingComponents"),L=d(R=>[R.start,R.end].filter(_=>!!_),"endpointIdsFor"),y=d(R=>{const _=[];for(const F of v(R)){const V=new Set(F),K=new Set(F.flatMap(Y=>L(Y))),Z=[...F];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(M.get(Y)??0)-(M.get(q)??0)),_.push(Z)}return _},"pairSearchGroups"),I=d((R,_,F)=>b(R,new Map([[_,F]])),"crossingCountWithSingleReplacement"),E=d(R=>{const _=new Map;for(const F of R.pairs)_.set(F.first,(_.get(F.first)??0)+F.count),_.set(F.second,(_.get(F.second)??0)+F.count);return _},"currentCrossingsByEdge"),A=d(R=>R.slice(1).reduce((_,F,V)=>{const K=R[V];return _+Math.abs(F.x-K.x)+Math.abs(F.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((_,F)=>_+oe(h(F,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((_,F)=>_+A(h(F,R)),0),"totalLength"),k=d((R,_,F=new Map)=>{const V=at(_);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,F)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,_)=>{const F=[R.start,R.end].filter(V=>!!V);for(const V of at(_))if(Pt(V.a,V.b,c,F,-2))return!0;return!1},"pathHitsNode"),P=d((R,_)=>{const F=ue(xt(_));at(F).length===F.length-1&&R.push(F)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,_,F)=>{switch(_){case"left":return Math.min(R.x,F.x)-20;case"right":return Math.max(R.x,F.x)+20;case"top":return Math.min(R.y,F.y)-20;case"bottom":return Math.max(R.y,F.y)+20}},"localTrackForSameSide"),tt=d((R,_,F,V)=>{const K=F==="left"||F==="top"?-1:1,Z=[j(_,F,V),g[F]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,ho(_,F,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,_,F,V,K)=>{for(const Z of u(F))for(const Y of u(K))P(R,[_,{x:Z,y:_.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,_,F,V,K)=>{for(const Z of u(F))for(const Y of u(K))P(R,[_,{x:_.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,_,F,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(F))for(const q of u(K))for(const m of Z)P(R,[_,{x:Y,y:_.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),Ft=d((R,_,F,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(F))for(const q of u(K))for(const m of Z)P(R,[_,{x:_.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const _=new Set;return R.map(F=>xt(F)).filter(F=>{const V=F.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return _.has(V)||F.length<2?!1:(_.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,_,F,V)=>{const K=[],Z=uo(R,_,F,V,20,et);Z&&P(K,Z),_===V&&tt(K,R,_,F);const Y=G(_),q=G(V);return Y&&!q?ft(K,R,_,F,V):!Y&&q?Mt(K,R,_,F,V):Y?Ht(K,R,_,F,V):Ft(K,R,_,F,V),nt(K)},"buildCandidatesForSides"),rt=d((R,_,F,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of f){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[_,F,{x:S,y:F.y},{x:S,y:q.y},q]);for(const w of m)P(R,[_,F,{x:S,y:F.y},{x:S,y:w},{x:q.x,y:w},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,_,F,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of f){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[_,F,{x:F.x,y:S},{x:q.x,y:S},q]);for(const w of m)P(R,[_,F,{x:F.x,y:S},{x:w,y:S},{x:w,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const _=R.start,F=R.end,V=F?a.get(F):void 0;if(!_||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const _=R.start,F=R.end,V=_?a.get(_):void 0,K=F?a.get(F):void 0;if(!V||!K)return[];const Z=[];for(const Y of f){const q=Le(V,Y);for(const m of f)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),wt=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,_,F)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=F.get(K)??at(h(K));_.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,_,F,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=l(q,F.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:_.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:A(Y)}}).filter(({crossings:Y})=>Y<=_.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,F),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,_,F,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===_||m.second===_||m.first===V||m.second===V)&&(Y+=m.count);let q=l(F.segments,K.segments);for(const m of p){if(m===_||m===V)continue;const S=Z.get(m)??at(h(m));q+=l(F.segments,S)+l(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,_)=>{for(const F of R.sharedTrackConflicts)if(F!==_)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,_)=>R.segments.some(F=>_.segments.some(V=>de(F,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,_,F,V)=>se(_,F.edge)&&se(V,R.edge)&&!Ee(_,V),"pairCandidatesAreCompatible"),Te=d((R,_,F,V,K)=>{const Z=Jt(R.current,_.edge,F,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[_.edge,F.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(_.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+F.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(_.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+F.length+K.length}},"scorePairReplacement"),mn=d((R,_)=>R.crossings<_.crossings||R.crossings===_.crossings&&(R.bends<_.bends||R.bends===_.bends&&R.length<_.length),"pairScoreIsBetter"),yn=d((R,_,F,V)=>{let K=V;for(const Z of _.candidates)for(const Y of F.candidates){if(!me(_,Z,F,Y))continue;const q=Te(R,_,Z,F,Y);q&&mn(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),pn=d(R=>{const _=B(),F=O(),V=wt(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,A(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:_,length:F};const w={current:R,currentBends:_,currentLength:F,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W<D.length;W++){const ot=D[W];for(let U=W+1;U<D.length;U++){const z=D[U];!N.has(ot.edge)&&!N.has(z.edge)||(S=yn(w,ot,z,S))}}}return S.replacements.size>0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const _=C(),F=_.count;if(F===0)return;let V,K,Z=F,Y=Number.POSITIVE_INFINITY;for(const m of _.edges){const S=oe(h(m),et);for(const w of St(m)){const T=H(m,w),N=!T&&k(m,w),D=I(_,m,w),W=oe(w,et);T||N||!(D<F||D===F&&W<S)||D>Z||D===Z&&W>=Y||(V=m,K=w,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=pn(_);if(!q)return;for(const[m,S]of q)m.points=S}}d(ws,"resolveRenderedOrthogonalCrossings");var be=.001,Zr=8;function As(t,e){const{nodeInfoById:n,realNodeRects:o}=un(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(l=>l.rect.top))-r,bottom:Math.max(...o.map(l=>l.rect.bottom))+r,left:Math.min(...o.map(l=>l.rect.left))-r,right:Math.max(...o.map(l=>l.rect.right))+r},a=d((l,x,C,b)=>{const v=[],L=uo(l,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(ho(l,x,C,i[x])),v},"buildOrthogonalPathCandidates"),c=d((l,x)=>{for(let C=0;C<l.length-1;C++){const b=l[C],v=l[C+1];if(Pt(b,v,o,x,1))return!0}return!1},"pathHitsNode"),f=d((l,x,C=!1)=>{let b=0;const v=Be(l,be),L=x.start,y=x.end;for(const I of t){if(I===x||I.isLayoutOnly)continue;const E=I.start,A=I.end;if(!C&&L&&y&&(E===L||E===y||A===L||A===y))continue;const B=I.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(mo(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Zr&&b++}}return b},"pathConflictCount"),g=4,p=d((l,x)=>{const C=Math.abs(l.y-x.rect.top),b=Math.abs(l.y-x.rect.bottom),v=Math.abs(l.x-x.rect.left),L=Math.abs(l.x-x.rect.right);let y="top",I=C;return b<I&&(y="bottom",I=b),v<I&&(y="left",I=v),L<I&&(y="right",I=L),y},"nearestSideOfRect"),M=new Map,u=d((l,x,C)=>{const b=M.get(l)??[];b.push({side:x,edgeId:C}),M.set(l,b)},"addFaceClaim");for(const l of t){if(l.isLayoutOnly)continue;const x=l.points??[];if(x.length<1)continue;const C=l.id??"",b=l.start,v=l.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((l,x,C)=>{var b;return((b=M.get(l))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const l of t){if(l.isLayoutOnly)continue;const x=l.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C<g)continue;const b=l.start,v=l.end;if(!b||!v)continue;const L=n.get(b),y=n.get(v);if(!L||!y)continue;const I=l.id??"",E=f(x,l,!0),A=f(x,l);let B,O=E,k=C;for(const H of s){if(h(b,H,I))continue;const P=Le(L,H);for(const G of s){if(h(v,G,I))continue;const j=Le(y,G);for(const tt of a(P,H,j,G)){if(c(tt,[b,v]))continue;const ft=oe(tt,be);if(E>0){const Mt=f(tt,l,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}f(tt,l)>A||ft<k&&(k=ft,B=tt)}}}if(B){l.points=B;const H=M.get(b);H&&M.set(b,H.filter(G=>G.edgeId!==I));const P=M.get(v);P&&M.set(v,P.filter(G=>G.edgeId!==I)),u(b,p(B[0],L),I),u(v,p(B[B.length-1],y),I)}}}d(As,"simplifyDetouredEdges");var Qt=.001,Fo=10,Ke=7;function Un(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,a=r.y-s.y;if(!(Math.abs(i)+Math.abs(a)<Qt)){if(Math.abs(a)<=Qt){const f=s.x+Math.sign(i)*Fo;return{left:Math.min(s.x,f),right:Math.max(s.x,f),top:s.y-Ke,bottom:s.y+Ke}}if(Math.abs(i)<=Qt){const f=s.y+Math.sign(a)*Fo;return{left:s.x-Ke,right:s.x+Ke,top:Math.min(s.y,f),bottom:Math.max(s.y,f)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}d(Un,"markerClearanceRectFor");function Rs(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)}}d(Rs,"normalizeRect");function Wn(t,e){const n=xt(e),o=Un(n,!0),s=Un(n,!1);return[o,s].some(r=>r&&en(t,Rs(r)))}d(Wn,"labelOverlapsOwnMarker");function Je(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const l=h.points;if(!(!l||l.length<2))for(let x=0;x<l.length-1;x++)n.push({edgeId:h.id,p1:l[x],p2:l[x+1]})}const o=[],s=[];for(const h of e.values()){const l=h.isGroup,x=h.parentId;if(l&&!x){const b=te(h);b&&s.push({id:h.id,rect:b});continue}if(l||h.isEdgeLabel)continue;const C=te(h);C&&o.push({nodeId:h.id,rect:C})}const r=3,i=1,a=12,c=d((h,l)=>{const x=Nn(l,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&en(x,b))return!0;return!1},"labelOverlapsForeignNode"),f=d((h,l)=>{const x=Nn(l,r);for(const C of n)if(C.edgeId!==h&&dn(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,l,x)=>c(h,x)||f(l,x),"labelOverlapsAnything"),p=[],M=d(h=>{for(const{id:l,rect:x}of s)if(ss(x,h))return l},"findContainingLane"),u=d((h,l)=>p.some(x=>x.labelId!==h&&en(l,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const l=h.labelNodeId;if(!l)continue;const x=e.get(l);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt<C.length-1;nt++){const J=C[nt],rt=C[nt+1],ut=Math.abs(J.x-rt.x),pt=Math.abs(J.y-rt.y);ut<Qt&&pt<Qt||ut>=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx<L.length-1):L,I=y.length>0?y:L,E=b>=v?"horizontal":"vertical",A=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,wt=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==wt?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=M(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+i,St=ut.rect.right-b/2-i,wt=ut.rect.top+v/2+i,Kt=ut.rect.bottom-v/2-i;if(pt>St||wt>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,wt,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt<ut)return!1}if(nt===O){const pt=C[nt.idx+1];if(tt(nt,J,pt)+Qt<ut)return!1}return!0},"labelClearsTerminalEndpoints"),Mt=d(nt=>{const J=A(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!Wn(St.rect,C)&&!u(l,St.rect)&&!g(l,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=A(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const wt=j(St);if(wt&&!Wn(wt.rect,C)&&!u(l,wt.rect)&&!c(l,wt.rect)&&(rt||!f(h.id,wt.rect)))return{laneId:wt.laneId,anchor:wt.anchor}}},"findLaneContainingFallback"),Ft=Mt(I)??(I.length<L.length?Mt(L):void 0)??Ht(L,!0)??Ht(L,!1)??Ht(L,!1,!0);if(Ft){x.x=Ft.anchor.midX,x.y=Ft.anchor.midY,x.parentId=Ft.laneId;const nt=Pe(Ft.anchor.midX,Ft.anchor.midY,b,v),J=p.findIndex(rt=>rt.labelId===l);J>=0?p[J]={labelId:l,rect:nt}:p.push({labelId:l,rect:nt})}}}d(Je,"anchorLabelsToPolyline");var En=1e-6,Qr=8,Do=Qr/2,ti=3;function Kn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}d(Kn,"pairKey");function Ns(t,e){const{nodeInfoById:n,realNodeRects:o}=un(e),s=new Map;for(const i of e){const a=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(a,{w:i.width??0,h:i.height??0});continue}}const r=d((i,a,c,f)=>{const g=Kn(a,c);let p=0;const M=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const l=f==="x"?h.w/2:h.h/2;l>p&&(p=l)},"consider");M(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const h=u.start,l=u.end;!h||!l||Kn(h,l)===g&&M(u.labelNodeId)}return p>0?p+ti:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const a=i.points;if(!lo(a,En))continue;const c=go(i,n,En);if(!c)continue;const{srcId:f,dstId:g,srcInfo:p,dstInfo:M,collinearX:u,collinearY:h}=c;if(u===h)continue;let l,x;if(u){const y=M.cy>p.cy;l={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:M.cx,y:y?M.rect.top:M.rect.bottom}}else{const y=M.cx>p.cx;l={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?M.rect.left:M.rect.right,y:M.cy}}if(Pt(l,x,o,[f,g],1))continue;const b=r(i,f,g,u?"x":"y"),v=b>Do?b:Do,L=[0,v,-v];for(const y of L){const I={...l},E={...x};if(u){if(I.x+=y,E.x+=y,I.x<=p.rect.left||I.x>=p.rect.right||E.x<=M.rect.left||E.x>=M.rect.right)continue}else if(I.y+=y,E.y+=y,I.y<=p.rect.top||I.y>=p.rect.bottom||E.y<=M.rect.top||E.y>=M.rect.bottom)continue;if(!Pt(I,E,o,[f,g],1)&&!nn(I,E,t,i,{epsilon:En})){i.points=[I,E];break}}}}d(Ns,"straightenCollinearSiblingDetours");function qn(t,e){const{realNodeRects:c,labelNodeRects:f}=Me(e.values()),g=d((y,I)=>Be(I,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=I.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const I of t){if(I.isLayoutOnly)continue;const E=I.points;!E||E.length<2||y.push(...g(I,xt(E)))}return y},"allSegments"),M=d((y,I)=>y.horizontal&&I.horizontal?Wt(y.a.x,y.b.x,I.a.x,I.b.x)>=8&&Math.abs(y.a.y-I.a.y)<7:y.vertical&&I.vertical?Wt(y.a.y,y.b.y,I.a.y,I.b.y)>=8&&Math.abs(y.a.x-I.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,I)=>{const E=y.start,A=y.end,B=g(y,I);if(B.length!==I.length-1)return!1;const O=[E,A].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,c,O,-2)||Pt(H.a,H.b,f,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(M(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,I)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const A=E.map(B=>({...B}));if(y.horizontal)A[y.index].y+=I,A[y.index+1].y+=I;else if(y.vertical)A[y.index].x+=I,A[y.index+1].x+=I;else return;return g(y.edge,A).length===A.length-1?A:void 0},"shiftedCandidate"),l=d((y,I)=>({x:y.x??(I.left+I.right)/2,y:y.y??(I.top+I.bottom)/2}),"nodeCenter"),x=d(y=>{const I=y.edge,E=xt(I.points??[]);if(E.length!==4||y.index!==1)return;const A=I.start?e.get(I.start):void 0,B=I.end?e.get(I.end):void 0,O=A?te(A):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!A||!B||!O||!k||H.length===0))return{sourceCenter:l(A,O),targetCenter:l(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,I,E,A,B,O)=>{const k=A.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+I;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,I,E,A,B,O)=>{const k=A.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+I;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,I)=>{const E=x(y);if(E){if(y.vertical)return C(y,I,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,I,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const I=p();let E=!1;for(let A=0;A<I.length&&!E;A++)for(let B=A+1;B<I.length&&!E;B++){const O=I[A],k=I[B];if(O.edge===k.edge||!M(O,k))continue;const H=[O,k].filter(P=>P.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(qn,"nudgeSharedInteriorSubpaths");function Os(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=s*a-r*i;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,g=n.y-t.y,p=(f*a-g*i)/c,M=(f*r-g*s)/c,u=.01;return p>u&&p<1-u&&M>u&&M<1-u}d(Os,"segmentsIntersect");function Ps(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=rs(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const c=a.points;if(!c||c.length<2)continue;const f=a.start,g=a.end,p=a.labelNodeId,M=a.id??`${f}->${g}`;for(const u of s)if(!(u.nodeId===f||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h<c.length-1;h++)if(dn(c[h],c[h+1],u,-1)){o.push({type:"edge-node-overlap",edgeId:M,targetId:u.nodeId,detail:`segment ${h} passes through node "${u.nodeId}"`});break}}for(let u=0;u<c.length-1;u++)r.push({edgeId:M,start:f,end:g,p1:c[u],p2:c[u+1]})}const i=new Set;for(let a=0;a<r.length;a++)for(let c=a+1;c<r.length;c++){const f=r[a],g=r[c];if(f.edgeId!==g.edgeId&&!(f.start===g.start||f.start===g.end||f.end===g.start||f.end===g.end)&&Os(f.p1,f.p2,g.p1,g.p2)){const p=f.edgeId<g.edgeId?`${f.edgeId}|${g.edgeId}`:`${g.edgeId}|${f.edgeId}`;i.has(p)||(i.add(p),o.push({type:"edge-edge-crossing",edgeId:f.edgeId,targetId:g.edgeId,detail:`edges "${f.edgeId}" and "${g.edgeId}" cross`}))}}if(o.length>0){const a=o.filter(f=>f.type==="edge-node-overlap").length,c=o.filter(f=>f.type==="edge-edge-crossing").length;Qe.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${c} edge crossing(s)`);for(const f of o)Qe.warn(`[SWIMLANE_VALIDATE] ${f.type}: ${f.detail}`)}return o}d(Ps,"validateSwimlanesLayout");function Bs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!Ms(t,e)||e==="BT"&&s.length>0&&!bs(t))return;for(const a of o){if(a.isLayoutOnly)continue;const c=a.points;!c||c.length<2||(a.points=ue(on(c)))}As(o,n),Ns(o,n),Is(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Je(o,r),fs(o,r),Ss(o,r),qn(o,r),Cs(o,r),vs(o,r),zn(o,r),Ls(o,r);const i=d(()=>{ws(o,r),Es(o,r),Ts(o,r),Je(o,r),Gn(o,r),zn(o,r),Je(o,r),Gn(o,r)},"finalizeRenderedEdges");i(),qn(o,r),i(),Vn(o,r),jn(o,r),Vn(o,r),jn(o,r)}d(Bs,"postProcessSwimlaneLayout");function Ie(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 i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function Mo(t,e){return t.edges.filter(n=>n.dst===e)}d(Mo,"incoming");function ks(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}d(ks,"buildSuccessorMap");function Io(t){const e=ks(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(Io,"buildSortedSuccessorMap");function So(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}d(So,"buildInDegreeMap");function Co(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Co,"sortedZeroInDegreeNodes");function hn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(hn,"buildPredecessorSuccessorMaps");function vo(t,e,n,o){var i,a;let s=0;for(const c of t.nodes)o!=null&&o.skipGroups&&((i=t.nodeById.get(c))!=null&&i.isGroup)||(s=Math.max(s,n[c]??0));const r=Array.from({length:s+1},()=>[]);for(const c of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(c))!=null&&a.isGroup)||r[Math.max(0,n[c]??0)].push(c);return r}d(vo,"buildLayersFromRanks");function De(t){const e=So(t),n=Co(e),o=[],s=Io(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let a=0;for(;a<n.length&&n[a]<i;)a++;n.splice(a,0,i)}}return o.length===t.nodes.length?o:null}d(De,"topoSortIfAcyclic");function ke(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}d(ke,"buildLayerIndex");function Lo(t){const e=new Array(t.length),n=d((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),a=o,c=r,f=o;for(;a<r||c<s;)c>=s||a<r&&t[a]<=t[c]?e[f++]=t[a++]:(e[f++]=t[c++],i+=r-a);for(let g=o;g<s;g++)t[g]=e[g];return i},"count");return n(0,t.length)}d(Lo,"countInversions");function _s(t){const e=Ie(t),n=new Map;for(const g of e.nodes)n.set(g,[]);for(const g of e.edges)n.get(g.src).push(g);for(const g of n.values())g.sort((p,M)=>p.dst===M.dst?p.id.localeCompare(M.id):p.dst.localeCompare(M.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const M=p.dst;o[M]===0?r(M):o[M]===1&&s.push(p)}o[g]=2},"dfs"),i=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of i)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),c=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:c,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(_s,"removeCycles_DFS");function Fs(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Fs,"buildTopLaneMap");function ge(t){const e=Fs(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function gn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(gn,"buildTopLaneOrder");function Eo(t,e){const n=gn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}d(Eo,"resolveTopLaneOrder");var ei={EPSILON:1e-6},ln={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Ho={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Ds(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=hn(n);for(const y of r.values())y.sort((I,E)=>I.localeCompare(E));const i=De(n)??[...n.nodes].sort((y,I)=>y.localeCompare(I)),a=new Map;for(const[y,I]of i.entries())a.set(I,y);const c=new Map,f=new Map;for(const y of n.nodes)f.set(y,[]);for(const y of i){const I=(r.get(y)??[]).filter(E=>c.has(E));if(I.length>0){const E=Hs(y,I,{laneOf:o,rankHint:s,topoIndex:a});c.set(y,E),f.get(E).push(y)}else c.has(y)||c.set(y,null)}for(const y of n.nodes)c.has(y)||c.set(y,null);const g=new Set;for(const y of n.nodes)(c.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,I)=>{const E=a.get(y)??0,A=a.get(I)??0;return E===A?y.localeCompare(I):E-A}),M=Xs(n),u=new Map;for(const[y,I]of M.entries())u.set(y,[...I].sort((E,A)=>E.localeCompare(A)));const h=Ys(u),l=Gs(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of l)for(const I of y.nodes){const E=x.get(I);E?E.push(y.id):x.set(I,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const I of f.get(y)??[])L(I);b.push(y)}},"walk");for(const y of p)L(y);for(const y of i)L(y);return{parent:c,children:f,roots:p,componentOf:h,blocks:l,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:i}}d(Ds,"buildDrivingTree");function Hs(t,e,n){const o=n.laneOf(t);return[...e].sort((r,i)=>{var l,x;const a=n.laneOf(r),c=n.laneOf(i),f=a!=null&&a===o,g=c!=null&&c===o;if(f!==g)return f?-1:1;const p=(l=n.rankHint)==null?void 0:l[r],M=(x=n.rankHint)==null?void 0:x[i];if(p!=null&&M!=null&&p!==M)return M-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(i)??0;return u!==h?u-h:r.localeCompare(i)})[0]}d(Hs,"chooseParent");function Xs(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}d(Xs,"buildAdjacency");function Ys(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}d(Ys,"assignComponents");function Gs(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=d((a,c)=>{e.set(a,++r),n.set(a,r);for(const f of t.get(a)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(a)??0)&&(o.push([a,f]),n.set(a,Math.min(n.get(a)??r,e.get(f)??r))):(o.push([a,f]),i(f,a),n.set(a,Math.min(n.get(a)??r,n.get(f)??r)),(n.get(f)??0)>=(e.get(a)??0)&&s.push($s(a,f,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||i(a,null);return s}d(Gs,"computeBlocks");function $s(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d($s,"popBlock");function zs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,i=new Array(r).fill(-1),a=new Array(r).fill(0),c=[],f=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(i[L]=-1,a[L]=0,f.has(b)||(f.add(b),c.push(b)))}for(;c.length>0;){const b=c.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(f.has(y))continue;const I=s.get(y);I!=null&&(i[I]=v,a[I]=a[v]+1,f.add(y),c.push(y))}}for(const b of o){if(f.has(b))continue;const v=s.get(b);v!=null&&(i[v]=-1,a[v]=0,f.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b<r;b++)p[0][b]=i[b];for(let b=1;b<g;b++)for(let v=0;v<r;v++){const L=p[b-1][v];p[b][v]=L===-1?-1:p[b-1][L]}const M=d((b,v)=>{if(b===-1||v===-1)return-1;a[b]<a[v]&&([b,v]=[v,b]);const L=a[b]-a[v];for(let y=0;y<g;y++)if(L>>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const I=p[y][b],E=p[y][v];I===-1||E===-1||I!==E&&(b=I,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],I=e[L];if(y==null||I==null||(y>I&&([v,L]=[L,v],[y,I]=[I,y]),y==null||I==null||y===I))continue;const E=s.get(v),A=s.get(L);if(E==null||A==null)continue;const B=M(E,A);if(B===-1)continue;const O=u[B];for(let k=y;k<I;k++)O.set(k,(O.get(k)??0)+1)}const h=new Map,l=d((b,v)=>{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,I=n.children.get(b)??[];for(const E of I){const A=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=A.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}l(y,A)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(zs,"computeSubtreeCrossCounts");function Vs(t,e,n){const o=new Map,s=d(r=>{let i=n[r]??0;const a=[...e.get(r)??[]];a.sort(To(n));for(const c of a){s(c);const f=o.get(c);f!=null&&(i=Math.min(i,f))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}d(Vs,"annotateMinimumLayers");function To(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(To,"compareByRankThenId");function js(t,e,n,o){let s=0;for(const c of e){const f=n[c]??0;f>s&&(s=f)}const r=Array.from({length:s+1},()=>[]),i=new Set,a=d(c=>{if(i.has(c))return;i.add(c);const f=n[c]??0;r[f]||(r[f]=[]),r[f].push(c);for(const g of o(c))a(g)},"emit");for(const c of t)a(c);for(const c of e)if(!i.has(c)){const f=n[c]??0;r[f]||(r[f]=[]),r[f].push(c),i.add(c)}return r}d(js,"emitNodesInTreeOrder");function Us(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d(Us,"deduplicateLayers");function Ws(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,a=[],c=[],f=n.get(s);for(const g of r){const p=o.get(g)??i;p>i?a.push({child:g,min:p}):c.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),c.sort((g,p)=>{const M=(f==null?void 0:f.get(g))??0,u=(f==null?void 0:f.get(p))??0;if(M!==u)return M-u;const h=o.get(g)??i,l=o.get(p)??i;return h!==l?h-l:g.localeCompare(p)}),[...a.map(g=>g.child),...c]}}d(Ws,"createChildOrderer");function fn(t,e,n){const o=Ds(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const i=zs(t,e,o),a=[...r].sort(To(e)),c=Vs(a,s,e),f=Ws(s,e,i,c);let g=js(a,t.nodes,e,f);return g=Us(g),g}d(fn,"buildMultitreeLayerOrder");function Ks(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),i=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&i.push(r.get(a.dst));return Lo(i)}d(Ks,"countCrossingsBetweenAdjacent");function Jn(t,e,n){const o=[];for(const r of e){const i=n[r.src],a=n[r.dst];if(i==null||a==null||i===a)continue;let c=r.src,f=r.dst,g=i,p=a;i>a&&(c=r.dst,f=r.src,g=a,p=i);for(let M=g;M<p;M++)o.push({id:`${r.id}@${M}`,src:c,dst:f,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Ks(t[r],t[r+1],o);return s}d(Jn,"totalCrossings");function qs(t,e){const n={...e},{preds:o}=hn(t),s=ge(t),r=fn(t,n,s);let i=Jn(r,t.edges,n);const a=ln.MAX_CROSSING_OPTIMIZATION_PASSES;for(let c=0;c<a;c++){let f=!1;const g=[...t.nodes].sort((p,M)=>(n[M]??0)-(n[p]??0));for(const p of g){const M=n[p]??0;if(M===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=M)continue;const h=M;n[p]=u;const l=fn(t,n,s),x=Jn(l,t.edges,n);x<i?(i=x,f=!0):n[p]=h}if(!f)break}return n}d(qs,"optimizeRanksByCrossings");function Js(t,e){const n=ge(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(l=>l.src===s);if(i.length===0)continue;let a=!1,c=0;for(const l of i){const x=n(l.dst);x==null||x===r?a=!0:c++}if(c===0||a)continue;let f=0,g=!1;for(const l of t.edges){if(l.dst!==s)continue;const x=n(l.src);x&&(x===r?g=!0:f++)}if(f>0||!g)continue;const p=e[s]??0,M=p+c;let u=0;for(const l of t.edges)l.dst===s&&(u=Math.max(u,(e[l.src]??0)+1));const h=Math.max(p,u,M);h!==p&&(e[s]=h)}}d(Js,"adjustCrossLaneSources");function Zs(t,e){const n=Ie(t),o=De(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let i=Object.create(null);for(const c of o){const f=Mo(n,c),g=e!=null&&e.ignoreCrossLaneEdges?f.filter(p=>{const M=r(p.src),u=r(c);return!M||!u?!0:M===u}):f;if(g.length===0)i[c]=0;else if(s&&g.length===1){const p=g[0].src,M=r(p),u=r(c);M!==u?i[c]=i[p]??0:i[c]=(i[p]??0)+1}else{let p=-1/0;for(const M of g)p=Math.max(p,(i[M.src]??0)+1);i[c]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(i=qs(n,i)),e!=null&&e.ignoreCrossLaneEdges&&Js(n,i),{layers:fn(n,i,r),rankOf:i,dummy:new Set}}d(Zs,"assignLayers_LongestPath");function Qs(t,e){const n=Ie(t),s={...Zs(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:i,succs:a}=hn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const l=r(h.src),x=r(h.dst);if(l&&x&&l!==x)return!1}return!0}),c=De(n)??[...n.nodes],f=[...c].reverse(),g=d((h,l)=>{let x=0;for(const v of i.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,l)),Math.min(Math.max(l,x),C)},"clampFeasible"),p=ln.GRAVITY_ITERATIONS,M=d(h=>{let l=!1;for(const x of h){const C=i.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,A)=>E+(s[A]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,A)=>E+(s[A]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),I=g(x,y);I!==s[x]&&(s[x]=I,l=!0)}return l},"relaxOrder");for(let h=0;h<p;h++){const l=M(c),x=M(f);if(!l&&!x)break}for(const h of c){let l=0;for(const x of i.get(h)??[])l=Math.max(l,(s[x]??0)+1);(s[h]??0)<l&&(s[h]=l)}for(const h of f){const l=a.get(h)??[];if(l.length>0){const x=Math.min(...l.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:vo(n,c,s),rankOf:s,dummy:new Set}}d(Qs,"assignLayers_Gravity");function tr(t){const e=So(t),n=Io(t);let o=Co(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const a of n.get(i)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((i,a)=>i.localeCompare(a))}return s.length===t.nodes.length?s:null}d(tr,"topoSortByGenerationIfAcyclic");function er(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?tr(n)??[...n.nodes].sort():De(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),i=Object.create(null),a=new Map,c=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const M=Mo(n,g);let u=0;if(M.length>0)for(const C of M){const b=C.src,v=i[b]??0;u=Math.max(u,v+c(b,g))}const h=r(g),l=a.get(h)??0,x=Math.max(u,l);i[g]=x,a.set(h,x+1)}return{layers:vo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}d(er,"assignLayers_LaneAwareCompact");function nr(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const a=new Map(n.nodeById),c=d(u=>{const h=`placeholder-${i++}`,l={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,l),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),f=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of f){const h=o[u.src]??0,l=o[u.dst]??0;if(l-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b<l;b++,v++){const L=c(b);g.push({id:`${u.id}#${v}`,src:x,dst:L,weight:u.weight,ref:u.ref}),x=L}const C=l-h-2;g.push({id:`${u.id}#${Math.max(C+1,0)}`,src:x,dst:u.dst,weight:u.weight,ref:u.ref})}const M={nodes:[...n.nodes,...[...r].filter(u=>!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:M}}d(nr,"makeProperLayering");function Zn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(Zn,"median");function Qn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Qn,"barycenter");function or(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(or,"neighborPositionsFor");function sr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(sr,"currentOrderTieBreak");function to(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),i=ke(e),a=[];for(const f of n)o.has(f.src)&&s.has(f.dst)&&a.push({u:r.get(f.src),v:i.get(f.dst)});a.sort((f,g)=>f.u===g.u?f.v-g.v:f.u-g.u);const c=a.map(f=>f.v);return Lo(c)}d(to,"countCrossingsBetweenAdjacent");function Ze(t,e,n){return[...t].sort((o,s)=>{const r=Zn(e.get(o)??[]),i=Zn(e.get(s)??[]);return r===i?sr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}d(Ze,"sortByHeuristic");function eo(t,e,n,o,s,r){const i=ke(t),a=ke(e),c=or(e,i,n,o);if(!s||!r||r.length===0)return Ze(e,c,a);const f=new Map;for(const M of e){const u=s(M),h=f.get(u)??[];h.push(M),f.set(u,h)}const g=[];for(const M of r){const u=f.get(M);if(!u||u.length===0)continue;const h=Ze(u,c,a);g.push(...h)}const p=f.get(null);if(p&&p.length>0){const M=Ze(p,c,a);for(const u of M){const h=Qn(c.get(u)??[]);let l=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Qn(c.get(C)??[]);if(h<b){l=x;break}}g.splice(l,0,u)}}return g}d(eo,"reorderLayer");function no(t,e,n,o,s){const r=[...e],i=new Set(t),a=new Set(e),c=o?new Set(o):null,f=n.filter(l=>i.has(l.src)&&a.has(l.dst)),g=c?n.filter(l=>a.has(l.src)&&c.has(l.dst)):void 0,p=d(l=>{let x=to(t,l,f);return g&&o&&(x+=to(l,o,g)),x},"crossingScore"),M=s?new Map:null;if(s&&M)for(const l of e)M.set(l,s(l));let u=!0,h=p(r);for(;u;){u=!1;for(let l=0;l+1<r.length;l++){if(M){const b=M.get(r[l]),v=M.get(r[l+1]);if(b!==v)continue}const x=h;[r[l],r[l+1]]=[r[l+1],r[l]];const C=p(r);C<x?(h=C,u=!0):[r[l],r[l+1]]=[r[l+1],r[l]]}}return r}d(no,"transposeImprove");function rr(t,e,n){const o=t.layers.map(a=>[...a]),s=e.edges,r=ge(e),i=Eo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let c=1;c<o.length;c++)o[c]=eo(o[c-1],o[c],s,"down",r,i),o[c]=no(o[c-1],o[c],s,o[c+1],r);for(let c=o.length-2;c>=0;c--)o[c]=eo(o[c+1],o[c],s,"up",r,i),o[c]=no(o[c+1],o[c],s,o[c-1],r)}return{layers:o}}d(rr,"orderLayers");function ir(t,e,n){const o=(n==null?void 0:n.layerGap)??Ho.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??Ho.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,i=(n==null?void 0:n.direction)??"TB",a=i==="LR"||i==="RL",c=t.layers,f=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),M=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),l=Eo(e,n==null?void 0:n.laneOrder),x=c.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1<c.length;O++){const k=c[O].reduce((Mt,Ht)=>Math.max(Mt,M(Ht)),0),H=c[O+1].reduce((Mt,Ht)=>Math.max(Mt,M(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of c)for(const k of O)b.add(h(k));const v=b.has(null),L=l.filter(O=>b.has(O)),y=[...v?[null]:[],...L],I=Object.create(null);for(const O of L)I[O]=0;v&&(I.null=0);for(const O of c){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+M(ft),0)+s*Math.max(0,G.length-1);I[P]=Math.max(I[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+M(j),0)+s*Math.max(0,H.length-1);I.null=Math.max(I.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?I.null:I[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;P<y.length;P++){const G=y[P],j=O[P]??0,tt=H+j/2;E.set(G,tt),H+=j,P<y.length-1&&(H+=r)}}let A=0;for(const[O,k]of c.entries()){const H=x[O]??0,P=new Map;for(const j of k){const tt=h(j),ft=P.get(tt)??[];ft.push(j),P.set(tt,ft)}for(const j of y){const tt=P.get(j)??[];if(tt.length===0)continue;const ft=E.get(j);if(tt.length===1){const Mt=tt[0];f[Mt]=ft,g[Mt]=A+H/2}else{const Mt=tt.map(nt=>M(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let Ft=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];f[J]=Ft+rt/2,g[J]=A+H/2,Ft+=rt+s}}}const G=C[O]??0;A+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((f[H]??0)+(f[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(f[tt]=G)}}return{x:f,y:g}}d(ir,"assignCoordinates");var cr=8;function ar(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}d(ar,"hashString");function lr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(lr,"mulberry32");function fr(t,e){const n=[...t],o=lr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(fr,"deterministicShuffle");function dr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(dr,"sourceDistance");function oo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const a=n.get(s),c=n.get(r);a==null||c==null||(o+=i*Math.abs(a-c))}return o}d(oo,"laneArrangementCost");function ur(t){const e=gn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!i||!a||!t.nodeById.has(i)||!t.nodeById.has(a))continue;const c=o(i),f=o(a);if(!c||!f||c===f)continue;const g=n.get(c),p=n.get(f);if(g==null||p==null)continue;const[M,u]=g<=p?[c,f]:[f,c],h=`${M}\0${u}`,l=s.get(h);l?l.weight++:s.set(h,{a:M,b:u,weight:1})}return[...s.values()]}d(ur,"buildWeightedLaneEdges");function so(t,e,n){const o=[...t];let s=oo(o,e),r=!0,i=0;const a=Math.max(1,o.length);for(;r&&i<a;){r=!1,i++;for(let c=0;c+1<o.length;c++){[o[c],o[c+1]]=[o[c+1],o[c]];const f=oo(o,e);f<s?(s=f,r=!0):[o[c],o[c+1]]=[o[c+1],o[c]]}}return{order:o,cost:s,sourceDistance:dr(o,n)}}d(so,"greedySwitch");function hr(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}d(hr,"isBetterCandidate");function gr(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return ar(`${t.join("|")}#${o}#${n}`)}d(gr,"seedForRestart");function mr(t,e={}){const n=gn(t);if(n.length<2)return n;const o=ur(t);if(o.length===0)return n;const s=new Map(n.map((a,c)=>[a,c]));let r=so(n,o,s);const i=Math.max(0,e.restarts??cr);for(let a=0;a<i;a++){const c=gr(n,o,a),f=fr(n,c),g=so(f,o,s);hr(g,r)&&(r=g)}return r.order}d(mr,"optimizeTopLaneOrder");function yr(t,e){const n=(e==null?void 0:e.ignoreCrossLaneEdges)??!0,o=(e==null?void 0:e.optimizeRanksByCrossings)??!0,s=Ie(t),r=e!=null&&e.automaticLaneOrdering?mr(s,{restarts:cr}):void 0,i=_s(s),a=i.acyclic,c=n?er(a,{compactSingleInput:(e==null?void 0:e.compactSingleInput)??ln.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e==null?void 0:e.direction}):Qs(a,{compactSingleInput:(e==null?void 0:e.compactSingleInput)??ln.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:g}=nr(c,a),p=rr(f,g,{laneOrder:r}),M=ir(p,g,{layerGap:e==null?void 0:e.layerGap,nodeGap:e==null?void 0:e.nodeGap,direction:e==null?void 0:e.direction,laneOrder:r});return{acyclic:a,reversed:i.reversed,layering:f,ordered:p,coordinates:M}}d(yr,"sugiyamaLayout");var lt=ei.EPSILON,ni=8,Ce=15,Ne=15,qe=25,ie=20,Tn=10;function ro(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,a=Math.abs(r),c=Math.abs(i);return a<lt&&c<lt?n:c>lt&&c*3>=a?i>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(ro,"chooseOrthogonalSide");function io(t,e){return Math.abs(t.to-e.from)<lt||Math.abs(t.to-e.to)<lt?t.to:t.from}d(io,"sharedLineEndpointCoord");function ve(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}d(ve,"pointOnLine");function pr(t,e){var K,Z,Y,q;const n=t.nodes??[],o=t.edges??[],s=[];for(const m of o)m.isLayoutOnly||s.push({...m,__originalEdge:m});const r=new Map,i=new Map,a=[],c=e==="LR";for(const m of n)r.set(m.id,m);const f=n.filter(m=>m.isGroup&&!m.parentId);for(const m of f){const S={id:m.id},w=d(T=>{i.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(w)},"assignLane");w(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,w=m.height??10,T=m.x??0,N=m.y??0,D=ni;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-w/2-D,maxY:N+w/2+D,visualXHalfExtent:c?w/2+D:S/2+D}}),p=d((m,S,w,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:w,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,w),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),M=d((m,S)=>{const w=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-w/2,y:D};case"right":return{x:N+w/2,y:D}}},"portForSide"),u=d((m,S,w)=>M(m,ro(m,S,w?"bottom":"top")),"getOrthogonalPort"),h=[],l=[],x=new Set,C=1e3,b=d((m,S,w)=>{if(h.length===0)return 0;const T=Math.abs(S.y-w.y)<lt,N=Math.abs(S.x-w.x)<lt;if(!T&&!N)return 0;let D=0;if(T){const W=S.y,ot=Math.min(S.x,w.x)-lt,U=Math.max(S.x,w.x)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="vertical"||z.pipe.coord<ot||z.pipe.coord>U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,w.y)-lt,U=Math.max(S.y,w.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coord<ot||z.pipe.coord>U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const w=r.get(m.start),T=r.get(m.end),N=i.get(m.start),D=i.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=w&&T?Math.abs((T.x??0)-(w.x??0)):0,U=w&&T?Math.abs((T.y??0)-(w.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const w=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(w-T)>1?w-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,w,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>w&&z.nodeId===w||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minY<m.y&&z.maxY>m.y&&z.maxX>N&&z.minX<D:z.minX<m.x&&z.maxX>m.x&&z.maxY>W&&z.minY<ot)},"isSegmentBlocked"),y=new Map,I=new Map;for(const m of s)!m.start||!m.end||m.start===m.end||(I.set(m.start,(I.get(m.start)??0)+1),I.set(m.end,(I.get(m.end)??0)+1));const E=d((m,S)=>ro(m,S,"bottom"),"determineSide"),A=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const w=r.get(S.start),T=r.get(S.end);if(!w||!T)continue;const N=(T.x??0)-(w.x??0),D=(T.y??0)-(w.y??0);A.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(w,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:w.x??0,y:w.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of A.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of A.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,w)=>{const T=B(S),N=B(w);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-w.edgeIdx});for(let S=1;S<m.length;S++){const w=m[S],T=O(w),N=H.get(P(w.srcId,w.srcSide))??0,D=H.get(P(w.srcId,T))??0;D>=N||(H.set(P(w.srcId,w.srcSide),N-1),H.set(P(w.srcId,T),D+1),w.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of A.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of A.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const w=O(m);if(S.has(w)||(H.get(P(m.srcId,w))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,w),1),m.srcSide=w}for(const m of A.values()){const{edgeIdx:S,srcId:w,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(w),ot=r.get(T),U=`${w}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((At,Gt)=>At.oppositeCoord-Gt.oppositeCoord);const w=m.split(":"),T=w.slice(0,-2).join(":"),N=w[w.length-2],D=w[w.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[At,Gt]of S.entries()){const ee=Bt+At*st,xn=`${Gt.edgeIdx}:${D}`;tt.set(xn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:w})=>Mt(w))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:w})=>Mt(w)):!1,"faceHasLabelNode"),Ft=d((m,S,w)=>S==="top"||S==="bottom"?{x:m.x+w,y:m.y}:{x:m.x,y:m.y+w},"applyPortOffset"),nt=d((m,S,w)=>{const T=A.get(m),N={x:w.x??0,y:w.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(w,D);let U=T?M(S,T.srcSide):u(S,N,!0),z=T?M(w,T.dstSide):u(w,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=Ft(U,W,bt)),dt!==void 0&&(z=Ft(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(l[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const w=r.get(S.start),T=r.get(S.end);if(!w||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,w,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(w.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(w.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.x<Q.maxX&&X.y>Q.minY&&X.y<Q.maxY)return{inside:!0,obstacle:Q};return{inside:!1}},"isPointInObstacle"),st=d((X,$,Q,ht,Tt)=>{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],At=ct(U,Bt);if(At.inside&&At.obstacle){const X=At.obstacle;if(bt){const $=st(N,w,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,w,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,w,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,w,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)<X,Q=Math.abs(U.y-z.y)<X,ht=tt.get(`${m}:src`)!==void 0||tt.get(`${m}:dst`)!==void 0,Tt=(((K=y.get(`${S.start??""}:${W}:src`))==null?void 0:K.length)??0)+(((Z=y.get(`${S.start??""}:${W}:dst`))==null?void 0:Z.length)??0),Ct=(((Y=y.get(`${S.end??""}:${ot}:src`))==null?void 0:Y.length)??0)+(((q=y.get(`${S.end??""}:${ot}:dst`))==null?void 0:q.length)??0),Rt=Tt>1||Ct>1,kt=I.get(S.start??"")??0,mt=I.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const xn=p("vertical",U.x,U.y,U.y);U.x=xn.coord;const Mr=p("vertical",z.x,z.y,z.y);z.x=Mr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,we=Math.min(U.y,z.y)-50,Ae=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX<Q&&X.maxX>$&&X.minY<Tt&&X.maxY>ht&&(ye=Math.min(ye,X.minX-qe),pe=Math.max(pe,X.maxX+qe),we=Math.min(we,X.minY-qe),Ae=Math.max(Ae,X.maxY+qe))}for(const X of g){if(X.maxX<ye||X.minX>pe||X.maxY<we||X.minY>Ae)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,we,Ae),p("vertical",X.maxX+Q,we,Ae)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const Ir=a.filter(X=>X.orientation==="horizontal"&&X.coord>=we&&X.coord<=Ae),Sr=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),He=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),Xe=He(U.x,U.y),wo=He(z.x,z.y),Ye=new Map,bn=new Map,Mn=new Map,Ge=new Set,Se=[];Ye.set(Xe,0),Mn.set(Xe,"n"),Se.push({key:Xe,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ge.add(Xe);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),In={x:z.x,y:U.y},Cr=xe(U,In),vr=xe(In,z),Lr=Cr||vr,Sn={x:U.x,y:z.y},Er=xe(U,Sn),Tr=xe(Sn,z);if(Lr?Er||Tr||(Math.abs(U.x-z.x)<lt?$t=[U,z]:$t=[U,Sn,z]):Math.abs(U.y-z.y)<lt||Math.abs(U.x-z.x)<lt?$t=[U,z]:$t=[U,In,z],$t.length===0)for(;Se.length>0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ge.delete(X.key),X.key===wo){let mt=wo,Vt=z;for($t=[Vt];bn.has(mt);){const re=bn.get(mt);$t.unshift(re),Vt=re,mt=He(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=Sr.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=Ir.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt<ht.length-1&&kt.push({x:ht[Tt+1].coord,y:Q}),Rt>0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rt<Ct.length-1&&kt.push({x:$,y:Ct[Rt+1].coord});for(const mt of kt){const Vt=Math.min($,mt.x),re=Math.max($,mt.x),Dt=Math.min(Q,mt.y),jt=Math.max(Q,mt.y);if(g.some(ne=>ne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minY<Q&&ne.maxY>Q&&ne.maxX>Vt&&ne.minX<re:ne.minX<$&&ne.maxX>$&&ne.maxY>Dt&&ne.minY<jt))continue;const vt=He(mt.x,mt.y),Ut=Math.abs(mt.x-$)+Math.abs(mt.y-Q),Lt=b(m,X.pt,mt);let Et=0;const Zt=z.x-U.x,Re=z.y-U.y,$e=mt.x-$,Cn=mt.y-Q;(Re>10&&Cn<-5||Re<-10&&Cn>5)&&(Et=Math.abs(Cn)*100),(Zt>10&&$e<-5||Zt<-10&&$e>5)&&(Et+=Math.abs($e)*50);let Ao=0;const Ro=Mn.get(X.key)??"n",No=Math.abs($e)>lt?"h":"v";Ro!=="n"&&Ro!==No&&(Ao=50);const wr=Ut+Lt+Et+Ao,ze=(Ye.get(X.key)??1/0)+wr,Oo=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if(ze<(Ye.get(vt)??1/0))if(bn.set(vt,X.pt),Ye.set(vt,ze),Mn.set(vt,No),!Ge.has(vt))Se.push({key:vt,f:ze+Oo,pt:mt}),Ge.add(vt);else{const ne=Se.findIndex(Ar=>Ar.key===vt);ne!==-1&&(Se[ne].f=ze+Oo)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=Q<Math.min(X.x,$.x);if(c){const Dt=Ne;if(Rt){const jt=Math.max(X.x,$.x),_t=Math.min(X.y,$.y),vt=Math.max(X.y,$.y),Ut=g.filter(Lt=>Lt.minX<jt&&Lt.maxX>jt&&Lt.minY<vt&&Lt.maxY>_t);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(_t=>_t.minX<Math.min(X.x,$.x)+Dt&&_t.minY<Math.max(X.y,$.y)&&_t.maxY>Math.min(X.y,$.y));if(jt.length>0){let _t=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;_t=Math.min(_t,Lt)}Q=_t}}}const mt=d(Dt=>{const jt=$.y>X.y,_t=g.filter(Lt=>{const Et=Math.min(X.x,$.x)<Lt.maxX&&Math.max(X.x,$.x)>Lt.minX,Zt=Math.min(X.y,$.y)<Lt.maxY&&Math.max(X.y,$.y)>Lt.minY;return Et&&Zt});let vt=_t;if(c&&_t.length>0){const Lt=_t.filter(Et=>Et.minX<Dt&&Et.maxX>Dt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),_t={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,_t),Et=xe(_t,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)<lt?[X,_t,vt,$]:[X,_t,vt,Ut,$]:null},"trySimplifyWithDetourX"),re=Rt&&!kt?Vt(ht):kt&&!Rt?Vt(Q):null;re&&($t=re)}const zt=[N,...It,...$t,...Gt.reverse(),D];if(zt.length>=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)<lt&&Math.abs($.y-X.y)<lt,Tt=Math.abs(Q.x-$.x)<lt&&Math.abs($.x-X.x)<lt;if(ht){const Ct=Math.sign($.x-Q.x),Rt=Math.sign(X.x-Q.x);Ct!==0&&Ct===Rt&&Math.abs($.x-Q.x)>Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X<zt.length-1;X++){if(X===1){fe.push(zt[X]);continue}const $=fe[fe.length-1],Q=zt[X],ht=zt[X+1];if(Math.abs($.y-Q.y)<lt&&Math.abs(Q.y-ht.y)<lt){const Tt=Q.x>$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)<lt&&Math.abs(Q.x-ht.x)<lt){const Tt=Q.y>$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;X<fe.length-1;X++){const $=fe[X],Q=fe[X+1],ht=Math.abs($.x-Q.x)<lt?"vertical":"horizontal",Tt=ht==="vertical"?$.x:$.y,Ct=ht==="vertical"?Math.min($.y,Q.y):Math.min($.x,Q.x),Rt=ht==="vertical"?Math.max($.y,Q.y):Math.max($.x,Q.x),kt=p(ht,Tt,Ct,Rt),mt={edgeIndex:m,segmentIndex:X,orientation:ht,pipe:kt,trackIndex:0,from:Ct,to:Rt};h.push(mt),l[m].push(h.length-1),kt.tracks[0]||(kt.tracks[0]={index:0,coord:kt.coord,segments:[]}),kt.tracks[0].segments.push({edgeIndex:m,segmentIndex:X,from:Ct,to:Rt})}}const J=d((m,S)=>m.from<S.to&&S.from<m.to,"segmentsOverlap"),rt=d((m,S,w,T)=>{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!w.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=w.index,w.segments=[...w.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const w=m.pipe.tracks[m.trackIndex];w.segments=w.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const w=l[m.edgeIndex];for(const T of w){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),wt=d(m=>{const S=l[m.edgeIndex],w=S.indexOf(h.indexOf(m)),T=[];return w>0&&T.push(h[S[w-1]]),w<S.length-1&&T.push(h[S[w+1]]),T},"getAdjacentSegmentsAlongEdge"),Kt=d((m,S)=>{if(m.orientation===S.orientation)return!1;const w=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>w.from&&T.pipe.coord<w.to&&w.pipe.coord>T.from&&w.pipe.coord<T.to},"haveAnyCrossing"),qt=d((m,S)=>{for(const w of m.tracks)if(!w.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return w.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const w=wt(m),T=wt(S);return w.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,w)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);w(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let w=0;w<m.length;w++)for(let T=w+1;T<m.length;T++){const N=m[w],D=m[T];N.pipe===D.pipe&&Jt(N,D)&&(S++,se(N,D,St))}return S},"resolveHandleConflicts"),me=new Map,Te=d(m=>{if(me.has(m))return me.get(m);const S=l[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;ot<S.length;ot++){const U=h[S[ot]];if(U.orientation==="horizontal"){const z=U.from,bt=U.to;N=Math.abs(z-T)>Math.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),mn=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())l[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const w=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=w(D),bt=w(W);if(Math.abs(z-bt)>1)return bt-z;const dt=l[D].length,ct=l[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=l[D][0],It=l[W][0];if(h[st]&&h[It]){const Bt=h[st],At=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(At.to-At.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[l[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),yn=d(()=>{let m=0;const S=new Map;for(const[w,T]of s.entries())l[w].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(w));for(const w of S.values()){w.sort((N,D)=>{const W=d(z=>{const bt=l[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=w.map(N=>h[l[N][l[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),pn=d(()=>{let m=0;for(const S of a){const w=[];for(const T of S.tracks)for(const N of T.segments){const D=l[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&w.push(h[D])}w.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T<w.length;T++)for(let N=T+1;N<w.length;N++){const D=w[T],W=w[N];Jt(D,W)&&(m++,se(D,W,pt))}}return m},"fixPipeCrossings");let R=0;const _=10;for(;R<_;){let m=0;if(m+=mn(),m+=yn(),m+=pn(),m===0)break;R++}const F=new Map;for(const m of a){const S=[];m.tracks.forEach(T=>{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const w=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;D<S.length;D++){const W=S[D];W.from<N?(T.push(W),N=Math.max(N,W.to)):(w.push(T),T=[W],N=W.to)}w.push(T)}for(const T of w){const N=new Set;T.forEach(st=>N.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const At=x.has(Bt.edgeIndex)?m.coord:It;F.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,At)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*Tn);if(U.length===0&&N.size>0){const st=[...N].sort((At,Gt)=>Math.abs(D.get(At)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*Tn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*Tn)}}for(const[m,S]of s.entries()){const w=l[m]??[];if(w.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=w.map(dt=>{const ct=h[dt],st=F.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dt<U.length;dt++){const ct=U[dt],st=T[T.length-1],It=ct.orient==="vertical"?st.y:st.x,Bt=ct.orient==="vertical"?st.x:st.y,At=U[dt+1],Gt=dt<U.length-1;if(Math.abs(Bt-ct.coord)>lt&&T.push(ve(ct,It)),Gt&&At.orient===ct.orient)if(Math.abs(ct.coord-At.coord)>lt){const ee=ct.orient==="vertical"?(It+At.from)/2:io(ct,At);T.push(ve(ct,ee),ve(At,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,io(ct,At)));else if(Gt)T.push(ve(ct,At.coord));else{const ee=Math.abs(ct.from-It)<Math.abs(ct.to-It)?ct.to:ct.from;T.push(ve(ct,ee))}}const z=T[T.length-1];(Math.abs(z.x-ot.x)>lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dt<T.length;dt++){const ct=T[dt],st=bt[bt.length-1];(Math.abs(ct.x-st.x)>lt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const w=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=w-N/2,ot=w+N/2,U=T-D/2,z=T+D/2;if(m.x<W||m.x>ot||m.y<U||m.y>z)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const w=m.start,T=m.end,N=w?r.get(w):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(pr,"routeEdgesOrthogonal");function xr(t){return t.direction??"TB"}d(xr,"getSwimlaneDirection");function br(t){var g,p,M,u,h;const e=es(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((M=t.config.swimlane)==null?void 0:M.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,i=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=xr(t),{ordered:c,coordinates:f}=yr(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:a});ns(e,c,f,{nodeGap:n,layerGap:o});for(const l of t.edges??[])delete l.points;pr(t,a);for(const l of t.edges??[])(!l.curve||l.curve==="basis")&&(l.curve="rounded");return Bs(t,a),Ps(t),a}d(br,"runSwimlaneLayoutCore");async function oi(t,e){const n=e.select("g");Or(n,t.markers,t.type,t.diagramId),Pr(),Br(),kr(),Nr(),ts(t);const o=os(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:s}=await Xo(n,t);br(t),await Jo(t,s)}d(oi,"render");export{oi as render};
@@ -0,0 +1,8 @@
1
+ import{c as r,s as e}from"./flowDiagram-23GEKE2U-D5pYz8Px.js";import{_ as a}from"./mermaid.core-2Gz9YusH.js";import"./chunk-5VM5RSS4-CyInWuue.js";import"./chunk-XXDRQBXY-BJyBGcSF.js";import"./chunk-VR4S4FIN-GkW_x_pD.js";import"./chunk-32BRIVSS-C7ZEXYO8.js";import"./index-BU0KLNTt.js";import"./channel-CHc3ibOz.js";var o=a(t=>`${e(t)}
2
+ .swimlane.cluster rect {
3
+ stroke: ${t.clusterBorder} !important;
4
+ }
5
+ [data-look="neo"].cluster rect {
6
+ filter: none;
7
+ }
8
+ `,"getStyles"),s=o,n=r({defaultLayout:"swimlane",styles:s});export{n as diagram};
@@ -1,4 +1,4 @@
1
- import{_ as l,z as pt,a9 as Wt,aa as Pt,ab as Bt,c as gt,l as S,F as Vt,a1 as Ft,ac as ft,d as J,u as zt,ad as Gt,q as Ot}from"./mermaid.core-BbvVSKV6.js";import{d as ot}from"./arc-DCySHdMS.js";import"./index-CcolbA6z.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var Z=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function q(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(q,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var K="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?K="Parse error on line "+(M+1)+`:
1
+ import{_ as l,z as pt,a9 as Wt,aa as Pt,ab as Bt,c as gt,l as S,F as Vt,a1 as Ft,ac as ft,d as J,u as zt,ad as Gt,q as Ot}from"./mermaid.core-2Gz9YusH.js";import{d as ot}from"./arc-Cx0L6o2z.js";import"./index-BU0KLNTt.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var Z=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function q(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(q,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var K="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?K="Parse error on line "+(M+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":K="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(K,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,C=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},Z&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,C,M,R.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{b3 as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as S,z as St,F as Qt,d as rt,ak as $t,a9 as te,aa as ee,ab as ne,e as se,q as ie,B as re,D as oe}from"./mermaid.core-BbvVSKV6.js";import"./index-CcolbA6z.js";const It=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(Q(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)Q(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Q(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)Q(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);Q(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(k=>{k.size==0&&k.sets.length==1&&O.add(k.sets[0])}),f=f.filter(k=>!k.sets.some(C=>O.has(C)));let I={},R={};if(f.length>0){let k=b(f,{lossFunction:v,distinct:m});l&&(k=Ct(k,o,d)),I=Nt(k,s,e,i,h),R=Lt(I,f,M)}const Z={};f.forEach(k=>{k.label&&(Z[k.sets]=k.label)});function U(k){if(k.sets in Z)return Z[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(k){const C=this.getAttribute("d");k.sets.length==1&&C&&!m&&(z=!0,V[k.sets[0]]=Me(C))});function q(k){return C=>{const G=k.sets.map(J=>{let W=V[J],X=I[J];return W||(W={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:W.x*(1-C)+X.x*C,y:W.y*(1-C)+X.y*C,radius:W.radius*(1-C)+X.radius*C}});return wt(G,y)}}const A=B.selectAll(".venn-area").data(f,k=>k.sets),F=A.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),j=F.append("path"),L=F.append("text").attr("class","label").text(k=>U(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function P(k){return typeof k.transition=="function"?k.transition("venn").duration(r):k}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",k=>wt(k.sets.map(C=>I[C])),y);const D=_.selectAll("text").filter(k=>k.sets in R).text(k=>U(k)).attr("x",k=>Math.floor(R[k.sets].x)).attr("y",k=>Math.floor(R[k.sets].y));u&&(z?"on"in D?D.on("end",ot(I,U)):D.each("end",ot(I,U)):D.each(ot(I,U)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",q);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:I,textCentres:R,nodes:A,enter:F,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function ke(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=ke(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
1
+ import{b3 as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as S,z as St,F as Qt,d as rt,ak as $t,a9 as te,aa as ee,ab as ne,e as se,q as ie,B as re,D as oe}from"./mermaid.core-2Gz9YusH.js";import"./index-BU0KLNTt.js";const It=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(Q(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)Q(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Q(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)Q(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);Q(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(k=>{k.size==0&&k.sets.length==1&&O.add(k.sets[0])}),f=f.filter(k=>!k.sets.some(C=>O.has(C)));let I={},R={};if(f.length>0){let k=b(f,{lossFunction:v,distinct:m});l&&(k=Ct(k,o,d)),I=Nt(k,s,e,i,h),R=Lt(I,f,M)}const Z={};f.forEach(k=>{k.label&&(Z[k.sets]=k.label)});function U(k){if(k.sets in Z)return Z[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(k){const C=this.getAttribute("d");k.sets.length==1&&C&&!m&&(z=!0,V[k.sets[0]]=Me(C))});function q(k){return C=>{const G=k.sets.map(J=>{let W=V[J],X=I[J];return W||(W={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:W.x*(1-C)+X.x*C,y:W.y*(1-C)+X.y*C,radius:W.radius*(1-C)+X.radius*C}});return wt(G,y)}}const A=B.selectAll(".venn-area").data(f,k=>k.sets),F=A.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),j=F.append("path"),L=F.append("text").attr("class","label").text(k=>U(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function P(k){return typeof k.transition=="function"?k.transition("venn").duration(r):k}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",k=>wt(k.sets.map(C=>I[C])),y);const D=_.selectAll("text").filter(k=>k.sets in R).text(k=>U(k)).attr("x",k=>Math.floor(R[k.sets].x)).attr("y",k=>Math.floor(R[k.sets].y));u&&(z?"on"in D?D.on("end",ot(I,U)):D.each("end",ot(I,U)):D.each(ot(I,U)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",q);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:I,textCentres:R,nodes:A,enter:F,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function ke(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=ke(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
2
2
  M`,t,n),e.push(`
3
3
  m`,-s,0),e.push(`
4
4
  a`,s,s,0,1,0,s*2,0),e.push(`
@@ -1,4 +1,4 @@
1
- import{p as zt}from"./chunk-JWPE2WC7-gNumDpip.js";import{s as Lt,g as Tt,p as At,o as Xt,a as Et,b as Yt,_ as y,W as It,z as Bt,B as Q,l as et,F as Ft,e as Rt,q as Ot,c as V}from"./mermaid.core-BbvVSKV6.js";import{p as Wt}from"./cynefin-VYW2F7L2-lliB__8b.js";import"./index-CcolbA6z.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map
1
+ import{p as zt}from"./chunk-JWPE2WC7-CJ3Qx30f.js";import{s as Lt,g as Tt,p as At,o as Xt,a as Et,b as Yt,_ as y,W as It,z as Bt,B as Q,l as et,F as Ft,e as Rt,q as Ot,c as V}from"./mermaid.core-2Gz9YusH.js";import{p as Wt}from"./cynefin-VYW2F7L2-C08dfI3w.js";import"./index-BU0KLNTt.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map
2
2
  `+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((J=g.size)==null?void 0:J.width)??r.width,k=((K=g.size)==null?void 0:K.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Rt(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(h=>{s.push({start:i,end:h}),i=h})}else{const i=1/R.length;R.forEach((h,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,h)=>{const l=s[h],x=r.padding+l.start*B,f=r.padding+l.end*B,u=(x+f)/2;h>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f<i.length-1;f++){const u=i[f],w=i[f+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,l=-1/0,x=0;if(s.componentIds.forEach(f=>{const u=c.get(f);u&&(h=Math.min(h,u.x),l=Math.max(l,u.x),x=u.y)}),h!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=x-u/2,S=c.get(s.nodeId);if(S){const z=(h+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*h}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*h}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*h}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+h*h),f=8,u=h/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,h=s.x-n.x,l=s.y-n.y,x=Math.sqrt(h*h+l*l),f=8,u=-h/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,S=-l/f,z=i+w*u,W=h+S*u;let Y=Math.atan2(x,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),h=s-n.x,l=i-n.y,x=Math.sqrt(h*h+l*l),f=r.nodeRadius+2,u=x>f?s-h/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i<s.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[i].x).attr("y1",s[i].y).attr("x2",s[i+1].x).attr("y2",s[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach(i=>{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,h=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=x.append("text").attr("x",n+i).attr("y",s+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*h+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*h)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),h=60,l=30,x=20,f=`
3
3
  M ${s} ${i-l/2}
4
4
  L ${s+h-x} ${i-l/2}