@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,5 +1,5 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36986,e=>{"use strict";var t=e.i(96871),s=e.i(16539),a=e.i(31777);e.i(98026);var r=e.i(50728),n=e.i(33109),l=e.i(60112),i=e.i(83428),o=e.i(67669),d=e.i(24042),c=e.i(64970),u=e.i(33548),x=e.i(23925),m=e.i(37260),p=e.i(83299),h=e.i(96976);let f=(0,h.createServerReference)("60b0f59e7534c300e539145c284cc75c8520789f0e",h.callServer,void 0,h.findSourceMapURL,"approveFeature");var g=e.i(99262),b=e.i(25931),j=e.i(46634);let v=(0,h.createServerReference)("70aa7f576505b6825f291fa870ad4667e76f924823",h.callServer,void 0,h.findSourceMapURL,"rejectFeature"),y=(0,h.createServerReference)("4059c49edf63139dced2a1bff07b5a7b743168275d",h.callServer,void 0,h.findSourceMapURL,"getFeatureArtifact"),N=(0,h.createServerReference)("40678a63f1056ad494365f17601f94a8b3cb4bd458",h.callServer,void 0,h.findSourceMapURL,"getResearchArtifact"),w=(0,h.createServerReference)("4022ddfbbc273c6028fcb798440d4caca039390c83",h.callServer,void 0,h.findSourceMapURL,"getMergeReviewData");var k=e.i(75921),C=e.i(8361),T=e.i(30153),S=e.i(8537),R=e.i(48034);e.i(1650);var M=e.i(11495);e.i(99348);var I=e.i(17466),P=e.i(2828);e.i(31566);var A=e.i(65104),z=e.i(8986),D=e.i(38573),$=e.i(19933),E=e.i(70471),L=e.i(51251);let F="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40";function q({loading:e,error:s,icon:a}){return e?(0,t.jsx)(i.Loader2,{className:"size-3.5 animate-spin"}):s?(0,t.jsx)(L.CircleAlert,{className:"text-destructive size-3.5"}):(0,t.jsx)(a,{className:"size-4"})}function O({actions:e,repositoryPath:a,worktreePath:r,showSpecs:n}){let[l,i]=(0,s.useState)(!1);return(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInIde,disabled:e.ideLoading,"aria-label":"Open in IDE",children:(0,t.jsx)(q,{loading:e.ideLoading,error:e.ideError,icon:z.Code2})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open in IDE"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInShell,disabled:e.shellLoading,"aria-label":"Open terminal",children:(0,t.jsx)(q,{loading:e.shellLoading,error:e.shellError,icon:D.Terminal})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open terminal"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openFolder,disabled:e.folderLoading,"aria-label":"Open folder",children:(0,t.jsx)(q,{loading:e.folderLoading,error:e.folderError,icon:$.FolderOpen})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open folder"})]}),n?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openSpecsFolder,disabled:e.specsLoading,"aria-label":"Open specs",children:(0,t.jsx)(q,{loading:e.specsLoading,error:e.specsError,icon:E.FileText})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open specs"})]}):null,(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:()=>{navigator.clipboard.writeText(r??a),i(!0),setTimeout(()=>i(!1),2e3)},"aria-label":"Copy path",children:l?(0,t.jsx)(x.Check,{className:"size-3.5 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:l?"Copied!":"Copy path"})]})]})})}var B=e.i(79687),U=e.i(16489),V=e.i(74294),W=e.i(3645);let H=(0,W.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),G=(0,W.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),_=(0,W.default)("file-check",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var K=e.i(18532),Z=e.i(93192);let Q=(0,W.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var J=e.i(48109),X=e.i(38227),Y=e.i(53360);let ee=(0,W.default)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);var et=e.i(68304);let es=(0,h.createServerReference)("4003514defce90a910b9d1d4f4378407b4ad35c304",h.callServer,void 0,h.findSourceMapURL,"getFeaturePhaseTimings"),ea=(0,h.createServerReference)("40e10d02bf7505afdfe2161967c14ed17604be7d78",h.callServer,void 0,h.findSourceMapURL,"getFeaturePlan");e.i(47506);var er=e.i(2929);let en=(0,e.i(94237).cva)("inline-block shrink-0",{variants:{size:{sm:"size-5",md:"size-8",lg:"size-12"}},defaultVariants:{size:"md"}}),el=[{r:9,spline:"0.12 0 0.04 1",opacity:1},{r:8.2,spline:"0.16 0 0.08 1",opacity:.95},{r:7.4,spline:"0.20 0 0.12 1",opacity:.9},{r:6.6,spline:"0.25 0 0.16 1",opacity:.84},{r:5.8,spline:"0.30 0 0.20 1",opacity:.76},{r:5,spline:"0.36 0 0.25 1",opacity:.67},{r:4.2,spline:"0.42 0 0.31 1",opacity:.56},{r:3.4,spline:"0.48 0 0.37 1",opacity:.44},{r:2.6,spline:"0.55 0 0.44 1",opacity:.32},{r:1.8,spline:"0.62 0 0.52 1",opacity:.2},{r:1,spline:"0.70 0 0.60 1",opacity:.1}];function ei({className:e,size:s="md",duration:r=5,...n}){return(0,t.jsxs)("svg",{"data-slot":"comet-spinner",role:"status","aria-label":"Loading",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",className:(0,a.cn)(en({size:s}),e),...n,children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:"comet-gooey",x:"-100%",y:"-100%",width:"300%",height:"300%",colorInterpolationFilters:"sRGB",children:[(0,t.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"2.5"}),(0,t.jsx)("feColorMatrix",{mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 -30",result:"goo"})]})}),(0,t.jsxs)("g",{filter:"url(#comet-gooey)",children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 50 50",to:"360 50 50",dur:`${r}s`,repeatCount:"indefinite"}),el.map(e=>(0,t.jsxs)("g",{children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"spline",values:"0 50 50;360 50 50",keyTimes:"0;1",keySplines:e.spline,dur:"1s",repeatCount:"indefinite"}),(0,t.jsx)("circle",{cx:"50",cy:"18",r:e.r,fill:"currentColor",opacity:e.opacity})]},e.r)),(0,t.jsxs)("circle",{cx:"50",cy:"50",r:"4",fill:"currentColor",opacity:"0.15",children:[(0,t.jsx)("animate",{attributeName:"r",values:"3;5;3",dur:"2s",repeatCount:"indefinite"}),(0,t.jsx)("animate",{attributeName:"opacity",values:"0.1;0.25;0.1",dur:"2s",repeatCount:"indefinite"})]})]})]})}var eo=e.i(11345),ed=e.i(76016),ec=e.i(35364),eu=e.i(81846),ex=e.i(16868);let em=(0,W.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);var ep=e.i(58481),eh=e.i(48306);e.i(50032);var ef=e.i(86254),eg=e.i(42076);let eb=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]);function ej({onReject:e,onApprove:n,approveLabel:l,approveVariant:i="default",revisionPlaceholder:o,isProcessing:d=!1,isRejecting:c=!1,children:u,chatInput:m,onChatInputChange:p}){let{t:h}=(0,r.useTranslation)("web"),f="warning"===i,g=f?ep.AlertTriangle:x.Check,b=f?"bg-orange-500/85":"bg-blue-500/85",[j,v]=(0,s.useState)(""),y=m??j,N=p??v,w=(0,C.useSoundAction)("approve"),k=d||c,[T,S]=(0,s.useState)([]),[R,M]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null),[z,D]=(0,s.useState)(!1),[$,E]=(0,s.useState)(!1),[L,F]=(0,s.useState)(!1),q=y.trim().length>0,O=q?z||$&&L:!z,B=(0,s.useRef)(0),U=(0,s.useRef)(crypto.randomUUID()),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){("Control"===e.key||"Meta"===e.key)&&E(!0),"Shift"===e.key&&F(!0)}function t(e){("Control"===e.key||"Meta"===e.key)&&E(!1),"Shift"===e.key&&F(!1)}function s(){E(!1),F(!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",s),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",s)}},[]);let W=(0,s.useCallback)(async e=>{for(let t of(A(null),e)){if(t.size>0xa00000)return void A(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!eb.has(e))return void A(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();S(s=>[...s,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let s=new FormData;s.append("file",t),s.append("sessionId",U.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:s});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));S(t=>t.filter(t=>t.id!==e)),A(t.error??"Upload failed");return}let r=await a.json();S(t=>t.some(t=>t.id!==e&&t.path===r.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...r,id:e,loading:!1}:t))}catch{S(t=>t.filter(t=>t.id!==e)),A("Upload failed")}}},[]),H=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,1===B.current&&M(!0)},[]),G=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,0===B.current&&M(!1)},[]),_=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),K=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&W(t)},[W]),Z=(0,s.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let s=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&s.push(t)}s.length>0&&(e.preventDefault(),W(s))},[W]),Q=(0,s.useCallback)(async()=>{try{let e=await (0,eg.pickFiles)();e&&S(t=>{let s=new Set(t.map(e=>e.path)),a=e.filter(e=>!s.has(e.path)).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,mimeType:"application/octet-stream",path:e.path}));return a.length>0?[...t,...a]:t})}catch{}},[]),J=(0,s.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),X=(0,s.useCallback)((e,t)=>{S(s=>s.map(s=>s.id===e?{...s,notes:t}:s))},[]),Y=(0,s.useCallback)(()=>{N(""),S([]),A(null)},[N]),ee=(0,s.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),V.current?.requestSubmit())},[]),et="u">typeof navigator&&/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl";return(0,t.jsxs)("div",{className:"border-border shrink-0 border-t",children:[u,e?(0,t.jsx)(P.TooltipProvider,{delayDuration:400,children:(0,t.jsx)("form",{ref:V,onSubmit:function(t){t.preventDefault();let s=y.trim();if(O)w.play(),n(),Y();else{if(!s||!e)return;e(s,T.filter(e=>!e.loading)),Y()}},className:"p-3",children:(0,t.jsx)("div",{role:"region","aria-label":h("createDrawer.fileDropZone"),"data-drag-over":R?"true":"false",onDragEnter:H,onDragLeave:G,onDragOver:_,onDrop:K,className:(0,a.cn)("rounded-md border-2 border-transparent transition-colors",R&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{className:"border-input focus-within:ring-ring/50 focus-within:border-ring flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow] focus-within:ring-[3px]",children:[(0,t.jsx)(eh.Textarea,{placeholder:o??"Ask AI to revise...","aria-label":o??"Ask AI to revise...",disabled:k,value:y,onChange:e=>N(e.target.value),onKeyDown:ee,onPaste:Z,rows:1,"aria-invalid":!!I,"aria-describedby":I?"drawer-action-upload-error":void 0,className:"max-h-[35dvh] min-h-9 flex-1 resize-none overflow-y-auto rounded-none border-0 py-2 shadow-none focus-visible:ring-0","data-testid":"drawer-chat-input"}),T.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:T.map(e=>(0,t.jsx)(ef.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>J(e.id),disabled:k,loading:e.loading,notes:e.notes,onNotesChange:t=>X(e.id,t)},e.id))}),I?(0,t.jsx)("p",{id:"drawer-action-upload-error",className:"text-destructive px-3 pb-2 text-xs",role:"alert",children:I}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-2 border-t px-3 py-1.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex-1 truncate text-[11px]",children:[(0,t.jsxs)("kbd",{className:"bg-muted rounded px-1 py-0.5 font-mono text-[10px]",children:[et,"+Enter"]})," ",q?"reject":"approve"]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:Q,disabled:k,"aria-label":h("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(ex.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"top",children:h("chat.attachFiles")})]}),(0,t.jsx)("div",{onMouseLeave:()=>D(!1),children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"submit",disabled:k,"data-testid":"drawer-action-submit",className:(0,a.cn)("relative flex h-9 min-w-[12rem] cursor-pointer items-center overflow-hidden rounded-md border ps-4 pe-10 text-sm font-medium whitespace-nowrap transition-colors","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",O?`${f?"border-orange-400/60":"border-blue-400/60"} text-white`:q&&$&&!L?"border-primary bg-muted ring-primary/30 shadow-sm ring-1":"border-border bg-muted/50 hover:bg-muted shadow-sm"),children:[(0,t.jsx)("div",{className:(0,a.cn)("pointer-events-none absolute inset-0 transition-transform duration-300 ease-in-out",b),style:{transform:O?"translateX(0)":"translateX(100%)"}}),(0,t.jsxs)("span",{className:(0,a.cn)("absolute inset-0 z-10 flex items-center justify-center gap-2 pe-8 transition-opacity duration-300",O?"opacity-0":"opacity-100"),children:[(0,t.jsx)(em,{className:"h-4 w-4 shrink-0"}),"Reject"]}),(0,t.jsxs)("span",{className:(0,a.cn)("absolute inset-0 z-10 flex items-center justify-center gap-2 text-white transition-opacity duration-300",O?"opacity-100":"opacity-0"),children:[(0,t.jsx)(g,{className:"h-4 w-4 shrink-0"}),l]}),(0,t.jsx)("span",{className:(0,a.cn)(`border-input/60 absolute inset-y-0 right-0 z-20 flex w-8 cursor-pointer items-center justify-center rounded-e-[5px] border-s ${b} transition-opacity duration-300`,!q&&!z&&"pointer-events-none opacity-0"),onMouseEnter:()=>D(!0),children:(0,t.jsx)(eo.ChevronLeft,{className:"h-4 w-4 text-white"})})]})}),f?null:(0,t.jsx)(P.TooltipContent,{side:"top",children:O?l:h("drawerActionBar.sendRevisionFeedback")})]})})]})]})})})}):(0,t.jsx)("div",{className:"flex items-center gap-2 px-4 pb-4",children:(0,t.jsx)(ec.Button,{type:"button",className:"flex-1",disabled:k,onClick:()=>{w.play(),n()},children:l})})]})}function ev({data:e,selections:r,onSelect:n,onApprove:l,onReject:i,isProcessing:o=!1,isRejecting:d=!1,showHeader:c=!1,chatInput:u,onChatInputChange:x}){let{question:m,context:p,questions:h,finalAction:f}=e,[g,b]=(0,s.useState)(0),j=(0,C.useSoundAction)("select"),v=(0,C.useSoundAction)("navigate"),y=h.length,N=g===y-1,w=h[g],k=(0,s.useMemo)(()=>Object.keys(r).length,[r]),T=(0,s.useCallback)((e,t)=>{j.play(),n(e,t),N||setTimeout(()=>b(e=>e+1),250)},[n,N,j]);return 0===y?null:(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[c?(0,t.jsxs)("div",{className:"border-border flex items-start gap-3 border-b pb-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full bg-amber-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground mb-1.5 text-sm font-bold",children:m}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:p})]})]}):null,(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("label",{className:"text-foreground min-w-0 flex-1 text-sm font-semibold",children:[g+1,". ",w.question]}),(0,t.jsx)("div",{className:"mt-1.5 flex shrink-0 gap-1",children:h.map((e,s)=>(0,t.jsx)("button",{type:"button","aria-label":`Go to question ${s+1}`,className:(0,a.cn)("h-1.5 rounded-full transition-all duration-200",s===g?"bg-primary w-4":"w-1.5",s!==g&&r[e.id]?"bg-primary/50":"",s===g||r[e.id]?"":"bg-muted-foreground/25"),onClick:()=>{v.play(),b(s)}},e.id))})]}),(0,t.jsx)("div",{className:"space-y-2",children:w.options.map((e,s)=>{let n=r[w.id]===e.id,l=String.fromCharCode(65+s);return(0,t.jsx)("button",{type:"button",className:(0,a.cn)("border-border w-full overflow-hidden rounded-md border px-3 py-3 text-start text-xs transition-all","hover:border-primary/70 hover:bg-primary/5 group",n&&"border-primary bg-primary/5",e.isNew&&"animate-option-highlight"),disabled:o,onClick:()=>T(w.id,e.id),children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("span",{className:"text-muted-foreground mt-0.5 font-mono text-xs",children:[l,"."]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-foreground mb-0.5 text-xs font-semibold wrap-break-word",children:e.label}),(0,t.jsx)("div",{className:"text-muted-foreground text-xs leading-snug",children:e.rationale})]}),e.recommended||e.isNew?(0,t.jsx)("div",{className:"shrink-0 pt-0.5",children:e.recommended?(0,t.jsx)(eu.Badge,{className:"px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):(0,t.jsx)(eu.Badge,{className:"border-transparent bg-emerald-600 px-1.5 py-0 text-[10px] whitespace-nowrap text-white hover:bg-emerald-600/80",children:"New"})}):null]})},e.id)})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:0===g||o,onClick:()=>{v.play(),b(e=>e-1)},children:[(0,t.jsx)(eo.ChevronLeft,{className:"me-1 h-4 w-4"}),"Previous"]}),N?null:(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>{v.play(),b(e=>e+1)},children:[r[w.id]?"Next":"Skip",(0,t.jsx)(ed.ChevronRight,{className:"ms-1 h-4 w-4"})]})]})]}),(0,t.jsx)(ej,{onReject:i,onApprove:()=>l(f.id),approveLabel:f.label,revisionPlaceholder:"Ask AI to refine requirements...",isProcessing:o,isRejecting:d,chatInput:u,onChatInputChange:x,children:(0,t.jsx)("div",{className:(0,a.cn)("bg-muted h-1.5 overflow-hidden",k>0&&k<y||o?"opacity-100":"opacity-0","transition-opacity duration-200"),"data-testid":"progress-bar-container",children:o?(0,t.jsx)("div",{className:"bg-primary animate-indeterminate-progress h-full w-1/3"}):(0,t.jsx)("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${y>0?k/y*100:0}%`},"data-testid":"progress-bar"})})})]})}var ey=e.i(68864);let eN=(0,W.default)("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]),ew={p:({children:e})=>(0,t.jsx)("p",{className:"text-muted-foreground mb-2 text-xs leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"text-foreground font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:s})=>s?(0,t.jsx)("code",{className:`${s} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-muted my-2 overflow-x-auto rounded-lg border p-3",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"text-muted-foreground mb-2 list-disc space-y-1 ps-4 text-xs",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"text-muted-foreground mb-2 list-decimal space-y-1 ps-4 text-xs",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"leading-relaxed",children:e}),a:({children:e,href:s})=>(0,t.jsx)("a",{href:s,className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e})};function ek({decision:e,index:a}){let[r,n]=(0,s.useState)(!1),l=(0,C.useSoundAction)("expand"),i=(0,C.useSoundAction)("collapse");return(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:a+1}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.title}),(0,t.jsx)("p",{className:"text-muted-foreground mt-0.5 text-xs",children:e.chosen})]})]}),"decisionName"in e&&e.decisionName?(0,t.jsx)(eu.Badge,{variant:"secondary",className:"bg-primary/10 text-primary shrink-0",children:e.decisionName}):null]}),e.rationale?(0,t.jsx)(ey.default,{components:ew,children:e.rationale}):null]}),e.rejected.length>0?(0,t.jsxs)("div",{className:"border-border border-t",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{r?i.play():l.play(),n(e=>!e)},className:"text-muted-foreground hover:bg-muted/50 flex w-full items-center gap-1.5 px-4 py-3 text-xs font-medium transition-colors",children:[(0,t.jsx)(ed.ChevronRight,{className:`h-3.5 w-3.5 transition-transform ${r?"rotate-90":""}`}),(0,t.jsx)(ee,{className:"h-3.5 w-3.5"}),"Other Options Considered (",e.rejected.length,")"]}),r?(0,t.jsx)("div",{className:"space-y-1.5 px-4 pb-3",children:e.rejected.map(e=>(0,t.jsx)("div",{className:"bg-primary/5 rounded-md px-3 py-2",children:(0,t.jsx)("span",{className:"text-foreground text-xs",children:e})},e))}):null]}):null]})}function eC({data:e}){let{summary:s,decisions:a}=e;return 0===a.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:"Technical Implementation Plan Review"}),s?(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,t.jsx)(eN,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Technical Decisions"})]}),a.map((e,s)=>(0,t.jsx)(ek,{decision:e,index:s},e.title))]})}var eT=e.i(41698);function eS({item:e,index:s}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsx)("div",{className:"space-y-2 px-4 py-3",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:s+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.question}),(0,t.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,t.jsx)("p",{className:"text-muted-foreground min-w-0 truncate text-xs",children:e.selectedOption}),e.wasRecommended?(0,t.jsx)(eu.Badge,{className:"shrink-0 px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):null]})]})]})})})}function eR({data:e}){let{questions:s}=e;return 0===s.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eT.ClipboardList,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Product Decisions"})]}),s.map((e,s)=>(0,t.jsx)(eS,{item:e,index:s},e.question))]})}var eM=e.i(30702);let eI=(0,W.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);var eP=e.i(65530),eA=e.i(49228);let ez=(0,W.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),eD=(0,W.default)("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),e$=(0,W.default)("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var eE=e.i(81181),eL=e.i(99105),eF=e.i(35e3),eq=e.i(30090),eq=eq,eO=e.i(17406);function eB({status:e}){switch(e){case eO.CiStatus.Success:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)(eF.CheckCircle2,{className:"me-1 h-3.5 w-3.5"}),"Passing"]});case eO.CiStatus.Pending:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-yellow-50 text-yellow-700 hover:bg-yellow-50",children:[(0,t.jsx)(i.Loader2,{className:"me-1 h-3.5 w-3.5 animate-spin"}),"Pending"]});case eO.CiStatus.Failure:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-red-50 text-red-700 hover:bg-red-50",children:[(0,t.jsx)(eq.default,{className:"me-1 h-3.5 w-3.5"}),"Failing"]})}}var eU=e.i(12919);let eV=(0,W.default)("file-minus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);var eW=e.i(35749);let eH={added:{icon:eU.FilePlus,label:"A",className:"text-green-600"},modified:{icon:eW.FileEdit,label:"M",className:"text-amber-600"},deleted:{icon:eV,label:"D",className:"text-red-600"},renamed:{icon:eW.FileEdit,label:"R",className:"text-blue-600"}};function eG({status:e}){let s=eH[e],r=s.icon;return(0,t.jsx)(r,{className:(0,a.cn)("h-3.5 w-3.5 shrink-0",s.className)})}function e_({hunk:e}){return(0,t.jsxs)("div",{className:"border-border border-t first:border-t-0",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-muted-foreground px-3 py-1 font-mono text-[10px]",children:e.header}),(0,t.jsx)("div",{className:"font-mono text-[11px] leading-[18px]",children:e.lines.map(e=>(0,t.jsxs)("div",{className:(0,a.cn)("flex","added"===e.type&&"bg-green-50 dark:bg-green-950/30","removed"===e.type&&"bg-red-50 dark:bg-red-950/30"),children:[(0,t.jsx)("span",{className:"text-muted-foreground w-10 shrink-0 px-1 text-end text-[10px] select-none",children:e.oldNumber??""}),(0,t.jsx)("span",{className:"text-muted-foreground w-10 shrink-0 px-1 text-end text-[10px] select-none",children:e.newNumber??""}),(0,t.jsx)("span",{className:(0,a.cn)("w-4 shrink-0 text-center select-none","added"===e.type&&"text-green-700 dark:text-green-400","removed"===e.type&&"text-red-700 dark:text-red-400"),children:"added"===e.type?"+":"removed"===e.type?"-":" "}),(0,t.jsx)("span",{className:"min-w-0 flex-1 pe-2 break-all whitespace-pre-wrap",children:e.content})]},`${e.type}-${e.oldNumber??""}-${e.newNumber??""}`))})]})}function eK({file:e}){let[r,n]=(0,s.useState)(!1),l=e.path.split("/").pop()??e.path,i=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,t.jsxs)("div",{className:"border-border border-b last:border-b-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(!r),className:"hover:bg-muted/50 flex w-full items-center gap-2 px-3 py-2 text-start",children:[(0,t.jsx)(ed.ChevronRight,{className:(0,a.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform duration-150",r&&"rotate-90")}),(0,t.jsx)(eG,{status:e.status}),(0,t.jsx)("span",{className:"text-foreground min-w-0 flex-1 truncate text-xs",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[i,"/"]}),l]}):l}),e.oldPath?(0,t.jsxs)("span",{className:"text-muted-foreground truncate text-[10px]",children:["← ",e.oldPath.split("/").pop()]}):null,(0,t.jsxs)("span",{className:"shrink-0 text-[10px]",children:[e.additions>0?(0,t.jsxs)("span",{className:"text-green-600",children:["+",e.additions]}):null,e.additions>0&&e.deletions>0?" ":null,e.deletions>0?(0,t.jsxs)("span",{className:"text-red-600",children:["-",e.deletions]}):null]})]}),r&&e.hunks.length>0?(0,t.jsx)("div",{className:"border-border overflow-x-auto border-t",children:e.hunks.map(e=>(0,t.jsx)(e_,{hunk:e},e.header))}):null]})}function eZ({fileDiffs:e}){return 0===e.length?null:(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)(E.FileText,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changed Files"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:["(",e.length,")"]})]})}),(0,t.jsx)("div",{className:"border-border border-t",children:e.map(e=>(0,t.jsx)(eK,{file:e},`${e.status}-${e.path}`))})]})}let eQ={Screenshot:eD,Video:e$,TestOutput:E.FileText,TerminalRecording:D.Terminal},eJ=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp"]),eX=new Set([".mp4",".webm",".mov"]);function eY({evidence:e}){var a,r;let n,[l,i]=(0,s.useState)(!0),o=eQ[e.type]??eD,d=(n=(a=e.relativePath).lastIndexOf("."))>=0?a.slice(n).toLowerCase():"",c=(r=e.relativePath,`/api/evidence?path=${encodeURIComponent(r)}`),u="Screenshot"===e.type||eJ.has(d),x="Video"===e.type||eX.has(d),m="TestOutput"===e.type||"TerminalRecording"===e.type;return(0,t.jsxs)("li",{className:"border-border rounded-md border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(!l),className:"flex w-full cursor-pointer items-center gap-2.5 px-3 py-2.5 text-start",children:[l?(0,t.jsx)(eL.ChevronDown,{className:"text-muted-foreground h-3 w-3 shrink-0"}):(0,t.jsx)(ed.ChevronRight,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)(o,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"text-foreground text-xs font-medium",children:e.description}),e.taskRef?(0,t.jsxs)("span",{className:"text-muted-foreground ms-1.5 text-[10px]",children:["(",e.taskRef,")"]}):null]}),(0,t.jsx)("a",{href:c,download:!0,onClick:e=>e.stopPropagation(),className:"text-muted-foreground hover:text-foreground shrink-0 rounded p-1 transition-colors","aria-label":"Download",children:(0,t.jsx)(eE.Download,{className:"h-3 w-3"})})]}),l&&c?(0,t.jsx)("div",{className:"border-border border-t px-3 py-2.5",children:u?(0,t.jsx)("img",{src:c,alt:e.description,className:"max-h-80 w-full rounded-md border object-contain",loading:"lazy"}):x?(0,t.jsx)("video",{src:c,controls:!0,className:"max-h-80 w-full rounded-md border",preload:"metadata",children:(0,t.jsx)("track",{kind:"captions"})}):m?(0,t.jsx)(e0,{url:c}):(0,t.jsx)("p",{className:"text-muted-foreground truncate font-mono text-[10px]",children:e.relativePath})}):null,null]})}function e0({url:e}){let[a,r]=(0,s.useState)(null),[n,l]=(0,s.useState)(!1);return n?a?(0,t.jsx)("pre",{className:"bg-muted/50 max-h-60 overflow-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:a}):(0,t.jsx)("p",{className:"text-muted-foreground text-[10px]",children:"Unable to load preview"}):(fetch(e).then(e=>e.ok?e.text():Promise.reject(Error("Failed"))).then(e=>{let t=e.split("\n");r(t.length>100?`${t.slice(0,100).join("\n")}
2
- ...`:e)}).catch(()=>r(null)).finally(()=>l(!0)),(0,t.jsx)("div",{className:"bg-muted/50 h-16 animate-pulse rounded-md"}))}function e1({evidence:e}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(eD,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Evidence"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"text-[10px]",children:e.length})]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(eY,{evidence:e},`${e.type}-${e.relativePath}`))})]})})}function e2({data:e,readOnly:s=!1,onApprove:a,onReject:r,isProcessing:n=!1,isRejecting:l=!1,chatInput:i,onChatInputChange:o}){let{pr:d,diffSummary:c,fileDiffs:u,branch:x,warning:m,evidence:p,hideCiStatus:h}=e,f=d?.mergeable===!1,g=f&&r?()=>r("Resolve merge conflicts",[]):a;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-emerald-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:s?"Merge History":"Merge Review"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s?"This feature was merged. Review the pull request details and evidence below.":d?"Review the pull request details and approve to merge.":"Review the changes and approve to merge."})]})]}),x?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(eA.GitBranch,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"font-mono text-[11px]",children:x.source}),(0,t.jsx)(ez,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"font-mono text-[11px]",children:x.target})]})}):null,d?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary flex items-center gap-1.5 text-sm font-semibold underline underline-offset-2",children:["PR #",d.number,(0,t.jsx)(eM.ExternalLink,{className:"h-3.5 w-3.5"})]}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"text-xs",children:d.status})]}),!1===d.mergeable?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Merge Status"}),(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-orange-50 text-orange-700 hover:bg-orange-50",children:[(0,t.jsx)(ep.AlertTriangle,{className:"me-1 h-3.5 w-3.5"}),"Conflicts"]})]}):null,d.ciStatus&&!0!==h?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"CI Status"}),(0,t.jsx)(eB,{status:d.ciStatus})]}):null,d.commitHash?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Commit"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(eP.GitCommitHorizontal,{className:"text-muted-foreground h-3.5 w-3.5"}),(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:d.commitHash.slice(0,7)})]})]}):null]})}):null,c?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(eI,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changes"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-3",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.filesChanged}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"files"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-green-600",children:["+",c.additions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"additions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-red-600",children:["-",c.deletions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"deletions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.commitCount}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"commits"})]})]})]})}):m?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(ep.AlertTriangle,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:m})]})}):null,p&&p.length>0?(0,t.jsx)(e1,{evidence:p}):null,u&&u.length>0?(0,t.jsx)(eZ,{fileDiffs:u}):null]}),!s&&(0,t.jsx)(ej,{onReject:r,onApprove:g,approveLabel:f?"Resolve Conflicts":"Approve Merge",approveVariant:f?"warning":"default",revisionPlaceholder:"Ask AI to revise before merging...",isProcessing:n,isRejecting:l,chatInput:i,onChatInputChange:o})]})}var e5=e.i(55016);let e3=(0,W.default)("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),e4=(0,W.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var e6=e.i(43416),e8=e.i(39200);let e9=(0,W.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var e7=e.i(60253),te=e.i(2287),tt=e.i(19807),ts=e.i(80436);let ta=(0,W.default)("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]),tr=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function tn(e){let t=e.lastIndexOf(".");return t>=0&&tr.has(e.slice(t).toLowerCase())}function tl(e){let t=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"",s=tn(e)?`image/${t.slice(1).replace("jpg","jpeg")}`:"",a=new URLSearchParams({path:e,...s&&{mimeType:s}});return`/api/attachments/preview?${a.toString()}`}let ti=/(?:^|\s)@(\/[^\s]+)/g;function to({text:e,attachmentPaths:s}){let a=function(e){let t=[],s=0;for(let a of e.matchAll(ti)){let r=a.index,n=r+(a[0].length-a[0].trimStart().length);n>s&&t.push({type:"text",value:e.slice(s,n)}),t.push({type:"attachment",path:a[1]}),s=r+a[0].length}return s<e.length&&t.push({type:"text",value:e.slice(s)}),t}(e),r=a.some(e=>"attachment"===e.type),n=s?.filter(Boolean)??[];return r||0!==n.length?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[a.map(e=>{if("text"===e.type){let s=e.value.trim();return s?(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:s},`text-${s.slice(0,40)}`):null}return(0,t.jsx)(td,{path:e.path},`att-${e.path}`)}),n.map(e=>(0,t.jsx)(td,{path:e},`extra-${e}`))]}):(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:e})}function td({path:e}){let a=e.split("/").pop()??e,[r,n]=(0,s.useState)(!1);return tn(e)?r?(0,t.jsxs)("div",{"data-testid":"inline-attachment-image-error",className:"text-muted-foreground flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,t.jsx)(ta,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a})]}):(0,t.jsxs)(te.Dialog,{children:[(0,t.jsx)(te.DialogTrigger,{asChild:!0,children:(0,t.jsx)("img",{src:tl(e),alt:a,"data-testid":"inline-attachment-image",onError:()=>n(!0),className:"max-h-48 max-w-full cursor-pointer rounded-md border object-contain transition-opacity hover:opacity-80"})}),(0,t.jsxs)(te.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,t.jsx)(tt.VisuallyHidden.Root,{children:(0,t.jsxs)(te.DialogTitle,{children:["Preview: ",a]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:tl(e),alt:a,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,t.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col",children:(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:a})}),(0,t.jsx)("a",{href:tl(e),download:a,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${a}`,children:(0,t.jsx)(ts.DownloadIcon,{className:"h-4 w-4"})})]})]})]}):(0,t.jsx)("a",{href:tl(e),download:a,"data-testid":"inline-attachment-file",className:"text-primary text-sm underline underline-offset-2",children:a})}e.i(81803);var tc=e.i(72714),tu=e.i(86782),tx=e.i(29847);function tm(e){if(0===e)return"0s";let t=Math.floor(e/1e3);if(0===t)return"<1s";let s=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return s>0?`${s}h ${a}m`:a>0?`${a}m ${r}s`:`${r}s`}function tp({icon:e,title:s,children:a}){return(0,t.jsxs)("div",{className:"px-3 pt-4 pb-1",children:[(0,t.jsxs)("div",{className:"text-foreground mb-2 flex items-center gap-1.5 text-sm font-semibold tracking-wider uppercase",children:[(0,t.jsx)(e,{className:"size-4 opacity-50"}),s]}),a]})}function th({children:e,className:s}){return(0,t.jsx)("div",{className:(0,a.cn)("bg-muted/60 rounded-md border border-transparent p-3",s),children:e})}function tf({label:e,children:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-foreground/40 text-[11px] font-medium tracking-wider uppercase",children:e}),(0,t.jsx)("span",{className:"text-sm leading-snug",children:s})]})}function tg({on:e,label:s}){return(0,t.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium",e?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-foreground/[0.04] text-foreground/25"),children:[e?(0,t.jsx)(x.Check,{className:"size-3"}):(0,t.jsx)(e7.X,{className:"size-3"}),s]})}let tb={[eO.PrStatus.Open]:"text-blue-600 dark:text-blue-400",[eO.PrStatus.Merged]:"text-purple-600 dark:text-purple-400",[eO.PrStatus.Closed]:"text-red-600 dark:text-red-400"};function tj({data:e,syncStatus:r,syncLoading:n,syncError:l,onRefreshSync:i,onRebaseOnMain:o,rebaseLoading:d,rebaseError:c}){var u;let x,m,p,h,f,g,b="maintain"===e.lifecycle,j=function(e){let[t,a]=(0,s.useState)(null),r=(0,s.useRef)(null);return(0,s.useEffect)(()=>e?(a(tm(Math.max(0,Date.now()-e))),r.current=setInterval(()=>{a(tm(Math.max(0,Date.now()-e)))},1e3),()=>{r.current&&clearInterval(r.current)}):void a(null),[e]),t}("running"===e.state||"action-required"===e.state?e.startedAt:void 0),v=er.featureNodeStateConfig[e.state],y=!!e.summary&&!(e.userQuery&&e.summary?.trim()===e.userQuery.trim());return(0,t.jsxs)("div",{"data-testid":"feature-drawer-status",className:"pb-4",children:[!b&&e.progress>0?(0,t.jsx)("div",{"data-testid":"feature-drawer-progress",className:"px-3 pb-2",children:(0,t.jsx)("div",{className:"bg-foreground/[0.06] h-1.5 w-full overflow-hidden rounded-full",children:(0,t.jsx)("div",{className:(0,a.cn)("h-full rounded-full transition-all",v.progressClass),style:{width:`${e.progress}%`}})})}):null,e.oneLiner||e.userQuery||y?(0,t.jsx)(tp,{icon:e4,title:"Description",children:(0,t.jsxs)(th,{className:"flex flex-col gap-2",children:[e.oneLiner?(0,t.jsx)(tf,{label:"One-Liner",children:e.oneLiner}):null,e.userQuery?(0,t.jsx)(tf,{label:"Query",children:(0,t.jsx)(to,{text:e.userQuery})}):null,y?(0,t.jsx)(tf,{label:"Summary",children:(0,t.jsx)("span",{className:"leading-snug",children:e.summary})}):null]})}):null,e.pr?(0,t.jsx)(tp,{icon:eP.GitCommitHorizontal,title:"Pull Request",children:(0,t.jsx)(th,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("a",{href:e.pr.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center gap-1 text-sm font-semibold hover:underline",children:["#",e.pr.number," ",(0,t.jsx)(eM.ExternalLink,{className:"size-3"})]}),(0,t.jsx)("span",{className:(0,a.cn)("text-xs font-semibold",tb[e.pr.status]),children:e.pr.status}),!1===e.pr.mergeable?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-orange-600 dark:text-orange-400",children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3 shrink-0"})," Conflicts"]}):null,e.pr.ciStatus&&!0!==e.hideCiStatus?(0,t.jsx)(eB,{status:e.pr.ciStatus}):null,e.pr.commitHash?(0,t.jsx)("code",{className:"text-foreground/40 ml-auto font-mono text-[11px]",children:e.pr.commitHash.slice(0,7)}):null]})})}):null,(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-3 pb-1",children:[e.branch?(0,t.jsx)(th,{children:(0,t.jsxs)(tf,{label:"Branch",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(eA.GitBranch,{className:"text-foreground/30 size-3 shrink-0"}),(0,t.jsx)("code",{className:"font-mono text-[11px]",children:e.branch})]}),e.baseBranch?(0,t.jsxs)("span",{className:"text-foreground/30 block text-[10px]",children:["from ",e.baseBranch]}):null]})}):null,e.agentType||e.modelId?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:"Agent",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.agentType?(x=(0,tu.getAgentTypeIcon)(e.agentType),(0,t.jsx)(x,{className:"size-3.5 shrink-0 opacity-50"})):null,e.agentType?(0,t.jsx)("span",{children:tu.agentTypeLabels[e.agentType]??e.agentType}):null,e.agentType&&e.modelId?(0,t.jsx)("span",{className:"text-foreground/20",children:"/"}):null,e.modelId?(0,t.jsx)("span",{className:"text-foreground/50 text-[12px]",children:(0,tx.getModelMeta)(e.modelId).displayName||e.modelId}):null]})})}):null,e.createdAt?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:"Created",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),(u=e.createdAt,m=Date.now(),(g=Math.floor((f=Math.floor((h=Math.floor((m-(p="string"==typeof u?new Date(u).getTime():u))/6e4))/60))/24))>30?new Date(p).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):g>0?`${g}d ago`:f>0?`${f}h ago`:h>0?`${h}m ago`:"just now")]})})}):null,e.fastMode?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:"Mode",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-amber-600 dark:text-amber-400",children:[(0,t.jsx)(Y.Zap,{className:"size-3.5"})," Fast"]})})}):null,e.runtime||j?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:e.runtime?"Runtime":"Elapsed",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),e.runtime??j]})})}):null]}),e.blockedBy||e.errorMessage?(0,t.jsx)(tp,{icon:ep.AlertTriangle,title:"Issues",children:(0,t.jsxs)(th,{className:"border-destructive/20 bg-destructive/5",children:[e.blockedBy?(0,t.jsx)(tf,{label:"Blocked By",children:e.blockedBy}):null,e.errorMessage?(0,t.jsx)(tf,{label:"Error",children:(0,t.jsx)("span",{className:"text-destructive",children:e.errorMessage})}):null]})}):null,o&&e.branch&&i?(0,t.jsx)(tp,{icon:e6.RefreshCw,title:"Branch Sync",children:(0,t.jsx)(tv,{syncStatus:r??null,syncLoading:n??!1,syncError:l??null,onRefreshSync:i,onRebaseOnMain:o,rebaseLoading:d??!1,rebaseError:c??null})}):null,(0,t.jsx)(ty,{data:e})]})}function tv({syncStatus:e,syncLoading:s,syncError:n,onRefreshSync:l,onRebaseOnMain:i,rebaseLoading:o,rebaseError:d}){let{t:c}=(0,r.useTranslation)("web"),u=null!=e&&e.behind>0,x=e?.behind===0,m=e?.baseBranch??"main";return(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{"data-testid":"branch-sync-status",className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-1.5 text-[13px]",children:s&&!e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsx)("span",{className:"text-foreground/40",children:"Checking..."})]}):n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-red-500"}),(0,t.jsx)("span",{className:"text-destructive text-xs",children:n})]}):o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsxs)("span",{children:["Rebasing on ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),"..."]})]}):u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-orange-500"}),(0,t.jsxs)("span",{children:[e.behind," behind ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eF.CheckCircle2,{className:"size-3.5 text-green-500"}),(0,t.jsxs)("span",{children:["Up to date · ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):null}),(e||n)&&!o?(0,t.jsx)("button",{onClick:l,disabled:s,className:"text-foreground/30 hover:text-foreground/60 hover:bg-foreground/5 inline-flex size-6 items-center justify-center rounded-sm disabled:opacity-50","aria-label":c("branchSyncStatus.refreshSyncStatus"),children:(0,t.jsx)(e6.RefreshCw,{className:(0,a.cn)("size-3",s&&"animate-spin")})}):null]}),u&&!o?(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(tc.ActionButton,{label:c("branchSyncStatus.rebaseOnMain"),onClick:i,loading:!1,error:!!d,icon:Q,variant:"outline",size:"sm"})}):null,d?(0,t.jsx)("p",{className:"text-destructive pt-1 text-[11px]",children:d}):null]})}function ty({data:e}){return null==e.approvalGates&&null==e.push&&null==e.openPr&&null==e.ciWatchEnabled&&null==e.enableEvidence&&null==e.forkAndPr&&null==e.commitSpecs?null:(0,t.jsx)(tp,{icon:e8.Settings,title:"Settings",children:(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[e.approvalGates?(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{className:"text-foreground/40 mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(e9,{className:"size-3"})," Approve"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(tg,{on:e.approvalGates.allowPrd,label:"PRD"}),(0,t.jsx)(tg,{on:e.approvalGates.allowPlan,label:"Plan"}),(0,t.jsx)(tg,{on:e.approvalGates.allowMerge,label:"Merge"})]})]}):null,null!=e.enableEvidence?(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{className:"text-foreground/40 mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(e3,{className:"size-3"})," Evidence"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(tg,{on:e.enableEvidence,label:"Collect"}),null!=e.commitEvidence?(0,t.jsx)(tg,{on:e.commitEvidence,label:"Add to PR"}):null]})]}):null,null!=e.push||null!=e.openPr||null!=e.ciWatchEnabled||null!=e.commitSpecs||null!=e.forkAndPr?(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{className:"text-foreground/40 mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(eA.GitBranch,{className:"size-3"})," Git"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[null!=e.push?(0,t.jsx)(tg,{on:e.push,label:"Push"}):null,null!=e.openPr?(0,t.jsx)(tg,{on:e.openPr,label:"PR"}):null,null!=e.ciWatchEnabled?(0,t.jsx)(tg,{on:e.ciWatchEnabled,label:"Watch"}):null,null!=e.commitSpecs?(0,t.jsx)(tg,{on:e.commitSpecs,label:"Specs"}):null,null!=e.forkAndPr?(0,t.jsx)(tg,{on:e.forkAndPr,label:"Fork"}):null]})]}):null]})})}let tN=(0,W.default)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var eq=eq,tw=e.i(94819),tk=e.i(58860);let tC=(0,W.default)("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),tT=(0,W.default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);function tS(e,t){if(null!=e.durationMs&&e.durationMs>0)return e.durationMs;if(!e.completedAt&&e.startedAt){let s=new Date(e.startedAt).getTime();if(!Number.isNaN(s))return Math.max(0,t-s)}return 0}function tR(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tM(e){let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?"":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function tI(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}let tP={analyze:"Analyzing",requirements:"Requirements",research:"Researching",plan:"Planning",implement:"Implementing",rebase:"Rebasing","fast-implement":"Fast Implement",evidence:"Evidence",validate:"Validating",repair:"Repairing",merge:"Merging"},tA={"run:started":{label:"started",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:d.Play},"run:resumed":{label:"resumed",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:X.RotateCcw},"run:completed":{label:"completed",colorClass:"text-emerald-600",bgClass:"bg-emerald-50 dark:bg-emerald-950/30",icon:eF.CheckCircle2},"run:failed":{label:"failed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:stopped":{label:"stopped",colorClass:"text-amber-600",bgClass:"bg-amber-50 dark:bg-amber-950/30",icon:c.Square},"run:crashed":{label:"crashed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:rejected":{label:"rejected",colorClass:"text-orange-600",bgClass:"bg-orange-50 dark:bg-orange-950/30",icon:tw.Ban}};function tz(e){return e.startsWith("run:")}function tD({timings:e,loading:a,error:n,rejectionFeedback:l}){let{t:o}=(0,r.useTranslation)("web"),d=function(e){let[t,a]=(0,s.useState)(Date.now),r=(0,s.useRef)(null);return(0,s.useEffect)(()=>(e&&e.some(e=>!e.phase.startsWith("run:")&&!e.completedAt&&e.startedAt)&&(r.current=setInterval(()=>a(Date.now()),1e3)),()=>{r.current&&(clearInterval(r.current),r.current=null)}),[e]),t}(e);if(a)return(0,t.jsx)("div",{"data-testid":"activity-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(n)return(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-base text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]});if(!e||0===e.length)return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(e5.Clock,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-base",children:o("activityTab.noActivityRecorded")})]});let c=e.filter(e=>!tz(e.phase)),u=Math.max(...c.map(e=>tS(e,d)),...c.map(e=>e.approvalWaitMs??0),0),x=function(e,t){if(!e.length)return[];let s=e.filter(e=>"run:rejected"===e.phase).length,a=t?.length??0,r=e;if(a>s){r=[...e];let n=e[e.length-1].agentRunId;for(let e=s;e<a;e++){let a=t[e];e>s&&r.push({agentRunId:n,phase:"run:resumed",startedAt:a.timestamp??`synthetic-resumed-${e}`}),r.push({agentRunId:n,phase:"run:rejected",startedAt:a.timestamp??`synthetic-${e}`})}}let n=[],l=[],i=0;for(let e of r)if(l.push(e),"run:rejected"===e.phase){let e=t?.[i];n.push({number:n.length+1,timings:l,rejectionMessage:e?.message,rejectionAttachments:e?.attachments}),l=[],i++}return l.length>0&&n.push({number:n.length+1,timings:l}),n}(e,l),m=x.length>1,p=c.reduce((e,t)=>e+tS(t,d),0),h=c.reduce((e,t)=>e+(t.approvalWaitMs??0),0),f=c.reduce((e,t)=>e+(t.inputTokens??0),0),g=c.reduce((e,t)=>e+(t.outputTokens??0),0),b=c.reduce((e,t)=>e+(t.costUsd??0),0);return(0,t.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,t.jsx)("div",{"data-testid":"activity-timings",className:"flex flex-col gap-3",children:x.map(e=>(0,t.jsx)(t$,{iteration:e,showHeader:m,maxDurationMs:u,now:d},e.number))}),p>0?(0,t.jsx)(tq,{totalExecMs:p,totalWaitMs:h,totalInputTokens:f,totalOutputTokens:g,totalCostUsd:b}):null]})}function t$({iteration:e,showHeader:s,maxDurationMs:a,now:r}){let n=function(e){let t=[...e.timings].reverse().find(e=>tz(e.phase));if(!t)return null;switch(t.phase){case"run:rejected":return{label:"Rejected",colorClass:"text-orange-600",dotClass:"bg-orange-500"};case"run:completed":return{label:"Completed",colorClass:"text-emerald-600",dotClass:"bg-emerald-500"};case"run:failed":return{label:"Failed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:crashed":return{label:"Crashed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:stopped":return{label:"Stopped",colorClass:"text-amber-600",dotClass:"bg-amber-500"};default:return null}}(e);return(0,t.jsxs)("div",{"data-testid":`iteration-${e.number}`,className:"border-border/50 bg-card/50 flex flex-col overflow-hidden rounded-lg border",children:[s?(0,t.jsxs)("div",{className:"bg-muted/30 border-border/50 flex items-center justify-between border-b px-3 py-1.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground text-sm font-semibold tracking-wide",children:["Iteration ",e.number]}),n?(0,t.jsxs)("span",{className:`flex items-center gap-1 text-xs font-medium ${n.colorClass}`,children:[(0,t.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${n.dotClass}`}),n.label]}):null]}):null,(0,t.jsxs)("div",{className:"relative flex flex-col",children:[(0,t.jsx)("div",{className:"bg-border/60 absolute top-4 bottom-4 left-[21.5px] w-px"}),e.timings.map((s,n)=>{if(tz(s.phase)){let a,r="run:rejected"===s.phase,l="run:failed"===s.phase||"run:crashed"===s.phase||"run:stopped"===s.phase;if(r)a=e.rejectionMessage;else if(l){let t=[...e.timings].reverse().find(e=>!tz(e.phase)&&e.errorMessage);a=t?.errorMessage??s.errorMessage}return(0,t.jsx)(tE,{timing:s,message:a,attachments:r?e.rejectionAttachments:void 0,isFirst:0===n,isLast:n===e.timings.length-1},`${s.agentRunId}-${s.phase}-${s.startedAt}`)}return(0,t.jsx)(tL,{timing:s,maxDurationMs:a,now:r},`${s.agentRunId}-${s.phase}-${s.startedAt}`)})]})]})}function tE({timing:e,message:s,attachments:a,isFirst:r,isLast:n}){let l,i=tA[e.phase];if(!i)return null;let o=a&&a.length>0,d=i.icon;return(0,t.jsxs)("div",{className:`relative flex flex-col gap-1 px-3 ${r?"pt-2":"pt-1"} ${n?"pb-2":"pb-1"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:`relative z-10 flex h-5 w-5 shrink-0 items-center justify-center rounded-full ${i.bgClass}`,children:(0,t.jsx)(d,{className:`h-3 w-3 ${i.colorClass}`})}),(0,t.jsx)("span",{className:`text-sm font-medium ${i.colorClass}`,children:i.label}),e.startedAt&&!("string"==typeof e.startedAt&&e.startedAt.startsWith("synthetic"))?(0,t.jsx)("span",{className:"text-muted-foreground/60 ml-auto text-xs tabular-nums",children:tM(String(e.startedAt))}):null]}),s?(l="run:failed"===e.phase||"run:crashed"===e.phase||"run:stopped"===e.phase,(0,t.jsxs)("div",{className:`ml-[26px] flex items-start gap-1.5 rounded-md px-2 py-1.5 ${l?"bg-red-50/50 dark:bg-red-950/20":"bg-orange-50/50 dark:bg-orange-950/20"}`,children:[l?(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-400"}):(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-orange-400"}),(0,t.jsxs)("span",{"data-testid":l?"error-message-text":"rejection-feedback-text",className:"text-muted-foreground text-xs leading-relaxed italic",children:["— ",s]})]})):null,o?(0,t.jsx)("div",{"data-testid":"rejection-feedback-attachments",className:"ml-[26px]",children:(0,t.jsx)(to,{text:"",attachmentPaths:a})}):null]})}function tL({timing:e,maxDurationMs:a,now:n}){let{t:l}=(0,r.useTranslation)("web"),i=e.phase.includes(":")?e.phase.split(":")[0]:e.phase,o=e.phase.includes(":")?e.phase.split(":")[1]:null,d=null!==o,c=o?.startsWith("phase-")??!1,m=tP[i]??i,p=c?`Phase ${o.replace("phase-","")}`:null!==o?`${m} #${o}`:m,h=tS(e,n),f=!e.completedAt&&!!e.startedAt,g=f?15:2,b=a>0?Math.max(g,h/a*100):g,j=e.completedAt?c?"bg-emerald-400":d?"bg-amber-500":"bg-emerald-500":"bg-blue-500",v=null!=e.inputTokens||null!=e.outputTokens?(e.inputTokens??0)+(e.outputTokens??0):null,[y,N]=(0,s.useState)(!1),w=(0,s.useCallback)(()=>{e.prompt&&navigator.clipboard.writeText(e.prompt).then(()=>{N(!0),setTimeout(()=>N(!1),1500)})},[e.prompt]);return(0,t.jsxs)("div",{className:`group/phase relative flex flex-col gap-0.5 px-3 py-1.5 ${d?"ms-4":""}`,children:[(0,t.jsxs)("div",{"data-testid":`timing-bar-${e.phase}`,className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"relative z-10 flex h-5 w-5 shrink-0 items-center justify-center",children:(0,t.jsx)("div",{className:`rounded-full ${f?"h-3 w-3 animate-pulse":"h-2.5 w-2.5"} ${f?"bg-blue-500":e.completedAt?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,t.jsx)("span",{className:`w-28 shrink-0 truncate text-sm font-medium ${d?"text-muted-foreground":"text-foreground/80"}`,children:p}),e.prompt?(0,t.jsx)("button",{type:"button",onClick:w,className:"text-muted-foreground/50 hover:text-foreground/70 -ms-1 shrink-0 opacity-0 transition-opacity group-hover/phase:opacity-100",title:l("activityTab.copyPromptToClipboard"),children:y?(0,t.jsx)(x.Check,{className:"h-3.5 w-3.5 text-emerald-500"}):(0,t.jsx)(u.Copy,{className:"h-3.5 w-3.5"})}):null,(0,t.jsx)("div",{className:`bg-muted relative min-w-0 flex-1 overflow-hidden rounded-full ${d?"h-1.5":"h-2"}`,children:f?(0,t.jsx)("div",{className:"absolute inset-0 rounded-full bg-blue-500/30",style:{backgroundImage:"linear-gradient(90deg, transparent 0%, rgb(59 130 246) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}):(0,t.jsx)("div",{className:`h-full rounded-full transition-all duration-300 ${j}`,style:{width:`${Math.min(b,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-sm font-medium tabular-nums",children:tm(h)})]}),(0,t.jsxs)("div",{className:"ml-[28px] flex items-center gap-3 text-xs",children:[e.startedAt?(0,t.jsx)("span",{className:"text-muted-foreground/60 tabular-nums",children:tM(e.startedAt)}):null,null!=v&&v>0?(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-50"}),tR(v)]}):null,null!=e.costUsd&&e.costUsd>0?(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5",children:[(0,t.jsx)(tN,{className:"h-3 w-3 opacity-50"}),tI(e.costUsd)]}):null]}),null!=e.approvalWaitMs&&e.approvalWaitMs>0?(0,t.jsx)(tF,{timing:e,maxDurationMs:a}):null]})}function tF({timing:e,maxDurationMs:s}){let a=e.approvalWaitMs??0,r=s>0?Math.max(2,a/s*100):2;return(0,t.jsxs)("div",{"data-testid":`approval-wait-${e.phase}`,className:"ml-[26px] flex items-center gap-2 rounded-md bg-amber-50/50 px-1.5 py-1 dark:bg-amber-950/20",children:[(0,t.jsx)(tk.Timer,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 text-xs",children:"approval"}),(0,t.jsx)("div",{className:"bg-muted h-1.5 min-w-0 flex-1 overflow-hidden rounded-full",children:(0,t.jsx)("div",{className:"h-full rounded-full bg-amber-500",style:{width:`${Math.min(r,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-xs tabular-nums",children:tm(a)})]})}function tq({totalExecMs:e,totalWaitMs:s,totalInputTokens:a,totalOutputTokens:n,totalCostUsd:l}){let{t:i}=(0,r.useTranslation)("web"),o=a+n;return(0,t.jsxs)("div",{"data-testid":"activity-summary",className:"border-border bg-card/30 flex flex-col gap-2 rounded-lg border p-3",children:[(0,t.jsx)("div",{className:"text-muted-foreground mb-1 text-xs font-semibold tracking-wider uppercase",children:"Summary"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:[(0,t.jsx)(tO,{icon:e5.Clock,label:i("activityTab.execution"),value:tm(e)}),(0,t.jsx)(tO,{icon:tk.Timer,label:i("activityTab.wait"),value:s>0?tm(s):"n/a"}),(0,t.jsx)(tO,{icon:e5.Clock,label:"Wall-clock",value:s>0?tm(e+s):tm(e)}),(0,t.jsx)(tO,{icon:tN,label:i("activityTab.cost"),value:l>0?tI(l):"n/a"}),(0,t.jsxs)("div",{className:"col-span-2 flex flex-col gap-0.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-40"}),"Tokens"]}),o>0?(0,t.jsxs)("span",{className:"flex items-center gap-2.5 text-sm tabular-nums",children:[(0,t.jsx)("span",{children:tR(o)}),(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-3 text-xs",title:"Input tokens / Output tokens",children:[(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tC,{className:"h-3 w-3 text-blue-500 opacity-60"}),tR(a)]}),(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tT,{className:"h-3 w-3 text-emerald-500 opacity-60"}),tR(n)]})]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-sm italic tabular-nums",children:"n/a"})]})]})]})}function tO({icon:e,label:s,value:a,className:r=""}){let n="n/a"===a;return(0,t.jsxs)("div",{className:`flex flex-col gap-0.5 ${r}`,children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(e,{className:"h-3 w-3 opacity-40"}),s]}),(0,t.jsx)("span",{className:`text-sm tabular-nums ${n?"text-muted-foreground/40 italic":""}`,children:a})]})}var tB=e.i(7311),tU=e.i(44229);let tV=(0,W.default)("coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]),tW=(0,W.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),tH=(0,W.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),tG=/^\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]\s+(?:\[([^\]]+)\]\s+)?(?:\[([^\]|]+)(?:\|([^\]]+))?\]\s+)?(.*)$/,t_=/^\[(tool-result|tool|text|delta|result|tokens|cmd|file|turn|thread|error|event|raw|WORKER)\]\s*(.*)/;function tK(e){let t=e.match(tG);if(!t)return{timestamp:null,phase:null,agent:null,model:null,tag:"raw",message:e,raw:e};let[,s,a,r,n,l]=t,i=null,o=null,d=null,c=l??"";if(null!=r&&null!=a)if(a.includes("|")){let[e,t]=a.split("|");o=e,d=t??null,c=`[${r}] ${l??""}`}else i=a,o=r,d=n??null;else if(null!=a)if(a.includes("|")){let[e,t]=a.split("|");o=e,d=t??null}else i=a;let u=c.match(t_),x="info";return u&&(x=u[1].toLowerCase(),c=u[2]),{timestamp:s??null,phase:i,agent:o,model:d,tag:x,message:c.trim(),raw:e}}function tZ({content:e}){let a=(0,s.useMemo)(()=>e?e.split("\n").filter(e=>e.trim().length>0).map(tK):[],[e]);return 0===a.length?null:(0,t.jsx)("div",{className:"flex flex-col",children:a.map((e,s)=>(0,t.jsx)(tQ,{line:e},s))})}function tQ({line:e}){switch(e.tag){case"tool":return(0,t.jsx)(tY,{line:e});case"tool-result":return(0,t.jsx)(t4,{line:e});case"text":case"delta":return(0,t.jsx)(t1,{line:e});case"result":return(0,t.jsx)(t2,{line:e});case"tokens":case"turn":return(0,t.jsx)(t5,{line:e});case"cmd":return(0,t.jsx)(t6,{line:e});case"file":return(0,t.jsx)(t8,{line:e});case"thread":case"event":case"info":return(0,t.jsx)(t7,{line:e});case"error":return(0,t.jsx)(t9,{line:e});case"worker":return(0,t.jsx)(t3,{line:e});default:return(0,t.jsx)(se,{line:e})}}function tJ({value:e}){if(!e)return null;let s=e.replace(/^.*T/,"").replace("Z",""),a=s.split(":"),r=a.length>=3?`${a[1]}:${a[2].split(".")[0]}`:s;return(0,t.jsx)("span",{className:"text-muted-foreground/60 w-11 shrink-0 font-mono text-[10px]",children:r})}function tX({phase:e}){return e?(0,t.jsx)("span",{className:"bg-muted text-muted-foreground w-20 shrink-0 truncate rounded px-1.5 py-0.5 font-mono text-[10px] font-medium",title:e,children:e}):(0,t.jsx)("span",{className:"w-20 shrink-0"})}function tY({line:e}){var s;let a,{toolName:r,args:n}=-1===(a=(s=e.message).indexOf(" "))?{toolName:s,args:""}:{toolName:s.slice(0,a),args:s.slice(a+1)},l=function(e,t){try{let s=JSON.parse(t);if("Read"===e&&s.file_path||"Write"===e&&s.file_path||"Edit"===e&&s.file_path)return s.file_path;if("Glob"===e&&s.pattern||"Grep"===e&&s.pattern)return s.pattern;if("Bash"===e&&s.command)return s.command;if("Task"===e&&s.description)return s.description}catch{if(t.length>0)return t}return null}(r,n);return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 border-b border-transparent px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t0,{toolName:r}),(0,t.jsx)("span",{className:"text-xs font-semibold text-violet-600 dark:text-violet-400",children:r}),l?(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-xs break-all",children:l}):null]})]})}function t0({toolName:e}){let s=e.toLowerCase();return"bash"===s?(0,t.jsx)(D.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"read"===s||"glob"===s||"grep"===s?(0,t.jsx)(E.FileText,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"write"===s||"edit"===s?(0,t.jsx)(tH,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):(0,t.jsx)(D.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"})}function t1({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3 w-3 shrink-0 text-blue-500"}),(0,t.jsx)("span",{className:"text-foreground/80 min-w-0 text-xs leading-relaxed",children:e.message})]})]})}function t2({line:e}){var s;let a,r,{chars:n}=(a=(s=e.message).match(/^(\d+)\s+chars/),r=s.match(/session=(\S+)/),{chars:a?parseInt(a[1],10):0,sessionId:r?r[1]:null});return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3 w-3 shrink-0 text-emerald-500"}),(0,t.jsxs)("span",{className:"text-xs font-medium text-emerald-600 dark:text-emerald-400",children:["Result: ",n.toLocaleString()," chars"]})]})]})}function t5({line:e}){let s,{inputTokens:a,outputTokens:r}=(s=e.message.match(/^(\d+)\s+in\s*\/\s*(\d+)\s+out/))?{inputTokens:parseInt(s[1],10),outputTokens:parseInt(s[2],10)}:{inputTokens:0,outputTokens:0};return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tV,{className:"mt-0.5 h-3 w-3 shrink-0 text-amber-500"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:[(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:a.toLocaleString()})," in / ",(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:r.toLocaleString()})," out"]})]})]})}function t3({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 bg-zinc-50 px-3 py-1.5 transition-colors dark:bg-zinc-900/50",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tW,{className:"mt-0.5 h-3 w-3 shrink-0 text-zinc-500"}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium break-all",children:e.message})]})]})}function t4({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(ez,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-400"}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-[11px] break-all",children:e.message})]})]})}function t6({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(d.Play,{className:"mt-0.5 h-3 w-3 shrink-0 text-cyan-500"}),(0,t.jsx)("span",{className:"min-w-0 font-mono text-xs break-all text-cyan-700 dark:text-cyan-400",children:e.message})]})]})}function t8({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tH,{className:"mt-0.5 h-3 w-3 shrink-0 text-orange-500"}),(0,t.jsx)("span",{className:"min-w-0 text-xs break-all text-orange-700 dark:text-orange-400",children:e.message})]})]})}function t9({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 bg-red-50 px-3 py-1.5 transition-colors dark:bg-red-950/30",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3 w-3 shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"min-w-0 text-xs font-medium break-all text-red-700 dark:text-red-400",children:e.message})]})]})}function t7({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs break-all",children:e.message})]})}function se({line:e}){return(0,t.jsx)("div",{className:"px-3 py-0.5",children:(0,t.jsx)("span",{className:"text-muted-foreground/70 font-mono text-[11px] break-all whitespace-pre-wrap",children:e.raw})})}function st({content:e,isConnected:a,error:n}){let{t:l}=(0,r.useTranslation)("web"),i=(0,s.useRef)(null),[o,d]=(0,s.useState)(!0),[c,u]=(0,s.useState)("structured"),x=(0,s.useCallback)(()=>{let e=i.current;e&&d(e.scrollHeight-e.scrollTop-e.clientHeight<40)},[]),m=(0,s.useCallback)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight,d(!0))},[]);return((0,s.useEffect)(()=>{o&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,o]),n)?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]}):e?(0,t.jsxs)("div",{className:"flex h-full flex-col","data-testid":"log-tab",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-1.5",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full ${a?"bg-emerald-500":"bg-zinc-400"}`}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:a?"Live":"Disconnected"}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>u("structured"),className:`rounded p-1 transition-colors ${"structured"===c?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,title:l("logTab.structuredView"),children:(0,t.jsx)(E.FileText,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{type:"button",onClick:()=>u("raw"),className:`rounded p-1 transition-colors ${"raw"===c?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,title:l("logTab.rawView"),children:(0,t.jsx)(tU.Code,{className:"h-3.5 w-3.5"})}),o?null:(0,t.jsxs)("button",{type:"button",onClick:m,className:"text-muted-foreground hover:text-foreground ms-1 flex items-center gap-1 text-xs",children:[(0,t.jsx)(tB.ArrowDown,{className:"h-3 w-3"}),"Jump to bottom"]})]})]}),(0,t.jsx)("div",{ref:i,onScroll:x,className:`flex-1 overflow-y-auto ${"raw"===c?"bg-zinc-950 p-3 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap text-zinc-300":"bg-background"}`,children:"structured"===c?(0,t.jsx)(tZ,{content:e}):e})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(D.Terminal,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:l("logTab.noLogOutput")}),a?(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Waiting for log data..."}):null]})}let ss=(0,W.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var sa=e.i(95812),sr=e.i(87889);let sn=(0,W.default)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]),sl={Todo:{icon:sa.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Todo"},"Work in Progress":{icon:i.Loader2,colorClass:"text-blue-600",borderClass:"border-blue-200",spinning:!0,label:"In Progress"},Done:{icon:x.Check,colorClass:"text-emerald-600",borderClass:"border-emerald-200",label:"Done"},Review:{icon:sr.Eye,colorClass:"text-amber-600",borderClass:"border-amber-200",label:"Review"}},si={icon:sa.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Unknown"};function so({tasks:e}){let{t:s}=(0,r.useTranslation)("web");return 0===e.length?(0,t.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 py-4",children:(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:s("taskProgress.noTasksDefined")})}):(0,t.jsxs)("div",{"data-testid":"task-progress-view",className:"flex flex-col gap-3",children:[(0,t.jsx)(sd,{tasks:e}),(0,t.jsx)("div",{"data-testid":"task-progress-list",className:"flex flex-col gap-2",children:e.map((e,s)=>(0,t.jsx)(su,{task:e,index:s},e.title||`task-${s}`))})]})}function sd({tasks:e}){let{t:a}=(0,r.useTranslation)("web"),n=(0,s.useMemo)(()=>{let t=e.filter(e=>"Done"===e.state).length,s=e.filter(e=>"Work in Progress"===e.state).length,a=e.filter(e=>"Review"===e.state).length,r=e.filter(e=>"Done"!==e.state&&"Work in Progress"!==e.state&&"Review"!==e.state).length,n=e.length,l=n>0?Math.round(t/n*100):0;return{done:t,wip:s,review:a,todo:r,total:n,percent:l}},[e]);return(0,t.jsxs)("div",{"data-testid":"task-progress-summary",className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Task Progress"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:[n.done," of ",n.total," done"]})]}),(0,t.jsx)("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:(0,t.jsx)("div",{"data-testid":"task-progress-bar",className:"h-full rounded-full bg-emerald-500 transition-all",style:{width:`${n.percent}%`}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3",children:[n.done>0?(0,t.jsx)(sc,{icon:x.Check,label:a("taskProgress.done"),count:n.done,className:"text-emerald-600"}):null,n.wip>0?(0,t.jsx)(sc,{icon:i.Loader2,label:a("taskProgress.inProgress"),count:n.wip,className:"text-blue-600"}):null,n.review>0?(0,t.jsx)(sc,{icon:sr.Eye,label:a("taskProgress.review"),count:n.review,className:"text-amber-600"}):null,n.todo>0?(0,t.jsx)(sc,{icon:sa.Circle,label:a("taskProgress.todo"),count:n.todo,className:"text-muted-foreground"}):null]})]})}function sc({icon:e,label:s,count:r,className:n}){return(0,t.jsxs)("span",{className:(0,a.cn)("flex items-center gap-1 text-xs",n),children:[(0,t.jsx)(e,{className:"h-3 w-3"}),r," ",s]})}function su({task:e,index:r}){let[n,l]=(0,s.useState)(!1),i=sl[e.state]??si,o=i.icon,d=e.actionItems.length>0,c=(0,s.useCallback)(()=>{d&&l(e=>!e)},[d]);return(0,t.jsxs)("div",{"data-testid":`task-card-${r}`,className:(0,a.cn)("rounded-lg border",i.borderClass),children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!d,className:(0,a.cn)("flex w-full items-start gap-2 px-3 py-2.5 text-start",d&&"hover:bg-muted/50 cursor-pointer transition-colors"),children:[(0,t.jsx)(o,{className:(0,a.cn)("mt-0.5 h-4 w-4 shrink-0",i.colorClass,i.spinning&&"animate-spin")}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:(0,a.cn)("text-sm font-medium",i.colorClass),children:e.title}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description}):null]}),d?(0,t.jsx)(ed.ChevronRight,{className:(0,a.cn)("text-muted-foreground mt-0.5 h-4 w-4 shrink-0 transition-transform",n&&"rotate-90")}):null]}),n&&d?(0,t.jsx)("div",{className:"border-t px-3 py-2.5",children:(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.actionItems.map((e,s)=>(0,t.jsx)(sx,{item:e},e.name||`ai-${s}`))})}):null]})}function sx({item:e}){let s=e.acceptanceCriteria.length,a=e.acceptanceCriteria.filter(e=>e.verified).length,r=s>0&&a===s;return(0,t.jsxs)("div",{"data-testid":"action-item",className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[r?(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,t.jsx)(sn,{className:"text-muted-foreground mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.name}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-[11px]",children:e.description}):null]}),s>0?(0,t.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[a,"/",s]}):null]}),s>0?(0,t.jsx)("div",{className:"ms-5.5 flex flex-col gap-1",children:e.acceptanceCriteria.map((e,s)=>(0,t.jsx)(sm,{criterion:e},e.description||`ac-${s}`))}):null]})}function sm({criterion:e}){return(0,t.jsxs)("div",{"data-testid":"acceptance-criterion",className:"flex items-start gap-1.5",children:[e.verified?(0,t.jsx)(x.Check,{className:"mt-0.5 h-3 w-3 shrink-0 text-emerald-600"}):(0,t.jsx)(sa.Circle,{className:"text-muted-foreground mt-0.5 h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:(0,a.cn)("text-[11px]",e.verified?"text-muted-foreground line-through":"text-foreground"),children:e.description})]})}let sp={Requirements:"border-transparent bg-blue-50 text-blue-700 hover:bg-blue-50",ClarificationRequired:"border-transparent bg-amber-50 text-amber-700 hover:bg-amber-50",Ready:"border-transparent bg-green-50 text-green-700 hover:bg-green-50"};function sh({plan:e,loading:s,error:a}){return s?(0,t.jsx)("div",{"data-testid":"plan-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):a?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:a})]}):e?(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Plan State"}),(0,t.jsx)(eu.Badge,{className:sp[e.state]??"border-transparent bg-gray-50 text-gray-700",children:e.state})]}),e.overview?(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Overview"}),(0,t.jsx)("p",{className:"text-sm leading-relaxed",children:e.overview})]}):null,(0,t.jsx)(so,{tasks:e.tasks})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(ss,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"No plan created yet"})]})}var sf=e.i(28112);function sg(){return{data:null,loading:!1,error:null}}let sb=[{key:"overview",label:"Overview",icon:U.LayoutDashboard},{key:"activity",label:"Activity",icon:V.Activity},{key:"log",label:"Log",icon:H},{key:"plan",label:"Plan",icon:G},{key:"prd-review",label:"PRD Review",icon:_},{key:"tech-decisions",label:"Tech Decisions",icon:K.Cpu},{key:"product-decisions",label:"Product",icon:Z.Package},{key:"merge-review",label:"Merge Review",icon:Q},{key:"chat",label:"Chat",icon:J.MessageSquare}],sj={activity:async function(e){let t=await es(e);if("error"in t)throw Error(t.error);return{timings:t.timings,rejectionFeedback:t.rejectionFeedback}},plan:async function(e){let t=await ea(e);if("error"in t)throw Error(t.error);return t.plan}};function sv({featureName:e,headerContent:r,featureNode:l,featureId:o,initialTab:u,urlTab:x,prdData:m,prdSelections:p,onPrdSelect:h,onPrdApprove:f,onPrdReject:g,isPrdLoading:b,techData:j,onTechApprove:v,onTechReject:y,isTechLoading:N,productData:w,mergeData:k,onMergeApprove:C,onMergeReject:T,isMergeLoading:S,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:D,rebaseError:$,isRejecting:E,chatInput:L,onChatInputChange:F,sseEvents:q,interactiveAgentEnabled:O=!0,onRetry:U,onStop:V,onStart:W}){let H,G=(0,n.usePathname)(),_=(0,s.useMemo)(()=>(function(e,t=!0){let s=["overview","activity"];return e.hasAgentRun&&s.push("log"),e.hasPlan&&s.push("plan"),"requirements"===e.lifecycle&&"action-required"===e.state&&s.push("prd-review"),"implementation"===e.lifecycle&&"action-required"===e.state&&s.push("tech-decisions","product-decisions"),"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)&&s.push("merge-review"),"maintain"===e.lifecycle&&e.pr&&s.push("merge-review"),t&&s.push("chat"),s})(l,O),[l,O]),K=(0,s.useMemo)(()=>sb.filter(e=>_.includes(e.key)).map(e=>"merge-review"===e.key&&"maintain"===l.lifecycle?{...e,label:"Merge History"}:e),[_,l.lifecycle]),Z=(0,s.useMemo)(()=>{let e=G.match(/^(\/feature\/[^/]+)/);return e?e[1]:G},[G]),Q=(0,s.useMemo)(()=>x&&_.includes(x)?x:u&&_.includes(u)?u:"overview",[]),[J,es]=(0,s.useState)(Q),ea=function(e){let[t,a]=(0,s.useState)(""),[r,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),o=(0,s.useRef)(null),d=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),n(!1)},[]);return(0,s.useEffect)(()=>{if(!e){a(""),n(!1),i(null);return}a(""),i(null);let t=new EventSource(`/api/feature-logs?featureId=${e}`);return o.current=t,t.onopen=()=>{n(!0)},t.addEventListener("initial",e=>{a(JSON.parse(e.data).content)}),t.addEventListener("log",e=>{let t=JSON.parse(e.data);a(e=>e+t.content)}),t.addEventListener("error",e=>{try{let t=JSON.parse(e.data);i(t.error)}catch{i(e.data?String(e.data):"Log stream unavailable")}}),t.onerror=()=>{n(!1)},()=>{t.close(),o.current=null}},[e,d]),{content:t,isConnected:r,error:l}}("log"===J?o:null),{tabs:en,fetchTab:el,refreshTab:eo}=function(e,t){let a=Object.keys(t),[r,n]=(0,s.useState)(()=>{let e={};for(let t of a)e[t]=sg();return e}),l=(0,s.useRef)(t);l.current=t;let i=(0,s.useRef)(e);i.current=e;let o=(0,s.useRef)(!0);(0,s.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);let d=(0,s.useRef)(e);(0,s.useEffect)(()=>{d.current!==e&&(d.current=e,n(e=>{let t={};for(let s of Object.keys(e))t[s]=sg();return t}))},[e]);let c=(0,s.useCallback)(async e=>{let t=l.current[e],s=i.current;if(t){o.current&&n(t=>t[e]?.data!==null?t:{...t,[e]:{...t[e],loading:!0,error:null}});try{let a=await t(s);o.current&&n(t=>({...t,[e]:{data:a,loading:!1,error:null}}))}catch(t){o.current&&n(s=>{let a=t instanceof Error?t.message:"Failed to fetch tab data",r=s[e]?.data??null;return{...s,[e]:{data:r,loading:!1,error:r?null:a}}})}}},[]),u=(0,s.useCallback)(async e=>{let t=r[e];t&&null!==t.data||t&&t.loading||await c(e)},[r,c]);return{tabs:r,fetchTab:u,refreshTab:(0,s.useCallback)(async e=>{await c(e)},[c])}}(o,sj),ed=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!ed.current)return;ed.current=!1;let e="overview"===J?Z:`${Z}/${J}`;e!==G&&window.history.pushState(null,"",e)},[J,Z,G]);let ec=(0,s.useRef)(G);(0,s.useEffect)(()=>{if(ec.current===G||(ec.current=G,ed.current))return;let e=G.split("/"),t=e.length>=4?e[3]:void 0,s=t&&_.includes(t)?t:"overview";s!==J&&(es(s),("activity"===s||"plan"===s)&&el(s))},[G]);let eu=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!eu.current&&(eu.current=!0,!x&&"overview"!==Q)){let e=`${Z}/${Q}`;e!==G&&window.history.replaceState(null,"",e)}},[]);let ex=(0,s.useRef)(!1);(0,s.useEffect)(()=>{ex.current||(ex.current=!0,("activity"===J||"plan"===J)&&el(J))},[J,el]);let em=(0,s.useRef)(o);(0,s.useEffect)(()=>{em.current!==o&&(em.current=o,es("overview"))},[o]);let ep=(0,s.useRef)(u);(0,s.useEffect)(()=>{if(ep.current!==u&&u&&_.includes(u)){ep.current=u,es(u),("activity"===u||"plan"===u)&&el(u);let e="overview"===u?Z:`${Z}/${u}`;e!==window.location.pathname&&window.history.replaceState(null,"",e)}},[u,_,Z,el]),(0,s.useEffect)(()=>{_.includes(J)||(es("overview"),window.location.pathname!==Z&&window.history.replaceState(null,"",Z))},[_,J,Z]);let eh=(0,s.useRef)(J);eh.current=J;let ef=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(!q||0===q.length||(ef.current>q.length&&(ef.current=0),q.length<=ef.current))return;let e=q.slice(ef.current);if(ef.current=q.length,!e.some(e=>e.featureId===o))return;eo("activity");let t=eh.current;"plan"===t&&eo(t)},[q,o,eo]);let eg="running"===l.state||"creating"===l.state;(0,s.useEffect)(()=>{if(!eg)return;let e=setInterval(()=>{eo("activity")},5e3);return()=>clearInterval(e)},[eg,eo]);let eb=(0,s.useCallback)(e=>{ed.current=!0,es(e),("activity"===e||"plan"===e)&&el(e)},[el]);return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsxs)(et.Tabs,{value:J,onValueChange:eb,className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(et.TabsList,{className:"bg-muted/50 h-auto w-full shrink-0 justify-start gap-0 rounded-none border-b p-0",children:K.map(e=>{let s=e.icon;return(0,t.jsxs)(et.TabsTrigger,{value:e.key,className:"text-muted-foreground hover:bg-muted hover:text-foreground data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:border-t-primary [&:not([data-state=active])]:border-r-border relative h-auto rounded-none border-t-2 border-r border-t-transparent border-r-transparent bg-transparent px-3.5 py-2.5 text-[13px] font-normal shadow-none transition-none last:border-r-transparent data-[state=active]:shadow-none",children:[(0,t.jsx)(s,{className:"mr-1.5 size-4"}),e.label]},e.key)})}),(0,t.jsxs)("div",{className:"bg-muted/40 shrink-0 border-b",children:[e?(0,t.jsxs)("div",{className:"flex h-12 items-stretch gap-2 pr-0 pl-4","data-testid":"feature-drawer-header",children:[(0,t.jsx)("div",{className:"flex items-center",children:l.fastMode?(0,t.jsx)(Y.Zap,{className:"size-4 shrink-0 text-amber-500"}):(0,t.jsx)(ee,{className:"text-muted-foreground/50 size-4 shrink-0"})}),(0,t.jsx)("h2",{className:"text-foreground flex min-w-0 items-center truncate text-base font-semibold tracking-tight",children:e}),l.repositoryName?(0,t.jsxs)("span",{className:"animate-in fade-in flex shrink-0 items-center gap-1.5 self-center duration-200",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),l.remoteUrl?(0,t.jsx)("a",{href:l.remoteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground text-sm",children:l.repositoryName}):(0,t.jsx)("span",{className:"text-muted-foreground text-sm",children:l.repositoryName})]}):(0,t.jsxs)("span",{className:"flex items-center gap-1.5 self-center",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),(0,t.jsx)("span",{className:"bg-muted h-4 w-16 animate-pulse rounded"})]}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 cursor-default items-center self-stretch text-xs font-medium",children:[(0,t.jsxs)("div",{className:(0,a.cn)("flex items-center gap-1.5 self-stretch px-3",er.featureNodeStateConfig[l.state].labelClass),children:["running"===l.state?(0,t.jsx)(ei,{size:"sm",className:"shrink-0"}):(H=er.featureNodeStateConfig[l.state].icon,(0,t.jsx)(H,{className:"size-3.5 shrink-0"})),er.featureNodeStateConfig[l.state].label]}),"pending"===l.state&&W?(0,t.jsxs)("button",{type:"button",onClick:()=>W(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-green-500/10 hover:text-green-600 dark:hover:text-green-400","data-testid":"feature-drawer-start-button",children:[(0,t.jsx)(d.Play,{className:"size-3.5"})," Start"]}):"error"===l.state&&U?(0,t.jsxs)("button",{type:"button",onClick:()=>U(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 dark:hover:text-red-400","data-testid":"feature-drawer-retry-button",children:[(0,t.jsx)(X.RotateCcw,{className:"size-3.5"})," Retry"]}):"running"===l.state&&V?(0,t.jsxs)("button",{type:"button",onClick:()=>V(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 dark:hover:text-red-400","data-testid":"feature-drawer-stop-button",children:[(0,t.jsx)(c.Square,{className:"size-3.5"})," Stop"]}):null]})}),l.errorMessage?(0,t.jsxs)(P.TooltipContent,{side:"bottom",align:"end",sideOffset:4,className:"z-[100] max-w-xs cursor-pointer text-xs leading-relaxed select-text",onClick:()=>{navigator.clipboard.writeText(l.errorMessage)},children:[l.errorMessage,(0,t.jsx)("span",{className:"text-muted-foreground ml-1 text-[10px] italic",children:"(click to copy)"})]}):null]})})]}):null,r]}),(0,t.jsx)(et.TabsContent,{value:"overview",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tj,{data:l,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:D,rebaseError:$})}),(0,t.jsx)(et.TabsContent,{value:"activity",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tD,{timings:en.activity.data?.timings??null,loading:en.activity.loading,error:en.activity.error,rejectionFeedback:en.activity.data?.rejectionFeedback})}),(0,t.jsx)(et.TabsContent,{value:"log",className:"mt-0 flex-1 overflow-hidden",children:(0,t.jsx)(st,{content:ea.content,isConnected:ea.isConnected,error:ea.error})}),(0,t.jsx)(et.TabsContent,{value:"plan",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(sh,{plan:en.plan.data,loading:en.plan.loading,error:en.plan.error})}),_.includes("prd-review")?(0,t.jsx)(et.TabsContent,{value:"prd-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:m?(0,t.jsx)(ev,{data:m,selections:p??{},onSelect:h??(()=>void 0),onApprove:f??(()=>void 0),onReject:g,isProcessing:b,isRejecting:E,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,_.includes("tech-decisions")?(0,t.jsx)(et.TabsContent,{value:"tech-decisions",className:"mt-0 flex min-h-0 flex-1 flex-col",children:j?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(eC,{data:j})}),(0,t.jsx)(sy,{onApprove:v??(()=>void 0),onReject:y,isProcessing:N,isRejecting:E,chatInput:L,onChatInputChange:F})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,_.includes("product-decisions")?(0,t.jsx)(et.TabsContent,{value:"product-decisions",className:"mt-0 flex-1 overflow-y-auto",children:null===w?(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):w?(0,t.jsx)(eR,{data:w}):(0,t.jsx)("p",{className:"text-muted-foreground p-4 text-center text-sm",children:"No product decisions available."})}):null,_.includes("merge-review")?(0,t.jsx)(et.TabsContent,{value:"merge-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:k?(0,t.jsx)(e2,{data:k,readOnly:"maintain"===l.lifecycle,onApprove:C??(()=>void 0),onReject:T,isProcessing:S,isRejecting:E,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:S?(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"}):(0,t.jsxs)("div",{className:"text-muted-foreground flex flex-col items-center gap-2 text-sm",children:[(0,t.jsx)(B.AlertCircle,{className:"h-6 w-6"}),(0,t.jsx)("span",{children:"Merge review data unavailable"})]})})}):null,_.includes("chat")?(0,t.jsx)(et.TabsContent,{value:"chat",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(sf.ChatTab,{featureId:o,worktreePath:l.worktreePath})}):null]})})}function sy({onApprove:e,onReject:s,isProcessing:a,isRejecting:n,chatInput:l,onChatInputChange:i}){let{t:o}=(0,r.useTranslation)("web");return(0,t.jsx)(ej,{onReject:s,onApprove:e,approveLabel:o("featureDrawer.approvePlan"),revisionPlaceholder:"Ask AI to revise the plan...",isProcessing:a,isRejecting:n,chatInput:l,onChatInputChange:i})}var sN=e.i(76173),sw=e.i(40854),sk=e.i(57945);let sC=(0,h.createServerReference)("40e366c963166f612b730f46a25271a65f3f9e2ad9",h.callServer,void 0,h.findSourceMapURL,"rebaseFeature");var sT=e.i(99045);function sS(e){return"requirements"===e.lifecycle&&"action-required"===e.state?"prd-review":"implementation"===e.lifecycle&&"action-required"===e.state?"tech-decisions":"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)?"merge-review":"overview"}function sR(e,t,a,r,n,i){let[o,d]=(0,s.useState)(!1),c=(0,s.useRef)(a),u=(0,s.useRef)(r);return c.current=a,u.current=r,(0,s.useEffect)(()=>{if(u.current(),!e)return;let s=!1;return d(!0),t(e).then(e=>{s||c.current(e)}).catch(()=>{!s&&n&&l.toast.error(n)}).finally(()=>{s||d(!1)}),()=>{s=!0}},[e,t,n,i]),o}let sM=(0,h.createServerReference)("40763b5550abf087f516c43b26a339dbed988d82ab",h.callServer,void 0,h.findSourceMapURL,"getFeatureDrawerData"),sI=(0,h.createServerReference)("40aa492efe3888e57a2ee15fcd971e50f93f53244e",h.callServer,void 0,h.findSourceMapURL,"getBranchSyncStatus"),sP=new Map;e.s(["FeatureDrawerClient",0,function({view:e,urlTab:h,interactiveAgentEnabled:z=!0}){var D;let $,E,L,F,q,B,U=(0,k.useFeatureFlags)(),{t:V}=(0,r.useTranslation)("web"),W=(0,n.useRouter)(),H=(0,C.useSoundAction)("reject"),[G,_]=(0,s.useState)(e);(0,s.useEffect)(()=>{_(t=>"feature"===t.type&&"feature"===e.type&&t.node.featureId===e.node.featureId?{...e,node:{...t.node,...e.node}}:e)},[e]);let K="feature"===G.type?G.node:null,{events:Z}=(0,R.useAgentEventsContext)(),Q=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(Q.current>Z.length&&(Q.current=0),!K||Z.length<=Q.current)return;let e=Z.slice(Q.current);for(let t of(Q.current=Z.length,(0,sT.resolveSseEventUpdates)(e)))t.featureId===K.featureId&&"deleting"!==K.state&&(void 0!==t.state||void 0!==t.lifecycle)&&_(e=>{if("feature"!==e.type)return e;let s={...e.node,...void 0!==t.state&&{state:t.state},...void 0!==t.lifecycle&&{lifecycle:t.lifecycle}};return{...e,node:s,initialTab:sS(s)}})},[Z,K]);let J=(0,n.usePathname)().startsWith("/feature/");D=K?.featureId??null,$=(0,s.useRef)(J),E=(0,s.useRef)(!1),L=(0,s.useRef)(0),F=(0,s.useCallback)(async()=>{if(!D||E.current)return;E.current=!0;let e=L.current;try{let t=await sM(D);if(!t||e!==L.current)return;_(e=>(function(e,t){if("feature"!==e.type)return e;let s={...e.node,...t},a=s.state!==e.node.state||s.lifecycle!==e.node.lifecycle;return{...e,node:s,initialTab:a?sS(s):e.initialTab}})(e,t))}catch{}finally{E.current=!1}},[D,_]),q=(0,s.useRef)(!1),(0,s.useEffect)(()=>{!J||$.current&&q.current||(q.current=!0,L.current+=1,E.current=!1,F()),$.current=J},[J,F]),(0,s.useEffect)(()=>{if(!J||!D)return;let e=setInterval(()=>{F()},15e3);return()=>clearInterval(e)},[J,D,F]);let X=(0,s.useCallback)(()=>{W.push("/")},[W]),[Y,ee]=(0,s.useState)(""),[et,es]=(0,s.useState)(null),[ea,er]=(0,s.useState)({}),[en,el]=(0,s.useState)({}),[ei,eo]=(0,s.useState)(null),[ed,ec]=(0,s.useState)(void 0),[eu,ex]=(0,s.useState)(null),[em,ep]=(0,s.useState)(!1),[eh,ef]=(0,s.useState)(!1),[eg,eb]=(0,s.useState)(!1),ej=`${K?.featureId}:${K?.state}`,ev=(0,s.useRef)(ej);(0,s.useEffect)(()=>{ej!==ev.current&&(ev.current=ej,eb(!1))},[ej]);let[ey,eN]=(0,s.useState)(!1),ew=(0,s.useRef)(!1),ek="feature"===G.type?G.initialTab:void 0;(0,s.useEffect)(()=>{ee("")},[ek]);let eC=(0,s.useRef)(0),eT=(0,s.useRef)(K?.state),eS=(0,s.useRef)(K?.lifecycle);(K?.state!==eT.current||K?.lifecycle!==eS.current)&&(eT.current=K?.state,eS.current=K?.lifecycle,eC.current+=1);let eR=eC.current,eM=sR(K?.lifecycle==="requirements"&&K?.state==="action-required"?K.featureId:null,y,e=>{if(e.error)return void l.toast.error(e.error);if(e.questionnaire){es(e.questionnaire);let t={};for(let s of e.questionnaire.questions){let e=s.options.find(e=>e.recommended);e&&(t[s.id]=e.id)}er(t),el(t)}},()=>{er({}),el({}),es(null)},"Failed to load questionnaire",eR),eI=K?.lifecycle==="implementation"&&K?.state==="action-required"?K.featureId:null,eP=sR(eI,N,e=>{e.error?l.toast.error(e.error):e.techDecisions&&eo(e.techDecisions)},()=>eo(null),"Failed to load tech decisions",eR),eA=sR(eI,y,e=>{e.productDecisions&&ec(e.productDecisions)},()=>ec(void 0),void 0,eR),ez=sR(K?.lifecycle==="review"&&(K?.state==="action-required"||K?.state==="error")||K?.lifecycle==="maintain"&&K?.pr?K.featureId:null,w,e=>{"error"in e?l.toast.error(e.error):ex(e)},()=>ex(null),"Failed to load merge review data",eR),eD=Y.trim().length>0,e$=K?.lifecycle==="requirements"&&K?.state==="action-required"&&Object.keys(en).some(e=>en[e]!==ea[e]),eE=(0,s.useCallback)(()=>{ee(""),er({...en})},[en]),{attemptClose:eL}=(0,T.useGuardedDrawerClose)({open:J,isDirty:eD||e$,onClose:X,onReset:eE}),eF=(0,s.useCallback)(async(e,t,s=[],a)=>{if(K?.featureId){ew.current=!0,eN(!0);try{let r=s.map(e=>e.path).filter(Boolean),n=s.filter(e=>e.notes?.trim()),i=n.length>0?`${e}
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36986,e=>{"use strict";var t=e.i(96871),s=e.i(16539),a=e.i(31777);e.i(98026);var r=e.i(50728),n=e.i(33109),l=e.i(60112),i=e.i(83428),o=e.i(67669),d=e.i(24042),c=e.i(64970),u=e.i(33548),x=e.i(23925),m=e.i(37260),p=e.i(83299),h=e.i(96976);let f=(0,h.createServerReference)("60beee6b59cc76aaf0ded0ecb94d050ef6a46ddce9",h.callServer,void 0,h.findSourceMapURL,"approveFeature");var g=e.i(68732),b=e.i(81864),j=e.i(45914);let v=(0,h.createServerReference)("700fd1f215bdd4f0589a9618ff599294b275fd2eb3",h.callServer,void 0,h.findSourceMapURL,"rejectFeature"),y=(0,h.createServerReference)("40c8b4ceaf7b066e4e64125bb5d8adf20592a4a7ba",h.callServer,void 0,h.findSourceMapURL,"getFeatureArtifact"),N=(0,h.createServerReference)("407ac9e5f693a0f86ecf284e26745a05f17426054b",h.callServer,void 0,h.findSourceMapURL,"getResearchArtifact"),w=(0,h.createServerReference)("4023ea4ea9599b4e28347ce046ed5ecf4878c59019",h.callServer,void 0,h.findSourceMapURL,"getMergeReviewData");var k=e.i(75921),C=e.i(8361),T=e.i(30153),S=e.i(8537),R=e.i(48034);e.i(1650);var M=e.i(11495);e.i(99348);var I=e.i(17466),P=e.i(2828);e.i(31566);var A=e.i(65104),z=e.i(8986),D=e.i(38573),$=e.i(19933),E=e.i(70471),L=e.i(51251);let F="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40";function q({loading:e,error:s,icon:a}){return e?(0,t.jsx)(i.Loader2,{className:"size-3.5 animate-spin"}):s?(0,t.jsx)(L.CircleAlert,{className:"text-destructive size-3.5"}):(0,t.jsx)(a,{className:"size-4"})}function O({actions:e,repositoryPath:a,worktreePath:r,showSpecs:n}){let[l,i]=(0,s.useState)(!1);return(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInIde,disabled:e.ideLoading,"aria-label":"Open in IDE",children:(0,t.jsx)(q,{loading:e.ideLoading,error:e.ideError,icon:z.Code2})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open in IDE"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInShell,disabled:e.shellLoading,"aria-label":"Open terminal",children:(0,t.jsx)(q,{loading:e.shellLoading,error:e.shellError,icon:D.Terminal})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open terminal"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openFolder,disabled:e.folderLoading,"aria-label":"Open folder",children:(0,t.jsx)(q,{loading:e.folderLoading,error:e.folderError,icon:$.FolderOpen})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open folder"})]}),n?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openSpecsFolder,disabled:e.specsLoading,"aria-label":"Open specs",children:(0,t.jsx)(q,{loading:e.specsLoading,error:e.specsError,icon:E.FileText})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open specs"})]}):null,(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:()=>{navigator.clipboard.writeText(r??a),i(!0),setTimeout(()=>i(!1),2e3)},"aria-label":"Copy path",children:l?(0,t.jsx)(x.Check,{className:"size-3.5 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:l?"Copied!":"Copy path"})]})]})})}var B=e.i(79687),U=e.i(16489),V=e.i(74294),W=e.i(3645);let H=(0,W.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),G=(0,W.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),_=(0,W.default)("file-check",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var K=e.i(18532),Z=e.i(93192);let Q=(0,W.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var J=e.i(48109),X=e.i(38227),Y=e.i(53360);let ee=(0,W.default)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);var et=e.i(68304);let es=(0,h.createServerReference)("40e640338fe9f4f8f29098ebaa6cef99d863b59333",h.callServer,void 0,h.findSourceMapURL,"getFeaturePhaseTimings"),ea=(0,h.createServerReference)("402ace00b46d978b0d3cca94a40e49b325643b2ef1",h.callServer,void 0,h.findSourceMapURL,"getFeaturePlan");e.i(47506);var er=e.i(2929);let en=(0,e.i(94237).cva)("inline-block shrink-0",{variants:{size:{sm:"size-5",md:"size-8",lg:"size-12"}},defaultVariants:{size:"md"}}),el=[{r:9,spline:"0.12 0 0.04 1",opacity:1},{r:8.2,spline:"0.16 0 0.08 1",opacity:.95},{r:7.4,spline:"0.20 0 0.12 1",opacity:.9},{r:6.6,spline:"0.25 0 0.16 1",opacity:.84},{r:5.8,spline:"0.30 0 0.20 1",opacity:.76},{r:5,spline:"0.36 0 0.25 1",opacity:.67},{r:4.2,spline:"0.42 0 0.31 1",opacity:.56},{r:3.4,spline:"0.48 0 0.37 1",opacity:.44},{r:2.6,spline:"0.55 0 0.44 1",opacity:.32},{r:1.8,spline:"0.62 0 0.52 1",opacity:.2},{r:1,spline:"0.70 0 0.60 1",opacity:.1}];function ei({className:e,size:s="md",duration:r=5,...n}){return(0,t.jsxs)("svg",{"data-slot":"comet-spinner",role:"status","aria-label":"Loading",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",className:(0,a.cn)(en({size:s}),e),...n,children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:"comet-gooey",x:"-100%",y:"-100%",width:"300%",height:"300%",colorInterpolationFilters:"sRGB",children:[(0,t.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"2.5"}),(0,t.jsx)("feColorMatrix",{mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 -30",result:"goo"})]})}),(0,t.jsxs)("g",{filter:"url(#comet-gooey)",children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 50 50",to:"360 50 50",dur:`${r}s`,repeatCount:"indefinite"}),el.map(e=>(0,t.jsxs)("g",{children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"spline",values:"0 50 50;360 50 50",keyTimes:"0;1",keySplines:e.spline,dur:"1s",repeatCount:"indefinite"}),(0,t.jsx)("circle",{cx:"50",cy:"18",r:e.r,fill:"currentColor",opacity:e.opacity})]},e.r)),(0,t.jsxs)("circle",{cx:"50",cy:"50",r:"4",fill:"currentColor",opacity:"0.15",children:[(0,t.jsx)("animate",{attributeName:"r",values:"3;5;3",dur:"2s",repeatCount:"indefinite"}),(0,t.jsx)("animate",{attributeName:"opacity",values:"0.1;0.25;0.1",dur:"2s",repeatCount:"indefinite"})]})]})]})}var eo=e.i(11345),ed=e.i(76016),ec=e.i(35364),eu=e.i(81846),ex=e.i(16868);let em=(0,W.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);var ep=e.i(58481),eh=e.i(48306);e.i(50032);var ef=e.i(86254),eg=e.i(42076);let eb=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]);function ej({onReject:e,onApprove:n,approveLabel:l,approveVariant:i="default",revisionPlaceholder:o,isProcessing:d=!1,isRejecting:c=!1,children:u,chatInput:m,onChatInputChange:p}){let{t:h}=(0,r.useTranslation)("web"),f="warning"===i,g=f?ep.AlertTriangle:x.Check,b=f?"bg-orange-500/85":"bg-blue-500/85",[j,v]=(0,s.useState)(""),y=m??j,N=p??v,w=(0,C.useSoundAction)("approve"),k=d||c,[T,S]=(0,s.useState)([]),[R,M]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null),[z,D]=(0,s.useState)(!1),[$,E]=(0,s.useState)(!1),[L,F]=(0,s.useState)(!1),q=y.trim().length>0,O=q?z||$&&L:!z,B=(0,s.useRef)(0),U=(0,s.useRef)(crypto.randomUUID()),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){("Control"===e.key||"Meta"===e.key)&&E(!0),"Shift"===e.key&&F(!0)}function t(e){("Control"===e.key||"Meta"===e.key)&&E(!1),"Shift"===e.key&&F(!1)}function s(){E(!1),F(!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",s),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",s)}},[]);let W=(0,s.useCallback)(async e=>{for(let t of(A(null),e)){if(t.size>0xa00000)return void A(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!eb.has(e))return void A(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();S(s=>[...s,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let s=new FormData;s.append("file",t),s.append("sessionId",U.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:s});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));S(t=>t.filter(t=>t.id!==e)),A(t.error??"Upload failed");return}let r=await a.json();S(t=>t.some(t=>t.id!==e&&t.path===r.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...r,id:e,loading:!1}:t))}catch{S(t=>t.filter(t=>t.id!==e)),A("Upload failed")}}},[]),H=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,1===B.current&&M(!0)},[]),G=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,0===B.current&&M(!1)},[]),_=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),K=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&W(t)},[W]),Z=(0,s.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let s=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&s.push(t)}s.length>0&&(e.preventDefault(),W(s))},[W]),Q=(0,s.useCallback)(async()=>{try{let e=await (0,eg.pickFiles)();e&&S(t=>{let s=new Set(t.map(e=>e.path)),a=e.filter(e=>!s.has(e.path)).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,mimeType:"application/octet-stream",path:e.path}));return a.length>0?[...t,...a]:t})}catch{}},[]),J=(0,s.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),X=(0,s.useCallback)((e,t)=>{S(s=>s.map(s=>s.id===e?{...s,notes:t}:s))},[]),Y=(0,s.useCallback)(()=>{N(""),S([]),A(null)},[N]),ee=(0,s.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),V.current?.requestSubmit())},[]),et="u">typeof navigator&&/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl";return(0,t.jsxs)("div",{className:"border-border shrink-0 border-t",children:[u,e?(0,t.jsx)(P.TooltipProvider,{delayDuration:400,children:(0,t.jsx)("form",{ref:V,onSubmit:function(t){t.preventDefault();let s=y.trim();if(O)w.play(),n(),Y();else{if(!s||!e)return;e(s,T.filter(e=>!e.loading)),Y()}},className:"p-3",children:(0,t.jsx)("div",{role:"region","aria-label":h("createDrawer.fileDropZone"),"data-drag-over":R?"true":"false",onDragEnter:H,onDragLeave:G,onDragOver:_,onDrop:K,className:(0,a.cn)("rounded-md border-2 border-transparent transition-colors",R&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{className:"border-input focus-within:ring-ring/50 focus-within:border-ring flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow] focus-within:ring-[3px]",children:[(0,t.jsx)(eh.Textarea,{placeholder:o??"Ask AI to revise...","aria-label":o??"Ask AI to revise...",disabled:k,value:y,onChange:e=>N(e.target.value),onKeyDown:ee,onPaste:Z,rows:1,"aria-invalid":!!I,"aria-describedby":I?"drawer-action-upload-error":void 0,className:"max-h-[35dvh] min-h-9 flex-1 resize-none overflow-y-auto rounded-none border-0 py-2 shadow-none focus-visible:ring-0","data-testid":"drawer-chat-input"}),T.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:T.map(e=>(0,t.jsx)(ef.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>J(e.id),disabled:k,loading:e.loading,notes:e.notes,onNotesChange:t=>X(e.id,t)},e.id))}),I?(0,t.jsx)("p",{id:"drawer-action-upload-error",className:"text-destructive px-3 pb-2 text-xs",role:"alert",children:I}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-2 border-t px-3 py-1.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex-1 truncate text-[11px]",children:[(0,t.jsxs)("kbd",{className:"bg-muted rounded px-1 py-0.5 font-mono text-[10px]",children:[et,"+Enter"]})," ",q?"reject":"approve"]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:Q,disabled:k,"aria-label":h("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(ex.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"top",children:h("chat.attachFiles")})]}),(0,t.jsx)("div",{onMouseLeave:()=>D(!1),children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"submit",disabled:k,"data-testid":"drawer-action-submit",className:(0,a.cn)("relative flex h-9 min-w-[12rem] cursor-pointer items-center overflow-hidden rounded-md border ps-4 pe-10 text-sm font-medium whitespace-nowrap transition-colors","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",O?`${f?"border-orange-400/60":"border-blue-400/60"} text-white`:q&&$&&!L?"border-primary bg-muted ring-primary/30 shadow-sm ring-1":"border-border bg-muted/50 hover:bg-muted shadow-sm"),children:[(0,t.jsx)("div",{className:(0,a.cn)("pointer-events-none absolute inset-0 transition-transform duration-300 ease-in-out",b),style:{transform:O?"translateX(0)":"translateX(100%)"}}),(0,t.jsxs)("span",{className:(0,a.cn)("absolute inset-0 z-10 flex items-center justify-center gap-2 pe-8 transition-opacity duration-300",O?"opacity-0":"opacity-100"),children:[(0,t.jsx)(em,{className:"h-4 w-4 shrink-0"}),"Reject"]}),(0,t.jsxs)("span",{className:(0,a.cn)("absolute inset-0 z-10 flex items-center justify-center gap-2 text-white transition-opacity duration-300",O?"opacity-100":"opacity-0"),children:[(0,t.jsx)(g,{className:"h-4 w-4 shrink-0"}),l]}),(0,t.jsx)("span",{className:(0,a.cn)(`border-input/60 absolute inset-y-0 right-0 z-20 flex w-8 cursor-pointer items-center justify-center rounded-e-[5px] border-s ${b} transition-opacity duration-300`,!q&&!z&&"pointer-events-none opacity-0"),onMouseEnter:()=>D(!0),children:(0,t.jsx)(eo.ChevronLeft,{className:"h-4 w-4 text-white"})})]})}),f?null:(0,t.jsx)(P.TooltipContent,{side:"top",children:O?l:h("drawerActionBar.sendRevisionFeedback")})]})})]})]})})})}):(0,t.jsx)("div",{className:"flex items-center gap-2 px-4 pb-4",children:(0,t.jsx)(ec.Button,{type:"button",className:"flex-1",disabled:k,onClick:()=>{w.play(),n()},children:l})})]})}function ev({data:e,selections:r,onSelect:n,onApprove:l,onReject:i,isProcessing:o=!1,isRejecting:d=!1,showHeader:c=!1,chatInput:u,onChatInputChange:x}){let{question:m,context:p,questions:h,finalAction:f}=e,[g,b]=(0,s.useState)(0),j=(0,C.useSoundAction)("select"),v=(0,C.useSoundAction)("navigate"),y=h.length,N=g===y-1,w=h[g],k=(0,s.useMemo)(()=>Object.keys(r).length,[r]),T=(0,s.useCallback)((e,t)=>{j.play(),n(e,t),N||setTimeout(()=>b(e=>e+1),250)},[n,N,j]);return 0===y?null:(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[c?(0,t.jsxs)("div",{className:"border-border flex items-start gap-3 border-b pb-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full bg-amber-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground mb-1.5 text-sm font-bold",children:m}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:p})]})]}):null,(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("label",{className:"text-foreground min-w-0 flex-1 text-sm font-semibold",children:[g+1,". ",w.question]}),(0,t.jsx)("div",{className:"mt-1.5 flex shrink-0 gap-1",children:h.map((e,s)=>(0,t.jsx)("button",{type:"button","aria-label":`Go to question ${s+1}`,className:(0,a.cn)("h-1.5 rounded-full transition-all duration-200",s===g?"bg-primary w-4":"w-1.5",s!==g&&r[e.id]?"bg-primary/50":"",s===g||r[e.id]?"":"bg-muted-foreground/25"),onClick:()=>{v.play(),b(s)}},e.id))})]}),(0,t.jsx)("div",{className:"space-y-2",children:w.options.map((e,s)=>{let n=r[w.id]===e.id,l=String.fromCharCode(65+s);return(0,t.jsx)("button",{type:"button",className:(0,a.cn)("border-border w-full overflow-hidden rounded-md border px-3 py-3 text-start text-xs transition-all","hover:border-primary/70 hover:bg-primary/5 group",n&&"border-primary bg-primary/5",e.isNew&&"animate-option-highlight"),disabled:o,onClick:()=>T(w.id,e.id),children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("span",{className:"text-muted-foreground mt-0.5 font-mono text-xs",children:[l,"."]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-foreground mb-0.5 text-xs font-semibold wrap-break-word",children:e.label}),(0,t.jsx)("div",{className:"text-muted-foreground text-xs leading-snug",children:e.rationale})]}),e.recommended||e.isNew?(0,t.jsx)("div",{className:"shrink-0 pt-0.5",children:e.recommended?(0,t.jsx)(eu.Badge,{className:"px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):(0,t.jsx)(eu.Badge,{className:"border-transparent bg-emerald-600 px-1.5 py-0 text-[10px] whitespace-nowrap text-white hover:bg-emerald-600/80",children:"New"})}):null]})},e.id)})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:0===g||o,onClick:()=>{v.play(),b(e=>e-1)},children:[(0,t.jsx)(eo.ChevronLeft,{className:"me-1 h-4 w-4"}),"Previous"]}),N?null:(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>{v.play(),b(e=>e+1)},children:[r[w.id]?"Next":"Skip",(0,t.jsx)(ed.ChevronRight,{className:"ms-1 h-4 w-4"})]})]})]}),(0,t.jsx)(ej,{onReject:i,onApprove:()=>l(f.id),approveLabel:f.label,revisionPlaceholder:"Ask AI to refine requirements...",isProcessing:o,isRejecting:d,chatInput:u,onChatInputChange:x,children:(0,t.jsx)("div",{className:(0,a.cn)("bg-muted h-1.5 overflow-hidden",k>0&&k<y||o?"opacity-100":"opacity-0","transition-opacity duration-200"),"data-testid":"progress-bar-container",children:o?(0,t.jsx)("div",{className:"bg-primary animate-indeterminate-progress h-full w-1/3"}):(0,t.jsx)("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${y>0?k/y*100:0}%`},"data-testid":"progress-bar"})})})]})}var ey=e.i(68864);let eN=(0,W.default)("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]),ew={p:({children:e})=>(0,t.jsx)("p",{className:"text-muted-foreground mb-2 text-xs leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"text-foreground font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:s})=>s?(0,t.jsx)("code",{className:`${s} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-muted my-2 overflow-x-auto rounded-lg border p-3",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"text-muted-foreground mb-2 list-disc space-y-1 ps-4 text-xs",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"text-muted-foreground mb-2 list-decimal space-y-1 ps-4 text-xs",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"leading-relaxed",children:e}),a:({children:e,href:s})=>(0,t.jsx)("a",{href:s,className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e})};function ek({decision:e,index:a}){let[r,n]=(0,s.useState)(!1),l=(0,C.useSoundAction)("expand"),i=(0,C.useSoundAction)("collapse");return(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:a+1}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.title}),(0,t.jsx)("p",{className:"text-muted-foreground mt-0.5 text-xs",children:e.chosen})]})]}),"decisionName"in e&&e.decisionName?(0,t.jsx)(eu.Badge,{variant:"secondary",className:"bg-primary/10 text-primary shrink-0",children:e.decisionName}):null]}),e.rationale?(0,t.jsx)(ey.default,{components:ew,children:e.rationale}):null]}),e.rejected.length>0?(0,t.jsxs)("div",{className:"border-border border-t",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{r?i.play():l.play(),n(e=>!e)},className:"text-muted-foreground hover:bg-muted/50 flex w-full items-center gap-1.5 px-4 py-3 text-xs font-medium transition-colors",children:[(0,t.jsx)(ed.ChevronRight,{className:`h-3.5 w-3.5 transition-transform ${r?"rotate-90":""}`}),(0,t.jsx)(ee,{className:"h-3.5 w-3.5"}),"Other Options Considered (",e.rejected.length,")"]}),r?(0,t.jsx)("div",{className:"space-y-1.5 px-4 pb-3",children:e.rejected.map(e=>(0,t.jsx)("div",{className:"bg-primary/5 rounded-md px-3 py-2",children:(0,t.jsx)("span",{className:"text-foreground text-xs",children:e})},e))}):null]}):null]})}function eC({data:e}){let{summary:s,decisions:a}=e;return 0===a.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:"Technical Implementation Plan Review"}),s?(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,t.jsx)(eN,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Technical Decisions"})]}),a.map((e,s)=>(0,t.jsx)(ek,{decision:e,index:s},e.title))]})}var eT=e.i(41698);function eS({item:e,index:s}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsx)("div",{className:"space-y-2 px-4 py-3",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:s+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.question}),(0,t.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,t.jsx)("p",{className:"text-muted-foreground min-w-0 truncate text-xs",children:e.selectedOption}),e.wasRecommended?(0,t.jsx)(eu.Badge,{className:"shrink-0 px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):null]})]})]})})})}function eR({data:e}){let{questions:s}=e;return 0===s.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eT.ClipboardList,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Product Decisions"})]}),s.map((e,s)=>(0,t.jsx)(eS,{item:e,index:s},e.question))]})}var eM=e.i(30702);let eI=(0,W.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);var eP=e.i(65530),eA=e.i(49228);let ez=(0,W.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),eD=(0,W.default)("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),e$=(0,W.default)("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var eE=e.i(81181),eL=e.i(99105),eF=e.i(35e3),eq=e.i(30090),eq=eq,eO=e.i(17406);function eB({status:e}){switch(e){case eO.CiStatus.Success:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)(eF.CheckCircle2,{className:"me-1 h-3.5 w-3.5"}),"Passing"]});case eO.CiStatus.Pending:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-yellow-50 text-yellow-700 hover:bg-yellow-50",children:[(0,t.jsx)(i.Loader2,{className:"me-1 h-3.5 w-3.5 animate-spin"}),"Pending"]});case eO.CiStatus.Failure:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-red-50 text-red-700 hover:bg-red-50",children:[(0,t.jsx)(eq.default,{className:"me-1 h-3.5 w-3.5"}),"Failing"]})}}var eU=e.i(12919);let eV=(0,W.default)("file-minus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);var eW=e.i(35749);let eH={added:{icon:eU.FilePlus,label:"A",className:"text-green-600"},modified:{icon:eW.FileEdit,label:"M",className:"text-amber-600"},deleted:{icon:eV,label:"D",className:"text-red-600"},renamed:{icon:eW.FileEdit,label:"R",className:"text-blue-600"}};function eG({status:e}){let s=eH[e],r=s.icon;return(0,t.jsx)(r,{className:(0,a.cn)("h-3.5 w-3.5 shrink-0",s.className)})}function e_({hunk:e}){return(0,t.jsxs)("div",{className:"border-border border-t first:border-t-0",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-muted-foreground px-3 py-1 font-mono text-[10px]",children:e.header}),(0,t.jsx)("div",{className:"font-mono text-[11px] leading-[18px]",children:e.lines.map(e=>(0,t.jsxs)("div",{className:(0,a.cn)("flex","added"===e.type&&"bg-green-50 dark:bg-green-950/30","removed"===e.type&&"bg-red-50 dark:bg-red-950/30"),children:[(0,t.jsx)("span",{className:"text-muted-foreground w-10 shrink-0 px-1 text-end text-[10px] select-none",children:e.oldNumber??""}),(0,t.jsx)("span",{className:"text-muted-foreground w-10 shrink-0 px-1 text-end text-[10px] select-none",children:e.newNumber??""}),(0,t.jsx)("span",{className:(0,a.cn)("w-4 shrink-0 text-center select-none","added"===e.type&&"text-green-700 dark:text-green-400","removed"===e.type&&"text-red-700 dark:text-red-400"),children:"added"===e.type?"+":"removed"===e.type?"-":" "}),(0,t.jsx)("span",{className:"min-w-0 flex-1 pe-2 break-all whitespace-pre-wrap",children:e.content})]},`${e.type}-${e.oldNumber??""}-${e.newNumber??""}`))})]})}function eK({file:e}){let[r,n]=(0,s.useState)(!1),l=e.path.split("/").pop()??e.path,i=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,t.jsxs)("div",{className:"border-border border-b last:border-b-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(!r),className:"hover:bg-muted/50 flex w-full items-center gap-2 px-3 py-2 text-start",children:[(0,t.jsx)(ed.ChevronRight,{className:(0,a.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform duration-150",r&&"rotate-90")}),(0,t.jsx)(eG,{status:e.status}),(0,t.jsx)("span",{className:"text-foreground min-w-0 flex-1 truncate text-xs",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[i,"/"]}),l]}):l}),e.oldPath?(0,t.jsxs)("span",{className:"text-muted-foreground truncate text-[10px]",children:["← ",e.oldPath.split("/").pop()]}):null,(0,t.jsxs)("span",{className:"shrink-0 text-[10px]",children:[e.additions>0?(0,t.jsxs)("span",{className:"text-green-600",children:["+",e.additions]}):null,e.additions>0&&e.deletions>0?" ":null,e.deletions>0?(0,t.jsxs)("span",{className:"text-red-600",children:["-",e.deletions]}):null]})]}),r&&e.hunks.length>0?(0,t.jsx)("div",{className:"border-border overflow-x-auto border-t",children:e.hunks.map(e=>(0,t.jsx)(e_,{hunk:e},e.header))}):null]})}function eZ({fileDiffs:e}){return 0===e.length?null:(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)(E.FileText,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changed Files"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:["(",e.length,")"]})]})}),(0,t.jsx)("div",{className:"border-border border-t",children:e.map(e=>(0,t.jsx)(eK,{file:e},`${e.status}-${e.path}`))})]})}let eQ={Screenshot:eD,Video:e$,TestOutput:E.FileText,TerminalRecording:D.Terminal},eJ=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp"]),eX=new Set([".mp4",".webm",".mov"]);function eY({evidence:e}){var a,r;let n,[l,i]=(0,s.useState)(!0),o=eQ[e.type]??eD,d=(n=(a=e.relativePath).lastIndexOf("."))>=0?a.slice(n).toLowerCase():"",c=(r=e.relativePath,`/api/evidence?path=${encodeURIComponent(r)}`),u="Screenshot"===e.type||eJ.has(d),x="Video"===e.type||eX.has(d),m="TestOutput"===e.type||"TerminalRecording"===e.type;return(0,t.jsxs)("li",{className:"border-border rounded-md border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(!l),className:"flex w-full cursor-pointer items-center gap-2.5 px-3 py-2.5 text-start",children:[l?(0,t.jsx)(eL.ChevronDown,{className:"text-muted-foreground h-3 w-3 shrink-0"}):(0,t.jsx)(ed.ChevronRight,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)(o,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"text-foreground text-xs font-medium",children:e.description}),e.taskRef?(0,t.jsxs)("span",{className:"text-muted-foreground ms-1.5 text-[10px]",children:["(",e.taskRef,")"]}):null]}),(0,t.jsx)("a",{href:c,download:!0,onClick:e=>e.stopPropagation(),className:"text-muted-foreground hover:text-foreground shrink-0 rounded p-1 transition-colors","aria-label":"Download",children:(0,t.jsx)(eE.Download,{className:"h-3 w-3"})})]}),l&&c?(0,t.jsx)("div",{className:"border-border border-t px-3 py-2.5",children:u?(0,t.jsx)("img",{src:c,alt:e.description,className:"max-h-80 w-full rounded-md border object-contain",loading:"lazy"}):x?(0,t.jsx)("video",{src:c,controls:!0,className:"max-h-80 w-full rounded-md border",preload:"metadata",children:(0,t.jsx)("track",{kind:"captions"})}):m?(0,t.jsx)(e0,{url:c}):(0,t.jsx)("p",{className:"text-muted-foreground truncate font-mono text-[10px]",children:e.relativePath})}):null,null]})}function e0({url:e}){let[a,r]=(0,s.useState)(null),[n,l]=(0,s.useState)(!1);return n?a?(0,t.jsx)("pre",{className:"bg-muted/50 max-h-60 overflow-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:a}):(0,t.jsx)("p",{className:"text-muted-foreground text-[10px]",children:"Unable to load preview"}):(fetch(e).then(e=>e.ok?e.text():Promise.reject(Error("Failed"))).then(e=>{let t=e.split("\n");r(t.length>100?`${t.slice(0,100).join("\n")}
2
+ ...`:e)}).catch(()=>r(null)).finally(()=>l(!0)),(0,t.jsx)("div",{className:"bg-muted/50 h-16 animate-pulse rounded-md"}))}function e1({evidence:e}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(eD,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Evidence"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"text-[10px]",children:e.length})]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(eY,{evidence:e},`${e.type}-${e.relativePath}`))})]})})}function e2({data:e,readOnly:s=!1,onApprove:a,onReject:r,isProcessing:n=!1,isRejecting:l=!1,chatInput:i,onChatInputChange:o}){let{pr:d,diffSummary:c,fileDiffs:u,branch:x,warning:m,evidence:p,hideCiStatus:h}=e,f=d?.mergeable===!1,g=f&&r?()=>r("Resolve merge conflicts",[]):a;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-emerald-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:s?"Merge History":"Merge Review"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s?"This feature was merged. Review the pull request details and evidence below.":d?"Review the pull request details and approve to merge.":"Review the changes and approve to merge."})]})]}),x?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(eA.GitBranch,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"font-mono text-[11px]",children:x.source}),(0,t.jsx)(ez,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"font-mono text-[11px]",children:x.target})]})}):null,d?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary flex items-center gap-1.5 text-sm font-semibold underline underline-offset-2",children:["PR #",d.number,(0,t.jsx)(eM.ExternalLink,{className:"h-3.5 w-3.5"})]}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"text-xs",children:d.status})]}),!1===d.mergeable?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Merge Status"}),(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-orange-50 text-orange-700 hover:bg-orange-50",children:[(0,t.jsx)(ep.AlertTriangle,{className:"me-1 h-3.5 w-3.5"}),"Conflicts"]})]}):null,d.ciStatus&&!0!==h?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"CI Status"}),(0,t.jsx)(eB,{status:d.ciStatus})]}):null,d.commitHash?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Commit"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(eP.GitCommitHorizontal,{className:"text-muted-foreground h-3.5 w-3.5"}),(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:d.commitHash.slice(0,7)})]})]}):null]})}):null,c?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(eI,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changes"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-3",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.filesChanged}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"files"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-green-600",children:["+",c.additions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"additions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-red-600",children:["-",c.deletions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"deletions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.commitCount}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"commits"})]})]})]})}):m?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(ep.AlertTriangle,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:m})]})}):null,p&&p.length>0?(0,t.jsx)(e1,{evidence:p}):null,u&&u.length>0?(0,t.jsx)(eZ,{fileDiffs:u}):null]}),!s&&(0,t.jsx)(ej,{onReject:r,onApprove:g,approveLabel:f?"Resolve Conflicts":"Approve Merge",approveVariant:f?"warning":"default",revisionPlaceholder:"Ask AI to revise before merging...",isProcessing:n,isRejecting:l,chatInput:i,onChatInputChange:o})]})}var e5=e.i(55016);let e3=(0,W.default)("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),e4=(0,W.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var e6=e.i(43416),e8=e.i(39200);let e9=(0,W.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var e7=e.i(60253),te=e.i(2287),tt=e.i(19807),ts=e.i(80436);let ta=(0,W.default)("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]),tr=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function tn(e){let t=e.lastIndexOf(".");return t>=0&&tr.has(e.slice(t).toLowerCase())}function tl(e){let t=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"",s=tn(e)?`image/${t.slice(1).replace("jpg","jpeg")}`:"",a=new URLSearchParams({path:e,...s&&{mimeType:s}});return`/api/attachments/preview?${a.toString()}`}let ti=/(?:^|\s)@(\/[^\s]+)/g;function to({text:e,attachmentPaths:s}){let a=function(e){let t=[],s=0;for(let a of e.matchAll(ti)){let r=a.index,n=r+(a[0].length-a[0].trimStart().length);n>s&&t.push({type:"text",value:e.slice(s,n)}),t.push({type:"attachment",path:a[1]}),s=r+a[0].length}return s<e.length&&t.push({type:"text",value:e.slice(s)}),t}(e),r=a.some(e=>"attachment"===e.type),n=s?.filter(Boolean)??[];return r||0!==n.length?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[a.map(e=>{if("text"===e.type){let s=e.value.trim();return s?(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:s},`text-${s.slice(0,40)}`):null}return(0,t.jsx)(td,{path:e.path},`att-${e.path}`)}),n.map(e=>(0,t.jsx)(td,{path:e},`extra-${e}`))]}):(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:e})}function td({path:e}){let a=e.split("/").pop()??e,[r,n]=(0,s.useState)(!1);return tn(e)?r?(0,t.jsxs)("div",{"data-testid":"inline-attachment-image-error",className:"text-muted-foreground flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,t.jsx)(ta,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a})]}):(0,t.jsxs)(te.Dialog,{children:[(0,t.jsx)(te.DialogTrigger,{asChild:!0,children:(0,t.jsx)("img",{src:tl(e),alt:a,"data-testid":"inline-attachment-image",onError:()=>n(!0),className:"max-h-48 max-w-full cursor-pointer rounded-md border object-contain transition-opacity hover:opacity-80"})}),(0,t.jsxs)(te.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,t.jsx)(tt.VisuallyHidden.Root,{children:(0,t.jsxs)(te.DialogTitle,{children:["Preview: ",a]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:tl(e),alt:a,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,t.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col",children:(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:a})}),(0,t.jsx)("a",{href:tl(e),download:a,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${a}`,children:(0,t.jsx)(ts.DownloadIcon,{className:"h-4 w-4"})})]})]})]}):(0,t.jsx)("a",{href:tl(e),download:a,"data-testid":"inline-attachment-file",className:"text-primary text-sm underline underline-offset-2",children:a})}e.i(81803);var tc=e.i(72714),tu=e.i(86782),tx=e.i(29847);function tm(e){if(0===e)return"0s";let t=Math.floor(e/1e3);if(0===t)return"<1s";let s=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return s>0?`${s}h ${a}m`:a>0?`${a}m ${r}s`:`${r}s`}function tp({icon:e,title:s,children:a}){return(0,t.jsxs)("div",{className:"px-3 pt-4 pb-1",children:[(0,t.jsxs)("div",{className:"text-foreground mb-2 flex items-center gap-1.5 text-sm font-semibold tracking-wider uppercase",children:[(0,t.jsx)(e,{className:"size-4 opacity-50"}),s]}),a]})}function th({children:e,className:s}){return(0,t.jsx)("div",{className:(0,a.cn)("bg-muted/60 rounded-md border border-transparent p-3",s),children:e})}function tf({label:e,children:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-foreground/40 text-[11px] font-medium tracking-wider uppercase",children:e}),(0,t.jsx)("span",{className:"text-sm leading-snug",children:s})]})}function tg({on:e,label:s}){return(0,t.jsxs)("span",{className:(0,a.cn)("inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium",e?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-foreground/[0.04] text-foreground/25"),children:[e?(0,t.jsx)(x.Check,{className:"size-3"}):(0,t.jsx)(e7.X,{className:"size-3"}),s]})}let tb={[eO.PrStatus.Open]:"text-blue-600 dark:text-blue-400",[eO.PrStatus.Merged]:"text-purple-600 dark:text-purple-400",[eO.PrStatus.Closed]:"text-red-600 dark:text-red-400"};function tj({data:e,syncStatus:r,syncLoading:n,syncError:l,onRefreshSync:i,onRebaseOnMain:o,rebaseLoading:d,rebaseError:c}){var u;let x,m,p,h,f,g,b="maintain"===e.lifecycle,j=function(e){let[t,a]=(0,s.useState)(null),r=(0,s.useRef)(null);return(0,s.useEffect)(()=>e?(a(tm(Math.max(0,Date.now()-e))),r.current=setInterval(()=>{a(tm(Math.max(0,Date.now()-e)))},1e3),()=>{r.current&&clearInterval(r.current)}):void a(null),[e]),t}("running"===e.state||"action-required"===e.state?e.startedAt:void 0),v=er.featureNodeStateConfig[e.state],y=!!e.summary&&!(e.userQuery&&e.summary?.trim()===e.userQuery.trim());return(0,t.jsxs)("div",{"data-testid":"feature-drawer-status",className:"pb-4",children:[!b&&e.progress>0?(0,t.jsx)("div",{"data-testid":"feature-drawer-progress",className:"px-3 pb-2",children:(0,t.jsx)("div",{className:"bg-foreground/[0.06] h-1.5 w-full overflow-hidden rounded-full",children:(0,t.jsx)("div",{className:(0,a.cn)("h-full rounded-full transition-all",v.progressClass),style:{width:`${e.progress}%`}})})}):null,e.oneLiner||e.userQuery||y?(0,t.jsx)(tp,{icon:e4,title:"Description",children:(0,t.jsxs)(th,{className:"flex flex-col gap-2",children:[e.oneLiner?(0,t.jsx)(tf,{label:"One-Liner",children:e.oneLiner}):null,e.userQuery?(0,t.jsx)(tf,{label:"Query",children:(0,t.jsx)(to,{text:e.userQuery})}):null,y?(0,t.jsx)(tf,{label:"Summary",children:(0,t.jsx)("span",{className:"leading-snug",children:e.summary})}):null]})}):null,e.pr?(0,t.jsx)(tp,{icon:eP.GitCommitHorizontal,title:"Pull Request",children:(0,t.jsx)(th,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("a",{href:e.pr.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center gap-1 text-sm font-semibold hover:underline",children:["#",e.pr.number," ",(0,t.jsx)(eM.ExternalLink,{className:"size-3"})]}),(0,t.jsx)("span",{className:(0,a.cn)("text-xs font-semibold",tb[e.pr.status]),children:e.pr.status}),!1===e.pr.mergeable?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-orange-600 dark:text-orange-400",children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3 shrink-0"})," Conflicts"]}):null,e.pr.ciStatus&&!0!==e.hideCiStatus?(0,t.jsx)(eB,{status:e.pr.ciStatus}):null,e.pr.commitHash?(0,t.jsx)("code",{className:"text-foreground/40 ml-auto font-mono text-[11px]",children:e.pr.commitHash.slice(0,7)}):null]})})}):null,(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-3 pb-1",children:[e.branch?(0,t.jsx)(th,{children:(0,t.jsxs)(tf,{label:"Branch",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(eA.GitBranch,{className:"text-foreground/30 size-3 shrink-0"}),(0,t.jsx)("code",{className:"font-mono text-[11px]",children:e.branch})]}),e.baseBranch?(0,t.jsxs)("span",{className:"text-foreground/30 block text-[10px]",children:["from ",e.baseBranch]}):null]})}):null,e.agentType||e.modelId?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:"Agent",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.agentType?(x=(0,tu.getAgentTypeIcon)(e.agentType),(0,t.jsx)(x,{className:"size-3.5 shrink-0 opacity-50"})):null,e.agentType?(0,t.jsx)("span",{children:tu.agentTypeLabels[e.agentType]??e.agentType}):null,e.agentType&&e.modelId?(0,t.jsx)("span",{className:"text-foreground/20",children:"/"}):null,e.modelId?(0,t.jsx)("span",{className:"text-foreground/50 text-[12px]",children:(0,tx.getModelMeta)(e.modelId).displayName||e.modelId}):null]})})}):null,e.createdAt?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:"Created",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),(u=e.createdAt,m=Date.now(),(g=Math.floor((f=Math.floor((h=Math.floor((m-(p="string"==typeof u?new Date(u).getTime():u))/6e4))/60))/24))>30?new Date(p).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):g>0?`${g}d ago`:f>0?`${f}h ago`:h>0?`${h}m ago`:"just now")]})})}):null,e.fastMode?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:"Mode",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-amber-600 dark:text-amber-400",children:[(0,t.jsx)(Y.Zap,{className:"size-3.5"})," Fast"]})})}):null,e.runtime||j?(0,t.jsx)(th,{children:(0,t.jsx)(tf,{label:e.runtime?"Runtime":"Elapsed",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),e.runtime??j]})})}):null]}),e.blockedBy||e.errorMessage?(0,t.jsx)(tp,{icon:ep.AlertTriangle,title:"Issues",children:(0,t.jsxs)(th,{className:"border-destructive/20 bg-destructive/5",children:[e.blockedBy?(0,t.jsx)(tf,{label:"Blocked By",children:e.blockedBy}):null,e.errorMessage?(0,t.jsx)(tf,{label:"Error",children:(0,t.jsx)("span",{className:"text-destructive",children:e.errorMessage})}):null]})}):null,o&&e.branch&&i?(0,t.jsx)(tp,{icon:e6.RefreshCw,title:"Branch Sync",children:(0,t.jsx)(tv,{syncStatus:r??null,syncLoading:n??!1,syncError:l??null,onRefreshSync:i,onRebaseOnMain:o,rebaseLoading:d??!1,rebaseError:c??null})}):null,(0,t.jsx)(ty,{data:e})]})}function tv({syncStatus:e,syncLoading:s,syncError:n,onRefreshSync:l,onRebaseOnMain:i,rebaseLoading:o,rebaseError:d}){let{t:c}=(0,r.useTranslation)("web"),u=null!=e&&e.behind>0,x=e?.behind===0,m=e?.baseBranch??"main";return(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{"data-testid":"branch-sync-status",className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-1.5 text-[13px]",children:s&&!e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsx)("span",{className:"text-foreground/40",children:"Checking..."})]}):n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-red-500"}),(0,t.jsx)("span",{className:"text-destructive text-xs",children:n})]}):o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsxs)("span",{children:["Rebasing on ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),"..."]})]}):u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-orange-500"}),(0,t.jsxs)("span",{children:[e.behind," behind ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eF.CheckCircle2,{className:"size-3.5 text-green-500"}),(0,t.jsxs)("span",{children:["Up to date · ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):null}),(e||n)&&!o?(0,t.jsx)("button",{onClick:l,disabled:s,className:"text-foreground/30 hover:text-foreground/60 hover:bg-foreground/5 inline-flex size-6 items-center justify-center rounded-sm disabled:opacity-50","aria-label":c("branchSyncStatus.refreshSyncStatus"),children:(0,t.jsx)(e6.RefreshCw,{className:(0,a.cn)("size-3",s&&"animate-spin")})}):null]}),u&&!o?(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(tc.ActionButton,{label:c("branchSyncStatus.rebaseOnMain"),onClick:i,loading:!1,error:!!d,icon:Q,variant:"outline",size:"sm"})}):null,d?(0,t.jsx)("p",{className:"text-destructive pt-1 text-[11px]",children:d}):null]})}function ty({data:e}){return null==e.approvalGates&&null==e.push&&null==e.openPr&&null==e.ciWatchEnabled&&null==e.enableEvidence&&null==e.forkAndPr&&null==e.commitSpecs?null:(0,t.jsx)(tp,{icon:e8.Settings,title:"Settings",children:(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[e.approvalGates?(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{className:"text-foreground/40 mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(e9,{className:"size-3"})," Approve"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(tg,{on:e.approvalGates.allowPrd,label:"PRD"}),(0,t.jsx)(tg,{on:e.approvalGates.allowPlan,label:"Plan"}),(0,t.jsx)(tg,{on:e.approvalGates.allowMerge,label:"Merge"})]})]}):null,null!=e.enableEvidence?(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{className:"text-foreground/40 mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(e3,{className:"size-3"})," Evidence"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(tg,{on:e.enableEvidence,label:"Collect"}),null!=e.commitEvidence?(0,t.jsx)(tg,{on:e.commitEvidence,label:"Add to PR"}):null]})]}):null,null!=e.push||null!=e.openPr||null!=e.ciWatchEnabled||null!=e.commitSpecs||null!=e.forkAndPr?(0,t.jsxs)(th,{children:[(0,t.jsxs)("div",{className:"text-foreground/40 mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(eA.GitBranch,{className:"size-3"})," Git"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[null!=e.push?(0,t.jsx)(tg,{on:e.push,label:"Push"}):null,null!=e.openPr?(0,t.jsx)(tg,{on:e.openPr,label:"PR"}):null,null!=e.ciWatchEnabled?(0,t.jsx)(tg,{on:e.ciWatchEnabled,label:"Watch"}):null,null!=e.commitSpecs?(0,t.jsx)(tg,{on:e.commitSpecs,label:"Specs"}):null,null!=e.forkAndPr?(0,t.jsx)(tg,{on:e.forkAndPr,label:"Fork"}):null]})]}):null]})})}let tN=(0,W.default)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var eq=eq,tw=e.i(94819),tk=e.i(58860);let tC=(0,W.default)("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),tT=(0,W.default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);function tS(e,t){if(null!=e.durationMs&&e.durationMs>0)return e.durationMs;if(!e.completedAt&&e.startedAt){let s=new Date(e.startedAt).getTime();if(!Number.isNaN(s))return Math.max(0,t-s)}return 0}function tR(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tM(e){let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?"":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function tI(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}let tP={analyze:"Analyzing",requirements:"Requirements",research:"Researching",plan:"Planning",implement:"Implementing",rebase:"Rebasing","fast-implement":"Fast Implement",evidence:"Evidence",validate:"Validating",repair:"Repairing",merge:"Merging"},tA={"run:started":{label:"started",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:d.Play},"run:resumed":{label:"resumed",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:X.RotateCcw},"run:completed":{label:"completed",colorClass:"text-emerald-600",bgClass:"bg-emerald-50 dark:bg-emerald-950/30",icon:eF.CheckCircle2},"run:failed":{label:"failed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:stopped":{label:"stopped",colorClass:"text-amber-600",bgClass:"bg-amber-50 dark:bg-amber-950/30",icon:c.Square},"run:crashed":{label:"crashed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:rejected":{label:"rejected",colorClass:"text-orange-600",bgClass:"bg-orange-50 dark:bg-orange-950/30",icon:tw.Ban}};function tz(e){return e.startsWith("run:")}function tD({timings:e,loading:a,error:n,rejectionFeedback:l}){let{t:o}=(0,r.useTranslation)("web"),d=function(e){let[t,a]=(0,s.useState)(Date.now),r=(0,s.useRef)(null);return(0,s.useEffect)(()=>(e&&e.some(e=>!e.phase.startsWith("run:")&&!e.completedAt&&e.startedAt)&&(r.current=setInterval(()=>a(Date.now()),1e3)),()=>{r.current&&(clearInterval(r.current),r.current=null)}),[e]),t}(e);if(a)return(0,t.jsx)("div",{"data-testid":"activity-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(n)return(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-base text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]});if(!e||0===e.length)return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(e5.Clock,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-base",children:o("activityTab.noActivityRecorded")})]});let c=e.filter(e=>!tz(e.phase)),u=Math.max(...c.map(e=>tS(e,d)),...c.map(e=>e.approvalWaitMs??0),0),x=function(e,t){if(!e.length)return[];let s=e.filter(e=>"run:rejected"===e.phase).length,a=t?.length??0,r=e;if(a>s){r=[...e];let n=e[e.length-1].agentRunId;for(let e=s;e<a;e++){let a=t[e];e>s&&r.push({agentRunId:n,phase:"run:resumed",startedAt:a.timestamp??`synthetic-resumed-${e}`}),r.push({agentRunId:n,phase:"run:rejected",startedAt:a.timestamp??`synthetic-${e}`})}}let n=[],l=[],i=0;for(let e of r)if(l.push(e),"run:rejected"===e.phase){let e=t?.[i];n.push({number:n.length+1,timings:l,rejectionMessage:e?.message,rejectionAttachments:e?.attachments}),l=[],i++}return l.length>0&&n.push({number:n.length+1,timings:l}),n}(e,l),m=x.length>1,p=c.reduce((e,t)=>e+tS(t,d),0),h=c.reduce((e,t)=>e+(t.approvalWaitMs??0),0),f=c.reduce((e,t)=>e+(t.inputTokens??0),0),g=c.reduce((e,t)=>e+(t.outputTokens??0),0),b=c.reduce((e,t)=>e+(t.costUsd??0),0);return(0,t.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,t.jsx)("div",{"data-testid":"activity-timings",className:"flex flex-col gap-3",children:x.map(e=>(0,t.jsx)(t$,{iteration:e,showHeader:m,maxDurationMs:u,now:d},e.number))}),p>0?(0,t.jsx)(tq,{totalExecMs:p,totalWaitMs:h,totalInputTokens:f,totalOutputTokens:g,totalCostUsd:b}):null]})}function t$({iteration:e,showHeader:s,maxDurationMs:a,now:r}){let n=function(e){let t=[...e.timings].reverse().find(e=>tz(e.phase));if(!t)return null;switch(t.phase){case"run:rejected":return{label:"Rejected",colorClass:"text-orange-600",dotClass:"bg-orange-500"};case"run:completed":return{label:"Completed",colorClass:"text-emerald-600",dotClass:"bg-emerald-500"};case"run:failed":return{label:"Failed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:crashed":return{label:"Crashed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:stopped":return{label:"Stopped",colorClass:"text-amber-600",dotClass:"bg-amber-500"};default:return null}}(e);return(0,t.jsxs)("div",{"data-testid":`iteration-${e.number}`,className:"border-border/50 bg-card/50 flex flex-col overflow-hidden rounded-lg border",children:[s?(0,t.jsxs)("div",{className:"bg-muted/30 border-border/50 flex items-center justify-between border-b px-3 py-1.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground text-sm font-semibold tracking-wide",children:["Iteration ",e.number]}),n?(0,t.jsxs)("span",{className:`flex items-center gap-1 text-xs font-medium ${n.colorClass}`,children:[(0,t.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${n.dotClass}`}),n.label]}):null]}):null,(0,t.jsxs)("div",{className:"relative flex flex-col",children:[(0,t.jsx)("div",{className:"bg-border/60 absolute top-4 bottom-4 left-[21.5px] w-px"}),e.timings.map((s,n)=>{if(tz(s.phase)){let a,r="run:rejected"===s.phase,l="run:failed"===s.phase||"run:crashed"===s.phase||"run:stopped"===s.phase;if(r)a=e.rejectionMessage;else if(l){let t=[...e.timings].reverse().find(e=>!tz(e.phase)&&e.errorMessage);a=t?.errorMessage??s.errorMessage}return(0,t.jsx)(tE,{timing:s,message:a,attachments:r?e.rejectionAttachments:void 0,isFirst:0===n,isLast:n===e.timings.length-1},`${s.agentRunId}-${s.phase}-${s.startedAt}`)}return(0,t.jsx)(tL,{timing:s,maxDurationMs:a,now:r},`${s.agentRunId}-${s.phase}-${s.startedAt}`)})]})]})}function tE({timing:e,message:s,attachments:a,isFirst:r,isLast:n}){let l,i=tA[e.phase];if(!i)return null;let o=a&&a.length>0,d=i.icon;return(0,t.jsxs)("div",{className:`relative flex flex-col gap-1 px-3 ${r?"pt-2":"pt-1"} ${n?"pb-2":"pb-1"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:`relative z-10 flex h-5 w-5 shrink-0 items-center justify-center rounded-full ${i.bgClass}`,children:(0,t.jsx)(d,{className:`h-3 w-3 ${i.colorClass}`})}),(0,t.jsx)("span",{className:`text-sm font-medium ${i.colorClass}`,children:i.label}),e.startedAt&&!("string"==typeof e.startedAt&&e.startedAt.startsWith("synthetic"))?(0,t.jsx)("span",{className:"text-muted-foreground/60 ml-auto text-xs tabular-nums",children:tM(String(e.startedAt))}):null]}),s?(l="run:failed"===e.phase||"run:crashed"===e.phase||"run:stopped"===e.phase,(0,t.jsxs)("div",{className:`ml-[26px] flex items-start gap-1.5 rounded-md px-2 py-1.5 ${l?"bg-red-50/50 dark:bg-red-950/20":"bg-orange-50/50 dark:bg-orange-950/20"}`,children:[l?(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-400"}):(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-orange-400"}),(0,t.jsxs)("span",{"data-testid":l?"error-message-text":"rejection-feedback-text",className:"text-muted-foreground text-xs leading-relaxed italic",children:["— ",s]})]})):null,o?(0,t.jsx)("div",{"data-testid":"rejection-feedback-attachments",className:"ml-[26px]",children:(0,t.jsx)(to,{text:"",attachmentPaths:a})}):null]})}function tL({timing:e,maxDurationMs:a,now:n}){let{t:l}=(0,r.useTranslation)("web"),i=e.phase.includes(":")?e.phase.split(":")[0]:e.phase,o=e.phase.includes(":")?e.phase.split(":")[1]:null,d=null!==o,c=o?.startsWith("phase-")??!1,m=tP[i]??i,p=c?`Phase ${o.replace("phase-","")}`:null!==o?`${m} #${o}`:m,h=tS(e,n),f=!e.completedAt&&!!e.startedAt,g=f?15:2,b=a>0?Math.max(g,h/a*100):g,j=e.completedAt?c?"bg-emerald-400":d?"bg-amber-500":"bg-emerald-500":"bg-blue-500",v=null!=e.inputTokens||null!=e.outputTokens?(e.inputTokens??0)+(e.outputTokens??0):null,[y,N]=(0,s.useState)(!1),w=(0,s.useCallback)(()=>{e.prompt&&navigator.clipboard.writeText(e.prompt).then(()=>{N(!0),setTimeout(()=>N(!1),1500)})},[e.prompt]);return(0,t.jsxs)("div",{className:`group/phase relative flex flex-col gap-0.5 px-3 py-1.5 ${d?"ms-4":""}`,children:[(0,t.jsxs)("div",{"data-testid":`timing-bar-${e.phase}`,className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"relative z-10 flex h-5 w-5 shrink-0 items-center justify-center",children:(0,t.jsx)("div",{className:`rounded-full ${f?"h-3 w-3 animate-pulse":"h-2.5 w-2.5"} ${f?"bg-blue-500":e.completedAt?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,t.jsx)("span",{className:`w-28 shrink-0 truncate text-sm font-medium ${d?"text-muted-foreground":"text-foreground/80"}`,children:p}),e.prompt?(0,t.jsx)("button",{type:"button",onClick:w,className:"text-muted-foreground/50 hover:text-foreground/70 -ms-1 shrink-0 opacity-0 transition-opacity group-hover/phase:opacity-100",title:l("activityTab.copyPromptToClipboard"),children:y?(0,t.jsx)(x.Check,{className:"h-3.5 w-3.5 text-emerald-500"}):(0,t.jsx)(u.Copy,{className:"h-3.5 w-3.5"})}):null,(0,t.jsx)("div",{className:`bg-muted relative min-w-0 flex-1 overflow-hidden rounded-full ${d?"h-1.5":"h-2"}`,children:f?(0,t.jsx)("div",{className:"absolute inset-0 rounded-full bg-blue-500/30",style:{backgroundImage:"linear-gradient(90deg, transparent 0%, rgb(59 130 246) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}):(0,t.jsx)("div",{className:`h-full rounded-full transition-all duration-300 ${j}`,style:{width:`${Math.min(b,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-sm font-medium tabular-nums",children:tm(h)})]}),(0,t.jsxs)("div",{className:"ml-[28px] flex items-center gap-3 text-xs",children:[e.startedAt?(0,t.jsx)("span",{className:"text-muted-foreground/60 tabular-nums",children:tM(e.startedAt)}):null,null!=v&&v>0?(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-50"}),tR(v)]}):null,null!=e.costUsd&&e.costUsd>0?(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5",children:[(0,t.jsx)(tN,{className:"h-3 w-3 opacity-50"}),tI(e.costUsd)]}):null]}),null!=e.approvalWaitMs&&e.approvalWaitMs>0?(0,t.jsx)(tF,{timing:e,maxDurationMs:a}):null]})}function tF({timing:e,maxDurationMs:s}){let a=e.approvalWaitMs??0,r=s>0?Math.max(2,a/s*100):2;return(0,t.jsxs)("div",{"data-testid":`approval-wait-${e.phase}`,className:"ml-[26px] flex items-center gap-2 rounded-md bg-amber-50/50 px-1.5 py-1 dark:bg-amber-950/20",children:[(0,t.jsx)(tk.Timer,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 text-xs",children:"approval"}),(0,t.jsx)("div",{className:"bg-muted h-1.5 min-w-0 flex-1 overflow-hidden rounded-full",children:(0,t.jsx)("div",{className:"h-full rounded-full bg-amber-500",style:{width:`${Math.min(r,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-xs tabular-nums",children:tm(a)})]})}function tq({totalExecMs:e,totalWaitMs:s,totalInputTokens:a,totalOutputTokens:n,totalCostUsd:l}){let{t:i}=(0,r.useTranslation)("web"),o=a+n;return(0,t.jsxs)("div",{"data-testid":"activity-summary",className:"border-border bg-card/30 flex flex-col gap-2 rounded-lg border p-3",children:[(0,t.jsx)("div",{className:"text-muted-foreground mb-1 text-xs font-semibold tracking-wider uppercase",children:"Summary"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:[(0,t.jsx)(tO,{icon:e5.Clock,label:i("activityTab.execution"),value:tm(e)}),(0,t.jsx)(tO,{icon:tk.Timer,label:i("activityTab.wait"),value:s>0?tm(s):"n/a"}),(0,t.jsx)(tO,{icon:e5.Clock,label:"Wall-clock",value:s>0?tm(e+s):tm(e)}),(0,t.jsx)(tO,{icon:tN,label:i("activityTab.cost"),value:l>0?tI(l):"n/a"}),(0,t.jsxs)("div",{className:"col-span-2 flex flex-col gap-0.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-40"}),"Tokens"]}),o>0?(0,t.jsxs)("span",{className:"flex items-center gap-2.5 text-sm tabular-nums",children:[(0,t.jsx)("span",{children:tR(o)}),(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-3 text-xs",title:"Input tokens / Output tokens",children:[(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tC,{className:"h-3 w-3 text-blue-500 opacity-60"}),tR(a)]}),(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tT,{className:"h-3 w-3 text-emerald-500 opacity-60"}),tR(n)]})]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-sm italic tabular-nums",children:"n/a"})]})]})]})}function tO({icon:e,label:s,value:a,className:r=""}){let n="n/a"===a;return(0,t.jsxs)("div",{className:`flex flex-col gap-0.5 ${r}`,children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(e,{className:"h-3 w-3 opacity-40"}),s]}),(0,t.jsx)("span",{className:`text-sm tabular-nums ${n?"text-muted-foreground/40 italic":""}`,children:a})]})}var tB=e.i(7311),tU=e.i(44229);let tV=(0,W.default)("coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]),tW=(0,W.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),tH=(0,W.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),tG=/^\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]\s+(?:\[([^\]]+)\]\s+)?(?:\[([^\]|]+)(?:\|([^\]]+))?\]\s+)?(.*)$/,t_=/^\[(tool-result|tool|text|delta|result|tokens|cmd|file|turn|thread|error|event|raw|WORKER)\]\s*(.*)/;function tK(e){let t=e.match(tG);if(!t)return{timestamp:null,phase:null,agent:null,model:null,tag:"raw",message:e,raw:e};let[,s,a,r,n,l]=t,i=null,o=null,d=null,c=l??"";if(null!=r&&null!=a)if(a.includes("|")){let[e,t]=a.split("|");o=e,d=t??null,c=`[${r}] ${l??""}`}else i=a,o=r,d=n??null;else if(null!=a)if(a.includes("|")){let[e,t]=a.split("|");o=e,d=t??null}else i=a;let u=c.match(t_),x="info";return u&&(x=u[1].toLowerCase(),c=u[2]),{timestamp:s??null,phase:i,agent:o,model:d,tag:x,message:c.trim(),raw:e}}function tZ({content:e}){let a=(0,s.useMemo)(()=>e?e.split("\n").filter(e=>e.trim().length>0).map(tK):[],[e]);return 0===a.length?null:(0,t.jsx)("div",{className:"flex flex-col",children:a.map((e,s)=>(0,t.jsx)(tQ,{line:e},s))})}function tQ({line:e}){switch(e.tag){case"tool":return(0,t.jsx)(tY,{line:e});case"tool-result":return(0,t.jsx)(t4,{line:e});case"text":case"delta":return(0,t.jsx)(t1,{line:e});case"result":return(0,t.jsx)(t2,{line:e});case"tokens":case"turn":return(0,t.jsx)(t5,{line:e});case"cmd":return(0,t.jsx)(t6,{line:e});case"file":return(0,t.jsx)(t8,{line:e});case"thread":case"event":case"info":return(0,t.jsx)(t7,{line:e});case"error":return(0,t.jsx)(t9,{line:e});case"worker":return(0,t.jsx)(t3,{line:e});default:return(0,t.jsx)(se,{line:e})}}function tJ({value:e}){if(!e)return null;let s=e.replace(/^.*T/,"").replace("Z",""),a=s.split(":"),r=a.length>=3?`${a[1]}:${a[2].split(".")[0]}`:s;return(0,t.jsx)("span",{className:"text-muted-foreground/60 w-11 shrink-0 font-mono text-[10px]",children:r})}function tX({phase:e}){return e?(0,t.jsx)("span",{className:"bg-muted text-muted-foreground w-20 shrink-0 truncate rounded px-1.5 py-0.5 font-mono text-[10px] font-medium",title:e,children:e}):(0,t.jsx)("span",{className:"w-20 shrink-0"})}function tY({line:e}){var s;let a,{toolName:r,args:n}=-1===(a=(s=e.message).indexOf(" "))?{toolName:s,args:""}:{toolName:s.slice(0,a),args:s.slice(a+1)},l=function(e,t){try{let s=JSON.parse(t);if("Read"===e&&s.file_path||"Write"===e&&s.file_path||"Edit"===e&&s.file_path)return s.file_path;if("Glob"===e&&s.pattern||"Grep"===e&&s.pattern)return s.pattern;if("Bash"===e&&s.command)return s.command;if("Task"===e&&s.description)return s.description}catch{if(t.length>0)return t}return null}(r,n);return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 border-b border-transparent px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t0,{toolName:r}),(0,t.jsx)("span",{className:"text-xs font-semibold text-violet-600 dark:text-violet-400",children:r}),l?(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-xs break-all",children:l}):null]})]})}function t0({toolName:e}){let s=e.toLowerCase();return"bash"===s?(0,t.jsx)(D.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"read"===s||"glob"===s||"grep"===s?(0,t.jsx)(E.FileText,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"write"===s||"edit"===s?(0,t.jsx)(tH,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):(0,t.jsx)(D.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"})}function t1({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3 w-3 shrink-0 text-blue-500"}),(0,t.jsx)("span",{className:"text-foreground/80 min-w-0 text-xs leading-relaxed",children:e.message})]})]})}function t2({line:e}){var s;let a,r,{chars:n}=(a=(s=e.message).match(/^(\d+)\s+chars/),r=s.match(/session=(\S+)/),{chars:a?parseInt(a[1],10):0,sessionId:r?r[1]:null});return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3 w-3 shrink-0 text-emerald-500"}),(0,t.jsxs)("span",{className:"text-xs font-medium text-emerald-600 dark:text-emerald-400",children:["Result: ",n.toLocaleString()," chars"]})]})]})}function t5({line:e}){let s,{inputTokens:a,outputTokens:r}=(s=e.message.match(/^(\d+)\s+in\s*\/\s*(\d+)\s+out/))?{inputTokens:parseInt(s[1],10),outputTokens:parseInt(s[2],10)}:{inputTokens:0,outputTokens:0};return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tV,{className:"mt-0.5 h-3 w-3 shrink-0 text-amber-500"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:[(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:a.toLocaleString()})," in / ",(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:r.toLocaleString()})," out"]})]})]})}function t3({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 bg-zinc-50 px-3 py-1.5 transition-colors dark:bg-zinc-900/50",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tW,{className:"mt-0.5 h-3 w-3 shrink-0 text-zinc-500"}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium break-all",children:e.message})]})]})}function t4({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(ez,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-400"}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-[11px] break-all",children:e.message})]})]})}function t6({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(d.Play,{className:"mt-0.5 h-3 w-3 shrink-0 text-cyan-500"}),(0,t.jsx)("span",{className:"min-w-0 font-mono text-xs break-all text-cyan-700 dark:text-cyan-400",children:e.message})]})]})}function t8({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tH,{className:"mt-0.5 h-3 w-3 shrink-0 text-orange-500"}),(0,t.jsx)("span",{className:"min-w-0 text-xs break-all text-orange-700 dark:text-orange-400",children:e.message})]})]})}function t9({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 bg-red-50 px-3 py-1.5 transition-colors dark:bg-red-950/30",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3 w-3 shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"min-w-0 text-xs font-medium break-all text-red-700 dark:text-red-400",children:e.message})]})]})}function t7({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(tJ,{value:e.timestamp}),(0,t.jsx)(tX,{phase:e.phase}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs break-all",children:e.message})]})}function se({line:e}){return(0,t.jsx)("div",{className:"px-3 py-0.5",children:(0,t.jsx)("span",{className:"text-muted-foreground/70 font-mono text-[11px] break-all whitespace-pre-wrap",children:e.raw})})}function st({content:e,isConnected:a,error:n}){let{t:l}=(0,r.useTranslation)("web"),i=(0,s.useRef)(null),[o,d]=(0,s.useState)(!0),[c,u]=(0,s.useState)("structured"),x=(0,s.useCallback)(()=>{let e=i.current;e&&d(e.scrollHeight-e.scrollTop-e.clientHeight<40)},[]),m=(0,s.useCallback)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight,d(!0))},[]);return((0,s.useEffect)(()=>{o&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,o]),n)?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]}):e?(0,t.jsxs)("div",{className:"flex h-full flex-col","data-testid":"log-tab",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-1.5",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full ${a?"bg-emerald-500":"bg-zinc-400"}`}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:a?"Live":"Disconnected"}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>u("structured"),className:`rounded p-1 transition-colors ${"structured"===c?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,title:l("logTab.structuredView"),children:(0,t.jsx)(E.FileText,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{type:"button",onClick:()=>u("raw"),className:`rounded p-1 transition-colors ${"raw"===c?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,title:l("logTab.rawView"),children:(0,t.jsx)(tU.Code,{className:"h-3.5 w-3.5"})}),o?null:(0,t.jsxs)("button",{type:"button",onClick:m,className:"text-muted-foreground hover:text-foreground ms-1 flex items-center gap-1 text-xs",children:[(0,t.jsx)(tB.ArrowDown,{className:"h-3 w-3"}),"Jump to bottom"]})]})]}),(0,t.jsx)("div",{ref:i,onScroll:x,className:`flex-1 overflow-y-auto ${"raw"===c?"bg-zinc-950 p-3 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap text-zinc-300":"bg-background"}`,children:"structured"===c?(0,t.jsx)(tZ,{content:e}):e})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(D.Terminal,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:l("logTab.noLogOutput")}),a?(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Waiting for log data..."}):null]})}let ss=(0,W.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var sa=e.i(95812),sr=e.i(87889);let sn=(0,W.default)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]),sl={Todo:{icon:sa.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Todo"},"Work in Progress":{icon:i.Loader2,colorClass:"text-blue-600",borderClass:"border-blue-200",spinning:!0,label:"In Progress"},Done:{icon:x.Check,colorClass:"text-emerald-600",borderClass:"border-emerald-200",label:"Done"},Review:{icon:sr.Eye,colorClass:"text-amber-600",borderClass:"border-amber-200",label:"Review"}},si={icon:sa.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Unknown"};function so({tasks:e}){let{t:s}=(0,r.useTranslation)("web");return 0===e.length?(0,t.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 py-4",children:(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:s("taskProgress.noTasksDefined")})}):(0,t.jsxs)("div",{"data-testid":"task-progress-view",className:"flex flex-col gap-3",children:[(0,t.jsx)(sd,{tasks:e}),(0,t.jsx)("div",{"data-testid":"task-progress-list",className:"flex flex-col gap-2",children:e.map((e,s)=>(0,t.jsx)(su,{task:e,index:s},e.title||`task-${s}`))})]})}function sd({tasks:e}){let{t:a}=(0,r.useTranslation)("web"),n=(0,s.useMemo)(()=>{let t=e.filter(e=>"Done"===e.state).length,s=e.filter(e=>"Work in Progress"===e.state).length,a=e.filter(e=>"Review"===e.state).length,r=e.filter(e=>"Done"!==e.state&&"Work in Progress"!==e.state&&"Review"!==e.state).length,n=e.length,l=n>0?Math.round(t/n*100):0;return{done:t,wip:s,review:a,todo:r,total:n,percent:l}},[e]);return(0,t.jsxs)("div",{"data-testid":"task-progress-summary",className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Task Progress"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs",children:[n.done," of ",n.total," done"]})]}),(0,t.jsx)("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:(0,t.jsx)("div",{"data-testid":"task-progress-bar",className:"h-full rounded-full bg-emerald-500 transition-all",style:{width:`${n.percent}%`}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3",children:[n.done>0?(0,t.jsx)(sc,{icon:x.Check,label:a("taskProgress.done"),count:n.done,className:"text-emerald-600"}):null,n.wip>0?(0,t.jsx)(sc,{icon:i.Loader2,label:a("taskProgress.inProgress"),count:n.wip,className:"text-blue-600"}):null,n.review>0?(0,t.jsx)(sc,{icon:sr.Eye,label:a("taskProgress.review"),count:n.review,className:"text-amber-600"}):null,n.todo>0?(0,t.jsx)(sc,{icon:sa.Circle,label:a("taskProgress.todo"),count:n.todo,className:"text-muted-foreground"}):null]})]})}function sc({icon:e,label:s,count:r,className:n}){return(0,t.jsxs)("span",{className:(0,a.cn)("flex items-center gap-1 text-xs",n),children:[(0,t.jsx)(e,{className:"h-3 w-3"}),r," ",s]})}function su({task:e,index:r}){let[n,l]=(0,s.useState)(!1),i=sl[e.state]??si,o=i.icon,d=e.actionItems.length>0,c=(0,s.useCallback)(()=>{d&&l(e=>!e)},[d]);return(0,t.jsxs)("div",{"data-testid":`task-card-${r}`,className:(0,a.cn)("rounded-lg border",i.borderClass),children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!d,className:(0,a.cn)("flex w-full items-start gap-2 px-3 py-2.5 text-start",d&&"hover:bg-muted/50 cursor-pointer transition-colors"),children:[(0,t.jsx)(o,{className:(0,a.cn)("mt-0.5 h-4 w-4 shrink-0",i.colorClass,i.spinning&&"animate-spin")}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:(0,a.cn)("text-sm font-medium",i.colorClass),children:e.title}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description}):null]}),d?(0,t.jsx)(ed.ChevronRight,{className:(0,a.cn)("text-muted-foreground mt-0.5 h-4 w-4 shrink-0 transition-transform",n&&"rotate-90")}):null]}),n&&d?(0,t.jsx)("div",{className:"border-t px-3 py-2.5",children:(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.actionItems.map((e,s)=>(0,t.jsx)(sx,{item:e},e.name||`ai-${s}`))})}):null]})}function sx({item:e}){let s=e.acceptanceCriteria.length,a=e.acceptanceCriteria.filter(e=>e.verified).length,r=s>0&&a===s;return(0,t.jsxs)("div",{"data-testid":"action-item",className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[r?(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,t.jsx)(sn,{className:"text-muted-foreground mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.name}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-[11px]",children:e.description}):null]}),s>0?(0,t.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[a,"/",s]}):null]}),s>0?(0,t.jsx)("div",{className:"ms-5.5 flex flex-col gap-1",children:e.acceptanceCriteria.map((e,s)=>(0,t.jsx)(sm,{criterion:e},e.description||`ac-${s}`))}):null]})}function sm({criterion:e}){return(0,t.jsxs)("div",{"data-testid":"acceptance-criterion",className:"flex items-start gap-1.5",children:[e.verified?(0,t.jsx)(x.Check,{className:"mt-0.5 h-3 w-3 shrink-0 text-emerald-600"}):(0,t.jsx)(sa.Circle,{className:"text-muted-foreground mt-0.5 h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:(0,a.cn)("text-[11px]",e.verified?"text-muted-foreground line-through":"text-foreground"),children:e.description})]})}let sp={Requirements:"border-transparent bg-blue-50 text-blue-700 hover:bg-blue-50",ClarificationRequired:"border-transparent bg-amber-50 text-amber-700 hover:bg-amber-50",Ready:"border-transparent bg-green-50 text-green-700 hover:bg-green-50"};function sh({plan:e,loading:s,error:a}){return s?(0,t.jsx)("div",{"data-testid":"plan-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):a?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:a})]}):e?(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Plan State"}),(0,t.jsx)(eu.Badge,{className:sp[e.state]??"border-transparent bg-gray-50 text-gray-700",children:e.state})]}),e.overview?(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Overview"}),(0,t.jsx)("p",{className:"text-sm leading-relaxed",children:e.overview})]}):null,(0,t.jsx)(so,{tasks:e.tasks})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(ss,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"No plan created yet"})]})}var sf=e.i(28112);function sg(){return{data:null,loading:!1,error:null}}let sb=[{key:"overview",label:"Overview",icon:U.LayoutDashboard},{key:"activity",label:"Activity",icon:V.Activity},{key:"log",label:"Log",icon:H},{key:"plan",label:"Plan",icon:G},{key:"prd-review",label:"PRD Review",icon:_},{key:"tech-decisions",label:"Tech Decisions",icon:K.Cpu},{key:"product-decisions",label:"Product",icon:Z.Package},{key:"merge-review",label:"Merge Review",icon:Q},{key:"chat",label:"Chat",icon:J.MessageSquare}],sj={activity:async function(e){let t=await es(e);if("error"in t)throw Error(t.error);return{timings:t.timings,rejectionFeedback:t.rejectionFeedback}},plan:async function(e){let t=await ea(e);if("error"in t)throw Error(t.error);return t.plan}};function sv({featureName:e,headerContent:r,featureNode:l,featureId:o,initialTab:u,urlTab:x,prdData:m,prdSelections:p,onPrdSelect:h,onPrdApprove:f,onPrdReject:g,isPrdLoading:b,techData:j,onTechApprove:v,onTechReject:y,isTechLoading:N,productData:w,mergeData:k,onMergeApprove:C,onMergeReject:T,isMergeLoading:S,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:D,rebaseError:$,isRejecting:E,chatInput:L,onChatInputChange:F,sseEvents:q,interactiveAgentEnabled:O=!0,onRetry:U,onStop:V,onStart:W}){let H,G=(0,n.usePathname)(),_=(0,s.useMemo)(()=>(function(e,t=!0){let s=["overview","activity"];return e.hasAgentRun&&s.push("log"),e.hasPlan&&s.push("plan"),"requirements"===e.lifecycle&&"action-required"===e.state&&s.push("prd-review"),"implementation"===e.lifecycle&&"action-required"===e.state&&s.push("tech-decisions","product-decisions"),"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)&&s.push("merge-review"),"maintain"===e.lifecycle&&e.pr&&s.push("merge-review"),t&&s.push("chat"),s})(l,O),[l,O]),K=(0,s.useMemo)(()=>sb.filter(e=>_.includes(e.key)).map(e=>"merge-review"===e.key&&"maintain"===l.lifecycle?{...e,label:"Merge History"}:e),[_,l.lifecycle]),Z=(0,s.useMemo)(()=>{let e=G.match(/^(\/feature\/[^/]+)/);return e?e[1]:G},[G]),Q=(0,s.useMemo)(()=>x&&_.includes(x)?x:u&&_.includes(u)?u:"overview",[]),[J,es]=(0,s.useState)(Q),ea=function(e){let[t,a]=(0,s.useState)(""),[r,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),o=(0,s.useRef)(null),d=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),n(!1)},[]);return(0,s.useEffect)(()=>{if(!e){a(""),n(!1),i(null);return}a(""),i(null);let t=new EventSource(`/api/feature-logs?featureId=${e}`);return o.current=t,t.onopen=()=>{n(!0)},t.addEventListener("initial",e=>{a(JSON.parse(e.data).content)}),t.addEventListener("log",e=>{let t=JSON.parse(e.data);a(e=>e+t.content)}),t.addEventListener("error",e=>{try{let t=JSON.parse(e.data);i(t.error)}catch{i(e.data?String(e.data):"Log stream unavailable")}}),t.onerror=()=>{n(!1)},()=>{t.close(),o.current=null}},[e,d]),{content:t,isConnected:r,error:l}}("log"===J?o:null),{tabs:en,fetchTab:el,refreshTab:eo}=function(e,t){let a=Object.keys(t),[r,n]=(0,s.useState)(()=>{let e={};for(let t of a)e[t]=sg();return e}),l=(0,s.useRef)(t);l.current=t;let i=(0,s.useRef)(e);i.current=e;let o=(0,s.useRef)(!0);(0,s.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);let d=(0,s.useRef)(e);(0,s.useEffect)(()=>{d.current!==e&&(d.current=e,n(e=>{let t={};for(let s of Object.keys(e))t[s]=sg();return t}))},[e]);let c=(0,s.useCallback)(async e=>{let t=l.current[e],s=i.current;if(t){o.current&&n(t=>t[e]?.data!==null?t:{...t,[e]:{...t[e],loading:!0,error:null}});try{let a=await t(s);o.current&&n(t=>({...t,[e]:{data:a,loading:!1,error:null}}))}catch(t){o.current&&n(s=>{let a=t instanceof Error?t.message:"Failed to fetch tab data",r=s[e]?.data??null;return{...s,[e]:{data:r,loading:!1,error:r?null:a}}})}}},[]),u=(0,s.useCallback)(async e=>{let t=r[e];t&&null!==t.data||t&&t.loading||await c(e)},[r,c]);return{tabs:r,fetchTab:u,refreshTab:(0,s.useCallback)(async e=>{await c(e)},[c])}}(o,sj),ed=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!ed.current)return;ed.current=!1;let e="overview"===J?Z:`${Z}/${J}`;e!==G&&window.history.pushState(null,"",e)},[J,Z,G]);let ec=(0,s.useRef)(G);(0,s.useEffect)(()=>{if(ec.current===G||(ec.current=G,ed.current))return;let e=G.split("/"),t=e.length>=4?e[3]:void 0,s=t&&_.includes(t)?t:"overview";s!==J&&(es(s),("activity"===s||"plan"===s)&&el(s))},[G]);let eu=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!eu.current&&(eu.current=!0,!x&&"overview"!==Q)){let e=`${Z}/${Q}`;e!==G&&window.history.replaceState(null,"",e)}},[]);let ex=(0,s.useRef)(!1);(0,s.useEffect)(()=>{ex.current||(ex.current=!0,("activity"===J||"plan"===J)&&el(J))},[J,el]);let em=(0,s.useRef)(o);(0,s.useEffect)(()=>{em.current!==o&&(em.current=o,es("overview"))},[o]);let ep=(0,s.useRef)(u);(0,s.useEffect)(()=>{if(ep.current!==u&&u&&_.includes(u)){ep.current=u,es(u),("activity"===u||"plan"===u)&&el(u);let e="overview"===u?Z:`${Z}/${u}`;e!==window.location.pathname&&window.history.replaceState(null,"",e)}},[u,_,Z,el]),(0,s.useEffect)(()=>{_.includes(J)||(es("overview"),window.location.pathname!==Z&&window.history.replaceState(null,"",Z))},[_,J,Z]);let eh=(0,s.useRef)(J);eh.current=J;let ef=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(!q||0===q.length||(ef.current>q.length&&(ef.current=0),q.length<=ef.current))return;let e=q.slice(ef.current);if(ef.current=q.length,!e.some(e=>e.featureId===o))return;eo("activity");let t=eh.current;"plan"===t&&eo(t)},[q,o,eo]);let eg="running"===l.state||"creating"===l.state;(0,s.useEffect)(()=>{if(!eg)return;let e=setInterval(()=>{eo("activity")},5e3);return()=>clearInterval(e)},[eg,eo]);let eb=(0,s.useCallback)(e=>{ed.current=!0,es(e),("activity"===e||"plan"===e)&&el(e)},[el]);return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsxs)(et.Tabs,{value:J,onValueChange:eb,className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(et.TabsList,{className:"bg-muted/50 h-auto w-full shrink-0 justify-start gap-0 rounded-none border-b p-0",children:K.map(e=>{let s=e.icon;return(0,t.jsxs)(et.TabsTrigger,{value:e.key,className:"text-muted-foreground hover:bg-muted hover:text-foreground data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:border-t-primary [&:not([data-state=active])]:border-r-border relative h-auto rounded-none border-t-2 border-r border-t-transparent border-r-transparent bg-transparent px-3.5 py-2.5 text-[13px] font-normal shadow-none transition-none last:border-r-transparent data-[state=active]:shadow-none",children:[(0,t.jsx)(s,{className:"mr-1.5 size-4"}),e.label]},e.key)})}),(0,t.jsxs)("div",{className:"bg-muted/40 shrink-0 border-b",children:[e?(0,t.jsxs)("div",{className:"flex h-12 items-stretch gap-2 pr-0 pl-4","data-testid":"feature-drawer-header",children:[(0,t.jsx)("div",{className:"flex items-center",children:l.fastMode?(0,t.jsx)(Y.Zap,{className:"size-4 shrink-0 text-amber-500"}):(0,t.jsx)(ee,{className:"text-muted-foreground/50 size-4 shrink-0"})}),(0,t.jsx)("h2",{className:"text-foreground flex min-w-0 items-center truncate text-base font-semibold tracking-tight",children:e}),l.repositoryName?(0,t.jsxs)("span",{className:"animate-in fade-in flex shrink-0 items-center gap-1.5 self-center duration-200",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),l.remoteUrl?(0,t.jsx)("a",{href:l.remoteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground text-sm",children:l.repositoryName}):(0,t.jsx)("span",{className:"text-muted-foreground text-sm",children:l.repositoryName})]}):(0,t.jsxs)("span",{className:"flex items-center gap-1.5 self-center",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),(0,t.jsx)("span",{className:"bg-muted h-4 w-16 animate-pulse rounded"})]}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 cursor-default items-center self-stretch text-xs font-medium",children:[(0,t.jsxs)("div",{className:(0,a.cn)("flex items-center gap-1.5 self-stretch px-3",er.featureNodeStateConfig[l.state].labelClass),children:["running"===l.state?(0,t.jsx)(ei,{size:"sm",className:"shrink-0"}):(H=er.featureNodeStateConfig[l.state].icon,(0,t.jsx)(H,{className:"size-3.5 shrink-0"})),er.featureNodeStateConfig[l.state].label]}),"pending"===l.state&&W?(0,t.jsxs)("button",{type:"button",onClick:()=>W(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-green-500/10 hover:text-green-600 dark:hover:text-green-400","data-testid":"feature-drawer-start-button",children:[(0,t.jsx)(d.Play,{className:"size-3.5"})," Start"]}):"error"===l.state&&U?(0,t.jsxs)("button",{type:"button",onClick:()=>U(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 dark:hover:text-red-400","data-testid":"feature-drawer-retry-button",children:[(0,t.jsx)(X.RotateCcw,{className:"size-3.5"})," Retry"]}):"running"===l.state&&V?(0,t.jsxs)("button",{type:"button",onClick:()=>V(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 dark:hover:text-red-400","data-testid":"feature-drawer-stop-button",children:[(0,t.jsx)(c.Square,{className:"size-3.5"})," Stop"]}):null]})}),l.errorMessage?(0,t.jsxs)(P.TooltipContent,{side:"bottom",align:"end",sideOffset:4,className:"z-[100] max-w-xs cursor-pointer text-xs leading-relaxed select-text",onClick:()=>{navigator.clipboard.writeText(l.errorMessage)},children:[l.errorMessage,(0,t.jsx)("span",{className:"text-muted-foreground ml-1 text-[10px] italic",children:"(click to copy)"})]}):null]})})]}):null,r]}),(0,t.jsx)(et.TabsContent,{value:"overview",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tj,{data:l,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:D,rebaseError:$})}),(0,t.jsx)(et.TabsContent,{value:"activity",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tD,{timings:en.activity.data?.timings??null,loading:en.activity.loading,error:en.activity.error,rejectionFeedback:en.activity.data?.rejectionFeedback})}),(0,t.jsx)(et.TabsContent,{value:"log",className:"mt-0 flex-1 overflow-hidden",children:(0,t.jsx)(st,{content:ea.content,isConnected:ea.isConnected,error:ea.error})}),(0,t.jsx)(et.TabsContent,{value:"plan",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(sh,{plan:en.plan.data,loading:en.plan.loading,error:en.plan.error})}),_.includes("prd-review")?(0,t.jsx)(et.TabsContent,{value:"prd-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:m?(0,t.jsx)(ev,{data:m,selections:p??{},onSelect:h??(()=>void 0),onApprove:f??(()=>void 0),onReject:g,isProcessing:b,isRejecting:E,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,_.includes("tech-decisions")?(0,t.jsx)(et.TabsContent,{value:"tech-decisions",className:"mt-0 flex min-h-0 flex-1 flex-col",children:j?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(eC,{data:j})}),(0,t.jsx)(sy,{onApprove:v??(()=>void 0),onReject:y,isProcessing:N,isRejecting:E,chatInput:L,onChatInputChange:F})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,_.includes("product-decisions")?(0,t.jsx)(et.TabsContent,{value:"product-decisions",className:"mt-0 flex-1 overflow-y-auto",children:null===w?(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):w?(0,t.jsx)(eR,{data:w}):(0,t.jsx)("p",{className:"text-muted-foreground p-4 text-center text-sm",children:"No product decisions available."})}):null,_.includes("merge-review")?(0,t.jsx)(et.TabsContent,{value:"merge-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:k?(0,t.jsx)(e2,{data:k,readOnly:"maintain"===l.lifecycle,onApprove:C??(()=>void 0),onReject:T,isProcessing:S,isRejecting:E,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:S?(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"}):(0,t.jsxs)("div",{className:"text-muted-foreground flex flex-col items-center gap-2 text-sm",children:[(0,t.jsx)(B.AlertCircle,{className:"h-6 w-6"}),(0,t.jsx)("span",{children:"Merge review data unavailable"})]})})}):null,_.includes("chat")?(0,t.jsx)(et.TabsContent,{value:"chat",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(sf.ChatTab,{featureId:o,worktreePath:l.worktreePath})}):null]})})}function sy({onApprove:e,onReject:s,isProcessing:a,isRejecting:n,chatInput:l,onChatInputChange:i}){let{t:o}=(0,r.useTranslation)("web");return(0,t.jsx)(ej,{onReject:s,onApprove:e,approveLabel:o("featureDrawer.approvePlan"),revisionPlaceholder:"Ask AI to revise the plan...",isProcessing:a,isRejecting:n,chatInput:l,onChatInputChange:i})}var sN=e.i(97093),sw=e.i(62794),sk=e.i(33328);let sC=(0,h.createServerReference)("402236d2cab5e0074fd02ba809213c4d3d0e32ecf8",h.callServer,void 0,h.findSourceMapURL,"rebaseFeature");var sT=e.i(99045);function sS(e){return"requirements"===e.lifecycle&&"action-required"===e.state?"prd-review":"implementation"===e.lifecycle&&"action-required"===e.state?"tech-decisions":"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)?"merge-review":"overview"}function sR(e,t,a,r,n,i){let[o,d]=(0,s.useState)(!1),c=(0,s.useRef)(a),u=(0,s.useRef)(r);return c.current=a,u.current=r,(0,s.useEffect)(()=>{if(u.current(),!e)return;let s=!1;return d(!0),t(e).then(e=>{s||c.current(e)}).catch(()=>{!s&&n&&l.toast.error(n)}).finally(()=>{s||d(!1)}),()=>{s=!0}},[e,t,n,i]),o}let sM=(0,h.createServerReference)("4051f3ece9c2df090c830ad470622887f17dce1576",h.callServer,void 0,h.findSourceMapURL,"getFeatureDrawerData"),sI=(0,h.createServerReference)("4069db35a515506fac388bc4e7062ba58bbe0fdfde",h.callServer,void 0,h.findSourceMapURL,"getBranchSyncStatus"),sP=new Map;e.s(["FeatureDrawerClient",0,function({view:e,urlTab:h,interactiveAgentEnabled:z=!0}){var D;let $,E,L,F,q,B,U=(0,k.useFeatureFlags)(),{t:V}=(0,r.useTranslation)("web"),W=(0,n.useRouter)(),H=(0,C.useSoundAction)("reject"),[G,_]=(0,s.useState)(e);(0,s.useEffect)(()=>{_(t=>"feature"===t.type&&"feature"===e.type&&t.node.featureId===e.node.featureId?{...e,node:{...t.node,...e.node}}:e)},[e]);let K="feature"===G.type?G.node:null,{events:Z}=(0,R.useAgentEventsContext)(),Q=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(Q.current>Z.length&&(Q.current=0),!K||Z.length<=Q.current)return;let e=Z.slice(Q.current);for(let t of(Q.current=Z.length,(0,sT.resolveSseEventUpdates)(e)))t.featureId===K.featureId&&"deleting"!==K.state&&(void 0!==t.state||void 0!==t.lifecycle)&&_(e=>{if("feature"!==e.type)return e;let s={...e.node,...void 0!==t.state&&{state:t.state},...void 0!==t.lifecycle&&{lifecycle:t.lifecycle}};return{...e,node:s,initialTab:sS(s)}})},[Z,K]);let J=(0,n.usePathname)().startsWith("/feature/");D=K?.featureId??null,$=(0,s.useRef)(J),E=(0,s.useRef)(!1),L=(0,s.useRef)(0),F=(0,s.useCallback)(async()=>{if(!D||E.current)return;E.current=!0;let e=L.current;try{let t=await sM(D);if(!t||e!==L.current)return;_(e=>(function(e,t){if("feature"!==e.type)return e;let s={...e.node,...t},a=s.state!==e.node.state||s.lifecycle!==e.node.lifecycle;return{...e,node:s,initialTab:a?sS(s):e.initialTab}})(e,t))}catch{}finally{E.current=!1}},[D,_]),q=(0,s.useRef)(!1),(0,s.useEffect)(()=>{!J||$.current&&q.current||(q.current=!0,L.current+=1,E.current=!1,F()),$.current=J},[J,F]),(0,s.useEffect)(()=>{if(!J||!D)return;let e=setInterval(()=>{F()},15e3);return()=>clearInterval(e)},[J,D,F]);let X=(0,s.useCallback)(()=>{W.push("/")},[W]),[Y,ee]=(0,s.useState)(""),[et,es]=(0,s.useState)(null),[ea,er]=(0,s.useState)({}),[en,el]=(0,s.useState)({}),[ei,eo]=(0,s.useState)(null),[ed,ec]=(0,s.useState)(void 0),[eu,ex]=(0,s.useState)(null),[em,ep]=(0,s.useState)(!1),[eh,ef]=(0,s.useState)(!1),[eg,eb]=(0,s.useState)(!1),ej=`${K?.featureId}:${K?.state}`,ev=(0,s.useRef)(ej);(0,s.useEffect)(()=>{ej!==ev.current&&(ev.current=ej,eb(!1))},[ej]);let[ey,eN]=(0,s.useState)(!1),ew=(0,s.useRef)(!1),ek="feature"===G.type?G.initialTab:void 0;(0,s.useEffect)(()=>{ee("")},[ek]);let eC=(0,s.useRef)(0),eT=(0,s.useRef)(K?.state),eS=(0,s.useRef)(K?.lifecycle);(K?.state!==eT.current||K?.lifecycle!==eS.current)&&(eT.current=K?.state,eS.current=K?.lifecycle,eC.current+=1);let eR=eC.current,eM=sR(K?.lifecycle==="requirements"&&K?.state==="action-required"?K.featureId:null,y,e=>{if(e.error)return void l.toast.error(e.error);if(e.questionnaire){es(e.questionnaire);let t={};for(let s of e.questionnaire.questions){let e=s.options.find(e=>e.recommended);e&&(t[s.id]=e.id)}er(t),el(t)}},()=>{er({}),el({}),es(null)},"Failed to load questionnaire",eR),eI=K?.lifecycle==="implementation"&&K?.state==="action-required"?K.featureId:null,eP=sR(eI,N,e=>{e.error?l.toast.error(e.error):e.techDecisions&&eo(e.techDecisions)},()=>eo(null),"Failed to load tech decisions",eR),eA=sR(eI,y,e=>{e.productDecisions&&ec(e.productDecisions)},()=>ec(void 0),void 0,eR),ez=sR(K?.lifecycle==="review"&&(K?.state==="action-required"||K?.state==="error")||K?.lifecycle==="maintain"&&K?.pr?K.featureId:null,w,e=>{"error"in e?l.toast.error(e.error):ex(e)},()=>ex(null),"Failed to load merge review data",eR),eD=Y.trim().length>0,e$=K?.lifecycle==="requirements"&&K?.state==="action-required"&&Object.keys(en).some(e=>en[e]!==ea[e]),eE=(0,s.useCallback)(()=>{ee(""),er({...en})},[en]),{attemptClose:eL}=(0,T.useGuardedDrawerClose)({open:J,isDirty:eD||e$,onClose:X,onReset:eE}),eF=(0,s.useCallback)(async(e,t,s=[],a)=>{if(K?.featureId){ew.current=!0,eN(!0);try{let r=s.map(e=>e.path).filter(Boolean),n=s.filter(e=>e.notes?.trim()),i=n.length>0?`${e}
3
3
 
4
4
  Image notes:
5
5
  ${n.map(e=>`- @${e.path}: ${e.notes.trim()}`).join("\n")}`:e,o=await v(K.featureId,i,r);if(!o.rejected)return void l.toast.error(o.error??`Failed to reject ${t.toLowerCase()}`);H.play(),ee(""),l.toast.success(`${t} rejected — agent re-iterating (iteration ${o.iteration})`),o.iterationWarning&&l.toast.warning(`Iteration ${o.iteration} — consider approving or adjusting feedback to avoid excessive iterations`),window.dispatchEvent(new CustomEvent("shipit-ai:feature-approved",{detail:{featureId:K.featureId}})),X(),a?.()}finally{ew.current=!1,eN(!1)}}},[K,X,H]),eq=(0,s.useCallback)((e,t)=>eF(e,"Requirements",t,()=>er({})),[eF]),eO=(0,s.useCallback)((e,t)=>eF(e,"Plan",t),[eF]),eB=(0,s.useCallback)((e,t)=>eF(e,"Merge",t),[eF]),eU=(0,s.useCallback)(async e=>{if(!K?.featureId)return;let t=await f(K.featureId);t.approved?(ee(""),l.toast.success(`${e} approved — agent resuming`),window.dispatchEvent(new CustomEvent("shipit-ai:feature-approved",{detail:{featureId:K.featureId}})),X()):l.toast.error(t.error??`Failed to approve ${e.toLowerCase()}`)},[K,X]),eV=(0,s.useCallback)(async e=>{let t;if("feature"!==G.type||!K)return;if(et){let e=[];for(let[t,s]of Object.entries(ea)){let a=et.questions.find(e=>e.id===t),r=a?.options.find(e=>e.id===s);a&&r&&e.push({questionId:a.question,selectedOption:r.label})}t={approved:!0,changedSelections:e}}let s=await f(K.featureId,t);s.approved?(ee(""),l.toast.success("Requirements approved — agent resuming"),window.dispatchEvent(new CustomEvent("shipit-ai:feature-approved",{detail:{featureId:K.featureId}})),er({}),X()):l.toast.error(s.error??"Failed to approve requirements")},[G,K,et,ea,X]),eW=(0,s.useCallback)(()=>eU("Plan"),[eU]),eH=(0,s.useCallback)(()=>eU("Merge"),[eU]),eG=(0,s.useCallback)(async(e,t,s,a)=>{ep(!0),ef(!1),window.dispatchEvent(new CustomEvent("shipit-ai:feature-delete-requested",{detail:{featureId:e,cleanup:t,cascadeDelete:s,closePr:a}})),W.push("/")},[W]),e_=(0,s.useCallback)(e=>{eb(!0),window.dispatchEvent(new CustomEvent("shipit-ai:feature-archive-requested",{detail:{featureId:e}})),W.push("/")},[W]),eK=(0,s.useCallback)(e=>{eb(!0),window.dispatchEvent(new CustomEvent("shipit-ai:feature-unarchive-requested",{detail:{featureId:e}})),W.push("/")},[W]),eZ=(0,s.useCallback)(async e=>{let t=await (0,g.resumeFeature)(e);t.error?l.toast.error(t.error):(l.toast.success("Feature resumed — agent restarting"),window.dispatchEvent(new CustomEvent("shipit-ai:feature-approved",{detail:{featureId:e}})),_(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[]),eQ=(0,s.useCallback)(async e=>{let t=await (0,j.stopFeature)(e);t.stopped?(l.toast.success("Agent stopped"),_(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"error"}})):l.toast.error(t.error??"Failed to stop")},[]),eJ=(0,s.useCallback)(async e=>{let t=await (0,b.startFeature)(e);t.error?l.toast.error(t.error):(l.toast.success("Feature started"),_(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[]),eX=K?.repositoryPath&&K?.branch?{featureId:K.featureId,repositoryPath:K.repositoryPath,branch:K.branch,worktreePath:K.worktreePath,specPath:K.specPath}:null,eY=function(e){let[t,a]=(0,s.useState)(!1),[r,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(!1),[x,m]=(0,s.useState)(null),[p,h]=(0,s.useState)(null),[f,g]=(0,s.useState)(null),[b,j]=(0,s.useState)(null),[v,y]=(0,s.useState)(null),N=(0,s.useRef)(null),w=(0,s.useRef)(null),k=(0,s.useRef)(null),C=(0,s.useRef)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=[N,w,k,C,T];return()=>{for(let t of e)t.current&&clearTimeout(t.current)}},[]);let S=(0,s.useCallback)(async(t,s,a,r,n)=>{if(e&&!n){r.current&&clearTimeout(r.current),s(!0),a(null);try{let s=await t({repositoryPath:e.repositoryPath,branch:e.branch});if(!s.success){let e=s.error??"An unexpected error occurred";a(e),r.current=setTimeout(()=>a(null),5e3)}}catch(e){a(e instanceof Error?e.message:"An unexpected error occurred"),r.current=setTimeout(()=>a(null),5e3)}finally{s(!1)}}},[e]);return{openInIde:(0,s.useCallback)(()=>S(sN.openIde,a,m,N,t),[S,t]),openInShell:(0,s.useCallback)(()=>S(sw.openShell,n,h,w,r),[S,r]),openFolder:(0,s.useCallback)(async()=>{if(e&&!l){k.current&&clearTimeout(k.current),i(!0),g(null);try{let t=e.worktreePath??e.repositoryPath,s=await (0,sk.openFolder)(t);if(!s.success){let e=s.error??"An unexpected error occurred";g(e),k.current=setTimeout(()=>g(null),5e3)}}catch(e){g(e instanceof Error?e.message:"An unexpected error occurred"),k.current=setTimeout(()=>g(null),5e3)}finally{i(!1)}}},[e,l]),openSpecsFolder:(0,s.useCallback)(async()=>{if(e?.specPath&&!o){C.current&&clearTimeout(C.current),d(!0),j(null);try{let t=await (0,sk.openFolder)(e.specPath);if(!t.success){let e=t.error??"An unexpected error occurred";j(e),C.current=setTimeout(()=>j(null),5e3)}}catch(e){j(e instanceof Error?e.message:"An unexpected error occurred"),C.current=setTimeout(()=>j(null),5e3)}finally{d(!1)}}},[e,o]),rebaseOnMain:(0,s.useCallback)(async()=>{if(e?.featureId&&!c){T.current&&clearTimeout(T.current),u(!0),y(null);try{let t=await sC(e.featureId);if(!t.success){let e=t.error??"An unexpected error occurred";y(e),T.current=setTimeout(()=>y(null),5e3)}}catch(e){y(e instanceof Error?e.message:"An unexpected error occurred"),T.current=setTimeout(()=>y(null),5e3)}finally{u(!1)}}},[e,c]),ideLoading:t,shellLoading:r,folderLoading:l,specsLoading:o,rebaseLoading:c,ideError:x,shellError:p,folderError:f,specsError:b,rebaseError:v}}(eX),e0=U.gitRebaseSync&&K?.branch&&K?.remoteUrl?K.featureId:null,{data:e1,loading:e2,error:e5,refresh:e3}=function(e){let[t,a]=(0,s.useState)(()=>{if(!e)return null;let t=sP.get(e);return t?t.data:null}),[r,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),o=(0,s.useRef)(e);o.current=e;let d=(0,s.useCallback)(async e=>{n(!0),i(null);try{let t=await sI(e);if(o.current!==e)return;if(t.success&&t.data){let s=t.data;sP.set(e,{data:s,timestamp:Date.now()}),a(s)}else i(t.error??"Failed to check sync status")}catch{if(o.current!==e)return;i("Failed to check sync status")}finally{o.current===e&&n(!1)}},[]);return(0,s.useEffect)(()=>{if(!e){a(null),i(null);return}let t=sP.get(e);t&&(a(t.data),Date.now()-t.timestamp<3e4)||d(e)},[e,d]),{data:t,loading:r,error:l,refresh:(0,s.useCallback)(()=>{e&&d(e)},[e,d])}}(e0),e4=(0,s.useRef)(eY.rebaseLoading);(0,s.useEffect)(()=>{!e4.current||eY.rebaseLoading||eY.rebaseError||e3(),e4.current=eY.rebaseLoading},[eY.rebaseLoading,eY.rebaseError,e3]);let e6=K?.repositoryPath&&K.branch?{targetId:K.featureId,targetType:"feature",repositoryPath:K.repositoryPath,branch:K.branch}:null,e8=(0,S.useDeployAction)(e6),e9="Booting"===e8.status||"Ready"===e8.status,[e7,te]=(0,s.useState)(!1),tt=(0,s.useCallback)(()=>{K?.featureId&&(navigator.clipboard.writeText(K.featureId),te(!0),setTimeout(()=>te(!1),2e3))},[K?.featureId]);if(K){let e=K.featureId.slice(0,8),s="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40",r="bg-border/60 mx-1.5 h-5 w-px shrink-0";B=(0,t.jsx)("div",{"data-testid":"feature-drawer-toolbar",children:(0,t.jsxs)("div",{className:"flex h-10 items-center px-2","data-testid":"feature-drawer-actions",children:[eX&&K?.state!=="done"?(0,t.jsx)(O,{actions:eY,repositoryPath:eX.repositoryPath,worktreePath:eX.worktreePath,showSpecs:!!eX.specPath}):null,eX&&K?.state!=="done"&&U.envDeploy&&e6?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:e8.deployLoading||e8.stopLoading,onClick:e9?e8.stop:e8.deploy,className:(0,a.cn)("inline-flex size-7 items-center justify-center rounded-[3px] disabled:opacity-40",e9?"text-red-500 hover:bg-red-500/10 hover:text-red-400":"text-green-600 hover:bg-green-500/10 dark:text-green-500"),"aria-label":V(e9?"featureDrawer.stopDevServer":"featureDrawer.startDevServer"),children:e8.deployLoading||e8.stopLoading?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):e9?(0,t.jsx)(c.Square,{className:"size-4"}):(0,t.jsx)(d.Play,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:V(e9?"featureDrawer.stopDevServer":"featureDrawer.startDevServer")})]})}),e9?(0,t.jsx)(I.DeploymentStatusBadge,{status:e8.status,url:e8.url,targetId:e6?.targetId}):null]}):null,(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("code",{className:"text-muted-foreground/70 font-mono text-[10px] tracking-wide select-none",children:e}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:tt,className:s,"aria-label":V("featureDrawer.copyFeatureId"),"data-testid":"feature-drawer-copy-id",children:e7?(0,t.jsx)(x.Check,{className:"size-4 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:V("featureDrawer.copyFeatureId")})]})}),K.featureId?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r}),(0,t.jsxs)(P.TooltipProvider,{delayDuration:300,children:["archived"===K.state?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:eg,className:s,"aria-label":V("featureDrawer.unarchiveFeature"),"data-testid":"feature-drawer-unarchive",onClick:()=>eK(K.featureId),children:eg?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(p.ArchiveRestore,{className:"size-3"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:V("featureDrawer.unarchiveFeature")})]}):"deleting"!==K.state?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:eg,className:s,"aria-label":V("featureDrawer.archiveFeature"),"data-testid":"feature-drawer-archive",onClick:()=>e_(K.featureId),children:eg?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(m.Archive,{className:"size-3"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:V("featureDrawer.archiveFeature")})]}):null,(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:em,className:(0,a.cn)(s,"hover:bg-destructive/10 hover:text-destructive"),"aria-label":V("featureDrawer.deleteFeature"),"data-testid":"feature-drawer-delete",onClick:()=>ef(!0),children:em?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(o.Trash2,{className:"size-3"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:V("featureDrawer.deleteFeature")})]})]}),(0,t.jsx)(A.DeleteFeatureDialog,{open:eh,onOpenChange:ef,onConfirm:(e,t,s)=>eG(K.featureId,e,t,s),isDeleting:em,featureName:K.name,featureId:K.featureId,hasChildren:K.hasChildren,hasOpenPr:!!K.pr&&"Open"===K.pr.status})]}):null]})]})})}let ts=null;if("feature"===G.type&&K){let e={...K,..."error"===K.state&&{onRetry:eZ},..."pending"===K.state&&{onStart:eJ}};ts=(0,t.jsx)(sv,{featureName:K.name,headerContent:B,featureNode:e,featureId:K.featureId,initialTab:G.initialTab,urlTab:h,sseEvents:Z,prdData:et,prdSelections:ea,onPrdSelect:(e,t)=>er(s=>({...s,[e]:t})),onPrdApprove:eV,onPrdReject:eq,isPrdLoading:eM,techData:ei,onTechApprove:eW,onTechReject:eO,isTechLoading:eP,productData:eA?null:ed,mergeData:eu,onMergeApprove:eH,onMergeReject:eB,isMergeLoading:ez,syncStatus:e0?e1:void 0,syncLoading:e2,syncError:e5,onRefreshSync:e0?e3:void 0,onRebaseOnMain:e0?eY.rebaseOnMain:void 0,rebaseLoading:eY.rebaseLoading,rebaseError:eY.rebaseError,isRejecting:ey,chatInput:Y,onChatInputChange:ee,interactiveAgentEnabled:z,onRetry:eZ,onStop:eQ,onStart:eJ})}return(0,t.jsx)(M.BaseDrawer,{open:J,onClose:eL,size:"lg",modal:!1,"data-testid":"feature"===G.type?"feature-drawer":"repository-drawer",children:ts})}],36986)}]);