@shepai/cli 1.130.1 → 1.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/apis/json-schema/WorkflowConfig.yaml +5 -0
  2. package/dist/packages/core/src/application/use-cases/agents/approve-agent-run.use-case.d.ts.map +1 -1
  3. package/dist/packages/core/src/application/use-cases/agents/approve-agent-run.use-case.js +2 -2
  4. package/dist/packages/core/src/application/use-cases/agents/reject-agent-run.use-case.d.ts.map +1 -1
  5. package/dist/packages/core/src/application/use-cases/agents/reject-agent-run.use-case.js +2 -2
  6. package/dist/packages/core/src/domain/generated/output.d.ts +4 -0
  7. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  8. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts +5 -0
  9. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/fast-feature-agent-graph.d.ts.map +1 -1
  10. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts +17 -0
  11. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts.map +1 -1
  12. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence-output-parser.d.ts +52 -1
  13. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence-output-parser.d.ts.map +1 -1
  14. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence-output-parser.js +121 -1
  15. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.d.ts +6 -2
  16. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.d.ts.map +1 -1
  17. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/evidence.node.js +139 -75
  18. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.d.ts.map +1 -1
  19. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/implement.node.js +19 -65
  20. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/ci-watch-fix-loop.d.ts.map +1 -1
  21. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/ci-watch-fix-loop.js +34 -3
  22. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts +31 -0
  23. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
  24. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +48 -2
  25. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/analyze.prompt.d.ts.map +1 -1
  26. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/analyze.prompt.js +13 -0
  27. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/evidence-prompts.d.ts +12 -0
  28. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/evidence-prompts.d.ts.map +1 -1
  29. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/evidence-prompts.js +50 -0
  30. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/plan.prompt.d.ts.map +1 -1
  31. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/plan.prompt.js +13 -0
  32. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/requirements.prompt.d.ts.map +1 -1
  33. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/requirements.prompt.js +13 -0
  34. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/research.prompt.d.ts.map +1 -1
  35. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/research.prompt.js +13 -0
  36. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/repair.node.d.ts.map +1 -1
  37. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/repair.node.js +24 -1
  38. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts +1 -0
  39. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.d.ts.map +1 -1
  40. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/state.js +4 -0
  41. package/dist/src/presentation/cli/ui/output.js +2 -2
  42. package/dist/src/presentation/web/app/build-feature-node-data.d.ts.map +1 -1
  43. package/dist/src/presentation/web/app/build-feature-node-data.js +2 -0
  44. package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.d.ts.map +1 -1
  45. package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.js +2 -1
  46. package/dist/src/presentation/web/components/common/feature-drawer/use-feature-actions.d.ts +1 -0
  47. package/dist/src/presentation/web/components/common/feature-drawer/use-feature-actions.d.ts.map +1 -1
  48. package/dist/src/presentation/web/components/common/open-action-menu/config.d.ts +3 -1
  49. package/dist/src/presentation/web/components/common/open-action-menu/config.d.ts.map +1 -1
  50. package/dist/src/presentation/web/components/common/open-action-menu/open-action-menu.d.ts +1 -1
  51. package/dist/src/presentation/web/components/common/open-action-menu/open-action-menu.d.ts.map +1 -1
  52. package/dist/src/presentation/web/components/common/open-action-menu/open-action-menu.js +2 -2
  53. package/dist/src/presentation/web/components/common/open-action-menu/open-action-menu.stories.d.ts +2 -0
  54. package/dist/src/presentation/web/components/common/open-action-menu/open-action-menu.stories.d.ts.map +1 -1
  55. package/dist/src/presentation/web/components/common/open-action-menu/open-action-menu.stories.js +9 -0
  56. package/dist/tsconfig.build.tsbuildinfo +1 -1
  57. package/package.json +3 -3
  58. package/web/.next/BUILD_ID +1 -1
  59. package/web/.next/build-manifest.json +2 -2
  60. package/web/.next/fallback-build-manifest.json +2 -2
  61. package/web/.next/prerender-manifest.json +3 -3
  62. package/web/.next/required-server-files.js +2 -2
  63. package/web/.next/required-server-files.json +2 -2
  64. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +24 -24
  65. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +2 -2
  66. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  67. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  68. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +24 -24
  69. package/web/.next/server/app/(dashboard)/@drawer/create/page.js +2 -2
  70. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  71. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  72. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +30 -30
  73. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +2 -2
  74. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  75. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +30 -30
  77. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +2 -2
  78. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  79. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  80. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +22 -22
  81. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +2 -2
  82. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  83. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  84. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +24 -24
  85. package/web/.next/server/app/(dashboard)/create/page.js +2 -2
  86. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  87. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  88. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +30 -30
  89. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +2 -2
  90. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  91. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  92. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +30 -30
  93. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +2 -2
  94. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  95. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  96. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +22 -22
  97. package/web/.next/server/app/(dashboard)/page.js +2 -2
  98. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  99. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  100. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +22 -22
  101. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +2 -2
  102. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  103. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  104. package/web/.next/server/app/_global-error.html +2 -2
  105. package/web/.next/server/app/_global-error.rsc +1 -1
  106. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  107. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  108. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  109. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  110. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  111. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +3 -3
  112. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  113. package/web/.next/server/app/api/graph-data/route.js +1 -1
  114. package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
  115. package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
  116. package/web/.next/server/app/settings/page.js +1 -1
  117. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  118. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  119. package/web/.next/server/app/skills/page/server-reference-manifest.json +8 -8
  120. package/web/.next/server/app/skills/page.js +1 -1
  121. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  122. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  123. package/web/.next/server/app/tools/page/server-reference-manifest.json +8 -8
  124. package/web/.next/server/app/tools/page.js +1 -1
  125. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  126. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  127. package/web/.next/server/app/version/page/server-reference-manifest.json +3 -3
  128. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  129. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  130. package/web/.next/server/chunks/{[root-of-the-server]__d1dc8fcd._.js → [root-of-the-server]__c6e32a23._.js} +2 -2
  131. package/web/.next/server/chunks/[root-of-the-server]__c6e32a23._.js.map +1 -0
  132. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  133. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_4e741df2.js +1 -1
  134. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_4e741df2.js.map +1 -1
  135. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  136. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  137. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_026fdffa.js +1 -1
  138. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_026fdffa.js.map +1 -1
  139. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_8b91e197.js +1 -1
  140. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_8b91e197.js.map +1 -1
  141. package/web/.next/server/chunks/ssr/[root-of-the-server]__2c791c42._.js +4 -0
  142. package/web/.next/server/chunks/ssr/[root-of-the-server]__2c791c42._.js.map +1 -0
  143. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  144. package/web/.next/server/chunks/ssr/{[root-of-the-server]__84f72684._.js → [root-of-the-server]__3ef34e4c._.js} +3 -3
  145. package/web/.next/server/chunks/ssr/{[root-of-the-server]__84f72684._.js.map → [root-of-the-server]__3ef34e4c._.js.map} +1 -1
  146. package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js +1 -1
  147. package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js.map +1 -1
  148. package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js +2 -2
  149. package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js.map +1 -1
  150. package/web/.next/server/chunks/ssr/[root-of-the-server]__755cfe02._.js +1 -1
  151. package/web/.next/server/chunks/ssr/[root-of-the-server]__755cfe02._.js.map +1 -1
  152. package/web/.next/server/chunks/ssr/[root-of-the-server]__7894f27f._.js +1 -1
  153. package/web/.next/server/chunks/ssr/[root-of-the-server]__7894f27f._.js.map +1 -1
  154. package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js +1 -1
  155. package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js.map +1 -1
  156. package/web/.next/server/chunks/ssr/[root-of-the-server]__96670392._.js +4 -0
  157. package/web/.next/server/chunks/ssr/[root-of-the-server]__96670392._.js.map +1 -0
  158. package/web/.next/server/chunks/ssr/{[root-of-the-server]__57018345._.js → [root-of-the-server]__9c45d070._.js} +2 -2
  159. package/web/.next/server/chunks/ssr/[root-of-the-server]__9c45d070._.js.map +1 -0
  160. package/web/.next/server/chunks/ssr/[root-of-the-server]__a628fb91._.js +1 -1
  161. package/web/.next/server/chunks/ssr/[root-of-the-server]__a628fb91._.js.map +1 -1
  162. package/web/.next/server/chunks/ssr/[root-of-the-server]__bfba58e6._.js +1 -1
  163. package/web/.next/server/chunks/ssr/[root-of-the-server]__bfba58e6._.js.map +1 -1
  164. package/web/.next/server/chunks/ssr/[root-of-the-server]__c3ab8422._.js +1 -1
  165. package/web/.next/server/chunks/ssr/[root-of-the-server]__c3ab8422._.js.map +1 -1
  166. package/web/.next/server/chunks/ssr/_02ec1aea._.js +1 -1
  167. package/web/.next/server/chunks/ssr/_02ec1aea._.js.map +1 -1
  168. package/web/.next/server/chunks/ssr/{_60d96b77._.js → _1ff3035b._.js} +2 -2
  169. package/web/.next/server/chunks/ssr/{_60d96b77._.js.map → _1ff3035b._.js.map} +1 -1
  170. package/web/.next/server/chunks/ssr/_4a4b4e1a._.js +3 -0
  171. package/web/.next/server/chunks/ssr/{_e44c1df8._.js.map → _4a4b4e1a._.js.map} +1 -1
  172. package/web/.next/server/chunks/ssr/_7dca1882._.js +1 -1
  173. package/web/.next/server/chunks/ssr/_7dca1882._.js.map +1 -1
  174. package/web/.next/server/chunks/ssr/_a9f57758._.js +1 -1
  175. package/web/.next/server/chunks/ssr/_d4b20e29._.js.map +1 -1
  176. package/web/.next/server/chunks/ssr/_d8575088._.js +1 -1
  177. package/web/.next/server/chunks/ssr/_d8575088._.js.map +1 -1
  178. package/web/.next/server/chunks/ssr/_f39a1adb._.js +1 -1
  179. package/web/.next/server/chunks/ssr/_f39a1adb._.js.map +1 -1
  180. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  181. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  182. package/web/.next/server/chunks/ssr/{src_presentation_web_1b00ce26._.js → src_presentation_web_1769b67a._.js} +2 -2
  183. package/web/.next/server/chunks/ssr/{src_presentation_web_1b00ce26._.js.map → src_presentation_web_1769b67a._.js.map} +1 -1
  184. package/web/.next/server/chunks/ssr/src_presentation_web_8e7fe0d1._.js +2 -2
  185. package/web/.next/server/chunks/ssr/src_presentation_web_8e7fe0d1._.js.map +1 -1
  186. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_ca051134.js +1 -1
  187. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_ca051134.js.map +1 -1
  188. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js +1 -1
  189. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js.map +1 -1
  190. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js +1 -1
  191. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js.map +1 -1
  192. package/web/.next/server/chunks/ssr/src_presentation_web_b9023017._.js +2 -2
  193. package/web/.next/server/chunks/ssr/src_presentation_web_b9023017._.js.map +1 -1
  194. package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
  195. package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
  196. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  197. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  198. package/web/.next/server/pages/500.html +2 -2
  199. package/web/.next/server/server-reference-manifest.js +1 -1
  200. package/web/.next/server/server-reference-manifest.json +38 -38
  201. package/web/.next/static/chunks/{6a528a033ae55794.js → 1e7aa4fc00db4d85.js} +2 -2
  202. package/web/.next/static/chunks/{ceefd537b2a82fb5.js → 24ab1a6841758200.js} +1 -1
  203. package/web/.next/static/chunks/{1553f15c07eb7745.js → 431ebee69d487093.js} +1 -1
  204. package/web/.next/static/chunks/46488328b6d76dcf.js +1 -0
  205. package/web/.next/static/chunks/554010ffa090b3cb.js +1 -0
  206. package/web/.next/static/chunks/{c5019bfe2884e088.js → 5541ee6e8c3dfbc0.js} +1 -1
  207. package/web/.next/static/chunks/5f401fd30f6e8a29.js +1 -0
  208. package/web/.next/static/chunks/665bc0be216c6374.js +1 -0
  209. package/web/.next/static/chunks/81e8a59652c53338.js +1 -0
  210. package/web/.next/static/chunks/a90d02d0338ca269.js +2 -0
  211. package/web/.next/static/chunks/{499fe813285eb6b6.js → bd5910aa46e4f7f8.js} +1 -1
  212. package/web/.next/static/chunks/{7e5b7a8ca6303e76.js → ecfe17fa09ff543e.js} +1 -1
  213. package/web/next.config.mjs +1 -1
  214. package/web/package.json +1 -1
  215. package/web/.next/server/chunks/[root-of-the-server]__d1dc8fcd._.js.map +0 -1
  216. package/web/.next/server/chunks/ssr/[root-of-the-server]__5142820f._.js +0 -4
  217. package/web/.next/server/chunks/ssr/[root-of-the-server]__5142820f._.js.map +0 -1
  218. package/web/.next/server/chunks/ssr/[root-of-the-server]__57018345._.js.map +0 -1
  219. package/web/.next/server/chunks/ssr/[root-of-the-server]__99ab2519._.js +0 -4
  220. package/web/.next/server/chunks/ssr/[root-of-the-server]__99ab2519._.js.map +0 -1
  221. package/web/.next/server/chunks/ssr/_e44c1df8._.js +0 -3
  222. package/web/.next/static/chunks/010e770e43094b0c.js +0 -1
  223. package/web/.next/static/chunks/2fc5168fdc6be797.js +0 -1
  224. package/web/.next/static/chunks/8057ebdc852674de.js +0 -2
  225. package/web/.next/static/chunks/ad8d9368ff2f152d.js +0 -1
  226. package/web/.next/static/chunks/c1bc8dbfa5d7fc35.js +0 -1
  227. package/web/.next/static/chunks/f3e3c98b0dbdb7c5.js +0 -1
  228. /package/web/.next/static/{JhvdO6haSso0T4F28qUg0 → fBDTRerkah3YOaOkhqEUT}/_buildManifest.js +0 -0
  229. /package/web/.next/static/{JhvdO6haSso0T4F28qUg0 → fBDTRerkah3YOaOkhqEUT}/_clientMiddlewareManifest.json +0 -0
  230. /package/web/.next/static/{JhvdO6haSso0T4F28qUg0 → fBDTRerkah3YOaOkhqEUT}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24042,64970,e=>{"use strict";var t=e.i(3645);let n=(0,t.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",()=>n],24042);let r=(0,t.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);e.s(["Square",()=>r],64970)},81803,72714,e=>{"use strict";var t=e.i(20314),n=e.i(83428),r=e.i(51251),a=e.i(31777),o=e.i(35364),l=e.i(8361);function i({label:e,onClick:i,loading:u,error:s,icon:d,iconOnly:c=!1,variant:f="outline",size:p="sm"}){let m=(0,l.useSoundAction)("click");return(0,t.jsxs)(o.Button,{variant:f,size:p,"aria-label":e,disabled:u,onClick:()=>{m.play(),i()},className:(0,a.cn)("gap-1.5",s&&"text-destructive hover:text-destructive",!s&&c&&"ghost"===f&&"text-muted-foreground cursor-pointer rounded-full transition-colors hover:text-blue-500"),children:[u?(0,t.jsx)(n.Loader2,{className:"size-4 animate-spin"}):s?(0,t.jsx)(r.CircleAlert,{className:"size-4"}):(0,t.jsx)(d,{className:"size-4"}),c?null:e]})}e.s(["ActionButton",()=>i],72714),e.s([],81803)},8537,e=>{"use strict";var t=e.i(79054),n=e.i(18354),r=e.i(21023);let a=(0,r.createServerReference)("402fd3503a42a202593f5637ef846b96bbbdd611c9",r.callServer,void 0,r.findSourceMapURL,"deployFeature"),o=(0,r.createServerReference)("400006db9b6181f4ea254f1c653e585733c9daceca",r.callServer,void 0,r.findSourceMapURL,"deployRepository"),l=(0,r.createServerReference)("40eeabbd54a047c1b10e22242d4a266eb58ff2ab9a",r.callServer,void 0,r.findSourceMapURL,"stopDeployment"),i=(0,r.createServerReference)("40475192836f415ecc01af1e8c27bc01ab78a15d33",r.callServer,void 0,r.findSourceMapURL,"getDeploymentStatus"),u=(0,n.createLogger)("[useDeployAction]");function s(e){let[n,r]=(0,t.useState)(!1),[s,d]=(0,t.useState)(!1),[c,f]=(0,t.useState)(null),[p,m]=(0,t.useState)(null),[g,h]=(0,t.useState)(null),v=(0,t.useRef)(null),w=(0,t.useRef)(!0),y=(0,t.useRef)(p);(0,t.useEffect)(()=>{y.current=p},[p]),(0,t.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]),(0,t.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let n=await i(e.targetId);if(t||!w.current)return;n&&"Stopped"!==n.state&&(u.info(`mount recovery: "${e.targetId}" state=${n.state}, url=${n.url}`),m(n.state),h(n.url),x(e.targetId))}catch{u.debug(`mount recovery failed for "${e.targetId}" — ignoring`)}})(),()=>{t=!0}},[e?.targetId]),(0,t.useEffect)(()=>()=>{v.current&&clearInterval(v.current)},[]);let b=(0,t.useCallback)(()=>{v.current&&(u.debug("stopping polling"),clearInterval(v.current),v.current=null)},[]),x=(0,t.useCallback)(e=>{b(),u.debug(`starting polling for "${e}" every 3000ms`),v.current=setInterval(async()=>{let t;if(!w.current)return void b();try{t=await i(e)}catch(t){u.warn(`poll fetch failed for "${e}":`,t),w.current&&(m(null),h(null),b());return}w.current&&(t&&"Stopped"!==t.state?(t.state!==y.current&&u.info(`poll state changed: ${y.current} → ${t.state}, url=${t.url}`),m(t.state),h(t.url)):(u.info(`poll result: ${t?`state=${t.state}`:"null (deployment gone)"} — stopping poll`),m(null),h(null),b()))},3e3)},[b]);(0,t.useEffect)(()=>{if(!e||null!==p)return;let t=setInterval(async()=>{if(w.current)try{let t=await i(e.targetId);if(!w.current)return;t&&"Stopped"!==t.state&&(u.info(`idle poll: "${e.targetId}" state=${t.state}, url=${t.url}`),m(t.state),h(t.url),x(e.targetId))}catch{}},5e3);return()=>clearInterval(t)},[e,p,x]);let R=(0,t.useCallback)(async()=>{if(!e)return void u.warn("deploy() called but input is null — no-op");if(n)return void u.warn("deploy() called but already loading — no-op");u.info(`deploy() — targetType="${e.targetType}", targetId="${e.targetId}", repositoryPath="${e.repositoryPath}"`),r(!0),f(null);try{let t="feature"===e.targetType?await a(e.targetId):await o(e.repositoryPath);if(u.info("server action result:",t),!w.current)return void u.warn("component unmounted after deploy — discarding result");if(t.success)u.info(`deploy succeeded — initial state=${t.state}, starting polling`),m(t.state??null),h(null),x(e.targetId);else{let e=t.error??"An unexpected error occurred";u.warn(`deploy failed: ${e}`),f(e)}}catch(t){if(!w.current)return;let e=t instanceof Error?t.message:"An unexpected error occurred";u.error(`deploy threw exception: ${e}`,t),f(e)}finally{w.current&&r(!1)}},[e,n,x]),C=(0,t.useCallback)(async()=>{if(e&&!s){u.info(`stop() — targetId="${e.targetId}"`),d(!0);try{let t=await l(e.targetId);if(u.info("stop result:",t),!w.current)return;t.success&&(b(),m(null),h(null))}catch(e){u.warn("stop error (non-critical):",e)}finally{w.current&&d(!1)}}},[e,s,b]);return{deploy:R,stop:C,deployLoading:n,stopLoading:s,deployError:c,status:p,url:g}}e.s(["useDeployAction",()=>s],8537)},99348,17466,45811,e=>{"use strict";let t;var n=e.i(20314),r=e.i(79054),a=e.i(83428),o=e.i(30702),l=e.i(38573),i=e.i(17406),u=e.i(81846),s=e.i(2287),d=e.i(21023);let c=(0,d.createServerReference)("409f010385a046bca716082fb29e7152d83e71a89c",d.callServer,void 0,d.findSourceMapURL,"getDeploymentLogs");function f({open:e,onOpenChange:t,targetId:a}){let{logs:o,isConnected:l}=function(e){let[t,n]=(0,r.useState)([]),[a,o]=(0,r.useState)(!1),l=(0,r.useRef)(null),i=(0,r.useCallback)(()=>{l.current&&(l.current.close(),l.current=null),o(!1)},[]);return(0,r.useEffect)(()=>{if(!e){n([]),o(!1);return}c(e).then(e=>{e&&n(e)}).catch(()=>{});let t=new EventSource(`/api/deployment-logs?targetId=${e}`);return l.current=t,t.onopen=()=>{o(!0)},t.addEventListener("log",e=>{let t=JSON.parse(e.data);n(e=>[...e,t])}),t.onerror=()=>{o(!1)},()=>{t.close(),l.current=null}},[e,i]),{logs:t,isConnected:a}}(e?a:null);return(0,n.jsx)(p,{open:e,onOpenChange:t,logs:o,isConnected:l})}function p({open:e,onOpenChange:t,logs:a,isConnected:o}){let i=(0,r.useRef)(null),u=(0,r.useRef)(!0),d=(0,r.useCallback)(()=>{let e=i.current;e&&(u.current=e.scrollTop+e.clientHeight>=e.scrollHeight-50)},[]);return(0,r.useEffect)(()=>{u.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[a]),(0,n.jsx)(s.Dialog,{open:e,onOpenChange:t,children:(0,n.jsxs)(s.DialogContent,{className:"flex h-[calc(100vh-48px)] max-h-[calc(100vh-48px)] w-full max-w-[calc(100vw-48px)] flex-col gap-0 bg-zinc-950 p-0 text-zinc-100 sm:rounded-lg","aria-describedby":void 0,children:[(0,n.jsxs)(s.DialogHeader,{className:"flex flex-row items-center justify-between border-b border-zinc-800 px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(l.Terminal,{className:"h-4 w-4 text-zinc-400"}),(0,n.jsx)(s.DialogTitle,{className:"text-sm font-medium text-zinc-100",children:"Server Logs"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${o?"bg-green-500":"bg-zinc-500"}`}),(0,n.jsx)("span",{className:"text-xs text-zinc-400",children:o?"Connected":"Disconnected"})]})]}),(0,n.jsxs)("div",{ref:i,onScroll:d,className:"flex-1 overflow-auto p-4 font-mono text-sm leading-relaxed",children:[0===a.length?(0,n.jsx)("p",{className:"text-zinc-500",children:"Waiting for log output..."}):a.map(e=>(0,n.jsx)(m,{entry:e},`${e.timestamp}-${e.stream}-${e.line}`)),!o&&a.length>0&&(0,n.jsx)("div",{className:"mt-2 border-t border-zinc-800 pt-2 text-zinc-500",children:"[Server stopped]"})]})]})})}function m({entry:e}){return(0,n.jsx)("div",{"data-stream":e.stream,className:"stderr"===e.stream?"text-red-400":"text-zinc-200",children:(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.line})})}function g({status:e,url:t,targetId:s}){let[d,c]=(0,r.useState)(!1),p=s&&(e===i.DeploymentState.Booting||e===i.DeploymentState.Ready);switch(e){case i.DeploymentState.Booting:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(u.Badge,{className:"border-transparent bg-blue-50 text-blue-700 hover:bg-blue-50",children:[(0,n.jsx)(a.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),"Starting...",p?(0,n.jsx)("button",{type:"button","aria-label":"View server logs",className:"ml-1.5 inline-flex items-center rounded-sm p-0.5 hover:bg-blue-100",onClick:e=>{e.stopPropagation(),c(!0)},children:(0,n.jsx)(l.Terminal,{className:"h-3 w-3"})}):null]}),p?(0,n.jsx)(f,{open:d,onOpenChange:c,targetId:s}):null]});case i.DeploymentState.Ready:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(u.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,n.jsx)("span",{className:"mr-1 inline-block h-2 w-2 rounded-full bg-green-500"}),t?(0,n.jsxs)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:underline",onClick:e=>e.stopPropagation(),children:[t,(0,n.jsx)(o.ExternalLink,{className:"h-3 w-3"})]}):"Ready",p?(0,n.jsx)("button",{type:"button","aria-label":"View server logs",className:"ml-1.5 inline-flex items-center rounded-sm p-0.5 hover:bg-green-100",onClick:e=>{e.stopPropagation(),c(!0)},children:(0,n.jsx)(l.Terminal,{className:"h-3 w-3"})}):null]}),p?(0,n.jsx)(f,{open:d,onOpenChange:c,targetId:s}):null]});default:return null}}e.s(["DeploymentStatusBadge",()=>g],17466),e.s([],99348);var h=e.i(48249),v=e.i(567);let w=r.default.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),y=()=>{let e=r.default.useContext(w);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function b(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function x(){return R(/^iPhone/)||R(/^iPad/)||R(/^Mac/)&&navigator.maxTouchPoints>1}function R(e){return"u">typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");let C="u">typeof window?r.useLayoutEffect:r.useEffect;function j(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let D="u">typeof document&&window.visualViewport;function T(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function E(e){for(T(e)&&(e=e.parentElement);e&&!T(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let S=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),$=0;function N(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function k(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=E(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function P(e){return e instanceof HTMLInputElement&&!S.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function M(...e){return r.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let O=new WeakMap;function z(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||O.set(e,r)}let I=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function L(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[I(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[I(t)?5:4]):null}function B(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let F=[.32,.72,0,1],A="vaul-dragging";function H(e){let t=r.default.useRef(e);return r.default.useEffect(()=>{t.current=e}),r.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function W({prop:e,defaultProp:t,onChange:n=()=>{}}){let[a,o]=function({defaultProp:e,onChange:t}){let n=r.default.useState(e),[a]=n,o=r.default.useRef(a),l=H(t);return r.default.useEffect(()=>{o.current!==a&&(l(a),o.current=a)},[a,o,l]),n}({defaultProp:t,onChange:n}),l=void 0!==e,i=l?e:a,u=H(n);return[i,r.default.useCallback(t=>{if(l){let n="function"==typeof t?t(e):t;n!==e&&u(n)}else o(t)},[l,e,o,u])]}let q=()=>()=>{},Y=null;function U({open:e,onOpenChange:n,children:a,onDrag:o,onRelease:l,snapPoints:i,shouldScaleBackground:u=!1,setBackgroundColorOnScale:s=!0,closeThreshold:d=.25,scrollLockTimeout:c=100,dismissible:f=!0,handleOnly:p=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:g,setActiveSnapPoint:h,fixed:y,modal:R=!0,onClose:T,nested:S,noBodyStyles:M=!1,direction:B="bottom",defaultOpen:H=!1,disablePreventScroll:q=!0,snapToSequentialPoint:U=!1,preventScrollRestoration:X=!1,repositionInputs:V=!0,onAnimationEnd:K,container:J,autoFocus:_=!1}){var G,Q;let[Z=!1,ee]=W({defaultProp:H,prop:e,onChange:e=>{null==n||n(e),e||S||ek(),setTimeout(()=>{null==K||K(e)},500),e&&!R&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[et,en]=r.default.useState(!1),[er,ea]=r.default.useState(!1),[eo,el]=r.default.useState(!1),ei=r.default.useRef(null),eu=r.default.useRef(null),es=r.default.useRef(null),ed=r.default.useRef(null),ec=r.default.useRef(null),ef=r.default.useRef(!1),ep=r.default.useRef(null),em=r.default.useRef(0),eg=r.default.useRef(!1),eh=r.default.useRef(!H),ev=r.default.useRef(0),ew=r.default.useRef(null),ey=r.default.useRef((null==(G=ew.current)?void 0:G.getBoundingClientRect().height)||0),eb=r.default.useRef((null==(Q=ew.current)?void 0:Q.getBoundingClientRect().width)||0),ex=r.default.useRef(0),eR=r.default.useCallback(e=>{i&&e===eE.length-1&&(eu.current=new Date)},[]),{activeSnapPoint:eC,activeSnapPointIndex:ej,setActiveSnapPoint:eD,onRelease:eT,snapPointsOffset:eE,onDrag:eS,shouldFade:e$,getPercentageDragged:eN}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:a,overlayRef:o,fadeFromIndex:l,onSnapPointChange:i,direction:u="bottom",container:s,snapToSequentialPoint:d}){let[c,f]=W({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[p,m]=r.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);r.default.useEffect(()=>{function e(){m({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let g=r.default.useMemo(()=>c===(null==n?void 0:n[n.length-1])||null,[n,c]),h=r.default.useMemo(()=>{var e;return null!=(e=null==n?void 0:n.findIndex(e=>e===c))?e:null},[n,c]),v=n&&n.length>0&&(l||0===l)&&!Number.isNaN(l)&&n[l]===c||!n,w=r.default.useMemo(()=>{var e;let t=s?{width:s.getBoundingClientRect().width,height:s.getBoundingClientRect().height}:"u">typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return null!=(e=null==n?void 0:n.map(e=>{let n="string"==typeof e,r=0;if(n&&(r=parseInt(e,10)),I(u)){let a=n?r:p?e*t.height:0;return p?"bottom"===u?t.height-a:-t.height+a:a}let a=n?r:p?e*t.width:0;return p?"right"===u?t.width-a:-t.width+a:a}))?e:[]},[n,p,s]),y=r.default.useMemo(()=>null!==h?null==w?void 0:w[h]:null,[w,h]),b=r.default.useCallback(e=>{var t;let r=null!=(t=null==w?void 0:w.findIndex(t=>t===e))?t:null;i(r),z(a.current,{transition:`transform 0.5s cubic-bezier(${F.join(",")})`,transform:I(u)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),w&&r!==w.length-1&&void 0!==l&&r!==l&&r<l?z(o.current,{transition:`opacity 0.5s cubic-bezier(${F.join(",")})`,opacity:"0"}):z(o.current,{transition:`opacity 0.5s cubic-bezier(${F.join(",")})`,opacity:"1"}),f(null==n?void 0:n[Math.max(r,0)])},[a.current,n,w,l,o,f]);return r.default.useEffect(()=>{if(c||e){var t;let r=null!=(t=null==n?void 0:n.findIndex(t=>t===e||t===c))?t:-1;w&&-1!==r&&"number"==typeof w[r]&&b(w[r])}},[c,e,n,w,b]),{isLastSnapPoint:g,activeSnapPoint:c,shouldFade:v,getPercentageDragged:function(e,t){if(!n||"number"!=typeof h||!w||void 0===l)return null;let r=h===l-1;if(h>=l&&t)return 0;if(r&&!t)return 1;if(!v&&!r)return null;let a=r?h+1:h-1,o=e/Math.abs(r?w[a]-w[a-1]:w[a+1]-w[a]);return r?1-o:o},setActiveSnapPoint:f,activeSnapPointIndex:h,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:a}){if(void 0===l)return;let i="bottom"===u||"right"===u?(null!=y?y:0)-e:(null!=y?y:0)+e,s=h===l-1,c=0===h,f=e>0;if(s&&z(o.current,{transition:`opacity 0.5s cubic-bezier(${F.join(",")})`}),!d&&r>2&&!f)return void(a?t():b(w[0]));if(!d&&r>2&&f&&w&&n)return void b(w[n.length-1]);let p=null==w?void 0:w.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-i)<Math.abs(e-i)?t:e),m=I(u)?window.innerHeight:window.innerWidth;if(r>.4&&Math.abs(e)<.4*m){let e=f?1:-1;return e>0&&g&&n?void b(w[n.length-1]):void(c&&e<0&&a&&t(),null===h||b(w[h+e]))}b(p)},onDrag:function({draggedDistance:e}){if(null===y)return;let t="bottom"===u||"right"===u?y-e:y+e;("bottom"===u||"right"===u)&&t<w[w.length-1]||("top"===u||"left"===u)&&t>w[w.length-1]||z(a.current,{transform:I(u)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:w}}({snapPoints:i,activeSnapPointProp:g,setActiveSnapPointProp:h,drawerRef:ew,fadeFromIndex:m,overlayRef:ei,onSnapPointChange:eR,direction:B,container:J,snapToSequentialPoint:U});!function(e={}){let{isDisabled:n}=e;C(()=>{if(!n){var e,r,a;let n,o,l,i,u,s,d;return 1==++$&&x()&&(l=0,i=window.pageXOffset,u=window.pageYOffset,s=j((e=document.documentElement,r="paddingRight",a=`${window.innerWidth-document.documentElement.clientWidth}px`,n=e.style[r],e.style[r]=a,()=>{e.style[r]=n})),window.scrollTo(0,0),d=j(N(document,"touchstart",e=>{((o=E(e.target))!==document.documentElement||o!==document.body)&&(l=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),N(document,"touchmove",e=>{if(!o||o===document.documentElement||o===document.body)return void e.preventDefault();let t=e.changedTouches[0].pageY,n=o.scrollTop,r=o.scrollHeight-o.clientHeight;0!==r&&((n<=0&&t>l||n>=r&&t<l)&&e.preventDefault(),l=t)},{passive:!1,capture:!0}),N(document,"touchend",e=>{let t=e.target;P(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),N(document,"focus",e=>{let t=e.target;P(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",D&&(D.height<window.innerHeight?requestAnimationFrame(()=>{k(t)}):D.addEventListener("resize",()=>k(t),{once:!0}))}))},!0),N(window,"scroll",()=>{window.scrollTo(0,0)})),t=()=>{s(),d(),window.scrollTo(i,u)}),()=>{0==--$&&(null==t||t())}}},[n])}({isDisabled:!Z||er||!R||eo||!et||!V||!q});let{restorePositionSetting:ek}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:a,preventScrollRestoration:o,noBodyStyles:l}){let[i,u]=r.default.useState(()=>"u">typeof window?window.location.href:""),s=r.default.useRef(0),d=r.default.useCallback(()=>{if(b()&&null===Y&&e&&!l){Y={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-s.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&s.current>=t&&(document.body.style.top=`${-(s.current+e)}px`)}),300)}},[e]),c=r.default.useCallback(()=>{if(b()&&null!==Y&&!l){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Y),window.requestAnimationFrame(()=>{o&&i!==window.location.href?u(window.location.href):window.scrollTo(t,e)}),Y=null}},[i]);return r.default.useEffect(()=>{function e(){s.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),r.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||c()}},[t,c]),r.default.useEffect(()=>{!n&&a&&(e?(window.matchMedia("(display-mode: standalone)").matches||d(),t||window.setTimeout(()=>{c()},500)):c())},[e,a,i,t,n,d,c]),{restorePositionSetting:c}}({isOpen:Z,modal:R,nested:null!=S&&S,hasBeenOpened:et,preventScrollRestoration:X,noBodyStyles:M});function eP(){return(window.innerWidth-26)/window.innerWidth}function eM(e,t){var n;let r=e,a=null==(n=window.getSelection())?void 0:n.toString(),o=ew.current?L(ew.current,B):null,l=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===B||"left"===B)return!0;if(eu.current&&l.getTime()-eu.current.getTime()<500)return!1;if(null!==o&&("bottom"===B?o>0:o<0))return!0;if(a&&a.length>0)return!1;if(ec.current&&l.getTime()-ec.current.getTime()<c&&0===o||t)return ec.current=l,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return ec.current=new Date,!1;if("dialog"===r.getAttribute("role"))break}r=r.parentNode}return!0}function eO(e){er&&ew.current&&(ew.current.classList.remove(A),ef.current=!1,ea(!1),ed.current=new Date),null==T||T(),e||ee(!1),setTimeout(()=>{i&&eD(i[0])},500)}function ez(){if(!ew.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=L(ew.current,B);z(ew.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${F.join(",")})`}),z(ei.current,{transition:`opacity 0.5s cubic-bezier(${F.join(",")})`,opacity:"1"}),u&&t&&t>0&&Z&&z(e,{borderRadius:"8px",overflow:"hidden",...I(B)?{transform:`scale(${eP()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${eP()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${F.join(",")})`},!0)}return r.default.useEffect(()=>{window.requestAnimationFrame(()=>{eh.current=!0})},[]),r.default.useEffect(()=>{var e;function t(){if(ew.current&&V&&(P(document.activeElement)||eg.current)){var e;let t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight,r=n-t,a=ew.current.getBoundingClientRect().height||0;ex.current||(ex.current=a);let o=ew.current.getBoundingClientRect().top;if(Math.abs(ev.current-r)>60&&(eg.current=!eg.current),i&&i.length>0&&eE&&ej&&(r+=eE[ej]||0),ev.current=r,a>t||eg.current){let e=ew.current.getBoundingClientRect().height,l=e;e>t&&(l=t-(a>.8*n?o:26)),y?ew.current.style.height=`${e-Math.max(r,0)}px`:ew.current.style.height=`${Math.max(l,t-o)}px`}else{let e;e=navigator.userAgent,"u">typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))||(ew.current.style.height=`${ex.current}px`)}i&&i.length>0&&!eg.current?ew.current.style.bottom="0px":ew.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[ej,i,eE]),r.default.useEffect(()=>(Z&&(z(document.documentElement,{scrollBehavior:"auto"}),eu.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=O.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[Z]),r.default.useEffect(()=>{R||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[R]),r.default.createElement(v.Root,{defaultOpen:H,onOpenChange:e=>{(f||e)&&(e?en(!0):eO(!0),ee(e))},open:Z},r.default.createElement(w.Provider,{value:{activeSnapPoint:eC,snapPoints:i,setActiveSnapPoint:eD,drawerRef:ew,overlayRef:ei,onOpenChange:n,onPress:function(e){var t,n;!f&&!i||(!ew.current||ew.current.contains(e.target))&&(ey.current=(null==(t=ew.current)?void 0:t.getBoundingClientRect().height)||0,eb.current=(null==(n=ew.current)?void 0:n.getBoundingClientRect().width)||0,ea(!0),es.current=new Date,x()&&window.addEventListener("touchend",()=>ef.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),em.current=I(B)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!er||!ew.current)return;ew.current.classList.remove(A),ef.current=!1,ea(!1),ed.current=new Date;let r=L(ew.current,B);if(!e||!eM(e.target,!1)||!r||Number.isNaN(r)||null===es.current)return;let a=ed.current.getTime()-es.current.getTime(),o=em.current-(I(B)?e.pageY:e.pageX),u=Math.abs(o)/a;if(u>.05&&(el(!0),setTimeout(()=>{el(!1)},200)),i){eT({draggedDistance:o*("bottom"===B||"right"===B?1:-1),closeDrawer:eO,velocity:u,dismissible:f}),null==l||l(e,!0);return}if("bottom"===B||"right"===B?o>0:o<0){ez(),null==l||l(e,!0);return}if(u>.4){eO(),null==l||l(e,!1);return}let s=Math.min(null!=(t=ew.current.getBoundingClientRect().height)?t:0,window.innerHeight),c=Math.min(null!=(n=ew.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===B||"right"===B?c:s)*d){eO(),null==l||l(e,!1);return}null==l||l(e,!0),ez()},onDrag:function(e){if(ew.current&&er){let t="bottom"===B||"right"===B?1:-1,n=(em.current-(I(B)?e.pageY:e.pageX))*t,r=n>0,a=i&&!f&&!r;if(a&&0===ej)return;let l=Math.abs(n),s=document.querySelector("[data-vaul-drawer-wrapper]"),d=l/("bottom"===B||"top"===B?ey.current:eb.current),c=eN(l,r);if(null!==c&&(d=c),a&&d>=1||!ef.current&&!eM(e.target,r))return;if(ew.current.classList.add(A),ef.current=!0,z(ew.current,{transition:"none"}),z(ei.current,{transition:"none"}),i&&eS({draggedDistance:n}),r&&!i){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;z(ew.current,{transform:I(B)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let p=1-d;if((e$||m&&ej===m-1)&&(null==o||o(e,d),z(ei.current,{opacity:`${p}`,transition:"none"},!0)),s&&ei.current&&u){let e=Math.min(eP()+d*(1-eP()),1),t=8-8*d,n=Math.max(0,14-14*d);z(s,{borderRadius:`${t}px`,transform:I(B)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!i){let e=l*t;z(ew.current,{transform:I(B)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:f,shouldAnimate:eh,handleOnly:p,isOpen:Z,isDragging:er,shouldFade:e$,closeDrawer:eO,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;z(ew.current,{transform:I(B)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){let t=e?(window.innerWidth-16)/window.innerWidth:1,n=e?-16:0;ep.current&&window.clearTimeout(ep.current),z(ew.current,{transition:`transform 0.5s cubic-bezier(${F.join(",")})`,transform:I(B)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&ew.current&&(ep.current=setTimeout(()=>{let e=L(ew.current,B);z(ew.current,{transition:"none",transform:I(B)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=I(B)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&z(ew.current,{transition:`transform 0.5s cubic-bezier(${F.join(",")})`,transform:I(B)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:eg,modal:R,snapPointsOffset:eE,activeSnapPointIndex:ej,direction:B,shouldScaleBackground:u,setBackgroundColorOnScale:s,noBodyStyles:M,container:J,autoFocus:_}},a))}let X=r.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:a,onRelease:o,shouldFade:l,isOpen:i,modal:u,shouldAnimate:s}=y(),d=M(t,n),c=a&&a.length>0;if(!u)return null;let f=r.default.useCallback(e=>o(e),[o]);return r.default.createElement(v.Overlay,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":i&&c?"true":"false","data-vaul-snap-points-overlay":i&&l?"true":"false","data-vaul-animate":(null==s?void 0:s.current)?"true":"false",...e})});X.displayName="Drawer.Overlay";let V=r.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...a},o){let{drawerRef:l,onPress:i,onRelease:u,onDrag:s,keyboardIsOpen:d,snapPointsOffset:c,activeSnapPointIndex:f,modal:p,isOpen:m,direction:g,snapPoints:h,container:w,handleOnly:b,shouldAnimate:x,autoFocus:R}=y(),[C,j]=r.default.useState(!1),D=M(o,l),T=r.default.useRef(null),E=r.default.useRef(null),S=r.default.useRef(!1),$=h&&h.length>0;function N(e){T.current=null,S.current=!1,u(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:a,noBodyStyles:o}=y(),l=r.default.useRef(null),i=(0,r.useMemo)(()=>document.body.style.backgroundColor,[]);function u(){return(window.innerWidth-26)/window.innerWidth}r.default.useEffect(()=>{if(t&&n){l.current&&clearTimeout(l.current);let t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;!function(...e){}(a&&!o?B(document.body,{background:"black"}):q,B(t,{transformOrigin:I(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${F.join(",")})`}));let n=B(t,{borderRadius:"8px",overflow:"hidden",...I(e)?{transform:`scale(${u()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${u()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),l.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},500)}}},[t,n,i])}(),r.default.useEffect(()=>{$&&window.requestAnimationFrame(()=>{j(!0)})},[]),r.default.createElement(v.Content,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":C?"true":"false","data-vaul-snap-points":m&&$?"true":"false","data-vaul-custom-container":w?"true":"false","data-vaul-animate":(null==x?void 0:x.current)?"true":"false",...a,ref:D,style:c&&c.length>0?{"--snap-point-height":`${c[null!=f?f:0]}px`,...t}:t,onPointerDown:e=>{b||(null==a.onPointerDown||a.onPointerDown.call(a,e),T.current={x:e.pageX,y:e.pageY},i(e))},onOpenAutoFocus:e=>{null==n||n(e),R||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!p||t.defaultPrevented)?t.preventDefault():d.current&&(d.current=!1)},onFocusOutside:e=>{if(!p)return void e.preventDefault()},onPointerMove:e=>{if(E.current=e,b||(null==a.onPointerMove||a.onPointerMove.call(a,e),!T.current))return;let t=e.pageY-T.current.y,n=e.pageX-T.current.x,r="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(S.current)return!0;let r=Math.abs(e.y),a=Math.abs(e.x),o=a>r,l=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*l<0)&&a>=0&&a<=n)return o}else if(!(e.y*l<0)&&r>=0&&r<=n)return!o;return S.current=!0,!0})({x:n,y:t},g,r)?s(e):(Math.abs(n)>r||Math.abs(t)>r)&&(T.current=null)},onPointerUp:e=>{null==a.onPointerUp||a.onPointerUp.call(a,e),T.current=null,S.current=!1,u(e)},onPointerOut:e=>{null==a.onPointerOut||a.onPointerOut.call(a,e),N(E.current)},onContextMenu:e=>{null==a.onContextMenu||a.onContextMenu.call(a,e),E.current&&N(E.current)}})});V.displayName="Drawer.Content";let K=r.default.forwardRef(function({preventCycle:e=!1,children:t,...n},a){let{closeDrawer:o,isDragging:l,snapPoints:i,activeSnapPoint:u,setActiveSnapPoint:s,dismissible:d,handleOnly:c,isOpen:f,onPress:p,onDrag:m}=y(),g=r.default.useRef(null),h=r.default.useRef(!1);function v(){g.current&&window.clearTimeout(g.current),h.current=!1}return r.default.createElement("div",{onClick:function(){h.current?v():window.setTimeout(()=>{!function(){if(l||e||h.current)return v();if(v(),!i||0===i.length){d||o();return}if(u===i[i.length-1]&&d)return o();let t=i.findIndex(e=>e===u);-1===t||s(i[t+1])}()},120)},onPointerCancel:v,onPointerDown:e=>{c&&p(e),g.current=window.setTimeout(()=>{h.current=!0},250)},onPointerMove:e=>{c&&m(e)},ref:a,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},r.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});K.displayName="Drawer.Handle";let J={Root:U,NestedRoot:function({onDrag:e,onOpenChange:t,open:n,...a}){let{onNestedDrag:o,onNestedOpenChange:l,onNestedRelease:i}=y();if(!o)throw Error("Drawer.NestedRoot must be placed in another drawer");return r.default.createElement(U,{nested:!0,open:n,onClose:()=>{l(!1)},onDrag:(t,n)=>{o(t,n),null==e||e(t,n)},onOpenChange:e=>{e&&l(e),null==t||t(e)},onRelease:i,...a})},Content:V,Overlay:X,Trigger:v.Trigger,Portal:function(e){let t=y(),{container:n=t.container,...a}=e;return r.default.createElement(v.Portal,{container:n,...a})},Handle:K,Close:v.Close,Title:v.Title,Description:v.Description};var _=e.i(31777);function G({...e}){return(0,n.jsx)(J.Root,{"data-slot":"drawer",...e})}function Q({...e}){return(0,n.jsx)(J.Portal,{"data-slot":"drawer-portal",...e})}function Z({className:e,...t}){return(0,n.jsx)(J.Overlay,{"data-slot":"drawer-overlay",className:(0,_.cn)("fixed inset-0 z-50 bg-black/50",e),...t})}function ee({className:e,children:t,direction:r="bottom",showCloseButton:a=!0,...o}){return(0,n.jsx)(Q,{children:(0,n.jsxs)(J.Content,{"data-slot":"drawer-content",className:(0,_.cn)("bg-background fixed z-50 flex flex-col shadow-lg","bottom"===r&&"inset-x-0 bottom-0 mb-24 rounded-t-lg border-t","top"===r&&"inset-x-0 top-0 mt-24 rounded-b-lg border-b","right"===r&&"inset-y-0 right-0 h-full w-3/4 border-l","left"===r&&"inset-y-0 left-0 h-full w-3/4 border-r",e),style:{"--initial-transform":"right"===r?"calc(100% + 8px)":"left"===r||"top"===r?"calc(-100% - 8px)":"calc(100% + 8px)",userSelect:"text",...o.style??{}},...o,children:[t,a?(0,n.jsxs)(J.Close,{className:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,n.jsx)(h.XIcon,{className:"size-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]}):null]})})}function et({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-header",className:(0,_.cn)("flex flex-col gap-1.5 p-4",e),...t})}function en({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"drawer-footer",className:(0,_.cn)("mt-auto flex flex-col gap-2 p-4",e),...t})}function er({className:e,...t}){return(0,n.jsx)(J.Title,{"data-slot":"drawer-title",className:(0,_.cn)("text-foreground font-semibold",e),...t})}function ea({className:e,...t}){return(0,n.jsx)(J.Description,{"data-slot":"drawer-description",className:(0,_.cn)("text-muted-foreground text-sm",e),...t})}e.s(["Drawer",()=>G,"DrawerContent",()=>ee,"DrawerDescription",()=>ea,"DrawerFooter",()=>en,"DrawerHeader",()=>et,"DrawerOverlay",()=>Z,"DrawerTitle",()=>er],45811)},11495,e=>{"use strict";var t=e.i(20314),n=e.i(79054),r=e.i(48249),a=e.i(24042),o=e.i(64970),l=e.i(94237),i=e.i(31777);e.i(81803);var u=e.i(72714);e.i(99348);var s=e.i(17466),d=e.i(45811),c=e.i(25235),f=e.i(2828),p=e.i(8537),m=e.i(75921);let g=(0,l.cva)("",{variants:{size:{sm:"w-96",md:"w-2xl"}},defaultVariants:{size:"sm"}});function h({open:e,onClose:a,modal:o=!1,dismissOnOutsideClick:l=!1,title:u="Drawer",size:s,header:f,children:p,footer:h,className:w,"data-testid":y,deployTarget:b}){let x=(0,m.useFeatureFlags)(),R=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!e||o)return;let t=e=>{let t=e.target;!document.body.contains(t)||R.current?.contains(t)||t.closest(l?'[role="alertdialog"], [role="dialog"], [role="menu"], [role="listbox"], [data-radix-popper-content-wrapper]':'[data-no-drawer-close], [role="alertdialog"], [role="dialog"], [role="menu"], [role="listbox"], [data-radix-popper-content-wrapper]')||a()};return document.addEventListener("click",t),()=>document.removeEventListener("click",t)},[e,o,a,l]),(0,t.jsxs)(d.Drawer,{direction:"right",modal:o,handleOnly:!0,open:e,onOpenChange:e=>{e||a()},children:[o?(0,t.jsx)(d.DrawerOverlay,{}):null,(0,t.jsxs)(d.DrawerContent,{ref:R,direction:"right",showCloseButton:!1,className:(0,i.cn)(g({size:s}),w),"data-testid":y,onInteractOutside:o?void 0:e=>e.preventDefault(),children:[(0,t.jsx)(d.DrawerTitle,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:u})}),(0,t.jsx)(d.DrawerDescription,{asChild:!0,children:(0,t.jsx)("span",{className:"sr-only",children:u})}),(0,t.jsxs)("button",{type:"button","aria-label":"Close",onClick:a,className:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden","data-testid":y?`${y}-close-button`:void 0,children:[(0,t.jsx)(r.XIcon,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]}),f?(0,t.jsx)(d.DrawerHeader,{className:"shrink-0",children:f}):null,f?(0,t.jsx)(c.Separator,{}):null,x.envDeploy&&b?(0,t.jsx)(v,{deployTarget:b}):null,(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:p}),h?(0,t.jsx)(d.DrawerFooter,{className:"shrink-0",children:h}):null]})]})}function v({deployTarget:e}){let n=(0,p.useDeployAction)(e),r="Booting"===n.status||"Ready"===n.status;return(0,t.jsxs)("div",{"data-testid":"base-drawer-deploy-bar",className:"flex items-center gap-2 px-4 pb-3",children:[(0,t.jsx)(f.TooltipProvider,{children:(0,t.jsxs)(f.Tooltip,{children:[(0,t.jsx)(f.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{children:(0,t.jsx)(u.ActionButton,{label:r?"Stop Dev Server":"Start Dev Server",onClick:r?n.stop:n.deploy,loading:n.deployLoading||n.stopLoading,error:!!n.deployError,icon:r?o.Square:a.Play,iconOnly:!0,variant:"outline",size:"icon-sm"})})}),(0,t.jsx)(f.TooltipContent,{children:r?"Stop Dev Server":"Start Dev Server"})]})}),r?(0,t.jsx)(s.DeploymentStatusBadge,{status:n.status,url:n.url,targetId:e.targetId}):null]})}e.s(["BaseDrawer",()=>h])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=o((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(e,t,n)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n},a=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function a(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=class{constructor(e){o(this,"_isDirected",!0),o(this,"_isMultigraph",!1),o(this,"_isCompound",!1),o(this,"_label"),o(this,"_defaultNodeLabelFn",()=>{}),o(this,"_defaultEdgeLabelFn",()=>{}),o(this,"_nodes",{}),o(this,"_in",{}),o(this,"_preds",{}),o(this,"_out",{}),o(this,"_sucs",{}),o(this,"_edgeObjs",{}),o(this,"_edgeLabels",{}),o(this,"_nodeCount",0),o(this,"_edgeCount",0),o(this,"_parent"),o(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{t+="";for(var r=t;void 0!==r;r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(o){var a=r.parent(o);return void 0===a||t.hasNode(a)?(n[o]=a,a):a in n?n[a]:e(a)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,o){return n.length>1?r.setEdge(e,o,t):r.setEdge(e,o),o}),this}setEdge(){var e,t,n,o,s=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,t=i.w,n=i.name,2==arguments.length&&(o=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var l=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=o),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?o:this._defaultEdgeLabelFn(e,t,n);var d=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}var i={v:o,w:a};return n&&(i.name=n),i}(this._isDirected,e,t,n);return e=d.v,t=d.w,Object.freeze(d),this._edgeObjs[l]=d,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=d,this._out[e][l]=d,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var o=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),i=this._edgeObjs[o];return i&&(e=i.v,t=i.w,delete this._edgeLabels[o],delete this._edgeObjs[o],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),s=n((e,t)=>{t.exports="3.0.2"}),i=n((e,t)=>{t.exports={Graph:a(),version:s()}}),l=n((e,t)=>{var r=a();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),o={v:e};return void 0!==r&&(o.value=r),void 0!==n&&(o.parent=n),o}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),d=n((e,t)=>{t.exports=function(e,t,n,o){return function(e,t,r,n){var o={},a=!0,s=0,i=e.nodes(),l=function(e){var t=r(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},a=!0)},d=function(){i.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;l({v:r,w:n})})})};i.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(a=!1,s++,d(),a);u++);if(s===c-1&&(a=!1,d(),a))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||r,o||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(o){t=[],function n(o){Object.hasOwn(r,o)||(r[o]=!0,t.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){o(this,"_arr",[]),o(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(e,t){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,o=r[e],a=r[t];r[e]=a,r[t]=o,n[a.key]=e,n[o.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,o,a){return function(e,t,n,o){var a,s,i={},l=new r,d=function(e){var t=e.v!==a?e.v:e.w,r=i[t],o=n(e),d=s.distance+o;if(o<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);d<r.distance&&(r.distance=d,r.predecessor=a,l.decrease(t,d))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;i[e]={distance:r},l.add(e,r)});l.size()>0&&(s=i[a=l.removeMin()]).distance!==1/0;)o(a).forEach(d);return i}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),f=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(o,a){return o[a]=r(e,a,t,n),o},{})}}),p=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],o=r;o!==t;)n.push(o),o=e[o].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},o=[];return e.nodes().forEach(function(a){Object.hasOwn(n,a)||function a(s){var i=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(i.lowlink=Math.min(i.lowlink,n[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,n[e].lowlink))}),i.lowlink===i.index){var l,d=[];do n[l=r.pop()].onStack=!1,d.push(l);while(s!==l)o.push(d)}}(a)}),o}}),m=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),v=n((e,t)=>{t.exports=function(e,t,n){var o,a,s,i,l;return o=e,a=t||r,s=n||function(t){return e.outEdges(t)},i={},(l=o.nodes()).forEach(function(e){i[e]={},i[e][e]={distance:0},l.forEach(function(t){e!==t&&(i[e][t]={distance:1/0})}),s(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);i[e][r]={distance:n,predecessor:e}})}),l.forEach(function(e){var t=i[e];l.forEach(function(r){var n=i[r];l.forEach(function(r){var o=n[e],a=t[r],s=n[r],i=o.distance+a.distance;i<s.distance&&(s.distance=i,s.predecessor=a.predecessor)})})}),i};var r=()=>1}),x=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(a),delete r[s],o.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return o}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),y=n((e,t)=>{var r=x();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),b=n((e,t)=>{t.exports=function(e,t,r,n,o){Array.isArray(t)||(t=[t]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);o=function e(t,r,n,o,a,s,i){return Object.hasOwn(o,r)||(o[r]=!0,n||(i=s(i,r)),a(r).forEach(function(r){i=e(t,r,n,o,a,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,a,n,o)}),o}}),w=n((e,t)=>{var r=b();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),E=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),j=n((e,t)=>{var r=a(),n=u();t.exports=function(e,t){var o,a=new r,s={},i=new n;function l(e){var r=e.v===o?e.w:e.v,n=i.priority(r);if(void 0!==n){var a=t(e);a<n&&(s[r]=o,i.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){i.add(e,1/0),a.setNode(e)}),i.decrease(e.nodes()[0],0);for(var d=!1;i.size()>0;){if(Object.hasOwn(s,o=i.removeMin()))a.setEdge(o,s[o]);else{if(d)throw Error("Input graph is not connected: "+e);d=!0}e.nodeEdges(o).forEach(l)}return a}}),N=n((e,t)=>{var r=h(),n=d();t.exports=function(e,t,o,a){return function(e,t,o,a){if(void 0===o)return r(e,t,o,a);for(var s=!1,i=e.nodes(),l=0;l<i.length;l++){for(var d=a(i[l]),c=0;c<d.length;c++){var u=d[c],h=u.v===i[l]?u.v:u.w,f=h===u.v?u.w:u.v;0>o({v:h,w:f})&&(s=!0)}if(s)return n(e,t,o,a)}return r(e,t,o,a)}(e,t,o,a||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:d(),components:c(),dijkstra:h(),dijkstraAll:f(),extractPath:p(),findCycles:m(),floydWarshall:v(),isAcyclic:y(),postorder:E(),preorder:k(),prim:j(),shortestPaths:N(),reduce:b(),tarjan:g(),topsort:x()}}),_=i();t.exports={Graph:_.Graph,json:l(),alg:C(),version:_.version}}),s=o((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),i=o((e,t)=>{var r=a().Graph,n=s();t.exports=function(e,t){var a,s;let d,c,u,h,f;if(1>=e.nodeCount())return[];let p=(a=e,s=t||o,d=new r,c=0,u=0,a.nodes().forEach(e=>{d.setNode(e,{v:e,in:0,out:0})}),a.edges().forEach(e=>{let t=d.edge(e.v,e.w)||0,r=s(e);d.setEdge(e.v,e.w,t+r),u=Math.max(u,d.node(e.v).out+=r),c=Math.max(c,d.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),f=c+1,d.nodes().forEach(e=>{l(h,f,d.node(e))}),{graph:d,buckets:h,zeroIdx:f});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)i(e,t,r,s);for(;s=o.dequeue();)i(e,t,r,s);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue()){n=n.concat(i(e,t,r,s,!0));break}}}return n})(p.graph,p.buckets,p.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function i(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let s=e.edge(n),i=e.node(n.v);o&&a.push({v:n.v,w:n.w}),i.out-=s,l(t,r,i)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,s=e.node(a);s.in-=o,l(t,r,s)}),e.removeNode(n.v),a}function l(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),l=o((e,t)=>{var r=a().Graph;function n(e,t,r,n){for(var o=n;e.hasNode(o);)o=l(n);return r.dummy=t,e.setNode(o,r),o}t.exports={addBorderNode:function(e,t,r,o){let a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=o),n(e,"border",a,t)},addDummyNode:n,applyWithChunking:o,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=d(s(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;void 0!==o&&(t[o][n.order]=r)}),t},intersectRect:function(e,t){let r,n,o=e.x,a=e.y,s=t.x-o,i=t.y-a,l=e.width/2,d=e.height/2;if(!s&&!i)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(i)*l>Math.abs(s)*d?(i<0&&(d=-d),r=d*s/i,n=d):(s<0&&(l=-l),r=l,n=l*i/s),{x:o+r,y:a+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:s,normalizeRanks:function(e){let t=o(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:d,removeEmptyRanks:function(e){let t=o(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let o=e.node(n).rank-t;r[o]||(r[o]=[]),r[o].push(n)});let n=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%a!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:l,zipObject:c};function o(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function s(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var i=0;function l(e){return e+""+ ++i}function d(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let o=[];for(let t=e;n(t);t+=r)o.push(t);return o}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),d=o((e,t)=>{var r=i(),n=l().uniqueId;t.exports={run:function(e){var t,o;let a,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],s={},i={},(o=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?a.push(t):e(t.w)}),delete s[t])}),a)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=o((e,t)=>{var r=l();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,o,a,s=t.v,i=e.node(s).rank,l=t.w,d=e.node(l).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(d!==i+1){for(e.removeEdge(t),a=0,++i;i<d;++a,++i)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",o,"_d"),i===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),s=n;e.setEdge(s,l,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}}}),u=o((e,t)=>{var{applyWithChunking:r}=l();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(o){var a=e.node(o);if(Object.hasOwn(t,o))return a.rank;t[o]=!0;var s=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),a.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=o((e,t)=>{var r=a().Graph,n=u().slack;t.exports=function(e){var t,o,a,s,i=new r({directed:!1}),l=e.nodes()[0],d=e.nodeCount();for(i.setNode(l,{});t=i,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var s=a.v,i=r===s?a.w:s;t.hasNode(i)||n(o,a)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<d;)a=function(e,t){return t.edges().reduce((r,o)=>{let a=1/0;return e.hasNode(o.v)!==e.hasNode(o.w)&&(a=n(t,o)),a<r[0]?[a,o]:r},[1/0,null])[1]}(i,e),s=i.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),f=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,s=a().alg.preorder,i=a().alg.postorder,d=l().simplify;function c(e){o(e=d(e));var t,n,a=r(e);for(g(a),f(a,e);t=m(a);)n=v(a,e,t),x(a,e,t,n)}function f(e,t){var r=i(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,s;return n=e,o=t,a=r,s=n.node(a).parent,void(n.edge(a,s).cutvalue=p(n,o,a))})}function p(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),s=0;return a||(o=!1,a=t.edge(n,r)),s=a.weight,t.nodeEdges(r).forEach(a=>{var i=a.v===r,l=i?a.w:a.v;if(l!==n){var d,c,u,h=i===o,f=t.edge(a).weight;if(s+=h?f:-f,d=e,c=r,u=l,d.hasEdge(c,u)){var p=e.edge(r,l).cutvalue;s+=h?-p:p}}}),s}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var s=n,i=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),i.low=s,i.lim=n++,a?i.parent=a:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function v(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var s=e.node(o),i=e.node(a),l=s,d=!1;return s.lim>i.lim&&(l=i,d=!0),t.edges().filter(t=>d===y(e,e.node(t.v),l)&&d!==y(e,e.node(t.w),l)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function x(e,t,r,n){var o,a,i,l,d=r.v,c=r.w;e.removeEdge(d,c),e.setEdge(n.v,n.w,{}),g(e),f(e,t),o=e,a=t,i=o.nodes().find(e=>!a.node(e).parent),(l=(l=s(o,i)).slice(1)).forEach(e=>{var t=o.node(e).parent,r=a.edge(e,t),n=!1;r||(r=a.edge(t,e),n=!0),a.node(e).rank=a.node(t).rank+(n?r.minlen:-r.minlen)})}function y(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=p,c.leaveEdge=m,c.enterEdge=v,c.exchangeEdges=x}),p=o((e,t)=>{var r=u().longestPath,n=h(),o=f();t.exports=function(e){var t,s=e.graph().ranker;if(s instanceof Function)return s(e);switch(e.graph().ranker){case"network-simplex":default:o(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":a(e);case"none":}};var a=r}),g=o((e,t)=>{t.exports=function(e){var t;let r,n,o=(r={},n=0,(t=e).children().forEach(function e(o){let a=n;t.children(o).forEach(e),r[o]={low:a,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,a=function(e,t,r,n){let o=[],a=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),l,d;l=r;do o.push(l=e.parent(l));while(l&&(t[l].low>s||i>t[l].lim))for(d=l,l=n;(l=e.parent(l))!==d;)a.push(l);return{path:o.concat(a.reverse()),lca:d}}(e,o,n.v,n.w),s=a.path,i=a.lca,l=0,d=s[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(d=s[l])!==i&&e.node(d).maxRank<r.rank;)l++;d===i&&(c=!1)}if(!c){for(;l<s.length-1&&e.node(d=s[l+1]).minRank<=r.rank;)l++;d=s[l]}e.setParent(t,d),t=e.successors(t)[0]}})}}),m=o((e,t)=>{var r=l();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,o){var a=t.children(r);a&&a.length&&a.forEach(t=>e(t,o+1)),n[r]=o})(e,1)),n),i=Object.values(s),l=r.applyWithChunking(Math.max,i)-1,d=2*l+1;e.graph().nestingRoot=a,e.edges().forEach(t=>e.edge(t).minlen*=d);let c=(o=e).edges().reduce((e,t)=>e+o.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,o,a,s,i,l){let d=t.children(l);if(!d.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:o});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(l);t.setParent(c,l),h.borderTop=c,t.setParent(u,l),h.borderBottom=u,d.forEach(r=>{e(t,n,o,a,s,i,r);let d=t.node(r),h=d.borderTop?d.borderTop:r,f=d.borderBottom?d.borderBottom:r,p=d.borderTop?a:2*a,g=h!==f?1:s-i[l]+1;t.setEdge(c,h,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(f,u,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,c,{weight:0,minlen:s+i[l]})})(e,a,d,c,l,s,t)),e.graph().nodeRankFactor=d},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),v=o((e,t)=>{var r=l();function n(e,t,n,o,a,s){let i=a[t][s-1],l=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);a[t][s]=l,e.setParent(l,o),i&&e.setEdge(i,l,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let o=e.children(r),a=e.node(r);if(o.length&&o.forEach(t),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,o=a.maxRank+1;t<o;++t)n(e,"borderLeft","_bl",r,a,t),n(e,"borderRight","_br",r,a,t)}})}}),x=o((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function a(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let s=e.graph().rankdir.toLowerCase();("bt"===s||"rl"===s)&&((t=e).nodes().forEach(e=>o(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(o),Object.hasOwn(r,"y")&&o(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>a(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(a),Object.hasOwn(t,"x")&&a(t)}),r(e))}}}),y=o((e,t)=>{var r=l();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),o=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,o),s=r.range(a+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,s[e.node(n).rank].push(n),e.successors(n).forEach(r))}),s}}),b=o((e,t)=>{var r=l().zipObject;t.exports=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=function(e,t,n){let o=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),s=1;for(;s<n.length;)s<<=1;let i=2*s-1;s-=1;let l=Array(i).fill(0),d=0;return a.forEach(e=>{let t=e.pos+s;l[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=l[t+1]),t=t-1>>1,l[t]+=e.weight;d+=e.weight*r}),d}(e,t[o-1],t[o]);return n}}),w=o((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=o((e,t)=>{var r=l();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(function(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),k=o((e,t)=>{var r=l();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var o;let a=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=a.lhs,i=a.rhs.sort((e,t)=>t.i-e.i),l=[],d=0,c=0,u=0;s.sort((o=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:o?t.i-e.i:e.i-t.i)),u=n(l,i,u),s.forEach(e=>{u+=e.vs.length,l.push(e.vs),d+=e.barycenter*e.weight,c+=e.weight,u=n(l,i,u)});let h={vs:l.flat(!0)};return c&&(h.barycenter=d/c,h.weight=c),h}}),j=o((e,t)=>{var r=w(),n=E(),o=k();t.exports=function e(t,a,s,i){var l,d;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};h&&(c=c.filter(e=>e!==h&&e!==f));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,s,i);p[r.v]=a,Object.hasOwn(a,"barycenter")&&(n=r,o=a,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+o.barycenter*o.weight)/(n.weight+o.weight),n.weight+=o.weight):(n.barycenter=o.barycenter,n.weight=o.weight))}});let m=n(g,s);l=m,d=p,l.forEach(e=>{e.vs=e.vs.flatMap(e=>d[e]?d[e].vs:e)});let v=o(m,i);if(h&&(v.vs=[h,v.vs,f].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(f)[0]);Object.hasOwn(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.order+r.order)/(v.weight+2),v.weight+=2}return v}}),N=o((e,t)=>{var r=a().Graph,n=l();t.exports=function(e,t,o,a){a||(a=e.nodes());let s=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),i=new r({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(t=>e.node(t));return a.forEach(r=>{let n=e.node(r),a=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,a||s),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=i.edge(n,r),a=void 0!==o?o.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),s,i;for(;a;){if((s=e.parent(a))?(i=n[s],n[s]=a):(i=o,o=a),i&&i!==a)return void t.setEdge(i,a);a=s}})}}),_=o((e,t)=>{var r=y(),n=b(),o=j(),s=N(),i=C(),d=a().Graph,c=l();function u(e,t,r){let n=new Map,o=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&o(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&o(e,t)}return t.map(function(t){return s(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,a={}){if("function"==typeof a.customOrder)return void a.customOrder(t,e);let s=c.maxRank(t),l=u(t,c.range(1,s+1),"inEdges"),f=u(t,c.range(s-1,-1,-1),"outEdges"),p=r(t);if(h(t,p),a.disableOptimalOrderHeuristic)return;let g=1/0,m,v=a.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new d;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let a=e.graph().root,s=o(e,a,n,t);s.vs.forEach((t,r)=>e.node(t).order=r),i(e,n,s.vs)})})(e%2?l:f,e%4>=2,v),p=c.buildLayerMatrix(t);let a=n(t,p);a<g?(r=0,m=Object.assign({},p),g=a):a===g&&(m=structuredClone(p))}h(t,m)}}),O=o((e,t)=>{var r=a().Graph,n=l();function o(e,t){let r={};return t.length&&t.reduce(function(t,n){let o=0,a=0,s=t.length,l=n[n.length-1];return n.forEach((t,d)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:s;(c||t===l)&&(n.slice(a,d+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),s=a.order;(s<o||u<s)&&!(a.dummy&&e.node(t).dummy)&&i(r,n,t)})}),a=d+1,o=u)}),n}),r}function s(e,t){let r={};function o(t,o,a,s,l){let d;n.range(o,a).forEach(n=>{d=t[n],e.node(d).dummy&&e.predecessors(d).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>l)&&i(r,t,d)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,s=0;return r.forEach((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(a=e.node(t[0]).order,o(r,s,l,n,a),s=l,n=a)}o(r,s,r.length,a,t.length)}),r}),r}function i(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function d(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let o={},a={},s={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let i=n(e);if(i.length){let n=((i=i.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let l=Math.floor(n),c=Math.ceil(n);l<=c;++l){let n=i[l];a[e]===e&&t<s[n]&&!d(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=s[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var s,i,l,d,c,u,h;let f,p,g,m={},v=(s=e,i=t,l=n,d=a,f=new r,g=(c=(p=s.graph()).nodesep,u=p.edgesep,h=d,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,s;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":s=-n.width/2;break;case"r":s=n.width/2}if(s&&(a+=h?s:-s),s=0,a+=(n.dummy?u:c)/2,a+=(o.dummy?u:c)/2,a+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":s=o.width/2;break;case"r":s=-o.width/2}return s&&(a+=h?s:-s),s=0,a}),i.forEach(e=>{let t;e.forEach(e=>{let r=l[e];if(f.setNode(r),t){var n=l[t],o=f.edge(n,r);f.setEdge(n,r,Math.max(g(s,e,t),o||0))}t=e})}),f),x=a?"borderLeft":"borderRight";function y(e,t){let r=v.nodes().slice(),n={},o=r.pop();for(;o;){if(n[o])e(o);else for(let e of(n[o]=!0,r.push(o),t(o)))r.push(e);o=r.pop()}}return y(function(e){m[e]=v.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+v.edge(t)),0)},v.predecessors.bind(v)),y(function(t){let r=v.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-v.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==x&&(m[t]=Math.max(m[t],r))},v.successors.bind(v)),Object.keys(o).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,o=1/0;Object.entries(r).forEach(([t,r])=>{var a,s;let i=(a=e,s=t,a.node(s).width/2);n=Math.max(r+i,n),o=Math.min(r-i,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function f(e,t){let r=Object.values(t),o=n.applyWithChunking(Math.min,r),a=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(s=>{let i=r+s,l=e[i];if(l===t)return;let d=Object.values(l),c=o-n.applyWithChunking(Math.min,d);"l"!==s&&(c=a-n.applyWithChunking(Math.max,d)),c&&(e[i]=n.mapValues(l,e=>e+c))})})}function p(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(o(e,t),s(e,t)),a={},i;["u","d"].forEach(o=>{i="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let s=("u"===o?e.predecessors:e.successors).bind(e),l=c(e,i,r,s),d=u(e,i,l.root,l.align,"r"===t);"r"===t&&(d=n.mapValues(d,e=>-e)),a[o+t]=d})});let l=h(e,a);return f(a,l),p(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:s,addConflict:i,hasConflict:d,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:f,findSmallestWidthAlignment:h,balance:p}}),R=o((e,t)=>{var r=l(),n=O().positionX;t.exports=function(e){var t;let o,a,s,i;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,s=t.graph().rankalign,i=0,o.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===s?n.y=i+n.height/2:"bottom"===s?n.y=i+r-n.height/2:n.y=i+r/2}),i+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),S=o((e,t)=>{var r=d(),n=c(),o=p(),s=l().normalizeRanks,i=g(),u=l().removeEmptyRanks,h=m(),f=v(),y=x(),b=_(),w=R(),E=l(),k=a().Graph;t.exports=function(e,t={}){let a=t.debugTiming?E.time:E.notime;return a("layout",()=>{let l=a(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new k({multigraph:!0,compound:!0}),n=F(t.graph()),r.setGraph(Object.assign({},N,L(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=L(F(t.node(e)),O);Object.keys(S).forEach(e=>{void 0===n[e]&&(n[e]=S[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=F(t.edge(e));r.setEdge(e,Object.assign({},P,L(n,M),E.pick(n,T)))}),r});return a(" runLayout",()=>{var e,d,c;return e=l,d=a,c=t,void(d(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),d(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),d(" acyclic",()=>r.run(e)),d(" nestingGraph.run",()=>h.run(e)),d(" rank",()=>o(E.asNonCompoundGraph(e))),d(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};E.addDummyNode(t,"edge-proxy",n,"_ep")}})}),d(" removeEmptyRanks",()=>u(e)),d(" nestingGraph.cleanup",()=>h.cleanup(e)),d(" normalizeRanks",()=>s(e)),d(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),d(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),d(" normalize.run",()=>n.run(e)),d(" parentDummyChains",()=>i(e)),d(" addBorderSegments",()=>f(e)),d(" order",()=>b(e,c)),d(" insertSelfEdges",()=>{var t;return t=e,void E.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var o=t.node(e);o.order=n+r,(o.selfEdges||[]).forEach(e=>{E.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),d(" adjustCoordinateSystem",()=>y.adjust(e)),d(" position",()=>w(e)),d(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,a=n.y,s=r.x-o,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:a-i},{x:o+5*s/6,y:a-i},{x:o+s,y:a},{x:o+5*s/6,y:a+i},{x:o+2*s/3,y:a+i}],r.label.x=r.x,r.label.y=r.y}})}),d(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),o=t.node(r.borderBottom),a=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-a.x),r.height=Math.abs(o.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),d(" normalize.undo",()=>n.undo(e)),d(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),d(" undoCoordinateSystem",()=>y.undo(e)),d(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function l(e){let a=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,a-i/2),r=Math.max(r,a+i/2),n=Math.min(n,s-l/2),o=Math.max(o,s+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&l(r)}),t-=s,n-=i,e.nodes().forEach(r=>{let o=e.node(r);o.x-=t,o.y-=n}),e.edges().forEach(r=>{let o=e.edge(r);o.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=n)}),a.width=r-t+s,a.height=o-n+i})(e)),d(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),o=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=o,s=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,s))})}),d(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),d(" acyclic.undo",()=>r.undo(e)))}),a(" updateInputGraph",()=>{var t,r;return t=e,r=l,void(t.nodes().forEach(e=>{let n=t.node(e),o=r.node(e);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,r.children(e).length&&(n.width=o.width,n.height=o.height))}),t.edges().forEach(e=>{let n=t.edge(e),o=r.edge(e);n.points=o.points,Object.hasOwn(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),l})};var j=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],S={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function L(e,t){return E.mapValues(E.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),M=o((e,t)=>{var r=l(),n=a().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),o=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{o.setNode(t,{label:t}),o.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>o.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{o.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(o.setEdge(e,t,{style:"invis"}),t))}),o}}}),P=o((e,t)=>{t.exports="2.0.4"});let T=o((e,t)=>{t.exports={graphlib:a(),layout:S(),debug:M(),util:{time:l().time,notime:l().notime},version:P()}})(),L={direction:"LR",ranksep:200,nodesep:30},F={featureNode:{width:288,height:140},repositoryNode:{width:400,height:140}};function D(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:F[e.type??""]??t}function A(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new T.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:a,nodesep:s});let l=new Set;for(let e of t)l.add(e.source),l.add(e.target);let d=e.filter(e=>l.has(e.id)),c=e.filter(e=>!l.has(e.id));for(let e of d){let t=D(e,o);i.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)i.hasNode(e.source)&&i.hasNode(e.target)&&i.setEdge(e.source,e.target,{},e.id);T.layout(i);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),f="LR"===n||"RL"===n,p=new Map;for(let e of d){let t=i.node(e.id),r=D(e,o);p.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of p.values()){g=f?e.cx:e.cy;break}for(let e of c){let t=D(e,o);p.set(e.id,{cx:f?g:0,cy:f?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)p.has(e.source)&&p.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let v=new Map;for(let t=0;t<e.length;t++)v.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let x=new Set;for(let e of m.values())for(let t of e)x.add(t);let y=[...[...l].filter(e=>p.has(e)&&!x.has(e)),...c.map(e=>e.id)];y.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let b=new Map;for(let e of y)!function e(t){if(b.has(t))return b.get(t);let r=p.get(t),n=f?r.h:r.w,o=m.get(t);if(!o||0===o.length)return b.set(t,n),n;let a=0;for(let t of o)a+=e(t);let i=Math.max(n,a+=(o.length-1)*s);return b.set(t,i),i}(e);let w=0;for(let e of y){let t=b.get(e)??0;!function e(t,r){let n=p.get(t);f?n.cy=r:n.cx=r;let o=m.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=b.get(e)??0;let i=r-(a+=(o.length-1)*s)/2;for(let t of o){let r=b.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let E=[];for(let t of e){let e=p.get(t.id);e&&E.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:E,edges:[...t]}}var I=e.i(21023);let $=(0,I.createServerReference)("784d80ed70cbbd43dbfa038d3f3f5fd83ae472f90c",I.callServer,void 0,I.findSourceMapURL,"deleteFeature");var z=e.i(75993),G=e.i(89959);let B=(0,I.createServerReference)("404e91ee3427910039072ab0378d5ce4a58fda02c7",I.callServer,void 0,I.findSourceMapURL,"stopFeature");var q=e.i(13018);let W=(0,I.createServerReference)("40e9db2f069eb637928d7a523b5ded822fdb1d6181",I.callServer,void 0,I.findSourceMapURL,"deleteRepository"),U=(0,I.createServerReference)("401b5e50e576027586673e2a02f4efa8d2d6303f2f",I.callServer,void 0,I.findSourceMapURL,"getFeatureMetadata");var V=e.i(39443),H=e.i(8361),X=e.i(18354),J=e.i(99045);function K(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,o=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&o.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:o}}function Y(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}function Q(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||n.parentNodeId!==e.parentNodeId||n.data!==e.data&&JSON.stringify(n.data)!==JSON.stringify(e.data))return!1}return!0}let Z=(0,X.createLogger)("[Polling]"),ee=0,et=0;function er(e,o){let a=(0,r.useRouter)(),s=(0,H.useSoundAction)("delete"),i=(0,H.useSoundAction)("create"),{nodes:l,edges:d,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:f,restoreFeature:p,addRepository:g,removeRepository:m,replaceRepository:v,getFeatureRepositoryPath:x,getRepositoryData:y,getRepoMapSize:b,setCallbacks:w,beginMutation:E,endMutation:k,isMutating:j}=function(e,r){let n=(0,t.useMemo)(()=>K(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[s,i]=(0,t.useState)(n.repoMap),[l,d]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)(new Set),h=(0,t.useRef)(0),f=(0,t.useRef)(new Set),p=(0,t.useRef)(new Set),g=(0,t.useRef)({}),m=(0,t.useMemo)(()=>({onNodeAction:e=>g.current.onNodeAction?.(e),onNodeSettings:e=>g.current.onNodeSettings?.(e),onFeatureDelete:(e,t,r,n)=>g.current.onFeatureDelete?.(e,t,r,n),onRepositoryAdd:e=>g.current.onRepositoryAdd?.(e),onRepositoryClick:e=>g.current.onRepositoryClick?.(e),onRepositoryDelete:e=>g.current.onRepositoryDelete?.(e),onRetryFeature:e=>g.current.onRetryFeature?.(e),onStartFeature:e=>g.current.onStartFeature?.(e)}),[]),v=(0,t.useRef)(o);v.current=o;let x=(0,t.useRef)(s);x.current=s;let y=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],s=e=>e.replace(/\\/g,"/"),i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(s(r.data.repositoryPath),e);let l=new Map;for(let[e,r]of[...t.entries()].sort((e,t)=>{let r=e[1].data.createdAt,n=t[1].data.createdAt;return("number"!=typeof r||Number.isNaN(r)?1/0:r)-("number"!=typeof n||Number.isNaN(n)?1/0:n)})){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};o.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,d,c]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let e="creating"===d.data.state||c,r={...d.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!e&&"error"===d.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!e&&"pending"===d.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature},...!e&&("running"===d.data.state||"action-required"===d.data.state)&&n?.onStopFeature&&{onStop:n.onStopFeature}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),d.parentNodeId)a.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=s(d.data.repositoryPath),r=i.get(e)??function(e){if(l.has(e))return l.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return o.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),l.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=new Set;for(let e of a)"dependencyEdge"===e.type&&d.add(e.source);let c=a.length>0;for(let e of o){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=d.has(e.id))}return{nodes:o,edges:a}})(o,s,l,m),[o,s,l,m]),b=(0,t.useRef)({key:"",positions:new Map}),{nodes:w,edges:E}=(0,t.useMemo)(()=>{let e=y.nodes.map(e=>e.id).sort().join(","),t=y.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==b.current.key){let e=A(y.nodes,y.edges,L),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});let n=b.current.positions;if(n.size>0){let r=0,o=0;for(let[e,a]of t){let t=n.get(e);if(t){r=t.position.x-a.position.x,o=t.position.y-a.position.y;break}}if(0!==r||0!==o){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+o};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+o}}}return b.current={key:r,positions:t},e}let{positions:n}=b.current;return{nodes:y.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:y.edges}},[y]),k=(0,t.useCallback)((e,t)=>{if(h.current>0)return;let{featureMap:r,repoMap:n}=K(e,t),o=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));a(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;o.has(t)||n.set(e,r)}let a=new Set;for(let[t,r]of e)"deleting"===r.data.state&&(n.has(t)?n.set(t,{...n.get(t),data:{...n.get(t).data,state:"deleting"}}):p.current.has(t)||(n.set(t,r),a.add(t)));for(let[e,t]of(p.current=a,c.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return Q(e,n)?e:n}),d(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,a]of e){let e=`${a.data.name}\0${a.data.repositoryPath}`;o.has(e)&&(r.delete(n),t=!0)}return t?r:e}),i(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,o]of e){if(t.has(n)||r.has(o.data.repositoryPath)){u.current.delete(n);continue}(n.startsWith("repo-temp-")||u.current.has(n))&&t.set(n,o)}return Q(e,t)?e:t})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=r.get(e);if(!n)return c.current.set(e,{...c.current.get(e),...t}),r;if(c.current.delete(e),Y(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o}),d(r=>{let n=r.get(e);if(!n||Y(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o})},[]),N=(0,t.useCallback)((e,t,r)=>{d(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),C=(0,t.useCallback)(e=>{d(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),_=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),O=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),R=(0,t.useCallback)((e,t)=>{u.current.add(e),i(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),S=(0,t.useCallback)(e=>{u.current.delete(e),i(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),M=(0,t.useCallback)((e,t,r)=>{u.current.delete(e),u.current.add(t),i(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),P=(0,t.useCallback)(e=>v.current.get(e)?.data.repositoryPath,[]),T=(0,t.useCallback)(e=>x.current.get(e)?.data,[]),F=(0,t.useCallback)(()=>x.current.size,[]),D=(0,t.useCallback)(e=>{g.current=e},[]),I=(0,t.useCallback)(()=>{h.current++},[]),$=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{h.current=Math.max(0,h.current-1),f.current.delete(t)},e);f.current.add(t)},[]),z=(0,t.useCallback)(()=>h.current>0,[]);return(0,t.useEffect)(()=>{let e=f.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:w,edges:E,reconcile:k,updateFeature:j,addPendingFeature:N,removePendingFeature:C,removeFeature:_,restoreFeature:O,addRepository:R,removeRepository:S,replaceRepository:M,getFeatureRepositoryPath:P,getRepositoryData:T,getRepoMapSize:F,setCallbacks:D,beginMutation:I,endMutation:$,isMutating:z}}(e,o),N=(0,t.useRef)(l),C=(0,t.useRef)(d);(0,t.useEffect)(()=>{N.current=l,C.current=d},[l,d]);let _=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),O=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),R=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${_}|${O}`;t!==R.current&&(R.current=t,c(e,o))},[_,O,e,o,c]);let S=(0,t.useRef)(new Map),{events:M}=(0,V.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=S.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,o=t.get(r.id);void 0!==o&&o!==e.state&&(M.some(t=>t.featureId===e.featureId&&(0,J.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>a.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[O,e,M,a]);let P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>M.length&&(P.current=0),M.length<=P.current)return;let e=M.slice(P.current);for(let{featureId:t,state:r,lifecycle:n}of(P.current=M.length,(0,J.resolveSseEventUpdates)(e)))if(void 0!==r||void 0!==n){let e=`feat-${t}`,o=N.current.find(t=>t.id===e),a=o?o.data.state:void 0;if("deleting"===a||"error"===r&&j()&&"running"===a)continue;u(e,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})}},[M,u,j]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;E(),u(`feat-${t}`,{state:"running"}),k()};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[u,E,k]);let T=(0,t.useRef)(new Set),F=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(F.current>M.length&&(F.current=0),M.length<=F.current)return;let e=M.slice(F.current);for(let t of(F.current=M.length,e)){if("Feature metadata updated"!==t.message||T.current.has(t.featureId))continue;T.current.add(t.featureId);let e=`feat-${t.featureId}`;U(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[M,u]),(0,t.useEffect)(()=>{Z.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{if(!j())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();c(t,r)}catch{Z.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Z.debug("polling disabled"),clearInterval(e)}},[c,j]);let D=(0,t.useCallback)(e=>{},[]),I=(0,t.useCallback)(e=>{},[]),X=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${ee++}`,o={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return h(n,o,"dependencyEdge"===r&&e?e:void 0),n},[h]),er=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,z.resumeFeature)(e).then(e=>{e.error?(u(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{u(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>k())},[u,E,k]),en=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,G.startFeature)(e).then(e=>{e.error?(u(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{u(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>k())},[u,E,k]),eo=(0,t.useCallback)(e=>{E(),B(e).then(e=>{e.error?n.toast.error(e.error):n.toast.success("Agent stopped")}).catch(()=>{n.toast.error("Failed to stop agent")}).finally(()=>k())},[E,k]),ea=(0,t.useCallback)((e,t,r,o)=>{let i=`feat-${e}`,l=[];if(!0===r){let e=[i];for(;e.length>0;){let t=e.shift();for(let r of C.current)"dependencyEdge"===r.type&&r.source===t&&(l.push(r.target),e.push(r.target))}}let d=new Map;for(let e of[i,...l]){let t=N.current.find(t=>t.id===e);t&&d.set(e,t.data.state)}for(let e of(E(),u(i,{state:"deleting"}),l))u(e,{state:"deleting"});s.play(),a.push("/"),$(e,t,r,o).then(e=>{if(e.error){for(let[e,t]of d)t&&u(e,{state:t});n.toast.error(e.error)}else for(let e of(f(i),l))f(e)}).catch(()=>{for(let[e,t]of d)t&&u(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>k())},[a,s,u,f,E,k]),es=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(C.current.filter(e=>e.source===t).map(e=>e.target)),o=y(t),a=new Map;for(let e of r){let t=N.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let i=()=>{for(let[e,r]of(o&&g(t,o),a))p(e,r)};for(let e of(E(),m(t),r))f(e);try{let t=await W(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),i();return}s.play()}catch{n.toast.error("Failed to remove repository"),i()}finally{k()}},[s,m,f,g,p,y,E,k]),ei=(0,t.useCallback)(e=>{let t=A(N.current,C.current,{...L,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:l,edges:d,onNodesChange:D,handleConnect:I,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++et}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return E(),g(r,{name:o,repositoryPath:e,id:r,createdAt:Date.now(),gitInfoStatus:"loading"}),(0,q.addRepository)({path:e,name:o}).then(e=>{if(e.error){m(r),n.toast.error(e.error);return}let t=e.repository;v(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),i.play()}).catch(()=>{m(r),n.toast.error("Failed to add repository")}).finally(()=>k()),{wasEmpty:t,repoPath:e}},[g,m,v,i,b,E,k]),handleLayout:ei,handleDeleteFeature:ea,handleRetryFeature:er,handleStartFeature:en,handleStopFeature:eo,handleDeleteRepository:es,createFeatureNode:X,getFeatureRepositoryPath:x,getRepositoryData:y,setCallbacks:w}}e.s(["useControlCenterState",()=>er],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(79054),o=e.i(31406),a=e.i(3214),s=e.i(38227),i=e.i(31777),l=e.i(35364);e.i(54793);var d=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002),h=e.i(82569),f=e.i(8986),p=e.i(38573),g=e.i(19933),m=e.i(67669),v=e.i(24042),x=e.i(64970),y=e.i(49228),b=e.i(65530),w=e.i(7311);let E=(0,e.i(3645).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.i(81803);var k=e.i(72714),j=e.i(2287),N=e.i(2828),C=e.i(8537),_=e.i(75921),O=e.i(76852),R=e.i(80519);function S({data:e}){let d=(0,o.useRouter)(),c=(0,_.useFeatureFlags)(),[S,M]=(0,n.useState)(!1),P=(0,O.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),T=(0,C.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),L="Booting"===T.status||"Ready"===T.status,F=(0,n.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",o=["Continue work from a previous agent session.","","## Session Context",`- Session ID: ${t.id}`,`- Messages: ${t.messageCount}`,t.lastMessageAt?`- Last active: ${t.lastMessageAt}`:"",`- Conversation file: ${r}`,"","## Session Preview",`> ${n}`,"","## Instructions","1. Read the full conversation history from the file above",`2. Analyze the current state of the repository — what was done, what remains`,"3. Create or update spec files to accurately reflect the current state and remaining work","4. Continue implementing any unfinished work from the conversation"].filter(Boolean).join("\n"),a=new URLSearchParams({repo:e.repositoryPath,prompt:o});d.push(`/create?${a.toString()}`)},[e.repositoryPath,d]);return(0,t.jsxs)("div",{className:(0,i.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:u.Position.Left,isConnectable:!1,className:"opacity-0!",style:{top:70}}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),M(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(m.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(N.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(j.Dialog,{open:S,onOpenChange:M,children:(0,t.jsxs)(j.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(j.DialogHeader,{children:[(0,t.jsx)(j.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(j.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(j.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(j.DialogClose,{asChild:!0,children:(0,t.jsx)(l.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(l.Button,{variant:"destructive",onClick:()=>{M(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:"nodrag bg-card flex w-[26rem] cursor-pointer flex-col overflow-hidden rounded-xl border shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)(h.Github,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,i.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(k.ActionButton,{label:"Open in IDE",onClick:P.openInIde,loading:P.ideLoading,error:!!P.ideError,icon:f.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(k.ActionButton,{label:"Open in Shell",onClick:P.openInShell,loading:P.shellLoading,error:!!P.shellError,icon:p.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(k.ActionButton,{label:"Open Folder",onClick:P.openFolder,loading:P.folderLoading,error:!!P.folderError,icon:g.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:"Open Folder"})]})}),(0,t.jsx)(R.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,onCreateFromSession:F})]}):null,e.onAdd?(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Add feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,i.cn)("text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:text-blue-500",e.pulseAdd&&"animate-pulse-cta bg-blue-100 text-blue-500 dark:bg-blue-900/40"),children:(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(N.TooltipContent,{children:"Add feature"})]})}):null]})]}),e.branch?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-info",className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1 truncate","data-testid":"repository-node-branch",children:[(0,t.jsx)(y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.branch})]}),null!=e.behindCount&&e.behindCount>0?(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap text-amber-500","data-testid":"repository-node-behind",children:[(0,t.jsx)(w.ArrowDown,{className:"h-3 w-3 shrink-0"}),e.behindCount," behind"]}):null]})}),e.commitMessage?(0,t.jsx)("div",{"data-testid":"repository-node-commit-info",className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(b.GitCommitHorizontal,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate","data-testid":"repository-node-commit-message",children:e.commitMessage}),e.committer?(0,t.jsxs)("span",{className:"text-muted-foreground/70 ml-auto flex shrink-0 items-center gap-1","data-testid":"repository-node-committer",children:[(0,t.jsx)(E,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:e.committer})]}):null]})}):null]}):"not-a-repo"===e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-not-repo",className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(g.FolderOpen,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate opacity-60",children:e.repositoryPath??"Unknown path"})]})}),(0,t.jsx)("div",{className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs opacity-40",children:[(0,t.jsx)(y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:"Not a git repository"})]})})]}):"ready"!==e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-loading",className:"border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex h-4 items-center gap-2 text-xs",children:[(0,t.jsx)(y.GitBranch,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"bg-muted h-3 w-20 animate-pulse rounded"})]})}),(0,t.jsx)("div",{className:"border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex h-4 items-center gap-2 text-xs",children:[(0,t.jsx)(b.GitCommitHorizontal,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"bg-muted h-3 w-36 animate-pulse rounded"})]})})]}):null,c.envDeploy&&e.repositoryPath?(0,t.jsx)("div",{"data-testid":"repository-node-dev-preview",className:"border-t px-4 py-2",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[T.deployError?(0,t.jsx)("span",{className:"truncate text-xs text-red-500",children:T.deployError}):L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mr-0.5 inline-block h-2 w-2 shrink-0 rounded-full bg-green-500"}),T.url?(0,t.jsx)("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"truncate text-green-700 hover:underline dark:text-green-400",children:T.url}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Starting..."})]}):(0,t.jsxs)("span",{className:"text-muted-foreground",children:["Run",(0,t.jsx)("span",{className:"text-muted-foreground/50 ml-2 text-[10px]",children:"start local environment"})]}),(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"ml-auto flex items-center",children:(0,t.jsx)(k.ActionButton,{label:T.deployError?"Retry":L?"Stop Dev Server":"Start Dev Server",onClick:L?T.stop:T.deploy,loading:T.deployLoading||T.stopLoading,error:!1,icon:T.deployError?s.RotateCcw:L?x.Square:v.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:L?"Stop Dev Server":"Start Dev Server"})]})})]})}):null]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:u.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!",style:{top:70}}):null]})}function M(e){let[n]=(0,u.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let P={x:30,y:30,zoom:.85};function T({onResetViewport:e}){let{setViewport:o}=(0,r.useReactFlow)(),a=(0,n.useCallback)(()=>{o(e(),{duration:400})},[e,o]);return(0,t.jsx)(r.ControlButton,{onClick:a,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(s.RotateCcw,{style:{fill:"none"}})})}function L({nodes:e,edges:o,selectedFeatureId:s,defaultViewport:u,onNodesChange:h,onAddFeature:f,onConnect:p,onNodeClick:g,onPaneClick:m,onCanvasDrag:v,onMoveEnd:x,onResetViewport:y,toolbar:b,emptyState:w}){let E=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:S}),[]),k=(0,n.useMemo)(()=>({dependencyEdge:M}),[]),j=(0,n.useMemo)(()=>null==s?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===s?{...e,selected:!0}:e),[e,s]),N=0===e.length,[C,_]=(0,n.useState)(N),[O,R]=(0,n.useState)(!1),L=(0,n.useRef)(N);(0,n.useEffect)(()=>{if(L.current&&!N){R(!0);let e=setTimeout(()=>{_(!1),R(!1)},300);return L.current=N,()=>clearTimeout(e)}!L.current&&N&&_(!0),L.current=N},[N]);let F=N&&!w?(0,t.jsx)(d.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(l.Button,{onClick:f,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})}):null,D=w??F;return(0,t.jsxs)("div",{"data-testid":N?"features-canvas-empty":"features-canvas","data-no-drawer-close":!0,className:"dark:bg-background pointer-events-auto relative h-full w-full bg-[#f6f7f8]",children:[(0,t.jsxs)(r.ReactFlow,{nodes:j,edges:o,nodeTypes:E,edgeTypes:k,onConnect:p,onNodesChange:h,onNodeClick:g,onPaneClick:m,onMoveStart:v,onMoveEnd:x,defaultViewport:u??P,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!N&&(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(T,{onResetViewport:y}):null}),b]}),C&&D?(0,t.jsx)("div",{className:(0,i.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",O?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto h-full w-full",children:D})}):null]})}var F=e.i(5147),D=e.i(8361),A=e.i(30153);let I="shep-canvas-viewport",$={x:30,y:30,zoom:.85};var z=e.i(33548),G=e.i(23925),B=e.i(83428),q=e.i(35e3),W=e.i(79687),U=e.i(99105),V=e.i(78521);e.i(13322);var H=e.i(61201),X=e.i(21023);let J=(0,X.createServerReference)("003f21744f59ccf5ed2062ddc0e75866bf079a335a",X.callServer,void 0,X.findSourceMapURL,"isAgentSetupComplete"),K=(0,X.createServerReference)("0024a2773080cf0aab648a7ae062654484acbc2ef7",X.callServer,void 0,X.findSourceMapURL,"checkAgentAuth");var Y=e.i(11345),Q=e.i(83303),Z=e.i(58946),ee=e.i(86782),et=e.i(29847);let er=["select-agent","select-model"];function en({onComplete:e,className:r}){let[o,a]=(0,n.useState)([]),[s,l]=(0,n.useState)(!0),[d,c]=(0,n.useState)("select-agent"),[u,h]=(0,n.useState)(null),[f,p]=(0,n.useState)(!1),[g,m]=(0,n.useState)(!1),[v,x]=(0,n.useState)(!0),y=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{(0,Q.getAllAgentModels)().then(a).finally(()=>l(!1))},[]);let b=u?o.find(e=>e.agentType===u):null,w=(0,n.useCallback)((e,t)=>{m(!0),x(!1),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{t?.(),c(e),requestAnimationFrame(()=>{x(!0),m(!1)})},150)},[]);(0,n.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]);let E=(0,n.useCallback)(async(t,r)=>{p(!0);try{await (0,Z.updateAgentAndModel)(t,r),x(!1),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{e()},200)}catch{p(!1)}},[e]),k=(0,n.useCallback)(e=>{let t=o.find(t=>t.agentType===e);t&&t.models.length>0?w("select-model",()=>{h(e)}):E(e,null)},[o,w,E]),j=(0,n.useCallback)(e=>{u&&E(u,e)},[u,E]),N=(0,n.useCallback)(()=>{"select-model"===d&&w("select-agent",()=>{h(null)})},[d,w]);if(s)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex flex-col items-center justify-center gap-4",r),children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-5 w-5 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Loading agents…"})]});let C=er.indexOf(d),_="select-agent"===d?"Choose your agent":"Pick a model",O="select-agent"===d?"Select the AI coding agent you want Shep to use.":b?`Choose which ${b.label} model to run.`:"";return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex w-full flex-col items-center",r),children:[(0,t.jsx)("div",{className:"mb-8 flex w-full max-w-xs items-center gap-1.5",children:er.map((e,r)=>(0,t.jsx)("div",{className:(0,i.cn)("h-[3px] flex-1 rounded-full transition-colors duration-300",r<=C?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,i.cn)("flex w-full flex-col items-center transition-opacity duration-200",v&&!g?"opacity-100":"opacity-0"),children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:_}),(0,t.jsx)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:O}),(0,t.jsxs)("div",{className:"mt-8 flex w-full flex-col items-center",children:["select-agent"===d&&(0,t.jsx)("div",{"data-testid":"agent-list",className:"grid w-full max-w-lg gap-3",style:{gridTemplateColumns:`repeat(${Math.min(o.length,4)}, minmax(0, 1fr))`},children:o.map(e=>{let r=(0,ee.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:f,"data-testid":`agent-option-${e.agentType}`,className:"border-border hover:bg-accent hover:border-foreground/20 flex cursor-pointer flex-col items-center gap-3 rounded-2xl border px-4 py-5 transition-all duration-150 active:scale-[0.97] disabled:opacity-50",onClick:()=>k(e.agentType),children:[(0,t.jsx)(r,{className:"text-foreground/70 h-7 w-7"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.agentType)})}),"select-model"===d&&b?(0,t.jsxs)("div",{"data-testid":"model-list",className:"flex w-full max-w-lg flex-col items-center gap-4",children:[(0,t.jsxs)("button",{type:"button",disabled:f,className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 self-start text-sm transition-colors",onClick:N,children:[(0,t.jsx)(Y.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,t.jsx)("div",{className:"grid w-full gap-3",style:{gridTemplateColumns:`repeat(${Math.min(b.models.length,3)}, minmax(0, 1fr))`},children:b.models.map(e=>{let r=(0,et.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:f,"data-testid":`model-option-${e.id}`,className:"border-border hover:bg-accent hover:border-foreground/20 flex cursor-pointer flex-col items-center gap-2 rounded-2xl border px-4 py-5 text-center transition-all duration-150 active:scale-[0.97] disabled:opacity-50",onClick:()=>j(e.id),children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:r.displayName||e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs leading-tight",children:r.description||e.description})]},e.id)})})]}):null]})]})]})}let eo=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function ea({onRepositorySelect:e,className:r}){let[o,a]=(0,n.useState)(!1),[s,l]=(0,n.useState)(!1),[d,c]=(0,n.useState)(!1),[u,h]=(0,n.useState)(null),[f,m]=(0,n.useState)(null),[v,x]=(0,n.useState)(!1),{reactFileManager:y}=(0,_.useFeatureFlags)();async function b(){if(!s){if(y)return void c(!0);l(!0);try{let t=await (0,V.pickFolder)();t&&e?.(t)}catch{c(!0)}finally{l(!1)}}}(0,n.useEffect)(()=>{J().then(e=>{h(e)})},[]),(0,n.useEffect)(()=>{u&&K().then(m)},[u]);let w=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(eo.join("\n")),a(!0),setTimeout(()=>a(!1),2e3)},[]),E=(0,n.useCallback)(()=>{h(!0)},[]),k=(0,n.useCallback)(()=>{m(null),K().then(m)},[]);return null===u?null:(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,i.cn)("relative flex h-full w-full flex-col items-center justify-center px-8",r),children:[u?(0,t.jsxs)("div",{className:"animate-in fade-in flex w-full max-w-md flex-col items-center duration-300",children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:"Add a project"}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:["Add your project folder to unlock feature creation.",(0,t.jsx)("br",{}),"Describe what you need — Shep handles the rest."]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(es,{status:f,onRetry:k})}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:b,disabled:s,className:"bg-foreground text-background hover:bg-foreground/90 mt-10 flex w-full cursor-pointer items-center justify-center gap-2.5 rounded-xl px-6 py-4 text-base font-medium shadow-lg transition-all duration-200 hover:shadow-xl active:scale-[0.98] disabled:cursor-wait disabled:opacity-50",children:[s?(0,t.jsx)(B.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(g.FolderOpen,{className:"h-5 w-5"}),s?"Opening…":"Choose a Folder"]}),(0,t.jsx)("p",{className:"text-muted-foreground/60 mt-3 text-center text-sm",children:"Any folder works — git will be initialized automatically if needed."})]}):(0,t.jsx)(en,{onComplete:E}),u?(0,t.jsxs)("div",{className:"absolute bottom-8 flex flex-col items-center",style:{animationDelay:"400ms",animationDuration:"600ms",animationFillMode:"both"},children:[(0,t.jsxs)("button",{type:"button",onClick:()=>x(!v),className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 transition-colors duration-200",children:[(0,t.jsx)(p.Terminal,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-sm",children:"or use the CLI"}),(0,t.jsx)(U.ChevronDown,{className:(0,i.cn)("h-3.5 w-3.5 transition-transform duration-200",v?"":"rotate-180")})]}),v?(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-top-1 mt-3 w-80 duration-200",children:(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative rounded-xl bg-zinc-900 px-5 py-4 font-mono text-[13px] leading-relaxed text-zinc-400",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:w,className:"absolute top-3 right-3 cursor-pointer rounded-md p-1.5 text-zinc-600 transition-colors hover:bg-zinc-800 hover:text-zinc-300","aria-label":"Copy commands",children:o?(0,t.jsx)(G.Check,{className:"h-3.5 w-3.5 text-emerald-400"}):(0,t.jsx)(z.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("div",{className:"space-y-1",children:eo.map(e=>(0,t.jsxs)("div",{className:"whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-zinc-600 select-none",children:"$ "}),(0,t.jsx)("span",{className:"text-zinc-300",children:e})]},e))})]})}):null]}):null,(0,t.jsx)(H.ReactFileManagerDialog,{open:d,onOpenChange:e=>{e||c(!1)},onSelect:function(t){t&&e?.(t),c(!1)}})]})}function es({status:e,onRetry:r}){return e?e.installed&&e.authenticated?(0,t.jsxs)("div",{className:"animate-in fade-in flex items-center gap-2",children:[(0,t.jsx)(q.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),(0,t.jsxs)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:[e.label," ready"]})]}):e.installed?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.AlertCircle,{className:"h-4 w-4 text-amber-500"}),(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.label," needs authentication"]})]}),e.authCommand?(0,t.jsx)("code",{className:"rounded-lg bg-zinc-100 px-3 py-1.5 text-xs text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",children:e.authCommand}):null,(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[e.binaryName?(0,t.jsxs)("button",{type:"button","data-testid":"auth-banner-open-terminal",onClick:async()=>{try{let t="claude-code"===e.agentType?"claude-code":e.agentType;await fetch(`/api/tools/${t}/launch`,{method:"POST"})}catch{}},className:"flex items-center gap-1.5 text-xs font-medium text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[(0,t.jsx)(p.Terminal,{className:"h-3 w-3"}),"Open ",e.label]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:"Re-check"})]})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.AlertCircle,{className:"h-4 w-4 text-amber-500"}),(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.label," not installed"]})]}),e.binaryName?(0,t.jsxs)("code",{className:"rounded-lg bg-zinc-100 px-3 py-1.5 text-xs text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",children:["npm install -g ",e.binaryName]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:"Re-check"})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground/50 h-3.5 w-3.5 animate-spin"}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:"Checking setup…"})]})}var ei=e.i(17840);let el={maxZoom:1,padding:.5,duration:500};function ed({initialNodes:e,initialEdges:a}){let s,i,l,d=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(s=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),s?.[1]??null),h=(0,D.useSoundAction)("click"),{guardedNavigate:f}=(0,A.useDrawerCloseGuard)(),{fitView:p}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:m,onMoveEnd:v,resetViewport:x}=(i=(0,n.useRef)(function(){try{let e=localStorage.getItem(I);if(null==e)return $;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:$}catch{return $}}()).current,l=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=l.current&&clearTimeout(l.current)},[]),{defaultViewport:i,onMoveEnd:(0,n.useCallback)(e=>{null!=l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{try{localStorage.setItem(I,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(I)}catch{}return $},[])}),{nodes:y,edges:b,onNodesChange:w,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleRetryFeature:N,handleStartFeature:C,handleStopFeature:_,handleDeleteRepository:O,createFeatureNode:R,setCallbacks:S}=(0,ei.useControlCenterState)(e,a),{setFeatures:M,setHasRepositories:P}=(0,F.useSidebarFeaturesContext)(),T=(0,n.useMemo)(()=>y.filter(e=>"featureNode"===e.type),[y]),z=(0,n.useMemo)(()=>T.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[T]);(0,n.useEffect)(()=>{M(T.map(e=>{let t=e.data,r=(0,F.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[z,T,M]);let G=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let r=t.data;"creating"!==r.state&&"deleting"!==r.state&&e.target.closest('[data-testid="feature-node-card"]')&&f(()=>{h.play(),d.push(`/feature/${r.featureId}`)})}},[d,h,f]),B=(0,n.useCallback)(()=>{h.play(),d.push("/create")},[d,h]),q=(0,n.useCallback)(e=>{h.play();let t=y.find(t=>t.id===e),r=t?.data?.repositoryPath;r?d.push(`/create?repo=${encodeURIComponent(r)}`):d.push("/create")},[y,d,h]),W=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?y.find(e=>e.id===r.source):null,o=n?.data?.repositoryPath;h.play();let a=new URLSearchParams;o&&a.set("repo",o),a.set("parent",t),d.push(`/create?${a.toString()}`)},[y,b,d,h]),U=(0,n.useCallback)(e=>{let t=y.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&f(()=>d.push(`/repository/${e.id}`))}},[y,d,f]),V=(0,n.useCallback)(()=>{"/"!==c&&f(()=>d.push("/"))},[d,c,f]),H=(0,n.useCallback)(e=>{setTimeout(()=>{p(el),g.current=setTimeout(()=>{f(()=>d.push(`/create?repo=${encodeURIComponent(e)}`))},600)},0)},[p,f,d]),X=(0,n.useCallback)(e=>{let{wasEmpty:t,repoPath:r}=k(e);t&&H(r)},[k,H]);(0,n.useEffect)(()=>{let e=e=>{X(e.detail.path)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=g.current&&clearTimeout(g.current)}},[X]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void R(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=y.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);R(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[y,R]),(0,n.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n,closePr:o}=e.detail;j(t,r,n,o)};return window.addEventListener("shep:feature-delete-requested",e),()=>window.removeEventListener("shep:feature-delete-requested",e)},[j]),(0,n.useEffect)(()=>{S({onNodeAction:W,onFeatureDelete:j,onRetryFeature:N,onStartFeature:C,onStopFeature:_,onRepositoryAdd:q,onRepositoryClick:U,onRepositoryDelete:O})},[S,W,j,N,C,_,q,U,O]);let J=(0,n.useCallback)((e,t)=>{v(t)},[v]),K=y.some(e=>"repositoryNode"===e.type);(0,n.useEffect)(()=>{P(K)},[K,P]);let[Y,Q]=(0,n.useState)(K),Z=(0,n.useRef)(null);(0,n.useEffect)(()=>(K?(Z.current&&(clearTimeout(Z.current),Z.current=null),Q(!0)):Y&&(x(),Z.current=setTimeout(()=>{Q(!1),Z.current=null},500)),()=>{Z.current&&clearTimeout(Z.current)}),[K,Y,x]);let ee=c.startsWith("/create"),et=(0,n.useMemo)(()=>{let e=y.filter(e=>"repositoryNode"===e.type),t=y.some(e=>"featureNode"===e.type);return 1!==e.length||t||ee?y:y.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[y,ee]);return(0,t.jsx)(L,{nodes:Y?et:[],edges:Y?b:[],selectedFeatureId:u,defaultViewport:m,onNodesChange:w,onConnect:E,onAddFeature:B,onNodeClick:G,onPaneClick:V,onMoveEnd:J,onResetViewport:x,emptyState:(0,t.jsx)(ea,{onRepositorySelect:X})})}function ec({initialNodes:e,initialEdges:n,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(ed,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>ec],48246)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=o((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(e,t,n)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n},a=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function a(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=class{constructor(e){o(this,"_isDirected",!0),o(this,"_isMultigraph",!1),o(this,"_isCompound",!1),o(this,"_label"),o(this,"_defaultNodeLabelFn",()=>{}),o(this,"_defaultEdgeLabelFn",()=>{}),o(this,"_nodes",{}),o(this,"_in",{}),o(this,"_preds",{}),o(this,"_out",{}),o(this,"_sucs",{}),o(this,"_edgeObjs",{}),o(this,"_edgeLabels",{}),o(this,"_nodeCount",0),o(this,"_edgeCount",0),o(this,"_parent"),o(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{t+="";for(var r=t;void 0!==r;r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(o){var a=r.parent(o);return void 0===a||t.hasNode(a)?(n[o]=a,a):a in n?n[a]:e(a)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,o){return n.length>1?r.setEdge(e,o,t):r.setEdge(e,o),o}),this}setEdge(){var e,t,n,o,s=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,t=i.w,n=i.name,2==arguments.length&&(o=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var l=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=o),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?o:this._defaultEdgeLabelFn(e,t,n);var d=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}var i={v:o,w:a};return n&&(i.name=n),i}(this._isDirected,e,t,n);return e=d.v,t=d.w,Object.freeze(d),this._edgeObjs[l]=d,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=d,this._out[e][l]=d,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var o=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),i=this._edgeObjs[o];return i&&(e=i.v,t=i.w,delete this._edgeLabels[o],delete this._edgeObjs[o],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),s=n((e,t)=>{t.exports="3.0.2"}),i=n((e,t)=>{t.exports={Graph:a(),version:s()}}),l=n((e,t)=>{var r=a();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),o={v:e};return void 0!==r&&(o.value=r),void 0!==n&&(o.parent=n),o}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),d=n((e,t)=>{t.exports=function(e,t,n,o){return function(e,t,r,n){var o={},a=!0,s=0,i=e.nodes(),l=function(e){var t=r(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},a=!0)},d=function(){i.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;l({v:r,w:n})})})};i.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(a=!1,s++,d(),a);u++);if(s===c-1&&(a=!1,d(),a))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||r,o||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(o){t=[],function n(o){Object.hasOwn(r,o)||(r[o]=!0,t.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){o(this,"_arr",[]),o(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(e,t){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,o=r[e],a=r[t];r[e]=a,r[t]=o,n[a.key]=e,n[o.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,o,a){return function(e,t,n,o){var a,s,i={},l=new r,d=function(e){var t=e.v!==a?e.v:e.w,r=i[t],o=n(e),d=s.distance+o;if(o<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);d<r.distance&&(r.distance=d,r.predecessor=a,l.decrease(t,d))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;i[e]={distance:r},l.add(e,r)});l.size()>0&&(s=i[a=l.removeMin()]).distance!==1/0;)o(a).forEach(d);return i}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),f=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(o,a){return o[a]=r(e,a,t,n),o},{})}}),p=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],o=r;o!==t;)n.push(o),o=e[o].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},o=[];return e.nodes().forEach(function(a){Object.hasOwn(n,a)||function a(s){var i=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(i.lowlink=Math.min(i.lowlink,n[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,n[e].lowlink))}),i.lowlink===i.index){var l,d=[];do n[l=r.pop()].onStack=!1,d.push(l);while(s!==l)o.push(d)}}(a)}),o}}),m=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),v=n((e,t)=>{t.exports=function(e,t,n){var o,a,s,i,l;return o=e,a=t||r,s=n||function(t){return e.outEdges(t)},i={},(l=o.nodes()).forEach(function(e){i[e]={},i[e][e]={distance:0},l.forEach(function(t){e!==t&&(i[e][t]={distance:1/0})}),s(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);i[e][r]={distance:n,predecessor:e}})}),l.forEach(function(e){var t=i[e];l.forEach(function(r){var n=i[r];l.forEach(function(r){var o=n[e],a=t[r],s=n[r],i=o.distance+a.distance;i<s.distance&&(s.distance=i,s.predecessor=a.predecessor)})})}),i};var r=()=>1}),x=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(a),delete r[s],o.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return o}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),y=n((e,t)=>{var r=x();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),b=n((e,t)=>{t.exports=function(e,t,r,n,o){Array.isArray(t)||(t=[t]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);o=function e(t,r,n,o,a,s,i){return Object.hasOwn(o,r)||(o[r]=!0,n||(i=s(i,r)),a(r).forEach(function(r){i=e(t,r,n,o,a,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,a,n,o)}),o}}),w=n((e,t)=>{var r=b();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),E=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),j=n((e,t)=>{var r=a(),n=u();t.exports=function(e,t){var o,a=new r,s={},i=new n;function l(e){var r=e.v===o?e.w:e.v,n=i.priority(r);if(void 0!==n){var a=t(e);a<n&&(s[r]=o,i.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){i.add(e,1/0),a.setNode(e)}),i.decrease(e.nodes()[0],0);for(var d=!1;i.size()>0;){if(Object.hasOwn(s,o=i.removeMin()))a.setEdge(o,s[o]);else{if(d)throw Error("Input graph is not connected: "+e);d=!0}e.nodeEdges(o).forEach(l)}return a}}),N=n((e,t)=>{var r=h(),n=d();t.exports=function(e,t,o,a){return function(e,t,o,a){if(void 0===o)return r(e,t,o,a);for(var s=!1,i=e.nodes(),l=0;l<i.length;l++){for(var d=a(i[l]),c=0;c<d.length;c++){var u=d[c],h=u.v===i[l]?u.v:u.w,f=h===u.v?u.w:u.v;0>o({v:h,w:f})&&(s=!0)}if(s)return n(e,t,o,a)}return r(e,t,o,a)}(e,t,o,a||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:d(),components:c(),dijkstra:h(),dijkstraAll:f(),extractPath:p(),findCycles:m(),floydWarshall:v(),isAcyclic:y(),postorder:E(),preorder:k(),prim:j(),shortestPaths:N(),reduce:b(),tarjan:g(),topsort:x()}}),_=i();t.exports={Graph:_.Graph,json:l(),alg:C(),version:_.version}}),s=o((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),i=o((e,t)=>{var r=a().Graph,n=s();t.exports=function(e,t){var a,s;let d,c,u,h,f;if(1>=e.nodeCount())return[];let p=(a=e,s=t||o,d=new r,c=0,u=0,a.nodes().forEach(e=>{d.setNode(e,{v:e,in:0,out:0})}),a.edges().forEach(e=>{let t=d.edge(e.v,e.w)||0,r=s(e);d.setEdge(e.v,e.w,t+r),u=Math.max(u,d.node(e.v).out+=r),c=Math.max(c,d.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),f=c+1,d.nodes().forEach(e=>{l(h,f,d.node(e))}),{graph:d,buckets:h,zeroIdx:f});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)i(e,t,r,s);for(;s=o.dequeue();)i(e,t,r,s);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue()){n=n.concat(i(e,t,r,s,!0));break}}}return n})(p.graph,p.buckets,p.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function i(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let s=e.edge(n),i=e.node(n.v);o&&a.push({v:n.v,w:n.w}),i.out-=s,l(t,r,i)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,s=e.node(a);s.in-=o,l(t,r,s)}),e.removeNode(n.v),a}function l(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),l=o((e,t)=>{var r=a().Graph;function n(e,t,r,n){for(var o=n;e.hasNode(o);)o=l(n);return r.dummy=t,e.setNode(o,r),o}t.exports={addBorderNode:function(e,t,r,o){let a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=o),n(e,"border",a,t)},addDummyNode:n,applyWithChunking:o,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=d(s(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;void 0!==o&&(t[o][n.order]=r)}),t},intersectRect:function(e,t){let r,n,o=e.x,a=e.y,s=t.x-o,i=t.y-a,l=e.width/2,d=e.height/2;if(!s&&!i)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(i)*l>Math.abs(s)*d?(i<0&&(d=-d),r=d*s/i,n=d):(s<0&&(l=-l),r=l,n=l*i/s),{x:o+r,y:a+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:s,normalizeRanks:function(e){let t=o(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:d,removeEmptyRanks:function(e){let t=o(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let o=e.node(n).rank-t;r[o]||(r[o]=[]),r[o].push(n)});let n=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%a!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:l,zipObject:c};function o(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function s(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var i=0;function l(e){return e+""+ ++i}function d(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let o=[];for(let t=e;n(t);t+=r)o.push(t);return o}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),d=o((e,t)=>{var r=i(),n=l().uniqueId;t.exports={run:function(e){var t,o;let a,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],s={},i={},(o=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?a.push(t):e(t.w)}),delete s[t])}),a)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=o((e,t)=>{var r=l();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,o,a,s=t.v,i=e.node(s).rank,l=t.w,d=e.node(l).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(d!==i+1){for(e.removeEdge(t),a=0,++i;i<d;++a,++i)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",o,"_d"),i===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),s=n;e.setEdge(s,l,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}}}),u=o((e,t)=>{var{applyWithChunking:r}=l();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(o){var a=e.node(o);if(Object.hasOwn(t,o))return a.rank;t[o]=!0;var s=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),a.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=o((e,t)=>{var r=a().Graph,n=u().slack;t.exports=function(e){var t,o,a,s,i=new r({directed:!1}),l=e.nodes()[0],d=e.nodeCount();for(i.setNode(l,{});t=i,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var s=a.v,i=r===s?a.w:s;t.hasNode(i)||n(o,a)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<d;)a=function(e,t){return t.edges().reduce((r,o)=>{let a=1/0;return e.hasNode(o.v)!==e.hasNode(o.w)&&(a=n(t,o)),a<r[0]?[a,o]:r},[1/0,null])[1]}(i,e),s=i.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),f=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,s=a().alg.preorder,i=a().alg.postorder,d=l().simplify;function c(e){o(e=d(e));var t,n,a=r(e);for(g(a),f(a,e);t=m(a);)n=v(a,e,t),x(a,e,t,n)}function f(e,t){var r=i(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,s;return n=e,o=t,a=r,s=n.node(a).parent,void(n.edge(a,s).cutvalue=p(n,o,a))})}function p(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),s=0;return a||(o=!1,a=t.edge(n,r)),s=a.weight,t.nodeEdges(r).forEach(a=>{var i=a.v===r,l=i?a.w:a.v;if(l!==n){var d,c,u,h=i===o,f=t.edge(a).weight;if(s+=h?f:-f,d=e,c=r,u=l,d.hasEdge(c,u)){var p=e.edge(r,l).cutvalue;s+=h?-p:p}}}),s}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var s=n,i=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),i.low=s,i.lim=n++,a?i.parent=a:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function v(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var s=e.node(o),i=e.node(a),l=s,d=!1;return s.lim>i.lim&&(l=i,d=!0),t.edges().filter(t=>d===y(e,e.node(t.v),l)&&d!==y(e,e.node(t.w),l)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function x(e,t,r,n){var o,a,i,l,d=r.v,c=r.w;e.removeEdge(d,c),e.setEdge(n.v,n.w,{}),g(e),f(e,t),o=e,a=t,i=o.nodes().find(e=>!a.node(e).parent),(l=(l=s(o,i)).slice(1)).forEach(e=>{var t=o.node(e).parent,r=a.edge(e,t),n=!1;r||(r=a.edge(t,e),n=!0),a.node(e).rank=a.node(t).rank+(n?r.minlen:-r.minlen)})}function y(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=p,c.leaveEdge=m,c.enterEdge=v,c.exchangeEdges=x}),p=o((e,t)=>{var r=u().longestPath,n=h(),o=f();t.exports=function(e){var t,s=e.graph().ranker;if(s instanceof Function)return s(e);switch(e.graph().ranker){case"network-simplex":default:o(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":a(e);case"none":}};var a=r}),g=o((e,t)=>{t.exports=function(e){var t;let r,n,o=(r={},n=0,(t=e).children().forEach(function e(o){let a=n;t.children(o).forEach(e),r[o]={low:a,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,a=function(e,t,r,n){let o=[],a=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),l,d;l=r;do o.push(l=e.parent(l));while(l&&(t[l].low>s||i>t[l].lim))for(d=l,l=n;(l=e.parent(l))!==d;)a.push(l);return{path:o.concat(a.reverse()),lca:d}}(e,o,n.v,n.w),s=a.path,i=a.lca,l=0,d=s[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(d=s[l])!==i&&e.node(d).maxRank<r.rank;)l++;d===i&&(c=!1)}if(!c){for(;l<s.length-1&&e.node(d=s[l+1]).minRank<=r.rank;)l++;d=s[l]}e.setParent(t,d),t=e.successors(t)[0]}})}}),m=o((e,t)=>{var r=l();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,o){var a=t.children(r);a&&a.length&&a.forEach(t=>e(t,o+1)),n[r]=o})(e,1)),n),i=Object.values(s),l=r.applyWithChunking(Math.max,i)-1,d=2*l+1;e.graph().nestingRoot=a,e.edges().forEach(t=>e.edge(t).minlen*=d);let c=(o=e).edges().reduce((e,t)=>e+o.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,o,a,s,i,l){let d=t.children(l);if(!d.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:o});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(l);t.setParent(c,l),h.borderTop=c,t.setParent(u,l),h.borderBottom=u,d.forEach(r=>{e(t,n,o,a,s,i,r);let d=t.node(r),h=d.borderTop?d.borderTop:r,f=d.borderBottom?d.borderBottom:r,p=d.borderTop?a:2*a,g=h!==f?1:s-i[l]+1;t.setEdge(c,h,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(f,u,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,c,{weight:0,minlen:s+i[l]})})(e,a,d,c,l,s,t)),e.graph().nodeRankFactor=d},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),v=o((e,t)=>{var r=l();function n(e,t,n,o,a,s){let i=a[t][s-1],l=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);a[t][s]=l,e.setParent(l,o),i&&e.setEdge(i,l,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let o=e.children(r),a=e.node(r);if(o.length&&o.forEach(t),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,o=a.maxRank+1;t<o;++t)n(e,"borderLeft","_bl",r,a,t),n(e,"borderRight","_br",r,a,t)}})}}),x=o((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function a(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let s=e.graph().rankdir.toLowerCase();("bt"===s||"rl"===s)&&((t=e).nodes().forEach(e=>o(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(o),Object.hasOwn(r,"y")&&o(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>a(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(a),Object.hasOwn(t,"x")&&a(t)}),r(e))}}}),y=o((e,t)=>{var r=l();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),o=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,o),s=r.range(a+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,s[e.node(n).rank].push(n),e.successors(n).forEach(r))}),s}}),b=o((e,t)=>{var r=l().zipObject;t.exports=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=function(e,t,n){let o=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),s=1;for(;s<n.length;)s<<=1;let i=2*s-1;s-=1;let l=Array(i).fill(0),d=0;return a.forEach(e=>{let t=e.pos+s;l[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=l[t+1]),t=t-1>>1,l[t]+=e.weight;d+=e.weight*r}),d}(e,t[o-1],t[o]);return n}}),w=o((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=o((e,t)=>{var r=l();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(function(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),k=o((e,t)=>{var r=l();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var o;let a=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=a.lhs,i=a.rhs.sort((e,t)=>t.i-e.i),l=[],d=0,c=0,u=0;s.sort((o=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:o?t.i-e.i:e.i-t.i)),u=n(l,i,u),s.forEach(e=>{u+=e.vs.length,l.push(e.vs),d+=e.barycenter*e.weight,c+=e.weight,u=n(l,i,u)});let h={vs:l.flat(!0)};return c&&(h.barycenter=d/c,h.weight=c),h}}),j=o((e,t)=>{var r=w(),n=E(),o=k();t.exports=function e(t,a,s,i){var l,d;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};h&&(c=c.filter(e=>e!==h&&e!==f));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,s,i);p[r.v]=a,Object.hasOwn(a,"barycenter")&&(n=r,o=a,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+o.barycenter*o.weight)/(n.weight+o.weight),n.weight+=o.weight):(n.barycenter=o.barycenter,n.weight=o.weight))}});let m=n(g,s);l=m,d=p,l.forEach(e=>{e.vs=e.vs.flatMap(e=>d[e]?d[e].vs:e)});let v=o(m,i);if(h&&(v.vs=[h,v.vs,f].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(f)[0]);Object.hasOwn(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.order+r.order)/(v.weight+2),v.weight+=2}return v}}),N=o((e,t)=>{var r=a().Graph,n=l();t.exports=function(e,t,o,a){a||(a=e.nodes());let s=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),i=new r({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(t=>e.node(t));return a.forEach(r=>{let n=e.node(r),a=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,a||s),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=i.edge(n,r),a=void 0!==o?o.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),s,i;for(;a;){if((s=e.parent(a))?(i=n[s],n[s]=a):(i=o,o=a),i&&i!==a)return void t.setEdge(i,a);a=s}})}}),_=o((e,t)=>{var r=y(),n=b(),o=j(),s=N(),i=C(),d=a().Graph,c=l();function u(e,t,r){let n=new Map,o=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&o(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&o(e,t)}return t.map(function(t){return s(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,a={}){if("function"==typeof a.customOrder)return void a.customOrder(t,e);let s=c.maxRank(t),l=u(t,c.range(1,s+1),"inEdges"),f=u(t,c.range(s-1,-1,-1),"outEdges"),p=r(t);if(h(t,p),a.disableOptimalOrderHeuristic)return;let g=1/0,m,v=a.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new d;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let a=e.graph().root,s=o(e,a,n,t);s.vs.forEach((t,r)=>e.node(t).order=r),i(e,n,s.vs)})})(e%2?l:f,e%4>=2,v),p=c.buildLayerMatrix(t);let a=n(t,p);a<g?(r=0,m=Object.assign({},p),g=a):a===g&&(m=structuredClone(p))}h(t,m)}}),O=o((e,t)=>{var r=a().Graph,n=l();function o(e,t){let r={};return t.length&&t.reduce(function(t,n){let o=0,a=0,s=t.length,l=n[n.length-1];return n.forEach((t,d)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:s;(c||t===l)&&(n.slice(a,d+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),s=a.order;(s<o||u<s)&&!(a.dummy&&e.node(t).dummy)&&i(r,n,t)})}),a=d+1,o=u)}),n}),r}function s(e,t){let r={};function o(t,o,a,s,l){let d;n.range(o,a).forEach(n=>{d=t[n],e.node(d).dummy&&e.predecessors(d).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>l)&&i(r,t,d)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,s=0;return r.forEach((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(a=e.node(t[0]).order,o(r,s,l,n,a),s=l,n=a)}o(r,s,r.length,a,t.length)}),r}),r}function i(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function d(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let o={},a={},s={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let i=n(e);if(i.length){let n=((i=i.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let l=Math.floor(n),c=Math.ceil(n);l<=c;++l){let n=i[l];a[e]===e&&t<s[n]&&!d(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=s[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var s,i,l,d,c,u,h;let f,p,g,m={},v=(s=e,i=t,l=n,d=a,f=new r,g=(c=(p=s.graph()).nodesep,u=p.edgesep,h=d,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,s;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":s=-n.width/2;break;case"r":s=n.width/2}if(s&&(a+=h?s:-s),s=0,a+=(n.dummy?u:c)/2,a+=(o.dummy?u:c)/2,a+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":s=o.width/2;break;case"r":s=-o.width/2}return s&&(a+=h?s:-s),s=0,a}),i.forEach(e=>{let t;e.forEach(e=>{let r=l[e];if(f.setNode(r),t){var n=l[t],o=f.edge(n,r);f.setEdge(n,r,Math.max(g(s,e,t),o||0))}t=e})}),f),x=a?"borderLeft":"borderRight";function y(e,t){let r=v.nodes().slice(),n={},o=r.pop();for(;o;){if(n[o])e(o);else for(let e of(n[o]=!0,r.push(o),t(o)))r.push(e);o=r.pop()}}return y(function(e){m[e]=v.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+v.edge(t)),0)},v.predecessors.bind(v)),y(function(t){let r=v.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-v.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==x&&(m[t]=Math.max(m[t],r))},v.successors.bind(v)),Object.keys(o).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,o=1/0;Object.entries(r).forEach(([t,r])=>{var a,s;let i=(a=e,s=t,a.node(s).width/2);n=Math.max(r+i,n),o=Math.min(r-i,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function f(e,t){let r=Object.values(t),o=n.applyWithChunking(Math.min,r),a=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(s=>{let i=r+s,l=e[i];if(l===t)return;let d=Object.values(l),c=o-n.applyWithChunking(Math.min,d);"l"!==s&&(c=a-n.applyWithChunking(Math.max,d)),c&&(e[i]=n.mapValues(l,e=>e+c))})})}function p(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(o(e,t),s(e,t)),a={},i;["u","d"].forEach(o=>{i="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let s=("u"===o?e.predecessors:e.successors).bind(e),l=c(e,i,r,s),d=u(e,i,l.root,l.align,"r"===t);"r"===t&&(d=n.mapValues(d,e=>-e)),a[o+t]=d})});let l=h(e,a);return f(a,l),p(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:s,addConflict:i,hasConflict:d,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:f,findSmallestWidthAlignment:h,balance:p}}),R=o((e,t)=>{var r=l(),n=O().positionX;t.exports=function(e){var t;let o,a,s,i;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,s=t.graph().rankalign,i=0,o.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===s?n.y=i+n.height/2:"bottom"===s?n.y=i+r-n.height/2:n.y=i+r/2}),i+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),S=o((e,t)=>{var r=d(),n=c(),o=p(),s=l().normalizeRanks,i=g(),u=l().removeEmptyRanks,h=m(),f=v(),y=x(),b=_(),w=R(),E=l(),k=a().Graph;t.exports=function(e,t={}){let a=t.debugTiming?E.time:E.notime;return a("layout",()=>{let l=a(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new k({multigraph:!0,compound:!0}),n=F(t.graph()),r.setGraph(Object.assign({},N,L(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=L(F(t.node(e)),O);Object.keys(S).forEach(e=>{void 0===n[e]&&(n[e]=S[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=F(t.edge(e));r.setEdge(e,Object.assign({},P,L(n,M),E.pick(n,T)))}),r});return a(" runLayout",()=>{var e,d,c;return e=l,d=a,c=t,void(d(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),d(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),d(" acyclic",()=>r.run(e)),d(" nestingGraph.run",()=>h.run(e)),d(" rank",()=>o(E.asNonCompoundGraph(e))),d(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};E.addDummyNode(t,"edge-proxy",n,"_ep")}})}),d(" removeEmptyRanks",()=>u(e)),d(" nestingGraph.cleanup",()=>h.cleanup(e)),d(" normalizeRanks",()=>s(e)),d(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),d(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),d(" normalize.run",()=>n.run(e)),d(" parentDummyChains",()=>i(e)),d(" addBorderSegments",()=>f(e)),d(" order",()=>b(e,c)),d(" insertSelfEdges",()=>{var t;return t=e,void E.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var o=t.node(e);o.order=n+r,(o.selfEdges||[]).forEach(e=>{E.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),d(" adjustCoordinateSystem",()=>y.adjust(e)),d(" position",()=>w(e)),d(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,a=n.y,s=r.x-o,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:a-i},{x:o+5*s/6,y:a-i},{x:o+s,y:a},{x:o+5*s/6,y:a+i},{x:o+2*s/3,y:a+i}],r.label.x=r.x,r.label.y=r.y}})}),d(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),o=t.node(r.borderBottom),a=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-a.x),r.height=Math.abs(o.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),d(" normalize.undo",()=>n.undo(e)),d(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),d(" undoCoordinateSystem",()=>y.undo(e)),d(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function l(e){let a=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,a-i/2),r=Math.max(r,a+i/2),n=Math.min(n,s-l/2),o=Math.max(o,s+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&l(r)}),t-=s,n-=i,e.nodes().forEach(r=>{let o=e.node(r);o.x-=t,o.y-=n}),e.edges().forEach(r=>{let o=e.edge(r);o.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=n)}),a.width=r-t+s,a.height=o-n+i})(e)),d(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),o=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=o,s=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,s))})}),d(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),d(" acyclic.undo",()=>r.undo(e)))}),a(" updateInputGraph",()=>{var t,r;return t=e,r=l,void(t.nodes().forEach(e=>{let n=t.node(e),o=r.node(e);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,r.children(e).length&&(n.width=o.width,n.height=o.height))}),t.edges().forEach(e=>{let n=t.edge(e),o=r.edge(e);n.points=o.points,Object.hasOwn(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),l})};var j=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],S={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function L(e,t){return E.mapValues(E.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),M=o((e,t)=>{var r=l(),n=a().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),o=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{o.setNode(t,{label:t}),o.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>o.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{o.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(o.setEdge(e,t,{style:"invis"}),t))}),o}}}),P=o((e,t)=>{t.exports="2.0.4"});let T=o((e,t)=>{t.exports={graphlib:a(),layout:S(),debug:M(),util:{time:l().time,notime:l().notime},version:P()}})(),L={direction:"LR",ranksep:200,nodesep:30},F={featureNode:{width:288,height:140},repositoryNode:{width:400,height:140}};function D(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:F[e.type??""]??t}function A(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new T.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:a,nodesep:s});let l=new Set;for(let e of t)l.add(e.source),l.add(e.target);let d=e.filter(e=>l.has(e.id)),c=e.filter(e=>!l.has(e.id));for(let e of d){let t=D(e,o);i.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)i.hasNode(e.source)&&i.hasNode(e.target)&&i.setEdge(e.source,e.target,{},e.id);T.layout(i);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),f="LR"===n||"RL"===n,p=new Map;for(let e of d){let t=i.node(e.id),r=D(e,o);p.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of p.values()){g=f?e.cx:e.cy;break}for(let e of c){let t=D(e,o);p.set(e.id,{cx:f?g:0,cy:f?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)p.has(e.source)&&p.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let v=new Map;for(let t=0;t<e.length;t++)v.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let x=new Set;for(let e of m.values())for(let t of e)x.add(t);let y=[...[...l].filter(e=>p.has(e)&&!x.has(e)),...c.map(e=>e.id)];y.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let b=new Map;for(let e of y)!function e(t){if(b.has(t))return b.get(t);let r=p.get(t),n=f?r.h:r.w,o=m.get(t);if(!o||0===o.length)return b.set(t,n),n;let a=0;for(let t of o)a+=e(t);let i=Math.max(n,a+=(o.length-1)*s);return b.set(t,i),i}(e);let w=0;for(let e of y){let t=b.get(e)??0;!function e(t,r){let n=p.get(t);f?n.cy=r:n.cx=r;let o=m.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=b.get(e)??0;let i=r-(a+=(o.length-1)*s)/2;for(let t of o){let r=b.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let E=[];for(let t of e){let e=p.get(t.id);e&&E.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:E,edges:[...t]}}var I=e.i(21023);let $=(0,I.createServerReference)("78c04c8f47695b3fc5238e8367cb0ae21950aeb0ae",I.callServer,void 0,I.findSourceMapURL,"deleteFeature");var z=e.i(65181),G=e.i(41383);let B=(0,I.createServerReference)("40935a7e5482a5d0791f0ae90a49cf07b6c5361cd2",I.callServer,void 0,I.findSourceMapURL,"stopFeature");var q=e.i(9700);let W=(0,I.createServerReference)("40e54d68cc272390ab043ca883426ab0a5e4afc684",I.callServer,void 0,I.findSourceMapURL,"deleteRepository"),U=(0,I.createServerReference)("40eb7406f36b58d3c450c1a106f8b3120443992908",I.callServer,void 0,I.findSourceMapURL,"getFeatureMetadata");var V=e.i(39443),H=e.i(8361),X=e.i(18354),J=e.i(99045);function K(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,o=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&o.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:o}}function Y(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}function Q(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||n.parentNodeId!==e.parentNodeId||n.data!==e.data&&JSON.stringify(n.data)!==JSON.stringify(e.data))return!1}return!0}let Z=(0,X.createLogger)("[Polling]"),ee=0,et=0;function er(e,o){let a=(0,r.useRouter)(),s=(0,H.useSoundAction)("delete"),i=(0,H.useSoundAction)("create"),{nodes:l,edges:d,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:f,restoreFeature:p,addRepository:g,removeRepository:m,replaceRepository:v,getFeatureRepositoryPath:x,getRepositoryData:y,getRepoMapSize:b,setCallbacks:w,beginMutation:E,endMutation:k,isMutating:j}=function(e,r){let n=(0,t.useMemo)(()=>K(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[s,i]=(0,t.useState)(n.repoMap),[l,d]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)(new Set),h=(0,t.useRef)(0),f=(0,t.useRef)(new Set),p=(0,t.useRef)(new Set),g=(0,t.useRef)({}),m=(0,t.useMemo)(()=>({onNodeAction:e=>g.current.onNodeAction?.(e),onNodeSettings:e=>g.current.onNodeSettings?.(e),onFeatureDelete:(e,t,r,n)=>g.current.onFeatureDelete?.(e,t,r,n),onRepositoryAdd:e=>g.current.onRepositoryAdd?.(e),onRepositoryClick:e=>g.current.onRepositoryClick?.(e),onRepositoryDelete:e=>g.current.onRepositoryDelete?.(e),onRetryFeature:e=>g.current.onRetryFeature?.(e),onStartFeature:e=>g.current.onStartFeature?.(e)}),[]),v=(0,t.useRef)(o);v.current=o;let x=(0,t.useRef)(s);x.current=s;let y=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],s=e=>e.replace(/\\/g,"/"),i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(s(r.data.repositoryPath),e);let l=new Map;for(let[e,r]of[...t.entries()].sort((e,t)=>{let r=e[1].data.createdAt,n=t[1].data.createdAt;return("number"!=typeof r||Number.isNaN(r)?1/0:r)-("number"!=typeof n||Number.isNaN(n)?1/0:n)})){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};o.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,d,c]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let e="creating"===d.data.state||c,r={...d.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!e&&"error"===d.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!e&&"pending"===d.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature},...!e&&("running"===d.data.state||"action-required"===d.data.state)&&n?.onStopFeature&&{onStop:n.onStopFeature}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),d.parentNodeId)a.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=s(d.data.repositoryPath),r=i.get(e)??function(e){if(l.has(e))return l.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return o.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),l.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=new Set;for(let e of a)"dependencyEdge"===e.type&&d.add(e.source);let c=a.length>0;for(let e of o){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=d.has(e.id))}return{nodes:o,edges:a}})(o,s,l,m),[o,s,l,m]),b=(0,t.useRef)({key:"",positions:new Map}),{nodes:w,edges:E}=(0,t.useMemo)(()=>{let e=y.nodes.map(e=>e.id).sort().join(","),t=y.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==b.current.key){let e=A(y.nodes,y.edges,L),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});let n=b.current.positions;if(n.size>0){let r=0,o=0;for(let[e,a]of t){let t=n.get(e);if(t){r=t.position.x-a.position.x,o=t.position.y-a.position.y;break}}if(0!==r||0!==o){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+o};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+o}}}return b.current={key:r,positions:t},e}let{positions:n}=b.current;return{nodes:y.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:y.edges}},[y]),k=(0,t.useCallback)((e,t)=>{if(h.current>0)return;let{featureMap:r,repoMap:n}=K(e,t),o=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));a(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;o.has(t)||n.set(e,r)}let a=new Set;for(let[t,r]of e)"deleting"===r.data.state&&(n.has(t)?n.set(t,{...n.get(t),data:{...n.get(t).data,state:"deleting"}}):p.current.has(t)||(n.set(t,r),a.add(t)));for(let[e,t]of(p.current=a,c.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return Q(e,n)?e:n}),d(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,a]of e){let e=`${a.data.name}\0${a.data.repositoryPath}`;o.has(e)&&(r.delete(n),t=!0)}return t?r:e}),i(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,o]of e){if(t.has(n)||r.has(o.data.repositoryPath)){u.current.delete(n);continue}(n.startsWith("repo-temp-")||u.current.has(n))&&t.set(n,o)}return Q(e,t)?e:t})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=r.get(e);if(!n)return c.current.set(e,{...c.current.get(e),...t}),r;if(c.current.delete(e),Y(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o}),d(r=>{let n=r.get(e);if(!n||Y(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o})},[]),N=(0,t.useCallback)((e,t,r)=>{d(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),C=(0,t.useCallback)(e=>{d(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),_=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),O=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),R=(0,t.useCallback)((e,t)=>{u.current.add(e),i(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),S=(0,t.useCallback)(e=>{u.current.delete(e),i(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),M=(0,t.useCallback)((e,t,r)=>{u.current.delete(e),u.current.add(t),i(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),P=(0,t.useCallback)(e=>v.current.get(e)?.data.repositoryPath,[]),T=(0,t.useCallback)(e=>x.current.get(e)?.data,[]),F=(0,t.useCallback)(()=>x.current.size,[]),D=(0,t.useCallback)(e=>{g.current=e},[]),I=(0,t.useCallback)(()=>{h.current++},[]),$=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{h.current=Math.max(0,h.current-1),f.current.delete(t)},e);f.current.add(t)},[]),z=(0,t.useCallback)(()=>h.current>0,[]);return(0,t.useEffect)(()=>{let e=f.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:w,edges:E,reconcile:k,updateFeature:j,addPendingFeature:N,removePendingFeature:C,removeFeature:_,restoreFeature:O,addRepository:R,removeRepository:S,replaceRepository:M,getFeatureRepositoryPath:P,getRepositoryData:T,getRepoMapSize:F,setCallbacks:D,beginMutation:I,endMutation:$,isMutating:z}}(e,o),N=(0,t.useRef)(l),C=(0,t.useRef)(d);(0,t.useEffect)(()=>{N.current=l,C.current=d},[l,d]);let _=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),O=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),R=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${_}|${O}`;t!==R.current&&(R.current=t,c(e,o))},[_,O,e,o,c]);let S=(0,t.useRef)(new Map),{events:M}=(0,V.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=S.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,o=t.get(r.id);void 0!==o&&o!==e.state&&(M.some(t=>t.featureId===e.featureId&&(0,J.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>a.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[O,e,M,a]);let P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>M.length&&(P.current=0),M.length<=P.current)return;let e=M.slice(P.current);for(let{featureId:t,state:r,lifecycle:n}of(P.current=M.length,(0,J.resolveSseEventUpdates)(e)))if(void 0!==r||void 0!==n){let e=`feat-${t}`,o=N.current.find(t=>t.id===e),a=o?o.data.state:void 0;if("deleting"===a||"error"===r&&j()&&"running"===a)continue;u(e,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})}},[M,u,j]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;E(),u(`feat-${t}`,{state:"running"}),k()};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[u,E,k]);let T=(0,t.useRef)(new Set),F=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(F.current>M.length&&(F.current=0),M.length<=F.current)return;let e=M.slice(F.current);for(let t of(F.current=M.length,e)){if("Feature metadata updated"!==t.message||T.current.has(t.featureId))continue;T.current.add(t.featureId);let e=`feat-${t.featureId}`;U(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[M,u]),(0,t.useEffect)(()=>{Z.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{if(!j())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();c(t,r)}catch{Z.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Z.debug("polling disabled"),clearInterval(e)}},[c,j]);let D=(0,t.useCallback)(e=>{},[]),I=(0,t.useCallback)(e=>{},[]),X=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${ee++}`,o={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return h(n,o,"dependencyEdge"===r&&e?e:void 0),n},[h]),er=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,z.resumeFeature)(e).then(e=>{e.error?(u(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{u(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>k())},[u,E,k]),en=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,G.startFeature)(e).then(e=>{e.error?(u(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{u(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>k())},[u,E,k]),eo=(0,t.useCallback)(e=>{E(),B(e).then(e=>{e.error?n.toast.error(e.error):n.toast.success("Agent stopped")}).catch(()=>{n.toast.error("Failed to stop agent")}).finally(()=>k())},[E,k]),ea=(0,t.useCallback)((e,t,r,o)=>{let i=`feat-${e}`,l=[];if(!0===r){let e=[i];for(;e.length>0;){let t=e.shift();for(let r of C.current)"dependencyEdge"===r.type&&r.source===t&&(l.push(r.target),e.push(r.target))}}let d=new Map;for(let e of[i,...l]){let t=N.current.find(t=>t.id===e);t&&d.set(e,t.data.state)}for(let e of(E(),u(i,{state:"deleting"}),l))u(e,{state:"deleting"});s.play(),a.push("/"),$(e,t,r,o).then(e=>{if(e.error){for(let[e,t]of d)t&&u(e,{state:t});n.toast.error(e.error)}else for(let e of(f(i),l))f(e)}).catch(()=>{for(let[e,t]of d)t&&u(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>k())},[a,s,u,f,E,k]),es=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(C.current.filter(e=>e.source===t).map(e=>e.target)),o=y(t),a=new Map;for(let e of r){let t=N.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let i=()=>{for(let[e,r]of(o&&g(t,o),a))p(e,r)};for(let e of(E(),m(t),r))f(e);try{let t=await W(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),i();return}s.play()}catch{n.toast.error("Failed to remove repository"),i()}finally{k()}},[s,m,f,g,p,y,E,k]),ei=(0,t.useCallback)(e=>{let t=A(N.current,C.current,{...L,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:l,edges:d,onNodesChange:D,handleConnect:I,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++et}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return E(),g(r,{name:o,repositoryPath:e,id:r,createdAt:Date.now(),gitInfoStatus:"loading"}),(0,q.addRepository)({path:e,name:o}).then(e=>{if(e.error){m(r),n.toast.error(e.error);return}let t=e.repository;v(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),i.play()}).catch(()=>{m(r),n.toast.error("Failed to add repository")}).finally(()=>k()),{wasEmpty:t,repoPath:e}},[g,m,v,i,b,E,k]),handleLayout:ei,handleDeleteFeature:ea,handleRetryFeature:er,handleStartFeature:en,handleStopFeature:eo,handleDeleteRepository:es,createFeatureNode:X,getFeatureRepositoryPath:x,getRepositoryData:y,setCallbacks:w}}e.s(["useControlCenterState",()=>er],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(79054),o=e.i(31406),a=e.i(3214),s=e.i(38227),i=e.i(31777),l=e.i(35364);e.i(54793);var d=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002),h=e.i(82569),f=e.i(8986),p=e.i(38573),g=e.i(19933),m=e.i(67669),v=e.i(24042),x=e.i(64970),y=e.i(49228),b=e.i(65530),w=e.i(7311);let E=(0,e.i(3645).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.i(81803);var k=e.i(72714),j=e.i(2287),N=e.i(2828),C=e.i(8537),_=e.i(75921),O=e.i(76852),R=e.i(80519);function S({data:e}){let d=(0,o.useRouter)(),c=(0,_.useFeatureFlags)(),[S,M]=(0,n.useState)(!1),P=(0,O.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),T=(0,C.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),L="Booting"===T.status||"Ready"===T.status,F=(0,n.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",o=["Continue work from a previous agent session.","","## Session Context",`- Session ID: ${t.id}`,`- Messages: ${t.messageCount}`,t.lastMessageAt?`- Last active: ${t.lastMessageAt}`:"",`- Conversation file: ${r}`,"","## Session Preview",`> ${n}`,"","## Instructions","1. Read the full conversation history from the file above",`2. Analyze the current state of the repository — what was done, what remains`,"3. Create or update spec files to accurately reflect the current state and remaining work","4. Continue implementing any unfinished work from the conversation"].filter(Boolean).join("\n"),a=new URLSearchParams({repo:e.repositoryPath,prompt:o});d.push(`/create?${a.toString()}`)},[e.repositoryPath,d]);return(0,t.jsxs)("div",{className:(0,i.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:u.Position.Left,isConnectable:!1,className:"opacity-0!",style:{top:70}}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),M(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(m.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(N.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(j.Dialog,{open:S,onOpenChange:M,children:(0,t.jsxs)(j.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(j.DialogHeader,{children:[(0,t.jsx)(j.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(j.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(j.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(j.DialogClose,{asChild:!0,children:(0,t.jsx)(l.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(l.Button,{variant:"destructive",onClick:()=>{M(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:"nodrag bg-card flex w-[26rem] cursor-pointer flex-col overflow-hidden rounded-xl border shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)(h.Github,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,i.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(k.ActionButton,{label:"Open in IDE",onClick:P.openInIde,loading:P.ideLoading,error:!!P.ideError,icon:f.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(k.ActionButton,{label:"Open in Shell",onClick:P.openInShell,loading:P.shellLoading,error:!!P.shellError,icon:p.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(k.ActionButton,{label:"Open Folder",onClick:P.openFolder,loading:P.folderLoading,error:!!P.folderError,icon:g.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:"Open Folder"})]})}),(0,t.jsx)(R.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,onCreateFromSession:F})]}):null,e.onAdd?(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Add feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,i.cn)("text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:text-blue-500",e.pulseAdd&&"animate-pulse-cta bg-blue-100 text-blue-500 dark:bg-blue-900/40"),children:(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(N.TooltipContent,{children:"Add feature"})]})}):null]})]}),e.branch?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-info",className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1 truncate","data-testid":"repository-node-branch",children:[(0,t.jsx)(y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.branch})]}),null!=e.behindCount&&e.behindCount>0?(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap text-amber-500","data-testid":"repository-node-behind",children:[(0,t.jsx)(w.ArrowDown,{className:"h-3 w-3 shrink-0"}),e.behindCount," behind"]}):null]})}),e.commitMessage?(0,t.jsx)("div",{"data-testid":"repository-node-commit-info",className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(b.GitCommitHorizontal,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate","data-testid":"repository-node-commit-message",children:e.commitMessage}),e.committer?(0,t.jsxs)("span",{className:"text-muted-foreground/70 ml-auto flex shrink-0 items-center gap-1","data-testid":"repository-node-committer",children:[(0,t.jsx)(E,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:e.committer})]}):null]})}):null]}):"not-a-repo"===e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-not-repo",className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(g.FolderOpen,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate opacity-60",children:e.repositoryPath??"Unknown path"})]})}),(0,t.jsx)("div",{className:"text-muted-foreground border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs opacity-40",children:[(0,t.jsx)(y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:"Not a git repository"})]})})]}):"ready"!==e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-loading",className:"border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex h-4 items-center gap-2 text-xs",children:[(0,t.jsx)(y.GitBranch,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"bg-muted h-3 w-20 animate-pulse rounded"})]})}),(0,t.jsx)("div",{className:"border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex h-4 items-center gap-2 text-xs",children:[(0,t.jsx)(b.GitCommitHorizontal,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"bg-muted h-3 w-36 animate-pulse rounded"})]})})]}):null,c.envDeploy&&e.repositoryPath?(0,t.jsx)("div",{"data-testid":"repository-node-dev-preview",className:"border-t px-4 py-2",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[T.deployError?(0,t.jsx)("span",{className:"truncate text-xs text-red-500",children:T.deployError}):L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mr-0.5 inline-block h-2 w-2 shrink-0 rounded-full bg-green-500"}),T.url?(0,t.jsx)("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"truncate text-green-700 hover:underline dark:text-green-400",children:T.url}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Starting..."})]}):(0,t.jsxs)("span",{className:"text-muted-foreground",children:["Run",(0,t.jsx)("span",{className:"text-muted-foreground/50 ml-2 text-[10px]",children:"start local environment"})]}),(0,t.jsx)(N.TooltipProvider,{children:(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"ml-auto flex items-center",children:(0,t.jsx)(k.ActionButton,{label:T.deployError?"Retry":L?"Stop Dev Server":"Start Dev Server",onClick:L?T.stop:T.deploy,loading:T.deployLoading||T.stopLoading,error:!1,icon:T.deployError?s.RotateCcw:L?x.Square:v.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(N.TooltipContent,{children:L?"Stop Dev Server":"Start Dev Server"})]})})]})}):null]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:u.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!",style:{top:70}}):null]})}function M(e){let[n]=(0,u.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let P={x:30,y:30,zoom:.85};function T({onResetViewport:e}){let{setViewport:o}=(0,r.useReactFlow)(),a=(0,n.useCallback)(()=>{o(e(),{duration:400})},[e,o]);return(0,t.jsx)(r.ControlButton,{onClick:a,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(s.RotateCcw,{style:{fill:"none"}})})}function L({nodes:e,edges:o,selectedFeatureId:s,defaultViewport:u,onNodesChange:h,onAddFeature:f,onConnect:p,onNodeClick:g,onPaneClick:m,onCanvasDrag:v,onMoveEnd:x,onResetViewport:y,toolbar:b,emptyState:w}){let E=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:S}),[]),k=(0,n.useMemo)(()=>({dependencyEdge:M}),[]),j=(0,n.useMemo)(()=>null==s?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===s?{...e,selected:!0}:e),[e,s]),N=0===e.length,[C,_]=(0,n.useState)(N),[O,R]=(0,n.useState)(!1),L=(0,n.useRef)(N);(0,n.useEffect)(()=>{if(L.current&&!N){R(!0);let e=setTimeout(()=>{_(!1),R(!1)},300);return L.current=N,()=>clearTimeout(e)}!L.current&&N&&_(!0),L.current=N},[N]);let F=N&&!w?(0,t.jsx)(d.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(l.Button,{onClick:f,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})}):null,D=w??F;return(0,t.jsxs)("div",{"data-testid":N?"features-canvas-empty":"features-canvas","data-no-drawer-close":!0,className:"dark:bg-background pointer-events-auto relative h-full w-full bg-[#f6f7f8]",children:[(0,t.jsxs)(r.ReactFlow,{nodes:j,edges:o,nodeTypes:E,edgeTypes:k,onConnect:p,onNodesChange:h,onNodeClick:g,onPaneClick:m,onMoveStart:v,onMoveEnd:x,defaultViewport:u??P,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!N&&(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(T,{onResetViewport:y}):null}),b]}),C&&D?(0,t.jsx)("div",{className:(0,i.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",O?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto h-full w-full",children:D})}):null]})}var F=e.i(5147),D=e.i(8361),A=e.i(30153);let I="shep-canvas-viewport",$={x:30,y:30,zoom:.85};var z=e.i(33548),G=e.i(23925),B=e.i(83428),q=e.i(35e3),W=e.i(79687),U=e.i(99105),V=e.i(78521);e.i(13322);var H=e.i(61201),X=e.i(21023);let J=(0,X.createServerReference)("00875a46d41de7040c7bf410e8efc3e8c8d6af0577",X.callServer,void 0,X.findSourceMapURL,"isAgentSetupComplete"),K=(0,X.createServerReference)("00fb61b550212f6c1f44b82a392192e5d127a7e51c",X.callServer,void 0,X.findSourceMapURL,"checkAgentAuth");var Y=e.i(11345),Q=e.i(5231),Z=e.i(730),ee=e.i(86782),et=e.i(29847);let er=["select-agent","select-model"];function en({onComplete:e,className:r}){let[o,a]=(0,n.useState)([]),[s,l]=(0,n.useState)(!0),[d,c]=(0,n.useState)("select-agent"),[u,h]=(0,n.useState)(null),[f,p]=(0,n.useState)(!1),[g,m]=(0,n.useState)(!1),[v,x]=(0,n.useState)(!0),y=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{(0,Q.getAllAgentModels)().then(a).finally(()=>l(!1))},[]);let b=u?o.find(e=>e.agentType===u):null,w=(0,n.useCallback)((e,t)=>{m(!0),x(!1),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{t?.(),c(e),requestAnimationFrame(()=>{x(!0),m(!1)})},150)},[]);(0,n.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]);let E=(0,n.useCallback)(async(t,r)=>{p(!0);try{await (0,Z.updateAgentAndModel)(t,r),x(!1),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{e()},200)}catch{p(!1)}},[e]),k=(0,n.useCallback)(e=>{let t=o.find(t=>t.agentType===e);t&&t.models.length>0?w("select-model",()=>{h(e)}):E(e,null)},[o,w,E]),j=(0,n.useCallback)(e=>{u&&E(u,e)},[u,E]),N=(0,n.useCallback)(()=>{"select-model"===d&&w("select-agent",()=>{h(null)})},[d,w]);if(s)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex flex-col items-center justify-center gap-4",r),children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-5 w-5 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Loading agents…"})]});let C=er.indexOf(d),_="select-agent"===d?"Choose your agent":"Pick a model",O="select-agent"===d?"Select the AI coding agent you want Shep to use.":b?`Choose which ${b.label} model to run.`:"";return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex w-full flex-col items-center",r),children:[(0,t.jsx)("div",{className:"mb-8 flex w-full max-w-xs items-center gap-1.5",children:er.map((e,r)=>(0,t.jsx)("div",{className:(0,i.cn)("h-[3px] flex-1 rounded-full transition-colors duration-300",r<=C?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,i.cn)("flex w-full flex-col items-center transition-opacity duration-200",v&&!g?"opacity-100":"opacity-0"),children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:_}),(0,t.jsx)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:O}),(0,t.jsxs)("div",{className:"mt-8 flex w-full flex-col items-center",children:["select-agent"===d&&(0,t.jsx)("div",{"data-testid":"agent-list",className:"grid w-full max-w-lg gap-3",style:{gridTemplateColumns:`repeat(${Math.min(o.length,4)}, minmax(0, 1fr))`},children:o.map(e=>{let r=(0,ee.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:f,"data-testid":`agent-option-${e.agentType}`,className:"border-border hover:bg-accent hover:border-foreground/20 flex cursor-pointer flex-col items-center gap-3 rounded-2xl border px-4 py-5 transition-all duration-150 active:scale-[0.97] disabled:opacity-50",onClick:()=>k(e.agentType),children:[(0,t.jsx)(r,{className:"text-foreground/70 h-7 w-7"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:e.label})]},e.agentType)})}),"select-model"===d&&b?(0,t.jsxs)("div",{"data-testid":"model-list",className:"flex w-full max-w-lg flex-col items-center gap-4",children:[(0,t.jsxs)("button",{type:"button",disabled:f,className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 self-start text-sm transition-colors",onClick:N,children:[(0,t.jsx)(Y.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,t.jsx)("div",{className:"grid w-full gap-3",style:{gridTemplateColumns:`repeat(${Math.min(b.models.length,3)}, minmax(0, 1fr))`},children:b.models.map(e=>{let r=(0,et.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:f,"data-testid":`model-option-${e.id}`,className:"border-border hover:bg-accent hover:border-foreground/20 flex cursor-pointer flex-col items-center gap-2 rounded-2xl border px-4 py-5 text-center transition-all duration-150 active:scale-[0.97] disabled:opacity-50",onClick:()=>j(e.id),children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:r.displayName||e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs leading-tight",children:r.description||e.description})]},e.id)})})]}):null]})]})]})}let eo=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function ea({onRepositorySelect:e,className:r}){let[o,a]=(0,n.useState)(!1),[s,l]=(0,n.useState)(!1),[d,c]=(0,n.useState)(!1),[u,h]=(0,n.useState)(null),[f,m]=(0,n.useState)(null),[v,x]=(0,n.useState)(!1),{reactFileManager:y}=(0,_.useFeatureFlags)();async function b(){if(!s){if(y)return void c(!0);l(!0);try{let t=await (0,V.pickFolder)();t&&e?.(t)}catch{c(!0)}finally{l(!1)}}}(0,n.useEffect)(()=>{J().then(e=>{h(e)})},[]),(0,n.useEffect)(()=>{u&&K().then(m)},[u]);let w=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(eo.join("\n")),a(!0),setTimeout(()=>a(!1),2e3)},[]),E=(0,n.useCallback)(()=>{h(!0)},[]),k=(0,n.useCallback)(()=>{m(null),K().then(m)},[]);return null===u?null:(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,i.cn)("relative flex h-full w-full flex-col items-center justify-center px-8",r),children:[u?(0,t.jsxs)("div",{className:"animate-in fade-in flex w-full max-w-md flex-col items-center duration-300",children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:"Add a project"}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:["Add your project folder to unlock feature creation.",(0,t.jsx)("br",{}),"Describe what you need — Shep handles the rest."]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(es,{status:f,onRetry:k})}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:b,disabled:s,className:"bg-foreground text-background hover:bg-foreground/90 mt-10 flex w-full cursor-pointer items-center justify-center gap-2.5 rounded-xl px-6 py-4 text-base font-medium shadow-lg transition-all duration-200 hover:shadow-xl active:scale-[0.98] disabled:cursor-wait disabled:opacity-50",children:[s?(0,t.jsx)(B.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(g.FolderOpen,{className:"h-5 w-5"}),s?"Opening…":"Choose a Folder"]}),(0,t.jsx)("p",{className:"text-muted-foreground/60 mt-3 text-center text-sm",children:"Any folder works — git will be initialized automatically if needed."})]}):(0,t.jsx)(en,{onComplete:E}),u?(0,t.jsxs)("div",{className:"absolute bottom-8 flex flex-col items-center",style:{animationDelay:"400ms",animationDuration:"600ms",animationFillMode:"both"},children:[(0,t.jsxs)("button",{type:"button",onClick:()=>x(!v),className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 transition-colors duration-200",children:[(0,t.jsx)(p.Terminal,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-sm",children:"or use the CLI"}),(0,t.jsx)(U.ChevronDown,{className:(0,i.cn)("h-3.5 w-3.5 transition-transform duration-200",v?"":"rotate-180")})]}),v?(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-top-1 mt-3 w-80 duration-200",children:(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative rounded-xl bg-zinc-900 px-5 py-4 font-mono text-[13px] leading-relaxed text-zinc-400",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:w,className:"absolute top-3 right-3 cursor-pointer rounded-md p-1.5 text-zinc-600 transition-colors hover:bg-zinc-800 hover:text-zinc-300","aria-label":"Copy commands",children:o?(0,t.jsx)(G.Check,{className:"h-3.5 w-3.5 text-emerald-400"}):(0,t.jsx)(z.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("div",{className:"space-y-1",children:eo.map(e=>(0,t.jsxs)("div",{className:"whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-zinc-600 select-none",children:"$ "}),(0,t.jsx)("span",{className:"text-zinc-300",children:e})]},e))})]})}):null]}):null,(0,t.jsx)(H.ReactFileManagerDialog,{open:d,onOpenChange:e=>{e||c(!1)},onSelect:function(t){t&&e?.(t),c(!1)}})]})}function es({status:e,onRetry:r}){return e?e.installed&&e.authenticated?(0,t.jsxs)("div",{className:"animate-in fade-in flex items-center gap-2",children:[(0,t.jsx)(q.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),(0,t.jsxs)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:[e.label," ready"]})]}):e.installed?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.AlertCircle,{className:"h-4 w-4 text-amber-500"}),(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.label," needs authentication"]})]}),e.authCommand?(0,t.jsx)("code",{className:"rounded-lg bg-zinc-100 px-3 py-1.5 text-xs text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",children:e.authCommand}):null,(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[e.binaryName?(0,t.jsxs)("button",{type:"button","data-testid":"auth-banner-open-terminal",onClick:async()=>{try{let t="claude-code"===e.agentType?"claude-code":e.agentType;await fetch(`/api/tools/${t}/launch`,{method:"POST"})}catch{}},className:"flex items-center gap-1.5 text-xs font-medium text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[(0,t.jsx)(p.Terminal,{className:"h-3 w-3"}),"Open ",e.label]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:"Re-check"})]})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.AlertCircle,{className:"h-4 w-4 text-amber-500"}),(0,t.jsxs)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.label," not installed"]})]}),e.binaryName?(0,t.jsxs)("code",{className:"rounded-lg bg-zinc-100 px-3 py-1.5 text-xs text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",children:["npm install -g ",e.binaryName]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:"Re-check"})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground/50 h-3.5 w-3.5 animate-spin"}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:"Checking setup…"})]})}var ei=e.i(17840);let el={maxZoom:1,padding:.5,duration:500};function ed({initialNodes:e,initialEdges:a}){let s,i,l,d=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(s=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),s?.[1]??null),h=(0,D.useSoundAction)("click"),{guardedNavigate:f}=(0,A.useDrawerCloseGuard)(),{fitView:p}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:m,onMoveEnd:v,resetViewport:x}=(i=(0,n.useRef)(function(){try{let e=localStorage.getItem(I);if(null==e)return $;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:$}catch{return $}}()).current,l=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=l.current&&clearTimeout(l.current)},[]),{defaultViewport:i,onMoveEnd:(0,n.useCallback)(e=>{null!=l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{try{localStorage.setItem(I,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(I)}catch{}return $},[])}),{nodes:y,edges:b,onNodesChange:w,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleRetryFeature:N,handleStartFeature:C,handleStopFeature:_,handleDeleteRepository:O,createFeatureNode:R,setCallbacks:S}=(0,ei.useControlCenterState)(e,a),{setFeatures:M,setHasRepositories:P}=(0,F.useSidebarFeaturesContext)(),T=(0,n.useMemo)(()=>y.filter(e=>"featureNode"===e.type),[y]),z=(0,n.useMemo)(()=>T.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[T]);(0,n.useEffect)(()=>{M(T.map(e=>{let t=e.data,r=(0,F.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[z,T,M]);let G=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let r=t.data;"creating"!==r.state&&"deleting"!==r.state&&e.target.closest('[data-testid="feature-node-card"]')&&f(()=>{h.play(),d.push(`/feature/${r.featureId}`)})}},[d,h,f]),B=(0,n.useCallback)(()=>{h.play(),d.push("/create")},[d,h]),q=(0,n.useCallback)(e=>{h.play();let t=y.find(t=>t.id===e),r=t?.data?.repositoryPath;r?d.push(`/create?repo=${encodeURIComponent(r)}`):d.push("/create")},[y,d,h]),W=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?y.find(e=>e.id===r.source):null,o=n?.data?.repositoryPath;h.play();let a=new URLSearchParams;o&&a.set("repo",o),a.set("parent",t),d.push(`/create?${a.toString()}`)},[y,b,d,h]),U=(0,n.useCallback)(e=>{let t=y.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&f(()=>d.push(`/repository/${e.id}`))}},[y,d,f]),V=(0,n.useCallback)(()=>{"/"!==c&&f(()=>d.push("/"))},[d,c,f]),H=(0,n.useCallback)(e=>{setTimeout(()=>{p(el),g.current=setTimeout(()=>{f(()=>d.push(`/create?repo=${encodeURIComponent(e)}`))},600)},0)},[p,f,d]),X=(0,n.useCallback)(e=>{let{wasEmpty:t,repoPath:r}=k(e);t&&H(r)},[k,H]);(0,n.useEffect)(()=>{let e=e=>{X(e.detail.path)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=g.current&&clearTimeout(g.current)}},[X]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void R(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=y.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);R(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[y,R]),(0,n.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n,closePr:o}=e.detail;j(t,r,n,o)};return window.addEventListener("shep:feature-delete-requested",e),()=>window.removeEventListener("shep:feature-delete-requested",e)},[j]),(0,n.useEffect)(()=>{S({onNodeAction:W,onFeatureDelete:j,onRetryFeature:N,onStartFeature:C,onStopFeature:_,onRepositoryAdd:q,onRepositoryClick:U,onRepositoryDelete:O})},[S,W,j,N,C,_,q,U,O]);let J=(0,n.useCallback)((e,t)=>{v(t)},[v]),K=y.some(e=>"repositoryNode"===e.type);(0,n.useEffect)(()=>{P(K)},[K,P]);let[Y,Q]=(0,n.useState)(K),Z=(0,n.useRef)(null);(0,n.useEffect)(()=>(K?(Z.current&&(clearTimeout(Z.current),Z.current=null),Q(!0)):Y&&(x(),Z.current=setTimeout(()=>{Q(!1),Z.current=null},500)),()=>{Z.current&&clearTimeout(Z.current)}),[K,Y,x]);let ee=c.startsWith("/create"),et=(0,n.useMemo)(()=>{let e=y.filter(e=>"repositoryNode"===e.type),t=y.some(e=>"featureNode"===e.type);return 1!==e.length||t||ee?y:y.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[y,ee]);return(0,t.jsx)(L,{nodes:Y?et:[],edges:Y?b:[],selectedFeatureId:u,defaultViewport:m,onNodesChange:w,onConnect:E,onAddFeature:B,onNodeClick:G,onPaneClick:V,onMoveEnd:J,onResetViewport:x,emptyState:(0,t.jsx)(ea,{onRepositorySelect:X})})}function ec({initialNodes:e,initialEdges:n,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(ed,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>ec],48246)}]);