@shipit-ai/cli 1.164.1 → 1.164.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/packages/core/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.d.ts +1 -1
  2. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/feature-agent-graph.d.ts +1 -1
  3. package/dist/src/presentation/web/components/ui/badge.d.ts +1 -1
  4. package/dist/src/presentation/web/components/ui/button.d.ts +1 -1
  5. package/dist/tsconfig.build.tsbuildinfo +1 -1
  6. package/package.json +1 -1
  7. package/web/.next/BUILD_ID +1 -1
  8. package/web/.next/build-manifest.json +3 -3
  9. package/web/.next/fallback-build-manifest.json +3 -3
  10. package/web/.next/prerender-manifest.json +3 -3
  11. package/web/.next/required-server-files.js +6 -6
  12. package/web/.next/required-server-files.json +6 -6
  13. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +29 -29
  14. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  15. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  16. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +27 -27
  17. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  18. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  19. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +30 -30
  20. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  21. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  22. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +37 -37
  23. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  24. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  25. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +37 -37
  26. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  27. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  28. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  29. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  30. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  31. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  32. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  33. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  34. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +27 -27
  35. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  36. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  37. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +30 -30
  38. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  39. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +37 -37
  41. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  42. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +37 -37
  44. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  45. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  46. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +27 -27
  47. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  48. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  49. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  50. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  51. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  52. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  53. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  54. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  55. package/web/.next/server/app/_global-error.html +1 -1
  56. package/web/.next/server/app/_global-error.rsc +1 -1
  57. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  58. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  59. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  60. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  61. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  62. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +6 -6
  63. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  64. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/settings/page/server-reference-manifest.json +9 -9
  66. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  67. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  68. package/web/.next/server/app/skills/page/server-reference-manifest.json +11 -11
  69. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  70. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/tools/page/server-reference-manifest.json +11 -11
  72. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  73. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  74. package/web/.next/server/app/version/page/server-reference-manifest.json +6 -6
  75. package/web/.next/server/app/version/page.js.nft.json +1 -1
  76. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  77. package/web/.next/server/chunks/[root-of-the-server]__0jx0isp._.js +1 -1
  78. package/web/.next/server/chunks/[root-of-the-server]__0jx0isp._.js.map +1 -1
  79. package/web/.next/server/chunks/[root-of-the-server]__0tb~wwk._.js +1 -1
  80. package/web/.next/server/chunks/[root-of-the-server]__0tb~wwk._.js.map +1 -1
  81. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_create-drawer-client_tsx_0g70fc5._.js +1 -1
  82. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_create-drawer-client_tsx_0g70fc5._.js.map +1 -1
  83. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_feature-drawer-client_tsx_104cna.._.js +2 -2
  84. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_feature-drawer-client_tsx_104cna.._.js.map +1 -1
  85. package/web/.next/server/chunks/ssr/0ukq_presentation_web_components_features_settings_settings-page-client_tsx_0j1uius._.js +1 -1
  86. package/web/.next/server/chunks/ssr/0ukq_presentation_web_components_features_settings_settings-page-client_tsx_0j1uius._.js.map +1 -1
  87. package/web/.next/server/chunks/ssr/11y9_components_common_control-center-drawer_repository-drawer-client_tsx_09z.znp._.js +1 -1
  88. package/web/.next/server/chunks/ssr/11y9_components_common_control-center-drawer_repository-drawer-client_tsx_09z.znp._.js.map +1 -1
  89. package/web/.next/server/chunks/ssr/[root-of-the-server]__0.j0ktf._.js +1 -1
  90. package/web/.next/server/chunks/ssr/[root-of-the-server]__0.j0ktf._.js.map +1 -1
  91. package/web/.next/server/chunks/ssr/[root-of-the-server]__07m44ax._.js +1 -1
  92. package/web/.next/server/chunks/ssr/[root-of-the-server]__07m44ax._.js.map +1 -1
  93. package/web/.next/server/chunks/ssr/[root-of-the-server]__0frgz11._.js +1 -1
  94. package/web/.next/server/chunks/ssr/[root-of-the-server]__0frgz11._.js.map +1 -1
  95. package/web/.next/server/chunks/ssr/[root-of-the-server]__0oi7r67._.js +1 -1
  96. package/web/.next/server/chunks/ssr/[root-of-the-server]__0pti1a3._.js +1 -1
  97. package/web/.next/server/chunks/ssr/[root-of-the-server]__0pti1a3._.js.map +1 -1
  98. package/web/.next/server/chunks/ssr/[root-of-the-server]__0rv1gci._.js +1 -1
  99. package/web/.next/server/chunks/ssr/[root-of-the-server]__0s9k_s3._.js +1 -1
  100. package/web/.next/server/chunks/ssr/[root-of-the-server]__0s9k_s3._.js.map +1 -1
  101. package/web/.next/server/chunks/ssr/[root-of-the-server]__0v-vmgt._.js +1 -1
  102. package/web/.next/server/chunks/ssr/[root-of-the-server]__0v-vmgt._.js.map +1 -1
  103. package/web/.next/server/chunks/ssr/[root-of-the-server]__0yky~xo._.js +1 -1
  104. package/web/.next/server/chunks/ssr/[root-of-the-server]__0yky~xo._.js.map +1 -1
  105. package/web/.next/server/chunks/ssr/[root-of-the-server]__11dc42t._.js +1 -1
  106. package/web/.next/server/chunks/ssr/[root-of-the-server]__11dc42t._.js.map +1 -1
  107. package/web/.next/server/chunks/ssr/{_0aakgii._.js → _05h68we._.js} +2 -2
  108. package/web/.next/server/chunks/ssr/{_0aakgii._.js.map → _05h68we._.js.map} +1 -1
  109. package/web/.next/server/chunks/ssr/_0__4si~._.js +1 -1
  110. package/web/.next/server/chunks/ssr/_0__4si~._.js.map +1 -1
  111. package/web/.next/server/chunks/ssr/_0_m17kl._.js +1 -1
  112. package/web/.next/server/chunks/ssr/_0_m17kl._.js.map +1 -1
  113. package/web/.next/server/chunks/ssr/_0aa~oer._.js +1 -1
  114. package/web/.next/server/chunks/ssr/_0d4miu.._.js +1 -1
  115. package/web/.next/server/chunks/ssr/_0d4miu.._.js.map +1 -1
  116. package/web/.next/server/chunks/ssr/_0e8ern9._.js +1 -1
  117. package/web/.next/server/chunks/ssr/_0e8ern9._.js.map +1 -1
  118. package/web/.next/server/chunks/ssr/_0ez.1o4._.js +1 -1
  119. package/web/.next/server/chunks/ssr/_0ez.1o4._.js.map +1 -1
  120. package/web/.next/server/chunks/ssr/_0hovej-._.js +2 -2
  121. package/web/.next/server/chunks/ssr/_0hovej-._.js.map +1 -1
  122. package/web/.next/server/chunks/ssr/_0p3zs6p._.js +1 -1
  123. package/web/.next/server/chunks/ssr/_0p3zs6p._.js.map +1 -1
  124. package/web/.next/server/chunks/ssr/_0r.3n~3._.js +1 -1
  125. package/web/.next/server/chunks/ssr/_0r.3n~3._.js.map +1 -1
  126. package/web/.next/server/chunks/ssr/_0sgeiju._.js +1 -1
  127. package/web/.next/server/chunks/ssr/_0sgeiju._.js.map +1 -1
  128. package/web/.next/server/chunks/ssr/_0t59q8r._.js +1 -1
  129. package/web/.next/server/chunks/ssr/_0t59q8r._.js.map +1 -1
  130. package/web/.next/server/chunks/ssr/{_133.z2f._.js → _0ts70ov._.js} +2 -2
  131. package/web/.next/server/chunks/ssr/{_133.z2f._.js.map → _0ts70ov._.js.map} +1 -1
  132. package/web/.next/server/chunks/ssr/_0v.yfmg._.js +1 -1
  133. package/web/.next/server/chunks/ssr/_0v.yfmg._.js.map +1 -1
  134. package/web/.next/server/chunks/ssr/_0w-_hww._.js +1 -1
  135. package/web/.next/server/chunks/ssr/_0w-_hww._.js.map +1 -1
  136. package/web/.next/server/chunks/ssr/_0zk-h5w._.js +1 -1
  137. package/web/.next/server/chunks/ssr/_0zk-h5w._.js.map +1 -1
  138. package/web/.next/server/chunks/ssr/_0~ev6dw._.js +2 -2
  139. package/web/.next/server/chunks/ssr/_0~ev6dw._.js.map +1 -1
  140. package/web/.next/server/chunks/ssr/_1161g9x._.js +1 -1
  141. package/web/.next/server/chunks/ssr/_1161g9x._.js.map +1 -1
  142. package/web/.next/server/chunks/ssr/_11kuznh._.js +1 -1
  143. package/web/.next/server/chunks/ssr/_11kuznh._.js.map +1 -1
  144. package/web/.next/server/chunks/ssr/_13e1_1b._.js +3 -0
  145. package/web/.next/server/chunks/ssr/{_0427j6p._.js.map → _13e1_1b._.js.map} +1 -1
  146. package/web/.next/server/chunks/ssr/src_presentation_web_0y11iiz._.js +1 -1
  147. package/web/.next/server/chunks/ssr/src_presentation_web_0y11iiz._.js.map +1 -1
  148. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_05m2q~u.js +1 -1
  149. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_05m2q~u.js.map +1 -1
  150. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_0.6zk.t.js +1 -1
  151. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_0.6zk.t.js.map +1 -1
  152. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_0w2wqvu._.js +1 -1
  153. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_0l3oxx9._.js +1 -1
  154. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_0l3oxx9._.js.map +1 -1
  155. package/web/.next/server/middleware/middleware-manifest.json +5 -5
  156. package/web/.next/server/middleware-build-manifest.js +3 -3
  157. package/web/.next/server/middleware-manifest.json +5 -5
  158. package/web/.next/server/pages/500.html +1 -1
  159. package/web/.next/server/server-reference-manifest.js +1 -1
  160. package/web/.next/server/server-reference-manifest.json +47 -47
  161. package/web/.next/static/chunks/{0qm-9ipi3co.d.js → 0.2owry_sk_ak.js} +1 -1
  162. package/web/.next/static/chunks/{0ureecfb3sk03.js → 01~tm1-qp0baa.js} +1 -1
  163. package/web/.next/static/chunks/{0si_11yihc0-l.js → 0_9hv9_f66hur.js} +1 -1
  164. package/web/.next/static/chunks/{0~io7k480nets.js → 0g-so1fagegtp.js} +1 -1
  165. package/web/.next/static/chunks/{09a1uo.4xdik3.js → 0in40lx7y7f8o.js} +1 -1
  166. package/web/.next/static/chunks/{0fc4~7_n~k~-y.js → 0qz02~wj25f-f.js} +1 -1
  167. package/web/.next/static/chunks/{0f698k1fycef7.js → 0rv6fo9ui94r9.js} +1 -1
  168. package/web/.next/static/chunks/{0yj1o1qkqnea0.js → 0t82zfhqgor5r.js} +1 -1
  169. package/web/.next/static/chunks/{0~d8qka._ncpd.js → 0whetjaoa5y.l.js} +2 -2
  170. package/web/.next/static/chunks/{0_5~ye5oqkvog.js → 0xs4~af3nc_15.js} +1 -1
  171. package/web/.next/static/chunks/{0dx9n.g50tq3h.js → 122mzkbtrj4-k.js} +2 -2
  172. package/web/.next/static/chunks/{0bkt5slti~l1x.js → 12pwrbjphv3z7.js} +1 -1
  173. package/web/.next/static/chunks/{0.ot~ed_rh0ui.js → 17jsatqy81xc..js} +2 -2
  174. package/web/.next/server/chunks/ssr/_0427j6p._.js +0 -3
  175. /package/web/.next/static/{ZJku-LesX1icuSm9WAIO0 → CJ4Fr1ggL4xWEe_fapYLv}/_buildManifest.js +0 -0
  176. /package/web/.next/static/{ZJku-LesX1icuSm9WAIO0 → CJ4Fr1ggL4xWEe_fapYLv}/_clientMiddlewareManifest.js +0 -0
  177. /package/web/.next/static/{ZJku-LesX1icuSm9WAIO0 → CJ4Fr1ggL4xWEe_fapYLv}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(16539),r=e.i(33109),n=e.i(60112),a=e.i(18354),o=e.i(99045);e.i(98026);var s=e.i(50728),i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=i((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?r(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n},o=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function o(e,t,r,n){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}return a+"\x01"+o+"\x01"+(void 0===n?"\0":n)}function s(e,t){return o(e,t.v,t.w,t.name)}t.exports=class{constructor(e){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(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(a){var o=r.parent(a);return void 0===o||t.hasNode(o)?(n[a]=o,o):o in n?n[o]:e(o)}(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,a){return n.length>1?r.setEdge(e,a,t):r.setEdge(e,a),a}),this}setEdge(){var e,t,n,a,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&&(a=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(a=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=a),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?a:this._defaultEdgeLabelFn(e,t,n);var d=function(e,t,r,n){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}var i={v:a,w:o};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]):o(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]):o(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var a=1==arguments.length?s(this._isDirected,arguments[0]):o(this._isDirected,e,t,r),i=this._edgeObjs[a];return i&&(e=i.v,t=i.w,delete this._edgeLabels[a],delete this._edgeObjs[a],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][a],delete this._out[e][a],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:o(),version:s()}}),l=n((e,t)=>{var r=o();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),a={v:e};return void 0!==r&&(a.value=r),void 0!==n&&(a.parent=n),a}),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,a){return function(e,t,r,n){var a={},o=!0,s=0,i=e.nodes(),l=function(e){var t=r(e);a[e.v].distance+t<a[e.w].distance&&(a[e.w]={distance:a[e.v].distance+t,predecessor:e.v},o=!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){a[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(o=!1,s++,d(),o);u++);if(s===c-1&&(o=!1,d(),o))throw Error("The graph contains a negative weight cycle");return a}(e,String(t),n||r,a||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(a){t=[],function n(a){Object.hasOwn(r,a)||(r[a]=!0,t.push(a),e.successors(a).forEach(n),e.predecessors(a).forEach(n))}(a),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){a(this,"_arr",[]),a(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,a=n.length;return r[e]=a,n.push({key:e,priority:t}),this._decrease(a),!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,a=e;r<t.length&&(a=t[r].priority<t[a].priority?r:a,n<t.length&&(a=t[n].priority<t[a].priority?n:a),a!==e&&(this._swap(e,a),this._heapify(a)))}_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,a=r[e],o=r[t];r[e]=o,r[t]=a,n[o.key]=e,n[a.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,a,o){return function(e,t,n,a){var o,s,i={},l=new r,d=function(e){var t=e.v!==o?e.v:e.w,r=i[t],a=n(e),d=s.distance+a;if(a<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+a);d<r.distance&&(r.distance=d,r.predecessor=o,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[o=l.removeMin()]).distance!==1/0;)a(o).forEach(d);return i}(e,String(t),a||n,o||function(t){return e.outEdges(t)})};var n=()=>1}),p=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(a,o){return a[o]=r(e,o,t,n),a},{})}}),f=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=[],a=r;a!==t;)n.push(a),a=e[a].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},a=[];return e.nodes().forEach(function(o){Object.hasOwn(n,o)||function o(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)):(o(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)a.push(d)}}(o)}),a}}),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])})}}),x=n((e,t)=>{t.exports=function(e,t,n){var a,o,s,i,l;return a=e,o=t||r,s=n||function(t){return e.outEdges(t)},i={},(l=a.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=o(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 a=n[e],o=t[r],s=n[r],i=a.distance+o.distance;i<s.distance&&(s.distance=i,s.predecessor=o.predecessor)})})}),i};var r=()=>1}),v=n((e,t)=>{function r(e){var t={},r={},a=[];if(e.sinks().forEach(function o(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(o),delete r[s],a.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return a}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),y=n((e,t)=>{var r=v();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,a){Array.isArray(t)||(t=[t]);var o=(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);a=function e(t,r,n,a,o,s,i){return Object.hasOwn(a,r)||(a[r]=!0,n||(i=s(i,r)),o(r).forEach(function(r){i=e(t,r,n,a,o,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,o,n,a)}),a}}),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},[])}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),j=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),N=n((e,t)=>{var r=o(),n=u();t.exports=function(e,t){var a,o=new r,s={},i=new n;function l(e){var r=e.v===a?e.w:e.v,n=i.priority(r);if(void 0!==n){var o=t(e);o<n&&(s[r]=a,i.decrease(r,o))}}if(0===e.nodeCount())return o;e.nodes().forEach(function(e){i.add(e,1/0),o.setNode(e)}),i.decrease(e.nodes()[0],0);for(var d=!1;i.size()>0;){if(Object.hasOwn(s,a=i.removeMin()))o.setEdge(a,s[a]);else{if(d)throw Error("Input graph is not connected: "+e);d=!0}e.nodeEdges(a).forEach(l)}return o}}),E=n((e,t)=>{var r=h(),n=d();t.exports=function(e,t,a,o){return function(e,t,a,o){if(void 0===a)return r(e,t,a,o);for(var s=!1,i=e.nodes(),l=0;l<i.length;l++){for(var d=o(i[l]),c=0;c<d.length;c++){var u=d[c],h=u.v===i[l]?u.v:u.w,p=h===u.v?u.w:u.v;0>a({v:h,w:p})&&(s=!0)}if(s)return n(e,t,a,o)}return r(e,t,a,o)}(e,t,a,o||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:d(),components:c(),dijkstra:h(),dijkstraAll:p(),extractPath:f(),findCycles:m(),floydWarshall:x(),isAcyclic:y(),postorder:k(),preorder:j(),prim:N(),shortestPaths:E(),reduce:b(),tarjan:g(),topsort:v()}}),_=i();t.exports={Graph:_.Graph,json:l(),alg:C(),version:_.version}}),d=i((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(", ")+"]"}}}),c=i((e,t)=>{var r=l().Graph,n=d();t.exports=function(e,t){var i,l;let d,c,u,h,p;if(1>=e.nodeCount())return[];let f=(i=e,l=t||a,d=new r,c=0,u=0,i.nodes().forEach(e=>{d.setNode(e,{v:e,in:0,out:0})}),i.edges().forEach(e=>{let t=d.edge(e.v,e.w)||0,r=l(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),p=c+1,d.nodes().forEach(e=>{s(h,p,d.node(e))}),{graph:d,buckets:h,zeroIdx:p});return(function(e,t,r){let n=[],a=t[t.length-1],s=t[0],i;for(;e.nodeCount();){for(;i=s.dequeue();)o(e,t,r,i);for(;i=a.dequeue();)o(e,t,r,i);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(i=t[a].dequeue()){n=n.concat(o(e,t,r,i,!0));break}}}return n})(f.graph,f.buckets,f.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var a=()=>1;function o(e,t,r,n,a){let o=a?[]:void 0;return e.inEdges(n.v).forEach(n=>{let i=e.edge(n),l=e.node(n.v);a&&o.push({v:n.v,w:n.w}),l.out-=i,s(t,r,l)}),e.outEdges(n.v).forEach(n=>{let a=e.edge(n),o=n.w,i=e.node(o);i.in-=a,s(t,r,i)}),e.removeNode(n.v),o}function s(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)}}),u=i((e,t)=>{var r=l().Graph;function n(e,t,r,n){for(var a=n;e.hasNode(a);)a=i(n);return r.dummy=t,e.setNode(a,r),a}t.exports={addBorderNode:function(e,t,r,a){let o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=a),n(e,"border",o,t)},addDummyNode:n,applyWithChunking:a,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(o(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),a=n.rank;void 0!==a&&(t[a][n.order]=r)}),t},intersectRect:function(e,t){let r,n,a=e.x,o=e.y,s=t.x-a,i=t.y-o,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:a+r,y:o+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:o,normalizeRanks:function(e){let t=a(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=a(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let a=e.node(n).rank-t;r[a]||(r[a]=[]),r[a].push(n)});let n=0,o=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%o!=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},a=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+a.weight,minlen:Math.max(n.minlen,a.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:i,zipObject:c};function a(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 a=e.slice(n,n+t);r.push(a)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function o(e){return a(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var s=0;function i(e){return e+""+ ++s}function d(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let a=[];for(let t=e;n(t);t+=r)a.push(t);return a}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),h=i((e,t)=>{var r=c(),n=u().uniqueId;t.exports={run:function(e){var t,a;let o,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(o=[],s={},i={},(a=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,a.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?o.push(t):e(t.w)}),delete s[t])}),o)).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)}})}}}),p=i((e,t)=>{var r=u();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,a,o,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),o=0,++i;i<d;++o,++i)u.points=[],a={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",a,"_d"),i===h&&(a.width=u.width,a.height=u.height,a.dummy="edge-label",a.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===o&&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,a;for(e.setEdge(r.edgeObj,n);r.dummy;)a=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=a,r=e.node(t)})}}}),f=i((e,t)=>{var{applyWithChunking:r}=u();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(a){var o=e.node(a);if(Object.hasOwn(t,a))return o.rank;t[a]=!0;var s=r(Math.min,e.outEdges(a).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),o.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),g=i((e,t)=>{var r=l().Graph,n=f().slack;t.exports=function(e){var t,a,o,s,i=new r({directed:!1}),l=e.nodes()[0],d=e.nodeCount();for(i.setNode(l,{});t=i,a=e,t.nodes().forEach(function e(r){a.nodeEdges(r).forEach(o=>{var s=o.v,i=r===s?o.w:s;t.hasNode(i)||n(a,o)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<d;)o=function(e,t){return t.edges().reduce((r,a)=>{let o=1/0;return e.hasNode(a.v)!==e.hasNode(a.w)&&(o=n(t,a)),o<r[0]?[o,a]:r},[1/0,null])[1]}(i,e),s=i.hasNode(o.v)?n(e,o):-n(e,o),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),m=i((e,t)=>{var r=g(),n=f().slack,a=f().longestPath,o=l().alg.preorder,s=l().alg.postorder,i=u().simplify;function d(e){a(e=i(e));var t,n,o=r(e);for(p(o),c(o,e);t=m(o);)n=x(o,e,t),v(o,e,t,n)}function c(e,t){var r=s(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,a,o,s;return n=e,a=t,o=r,s=n.node(o).parent,void(n.edge(o,s).cutvalue=h(n,a,o))})}function h(e,t,r){var n=e.node(r).parent,a=!0,o=t.edge(r,n),s=0;return o||(a=!1,o=t.edge(n,r)),s=o.weight,t.nodeEdges(r).forEach(o=>{var i=o.v===r,l=i?o.w:o.v;if(l!==n){var d,c,u,h=i===a,p=t.edge(o).weight;if(s+=h?p:-p,d=e,c=r,u=l,d.hasEdge(c,u)){var f=e.edge(r,l).cutvalue;s+=h?-f:f}}}),s}function p(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,a,o){var s=n,i=t.node(a);return r[a]=!0,t.neighbors(a).forEach(o=>{Object.hasOwn(r,o)||(n=e(t,r,n,o,a))}),i.low=s,i.lim=n++,o?i.parent=o:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function x(e,t,r){var a=r.v,o=r.w;t.hasEdge(a,o)||(a=r.w,o=r.v);var s=e.node(a),i=e.node(o),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 v(e,t,r,n){var a,s,i,l,d=r.v,u=r.w;e.removeEdge(d,u),e.setEdge(n.v,n.w,{}),p(e),c(e,t),a=e,s=t,i=a.nodes().find(e=>!s.node(e).parent),(l=(l=o(a,i)).slice(1)).forEach(e=>{var t=a.node(e).parent,r=s.edge(e,t),n=!1;r||(r=s.edge(t,e),n=!0),s.node(e).rank=s.node(t).rank+(n?r.minlen:-r.minlen)})}function y(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=d,d.initLowLimValues=p,d.initCutValues=c,d.calcCutValue=h,d.leaveEdge=m,d.enterEdge=x,d.exchangeEdges=v}),x=i((e,t)=>{var r=f().longestPath,n=g(),a=m();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:a(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":o(e);case"none":}};var o=r}),v=i((e,t)=>{t.exports=function(e){var t;let r,n,a=(r={},n=0,(t=e).children().forEach(function e(a){let o=n;t.children(a).forEach(e),r[a]={low:o,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,o=function(e,t,r,n){let a=[],o=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),l,d;l=r;do a.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;)o.push(l);return{path:a.concat(o.reverse()),lca:d}}(e,a,n.v,n.w),s=o.path,i=o.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]}})}}),y=i((e,t)=>{var r=u();t.exports={run:function(e){var t,n,a;let o=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,a){var o=t.children(r);o&&o.length&&o.forEach(t=>e(t,a+1)),n[r]=a})(e,1)),n),i=Object.values(s),l=r.applyWithChunking(Math.max,i)-1,d=2*l+1;e.graph().nestingRoot=o,e.edges().forEach(t=>e.edge(t).minlen*=d);let c=(a=e).edges().reduce((e,t)=>e+a.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,a,o,s,i,l){let d=t.children(l);if(!d.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:a});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,a,o,s,i,r);let d=t.node(r),h=d.borderTop?d.borderTop:r,p=d.borderBottom?d.borderBottom:r,f=d.borderTop?o:2*o,g=h!==p?1:s-i[l]+1;t.setEdge(c,h,{weight:f,minlen:g,nestingEdge:!0}),t.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,c,{weight:0,minlen:s+i[l]})})(e,o,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)})}}}),b=i((e,t)=>{var r=u();function n(e,t,n,a,o,s){let i=o[t][s-1],l=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);o[t][s]=l,e.setParent(l,a),i&&e.setEdge(i,l,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let a=e.children(r),o=e.node(r);if(a.length&&a.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let t=o.minRank,a=o.maxRank+1;t<a;++t)n(e,"borderLeft","_bl",r,o,t),n(e,"borderRight","_br",r,o,t)}})}}),w=i((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 a(e){e.y=-e.y}function o(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=>a(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(a),Object.hasOwn(r,"y")&&a(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>o(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(o),Object.hasOwn(t,"x")&&o(t)}),r(e))}}}),k=i((e,t)=>{var r=u();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),a=n.map(t=>e.node(t).rank),o=r.applyWithChunking(Math.max,a),s=r.range(o+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}}),j=i((e,t)=>{var r=u().zipObject;t.exports=function(e,t){let n=0;for(let a=1;a<t.length;++a)n+=function(e,t,n){let a=r(n,n.map((e,t)=>t)),o=t.flatMap(t=>e.outEdges(t).map(t=>({pos:a[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 o.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[a-1],t[a]);return n}}),N=i((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),a=e.node(r.v);return{sum:t.sum+n.weight*a.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=i((e,t)=>{var r=u();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))}}),C=i((e,t)=>{var r=u();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 a;let o=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=o.lhs,i=o.rhs.sort((e,t)=>t.i-e.i),l=[],d=0,c=0,u=0;s.sort((a=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:a?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}}),_=i((e,t)=>{var r=N(),n=E(),a=C();t.exports=function e(t,o,s,i){var l,d;let c=t.children(o),u=t.node(o),h=u?u.borderLeft:void 0,p=u?u.borderRight:void 0,f={};h&&(c=c.filter(e=>e!==h&&e!==p));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,a;let o=e(t,r.v,s,i);f[r.v]=o,Object.hasOwn(o,"barycenter")&&(n=r,a=o,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+a.barycenter*a.weight)/(n.weight+a.weight),n.weight+=a.weight):(n.barycenter=a.barycenter,n.weight=a.weight))}});let m=n(g,s);l=m,d=f,l.forEach(e=>{e.vs=e.vs.flatMap(e=>d[e]?d[e].vs:e)});let x=a(m,i);if(h&&(x.vs=[h,x.vs,p].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(p)[0]);Object.hasOwn(x,"barycenter")||(x.barycenter=0,x.weight=0),x.barycenter=(x.barycenter*x.weight+e.order+r.order)/(x.weight+2),x.weight+=2}return x}}),S=i((e,t)=>{var r=l().Graph,n=u();t.exports=function(e,t,a,o){o||(o=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 o.forEach(r=>{let n=e.node(r),o=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,o||s),e[a](r).forEach(t=>{let n=t.v===r?t.w:t.v,a=i.edge(n,r),o=void 0!==a?a.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),M=i((e,t)=>{t.exports=function(e,t,r){let n={},a;r.forEach(r=>{let o=e.parent(r),s,i;for(;o;){if((s=e.parent(o))?(i=n[s],n[s]=o):(i=a,a=o),i&&i!==o)return void t.setEdge(i,o);o=s}})}}),R=i((e,t)=>{var r=k(),n=j(),a=_(),o=S(),s=M(),i=l().Graph,d=u();function c(e,t,r){let n=new Map,a=(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&&a(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&a(e,t)}return t.map(function(t){return o(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,o={}){if("function"==typeof o.customOrder)return void o.customOrder(t,e);let l=d.maxRank(t),u=c(t,d.range(1,l+1),"inEdges"),p=c(t,d.range(l-1,-1,-1),"outEdges"),f=r(t);if(h(t,f),o.disableOptimalOrderHeuristic)return;let g=1/0,m,x=o.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new i;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let o=e.graph().root,i=a(e,o,n,t);i.vs.forEach((t,r)=>e.node(t).order=r),s(e,n,i.vs)})})(e%2?u:p,e%4>=2,x),f=d.buildLayerMatrix(t);let o=n(t,f);o<g?(r=0,m=Object.assign({},f),g=o):o===g&&(m=structuredClone(f))}h(t,m)}}),O=i((e,t)=>{var r=l().Graph,n=u();function a(e,t){let r={};return t.length&&t.reduce(function(t,n){let a=0,o=0,i=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:i;(c||t===l)&&(n.slice(o,d+1).forEach(t=>{e.predecessors(t).forEach(n=>{let o=e.node(n),i=o.order;(i<a||u<i)&&!(o.dummy&&e.node(t).dummy)&&s(r,n,t)})}),o=d+1,a=u)}),n}),r}function o(e,t){let r={};function a(t,a,o,i,l){let d;n.range(a,o).forEach(n=>{d=t[n],e.node(d).dummy&&e.predecessors(d).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<i||n.order>l)&&s(r,t,d)})})}return t.length&&t.reduce(function(t,r){let n=-1,o,s=0;return r.forEach((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(o=e.node(t[0]).order,a(r,s,l,n,o),s=l,n=o)}a(r,s,r.length,o,t.length)}),r}),r}function s(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 i(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function d(e,t,r,n){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let l=n(e);if(l.length){let n=((l=l.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=l[d];o[e]===e&&t<s[n]&&!i(r,e,n)&&(o[n]=e,o[e]=a[e]=a[n],t=s[n])}}})}),{root:a,align:o}}function c(e,t,n,a,o){var s,i,l,d,c,u,h;let p,f,g,m={},x=(s=e,i=t,l=n,d=o,p=new r,g=(c=(f=s.graph()).nodesep,u=f.edgesep,h=d,(e,t,r)=>{let n=e.node(t),a=e.node(r),o,s;if(o=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&&(o+=h?s:-s),s=0,o+=(n.dummy?u:c)/2,o+=(a.dummy?u:c)/2,o+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":s=a.width/2;break;case"r":s=-a.width/2}return s&&(o+=h?s:-s),s=0,o}),i.forEach(e=>{let t;e.forEach(e=>{let r=l[e];if(p.setNode(r),t){var n=l[t],a=p.edge(n,r);p.setEdge(n,r,Math.max(g(s,e,t),a||0))}t=e})}),p),v=o?"borderLeft":"borderRight";function y(e,t){let r=x.nodes().slice(),n={},a=r.pop();for(;a;){if(n[a])e(a);else for(let e of(n[a]=!0,r.push(a),t(a)))r.push(e);a=r.pop()}}return y(function(e){m[e]=x.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+x.edge(t)),0)},x.predecessors.bind(x)),y(function(t){let r=x.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-x.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==v&&(m[t]=Math.max(m[t],r))},x.successors.bind(x)),Object.keys(a).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,a=1/0;Object.entries(r).forEach(([t,r])=>{var o,s;let i=(o=e,s=t,o.node(s).width/2);n=Math.max(r+i,n),a=Math.min(r-i,a)});let o=n-a;return o<t[0]&&(t=[o,r]),t},[1/0,null])[1]}function p(e,t){let r=Object.values(t),a=n.applyWithChunking(Math.min,r),o=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=a-n.applyWithChunking(Math.min,d);"l"!==s&&(c=o-n.applyWithChunking(Math.max,d)),c&&(e[i]=n.mapValues(l,e=>e+c))})})}function f(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(a(e,t),o(e,t)),s={},i;["u","d"].forEach(a=>{i="u"===a?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let o=("u"===a?e.predecessors:e.successors).bind(e),l=d(e,i,r,o),u=c(e,i,l.root,l.align,"r"===t);"r"===t&&(u=n.mapValues(u,e=>-e)),s[a+t]=u})});let l=h(e,s);return p(s,l),f(s,e.graph().align)},findType1Conflicts:a,findType2Conflicts:o,addConflict:s,hasConflict:i,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:p,findSmallestWidthAlignment:h,balance:f}}),P=i((e,t)=>{var r=u(),n=O().positionX;t.exports=function(e){var t;let a,o,s,i;t=e=r.asNonCompoundGraph(e),a=r.buildLayerMatrix(t),o=t.graph().ranksep,s=t.graph().rankalign,i=0,a.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+o}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),T=i((e,t)=>{var r=h(),n=p(),a=x(),o=u().normalizeRanks,s=v(),i=u().removeEmptyRanks,d=y(),c=b(),f=w(),g=R(),m=P(),k=u(),j=l().Graph;t.exports=function(e,t={}){let l=t.debugTiming?k.time:k.notime;return l("layout",()=>{let u=l(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new j({multigraph:!0,compound:!0}),n=L(t.graph()),r.setGraph(Object.assign({},E,F(n,N),k.pick(n,C))),t.nodes().forEach(e=>{let n=F(L(t.node(e)),_);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=L(t.edge(e));r.setEdge(e,Object.assign({},O,F(n,M),k.pick(n,T)))}),r});return l(" runLayout",()=>{var e,h,p;return e=u,h=l,p=t,void(h(" 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)}))}),h(" 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)}})}),h(" acyclic",()=>r.run(e)),h(" nestingGraph.run",()=>d.run(e)),h(" rank",()=>a(k.asNonCompoundGraph(e))),h(" 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};k.addDummyNode(t,"edge-proxy",n,"_ep")}})}),h(" removeEmptyRanks",()=>i(e)),h(" nestingGraph.cleanup",()=>d.cleanup(e)),h(" normalizeRanks",()=>o(e)),h(" 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)}),h(" 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))})}),h(" normalize.run",()=>n.run(e)),h(" parentDummyChains",()=>s(e)),h(" addBorderSegments",()=>c(e)),h(" order",()=>g(e,p)),h(" insertSelfEdges",()=>{var t;return t=e,void k.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var a=t.node(e);a.order=n+r,(a.selfEdges||[]).forEach(e=>{k.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete a.selfEdges})})}),h(" adjustCoordinateSystem",()=>f.adjust(e)),h(" position",()=>m(e)),h(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),a=n.x+n.width/2,o=n.y,s=r.x-a,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:o-i},{x:a+5*s/6,y:o-i},{x:a+s,y:o},{x:a+5*s/6,y:o+i},{x:a+2*s/3,y:o+i}],r.label.x=r.x,r.label.y=r.y}})}),h(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),a=t.node(r.borderBottom),o=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-o.x),r.height=Math.abs(a.y-n.y),r.x=o.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),h(" normalize.undo",()=>n.undo(e)),h(" 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}})}),h(" undoCoordinateSystem",()=>f.undo(e)),h(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,a=0,o=e.graph(),s=o.marginx||0,i=o.marginy||0;function l(e){let o=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,o-i/2),r=Math.max(r,o+i/2),n=Math.min(n,s-l/2),a=Math.max(a,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 a=e.node(r);a.x-=t,a.y-=n}),e.edges().forEach(r=>{let a=e.edge(r);a.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(a,"x")&&(a.x-=t),Object.hasOwn(a,"y")&&(a.y-=n)}),o.width=r-t+s,o.height=a-n+i})(e)),h(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),a=t.node(e.w),o,s;r.points?(o=r.points[0],s=r.points[r.points.length-1]):(r.points=[],o=a,s=n),r.points.unshift(k.intersectRect(n,o)),r.points.push(k.intersectRect(a,s))})}),h(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),h(" acyclic.undo",()=>r.undo(e)))}),l(" updateInputGraph",()=>{var t,r;return t=e,r=u,void(t.nodes().forEach(e=>{let n=t.node(e),a=r.node(e);n&&(n.x=a.x,n.y=a.y,n.order=a.order,n.rank=a.rank,r.children(e).length&&(n.width=a.width,n.height=a.height))}),t.edges().forEach(e=>{let n=t.edge(e),a=r.edge(e);n.points=a.points,Object.hasOwn(a,"x")&&(n.x=a.x,n.y=a.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),u})};var N=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],_=["width","height","rank"],S={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function F(e,t){return k.mapValues(k.pick(e,t),Number)}function L(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),F=i((e,t)=>{var r=u(),n=l().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),a=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{a.setNode(t,{label:t}),a.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>a.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{a.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(a.setEdge(e,t,{style:"invis"}),t))}),a}}}),L=i((e,t)=>{t.exports="2.0.4"});let A=i((e,t)=>{t.exports={graphlib:l(),layout:T(),debug:F(),util:{time:u().time,notime:u().notime},version:L()}})(),D={direction:"LR",ranksep:200,nodesep:30};function I(e="ltr"){return{...D,direction:"rtl"===e?"RL":"LR"}}let $={featureNode:{width:388,height:140},repositoryNode:{width:400,height:140}};function z(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:$[e.type??""]??t}function B(e,t,r={}){let{direction:n="TB",nodeSize:a={width:172,height:36},ranksep:o=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new A.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:o,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=z(e,a);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);A.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),p="LR"===n||"RL"===n,f=new Map;for(let e of d){let t=i.node(e.id),r=z(e,a);f.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of f.values()){g=p?e.cx:e.cy;break}for(let e of c){let t=z(e,a);f.set(e.id,{cx:p?g:0,cy:p?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)f.has(e.source)&&f.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let x=new Map;for(let t=0;t<e.length;t++)x.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(x.get(e)??0)-(x.get(t)??0));let v=new Set;for(let e of m.values())for(let t of e)v.add(t);let y=[...[...l].filter(e=>f.has(e)&&!v.has(e)),...c.map(e=>e.id)];y.sort((e,t)=>(x.get(e)??0)-(x.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=f.get(t),n=p?r.h:r.w,a=m.get(t);if(!a||0===a.length)return b.set(t,n),n;let o=0;for(let t of a)o+=e(t);let i=Math.max(n,o+=(a.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=f.get(t);p?n.cy=r:n.cx=r;let a=m.get(t);if(!a||0===a.length)return;let o=0;for(let e of a)o+=b.get(e)??0;let i=r-(o+=(a.length-1)*s)/2;for(let t of a){let r=b.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let k=[];for(let t of e){let e=f.get(t.id);e&&k.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:k,edges:[...t]}}function G(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,a=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&&a.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:a}}function U(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}var W=e.i(96976);let V=(0,W.createServerReference)("409ef43db5afffcabeb48a0d5a5f18c862983a89e0",W.callServer,void 0,W.findSourceMapURL,"getFeatureMetadata");var H=e.i(48034);let X=(0,W.createServerReference)("40bff875a4f6200cebc71873759470de7b26422e21",W.callServer,void 0,W.findSourceMapURL,"archiveFeature"),J=(0,W.createServerReference)("7813183bc4180c23bfc01cede75c865e1bfcaeae25",W.callServer,void 0,W.findSourceMapURL,"deleteFeature");var K=e.i(99262),Y=e.i(25931),Q=e.i(46634);let Z=(0,W.createServerReference)("40a915899629697c72679c5331a1c0d205a82b75e3",W.callServer,void 0,W.findSourceMapURL,"unarchiveFeature");var ee=e.i(31696);let et=(0,W.createServerReference)("401db8958290daea4a7f39a248a6bb48922ef273be",W.callServer,void 0,W.findSourceMapURL,"deleteRepository");var er=e.i(8361);let en=(0,a.createLogger)("[Polling]"),ea=0;e.s(["useControlCenterState",0,function(e,a){let i=(0,r.useRouter)(),[l,d]=(0,t.useState)(!1),{nodes:c,edges:u,reconcile:h,updateFeature:p,addPendingFeature:f,removeFeature:g,restoreFeature:m,addRepository:x,removeRepository:v,replaceRepository:y,getFeatureRepositoryPath:b,getRepositoryData:w,getRepoMapSize:k,setCallbacks:j,beginMutation:N,endMutation:E,isMutating:C}=function(e,r,n=!1){var a;let o,{i18n:i}=(0,s.useTranslation)(),l=(0,t.useMemo)(()=>I(i.dir()),[i]),d=(0,t.useMemo)(()=>G(e,r),[]),[c,u]=(0,t.useState)(d.featureMap),[h,p]=(0,t.useState)(d.repoMap),[f,g]=(0,t.useState)(new Map),m=(0,t.useRef)(new Map),x=(0,t.useRef)(new Set),v=(0,t.useRef)(0),y=(0,t.useRef)(new Set),b=(0,t.useRef)(new Set),w=(0,t.useRef)({}),k=(0,t.useMemo)(()=>({onNodeAction:e=>w.current.onNodeAction?.(e),onNodeSettings:e=>w.current.onNodeSettings?.(e),onFeatureDelete:(e,t,r,n)=>w.current.onFeatureDelete?.(e,t,r,n),onRepositoryAdd:e=>w.current.onRepositoryAdd?.(e),onRepositoryClick:e=>w.current.onRepositoryClick?.(e),onRepositoryDelete:e=>w.current.onRepositoryDelete?.(e),onRetryFeature:e=>w.current.onRetryFeature?.(e),onStartFeature:e=>w.current.onStartFeature?.(e),onArchiveFeature:e=>w.current.onArchiveFeature?.(e),onUnarchiveFeature:e=>w.current.onUnarchiveFeature?.(e)}),[]),j=(0,t.useRef)(c);j.current=c;let N=(0,t.useRef)(h);N.current=h;let E=(0,t.useMemo)(()=>{if(n)return c;let e=new Map;for(let[t,r]of c)"archived"!==r.data.state&&e.set(t,r);return e.size===c.size?c:e},[c,n]),{nodes:C,edges:_}=(a=(0,t.useMemo)(()=>(function(e,t,r,n){let a=[],o=[],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}};a.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 u="creating"===d.data.state||c,h={...d.data,...!u&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!u&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!u&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!u&&"error"===d.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!u&&"pending"===d.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature},...!u&&("running"===d.data.state||"action-required"===d.data.state)&&n?.onStopFeature&&{onStop:n.onStopFeature},...!u&&"archived"!==d.data.state&&"deleting"!==d.data.state&&n?.onArchiveFeature&&{onArchive:n.onArchiveFeature},...!u&&"archived"===d.data.state&&n?.onUnarchiveFeature&&{onUnarchive:n.onUnarchiveFeature}};if(a.push({id:t,type:"featureNode",position:{x:0,y:0},data:h}),d.parentNodeId&&(e.has(d.parentNodeId)||r.has(d.parentNodeId)))o.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 a.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),l.set(e,t),t}(e);o.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=new Set;for(let e of o)"dependencyEdge"===e.type&&d.add(e.source);let c=o.length>0;for(let e of a){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=d.has(e.id))}return{nodes:a,edges:o}})(E,h,f,k),[E,h,f,k]),o=(0,t.useRef)({key:"",positions:new Map}),(0,t.useMemo)(()=>{let e=a.nodes.map(e=>e.id).sort().join(","),t=a.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}|${l.direction}`;if(r!==o.current.key){let e=B(a.nodes,a.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=o.current.positions;if(n.size>0){let r=0,a=0;for(let[e,o]of t){let t=n.get(e);if(t){r=t.position.x-o.position.x,a=t.position.y-o.position.y;break}}if(0!==r||0!==a){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+a};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+a}}}return o.current={key:r,positions:t},e}let{positions:n}=o.current;return{nodes:a.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:a.edges}},[a,l])),S=(0,t.useCallback)((e,t)=>{if(v.current>0)return;let{featureMap:r,repoMap:n}=G(e,t),a=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));u(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}`;a.has(t)||n.set(e,r)}let o=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"}}):b.current.has(t)||(n.set(t,r),o.add(t)));for(let[e,t]of(b.current=o,m.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),m.current.delete(e))}return q(e,n)?e:n}),g(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,o]of e){let e=`${o.data.name}\0${o.data.repositoryPath}`;a.has(e)&&(r.delete(n),t=!0)}return t?r:e}),p(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,a]of e){if(t.has(n)||r.has(a.data.repositoryPath)){x.current.delete(n);continue}(n.startsWith("repo-temp-")||x.current.has(n))&&t.set(n,a)}return q(e,t)?e:t})},[]),M=(0,t.useCallback)((e,t)=>{u(r=>{let n=r.get(e);if(!n)return m.current.set(e,{...m.current.get(e),...t}),r;if(m.current.delete(e),U(n.data,t))return r;let a=new Map(r);return a.set(e,{...n,data:{...n.data,...t}}),a}),g(r=>{let n=r.get(e);if(!n||U(n.data,t))return r;let a=new Map(r);return a.set(e,{...n,data:{...n.data,...t}}),a})},[]),R=(0,t.useCallback)((e,t,r)=>{g(n=>{let a=new Map(n);return a.set(e,{nodeId:e,data:t,parentNodeId:r}),a})},[]),O=(0,t.useCallback)(e=>{g(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),P=(0,t.useCallback)(e=>{u(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),T=(0,t.useCallback)((e,t)=>{u(r=>{let n=new Map(r);return n.set(e,t),n})},[]),F=(0,t.useCallback)((e,t)=>{x.current.add(e),p(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),L=(0,t.useCallback)(e=>{x.current.delete(e),p(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),A=(0,t.useCallback)((e,t,r)=>{x.current.delete(e),x.current.add(t),p(n=>{if(!n.has(e))return n;let a=new Map(n);return a.delete(e),a.set(t,{nodeId:t,data:r}),a})},[]),D=(0,t.useCallback)(e=>j.current.get(e)?.data.repositoryPath,[]),$=(0,t.useCallback)(e=>N.current.get(e)?.data,[]),z=(0,t.useCallback)(()=>N.current.size,[]),W=(0,t.useCallback)(e=>{w.current=e},[]),V=(0,t.useCallback)(()=>{v.current++},[]),H=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{v.current=Math.max(0,v.current-1),y.current.delete(t)},e);y.current.add(t)},[]),X=(0,t.useCallback)(()=>v.current>0,[]);return(0,t.useEffect)(()=>{let e=y.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:C,edges:_,reconcile:S,updateFeature:M,addPendingFeature:R,removePendingFeature:O,removeFeature:P,restoreFeature:T,addRepository:F,removeRepository:L,replaceRepository:A,getFeatureRepositoryPath:D,getRepositoryData:$,getRepoMapSize:z,setCallbacks:W,beginMutation:V,endMutation:H,isMutating:X}}(e,a,l),_=(0,t.useRef)(c),S=(0,t.useRef)(u);(0,t.useEffect)(()=>{_.current=c,S.current=u},[c,u]);let M=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),R=(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]),O=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${M}|${R}`;t!==O.current&&(O.current=t,h(e,a))},[M,R,e,a,h]);let P=(0,t.useRef)(new Map),{events:T}=(0,H.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=P.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,a=t.get(r.id);void 0!==a&&a!==e.state&&(T.some(t=>t.featureId===e.featureId&&(0,o.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:()=>i.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[R,e,T,i]),function({nodesRef:e,updateFeature:r,isMutating:n,beginMutation:a,endMutation:s}){let{events:i}=(0,H.useAgentEventsContext)(),l=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(l.current>i.length&&(l.current=0),i.length<=l.current)return;let t=i.slice(l.current);for(let{featureId:a,state:s,lifecycle:d}of(l.current=i.length,(0,o.resolveSseEventUpdates)(t)))if(void 0!==s||void 0!==d){let t=`feat-${a}`,o=e.current.find(e=>e.id===t),i=o?o.data.state:void 0;if("deleting"===i||"error"===s&&n()&&"running"===i)continue;r(t,{...void 0!==s&&{state:s},...void 0!==d&&{lifecycle:d}})}},[i,r,n,e]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;a(),r(`feat-${t}`,{state:"running"}),s()};return window.addEventListener("shipit-ai:feature-approved",e),()=>window.removeEventListener("shipit-ai:feature-approved",e)},[r,a,s]);let d=(0,t.useRef)(new Set),c=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(c.current>i.length&&(c.current=0),i.length<=c.current)return;let e=i.slice(c.current);for(let t of(c.current=i.length,e)){if("Feature metadata updated"!==t.message||d.current.has(t.featureId))continue;d.current.add(t.featureId);let e=`feat-${t.featureId}`;V(t.featureId).then(t=>{t&&r(e,{name:t.name,description:t.description})}).catch(()=>{})}},[i,r])}({nodesRef:_,updateFeature:p,isMutating:C,beginMutation:N,endMutation:E}),(0,t.useEffect)(()=>{en.debug("polling enabled (15000ms interval)");let e=setInterval(async()=>{if(!document.hidden&&!C())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();h(t,r)}catch{en.warn("poll fetch failed — will retry next interval")}},15e3);return()=>{en.debug("polling disabled"),clearInterval(e)}},[h,C]);let{handleRetryFeature:F,handleStartFeature:L,handleStopFeature:A,handleArchiveFeature:D,handleUnarchiveFeature:$,handleDeleteFeature:z,handleDeleteRepository:W,handleLayout:eo,handleAddRepository:es}=function({nodesRef:e,edgesRef:a,updateFeature:o,removeFeature:s,restoreFeature:i,addRepositoryToMap:l,removeRepository:d,replaceRepository:c,getRepositoryData:u,getRepoMapSize:h,reconcile:p,beginMutation:f,endMutation:g}){let m=(0,r.useRouter)(),x=(0,er.useSoundAction)("delete"),v=(0,er.useSoundAction)("create"),y=(0,t.useRef)(0),b=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"running"}),(0,K.resumeFeature)(e).then(e=>{e.error?(o(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{o(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>g())},[o,f,g]),w=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"running"}),(0,Y.startFeature)(e).then(e=>{e.error?(o(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{o(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>g())},[o,f,g]),k=(0,t.useCallback)(e=>{f(),(0,Q.stopFeature)(e).then(e=>{e.error?n.toast.error(e.error):n.toast.success("Agent stopped")}).catch(()=>{n.toast.error("Failed to stop agent")}).finally(()=>g())},[f,g]),j=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"archived"}),X(e).then(e=>{e.error?(o(t,{state:"done"}),n.toast.error(e.error)):n.toast.success("Feature archived")}).catch(()=>{o(t,{state:"done"}),n.toast.error("Failed to archive feature")}).finally(()=>g())},[o,f,g]),N=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"done"}),Z(e).then(e=>{e.error?(o(t,{state:"archived"}),n.toast.error(e.error)):n.toast.success("Feature unarchived")}).catch(()=>{o(t,{state:"archived"}),n.toast.error("Failed to unarchive feature")}).finally(()=>g())},[o,f,g]),E=(0,t.useCallback)((t,r,i,l)=>{let d=`feat-${t}`,c=[];if(!0===i){let e=[d];for(;e.length>0;){let t=e.shift();for(let r of a.current)"dependencyEdge"===r.type&&r.source===t&&(c.push(r.target),e.push(r.target))}}let u=new Map;for(let t of[d,...c]){let r=e.current.find(e=>e.id===t);r&&u.set(t,r.data.state)}for(let e of(f(),o(d,{state:"deleting"}),c))o(e,{state:"deleting"});x.play(),m.push("/"),J(t,r,i,l).then(e=>{if(e.error){for(let[e,t]of u)t&&o(e,{state:t});n.toast.error(e.error)}else for(let e of(s(d),c))s(e)}).catch(()=>{for(let[e,t]of u)t&&o(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>g())},[m,x,o,s,f,g,e,a]),C=(0,t.useCallback)(async t=>{let r=`repo-${t}`,o=new Set(a.current.filter(e=>e.source===r).map(e=>e.target)),c=u(r),h=new Map;for(let t of o){let r=e.current.find(e=>e.id===t);r&&h.set(t,{nodeId:t,data:r.data})}let p=()=>{for(let[e,t]of(c&&l(r,c),h))i(e,t)};for(let e of(f(),d(r),o))s(e);try{let e=await et(t);if(!e.success){n.toast.error(e.error??"Failed to remove repository"),p();return}x.play()}catch{n.toast.error("Failed to remove repository"),p()}finally{g()}},[x,d,s,l,i,u,f,g,e,a]);return{handleRetryFeature:b,handleStartFeature:w,handleStopFeature:k,handleArchiveFeature:j,handleUnarchiveFeature:N,handleDeleteFeature:E,handleDeleteRepository:C,handleLayout:(0,t.useCallback)(t=>{let r=B(e.current,a.current,{...I(),direction:t});p(r.nodes,r.edges)},[p,e,a]),handleAddRepository:(0,t.useCallback)(e=>{let t=0===h(),r=`repo-temp-${++y.current}`,a=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return f(),l(r,{name:a,repositoryPath:e,id:r,createdAt:Date.now(),gitInfoStatus:"loading"}),(0,ee.addRepository)({path:e,name:a}).then(e=>{if(e.error){d(r),n.toast.error(e.error);return}let t=e.repository;c(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),v.play()}).catch(()=>{d(r),n.toast.error("Failed to add repository")}).finally(()=>g()),{wasEmpty:t,repoPath:e}},[l,d,c,v,h,f,g])}}({nodesRef:_,edgesRef:S,updateFeature:p,removeFeature:g,restoreFeature:m,addRepositoryToMap:x,removeRepository:v,replaceRepository:y,getRepositoryData:w,getRepoMapSize:k,reconcile:h,beginMutation:N,endMutation:E}),ei=(0,t.useCallback)(e=>{},[]);return{nodes:c,edges:u,onNodesChange:ei,handleConnect:(0,t.useCallback)(e=>{},[]),handleAddRepository:es,handleArchiveFeature:D,handleLayout:eo,handleDeleteFeature:z,handleRetryFeature:F,handleStartFeature:L,handleStopFeature:A,handleUnarchiveFeature:$,handleDeleteRepository:W,createFeatureNode:(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${ea++}`,a={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 f(n,a,"dependencyEdge"===r&&e?e:void 0),n},[f]),showArchived:l,setShowArchived:d,getFeatureRepositoryPath:b,getRepositoryData:w,setCallbacks:j}}],17840)},48246,e=>{"use strict";var t=e.i(96871),r=e.i(86066),n=e.i(92786),a=e.i(16539),o=e.i(33109),s=e.i(53756),i=e.i(91925),l=e.i(3645);let d=(0,l.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);var c=e.i(49228),u=e.i(3214);e.i(98026);var h=e.i(50728),p=e.i(31777),f=e.i(35364);e.i(54793);var g=e.i(7729);e.i(47506);var m=e.i(89313),x=e.i(33814),v=e.i(8986),y=e.i(38573),b=e.i(19933),w=e.i(67669),k=e.i(24042),j=e.i(64970),N=e.i(65530),E=e.i(7311),C=e.i(94365),_=e.i(38227),S=e.i(48109);e.i(81803);var M=e.i(72714),R=e.i(2287),O=e.i(2828),P=e.i(8537),T=e.i(75921),F=e.i(74442),L=e.i(57779),A=e.i(80554),D=e.i(80519);function I({data:e,selected:n}){let{t:s,i18n:i}=(0,h.useTranslation)("web"),l=(0,o.useRouter)(),g="rtl"===i.dir(),m=g?x.Position.Right:x.Position.Left,$=g?x.Position.Left:x.Position.Right,z=(0,T.useFeatureFlags)(),[B,G]=(0,a.useState)(!1),U=e.id?`repo-${e.id}`:`repo-${e.name}`,q=(0,A.useTurnStatus)(U),W=(0,F.useRepositoryActions)(e.repositoryPath?{repositoryId:e.id,repositoryPath:e.repositoryPath}:null),V=(0,P.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),H="Booting"===V.status||"Ready"===V.status,X=(0,a.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",a=["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"),o=new URLSearchParams({repo:e.repositoryPath,prompt:a});l.push(`/create?${o.toString()}`)},[e.repositoryPath,l]);return(0,t.jsxs)("div",{className:(0,p.cn)("group relative",e.onDelete&&e.id&&"ps-10"),style:{direction:g?"rtl":"ltr"},children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:m,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 -start-3 top-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":s("repositoryNode.removeRepository"),"data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),G(!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)(w.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.removeRepository")})]})})}),(0,t.jsx)(R.Dialog,{open:B,onOpenChange:G,children:(0,t.jsxs)(R.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(R.DialogHeader,{children:[(0,t.jsx)(R.DialogTitle,{children:s("repositoryNode.removeConfirmTitle")}),(0,t.jsx)(R.DialogDescription,{children:s("repositoryNode.removeConfirmDescription",{name:e.name})})]}),(0,t.jsxs)(R.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(R.DialogClose,{asChild:!0,children:(0,t.jsx)(f.Button,{variant:"outline",children:s("repositoryNode.cancel")})}),(0,t.jsx)(f.Button,{variant:"destructive",onClick:()=>{G(!1),e.onDelete?.(e.id)},children:s("repositoryNode.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:(0,p.cn)("nodrag bg-card flex w-[26rem] cursor-pointer flex-col overflow-hidden rounded-xl border shadow-sm transition-[border-color,box-shadow] duration-200 dark:bg-neutral-800/80",n&&"border-blue-400 dark:border-amber-500/60"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)(d,{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,p.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ms-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(M.ActionButton,{label:s("repositoryNode.openInIde"),onClick:W.openInIde,loading:W.ideLoading,error:!!W.ideError,icon:v.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.openInIde")})]})}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(M.ActionButton,{label:s("repositoryNode.openInShell"),onClick:W.openInShell,loading:W.shellLoading,error:!!W.shellError,icon:y.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.openInShell")})]})}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(M.ActionButton,{label:s("repositoryNode.openFolder"),onClick:W.openFolder,loading:W.folderLoading,error:!!W.folderError,icon:b.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.openFolder")})]})}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)(f.Button,{variant:"ghost",size:"icon-xs","aria-label":s("repositoryNode.chatWithAgent"),onClick:t=>{t.stopPropagation(),e.id&&l.push(`/repository/${e.id}/chat`)},className:"nodrag relative cursor-pointer text-violet-500 hover:text-violet-600 dark:text-violet-400 dark:hover:text-violet-300",children:[(0,t.jsx)(S.MessageSquare,{className:"h-3 w-3"}),(0,t.jsx)(L.ChatDotIndicator,{status:q})]})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.chatWithAgent")})]})}),(0,t.jsx)(D.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,includeWorktrees:!0,onCreateFromSession:X})]}):null,e.onAdd?(0,t.jsx)("div",{className:"ms-1.5"}):null,e.onAdd?(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{"aria-label":s("repositoryNode.newFeature"),"data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,p.cn)("flex h-6 shrink-0 cursor-pointer items-center gap-0.5 rounded bg-blue-500 px-1.5 text-[11px] font-bold text-white transition-colors hover:bg-blue-600 dark:bg-amber-500 dark:hover:bg-amber-400",e.pulseAdd&&"animate-pulse-cta"),children:[(0,t.jsx)(u.Plus,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"translate-y-px",children:s("repositoryNode.new")})]})}),(0,t.jsx)(O.TooltipContent,{side:"top",children:s("repositoryNode.newFeature")})]})}):null]})]}),e.branch?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-info",className:"text-muted-foreground border-border/50 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)(c.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)(E.ArrowDown,{className:"h-3 w-3 shrink-0"}),s("repositoryNode.behind",{count:e.behindCount})]}):null]})}),e.commitMessage?(0,t.jsx)("div",{"data-testid":"repository-node-commit-info",className:"text-muted-foreground border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(N.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 ms-auto flex shrink-0 items-center gap-1","data-testid":"repository-node-committer",children:[(0,t.jsx)(C.User,{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-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(b.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-border/50 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)(c.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:s("repositoryNode.notAGitRepository")})]})})]}):"ready"!==e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-loading",className:"border-border/50 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)(c.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-border/50 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)(N.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,z.envDeploy&&e.repositoryPath?(0,t.jsx)("div",{"data-testid":"repository-node-dev-preview",className:"border-border/50 border-t px-4 py-2",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[V.deployError?(0,t.jsx)("span",{className:"truncate text-xs text-red-500",children:V.deployError}):H?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"me-0.5 inline-block h-2 w-2 shrink-0 rounded-full bg-green-500"}),V.url?(0,t.jsx)("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",className:"truncate text-green-700 hover:underline dark:text-green-400",children:V.url}):(0,t.jsx)("span",{className:"text-muted-foreground",children:s("repositoryNode.starting")})]}):(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex items-baseline gap-2",children:[(0,t.jsx)("span",{children:s("repositoryNode.run")}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-[10px]",children:s("repositoryNode.startLocalEnvironment")})]}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:(0,p.cn)("ms-auto flex items-center",!H&&!V.deployError&&"[&_button]:text-green-600 [&_button]:hover:text-green-700 dark:[&_button]:text-green-400 dark:[&_button]:hover:text-green-300"),children:(0,t.jsx)(M.ActionButton,{label:s(V.deployError?"repositoryNode.retry":H?"repositoryNode.stopDevServer":"repositoryNode.startDevServer"),onClick:H?V.stop:V.deploy,loading:V.deployLoading||V.stopLoading,error:!1,icon:V.deployError?_.RotateCcw:H?j.Square:k.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s(H?"repositoryNode.stopDevServer":"repositoryNode.startDevServer")})]})})]})}):null]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:$,isConnectable:!e.showHandles,className:"opacity-0!",style:{top:70}}):null]})}function $(e){let[n]=(0,x.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 z={x:30,y:30,zoom:.85};function B({nodes:e,edges:n,selectedFeatureId:o,selectedRepository:s,defaultViewport:i,onNodesChange:l,onAddFeature:d,onConnect:c,onNodeClick:x,onPaneClick:v,onCanvasDrag:y,onMoveEnd:b,toolbar:w,emptyState:k}){let{t:j}=(0,h.useTranslation)("web"),N=(0,a.useMemo)(()=>({featureNode:m.FeatureNode,repositoryNode:I}),[]),E=(0,a.useMemo)(()=>({dependencyEdge:$}),[]),C=(0,a.useMemo)(()=>{let t=null!=o,r=null!=s&&(null!=s.id||null!=s.path);return t||r?e.map(e=>{if(t&&"featureNode"===e.type&&e.data.featureId===o)return{...e,selected:!0};if(r&&"repositoryNode"===e.type){let t=e.data,r=null!=s.id&&(e.id===s.id||t.id===s.id),n=null!=s.path&&t.repositoryPath===s.path;if(r||n)return{...e,selected:!0}}return e}):e},[e,o,s]),_=0===e.length,[S,M]=(0,a.useState)(_),[R,O]=(0,a.useState)(!1),P=(0,a.useRef)(_);(0,a.useEffect)(()=>{if(P.current&&!_){O(!0);let e=setTimeout(()=>{M(!1),O(!1)},300);return P.current=_,()=>clearTimeout(e)}!P.current&&_&&M(!0),P.current=_},[_]);let T=_&&!k?(0,t.jsx)(g.EmptyState,{title:j("canvas.noFeatures"),description:j("canvas.noFeaturesDescription"),action:(0,t.jsxs)(f.Button,{onClick:d,children:[(0,t.jsx)(u.Plus,{className:"me-2 h-4 w-4"}),j("canvas.newFeature")]})}):null,F=k??T;return(0,t.jsxs)("div",{"data-testid":_?"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:C,edges:n,nodeTypes:N,edgeTypes:E,onConnect:c,onNodesChange:l,onNodeClick:x,onPaneClick:v,onMoveStart:y,onMoveEnd:b,defaultViewport:i??z,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},className:"[&_.react-flow__pane]:!cursor-default",children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!_&&w?(0,t.jsx)(r.Panel,{position:"top-right",className:"!me-3 !mt-3",children:w}):null]}),S&&F?(0,t.jsx)("div",{className:(0,p.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",R?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto h-full w-full",children:F})}):null]})}var G=e.i(87889);let U=(0,l.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),q=(0,l.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),W=(0,l.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),V=(0,l.default)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);function H({showArchived:e,onToggleArchived:n,onResetViewport:o}){let{t:s}=(0,h.useTranslation)("web"),{zoomIn:i,zoomOut:l,fitView:d,setViewport:c}=(0,r.useReactFlow)(),u=(0,a.useCallback)(()=>{i({duration:200})},[i]),p=(0,a.useCallback)(()=>{l({duration:200})},[l]),f=(0,a.useCallback)(()=>{d({duration:400,padding:.3})},[d]),g=(0,a.useCallback)(()=>{o&&c(o(),{duration:400})},[o,c]);return(0,t.jsxs)("div",{className:"bg-background flex items-center gap-1 rounded-xl border px-2 py-1.5 shadow-md dark:bg-neutral-900",children:[(0,t.jsx)(X,{onClick:n,title:s(e?"canvas.hideArchived":"canvas.showArchived"),active:e,label:s(e?"canvas.hideArchivedLabel":"canvas.showArchivedLabel"),children:e?(0,t.jsx)(G.Eye,{className:"h-4 w-4"}):(0,t.jsx)(U,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"bg-border mx-1 h-5 w-px"}),(0,t.jsx)(X,{onClick:p,title:s("canvas.zoomOut"),children:(0,t.jsx)(W,{className:"h-4 w-4"})}),(0,t.jsx)(X,{onClick:u,title:s("canvas.zoomIn"),children:(0,t.jsx)(q,{className:"h-4 w-4"})}),(0,t.jsx)(X,{onClick:f,title:s("canvas.fitView"),children:(0,t.jsx)(V,{className:"h-4 w-4"})}),o?(0,t.jsx)(X,{onClick:g,title:s("canvas.resetView"),children:(0,t.jsx)(_.RotateCcw,{className:"h-4 w-4"})}):null]})}function X({children:e,onClick:r,title:n,label:a,active:o}){return(0,t.jsxs)("button",{type:"button",onClick:r,"aria-label":n,title:n,className:(0,p.cn)("inline-flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium transition-colors","hover:bg-accent hover:text-accent-foreground",o?"text-primary bg-primary/10":"text-muted-foreground"),children:[e,a?(0,t.jsx)("span",{children:a}):null]})}var J=e.i(83428),K=e.i(60253);function Y({actions:e,className:r,style:n}){let{t:o}=(0,h.useTranslation)("web"),[s,i]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(s)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&i(!1)}},[s]),(0,t.jsxs)(t.Fragment,{children:[s?(0,t.jsx)("div",{"data-testid":"fab-overlay",className:"fixed inset-0 z-40",onClick:()=>i(!1),"aria-hidden":"true"}):null,(0,t.jsxs)("div",{"data-testid":"floating-action-button",className:(0,p.cn)("relative z-50",r),style:n,children:[(0,t.jsx)("div",{className:(0,p.cn)("absolute start-0 bottom-[calc(100%+24px)] flex flex-col items-start gap-2",!s&&"pointer-events-none"),"data-testid":"fab-actions",children:e.map((r,n)=>{let a=(e.length-1-n)*50;return(0,t.jsxs)("button",{"data-testid":`fab-action-${r.id}`,"aria-label":r.label,disabled:r.disabled??r.loading,className:(0,p.cn)("flex h-10 items-center gap-2.5 rounded-full px-4","bg-background text-foreground shadow-md","border-border border","hover:bg-accent hover:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50","text-sm font-medium whitespace-nowrap",s?"translate-y-0 opacity-100":"pointer-events-none translate-y-0 opacity-0"),style:{transition:`opacity ${s?250:120}ms ease-out ${s?a:0}ms, transform ${s?250:120}ms ease-out ${s?a:0}ms`},onClick:()=>{r.onClick(),i(!1)},children:[(0,t.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:r.loading?(0,t.jsx)(J.Loader2,{className:"h-4 w-4 animate-spin"}):r.icon}),(0,t.jsx)("span",{children:r.label})]},r.id)})}),(0,t.jsxs)(f.Button,{size:"icon","data-testid":"fab-trigger","aria-label":o(s?"fab.closeActions":"fab.createNew"),className:(0,p.cn)("relative h-14 w-14 rounded-full shadow-lg","bg-indigo-500 text-white hover:bg-indigo-400 dark:bg-indigo-500 dark:hover:bg-indigo-400","transition-all duration-200 hover:scale-105 hover:shadow-xl active:scale-95"),onClick:()=>i(e=>!e),children:[(0,t.jsx)(u.Plus,{className:(0,p.cn)("absolute h-7 w-7 stroke-[2.5] transition-all",s?"scale-0 rotate-90 opacity-0":"scale-100 rotate-0 opacity-100"),style:{transitionDuration:"250ms"}}),(0,t.jsx)(K.X,{className:(0,p.cn)("absolute h-6 w-6 stroke-[2.5] transition-all",s?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-90 opacity-0"),style:{transitionDuration:"250ms"}})]})]})]})}var Q=e.i(5147),Z=e.i(8361),ee=e.i(30153);let et="shipit-ai-canvas-viewport",er={x:30,y:30,zoom:.85};var en=e.i(57638),ea=e.i(38373),eo=e.i(33548),es=e.i(23925),ei=e.i(35e3),el=e.i(79687),ed=e.i(99105),ec=e.i(30702),eu=e.i(78521);e.i(13322);var eh=e.i(61201),ep=e.i(96976);let ef=(0,ep.createServerReference)("00d2a98931c51595fa20c0051c27f5fdd0da2ae7a3",ep.callServer,void 0,ep.findSourceMapURL,"isAgentSetupComplete"),eg=(0,ep.createServerReference)("00eb4b01ab9d18db96b86d71b08195efe3b6612068",ep.callServer,void 0,ep.findSourceMapURL,"checkAgentAuth"),em=(0,ep.createServerReference)("00282274c6a78fafd3c3fbd3a77086d0e3a839292c",ep.callServer,void 0,ep.findSourceMapURL,"checkToolStatus");var ex=e.i(11345),ev=e.i(58481),ey=e.i(97944),eb=e.i(69967),ew=e.i(86782),ek=e.i(29847);let ej=["select-agent","select-model"];function eN({onComplete:e,className:r}){let{t:n}=(0,h.useTranslation)("web"),[o,s]=(0,a.useState)([]),[i,l]=(0,a.useState)(!0),[d,c]=(0,a.useState)("select-agent"),[u,f]=(0,a.useState)(null),[g,m]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!0),w=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{(0,ey.getAllAgentModels)().then(s).finally(()=>l(!1))},[]);let k=u?o.find(e=>e.agentType===u):null,j=(0,a.useCallback)((e,t)=>{v(!0),b(!1),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{t?.(),c(e),requestAnimationFrame(()=>{b(!0),v(!1)})},150)},[]);(0,a.useEffect)(()=>()=>{w.current&&clearTimeout(w.current)},[]);let N=(0,a.useCallback)(async(t,r)=>{m(!0);try{await (0,eb.updateAgentAndModel)(t,r),b(!1),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{e()},200)}catch{m(!1)}},[e]),E=(0,a.useCallback)(e=>{let t=o.find(t=>t.agentType===e);t&&t.models.length>0?j("select-model",()=>{f(e)}):N(e,null)},[o,j,N]),C=(0,a.useCallback)(e=>{u&&N(u,e)},[u,N]),_=(0,a.useCallback)(()=>{"select-model"===d&&j("select-agent",()=>{f(null)})},[d,j]);if(i)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,p.cn)("flex flex-col items-center justify-center gap-4",r),children:[(0,t.jsx)(J.Loader2,{className:"text-muted-foreground h-5 w-5 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:n("welcome.loadingAgents")})]});let S=ej.indexOf(d),M=n("select-agent"===d?"welcome.chooseAgent":"welcome.pickModel"),R="select-agent"===d?n("welcome.selectAgentSubtitle"):k?n("welcome.chooseModelSubtitle",{label:k.label}):"";return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,p.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:ej.map((e,r)=>(0,t.jsx)("div",{className:(0,p.cn)("h-[3px] flex-1 rounded-full transition-colors duration-300",r<=S?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,p.cn)("flex w-full flex-col items-center transition-opacity duration-200",y&&!x?"opacity-100":"opacity-0"),children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:M}),(0,t.jsx)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:R}),"select-agent"===d&&(0,t.jsxs)("div",{"data-testid":"gh-cli-notice",className:"mt-5 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-900 dark:bg-amber-950/40",children:[(0,t.jsx)(ev.AlertTriangle,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500"}),(0,t.jsxs)("p",{className:"text-sm leading-relaxed text-amber-800 dark:text-amber-300",children:[(0,t.jsx)("span",{className:"font-medium",children:n("welcome.ghCliRequired")})," ",n("welcome.ghCliRequiredText")," ",(0,t.jsx)("a",{href:"https://cli.github.com/",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-amber-900 dark:hover:text-amber-200",children:n("welcome.installHere")}),"."]})]}),(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,ew.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:g,"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:()=>E(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&&k?(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:g,className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 self-start text-sm transition-colors",onClick:_,children:[(0,t.jsx)(ex.ChevronLeft,{className:"h-4 w-4"}),n("welcome.back")]}),(0,t.jsx)("div",{className:"grid w-full gap-3",style:{gridTemplateColumns:`repeat(${Math.min(k.models.length,3)}, minmax(0, 1fr))`},children:k.models.map(e=>{let r=(0,ek.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:g,"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:()=>C(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 eE=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function eC({onRepositorySelect:e,className:r}){let{t:n}=(0,h.useTranslation)("web"),[o,s]=(0,a.useState)(!1),[i,l]=(0,a.useState)(!1),[d,c]=(0,a.useState)(!1),[u,f]=(0,a.useState)(null),[g,m]=(0,a.useState)(null),[x,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),{reactFileManager:j}=(0,T.useFeatureFlags)();async function N(){if(!i){if(j)return void c(!0);l(!0);try{let t=await (0,eu.pickFolder)();t&&e?.(t)}catch{c(!0)}finally{l(!1)}}}(0,a.useEffect)(()=>{ef().then(e=>{f(e)})},[]),(0,a.useEffect)(()=>{u&&(eg().then(m),em().then(k))},[u]);let E=(0,a.useCallback)(async()=>{await navigator.clipboard.writeText(eE.join("\n")),s(!0),setTimeout(()=>s(!1),2e3)},[]),C=(0,a.useCallback)(()=>{f(!0)},[]),_=(0,a.useCallback)(()=>{m(null),eg().then(m)},[]);return null===u?null:(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,p.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:n("emptyState.addProject")}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:[n("emptyState.addProjectDescription"),(0,t.jsx)("br",{}),n("emptyState.addProjectDescriptionLine2")]}),(0,t.jsxs)("div",{className:"mt-8 flex w-full flex-col gap-3",children:[(0,t.jsx)(e_,{status:g,onRetry:_}),(0,t.jsx)(eS,{label:n("emptyState.git"),status:w?.git??null,missingHint:n("emptyState.gitRequired")}),(0,t.jsx)(eS,{label:n("emptyState.githubCli"),status:w?.gh??null,missingHint:n("emptyState.githubCliRequired")})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:N,disabled:i,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:[i?(0,t.jsx)(J.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(b.FolderOpen,{className:"h-5 w-5"}),n(i?"emptyState.opening":"emptyState.chooseFolder")]}),(0,t.jsx)("p",{className:"text-muted-foreground/60 mt-3 text-center text-sm",children:n("emptyState.folderHint")})]}):(0,t.jsx)(eN,{onComplete:C}),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:()=>v(!x),className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 transition-colors duration-200",children:[(0,t.jsx)(y.Terminal,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-sm",children:n("emptyState.orUseCli")}),(0,t.jsx)(ed.ChevronDown,{className:(0,p.cn)("h-3.5 w-3.5 transition-transform duration-200",x?"":"rotate-180")})]}),x?(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:E,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":n("emptyState.copyCommands"),children:o?(0,t.jsx)(es.Check,{className:"h-3.5 w-3.5 text-emerald-400"}):(0,t.jsx)(eo.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("div",{className:"space-y-1",children:eE.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)(eh.ReactFileManagerDialog,{open:d,onOpenChange:e=>{e||c(!1)},onSelect:function(t){t&&e?.(t),c(!1)}})]})}function e_({status:e,onRetry:r}){let{t:n}=(0,h.useTranslation)("web");return e?e.installed&&e.authenticated?(0,t.jsx)(eM,{icon:(0,t.jsx)(ei.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),children:(0,t.jsx)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:n("emptyState.ready",{label:e.label})})}):e.installed?(0,t.jsxs)(eM,{icon:(0,t.jsx)(el.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsx)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:n("emptyState.needsAuth",{label:e.label})}),e.authCommand?(0,t.jsx)(eR,{command: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 text-xs font-medium text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[(0,t.jsx)(y.Terminal,{className:"h-3 w-3"}),n("emptyState.open",{label: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:n("emptyState.reCheck")})]})]}):(0,t.jsxs)(eM,{icon:(0,t.jsx)(el.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsx)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:n("emptyState.notInstalled",{label:e.label})}),e.installCommand?(0,t.jsx)(eR,{command:e.installCommand}):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:n("emptyState.reCheck")})]}):(0,t.jsx)(eM,{icon:(0,t.jsx)(J.Loader2,{className:"text-muted-foreground/50 h-4 w-4 animate-spin"}),children:(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:n("emptyState.checkingSetup")})})}function eS({label:e,status:r,missingHint:n}){let{t:a}=(0,h.useTranslation)("web");return r?r.installed?(0,t.jsx)(eM,{icon:(0,t.jsx)(ei.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),children:(0,t.jsxs)("span",{className:"flex items-baseline gap-2",children:[(0,t.jsx)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:a("emptyState.ready",{label:e})}),r.version?(0,t.jsxs)("span",{className:"text-muted-foreground/40 text-xs",children:["v",r.version]}):null]})}):(0,t.jsxs)(eM,{icon:(0,t.jsx)(el.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsx)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:a("emptyState.notFound",{label:e})}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:n}),r.installCommand?(0,t.jsx)(eR,{command:r.installCommand}):null,r.installUrl?(0,t.jsxs)("a",{href:r.installUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[a("emptyState.docs")," ",(0,t.jsx)(ec.ExternalLink,{className:"h-3 w-3"})]}):null]}):(0,t.jsx)(eM,{icon:(0,t.jsx)(J.Loader2,{className:"text-muted-foreground/50 h-4 w-4 animate-spin"}),children:(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:a("emptyState.checking",{label:e})})})}function eM({icon:e,children:r}){return(0,t.jsxs)("div",{className:"animate-in fade-in flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"mt-0.5 shrink-0",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:r})]})}function eR({command:e}){let[r,n]=(0,a.useState)(!1);return(0,t.jsxs)("button",{type:"button",onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},className:"group/cmd flex cursor-pointer items-center justify-between gap-2 rounded-md bg-zinc-100 py-1 ps-2.5 pe-2 text-start transition-colors hover:bg-zinc-200 dark:bg-zinc-800 dark:hover:bg-zinc-700",children:[(0,t.jsx)("code",{className:"min-w-0 truncate text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-300",children:e}),r?(0,t.jsx)(es.Check,{className:"h-3 w-3 shrink-0 text-emerald-500"}):(0,t.jsx)(eo.Copy,{className:"h-3 w-3 shrink-0 text-zinc-400 opacity-0 transition-opacity group-hover/cmd:opacity-100"})]})}var eO=e.i(17840);let eP={maxZoom:1,padding:.5,duration:500};function eT({initialNodes:e,initialEdges:n}){let l,u,p,f,g,m,{t:x}=(0,h.useTranslation)("web"),v=(0,o.useRouter)(),y=(0,o.usePathname)(),b=(l=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),l?.[1]??null),w=(u=(0,o.usePathname)(),p=(0,o.useSearchParams)(),f=u.match(/^\/repository\/([^/]+)/),{id:f?.[1]??null,path:u.startsWith("/create")?p.get("repo"):null}),k=(0,Z.useSoundAction)("click"),{guardedNavigate:j}=(0,ee.useDrawerCloseGuard)(),{fitView:N}=(0,r.useReactFlow)(),E=(0,a.useRef)(null),{defaultViewport:C,onMoveEnd:_,resetViewport:S}=(g=(0,a.useRef)(function(){try{let e=localStorage.getItem(et);if(null==e)return er;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:er}catch{return er}}()).current,m=(0,a.useRef)(null),(0,a.useEffect)(()=>()=>{null!=m.current&&clearTimeout(m.current)},[]),{defaultViewport:g,onMoveEnd:(0,a.useCallback)(e=>{null!=m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{try{localStorage.setItem(et,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,a.useCallback)(()=>{try{localStorage.removeItem(et)}catch{}return er},[])}),{nodes:M,edges:R,onNodesChange:O,handleConnect:P,handleAddRepository:F,handleArchiveFeature:L,handleDeleteFeature:A,handleRetryFeature:D,handleStartFeature:I,handleStopFeature:$,handleUnarchiveFeature:z,handleDeleteRepository:G,createFeatureNode:U,showArchived:q,setShowArchived:W,setCallbacks:V}=(0,eO.useControlCenterState)(e,n),{setFeatures:X,setHasRepositories:J}=(0,Q.useSidebarFeaturesContext)(),K=(0,a.useMemo)(()=>M.filter(e=>"featureNode"===e.type),[M]),Y=(0,a.useMemo)(()=>K.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}:${t.repositoryPath}`}).sort().join(","),[K]);(0,a.useEffect)(()=>{X(K.map(e=>{let t=e.data,r=(0,Q.mapNodeStateToSidebarStatus)(t.state);if(!r)return null;let n=t.repositoryPath??"";return{featureId:t.featureId,name:t.name,status:r,repositoryPath:n,repositoryName:t.repositoryName??n.split("/").filter(Boolean).pop()??n,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}}).filter(Boolean))},[Y,K,X]);let en=(0,a.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"]')&&j(()=>{k.play(),v.push(`/feature/${r.featureId}`)})}},[v,k,j]),ea=(0,a.useCallback)(()=>{k.play(),v.push("/create")},[v,k]),eo=(0,a.useCallback)(e=>{k.play();let t=M.find(t=>t.id===e),r=t?.data?.repositoryPath;r?v.push(`/create?repo=${encodeURIComponent(r)}`):v.push("/create")},[M,v,k]),es=(0,a.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=R.find(t=>t.target===e),n=r?M.find(e=>e.id===r.source):null,a=n?.data?.repositoryPath;k.play();let o=new URLSearchParams;a&&o.set("repo",a),o.set("parent",t),v.push(`/create?${o.toString()}`)},[M,R,v,k]),ei=(0,a.useCallback)(e=>{let t=M.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&j(()=>v.push(`/repository/${e.id}`))}},[M,v,j]),el=(0,a.useCallback)(()=>{"/"!==y&&j(()=>v.push("/"))},[v,y,j]),ed=(0,a.useCallback)(e=>{setTimeout(()=>{N(eP),E.current=setTimeout(()=>{j(()=>v.push(`/create?repo=${encodeURIComponent(e)}`))},600)},0)},[N,j,v]),ec=(0,a.useCallback)(e=>{let{wasEmpty:t,repoPath:r}=F(e);t&&ed(r)},[F,ed]);(0,a.useEffect)(()=>{let e=e=>{ec(e.detail.path)};return window.addEventListener("shipit-ai:add-repository",e),()=>{window.removeEventListener("shipit-ai:add-repository",e),null!=E.current&&clearTimeout(E.current)}},[ec]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void U(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=M.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);U(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shipit-ai:feature-created",e),()=>window.removeEventListener("shipit-ai:feature-created",e)},[M,U]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n,closePr:a}=e.detail;A(t,r,n,a)};return window.addEventListener("shipit-ai:feature-delete-requested",e),()=>window.removeEventListener("shipit-ai:feature-delete-requested",e)},[A]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;L(t)};return window.addEventListener("shipit-ai:feature-archive-requested",e),()=>window.removeEventListener("shipit-ai:feature-archive-requested",e)},[L]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;z(t)};return window.addEventListener("shipit-ai:feature-unarchive-requested",e),()=>window.removeEventListener("shipit-ai:feature-unarchive-requested",e)},[z]),(0,a.useEffect)(()=>{V({onNodeAction:es,onFeatureDelete:A,onRetryFeature:D,onStartFeature:I,onStopFeature:$,onArchiveFeature:L,onUnarchiveFeature:z,onRepositoryAdd:eo,onRepositoryClick:ei,onRepositoryDelete:G})},[V,es,L,A,D,I,$,z,eo,ei,G]);let eu=(0,a.useCallback)((e,t)=>{_(t)},[_]),eh=M.some(e=>"repositoryNode"===e.type);(0,a.useEffect)(()=>{J(eh)},[eh,J]);let[ep,ef]=(0,a.useState)(eh),eg=(0,a.useRef)(null);(0,a.useEffect)(()=>(eh?(eg.current&&(clearTimeout(eg.current),eg.current=null),ef(!0)):ep&&(S(),eg.current=setTimeout(()=>{ef(!1),eg.current=null},500)),()=>{eg.current&&clearTimeout(eg.current)}),[eh,ep,S]);let em=y.startsWith("/create"),ex=(0,a.useMemo)(()=>{let e=M.filter(e=>"repositoryNode"===e.type),t=M.some(e=>"featureNode"===e.type);return 1!==e.length||t||em?M:M.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[M,em]),ev=(0,a.useCallback)(()=>{window.dispatchEvent(new CustomEvent("shipit-ai:pick-folder"))},[]),ey=(0,T.useFeatureFlags)(),eb=(0,a.useMemo)(()=>{let e=[{id:"new-feature",label:x("fab.newFeature"),icon:(0,t.jsx)(s.Sparkles,{className:"h-4 w-4"}),onClick:()=>{k.play(),j(()=>v.push("/create"))}},{id:"add-local-repo",label:x("fab.localFolder"),icon:(0,t.jsx)(i.FolderPlus,{className:"h-4 w-4"}),onClick:ev}];return ey.adoptBranch&&e.push({id:"adopt-branch",label:x("fab.adoptBranch"),icon:(0,t.jsx)(c.GitBranch,{className:"h-4 w-4"}),onClick:()=>{j(()=>v.push("/adopt"))}}),ey.githubImport&&e.push({id:"add-github-repo",label:x("fab.fromGithub"),icon:(0,t.jsx)(d,{className:"h-4 w-4"}),onClick:()=>{window.dispatchEvent(new CustomEvent("shipit-ai:open-github-import"))}}),e},[x,k,j,v,ev,ey.adoptBranch,ey.githubImport]),ew=(0,t.jsx)(H,{showArchived:q,onToggleArchived:()=>W(!q),onResetViewport:S});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{nodes:ep?ex:[],edges:ep?R:[],selectedFeatureId:b,selectedRepository:w,defaultViewport:C,onNodesChange:O,onConnect:P,onAddFeature:ea,onNodeClick:en,onPaneClick:el,onMoveEnd:eu,toolbar:ew,emptyState:(0,t.jsx)(eC,{onRepositorySelect:ec})}),ep?(0,t.jsx)(eF,{actions:eb}):null]})}function eF({actions:e}){let{state:r}=(0,en.useSidebar)(),{i18n:n}=(0,h.useTranslation)("web"),{swapPosition:a}=(0,ea.useFabLayout)(),o="rtl"===n.dir();if(a)return(0,t.jsx)(Y,{actions:e,className:"!fixed bottom-6",style:o?{left:"calc(var(--sidebar-width-icon) + 32px)",transition:"left 200ms ease-in-out"}:{right:"32px",transition:"right 200ms ease-in-out"}});let s="expanded"===r?"calc(var(--sidebar-width) + 32px)":"calc(var(--sidebar-width-icon) + 32px)";return(0,t.jsx)(Y,{actions:e,className:"!fixed bottom-6",style:o?{right:s,transition:"right 200ms ease-in-out"}:{left:s,transition:"left 200ms ease-in-out"}})}e.s(["ControlCenter",0,function({initialNodes:e,initialEdges:a,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(n.SessionsProvider,{children:(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(eT,{initialNodes:e,initialEdges:a})})}),(0,t.jsx)("div",{children:o},"drawer")]})}],48246)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(16539),r=e.i(33109),n=e.i(60112),a=e.i(18354),o=e.i(99045);e.i(98026);var s=e.i(50728),i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=i((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?r(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n},o=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function o(e,t,r,n){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}return a+"\x01"+o+"\x01"+(void 0===n?"\0":n)}function s(e,t){return o(e,t.v,t.w,t.name)}t.exports=class{constructor(e){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(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(a){var o=r.parent(a);return void 0===o||t.hasNode(o)?(n[a]=o,o):o in n?n[o]:e(o)}(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,a){return n.length>1?r.setEdge(e,a,t):r.setEdge(e,a),a}),this}setEdge(){var e,t,n,a,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&&(a=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(a=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=a),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?a:this._defaultEdgeLabelFn(e,t,n);var d=function(e,t,r,n){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}var i={v:a,w:o};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]):o(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]):o(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var a=1==arguments.length?s(this._isDirected,arguments[0]):o(this._isDirected,e,t,r),i=this._edgeObjs[a];return i&&(e=i.v,t=i.w,delete this._edgeLabels[a],delete this._edgeObjs[a],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][a],delete this._out[e][a],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:o(),version:s()}}),l=n((e,t)=>{var r=o();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),a={v:e};return void 0!==r&&(a.value=r),void 0!==n&&(a.parent=n),a}),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,a){return function(e,t,r,n){var a={},o=!0,s=0,i=e.nodes(),l=function(e){var t=r(e);a[e.v].distance+t<a[e.w].distance&&(a[e.w]={distance:a[e.v].distance+t,predecessor:e.v},o=!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){a[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(o=!1,s++,d(),o);u++);if(s===c-1&&(o=!1,d(),o))throw Error("The graph contains a negative weight cycle");return a}(e,String(t),n||r,a||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(a){t=[],function n(a){Object.hasOwn(r,a)||(r[a]=!0,t.push(a),e.successors(a).forEach(n),e.predecessors(a).forEach(n))}(a),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){a(this,"_arr",[]),a(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,a=n.length;return r[e]=a,n.push({key:e,priority:t}),this._decrease(a),!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,a=e;r<t.length&&(a=t[r].priority<t[a].priority?r:a,n<t.length&&(a=t[n].priority<t[a].priority?n:a),a!==e&&(this._swap(e,a),this._heapify(a)))}_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,a=r[e],o=r[t];r[e]=o,r[t]=a,n[o.key]=e,n[a.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,a,o){return function(e,t,n,a){var o,s,i={},l=new r,d=function(e){var t=e.v!==o?e.v:e.w,r=i[t],a=n(e),d=s.distance+a;if(a<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+a);d<r.distance&&(r.distance=d,r.predecessor=o,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[o=l.removeMin()]).distance!==1/0;)a(o).forEach(d);return i}(e,String(t),a||n,o||function(t){return e.outEdges(t)})};var n=()=>1}),p=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(a,o){return a[o]=r(e,o,t,n),a},{})}}),f=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=[],a=r;a!==t;)n.push(a),a=e[a].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},a=[];return e.nodes().forEach(function(o){Object.hasOwn(n,o)||function o(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)):(o(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)a.push(d)}}(o)}),a}}),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])})}}),x=n((e,t)=>{t.exports=function(e,t,n){var a,o,s,i,l;return a=e,o=t||r,s=n||function(t){return e.outEdges(t)},i={},(l=a.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=o(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 a=n[e],o=t[r],s=n[r],i=a.distance+o.distance;i<s.distance&&(s.distance=i,s.predecessor=o.predecessor)})})}),i};var r=()=>1}),v=n((e,t)=>{function r(e){var t={},r={},a=[];if(e.sinks().forEach(function o(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(o),delete r[s],a.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return a}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),y=n((e,t)=>{var r=v();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,a){Array.isArray(t)||(t=[t]);var o=(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);a=function e(t,r,n,a,o,s,i){return Object.hasOwn(a,r)||(a[r]=!0,n||(i=s(i,r)),o(r).forEach(function(r){i=e(t,r,n,a,o,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,o,n,a)}),a}}),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},[])}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),j=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),N=n((e,t)=>{var r=o(),n=u();t.exports=function(e,t){var a,o=new r,s={},i=new n;function l(e){var r=e.v===a?e.w:e.v,n=i.priority(r);if(void 0!==n){var o=t(e);o<n&&(s[r]=a,i.decrease(r,o))}}if(0===e.nodeCount())return o;e.nodes().forEach(function(e){i.add(e,1/0),o.setNode(e)}),i.decrease(e.nodes()[0],0);for(var d=!1;i.size()>0;){if(Object.hasOwn(s,a=i.removeMin()))o.setEdge(a,s[a]);else{if(d)throw Error("Input graph is not connected: "+e);d=!0}e.nodeEdges(a).forEach(l)}return o}}),E=n((e,t)=>{var r=h(),n=d();t.exports=function(e,t,a,o){return function(e,t,a,o){if(void 0===a)return r(e,t,a,o);for(var s=!1,i=e.nodes(),l=0;l<i.length;l++){for(var d=o(i[l]),c=0;c<d.length;c++){var u=d[c],h=u.v===i[l]?u.v:u.w,p=h===u.v?u.w:u.v;0>a({v:h,w:p})&&(s=!0)}if(s)return n(e,t,a,o)}return r(e,t,a,o)}(e,t,a,o||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:d(),components:c(),dijkstra:h(),dijkstraAll:p(),extractPath:f(),findCycles:m(),floydWarshall:x(),isAcyclic:y(),postorder:k(),preorder:j(),prim:N(),shortestPaths:E(),reduce:b(),tarjan:g(),topsort:v()}}),_=i();t.exports={Graph:_.Graph,json:l(),alg:C(),version:_.version}}),d=i((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(", ")+"]"}}}),c=i((e,t)=>{var r=l().Graph,n=d();t.exports=function(e,t){var i,l;let d,c,u,h,p;if(1>=e.nodeCount())return[];let f=(i=e,l=t||a,d=new r,c=0,u=0,i.nodes().forEach(e=>{d.setNode(e,{v:e,in:0,out:0})}),i.edges().forEach(e=>{let t=d.edge(e.v,e.w)||0,r=l(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),p=c+1,d.nodes().forEach(e=>{s(h,p,d.node(e))}),{graph:d,buckets:h,zeroIdx:p});return(function(e,t,r){let n=[],a=t[t.length-1],s=t[0],i;for(;e.nodeCount();){for(;i=s.dequeue();)o(e,t,r,i);for(;i=a.dequeue();)o(e,t,r,i);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(i=t[a].dequeue()){n=n.concat(o(e,t,r,i,!0));break}}}return n})(f.graph,f.buckets,f.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var a=()=>1;function o(e,t,r,n,a){let o=a?[]:void 0;return e.inEdges(n.v).forEach(n=>{let i=e.edge(n),l=e.node(n.v);a&&o.push({v:n.v,w:n.w}),l.out-=i,s(t,r,l)}),e.outEdges(n.v).forEach(n=>{let a=e.edge(n),o=n.w,i=e.node(o);i.in-=a,s(t,r,i)}),e.removeNode(n.v),o}function s(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)}}),u=i((e,t)=>{var r=l().Graph;function n(e,t,r,n){for(var a=n;e.hasNode(a);)a=i(n);return r.dummy=t,e.setNode(a,r),a}t.exports={addBorderNode:function(e,t,r,a){let o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=a),n(e,"border",o,t)},addDummyNode:n,applyWithChunking:a,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(o(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),a=n.rank;void 0!==a&&(t[a][n.order]=r)}),t},intersectRect:function(e,t){let r,n,a=e.x,o=e.y,s=t.x-a,i=t.y-o,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:a+r,y:o+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:o,normalizeRanks:function(e){let t=a(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=a(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let a=e.node(n).rank-t;r[a]||(r[a]=[]),r[a].push(n)});let n=0,o=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%o!=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},a=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+a.weight,minlen:Math.max(n.minlen,a.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:i,zipObject:c};function a(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 a=e.slice(n,n+t);r.push(a)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function o(e){return a(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var s=0;function i(e){return e+""+ ++s}function d(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let a=[];for(let t=e;n(t);t+=r)a.push(t);return a}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),h=i((e,t)=>{var r=c(),n=u().uniqueId;t.exports={run:function(e){var t,a;let o,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(o=[],s={},i={},(a=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,a.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?o.push(t):e(t.w)}),delete s[t])}),o)).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)}})}}}),p=i((e,t)=>{var r=u();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,a,o,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),o=0,++i;i<d;++o,++i)u.points=[],a={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",a,"_d"),i===h&&(a.width=u.width,a.height=u.height,a.dummy="edge-label",a.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===o&&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,a;for(e.setEdge(r.edgeObj,n);r.dummy;)a=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=a,r=e.node(t)})}}}),f=i((e,t)=>{var{applyWithChunking:r}=u();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(a){var o=e.node(a);if(Object.hasOwn(t,a))return o.rank;t[a]=!0;var s=r(Math.min,e.outEdges(a).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),o.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),g=i((e,t)=>{var r=l().Graph,n=f().slack;t.exports=function(e){var t,a,o,s,i=new r({directed:!1}),l=e.nodes()[0],d=e.nodeCount();for(i.setNode(l,{});t=i,a=e,t.nodes().forEach(function e(r){a.nodeEdges(r).forEach(o=>{var s=o.v,i=r===s?o.w:s;t.hasNode(i)||n(a,o)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<d;)o=function(e,t){return t.edges().reduce((r,a)=>{let o=1/0;return e.hasNode(a.v)!==e.hasNode(a.w)&&(o=n(t,a)),o<r[0]?[o,a]:r},[1/0,null])[1]}(i,e),s=i.hasNode(o.v)?n(e,o):-n(e,o),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),m=i((e,t)=>{var r=g(),n=f().slack,a=f().longestPath,o=l().alg.preorder,s=l().alg.postorder,i=u().simplify;function d(e){a(e=i(e));var t,n,o=r(e);for(p(o),c(o,e);t=m(o);)n=x(o,e,t),v(o,e,t,n)}function c(e,t){var r=s(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,a,o,s;return n=e,a=t,o=r,s=n.node(o).parent,void(n.edge(o,s).cutvalue=h(n,a,o))})}function h(e,t,r){var n=e.node(r).parent,a=!0,o=t.edge(r,n),s=0;return o||(a=!1,o=t.edge(n,r)),s=o.weight,t.nodeEdges(r).forEach(o=>{var i=o.v===r,l=i?o.w:o.v;if(l!==n){var d,c,u,h=i===a,p=t.edge(o).weight;if(s+=h?p:-p,d=e,c=r,u=l,d.hasEdge(c,u)){var f=e.edge(r,l).cutvalue;s+=h?-f:f}}}),s}function p(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,a,o){var s=n,i=t.node(a);return r[a]=!0,t.neighbors(a).forEach(o=>{Object.hasOwn(r,o)||(n=e(t,r,n,o,a))}),i.low=s,i.lim=n++,o?i.parent=o:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function x(e,t,r){var a=r.v,o=r.w;t.hasEdge(a,o)||(a=r.w,o=r.v);var s=e.node(a),i=e.node(o),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 v(e,t,r,n){var a,s,i,l,d=r.v,u=r.w;e.removeEdge(d,u),e.setEdge(n.v,n.w,{}),p(e),c(e,t),a=e,s=t,i=a.nodes().find(e=>!s.node(e).parent),(l=(l=o(a,i)).slice(1)).forEach(e=>{var t=a.node(e).parent,r=s.edge(e,t),n=!1;r||(r=s.edge(t,e),n=!0),s.node(e).rank=s.node(t).rank+(n?r.minlen:-r.minlen)})}function y(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=d,d.initLowLimValues=p,d.initCutValues=c,d.calcCutValue=h,d.leaveEdge=m,d.enterEdge=x,d.exchangeEdges=v}),x=i((e,t)=>{var r=f().longestPath,n=g(),a=m();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:a(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":o(e);case"none":}};var o=r}),v=i((e,t)=>{t.exports=function(e){var t;let r,n,a=(r={},n=0,(t=e).children().forEach(function e(a){let o=n;t.children(a).forEach(e),r[a]={low:o,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,o=function(e,t,r,n){let a=[],o=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),l,d;l=r;do a.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;)o.push(l);return{path:a.concat(o.reverse()),lca:d}}(e,a,n.v,n.w),s=o.path,i=o.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]}})}}),y=i((e,t)=>{var r=u();t.exports={run:function(e){var t,n,a;let o=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,a){var o=t.children(r);o&&o.length&&o.forEach(t=>e(t,a+1)),n[r]=a})(e,1)),n),i=Object.values(s),l=r.applyWithChunking(Math.max,i)-1,d=2*l+1;e.graph().nestingRoot=o,e.edges().forEach(t=>e.edge(t).minlen*=d);let c=(a=e).edges().reduce((e,t)=>e+a.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,a,o,s,i,l){let d=t.children(l);if(!d.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:a});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,a,o,s,i,r);let d=t.node(r),h=d.borderTop?d.borderTop:r,p=d.borderBottom?d.borderBottom:r,f=d.borderTop?o:2*o,g=h!==p?1:s-i[l]+1;t.setEdge(c,h,{weight:f,minlen:g,nestingEdge:!0}),t.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,c,{weight:0,minlen:s+i[l]})})(e,o,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)})}}}),b=i((e,t)=>{var r=u();function n(e,t,n,a,o,s){let i=o[t][s-1],l=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);o[t][s]=l,e.setParent(l,a),i&&e.setEdge(i,l,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let a=e.children(r),o=e.node(r);if(a.length&&a.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let t=o.minRank,a=o.maxRank+1;t<a;++t)n(e,"borderLeft","_bl",r,o,t),n(e,"borderRight","_br",r,o,t)}})}}),w=i((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 a(e){e.y=-e.y}function o(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=>a(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(a),Object.hasOwn(r,"y")&&a(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>o(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(o),Object.hasOwn(t,"x")&&o(t)}),r(e))}}}),k=i((e,t)=>{var r=u();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),a=n.map(t=>e.node(t).rank),o=r.applyWithChunking(Math.max,a),s=r.range(o+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}}),j=i((e,t)=>{var r=u().zipObject;t.exports=function(e,t){let n=0;for(let a=1;a<t.length;++a)n+=function(e,t,n){let a=r(n,n.map((e,t)=>t)),o=t.flatMap(t=>e.outEdges(t).map(t=>({pos:a[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 o.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[a-1],t[a]);return n}}),N=i((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),a=e.node(r.v);return{sum:t.sum+n.weight*a.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=i((e,t)=>{var r=u();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))}}),C=i((e,t)=>{var r=u();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 a;let o=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=o.lhs,i=o.rhs.sort((e,t)=>t.i-e.i),l=[],d=0,c=0,u=0;s.sort((a=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:a?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}}),_=i((e,t)=>{var r=N(),n=E(),a=C();t.exports=function e(t,o,s,i){var l,d;let c=t.children(o),u=t.node(o),h=u?u.borderLeft:void 0,p=u?u.borderRight:void 0,f={};h&&(c=c.filter(e=>e!==h&&e!==p));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,a;let o=e(t,r.v,s,i);f[r.v]=o,Object.hasOwn(o,"barycenter")&&(n=r,a=o,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+a.barycenter*a.weight)/(n.weight+a.weight),n.weight+=a.weight):(n.barycenter=a.barycenter,n.weight=a.weight))}});let m=n(g,s);l=m,d=f,l.forEach(e=>{e.vs=e.vs.flatMap(e=>d[e]?d[e].vs:e)});let x=a(m,i);if(h&&(x.vs=[h,x.vs,p].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(p)[0]);Object.hasOwn(x,"barycenter")||(x.barycenter=0,x.weight=0),x.barycenter=(x.barycenter*x.weight+e.order+r.order)/(x.weight+2),x.weight+=2}return x}}),S=i((e,t)=>{var r=l().Graph,n=u();t.exports=function(e,t,a,o){o||(o=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 o.forEach(r=>{let n=e.node(r),o=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,o||s),e[a](r).forEach(t=>{let n=t.v===r?t.w:t.v,a=i.edge(n,r),o=void 0!==a?a.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),M=i((e,t)=>{t.exports=function(e,t,r){let n={},a;r.forEach(r=>{let o=e.parent(r),s,i;for(;o;){if((s=e.parent(o))?(i=n[s],n[s]=o):(i=a,a=o),i&&i!==o)return void t.setEdge(i,o);o=s}})}}),R=i((e,t)=>{var r=k(),n=j(),a=_(),o=S(),s=M(),i=l().Graph,d=u();function c(e,t,r){let n=new Map,a=(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&&a(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&a(e,t)}return t.map(function(t){return o(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,o={}){if("function"==typeof o.customOrder)return void o.customOrder(t,e);let l=d.maxRank(t),u=c(t,d.range(1,l+1),"inEdges"),p=c(t,d.range(l-1,-1,-1),"outEdges"),f=r(t);if(h(t,f),o.disableOptimalOrderHeuristic)return;let g=1/0,m,x=o.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new i;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let o=e.graph().root,i=a(e,o,n,t);i.vs.forEach((t,r)=>e.node(t).order=r),s(e,n,i.vs)})})(e%2?u:p,e%4>=2,x),f=d.buildLayerMatrix(t);let o=n(t,f);o<g?(r=0,m=Object.assign({},f),g=o):o===g&&(m=structuredClone(f))}h(t,m)}}),O=i((e,t)=>{var r=l().Graph,n=u();function a(e,t){let r={};return t.length&&t.reduce(function(t,n){let a=0,o=0,i=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:i;(c||t===l)&&(n.slice(o,d+1).forEach(t=>{e.predecessors(t).forEach(n=>{let o=e.node(n),i=o.order;(i<a||u<i)&&!(o.dummy&&e.node(t).dummy)&&s(r,n,t)})}),o=d+1,a=u)}),n}),r}function o(e,t){let r={};function a(t,a,o,i,l){let d;n.range(a,o).forEach(n=>{d=t[n],e.node(d).dummy&&e.predecessors(d).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<i||n.order>l)&&s(r,t,d)})})}return t.length&&t.reduce(function(t,r){let n=-1,o,s=0;return r.forEach((i,l)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(o=e.node(t[0]).order,a(r,s,l,n,o),s=l,n=o)}a(r,s,r.length,o,t.length)}),r}),r}function s(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 i(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function d(e,t,r,n){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let l=n(e);if(l.length){let n=((l=l.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=l[d];o[e]===e&&t<s[n]&&!i(r,e,n)&&(o[n]=e,o[e]=a[e]=a[n],t=s[n])}}})}),{root:a,align:o}}function c(e,t,n,a,o){var s,i,l,d,c,u,h;let p,f,g,m={},x=(s=e,i=t,l=n,d=o,p=new r,g=(c=(f=s.graph()).nodesep,u=f.edgesep,h=d,(e,t,r)=>{let n=e.node(t),a=e.node(r),o,s;if(o=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&&(o+=h?s:-s),s=0,o+=(n.dummy?u:c)/2,o+=(a.dummy?u:c)/2,o+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":s=a.width/2;break;case"r":s=-a.width/2}return s&&(o+=h?s:-s),s=0,o}),i.forEach(e=>{let t;e.forEach(e=>{let r=l[e];if(p.setNode(r),t){var n=l[t],a=p.edge(n,r);p.setEdge(n,r,Math.max(g(s,e,t),a||0))}t=e})}),p),v=o?"borderLeft":"borderRight";function y(e,t){let r=x.nodes().slice(),n={},a=r.pop();for(;a;){if(n[a])e(a);else for(let e of(n[a]=!0,r.push(a),t(a)))r.push(e);a=r.pop()}}return y(function(e){m[e]=x.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+x.edge(t)),0)},x.predecessors.bind(x)),y(function(t){let r=x.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-x.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==v&&(m[t]=Math.max(m[t],r))},x.successors.bind(x)),Object.keys(a).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,a=1/0;Object.entries(r).forEach(([t,r])=>{var o,s;let i=(o=e,s=t,o.node(s).width/2);n=Math.max(r+i,n),a=Math.min(r-i,a)});let o=n-a;return o<t[0]&&(t=[o,r]),t},[1/0,null])[1]}function p(e,t){let r=Object.values(t),a=n.applyWithChunking(Math.min,r),o=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=a-n.applyWithChunking(Math.min,d);"l"!==s&&(c=o-n.applyWithChunking(Math.max,d)),c&&(e[i]=n.mapValues(l,e=>e+c))})})}function f(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(a(e,t),o(e,t)),s={},i;["u","d"].forEach(a=>{i="u"===a?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let o=("u"===a?e.predecessors:e.successors).bind(e),l=d(e,i,r,o),u=c(e,i,l.root,l.align,"r"===t);"r"===t&&(u=n.mapValues(u,e=>-e)),s[a+t]=u})});let l=h(e,s);return p(s,l),f(s,e.graph().align)},findType1Conflicts:a,findType2Conflicts:o,addConflict:s,hasConflict:i,verticalAlignment:d,horizontalCompaction:c,alignCoordinates:p,findSmallestWidthAlignment:h,balance:f}}),P=i((e,t)=>{var r=u(),n=O().positionX;t.exports=function(e){var t;let a,o,s,i;t=e=r.asNonCompoundGraph(e),a=r.buildLayerMatrix(t),o=t.graph().ranksep,s=t.graph().rankalign,i=0,a.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+o}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),T=i((e,t)=>{var r=h(),n=p(),a=x(),o=u().normalizeRanks,s=v(),i=u().removeEmptyRanks,d=y(),c=b(),f=w(),g=R(),m=P(),k=u(),j=l().Graph;t.exports=function(e,t={}){let l=t.debugTiming?k.time:k.notime;return l("layout",()=>{let u=l(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new j({multigraph:!0,compound:!0}),n=L(t.graph()),r.setGraph(Object.assign({},E,F(n,N),k.pick(n,C))),t.nodes().forEach(e=>{let n=F(L(t.node(e)),_);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=L(t.edge(e));r.setEdge(e,Object.assign({},O,F(n,M),k.pick(n,T)))}),r});return l(" runLayout",()=>{var e,h,p;return e=u,h=l,p=t,void(h(" 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)}))}),h(" 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)}})}),h(" acyclic",()=>r.run(e)),h(" nestingGraph.run",()=>d.run(e)),h(" rank",()=>a(k.asNonCompoundGraph(e))),h(" 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};k.addDummyNode(t,"edge-proxy",n,"_ep")}})}),h(" removeEmptyRanks",()=>i(e)),h(" nestingGraph.cleanup",()=>d.cleanup(e)),h(" normalizeRanks",()=>o(e)),h(" 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)}),h(" 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))})}),h(" normalize.run",()=>n.run(e)),h(" parentDummyChains",()=>s(e)),h(" addBorderSegments",()=>c(e)),h(" order",()=>g(e,p)),h(" insertSelfEdges",()=>{var t;return t=e,void k.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var a=t.node(e);a.order=n+r,(a.selfEdges||[]).forEach(e=>{k.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete a.selfEdges})})}),h(" adjustCoordinateSystem",()=>f.adjust(e)),h(" position",()=>m(e)),h(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),a=n.x+n.width/2,o=n.y,s=r.x-a,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:o-i},{x:a+5*s/6,y:o-i},{x:a+s,y:o},{x:a+5*s/6,y:o+i},{x:a+2*s/3,y:o+i}],r.label.x=r.x,r.label.y=r.y}})}),h(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),a=t.node(r.borderBottom),o=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-o.x),r.height=Math.abs(a.y-n.y),r.x=o.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),h(" normalize.undo",()=>n.undo(e)),h(" 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}})}),h(" undoCoordinateSystem",()=>f.undo(e)),h(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,a=0,o=e.graph(),s=o.marginx||0,i=o.marginy||0;function l(e){let o=e.x,s=e.y,i=e.width,l=e.height;t=Math.min(t,o-i/2),r=Math.max(r,o+i/2),n=Math.min(n,s-l/2),a=Math.max(a,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 a=e.node(r);a.x-=t,a.y-=n}),e.edges().forEach(r=>{let a=e.edge(r);a.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(a,"x")&&(a.x-=t),Object.hasOwn(a,"y")&&(a.y-=n)}),o.width=r-t+s,o.height=a-n+i})(e)),h(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),a=t.node(e.w),o,s;r.points?(o=r.points[0],s=r.points[r.points.length-1]):(r.points=[],o=a,s=n),r.points.unshift(k.intersectRect(n,o)),r.points.push(k.intersectRect(a,s))})}),h(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),h(" acyclic.undo",()=>r.undo(e)))}),l(" updateInputGraph",()=>{var t,r;return t=e,r=u,void(t.nodes().forEach(e=>{let n=t.node(e),a=r.node(e);n&&(n.x=a.x,n.y=a.y,n.order=a.order,n.rank=a.rank,r.children(e).length&&(n.width=a.width,n.height=a.height))}),t.edges().forEach(e=>{let n=t.edge(e),a=r.edge(e);n.points=a.points,Object.hasOwn(a,"x")&&(n.x=a.x,n.y=a.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),u})};var N=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],_=["width","height","rank"],S={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function F(e,t){return k.mapValues(k.pick(e,t),Number)}function L(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),F=i((e,t)=>{var r=u(),n=l().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),a=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{a.setNode(t,{label:t}),a.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>a.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{a.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(a.setEdge(e,t,{style:"invis"}),t))}),a}}}),L=i((e,t)=>{t.exports="2.0.4"});let A=i((e,t)=>{t.exports={graphlib:l(),layout:T(),debug:F(),util:{time:u().time,notime:u().notime},version:L()}})(),D={direction:"LR",ranksep:200,nodesep:30};function I(e="ltr"){return{...D,direction:"rtl"===e?"RL":"LR"}}let $={featureNode:{width:388,height:140},repositoryNode:{width:400,height:140}};function z(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:$[e.type??""]??t}function B(e,t,r={}){let{direction:n="TB",nodeSize:a={width:172,height:36},ranksep:o=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new A.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:o,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=z(e,a);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);A.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),p="LR"===n||"RL"===n,f=new Map;for(let e of d){let t=i.node(e.id),r=z(e,a);f.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of f.values()){g=p?e.cx:e.cy;break}for(let e of c){let t=z(e,a);f.set(e.id,{cx:p?g:0,cy:p?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)f.has(e.source)&&f.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let x=new Map;for(let t=0;t<e.length;t++)x.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(x.get(e)??0)-(x.get(t)??0));let v=new Set;for(let e of m.values())for(let t of e)v.add(t);let y=[...[...l].filter(e=>f.has(e)&&!v.has(e)),...c.map(e=>e.id)];y.sort((e,t)=>(x.get(e)??0)-(x.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=f.get(t),n=p?r.h:r.w,a=m.get(t);if(!a||0===a.length)return b.set(t,n),n;let o=0;for(let t of a)o+=e(t);let i=Math.max(n,o+=(a.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=f.get(t);p?n.cy=r:n.cx=r;let a=m.get(t);if(!a||0===a.length)return;let o=0;for(let e of a)o+=b.get(e)??0;let i=r-(o+=(a.length-1)*s)/2;for(let t of a){let r=b.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let k=[];for(let t of e){let e=f.get(t.id);e&&k.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:k,edges:[...t]}}function G(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,a=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&&a.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:a}}function U(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}var W=e.i(96976);let V=(0,W.createServerReference)("40912663fe1b22563821a2ee9c729fee2113e449e0",W.callServer,void 0,W.findSourceMapURL,"getFeatureMetadata");var H=e.i(48034);let X=(0,W.createServerReference)("40a7e21b413b195daf9970d2b0a98ad53152fab94e",W.callServer,void 0,W.findSourceMapURL,"archiveFeature"),J=(0,W.createServerReference)("78aafb9ae6536f1a507608adf075663cec624ab537",W.callServer,void 0,W.findSourceMapURL,"deleteFeature");var K=e.i(68732),Y=e.i(81864),Q=e.i(45914);let Z=(0,W.createServerReference)("40121c69e3a9bb6ab96a1da716236c69223e53d274",W.callServer,void 0,W.findSourceMapURL,"unarchiveFeature");var ee=e.i(34629);let et=(0,W.createServerReference)("40dc01bdf627371ea3223be73078cb105b56df6b98",W.callServer,void 0,W.findSourceMapURL,"deleteRepository");var er=e.i(8361);let en=(0,a.createLogger)("[Polling]"),ea=0;e.s(["useControlCenterState",0,function(e,a){let i=(0,r.useRouter)(),[l,d]=(0,t.useState)(!1),{nodes:c,edges:u,reconcile:h,updateFeature:p,addPendingFeature:f,removeFeature:g,restoreFeature:m,addRepository:x,removeRepository:v,replaceRepository:y,getFeatureRepositoryPath:b,getRepositoryData:w,getRepoMapSize:k,setCallbacks:j,beginMutation:N,endMutation:E,isMutating:C}=function(e,r,n=!1){var a;let o,{i18n:i}=(0,s.useTranslation)(),l=(0,t.useMemo)(()=>I(i.dir()),[i]),d=(0,t.useMemo)(()=>G(e,r),[]),[c,u]=(0,t.useState)(d.featureMap),[h,p]=(0,t.useState)(d.repoMap),[f,g]=(0,t.useState)(new Map),m=(0,t.useRef)(new Map),x=(0,t.useRef)(new Set),v=(0,t.useRef)(0),y=(0,t.useRef)(new Set),b=(0,t.useRef)(new Set),w=(0,t.useRef)({}),k=(0,t.useMemo)(()=>({onNodeAction:e=>w.current.onNodeAction?.(e),onNodeSettings:e=>w.current.onNodeSettings?.(e),onFeatureDelete:(e,t,r,n)=>w.current.onFeatureDelete?.(e,t,r,n),onRepositoryAdd:e=>w.current.onRepositoryAdd?.(e),onRepositoryClick:e=>w.current.onRepositoryClick?.(e),onRepositoryDelete:e=>w.current.onRepositoryDelete?.(e),onRetryFeature:e=>w.current.onRetryFeature?.(e),onStartFeature:e=>w.current.onStartFeature?.(e),onArchiveFeature:e=>w.current.onArchiveFeature?.(e),onUnarchiveFeature:e=>w.current.onUnarchiveFeature?.(e)}),[]),j=(0,t.useRef)(c);j.current=c;let N=(0,t.useRef)(h);N.current=h;let E=(0,t.useMemo)(()=>{if(n)return c;let e=new Map;for(let[t,r]of c)"archived"!==r.data.state&&e.set(t,r);return e.size===c.size?c:e},[c,n]),{nodes:C,edges:_}=(a=(0,t.useMemo)(()=>(function(e,t,r,n){let a=[],o=[],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}};a.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 u="creating"===d.data.state||c,h={...d.data,...!u&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!u&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!u&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!u&&"error"===d.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!u&&"pending"===d.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature},...!u&&("running"===d.data.state||"action-required"===d.data.state)&&n?.onStopFeature&&{onStop:n.onStopFeature},...!u&&"archived"!==d.data.state&&"deleting"!==d.data.state&&n?.onArchiveFeature&&{onArchive:n.onArchiveFeature},...!u&&"archived"===d.data.state&&n?.onUnarchiveFeature&&{onUnarchive:n.onUnarchiveFeature}};if(a.push({id:t,type:"featureNode",position:{x:0,y:0},data:h}),d.parentNodeId&&(e.has(d.parentNodeId)||r.has(d.parentNodeId)))o.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 a.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),l.set(e,t),t}(e);o.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=new Set;for(let e of o)"dependencyEdge"===e.type&&d.add(e.source);let c=o.length>0;for(let e of a){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=d.has(e.id))}return{nodes:a,edges:o}})(E,h,f,k),[E,h,f,k]),o=(0,t.useRef)({key:"",positions:new Map}),(0,t.useMemo)(()=>{let e=a.nodes.map(e=>e.id).sort().join(","),t=a.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}|${l.direction}`;if(r!==o.current.key){let e=B(a.nodes,a.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=o.current.positions;if(n.size>0){let r=0,a=0;for(let[e,o]of t){let t=n.get(e);if(t){r=t.position.x-o.position.x,a=t.position.y-o.position.y;break}}if(0!==r||0!==a){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+a};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+a}}}return o.current={key:r,positions:t},e}let{positions:n}=o.current;return{nodes:a.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:a.edges}},[a,l])),S=(0,t.useCallback)((e,t)=>{if(v.current>0)return;let{featureMap:r,repoMap:n}=G(e,t),a=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));u(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}`;a.has(t)||n.set(e,r)}let o=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"}}):b.current.has(t)||(n.set(t,r),o.add(t)));for(let[e,t]of(b.current=o,m.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),m.current.delete(e))}return q(e,n)?e:n}),g(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,o]of e){let e=`${o.data.name}\0${o.data.repositoryPath}`;a.has(e)&&(r.delete(n),t=!0)}return t?r:e}),p(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,a]of e){if(t.has(n)||r.has(a.data.repositoryPath)){x.current.delete(n);continue}(n.startsWith("repo-temp-")||x.current.has(n))&&t.set(n,a)}return q(e,t)?e:t})},[]),M=(0,t.useCallback)((e,t)=>{u(r=>{let n=r.get(e);if(!n)return m.current.set(e,{...m.current.get(e),...t}),r;if(m.current.delete(e),U(n.data,t))return r;let a=new Map(r);return a.set(e,{...n,data:{...n.data,...t}}),a}),g(r=>{let n=r.get(e);if(!n||U(n.data,t))return r;let a=new Map(r);return a.set(e,{...n,data:{...n.data,...t}}),a})},[]),R=(0,t.useCallback)((e,t,r)=>{g(n=>{let a=new Map(n);return a.set(e,{nodeId:e,data:t,parentNodeId:r}),a})},[]),O=(0,t.useCallback)(e=>{g(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),P=(0,t.useCallback)(e=>{u(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),T=(0,t.useCallback)((e,t)=>{u(r=>{let n=new Map(r);return n.set(e,t),n})},[]),F=(0,t.useCallback)((e,t)=>{x.current.add(e),p(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),L=(0,t.useCallback)(e=>{x.current.delete(e),p(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),A=(0,t.useCallback)((e,t,r)=>{x.current.delete(e),x.current.add(t),p(n=>{if(!n.has(e))return n;let a=new Map(n);return a.delete(e),a.set(t,{nodeId:t,data:r}),a})},[]),D=(0,t.useCallback)(e=>j.current.get(e)?.data.repositoryPath,[]),$=(0,t.useCallback)(e=>N.current.get(e)?.data,[]),z=(0,t.useCallback)(()=>N.current.size,[]),W=(0,t.useCallback)(e=>{w.current=e},[]),V=(0,t.useCallback)(()=>{v.current++},[]),H=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{v.current=Math.max(0,v.current-1),y.current.delete(t)},e);y.current.add(t)},[]),X=(0,t.useCallback)(()=>v.current>0,[]);return(0,t.useEffect)(()=>{let e=y.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:C,edges:_,reconcile:S,updateFeature:M,addPendingFeature:R,removePendingFeature:O,removeFeature:P,restoreFeature:T,addRepository:F,removeRepository:L,replaceRepository:A,getFeatureRepositoryPath:D,getRepositoryData:$,getRepoMapSize:z,setCallbacks:W,beginMutation:V,endMutation:H,isMutating:X}}(e,a,l),_=(0,t.useRef)(c),S=(0,t.useRef)(u);(0,t.useEffect)(()=>{_.current=c,S.current=u},[c,u]);let M=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),R=(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]),O=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${M}|${R}`;t!==O.current&&(O.current=t,h(e,a))},[M,R,e,a,h]);let P=(0,t.useRef)(new Map),{events:T}=(0,H.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=P.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,a=t.get(r.id);void 0!==a&&a!==e.state&&(T.some(t=>t.featureId===e.featureId&&(0,o.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:()=>i.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[R,e,T,i]),function({nodesRef:e,updateFeature:r,isMutating:n,beginMutation:a,endMutation:s}){let{events:i}=(0,H.useAgentEventsContext)(),l=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(l.current>i.length&&(l.current=0),i.length<=l.current)return;let t=i.slice(l.current);for(let{featureId:a,state:s,lifecycle:d}of(l.current=i.length,(0,o.resolveSseEventUpdates)(t)))if(void 0!==s||void 0!==d){let t=`feat-${a}`,o=e.current.find(e=>e.id===t),i=o?o.data.state:void 0;if("deleting"===i||"error"===s&&n()&&"running"===i)continue;r(t,{...void 0!==s&&{state:s},...void 0!==d&&{lifecycle:d}})}},[i,r,n,e]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;a(),r(`feat-${t}`,{state:"running"}),s()};return window.addEventListener("shipit-ai:feature-approved",e),()=>window.removeEventListener("shipit-ai:feature-approved",e)},[r,a,s]);let d=(0,t.useRef)(new Set),c=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(c.current>i.length&&(c.current=0),i.length<=c.current)return;let e=i.slice(c.current);for(let t of(c.current=i.length,e)){if("Feature metadata updated"!==t.message||d.current.has(t.featureId))continue;d.current.add(t.featureId);let e=`feat-${t.featureId}`;V(t.featureId).then(t=>{t&&r(e,{name:t.name,description:t.description})}).catch(()=>{})}},[i,r])}({nodesRef:_,updateFeature:p,isMutating:C,beginMutation:N,endMutation:E}),(0,t.useEffect)(()=>{en.debug("polling enabled (15000ms interval)");let e=setInterval(async()=>{if(!document.hidden&&!C())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();h(t,r)}catch{en.warn("poll fetch failed — will retry next interval")}},15e3);return()=>{en.debug("polling disabled"),clearInterval(e)}},[h,C]);let{handleRetryFeature:F,handleStartFeature:L,handleStopFeature:A,handleArchiveFeature:D,handleUnarchiveFeature:$,handleDeleteFeature:z,handleDeleteRepository:W,handleLayout:eo,handleAddRepository:es}=function({nodesRef:e,edgesRef:a,updateFeature:o,removeFeature:s,restoreFeature:i,addRepositoryToMap:l,removeRepository:d,replaceRepository:c,getRepositoryData:u,getRepoMapSize:h,reconcile:p,beginMutation:f,endMutation:g}){let m=(0,r.useRouter)(),x=(0,er.useSoundAction)("delete"),v=(0,er.useSoundAction)("create"),y=(0,t.useRef)(0),b=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"running"}),(0,K.resumeFeature)(e).then(e=>{e.error?(o(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{o(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>g())},[o,f,g]),w=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"running"}),(0,Y.startFeature)(e).then(e=>{e.error?(o(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{o(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>g())},[o,f,g]),k=(0,t.useCallback)(e=>{f(),(0,Q.stopFeature)(e).then(e=>{e.error?n.toast.error(e.error):n.toast.success("Agent stopped")}).catch(()=>{n.toast.error("Failed to stop agent")}).finally(()=>g())},[f,g]),j=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"archived"}),X(e).then(e=>{e.error?(o(t,{state:"done"}),n.toast.error(e.error)):n.toast.success("Feature archived")}).catch(()=>{o(t,{state:"done"}),n.toast.error("Failed to archive feature")}).finally(()=>g())},[o,f,g]),N=(0,t.useCallback)(e=>{let t=`feat-${e}`;f(),o(t,{state:"done"}),Z(e).then(e=>{e.error?(o(t,{state:"archived"}),n.toast.error(e.error)):n.toast.success("Feature unarchived")}).catch(()=>{o(t,{state:"archived"}),n.toast.error("Failed to unarchive feature")}).finally(()=>g())},[o,f,g]),E=(0,t.useCallback)((t,r,i,l)=>{let d=`feat-${t}`,c=[];if(!0===i){let e=[d];for(;e.length>0;){let t=e.shift();for(let r of a.current)"dependencyEdge"===r.type&&r.source===t&&(c.push(r.target),e.push(r.target))}}let u=new Map;for(let t of[d,...c]){let r=e.current.find(e=>e.id===t);r&&u.set(t,r.data.state)}for(let e of(f(),o(d,{state:"deleting"}),c))o(e,{state:"deleting"});x.play(),m.push("/"),J(t,r,i,l).then(e=>{if(e.error){for(let[e,t]of u)t&&o(e,{state:t});n.toast.error(e.error)}else for(let e of(s(d),c))s(e)}).catch(()=>{for(let[e,t]of u)t&&o(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>g())},[m,x,o,s,f,g,e,a]),C=(0,t.useCallback)(async t=>{let r=`repo-${t}`,o=new Set(a.current.filter(e=>e.source===r).map(e=>e.target)),c=u(r),h=new Map;for(let t of o){let r=e.current.find(e=>e.id===t);r&&h.set(t,{nodeId:t,data:r.data})}let p=()=>{for(let[e,t]of(c&&l(r,c),h))i(e,t)};for(let e of(f(),d(r),o))s(e);try{let e=await et(t);if(!e.success){n.toast.error(e.error??"Failed to remove repository"),p();return}x.play()}catch{n.toast.error("Failed to remove repository"),p()}finally{g()}},[x,d,s,l,i,u,f,g,e,a]);return{handleRetryFeature:b,handleStartFeature:w,handleStopFeature:k,handleArchiveFeature:j,handleUnarchiveFeature:N,handleDeleteFeature:E,handleDeleteRepository:C,handleLayout:(0,t.useCallback)(t=>{let r=B(e.current,a.current,{...I(),direction:t});p(r.nodes,r.edges)},[p,e,a]),handleAddRepository:(0,t.useCallback)(e=>{let t=0===h(),r=`repo-temp-${++y.current}`,a=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return f(),l(r,{name:a,repositoryPath:e,id:r,createdAt:Date.now(),gitInfoStatus:"loading"}),(0,ee.addRepository)({path:e,name:a}).then(e=>{if(e.error){d(r),n.toast.error(e.error);return}let t=e.repository;c(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),v.play()}).catch(()=>{d(r),n.toast.error("Failed to add repository")}).finally(()=>g()),{wasEmpty:t,repoPath:e}},[l,d,c,v,h,f,g])}}({nodesRef:_,edgesRef:S,updateFeature:p,removeFeature:g,restoreFeature:m,addRepositoryToMap:x,removeRepository:v,replaceRepository:y,getRepositoryData:w,getRepoMapSize:k,reconcile:h,beginMutation:N,endMutation:E}),ei=(0,t.useCallback)(e=>{},[]);return{nodes:c,edges:u,onNodesChange:ei,handleConnect:(0,t.useCallback)(e=>{},[]),handleAddRepository:es,handleArchiveFeature:D,handleLayout:eo,handleDeleteFeature:z,handleRetryFeature:F,handleStartFeature:L,handleStopFeature:A,handleUnarchiveFeature:$,handleDeleteRepository:W,createFeatureNode:(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${ea++}`,a={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 f(n,a,"dependencyEdge"===r&&e?e:void 0),n},[f]),showArchived:l,setShowArchived:d,getFeatureRepositoryPath:b,getRepositoryData:w,setCallbacks:j}}],17840)},48246,e=>{"use strict";var t=e.i(96871),r=e.i(86066),n=e.i(92786),a=e.i(16539),o=e.i(33109),s=e.i(53756),i=e.i(91925),l=e.i(3645);let d=(0,l.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);var c=e.i(49228),u=e.i(3214);e.i(98026);var h=e.i(50728),p=e.i(31777),f=e.i(35364);e.i(54793);var g=e.i(7729);e.i(47506);var m=e.i(89313),x=e.i(33814),v=e.i(8986),y=e.i(38573),b=e.i(19933),w=e.i(67669),k=e.i(24042),j=e.i(64970),N=e.i(65530),E=e.i(7311),C=e.i(94365),_=e.i(38227),S=e.i(48109);e.i(81803);var M=e.i(72714),R=e.i(2287),O=e.i(2828),P=e.i(8537),T=e.i(75921),F=e.i(74442),L=e.i(57779),A=e.i(80554),D=e.i(80519);function I({data:e,selected:n}){let{t:s,i18n:i}=(0,h.useTranslation)("web"),l=(0,o.useRouter)(),g="rtl"===i.dir(),m=g?x.Position.Right:x.Position.Left,$=g?x.Position.Left:x.Position.Right,z=(0,T.useFeatureFlags)(),[B,G]=(0,a.useState)(!1),U=e.id?`repo-${e.id}`:`repo-${e.name}`,q=(0,A.useTurnStatus)(U),W=(0,F.useRepositoryActions)(e.repositoryPath?{repositoryId:e.id,repositoryPath:e.repositoryPath}:null),V=(0,P.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),H="Booting"===V.status||"Ready"===V.status,X=(0,a.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",a=["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"),o=new URLSearchParams({repo:e.repositoryPath,prompt:a});l.push(`/create?${o.toString()}`)},[e.repositoryPath,l]);return(0,t.jsxs)("div",{className:(0,p.cn)("group relative",e.onDelete&&e.id&&"ps-10"),style:{direction:g?"rtl":"ltr"},children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:m,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 -start-3 top-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":s("repositoryNode.removeRepository"),"data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),G(!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)(w.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.removeRepository")})]})})}),(0,t.jsx)(R.Dialog,{open:B,onOpenChange:G,children:(0,t.jsxs)(R.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(R.DialogHeader,{children:[(0,t.jsx)(R.DialogTitle,{children:s("repositoryNode.removeConfirmTitle")}),(0,t.jsx)(R.DialogDescription,{children:s("repositoryNode.removeConfirmDescription",{name:e.name})})]}),(0,t.jsxs)(R.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(R.DialogClose,{asChild:!0,children:(0,t.jsx)(f.Button,{variant:"outline",children:s("repositoryNode.cancel")})}),(0,t.jsx)(f.Button,{variant:"destructive",onClick:()=>{G(!1),e.onDelete?.(e.id)},children:s("repositoryNode.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:(0,p.cn)("nodrag bg-card flex w-[26rem] cursor-pointer flex-col overflow-hidden rounded-xl border shadow-sm transition-[border-color,box-shadow] duration-200 dark:bg-neutral-800/80",n&&"border-blue-400 dark:border-amber-500/60"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)(d,{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,p.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ms-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(M.ActionButton,{label:s("repositoryNode.openInIde"),onClick:W.openInIde,loading:W.ideLoading,error:!!W.ideError,icon:v.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.openInIde")})]})}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(M.ActionButton,{label:s("repositoryNode.openInShell"),onClick:W.openInShell,loading:W.shellLoading,error:!!W.shellError,icon:y.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.openInShell")})]})}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(M.ActionButton,{label:s("repositoryNode.openFolder"),onClick:W.openFolder,loading:W.folderLoading,error:!!W.folderError,icon:b.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.openFolder")})]})}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)(f.Button,{variant:"ghost",size:"icon-xs","aria-label":s("repositoryNode.chatWithAgent"),onClick:t=>{t.stopPropagation(),e.id&&l.push(`/repository/${e.id}/chat`)},className:"nodrag relative cursor-pointer text-violet-500 hover:text-violet-600 dark:text-violet-400 dark:hover:text-violet-300",children:[(0,t.jsx)(S.MessageSquare,{className:"h-3 w-3"}),(0,t.jsx)(L.ChatDotIndicator,{status:q})]})}),(0,t.jsx)(O.TooltipContent,{children:s("repositoryNode.chatWithAgent")})]})}),(0,t.jsx)(D.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,includeWorktrees:!0,onCreateFromSession:X})]}):null,e.onAdd?(0,t.jsx)("div",{className:"ms-1.5"}):null,e.onAdd?(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{"aria-label":s("repositoryNode.newFeature"),"data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,p.cn)("flex h-6 shrink-0 cursor-pointer items-center gap-0.5 rounded bg-blue-500 px-1.5 text-[11px] font-bold text-white transition-colors hover:bg-blue-600 dark:bg-amber-500 dark:hover:bg-amber-400",e.pulseAdd&&"animate-pulse-cta"),children:[(0,t.jsx)(u.Plus,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"translate-y-px",children:s("repositoryNode.new")})]})}),(0,t.jsx)(O.TooltipContent,{side:"top",children:s("repositoryNode.newFeature")})]})}):null]})]}),e.branch?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-info",className:"text-muted-foreground border-border/50 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)(c.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)(E.ArrowDown,{className:"h-3 w-3 shrink-0"}),s("repositoryNode.behind",{count:e.behindCount})]}):null]})}),e.commitMessage?(0,t.jsx)("div",{"data-testid":"repository-node-commit-info",className:"text-muted-foreground border-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(N.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 ms-auto flex shrink-0 items-center gap-1","data-testid":"repository-node-committer",children:[(0,t.jsx)(C.User,{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-border/50 border-t px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(b.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-border/50 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)(c.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:s("repositoryNode.notAGitRepository")})]})})]}):"ready"!==e.gitInfoStatus?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-testid":"repository-node-git-loading",className:"border-border/50 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)(c.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-border/50 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)(N.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,z.envDeploy&&e.repositoryPath?(0,t.jsx)("div",{"data-testid":"repository-node-dev-preview",className:"border-border/50 border-t px-4 py-2",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[V.deployError?(0,t.jsx)("span",{className:"truncate text-xs text-red-500",children:V.deployError}):H?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"me-0.5 inline-block h-2 w-2 shrink-0 rounded-full bg-green-500"}),V.url?(0,t.jsx)("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",className:"truncate text-green-700 hover:underline dark:text-green-400",children:V.url}):(0,t.jsx)("span",{className:"text-muted-foreground",children:s("repositoryNode.starting")})]}):(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex items-baseline gap-2",children:[(0,t.jsx)("span",{children:s("repositoryNode.run")}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-[10px]",children:s("repositoryNode.startLocalEnvironment")})]}),(0,t.jsx)(O.TooltipProvider,{children:(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:(0,p.cn)("ms-auto flex items-center",!H&&!V.deployError&&"[&_button]:text-green-600 [&_button]:hover:text-green-700 dark:[&_button]:text-green-400 dark:[&_button]:hover:text-green-300"),children:(0,t.jsx)(M.ActionButton,{label:s(V.deployError?"repositoryNode.retry":H?"repositoryNode.stopDevServer":"repositoryNode.startDevServer"),onClick:H?V.stop:V.deploy,loading:V.deployLoading||V.stopLoading,error:!1,icon:V.deployError?_.RotateCcw:H?j.Square:k.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(O.TooltipContent,{children:s(H?"repositoryNode.stopDevServer":"repositoryNode.startDevServer")})]})})]})}):null]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:$,isConnectable:!e.showHandles,className:"opacity-0!",style:{top:70}}):null]})}function $(e){let[n]=(0,x.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 z={x:30,y:30,zoom:.85};function B({nodes:e,edges:n,selectedFeatureId:o,selectedRepository:s,defaultViewport:i,onNodesChange:l,onAddFeature:d,onConnect:c,onNodeClick:x,onPaneClick:v,onCanvasDrag:y,onMoveEnd:b,toolbar:w,emptyState:k}){let{t:j}=(0,h.useTranslation)("web"),N=(0,a.useMemo)(()=>({featureNode:m.FeatureNode,repositoryNode:I}),[]),E=(0,a.useMemo)(()=>({dependencyEdge:$}),[]),C=(0,a.useMemo)(()=>{let t=null!=o,r=null!=s&&(null!=s.id||null!=s.path);return t||r?e.map(e=>{if(t&&"featureNode"===e.type&&e.data.featureId===o)return{...e,selected:!0};if(r&&"repositoryNode"===e.type){let t=e.data,r=null!=s.id&&(e.id===s.id||t.id===s.id),n=null!=s.path&&t.repositoryPath===s.path;if(r||n)return{...e,selected:!0}}return e}):e},[e,o,s]),_=0===e.length,[S,M]=(0,a.useState)(_),[R,O]=(0,a.useState)(!1),P=(0,a.useRef)(_);(0,a.useEffect)(()=>{if(P.current&&!_){O(!0);let e=setTimeout(()=>{M(!1),O(!1)},300);return P.current=_,()=>clearTimeout(e)}!P.current&&_&&M(!0),P.current=_},[_]);let T=_&&!k?(0,t.jsx)(g.EmptyState,{title:j("canvas.noFeatures"),description:j("canvas.noFeaturesDescription"),action:(0,t.jsxs)(f.Button,{onClick:d,children:[(0,t.jsx)(u.Plus,{className:"me-2 h-4 w-4"}),j("canvas.newFeature")]})}):null,F=k??T;return(0,t.jsxs)("div",{"data-testid":_?"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:C,edges:n,nodeTypes:N,edgeTypes:E,onConnect:c,onNodesChange:l,onNodeClick:x,onPaneClick:v,onMoveStart:y,onMoveEnd:b,defaultViewport:i??z,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},className:"[&_.react-flow__pane]:!cursor-default",children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!_&&w?(0,t.jsx)(r.Panel,{position:"top-right",className:"!me-3 !mt-3",children:w}):null]}),S&&F?(0,t.jsx)("div",{className:(0,p.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",R?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto h-full w-full",children:F})}):null]})}var G=e.i(87889);let U=(0,l.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),q=(0,l.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),W=(0,l.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),V=(0,l.default)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);function H({showArchived:e,onToggleArchived:n,onResetViewport:o}){let{t:s}=(0,h.useTranslation)("web"),{zoomIn:i,zoomOut:l,fitView:d,setViewport:c}=(0,r.useReactFlow)(),u=(0,a.useCallback)(()=>{i({duration:200})},[i]),p=(0,a.useCallback)(()=>{l({duration:200})},[l]),f=(0,a.useCallback)(()=>{d({duration:400,padding:.3})},[d]),g=(0,a.useCallback)(()=>{o&&c(o(),{duration:400})},[o,c]);return(0,t.jsxs)("div",{className:"bg-background flex items-center gap-1 rounded-xl border px-2 py-1.5 shadow-md dark:bg-neutral-900",children:[(0,t.jsx)(X,{onClick:n,title:s(e?"canvas.hideArchived":"canvas.showArchived"),active:e,label:s(e?"canvas.hideArchivedLabel":"canvas.showArchivedLabel"),children:e?(0,t.jsx)(G.Eye,{className:"h-4 w-4"}):(0,t.jsx)(U,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"bg-border mx-1 h-5 w-px"}),(0,t.jsx)(X,{onClick:p,title:s("canvas.zoomOut"),children:(0,t.jsx)(W,{className:"h-4 w-4"})}),(0,t.jsx)(X,{onClick:u,title:s("canvas.zoomIn"),children:(0,t.jsx)(q,{className:"h-4 w-4"})}),(0,t.jsx)(X,{onClick:f,title:s("canvas.fitView"),children:(0,t.jsx)(V,{className:"h-4 w-4"})}),o?(0,t.jsx)(X,{onClick:g,title:s("canvas.resetView"),children:(0,t.jsx)(_.RotateCcw,{className:"h-4 w-4"})}):null]})}function X({children:e,onClick:r,title:n,label:a,active:o}){return(0,t.jsxs)("button",{type:"button",onClick:r,"aria-label":n,title:n,className:(0,p.cn)("inline-flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium transition-colors","hover:bg-accent hover:text-accent-foreground",o?"text-primary bg-primary/10":"text-muted-foreground"),children:[e,a?(0,t.jsx)("span",{children:a}):null]})}var J=e.i(83428),K=e.i(60253);function Y({actions:e,className:r,style:n}){let{t:o}=(0,h.useTranslation)("web"),[s,i]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(s)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&i(!1)}},[s]),(0,t.jsxs)(t.Fragment,{children:[s?(0,t.jsx)("div",{"data-testid":"fab-overlay",className:"fixed inset-0 z-40",onClick:()=>i(!1),"aria-hidden":"true"}):null,(0,t.jsxs)("div",{"data-testid":"floating-action-button",className:(0,p.cn)("relative z-50",r),style:n,children:[(0,t.jsx)("div",{className:(0,p.cn)("absolute start-0 bottom-[calc(100%+24px)] flex flex-col items-start gap-2",!s&&"pointer-events-none"),"data-testid":"fab-actions",children:e.map((r,n)=>{let a=(e.length-1-n)*50;return(0,t.jsxs)("button",{"data-testid":`fab-action-${r.id}`,"aria-label":r.label,disabled:r.disabled??r.loading,className:(0,p.cn)("flex h-10 items-center gap-2.5 rounded-full px-4","bg-background text-foreground shadow-md","border-border border","hover:bg-accent hover:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50","text-sm font-medium whitespace-nowrap",s?"translate-y-0 opacity-100":"pointer-events-none translate-y-0 opacity-0"),style:{transition:`opacity ${s?250:120}ms ease-out ${s?a:0}ms, transform ${s?250:120}ms ease-out ${s?a:0}ms`},onClick:()=>{r.onClick(),i(!1)},children:[(0,t.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:r.loading?(0,t.jsx)(J.Loader2,{className:"h-4 w-4 animate-spin"}):r.icon}),(0,t.jsx)("span",{children:r.label})]},r.id)})}),(0,t.jsxs)(f.Button,{size:"icon","data-testid":"fab-trigger","aria-label":o(s?"fab.closeActions":"fab.createNew"),className:(0,p.cn)("relative h-14 w-14 rounded-full shadow-lg","bg-indigo-500 text-white hover:bg-indigo-400 dark:bg-indigo-500 dark:hover:bg-indigo-400","transition-all duration-200 hover:scale-105 hover:shadow-xl active:scale-95"),onClick:()=>i(e=>!e),children:[(0,t.jsx)(u.Plus,{className:(0,p.cn)("absolute h-7 w-7 stroke-[2.5] transition-all",s?"scale-0 rotate-90 opacity-0":"scale-100 rotate-0 opacity-100"),style:{transitionDuration:"250ms"}}),(0,t.jsx)(K.X,{className:(0,p.cn)("absolute h-6 w-6 stroke-[2.5] transition-all",s?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-90 opacity-0"),style:{transitionDuration:"250ms"}})]})]})]})}var Q=e.i(5147),Z=e.i(8361),ee=e.i(30153);let et="shipit-ai-canvas-viewport",er={x:30,y:30,zoom:.85};var en=e.i(57638),ea=e.i(38373),eo=e.i(33548),es=e.i(23925),ei=e.i(35e3),el=e.i(79687),ed=e.i(99105),ec=e.i(30702),eu=e.i(78521);e.i(13322);var eh=e.i(61201),ep=e.i(96976);let ef=(0,ep.createServerReference)("00ad481cbbd153a47736e80f53e5d1c1faa69e9955",ep.callServer,void 0,ep.findSourceMapURL,"isAgentSetupComplete"),eg=(0,ep.createServerReference)("004238accf1cff3b56f229cfd001f808cedea6d3f9",ep.callServer,void 0,ep.findSourceMapURL,"checkAgentAuth"),em=(0,ep.createServerReference)("00332c3de0c2b83676af966062491e766530baf88f",ep.callServer,void 0,ep.findSourceMapURL,"checkToolStatus");var ex=e.i(11345),ev=e.i(58481),ey=e.i(6894),eb=e.i(65934),ew=e.i(86782),ek=e.i(29847);let ej=["select-agent","select-model"];function eN({onComplete:e,className:r}){let{t:n}=(0,h.useTranslation)("web"),[o,s]=(0,a.useState)([]),[i,l]=(0,a.useState)(!0),[d,c]=(0,a.useState)("select-agent"),[u,f]=(0,a.useState)(null),[g,m]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!0),w=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{(0,ey.getAllAgentModels)().then(s).finally(()=>l(!1))},[]);let k=u?o.find(e=>e.agentType===u):null,j=(0,a.useCallback)((e,t)=>{v(!0),b(!1),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{t?.(),c(e),requestAnimationFrame(()=>{b(!0),v(!1)})},150)},[]);(0,a.useEffect)(()=>()=>{w.current&&clearTimeout(w.current)},[]);let N=(0,a.useCallback)(async(t,r)=>{m(!0);try{await (0,eb.updateAgentAndModel)(t,r),b(!1),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{e()},200)}catch{m(!1)}},[e]),E=(0,a.useCallback)(e=>{let t=o.find(t=>t.agentType===e);t&&t.models.length>0?j("select-model",()=>{f(e)}):N(e,null)},[o,j,N]),C=(0,a.useCallback)(e=>{u&&N(u,e)},[u,N]),_=(0,a.useCallback)(()=>{"select-model"===d&&j("select-agent",()=>{f(null)})},[d,j]);if(i)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,p.cn)("flex flex-col items-center justify-center gap-4",r),children:[(0,t.jsx)(J.Loader2,{className:"text-muted-foreground h-5 w-5 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:n("welcome.loadingAgents")})]});let S=ej.indexOf(d),M=n("select-agent"===d?"welcome.chooseAgent":"welcome.pickModel"),R="select-agent"===d?n("welcome.selectAgentSubtitle"):k?n("welcome.chooseModelSubtitle",{label:k.label}):"";return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,p.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:ej.map((e,r)=>(0,t.jsx)("div",{className:(0,p.cn)("h-[3px] flex-1 rounded-full transition-colors duration-300",r<=S?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,p.cn)("flex w-full flex-col items-center transition-opacity duration-200",y&&!x?"opacity-100":"opacity-0"),children:[(0,t.jsx)("h1",{className:"text-foreground/90 text-center text-5xl font-extralight tracking-tight",children:M}),(0,t.jsx)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:R}),"select-agent"===d&&(0,t.jsxs)("div",{"data-testid":"gh-cli-notice",className:"mt-5 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-900 dark:bg-amber-950/40",children:[(0,t.jsx)(ev.AlertTriangle,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500"}),(0,t.jsxs)("p",{className:"text-sm leading-relaxed text-amber-800 dark:text-amber-300",children:[(0,t.jsx)("span",{className:"font-medium",children:n("welcome.ghCliRequired")})," ",n("welcome.ghCliRequiredText")," ",(0,t.jsx)("a",{href:"https://cli.github.com/",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-amber-900 dark:hover:text-amber-200",children:n("welcome.installHere")}),"."]})]}),(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,ew.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:g,"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:()=>E(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&&k?(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:g,className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 self-start text-sm transition-colors",onClick:_,children:[(0,t.jsx)(ex.ChevronLeft,{className:"h-4 w-4"}),n("welcome.back")]}),(0,t.jsx)("div",{className:"grid w-full gap-3",style:{gridTemplateColumns:`repeat(${Math.min(k.models.length,3)}, minmax(0, 1fr))`},children:k.models.map(e=>{let r=(0,ek.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:g,"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:()=>C(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 eE=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function eC({onRepositorySelect:e,className:r}){let{t:n}=(0,h.useTranslation)("web"),[o,s]=(0,a.useState)(!1),[i,l]=(0,a.useState)(!1),[d,c]=(0,a.useState)(!1),[u,f]=(0,a.useState)(null),[g,m]=(0,a.useState)(null),[x,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),{reactFileManager:j}=(0,T.useFeatureFlags)();async function N(){if(!i){if(j)return void c(!0);l(!0);try{let t=await (0,eu.pickFolder)();t&&e?.(t)}catch{c(!0)}finally{l(!1)}}}(0,a.useEffect)(()=>{ef().then(e=>{f(e)})},[]),(0,a.useEffect)(()=>{u&&(eg().then(m),em().then(k))},[u]);let E=(0,a.useCallback)(async()=>{await navigator.clipboard.writeText(eE.join("\n")),s(!0),setTimeout(()=>s(!1),2e3)},[]),C=(0,a.useCallback)(()=>{f(!0)},[]),_=(0,a.useCallback)(()=>{m(null),eg().then(m)},[]);return null===u?null:(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,p.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:n("emptyState.addProject")}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-3 text-center text-lg leading-relaxed font-light",children:[n("emptyState.addProjectDescription"),(0,t.jsx)("br",{}),n("emptyState.addProjectDescriptionLine2")]}),(0,t.jsxs)("div",{className:"mt-8 flex w-full flex-col gap-3",children:[(0,t.jsx)(e_,{status:g,onRetry:_}),(0,t.jsx)(eS,{label:n("emptyState.git"),status:w?.git??null,missingHint:n("emptyState.gitRequired")}),(0,t.jsx)(eS,{label:n("emptyState.githubCli"),status:w?.gh??null,missingHint:n("emptyState.githubCliRequired")})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:N,disabled:i,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:[i?(0,t.jsx)(J.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(b.FolderOpen,{className:"h-5 w-5"}),n(i?"emptyState.opening":"emptyState.chooseFolder")]}),(0,t.jsx)("p",{className:"text-muted-foreground/60 mt-3 text-center text-sm",children:n("emptyState.folderHint")})]}):(0,t.jsx)(eN,{onComplete:C}),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:()=>v(!x),className:"text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1.5 transition-colors duration-200",children:[(0,t.jsx)(y.Terminal,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-sm",children:n("emptyState.orUseCli")}),(0,t.jsx)(ed.ChevronDown,{className:(0,p.cn)("h-3.5 w-3.5 transition-transform duration-200",x?"":"rotate-180")})]}),x?(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:E,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":n("emptyState.copyCommands"),children:o?(0,t.jsx)(es.Check,{className:"h-3.5 w-3.5 text-emerald-400"}):(0,t.jsx)(eo.Copy,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("div",{className:"space-y-1",children:eE.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)(eh.ReactFileManagerDialog,{open:d,onOpenChange:e=>{e||c(!1)},onSelect:function(t){t&&e?.(t),c(!1)}})]})}function e_({status:e,onRetry:r}){let{t:n}=(0,h.useTranslation)("web");return e?e.installed&&e.authenticated?(0,t.jsx)(eM,{icon:(0,t.jsx)(ei.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),children:(0,t.jsx)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:n("emptyState.ready",{label:e.label})})}):e.installed?(0,t.jsxs)(eM,{icon:(0,t.jsx)(el.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsx)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:n("emptyState.needsAuth",{label:e.label})}),e.authCommand?(0,t.jsx)(eR,{command: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 text-xs font-medium text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[(0,t.jsx)(y.Terminal,{className:"h-3 w-3"}),n("emptyState.open",{label: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:n("emptyState.reCheck")})]})]}):(0,t.jsxs)(eM,{icon:(0,t.jsx)(el.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsx)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:n("emptyState.notInstalled",{label:e.label})}),e.installCommand?(0,t.jsx)(eR,{command:e.installCommand}):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:n("emptyState.reCheck")})]}):(0,t.jsx)(eM,{icon:(0,t.jsx)(J.Loader2,{className:"text-muted-foreground/50 h-4 w-4 animate-spin"}),children:(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:n("emptyState.checkingSetup")})})}function eS({label:e,status:r,missingHint:n}){let{t:a}=(0,h.useTranslation)("web");return r?r.installed?(0,t.jsx)(eM,{icon:(0,t.jsx)(ei.CheckCircle2,{className:"h-4 w-4 text-emerald-500"}),children:(0,t.jsxs)("span",{className:"flex items-baseline gap-2",children:[(0,t.jsx)("span",{className:"text-sm text-emerald-600 dark:text-emerald-400",children:a("emptyState.ready",{label:e})}),r.version?(0,t.jsxs)("span",{className:"text-muted-foreground/40 text-xs",children:["v",r.version]}):null]})}):(0,t.jsxs)(eM,{icon:(0,t.jsx)(el.AlertCircle,{className:"h-4 w-4 text-amber-500"}),children:[(0,t.jsx)("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:a("emptyState.notFound",{label:e})}),(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:n}),r.installCommand?(0,t.jsx)(eR,{command:r.installCommand}):null,r.installUrl?(0,t.jsxs)("a",{href:r.installUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-amber-600 underline underline-offset-2 hover:text-amber-800 dark:text-amber-400",children:[a("emptyState.docs")," ",(0,t.jsx)(ec.ExternalLink,{className:"h-3 w-3"})]}):null]}):(0,t.jsx)(eM,{icon:(0,t.jsx)(J.Loader2,{className:"text-muted-foreground/50 h-4 w-4 animate-spin"}),children:(0,t.jsx)("span",{className:"text-muted-foreground/50 text-sm",children:a("emptyState.checking",{label:e})})})}function eM({icon:e,children:r}){return(0,t.jsxs)("div",{className:"animate-in fade-in flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"mt-0.5 shrink-0",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:r})]})}function eR({command:e}){let[r,n]=(0,a.useState)(!1);return(0,t.jsxs)("button",{type:"button",onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},className:"group/cmd flex cursor-pointer items-center justify-between gap-2 rounded-md bg-zinc-100 py-1 ps-2.5 pe-2 text-start transition-colors hover:bg-zinc-200 dark:bg-zinc-800 dark:hover:bg-zinc-700",children:[(0,t.jsx)("code",{className:"min-w-0 truncate text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-300",children:e}),r?(0,t.jsx)(es.Check,{className:"h-3 w-3 shrink-0 text-emerald-500"}):(0,t.jsx)(eo.Copy,{className:"h-3 w-3 shrink-0 text-zinc-400 opacity-0 transition-opacity group-hover/cmd:opacity-100"})]})}var eO=e.i(17840);let eP={maxZoom:1,padding:.5,duration:500};function eT({initialNodes:e,initialEdges:n}){let l,u,p,f,g,m,{t:x}=(0,h.useTranslation)("web"),v=(0,o.useRouter)(),y=(0,o.usePathname)(),b=(l=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),l?.[1]??null),w=(u=(0,o.usePathname)(),p=(0,o.useSearchParams)(),f=u.match(/^\/repository\/([^/]+)/),{id:f?.[1]??null,path:u.startsWith("/create")?p.get("repo"):null}),k=(0,Z.useSoundAction)("click"),{guardedNavigate:j}=(0,ee.useDrawerCloseGuard)(),{fitView:N}=(0,r.useReactFlow)(),E=(0,a.useRef)(null),{defaultViewport:C,onMoveEnd:_,resetViewport:S}=(g=(0,a.useRef)(function(){try{let e=localStorage.getItem(et);if(null==e)return er;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:er}catch{return er}}()).current,m=(0,a.useRef)(null),(0,a.useEffect)(()=>()=>{null!=m.current&&clearTimeout(m.current)},[]),{defaultViewport:g,onMoveEnd:(0,a.useCallback)(e=>{null!=m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{try{localStorage.setItem(et,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,a.useCallback)(()=>{try{localStorage.removeItem(et)}catch{}return er},[])}),{nodes:M,edges:R,onNodesChange:O,handleConnect:P,handleAddRepository:F,handleArchiveFeature:L,handleDeleteFeature:A,handleRetryFeature:D,handleStartFeature:I,handleStopFeature:$,handleUnarchiveFeature:z,handleDeleteRepository:G,createFeatureNode:U,showArchived:q,setShowArchived:W,setCallbacks:V}=(0,eO.useControlCenterState)(e,n),{setFeatures:X,setHasRepositories:J}=(0,Q.useSidebarFeaturesContext)(),K=(0,a.useMemo)(()=>M.filter(e=>"featureNode"===e.type),[M]),Y=(0,a.useMemo)(()=>K.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}:${t.repositoryPath}`}).sort().join(","),[K]);(0,a.useEffect)(()=>{X(K.map(e=>{let t=e.data,r=(0,Q.mapNodeStateToSidebarStatus)(t.state);if(!r)return null;let n=t.repositoryPath??"";return{featureId:t.featureId,name:t.name,status:r,repositoryPath:n,repositoryName:t.repositoryName??n.split("/").filter(Boolean).pop()??n,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}}).filter(Boolean))},[Y,K,X]);let en=(0,a.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"]')&&j(()=>{k.play(),v.push(`/feature/${r.featureId}`)})}},[v,k,j]),ea=(0,a.useCallback)(()=>{k.play(),v.push("/create")},[v,k]),eo=(0,a.useCallback)(e=>{k.play();let t=M.find(t=>t.id===e),r=t?.data?.repositoryPath;r?v.push(`/create?repo=${encodeURIComponent(r)}`):v.push("/create")},[M,v,k]),es=(0,a.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=R.find(t=>t.target===e),n=r?M.find(e=>e.id===r.source):null,a=n?.data?.repositoryPath;k.play();let o=new URLSearchParams;a&&o.set("repo",a),o.set("parent",t),v.push(`/create?${o.toString()}`)},[M,R,v,k]),ei=(0,a.useCallback)(e=>{let t=M.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&j(()=>v.push(`/repository/${e.id}`))}},[M,v,j]),el=(0,a.useCallback)(()=>{"/"!==y&&j(()=>v.push("/"))},[v,y,j]),ed=(0,a.useCallback)(e=>{setTimeout(()=>{N(eP),E.current=setTimeout(()=>{j(()=>v.push(`/create?repo=${encodeURIComponent(e)}`))},600)},0)},[N,j,v]),ec=(0,a.useCallback)(e=>{let{wasEmpty:t,repoPath:r}=F(e);t&&ed(r)},[F,ed]);(0,a.useEffect)(()=>{let e=e=>{ec(e.detail.path)};return window.addEventListener("shipit-ai:add-repository",e),()=>{window.removeEventListener("shipit-ai:add-repository",e),null!=E.current&&clearTimeout(E.current)}},[ec]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void U(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=M.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);U(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shipit-ai:feature-created",e),()=>window.removeEventListener("shipit-ai:feature-created",e)},[M,U]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n,closePr:a}=e.detail;A(t,r,n,a)};return window.addEventListener("shipit-ai:feature-delete-requested",e),()=>window.removeEventListener("shipit-ai:feature-delete-requested",e)},[A]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;L(t)};return window.addEventListener("shipit-ai:feature-archive-requested",e),()=>window.removeEventListener("shipit-ai:feature-archive-requested",e)},[L]),(0,a.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;z(t)};return window.addEventListener("shipit-ai:feature-unarchive-requested",e),()=>window.removeEventListener("shipit-ai:feature-unarchive-requested",e)},[z]),(0,a.useEffect)(()=>{V({onNodeAction:es,onFeatureDelete:A,onRetryFeature:D,onStartFeature:I,onStopFeature:$,onArchiveFeature:L,onUnarchiveFeature:z,onRepositoryAdd:eo,onRepositoryClick:ei,onRepositoryDelete:G})},[V,es,L,A,D,I,$,z,eo,ei,G]);let eu=(0,a.useCallback)((e,t)=>{_(t)},[_]),eh=M.some(e=>"repositoryNode"===e.type);(0,a.useEffect)(()=>{J(eh)},[eh,J]);let[ep,ef]=(0,a.useState)(eh),eg=(0,a.useRef)(null);(0,a.useEffect)(()=>(eh?(eg.current&&(clearTimeout(eg.current),eg.current=null),ef(!0)):ep&&(S(),eg.current=setTimeout(()=>{ef(!1),eg.current=null},500)),()=>{eg.current&&clearTimeout(eg.current)}),[eh,ep,S]);let em=y.startsWith("/create"),ex=(0,a.useMemo)(()=>{let e=M.filter(e=>"repositoryNode"===e.type),t=M.some(e=>"featureNode"===e.type);return 1!==e.length||t||em?M:M.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[M,em]),ev=(0,a.useCallback)(()=>{window.dispatchEvent(new CustomEvent("shipit-ai:pick-folder"))},[]),ey=(0,T.useFeatureFlags)(),eb=(0,a.useMemo)(()=>{let e=[{id:"new-feature",label:x("fab.newFeature"),icon:(0,t.jsx)(s.Sparkles,{className:"h-4 w-4"}),onClick:()=>{k.play(),j(()=>v.push("/create"))}},{id:"add-local-repo",label:x("fab.localFolder"),icon:(0,t.jsx)(i.FolderPlus,{className:"h-4 w-4"}),onClick:ev}];return ey.adoptBranch&&e.push({id:"adopt-branch",label:x("fab.adoptBranch"),icon:(0,t.jsx)(c.GitBranch,{className:"h-4 w-4"}),onClick:()=>{j(()=>v.push("/adopt"))}}),ey.githubImport&&e.push({id:"add-github-repo",label:x("fab.fromGithub"),icon:(0,t.jsx)(d,{className:"h-4 w-4"}),onClick:()=>{window.dispatchEvent(new CustomEvent("shipit-ai:open-github-import"))}}),e},[x,k,j,v,ev,ey.adoptBranch,ey.githubImport]),ew=(0,t.jsx)(H,{showArchived:q,onToggleArchived:()=>W(!q),onResetViewport:S});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{nodes:ep?ex:[],edges:ep?R:[],selectedFeatureId:b,selectedRepository:w,defaultViewport:C,onNodesChange:O,onConnect:P,onAddFeature:ea,onNodeClick:en,onPaneClick:el,onMoveEnd:eu,toolbar:ew,emptyState:(0,t.jsx)(eC,{onRepositorySelect:ec})}),ep?(0,t.jsx)(eF,{actions:eb}):null]})}function eF({actions:e}){let{state:r}=(0,en.useSidebar)(),{i18n:n}=(0,h.useTranslation)("web"),{swapPosition:a}=(0,ea.useFabLayout)(),o="rtl"===n.dir();if(a)return(0,t.jsx)(Y,{actions:e,className:"!fixed bottom-6",style:o?{left:"calc(var(--sidebar-width-icon) + 32px)",transition:"left 200ms ease-in-out"}:{right:"32px",transition:"right 200ms ease-in-out"}});let s="expanded"===r?"calc(var(--sidebar-width) + 32px)":"calc(var(--sidebar-width-icon) + 32px)";return(0,t.jsx)(Y,{actions:e,className:"!fixed bottom-6",style:o?{right:s,transition:"right 200ms ease-in-out"}:{left:s,transition:"left 200ms ease-in-out"}})}e.s(["ControlCenter",0,function({initialNodes:e,initialEdges:a,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(n.SessionsProvider,{children:(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(eT,{initialNodes:e,initialEdges:a})})}),(0,t.jsx)("div",{children:o},"drawer")]})}],48246)}]);