@taskmark/ui 0.2.6 → 0.3.1

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 (320) hide show
  1. package/README.md +16 -1
  2. package/app/board/page.tsx +3 -272
  3. package/app/globals.css +25 -0
  4. package/app/layout.tsx +15 -5
  5. package/app/page.tsx +14 -14
  6. package/app/setup/actions.ts +4 -4
  7. package/app/setup/page.tsx +9 -4
  8. package/bin/lib/resolve-board.mjs +1 -4
  9. package/bin/taskmark.js +15 -2
  10. package/components/board/app-bar.tsx +3 -0
  11. package/components/board/board-screen.tsx +229 -0
  12. package/components/board/changelog-panel.tsx +26 -0
  13. package/components/board/epic-list.tsx +4 -2
  14. package/components/board/list-view-switcher.tsx +7 -3
  15. package/components/board/markdown-content.tsx +21 -1
  16. package/components/board/mermaid-diagram.tsx +88 -0
  17. package/components/board/metric-stat-card.tsx +4 -4
  18. package/components/board/overall-tree-list.tsx +467 -0
  19. package/components/board/overall-work-items-list.tsx +6 -2
  20. package/components/board/points-heatmap.tsx +183 -0
  21. package/components/board/project-status-metrics-strip.tsx +5 -22
  22. package/components/board/static-board-app.tsx +29 -94
  23. package/components/board/status-badge.tsx +8 -0
  24. package/components/board/story-list.tsx +3 -1
  25. package/components/board/task-list.tsx +5 -1
  26. package/components/board/work-item-detail-body.tsx +123 -8
  27. package/components/board/work-items-list.tsx +2 -0
  28. package/components/theme-provider.tsx +39 -0
  29. package/components/theme-toggle.tsx +27 -0
  30. package/components/ui/sonner.tsx +2 -2
  31. package/dist/prod-next/BUILD_ID +1 -1
  32. package/dist/prod-next/app-path-routes-manifest.json +2 -2
  33. package/dist/prod-next/build-manifest.json +6 -6
  34. package/dist/prod-next/prerender-manifest.json +3 -27
  35. package/dist/prod-next/react-loadable-manifest.json +392 -2
  36. package/dist/prod-next/server/app/_global-error/page.js +2 -2
  37. package/dist/prod-next/server/app/_global-error/page.js.nft.json +1 -1
  38. package/dist/prod-next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  39. package/dist/prod-next/server/app/_global-error.html +1 -1
  40. package/dist/prod-next/server/app/_global-error.rsc +1 -1
  41. package/dist/prod-next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  42. package/dist/prod-next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  43. package/dist/prod-next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  44. package/dist/prod-next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  45. package/dist/prod-next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  46. package/dist/prod-next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  47. package/dist/prod-next/server/app/_not-found/page.js +2 -2
  48. package/dist/prod-next/server/app/_not-found/page.js.nft.json +1 -1
  49. package/dist/prod-next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  50. package/dist/prod-next/server/app/_not-found.html +1 -1
  51. package/dist/prod-next/server/app/_not-found.rsc +19 -17
  52. package/dist/prod-next/server/app/_not-found.segments/_full.segment.rsc +19 -17
  53. package/dist/prod-next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  54. package/dist/prod-next/server/app/_not-found.segments/_index.segment.rsc +8 -6
  55. package/dist/prod-next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  56. package/dist/prod-next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  57. package/dist/prod-next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  58. package/dist/prod-next/server/app/api/taskmark-reload/route.js +1 -1
  59. package/dist/prod-next/server/app/api/taskmark-reload/route.js.nft.json +1 -1
  60. package/dist/prod-next/server/app/board/page.js +2 -50
  61. package/dist/prod-next/server/app/board/page.js.nft.json +1 -1
  62. package/dist/prod-next/server/app/board/page_client-reference-manifest.js +1 -1
  63. package/dist/prod-next/server/app/favicon.ico/route.js +1 -1
  64. package/dist/prod-next/server/app/favicon.ico/route.js.nft.json +1 -1
  65. package/dist/prod-next/server/app/page.js +2 -2
  66. package/dist/prod-next/server/app/page.js.nft.json +1 -1
  67. package/dist/prod-next/server/app/page_client-reference-manifest.js +1 -1
  68. package/dist/prod-next/server/app/setup/page.js +2 -2
  69. package/dist/prod-next/server/app/setup/page.js.nft.json +1 -1
  70. package/dist/prod-next/server/app/setup/page_client-reference-manifest.js +1 -1
  71. package/dist/prod-next/server/app-paths-manifest.json +2 -2
  72. package/dist/prod-next/server/chunks/102.js +90 -0
  73. package/dist/prod-next/server/chunks/11.js +1 -0
  74. package/dist/prod-next/server/chunks/1286.js +1 -0
  75. package/dist/prod-next/server/chunks/1412.js +38 -0
  76. package/dist/prod-next/server/chunks/1605.js +1 -0
  77. package/dist/prod-next/server/chunks/169.js +1 -0
  78. package/dist/prod-next/server/chunks/18.js +86 -0
  79. package/dist/prod-next/server/chunks/2.js +1 -0
  80. package/dist/prod-next/server/chunks/2022.js +1 -0
  81. package/dist/prod-next/server/chunks/2156.js +1 -0
  82. package/dist/prod-next/server/chunks/2157.js +1 -0
  83. package/dist/prod-next/server/chunks/2325.js +82 -0
  84. package/dist/prod-next/server/chunks/2838.js +1 -0
  85. package/dist/prod-next/server/chunks/2897.js +79 -0
  86. package/dist/prod-next/server/chunks/3227.js +1 -0
  87. package/dist/prod-next/server/chunks/3266.js +1 -0
  88. package/dist/prod-next/server/chunks/3307.js +49 -0
  89. package/dist/prod-next/server/chunks/3387.js +19 -0
  90. package/dist/prod-next/server/chunks/3428.js +32 -0
  91. package/dist/prod-next/server/chunks/3479.js +1 -0
  92. package/dist/prod-next/server/chunks/367.js +115 -0
  93. package/dist/prod-next/server/chunks/3698.js +93 -0
  94. package/dist/prod-next/server/chunks/3709.js +148 -0
  95. package/dist/prod-next/server/chunks/41.js +1 -0
  96. package/dist/prod-next/server/chunks/4107.js +62 -0
  97. package/dist/prod-next/server/chunks/4569.js +34 -0
  98. package/dist/prod-next/server/chunks/{741.js → 4741.js} +1 -1
  99. package/dist/prod-next/server/chunks/4755.js +153 -0
  100. package/dist/prod-next/server/chunks/487.js +1 -0
  101. package/dist/prod-next/server/chunks/5002.js +1 -0
  102. package/dist/prod-next/server/chunks/5112.js +1 -0
  103. package/dist/prod-next/server/chunks/5289.js +8 -0
  104. package/dist/prod-next/server/chunks/5318.js +1 -0
  105. package/dist/prod-next/server/chunks/5452.js +23 -0
  106. package/dist/prod-next/server/chunks/5453.js +1 -0
  107. package/dist/prod-next/server/chunks/5749.js +27 -0
  108. package/dist/prod-next/server/chunks/5782.js +36 -0
  109. package/dist/prod-next/server/chunks/6163.js +104 -0
  110. package/dist/prod-next/server/chunks/6169.js +64 -0
  111. package/dist/prod-next/server/chunks/6208.js +172 -0
  112. package/dist/prod-next/server/chunks/6399.js +24 -0
  113. package/dist/prod-next/server/chunks/6496.js +1 -0
  114. package/dist/prod-next/server/chunks/6823.js +215 -0
  115. package/dist/prod-next/server/chunks/6888.js +1 -0
  116. package/dist/prod-next/server/chunks/6980.js +1 -0
  117. package/dist/prod-next/server/chunks/7245.js +77 -0
  118. package/dist/prod-next/server/chunks/7307.js +1 -0
  119. package/dist/prod-next/server/chunks/7372.js +287 -0
  120. package/dist/prod-next/server/chunks/7384.js +226 -0
  121. package/dist/prod-next/server/chunks/7516.js +1 -0
  122. package/dist/prod-next/server/chunks/7531.js +24 -0
  123. package/dist/prod-next/server/chunks/7591.js +1 -0
  124. package/dist/prod-next/server/chunks/7755.js +138 -0
  125. package/dist/prod-next/server/chunks/7916.js +1 -0
  126. package/dist/prod-next/server/chunks/8078.js +94 -0
  127. package/dist/prod-next/server/chunks/8253.js +41 -0
  128. package/dist/prod-next/server/chunks/8635.js +1 -0
  129. package/dist/prod-next/server/chunks/8688.js +1 -0
  130. package/dist/prod-next/server/chunks/8872.js +1 -0
  131. package/dist/prod-next/server/chunks/9006.js +1 -0
  132. package/dist/prod-next/server/chunks/9018.js +1 -0
  133. package/dist/prod-next/server/chunks/9047.js +1 -0
  134. package/dist/prod-next/server/chunks/9108.js +1 -0
  135. package/dist/prod-next/server/chunks/9280.js +256 -0
  136. package/dist/prod-next/server/chunks/9419.js +1 -0
  137. package/dist/prod-next/server/chunks/9430.js +1 -0
  138. package/dist/prod-next/server/chunks/9586.js +1 -0
  139. package/dist/prod-next/server/chunks/9775.js +1 -0
  140. package/dist/prod-next/server/chunks/992.js +1 -0
  141. package/dist/prod-next/server/chunks/9926.js +1 -0
  142. package/dist/prod-next/server/chunks/9984.js +8 -0
  143. package/dist/prod-next/server/middleware-build-manifest.js +1 -1
  144. package/dist/prod-next/server/middleware-react-loadable-manifest.js +1 -1
  145. package/dist/prod-next/server/pages/404.html +1 -1
  146. package/dist/prod-next/server/pages/500.html +1 -1
  147. package/dist/prod-next/server/server-reference-manifest.js +1 -1
  148. package/dist/prod-next/server/server-reference-manifest.json +1 -1
  149. package/dist/prod-next/server/webpack-runtime.js +1 -1
  150. package/dist/prod-next/static/chunks/1213.e5c6e70a79b5f7e6.js +24 -0
  151. package/dist/prod-next/static/chunks/1519.2f596e5f5af9ef57.js +62 -0
  152. package/dist/prod-next/static/chunks/1759-f5b8fb456f8fb420.js +1 -0
  153. package/dist/prod-next/static/chunks/1974.885c9a133b86d8a4.js +32 -0
  154. package/dist/prod-next/static/chunks/2280.6a7f540787704698.js +1 -0
  155. package/dist/prod-next/static/chunks/2521.7f745f50d30076e7.js +77 -0
  156. package/dist/prod-next/static/chunks/2585.4d6aa847c780c666.js +1 -0
  157. package/dist/prod-next/static/chunks/2589.1aad68c09021b1ac.js +1 -0
  158. package/dist/prod-next/static/chunks/2600.45ba17a0f756fc31.js +1 -0
  159. package/dist/prod-next/static/chunks/2619.9aac8983f30c7c8a.js +1 -0
  160. package/dist/prod-next/static/chunks/26d302b2.9f6383e42abdfe16.js +122 -0
  161. package/dist/prod-next/static/chunks/2768.305914f7900745b6.js +1 -0
  162. package/dist/prod-next/static/chunks/2931.c2acdbf72808b646.js +41 -0
  163. package/dist/prod-next/static/chunks/3012-838f69b72a0dc1b3.js +1 -0
  164. package/dist/prod-next/static/chunks/3016.406e568aa95ff867.js +1 -0
  165. package/dist/prod-next/static/chunks/3022.972047558a20553a.js +172 -0
  166. package/dist/prod-next/static/chunks/3064.3a2a1e7cd4fdca5f.js +1 -0
  167. package/dist/prod-next/static/chunks/3174.03fbed7b7d7a8256.js +1 -0
  168. package/dist/prod-next/static/chunks/3189.b048866768087750.js +1 -0
  169. package/dist/prod-next/static/chunks/3217.1a053843c58b70b5.js +24 -0
  170. package/dist/prod-next/static/chunks/3308.30b95d524f9c1daf.js +74 -0
  171. package/dist/prod-next/static/chunks/331.fc5d78e1e91daf43.js +1 -0
  172. package/dist/prod-next/static/chunks/3510.5d4d1c79533e080c.js +1 -0
  173. package/dist/prod-next/static/chunks/364.ce5400a9dd70b9dc.js +1 -0
  174. package/dist/prod-next/static/chunks/3661-1f08d73aaffb011d.js +1 -0
  175. package/dist/prod-next/static/chunks/370.57cfa27da8567918.js +1 -0
  176. package/dist/prod-next/static/chunks/3789.c418b69121761983.js +1 -0
  177. package/dist/prod-next/static/chunks/3794-c66b3d8325973459.js +32 -0
  178. package/dist/prod-next/static/chunks/3831.25ae62d10dccc27a.js +1 -0
  179. package/dist/prod-next/static/chunks/395.b41e9d76613d37b5.js +90 -0
  180. package/dist/prod-next/static/chunks/3a7aa434.93dbd20997cfd24f.js +82 -0
  181. package/dist/prod-next/static/chunks/4020.3cc19c463c49f969.js +23 -0
  182. package/dist/prod-next/static/chunks/4035.0acc428926d5c8dd.js +1 -0
  183. package/dist/prod-next/static/chunks/405.0902e4f6eb7bd9a2.js +215 -0
  184. package/dist/prod-next/static/chunks/4159.49ae537ff687bdc6.js +138 -0
  185. package/dist/prod-next/static/chunks/4208.384b381ca2757643.js +287 -0
  186. package/dist/prod-next/static/chunks/4263.ffa8d9bd8a0faaae.js +1 -0
  187. package/dist/prod-next/static/chunks/4561.d1a3aaca8bae3224.js +34 -0
  188. package/dist/prod-next/static/chunks/4592.d0f37bc216b9d988.js +93 -0
  189. package/dist/prod-next/static/chunks/4799.0dc7aa21bff2fd2a.js +1 -0
  190. package/dist/prod-next/static/chunks/4bd1b696-e356ca5ba0218e27.js +1 -0
  191. package/dist/prod-next/static/chunks/514.b804c51b26f5e126.js +1 -0
  192. package/dist/prod-next/static/chunks/5270.28592864d38e881c.js +1 -0
  193. package/dist/prod-next/static/chunks/52733464.3870f99cc446f9ff.js +1 -0
  194. package/dist/prod-next/static/chunks/5354.b559c717a607dc5c.js +1 -0
  195. package/dist/prod-next/static/chunks/5448.d3972d9fb464b54f.js +38 -0
  196. package/dist/prod-next/static/chunks/587.d52737d7288c11b4.js +1 -0
  197. package/dist/prod-next/static/chunks/5909.9e37f7b495b11995.js +115 -0
  198. package/dist/prod-next/static/chunks/5949.5504b3545fcc3d34.js +104 -0
  199. package/dist/prod-next/static/chunks/6322-4e97920c006f7933.js +1 -0
  200. package/dist/prod-next/static/chunks/6361.893d04ac34fa1b49.js +148 -0
  201. package/dist/prod-next/static/chunks/6774.8cd53427dbf32cac.js +86 -0
  202. package/dist/prod-next/static/chunks/6968.b80277c724dbc96e.js +1 -0
  203. package/dist/prod-next/static/chunks/7113.4b9e7ea870aa300a.js +8 -0
  204. package/dist/prod-next/static/chunks/7236.55a9728d35f5b8a6.js +1 -0
  205. package/dist/prod-next/static/chunks/7390.dde9b5bc2f6e24b8.js +1 -0
  206. package/dist/prod-next/static/chunks/7806.a903780fcfa3a30e.js +1 -0
  207. package/dist/prod-next/static/chunks/7997.be57e92e583fe635.js +1 -0
  208. package/dist/prod-next/static/chunks/8216.64a72d4d35ea7be0.js +1 -0
  209. package/dist/prod-next/static/chunks/830.5d5274d7ad1cb58e.js +1 -0
  210. package/dist/prod-next/static/chunks/8378.fa91de3406f554c9.js +226 -0
  211. package/dist/prod-next/static/chunks/8501.cd06aa1b0c7e1c6a.js +79 -0
  212. package/dist/prod-next/static/chunks/8663.6ec5792fb4952e45.js +27 -0
  213. package/dist/prod-next/static/chunks/872.96937e758ddce860.js +1 -0
  214. package/dist/prod-next/static/chunks/8803.75bde095fe3613f5.js +1 -0
  215. package/dist/prod-next/static/chunks/8863.72f5dbb820a0e4c3.js +1 -0
  216. package/dist/prod-next/static/chunks/90542734.f7a7b2972ef5a749.js +1 -0
  217. package/dist/prod-next/static/chunks/9379.5bc9c9343ec5a16c.js +64 -0
  218. package/dist/prod-next/static/chunks/9389.906fe7aa9cd6a170.js +1 -0
  219. package/dist/prod-next/static/chunks/9472.8818ee52cfa931a4.js +94 -0
  220. package/dist/prod-next/static/chunks/966.d6babbf8119162cc.js +1 -0
  221. package/dist/prod-next/static/chunks/9884.d4ac1a961b3366f1.js +36 -0
  222. package/dist/prod-next/static/chunks/9909.67cf9940b125243b.js +1 -0
  223. package/dist/prod-next/static/chunks/app/_global-error/page-8be5492b3b872a4c.js +1 -0
  224. package/dist/prod-next/static/chunks/app/_not-found/page-799e445a538b0024.js +1 -0
  225. package/dist/prod-next/static/chunks/app/api/taskmark-reload/route-8be5492b3b872a4c.js +1 -0
  226. package/dist/prod-next/static/chunks/app/board/page-5c181f45738daf1c.js +1 -0
  227. package/dist/prod-next/static/chunks/app/layout-21782e6d13a6f275.js +1 -0
  228. package/dist/prod-next/static/chunks/app/page-51bfe4356fe233e3.js +1 -0
  229. package/dist/prod-next/static/chunks/app/setup/page-3ccfba00c10f9b17.js +1 -0
  230. package/dist/prod-next/static/chunks/d3ac728e.7964f816a1ca64e5.js +1 -0
  231. package/dist/prod-next/static/chunks/e413bedd.3a12a8cb02e28fdf.js +153 -0
  232. package/dist/prod-next/static/chunks/ea233666.f00b64a7d99b4950.js +62 -0
  233. package/dist/prod-next/static/chunks/framework-711ef29bc66f648c.js +1 -0
  234. package/dist/prod-next/static/chunks/main-app-dd26d4f9d120646e.js +1 -0
  235. package/dist/prod-next/static/chunks/{main-bb33c46a9c25dee8.js → main-df4bcaed74f274eb.js} +2 -2
  236. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/app-error-8be5492b3b872a4c.js +1 -0
  237. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/forbidden-8be5492b3b872a4c.js +1 -0
  238. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/global-error-45a0cf77e03361ed.js +1 -0
  239. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/not-found-8be5492b3b872a4c.js +1 -0
  240. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/unauthorized-8be5492b3b872a4c.js +1 -0
  241. package/dist/prod-next/static/chunks/webpack-713747aaa9716c4c.js +1 -0
  242. package/dist/prod-next/static/css/cb78d4b0062d9a3f.css +1 -0
  243. package/dist/public/taskmark-snapshot.json +1 -1
  244. package/lib/taskmark/board-index.ts +101 -0
  245. package/lib/taskmark/build-snapshot.ts +28 -7
  246. package/lib/taskmark/derive-parents.test.ts +23 -0
  247. package/lib/taskmark/derive-parents.ts +323 -0
  248. package/lib/taskmark/detail-load.ts +55 -7
  249. package/lib/taskmark/detail-types.ts +10 -2
  250. package/lib/taskmark/dev-reload-token.ts +1 -1
  251. package/lib/taskmark/discover.ts +4 -7
  252. package/lib/taskmark/epic-types.ts +2 -1
  253. package/lib/taskmark/flat-work-item-types.ts +1 -4
  254. package/lib/taskmark/identity.ts +3 -3
  255. package/lib/taskmark/item-types.ts +2 -1
  256. package/lib/taskmark/list-filters.test.ts +23 -0
  257. package/lib/taskmark/list-filters.ts +7 -2
  258. package/lib/taskmark/list-view-mode.test.ts +45 -0
  259. package/lib/taskmark/list-view-mode.ts +20 -9
  260. package/lib/taskmark/load-changelog.test.ts +32 -0
  261. package/lib/taskmark/load-changelog.ts +18 -0
  262. package/lib/taskmark/overall-tree.test.ts +196 -0
  263. package/lib/taskmark/overall-tree.ts +194 -0
  264. package/lib/taskmark/parse-detail.ts +5 -5
  265. package/lib/taskmark/parse-epics.ts +19 -16
  266. package/lib/taskmark/parse-flat-lists.ts +32 -28
  267. package/lib/taskmark/parse-items.ts +47 -9
  268. package/lib/taskmark/parse-stories.ts +18 -15
  269. package/lib/taskmark/points-calendar.test.ts +72 -0
  270. package/lib/taskmark/points-calendar.ts +86 -0
  271. package/lib/taskmark/project-metrics.ts +11 -7
  272. package/lib/taskmark/snapshot-types.ts +2 -0
  273. package/lib/taskmark/story-types.ts +2 -1
  274. package/lib/taskmark/table-sort.ts +4 -3
  275. package/lib/taskmark/timing.ts +29 -18
  276. package/lib/taskmark/validate.ts +1 -1
  277. package/lib/theme-cookie.test.ts +27 -0
  278. package/lib/theme-cookie.ts +43 -0
  279. package/package.json +3 -1
  280. package/public/taskmark-snapshot.json +1 -1
  281. package/scripts/build-static.mjs +61 -3
  282. package/dist/prod-next/server/app/setup.html +0 -1
  283. package/dist/prod-next/server/app/setup.meta +0 -17
  284. package/dist/prod-next/server/app/setup.rsc +0 -22
  285. package/dist/prod-next/server/app/setup.segments/_full.segment.rsc +0 -22
  286. package/dist/prod-next/server/app/setup.segments/_head.segment.rsc +0 -6
  287. package/dist/prod-next/server/app/setup.segments/_index.segment.rsc +0 -8
  288. package/dist/prod-next/server/app/setup.segments/_tree.segment.rsc +0 -5
  289. package/dist/prod-next/server/app/setup.segments/setup/__PAGE__.segment.rsc +0 -6
  290. package/dist/prod-next/server/app/setup.segments/setup.segment.rsc +0 -5
  291. package/dist/prod-next/server/chunks/318.js +0 -1
  292. package/dist/prod-next/server/chunks/490.js +0 -8
  293. package/dist/prod-next/server/chunks/57.js +0 -19
  294. package/dist/prod-next/server/chunks/616.js +0 -1
  295. package/dist/prod-next/server/chunks/708.js +0 -1
  296. package/dist/prod-next/server/chunks/724.js +0 -1
  297. package/dist/prod-next/static/chunks/4bd1b696-deb4a0a1da1923b0.js +0 -1
  298. package/dist/prod-next/static/chunks/51.e9139a9ea6eb36b9.js +0 -1
  299. package/dist/prod-next/static/chunks/613-6f794154d28bb75a.js +0 -1
  300. package/dist/prod-next/static/chunks/669-8103441c67b185da.js +0 -1
  301. package/dist/prod-next/static/chunks/701-df3ee5f1cf837b1a.js +0 -1
  302. package/dist/prod-next/static/chunks/794-25668765560cb197.js +0 -32
  303. package/dist/prod-next/static/chunks/app/_global-error/page-d34451c04262dd7d.js +0 -1
  304. package/dist/prod-next/static/chunks/app/_not-found/page-0b3785af737e7968.js +0 -1
  305. package/dist/prod-next/static/chunks/app/api/taskmark-reload/route-d34451c04262dd7d.js +0 -1
  306. package/dist/prod-next/static/chunks/app/board/page-cd1d9be0c0127225.js +0 -1
  307. package/dist/prod-next/static/chunks/app/layout-856e8a282e69e7d0.js +0 -1
  308. package/dist/prod-next/static/chunks/app/page-d34451c04262dd7d.js +0 -1
  309. package/dist/prod-next/static/chunks/app/setup/page-c3003359e8becc84.js +0 -1
  310. package/dist/prod-next/static/chunks/framework-b29f9083d3cda3b2.js +0 -1
  311. package/dist/prod-next/static/chunks/main-app-bfb36455d24b3e5a.js +0 -1
  312. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/app-error-d34451c04262dd7d.js +0 -1
  313. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/forbidden-d34451c04262dd7d.js +0 -1
  314. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/global-error-dc53ab29e0491fe4.js +0 -1
  315. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/not-found-d34451c04262dd7d.js +0 -1
  316. package/dist/prod-next/static/chunks/next/dist/client/components/builtin/unauthorized-d34451c04262dd7d.js +0 -1
  317. package/dist/prod-next/static/chunks/webpack-bfe8992962004e2b.js +0 -1
  318. package/dist/prod-next/static/css/2e6ec4c80894e3c0.css +0 -1
  319. /package/dist/prod-next/static/{sAWr5ATVuqk6Wqs18kAWs → EI1zQaa_kQ7DqUSE4o3Qo}/_buildManifest.js +0 -0
  320. /package/dist/prod-next/static/{sAWr5ATVuqk6Wqs18kAWs → EI1zQaa_kQ7DqUSE4o3Qo}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5270],{85270:(t,e,i)=>{i.d(e,{diagram:()=>I});var a=i(31775),n=i(56037),s=i(89851),r=i(33948),l=function(){var t=(0,s.K)(function(t,e,i,a){for(i=i||{},a=t.length;a--;i[t[a]]=e);return i},"o"),e=[1,3],i=[1,4],a=[1,5],n=[1,6],r=[1,7],l=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],o=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[55,56,57],c=[2,36],d=[1,37],u=[1,36],x=[1,38],g=[1,35],f=[1,43],p=[1,41],y=[1,45],T=[1,14],m=[1,23],_=[1,18],q=[1,19],A=[1,20],b=[1,21],k=[1,22],S=[1,24],F=[1,25],P=[1,26],C=[1,27],v=[1,28],L=[1,29],I=[1,32],E=[1,33],D=[1,34],z=[1,39],K=[1,40],U=[1,42],w=[1,44],N=[1,63],R=[1,62],B=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],$=[1,66],W=[1,67],O=[1,68],Q=[1,69],X=[1,70],M=[1,71],Y=[1,72],H=[1,73],j=[1,74],G=[1,75],Z=[1,76],V=[1,77],J=[4,5,6,7,8,9,10,11,12,13,14,15,18],tt=[1,91],te=[1,92],ti=[1,93],ta=[1,100],tn=[1,94],ts=[1,97],tr=[1,95],tl=[1,96],to=[1,98],th=[1,99],tc=[1,103],td=[10,55,56,57],tu=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],tx={trace:(0,s.K)(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:(0,s.K)(function(t,e,i,a,n,s,r){var l=s.length-1;switch(n){case 23:case 68:this.$=s[l];break;case 24:case 69:this.$=s[l-1]+""+s[l];break;case 26:this.$=s[l-1]+s[l];break;case 27:this.$=[s[l].trim()];break;case 28:s[l-2].push(s[l].trim()),this.$=s[l-2];break;case 29:this.$=s[l-4],a.addClass(s[l-2],s[l]);break;case 37:this.$=[];break;case 42:this.$=s[l].trim(),a.setDiagramTitle(this.$);break;case 43:this.$=s[l].trim(),a.setAccTitle(this.$);break;case 44:case 45:this.$=s[l].trim(),a.setAccDescription(this.$);break;case 46:a.addSection(s[l].substr(8)),this.$=s[l].substr(8);break;case 47:a.addPoint(s[l-3],"",s[l-1],s[l],[]);break;case 48:a.addPoint(s[l-4],s[l-3],s[l-1],s[l],[]);break;case 49:a.addPoint(s[l-4],"",s[l-2],s[l-1],s[l]);break;case 50:a.addPoint(s[l-5],s[l-4],s[l-2],s[l-1],s[l]);break;case 51:a.setXAxisLeftText(s[l-2]),a.setXAxisRightText(s[l]);break;case 52:s[l-1].text+=" ⟶ ",a.setXAxisLeftText(s[l-1]);break;case 53:a.setXAxisLeftText(s[l]);break;case 54:a.setYAxisBottomText(s[l-2]),a.setYAxisTopText(s[l]);break;case 55:s[l-1].text+=" ⟶ ",a.setYAxisBottomText(s[l-1]);break;case 56:a.setYAxisBottomText(s[l]);break;case 57:a.setQuadrant1Text(s[l]);break;case 58:a.setQuadrant2Text(s[l]);break;case 59:a.setQuadrant3Text(s[l]);break;case 60:a.setQuadrant4Text(s[l]);break;case 64:case 66:this.$={text:s[l],type:"text"};break;case 65:this.$={text:s[l-1].text+""+s[l],type:s[l-1].type};break;case 67:this.$={text:s[l],type:"markdown"}}},"anonymous"),table:[{18:e,26:1,27:2,28:i,55:a,56:n,57:r},{1:[3]},{18:e,26:8,27:2,28:i,55:a,56:n,57:r},{18:e,26:9,27:2,28:i,55:a,56:n,57:r},t(l,[2,33],{29:10}),t(o,[2,61]),t(o,[2,62]),t(o,[2,63]),{1:[2,30]},{1:[2,31]},t(h,c,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:u,10:x,12:g,13:f,14:p,15:y,18:T,25:m,35:_,37:q,39:A,41:b,42:k,48:S,50:F,51:P,52:C,53:v,54:L,60:I,61:E,63:D,64:z,65:K,66:U,67:w}),t(l,[2,34]),{27:46,55:a,56:n,57:r},t(h,[2,37]),t(h,c,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:u,10:x,12:g,13:f,14:p,15:y,18:T,25:m,35:_,37:q,39:A,41:b,42:k,48:S,50:F,51:P,52:C,53:v,54:L,60:I,61:E,63:D,64:z,65:K,66:U,67:w}),t(h,[2,39]),t(h,[2,40]),t(h,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(h,[2,45]),t(h,[2,46]),{18:[1,51]},{4:d,5:u,10:x,12:g,13:f,14:p,15:y,43:52,58:31,60:I,61:E,63:D,64:z,65:K,66:U,67:w},{4:d,5:u,10:x,12:g,13:f,14:p,15:y,43:53,58:31,60:I,61:E,63:D,64:z,65:K,66:U,67:w},{4:d,5:u,10:x,12:g,13:f,14:p,15:y,43:54,58:31,60:I,61:E,63:D,64:z,65:K,66:U,67:w},{4:d,5:u,10:x,12:g,13:f,14:p,15:y,43:55,58:31,60:I,61:E,63:D,64:z,65:K,66:U,67:w},{4:d,5:u,10:x,12:g,13:f,14:p,15:y,43:56,58:31,60:I,61:E,63:D,64:z,65:K,66:U,67:w},{4:d,5:u,10:x,12:g,13:f,14:p,15:y,43:57,58:31,60:I,61:E,63:D,64:z,65:K,66:U,67:w},{4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,44:[1,58],47:[1,59],58:61,59:60,63:D,64:z,65:K,66:U,67:w},t(B,[2,64]),t(B,[2,66]),t(B,[2,67]),t(B,[2,70]),t(B,[2,71]),t(B,[2,72]),t(B,[2,73]),t(B,[2,74]),t(B,[2,75]),t(B,[2,76]),t(B,[2,77]),t(B,[2,78]),t(B,[2,79]),t(B,[2,80]),t(B,[2,81]),t(l,[2,35]),t(h,[2,38]),t(h,[2,42]),t(h,[2,43]),t(h,[2,44]),{3:65,4:$,5:W,6:O,7:Q,8:X,9:M,10:Y,11:H,12:j,13:G,14:Z,15:V,21:64},t(h,[2,53],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,49:[1,78],63:D,64:z,65:K,66:U,67:w}),t(h,[2,56],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,49:[1,79],63:D,64:z,65:K,66:U,67:w}),t(h,[2,57],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,63:D,64:z,65:K,66:U,67:w}),t(h,[2,58],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,63:D,64:z,65:K,66:U,67:w}),t(h,[2,59],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,63:D,64:z,65:K,66:U,67:w}),t(h,[2,60],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,63:D,64:z,65:K,66:U,67:w}),{45:[1,80]},{44:[1,81]},t(B,[2,65]),t(B,[2,82]),t(B,[2,83]),t(B,[2,84]),{3:83,4:$,5:W,6:O,7:Q,8:X,9:M,10:Y,11:H,12:j,13:G,14:Z,15:V,18:[1,82]},t(J,[2,23]),t(J,[2,1]),t(J,[2,2]),t(J,[2,3]),t(J,[2,4]),t(J,[2,5]),t(J,[2,6]),t(J,[2,7]),t(J,[2,8]),t(J,[2,9]),t(J,[2,10]),t(J,[2,11]),t(J,[2,12]),t(h,[2,52],{58:31,43:84,4:d,5:u,10:x,12:g,13:f,14:p,15:y,60:I,61:E,63:D,64:z,65:K,66:U,67:w}),t(h,[2,55],{58:31,43:85,4:d,5:u,10:x,12:g,13:f,14:p,15:y,60:I,61:E,63:D,64:z,65:K,66:U,67:w}),{46:[1,86]},{45:[1,87]},{4:tt,5:te,6:ti,8:ta,11:tn,13:ts,16:90,17:tr,18:tl,19:to,20:th,22:89,23:88},t(J,[2,24]),t(h,[2,51],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,63:D,64:z,65:K,66:U,67:w}),t(h,[2,54],{59:60,58:61,4:d,5:u,8:N,10:x,12:g,13:f,14:p,15:y,18:R,63:D,64:z,65:K,66:U,67:w}),t(h,[2,47],{22:89,16:90,23:101,4:tt,5:te,6:ti,8:ta,11:tn,13:ts,17:tr,18:tl,19:to,20:th}),{46:[1,102]},t(h,[2,29],{10:tc}),t(td,[2,27],{16:104,4:tt,5:te,6:ti,8:ta,11:tn,13:ts,17:tr,18:tl,19:to,20:th}),t(tu,[2,25]),t(tu,[2,13]),t(tu,[2,14]),t(tu,[2,15]),t(tu,[2,16]),t(tu,[2,17]),t(tu,[2,18]),t(tu,[2,19]),t(tu,[2,20]),t(tu,[2,21]),t(tu,[2,22]),t(h,[2,49],{10:tc}),t(h,[2,48],{22:89,16:90,23:105,4:tt,5:te,6:ti,8:ta,11:tn,13:ts,17:tr,18:tl,19:to,20:th}),{4:tt,5:te,6:ti,8:ta,11:tn,13:ts,16:90,17:tr,18:tl,19:to,20:th,22:106},t(tu,[2,26]),t(h,[2,50],{10:tc}),t(td,[2,28],{16:104,4:tt,5:te,6:ti,8:ta,11:tn,13:ts,17:tr,18:tl,19:to,20:th})],defaultActions:{8:[2,30],9:[2,31]},parseError:(0,s.K)(function(t,e){if(e.recoverable)this.trace(t);else{var i=Error(t);throw i.hash=e,i}},"parseError"),parse:(0,s.K)(function(t){var e=this,i=[0],a=[],n=[null],r=[],l=this.table,o="",h=0,c=0,d=0,u=r.slice.call(arguments,1),x=Object.create(this.lexer),g={};for(var f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(g[f]=this.yy[f]);x.setInput(t,g),g.lexer=x,g.parser=this,void 0===x.yylloc&&(x.yylloc={});var p=x.yylloc;r.push(p);var y=x.options&&x.options.ranges;function T(){var t;return"number"!=typeof(t=a.pop()||x.lex()||1)&&(t instanceof Array&&(t=(a=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof g.parseError?this.parseError=g.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,s.K)(function(t){i.length=i.length-2*t,n.length=n.length-t,r.length=r.length-t},"popStack"),(0,s.K)(T,"lex");for(var m,_,q,A,b,k,S,F,P,C={};;){if(q=i[i.length-1],this.defaultActions[q]?A=this.defaultActions[q]:(null==m&&(m=T()),A=l[q]&&l[q][m]),void 0===A||!A.length||!A[0]){var v="";for(k in P=[],l[q])this.terminals_[k]&&k>2&&P.push("'"+this.terminals_[k]+"'");v=x.showPosition?"Parse error on line "+(h+1)+":\n"+x.showPosition()+"\nExpecting "+P.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(v,{text:x.match,token:this.terminals_[m]||m,line:x.yylineno,loc:p,expected:P})}if(A[0]instanceof Array&&A.length>1)throw Error("Parse Error: multiple actions possible at state: "+q+", token: "+m);switch(A[0]){case 1:i.push(m),n.push(x.yytext),r.push(x.yylloc),i.push(A[1]),m=null,_?(m=_,_=null):(c=x.yyleng,o=x.yytext,h=x.yylineno,p=x.yylloc,d>0&&d--);break;case 2:if(S=this.productions_[A[1]][1],C.$=n[n.length-S],C._$={first_line:r[r.length-(S||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(S||1)].first_column,last_column:r[r.length-1].last_column},y&&(C._$.range=[r[r.length-(S||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply(C,[o,c,h,g,A[1],n,r].concat(u))))return b;S&&(i=i.slice(0,-1*S*2),n=n.slice(0,-1*S),r=r.slice(0,-1*S)),i.push(this.productions_[A[1]][0]),n.push(C.$),r.push(C._$),F=l[i[i.length-2]][i[i.length-1]],i.push(F);break;case 3:return!0}}return!0},"parse")};function tg(){this.yy={}}return tx.lexer={EOF:1,parseError:(0,s.K)(function(t,e){if(this.yy.parser)this.yy.parser.parseError(t,e);else throw Error(t)},"parseError"),setInput:(0,s.K)(function(t,e){return this.yy=e||this.yy||{},this._input=t,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:(0,s.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,s.K)(function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var a=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),i.length-1&&(this.yylineno-=i.length-1);var n=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:i?(i.length===a.length?this.yylloc.first_column:0)+a[a.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:(0,s.K)(function(){return this._more=!0,this},"more"),reject:(0,s.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,s.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,s.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,s.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,s.K)(function(){var t=this.pastInput(),e=Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:(0,s.K)(function(t,e){var i,a,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(a=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack)for(var s in n)this[s]=n[s];return!1},"test_match"),next:(0,s.K)(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,e,i,a,n=this._currentRules(),s=0;s<n.length;s++)if((i=this._input.match(this.rules[n[s]]))&&(!e||i[0].length>e[0].length)){if(e=i,a=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,n[s])))return t;if(!this._backtrack)return!1;e=!1;continue}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[a]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,s.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,s.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,s.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,s.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,s.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,s.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,s.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,s.K)(function(t,e,i,a){switch(i){case 0:case 1:case 3:break;case 2:return 55;case 4:return this.begin("title"),35;case 5:return this.popState(),"title_value";case 6:return this.begin("acc_title"),37;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),39;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 23:case 25:case 31:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 24:this.begin("string");break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;case 29:return this.begin("point_start"),44;case 30:return this.begin("point_x"),45;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;case 34:return 28;case 35:return 4;case 36:return 15;case 37:return 11;case 38:return 64;case 39:return 10;case 40:case 41:return 65;case 42:return 14;case 43:return 13;case 44:return 67;case 45:return 66;case 46:return 12;case 47:return 8;case 48:return 5;case 49:return 18;case 50:return 56;case 51:return 63;case 52:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?:[^\x00-\x7F]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}},(0,s.K)(tg,"Parser"),tg.prototype=tx,tx.Parser=tg,new tg}();l.parser=l;var o=(0,a.P$)(),h=class{constructor(){this.classes=new Map,this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}static{(0,s.K)(this,"QuadrantBuilder")}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:a.UI.quadrantChart?.chartWidth||500,chartWidth:a.UI.quadrantChart?.chartHeight||500,titlePadding:a.UI.quadrantChart?.titlePadding||10,titleFontSize:a.UI.quadrantChart?.titleFontSize||20,quadrantPadding:a.UI.quadrantChart?.quadrantPadding||5,xAxisLabelPadding:a.UI.quadrantChart?.xAxisLabelPadding||5,yAxisLabelPadding:a.UI.quadrantChart?.yAxisLabelPadding||5,xAxisLabelFontSize:a.UI.quadrantChart?.xAxisLabelFontSize||16,yAxisLabelFontSize:a.UI.quadrantChart?.yAxisLabelFontSize||16,quadrantLabelFontSize:a.UI.quadrantChart?.quadrantLabelFontSize||16,quadrantTextTopPadding:a.UI.quadrantChart?.quadrantTextTopPadding||5,pointTextPadding:a.UI.quadrantChart?.pointTextPadding||5,pointLabelFontSize:a.UI.quadrantChart?.pointLabelFontSize||12,pointRadius:a.UI.quadrantChart?.pointRadius||5,xAxisPosition:a.UI.quadrantChart?.xAxisPosition||"top",yAxisPosition:a.UI.quadrantChart?.yAxisPosition||"left",quadrantInternalBorderStrokeWidth:a.UI.quadrantChart?.quadrantInternalBorderStrokeWidth||1,quadrantExternalBorderStrokeWidth:a.UI.quadrantChart?.quadrantExternalBorderStrokeWidth||2}}getDefaultThemeConfig(){return{quadrant1Fill:o.quadrant1Fill,quadrant2Fill:o.quadrant2Fill,quadrant3Fill:o.quadrant3Fill,quadrant4Fill:o.quadrant4Fill,quadrant1TextFill:o.quadrant1TextFill,quadrant2TextFill:o.quadrant2TextFill,quadrant3TextFill:o.quadrant3TextFill,quadrant4TextFill:o.quadrant4TextFill,quadrantPointFill:o.quadrantPointFill,quadrantPointTextFill:o.quadrantPointTextFill,quadrantXAxisTextFill:o.quadrantXAxisTextFill,quadrantYAxisTextFill:o.quadrantYAxisTextFill,quadrantTitleFill:o.quadrantTitleFill,quadrantInternalBorderStrokeFill:o.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:o.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,n.R.info("clear called")}setData(t){this.data={...this.data,...t}}addPoints(t){this.data.points=[...t,...this.data.points]}addClass(t,e){this.classes.set(t,e)}setConfig(t){n.R.trace("setConfig called with: ",t),this.config={...this.config,...t}}setThemeConfig(t){n.R.trace("setThemeConfig called with: ",t),this.themeConfig={...this.themeConfig,...t}}calculateSpace(t,e,i,a){let n=2*this.config.xAxisLabelPadding+this.config.xAxisLabelFontSize,s={top:"top"===t&&e?n:0,bottom:"bottom"===t&&e?n:0},r=2*this.config.yAxisLabelPadding+this.config.yAxisLabelFontSize,l={left:"left"===this.config.yAxisPosition&&i?r:0,right:"right"===this.config.yAxisPosition&&i?r:0},o=this.config.titleFontSize+2*this.config.titlePadding,h={top:a?o:0},c=this.config.quadrantPadding+l.left,d=this.config.quadrantPadding+s.top+h.top,u=this.config.chartWidth-2*this.config.quadrantPadding-l.left-l.right,x=this.config.chartHeight-2*this.config.quadrantPadding-s.top-s.bottom-h.top;return{xAxisSpace:s,yAxisSpace:l,titleSpace:h,quadrantSpace:{quadrantLeft:c,quadrantTop:d,quadrantWidth:u,quadrantHalfWidth:u/2,quadrantHeight:x,quadrantHalfHeight:x/2}}}getAxisLabels(t,e,i,a){let{quadrantSpace:n,titleSpace:s}=a,{quadrantHalfHeight:r,quadrantHeight:l,quadrantLeft:o,quadrantHalfWidth:h,quadrantTop:c,quadrantWidth:d}=n,u=!!this.data.xAxisRightText,x=!!this.data.yAxisTopText,g=[];return this.data.xAxisLeftText&&e&&g.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:o+(u?h/2:0),y:"top"===t?this.config.xAxisLabelPadding+s.top:this.config.xAxisLabelPadding+c+l+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:u?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&e&&g.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:o+h+(u?h/2:0),y:"top"===t?this.config.xAxisLabelPadding+s.top:this.config.xAxisLabelPadding+c+l+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:u?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&i&&g.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:"left"===this.config.yAxisPosition?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+o+d+this.config.quadrantPadding,y:c+l-(x?r/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:x?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&i&&g.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:"left"===this.config.yAxisPosition?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+o+d+this.config.quadrantPadding,y:c+r-(x?r/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:x?"center":"left",horizontalPos:"top",rotation:-90}),g}getQuadrants(t){let{quadrantSpace:e}=t,{quadrantHalfHeight:i,quadrantLeft:a,quadrantHalfWidth:n,quadrantTop:s}=e,r=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:a+n,y:s,width:n,height:i,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:a,y:s,width:n,height:i,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:a,y:s+i,width:n,height:i,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:a+n,y:s+i,width:n,height:i,fill:this.themeConfig.quadrant4Fill}];for(let t of r)t.text.x=t.x+t.width/2,0===this.data.points.length?(t.text.y=t.y+t.height/2,t.text.horizontalPos="middle"):(t.text.y=t.y+this.config.quadrantTextTopPadding,t.text.horizontalPos="top");return r}getQuadrantPoints(t){let{quadrantSpace:e}=t,{quadrantHeight:i,quadrantLeft:a,quadrantTop:n,quadrantWidth:s}=e,l=(0,r.m4Y)().domain([0,1]).range([a,s+a]),o=(0,r.m4Y)().domain([0,1]).range([i+n,n]);return this.data.points.map(t=>{let e=this.classes.get(t.className);return e&&(t={...e,...t}),{x:l(t.x),y:o(t.y),fill:t.color??this.themeConfig.quadrantPointFill,radius:t.radius??this.config.pointRadius,text:{text:t.text,fill:this.themeConfig.quadrantPointTextFill,x:l(t.x),y:o(t.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:t.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:t.strokeWidth??"0px"}})}getBorders(t){let e=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:i}=t,{quadrantHalfHeight:a,quadrantHeight:n,quadrantLeft:s,quadrantHalfWidth:r,quadrantTop:l,quadrantWidth:o}=i;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s-e,y1:l,x2:s+o+e,y2:l},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s+o,y1:l+e,x2:s+o,y2:l+n-e},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s-e,y1:l+n,x2:s+o+e,y2:l+n},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s,y1:l+e,x2:s,y2:l+n-e},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:s+r,y1:l+e,x2:s+r,y2:l+n-e},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:s+e,y1:l+a,x2:s+o-e,y2:l+a}]}getTitle(t){if(t)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){let t=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),e=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),i=this.config.showTitle&&!!this.data.titleText,a=this.data.points.length>0?"bottom":this.config.xAxisPosition,n=this.calculateSpace(a,t,e,i);return{points:this.getQuadrantPoints(n),quadrants:this.getQuadrants(n),axisLabels:this.getAxisLabels(a,t,e,n),borderLines:this.getBorders(n),title:this.getTitle(i)}}},c=class extends Error{static{(0,s.K)(this,"InvalidStyleError")}constructor(t,e,i){super(`value for ${t} ${e} is invalid, please use a valid ${i}`),this.name="InvalidStyleError"}};function d(t){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t)}function u(t){return!/^\d+$/.test(t)}function x(t){return!/^\d+px$/.test(t)}function g(t){return(0,a.jZ)(t.trim(),(0,a.D7)())}(0,s.K)(d,"validateHexCode"),(0,s.K)(u,"validateNumber"),(0,s.K)(x,"validateSizeInPixels"),(0,s.K)(g,"textSanitizer");var f=new h;function p(t){f.setData({quadrant1Text:g(t.text)})}function y(t){f.setData({quadrant2Text:g(t.text)})}function T(t){f.setData({quadrant3Text:g(t.text)})}function m(t){f.setData({quadrant4Text:g(t.text)})}function _(t){f.setData({xAxisLeftText:g(t.text)})}function q(t){f.setData({xAxisRightText:g(t.text)})}function A(t){f.setData({yAxisTopText:g(t.text)})}function b(t){f.setData({yAxisBottomText:g(t.text)})}function k(t){let e={};for(let i of t){let[t,a]=i.trim().split(/\s*:\s*/);if("radius"===t){if(u(a))throw new c(t,a,"number");e.radius=parseInt(a)}else if("color"===t){if(d(a))throw new c(t,a,"hex code");e.color=a}else if("stroke-color"===t){if(d(a))throw new c(t,a,"hex code");e.strokeColor=a}else if("stroke-width"===t){if(x(a))throw new c(t,a,"number of pixels (eg. 10px)");e.strokeWidth=a}else throw Error(`style named ${t} is not supported.`)}return e}function S(t,e,i,a,n){let s=k(n);f.addPoints([{x:i,y:a,text:g(t.text),className:e,...s}])}function F(t,e){f.addClass(t,k(e))}function P(t){f.setConfig({chartWidth:t})}function C(t){f.setConfig({chartHeight:t})}function v(){let{themeVariables:t,quadrantChart:e}=(0,a.D7)();return e&&f.setConfig(e),f.setThemeConfig({quadrant1Fill:t.quadrant1Fill,quadrant2Fill:t.quadrant2Fill,quadrant3Fill:t.quadrant3Fill,quadrant4Fill:t.quadrant4Fill,quadrant1TextFill:t.quadrant1TextFill,quadrant2TextFill:t.quadrant2TextFill,quadrant3TextFill:t.quadrant3TextFill,quadrant4TextFill:t.quadrant4TextFill,quadrantPointFill:t.quadrantPointFill,quadrantPointTextFill:t.quadrantPointTextFill,quadrantXAxisTextFill:t.quadrantXAxisTextFill,quadrantYAxisTextFill:t.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:t.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:t.quadrantInternalBorderStrokeFill,quadrantTitleFill:t.quadrantTitleFill}),f.setData({titleText:(0,a.ab)()}),f.build()}(0,s.K)(p,"setQuadrant1Text"),(0,s.K)(y,"setQuadrant2Text"),(0,s.K)(T,"setQuadrant3Text"),(0,s.K)(m,"setQuadrant4Text"),(0,s.K)(_,"setXAxisLeftText"),(0,s.K)(q,"setXAxisRightText"),(0,s.K)(A,"setYAxisTopText"),(0,s.K)(b,"setYAxisBottomText"),(0,s.K)(k,"parseStyles"),(0,s.K)(S,"addPoint"),(0,s.K)(F,"addClass"),(0,s.K)(P,"setWidth"),(0,s.K)(C,"setHeight"),(0,s.K)(v,"getQuadrantData");var L={setWidth:P,setHeight:C,setQuadrant1Text:p,setQuadrant2Text:y,setQuadrant3Text:T,setQuadrant4Text:m,setXAxisLeftText:_,setXAxisRightText:q,setYAxisTopText:A,setYAxisBottomText:b,parseStyles:k,addPoint:S,addClass:F,getQuadrantData:v,clear:(0,s.K)(function(){f.clear(),(0,a.IU)()},"clear"),setAccTitle:a.SV,getAccTitle:a.iN,setDiagramTitle:a.ke,getDiagramTitle:a.ab,getAccDescription:a.m7,setAccDescription:a.EI},I={parser:l,db:L,renderer:{draw:(0,s.K)((t,e,i,l)=>{let o;function h(t){return"top"===t?"hanging":"middle"}function c(t){return"left"===t?"start":"middle"}function d(t){return`translate(${t.x}, ${t.y}) rotate(${t.rotation||0})`}(0,s.K)(h,"getDominantBaseLine"),(0,s.K)(c,"getTextAnchor"),(0,s.K)(d,"getTransformation");let u=(0,a.D7)();n.R.debug("Rendering quadrant chart\n"+t);let x=u.securityLevel;"sandbox"===x&&(o=(0,r.Ltv)("#i"+e));let g=("sandbox"===x?(0,r.Ltv)(o.nodes()[0].contentDocument.body):(0,r.Ltv)("body")).select(`[id="${e}"]`),f=g.append("g").attr("class","main"),p=u.quadrantChart?.chartWidth??500,y=u.quadrantChart?.chartHeight??500;(0,a.a$)(g,y,p,u.quadrantChart?.useMaxWidth??!0),g.attr("viewBox","0 0 "+p+" "+y),l.db.setHeight(y),l.db.setWidth(p);let T=l.db.getQuadrantData(),m=f.append("g").attr("class","quadrants"),_=f.append("g").attr("class","border"),q=f.append("g").attr("class","data-points"),A=f.append("g").attr("class","labels"),b=f.append("g").attr("class","title");T.title&&b.append("text").attr("x",0).attr("y",0).attr("fill",T.title.fill).attr("font-size",T.title.fontSize).attr("dominant-baseline",h(T.title.horizontalPos)).attr("text-anchor",c(T.title.verticalPos)).attr("transform",d(T.title)).text(T.title.text),T.borderLines&&_.selectAll("line").data(T.borderLines).enter().append("line").attr("x1",t=>t.x1).attr("y1",t=>t.y1).attr("x2",t=>t.x2).attr("y2",t=>t.y2).style("stroke",t=>t.strokeFill).style("stroke-width",t=>t.strokeWidth);let k=m.selectAll("g.quadrant").data(T.quadrants).enter().append("g").attr("class","quadrant");k.append("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",t=>t.width).attr("height",t=>t.height).attr("fill",t=>t.fill),k.append("text").attr("x",0).attr("y",0).attr("fill",t=>t.text.fill).attr("font-size",t=>t.text.fontSize).attr("dominant-baseline",t=>h(t.text.horizontalPos)).attr("text-anchor",t=>c(t.text.verticalPos)).attr("transform",t=>d(t.text)).text(t=>t.text.text),A.selectAll("g.label").data(T.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(t=>t.text).attr("fill",t=>t.fill).attr("font-size",t=>t.fontSize).attr("dominant-baseline",t=>h(t.horizontalPos)).attr("text-anchor",t=>c(t.verticalPos)).attr("transform",t=>d(t));let S=q.selectAll("g.data-point").data(T.points).enter().append("g").attr("class","data-point");S.append("circle").attr("cx",t=>t.x).attr("cy",t=>t.y).attr("r",t=>t.radius).attr("fill",t=>t.fill).attr("stroke",t=>t.strokeColor).attr("stroke-width",t=>t.strokeWidth),S.append("text").attr("x",0).attr("y",0).text(t=>t.text.text).attr("fill",t=>t.text.fill).attr("font-size",t=>t.text.fontSize).attr("dominant-baseline",t=>h(t.text.horizontalPos)).attr("text-anchor",t=>c(t.text.verticalPos)).attr("transform",t=>d(t.text))},"draw")},styles:(0,s.K)(()=>"","styles")}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1695],{58070:(e,t,n)=>{n.r(t),n.d(t,{render:()=>ns});var r=n(31595);n(33604);var o=n(78706);n(6741),n(60703),n(10969),n(69123),n(2401),n(52691),n(31775);var l=n(56037),i=n(89851),a=n(92619).Buffer;function s(e){let t=[];for(let n=0;n<e.length-1;n++)t.push({a:e[n],b:e[n+1]});return t}function f(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=r.x-n.x,a=r.y-n.y,s=o*a-l*i;if(0===s)return null;let f=n.x-e.x,d=n.y-e.y,u=(f*a-d*i)/s,h=(f*l-d*o)/s;return u<=1e-6||u>=.999999||h<=1e-6||h>=.999999?null:{point:{x:e.x+u*o,y:e.y+u*l},tA:u,tB:h}}function d(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function u(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=s(r.points);for(let l=n+1;l<e.length;l++){let n=e[l],i=s(n.points);for(let[e,l]of o.entries())for(let[o,a]of i.entries()){let i=f(l.a,l.b,a.a,a.b);if(!i)continue;let s=d(l);s!==d(a)&&s?t.push({jumpEdgeId:r.id,otherEdgeId:n.id,segIndex:e,t:i.tA,point:i.point}):t.push({jumpEdgeId:n.id,otherEdgeId:r.id,segIndex:o,t:i.tB,point:i.point})}}}return t}function h(e){let t=Math.round(1e3*e)/1e3;return Number.isInteger(t),`${t}`}function g(e){return`${h(e.x)},${h(e.y)}`}function c(e){let t=e.b.x-e.a.x,n=e.b.y-e.a.y;return Math.abs(t)>=Math.abs(n)?+(t>=0):+(n>=0)}function p(e,t){if(e.length<2)return e.map(e=>({...e}));let n=e.map(e=>({...e})),r=t.arrowTypeStart&&o.hq[t.arrowTypeStart];if(r){let t=e[0],o=e[1],l=Math.atan2(o.y-t.y,o.x-t.x);n[0].x=t.x+r*Math.cos(l),n[0].y=t.y+r*Math.sin(l)}let l=t.arrowTypeEnd&&o.hq[t.arrowTypeEnd];if(l){let t=e.length,r=e[t-2],o=e[t-1],i=Math.atan2(o.y-r.y,o.x-r.x);n[t-1].x=o.x-l*Math.cos(i),n[t-1].y=o.y-l*Math.sin(i)}return n}function x(e,t,n,r,o){let l=e.point.x,i=e.point.y,a={x:l-t*e.r,y:i-n*e.r},s={x:l+t*e.r,y:i+n*e.r},f=[`L${g(a)}`];return"arc"===o?f.push(`A${h(e.r)},${h(e.r)} 0 0 ${r} ${g(s)}`):f.push(`M${g(s)}`),f}function m(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=n.x-t.x,a=n.y-t.y,s=Math.hypot(o,l),f=Math.hypot(i,a);if(s<1e-5||f<1e-5)return null;let d=o/s,u=l/s,h=i/f,g=a/f,c=Math.acos(Math.max(-1,Math.min(1,d*h+u*g)));if(c<1e-5||1e-5>Math.abs(Math.PI-c))return null;let p=Math.min(r/Math.sin(c/2),s/2,f/2);return{startX:t.x-d*p,startY:t.y-u*p,endX:t.x+h*p,endY:t.y+g*p,ctrlX:t.x,ctrlY:t.y,cutLen:p}}function y(e,t,n){let r=e.points;if(r.length<2)return"";let o=p(r,e),l="rounded"===e.curve,i=s(o),a=new Map;for(let e of t){let t=i[e.segIndex];if(!t)continue;let r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),o=a.get(e.segIndex)??[];o.push({t:e.t,point:e.point,d:e.t*r,r:n.jumpRadius}),a.set(e.segIndex,o)}let f=[`M${g(o[0])}`];for(let e=0;e<i.length;e++){let t=i[e],r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),s=0===r?0:(t.b.x-t.a.x)/r,d=0===r?0:(t.b.y-t.a.y)/r,u=c(t),p=0;if(l&&e>0){let t=m(o[e-1],o[e],o[e+1]??o[e],5);t&&(p=t.cutLen)}let y=r,b=null;l&&e<i.length-1&&(b=m(o[e],o[e+1],o[e+2]??o[e+1],5))&&(y=r-b.cutLen);let M=[...a.get(e)??[]].sort((e,t)=>e.t-t.t);for(let e of M)e.r=Math.min(e.r,e.d-p,y-e.d);for(let e=0;e<M.length-1;e++){let t=M[e+1].d-M[e].d;if(M[e].r+M[e+1].r>t){let n=t/2;M[e].r=Math.min(M[e].r,n),M[e+1].r=Math.min(M[e+1].r,n)}}for(let e of M)e.r<.001||f.push(...x(e,s,d,u,n.jumpStyle));l&&b?(f.push(`L${h(b.startX)},${h(b.startY)}`),f.push(`Q${h(b.ctrlX)},${h(b.ctrlY)} ${h(b.endX)},${h(b.endY)}`)):f.push(`L${g(t.b)}`)}return f.join(" ")}function b(e){return/^[\d\s+,.LMelm-]*$/.test(e)}function M(e){return!e||"linear"===e||"rounded"===e||"step"===e||"stepBefore"===e||"stepAfter"===e}function K(e){if(!e)return null;try{let t="function"==typeof atob?atob(e):a.from(e,"base64").toString(),n=JSON.parse(t);if(!Array.isArray(n))return null;let r=[];for(let e of n)e&&"number"==typeof e.x&&"number"==typeof e.y&&r.push({x:e.x,y:e.y});return r.length>=2?r:null}catch{return null}}function I(e,t,n){if(!n.enabled)return;let r=e.node();if(!r)return;let o=new Map;for(let e of t)o.set(e.id,e);let l=[],i=new Map;for(let e of t){let t="u">typeof CSS&&CSS.escape?CSS.escape(e.id):e.id,n=r.querySelector(`path[data-id="${t}"]`);if(!n)continue;i.set(e.id,n);let o=K(n.getAttribute("data-points"))??e.points;l.push({...e,points:o})}let a=u(l);if(0===a.length)return;let s=new Map;for(let e of a){let t=s.get(e.jumpEdgeId)??[];t.push(e),s.set(e.jumpEdgeId,t)}for(let e of l){let t=s.get(e.id);if(!t||0===t.length)continue;let r=o.get(e.id),l=r?.curve;if(void 0!==l&&!M(l))continue;let a=i.get(e.id);if(!a||void 0===l&&!b(a.getAttribute("d")??""))continue;let f=a.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),u=d?Number.parseFloat(d[1]):null,h=d?Number.parseFloat(d[2]):null,g=y(e,t,n);if(a.setAttribute("d",g),null!==u&&null!==h&&"function"==typeof a.getTotalLength){let e=Math.max(0,a.getTotalLength()-u-h),t=`0 ${u} ${e} ${h}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${t};`).replace(/;\s*;+/g,";");a.setAttribute("style",n)}}}function w(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(!1===n)return;let r=e.edges.filter(e=>Array.isArray(e.points)&&e.points.length>=2).map(e=>({id:e.id,points:e.points,curve:e.curve,arrowTypeStart:e.arrowTypeStart,arrowTypeEnd:e.arrowTypeEnd}));I(t.groups.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:"gap"===n?"gap":"arc"})}(0,i.K)(s,"buildSegmentList"),(0,i.K)(f,"segmentIntersection"),(0,i.K)(d,"isHorizontalSeg"),(0,i.K)(u,"findEdgeIntersections"),(0,i.K)(h,"fmt"),(0,i.K)(g,"pointToString"),(0,i.K)(c,"getArcSweepFlag"),(0,i.K)(p,"applyMarkerOffsets"),(0,i.K)(x,"emitJump"),(0,i.K)(m,"computeRoundedCorner"),(0,i.K)(y,"rewriteEdgePath"),(0,i.K)(b,"isStraightPath"),(0,i.K)(M,"curveSupportsLineHops"),(0,i.K)(K,"decodeDataPoints"),(0,i.K)(I,"applyLineJumpsToSvg"),(0,i.K)(w,"applySwimlaneLineJumps");var S="__swimlane_default__";function v(e){return Math.max(e.padding??20,20)}function C(e){let{x:t,y:n,width:r,height:o}=e,l=e.swimlaneContentTop;if("number"!=typeof t||"number"!=typeof n||"number"!=typeof r||"number"!=typeof o||"number"!=typeof l||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(l)||r<=0||o<=0)return void delete e.groupTitleRect;let i=n-o/2,a=Math.min(21,Math.max(0,Math.min(l,n+o/2)-i)),s=i+a;s<=i?delete e.groupTitleRect:e.groupTitleRect={left:t-r/2,right:t+r/2,top:i,bottom:s}}function L(e){let t=e.direction,n=e.nodes??=[];for(let n of e.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",t&&(n.direction=t));let r=n.filter(e=>!e.isGroup&&!e.parentId);if(0===r.length)return;let o=n.find(e=>e.id===S);for(let e of(o?o.isGroup&&(o.shape="swimlane",t&&(o.direction=t)):(o={id:S,label:"",isGroup:!0,shape:"swimlane",padding:20,...t?{direction:t}:{}},n.push(o)),r))e.parentId=S}function k(e){let t=new Map;for(let n of e.nodes??[])t.set(n.id,n);let n=[];for(let t of e.edges??[]){let e="string"==typeof t.start?t.start:void 0,r="string"==typeof t.end?t.end:void 0;e&&r&&(t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t}))}let r=e.nodes??[],o=r.filter(e=>e.isGroup),l=r.filter(e=>!e.isGroup);return{nodes:[...[...o].reverse(),...l].map(e=>e.id),edges:n,layout:e,nodeById:t}}function $(e,t,n,r){let{layout:o}=e,l=e.nodeById,i=r?.layerGap??100,a=r?.nodeGap??40,s=0;for(let e of t.layers){let t=0;for(let r of e){let e=l.get(r);if(!e){t++;continue}e.layer=s,e.order=t;let o=n.x[r]??t*a,f=n.y[r]??s*i;e.x=o,e.y=f,t++}s++}let f=o.nodes??[],d=new Map,u=[];for(let e of f){if(!e?.isGroup)continue;e.parentId||u.push(e);let t=f.filter(t=>t.parentId===e.id),r=1/0,o=-1/0,l=1/0,i=-1/0;for(let e of t){let t=e.x??n.x[e.id],a=e.y??n.y[e.id],s=e.width??0,f=e.height??0;null!=t&&null!=a&&(r=Math.min(r,t-s/2),o=Math.max(o,t+s/2),l=Math.min(l,a-f/2),i=Math.max(i,a+f/2))}if(r===1/0||l===1/0)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=Math.max(0,o-r)+(e.parentId?t:2*v(e)),a=Math.max(0,i-l)+t,s=(l+i)/2;e.x=(r+o)/2,e.y=s,e.width=n,e.height=a,d.set(e.id,{minX:r,maxX:o,minY:l,maxY:i})}}if(u.length>0&&d.size>0){let e=1/0,t=-1/0,n=0;for(let r of u){let o=r.padding??20;o>n&&(n=o);let l=d.get(r.id);l&&(e=Math.min(e,l.minY),t=Math.max(t,l.maxY))}if(e!==1/0&&t!==-1/0){let r=Math.max(0,t-e)+2*Math.max(n,36),o=(e+t)/2;for(let t of u)t.y=o,t.height=r,t.swimlaneContentTop=e;let l=[...u].sort((e,t)=>(e.x??0)-(t.x??0)),i=[],a=[],s=[];for(let e of l){let t=d.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*v(e),r=(t.minX+t.maxX)/2;i.push(e.id),a.push(r),s.push(n)}let f=i.length;if(f>0){let e=new Map;if(1===f)e.set(i[0],s[0]);else{let t=[];for(let e=0;e<f-1;e++)t.push(a[e+1]-a[e]);let n=Array(f);n[0]=0;for(let e=0;e<f-1;e++)n[e+1]=2*t[e]-n[e];let r=0,o=1/0;for(let e=0;e<f;e++){let t=s[e];e%2==0?r=Math.max(r,t-n[e]):o=Math.min(o,n[e]-t)}let l=r;l=r<=o?(r+o)/2:r;for(let t=0;t<f;t++){let r=n[t]+(t%2==0?l:-l),o=Math.max(s[t],r);e.set(i[t],o)}}for(let t of u){let n=e.get(t.id);null!=n&&(t.width=n),C(t)}}}}}function R(e){let t=[],n=[],r=new Map;for(let t of e.nodes)r.set(t.id,t);for(let o of e.edges){if(!o.label||0===o.label.length||o.isLayoutOnly||o.labelNodeId)continue;let e=o.start?r.get(o.start):void 0,i=o.end?r.get(o.end):void 0;if(!e||!i){l.R.warn("[EdgeLabelNodes]",`Edge ${o.id} has missing source or target node`);continue}let a=`edge-label-${o.start}-${o.end}-${o.id}`,s=e.parentId!==i.parentId?i.parentId:e.parentId,f={id:a,label:o.label,edgeStart:o.start??"",edgeEnd:o.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:s,isGroup:!1,labelStyle:Array.isArray(o.labelStyle)?o.labelStyle[0]:o.labelStyle??"",...e.dir?{dir:e.dir}:{}};t.push(f),o.labelNodeId=a,o.label=void 0,o.text=void 0;let d={id:`${o.id}-to-label`,start:o.start,end:a,type:"normal",isLayoutOnly:!0},u={id:`${o.id}-from-label`,start:a,end:o.end,type:"normal",isLayoutOnly:!0};n.push(d,u)}let o=[...e.nodes,...t],i=[...e.edges,...n];return{...e,nodes:o,edges:i}}function O(e){let t=e.x??0,n=e.y??0,r=e.width??0,o=e.height??0;return r>0&&o>0?{cx:t,cy:n,rect:q(t,n,r,o)}:void 0}function T(e){if(e.isGroup)return;let t=O(e);if(t)return{id:String(e.id??""),cx:t.cx,cy:t.cy,rect:t.rect}}function F(e,t,n=.001){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function E(e,t,n=.001){return Math.abs(e.x-t.x)<n}function B(e,t,n=.001){return Math.abs(e.y-t.y)<n}function N(e,t,n=.001){return B(e,t,n)&&Math.abs(e.x-t.x)>n}function X(e,t,n=.001){return E(e,t,n)&&Math.abs(e.y-t.y)>n}function z(e,t,n,r){return Math.max(0,Math.min(Math.max(e,t),Math.max(n,r))-Math.max(Math.min(e,t),Math.min(n,r)))}function Y(e,t,n=.001){return e.horizontal&&t.horizontal&&B(e.a,t.a,n)?z(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&E(e.a,t.a,n)?z(e.a.y,e.b.y,t.a.y,t.b.y):0}function A(e,t=.001){let n=[];for(let r=0;r<e.length-1;r++){let o=e[r],l=e[r+1],i=N(o,l,t),a=X(o,l,t);(i||a)&&n.push({index:r,a:o,b:l,horizontal:i,vertical:a})}return n}function G(e,t=.001){let n=A(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}function D(e,t=.001){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;e&&F(e,r,t)||n.push({x:r.x,y:r.y})}return n}function P(e,t=.001){if(!e||4!==e.length)return;let[n,r,o,l]=e;return N(n,r,t)&&X(r,o,t)&&N(o,l,t)?{kind:"HVH",p0:n,p1:r,p2:o,p3:l}:X(n,r,t)&&N(r,o,t)&&X(o,l,t)?{kind:"VHV",p0:n,p1:r,p2:o,p3:l}:void 0}function H(e,t,n,r=0){let o=Math.min(e.x,t.x),l=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return l>n.left-r&&o<n.right+r&&a>n.top-r&&i<n.bottom+r}function j(e,t,n=0){return e.x>t.left+n&&e.x<t.right-n&&e.y>t.top+n&&e.y<t.bottom-n}function _(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function V(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function W(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function q(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}function J(e){return O(e)?.rect}function Q(e,t){switch(t){case"top":return{x:e.cx,y:e.rect.top};case"bottom":return{x:e.cx,y:e.rect.bottom};case"left":return{x:e.rect.left,y:e.cy};case"right":return{x:e.rect.right,y:e.cy}}}function U(e,t,n,r,o,l=.001){let i="left"===t||"right"===t,a="left"===r||"right"===r;if(i&&a){if("right"===t&&"left"===r&&e.x<n.x||"left"===t&&"right"===r&&e.x>n.x){if(B(e,n,l))return[e,n];let t=(e.x+n.x)/2;return[e,{x:t,y:e.y},{x:t,y:n.y},n]}if(t===r){if(B(e,n,l))return;let r="left"===t?Math.min(e.x,n.x)-o:Math.max(e.x,n.x)+o;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!i&&!a){if(t===r){if(E(e,n,l))return;let r="top"===t?Math.min(e.y,n.y)-o:Math.max(e.y,n.y)+o;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!("bottom"===t&&"top"===r&&e.y<n.y||"top"===t&&"bottom"===r&&e.y>n.y))return;if(E(e,n,l))return[e,n];let i=(e.y+n.y)/2;return[e,{x:e.x,y:i},{x:n.x,y:i},n]}if(i&&!a){let o="right"===t&&n.x>e.x||"left"===t&&n.x<e.x,l="top"===r&&e.y<n.y||"bottom"===r&&e.y>n.y;return o&&l?[e,{x:n.x,y:e.y},n]:void 0}let s="bottom"===t&&n.y>e.y||"top"===t&&n.y<e.y,f="left"===r&&e.x<n.x||"right"===r&&e.x>n.x;return s&&f?[e,{x:e.x,y:n.y},n]:void 0}function Z(e,t,n,r){return"left"===t||"right"===t?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}function ee(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=T(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}function et(e){let t=[],n=[];for(let r of e){let e=T(r);if(!e)continue;let o={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(o):t.push(o)}return{realNodeRects:t,labelNodeRects:n}}function en(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,o=r.y??0,l=r.width??0,i=r.height??0;n.push({nodeId:r.id,...q(e,o,l,i)})}return n}function er(e,t,n=.001){let r=e.start,o=e.end;if(!r||!o)return;let l=t.get(r),i=t.get(o);if(l&&i)return{srcId:r,dstId:o,srcInfo:l,dstInfo:i,collinearX:Math.abs(l.cx-i.cx)<n,collinearY:Math.abs(l.cy-i.cy)<n}}function eo(e,t,n,r=[],o=0){for(let l of n)if(!r.includes(l.id)&&H(e,t,l.rect,-o))return!0;return!1}function el(e,t,n,r,o=.001,l=1e-6){let i=B(e,t,o),a=E(e,t,o),s=B(n,r,o),f=E(n,r,o);if(i&&s||a&&f||!(i||a)||!(s||f))return!1;let d=i?{a:e,b:t}:{a:n,b:r},u=a?{a:e,b:t}:{a:n,b:r},h=d.a.y,g=Math.min(d.a.x,d.b.x),c=Math.max(d.a.x,d.b.x),p=u.a.x,x=Math.min(u.a.y,u.b.y),m=Math.max(u.a.y,u.b.y);if(p<g||p>c||h<x||h>m)return!1;let y=Math.abs(p-d.a.x)<l&&Math.abs(h-d.a.y)<l||Math.abs(p-d.b.x)<l&&Math.abs(h-d.b.y)<l,b=Math.abs(p-u.a.x)<l&&Math.abs(h-u.a.y)<l||Math.abs(p-u.b.x)<l&&Math.abs(h-u.b.y)<l;return!(y&&b)}function ei(e,t,n,r,o=.001){let l=B(e,t,o),i=E(e,t,o),a=B(n,r,o),s=E(n,r,o);return i&&s&&E(e,n,o)?z(e.y,t.y,n.y,r.y)>o:!!(l&&a&&B(e,n,o))&&z(e.x,t.x,n.x,r.x)>o}function ea(e,t,n,r,{epsilon:o=.001,skipDegenerateOther:l=!1}={}){for(let i of n){if(i===r||i.isLayoutOnly)continue;let n=i.points;if(n&&!(n.length<2))for(let r=0;r<n.length-1;r++){let i=n[r],a=n[r+1];if(!(l&&F(i,a,o))&&(el(e,t,i,a,o)||ei(e,t,i,a,o)))return!0}}return!1}function es(e,t,n,r,o=.001){let l=B(e,t,o),i=E(e,t,o),a=B(n,r,o),s=E(n,r,o);if(!(l&&s||i&&a))return!1;let f=l?{a:e,b:t}:{a:n,b:r},d=l?{a:n,b:r}:{a:e,b:t},u=f.a.y,h=Math.min(f.a.x,f.b.x),g=Math.max(f.a.x,f.b.x),c=d.a.x,p=Math.min(d.a.y,d.b.y),x=Math.max(d.a.y,d.b.y);return c>h+o&&c<g-o&&u>p+o&&u<x-o}function ef(e,t,n){let r=Math.min(t,n),o=Math.max(t,n);return e>r+.001&&e<o-.001}function ed(e,t,n){return E(e,t)&&E(t,n)?ef(t.y,e.y,n.y):!!(B(e,t)&&B(t,n))&&ef(t.x,e.x,n.x)}function eu(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let o=n[n.length-1],l=e[r],i=r+1<e.length?e[r+1]:void 0;if(o&&i){if(F(o,i)){r++,t=!0;continue}if(ed(o,l,i)){t=!0;continue}}n.push(l)}return{points:n,changed:t}}function eh(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],o=e[n];if(!E(r,o)&&!B(r,o)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&E(e,r)?{x:r.x,y:o.y}:{x:o.x,y:r.y};t.push(n)}t.push(o)}let n=[];for(let e of t){let t=n[n.length-1];t&&F(t,e)||n.push(e)}return n}function eg(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=eu(t);if(t=e.points,!e.changed)break}return t}function ec(e,t,n){if(e.isLayoutOnly||!e.points||e.points.length<n)return;let r=e.start?t.get(e.start):void 0,o=e.end?t.get(e.end):void 0;return{edge:e,points:e.points,srcRect:r?J(r):void 0,dstRect:o?J(o):void 0}}function ep(e,t,n){if(B(e,t,.001))return{x:e.x<n.left?n.left:n.right,y:e.y};if(E(e,t,.001)){let t=e.y<n.top?n.top:n.bottom;return{x:e.x,y:t}}return{x:Math.min(n.right,Math.max(n.left,e.x)),y:Math.min(n.bottom,Math.max(n.top,e.y))}}function ex(e,t,n){let r=n?1:-1,o=n?0:e.length-1;for(;o>=0&&o<e.length&&j(e[o],t,.5);)o+=r;if(o<0||o>=e.length)return e;let l=o-r;if(l<0||l>=e.length)return e;let i=ep(e[o],e[l],t);return n?[i,...e.slice(o)]:[...e.slice(0,o+1),i]}function em(e,t){for(let n of e){let e=ec(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=ex(r,e.srcRect,!0)),e.dstRect&&(r=ex(r,e.dstRect,!1)),r=ek(r=eg(eh(r)),e.srcRect,e.dstRect),e.edge.points=eg(eh(r))}}function ey(e,t,n,r=!1){if(B(e,t,.001)){if(t.y<n.top-.001||t.y>n.bottom+.001)return t;if(r){if(e.x<n.left-.001)return{x:n.left,y:e.y};if(e.x>n.right+.001)return{x:n.right,y:e.y}}return{x:Math.abs(t.x-n.left)<=Math.abs(t.x-n.right)?n.left:n.right,y:e.y}}if(E(e,t,.001)){if(t.x<n.left-.001||t.x>n.right+.001)return t;if(r){if(e.y<n.top-.001)return{x:e.x,y:n.top};if(e.y>n.bottom+.001)return{x:e.x,y:n.bottom}}let o=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:o?n.top:n.bottom}}return t}function eb(e,t,n){let r=e[t];for(let o=t+n;o>=0&&o<e.length;o+=n){let t=e[o];if(!F(t,r,.001))return t}return e[t+n]}function eM(e,t){let n=e+4,r=t-4;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}function eK(e,t,n){let{lo:r,hi:o}=eM(t,n);return Math.min(o,Math.max(r,e))}function eI(e){let t=Math.max(...e.map(e=>e.lo)),n=Math.min(...e.map(e=>e.hi));if(!(t>n))return{lo:t,hi:n}}function ew(e,t){return"left"===t||"right"===t?eM(e.top,e.bottom):eM(e.left,e.right)}function eS(e,t,n){let r=e.y>=n.top-.001&&e.y<=n.bottom+.001,o=e.x>=n.left-.001&&e.x<=n.right+.001;if(B(e,t,.001)&&r){if(.001>Math.abs(e.x-n.left))return"left";if(.001>Math.abs(e.x-n.right))return"right"}if(E(e,t,.001)&&o){if(.001>Math.abs(e.y-n.top))return"top";if(.001>Math.abs(e.y-n.bottom))return"bottom"}}function ev(e){return"left"===e||"right"===e}function eC(e,t,n,r,o){let l=[],i=n?eS(e,t,n):void 0,a=r?eS(t,e,r):void 0;return n&&i&&ev(i)===o&&l.push(ew(n,i)),r&&a&&ev(a)===o&&l.push(ew(r,a)),l.length>0?eI(l):void 0}function eL(e,t,n,r,o){let l=eC(e,t,n,r,o);if(!l)return;let i=o?e.y:e.x,a=Math.min(l.hi,Math.max(l.lo,i));if(!(.001>Math.abs(a-i)))return o?[{x:e.x,y:a},{x:t.x,y:a}]:[{x:a,y:e.y},{x:a,y:t.y}]}function ek(e,t,n){if(2!==e.length)return e;let[r,o]=e;return B(r,o,.001)?eL(r,o,t,n,!0)??e:E(r,o,.001)?eL(r,o,t,n,!1)??e:e}function e$(e,t,n){return ev(n)?{x:e.x,y:eK(e.y,t.top,t.bottom)}:{x:eK(e.x,t.left,t.right),y:e.y}}function eR(e,t,n,r,o,l){let i=e.map(e=>({...e}));for(let a=t;a>=0&&a<e.length;a+=n){let t=e[a];if(l&&!B(t,r,.001)||!l&&!E(t,r,.001))break;l?i[a].y=o.y:i[a].x=o.x}return i}function eO(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,o=n?1:-1,l=e[r],i=eb(e,r,o);if(!i)return e;let a=eS(l,i,t);if(!a)return e;let s=ev(a),f=e$(l,t,a);return F(l,f,.001)?e:eR(e,r,o,l,f,s)}function eT(e,t,n){let r=Math.min(e.x,t.x)>=n.left-.001&&Math.max(e.x,t.x)<=n.right+.001,o=Math.min(e.y,t.y)>=n.top-.001&&Math.max(e.y,t.y)<=n.bottom+.001;return .001>Math.abs(e.y-n.top)&&.001>Math.abs(t.y-n.top)&&r?"top":.001>Math.abs(e.y-n.bottom)&&.001>Math.abs(t.y-n.bottom)&&r?"bottom":.001>Math.abs(e.x-n.left)&&.001>Math.abs(t.x-n.left)&&o?"left":.001>Math.abs(e.x-n.right)&&.001>Math.abs(t.x-n.right)&&o?"right":void 0}function eF(e,t,n,r){switch(e){case"top":return E(t,n,.001)&&n.y<r.top-.001;case"bottom":return E(t,n,.001)&&n.y>r.bottom+.001;case"left":return B(t,n,.001)&&n.x<r.left-.001;case"right":return B(t,n,.001)&&n.x>r.right+.001}}function eE(e,t,n){if(e.length<3)return e;if(n){let n=eT(e[0],e[1],t);return n&&eF(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,o=eT(e[r-1],e[r],t);return o&&eF(o,e[r-1],e[r-2],t)?e.slice(0,r):e}function eB(e,t,n){let r=e;if(t){let e=eb(r,0,1);if(e){let n=ey(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=eE(r,t,!0)}if(n){let e=r.length-1,t=eb(r,e,-1);if(t){let o=ey(t,r[e],n,!0);o!==r[e]&&(r=[...r.slice(0,e),o])}r=eE(r,n,!1)}let o=ek(r,t,n);return o!==r||2===r.length?o:(t&&(r=eO(r,t,!0)),n&&(r=eO(r,n,!1)),r)}function eN(e,t){for(let n of e){let e=ec(n,t,2);if(!e)continue;let r=eB(D(e.points,.001),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let o=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=o}}function eX(e){return new Map(e.map(e=>[e.id,e]))}function ez(e,t){let n=e.parentId,r=null;for(;n;){let e=t.get(n);if(!e?.isGroup)break;r=e.id,n=e.parentId}return r}function eY(e,t){let n=0,r=e.parentId;for(;r;){let e=t.get(r);if(!e?.isGroup)break;n++,r=e.parentId}return n}function eA(e){let t=1/0,n=-1/0,r=1/0,o=-1/0;for(let l of e){let e=l.x,i=l.y;if("number"!=typeof e||"number"!=typeof i)continue;let a=l.width??0,s=l.height??0;t=Math.min(t,e-a/2),n=Math.max(n,e+a/2),r=Math.min(r,i-s/2),o=Math.max(o,i+s/2)}return t===1/0||r===1/0?null:{minX:t,maxX:n,minY:r,maxY:o}}function eG(e,t){let n=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+n,e.height=Math.max(0,t.maxY-t.minY)+n}function eD(e){let t=eX(e);for(let n of e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>eY(n,t)-eY(e,t))){let t=eA(e.filter(e=>e.parentId===n.id));t&&eG(n,t)}}function eP(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,a=-1/0;for(let e of o){let n=e[t];"number"==typeof n&&(l=Math.min(l,n),a=Math.max(a,n))}if(!Number.isFinite(l)||!Number.isFinite(a))return!1;let s=(0,i.K)(e=>l+a-e,"mirror");for(let e of n){let n=e[t];"number"==typeof n&&(e[t]=s(n));let r=e.groupTitleRect;r&&(e.groupTitleRect="x"===t?{...r,left:s(r.right),right:s(r.left)}:{...r,top:s(r.bottom),bottom:s(r.top)})}for(let e of r)for(let n of e.points??[])n[t]=s(n[t]);return!0}function eH(e){return!(e.nodes??[]).some(e=>!e.isGroup)||eP(e,"y")}function ej(e,t="LR"){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,i=1/0;for(let e of o){let t=e.x??0,n=e.y??0;t<l&&(l=t),n<i&&(i=n)}if(!Number.isFinite(l)||!Number.isFinite(i))return!1;let a=0,s=0;for(let e of o)a+=e.width??0,s+=e.height??0;let f=a/o.length,d=s/o.length,u=d>0?Math.max(1,f/d):1;for(let e of o){let t=e.x??0,n=((e.y??0)-i)*u+36,r=t-l;e.x=n,e.y=r}for(let e of r)if(e.points)for(let t of e.points){let e=t.x,n=(t.y-i)*u+36,r=e-l;t.x=n,t.y=r}eD(n);let h=n.filter(e=>e.isGroup&&!e.parentId);if(0===h.length)return"RL"===t&&eP(e,"x"),!0;let g=eX(n),c=new Map;for(let e of n){if(e.isGroup)continue;let t=ez(e,g);if(!t)continue;let n=c.get(t)??[];n.push(e),c.set(t,n)}let p=0;for(let e of h){let t=e.padding??0;t>p&&(p=t)}let x=[],m=1/0,y=-1/0;for(let e of h){let t=eA(c.get(e.id)??[]);t&&(m=Math.min(m,t.minX),y=Math.max(y,t.maxX),x.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(m===1/0||y===-1/0)return!0;let b=Math.max(0,y-m)+2*Math.max(p,10),M=36+b,K=(m+y)/2-b/2-36,I=K+M/2,w=Math.max(p,36);x.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<x.length;e++){let t,n,r=x[e];if(t=0===e?r.contentTop-w:(x[e-1].contentBottom+r.contentTop)/2,e===x.length-1)n=r.contentBottom+w;else{let t=x[e+1];n=(r.contentBottom+t.contentTop)/2}let o=Math.max(0,n-t),l=(t+n)/2;r.lane.x=I,r.lane.y=l,r.lane.width=M,r.lane.height=o,r.lane.swimlaneContentTop=r.contentTop,r.lane.groupTitleRect={left:K,right:K+36,top:t,bottom:n}}return"RL"===t&&eP(e,"x"),!0}(0,i.K)(v,"topLaneHorizontalPadding"),(0,i.K)(C,"assignTopLaneTitleRect"),(0,i.K)(L,"prepareLayoutForSwimlanes"),(0,i.K)(k,"toGraphView"),(0,i.K)($,"writeBackToLayoutData"),(0,i.K)(R,"createEdgeLabelNodes"),(0,i.K)(O,"measuredNodeRect"),(0,i.K)(T,"nodeBoundsInfoFor"),(0,i.K)(F,"samePoint"),(0,i.K)(E,"sameX"),(0,i.K)(B,"sameY"),(0,i.K)(N,"isHorizontalSegment"),(0,i.K)(X,"isVerticalSegment"),(0,i.K)(z,"overlapLength"),(0,i.K)(Y,"sameAxisSegmentOverlapLength"),(0,i.K)(A,"orthogonalSegmentsForPoints"),(0,i.K)(G,"countOrthogonalBends"),(0,i.K)(D,"dedupeConsecutivePoints"),(0,i.K)(P,"classifyThreeSegmentRoute"),(0,i.K)(H,"segmentBoundsOverlapRect"),(0,i.K)(j,"pointInsideRect"),(0,i.K)(_,"rectContainsRect"),(0,i.K)(V,"rectsOverlap"),(0,i.K)(W,"inflateRect"),(0,i.K)(q,"rectFromCenterSize"),(0,i.K)(J,"rectOfNodeBounds"),(0,i.K)(Q,"portForRectSide"),(0,i.K)(U,"buildOrthogonalPortPath"),(0,i.K)(Z,"buildSameSideTrackPath"),(0,i.K)(ee,"collectRealNodeBounds"),(0,i.K)(et,"collectNodeRectEntries"),(0,i.K)(en,"collectLayoutNodeRects"),(0,i.K)(er,"getNodePairGeometry"),(0,i.K)(eo,"segmentHitsAnyRect"),(0,i.K)(el,"orthogonalSegmentsCross"),(0,i.K)(ei,"sameAxisSegmentsOverlap"),(0,i.K)(ea,"segmentConflictsWithAnyEdge"),(0,i.K)(es,"orthogonalSegmentsStrictlyCross"),(0,i.K)(ef,"strictlyBetween"),(0,i.K)(ed,"isCollinearIntermediate"),(0,i.K)(eu,"simplifyPolylineOnce"),(0,i.K)(eh,"orthogonalizePolyline"),(0,i.K)(eg,"simplifyPolyline"),(0,i.K)(ec,"endpointContextFor"),(0,i.K)(ep,"segmentEnterPoint"),(0,i.K)(ex,"clipEndpoint"),(0,i.K)(em,"clipEdgeEndpointsToNodeBoundaries"),(0,i.K)(ey,"snapEndpointToBoundary"),(0,i.K)(eb,"firstDistinctAdjacent"),(0,i.K)(eM,"cornerClearanceRange"),(0,i.K)(eK,"clampToCornerClearance"),(0,i.K)(eI,"intersectRanges"),(0,i.K)(ew,"clearanceRangeForSide"),(0,i.K)(eS,"terminalSideForSegment"),(0,i.K)(ev,"isHorizontalSide"),(0,i.K)(eC,"straightClearanceRange"),(0,i.K)(eL,"clearStraightEndpointCornerAxis"),(0,i.K)(ek,"clearStraightEndpointCornerConnections"),(0,i.K)(e$,"cornerClearedEndpoint"),(0,i.K)(eR,"moveCollinearEndpointRun"),(0,i.K)(eO,"clearEndpointCornerConnection"),(0,i.K)(eT,"borderSideForSegment"),(0,i.K)(eF,"leavesOutward"),(0,i.K)(eE,"collapseOwnBorderStub"),(0,i.K)(eB,"snapAndCollapseEndpoints"),(0,i.K)(eN,"prepareEdgeEndpointsForRenderer"),(0,i.K)(eX,"buildNodeMap"),(0,i.K)(ez,"resolveTopLevelGroupId"),(0,i.K)(eY,"groupDepth"),(0,i.K)(eA,"boundsForChildren"),(0,i.K)(eG,"applyGroupBounds"),(0,i.K)(eD,"recomputeNestedGroupBounds"),(0,i.K)(eP,"mirrorAxis"),(0,i.K)(eH,"applyBtDirectionTransform"),(0,i.K)(ej,"applyLrDirectionTransform");var e_=[0,8,-8,16,-16];function eV(e,t){let{nodeInfoById:n,realNodeRects:r}=ee(t);for(let t of e){let o;if(t.isLayoutOnly)continue;let l=t.points;if(!l||l.length<4)continue;let i=P(D(l,1e-6),1e-6);if(!i)continue;let{p3:a}=i,s="HVH"===i.kind,f=er(t,n,1e-6);if(!f)continue;let{srcId:d,dstId:u,srcInfo:h,dstInfo:g,collinearX:c,collinearY:p}=f;if(c||p)continue;let x=h.rect;for(let n of e_){let l,i,f;if(s){let e=g.cy>h.cy?x.bottom:x.top,t=h.cx+n;if(t<=x.left+1e-6||t>=x.right-1e-6)continue;l={x:t,y:e},i={x:t,y:a.y},f={x:a.x,y:a.y}}else{let e=g.cx>h.cx?x.right:x.left,t=h.cy+n;if(t<=x.top+1e-6||t>=x.bottom-1e-6)continue;l={x:e,y:t},i={x:a.x,y:t},f={x:a.x,y:a.y}}let c=F(l,i,1e-6),p=F(i,f,1e-6);if(c&&p||!c&&eo(l,i,r,[d],1)||!p&&eo(i,f,r,[u],1))continue;let m=!c&&ea(l,i,e,t,{epsilon:1e-6,skipDegenerateOther:!0}),y=!p&&ea(i,f,e,t,{epsilon:1e-6,skipDegenerateOther:!0});if(!m&&!y){o=c?[i,f]:p?[l,i]:[l,i,f];break}}o&&(t.points=o)}}function eW(e,t){let{realNodeRects:n,labelNodeRects:r}=et(t.values());for(let o of e){let l,a;if(o.isLayoutOnly)continue;let s=o.points;if(!s||s.length<4)continue;let f=D(s,.001);if(f.length<4)continue;let d=f.length-1,u=f[d],h=f[d-1],g=f[d-2],c=Math.hypot(u.x-h.x,u.y-h.y);if(c>=10||c<.001)continue;let p=h.x-g.x,x=h.y-g.y;if(.001>Math.hypot(p,x))continue;let m=N(h,u,.001),y=X(h,u,.001),b=N(g,h,.001),M=X(g,h,.001);if(!(m&&M||y&&b))continue;let K=o.end,I=o.start,w=K?t.get(K):void 0;if(!w)continue;let S=w.x??0,v=w.y??0,C=J(w);if(!C)continue;if(M){let e=x<0;l={x:S,y:g.y},a={x:S,y:e?C.bottom:C.top}}else{let e=p>0;l={x:g.x,y:v},a={x:e?C.right:C.left,y:v}}if(eo(l,a,n,K?[K]:[],-2)||eo(l,a,r,[],-2))continue;if(I){let e=t.get(I),n=e?J(e):void 0;if(n&&j(l,n,2))continue}let L=(0,i.K)((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,"ownSegmentKey"),k=new Set;for(let e=0;e<f.length-1;e++)k.add(L(f[e],f[e+1]));let $=(0,i.K)((t,n)=>{for(let r of e){if(r===o||r.isLayoutOnly)continue;let e=r.points;if(e&&!(e.length<2))for(let r=0;r<e.length-1;r++){let o=e[r],l=e[r+1];if(!k.has(L(o,l))&&es(t,n,o,l,.001))return!0}}return!1},"segmentCrossesOtherEdge");if($(l,a))continue;if(d-3>=0){let e=f[d-3];if(eo(e,l,n,[I,K].filter(e=>!!e),-2)||$(e,l))continue}let R=[...f.slice(0,d-2),l,a];o.points=R;let O=o.labelNodeId;if(O){let e=t.get(O);if(e){let t=e.width??0,n=e.height??0;if(t>0&&n>0){let r,o,l=-1;for(let e=0;e<R.length-1;e++){let i=R[e],a=R[e+1],s=Math.hypot(a.x-i.x,a.y-i.y),f=B(i,a,.001),d=E(i,a,.001);(f&&s>=t+2||d&&s>=n+2)&&s>l&&(l=s,r=(i.x+a.x)/2,o=(i.y+a.y)/2)}void 0!==r&&void 0!==o&&(e.x=r,e.y=o)}}}}}(0,i.K)(eV,"portSwapToLShape"),(0,i.K)(eW,"collapseShortTerminalStub");var eq=(0,i.K)((e,t)=>E(e,t,.001)||B(e,t,.001),"orthogonallyAligned");function eJ(e,t){let n=(0,i.K)((e,t)=>{let n=e.x??0,r=e.y??0,o=t.x-n,l=t.y-r,i=(e.width??0)/2,a=(e.height??0)/2;return Math.abs(l)*i>Math.abs(o)*a?(l<0&&(a=-a),{x:n+(0===l?0:a*o/l),y:r+a}):(o<0&&(i=-i),{x:n+i,y:r+(0===o?0:i*l/o)})},"rectIntersect"),r=(0,i.K)((e,r)=>{let o=D(e.points??[]);if(o.length<2)return;let l=r?e.start:e.end,i=l?t.get(l):void 0,a=i?J(i):void 0;if(!i||!l||!a)return;let s=r?o[0]:o[o.length-1],f=r?o[1]:o[o.length-2],d=n(i,s),u=s;return(eq(f,d)&&(u=f),E(d,u,.001))?{edge:e,edgeId:String(e.id??""),nodeId:l,atStart:r,orientation:"V",coord:d.x,min:Math.min(d.y,u.y),max:Math.max(d.y,u.y),boundary:d,railEnd:u,rect:a}:B(d,u,.001)?{edge:e,edgeId:String(e.id??""),nodeId:l,atStart:r,orientation:"H",coord:d.y,min:Math.min(d.x,u.x),max:Math.max(d.x,u.x),boundary:d,railEnd:u,rect:a}:void 0},"terminalLaneFor"),o=(0,i.K)((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),"projectedOverlapLength"),l=(0,i.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&("H"===e.orientation?(1>Math.abs(e.boundary.x-e.rect.left)||1>Math.abs(e.boundary.x-e.rect.right))&&E(e.boundary,t.boundary,1):(1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom))&&B(e.boundary,t.boundary,1)),"sameTerminalFace"),a=(0,i.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&o(e,t)>=8&&.5>Math.abs(e.coord-t.coord),"exactTerminalLaneConflict"),s=(0,i.K)((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||"H"!==e.orientation||e.atStart===t.atStart)return!1;let n=o(e,t);if(n<8)return!1;let r=e.rect.bottom-e.rect.top;return!(n<r)&&!(n>2*r)&&l(e,t)&&16>Math.abs(e.coord-t.coord)},"nearTerminalLaneConflict"),f=(0,i.K)((e,t)=>{let n=D(e.edge.points??[]);if(n.length<2)return;let r="V"===e.orientation?{x:e.boundary.x+t,y:e.boundary.y}:{x:e.boundary.x,y:e.boundary.y+t},o="V"===e.orientation?{x:e.railEnd.x+t,y:e.railEnd.y}:{x:e.railEnd.x,y:e.railEnd.y+t};if(!(0,i.K)(()=>1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom)?B(r,e.boundary,.001)&&r.x>=e.rect.left+1&&r.x<=e.rect.right-1:!!(1>Math.abs(e.boundary.x-e.rect.left)||1>Math.abs(e.boundary.x-e.rect.right))&&E(r,e.boundary,.001)&&r.y>=e.rect.top+1&&r.y<=e.rect.bottom-1,"boundaryStaysOnSameFace")())return;if(e.atStart){let t=n.length>1&&F(n[1],e.railEnd,.001),l=n.slice(t?2:1),i=l[0];if(i&&!eq(i,o))return;return[r,o,...l]}let l=n.length>1&&F(n[n.length-2],e.railEnd,.001),a=n.slice(0,l?-2:-1),s=a[a.length-1];if(!s||eq(s,o))return[...a,o,r]},"shiftedCandidate"),d=(0,i.K)(e=>{let n=e.edge,r=D(n.points??[]);if(2!==r.length)return!1;let o=n.start,l=n.end,i=o?t.get(o):void 0,a=l?t.get(l):void 0;if(!i||!a)return!1;let s=i.x??0,f=i.y??0,d=a.x??0,u=a.y??0,[h,g]=r;return B(h,g,.001)&&1>Math.abs(f-u)&&Math.abs(s-d)>1||E(h,g,.001)&&1>Math.abs(s-d)&&Math.abs(f-u)>1},"laneIsStraightCollinearConnector"),u=[-7,7,-14,14,-21,21];for(let t=0;t<8;t++){let t=e.filter(e=>!e.isLayoutOnly).flatMap(e=>[r(e,!0),r(e,!1)]).filter(e=>!!e),n=!1;for(let e=0;e<t.length&&!n;e++)for(let o=e+1;o<t.length&&!n;o++){let l=t[e],i=t[o];if(l.edge===i.edge||!(a(l,i)||s(l,i)))continue;let h=!a(l,i);for(let e of[l,i].sort((e,t)=>{let n=d(e),r=d(t);return n!==r?Number(n)-Number(r):Number(!t.atStart)-Number(!e.atStart)})){for(let o of u){let l=f(e,o);if(!l)continue;let i=r({...e.edge,points:l},e.atStart);if(!(!i||t.some(t=>t.edge!==e.edge&&(a(i,t)||h&&s(i,t))))){e.edge.points=l,n=!0;break}}if(n)break}}if(!n)return}}function eQ(e,t){let{realNodeRects:n,labelNodeRects:r}=et(t.values()),o=(0,i.K)((t,o)=>{let l=t.start,i=t.end,a=A(o);if(a.length!==o.length-1)return!1;let s=[l,i].filter(e=>!!e);for(let e of a)if(eo(e.a,e.b,n,s,-2)||eo(e.a,e.b,r,[],-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(e&&!(e.length<2)){for(let t of a)for(let n of A(D(e)))if(Y(t,n,.5)>=8||es(t.a,t.b,n.a,n.b,.001))return!1}}return!0},"candidateIsSafe"),l=(0,i.K)((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],o=e[t+2],l=e[t+3],i=e[t+4],a=N(n,r)&&X(r,o)&&N(o,l)&&X(l,i)&&E(n,l,.001)&&E(n,i,.001)&&E(r,o,.001)&&(r.x-n.x)*(l.x-o.x)<0,s=X(n,r)&&N(r,o)&&X(o,l)&&N(l,i)&&B(n,l,.001)&&B(n,i,.001)&&B(r,o,.001)&&(r.y-n.y)*(l.y-o.y)<0;if(a||s)return D([...e.slice(0,t+1),i,...e.slice(t+5)]);if(t+5>=e.length)return;let f=e[t+5],d=X(n,r)&&N(r,o)&&X(o,l)&&N(l,i)&&X(i,f)&&E(n,i,.001)&&E(n,f,.001)&&E(o,l,.001)&&(o.x-r.x)*(i.x-l.x)<0,u=N(n,r)&&X(r,o)&&N(o,l)&&X(l,i)&&N(i,f)&&B(n,i,.001)&&B(n,f,.001)&&B(o,l,.001)&&(o.y-r.y)*(i.y-l.y)<0;if(d||u)return D([...e.slice(0,t+1),f,...e.slice(t+6)])},"withoutDogleg");for(let t=0;t<8;t++){let t=!1;for(let n of e){if(n.isLayoutOnly)continue;let e=D(n.points??[]);for(let r=0;r<=e.length-5;r++){let i=l(e,r);if(i&&o(n,i)){n.points=i,t=!0;break}}if(t)break}if(!t)return}}function eU(e,t){let{realNodeRects:n,labelNodeRects:r}=et(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t,n)=>D(e===t?n??[]:e.points??[]),"pointsFor"),a=(0,i.K)((e,t)=>{let n=0;for(let r=0;r<o.length;r++){let i=A(l(o[r],e,t));for(let a=r+1;a<o.length;a++){let r=A(l(o[a],e,t));for(let e of i)for(let t of r)es(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),s=(0,i.K)(e=>{let t=A(e);if(3!==t.length)return;let n=t[1];if(t[0].horizontal!==n.horizontal&&t[2].horizontal!==n.horizontal)return{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}},"middleRail"),f=(0,i.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);return n.filter(e=>{if(r.includes(e.id))return!1;let n=e.rect;return t.horizontal?z(t.a.x,t.b.x,n.left,n.right)>=8&&t.a.y>=n.top-2&&t.a.y<=n.bottom+2:z(t.a.y,t.b.y,n.top,n.bottom)>=8&&t.a.x>=n.left-2&&t.a.x<=n.right+2})},"blockingRectsFor"),d=(0,i.K)((e,t,n)=>{let r=e.map(e=>({...e}));if(t.horizontal)r[t.index].y=n,r[t.index+1].y=n;else{if(!t.vertical)return;r[t.index].x=n,r[t.index+1].x=n}let o=eg(D(r));return A(o).length===o.length-1?o:void 0},"candidateByMovingRail"),u=(0,i.K)((e,t,i)=>{let s=[e.start,e.end].filter(e=>!!e),f=A(t);if(f.length!==t.length-1)return!1;for(let e of f)if(eo(e.a,e.b,n,s,-2)||eo(e.a,e.b,r,[],-2))return!1;for(let t of o)if(t!==e){for(let e of f)for(let n of A(l(t)))if(Y(e,n,.5)>=8)return!1}return a(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e=a(),t=!1;for(let n of o){let r=l(n),o=s(r);if(!o)continue;let i=f(n,o.segment);if(0!==i.length){for(let l of o.horizontal?[Math.min(...i.map(e=>e.rect.top))-20,Math.max(...i.map(e=>e.rect.bottom))+20]:[Math.min(...i.map(e=>e.rect.left))-20,Math.max(...i.map(e=>e.rect.right))+20]){let i=d(r,o.segment,l);if(i&&u(n,i,e)){n.points=i,t=!0;break}}if(t)break}}if(!t)return}}function eZ(e,t){let n=(0,i.K)(e=>{let t=e.groupTitleRect;if(t&&"number"==typeof t.left&&"number"==typeof t.right&&"number"==typeof t.top&&"number"==typeof t.bottom&&Number.isFinite(t.left)&&Number.isFinite(t.right)&&Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&!(t.right<=t.left)&&!(t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},"validTitleRect"),r=(0,i.K)(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,r="string"==typeof t?t.toUpperCase():"";if("LR"===r||"RL"===r||"BT"===r)return;let o=n(e),l=e.y,i=e.height;if(!o||"number"!=typeof l||"number"!=typeof i||!Number.isFinite(l)||!Number.isFinite(i)||i<=0)return;let a=o.right-o.left,s=o.bottom-o.top;if(!(s<=0)&&!(a<s))return{node:e,rect:o}},"topLaneTitleFor"),o=(0,i.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<=t.top+.001)&&!(n>=t.bottom-.001)&&z(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),l=[...t.values()].map(r).filter(e=>!!e);if(0===l.length)return;let a=0;for(let t of e)if(!t.isLayoutOnly)for(let e of A(D(t.points??[])))for(let t of l)o(e,t.rect)&&(a=Math.max(a,t.rect.bottom-e.a.y+4));if(!(a<=.001))for(let e of l){let t=e.node.y,n=e.node.height;"number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n)&&!(n<=0)&&(e.node.y=t-a/2,e.node.height=n+a,e.node.groupTitleRect={...e.rect,top:e.rect.top-a,bottom:e.rect.bottom-a})}}function e0(e,t){let n=(0,i.K)(e=>{let t=e.groupTitleRect;if(t&&"number"==typeof t.left&&"number"==typeof t.right&&"number"==typeof t.top&&"number"==typeof t.bottom&&Number.isFinite(t.left)&&Number.isFinite(t.right)&&Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&!(t.right<=t.left)&&!(t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},"validTitleRect"),r=(0,i.K)(e=>{if(!e.isGroup||e.parentId||"LR"!==e.direction)return;let t=n(e),r=e.x,o=e.width;if(!t||"number"!=typeof r||"number"!=typeof o||!Number.isFinite(r)||!Number.isFinite(o)||o<=0)return;let l=t.right-t.left,i=t.bottom-t.top;if(!(l<=0)&&!(i<l))return{node:e,rect:t}},"leftLaneTitleFor"),o=(0,i.K)((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return!(n<=t.left+.001)&&!(n>=t.right-.001)&&z(e.a.y,e.b.y,t.top,t.bottom)>=8},"verticalSegmentIntersectsTitle"),l=(0,i.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<=t.top+.001)&&!(n>=t.bottom-.001)&&z(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...t.values()].map(r).filter(e=>!!e);if(0===a.length)return;let s=0;for(let t of e)if(!t.isLayoutOnly){for(let e of A(D(t.points??[])))for(let t of a)if(o(e,t.rect))s=Math.max(s,t.rect.right-e.a.x+4);else if(l(e,t.rect)){let n=Math.min(e.a.x,e.b.x);s=Math.max(s,t.rect.right-n+4)}}if(!(s<=.001))for(let e of a){let t=e.node.x,n=e.node.width;"number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n)&&!(n<=0)&&(e.node.x=t-s/2,e.node.width=n+s,e.node.groupTitleRect={...e.rect,left:e.rect.left-s,right:e.rect.right-s})}}function e1(e,t){let{realNodeRects:n}=et(t.values()),r=e.filter(e=>!e.isLayoutOnly),o=(0,i.K)((e,t=new Map)=>D(t.get(e)??e.points??[]),"replacementPointsFor"),l=(0,i.K)((e=new Map)=>{let t=0;for(let n=0;n<r.length;n++){let l=A(o(r[n],e));for(let i=n+1;i<r.length;i++){let n=A(o(r[i],e));for(let e of l)for(let r of n)es(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"crossingCount"),a=(0,i.K)((e=new Map)=>r.reduce((t,n)=>t+G(o(n,e)),0),"totalBends"),s=(0,i.K)(e=>{let t=o(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(N(n,r,.001)||X(n,r,.001))return{tailStart:n,terminal:r}},"terminalTailFor"),f=(0,i.K)((e,t)=>{let n,r=o(e);if(r.length<3)return;let l=r[0],i=r[1];if(N(l,i,.001))n={x:i.x,y:t.tailStart.y};else{if(!X(l,i,.001))return;n={x:t.tailStart.x,y:i.y}}let a=eg(D([l,i,n,t.tailStart,t.terminal]));return A(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=(0,i.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);for(let e of A(t))if(eo(e.a,e.b,n,r,-2))return!0;return!1},"pathHasNodeHit"),u=(0,i.K)((e,t,n)=>{for(let l of r)if(l!==e){for(let e of A(t))for(let t of A(o(l,n)))if(Y(e,t,.5)>=8)return!0}return!1},"pathHasSharedTrack"),h=(0,i.K)((e,t,n)=>!d(e,t)&&!u(e,t,n),"candidateIsSafe"),g=(0,i.K)(()=>{let e=new Map;for(let n of r){let r=n.end;if(!r||!t.has(r)||o(n).length<4)continue;let l=e.get(r)??[];l.push(n),e.set(r,l)}return e},"edgesByDestination");for(let e=0;e<4;e++){let e,t=l();if(0===t)return;let n=a(),r=t,o=n;for(let n of g().values())for(let i=0;i<n.length;i++)for(let d=i+1;d<n.length;d++){let u=n[i],g=n[d],c=s(u),p=s(g);if(!c||!p)continue;let x=f(u,p),m=f(g,c);if(!x||!m)continue;let y=new Map([[u,x],[g,m]]);if(!h(u,x,y)||!h(g,m,y))continue;let b=l(y),M=a(y);!(b>=t)&&(b>r||b===r&&M>=o||(e=y,r=b,o=M))}if(!e)return;for(let[t,n]of e)t.points=n}}function e2(e,t){let{realNodeRects:n,labelNodeRects:r}=et(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t=new Map)=>D(t.get(e)??e.points??[]),"replacementPointsFor"),a=(0,i.K)((e=new Map)=>{let t=0;for(let n=0;n<o.length;n++){let r=A(l(o[n],e));for(let i=n+1;i<o.length;i++){let n=A(l(o[i],e));for(let e of r)for(let r of n)es(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"strictCrossingCount"),s=(0,i.K)((e=new Map)=>o.reduce((t,n)=>t+G(l(n,e)),0),"totalBends"),f=(0,i.K)(e=>{let n=e.start,r=e.end,o=n?t.get(n):void 0,l=r?t.get(r):void 0,i=o?J(o):void 0,a=l?J(l):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=(0,i.K)((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=f(e);if(r){if(n.vertical){let o=n.a.x,l=Math.min(r.src.left,r.dst.left),i=Math.max(r.src.right,r.dst.right),a=o<l-.001?"left":o>i+.001?"right":void 0;if(!a)return;return{edge:e,points:t,segmentIndex:n.index,axis:"vertical",side:a,coord:o,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){let o=n.a.y,l=Math.min(r.src.top,r.dst.top),i=Math.max(r.src.bottom,r.dst.bottom),a=o<l-.001?"top":o>i+.001?"bottom":void 0;if(!a)return;return{edge:e,points:t,segmentIndex:n.index,axis:"horizontal",side:a,coord:o,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),u=(0,i.K)(()=>{let e=[];for(let t of o){let n=l(t);for(let r of A(n)){let o=d(t,n,r);o&&e.push(o)}}return e},"collectExternalRails"),h=(0,i.K)((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&z(e.min,e.max,t.min,t.max)>=8,"railsInteract"),g=(0,i.K)(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let o=[r],l=[];for(n.add(r);o.length>0;){let t=o.pop();for(let r of(l.push(t),e))!n.has(r)&&h(t,r)&&(n.add(r),o.push(r))}l.length>1&&t.push(l)}return t},"connectedComponents"),c=(0,i.K)(e=>{let t=[];for(let n of e)t.some(e=>.001>Math.abs(e-n.coord))||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),o=e[0].side;t.push("left"===o||"top"===o?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},"uniqueCoordsFor"),p=(0,i.K)(e=>{let t=e.map(e=>e.coord),n=c(e),r=[];if(e.length<=6){let o=Array(n.length).fill(!1),l=[],a=(0,i.K)(()=>{if(l.length===e.length){l.some((e,n)=>Math.abs(e-t[n])>=.001)&&r.push([...l]);return}for(let[e,t]of n.entries())o[e]||(o[e]=!0,l.push(t),a(),l.pop(),o[e]=!1)},"visit");return a(),r}for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let o=[...t];[o[e],o[n]]=[o[n],o[e]],r.push(o)}return r},"coordinateAssignmentsFor"),x=(0,i.K)((e,t)=>{let n=new Map;for(let[r,o]of e.entries()){let e=t[r],l=n.get(o.edge)??o.points.map(e=>({x:e.x,y:e.y}));"vertical"===o.axis?(l[o.segmentIndex].x=e,l[o.segmentIndex+1].x=e):(l[o.segmentIndex].y=e,l[o.segmentIndex+1].y=e),n.set(o.edge,l)}let r=new Map;for(let[e,t]of n){let n=eg(D(t));if(A(n).length!==n.length-1)return;r.set(e,n)}return r},"replacementsForAssignment"),m=(0,i.K)(e=>{for(let[t,o]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of A(o))if(eo(t.a,t.b,n,e,-2)||eo(t.a,t.b,r,[],-2))return!1}for(let t=0;t<o.length;t++){let n=o[t],r=e.has(n),i=A(l(n,e));for(let n=t+1;n<o.length;n++){let t=o[n];if(!r&&!e.has(t))continue;let a=A(l(t,e));for(let e of i)for(let t of a)if(Y(e,t,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let e=0;e<4;e++){let e,t=a();if(0===t)return;let n=t,r=s(),o=1/0;for(let l of g(u()))for(let i of p(l)){let f=x(l,i);if(!f||!m(f))continue;let d=a(f);if(d>=t)continue;let u=s(f),h=l.reduce((e,t,n)=>e+Math.abs(i[n]-t.coord),0);d>n||d===n&&(u>r||u===r&&h>=o)||(e=f,n=d,r=u,o=h)}if(!e)return;for(let[t,n]of e)t.points=n}}function e6(e,t){let{realNodeRects:n,labelNodeRects:r}=et(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t,n)=>D(e===t?n??[]:e.points??[]),"pointsFor"),a=(0,i.K)(e=>A(e).reduce((e,t)=>e+Math.hypot(t.a.x-t.b.x,t.a.y-t.b.y),0),"pathLength"),s=(0,i.K)((e,t)=>{let n=0;for(let r=0;r<o.length;r++){let i=A(l(o[r],e,t));for(let a=r+1;a<o.length;a++){let r=A(l(o[a],e,t));for(let e of i)for(let t of r)es(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),f=(0,i.K)((e,t)=>{if(e.horizontal){let n=e.a.y;return(1>Math.abs(n-t.top)||1>Math.abs(n-t.bottom))&&z(e.a.x,e.b.x,t.left,t.right)>=8}if(e.vertical){let n=e.a.x;return(1>Math.abs(n-t.left)||1>Math.abs(n-t.right))&&z(e.a.y,e.b.y,t.top,t.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=(0,i.K)(e=>{let n=[e.start,e.end].filter(e=>!!e),r=[];for(let e of n){let n=t.get(e),o=n?J(n):void 0;o&&r.push(o)}return r},"endpointRectsFor"),u=(0,i.K)((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],o=e[t+2],l=e[t+3],i=N(n,r,.001)&&X(r,o,.001)&&N(o,l,.001),a=X(n,r,.001)&&N(r,o,.001)&&X(o,l,.001);if(!i&&!a||!(i?Math.sign(r.x-n.x)!==Math.sign(l.x-o.x):Math.sign(r.y-n.y)!==Math.sign(l.y-o.y)))return[];let s=E(n,l,.001)||B(n,l,.001)?[]:[{x:n.x,y:l.y},{x:l.x,y:n.y}],f=0===s.length?[[...e.slice(0,t+1),...e.slice(t+3)]]:s.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),d=new Set;return f.map(e=>eg(D(e))).filter(e=>{if(A(e).length!==e.length-1||!e.some(e=>F(e,l,.001)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!d.has(t)&&(d.add(t),!0)})},"shortcutCandidatesAt"),h=(0,i.K)((e,t,i)=>{let a=[e.start,e.end].filter(e=>!!e),u=d(e);for(let e of A(t))if(eo(e.a,e.b,n,a,-2)||eo(e.a,e.b,r,[],-2)||u.some(t=>f(e,t)))return!1;for(let n of o)if(n!==e){for(let e of A(t))for(let t of A(l(n)))if(Y(e,t,.5)>=8)return!1}return s(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e,t,n=s(),r=n,i=1/0,f=1/0;for(let d of o){let o=l(d),g=G(o,.001),c=a(o);for(let l=0;l<=o.length-4;l++)for(let p of u(o,l)){let o=G(p,.001),l=a(p);if(!(o<g||o===g&&l<c-.001)||!h(d,p,n))continue;let u=s(d,p);u>r||u===r&&(o>i||o===i&&l>=f)||(e=d,t=p,r=u,i=o,f=l)}}if(!e||!t)return;e.points=t}}function e5(e,t){let n=[];for(let e of t.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,r=e.y??0,o=J(e);o&&n.push({id:String(e.id??""),cx:t,cy:r,rect:o})}if(0===n.length)return;let r=new Map(n.map(e=>[e.id,e])),o=n.map(e=>({id:e.id,rect:e.rect})),l=["top","bottom","left","right"],a={top:Math.min(...n.map(e=>e.rect.top))-20,bottom:Math.max(...n.map(e=>e.rect.bottom))+20,left:Math.min(...n.map(e=>e.rect.left))-20,right:Math.max(...n.map(e=>e.rect.right))+20},s=e.filter(e=>!e.isLayoutOnly),f=new Map(s.map((e,t)=>[e,t])),d=(0,i.K)(e=>{let t="left"===e||"top"===e?-1:1,n=[];for(let r=0;r<=2;r++)n.push(a[e]+20*t*r);return n},"outwardTracksForSide"),u=(0,i.K)((e,t=new Map)=>D(t.get(e)??e.points??[]),"replacementPointsFor"),h=(0,i.K)((e,t)=>{let n=0;for(let r of e)for(let e of t)es(r.a,r.b,e.a,e.b,.001)&&n++;return n},"crossingCountBetweenSegments"),g=(0,i.K)((e,t)=>h(A(e),A(t)),"crossingCountBetweenPaths"),c=(0,i.K)((e=new Map)=>{let t=0,n=[],r=new Set,o=[],l=(0,i.K)(e=>{r.has(e)||(r.add(e),o.push(e))},"addEdge");for(let r=0;r<s.length;r++){let o=s[r],i=u(o,e);for(let a=r+1;a<s.length;a++){let r=s[a],f=g(i,u(r,e));f>0&&(t+=f,n.push({first:o,second:r,count:f}),l(o),l(r))}}return o.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),{count:t,pairs:n,edgeSet:r,edges:o}},"crossingSnapshot"),p=(0,i.K)((e,t)=>{let n=new Set(t.keys());if(0===n.size)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let o=0;for(let e=0;e<s.length;e++){let r=s[e],l=n.has(r),i=u(r,t);for(let r=e+1;r<s.length;r++){let e=s[r];(l||n.has(e))&&(o+=g(i,u(e,t)))}}return e.count-r+o},"crossingCountWithReplacements"),x=(0,i.K)(e=>{let t=new Map;for(let n of e.pairs){let e=t.get(n.first)??new Set;e.add(n.second),t.set(n.first,e);let r=t.get(n.second)??new Set;r.add(n.first),t.set(n.second,r)}let n=[],r=new Set;for(let o of e.edges){if(r.has(o))continue;let e=[o],l=[];for(r.add(o);e.length>0;){let n=e.pop();for(let o of(l.push(n),t.get(n)??[]))r.has(o)||(r.add(o),e.push(o))}l.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),l.length>1&&n.push(l)}return n},"crossingComponents"),m=(0,i.K)(e=>[e.start,e.end].filter(e=>!!e),"endpointIdsFor"),y=(0,i.K)(e=>{let t=[];for(let n of x(e)){let e=new Set(n),r=new Set(n.flatMap(e=>m(e))),o=[...n];for(let t of s)!e.has(t)&&m(t).some(e=>r.has(e))&&o.push(t);o.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),t.push(o)}return t},"pairSearchGroups"),b=(0,i.K)((e,t,n)=>p(e,new Map([[t,n]])),"crossingCountWithSingleReplacement"),M=(0,i.K)(e=>{let t=new Map;for(let n of e.pairs)t.set(n.first,(t.get(n.first)??0)+n.count),t.set(n.second,(t.get(n.second)??0)+n.count);return t},"currentCrossingsByEdge"),K=(0,i.K)(e=>e.slice(1).reduce((t,n,r)=>{let o=e[r];return t+Math.abs(n.x-o.x)+Math.abs(n.y-o.y)},0),"pathLength"),I=(0,i.K)((e=new Map)=>s.reduce((t,n)=>t+G(u(n,e)),0),"totalBends"),w=(0,i.K)((e=new Map)=>s.reduce((t,n)=>t+K(u(n,e)),0),"totalLength"),S=(0,i.K)((e,t,n=new Map)=>{let r=A(t);for(let t of s)if(t!==e){for(let e of r)for(let r of A(u(t,n)))if(Y(e,r,.5)>=8)return!0}return!1},"pathHasSegmentConflict"),v=(0,i.K)((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of A(t))if(eo(e.a,e.b,o,n,-2))return!0;return!1},"pathHitsNode"),C=(0,i.K)((e,t)=>{let n=eg(D(t));A(n).length===n.length-1&&e.push(n)},"pushOrthogonalCandidate"),L=(0,i.K)(e=>"left"===e||"right"===e,"sideIsHorizontal"),k=(0,i.K)((e,t,n)=>{switch(t){case"left":return Math.min(e.x,n.x)-20;case"right":return Math.max(e.x,n.x)+20;case"top":return Math.min(e.y,n.y)-20;case"bottom":return Math.max(e.y,n.y)+20}},"localTrackForSameSide"),$=(0,i.K)((e,t,n,r)=>{let o="left"===n||"top"===n?-1:1;for(let l of[k(t,n,r),a[n]])for(let i=0;i<=2;i++)C(e,Z(t,n,r,l+20*o*i))},"addSameSideCandidates"),R=(0,i.K)((e,t,n,r,o)=>{for(let l of d(n))for(let n of d(o))C(e,[t,{x:l,y:t.y},{x:l,y:n},{x:r.x,y:n},r])},"addHorizontalToVerticalCandidates"),O=(0,i.K)((e,t,n,r,o)=>{for(let l of d(n))for(let n of d(o))C(e,[t,{x:t.x,y:l},{x:n,y:l},{x:n,y:r.y},r])},"addVerticalToHorizontalCandidates"),T=(0,i.K)((e,t,n,r,o)=>{let l=[...d("top"),...d("bottom")];for(let i of d(n))for(let n of d(o))for(let o of l)C(e,[t,{x:i,y:t.y},{x:i,y:o},{x:n,y:o},{x:n,y:r.y},r])},"addHorizontalPairCandidates"),F=(0,i.K)((e,t,n,r,o)=>{let l=[...d("left"),...d("right")];for(let i of d(n))for(let n of d(o))for(let o of l)C(e,[t,{x:t.x,y:i},{x:o,y:i},{x:o,y:n},{x:r.x,y:n},r])},"addVerticalPairCandidates"),E=(0,i.K)(e=>{let t=new Set;return e.map(e=>D(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!t.has(n)&&!(e.length<2)&&(t.add(n),!0)})},"dedupeCandidatePaths"),B=(0,i.K)((e,t,n,r)=>{let o=[],l=U(e,t,n,r,20,.001);l&&C(o,l),t===r&&$(o,e,t,n);let i=L(t),a=L(r);return i&&!a?R(o,e,t,n,r):!i&&a?O(o,e,t,n,r):i?T(o,e,t,n,r):F(o,e,t,n,r),E(o)},"buildCandidatesForSides"),z=(0,i.K)((e,t,n,r)=>{let o=[...d("left"),...d("right")],i=[...d("top"),...d("bottom")];for(let a of l){let l=Q(r,a),s="top"===a||"bottom"===a?d(a):i;for(let r of o)for(let o of(C(e,[t,n,{x:r,y:n.y},{x:r,y:l.y},l]),s))C(e,[t,n,{x:r,y:n.y},{x:r,y:o},{x:l.x,y:o},l])}},"addVerticalDepartureOuterTrackCandidates"),P=(0,i.K)((e,t,n,r)=>{let o=[...d("left"),...d("right")],i=[...d("top"),...d("bottom")];for(let a of l){let l=Q(r,a),s="left"===a||"right"===a?d(a):o;for(let r of i)for(let o of(C(e,[t,n,{x:n.x,y:r},{x:l.x,y:r},l]),s))C(e,[t,n,{x:n.x,y:r},{x:o,y:r},{x:o,y:l.y},l])}},"addHorizontalDepartureOuterTrackCandidates"),H=(0,i.K)(e=>{let t=e.start,n=e.end,o=n?r.get(n):void 0;if(!t||!o)return[];let l=D(e.points??[]);if(l.length<4)return[];let i=l[0],a=l[1],s=[];return X(i,a,.001)?z(s,i,a,o):N(i,a,.001)&&P(s,i,a,o),s},"terminalPreservingOuterTrackCandidates"),j=(0,i.K)(e=>{let t=e.start,n=e.end,o=t?r.get(t):void 0,i=n?r.get(n):void 0;if(!o||!i)return[];let a=[];for(let e of l){let t=Q(o,e);for(let n of l)a.push(...B(t,e,Q(i,n),n))}return a.push(...H(e)),a},"candidatePathsFor"),_=(0,i.K)(()=>new Map(s.map(e=>[e,A(u(e))])),"currentSegmentsByEdge"),V=(0,i.K)((e,t,n)=>{let r=new Set;for(let o of s){if(o===e)continue;let l=n.get(o)??A(u(o));t.some(e=>l.some(t=>Y(e,t,.5)>=8))&&r.add(o)}return r},"sharedTrackConflictsFor"),W=(0,i.K)((e,t,n,r)=>{let o=new Set;return j(e).map(e=>eg(D(e))).filter(t=>{if(v(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!o.has(n)&&!(t.length<2)&&(o.add(n),!0)}).map(o=>{let l=A(o),i=0;for(let t of s)t!==e&&(i+=h(l,n.get(t)??A(u(t))));return{candidate:o,candidateSegments:l,crossings:t.count-(r.get(e)??0)+i,bends:G(o,.001),totalBends:G(o),length:K(o)}}).filter(({crossings:e})=>e<=t.count).sort((e,t)=>e.crossings-t.crossings||e.bends-t.bends||e.length-t.length).slice(0,48).map(t=>({path:t.candidate,segments:t.candidateSegments,sharedTrackConflicts:V(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},"pairCandidatesFor"),q=(0,i.K)((e,t,n,r,o,l)=>{let i=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(i+=n.count);let a=h(n.segments,o.segments);for(let e of s){if(e===t||e===r)continue;let i=l.get(e)??A(u(e));a+=h(n.segments,i)+h(o.segments,i)}return e.count-i+a},"pairCrossingCount"),ee=(0,i.K)((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},"conflictsOnlyWith"),et=(0,i.K)((e,t)=>e.segments.some(e=>t.segments.some(t=>Y(e,t,.5)>=8)),"candidatesShareTrack"),en=(0,i.K)((e,t,n,r)=>ee(t,n.edge)&&ee(r,e.edge)&&!et(t,r),"pairCandidatesAreCompatible"),er=(0,i.K)((e,t,n,r,o)=>{let l=q(e.current,t.edge,n,r.edge,o,e.baseSegments);if(!(l>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,o.path]]),crossings:l,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+o.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+o.length}},"scorePairReplacement"),el=(0,i.K)((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),"pairScoreIsBetter"),ei=(0,i.K)((e,t,n,r)=>{let o=r;for(let r of t.candidates)for(let l of n.candidates){if(!en(t,r,n,l))continue;let i=er(e,t,r,n,l);i&&el(i,o)&&(o=i)}return o},"bestScoreForOptionPair"),ea=(0,i.K)(e=>{let t=I(),n=w(),r=_(),o=M(e),l=new Map(s.map(e=>[e,G(u(e))])),i=new Map(s.map(e=>[e,K(u(e))])),a=new Map,f=y(e);for(let t of f)for(let n of t){if(a.has(n))continue;let t=W(n,e,r,o);t.length>0&&a.set(n,{edge:n,candidates:t})}let d={replacements:new Map,crossings:e.count,bends:t,length:n},h={current:e,currentBends:t,currentLength:n,baseBendsByEdge:l,baseLengthByEdge:i,baseSegments:r};for(let t of f){let n=new Set(t.filter(t=>e.edgeSet.has(t))),r=t.map(e=>a.get(e)).filter(e=>!!e);for(let e=0;e<r.length;e++){let t=r[e];for(let o=e+1;o<r.length;o++){let e=r[o];(n.has(t.edge)||n.has(e.edge))&&(d=ei(h,t,e,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let e=0;e<4;e++){let e,t,n=c(),r=n.count;if(0===r)return;let o=r,l=1/0;for(let i of n.edges){let a=G(u(i),.001);for(let s of j(i)){let f=v(i,s),d=!f&&S(i,s),u=b(n,i,s),h=G(s,.001);!f&&!d&&(u<r||u===r&&h<a)&&(u>o||u===o&&h>=l||(e=i,t=s,o=u,l=h))}}if(e&&t){e.points=t;continue}let i=ea(n);if(!i)return;for(let[e,t]of i)e.points=t}}function e3(e,t){let{nodeInfoById:n,realNodeRects:r}=ee(t),o=["top","bottom","left","right"],l={top:Math.min(...r.map(e=>e.rect.top))-20,bottom:Math.max(...r.map(e=>e.rect.bottom))+20,left:Math.min(...r.map(e=>e.rect.left))-20,right:Math.max(...r.map(e=>e.rect.right))+20},a=(0,i.K)((e,t,n,r)=>{let o=[],i=U(e,t,n,r,20,.001);return i&&o.push(i),t===r&&o.push(Z(e,t,n,l[t])),o},"buildOrthogonalPathCandidates"),s=(0,i.K)((e,t)=>{for(let n=0;n<e.length-1;n++)if(eo(e[n],e[n+1],r,t,1))return!0;return!1},"pathHitsNode"),f=(0,i.K)((t,n,r=!1)=>{let o=0,l=A(t,.001),i=n.start,a=n.end;for(let t of e){if(t===n||t.isLayoutOnly)continue;let e=t.start,s=t.end;if(!r&&i&&a&&(e===i||e===a||s===i||s===a))continue;let f=t.points;if(f&&!(f.length<2))for(let e of l)for(let t of A(f,.001)){if(el(e.a,e.b,t.a,t.b,.001,.001)){o++;continue}Y(e,t,.001)>=8&&o++}}return o},"pathConflictCount"),d=(0,i.K)((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),o=Math.abs(e.x-t.rect.left),l=Math.abs(e.x-t.rect.right),i="top",a=n;return r<a&&(i="bottom",a=r),o<a&&(i="left",a=o),l<a&&(i="right",a=l),i},"nearestSideOfRect"),u=new Map,h=(0,i.K)((e,t,n)=>{let r=u.get(e)??[];r.push({side:t,edgeId:n}),u.set(e,r)},"addFaceClaim");for(let t of e){if(t.isLayoutOnly)continue;let e=t.points??[];if(e.length<1)continue;let r=t.id??"",o=t.start,l=t.end;if(o){let t=n.get(o);t&&h(o,d(e[0],t),r)}if(l){let t=n.get(l);t&&h(l,d(e[e.length-1],t),r)}}let g=(0,i.K)((e,t,n)=>u.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,"faceIsClaimed");for(let t of e){let e;if(t.isLayoutOnly)continue;let r=t.points;if(!r||r.length<2)continue;let l=G(r,.001);if(l<4)continue;let i=t.start,c=t.end;if(!i||!c)continue;let p=n.get(i),x=n.get(c);if(!p||!x)continue;let m=t.id??"",y=f(r,t,!0),b=f(r,t),M=y,K=l;for(let n of o){if(g(i,n,m))continue;let r=Q(p,n);for(let l of o)if(!g(c,l,m))for(let o of a(r,n,Q(x,l),l)){if(s(o,[i,c]))continue;let n=G(o,.001);if(y>0){let r=f(o,t,!0);if(r>M||r===M&&n>=K)continue;M=r,K=n,e=o;continue}!(f(o,t)>b)&&n<K&&(K=n,e=o)}}if(e){t.points=e;let n=u.get(i);n&&u.set(i,n.filter(e=>e.edgeId!==m));let r=u.get(c);r&&u.set(c,r.filter(e=>e.edgeId!==m)),h(i,d(e[0],p),m),h(c,d(e[e.length-1],x),m)}}}function e8(e,t){let n=t?0:e.length-1,r=e[n],o=e[n+(t?1:-1)];if(!r||!o)return;let l=o.x-r.x,i=o.y-r.y;if(!(Math.abs(l)+Math.abs(i)<.001)){if(.001>=Math.abs(i)){let e=r.x+10*Math.sign(l);return{left:Math.min(r.x,e),right:Math.max(r.x,e),top:r.y-7,bottom:r.y+7}}if(.001>=Math.abs(l)){let e=r.y+10*Math.sign(i);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,e),bottom:Math.max(r.y,e)}}return{left:Math.min(r.x,o.x),right:Math.max(r.x,o.x),top:Math.min(r.y,o.y),bottom:Math.max(r.y,o.y)}}}function e4(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom)}}function e9(e,t){let n=D(t);return[e8(n,!0),e8(n,!1)].some(t=>t&&V(e,e4(t)))}function e7(e,t){let n=[];for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(e&&!(e.length<2))for(let r=0;r<e.length-1;r++)n.push({edgeId:t.id,p1:e[r],p2:e[r+1]})}let r=[],o=[];for(let e of t.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=J(e);t&&o.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let l=J(e);l&&r.push({nodeId:e.id,rect:l})}let l=(0,i.K)((e,t)=>{let n=W(t,3);for(let{nodeId:t,rect:o}of r)if(t!==e&&V(n,o))return!0;return!1},"labelOverlapsForeignNode"),a=(0,i.K)((e,t)=>{let r=W(t,3);for(let t of n)if(t.edgeId!==e&&H(t.p1,t.p2,r))return!0;return!1},"labelOverlapsForeignEdge"),s=(0,i.K)((e,t,n)=>l(e,n)||a(t,n),"labelOverlapsAnything"),f=[],d=(0,i.K)(e=>{for(let{id:t,rect:n}of o)if(_(n,e))return t},"findContainingLane"),u=(0,i.K)((e,t)=>f.some(n=>n.labelId!==e&&V(t,n.rect)),"overlapsPlacedLabel");for(let n of e){if(n.isLayoutOnly)continue;let e=n.labelNodeId;if(!e)continue;let r=t.get(e);if(!r)continue;let h=n.points;if(!h||h.length<2)continue;let g=r.width??0,c=r.height??0;if(g<=0||c<=0)continue;let p=[];for(let e=0;e<h.length-1;e++){let t=h[e],n=h[e+1],r=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);(!(r<.001)||!(o<.001))&&(r>=.001&&o>=.001||p.push({idx:e,length:r+o,orientation:r>=.001?"horizontal":"vertical",midX:(t.x+n.x)/2,midY:(t.y+n.y)/2}))}if(0===p.length)continue;let x=p.length>=3?p.filter(e=>e.idx>0&&e.idx<p.length-1):p,m=x.length>0?x:p,y=g>=c?"horizontal":"vertical",b=(0,i.K)(e=>[...e].sort((e,t)=>{let n=e.orientation===y;if(n!==(t.orientation===y))return n?-1:1;let r=e.length>=("horizontal"===e.orientation?g:c)+2;return r!==t.length>=("horizontal"===t.orientation?g:c)+2?r?-1:1:t.length-e.length}),"rankSegments"),M=p[0],K=p[p.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],w=(0,i.K)((e,t)=>{let n=h[e.idx],r=h[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},"anchorAtT"),S=(0,i.K)((e,t,n)=>Math.min(n,Math.max(t,e)),"clamp"),v=(0,i.K)((e,t)=>e.midX>=t.left-.001&&e.midX<=t.right+.001&&e.midY>=t.top-.001&&e.midY<=t.bottom+.001,"pointInsideRectInclusive"),C=(0,i.K)(e=>{let t=q(e.midX,e.midY,g,c),n=d(t);if(n)return{laneId:n,anchor:e,rect:t};let r=o.find(({rect:t})=>v(e,t));if(!r)return;let l=r.rect.left+g/2+1,i=r.rect.right-g/2-1,a=r.rect.top+c/2+1,s=r.rect.bottom-c/2-1;if(l>i||a>s)return;let f={midX:S(e.midX,l,i),midY:S(e.midY,a,s)},u=q(f.midX,f.midY,g,c);return v(e,u)?{laneId:r.id,anchor:f,rect:u}:void 0},"placementForAnchor"),L=(0,i.K)((e,t,n)=>"horizontal"===e.orientation?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),"distanceAlongSegment"),k=(0,i.K)((e,t)=>{let n=("horizontal"===e.orientation?g/2:c/2)+12;if(e===M){let r=h[e.idx];if(L(e,t,r)+.001<n)return!1}if(e===K){let r=h[e.idx+1];if(L(e,t,r)+.001<n)return!1}return!0},"labelClearsTerminalEndpoints"),$=(0,i.K)(t=>{for(let r of b(t))for(let t of I){let o=w(r,t);if(!k(r,o))continue;let l=C(o);if(!(!l||e9(l.rect,h))&&!u(e,l.rect)&&!s(e,n.id,l.rect))return{laneId:l.laneId,anchor:l.anchor}}},"tryPool"),R=(0,i.K)((t,r,o=!1)=>{for(let i of b(t)){let t={midX:i.midX,midY:i.midY};if(r&&!k(i,t))continue;let s=C(t);if(s&&!e9(s.rect,h)&&!u(e,s.rect)&&!l(e,s.rect)&&(o||!a(n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"findLaneContainingFallback"),O=$(m)??(m.length<p.length?$(p):void 0)??R(p,!0)??R(p,!1)??R(p,!1,!0);if(O){r.x=O.anchor.midX,r.y=O.anchor.midY,r.parentId=O.laneId;let t=q(O.anchor.midX,O.anchor.midY,g,c),n=f.findIndex(t=>t.labelId===e);n>=0?f[n]={labelId:e,rect:t}:f.push({labelId:e,rect:t})}}}(0,i.K)(eJ,"separateSharedRenderedTerminalLanes"),(0,i.K)(eQ,"collapseRedundantRectangularDoglegs"),(0,i.K)(eU,"liftObstacleHuggingSameSideRails"),(0,i.K)(eZ,"liftTopLaneTitleBandsAboveRails"),(0,i.K)(e0,"shiftLeftLaneTitleBandsLeftOfRails"),(0,i.K)(e1,"swapDestinationTerminalTailsToReduceCrossings"),(0,i.K)(e2,"reassignCrossingExternalRailChannels"),(0,i.K)(e6,"shortcutRedundantOrthogonalJogs"),(0,i.K)(e5,"resolveRenderedOrthogonalCrossings"),(0,i.K)(e3,"simplifyDetouredEdges"),(0,i.K)(e8,"markerClearanceRectFor"),(0,i.K)(e4,"normalizeRect"),(0,i.K)(e9,"labelOverlapsOwnMarker"),(0,i.K)(e7,"anchorLabelsToPolyline");function te(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}function tt(e,t){let{nodeInfoById:n,realNodeRects:r}=ee(t),o=new Map;for(let e of t){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){o.set(t,{w:e.width??0,h:e.height??0});continue}}let l=(0,i.K)((t,n,r,l)=>{let a=te(n,r),s=0,f=(0,i.K)(e=>{if(!e)return;let t=o.get(e);if(!t)return;let n="x"===l?t.w/2:t.h/2;n>s&&(s=n)},"consider");for(let n of(f(t.labelNodeId),e)){if(n===t||n.isLayoutOnly)continue;let e=n.start,r=n.end;e&&r&&te(e,r)===a&&f(n.labelNodeId)}return s>0?s+3:0},"labelClearanceFor");for(let t of e){let o,i;if(t.isLayoutOnly||!P(t.points,1e-6))continue;let a=er(t,n,1e-6);if(!a)continue;let{srcId:s,dstId:f,srcInfo:d,dstInfo:u,collinearX:h,collinearY:g}=a;if(h===g)continue;if(h){let e=u.cy>d.cy;o={x:d.cx,y:e?d.rect.bottom:d.rect.top},i={x:u.cx,y:e?u.rect.top:u.rect.bottom}}else{let e=u.cx>d.cx;o={x:e?d.rect.right:d.rect.left,y:d.cy},i={x:e?u.rect.left:u.rect.right,y:u.cy}}if(eo(o,i,r,[s,f],1))continue;let c=l(t,s,f,h?"x":"y"),p=c>4?c:4;for(let n of[0,p,-p]){let l={...o},a={...i};if(h){if(l.x+=n,a.x+=n,l.x<=d.rect.left||l.x>=d.rect.right||a.x<=u.rect.left||a.x>=u.rect.right)continue}else if(l.y+=n,a.y+=n,l.y<=d.rect.top||l.y>=d.rect.bottom||a.y<=u.rect.top||a.y>=u.rect.bottom)continue;if(!eo(l,a,r,[s,f],1)&&!ea(l,a,e,t,{epsilon:1e-6})){t.points=[l,a];break}}}}function tn(e,t){let{realNodeRects:n,labelNodeRects:r}=et(t.values()),o=(0,i.K)((e,t)=>A(t,.001).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),"segmentsFor"),l=(0,i.K)(()=>{let t=[];for(let n of e){if(n.isLayoutOnly)continue;let e=n.points;e&&!(e.length<2)&&t.push(...o(n,D(e)))}return t},"allSegments"),a=(0,i.K)((e,t)=>e.horizontal&&t.horizontal?z(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&7>Math.abs(e.a.y-t.a.y):!!e.vertical&&!!t.vertical&&z(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&7>Math.abs(e.a.x-t.a.x),"hasCrowdedParallelTrack"),s=(0,i.K)((t,l)=>{let i=t.start,s=t.end,f=o(t,l);if(f.length!==l.length-1)return!1;let d=[i,s].filter(e=>!!e),u=t.labelNodeId?[t.labelNodeId]:[];for(let e of f)if(eo(e.a,e.b,n,d,-2)||eo(e.a,e.b,r,u,-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(e&&!(e.length<2)){for(let t of f)for(let r of o(n,D(e)))if(a(t,r)||es(t.a,t.b,r.a,r.b,.001))return!1}}return!0},"candidateIsSafe"),f=(0,i.K)((e,t)=>{let n=D(e.edge.points??[]);if(n.length<4||e.index>=n.length-1)return;let r=n.map(e=>({...e}));if(e.horizontal)r[e.index].y+=t,r[e.index+1].y+=t;else{if(!e.vertical)return;r[e.index].x+=t,r[e.index+1].x+=t}return o(e.edge,r).length===r.length-1?r:void 0},"shiftedCandidate"),d=(0,i.K)((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),"nodeCenter"),u=(0,i.K)(e=>{let n=e.edge,r=D(n.points??[]);if(4!==r.length||1!==e.index)return;let o=n.start?t.get(n.start):void 0,l=n.end?t.get(n.end):void 0,i=o?J(o):void 0,a=l?J(l):void 0,s=r.slice(e.index+2);if(o&&l&&i&&a&&0!==s.length)return{sourceCenter:d(o,i),targetCenter:d(l,a),sourceRect:i,tail:s}},"sourceDetourContextFor"),h=(0,i.K)((e,t,n,r,o,l)=>{let i=r.y>=n.y,a=i?o.bottom:o.top,s=a+(i?20:-20);if(i&&e.b.y<=s+.001||!i&&e.b.y>=s-.001)return;let f=e.a.x+t;return D([{x:n.x,y:a},{x:n.x,y:s},{x:f,y:s},{x:f,y:e.b.y},...l],.001)},"verticalSourceDetour"),g=(0,i.K)((e,t,n,r,o,l)=>{let i=r.x>=n.x,a=i?o.right:o.left,s=a+(i?20:-20);if(i&&e.b.x<=s+.001||!i&&e.b.x>=s-.001)return;let f=e.a.y+t;return D([{x:a,y:n.y},{x:s,y:n.y},{x:s,y:f},{x:e.b.x,y:f},...l],.001)},"horizontalSourceDetour"),c=(0,i.K)((e,t)=>{let n=u(e);if(n){if(e.vertical)return h(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return g(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},"sourceDetourCandidate"),p=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=l(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let o=e[n],l=e[r];if(o.edge!==l.edge&&a(o,l))for(let e of[o,l].filter(e=>e.interior)){for(let n of p){let r=f(e,n);if(r&&s(e.edge,r)){e.edge.points=r,t=!0;break}let o=c(e,n);if(o&&s(e.edge,o)){e.edge.points=o,t=!0;break}}if(t)break}}if(!t)return}}function tr(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=r.x-n.x,a=r.y-n.y,s=o*a-l*i;if(1e-10>Math.abs(s))return!1;let f=n.x-e.x,d=n.y-e.y,u=(f*a-d*i)/s,h=(f*l-d*o)/s;return u>.01&&u<.99&&h>.01&&h<.99}function to(e){let t=e.nodes??[],n=e.edges??[],r=[];if(!n.length||!t.length)return r;let o=en(t),i=[];for(let e of n){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,l=e.end,a=e.labelNodeId,s=e.id??`${n}->${l}`;for(let e of o)if(e.nodeId!==n&&e.nodeId!==l&&(!a||e.nodeId!==a)){for(let n=0;n<t.length-1;n++)if(H(t[n],t[n+1],e,-1)){r.push({type:"edge-node-overlap",edgeId:s,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)i.push({edgeId:s,start:n,end:l,p1:t[e],p2:t[e+1]})}let a=new Set;for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++){let n=i[e],o=i[t];if(n.edgeId!==o.edgeId&&n.start!==o.start&&n.start!==o.end&&n.end!==o.start&&n.end!==o.end&&tr(n.p1,n.p2,o.p1,o.p2)){let e=n.edgeId<o.edgeId?`${n.edgeId}|${o.edgeId}`:`${o.edgeId}|${n.edgeId}`;a.has(e)||(a.add(e),r.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:o.edgeId,detail:`edges "${n.edgeId}" and "${o.edgeId}" cross`}))}}if(r.length>0){let e=r.filter(e=>"edge-node-overlap"===e.type).length,t=r.filter(e=>"edge-edge-crossing"===e.type).length;for(let n of(l.R.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${e} edge-node overlap(s), ${t} edge crossing(s)`),r))l.R.warn(`[SWIMLANE_VALIDATE] ${n.type}: ${n.detail}`)}return r}function tl(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup);if(("LR"===t||"RL"===t)&&o.length>0&&!ej(e,t)||"BT"===t&&o.length>0&&!eH(e))return;for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;t&&!(t.length<2)&&(e.points=eg(eh(t)))}e3(r,n),tt(r,n),eV(r,n);let l=new Map;for(let e of n)l.set(String(e.id),e);e7(r,l),em(r,l),eW(r,l),tn(r,l),eJ(r,l),eQ(r,l),eU(r,l),e1(r,l);let a=(0,i.K)(()=>{e5(r,l),e2(r,l),e6(r,l),e7(r,l),eN(r,l),eU(r,l),e7(r,l),eN(r,l)},"finalizeRenderedEdges");a(),tn(r,l),a(),eZ(r,l),e0(r,l),eZ(r,l),e0(r,l)}function ti(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let o of e.edges){if(!t.has(o.src)||!t.has(o.dst))continue;let e=`${o.id}:${o.src}->${o.dst}`;n.has(e)||(n.add(e),r.push(o))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}function ta(e,t){return e.edges.filter(e=>e.dst===t)}function ts(e){let t=new Map;for(let n of e.nodes)t.set(n,[]);for(let n of e.edges)t.get(n.src).push(n.dst);return t}function tf(e){let t=ts(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}function td(e){let t=new Map;for(let n of e.nodes)t.set(n,0);for(let n of e.edges)t.set(n.dst,(t.get(n.dst)??0)+1);return t}function tu(e){return[...e.entries()].filter(([,e])=>0===e).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function th(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let o of e.edges)t(o)&&(r.get(o.src).push(o.dst),n.get(o.dst).push(o.src));return{preds:n,succs:r}}function tg(e,t,n,r){let o=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(o=Math.max(o,n[t]??0));let l=Array.from({length:o+1},()=>[]);for(let o of t)r?.skipGroups&&e.nodeById.get(o)?.isGroup||l[Math.max(0,n[o]??0)].push(o);return l}function tc(e){let t=td(e),n=tu(t),r=[],o=tf(e);for(;n.length;){let e=n.shift();for(let l of(r.push(e),o.get(e)??[]))if(t.set(l,(t.get(l)??0)-1),(t.get(l)??0)===0){let e=0;for(;e<n.length&&n[e]<l;)e++;n.splice(e,0,l)}}return r.length===e.nodes.length?r:null}function tp(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}function tx(e){let t=Array(e.length),n=(0,i.K)((r,o)=>{if(o-r<=1)return 0;let l=r+o>>1,i=n(r,l)+n(l,o),a=r,s=l,f=r;for(;a<l||s<o;)s>=o||a<l&&e[a]<=e[s]?t[f++]=e[a++]:(t[f++]=e[s++],i+=l-a);for(let n=r;n<o;n++)e[n]=t[n];return i},"count");return n(0,e.length)}function tm(e){let t=ti(e),n=new Map;for(let e of t.nodes)n.set(e,[]);for(let e of t.edges)n.get(e.src).push(e);for(let e of n.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let r=Object.create(null);for(let e of t.nodes)r[e]=0;let o=[],l=(0,i.K)(e=>{for(let t of(r[e]=1,n.get(e)??[])){let e=t.dst;0===r[e]?l(e):1===r[e]&&o.push(t)}r[e]=2},"dfs");for(let e of[...t.nodes].sort((e,t)=>e.localeCompare(t)))0===r[e]&&l(e);let a=new Set(o.map(e=>`${e.id}:${e.src}->${e.dst}`)),s=t.edges.map(e=>a.has(`${e.id}:${e.src}->${e.dst}`)?{id:e.id,src:e.dst,dst:e.src,weight:e.weight,ref:e.ref}:e);return{acyclic:{nodes:[...t.nodes],edges:s,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:o}}function ty(e){let t=new Map,n=(0,i.K)(r=>{if(t.has(r))return t.get(r);let o=e.nodeById.get(r);if(!o)return t.set(r,null),null;let l=o.parentId;if(!l)return t.set(r,null),null;let i=n(l)??l;return t.set(r,i),i},"resolve");for(let t of e.nodes)n(t);return t}function tb(e){let t=ty(e);return e=>t.get(e)??null}function tM(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}function tK(e,t){let n=tM(e);if(!t||0===t.length)return n;let r=new Set(n),o=new Set,l=[];for(let e of t)!r.has(e)||o.has(e)||(o.add(e),l.push(e));for(let e of n)o.has(e)||l.push(e);return l}(0,i.K)(te,"pairKey"),(0,i.K)(tt,"straightenCollinearSiblingDetours"),(0,i.K)(tn,"nudgeSharedInteriorSubpaths"),(0,i.K)(tr,"segmentsIntersect"),(0,i.K)(to,"validateSwimlanesLayout"),(0,i.K)(tl,"postProcessSwimlaneLayout"),(0,i.K)(ti,"normalizeGraph"),(0,i.K)(ta,"incoming"),(0,i.K)(ts,"buildSuccessorMap"),(0,i.K)(tf,"buildSortedSuccessorMap"),(0,i.K)(td,"buildInDegreeMap"),(0,i.K)(tu,"sortedZeroInDegreeNodes"),(0,i.K)(th,"buildPredecessorSuccessorMaps"),(0,i.K)(tg,"buildLayersFromRanks"),(0,i.K)(tc,"topoSortIfAcyclic"),(0,i.K)(tp,"buildLayerIndex"),(0,i.K)(tx,"countInversions"),(0,i.K)(tm,"removeCycles_DFS"),(0,i.K)(ty,"buildTopLaneMap"),(0,i.K)(tb,"createTopLaneResolver"),(0,i.K)(tM,"buildTopLaneOrder"),(0,i.K)(tK,"resolveTopLaneOrder");function tI(e,t){let n=ti(e),r=t?.laneOf??(()=>null),o=t?.rankHint,{preds:l}=th(n);for(let e of l.values())e.sort((e,t)=>e.localeCompare(t));let a=tc(n)??[...n.nodes].sort((e,t)=>e.localeCompare(t)),s=new Map;for(let[e,t]of a.entries())s.set(t,e);let f=new Map,d=new Map;for(let e of n.nodes)d.set(e,[]);for(let e of a){let t=(l.get(e)??[]).filter(e=>f.has(e));if(t.length>0){let n=tw(e,t,{laneOf:r,rankHint:o,topoIndex:s});f.set(e,n),d.get(n).push(e)}else f.has(e)||f.set(e,null)}for(let e of n.nodes)f.has(e)||f.set(e,null);let u=new Set;for(let e of n.nodes)(f.get(e)??null)===null&&u.add(e);let h=[...u].sort((e,t)=>{let n=s.get(e)??0,r=s.get(t)??0;return n===r?e.localeCompare(t):n-r}),g=tS(n),c=new Map;for(let[e,t]of g.entries())c.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let p=tv(c),x=tC(c),m=new Map;for(let e of n.nodes)m.set(e,[]);for(let e of x)for(let t of e.nodes){let n=m.get(t);n?n.push(e.id):m.set(t,[e.id])}let y=[],b=[],M=new Set,K=(0,i.K)(e=>{if(!M.has(e)){for(let t of(M.add(e),y.push(e),d.get(e)??[]))K(t);b.push(e)}},"walk");for(let e of h)K(e);for(let e of a)K(e);return{parent:f,children:d,roots:h,componentOf:p,blocks:x,nodeBlocks:m,adjacency:c,preorder:y,postorder:b,topologicalOrder:a}}function tw(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let o=n.laneOf(e),l=n.laneOf(t),i=null!=o&&o===r;if(i!==(null!=l&&l===r))return i?-1:1;let a=n.rankHint?.[e],s=n.rankHint?.[t];if(null!=a&&null!=s&&a!==s)return s-a;let f=n.topoIndex.get(e)??0,d=n.topoIndex.get(t)??0;return f!==d?f-d:e.localeCompare(t)})[0]}function tS(e){let t=new Map;for(let n of e.nodes)t.set(n,new Set);for(let n of e.edges)t.get(n.src).add(n.dst),t.get(n.dst).add(n.src);return t}function tv(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let o=[r];for(;o.length>0;){let r=o.pop();if(!t.has(r))for(let l of(t.set(r,n),e.get(r)??[]))t.has(l)||o.push(l)}n++}return t}function tC(e){let t=new Map,n=new Map,r=[],o=[],l=0,a=(0,i.K)((i,s)=>{for(let f of(t.set(i,++l),n.set(i,l),e.get(i)??[]))f!==s&&(t.has(f)?(t.get(f)??0)<(t.get(i)??0)&&(r.push([i,f]),n.set(i,Math.min(n.get(i)??l,t.get(f)??l))):(r.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??l,n.get(f)??l)),(n.get(f)??0)>=(t.get(i)??0)&&o.push(tL(i,f,r,o.length))))},"visit");for(let n of e.keys())t.has(n)||a(n,null);return o}function tL(e,t,n,r){let o=[],l=new Set;for(;n.length>0;){let r=n.pop();if(o.push(r),l.add(r[0]),l.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:o,nodes:[...l]}}function tk(e,t,n){let r=[...e.nodes],o=new Map;for(let[e,t]of r.entries())o.set(t,e);let l=r.length,a=Array(l).fill(-1),s=Array(l).fill(0),f=[],d=new Set;for(let e of r){let t=n.parent.get(e)??null,r=o.get(e);null!=r&&null==t&&(a[r]=-1,s[r]=0,d.has(e)||(d.add(e),f.push(e)))}for(;f.length>0;){let e=f.shift(),t=o.get(e);if(null!=t)for(let r of n.children.get(e)??[]){if(d.has(r))continue;let e=o.get(r);null!=e&&(a[e]=t,s[e]=s[t]+1,d.add(r),f.push(r))}}for(let e of r){if(d.has(e))continue;let t=o.get(e);null!=t&&(a[t]=-1,s[t]=0,d.add(e))}let u=Math.max(1,Math.ceil(Math.log2(Math.max(1,l)))+1),h=Array.from({length:u},()=>Array(l).fill(-1));for(let e=0;e<l;e++)h[0][e]=a[e];for(let e=1;e<u;e++)for(let t=0;t<l;t++){let n=h[e-1][t];h[e][t]=-1===n?-1:h[e-1][n]}let g=(0,i.K)((e,t)=>{if(-1===e||-1===t)return -1;s[e]<s[t]&&([e,t]=[t,e]);let n=s[e]-s[t];for(let t=0;t<u;t++)if(n>>t&1&&-1===(e=h[t][e]))return -1;if(e===t)return e;for(let n=u-1;n>=0;n--){let r=h[n][e],o=h[n][t];-1!==r&&-1!==o&&r!==o&&(e=r,t=o)}return h[0][e]},"lcaIndex"),c=Array.from({length:l},()=>new Map);for(let n of e.edges){let e=n.src,r=n.dst,l=t[e],i=t[r];if(null==l||null==i||(l>i&&([e,r]=[r,e],[l,i]=[i,l]),null==l||null==i||l===i))continue;let a=o.get(e),s=o.get(r);if(null==a||null==s)continue;let f=g(a,s);if(-1===f)continue;let d=c[f];for(let e=l;e<i;e++)d.set(e,(d.get(e)??0)+1)}let p=new Map,x=(0,i.K)((e,t)=>{if(0!==t.size)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},"mergeInto"),m=new Set,y=(0,i.K)(e=>{let r=o.get(e);m.add(e);let l=null==r?void 0:c[r],i=l?new Map(l):new Map;for(let r of n.children.get(e)??[]){let n=y(r),o=t[e];if(null!=o){let l=p.get(e);l||(l=new Map,p.set(e,l));let i=n.get(o)??0,a=t[r];null!=a&&a>o&&(i+=1),l.set(r,i)}x(i,n)}return i},"dfs");for(let e of n.roots)m.has(e)||y(e);for(let e of r)m.has(e)||y(e);return p}function t$(e,t,n){let r=new Map,o=(0,i.K)(e=>{let l=n[e]??0,i=[...t.get(e)??[]];for(let e of(i.sort(tR(n)),i)){o(e);let t=r.get(e);null!=t&&(l=Math.min(l,t))}r.set(e,l)},"annotate");for(let t of e)o(t);return r}function tR(e){return(t,n)=>{let r=e[t]??0,o=e[n]??0;return r===o?t.localeCompare(n):r-o}}function tO(e,t,n,r){let o=0;for(let e of t){let t=n[e]??0;t>o&&(o=t)}let l=Array.from({length:o+1},()=>[]),a=new Set,s=(0,i.K)(e=>{if(a.has(e))return;a.add(e);let t=n[e]??0;for(let n of(l[t]||(l[t]=[]),l[t].push(e),r(e)))s(n)},"emit");for(let t of e)s(t);for(let e of t)if(!a.has(e)){let t=n[e]??0;l[t]||(l[t]=[]),l[t].push(e),a.add(e)}return l}function tT(e){let t=[];for(let n of e){let e=new Set,r=[];for(let t of n)e.has(t)||(e.add(t),r.push(t));t.push(r)}return t}function tF(e,t,n,r){return o=>{let l=e.get(o)??[];if(0===l.length)return[];let i=t[o]??0,a=[],s=[],f=n.get(o);for(let e of l){let t=r.get(e)??i;t>i?a.push({child:e,min:t}):s.push(e)}return a.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),s.sort((e,t)=>{let n=f?.get(e)??0,o=f?.get(t)??0;if(n!==o)return n-o;let l=r.get(e)??i,a=r.get(t)??i;return l!==a?l-a:e.localeCompare(t)}),[...a.map(e=>e.child),...s]}}function tE(e,t,n){let r=tI(e,{rankHint:t,laneOf:n}),{children:o,roots:l}=r;for(let t of e.nodes)o.has(t)||o.set(t,[]);let i=tk(e,t,r),a=[...l].sort(tR(t)),s=t$(a,o,t),f=tF(o,t,i,s),d=tO(a,e.nodes,t,f);return tT(d)}function tB(e,t,n){let r=new Set(e),o=new Set(t),l=tp(t),i=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&i.push(l.get(e.dst));return tx(i)}function tN(e,t,n){let r=[];for(let e of t){let t=n[e.src],o=n[e.dst];if(null==t||null==o||t===o)continue;let l=e.src,i=e.dst,a=t,s=o;t>o&&(l=e.dst,i=e.src,a=o,s=t);for(let t=a;t<s;t++)r.push({id:`${e.id}@${t}`,src:l,dst:i,ref:e.ref})}let o=0;for(let t=0;t+1<e.length;t++)o+=tB(e[t],e[t+1],r);return o}function tX(e,t){let n={...t},{preds:r}=th(e),o=tb(e),l=tN(tE(e,n,o),e.edges,n);for(let t=0;t<4;t++){let t=!1;for(let i of[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0))){let a=n[i]??0;if(0===a)continue;let s=0;for(let e of r.get(i)??[])s=Math.max(s,(n[e]??0)+1);if(s>=a)continue;n[i]=s;let f=tN(tE(e,n,o),e.edges,n);f<l?(l=f,t=!0):n[i]=a}if(!t)break}return n}function tz(e,t){let n=tb(e);for(let r of[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n))){let o=n(r);if(!o)continue;let l=e.edges.filter(e=>e.src===r);if(0===l.length)continue;let i=!1,a=0;for(let e of l){let t=n(e.dst);null==t||t===o?i=!0:a++}if(0===a||i)continue;let s=0,f=!1;for(let t of e.edges){if(t.dst!==r)continue;let e=n(t.src);e&&(e===o?f=!0:s++)}if(s>0||!f)continue;let d=t[r]??0,u=d+a,h=0;for(let n of e.edges)n.dst===r&&(h=Math.max(h,(t[n.src]??0)+1));let g=Math.max(d,h,u);g!==d&&(t[r]=g)}}function tY(e,t){let n=ti(e),r=tc(n)??[...n.nodes].sort(),o=t?.compactSingleInput??!1,l=tb(n),i=Object.create(null);for(let e of r){let r=ta(n,e),a=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=l(t.src),r=l(e);return!n||!r||n===r}):r;if(0===a.length)i[e]=0;else if(o&&1===a.length){let t=a[0].src;l(t)!==l(e)?i[e]=i[t]??0:i[e]=(i[t]??0)+1}else{let t=-1/0;for(let e of a)t=Math.max(t,(i[e.src]??0)+1);i[e]=t===-1/0?0:t}}return t?.optimizeRanksByCrossings&&(i=tX(n,i)),t?.ignoreCrossLaneEdges&&tz(n,i),{layers:tE(n,i,l),rankOf:i,dummy:new Set}}function tA(e,t){let n=ti(e),r={...tY(n,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},o=tb(n),{preds:l,succs:a}=th(n,e=>{if(t?.ignoreCrossLaneEdges){let t=o(e.src),n=o(e.dst);if(t&&n&&t!==n)return!1}return!0}),s=tc(n)??[...n.nodes],f=[...s].reverse(),d=(0,i.K)((e,t)=>{let n=0;for(let t of l.get(e)??[])n=Math.max(n,(r[t]??0)+1);let o=1/0,i=a.get(e)??[];return i.length>0&&(o=Math.min(...i.map(e=>(r[e]??0)-1))),Number.isFinite(o)||(o=Math.max(n,t)),Math.min(Math.max(t,n),o)},"clampFeasible"),u=(0,i.K)(e=>{let t=!1;for(let n of e){let e=l.get(n)??[],o=a.get(n)??[];if(0===e.length&&0===o.length)continue;let i=Math.round(((e.length>0?e.reduce((e,t)=>e+(r[t]??0)+1,0)/e.length:r[n]??0)+(o.length>0?o.reduce((e,t)=>e+(r[t]??0)-1,0)/o.length:r[n]??0))/2),s=d(n,i);s!==r[n]&&(r[n]=s,t=!0)}return t},"relaxOrder");for(let e=0;e<8;e++){let e=u(s),t=u(f);if(!e&&!t)break}for(let e of s){let t=0;for(let n of l.get(e)??[])t=Math.max(t,(r[n]??0)+1);(r[e]??0)<t&&(r[e]=t)}for(let e of f){let t=a.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(r[e]??0)-1));(r[e]??0)>n&&(r[e]=n)}}return{layers:tg(n,s,r),rankOf:r,dummy:new Set}}function tG(e){let t=td(e),n=tf(e),r=tu(t),o=[];for(;r.length>0;){let e=[];for(let l of r)for(let r of(o.push(l),n.get(l)??[]))t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0&&e.push(r);r=e.sort((e,t)=>e.localeCompare(t))}return o.length===e.nodes.length?o:null}function tD(e,t){let n=ti(e),r=t?.direction==="LR"?tG(n)??[...n.nodes].sort():tc(n)??[...n.nodes].sort(),o=tb(n),l=(0,i.K)(e=>o(e)??e,"laneOf"),a=Object.create(null),s=new Map,f=(0,i.K)((e,n)=>t?.ignoreCrossLaneEdges??!0?+(l(e)===l(n)):1,"edgeWeight");for(let e of r){let t=n.nodeById.get(e);if(t?.isGroup)continue;let r=ta(n,e),o=0;if(r.length>0)for(let t of r){let n=t.src;o=Math.max(o,(a[n]??0)+f(n,e))}let i=l(e),d=Math.max(o,s.get(i)??0);a[e]=d,s.set(i,d+1)}return{layers:tg(n,r,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function tP(e,t){let n=ti(t),{rankOf:r}=e,o=e.layers.map(e=>[...e]),l=new Set(e.dummy?[...e.dummy]:[]),a=0,s=new Map(n.nodeById),f=(0,i.K)(e=>{let t=`placeholder-${a++}`;for(s.set(t,{id:t,isGroup:!1,isDummy:!0,width:0,height:0}),l.add(t);o.length<=e;)o.push([]);return o[e].push(t),r[t]=e,t},"addDummyAt"),d=[...n.edges].sort((e,t)=>e.id===t.id?e.src===t.src?e.dst.localeCompare(t.dst):e.src.localeCompare(t.src):e.id.localeCompare(t.id)),u=[];for(let e of d){let t=r[e.src]??0,n=r[e.dst]??0;if(n-t<=1){u.push(e);continue}let o=e.src;for(let r=t+1,l=0;r<n;r++,l++){let t=f(r);u.push({id:`${e.id}#${l}`,src:o,dst:t,weight:e.weight,ref:e.ref}),o=t}let l=n-t-2;u.push({id:`${e.id}#${Math.max(l+1,0)}`,src:o,dst:e.dst,weight:e.weight,ref:e.ref})}let h={nodes:[...n.nodes,...[...l].filter(e=>!n.nodes.includes(e))],edges:u,layout:n.layout,nodeById:s};return{layering:{layers:o,rankOf:r,dummy:l},graphWithDummies:h}}function tH(e){let t=e.length;if(0===t)return 1/0;let n=[...e].sort((e,t)=>e-t);return t%2==1?n[(t-1)/2]:.5*(n[t/2-1]+n[t/2])}function tj(e){return 0===e.length?1/0:e.reduce((e,t)=>e+t,0)/e.length}function t_(e,t,n,r){let o=new Map;for(let t of e)o.set(t,[]);for(let e of n)"down"===r?t.has(e.src)&&o.has(e.dst)&&o.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&o.has(e.src)&&o.get(e.src).push(t.get(e.dst));return o}function tV(e,t,n){let r=n.get(e)??0,o=n.get(t)??0;return r!==o?r-o:e.localeCompare(t)}function tW(e,t,n){let r=new Set(e),o=new Set(t),l=tp(e),i=tp(t),a=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&a.push({u:l.get(e.src),v:i.get(e.dst)});return a.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),tx(a.map(e=>e.v))}function tq(e,t,n){return[...e].sort((e,r)=>{let o=tH(t.get(e)??[]),l=tH(t.get(r)??[]);return o===l?tV(e,r,n):isFinite(o)?isFinite(l)?o-l:-1:1})}function tJ(e,t,n,r,o,l){let i=tp(e),a=tp(t),s=t_(t,i,n,r);if(!o||!l||0===l.length)return tq(t,s,a);let f=new Map;for(let e of t){let t=o(e),n=f.get(t)??[];n.push(e),f.set(t,n)}let d=[];for(let e of l){let t=f.get(e);if(!t||0===t.length)continue;let n=tq(t,s,a);d.push(...n)}let u=f.get(null);if(u&&u.length>0)for(let e of tq(u,s,a)){let t=tj(s.get(e)??[]),n=d.length;if(isFinite(t)){for(let[e,r]of d.entries())if(t<tj(s.get(r)??[])){n=e;break}}d.splice(n,0,e)}return d}function tQ(e,t,n,r,o){let l=[...t],a=new Set(e),s=new Set(t),f=r?new Set(r):null,d=n.filter(e=>a.has(e.src)&&s.has(e.dst)),u=f?n.filter(e=>s.has(e.src)&&f.has(e.dst)):void 0,h=(0,i.K)(t=>{let n=tW(e,t,d);return u&&r&&(n+=tW(t,r,u)),n},"crossingScore"),g=o?new Map:null;if(o&&g)for(let e of t)g.set(e,o(e));let c=!0,p=h(l);for(;c;){c=!1;for(let e=0;e+1<l.length;e++){if(g&&g.get(l[e])!==g.get(l[e+1]))continue;let t=p;[l[e],l[e+1]]=[l[e+1],l[e]];let n=h(l);n<t?(p=n,c=!0):[l[e],l[e+1]]=[l[e+1],l[e]]}}return l}function tU(e,t,n){let r=e.layers.map(e=>[...e]),o=t.edges,l=tb(t),i=tK(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=tJ(r[e-1],r[e],o,"down",l,i),r[e]=tQ(r[e-1],r[e],o,r[e+1],l);for(let e=r.length-2;e>=0;e--)r[e]=tJ(r[e+1],r[e],o,"up",l,i),r[e]=tQ(r[e+1],r[e],o,r[e-1],l)}return{layers:r}}function tZ(e,t,n){let r=n?.layerGap??100,o=n?.nodeGap??40,l=n?.laneGap??2*o,a=n?.direction??"TB",s=e.layers,f=Object.create(null),d=Object.create(null),u=(0,i.K)(e=>t.nodeById.get(e),"getNode"),h=(0,i.K)(e=>u(e)?.width??0,"getWidth"),g=(0,i.K)(e=>u(e)?.height??0,"getHeight"),c=tb(t),p=tK(t,n?.laneOrder),x=s.map(e=>e.reduce((e,t)=>Math.max(e,g(t)),0)),m=[];if("LR"===a||"RL"===a)for(let e=0;e+1<s.length;e++){let t=Math.max(0,(s[e].reduce((e,t)=>Math.max(e,h(t)),0)+s[e+1].reduce((e,t)=>Math.max(e,h(t)),0))/2-(x[e]/2+x[e+1]/2)-r);m.push(t)}let y=new Set;for(let e of s)for(let t of e)y.add(c(t));let b=y.has(null),M=p.filter(e=>y.has(e)),K=[...b?[null]:[],...M],I=Object.create(null);for(let e of M)I[e]=0;for(let e of(b&&(I.null=0),s)){let t=Object.create(null),n=[];for(let r of e){let e=c(r);null===e?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+h(t),0)+o*Math.max(0,n.length-1);I[e]=Math.max(I[e]??0,t)}if(b&&n.length){let e=n.reduce((e,t)=>e+h(t),0)+o*Math.max(0,n.length-1);I.null=Math.max(I.null??0,e)}}let w=new Map;{let e=K.map(e=>(null===e?I.null:I[e])??0),t=-(e.reduce((e,t)=>e+t,0)+l*Math.max(0,K.length-1))/2;for(let n=0;n<K.length;n++){let r=K[n],o=e[n]??0,i=t+o/2;w.set(r,i),t+=o,n<K.length-1&&(t+=l)}}let S=0;for(let[e,t]of s.entries()){let n=x[e]??0,l=new Map;for(let e of t){let t=c(e),n=l.get(t)??[];n.push(e),l.set(t,n)}for(let e of K){let t=l.get(e)??[];if(0===t.length)continue;let r=w.get(e);if(1===t.length){let e=t[0];f[e]=r,d[e]=S+n/2}else{let e=t.map(e=>h(e)),l=r-(e.reduce((e,t)=>e+t,0)+o*(t.length-1))/2;for(let[r,i]of t.entries()){let t=e[r];f[i]=l+t/2,d[i]=S+n/2,l+=t+o}}}S+=n+r+(m[e]??0)}let v=new Map;for(let e of t.edges){let t=e.ref.id;v.has(t)||v.set(t,[]),v.get(t).push(e)}for(let[,e]of v){if(0===e.length)continue;let n=e[0].ref,r=n.start,o=n.end;if(null==r||null==o)continue;let l=Math.round(((f[r]??0)+(f[o]??0))/2),i=new Set;for(let t of e)i.add(t.src),i.add(t.dst);for(let e of i){if(e===r||e===o)continue;let n=t.nodeById.get(e);n?.isDummy&&(f[e]=l)}}return{x:f,y:d}}function t0(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,0x1000193);return t>>>0}function t1(e){let t=e>>>0;return()=>{let e=t+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000}}function t2(e,t){let n=[...e],r=t1(t);for(let e=n.length-1;e>0;e--){let t=Math.floor(r()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}function t6(e,t){let n=0;for(let[r,o]of e.entries())n+=Math.abs(r-(t.get(o)??r));return n}function t5(e,t){let n=new Map;for(let[t,r]of e.entries())n.set(r,t);let r=0;for(let{a:e,b:o,weight:l}of t){let t=n.get(e),i=n.get(o);null!=t&&null!=i&&(r+=l*Math.abs(t-i))}return r}function t3(e){let t=tM(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=tb(e),o=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let l="string"==typeof t.start?t.start:void 0,i="string"==typeof t.end?t.end:void 0;if(!l||!i||!e.nodeById.has(l)||!e.nodeById.has(i))continue;let a=r(l),s=r(i);if(!a||!s||a===s)continue;let f=n.get(a),d=n.get(s);if(null==f||null==d)continue;let[u,h]=f<=d?[a,s]:[s,a],g=`${u}\0${h}`,c=o.get(g);c?c.weight++:o.set(g,{a:u,b:h,weight:1})}return[...o.values()]}function t8(e,t,n){let r=[...e],o=t5(r,t),l=!0,i=0,a=Math.max(1,r.length);for(;l&&i<a;){l=!1,i++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=t5(r,t);n<o?(o=n,l=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:o,sourceDistance:t6(r,n)}}function t4(e,t){return e.cost!==t.cost?e.cost<t.cost:e.sourceDistance<t.sourceDistance}function t9(e,t,n){let r=[...t].sort((e,t)=>e.a===t.a?e.b.localeCompare(t.b):e.a.localeCompare(t.a)).map(({a:e,b:t,weight:n})=>`${e}:${t}:${n}`).join("|");return t0(`${e.join("|")}#${r}#${n}`)}function t7(e,t={}){let n=tM(e);if(n.length<2)return n;let r=t3(e);if(0===r.length)return n;let o=new Map(n.map((e,t)=>[e,t])),l=t8(n,r,o),i=Math.max(0,t.restarts??8);for(let e=0;e<i;e++){let t=t9(n,r,e),i=t8(t2(n,t),r,o);t4(i,l)&&(l=i)}return l.order}function ne(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,o=ti(e),l=t?.automaticLaneOrdering?t7(o,{restarts:8}):void 0,i=tm(o),a=i.acyclic,{layering:s,graphWithDummies:f}=tP(n?tD(a,{compactSingleInput:t?.compactSingleInput??!0,ignoreCrossLaneEdges:!0,direction:t?.direction}):tA(a,{compactSingleInput:t?.compactSingleInput??!0,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),a),d=tU(s,f,{laneOrder:l}),u=tZ(d,f,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:l});return{acyclic:a,reversed:i.reversed,layering:s,ordered:d,coordinates:u}}function nt(e,t,n){let r=e.x??0,o=e.y??0,l=t.x-r,i=t.y-o,a=Math.abs(l),s=Math.abs(i);return a<1e-6&&s<1e-6?n:s>1e-6&&3*s>=a?i>0?"bottom":"top":a>1e-6?l>0?"right":"left":n}function nn(e,t){return 1e-6>Math.abs(e.to-t.from)||1e-6>Math.abs(e.to-t.to)?e.to:e.from}function nr(e,t){return"vertical"===e.orient?{x:e.coord,y:t}:{x:t,y:e.coord}}function no(e,t){let n=e.nodes??[],r=e.edges??[],o=[];for(let e of r)e.isLayoutOnly||o.push({...e,__originalEdge:e});let l=new Map,a=new Map,s=[],f="LR"===t;for(let e of n)l.set(e.id,e);for(let e of n.filter(e=>e.isGroup&&!e.parentId)){let t={id:e.id},r=(0,i.K)(e=>{a.set(e.id,t),n.filter(t=>t.parentId===e.id).forEach(r)},"assignLane");r(e)}let d=n.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,o=e.y??0;return{nodeId:e.id,minX:r-t/2-8,maxX:r+t/2+8,minY:o-n/2-8,maxY:o+n/2+8,visualXHalfExtent:f?n/2+8:t/2+8}}),u=(0,i.K)((e,t,n,r)=>{let o=s.find(n=>n.orientation===e&&1>Math.abs(n.coord-t));return o||(o={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},s.push(o)),o.spanMin=Math.min(o.spanMin,n),o.spanMax=Math.max(o.spanMax,r),o},"getOrAddPipe"),h=(0,i.K)((e,t)=>{let n=e.width??10,r=e.height??10,o=e.x??0,l=e.y??0;switch(t){case"top":return{x:o,y:l-r/2};case"bottom":return{x:o,y:l+r/2};case"left":return{x:o-n/2,y:l};case"right":return{x:o+n/2,y:l}}},"portForSide"),g=(0,i.K)((e,t,n)=>h(e,nt(e,t,n?"bottom":"top")),"getOrthogonalPort"),c=[],p=[],x=new Set,m=(0,i.K)((e,t,n)=>{if(0===c.length)return 0;let r=1e-6>Math.abs(t.y-n.y),o=1e-6>Math.abs(t.x-n.x);if(!r&&!o)return 0;let l=0;if(r){let r=t.y,o=Math.min(t.x,n.x)-1e-6,i=Math.max(t.x,n.x)+1e-6;if(i<=o)return 0;for(let t of c)t.edgeIndex!==e&&"vertical"===t.orientation&&!(t.pipe.coord<o)&&!(t.pipe.coord>i)&&t.from-1e-6<=r&&t.to+1e-6>=r&&(l+=1e3)}else if(o){let r=t.x,o=Math.min(t.y,n.y)-1e-6,i=Math.max(t.y,n.y)+1e-6;if(i<=o)return 0;for(let t of c)t.edgeIndex!==e&&"horizontal"===t.orientation&&!(t.pipe.coord<o)&&!(t.pipe.coord>i)&&t.from-1e-6<=r&&t.to+1e-6>=r&&(l+=1e3)}return l},"crossingPenalty"),y=o.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=l.get(e.start),r=l.get(e.end),o=a.get(e.start),i=a.get(e.end),s=o&&i&&o.id!==i.id?1:0;return{idx:t,crossLane:s,dx:n&&r?Math.abs((r.x??0)-(n.x??0)):0,dy:n&&r?Math.abs((r.y??0)-(n.y??0)):0}}).sort((e,t)=>{if(e.crossLane!==t.crossLane)return t.crossLane-e.crossLane;let n=e.dx+e.dy,r=t.dx+t.dy;return Math.abs(n-r)>1?n-r:e.idx-t.idx}).map(e=>e.idx),b=(0,i.K)((e,t,n,r)=>{let o=Math.min(e.x,t.x),l=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return!!d.find(s=>(!n||s.nodeId!==n)&&(!r||s.nodeId!==r)&&(Math.abs(e.x-t.x)>1e-6?s.minY<e.y&&s.maxY>e.y&&s.maxX>o&&s.minX<l:s.minX<e.x&&s.maxX>e.x&&s.maxY>i&&s.minY<a))},"isSegmentBlocked"),M=new Map,K=new Map;for(let e of o)e.start&&e.end&&e.start!==e.end&&(K.set(e.start,(K.get(e.start)??0)+1),K.set(e.end,(K.get(e.end)??0)+1));let I=(0,i.K)((e,t)=>nt(e,t,"bottom"),"determineSide"),w=new Map;for(let[e,t]of o.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=l.get(t.start),r=l.get(t.end);if(!n||!r)continue;let o=(r.x??0)-(n.x??0),i=(r.y??0)-(n.y??0);w.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:I(n,{x:r.x??0,y:r.y??0}),dstSide:I(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(o),absDy:Math.abs(i),dxSign:Math.sign(o),dySign:Math.sign(i)})}let S=(0,i.K)(e=>"top"===e.srcSide||"bottom"===e.srcSide?0===e.absDx?1/0:e.absDy/e.absDx:0===e.absDy?1/0:e.absDx/e.absDy,"preferenceStrength"),v=(0,i.K)(e=>"top"===e.srcSide||"bottom"===e.srcSide?e.dxSign>=0?"right":"left":e.dySign>=0?"bottom":"top","secondarySide"),C=new Map;for(let e of w.values()){let t=`${e.srcId}:${e.srcSide}`;C.has(t)||C.set(t,[]),C.get(t).push(e)}let L=new Map,k=(0,i.K)((e,t)=>`${e}:${t}`,"loadKey");for(let e of w.values())L.set(k(e.srcId,e.srcSide),(L.get(k(e.srcId,e.srcSide))??0)+1),L.set(k(e.dstId,e.dstSide),(L.get(k(e.dstId,e.dstSide))??0)+1);for(let e of C.values())if(!(e.length<2)){e.sort((e,t)=>{let n=S(e),r=S(t);return Math.abs(n-r)>1e-9?r-n:e.edgeIdx-t.edgeIdx});for(let t=1;t<e.length;t++){let n=e[t],r=v(n),o=L.get(k(n.srcId,n.srcSide))??0,l=L.get(k(n.srcId,r))??0;l>=o||(L.set(k(n.srcId,n.srcSide),o-1),L.set(k(n.srcId,r),l+1),n.srcSide=r)}}let $=(0,i.K)(e=>{let t=e?.shape;return"question"===t||"diamond"===t},"isDiamondNode"),R=new Map;for(let e of w.values())R.has(e.dstId)||R.set(e.dstId,new Set),R.get(e.dstId).add(e.dstSide);for(let e of w.values()){if(!$(l.get(e.srcId)))continue;let t=R.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=v(e);if(t.has(n)||(L.get(k(e.srcId,n))??0)>0)continue;let r=L.get(k(e.srcId,e.srcSide))??0;L.set(k(e.srcId,e.srcSide),Math.max(0,r-1)),L.set(k(e.srcId,n),1),e.srcSide=n}for(let e of w.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:o,dstSide:i}=e,a=l.get(n),s=l.get(r),f=`${n}:${o}:src`,d="top"===o||"bottom"===o?s.x??0:s.y??0;M.has(f)||M.set(f,[]),M.get(f).push({edgeIdx:t,oppositeCoord:d});let u=`${r}:${i}:dst`,h="top"===i||"bottom"===i?a.x??0:a.y??0;M.has(u)||M.set(u,[]),M.get(u).push({edgeIdx:t,oppositeCoord:h})}let O=new Map;for(let[e,t]of M){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(":"),r=n.slice(0,-2).join(":"),o=n[n.length-2],i=n[n.length-1],a=l.get(r);if(!a)continue;let s="left"===o||"right"===o?a.height??10:a.width??10,f=a.shape,d=Math.min(20,Math.max(8,("question"===f||"diamond"===f?.3*s:s)/(t.length+1))),u=-(d*(t.length-1))/2;for(let[e,n]of t.entries()){let t=u+e*d,r=`${n.edgeIdx}:${i}`;O.set(r,t)}}let T=(0,i.K)(e=>!!o[e]?.labelNodeId,"edgeHasLabelNode"),F=(0,i.K)((e,t)=>!!e&&((M.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>T(e))||(M.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>T(e))),"faceHasLabelNode"),E=(0,i.K)((e,t,n)=>"top"===t||"bottom"===t?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},"applyPortOffset"),B=(0,i.K)((e,t,n)=>{let r=w.get(e),o={x:n.x??0,y:n.y??0},l={x:t.x??0,y:t.y??0},i=r?.srcSide??I(t,o),a=r?.dstSide??I(n,l),s=r?h(t,r.srcSide):g(t,o,!0),f=r?h(n,r.dstSide):g(n,l,!1),d=O.get(`${e}:src`),u=O.get(`${e}:dst`);return void 0!==d&&(s=E(s,i,d)),void 0!==u&&(f=E(f,a,u)),{pSrcPort:s,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(let e of y){let t=o[e];if(p[e]=[],!t.start||!t.end||t.points&&t.points.length>0||t.start===t.end)continue;let n=l.get(t.start),r=l.get(t.end);if(!n||!r)continue;let{pSrcPort:a,pDstPort:h,srcSide:g,dstSide:y}=B(e,n,r),I={...a},w={...h},S="top"===g||"bottom"===g,v="top"===y||"bottom"===y;S?I.y=a.y>(n.y??0)?a.y+20:a.y-20:I.x=a.x>(n.x??0)?a.x+20:a.x-20,v?w.y=h.y>(r.y??0)?h.y+20:h.y-20:w.x=h.x>(r.x??0)?h.x+20:h.x-20;let C=(0,i.K)((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),L=(0,i.K)((e,t,n,r,o)=>{if(o){let o=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+15:r.minX-15,y:o?r.maxY+15:r.minY-15,leavesPositiveSide:o}}let l=e.x>(t.x??0),i=(n.y??0)>=e.y;return{x:l?r.maxX+15:r.minX-15,y:i?r.maxY+15:r.minY-15,leavesPositiveSide:l}},"obstacleDetour"),k=[],$=[t.start,t.end],R=C(I,$);if(R.inside&&R.obstacle){let e=R.obstacle;if(S){let t=L(a,n,r,e,!0);I.x=t.x,I.y=t.y;let o=t.leavesPositiveSide?Math.min(e.minY-2,a.y+20):Math.max(e.maxY+2,a.y-20);k=[{x:a.x,y:o},{x:t.x,y:o},{x:t.x,y:t.y}]}else{let t=L(a,n,r,e,!1),o=t.leavesPositiveSide?Math.min(e.minX-2,a.x+20):Math.max(e.maxX+2,a.x-20);I.x=t.x,I.y=t.y,k=[{x:o,y:a.y},{x:o,y:t.y},{x:t.x,y:t.y}]}}let T=[],E=C(w,$);if(E.inside&&E.obstacle){let e=E.obstacle;if(v){let t=L(h,r,n,e,!0);w.x=t.x,w.y=t.y,T=[{x:t.x,y:t.y},{x:h.x,y:t.y}]}else{let t=L(h,r,n,e,!1);w.x=t.x,w.y=t.y,T=[{x:t.x,y:t.y},{x:t.x,y:h.y}]}}if(0===k.length&&0===T.length){let n=15>Math.abs(I.x-w.x),r=15>Math.abs(I.y-w.y),o=void 0!==O.get(`${e}:src`)||void 0!==O.get(`${e}:dst`),l=(M.get(`${t.start??""}:${g}:src`)?.length??0)+(M.get(`${t.start??""}:${g}:dst`)?.length??0),i=(M.get(`${t.end??""}:${y}:src`)?.length??0)+(M.get(`${t.end??""}:${y}:dst`)?.length??0),s=l>1||i>1,f=K.get(t.start??"")??0,d=K.get(t.end??"")??0,u=l>1&&F(t.start,g)||i>1&&F(t.end,y),p=l<=1||f<=2,m=i<=1||d<=2,S=s&&!u&&p&&m;if((n||r)&&!o&&(!s||S)&&!b(a,h,t.start,t.end)){t.points=[{...a},{...I},{...w},{...h}],x.add(e);let n=r?"horizontal":"vertical",o=r?a.y:a.x,l=r?Math.min(a.x,h.x):Math.min(a.y,h.y),i=r?Math.max(a.x,h.x):Math.max(a.y,h.y),s={id:`fast-path-${n}-${o.toFixed(0)}-${e}`,orientation:n,coord:o,spanMin:l,spanMax:i,tracks:[]};c.push({edgeIndex:e,segmentIndex:0,orientation:n,pipe:s,trackIndex:0,from:l,to:i});continue}}let N=u("vertical",I.x,I.y,I.y);I.x=N.coord;let X=u("vertical",w.x,w.y,w.y);w.x=X.coord;let z=Math.min(I.x,w.x)-50,Y=Math.max(I.x,w.x)+50,A=Math.min(I.y,w.y)-50,G=Math.max(I.y,w.y)+50;for(let e of d){let t=Math.min(I.x,w.x),n=Math.max(I.x,w.x),r=Math.min(I.y,w.y),o=Math.max(I.y,w.y);e.minX<n&&e.maxX>t&&e.minY<o&&e.maxY>r&&(z=Math.min(z,e.minX-25),Y=Math.max(Y,e.maxX+25),A=Math.min(A,e.minY-25),G=Math.max(G,e.maxY+25))}for(let e of d)e.maxX<z||e.minX>Y||e.maxY<A||e.minY>G||(u("horizontal",e.minY-15,z,Y),u("horizontal",e.maxY+15,z,Y),u("vertical",e.minX-15,A,G),u("vertical",e.maxX+15,A,G));u("horizontal",I.y,z,Y),u("horizontal",w.y,z,Y);let D=s.filter(e=>"horizontal"===e.orientation&&e.coord>=A&&e.coord<=G),P=s.filter(e=>"vertical"===e.orientation&&e.coord>=z&&e.coord<=Y),H=(0,i.K)((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,"getKey"),j=H(I.x,I.y),_=H(w.x,w.y),V=new Map,W=new Map,q=new Map,J=new Set,Q=[];V.set(j,0),q.set(j,"n"),Q.push({key:j,f:Math.hypot(w.x-I.x,w.y-I.y),pt:I}),J.add(j);let U=[],Z=(0,i.K)((e,n)=>b(e,n,t.start,t.end),"checkSegmentBlocked"),ee={x:w.x,y:I.y},et=Z(I,ee),en=Z(ee,w),er=et||en,eo={x:I.x,y:w.y},el=Z(I,eo),ei=Z(eo,w),ea=el||ei;if(er?ea||(U=1e-6>Math.abs(I.x-w.x)?[I,w]:[I,eo,w]):U=1e-6>Math.abs(I.y-w.y)||1e-6>Math.abs(I.x-w.x)?[I,w]:[I,ee,w],0===U.length)for(;Q.length>0;){Q.sort((e,t)=>e.f-t.f);let n=Q.shift();if(J.delete(n.key),n.key===_){let e=_,t=w;for(U=[t];W.has(e);){let n=W.get(e);U.unshift(n),t=n,e=H(n.x,n.y)}break}let r=n.pt.x,o=n.pt.y,l=P.sort((e,t)=>e.coord-t.coord),i=l.findIndex(e=>1>Math.abs(e.coord-r)),a=D.sort((e,t)=>e.coord-t.coord),s=a.findIndex(e=>1>Math.abs(e.coord-o)),f=[];for(let u of(i>0&&f.push({x:l[i-1].coord,y:o}),i>=0&&i<l.length-1&&f.push({x:l[i+1].coord,y:o}),s>0&&f.push({x:r,y:a[s-1].coord}),s>=0&&s<a.length-1&&f.push({x:r,y:a[s+1].coord}),f)){let l=Math.min(r,u.x),i=Math.max(r,u.x),a=Math.min(o,u.y),s=Math.max(o,u.y);if(d.some(e=>e.nodeId!==t.start&&e.nodeId!==t.end&&(l!==i?e.minY<o&&e.maxY>o&&e.maxX>l&&e.minX<i:e.minX<r&&e.maxX>r&&e.maxY>a&&e.minY<s)))continue;let f=H(u.x,u.y),h=Math.abs(u.x-r)+Math.abs(u.y-o),g=m(e,n.pt,u),c=0,p=w.x-I.x,x=w.y-I.y,y=u.x-r,b=u.y-o;(x>10&&b<-5||x<-10&&b>5)&&(c=100*Math.abs(b)),(p>10&&y<-5||p<-10&&y>5)&&(c+=50*Math.abs(y));let M=0,K=q.get(n.key)??"n",S=Math.abs(y)>1e-6?"h":"v";"n"!==K&&K!==S&&(M=50);let v=h+g+c+M,C=(V.get(n.key)??1/0)+v,L=Math.abs(w.x-u.x)+Math.abs(w.y-u.y);if(C<(V.get(f)??1/0))if(W.set(f,n.pt),V.set(f,C),q.set(f,S),J.has(f)){let e=Q.findIndex(e=>e.key===f);-1!==e&&(Q[e].f=C+L)}else Q.push({key:f,f:C+L,pt:u}),J.add(f)}}if(0===U.length&&(U=[I,{x:I.x,y:w.y},w]),U.length>4){let e=U[0],t=U[U.length-1],n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y);for(let e of U)n=Math.min(n,e.x),r=Math.max(r,e.x),o=Math.min(o,e.y),l=Math.max(l,e.y);let a=r>Math.max(e.x,t.x),s=n<Math.min(e.x,t.x);if(f){if(a){let n=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y),i=d.filter(e=>e.minX<n&&e.maxX>n&&e.minY<l&&e.maxY>o);if(i.length>0){let n=Math.max(e.x,t.x);for(let e of i){let t=(e.minX+e.maxX)/2;void 0===e.visualXHalfExtent||isNaN(e.visualXHalfExtent)||(n=Math.max(n,t+e.visualXHalfExtent+15))}isNaN(n)||(r=n)}}if(s){let r=d.filter(n=>n.minX<Math.min(e.x,t.x)+15&&n.minY<Math.max(e.y,t.y)&&n.maxY>Math.min(e.y,t.y));if(r.length>0){let o=Math.min(e.x,t.x);for(let e of r)o=Math.min(o,(e.minX+e.maxX)/2-e.visualXHalfExtent-15);n=o}}}let u=(0,i.K)(n=>{let r=t.y>e.y,o=d.filter(n=>{let r=Math.min(e.x,t.x)<n.maxX&&Math.max(e.x,t.x)>n.minX,o=Math.min(e.y,t.y)<n.maxY&&Math.max(e.y,t.y)>n.minY;return r&&o}),l=o;if(f&&o.length>0){let e=o.filter(e=>e.minX<n&&e.maxX>n);e.length>0&&(l=e)}if(0===l.length)return t.y;if(r){let e=Math.max(...l.map(e=>e.maxY))+15;if(e<t.y-1e-6)return e}else{let e=Math.min(...l.map(e=>e.minY))-15;if(e>t.y+1e-6)return e}return t.y},"findBestReturnY"),h=(0,i.K)(n=>{let r=u(n),o={x:n,y:e.y},l={x:n,y:r},i={x:t.x,y:r},a=Z(e,o),s=Z(o,l),f=Z(l,i),d=r!==t.y&&Z(i,t);return a||s||f||d?null:1e-6>Math.abs(r-t.y)?[e,o,l,t]:[e,o,l,i,t]},"trySimplifyWithDetourX"),g=a&&!s?h(r):s&&!a?h(n):null;g&&(U=g)}let es=[a,...k,...U,...T.reverse(),h];if(es.length>=3){let e=es[es.length-1],t=es[es.length-2],n=es[es.length-3],r=1e-6>Math.abs(n.y-t.y)&&1e-6>Math.abs(t.y-e.y),o=1e-6>Math.abs(n.x-t.x)&&1e-6>Math.abs(t.x-e.x);if(r){let r=Math.sign(t.x-n.x),o=Math.sign(e.x-n.x);0!==r&&r===o&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&es.splice(-2,1)}else if(o){let r=Math.sign(t.y-n.y),o=Math.sign(e.y-n.y);0!==r&&r===o&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&es.splice(-2,1)}}let ef=[es[0]];for(let e=1;e<es.length-1;e++){if(1===e){ef.push(es[e]);continue}let t=ef[ef.length-1],n=es[e],r=es[e+1];if(1e-6>Math.abs(t.y-n.y)&&1e-6>Math.abs(n.y-r.y)){n.x>t.x!=r.x>n.x&&ef.push(n);continue}if(1e-6>Math.abs(t.x-n.x)&&1e-6>Math.abs(n.x-r.x)){n.y>t.y!=r.y>n.y&&ef.push(n);continue}ef.push(n)}ef.push(es[es.length-1]);for(let t=0;t<ef.length-1;t++){let n=ef[t],r=ef[t+1],o=1e-6>Math.abs(n.x-r.x)?"vertical":"horizontal",l="vertical"===o?n.x:n.y,i="vertical"===o?Math.min(n.y,r.y):Math.min(n.x,r.x),a="vertical"===o?Math.max(n.y,r.y):Math.max(n.x,r.x),s=u(o,l,i,a),f={edgeIndex:e,segmentIndex:t,orientation:o,pipe:s,trackIndex:0,from:i,to:a};c.push(f),p[e].push(c.length-1),s.tracks[0]||(s.tracks[0]={index:0,coord:s.coord,segments:[]}),s.tracks[0].segments.push({edgeIndex:e,segmentIndex:t,from:i,to:a})}}let N=(0,i.K)((e,t)=>e.from<t.to&&t.from<e.to,"segmentsOverlap"),X=(0,i.K)((e,t,n,r)=>{let o=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&N(n,e)),l=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&N(n,t));return!!o&&!!l&&(e.trackIndex=r.index,t.trackIndex=n.index,n.segments=[...n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],r.segments=[...r.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],!0)},"trySwapSegmentsAcrossTracks"),z=(0,i.K)(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},"createNewTrack"),Y=(0,i.K)((e,t)=>{let n=e.pipe.tracks[e.trackIndex];n.segments=n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),e.trackIndex=t,e.pipe.tracks[t].segments.push({edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to})},"moveSegmentToTrack"),A=(0,i.K)((e,t)=>{for(let n of p[e.edgeIndex]){let r=c[n];r.pipe===e.pipe&&Y(r,t)}},"moveSegmentChainToTrack"),G=(0,i.K)(e=>{let t=p[e.edgeIndex],n=t.indexOf(c.indexOf(e)),r=[];return n>0&&r.push(c[t[n-1]]),n<t.length-1&&r.push(c[t[n+1]]),r},"getAdjacentSegmentsAlongEdge"),D=(0,i.K)((e,t)=>{if(e.orientation===t.orientation)return!1;let n="horizontal"===e.orientation?e:t,r="horizontal"===e.orientation?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},"haveAnyCrossing"),P=(0,i.K)((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&N(e,t)))return n.index;return -1},"findAvailableTrack"),H=(0,i.K)((e,t)=>{if(e.trackIndex===t.trackIndex)return N(e,t);let n=G(e),r=G(t);return n.some(e=>r.some(t=>D(e,t)))},"segmentsConflict"),j=(0,i.K)((e,t,n)=>{if(X(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=P(e.pipe,t);n(t,-1!==r?r:z(e.pipe))},"resolveTrackConflict"),_=(0,i.K)(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let o=e[n],l=e[r];o.pipe===l.pipe&&H(o,l)&&(t++,j(o,l,A))}return t},"resolveHandleConflicts"),V=new Map,W=(0,i.K)(e=>{if(V.has(e))return V.get(e);let t=p[e];if(0===t.length){let t={dest:0,deviation:0,base:0,delta:0};return V.set(e,t),t}let n=c[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let o=c[t[e]];if("horizontal"===o.orientation){let e=o.from,t=o.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let o=Math.abs(r-n),l={dest:r,deviation:o,base:n,delta:r-n};return V.set(e,l),l},"getDestInfo"),q=(0,i.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==p[e].length&&n.start&&(t.has(n.start)||t.set(n.start,[]),t.get(n.start).push(e));let n=(0,i.K)(e=>{let t=o[e];if(!t.start||!t.end)return 0;let n=l.get(t.start),r=l.get(t.end);return n&&r?Math.abs((r.x??0)-(n.x??0))+Math.abs((r.y??0)-(n.y??0)):0},"getEdgeDistance");for(let r of t.values())r.sort((e,t)=>{let r=W(e),o=W(t);if(Math.abs(r.deviation-o.deviation)>1)return r.deviation-o.deviation;if(Math.abs(r.dest-o.dest)>1)return r.dest-o.dest;let l=n(e),i=n(t);if(Math.abs(l-i)>1)return i-l;let a=p[e].length,s=p[t].length;if(a!==s)return a-s;if(1===a){let n=p[e][0],r=p[t][0];if(c[n]&&c[r]){let e=c[n],t=c[r],o=Math.abs(e.to-e.from),l=Math.abs(t.to-t.from);if(Math.abs(o-l)>1)return o-l}}return 0}),e+=_(r.map(e=>c[p[e][0]]));return e},"fixSourceHandleCrossings"),J=(0,i.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==p[e].length&&n.end&&(t.has(n.end)||t.set(n.end,[]),t.get(n.end).push(e));for(let n of t.values())n.sort((e,t)=>{let n=(0,i.K)(e=>{let t=p[e];if(t.length<2)return 0;let n=c[t[t.length-2]];return Math.abs(n.to-n.from)},"getDist"),r=n(e),o=n(t);return Math.abs(r-o)>.1?r-o:e-t}),e+=_(n.map(e=>c[p[e][p[e].length-1]]));return e},"fixTargetHandleCrossings"),Q=(0,i.K)(()=>{let e=0;for(let t of s){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=p[t.edgeIndex].find(e=>c[e].segmentIndex===t.segmentIndex);void 0!==e&&n.push(c[e])}n.sort((e,t)=>e.edgeIndex-t.edgeIndex||e.segmentIndex-t.segmentIndex);for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let o=n[t],l=n[r];H(o,l)&&(e++,j(o,l,Y))}}return e},"fixPipeCrossings"),U=0;for(;U<10&&0!==0+q()+J()+Q();){;U++}let Z=new Map;for(let e of s){let t=[];e.tracks.forEach(e=>{e.segments.forEach(n=>{t.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:e.index,from:n.from,to:n.to})})}),t.sort((e,t)=>e.from-t.from);let n=[];if(t.length>0){let e=[t[0]],r=t[0].to;for(let o=1;o<t.length;o++){let l=t[o];l.from<r?(e.push(l),r=Math.max(r,l.to)):(n.push(e),e=[l],r=l.to)}n.push(e)}for(let t of n){let n=new Set;t.forEach(e=>n.add(e.trackIndex));let r=new Map;t.forEach(e=>{let t=W(e.edgeIndex);r.set(e.trackIndex,(r.get(e.trackIndex)??0)+t.delta)});let o=[...n].filter(e=>(r.get(e)??0)<-1),l=[...n].filter(e=>(r.get(e)??0)>1),a=[...n].filter(e=>1>=Math.abs(r.get(e)??0));o.sort((e,t)=>(r.get(t)??0)-(r.get(e)??0)),l.sort((e,t)=>(r.get(e)??0)-(r.get(t)??0));let s=(0,i.K)((n,r)=>{t.filter(e=>e.trackIndex===n).forEach(t=>{let n=x.has(t.edgeIndex)?e.coord:r;Z.set(`${t.edgeIndex}-${t.segmentIndex}`,n)})},"assignCoord"),f=0;for(let t of o)f++,s(t,e.coord-10*f);if(0===a.length&&n.size>0){let e=[...n].sort((e,t)=>Math.abs(r.get(e)??0)-Math.abs(r.get(t)??0))[0],t=o.indexOf(e);-1!==t&&o.splice(t,1);let i=l.indexOf(e);-1!==i&&l.splice(i,1),a.push(e)}let d=0;for(let t of a){if(0===d)s(t,e.coord);else{let n=d%2==1?1:-1,r=Math.ceil(d/2);s(t,e.coord+n*r*5)}d++}let u=0;for(let t of l)u++,s(t,e.coord+10*u)}}for(let[e,t]of o.entries()){let n=p[e]??[];if(0===n.length)continue;let r=[],{pSrcPort:o,pDstPort:i}=B(e,l.get(t.start),l.get(t.end)),a=n.map(e=>{let t=c[e],n=Z.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(o);for(let e=0;e<a.length;e++){let t=a[e],n=r[r.length-1],o="vertical"===t.orient?n.y:n.x,l="vertical"===t.orient?n.x:n.y,i=a[e+1],s=e<a.length-1;if(Math.abs(l-t.coord)>1e-6&&r.push(nr(t,o)),s&&i.orient===t.orient)if(Math.abs(t.coord-i.coord)>1e-6){let e="vertical"===t.orient?(o+i.from)/2:nn(t,i);r.push(nr(t,e),nr(i,e))}else(0===e||e===a.length-2)&&r.push(nr(t,nn(t,i)));else if(s)r.push(nr(t,i.coord));else{let e=Math.abs(t.from-o)<Math.abs(t.to-o)?t.to:t.from;r.push(nr(t,e))}}let s=r[r.length-1];(Math.abs(s.x-i.x)>1e-6||Math.abs(s.y-i.y)>1e-6)&&r.push(i);let f=[];r.length>0&&f.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=f[f.length-1];(Math.abs(t.x-n.x)>1e-6||Math.abs(t.y-n.y)>1e-6)&&f.push(t)}t.points=f}for(let e of o){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}e.edges=(e.edges??[]).filter(e=>!e.isLayoutOnly);let ee=(0,i.K)((e,t)=>{let n=t.x??0,r=t.y??0,o=t.width??0,l=t.height??0;if(o<=0||l<=0)return e;let i=n-o/2,a=n+o/2,s=r-l/2,f=r+l/2;if(e.x<i||e.x>a||e.y<s||e.y>f)return e;let d=e.x-i,u=a-e.x,h=e.y-s,g=Math.min(d,u,h,f-e.y);return g===d?{x:i,y:e.y}:g===u?{x:a,y:e.y}:g===h?{x:e.x,y:s}:{x:e.x,y:f}},"nodeBoundaryClamp");for(let t of e.edges){let e=t.points;if(!e||e.length<2)continue;let n=t.start,r=t.end,o=n?l.get(n):void 0,i=r?l.get(r):void 0;o&&(e[0]=ee(e[0],o)),i&&(e[e.length-1]=ee(e[e.length-1],i))}return e}function nl(e){return e.direction??"TB"}function ni(e){let t=k(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,o=e.config.swimlane?.ignoreCrossLaneEdges??!0,l=e.config.swimlane?.optimizeRanksByCrossings??!0,i=e.config.swimlane?.automaticLaneOrdering??!1,a=nl(e),{ordered:s,coordinates:f}=ne(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:o,optimizeRanksByCrossings:l,automaticLaneOrdering:i,direction:a});for(let o of($(t,s,f,{nodeGap:n,layerGap:r}),e.edges??[]))delete o.points;for(let t of(no(e,a),e.edges??[]))t.curve&&"basis"!==t.curve||(t.curve="rounded");return tl(e,a),to(e),a}function na(e){L(e);let t=R(e);e.nodes=t.nodes,e.edges=t.edges}(0,i.K)(tI,"buildDrivingTree"),(0,i.K)(tw,"chooseParent"),(0,i.K)(tS,"buildAdjacency"),(0,i.K)(tv,"assignComponents"),(0,i.K)(tC,"computeBlocks"),(0,i.K)(tL,"popBlock"),(0,i.K)(tk,"computeSubtreeCrossCounts"),(0,i.K)(t$,"annotateMinimumLayers"),(0,i.K)(tR,"compareByRankThenId"),(0,i.K)(tO,"emitNodesInTreeOrder"),(0,i.K)(tT,"deduplicateLayers"),(0,i.K)(tF,"createChildOrderer"),(0,i.K)(tE,"buildMultitreeLayerOrder"),(0,i.K)(tB,"countCrossingsBetweenAdjacent"),(0,i.K)(tN,"totalCrossings"),(0,i.K)(tX,"optimizeRanksByCrossings"),(0,i.K)(tz,"adjustCrossLaneSources"),(0,i.K)(tY,"assignLayers_LongestPath"),(0,i.K)(tA,"assignLayers_Gravity"),(0,i.K)(tG,"topoSortByGenerationIfAcyclic"),(0,i.K)(tD,"assignLayers_LaneAwareCompact"),(0,i.K)(tP,"makeProperLayering"),(0,i.K)(tH,"median"),(0,i.K)(tj,"barycenter"),(0,i.K)(t_,"neighborPositionsFor"),(0,i.K)(tV,"currentOrderTieBreak"),(0,i.K)(tW,"countCrossingsBetweenAdjacent"),(0,i.K)(tq,"sortByHeuristic"),(0,i.K)(tJ,"reorderLayer"),(0,i.K)(tQ,"transposeImprove"),(0,i.K)(tU,"orderLayers"),(0,i.K)(tZ,"assignCoordinates"),(0,i.K)(t0,"hashString"),(0,i.K)(t1,"mulberry32"),(0,i.K)(t2,"deterministicShuffle"),(0,i.K)(t6,"sourceDistance"),(0,i.K)(t5,"laneArrangementCost"),(0,i.K)(t3,"buildWeightedLaneEdges"),(0,i.K)(t8,"greedySwitch"),(0,i.K)(t4,"isBetterCandidate"),(0,i.K)(t9,"seedForRestart"),(0,i.K)(t7,"optimizeTopLaneOrder"),(0,i.K)(ne,"sugiyamaLayout"),(0,i.K)(nt,"chooseOrthogonalSide"),(0,i.K)(nn,"sharedLineEndpointCoord"),(0,i.K)(nr,"pointOnLine"),(0,i.K)(no,"routeEdgesOrthogonal"),(0,i.K)(nl,"getSwimlaneDirection"),(0,i.K)(ni,"runSwimlaneLayoutCore"),(0,i.K)(na,"prepareSwimlaneLayout");var ns=(0,r.xY)({prepareLayout:na,runLayoutCore:ni,afterPaint:w})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5354],{5354:(e,a,s)=>{s.d(a,{createRailroadPegServices:()=>c.P});var c=s(54225);s(27698)}}]);
@@ -0,0 +1,38 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5448],{80650:(e,t,a)=>{function i(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}a.d(t,{S:()=>i}),(0,a(89851).K)(i,"populateCommonDb")},95448:(e,t,a)=>{a.d(t,{diagram:()=>v});var i=a(80650),l=a(9797),r=a(52691),n=a(31775),s=a(56037),o=a(89851),c=a(88863),d=a(33948),p=n.UI.pie,h={sections:new Map,showData:!1,config:p},g=h.sections,u=h.showData,f=structuredClone(p),m=(0,o.K)(()=>structuredClone(f),"getConfig"),$=(0,o.K)(()=>{g=new Map,u=h.showData,(0,n.IU)()},"clear"),x=(0,o.K)(({label:e,value:t})=>{if(t<0)throw Error(`"${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);g.has(e)||(g.set(e,t),s.R.debug(`added new section: ${e}, with value: ${t}`))},"addSection"),w=(0,o.K)(()=>g,"getSections"),S=(0,o.K)(e=>{u=e},"setShowData"),y=(0,o.K)(()=>u,"getShowData"),b={getConfig:m,clear:$,setDiagramTitle:n.ke,getDiagramTitle:n.ab,setAccTitle:n.SV,getAccTitle:n.iN,setAccDescription:n.EI,getAccDescription:n.m7,addSection:x,getSections:w,setShowData:S,getShowData:y},C=(0,o.K)((e,t)=>{(0,i.S)(e,t),t.setShowData(e.showData),e.sections.map(t.addSection)},"populateDb"),D={parse:(0,o.K)(async e=>{let t=await (0,c.qg)("pie",e);s.R.debug(t),C(t,b)},"parse")},T=(0,o.K)(e=>`
2
+ .pieCircle{
3
+ stroke: ${e.pieStrokeColor};
4
+ stroke-width : ${e.pieStrokeWidth};
5
+ opacity : ${e.pieOpacity};
6
+ }
7
+ .pieCircle.highlighted{
8
+ scale: 1.05;
9
+ opacity: 1;
10
+ }
11
+ .pieCircle.highlightedOnHover:hover{
12
+ transition-duration: 250ms;
13
+ scale: 1.05;
14
+ opacity: 1;
15
+ }
16
+ .pieOuterCircle{
17
+ stroke: ${e.pieOuterStrokeColor};
18
+ stroke-width: ${e.pieOuterStrokeWidth};
19
+ fill: none;
20
+ }
21
+ .pieTitleText {
22
+ text-anchor: middle;
23
+ font-size: ${e.pieTitleTextSize};
24
+ fill: ${e.pieTitleTextColor};
25
+ font-family: ${e.fontFamily};
26
+ }
27
+ .slice {
28
+ font-family: ${e.fontFamily};
29
+ fill: ${e.pieSectionTextColor};
30
+ font-size:${e.pieSectionTextSize};
31
+ // fill: white;
32
+ }
33
+ .legend text {
34
+ fill: ${e.pieLegendTextColor};
35
+ font-family: ${e.fontFamily};
36
+ font-size: ${e.pieLegendTextSize};
37
+ }
38
+ `,"getStyles"),k=(0,o.K)(e=>{let t=[...e.values()].reduce((e,t)=>e+t,0),a=[...e.entries()].map(([e,t])=>({label:e,value:t})).filter(e=>e.value/t*100>=1);return(0,d.rLf)().value(e=>e.value).sort(null)(a)},"createPieArcs"),v={parser:D,db:b,renderer:{draw:(0,o.K)((e,t,a,i)=>{s.R.debug("rendering pie chart\n"+e);let o=i.db,c=(0,n.D7)(),p=(0,r.$t)(o.getConfig(),c.pie),h=(0,l.D)(t),g=h.append("g");g.attr("transform","translate(225,225)");let{themeVariables:u}=c,[f]=(0,r.I5)(u.pieOuterStrokeWidth);f??=2;let m=p.legendPosition,$=p.textPosition,x=p.donutHole>0&&p.donutHole<=.9?p.donutHole:0,w=(0,d.JLW)().innerRadius(185*x).outerRadius(185),S=(0,d.JLW)().innerRadius(185*$).outerRadius(185*$),y=g.append("g");y.append("circle").attr("cx",0).attr("cy",0).attr("r",185+f/2).attr("class","pieOuterCircle");let b=o.getSections(),C=k(b),D=[u.pie1,u.pie2,u.pie3,u.pie4,u.pie5,u.pie6,u.pie7,u.pie8,u.pie9,u.pie10,u.pie11,u.pie12],T=0;b.forEach(e=>{T+=e});let v=C.filter(e=>"0"!==(e.data.value/T*100).toFixed(0)),A=(0,d.UMr)(D).domain([...b.keys()]);y.selectAll("mySlices").data(v).enter().append("path").attr("d",w).attr("fill",e=>A(e.data.label)).attr("class",e=>{let t="pieCircle";return"hover"===p.highlightSlice?t+=" highlightedOnHover":p.highlightSlice===e.data.label&&(t+=" highlighted"),t}),y.selectAll("mySlices").data(v).enter().append("text").text(e=>(e.data.value/T*100).toFixed(0)+"%").attr("transform",e=>"translate("+S.centroid(e)+")").style("text-anchor","middle").attr("class","slice");let K=g.append("text").text(o.getDiagramTitle()).attr("x",0).attr("y",-200).attr("class","pieTitleText"),R=[...b.entries()].map(([e,t])=>({label:e,value:t})),O=g.selectAll(".legend").data(R).enter().append("g").attr("class","legend");O.append("rect").attr("width",18).attr("height",18).style("fill",e=>A(e.label)).style("stroke",e=>A(e.label)),O.append("text").attr("x",22).attr("y",14).text(e=>o.getShowData()?`${e.label} [${e.value}]`:e.label);let M=Math.max(...O.selectAll("text").nodes().map(e=>e?.getBoundingClientRect().width??0)),z=450,W=490,E=22*R.length;switch(m){case"center":O.attr("transform",(e,t)=>"translate("+(-M/2-22)+","+(22*t-22*R.length/2)+")");break;case"top":z+=E,O.attr("transform",(e,t)=>`translate(${-M/2-22}, ${22*t-185})`),y.attr("transform",()=>`translate(0, ${E+22})`);break;case"bottom":z+=E,O.attr("transform",(e,t)=>"translate("+(-M/2-22)+","+(22*t- -207)+")");break;case"left":W+=22+M,O.attr("transform",(e,t)=>"translate(-207,"+(22*t-22*R.length/2)+")"),y.attr("transform",()=>`translate(${M+18+4}, 0)`);break;default:W+=22+M,O.attr("transform",(e,t)=>"translate(216,"+(22*t-22*R.length/2)+")")}let F=K.node()?.getBoundingClientRect().width??0,H=Math.min(0,225-F/2),L=Math.max(W,225+F/2)-H;h.attr("viewBox",`${H} 0 ${L} ${z}`),(0,n.a$)(h,z,L,p.useMaxWidth)},"draw")},styles:T}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[587],{72968:(e,a,s)=>{s.d(a,{createRailroadEbnfServices:()=>c.W});var c=s(69188);s(27698)}}]);