@shepai/cli 1.166.0-pr513.7e8c227 → 1.166.0-pr513.fdcdd56
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.
- package/dist/src/presentation/web/components/common/feature-create-drawer/mode-selector.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +1 -1
- package/web/.next/required-server-files.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +29 -29
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +30 -30
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +40 -40
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +40 -40
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +30 -30
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +40 -40
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +40 -40
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +9 -9
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +11 -11
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +11 -11
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/version/page.js.nft.json +1 -1
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1abe77bb._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1abe77bb._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1f389e5d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2d0c3840._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__2d0c3840._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__58a5b819._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__58a5b819._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__67a193c8._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__67a193c8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__754fb18e._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__754fb18e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__7562afc6._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__7562afc6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__8b0aac03._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__96ba046b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__96ba046b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__b7b96453._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_02e01240._.js +1 -1
- package/web/.next/server/chunks/ssr/_02e01240._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0727935d._.js +1 -1
- package/web/.next/server/chunks/ssr/_0727935d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_12c98a3d._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_18886033._.js +1 -1
- package/web/.next/server/chunks/ssr/_18886033._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_22e00a14._.js +1 -1
- package/web/.next/server/chunks/ssr/_22e00a14._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_5e0c43c0._.js → _40c4d64e._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_5e0c43c0._.js.map → _40c4d64e._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_cc456d44._.js → _52567223._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_cc456d44._.js.map → _52567223._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_a5a5901d._.js +1 -1
- package/web/.next/server/chunks/ssr/_a5a5901d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_ad09f271._.js +1 -1
- package/web/.next/server/chunks/ssr/_ad09f271._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_b0efd563._.js +3 -0
- package/web/.next/server/chunks/ssr/{_a8f53ee2._.js.map → _b0efd563._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_c3f595c6._.js +1 -1
- package/web/.next/server/chunks/ssr/_c3f595c6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_ea9e1556._.js +1 -1
- package/web/.next/server/chunks/ssr/_ea9e1556._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f1ba9be6._.js +2 -2
- package/web/.next/server/chunks/ssr/_f1ba9be6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f33cd07e._.js +2 -2
- package/web/.next/server/chunks/ssr/_f33cd07e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f8b45233._.js +1 -1
- package/web/.next/server/chunks/ssr/_f8b45233._.js.map +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
- package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_approve-feature_ts_9453ce8b._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +50 -50
- package/web/.next/static/chunks/{e83613a2d0198a6a.js → 04636196914be502.js} +1 -1
- package/web/.next/static/chunks/19e7ce7a45b9aba5.js +1 -0
- package/web/.next/static/chunks/{0f6208eca3d7d895.js → 333b1f2c897337c9.js} +1 -1
- package/web/.next/static/chunks/{03d92643ee2190a4.js → 517f9f7b52421b78.js} +1 -1
- package/web/.next/static/chunks/{3425ca88c85dddb9.js → 51f2de96879281ea.js} +1 -1
- package/web/.next/static/chunks/{d5656afdef3b2ee5.js → 785d6f99b66ca637.js} +1 -1
- package/web/.next/static/chunks/{14838064627a5dcb.js → 81a9fa188d0bef95.js} +1 -1
- package/web/.next/static/chunks/{c1103035e0d56769.js → 8aa61c1b439f38d6.js} +1 -1
- package/web/.next/static/chunks/{246321074153cf07.js → 904f10ee1f7ed44f.js} +3 -3
- package/web/.next/static/chunks/{84ecdec18d323210.css → 985b80ac9fd25d02.css} +1 -1
- package/web/.next/static/chunks/{95ecd55bfbbc87aa.js → b2b1a749ec72f3a3.js} +2 -2
- package/web/.next/static/chunks/b474396c44f62500.js +1 -0
- package/web/.next/static/chunks/{0811164ad80e0ca5.js → b810ab3e01ffa9cb.js} +1 -1
- package/web/.next/static/chunks/{2a641dc89a852e0c.js → ed6f26a65c6e7da9.js} +1 -1
- package/web/.next/server/chunks/ssr/_a8f53ee2._.js +0 -3
- package/web/.next/static/chunks/150c00c30ece763b.js +0 -1
- package/web/.next/static/chunks/453a86648b40099a.js +0 -1
- /package/web/.next/static/{i5nbrQ-16hfoxXQF80u89 → POB2JchXPeEvMtK9zhjns}/_buildManifest.js +0 -0
- /package/web/.next/static/{i5nbrQ-16hfoxXQF80u89 → POB2JchXPeEvMtK9zhjns}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{i5nbrQ-16hfoxXQF80u89 → POB2JchXPeEvMtK9zhjns}/_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(20314),a=e.i(79054),s=e.i(31777);e.i(41001);var r=e.i(64780),n=e.i(31406),l=e.i(60112),i=e.i(83428),o=e.i(67669),d=e.i(24042),c=e.i(6910),u=e.i(33548),x=e.i(23925),m=e.i(37260),p=e.i(83299),h=e.i(21023);let f=(0,h.createServerReference)("605bc12a49d50c6d4b36182d1f3a18a118c8e3ffc4",h.callServer,void 0,h.findSourceMapURL,"approveFeature");var g=e.i(90414),b=e.i(14404),j=e.i(96282);let v=(0,h.createServerReference)("70b12c3b48f5049212ea95b85988e5172df0c89788",h.callServer,void 0,h.findSourceMapURL,"rejectFeature"),y=(0,h.createServerReference)("60e93d18af966c5a155a106e6fd53c8425a0e6015e",h.callServer,void 0,h.findSourceMapURL,"submitExplorationFeedback"),N=(0,h.createServerReference)("60d8f7bd9c7162a16157301e8af0d958b2d6054296",h.callServer,void 0,h.findSourceMapURL,"promoteExploration"),w=(0,h.createServerReference)("406f91d2911ffec33bb1f2bf3226fce0ebe3aea047",h.callServer,void 0,h.findSourceMapURL,"discardExploration"),k=(0,h.createServerReference)("4057e0d3a1f9908f1c5b16ed830d5eeb5ff0164cda",h.callServer,void 0,h.findSourceMapURL,"getFeatureArtifact"),C=(0,h.createServerReference)("40b07407502283181691c18b85b5b174c86388a7fc",h.callServer,void 0,h.findSourceMapURL,"getResearchArtifact"),S=(0,h.createServerReference)("40067d4927a966a4dfb570af74fdcad73a4a8dad72",h.callServer,void 0,h.findSourceMapURL,"getMergeReviewData");var T=e.i(75921),R=e.i(8361),M=e.i(30153),I=e.i(8537),A=e.i(39443);e.i(1650);var D=e.i(11495);e.i(99348);var P=e.i(5259),E=e.i(2828);e.i(31566);var z=e.i(65104),$=e.i(8986),F=e.i(38573),L=e.i(19933),q=e.i(70471),O=e.i(51251);let B="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40";function U({loading:e,error:a,icon:s}){return e?(0,t.jsx)(i.Loader2,{className:"size-3.5 animate-spin"}):a?(0,t.jsx)(O.CircleAlert,{className:"text-destructive size-3.5"}):(0,t.jsx)(s,{className:"size-4"})}function H({actions:e,repositoryPath:s,worktreePath:r,showSpecs:n}){let[l,i]=(0,a.useState)(!1);return(0,t.jsx)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openInIde,disabled:e.ideLoading,"aria-label":"Open in IDE",children:(0,t.jsx)(U,{loading:e.ideLoading,error:e.ideError,icon:$.Code2})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open in IDE"})]}),(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openInShell,disabled:e.shellLoading,"aria-label":"Open terminal",children:(0,t.jsx)(U,{loading:e.shellLoading,error:e.shellError,icon:F.Terminal})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open terminal"})]}),(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openFolder,disabled:e.folderLoading,"aria-label":"Open folder",children:(0,t.jsx)(U,{loading:e.folderLoading,error:e.folderError,icon:L.FolderOpen})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open folder"})]}),n?(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openSpecsFolder,disabled:e.specsLoading,"aria-label":"Open specs",children:(0,t.jsx)(U,{loading:e.specsLoading,error:e.specsError,icon:q.FileText})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open specs"})]}):null,(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:()=>{navigator.clipboard.writeText(r??s),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)(E.TooltipContent,{side:"bottom",className:"text-xs",children:l?"Copied!":"Copy path"})]})]})})}var V=e.i(79687),W=e.i(16489),G=e.i(74294),_=e.i(3645);let K=(0,_.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"}]]),Z=(0,_.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"}]]),Q=(0,_.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 J=e.i(18532),X=e.i(93192);let Y=(0,_.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 ee=e.i(48109),et=e.i(38227),ea=e.i(53360);let es=(0,_.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 er=e.i(52443),en=e.i(68304);let el=(0,h.createServerReference)("40fd50f0d07dedc146eb3b14fe807bb44dde85fba1",h.callServer,void 0,h.findSourceMapURL,"getFeaturePhaseTimings"),ei=(0,h.createServerReference)("4062be9be9684bcfaec11df83e4948151cb8dabf39",h.callServer,void 0,h.findSourceMapURL,"getFeaturePlan");e.i(47506);var eo=e.i(2929);let ed=(0,e.i(94237).cva)("inline-block shrink-0",{variants:{size:{sm:"size-5",md:"size-8",lg:"size-12"}},defaultVariants:{size:"md"}}),ec=[{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 eu({className:e,size:a="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,s.cn)(ed({size:a}),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"}),ec.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 ex=e.i(11345),em=e.i(76016),ep=e.i(35364),eh=e.i(81846),ef=e.i(16868);let eg=(0,_.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 eb=e.i(58481),ej=e.i(48306);e.i(50032);var ev=e.i(86254),ey=e.i(42076);let eN=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 ew({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?eb.AlertTriangle:x.Check,b=f?"bg-orange-500/85":"bg-blue-500/85",[j,v]=(0,a.useState)(""),y=m??j,N=p??v,w=(0,R.useSoundAction)("approve"),k=d||c,[C,S]=(0,a.useState)([]),[T,M]=(0,a.useState)(!1),[I,A]=(0,a.useState)(null),[D,P]=(0,a.useState)(!1),[z,$]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),q=y.trim().length>0,O=q?D||z&&F:!D,B=(0,a.useRef)(0),U=(0,a.useRef)(crypto.randomUUID()),H=(0,a.useRef)(null);(0,a.useEffect)(()=>{function e(e){("Control"===e.key||"Meta"===e.key)&&$(!0),"Shift"===e.key&&L(!0)}function t(e){("Control"===e.key||"Meta"===e.key)&&$(!1),"Shift"===e.key&&L(!1)}function a(){$(!1),L(!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",a),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",a)}},[]);let V=(0,a.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&&!eN.has(e))return void A(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();S(a=>[...a,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let a=new FormData;a.append("file",t),a.append("sessionId",U.current);let s=await fetch("/api/attachments/upload",{method:"POST",body:a});if(!s.ok){let t=await s.json().catch(()=>({error:"Upload failed"}));S(t=>t.filter(t=>t.id!==e)),A(t.error??"Upload failed");return}let r=await s.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")}}},[]),W=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,1===B.current&&M(!0)},[]),G=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,0===B.current&&M(!1)},[]),_=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),K=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&V(t)},[V]),Z=(0,a.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let a=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&a.push(t)}a.length>0&&(e.preventDefault(),V(a))},[V]),Q=(0,a.useCallback)(async()=>{try{let e=await (0,ey.pickFiles)();e&&S(t=>{let a=new Set(t.map(e=>e.path)),s=e.filter(e=>!a.has(e.path)).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,mimeType:"application/octet-stream",path:e.path}));return s.length>0?[...t,...s]:t})}catch{}},[]),J=(0,a.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),X=(0,a.useCallback)((e,t)=>{S(a=>a.map(a=>a.id===e?{...a,notes:t}:a))},[]),Y=(0,a.useCallback)(()=>{N(""),S([]),A(null)},[N]),ee=(0,a.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),H.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)(E.TooltipProvider,{delayDuration:400,children:(0,t.jsx)("form",{ref:H,onSubmit:function(t){t.preventDefault();let a=y.trim();if(O)w.play(),n(),Y();else{if(!a||!e)return;e(a,C.filter(e=>!e.loading)),Y()}},className:"p-3",children:(0,t.jsx)("div",{role:"region","aria-label":h("createDrawer.fileDropZone"),"data-drag-over":T?"true":"false",onDragEnter:W,onDragLeave:G,onDragOver:_,onDrop:K,className:(0,s.cn)("rounded-md border-2 border-transparent transition-colors",T&&"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)(ej.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,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"}),C.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:C.map(e=>(0,t.jsx)(ev.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",{className:"text-destructive px-3 pb-2 text-xs",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)(E.Tooltip,{children:[(0,t.jsx)(E.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)(ef.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(E.TooltipContent,{side:"top",children:h("chat.attachFiles")})]}),(0,t.jsx)("div",{onMouseLeave:()=>P(!1),children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"submit",disabled:k,"data-testid":"drawer-action-submit",className:(0,s.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&&z&&!F?"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,s.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,s.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)(eg,{className:"h-4 w-4 shrink-0"}),"Reject"]}),(0,t.jsxs)("span",{className:(0,s.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,s.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&&!D&&"pointer-events-none opacity-0"),onMouseEnter:()=>P(!0),children:(0,t.jsx)(ex.ChevronLeft,{className:"h-4 w-4 text-white"})})]})}),f?null:(0,t.jsx)(E.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)(ep.Button,{type:"button",className:"flex-1",disabled:k,onClick:()=>{w.play(),n()},children:l})})]})}function ek({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,a.useState)(0),j=(0,R.useSoundAction)("select"),v=(0,R.useSoundAction)("navigate"),y=h.length,N=g===y-1,w=h[g],k=(0,a.useMemo)(()=>Object.keys(r).length,[r]),C=(0,a.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,a)=>(0,t.jsx)("button",{type:"button","aria-label":`Go to question ${a+1}`,className:(0,s.cn)("h-1.5 rounded-full transition-all duration-200",a===g?"bg-primary w-4":"w-1.5",a!==g&&r[e.id]?"bg-primary/50":"",a===g||r[e.id]?"":"bg-muted-foreground/25"),onClick:()=>{v.play(),b(a)}},e.id))})]}),(0,t.jsx)("div",{className:"space-y-2",children:w.options.map((e,a)=>{let n=r[w.id]===e.id,l=String.fromCharCode(65+a);return(0,t.jsx)("button",{type:"button",className:(0,s.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:()=>C(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)(eh.Badge,{className:"px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):(0,t.jsx)(eh.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)(ep.Button,{type:"button",variant:"ghost",size:"sm",disabled:0===g||o,onClick:()=>{v.play(),b(e=>e-1)},children:[(0,t.jsx)(ex.ChevronLeft,{className:"me-1 h-4 w-4"}),"Previous"]}),N?null:(0,t.jsxs)(ep.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)(em.ChevronRight,{className:"ms-1 h-4 w-4"})]})]})]}),(0,t.jsx)(ew,{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,s.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 eC=e.i(427);let eS=(0,_.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"}]]),eT={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:a})=>a?(0,t.jsx)("code",{className:`${a} 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:a})=>(0,t.jsx)("a",{href:a,className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e})};function eR({decision:e,index:s}){let[r,n]=(0,a.useState)(!1),l=(0,R.useSoundAction)("expand"),i=(0,R.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:s+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)(eh.Badge,{variant:"secondary",className:"bg-primary/10 text-primary shrink-0",children:e.decisionName}):null]}),e.rationale?(0,t.jsx)(eC.default,{components:eT,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)(em.ChevronRight,{className:`h-3.5 w-3.5 transition-transform ${r?"rotate-90":""}`}),(0,t.jsx)(es,{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 eM({data:e}){let{summary:a,decisions: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-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"}),a?(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:a}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,t.jsx)(eS,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Technical Decisions"})]}),s.map((e,a)=>(0,t.jsx)(eR,{decision:e,index:a},e.title))]})}var eI=e.i(41698);function eA({item:e,index:a}){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:a+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)(eh.Badge,{className:"shrink-0 px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):null]})]})]})})})}function eD({data:e}){let{questions: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-center gap-2",children:[(0,t.jsx)(eI.ClipboardList,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Product Decisions"})]}),a.map((e,a)=>(0,t.jsx)(eA,{item:e,index:a},e.question))]})}var eP=e.i(30702);let eE=(0,_.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 ez=e.i(48923),e$=e.i(49228);let eF=(0,_.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),eL=(0,_.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"}]]),eq=(0,_.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 eO=e.i(81181),eB=e.i(99105),eU=e.i(35e3),eH=e.i(30090),eH=eH,eV=e.i(17406);function eW({status:e}){switch(e){case eV.CiStatus.Success:return(0,t.jsxs)(eh.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)(eU.CheckCircle2,{className:"me-1 h-3.5 w-3.5"}),"Passing"]});case eV.CiStatus.Pending:return(0,t.jsxs)(eh.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 eV.CiStatus.Failure:return(0,t.jsxs)(eh.Badge,{className:"border-transparent bg-red-50 text-red-700 hover:bg-red-50",children:[(0,t.jsx)(eH.default,{className:"me-1 h-3.5 w-3.5"}),"Failing"]})}}var eG=e.i(12919);let e_=(0,_.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 eK=e.i(35749);let eZ={added:{icon:eG.FilePlus,label:"A",className:"text-green-600"},modified:{icon:eK.FileEdit,label:"M",className:"text-amber-600"},deleted:{icon:e_,label:"D",className:"text-red-600"},renamed:{icon:eK.FileEdit,label:"R",className:"text-blue-600"}};function eQ({status:e}){let a=eZ[e],r=a.icon;return(0,t.jsx)(r,{className:(0,s.cn)("h-3.5 w-3.5 shrink-0",a.className)})}function eJ({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,s.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,s.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 eX({file:e}){let[r,n]=(0,a.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)(em.ChevronRight,{className:(0,s.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform duration-150",r&&"rotate-90")}),(0,t.jsx)(eQ,{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)(eJ,{hunk:e},e.header))}):null]})}function eY({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)(q.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)(eX,{file:e},`${e.status}-${e.path}`))})]})}let e0={Screenshot:eL,Video:eq,TestOutput:q.FileText,TerminalRecording:F.Terminal},e1=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp"]),e2=new Set([".mp4",".webm",".mov"]);function e5({evidence:e}){var s,r;let n,[l,i]=(0,a.useState)(!0),o=e0[e.type]??eL,d=(n=(s=e.relativePath).lastIndexOf("."))>=0?s.slice(n).toLowerCase():"",c=(r=e.relativePath,`/api/evidence?path=${encodeURIComponent(r)}`),u="Screenshot"===e.type||e1.has(d),x="Video"===e.type||e2.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)(eB.ChevronDown,{className:"text-muted-foreground h-3 w-3 shrink-0"}):(0,t.jsx)(em.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)(eO.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)(e3,{url:c}):(0,t.jsx)("p",{className:"text-muted-foreground truncate font-mono text-[10px]",children:e.relativePath})}):null,null]})}function e3({url:e}){let[s,r]=(0,a.useState)(null),[n,l]=(0,a.useState)(!1);return n?s?(0,t.jsx)("pre",{className:"bg-muted/50 max-h-60 overflow-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:s}):(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 e4({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)(eL,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Evidence"}),(0,t.jsx)(eh.Badge,{variant:"secondary",className:"text-[10px]",children:e.length})]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(e5,{evidence:e},`${e.type}-${e.relativePath}`))})]})})}function e6({data:e,readOnly:a=!1,onApprove:s,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",[]):s;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:a?"Merge History":"Merge Review"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:a?"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)(e$.GitBranch,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)(eh.Badge,{variant:"secondary",className:"font-mono text-[11px]",children:x.source}),(0,t.jsx)(eF,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsx)(eh.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)(eP.ExternalLink,{className:"h-3.5 w-3.5"})]}),(0,t.jsx)(eh.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)(eh.Badge,{className:"border-transparent bg-orange-50 text-orange-700 hover:bg-orange-50",children:[(0,t.jsx)(eb.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)(eW,{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)(ez.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)(eE,{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)(eb.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)(e4,{evidence:p}):null,u&&u.length>0?(0,t.jsx)(eY,{fileDiffs:u}):null]}),!a&&(0,t.jsx)(ew,{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 e8=e.i(55016);let e9=(0,_.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"}]]),e7=(0,_.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 te=e.i(59311),tt=e.i(39200);let ta=(0,_.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 ts=e.i(60253),tr=e.i(2287),tn=e.i(28267),tl=e.i(80436);let ti=(0,_.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"}]]),to=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function td(e){let t=e.lastIndexOf(".");return t>=0&&to.has(e.slice(t).toLowerCase())}function tc(e){let t=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"",a=td(e)?`image/${t.slice(1).replace("jpg","jpeg")}`:"",s=new URLSearchParams({path:e,...a&&{mimeType:a}});return`/api/attachments/preview?${s.toString()}`}let tu=/(?:^|\s)@(\/[^\s]+)/g;function tx({text:e,attachmentPaths:a}){let s=function(e){let t=[],a=0;for(let s of e.matchAll(tu)){let r=s.index,n=r+(s[0].length-s[0].trimStart().length);n>a&&t.push({type:"text",value:e.slice(a,n)}),t.push({type:"attachment",path:s[1]}),a=r+s[0].length}return a<e.length&&t.push({type:"text",value:e.slice(a)}),t}(e),r=s.some(e=>"attachment"===e.type),n=a?.filter(Boolean)??[];return r||0!==n.length?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[s.map(e=>{if("text"===e.type){let a=e.value.trim();return a?(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:a},`text-${a.slice(0,40)}`):null}return(0,t.jsx)(tm,{path:e.path},`att-${e.path}`)}),n.map(e=>(0,t.jsx)(tm,{path:e},`extra-${e}`))]}):(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:e})}function tm({path:e}){let s=e.split("/").pop()??e,[r,n]=(0,a.useState)(!1);return td(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)(ti,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s})]}):(0,t.jsxs)(tr.Dialog,{children:[(0,t.jsx)(tr.DialogTrigger,{asChild:!0,children:(0,t.jsx)("img",{src:tc(e),alt:s,"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)(tr.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)(tn.VisuallyHidden.Root,{children:(0,t.jsxs)(tr.DialogTitle,{children:["Preview: ",s]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:tc(e),alt:s,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:s})}),(0,t.jsx)("a",{href:tc(e),download:s,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${s}`,children:(0,t.jsx)(tl.DownloadIcon,{className:"h-4 w-4"})})]})]})]}):(0,t.jsx)("a",{href:tc(e),download:s,"data-testid":"inline-attachment-file",className:"text-primary text-sm underline underline-offset-2",children:s})}e.i(81803);var tp=e.i(72714),th=e.i(86782),tf=e.i(29847);function tg(e){if(0===e)return"0s";let t=Math.floor(e/1e3);if(0===t)return"<1s";let a=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60;return a>0?`${a}h ${s}m`:s>0?`${s}m ${r}s`:`${r}s`}function tb({icon:e,title:a,children:s}){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"}),a]}),s]})}function tj({children:e,className:a}){return(0,t.jsx)("div",{className:(0,s.cn)("bg-muted/60 rounded-md border border-transparent p-3",a),children:e})}function tv({label:e,children:a}){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:a})]})}function ty({on:e,label:a}){return(0,t.jsxs)("span",{className:(0,s.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)(ts.X,{className:"size-3"}),a]})}let tN={[eV.PrStatus.Open]:"text-blue-600 dark:text-blue-400",[eV.PrStatus.Merged]:"text-purple-600 dark:text-purple-400",[eV.PrStatus.Closed]:"text-red-600 dark:text-red-400"};function tw({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,s]=(0,a.useState)(null),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>e?(s(tg(Math.max(0,Date.now()-e))),r.current=setInterval(()=>{s(tg(Math.max(0,Date.now()-e)))},1e3),()=>{r.current&&clearInterval(r.current)}):void s(null),[e]),t}("running"===e.state||"action-required"===e.state?e.startedAt:void 0),v=eo.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,s.cn)("h-full rounded-full transition-all",v.progressClass),style:{width:`${e.progress}%`}})})}):null,e.oneLiner||e.userQuery||y?(0,t.jsx)(tb,{icon:e7,title:"Description",children:(0,t.jsxs)(tj,{className:"flex flex-col gap-2",children:[e.oneLiner?(0,t.jsx)(tv,{label:"One-Liner",children:e.oneLiner}):null,e.userQuery?(0,t.jsx)(tv,{label:"Query",children:(0,t.jsx)(tx,{text:e.userQuery})}):null,y?(0,t.jsx)(tv,{label:"Summary",children:(0,t.jsx)("span",{className:"leading-snug",children:e.summary})}):null]})}):null,e.pr?(0,t.jsx)(tb,{icon:ez.GitCommitHorizontal,title:"Pull Request",children:(0,t.jsx)(tj,{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)(eP.ExternalLink,{className:"size-3"})]}),(0,t.jsx)("span",{className:(0,s.cn)("text-xs font-semibold",tN[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)(eb.AlertTriangle,{className:"size-3 shrink-0"})," Conflicts"]}):null,e.pr.ciStatus&&!0!==e.hideCiStatus?(0,t.jsx)(eW,{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)(tj,{children:(0,t.jsxs)(tv,{label:"Branch",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e$.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)(tj,{children:(0,t.jsx)(tv,{label:"Agent",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.agentType?(x=(0,th.getAgentTypeIcon)(e.agentType),(0,t.jsx)(x,{className:"size-3.5 shrink-0 opacity-50"})):null,e.agentType?(0,t.jsx)("span",{children:th.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,tf.getModelMeta)(e.modelId).displayName||e.modelId}):null]})})}):null,e.createdAt?(0,t.jsx)(tj,{children:(0,t.jsx)(tv,{label:"Created",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e8.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)(tj,{children:(0,t.jsx)(tv,{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)(ea.Zap,{className:"size-3.5"})," Fast"]})})}):null,e.runtime||j?(0,t.jsx)(tj,{children:(0,t.jsx)(tv,{label:e.runtime?"Runtime":"Elapsed",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e8.Clock,{className:"text-foreground/30 size-3 shrink-0"}),e.runtime??j]})})}):null]}),e.blockedBy||e.errorMessage?(0,t.jsx)(tb,{icon:eb.AlertTriangle,title:"Issues",children:(0,t.jsxs)(tj,{className:"border-destructive/20 bg-destructive/5",children:[e.blockedBy?(0,t.jsx)(tv,{label:"Blocked By",children:e.blockedBy}):null,e.errorMessage?(0,t.jsx)(tv,{label:"Error",children:(0,t.jsx)("span",{className:"text-destructive",children:e.errorMessage})}):null]})}):null,o&&e.branch&&i?(0,t.jsx)(tb,{icon:te.RefreshCw,title:"Branch Sync",children:(0,t.jsx)(tk,{syncStatus:r??null,syncLoading:n??!1,syncError:l??null,onRefreshSync:i,onRebaseOnMain:o,rebaseLoading:d??!1,rebaseError:c??null})}):null,(0,t.jsx)(tC,{data:e})]})}function tk({syncStatus:e,syncLoading:a,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)(tj,{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:a&&!e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu,{size:"sm"}),(0,t.jsx)("span",{className:"text-foreground/40",children:"Checking..."})]}):n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eb.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)(eu,{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)(eb.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)(eU.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:a,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)(te.RefreshCw,{className:(0,s.cn)("size-3",a&&"animate-spin")})}):null]}),u&&!o?(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(tp.ActionButton,{label:c("branchSyncStatus.rebaseOnMain"),onClick:i,loading:!1,error:!!d,icon:Y,variant:"outline",size:"sm"})}):null,d?(0,t.jsx)("p",{className:"text-destructive pt-1 text-[11px]",children:d}):null]})}function tC({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)(tb,{icon:tt.Settings,title:"Settings",children:(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[e.approvalGates?(0,t.jsxs)(tj,{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)(ta,{className:"size-3"})," Approve"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(ty,{on:e.approvalGates.allowPrd,label:"PRD"}),(0,t.jsx)(ty,{on:e.approvalGates.allowPlan,label:"Plan"}),(0,t.jsx)(ty,{on:e.approvalGates.allowMerge,label:"Merge"})]})]}):null,null!=e.enableEvidence?(0,t.jsxs)(tj,{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"})," Evidence"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(ty,{on:e.enableEvidence,label:"Collect"}),null!=e.commitEvidence?(0,t.jsx)(ty,{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)(tj,{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)(e$.GitBranch,{className:"size-3"})," Git"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[null!=e.push?(0,t.jsx)(ty,{on:e.push,label:"Push"}):null,null!=e.openPr?(0,t.jsx)(ty,{on:e.openPr,label:"PR"}):null,null!=e.ciWatchEnabled?(0,t.jsx)(ty,{on:e.ciWatchEnabled,label:"Watch"}):null,null!=e.commitSpecs?(0,t.jsx)(ty,{on:e.commitSpecs,label:"Specs"}):null,null!=e.forkAndPr?(0,t.jsx)(ty,{on:e.forkAndPr,label:"Fork"}):null]})]}):null]})})}let tS=(0,_.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 eH=eH,tT=e.i(94819),tR=e.i(58860);let tM=(0,_.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"}]]),tI=(0,_.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 tA(e,t){if(null!=e.durationMs&&e.durationMs>0)return e.durationMs;if(!e.completedAt&&e.startedAt){let a=new Date(e.startedAt).getTime();if(!Number.isNaN(a))return Math.max(0,t-a)}return 0}function tD(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tP(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 tE(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}let tz={analyze:"Analyzing",requirements:"Requirements",research:"Researching",plan:"Planning",implement:"Implementing",rebase:"Rebasing","fast-implement":"Fast Implement",evidence:"Evidence",validate:"Validating",repair:"Repairing",merge:"Merging"},t$={"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:et.RotateCcw},"run:completed":{label:"completed",colorClass:"text-emerald-600",bgClass:"bg-emerald-50 dark:bg-emerald-950/30",icon:eU.CheckCircle2},"run:failed":{label:"failed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eH.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:eH.default},"run:rejected":{label:"rejected",colorClass:"text-orange-600",bgClass:"bg-orange-50 dark:bg-orange-950/30",icon:tT.Ban}};function tF(e){return e.startsWith("run:")}function tL({timings:e,loading:s,error:n,rejectionFeedback:l}){let{t:o}=(0,r.useTranslation)("web"),d=function(e){let[t,s]=(0,a.useState)(Date.now),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>(e&&e.some(e=>!e.phase.startsWith("run:")&&!e.completedAt&&e.startedAt)&&(r.current=setInterval(()=>s(Date.now()),1e3)),()=>{r.current&&(clearInterval(r.current),r.current=null)}),[e]),t}(e);if(s)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)(V.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)(e8.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=>!tF(e.phase)),u=Math.max(...c.map(e=>tA(e,d)),...c.map(e=>e.approvalWaitMs??0),0),x=function(e,t){if(!e.length)return[];let a=e.filter(e=>"run:rejected"===e.phase).length,s=t?.length??0,r=e;if(s>a){r=[...e];let n=e[e.length-1].agentRunId;for(let e=a;e<s;e++){let s=t[e];e>a&&r.push({agentRunId:n,phase:"run:resumed",startedAt:s.timestamp??`synthetic-resumed-${e}`}),r.push({agentRunId:n,phase:"run:rejected",startedAt:s.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+tA(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)(tq,{iteration:e,showHeader:m,maxDurationMs:u,now:d},e.number))}),p>0?(0,t.jsx)(tH,{totalExecMs:p,totalWaitMs:h,totalInputTokens:f,totalOutputTokens:g,totalCostUsd:b}):null]})}function tq({iteration:e,showHeader:a,maxDurationMs:s,now:r}){let n=function(e){let t=[...e.timings].reverse().find(e=>tF(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:[a?(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((a,n)=>{if(tF(a.phase)){let s,r="run:rejected"===a.phase,l="run:failed"===a.phase||"run:crashed"===a.phase||"run:stopped"===a.phase;if(r)s=e.rejectionMessage;else if(l){let t=[...e.timings].reverse().find(e=>!tF(e.phase)&&e.errorMessage);s=t?.errorMessage??a.errorMessage}return(0,t.jsx)(tO,{timing:a,message:s,attachments:r?e.rejectionAttachments:void 0,isFirst:0===n,isLast:n===e.timings.length-1},`${a.agentRunId}-${a.phase}-${a.startedAt}`)}return(0,t.jsx)(tB,{timing:a,maxDurationMs:s,now:r},`${a.agentRunId}-${a.phase}-${a.startedAt}`)})]})]})}function tO({timing:e,message:a,attachments:s,isFirst:r,isLast:n}){let l,i=t$[e.phase];if(!i)return null;let o=s&&s.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:tP(String(e.startedAt))}):null]}),a?(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)(V.AlertCircle,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-400"}):(0,t.jsx)(ee.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:["— ",a]})]})):null,o?(0,t.jsx)("div",{"data-testid":"rejection-feedback-attachments",className:"ml-[26px]",children:(0,t.jsx)(tx,{text:"",attachmentPaths:s})}):null]})}function tB({timing:e,maxDurationMs:s,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=tz[i]??i,p=c?`Phase ${o.replace("phase-","")}`:null!==o?`${m} #${o}`:m,h=tA(e,n),f=!e.completedAt&&!!e.startedAt,g=f?15:2,b=s>0?Math.max(g,h/s*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,a.useState)(!1),w=(0,a.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:tg(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:tP(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)(ea.Zap,{className:"h-3 w-3 opacity-50"}),tD(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)(tS,{className:"h-3 w-3 opacity-50"}),tE(e.costUsd)]}):null]}),null!=e.approvalWaitMs&&e.approvalWaitMs>0?(0,t.jsx)(tU,{timing:e,maxDurationMs:s}):null]})}function tU({timing:e,maxDurationMs:a}){let s=e.approvalWaitMs??0,r=a>0?Math.max(2,s/a*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)(tR.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:tg(s)})]})}function tH({totalExecMs:e,totalWaitMs:a,totalInputTokens:s,totalOutputTokens:n,totalCostUsd:l}){let{t:i}=(0,r.useTranslation)("web"),o=s+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)(tV,{icon:e8.Clock,label:i("activityTab.execution"),value:tg(e)}),(0,t.jsx)(tV,{icon:tR.Timer,label:i("activityTab.wait"),value:a>0?tg(a):"n/a"}),(0,t.jsx)(tV,{icon:e8.Clock,label:"Wall-clock",value:a>0?tg(e+a):tg(e)}),(0,t.jsx)(tV,{icon:tS,label:i("activityTab.cost"),value:l>0?tE(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)(ea.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:tD(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)(tM,{className:"h-3 w-3 text-blue-500 opacity-60"}),tD(s)]}),(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tI,{className:"h-3 w-3 text-emerald-500 opacity-60"}),tD(n)]})]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-sm italic tabular-nums",children:"n/a"})]})]})]})}function tV({icon:e,label:a,value:s,className:r=""}){let n="n/a"===s;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"}),a]}),(0,t.jsx)("span",{className:`text-sm tabular-nums ${n?"text-muted-foreground/40 italic":""}`,children:s})]})}var tW=e.i(7311),tG=e.i(44229);let t_=(0,_.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"}]]),tK=(0,_.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"}]]),tZ=(0,_.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"}]]),tQ=/^\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]\s+(?:\[([^\]]+)\]\s+)?(?:\[([^\]|]+)(?:\|([^\]]+))?\]\s+)?(.*)$/,tJ=/^\[(tool-result|tool|text|delta|result|tokens|cmd|file|turn|thread|error|event|raw|WORKER)\]\s*(.*)/;function tX(e){let t=e.match(tQ);if(!t)return{timestamp:null,phase:null,agent:null,model:null,tag:"raw",message:e,raw:e};let[,a,s,r,n,l]=t,i=null,o=null,d=null,c=l??"";if(null!=r&&null!=s)if(s.includes("|")){let[e,t]=s.split("|");o=e,d=t??null,c=`[${r}] ${l??""}`}else i=s,o=r,d=n??null;else if(null!=s)if(s.includes("|")){let[e,t]=s.split("|");o=e,d=t??null}else i=s;let u=c.match(tJ),x="info";return u&&(x=u[1].toLowerCase(),c=u[2]),{timestamp:a??null,phase:i,agent:o,model:d,tag:x,message:c.trim(),raw:e}}function tY({content:e}){let s=(0,a.useMemo)(()=>e?e.split("\n").filter(e=>e.trim().length>0).map(tX):[],[e]);return 0===s.length?null:(0,t.jsx)("div",{className:"flex flex-col",children:s.map((e,a)=>(0,t.jsx)(t0,{line:e},a))})}function t0({line:e}){switch(e.tag){case"tool":return(0,t.jsx)(t5,{line:e});case"tool-result":return(0,t.jsx)(t7,{line:e});case"text":case"delta":return(0,t.jsx)(t4,{line:e});case"result":return(0,t.jsx)(t6,{line:e});case"tokens":case"turn":return(0,t.jsx)(t8,{line:e});case"cmd":return(0,t.jsx)(ae,{line:e});case"file":return(0,t.jsx)(at,{line:e});case"thread":case"event":case"info":return(0,t.jsx)(as,{line:e});case"error":return(0,t.jsx)(aa,{line:e});case"worker":return(0,t.jsx)(t9,{line:e});default:return(0,t.jsx)(ar,{line:e})}}function t1({value:e}){if(!e)return null;let a=e.replace(/^.*T/,"").replace("Z",""),s=a.split(":"),r=s.length>=3?`${s[1]}:${s[2].split(".")[0]}`:a;return(0,t.jsx)("span",{className:"text-muted-foreground/60 w-11 shrink-0 font-mono text-[10px]",children:r})}function t2({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 t5({line:e}){var a;let s,{toolName:r,args:n}=-1===(s=(a=e.message).indexOf(" "))?{toolName:a,args:""}:{toolName:a.slice(0,s),args:a.slice(s+1)},l=function(e,t){try{let a=JSON.parse(t);if("Read"===e&&a.file_path||"Write"===e&&a.file_path||"Edit"===e&&a.file_path)return a.file_path;if("Glob"===e&&a.pattern||"Grep"===e&&a.pattern)return a.pattern;if("Bash"===e&&a.command)return a.command;if("Task"===e&&a.description)return a.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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t3,{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 t3({toolName:e}){let a=e.toLowerCase();return"bash"===a?(0,t.jsx)(F.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"read"===a||"glob"===a||"grep"===a?(0,t.jsx)(q.FileText,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"write"===a||"edit"===a?(0,t.jsx)(tZ,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):(0,t.jsx)(F.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"})}function t4({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(ee.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 t6({line:e}){var a;let s,r,{chars:n}=(s=(a=e.message).match(/^(\d+)\s+chars/),r=a.match(/session=(\S+)/),{chars:s?parseInt(s[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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eU.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 t8({line:e}){let a,{inputTokens:s,outputTokens:r}=(a=e.message.match(/^(\d+)\s+in\s*\/\s*(\d+)\s+out/))?{inputTokens:parseInt(a[1],10),outputTokens:parseInt(a[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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t_,{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:s.toLocaleString()})," in / ",(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:r.toLocaleString()})," out"]})]})]})}function t9({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tK,{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 t7({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eF,{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 ae({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{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 at({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tZ,{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 aa({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(V.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 as({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs break-all",children:e.message})]})}function ar({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 an({content:e,isConnected:s,error:n}){let{t:l}=(0,r.useTranslation)("web"),i=(0,a.useRef)(null),[o,d]=(0,a.useState)(!0),[c,u]=(0,a.useState)("structured"),x=(0,a.useCallback)(()=>{let e=i.current;e&&d(e.scrollHeight-e.scrollTop-e.clientHeight<40)},[]),m=(0,a.useCallback)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight,d(!0))},[]);return((0,a.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)(V.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 ${s?"bg-emerald-500":"bg-zinc-400"}`}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:s?"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)(q.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)(tG.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)(tW.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)(tY,{content:e}):e})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(F.Terminal,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:l("logTab.noLogOutput")}),s?(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Waiting for log data..."}):null]})}let al=(0,_.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 ai=e.i(95812),ao=e.i(87889);let ad=(0,_.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"}]]),ac={Todo:{icon:ai.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:ao.Eye,colorClass:"text-amber-600",borderClass:"border-amber-200",label:"Review"}},au={icon:ai.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Unknown"};function ax({tasks:e}){let{t:a}=(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:a("taskProgress.noTasksDefined")})}):(0,t.jsxs)("div",{"data-testid":"task-progress-view",className:"flex flex-col gap-3",children:[(0,t.jsx)(am,{tasks:e}),(0,t.jsx)("div",{"data-testid":"task-progress-list",className:"flex flex-col gap-2",children:e.map((e,a)=>(0,t.jsx)(ah,{task:e,index:a},e.title||`task-${a}`))})]})}function am({tasks:e}){let{t:s}=(0,r.useTranslation)("web"),n=(0,a.useMemo)(()=>{let t=e.filter(e=>"Done"===e.state).length,a=e.filter(e=>"Work in Progress"===e.state).length,s=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:a,review:s,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)(ap,{icon:x.Check,label:s("taskProgress.done"),count:n.done,className:"text-emerald-600"}):null,n.wip>0?(0,t.jsx)(ap,{icon:i.Loader2,label:s("taskProgress.inProgress"),count:n.wip,className:"text-blue-600"}):null,n.review>0?(0,t.jsx)(ap,{icon:ao.Eye,label:s("taskProgress.review"),count:n.review,className:"text-amber-600"}):null,n.todo>0?(0,t.jsx)(ap,{icon:ai.Circle,label:s("taskProgress.todo"),count:n.todo,className:"text-muted-foreground"}):null]})]})}function ap({icon:e,label:a,count:r,className:n}){return(0,t.jsxs)("span",{className:(0,s.cn)("flex items-center gap-1 text-xs",n),children:[(0,t.jsx)(e,{className:"h-3 w-3"}),r," ",a]})}function ah({task:e,index:r}){let[n,l]=(0,a.useState)(!1),i=ac[e.state]??au,o=i.icon,d=e.actionItems.length>0,c=(0,a.useCallback)(()=>{d&&l(e=>!e)},[d]);return(0,t.jsxs)("div",{"data-testid":`task-card-${r}`,className:(0,s.cn)("rounded-lg border",i.borderClass),children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!d,className:(0,s.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,s.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,s.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)(em.ChevronRight,{className:(0,s.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,a)=>(0,t.jsx)(af,{item:e},e.name||`ai-${a}`))})}):null]})}function af({item:e}){let a=e.acceptanceCriteria.length,s=e.acceptanceCriteria.filter(e=>e.verified).length,r=a>0&&s===a;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)(eU.CheckCircle2,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,t.jsx)(ad,{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]}),a>0?(0,t.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[s,"/",a]}):null]}),a>0?(0,t.jsx)("div",{className:"ms-5.5 flex flex-col gap-1",children:e.acceptanceCriteria.map((e,a)=>(0,t.jsx)(ag,{criterion:e},e.description||`ac-${a}`))}):null]})}function ag({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)(ai.Circle,{className:"text-muted-foreground mt-0.5 h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:(0,s.cn)("text-[11px]",e.verified?"text-muted-foreground line-through":"text-foreground"),children:e.description})]})}let ab={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 aj({plan:e,loading:a,error:s}){return a?(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"})}):s?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(V.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:s})]}):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)(eh.Badge,{className:ab[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)(ax,{tasks:e.tasks})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(al,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"No plan created yet"})]})}let av=(0,_.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var ay=e.i(25235),aN=e.i(71326);function aw({data:e,onSubmitFeedback:s,onPromote:r,onDiscard:n,isSubmitting:l=!1}){let[d,c]=(0,a.useState)(""),[u,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(!1),h=(0,a.useCallback)(async()=>{d.trim()&&s&&(await s(d.trim()),c(""))},[d,s]),f=(0,a.useCallback)(async e=>{p(!1),await r?.(e)},[r]),g=(0,a.useCallback)(async()=>{x(!1),await n?.()},[n]),b="action-required"===e.state&&"exploring"===e.lifecycle,j="running"===e.state&&"exploring"===e.lifecycle;return(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4","data-testid":"prototype-tab",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(er.FlaskConical,{className:"h-4 w-4 text-amber-500"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Exploration Prototype"}),(e.iterationCount??0)>0&&(0,t.jsxs)(eh.Badge,{variant:"secondary","data-testid":"prototype-iteration-badge",children:["Iteration ",e.iterationCount]}),j?(0,t.jsxs)(eh.Badge,{variant:"outline",className:"text-teal-600 dark:text-teal-400",children:[(0,t.jsx)(i.Loader2,{className:"mr-1 h-3 w-3 animate-spin"}),"Generating..."]}):null,b?(0,t.jsx)(eh.Badge,{variant:"outline",className:"text-amber-600 dark:text-amber-400",children:"Awaiting feedback"}):null]}),(0,t.jsx)(ay.Separator,{}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{htmlFor:"prototype-feedback",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"Feedback"}),(0,t.jsx)(ej.Textarea,{id:"prototype-feedback",placeholder:b?"Describe what to change in the next iteration...":"Feedback can be submitted when the prototype is ready for review.",value:d,onChange:e=>c(e.target.value),disabled:!b||l,className:"min-h-24 resize-none","data-testid":"prototype-feedback-input"}),(0,t.jsxs)(ep.Button,{onClick:h,disabled:!d.trim()||!b||l,size:"sm",className:"self-end","data-testid":"prototype-submit-feedback",children:[l?(0,t.jsx)(i.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(eg,{className:"mr-1 h-3.5 w-3.5"}),"Send Feedback"]})]}),(0,t.jsx)(ay.Separator,{}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(ep.Button,{variant:"default",size:"sm",onClick:()=>p(!0),disabled:!b||l,"data-testid":"prototype-promote-button",children:[(0,t.jsx)(av,{className:"mr-1 h-3.5 w-3.5"}),"Promote to Feature"]}),(0,t.jsxs)(ep.Button,{variant:"outline",size:"sm",onClick:()=>x(!0),disabled:l,className:"text-destructive hover:text-destructive","data-testid":"prototype-discard-button",children:[(0,t.jsx)(o.Trash2,{className:"mr-1 h-3.5 w-3.5"}),"Discard"]})]}),(0,t.jsx)(aN.AlertDialog,{open:m,onOpenChange:p,children:(0,t.jsxs)(aN.AlertDialogContent,{children:[(0,t.jsxs)(aN.AlertDialogHeader,{children:[(0,t.jsx)(aN.AlertDialogTitle,{children:"Promote to Feature"}),(0,t.jsx)(aN.AlertDialogDescription,{children:"Choose the mode for the promoted feature. The prototype code will be preserved as the starting point."})]}),(0,t.jsxs)(aN.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row",children:[(0,t.jsx)(aN.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(aN.AlertDialogAction,{onClick:()=>f(eV.FeatureMode.Fast),"data-testid":"promote-fast",children:"Fast (Direct Implementation)"}),(0,t.jsx)(aN.AlertDialogAction,{onClick:()=>f(eV.FeatureMode.Regular),"data-testid":"promote-regular",children:"Regular (Full SDLC)"})]})]})}),(0,t.jsx)(aN.AlertDialog,{open:u,onOpenChange:x,children:(0,t.jsxs)(aN.AlertDialogContent,{children:[(0,t.jsxs)(aN.AlertDialogHeader,{children:[(0,t.jsx)(aN.AlertDialogTitle,{children:"Discard Exploration?"}),(0,t.jsx)(aN.AlertDialogDescription,{children:"This will delete the exploration feature, its worktree, and all prototype code. This action cannot be undone."})]}),(0,t.jsxs)(aN.AlertDialogFooter,{children:[(0,t.jsx)(aN.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(aN.AlertDialogAction,{onClick:g,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90","data-testid":"discard-confirm",children:"Discard"})]})]})})]})}var ak=e.i(28112);function aC(){return{data:null,loading:!1,error:null}}let aS=[{key:"overview",label:"Overview",icon:W.LayoutDashboard},{key:"prototype",label:"Prototype",icon:er.FlaskConical},{key:"activity",label:"Activity",icon:G.Activity},{key:"log",label:"Log",icon:K},{key:"plan",label:"Plan",icon:Z},{key:"prd-review",label:"PRD Review",icon:Q},{key:"tech-decisions",label:"Tech Decisions",icon:J.Cpu},{key:"product-decisions",label:"Product",icon:X.Package},{key:"merge-review",label:"Merge Review",icon:Y},{key:"chat",label:"Chat",icon:ee.MessageSquare}],aT={activity:async function(e){let t=await el(e);if("error"in t)throw Error(t.error);return{timings:t.timings,rejectionFeedback:t.rejectionFeedback}},plan:async function(e){let t=await ei(e);if("error"in t)throw Error(t.error);return t.plan}};function aR({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:S,isMergeLoading:T,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:D,rebaseLoading:P,rebaseError:z,isRejecting:$,chatInput:F,onChatInputChange:L,sseEvents:q,onSubmitFeedback:O,onPromote:B,onDiscardExploration:U,isPrototypeSubmitting:H,interactiveAgentEnabled:W=!0,onRetry:G,onStop:_,onStart:K}){let Z,Q=(0,n.usePathname)(),J=(0,a.useMemo)(()=>(function(e,t=!0){let a=["overview"];return"exploring"===e.lifecycle?(a.push("prototype","activity"),e.hasAgentRun&&a.push("log")):(a.push("activity"),e.hasAgentRun&&a.push("log"),e.hasPlan&&a.push("plan"),"requirements"===e.lifecycle&&"action-required"===e.state&&a.push("prd-review"),"implementation"===e.lifecycle&&"action-required"===e.state&&a.push("tech-decisions","product-decisions"),"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)&&a.push("merge-review"),"maintain"===e.lifecycle&&e.pr&&a.push("merge-review")),t&&a.push("chat"),a})(l,W),[l,W]),X=(0,a.useMemo)(()=>aS.filter(e=>J.includes(e.key)).map(e=>"merge-review"===e.key&&"maintain"===l.lifecycle?{...e,label:"Merge History"}:e),[J,l.lifecycle]),Y=(0,a.useMemo)(()=>{let e=Q.match(/^(\/feature\/[^/]+)/);return e?e[1]:Q},[Q]),ee=(0,a.useMemo)(()=>x&&J.includes(x)?x:u&&J.includes(u)?u:"overview",[]),[er,el]=(0,a.useState)(ee),ei=function(e){let[t,s]=(0,a.useState)(""),[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(null),o=(0,a.useRef)(null),d=(0,a.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),n(!1)},[]);return(0,a.useEffect)(()=>{if(!e){s(""),n(!1),i(null);return}s(""),i(null);let t=new EventSource(`/api/feature-logs?featureId=${e}`);return o.current=t,t.onopen=()=>{n(!0)},t.addEventListener("initial",e=>{s(JSON.parse(e.data).content)}),t.addEventListener("log",e=>{let t=JSON.parse(e.data);s(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"===er?o:null),{tabs:ed,fetchTab:ec,refreshTab:ex}=function(e,t){let s=Object.keys(t),[r,n]=(0,a.useState)(()=>{let e={};for(let t of s)e[t]=aC();return e}),l=(0,a.useRef)(t);l.current=t;let i=(0,a.useRef)(e);i.current=e;let o=(0,a.useRef)(!0);(0,a.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);let d=(0,a.useRef)(e);(0,a.useEffect)(()=>{d.current!==e&&(d.current=e,n(e=>{let t={};for(let a of Object.keys(e))t[a]=aC();return t}))},[e]);let c=(0,a.useCallback)(async e=>{let t=l.current[e],a=i.current;if(t){o.current&&n(t=>t[e]?.data!==null?t:{...t,[e]:{...t[e],loading:!0,error:null}});try{let s=await t(a);o.current&&n(t=>({...t,[e]:{data:s,loading:!1,error:null}}))}catch(t){o.current&&n(a=>{let s=t instanceof Error?t.message:"Failed to fetch tab data",r=a[e]?.data??null;return{...a,[e]:{data:r,loading:!1,error:r?null:s}}})}}},[]),u=(0,a.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,a.useCallback)(async e=>{await c(e)},[c])}}(o,aT),em=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!em.current)return;em.current=!1;let e="overview"===er?Y:`${Y}/${er}`;e!==Q&&window.history.pushState(null,"",e)},[er,Y,Q]);let ep=(0,a.useRef)(Q);(0,a.useEffect)(()=>{if(ep.current===Q||(ep.current=Q,em.current))return;let e=Q.split("/"),t=e.length>=4?e[3]:void 0,a=t&&J.includes(t)?t:"overview";a!==er&&(el(a),("activity"===a||"plan"===a)&&ec(a))},[Q]);let eh=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!eh.current&&(eh.current=!0,!x&&"overview"!==ee)){let e=`${Y}/${ee}`;e!==Q&&window.history.replaceState(null,"",e)}},[]);let ef=(0,a.useRef)(!1);(0,a.useEffect)(()=>{ef.current||(ef.current=!0,("activity"===er||"plan"===er)&&ec(er))},[er,ec]);let eg=(0,a.useRef)(o);(0,a.useEffect)(()=>{eg.current!==o&&(eg.current=o,el("overview"))},[o]);let eb=(0,a.useRef)(u);(0,a.useEffect)(()=>{if(eb.current!==u&&u&&J.includes(u)){eb.current=u,el(u),("activity"===u||"plan"===u)&&ec(u);let e="overview"===u?Y:`${Y}/${u}`;e!==window.location.pathname&&window.history.replaceState(null,"",e)}},[u,J,Y,ec]),(0,a.useEffect)(()=>{J.includes(er)||(el("overview"),window.location.pathname!==Y&&window.history.replaceState(null,"",Y))},[J,er,Y]);let ej=(0,a.useRef)(er);ej.current=er;let ev=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(!q||0===q.length||(ev.current>q.length&&(ev.current=0),q.length<=ev.current))return;let e=q.slice(ev.current);if(ev.current=q.length,!e.some(e=>e.featureId===o))return;ex("activity");let t=ej.current;"plan"===t&&ex(t)},[q,o,ex]);let ey="running"===l.state||"creating"===l.state;(0,a.useEffect)(()=>{if(!ey)return;let e=setInterval(()=>{ex("activity")},5e3);return()=>clearInterval(e)},[ey,ex]);let eN=(0,a.useCallback)(e=>{em.current=!0,el(e),("activity"===e||"plan"===e)&&ec(e)},[ec]);return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsxs)(en.Tabs,{value:er,onValueChange:eN,className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(en.TabsList,{className:"bg-muted/50 h-auto w-full shrink-0 justify-start gap-0 rounded-none border-b p-0",children:X.map(e=>{let a=e.icon;return(0,t.jsxs)(en.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)(a,{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)(ea.Zap,{className:"size-4 shrink-0 text-amber-500"}):(0,t.jsx)(es,{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)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.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,s.cn)("flex items-center gap-1.5 self-stretch px-3",eo.featureNodeStateConfig[l.state].labelClass),children:["running"===l.state?(0,t.jsx)(eu,{size:"sm",className:"shrink-0"}):(Z=eo.featureNodeStateConfig[l.state].icon,(0,t.jsx)(Z,{className:"size-3.5 shrink-0"})),eo.featureNodeStateConfig[l.state].label]}),"pending"===l.state&&K?(0,t.jsxs)("button",{type:"button",onClick:()=>K(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&&G?(0,t.jsxs)("button",{type:"button",onClick:()=>G(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)(et.RotateCcw,{className:"size-3.5"})," Retry"]}):"running"===l.state&&_?(0,t.jsxs)("button",{type:"button",onClick:()=>_(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)(E.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)(en.TabsContent,{value:"overview",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tw,{data:l,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:D,rebaseLoading:P,rebaseError:z})}),J.includes("prototype")?(0,t.jsx)(en.TabsContent,{value:"prototype",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(aw,{data:l,onSubmitFeedback:O,onPromote:B,onDiscard:U,isSubmitting:H})}):null,(0,t.jsx)(en.TabsContent,{value:"activity",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tL,{timings:ed.activity.data?.timings??null,loading:ed.activity.loading,error:ed.activity.error,rejectionFeedback:ed.activity.data?.rejectionFeedback})}),(0,t.jsx)(en.TabsContent,{value:"log",className:"mt-0 flex-1 overflow-hidden",children:(0,t.jsx)(an,{content:ei.content,isConnected:ei.isConnected,error:ei.error})}),(0,t.jsx)(en.TabsContent,{value:"plan",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(aj,{plan:ed.plan.data,loading:ed.plan.loading,error:ed.plan.error})}),J.includes("prd-review")?(0,t.jsx)(en.TabsContent,{value:"prd-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:m?(0,t.jsx)(ek,{data:m,selections:p??{},onSelect:h??(()=>void 0),onApprove:f??(()=>void 0),onReject:g,isProcessing:b,isRejecting:$,chatInput:F,onChatInputChange:L}):(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,J.includes("tech-decisions")?(0,t.jsx)(en.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)(eM,{data:j})}),(0,t.jsx)(aM,{onApprove:v??(()=>void 0),onReject:y,isProcessing:N,isRejecting:$,chatInput:F,onChatInputChange:L})]}):(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,J.includes("product-decisions")?(0,t.jsx)(en.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)(eD,{data:w}):(0,t.jsx)("p",{className:"text-muted-foreground p-4 text-center text-sm",children:"No product decisions available."})}):null,J.includes("merge-review")?(0,t.jsx)(en.TabsContent,{value:"merge-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:k?(0,t.jsx)(e6,{data:k,readOnly:"maintain"===l.lifecycle,onApprove:C??(()=>void 0),onReject:S,isProcessing:T,isRejecting:$,chatInput:F,onChatInputChange:L}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:T?(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)(V.AlertCircle,{className:"h-6 w-6"}),(0,t.jsx)("span",{children:"Merge review data unavailable"})]})})}):null,J.includes("chat")?(0,t.jsx)(en.TabsContent,{value:"chat",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(ak.ChatTab,{featureId:o,worktreePath:l.worktreePath})}):null]})})}function aM({onApprove:e,onReject:a,isProcessing:s,isRejecting:n,chatInput:l,onChatInputChange:i}){let{t:o}=(0,r.useTranslation)("web");return(0,t.jsx)(ew,{onReject:a,onApprove:e,approveLabel:o("featureDrawer.approvePlan"),revisionPlaceholder:"Ask AI to revise the plan...",isProcessing:s,isRejecting:n,chatInput:l,onChatInputChange:i})}var aI=e.i(37367),aA=e.i(96430),aD=e.i(29060);let aP=(0,h.createServerReference)("40920293cf25cd03169051993964629df458f5857d",h.callServer,void 0,h.findSourceMapURL,"rebaseFeature");var aE=e.i(99045);function az(e){return"exploring"===e.lifecycle?"prototype":"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 a$(e,t,s,r,n,i){let[o,d]=(0,a.useState)(!1),c=(0,a.useRef)(s),u=(0,a.useRef)(r);return c.current=s,u.current=r,(0,a.useEffect)(()=>{if(u.current(),!e)return;let a=!1;return d(!0),t(e).then(e=>{a||c.current(e)}).catch(()=>{!a&&n&&l.toast.error(n)}).finally(()=>{a||d(!1)}),()=>{a=!0}},[e,t,n,i]),o}let aF=(0,h.createServerReference)("40764d89e2a63ac6bd9d1195099539282567e549de",h.callServer,void 0,h.findSourceMapURL,"getFeatureDrawerData"),aL=(0,h.createServerReference)("40b1619673c5e788e48c8d12f207291eb668c78574",h.callServer,void 0,h.findSourceMapURL,"getBranchSyncStatus"),aq=new Map;function aO({view:e,urlTab:h,interactiveAgentEnabled:$=!0}){var F;let L,q,O,B,U,V,W=(0,T.useFeatureFlags)(),{t:G}=(0,r.useTranslation)("web"),_=(0,n.useRouter)(),K=(0,R.useSoundAction)("reject"),[Z,Q]=(0,a.useState)(e);(0,a.useEffect)(()=>{Q(t=>"feature"===t.type&&"feature"===e.type&&t.node.featureId===e.node.featureId?{...e,node:{...t.node,...e.node}}:e)},[e]);let J="feature"===Z.type?Z.node:null,{events:X}=(0,A.useAgentEventsContext)(),Y=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(Y.current>X.length&&(Y.current=0),!J||X.length<=Y.current)return;let e=X.slice(Y.current);for(let t of(Y.current=X.length,(0,aE.resolveSseEventUpdates)(e)))t.featureId===J.featureId&&"deleting"!==J.state&&(void 0!==t.state||void 0!==t.lifecycle)&&Q(e=>{if("feature"!==e.type)return e;let a={...e.node,...void 0!==t.state&&{state:t.state},...void 0!==t.lifecycle&&{lifecycle:t.lifecycle}};return{...e,node:a,initialTab:az(a)}})},[X,J]);let ee=(0,n.usePathname)().startsWith("/feature/");F=J?.featureId??null,L=(0,a.useRef)(ee),q=(0,a.useRef)(!1),O=(0,a.useRef)(0),B=(0,a.useCallback)(async()=>{if(!F||q.current)return;q.current=!0;let e=O.current;try{let t=await aF(F);if(!t||e!==O.current)return;Q(e=>(function(e,t){if("feature"!==e.type)return e;let a={...e.node,...t},s=a.state!==e.node.state||a.lifecycle!==e.node.lifecycle;return{...e,node:a,initialTab:s?az(a):e.initialTab}})(e,t))}catch{}finally{q.current=!1}},[F,Q]),U=(0,a.useRef)(!1),(0,a.useEffect)(()=>{!ee||L.current&&U.current||(U.current=!0,O.current+=1,q.current=!1,B()),L.current=ee},[ee,B]),(0,a.useEffect)(()=>{if(!ee||!F)return;let e=setInterval(()=>{B()},15e3);return()=>clearInterval(e)},[ee,F,B]);let et=(0,a.useCallback)(()=>{_.push("/")},[_]),[ea,es]=(0,a.useState)(""),[er,en]=(0,a.useState)(null),[el,ei]=(0,a.useState)({}),[eo,ed]=(0,a.useState)({}),[ec,eu]=(0,a.useState)(null),[ex,em]=(0,a.useState)(void 0),[ep,eh]=(0,a.useState)(null),[ef,eg]=(0,a.useState)(!1),[eb,ej]=(0,a.useState)(!1),[ev,ey]=(0,a.useState)(!1),eN=`${J?.featureId}:${J?.state}`,ew=(0,a.useRef)(eN);(0,a.useEffect)(()=>{eN!==ew.current&&(ew.current=eN,ey(!1))},[eN]);let[ek,eC]=(0,a.useState)(!1),[eS,eT]=(0,a.useState)(!1),eR=(0,a.useRef)(!1),eM="feature"===Z.type?Z.initialTab:void 0;(0,a.useEffect)(()=>{es("")},[eM]);let eI=(0,a.useRef)(0),eA=(0,a.useRef)(J?.state),eD=(0,a.useRef)(J?.lifecycle);(J?.state!==eA.current||J?.lifecycle!==eD.current)&&(eA.current=J?.state,eD.current=J?.lifecycle,eI.current+=1);let eP=eI.current,eE=a$(J?.lifecycle==="requirements"&&J?.state==="action-required"?J.featureId:null,k,e=>{if(e.error)return void l.toast.error(e.error);if(e.questionnaire){en(e.questionnaire);let t={};for(let a of e.questionnaire.questions){let e=a.options.find(e=>e.recommended);e&&(t[a.id]=e.id)}ei(t),ed(t)}},()=>{ei({}),ed({}),en(null)},"Failed to load questionnaire",eP),ez=J?.lifecycle==="implementation"&&J?.state==="action-required"?J.featureId:null,e$=a$(ez,C,e=>{e.error?l.toast.error(e.error):e.techDecisions&&eu(e.techDecisions)},()=>eu(null),"Failed to load tech decisions",eP),eF=a$(ez,k,e=>{e.productDecisions&&em(e.productDecisions)},()=>em(void 0),void 0,eP),eL=a$(J?.lifecycle==="review"&&(J?.state==="action-required"||J?.state==="error")||J?.lifecycle==="maintain"&&J?.pr?J.featureId:null,S,e=>{"error"in e?l.toast.error(e.error):eh(e)},()=>eh(null),"Failed to load merge review data",eP),eq=ea.trim().length>0,eO=J?.lifecycle==="requirements"&&J?.state==="action-required"&&Object.keys(eo).some(e=>eo[e]!==el[e]),eB=(0,a.useCallback)(()=>{es(""),ei({...eo})},[eo]),{attemptClose:eU}=(0,M.useGuardedDrawerClose)({open:ee,isDirty:eq||eO,onClose:et,onReset:eB}),eH=(0,a.useCallback)(async(e,t,a=[],s)=>{if(J?.featureId){eR.current=!0,eT(!0);try{let r=a.map(e=>e.path).filter(Boolean),n=a.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(20314),a=e.i(79054),s=e.i(31777);e.i(41001);var r=e.i(64780),n=e.i(31406),l=e.i(60112),i=e.i(83428),o=e.i(67669),d=e.i(24042),c=e.i(6910),u=e.i(33548),x=e.i(23925),m=e.i(37260),p=e.i(83299),h=e.i(21023);let f=(0,h.createServerReference)("608b6edc1e3cc74fd386b9de6ea20600a5a5ffb7e2",h.callServer,void 0,h.findSourceMapURL,"approveFeature");var g=e.i(78239),b=e.i(9781),j=e.i(41908);let v=(0,h.createServerReference)("70f87243bbc6411a7b1539f5e813b274f28d8a2518",h.callServer,void 0,h.findSourceMapURL,"rejectFeature"),y=(0,h.createServerReference)("6009d895ed634f0ece4b68c5b6025290be30267a6f",h.callServer,void 0,h.findSourceMapURL,"submitExplorationFeedback"),N=(0,h.createServerReference)("60852ad8209aff830802d7c2d6f2891fb0a45ae009",h.callServer,void 0,h.findSourceMapURL,"promoteExploration"),w=(0,h.createServerReference)("40c3feca05738117eabb9c65adb6b7db5f7046b01d",h.callServer,void 0,h.findSourceMapURL,"discardExploration"),k=(0,h.createServerReference)("40be42ce8be0aa1050aa512babe777629700a7a17b",h.callServer,void 0,h.findSourceMapURL,"getFeatureArtifact"),C=(0,h.createServerReference)("401cf5fd9b9343cbc32ef851d3049971076bd05e62",h.callServer,void 0,h.findSourceMapURL,"getResearchArtifact"),S=(0,h.createServerReference)("40a89668caee182f376b00c9c5e193e6dbe42da8d6",h.callServer,void 0,h.findSourceMapURL,"getMergeReviewData");var T=e.i(75921),R=e.i(8361),M=e.i(30153),I=e.i(8537),A=e.i(39443);e.i(1650);var D=e.i(11495);e.i(99348);var P=e.i(5259),E=e.i(2828);e.i(31566);var z=e.i(65104),$=e.i(8986),F=e.i(38573),L=e.i(19933),q=e.i(70471),O=e.i(51251);let B="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40";function U({loading:e,error:a,icon:s}){return e?(0,t.jsx)(i.Loader2,{className:"size-3.5 animate-spin"}):a?(0,t.jsx)(O.CircleAlert,{className:"text-destructive size-3.5"}):(0,t.jsx)(s,{className:"size-4"})}function H({actions:e,repositoryPath:s,worktreePath:r,showSpecs:n}){let[l,i]=(0,a.useState)(!1);return(0,t.jsx)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openInIde,disabled:e.ideLoading,"aria-label":"Open in IDE",children:(0,t.jsx)(U,{loading:e.ideLoading,error:e.ideError,icon:$.Code2})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open in IDE"})]}),(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openInShell,disabled:e.shellLoading,"aria-label":"Open terminal",children:(0,t.jsx)(U,{loading:e.shellLoading,error:e.shellError,icon:F.Terminal})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open terminal"})]}),(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openFolder,disabled:e.folderLoading,"aria-label":"Open folder",children:(0,t.jsx)(U,{loading:e.folderLoading,error:e.folderError,icon:L.FolderOpen})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open folder"})]}),n?(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:e.openSpecsFolder,disabled:e.specsLoading,"aria-label":"Open specs",children:(0,t.jsx)(U,{loading:e.specsLoading,error:e.specsError,icon:q.FileText})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:"Open specs"})]}):null,(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:B,onClick:()=>{navigator.clipboard.writeText(r??s),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)(E.TooltipContent,{side:"bottom",className:"text-xs",children:l?"Copied!":"Copy path"})]})]})})}var V=e.i(79687),W=e.i(16489),G=e.i(74294),_=e.i(3645);let K=(0,_.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"}]]),Z=(0,_.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"}]]),Q=(0,_.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 J=e.i(18532),X=e.i(93192);let Y=(0,_.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 ee=e.i(48109),et=e.i(38227),ea=e.i(53360);let es=(0,_.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 er=e.i(52443),en=e.i(68304);let el=(0,h.createServerReference)("40e4899a4ca838d7256dc12e17a5c440957d83ab49",h.callServer,void 0,h.findSourceMapURL,"getFeaturePhaseTimings"),ei=(0,h.createServerReference)("4057d2f7b2ab571df552315624186543172a765d46",h.callServer,void 0,h.findSourceMapURL,"getFeaturePlan");e.i(47506);var eo=e.i(2929);let ed=(0,e.i(94237).cva)("inline-block shrink-0",{variants:{size:{sm:"size-5",md:"size-8",lg:"size-12"}},defaultVariants:{size:"md"}}),ec=[{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 eu({className:e,size:a="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,s.cn)(ed({size:a}),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"}),ec.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 ex=e.i(11345),em=e.i(76016),ep=e.i(35364),eh=e.i(81846),ef=e.i(16868);let eg=(0,_.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 eb=e.i(58481),ej=e.i(48306);e.i(50032);var ev=e.i(86254),ey=e.i(42076);let eN=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 ew({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?eb.AlertTriangle:x.Check,b=f?"bg-orange-500/85":"bg-blue-500/85",[j,v]=(0,a.useState)(""),y=m??j,N=p??v,w=(0,R.useSoundAction)("approve"),k=d||c,[C,S]=(0,a.useState)([]),[T,M]=(0,a.useState)(!1),[I,A]=(0,a.useState)(null),[D,P]=(0,a.useState)(!1),[z,$]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),q=y.trim().length>0,O=q?D||z&&F:!D,B=(0,a.useRef)(0),U=(0,a.useRef)(crypto.randomUUID()),H=(0,a.useRef)(null);(0,a.useEffect)(()=>{function e(e){("Control"===e.key||"Meta"===e.key)&&$(!0),"Shift"===e.key&&L(!0)}function t(e){("Control"===e.key||"Meta"===e.key)&&$(!1),"Shift"===e.key&&L(!1)}function a(){$(!1),L(!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",a),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",a)}},[]);let V=(0,a.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&&!eN.has(e))return void A(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();S(a=>[...a,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let a=new FormData;a.append("file",t),a.append("sessionId",U.current);let s=await fetch("/api/attachments/upload",{method:"POST",body:a});if(!s.ok){let t=await s.json().catch(()=>({error:"Upload failed"}));S(t=>t.filter(t=>t.id!==e)),A(t.error??"Upload failed");return}let r=await s.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")}}},[]),W=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,1===B.current&&M(!0)},[]),G=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,0===B.current&&M(!1)},[]),_=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),K=(0,a.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&V(t)},[V]),Z=(0,a.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let a=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&a.push(t)}a.length>0&&(e.preventDefault(),V(a))},[V]),Q=(0,a.useCallback)(async()=>{try{let e=await (0,ey.pickFiles)();e&&S(t=>{let a=new Set(t.map(e=>e.path)),s=e.filter(e=>!a.has(e.path)).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,mimeType:"application/octet-stream",path:e.path}));return s.length>0?[...t,...s]:t})}catch{}},[]),J=(0,a.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),X=(0,a.useCallback)((e,t)=>{S(a=>a.map(a=>a.id===e?{...a,notes:t}:a))},[]),Y=(0,a.useCallback)(()=>{N(""),S([]),A(null)},[N]),ee=(0,a.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),H.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)(E.TooltipProvider,{delayDuration:400,children:(0,t.jsx)("form",{ref:H,onSubmit:function(t){t.preventDefault();let a=y.trim();if(O)w.play(),n(),Y();else{if(!a||!e)return;e(a,C.filter(e=>!e.loading)),Y()}},className:"p-3",children:(0,t.jsx)("div",{role:"region","aria-label":h("createDrawer.fileDropZone"),"data-drag-over":T?"true":"false",onDragEnter:W,onDragLeave:G,onDragOver:_,onDrop:K,className:(0,s.cn)("rounded-md border-2 border-transparent transition-colors",T&&"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)(ej.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,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"}),C.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:C.map(e=>(0,t.jsx)(ev.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",{className:"text-destructive px-3 pb-2 text-xs",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)(E.Tooltip,{children:[(0,t.jsx)(E.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)(ef.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(E.TooltipContent,{side:"top",children:h("chat.attachFiles")})]}),(0,t.jsx)("div",{onMouseLeave:()=>P(!1),children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"submit",disabled:k,"data-testid":"drawer-action-submit",className:(0,s.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&&z&&!F?"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,s.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,s.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)(eg,{className:"h-4 w-4 shrink-0"}),"Reject"]}),(0,t.jsxs)("span",{className:(0,s.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,s.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&&!D&&"pointer-events-none opacity-0"),onMouseEnter:()=>P(!0),children:(0,t.jsx)(ex.ChevronLeft,{className:"h-4 w-4 text-white"})})]})}),f?null:(0,t.jsx)(E.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)(ep.Button,{type:"button",className:"flex-1",disabled:k,onClick:()=>{w.play(),n()},children:l})})]})}function ek({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,a.useState)(0),j=(0,R.useSoundAction)("select"),v=(0,R.useSoundAction)("navigate"),y=h.length,N=g===y-1,w=h[g],k=(0,a.useMemo)(()=>Object.keys(r).length,[r]),C=(0,a.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,a)=>(0,t.jsx)("button",{type:"button","aria-label":`Go to question ${a+1}`,className:(0,s.cn)("h-1.5 rounded-full transition-all duration-200",a===g?"bg-primary w-4":"w-1.5",a!==g&&r[e.id]?"bg-primary/50":"",a===g||r[e.id]?"":"bg-muted-foreground/25"),onClick:()=>{v.play(),b(a)}},e.id))})]}),(0,t.jsx)("div",{className:"space-y-2",children:w.options.map((e,a)=>{let n=r[w.id]===e.id,l=String.fromCharCode(65+a);return(0,t.jsx)("button",{type:"button",className:(0,s.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:()=>C(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)(eh.Badge,{className:"px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):(0,t.jsx)(eh.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)(ep.Button,{type:"button",variant:"ghost",size:"sm",disabled:0===g||o,onClick:()=>{v.play(),b(e=>e-1)},children:[(0,t.jsx)(ex.ChevronLeft,{className:"me-1 h-4 w-4"}),"Previous"]}),N?null:(0,t.jsxs)(ep.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)(em.ChevronRight,{className:"ms-1 h-4 w-4"})]})]})]}),(0,t.jsx)(ew,{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,s.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 eC=e.i(427);let eS=(0,_.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"}]]),eT={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:a})=>a?(0,t.jsx)("code",{className:`${a} 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:a})=>(0,t.jsx)("a",{href:a,className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e})};function eR({decision:e,index:s}){let[r,n]=(0,a.useState)(!1),l=(0,R.useSoundAction)("expand"),i=(0,R.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:s+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)(eh.Badge,{variant:"secondary",className:"bg-primary/10 text-primary shrink-0",children:e.decisionName}):null]}),e.rationale?(0,t.jsx)(eC.default,{components:eT,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)(em.ChevronRight,{className:`h-3.5 w-3.5 transition-transform ${r?"rotate-90":""}`}),(0,t.jsx)(es,{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 eM({data:e}){let{summary:a,decisions: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-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"}),a?(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:a}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,t.jsx)(eS,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Technical Decisions"})]}),s.map((e,a)=>(0,t.jsx)(eR,{decision:e,index:a},e.title))]})}var eI=e.i(41698);function eA({item:e,index:a}){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:a+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)(eh.Badge,{className:"shrink-0 px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):null]})]})]})})})}function eD({data:e}){let{questions: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-center gap-2",children:[(0,t.jsx)(eI.ClipboardList,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Product Decisions"})]}),a.map((e,a)=>(0,t.jsx)(eA,{item:e,index:a},e.question))]})}var eP=e.i(30702);let eE=(0,_.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 ez=e.i(48923),e$=e.i(49228);let eF=(0,_.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),eL=(0,_.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"}]]),eq=(0,_.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 eO=e.i(81181),eB=e.i(99105),eU=e.i(35e3),eH=e.i(30090),eH=eH,eV=e.i(17406);function eW({status:e}){switch(e){case eV.CiStatus.Success:return(0,t.jsxs)(eh.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)(eU.CheckCircle2,{className:"me-1 h-3.5 w-3.5"}),"Passing"]});case eV.CiStatus.Pending:return(0,t.jsxs)(eh.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 eV.CiStatus.Failure:return(0,t.jsxs)(eh.Badge,{className:"border-transparent bg-red-50 text-red-700 hover:bg-red-50",children:[(0,t.jsx)(eH.default,{className:"me-1 h-3.5 w-3.5"}),"Failing"]})}}var eG=e.i(12919);let e_=(0,_.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 eK=e.i(35749);let eZ={added:{icon:eG.FilePlus,label:"A",className:"text-green-600"},modified:{icon:eK.FileEdit,label:"M",className:"text-amber-600"},deleted:{icon:e_,label:"D",className:"text-red-600"},renamed:{icon:eK.FileEdit,label:"R",className:"text-blue-600"}};function eQ({status:e}){let a=eZ[e],r=a.icon;return(0,t.jsx)(r,{className:(0,s.cn)("h-3.5 w-3.5 shrink-0",a.className)})}function eJ({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,s.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,s.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 eX({file:e}){let[r,n]=(0,a.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)(em.ChevronRight,{className:(0,s.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform duration-150",r&&"rotate-90")}),(0,t.jsx)(eQ,{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)(eJ,{hunk:e},e.header))}):null]})}function eY({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)(q.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)(eX,{file:e},`${e.status}-${e.path}`))})]})}let e0={Screenshot:eL,Video:eq,TestOutput:q.FileText,TerminalRecording:F.Terminal},e1=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp"]),e2=new Set([".mp4",".webm",".mov"]);function e5({evidence:e}){var s,r;let n,[l,i]=(0,a.useState)(!0),o=e0[e.type]??eL,d=(n=(s=e.relativePath).lastIndexOf("."))>=0?s.slice(n).toLowerCase():"",c=(r=e.relativePath,`/api/evidence?path=${encodeURIComponent(r)}`),u="Screenshot"===e.type||e1.has(d),x="Video"===e.type||e2.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)(eB.ChevronDown,{className:"text-muted-foreground h-3 w-3 shrink-0"}):(0,t.jsx)(em.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)(eO.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)(e3,{url:c}):(0,t.jsx)("p",{className:"text-muted-foreground truncate font-mono text-[10px]",children:e.relativePath})}):null,null]})}function e3({url:e}){let[s,r]=(0,a.useState)(null),[n,l]=(0,a.useState)(!1);return n?s?(0,t.jsx)("pre",{className:"bg-muted/50 max-h-60 overflow-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:s}):(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 e4({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)(eL,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Evidence"}),(0,t.jsx)(eh.Badge,{variant:"secondary",className:"text-[10px]",children:e.length})]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(e5,{evidence:e},`${e.type}-${e.relativePath}`))})]})})}function e6({data:e,readOnly:a=!1,onApprove:s,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",[]):s;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:a?"Merge History":"Merge Review"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:a?"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)(e$.GitBranch,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)(eh.Badge,{variant:"secondary",className:"font-mono text-[11px]",children:x.source}),(0,t.jsx)(eF,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsx)(eh.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)(eP.ExternalLink,{className:"h-3.5 w-3.5"})]}),(0,t.jsx)(eh.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)(eh.Badge,{className:"border-transparent bg-orange-50 text-orange-700 hover:bg-orange-50",children:[(0,t.jsx)(eb.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)(eW,{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)(ez.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)(eE,{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)(eb.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)(e4,{evidence:p}):null,u&&u.length>0?(0,t.jsx)(eY,{fileDiffs:u}):null]}),!a&&(0,t.jsx)(ew,{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 e8=e.i(55016);let e7=(0,_.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"}]]),e9=(0,_.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 te=e.i(59311),tt=e.i(39200);let ta=(0,_.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 ts=e.i(60253),tr=e.i(2287),tn=e.i(28267),tl=e.i(80436);let ti=(0,_.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"}]]),to=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function td(e){let t=e.lastIndexOf(".");return t>=0&&to.has(e.slice(t).toLowerCase())}function tc(e){let t=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"",a=td(e)?`image/${t.slice(1).replace("jpg","jpeg")}`:"",s=new URLSearchParams({path:e,...a&&{mimeType:a}});return`/api/attachments/preview?${s.toString()}`}let tu=/(?:^|\s)@(\/[^\s]+)/g;function tx({text:e,attachmentPaths:a}){let s=function(e){let t=[],a=0;for(let s of e.matchAll(tu)){let r=s.index,n=r+(s[0].length-s[0].trimStart().length);n>a&&t.push({type:"text",value:e.slice(a,n)}),t.push({type:"attachment",path:s[1]}),a=r+s[0].length}return a<e.length&&t.push({type:"text",value:e.slice(a)}),t}(e),r=s.some(e=>"attachment"===e.type),n=a?.filter(Boolean)??[];return r||0!==n.length?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[s.map(e=>{if("text"===e.type){let a=e.value.trim();return a?(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:a},`text-${a.slice(0,40)}`):null}return(0,t.jsx)(tm,{path:e.path},`att-${e.path}`)}),n.map(e=>(0,t.jsx)(tm,{path:e},`extra-${e}`))]}):(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:e})}function tm({path:e}){let s=e.split("/").pop()??e,[r,n]=(0,a.useState)(!1);return td(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)(ti,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s})]}):(0,t.jsxs)(tr.Dialog,{children:[(0,t.jsx)(tr.DialogTrigger,{asChild:!0,children:(0,t.jsx)("img",{src:tc(e),alt:s,"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)(tr.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)(tn.VisuallyHidden.Root,{children:(0,t.jsxs)(tr.DialogTitle,{children:["Preview: ",s]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:tc(e),alt:s,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:s})}),(0,t.jsx)("a",{href:tc(e),download:s,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${s}`,children:(0,t.jsx)(tl.DownloadIcon,{className:"h-4 w-4"})})]})]})]}):(0,t.jsx)("a",{href:tc(e),download:s,"data-testid":"inline-attachment-file",className:"text-primary text-sm underline underline-offset-2",children:s})}e.i(81803);var tp=e.i(72714),th=e.i(86782),tf=e.i(29847);function tg(e){if(0===e)return"0s";let t=Math.floor(e/1e3);if(0===t)return"<1s";let a=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60;return a>0?`${a}h ${s}m`:s>0?`${s}m ${r}s`:`${r}s`}function tb({icon:e,title:a,children:s}){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"}),a]}),s]})}function tj({children:e,className:a}){return(0,t.jsx)("div",{className:(0,s.cn)("bg-muted/60 rounded-md border border-transparent p-3",a),children:e})}function tv({label:e,children:a}){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:a})]})}function ty({on:e,label:a}){return(0,t.jsxs)("span",{className:(0,s.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)(ts.X,{className:"size-3"}),a]})}let tN={[eV.PrStatus.Open]:"text-blue-600 dark:text-blue-400",[eV.PrStatus.Merged]:"text-purple-600 dark:text-purple-400",[eV.PrStatus.Closed]:"text-red-600 dark:text-red-400"};function tw({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,s]=(0,a.useState)(null),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>e?(s(tg(Math.max(0,Date.now()-e))),r.current=setInterval(()=>{s(tg(Math.max(0,Date.now()-e)))},1e3),()=>{r.current&&clearInterval(r.current)}):void s(null),[e]),t}("running"===e.state||"action-required"===e.state?e.startedAt:void 0),v=eo.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,s.cn)("h-full rounded-full transition-all",v.progressClass),style:{width:`${e.progress}%`}})})}):null,e.oneLiner||e.userQuery||y?(0,t.jsx)(tb,{icon:e9,title:"Description",children:(0,t.jsxs)(tj,{className:"flex flex-col gap-2",children:[e.oneLiner?(0,t.jsx)(tv,{label:"One-Liner",children:e.oneLiner}):null,e.userQuery?(0,t.jsx)(tv,{label:"Query",children:(0,t.jsx)(tx,{text:e.userQuery})}):null,y?(0,t.jsx)(tv,{label:"Summary",children:(0,t.jsx)("span",{className:"leading-snug",children:e.summary})}):null]})}):null,e.pr?(0,t.jsx)(tb,{icon:ez.GitCommitHorizontal,title:"Pull Request",children:(0,t.jsx)(tj,{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)(eP.ExternalLink,{className:"size-3"})]}),(0,t.jsx)("span",{className:(0,s.cn)("text-xs font-semibold",tN[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)(eb.AlertTriangle,{className:"size-3 shrink-0"})," Conflicts"]}):null,e.pr.ciStatus&&!0!==e.hideCiStatus?(0,t.jsx)(eW,{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)(tj,{children:(0,t.jsxs)(tv,{label:"Branch",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e$.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)(tj,{children:(0,t.jsx)(tv,{label:"Agent",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.agentType?(x=(0,th.getAgentTypeIcon)(e.agentType),(0,t.jsx)(x,{className:"size-3.5 shrink-0 opacity-50"})):null,e.agentType?(0,t.jsx)("span",{children:th.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,tf.getModelMeta)(e.modelId).displayName||e.modelId}):null]})})}):null,e.createdAt?(0,t.jsx)(tj,{children:(0,t.jsx)(tv,{label:"Created",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e8.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)(tj,{children:(0,t.jsx)(tv,{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)(ea.Zap,{className:"size-3.5"})," Fast"]})})}):null,e.runtime||j?(0,t.jsx)(tj,{children:(0,t.jsx)(tv,{label:e.runtime?"Runtime":"Elapsed",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(e8.Clock,{className:"text-foreground/30 size-3 shrink-0"}),e.runtime??j]})})}):null]}),e.blockedBy||e.errorMessage?(0,t.jsx)(tb,{icon:eb.AlertTriangle,title:"Issues",children:(0,t.jsxs)(tj,{className:"border-destructive/20 bg-destructive/5",children:[e.blockedBy?(0,t.jsx)(tv,{label:"Blocked By",children:e.blockedBy}):null,e.errorMessage?(0,t.jsx)(tv,{label:"Error",children:(0,t.jsx)("span",{className:"text-destructive",children:e.errorMessage})}):null]})}):null,o&&e.branch&&i?(0,t.jsx)(tb,{icon:te.RefreshCw,title:"Branch Sync",children:(0,t.jsx)(tk,{syncStatus:r??null,syncLoading:n??!1,syncError:l??null,onRefreshSync:i,onRebaseOnMain:o,rebaseLoading:d??!1,rebaseError:c??null})}):null,(0,t.jsx)(tC,{data:e})]})}function tk({syncStatus:e,syncLoading:a,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)(tj,{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:a&&!e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu,{size:"sm"}),(0,t.jsx)("span",{className:"text-foreground/40",children:"Checking..."})]}):n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eb.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)(eu,{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)(eb.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)(eU.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:a,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)(te.RefreshCw,{className:(0,s.cn)("size-3",a&&"animate-spin")})}):null]}),u&&!o?(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(tp.ActionButton,{label:c("branchSyncStatus.rebaseOnMain"),onClick:i,loading:!1,error:!!d,icon:Y,variant:"outline",size:"sm"})}):null,d?(0,t.jsx)("p",{className:"text-destructive pt-1 text-[11px]",children:d}):null]})}function tC({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)(tb,{icon:tt.Settings,title:"Settings",children:(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[e.approvalGates?(0,t.jsxs)(tj,{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)(ta,{className:"size-3"})," Approve"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(ty,{on:e.approvalGates.allowPrd,label:"PRD"}),(0,t.jsx)(ty,{on:e.approvalGates.allowPlan,label:"Plan"}),(0,t.jsx)(ty,{on:e.approvalGates.allowMerge,label:"Merge"})]})]}):null,null!=e.enableEvidence?(0,t.jsxs)(tj,{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)(e7,{className:"size-3"})," Evidence"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(ty,{on:e.enableEvidence,label:"Collect"}),null!=e.commitEvidence?(0,t.jsx)(ty,{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)(tj,{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)(e$.GitBranch,{className:"size-3"})," Git"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[null!=e.push?(0,t.jsx)(ty,{on:e.push,label:"Push"}):null,null!=e.openPr?(0,t.jsx)(ty,{on:e.openPr,label:"PR"}):null,null!=e.ciWatchEnabled?(0,t.jsx)(ty,{on:e.ciWatchEnabled,label:"Watch"}):null,null!=e.commitSpecs?(0,t.jsx)(ty,{on:e.commitSpecs,label:"Specs"}):null,null!=e.forkAndPr?(0,t.jsx)(ty,{on:e.forkAndPr,label:"Fork"}):null]})]}):null]})})}let tS=(0,_.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 eH=eH,tT=e.i(94819),tR=e.i(58860);let tM=(0,_.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"}]]),tI=(0,_.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 tA(e,t){if(null!=e.durationMs&&e.durationMs>0)return e.durationMs;if(!e.completedAt&&e.startedAt){let a=new Date(e.startedAt).getTime();if(!Number.isNaN(a))return Math.max(0,t-a)}return 0}function tD(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tP(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 tE(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}let tz={analyze:"Analyzing",requirements:"Requirements",research:"Researching",plan:"Planning",implement:"Implementing",rebase:"Rebasing","fast-implement":"Fast Implement",evidence:"Evidence",validate:"Validating",repair:"Repairing",merge:"Merging"},t$={"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:et.RotateCcw},"run:completed":{label:"completed",colorClass:"text-emerald-600",bgClass:"bg-emerald-50 dark:bg-emerald-950/30",icon:eU.CheckCircle2},"run:failed":{label:"failed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eH.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:eH.default},"run:rejected":{label:"rejected",colorClass:"text-orange-600",bgClass:"bg-orange-50 dark:bg-orange-950/30",icon:tT.Ban}};function tF(e){return e.startsWith("run:")}function tL({timings:e,loading:s,error:n,rejectionFeedback:l}){let{t:o}=(0,r.useTranslation)("web"),d=function(e){let[t,s]=(0,a.useState)(Date.now),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>(e&&e.some(e=>!e.phase.startsWith("run:")&&!e.completedAt&&e.startedAt)&&(r.current=setInterval(()=>s(Date.now()),1e3)),()=>{r.current&&(clearInterval(r.current),r.current=null)}),[e]),t}(e);if(s)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)(V.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)(e8.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=>!tF(e.phase)),u=Math.max(...c.map(e=>tA(e,d)),...c.map(e=>e.approvalWaitMs??0),0),x=function(e,t){if(!e.length)return[];let a=e.filter(e=>"run:rejected"===e.phase).length,s=t?.length??0,r=e;if(s>a){r=[...e];let n=e[e.length-1].agentRunId;for(let e=a;e<s;e++){let s=t[e];e>a&&r.push({agentRunId:n,phase:"run:resumed",startedAt:s.timestamp??`synthetic-resumed-${e}`}),r.push({agentRunId:n,phase:"run:rejected",startedAt:s.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+tA(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)(tq,{iteration:e,showHeader:m,maxDurationMs:u,now:d},e.number))}),p>0?(0,t.jsx)(tH,{totalExecMs:p,totalWaitMs:h,totalInputTokens:f,totalOutputTokens:g,totalCostUsd:b}):null]})}function tq({iteration:e,showHeader:a,maxDurationMs:s,now:r}){let n=function(e){let t=[...e.timings].reverse().find(e=>tF(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:[a?(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((a,n)=>{if(tF(a.phase)){let s,r="run:rejected"===a.phase,l="run:failed"===a.phase||"run:crashed"===a.phase||"run:stopped"===a.phase;if(r)s=e.rejectionMessage;else if(l){let t=[...e.timings].reverse().find(e=>!tF(e.phase)&&e.errorMessage);s=t?.errorMessage??a.errorMessage}return(0,t.jsx)(tO,{timing:a,message:s,attachments:r?e.rejectionAttachments:void 0,isFirst:0===n,isLast:n===e.timings.length-1},`${a.agentRunId}-${a.phase}-${a.startedAt}`)}return(0,t.jsx)(tB,{timing:a,maxDurationMs:s,now:r},`${a.agentRunId}-${a.phase}-${a.startedAt}`)})]})]})}function tO({timing:e,message:a,attachments:s,isFirst:r,isLast:n}){let l,i=t$[e.phase];if(!i)return null;let o=s&&s.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:tP(String(e.startedAt))}):null]}),a?(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)(V.AlertCircle,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-400"}):(0,t.jsx)(ee.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:["— ",a]})]})):null,o?(0,t.jsx)("div",{"data-testid":"rejection-feedback-attachments",className:"ml-[26px]",children:(0,t.jsx)(tx,{text:"",attachmentPaths:s})}):null]})}function tB({timing:e,maxDurationMs:s,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=tz[i]??i,p=c?`Phase ${o.replace("phase-","")}`:null!==o?`${m} #${o}`:m,h=tA(e,n),f=!e.completedAt&&!!e.startedAt,g=f?15:2,b=s>0?Math.max(g,h/s*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,a.useState)(!1),w=(0,a.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:tg(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:tP(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)(ea.Zap,{className:"h-3 w-3 opacity-50"}),tD(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)(tS,{className:"h-3 w-3 opacity-50"}),tE(e.costUsd)]}):null]}),null!=e.approvalWaitMs&&e.approvalWaitMs>0?(0,t.jsx)(tU,{timing:e,maxDurationMs:s}):null]})}function tU({timing:e,maxDurationMs:a}){let s=e.approvalWaitMs??0,r=a>0?Math.max(2,s/a*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)(tR.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:tg(s)})]})}function tH({totalExecMs:e,totalWaitMs:a,totalInputTokens:s,totalOutputTokens:n,totalCostUsd:l}){let{t:i}=(0,r.useTranslation)("web"),o=s+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)(tV,{icon:e8.Clock,label:i("activityTab.execution"),value:tg(e)}),(0,t.jsx)(tV,{icon:tR.Timer,label:i("activityTab.wait"),value:a>0?tg(a):"n/a"}),(0,t.jsx)(tV,{icon:e8.Clock,label:"Wall-clock",value:a>0?tg(e+a):tg(e)}),(0,t.jsx)(tV,{icon:tS,label:i("activityTab.cost"),value:l>0?tE(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)(ea.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:tD(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)(tM,{className:"h-3 w-3 text-blue-500 opacity-60"}),tD(s)]}),(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tI,{className:"h-3 w-3 text-emerald-500 opacity-60"}),tD(n)]})]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-sm italic tabular-nums",children:"n/a"})]})]})]})}function tV({icon:e,label:a,value:s,className:r=""}){let n="n/a"===s;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"}),a]}),(0,t.jsx)("span",{className:`text-sm tabular-nums ${n?"text-muted-foreground/40 italic":""}`,children:s})]})}var tW=e.i(7311),tG=e.i(44229);let t_=(0,_.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"}]]),tK=(0,_.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"}]]),tZ=(0,_.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"}]]),tQ=/^\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]\s+(?:\[([^\]]+)\]\s+)?(?:\[([^\]|]+)(?:\|([^\]]+))?\]\s+)?(.*)$/,tJ=/^\[(tool-result|tool|text|delta|result|tokens|cmd|file|turn|thread|error|event|raw|WORKER)\]\s*(.*)/;function tX(e){let t=e.match(tQ);if(!t)return{timestamp:null,phase:null,agent:null,model:null,tag:"raw",message:e,raw:e};let[,a,s,r,n,l]=t,i=null,o=null,d=null,c=l??"";if(null!=r&&null!=s)if(s.includes("|")){let[e,t]=s.split("|");o=e,d=t??null,c=`[${r}] ${l??""}`}else i=s,o=r,d=n??null;else if(null!=s)if(s.includes("|")){let[e,t]=s.split("|");o=e,d=t??null}else i=s;let u=c.match(tJ),x="info";return u&&(x=u[1].toLowerCase(),c=u[2]),{timestamp:a??null,phase:i,agent:o,model:d,tag:x,message:c.trim(),raw:e}}function tY({content:e}){let s=(0,a.useMemo)(()=>e?e.split("\n").filter(e=>e.trim().length>0).map(tX):[],[e]);return 0===s.length?null:(0,t.jsx)("div",{className:"flex flex-col",children:s.map((e,a)=>(0,t.jsx)(t0,{line:e},a))})}function t0({line:e}){switch(e.tag){case"tool":return(0,t.jsx)(t5,{line:e});case"tool-result":return(0,t.jsx)(t9,{line:e});case"text":case"delta":return(0,t.jsx)(t4,{line:e});case"result":return(0,t.jsx)(t6,{line:e});case"tokens":case"turn":return(0,t.jsx)(t8,{line:e});case"cmd":return(0,t.jsx)(ae,{line:e});case"file":return(0,t.jsx)(at,{line:e});case"thread":case"event":case"info":return(0,t.jsx)(as,{line:e});case"error":return(0,t.jsx)(aa,{line:e});case"worker":return(0,t.jsx)(t7,{line:e});default:return(0,t.jsx)(ar,{line:e})}}function t1({value:e}){if(!e)return null;let a=e.replace(/^.*T/,"").replace("Z",""),s=a.split(":"),r=s.length>=3?`${s[1]}:${s[2].split(".")[0]}`:a;return(0,t.jsx)("span",{className:"text-muted-foreground/60 w-11 shrink-0 font-mono text-[10px]",children:r})}function t2({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 t5({line:e}){var a;let s,{toolName:r,args:n}=-1===(s=(a=e.message).indexOf(" "))?{toolName:a,args:""}:{toolName:a.slice(0,s),args:a.slice(s+1)},l=function(e,t){try{let a=JSON.parse(t);if("Read"===e&&a.file_path||"Write"===e&&a.file_path||"Edit"===e&&a.file_path)return a.file_path;if("Glob"===e&&a.pattern||"Grep"===e&&a.pattern)return a.pattern;if("Bash"===e&&a.command)return a.command;if("Task"===e&&a.description)return a.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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t3,{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 t3({toolName:e}){let a=e.toLowerCase();return"bash"===a?(0,t.jsx)(F.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"read"===a||"glob"===a||"grep"===a?(0,t.jsx)(q.FileText,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"write"===a||"edit"===a?(0,t.jsx)(tZ,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):(0,t.jsx)(F.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"})}function t4({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(ee.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 t6({line:e}){var a;let s,r,{chars:n}=(s=(a=e.message).match(/^(\d+)\s+chars/),r=a.match(/session=(\S+)/),{chars:s?parseInt(s[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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eU.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 t8({line:e}){let a,{inputTokens:s,outputTokens:r}=(a=e.message.match(/^(\d+)\s+in\s*\/\s*(\d+)\s+out/))?{inputTokens:parseInt(a[1],10),outputTokens:parseInt(a[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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t_,{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:s.toLocaleString()})," in / ",(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:r.toLocaleString()})," out"]})]})]})}function t7({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tK,{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 t9({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eF,{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 ae({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{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 at({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tZ,{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 aa({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(V.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 as({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)(t1,{value:e.timestamp}),(0,t.jsx)(t2,{phase:e.phase}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs break-all",children:e.message})]})}function ar({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 an({content:e,isConnected:s,error:n}){let{t:l}=(0,r.useTranslation)("web"),i=(0,a.useRef)(null),[o,d]=(0,a.useState)(!0),[c,u]=(0,a.useState)("structured"),x=(0,a.useCallback)(()=>{let e=i.current;e&&d(e.scrollHeight-e.scrollTop-e.clientHeight<40)},[]),m=(0,a.useCallback)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight,d(!0))},[]);return((0,a.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)(V.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 ${s?"bg-emerald-500":"bg-zinc-400"}`}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:s?"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)(q.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)(tG.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)(tW.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)(tY,{content:e}):e})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(F.Terminal,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:l("logTab.noLogOutput")}),s?(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Waiting for log data..."}):null]})}let al=(0,_.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 ai=e.i(95812),ao=e.i(87889);let ad=(0,_.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"}]]),ac={Todo:{icon:ai.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:ao.Eye,colorClass:"text-amber-600",borderClass:"border-amber-200",label:"Review"}},au={icon:ai.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Unknown"};function ax({tasks:e}){let{t:a}=(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:a("taskProgress.noTasksDefined")})}):(0,t.jsxs)("div",{"data-testid":"task-progress-view",className:"flex flex-col gap-3",children:[(0,t.jsx)(am,{tasks:e}),(0,t.jsx)("div",{"data-testid":"task-progress-list",className:"flex flex-col gap-2",children:e.map((e,a)=>(0,t.jsx)(ah,{task:e,index:a},e.title||`task-${a}`))})]})}function am({tasks:e}){let{t:s}=(0,r.useTranslation)("web"),n=(0,a.useMemo)(()=>{let t=e.filter(e=>"Done"===e.state).length,a=e.filter(e=>"Work in Progress"===e.state).length,s=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:a,review:s,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)(ap,{icon:x.Check,label:s("taskProgress.done"),count:n.done,className:"text-emerald-600"}):null,n.wip>0?(0,t.jsx)(ap,{icon:i.Loader2,label:s("taskProgress.inProgress"),count:n.wip,className:"text-blue-600"}):null,n.review>0?(0,t.jsx)(ap,{icon:ao.Eye,label:s("taskProgress.review"),count:n.review,className:"text-amber-600"}):null,n.todo>0?(0,t.jsx)(ap,{icon:ai.Circle,label:s("taskProgress.todo"),count:n.todo,className:"text-muted-foreground"}):null]})]})}function ap({icon:e,label:a,count:r,className:n}){return(0,t.jsxs)("span",{className:(0,s.cn)("flex items-center gap-1 text-xs",n),children:[(0,t.jsx)(e,{className:"h-3 w-3"}),r," ",a]})}function ah({task:e,index:r}){let[n,l]=(0,a.useState)(!1),i=ac[e.state]??au,o=i.icon,d=e.actionItems.length>0,c=(0,a.useCallback)(()=>{d&&l(e=>!e)},[d]);return(0,t.jsxs)("div",{"data-testid":`task-card-${r}`,className:(0,s.cn)("rounded-lg border",i.borderClass),children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!d,className:(0,s.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,s.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,s.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)(em.ChevronRight,{className:(0,s.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,a)=>(0,t.jsx)(af,{item:e},e.name||`ai-${a}`))})}):null]})}function af({item:e}){let a=e.acceptanceCriteria.length,s=e.acceptanceCriteria.filter(e=>e.verified).length,r=a>0&&s===a;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)(eU.CheckCircle2,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,t.jsx)(ad,{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]}),a>0?(0,t.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[s,"/",a]}):null]}),a>0?(0,t.jsx)("div",{className:"ms-5.5 flex flex-col gap-1",children:e.acceptanceCriteria.map((e,a)=>(0,t.jsx)(ag,{criterion:e},e.description||`ac-${a}`))}):null]})}function ag({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)(ai.Circle,{className:"text-muted-foreground mt-0.5 h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:(0,s.cn)("text-[11px]",e.verified?"text-muted-foreground line-through":"text-foreground"),children:e.description})]})}let ab={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 aj({plan:e,loading:a,error:s}){return a?(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"})}):s?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(V.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:s})]}):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)(eh.Badge,{className:ab[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)(ax,{tasks:e.tasks})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(al,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"No plan created yet"})]})}let av=(0,_.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var ay=e.i(25235),aN=e.i(71326);function aw({data:e,onSubmitFeedback:s,onPromote:r,onDiscard:n,isSubmitting:l=!1}){let[d,c]=(0,a.useState)(""),[u,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(!1),h=(0,a.useCallback)(async()=>{d.trim()&&s&&(await s(d.trim()),c(""))},[d,s]),f=(0,a.useCallback)(async e=>{p(!1),await r?.(e)},[r]),g=(0,a.useCallback)(async()=>{x(!1),await n?.()},[n]),b="action-required"===e.state&&"exploring"===e.lifecycle,j="running"===e.state&&"exploring"===e.lifecycle;return(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4","data-testid":"prototype-tab",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(er.FlaskConical,{className:"h-4 w-4 text-amber-500"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Exploration Prototype"}),(e.iterationCount??0)>0&&(0,t.jsxs)(eh.Badge,{variant:"secondary","data-testid":"prototype-iteration-badge",children:["Iteration ",e.iterationCount]}),j?(0,t.jsxs)(eh.Badge,{variant:"outline",className:"text-teal-600 dark:text-teal-400",children:[(0,t.jsx)(i.Loader2,{className:"mr-1 h-3 w-3 animate-spin"}),"Generating..."]}):null,b?(0,t.jsx)(eh.Badge,{variant:"outline",className:"text-amber-600 dark:text-amber-400",children:"Awaiting feedback"}):null]}),(0,t.jsx)(ay.Separator,{}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{htmlFor:"prototype-feedback",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"Feedback"}),(0,t.jsx)(ej.Textarea,{id:"prototype-feedback",placeholder:b?"Describe what to change in the next iteration...":"Feedback can be submitted when the prototype is ready for review.",value:d,onChange:e=>c(e.target.value),disabled:!b||l,className:"min-h-24 resize-none","data-testid":"prototype-feedback-input"}),(0,t.jsxs)(ep.Button,{onClick:h,disabled:!d.trim()||!b||l,size:"sm",className:"self-end","data-testid":"prototype-submit-feedback",children:[l?(0,t.jsx)(i.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(eg,{className:"mr-1 h-3.5 w-3.5"}),"Send Feedback"]})]}),(0,t.jsx)(ay.Separator,{}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(ep.Button,{variant:"default",size:"sm",onClick:()=>p(!0),disabled:!b||l,"data-testid":"prototype-promote-button",children:[(0,t.jsx)(av,{className:"mr-1 h-3.5 w-3.5"}),"Promote to Feature"]}),(0,t.jsxs)(ep.Button,{variant:"outline",size:"sm",onClick:()=>x(!0),disabled:l,className:"text-destructive hover:text-destructive","data-testid":"prototype-discard-button",children:[(0,t.jsx)(o.Trash2,{className:"mr-1 h-3.5 w-3.5"}),"Discard"]})]}),(0,t.jsx)(aN.AlertDialog,{open:m,onOpenChange:p,children:(0,t.jsxs)(aN.AlertDialogContent,{children:[(0,t.jsxs)(aN.AlertDialogHeader,{children:[(0,t.jsx)(aN.AlertDialogTitle,{children:"Promote to Feature"}),(0,t.jsx)(aN.AlertDialogDescription,{children:"Choose the mode for the promoted feature. The prototype code will be preserved as the starting point."})]}),(0,t.jsxs)(aN.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row",children:[(0,t.jsx)(aN.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(aN.AlertDialogAction,{onClick:()=>f(eV.FeatureMode.Fast),"data-testid":"promote-fast",children:"Fast (Direct Implementation)"}),(0,t.jsx)(aN.AlertDialogAction,{onClick:()=>f(eV.FeatureMode.Regular),"data-testid":"promote-regular",children:"Regular (Full SDLC)"})]})]})}),(0,t.jsx)(aN.AlertDialog,{open:u,onOpenChange:x,children:(0,t.jsxs)(aN.AlertDialogContent,{children:[(0,t.jsxs)(aN.AlertDialogHeader,{children:[(0,t.jsx)(aN.AlertDialogTitle,{children:"Discard Exploration?"}),(0,t.jsx)(aN.AlertDialogDescription,{children:"This will delete the exploration feature, its worktree, and all prototype code. This action cannot be undone."})]}),(0,t.jsxs)(aN.AlertDialogFooter,{children:[(0,t.jsx)(aN.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(aN.AlertDialogAction,{onClick:g,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90","data-testid":"discard-confirm",children:"Discard"})]})]})})]})}var ak=e.i(28112);function aC(){return{data:null,loading:!1,error:null}}let aS=[{key:"overview",label:"Overview",icon:W.LayoutDashboard},{key:"prototype",label:"Prototype",icon:er.FlaskConical},{key:"activity",label:"Activity",icon:G.Activity},{key:"log",label:"Log",icon:K},{key:"plan",label:"Plan",icon:Z},{key:"prd-review",label:"PRD Review",icon:Q},{key:"tech-decisions",label:"Tech Decisions",icon:J.Cpu},{key:"product-decisions",label:"Product",icon:X.Package},{key:"merge-review",label:"Merge Review",icon:Y},{key:"chat",label:"Chat",icon:ee.MessageSquare}],aT={activity:async function(e){let t=await el(e);if("error"in t)throw Error(t.error);return{timings:t.timings,rejectionFeedback:t.rejectionFeedback}},plan:async function(e){let t=await ei(e);if("error"in t)throw Error(t.error);return t.plan}};function aR({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:S,isMergeLoading:T,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:D,rebaseLoading:P,rebaseError:z,isRejecting:$,chatInput:F,onChatInputChange:L,sseEvents:q,onSubmitFeedback:O,onPromote:B,onDiscardExploration:U,isPrototypeSubmitting:H,interactiveAgentEnabled:W=!0,onRetry:G,onStop:_,onStart:K}){let Z,Q=(0,n.usePathname)(),J=(0,a.useMemo)(()=>(function(e,t=!0){let a=["overview"];return"exploring"===e.lifecycle?(a.push("prototype","activity"),e.hasAgentRun&&a.push("log")):(a.push("activity"),e.hasAgentRun&&a.push("log"),e.hasPlan&&a.push("plan"),"requirements"===e.lifecycle&&"action-required"===e.state&&a.push("prd-review"),"implementation"===e.lifecycle&&"action-required"===e.state&&a.push("tech-decisions","product-decisions"),"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)&&a.push("merge-review"),"maintain"===e.lifecycle&&e.pr&&a.push("merge-review")),t&&a.push("chat"),a})(l,W),[l,W]),X=(0,a.useMemo)(()=>aS.filter(e=>J.includes(e.key)).map(e=>"merge-review"===e.key&&"maintain"===l.lifecycle?{...e,label:"Merge History"}:e),[J,l.lifecycle]),Y=(0,a.useMemo)(()=>{let e=Q.match(/^(\/feature\/[^/]+)/);return e?e[1]:Q},[Q]),ee=(0,a.useMemo)(()=>x&&J.includes(x)?x:u&&J.includes(u)?u:"overview",[]),[er,el]=(0,a.useState)(ee),ei=function(e){let[t,s]=(0,a.useState)(""),[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(null),o=(0,a.useRef)(null),d=(0,a.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),n(!1)},[]);return(0,a.useEffect)(()=>{if(!e){s(""),n(!1),i(null);return}s(""),i(null);let t=new EventSource(`/api/feature-logs?featureId=${e}`);return o.current=t,t.onopen=()=>{n(!0)},t.addEventListener("initial",e=>{s(JSON.parse(e.data).content)}),t.addEventListener("log",e=>{let t=JSON.parse(e.data);s(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"===er?o:null),{tabs:ed,fetchTab:ec,refreshTab:ex}=function(e,t){let s=Object.keys(t),[r,n]=(0,a.useState)(()=>{let e={};for(let t of s)e[t]=aC();return e}),l=(0,a.useRef)(t);l.current=t;let i=(0,a.useRef)(e);i.current=e;let o=(0,a.useRef)(!0);(0,a.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);let d=(0,a.useRef)(e);(0,a.useEffect)(()=>{d.current!==e&&(d.current=e,n(e=>{let t={};for(let a of Object.keys(e))t[a]=aC();return t}))},[e]);let c=(0,a.useCallback)(async e=>{let t=l.current[e],a=i.current;if(t){o.current&&n(t=>t[e]?.data!==null?t:{...t,[e]:{...t[e],loading:!0,error:null}});try{let s=await t(a);o.current&&n(t=>({...t,[e]:{data:s,loading:!1,error:null}}))}catch(t){o.current&&n(a=>{let s=t instanceof Error?t.message:"Failed to fetch tab data",r=a[e]?.data??null;return{...a,[e]:{data:r,loading:!1,error:r?null:s}}})}}},[]),u=(0,a.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,a.useCallback)(async e=>{await c(e)},[c])}}(o,aT),em=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!em.current)return;em.current=!1;let e="overview"===er?Y:`${Y}/${er}`;e!==Q&&window.history.pushState(null,"",e)},[er,Y,Q]);let ep=(0,a.useRef)(Q);(0,a.useEffect)(()=>{if(ep.current===Q||(ep.current=Q,em.current))return;let e=Q.split("/"),t=e.length>=4?e[3]:void 0,a=t&&J.includes(t)?t:"overview";a!==er&&(el(a),("activity"===a||"plan"===a)&&ec(a))},[Q]);let eh=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!eh.current&&(eh.current=!0,!x&&"overview"!==ee)){let e=`${Y}/${ee}`;e!==Q&&window.history.replaceState(null,"",e)}},[]);let ef=(0,a.useRef)(!1);(0,a.useEffect)(()=>{ef.current||(ef.current=!0,("activity"===er||"plan"===er)&&ec(er))},[er,ec]);let eg=(0,a.useRef)(o);(0,a.useEffect)(()=>{eg.current!==o&&(eg.current=o,el("overview"))},[o]);let eb=(0,a.useRef)(u);(0,a.useEffect)(()=>{if(eb.current!==u&&u&&J.includes(u)){eb.current=u,el(u),("activity"===u||"plan"===u)&&ec(u);let e="overview"===u?Y:`${Y}/${u}`;e!==window.location.pathname&&window.history.replaceState(null,"",e)}},[u,J,Y,ec]),(0,a.useEffect)(()=>{J.includes(er)||(el("overview"),window.location.pathname!==Y&&window.history.replaceState(null,"",Y))},[J,er,Y]);let ej=(0,a.useRef)(er);ej.current=er;let ev=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(!q||0===q.length||(ev.current>q.length&&(ev.current=0),q.length<=ev.current))return;let e=q.slice(ev.current);if(ev.current=q.length,!e.some(e=>e.featureId===o))return;ex("activity");let t=ej.current;"plan"===t&&ex(t)},[q,o,ex]);let ey="running"===l.state||"creating"===l.state;(0,a.useEffect)(()=>{if(!ey)return;let e=setInterval(()=>{ex("activity")},5e3);return()=>clearInterval(e)},[ey,ex]);let eN=(0,a.useCallback)(e=>{em.current=!0,el(e),("activity"===e||"plan"===e)&&ec(e)},[ec]);return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsxs)(en.Tabs,{value:er,onValueChange:eN,className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(en.TabsList,{className:"bg-muted/50 h-auto w-full shrink-0 justify-start gap-0 rounded-none border-b p-0",children:X.map(e=>{let a=e.icon;return(0,t.jsxs)(en.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)(a,{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)(ea.Zap,{className:"size-4 shrink-0 text-amber-500"}):(0,t.jsx)(es,{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)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.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,s.cn)("flex items-center gap-1.5 self-stretch px-3",eo.featureNodeStateConfig[l.state].labelClass),children:["running"===l.state?(0,t.jsx)(eu,{size:"sm",className:"shrink-0"}):(Z=eo.featureNodeStateConfig[l.state].icon,(0,t.jsx)(Z,{className:"size-3.5 shrink-0"})),eo.featureNodeStateConfig[l.state].label]}),"pending"===l.state&&K?(0,t.jsxs)("button",{type:"button",onClick:()=>K(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&&G?(0,t.jsxs)("button",{type:"button",onClick:()=>G(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)(et.RotateCcw,{className:"size-3.5"})," Retry"]}):"running"===l.state&&_?(0,t.jsxs)("button",{type:"button",onClick:()=>_(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)(E.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)(en.TabsContent,{value:"overview",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tw,{data:l,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:D,rebaseLoading:P,rebaseError:z})}),J.includes("prototype")?(0,t.jsx)(en.TabsContent,{value:"prototype",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(aw,{data:l,onSubmitFeedback:O,onPromote:B,onDiscard:U,isSubmitting:H})}):null,(0,t.jsx)(en.TabsContent,{value:"activity",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tL,{timings:ed.activity.data?.timings??null,loading:ed.activity.loading,error:ed.activity.error,rejectionFeedback:ed.activity.data?.rejectionFeedback})}),(0,t.jsx)(en.TabsContent,{value:"log",className:"mt-0 flex-1 overflow-hidden",children:(0,t.jsx)(an,{content:ei.content,isConnected:ei.isConnected,error:ei.error})}),(0,t.jsx)(en.TabsContent,{value:"plan",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(aj,{plan:ed.plan.data,loading:ed.plan.loading,error:ed.plan.error})}),J.includes("prd-review")?(0,t.jsx)(en.TabsContent,{value:"prd-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:m?(0,t.jsx)(ek,{data:m,selections:p??{},onSelect:h??(()=>void 0),onApprove:f??(()=>void 0),onReject:g,isProcessing:b,isRejecting:$,chatInput:F,onChatInputChange:L}):(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,J.includes("tech-decisions")?(0,t.jsx)(en.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)(eM,{data:j})}),(0,t.jsx)(aM,{onApprove:v??(()=>void 0),onReject:y,isProcessing:N,isRejecting:$,chatInput:F,onChatInputChange:L})]}):(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,J.includes("product-decisions")?(0,t.jsx)(en.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)(eD,{data:w}):(0,t.jsx)("p",{className:"text-muted-foreground p-4 text-center text-sm",children:"No product decisions available."})}):null,J.includes("merge-review")?(0,t.jsx)(en.TabsContent,{value:"merge-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:k?(0,t.jsx)(e6,{data:k,readOnly:"maintain"===l.lifecycle,onApprove:C??(()=>void 0),onReject:S,isProcessing:T,isRejecting:$,chatInput:F,onChatInputChange:L}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:T?(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)(V.AlertCircle,{className:"h-6 w-6"}),(0,t.jsx)("span",{children:"Merge review data unavailable"})]})})}):null,J.includes("chat")?(0,t.jsx)(en.TabsContent,{value:"chat",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(ak.ChatTab,{featureId:o,worktreePath:l.worktreePath})}):null]})})}function aM({onApprove:e,onReject:a,isProcessing:s,isRejecting:n,chatInput:l,onChatInputChange:i}){let{t:o}=(0,r.useTranslation)("web");return(0,t.jsx)(ew,{onReject:a,onApprove:e,approveLabel:o("featureDrawer.approvePlan"),revisionPlaceholder:"Ask AI to revise the plan...",isProcessing:s,isRejecting:n,chatInput:l,onChatInputChange:i})}var aI=e.i(90938),aA=e.i(13867),aD=e.i(24473);let aP=(0,h.createServerReference)("4076d13144ecee3f2f337674f73755f25a5ef425b6",h.callServer,void 0,h.findSourceMapURL,"rebaseFeature");var aE=e.i(99045);function az(e){return"exploring"===e.lifecycle?"prototype":"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 a$(e,t,s,r,n,i){let[o,d]=(0,a.useState)(!1),c=(0,a.useRef)(s),u=(0,a.useRef)(r);return c.current=s,u.current=r,(0,a.useEffect)(()=>{if(u.current(),!e)return;let a=!1;return d(!0),t(e).then(e=>{a||c.current(e)}).catch(()=>{!a&&n&&l.toast.error(n)}).finally(()=>{a||d(!1)}),()=>{a=!0}},[e,t,n,i]),o}let aF=(0,h.createServerReference)("40f3064b4affbfd9674d24786abdaa3448c46828b2",h.callServer,void 0,h.findSourceMapURL,"getFeatureDrawerData"),aL=(0,h.createServerReference)("402cd69fd3ec55fbc810bd57c9288bd921a4625a7d",h.callServer,void 0,h.findSourceMapURL,"getBranchSyncStatus"),aq=new Map;function aO({view:e,urlTab:h,interactiveAgentEnabled:$=!0}){var F;let L,q,O,B,U,V,W=(0,T.useFeatureFlags)(),{t:G}=(0,r.useTranslation)("web"),_=(0,n.useRouter)(),K=(0,R.useSoundAction)("reject"),[Z,Q]=(0,a.useState)(e);(0,a.useEffect)(()=>{Q(t=>"feature"===t.type&&"feature"===e.type&&t.node.featureId===e.node.featureId?{...e,node:{...t.node,...e.node}}:e)},[e]);let J="feature"===Z.type?Z.node:null,{events:X}=(0,A.useAgentEventsContext)(),Y=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(Y.current>X.length&&(Y.current=0),!J||X.length<=Y.current)return;let e=X.slice(Y.current);for(let t of(Y.current=X.length,(0,aE.resolveSseEventUpdates)(e)))t.featureId===J.featureId&&"deleting"!==J.state&&(void 0!==t.state||void 0!==t.lifecycle)&&Q(e=>{if("feature"!==e.type)return e;let a={...e.node,...void 0!==t.state&&{state:t.state},...void 0!==t.lifecycle&&{lifecycle:t.lifecycle}};return{...e,node:a,initialTab:az(a)}})},[X,J]);let ee=(0,n.usePathname)().startsWith("/feature/");F=J?.featureId??null,L=(0,a.useRef)(ee),q=(0,a.useRef)(!1),O=(0,a.useRef)(0),B=(0,a.useCallback)(async()=>{if(!F||q.current)return;q.current=!0;let e=O.current;try{let t=await aF(F);if(!t||e!==O.current)return;Q(e=>(function(e,t){if("feature"!==e.type)return e;let a={...e.node,...t},s=a.state!==e.node.state||a.lifecycle!==e.node.lifecycle;return{...e,node:a,initialTab:s?az(a):e.initialTab}})(e,t))}catch{}finally{q.current=!1}},[F,Q]),U=(0,a.useRef)(!1),(0,a.useEffect)(()=>{!ee||L.current&&U.current||(U.current=!0,O.current+=1,q.current=!1,B()),L.current=ee},[ee,B]),(0,a.useEffect)(()=>{if(!ee||!F)return;let e=setInterval(()=>{B()},15e3);return()=>clearInterval(e)},[ee,F,B]);let et=(0,a.useCallback)(()=>{_.push("/")},[_]),[ea,es]=(0,a.useState)(""),[er,en]=(0,a.useState)(null),[el,ei]=(0,a.useState)({}),[eo,ed]=(0,a.useState)({}),[ec,eu]=(0,a.useState)(null),[ex,em]=(0,a.useState)(void 0),[ep,eh]=(0,a.useState)(null),[ef,eg]=(0,a.useState)(!1),[eb,ej]=(0,a.useState)(!1),[ev,ey]=(0,a.useState)(!1),eN=`${J?.featureId}:${J?.state}`,ew=(0,a.useRef)(eN);(0,a.useEffect)(()=>{eN!==ew.current&&(ew.current=eN,ey(!1))},[eN]);let[ek,eC]=(0,a.useState)(!1),[eS,eT]=(0,a.useState)(!1),eR=(0,a.useRef)(!1),eM="feature"===Z.type?Z.initialTab:void 0;(0,a.useEffect)(()=>{es("")},[eM]);let eI=(0,a.useRef)(0),eA=(0,a.useRef)(J?.state),eD=(0,a.useRef)(J?.lifecycle);(J?.state!==eA.current||J?.lifecycle!==eD.current)&&(eA.current=J?.state,eD.current=J?.lifecycle,eI.current+=1);let eP=eI.current,eE=a$(J?.lifecycle==="requirements"&&J?.state==="action-required"?J.featureId:null,k,e=>{if(e.error)return void l.toast.error(e.error);if(e.questionnaire){en(e.questionnaire);let t={};for(let a of e.questionnaire.questions){let e=a.options.find(e=>e.recommended);e&&(t[a.id]=e.id)}ei(t),ed(t)}},()=>{ei({}),ed({}),en(null)},"Failed to load questionnaire",eP),ez=J?.lifecycle==="implementation"&&J?.state==="action-required"?J.featureId:null,e$=a$(ez,C,e=>{e.error?l.toast.error(e.error):e.techDecisions&&eu(e.techDecisions)},()=>eu(null),"Failed to load tech decisions",eP),eF=a$(ez,k,e=>{e.productDecisions&&em(e.productDecisions)},()=>em(void 0),void 0,eP),eL=a$(J?.lifecycle==="review"&&(J?.state==="action-required"||J?.state==="error")||J?.lifecycle==="maintain"&&J?.pr?J.featureId:null,S,e=>{"error"in e?l.toast.error(e.error):eh(e)},()=>eh(null),"Failed to load merge review data",eP),eq=ea.trim().length>0,eO=J?.lifecycle==="requirements"&&J?.state==="action-required"&&Object.keys(eo).some(e=>eo[e]!==el[e]),eB=(0,a.useCallback)(()=>{es(""),ei({...eo})},[eo]),{attemptClose:eU}=(0,M.useGuardedDrawerClose)({open:ee,isDirty:eq||eO,onClose:et,onReset:eB}),eH=(0,a.useCallback)(async(e,t,a=[],s)=>{if(J?.featureId){eR.current=!0,eT(!0);try{let r=a.map(e=>e.path).filter(Boolean),n=a.filter(e=>e.notes?.trim()),i=n.length>0?`${e}
|
|
3
3
|
|
|
4
4
|
Image notes:
|
|
5
|
-
${n.map(e=>`- @${e.path}: ${e.notes.trim()}`).join("\n")}`:e,o=await v(J.featureId,i,r);if(!o.rejected)return void l.toast.error(o.error??`Failed to reject ${t.toLowerCase()}`);K.play(),es(""),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("shep:feature-approved",{detail:{featureId:J.featureId}})),et(),s?.()}finally{eR.current=!1,eT(!1)}}},[J,et,K]),eV=(0,a.useCallback)((e,t)=>eH(e,"Requirements",t,()=>ei({})),[eH]),eW=(0,a.useCallback)((e,t)=>eH(e,"Plan",t),[eH]),eG=(0,a.useCallback)((e,t)=>eH(e,"Merge",t),[eH]),e_=(0,a.useCallback)(async e=>{if(!J?.featureId)return;let t=await f(J.featureId);t.approved?(es(""),l.toast.success(`${e} approved — agent resuming`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}})),et()):l.toast.error(t.error??`Failed to approve ${e.toLowerCase()}`)},[J,et]),eK=(0,a.useCallback)(async e=>{let t;if("feature"!==Z.type||!J)return;if(er){let e=[];for(let[t,a]of Object.entries(el)){let s=er.questions.find(e=>e.id===t),r=s?.options.find(e=>e.id===a);s&&r&&e.push({questionId:s.question,selectedOption:r.label})}t={approved:!0,changedSelections:e}}let a=await f(J.featureId,t);a.approved?(es(""),l.toast.success("Requirements approved — agent resuming"),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}})),ei({}),et()):l.toast.error(a.error??"Failed to approve requirements")},[Z,J,er,el,et]),eZ=(0,a.useCallback)(()=>e_("Plan"),[e_]),eQ=(0,a.useCallback)(()=>e_("Merge"),[e_]),eJ=(0,a.useCallback)(async(e,t,a,s)=>{eg(!0),ej(!1),window.dispatchEvent(new CustomEvent("shep:feature-delete-requested",{detail:{featureId:e,cleanup:t,cascadeDelete:a,closePr:s}})),_.push("/")},[_]),eX=(0,a.useCallback)(e=>{ey(!0),window.dispatchEvent(new CustomEvent("shep:feature-archive-requested",{detail:{featureId:e}})),_.push("/")},[_]),eY=(0,a.useCallback)(e=>{ey(!0),window.dispatchEvent(new CustomEvent("shep:feature-unarchive-requested",{detail:{featureId:e}})),_.push("/")},[_]),e0=(0,a.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("shep:feature-approved",{detail:{featureId:e}})),Q(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[]),e1=(0,a.useCallback)(async e=>{let t=await (0,j.stopFeature)(e);t.stopped?(l.toast.success("Agent stopped"),Q(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"error"}})):l.toast.error(t.error??"Failed to stop")},[]),e2=(0,a.useCallback)(async e=>{let t=await (0,b.startFeature)(e);t.error?l.toast.error(t.error):(l.toast.success("Feature started"),Q(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[]),e5=(0,a.useCallback)(async e=>{if(J?.featureId){eC(!0);try{let t=await y(J.featureId,e);if(!t.submitted)return void l.toast.error(t.error??"Failed to submit feedback");l.toast.success(`Feedback sent — generating iteration ${(t.iteration??0)+1}`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}}))}finally{eC(!1)}}},[J]),e3=(0,a.useCallback)(async e=>{if(J?.featureId){eC(!0);try{let t=await N(J.featureId,e);if(t.error)return void l.toast.error(t.error);l.toast.success(`Exploration promoted to ${"Fast"===e?"fast":"regular"} mode`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}}))}finally{eC(!1)}}},[J]),e4=(0,a.useCallback)(async()=>{if(J?.featureId){eC(!0);try{let e=await w(J.featureId);if(!e.discarded)return void l.toast.error(e.error??"Failed to discard exploration");l.toast.success("Exploration discarded"),window.dispatchEvent(new CustomEvent("shep:feature-delete-requested",{detail:{featureId:J.featureId,cleanup:!0}})),_.push("/")}finally{eC(!1)}}},[J,_]),e6=J?.repositoryPath&&J?.branch?{featureId:J.featureId,repositoryPath:J.repositoryPath,branch:J.branch,worktreePath:J.worktreePath,specPath:J.specPath}:null,e8=function(e){let[t,s]=(0,a.useState)(!1),[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),[p,h]=(0,a.useState)(null),[f,g]=(0,a.useState)(null),[b,j]=(0,a.useState)(null),[v,y]=(0,a.useState)(null),N=(0,a.useRef)(null),w=(0,a.useRef)(null),k=(0,a.useRef)(null),C=(0,a.useRef)(null),S=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=[N,w,k,C,S];return()=>{for(let t of e)t.current&&clearTimeout(t.current)}},[]);let T=(0,a.useCallback)(async(t,a,s,r,n)=>{if(e&&!n){r.current&&clearTimeout(r.current),a(!0),s(null);try{let a=await t({repositoryPath:e.repositoryPath,branch:e.branch});if(!a.success){let e=a.error??"An unexpected error occurred";s(e),r.current=setTimeout(()=>s(null),5e3)}}catch(e){s(e instanceof Error?e.message:"An unexpected error occurred"),r.current=setTimeout(()=>s(null),5e3)}finally{a(!1)}}},[e]);return{openInIde:(0,a.useCallback)(()=>T(aI.openIde,s,m,N,t),[T,t]),openInShell:(0,a.useCallback)(()=>T(aA.openShell,n,h,w,r),[T,r]),openFolder:(0,a.useCallback)(async()=>{if(e&&!l){k.current&&clearTimeout(k.current),i(!0),g(null);try{let t=e.worktreePath??e.repositoryPath,a=await (0,aD.openFolder)(t);if(!a.success){let e=a.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,a.useCallback)(async()=>{if(e?.specPath&&!o){C.current&&clearTimeout(C.current),d(!0),j(null);try{let t=await (0,aD.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,a.useCallback)(async()=>{if(e?.featureId&&!c){S.current&&clearTimeout(S.current),u(!0),y(null);try{let t=await aP(e.featureId);if(!t.success){let e=t.error??"An unexpected error occurred";y(e),S.current=setTimeout(()=>y(null),5e3)}}catch(e){y(e instanceof Error?e.message:"An unexpected error occurred"),S.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}}(e6),e9=W.gitRebaseSync&&J?.branch&&J?.remoteUrl?J.featureId:null,{data:e7,loading:te,error:tt,refresh:ta}=function(e){let[t,s]=(0,a.useState)(()=>{if(!e)return null;let t=aq.get(e);return t?t.data:null}),[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(null),o=(0,a.useRef)(e);o.current=e;let d=(0,a.useCallback)(async e=>{n(!0),i(null);try{let t=await aL(e);if(o.current!==e)return;if(t.success&&t.data){let a=t.data;aq.set(e,{data:a,timestamp:Date.now()}),s(a)}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,a.useEffect)(()=>{if(!e){s(null),i(null);return}let t=aq.get(e);t&&(s(t.data),Date.now()-t.timestamp<3e4)||d(e)},[e,d]),{data:t,loading:r,error:l,refresh:(0,a.useCallback)(()=>{e&&d(e)},[e,d])}}(e9),ts=(0,a.useRef)(e8.rebaseLoading);(0,a.useEffect)(()=>{!ts.current||e8.rebaseLoading||e8.rebaseError||ta(),ts.current=e8.rebaseLoading},[e8.rebaseLoading,e8.rebaseError,ta]);let tr=J?.repositoryPath&&J.branch?{targetId:J.featureId,targetType:"feature",repositoryPath:J.repositoryPath,branch:J.branch}:null,tn=(0,I.useDeployAction)(tr),tl="Booting"===tn.status||"Ready"===tn.status,[ti,to]=(0,a.useState)(!1),td=(0,a.useCallback)(()=>{J?.featureId&&(navigator.clipboard.writeText(J.featureId),to(!0),setTimeout(()=>to(!1),2e3))},[J?.featureId]);if(J){let e=J.featureId.slice(0,8),a="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";V=(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:[e6&&J?.state!=="done"?(0,t.jsx)(H,{actions:e8,repositoryPath:e6.repositoryPath,worktreePath:e6.worktreePath,showSpecs:!!e6.specPath}):null,e6&&J?.state!=="done"&&W.envDeploy&&tr?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r}),(0,t.jsx)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:tn.deployLoading||tn.stopLoading,onClick:tl?tn.stop:tn.deploy,className:(0,s.cn)("inline-flex size-7 items-center justify-center rounded-[3px] disabled:opacity-40",tl?"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":G(tl?"featureDrawer.stopDevServer":"featureDrawer.startDevServer"),children:tn.deployLoading||tn.stopLoading?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):tl?(0,t.jsx)(c.Square,{className:"size-4"}):(0,t.jsx)(d.Play,{className:"size-4"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G(tl?"featureDrawer.stopDevServer":"featureDrawer.startDevServer")})]})}),tl?(0,t.jsx)(P.DeploymentStatusBadge,{status:tn.status,url:tn.url,targetId:tr?.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)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:td,className:a,"aria-label":G("featureDrawer.copyFeatureId"),"data-testid":"feature-drawer-copy-id",children:ti?(0,t.jsx)(x.Check,{className:"size-4 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.copyFeatureId")})]})}),J.featureId?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r}),(0,t.jsxs)(E.TooltipProvider,{delayDuration:300,children:["archived"===J.state?(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ev,className:a,"data-testid":"feature-drawer-unarchive",onClick:()=>eY(J.featureId),children:ev?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(p.ArchiveRestore,{className:"size-3"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.unarchiveFeature")})]}):"deleting"!==J.state?(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ev,className:a,"data-testid":"feature-drawer-archive",onClick:()=>eX(J.featureId),children:ev?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(m.Archive,{className:"size-3"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.archiveFeature")})]}):null,(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ef,className:(0,s.cn)(a,"hover:bg-destructive/10 hover:text-destructive"),"data-testid":"feature-drawer-delete",onClick:()=>ej(!0),children:ef?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(o.Trash2,{className:"size-3"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.deleteFeature")})]})]}),(0,t.jsx)(z.DeleteFeatureDialog,{open:eb,onOpenChange:ej,onConfirm:(e,t,a)=>eJ(J.featureId,e,t,a),isDeleting:ef,featureName:J.name,featureId:J.featureId,hasChildren:J.hasChildren,hasOpenPr:!!J.pr&&"Open"===J.pr.status})]}):null]})]})})}let tc=null;if("feature"===Z.type&&J){let e={...J,..."error"===J.state&&{onRetry:e0},..."pending"===J.state&&{onStart:e2}};tc=(0,t.jsx)(aR,{featureName:J.name,headerContent:V,featureNode:e,featureId:J.featureId,initialTab:Z.initialTab,urlTab:h,sseEvents:X,prdData:er,prdSelections:el,onPrdSelect:(e,t)=>ei(a=>({...a,[e]:t})),onPrdApprove:eK,onPrdReject:eV,isPrdLoading:eE,techData:ec,onTechApprove:eZ,onTechReject:eW,isTechLoading:e$,productData:eF?null:ex,mergeData:ep,onMergeApprove:eQ,onMergeReject:eG,isMergeLoading:eL,syncStatus:e9?e7:void 0,syncLoading:te,syncError:tt,onRefreshSync:e9?ta:void 0,onRebaseOnMain:e9?e8.rebaseOnMain:void 0,rebaseLoading:e8.rebaseLoading,rebaseError:e8.rebaseError,isRejecting:eS,chatInput:ea,onChatInputChange:es,onSubmitFeedback:e5,onPromote:e3,onDiscardExploration:e4,isPrototypeSubmitting:ek,interactiveAgentEnabled:$,onRetry:e0,onStop:e1,onStart:e2})}return(0,t.jsx)(D.BaseDrawer,{open:ee,onClose:eU,size:"lg",modal:!1,"data-testid":"feature"===Z.type?"feature-drawer":"repository-drawer",children:tc})}e.s(["FeatureDrawerClient",()=>aO],36986)}]);
|
|
5
|
+
${n.map(e=>`- @${e.path}: ${e.notes.trim()}`).join("\n")}`:e,o=await v(J.featureId,i,r);if(!o.rejected)return void l.toast.error(o.error??`Failed to reject ${t.toLowerCase()}`);K.play(),es(""),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("shep:feature-approved",{detail:{featureId:J.featureId}})),et(),s?.()}finally{eR.current=!1,eT(!1)}}},[J,et,K]),eV=(0,a.useCallback)((e,t)=>eH(e,"Requirements",t,()=>ei({})),[eH]),eW=(0,a.useCallback)((e,t)=>eH(e,"Plan",t),[eH]),eG=(0,a.useCallback)((e,t)=>eH(e,"Merge",t),[eH]),e_=(0,a.useCallback)(async e=>{if(!J?.featureId)return;let t=await f(J.featureId);t.approved?(es(""),l.toast.success(`${e} approved — agent resuming`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}})),et()):l.toast.error(t.error??`Failed to approve ${e.toLowerCase()}`)},[J,et]),eK=(0,a.useCallback)(async e=>{let t;if("feature"!==Z.type||!J)return;if(er){let e=[];for(let[t,a]of Object.entries(el)){let s=er.questions.find(e=>e.id===t),r=s?.options.find(e=>e.id===a);s&&r&&e.push({questionId:s.question,selectedOption:r.label})}t={approved:!0,changedSelections:e}}let a=await f(J.featureId,t);a.approved?(es(""),l.toast.success("Requirements approved — agent resuming"),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}})),ei({}),et()):l.toast.error(a.error??"Failed to approve requirements")},[Z,J,er,el,et]),eZ=(0,a.useCallback)(()=>e_("Plan"),[e_]),eQ=(0,a.useCallback)(()=>e_("Merge"),[e_]),eJ=(0,a.useCallback)(async(e,t,a,s)=>{eg(!0),ej(!1),window.dispatchEvent(new CustomEvent("shep:feature-delete-requested",{detail:{featureId:e,cleanup:t,cascadeDelete:a,closePr:s}})),_.push("/")},[_]),eX=(0,a.useCallback)(e=>{ey(!0),window.dispatchEvent(new CustomEvent("shep:feature-archive-requested",{detail:{featureId:e}})),_.push("/")},[_]),eY=(0,a.useCallback)(e=>{ey(!0),window.dispatchEvent(new CustomEvent("shep:feature-unarchive-requested",{detail:{featureId:e}})),_.push("/")},[_]),e0=(0,a.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("shep:feature-approved",{detail:{featureId:e}})),Q(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[]),e1=(0,a.useCallback)(async e=>{let t=await (0,j.stopFeature)(e);t.stopped?(l.toast.success("Agent stopped"),Q(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"error"}})):l.toast.error(t.error??"Failed to stop")},[]),e2=(0,a.useCallback)(async e=>{let t=await (0,b.startFeature)(e);t.error?l.toast.error(t.error):(l.toast.success("Feature started"),Q(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[]),e5=(0,a.useCallback)(async e=>{if(J?.featureId){eC(!0);try{let t=await y(J.featureId,e);if(!t.submitted)return void l.toast.error(t.error??"Failed to submit feedback");l.toast.success(`Feedback sent — generating iteration ${(t.iteration??0)+1}`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}}))}finally{eC(!1)}}},[J]),e3=(0,a.useCallback)(async e=>{if(J?.featureId){eC(!0);try{let t=await N(J.featureId,e);if(t.error)return void l.toast.error(t.error);l.toast.success(`Exploration promoted to ${"Fast"===e?"fast":"regular"} mode`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:J.featureId}}))}finally{eC(!1)}}},[J]),e4=(0,a.useCallback)(async()=>{if(J?.featureId){eC(!0);try{let e=await w(J.featureId);if(!e.discarded)return void l.toast.error(e.error??"Failed to discard exploration");l.toast.success("Exploration discarded"),window.dispatchEvent(new CustomEvent("shep:feature-delete-requested",{detail:{featureId:J.featureId,cleanup:!0}})),_.push("/")}finally{eC(!1)}}},[J,_]),e6=J?.repositoryPath&&J?.branch?{featureId:J.featureId,repositoryPath:J.repositoryPath,branch:J.branch,worktreePath:J.worktreePath,specPath:J.specPath}:null,e8=function(e){let[t,s]=(0,a.useState)(!1),[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),[p,h]=(0,a.useState)(null),[f,g]=(0,a.useState)(null),[b,j]=(0,a.useState)(null),[v,y]=(0,a.useState)(null),N=(0,a.useRef)(null),w=(0,a.useRef)(null),k=(0,a.useRef)(null),C=(0,a.useRef)(null),S=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=[N,w,k,C,S];return()=>{for(let t of e)t.current&&clearTimeout(t.current)}},[]);let T=(0,a.useCallback)(async(t,a,s,r,n)=>{if(e&&!n){r.current&&clearTimeout(r.current),a(!0),s(null);try{let a=await t({repositoryPath:e.repositoryPath,branch:e.branch});if(!a.success){let e=a.error??"An unexpected error occurred";s(e),r.current=setTimeout(()=>s(null),5e3)}}catch(e){s(e instanceof Error?e.message:"An unexpected error occurred"),r.current=setTimeout(()=>s(null),5e3)}finally{a(!1)}}},[e]);return{openInIde:(0,a.useCallback)(()=>T(aI.openIde,s,m,N,t),[T,t]),openInShell:(0,a.useCallback)(()=>T(aA.openShell,n,h,w,r),[T,r]),openFolder:(0,a.useCallback)(async()=>{if(e&&!l){k.current&&clearTimeout(k.current),i(!0),g(null);try{let t=e.worktreePath??e.repositoryPath,a=await (0,aD.openFolder)(t);if(!a.success){let e=a.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,a.useCallback)(async()=>{if(e?.specPath&&!o){C.current&&clearTimeout(C.current),d(!0),j(null);try{let t=await (0,aD.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,a.useCallback)(async()=>{if(e?.featureId&&!c){S.current&&clearTimeout(S.current),u(!0),y(null);try{let t=await aP(e.featureId);if(!t.success){let e=t.error??"An unexpected error occurred";y(e),S.current=setTimeout(()=>y(null),5e3)}}catch(e){y(e instanceof Error?e.message:"An unexpected error occurred"),S.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}}(e6),e7=W.gitRebaseSync&&J?.branch&&J?.remoteUrl?J.featureId:null,{data:e9,loading:te,error:tt,refresh:ta}=function(e){let[t,s]=(0,a.useState)(()=>{if(!e)return null;let t=aq.get(e);return t?t.data:null}),[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(null),o=(0,a.useRef)(e);o.current=e;let d=(0,a.useCallback)(async e=>{n(!0),i(null);try{let t=await aL(e);if(o.current!==e)return;if(t.success&&t.data){let a=t.data;aq.set(e,{data:a,timestamp:Date.now()}),s(a)}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,a.useEffect)(()=>{if(!e){s(null),i(null);return}let t=aq.get(e);t&&(s(t.data),Date.now()-t.timestamp<3e4)||d(e)},[e,d]),{data:t,loading:r,error:l,refresh:(0,a.useCallback)(()=>{e&&d(e)},[e,d])}}(e7),ts=(0,a.useRef)(e8.rebaseLoading);(0,a.useEffect)(()=>{!ts.current||e8.rebaseLoading||e8.rebaseError||ta(),ts.current=e8.rebaseLoading},[e8.rebaseLoading,e8.rebaseError,ta]);let tr=J?.repositoryPath&&J.branch?{targetId:J.featureId,targetType:"feature",repositoryPath:J.repositoryPath,branch:J.branch}:null,tn=(0,I.useDeployAction)(tr),tl="Booting"===tn.status||"Ready"===tn.status,[ti,to]=(0,a.useState)(!1),td=(0,a.useCallback)(()=>{J?.featureId&&(navigator.clipboard.writeText(J.featureId),to(!0),setTimeout(()=>to(!1),2e3))},[J?.featureId]);if(J){let e=J.featureId.slice(0,8),a="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";V=(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:[e6&&J?.state!=="done"?(0,t.jsx)(H,{actions:e8,repositoryPath:e6.repositoryPath,worktreePath:e6.worktreePath,showSpecs:!!e6.specPath}):null,e6&&J?.state!=="done"&&W.envDeploy&&tr?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r}),(0,t.jsx)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:tn.deployLoading||tn.stopLoading,onClick:tl?tn.stop:tn.deploy,className:(0,s.cn)("inline-flex size-7 items-center justify-center rounded-[3px] disabled:opacity-40",tl?"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":G(tl?"featureDrawer.stopDevServer":"featureDrawer.startDevServer"),children:tn.deployLoading||tn.stopLoading?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):tl?(0,t.jsx)(c.Square,{className:"size-4"}):(0,t.jsx)(d.Play,{className:"size-4"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G(tl?"featureDrawer.stopDevServer":"featureDrawer.startDevServer")})]})}),tl?(0,t.jsx)(P.DeploymentStatusBadge,{status:tn.status,url:tn.url,targetId:tr?.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)(E.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:td,className:a,"aria-label":G("featureDrawer.copyFeatureId"),"data-testid":"feature-drawer-copy-id",children:ti?(0,t.jsx)(x.Check,{className:"size-4 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.copyFeatureId")})]})}),J.featureId?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r}),(0,t.jsxs)(E.TooltipProvider,{delayDuration:300,children:["archived"===J.state?(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ev,className:a,"data-testid":"feature-drawer-unarchive",onClick:()=>eY(J.featureId),children:ev?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(p.ArchiveRestore,{className:"size-3"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.unarchiveFeature")})]}):"deleting"!==J.state?(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ev,className:a,"data-testid":"feature-drawer-archive",onClick:()=>eX(J.featureId),children:ev?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(m.Archive,{className:"size-3"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.archiveFeature")})]}):null,(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ef,className:(0,s.cn)(a,"hover:bg-destructive/10 hover:text-destructive"),"data-testid":"feature-drawer-delete",onClick:()=>ej(!0),children:ef?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(o.Trash2,{className:"size-3"})})}),(0,t.jsx)(E.TooltipContent,{side:"bottom",className:"text-xs",children:G("featureDrawer.deleteFeature")})]})]}),(0,t.jsx)(z.DeleteFeatureDialog,{open:eb,onOpenChange:ej,onConfirm:(e,t,a)=>eJ(J.featureId,e,t,a),isDeleting:ef,featureName:J.name,featureId:J.featureId,hasChildren:J.hasChildren,hasOpenPr:!!J.pr&&"Open"===J.pr.status})]}):null]})]})})}let tc=null;if("feature"===Z.type&&J){let e={...J,..."error"===J.state&&{onRetry:e0},..."pending"===J.state&&{onStart:e2}};tc=(0,t.jsx)(aR,{featureName:J.name,headerContent:V,featureNode:e,featureId:J.featureId,initialTab:Z.initialTab,urlTab:h,sseEvents:X,prdData:er,prdSelections:el,onPrdSelect:(e,t)=>ei(a=>({...a,[e]:t})),onPrdApprove:eK,onPrdReject:eV,isPrdLoading:eE,techData:ec,onTechApprove:eZ,onTechReject:eW,isTechLoading:e$,productData:eF?null:ex,mergeData:ep,onMergeApprove:eQ,onMergeReject:eG,isMergeLoading:eL,syncStatus:e7?e9:void 0,syncLoading:te,syncError:tt,onRefreshSync:e7?ta:void 0,onRebaseOnMain:e7?e8.rebaseOnMain:void 0,rebaseLoading:e8.rebaseLoading,rebaseError:e8.rebaseError,isRejecting:eS,chatInput:ea,onChatInputChange:es,onSubmitFeedback:e5,onPromote:e3,onDiscardExploration:e4,isPrototypeSubmitting:ek,interactiveAgentEnabled:$,onRetry:e0,onStop:e1,onStart:e2})}return(0,t.jsx)(D.BaseDrawer,{open:ee,onClose:eU,size:"lg",modal:!1,"data-testid":"feature"===Z.type?"feature-drawer":"repository-drawer",children:tc})}e.s(["FeatureDrawerClient",()=>aO],36986)}]);
|