@shepai/cli 1.182.0 → 1.182.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts +8 -1
- package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts.map +1 -1
- package/dist/packages/core/src/application/use-cases/repositories/import-github-repository.use-case.d.ts +13 -1
- package/dist/packages/core/src/application/use-cases/repositories/import-github-repository.use-case.d.ts.map +1 -1
- package/dist/packages/core/src/application/use-cases/repositories/import-github-repository.use-case.js +44 -5
- package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts +1 -0
- package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +15 -0
- 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 +2 -2
- package/web/.next/required-server-files.json +2 -2
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +32 -32
- 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 +30 -30
- 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 +33 -33
- 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 +41 -41
- 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 +41 -41
- 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 +31 -31
- 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 +31 -31
- 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 +30 -30
- 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 +33 -33
- 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 +41 -41
- 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 +41 -41
- 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 +30 -30
- 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 +31 -31
- 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 +31 -31
- 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 +7 -7
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +15 -15
- package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/features/page/server-reference-manifest.json +7 -7
- package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +15 -15
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +13 -13
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +7 -7
- 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/[root-of-the-server]__c8f90b29._.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]__013a0318._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1925bef0._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__4ee8be85._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e265da61._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0277d3b5._.js +1 -1
- package/web/.next/server/chunks/ssr/_0277d3b5._.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/_5dec4047._.js +3 -0
- package/web/.next/server/chunks/ssr/{_a7184dfa._.js.map → _5dec4047._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_21cc662b._.js → _73aa3b20._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_21cc662b._.js.map → _73aa3b20._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_177d29c6._.js → _774cbf7d._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_177d29c6._.js.map → _774cbf7d._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_503102fc._.js → _81e7a131._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_503102fc._.js.map → _81e7a131._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_946a7fc6._.js +1 -1
- package/web/.next/server/chunks/ssr/_946a7fc6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_575fe3ee._.js → _d75dcb43._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_575fe3ee._.js.map → _d75dcb43._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_eff1b518._.js +1 -1
- package/web/.next/server/chunks/ssr/_eff1b518._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f227429a._.js +1 -1
- package/web/.next/server/chunks/ssr/_f227429a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f86fc1bf._.js +1 -1
- package/web/.next/server/chunks/ssr/_f86fc1bf._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f8c55130._.js +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/src_presentation_web_36f2bc45._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +3 -3
- package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js.map +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_common_base-drawer_base-drawer_tsx_97dfbbc8._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.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/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.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 +54 -54
- package/web/.next/static/chunks/{87a0df5389e06641.js → 2af89379fde6831d.js} +1 -1
- package/web/.next/static/chunks/{b87904ecdddde972.js → 3a71cab38909921e.js} +1 -1
- package/web/.next/static/chunks/{e4f0ca20b62bd66f.js → 4e53adb5d07b7e3d.js} +1 -1
- package/web/.next/static/chunks/{ceff12f8a2e5bc08.js → 503d2e86f83285f9.js} +1 -1
- package/web/.next/static/chunks/{8c9016ab8c1f6204.js → 5e7ac3508bef115f.js} +1 -1
- package/web/.next/static/chunks/761a7c542b358739.js +1 -0
- package/web/.next/static/chunks/{6afd16b2fe544054.js → 7bf6ed16395220c4.js} +2 -2
- package/web/.next/static/chunks/{be2e80436bc15812.js → 996e4ea45364bf3c.js} +2 -2
- package/web/.next/static/chunks/{b4aa3a83f2451e07.js → 9e9b60f127270dfd.js} +1 -1
- package/web/.next/static/chunks/{ac22076c64634ac1.js → a2601dbbcb657c7d.js} +1 -1
- package/web/.next/static/chunks/{de7de1db2a8788dd.js → a31f2264cedb23e9.js} +1 -1
- package/web/.next/static/chunks/{a2531137c7d36d54.js → abf7d1b66555b758.js} +1 -1
- package/web/.next/static/chunks/{33dc7a1041f4ab64.js → d488e6b5cbbc6833.js} +1 -1
- package/web/.next/static/chunks/{2424ab50273fe1d9.js → d984d1d8d506291c.js} +1 -1
- package/web/.next/static/chunks/e843a0d8e8c645c4.js +1 -0
- package/web/.next/static/chunks/{7604027076448f2b.js → f5ed0232d50b1ec8.js} +1 -1
- package/web/.next/server/chunks/ssr/_a7184dfa._.js +0 -3
- package/web/.next/static/chunks/94e8559ae19a16e1.js +0 -1
- package/web/.next/static/chunks/a0cfca1e5fd467e9.js +0 -1
- /package/web/.next/static/{EVCmRtpgNX9ebXGb-bV1G → 6GBQ7MHEYpZbJzqULwvXh}/_buildManifest.js +0 -0
- /package/web/.next/static/{EVCmRtpgNX9ebXGb-bV1G → 6GBQ7MHEYpZbJzqULwvXh}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{EVCmRtpgNX9ebXGb-bV1G → 6GBQ7MHEYpZbJzqULwvXh}/_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),s=e.i(79054),r=e.i(31777);e.i(41001);var a=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)("60af37e525b8b54b8fac4ed677859d776efe60828a",h.callServer,void 0,h.findSourceMapURL,"approveFeature");var g=e.i(26797),b=e.i(61273),j=e.i(9583);let v=(0,h.createServerReference)("703d3d532cbc74a0c05751f7a20fd949bc5e141515",h.callServer,void 0,h.findSourceMapURL,"rejectFeature"),y=(0,h.createServerReference)("40b97ed8d87db3542e339020bb80766c85c34e759a",h.callServer,void 0,h.findSourceMapURL,"getFeatureArtifact"),N=(0,h.createServerReference)("40377e3cfeeb2d2031c5aa8a570ab518dd3dcca4e2",h.callServer,void 0,h.findSourceMapURL,"getResearchArtifact"),w=(0,h.createServerReference)("403f16255afedb924b5acc4ef49a66308457eca3bf",h.callServer,void 0,h.findSourceMapURL,"getMergeReviewData");var k=e.i(75921),C=e.i(8361),T=e.i(30153),S=e.i(8537),R=e.i(39443);e.i(1650);var M=e.i(11495);e.i(99348);var I=e.i(5259),P=e.i(2828);e.i(31566);var A=e.i(65104),z=e.i(8986),$=e.i(38573),E=e.i(19933),D=e.i(70471),L=e.i(51251);let F="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40";function q({loading:e,error:s,icon:r}){return e?(0,t.jsx)(i.Loader2,{className:"size-3.5 animate-spin"}):s?(0,t.jsx)(L.CircleAlert,{className:"text-destructive size-3.5"}):(0,t.jsx)(r,{className:"size-4"})}function O({actions:e,repositoryPath:r,worktreePath:a,showSpecs:n}){let[l,i]=(0,s.useState)(!1);return(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInIde,disabled:e.ideLoading,"aria-label":"Open in IDE",children:(0,t.jsx)(q,{loading:e.ideLoading,error:e.ideError,icon:z.Code2})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open in IDE"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInShell,disabled:e.shellLoading,"aria-label":"Open terminal",children:(0,t.jsx)(q,{loading:e.shellLoading,error:e.shellError,icon:$.Terminal})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open terminal"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openFolder,disabled:e.folderLoading,"aria-label":"Open folder",children:(0,t.jsx)(q,{loading:e.folderLoading,error:e.folderError,icon:E.FolderOpen})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open folder"})]}),n?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openSpecsFolder,disabled:e.specsLoading,"aria-label":"Open specs",children:(0,t.jsx)(q,{loading:e.specsLoading,error:e.specsError,icon:D.FileText})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open specs"})]}):null,(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:()=>{navigator.clipboard.writeText(a??r),i(!0),setTimeout(()=>i(!1),2e3)},"aria-label":"Copy path",children:l?(0,t.jsx)(x.Check,{className:"size-3.5 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:l?"Copied!":"Copy path"})]})]})})}var B=e.i(79687),U=e.i(16489),V=e.i(74294),W=e.i(3645);let H=(0,W.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),G=(0,W.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),_=(0,W.default)("file-check",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var K=e.i(18532),Z=e.i(93192);let Q=(0,W.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var J=e.i(48109),X=e.i(38227),Y=e.i(53360),ee=e.i(76874),et=e.i(68304);let es=(0,h.createServerReference)("409912f31cd47efdfb7670eb11b3f1638989f5725c",h.callServer,void 0,h.findSourceMapURL,"getFeaturePhaseTimings"),er=(0,h.createServerReference)("40deaec0cd3d31e5f5bf3a66680796ca05a030d45b",h.callServer,void 0,h.findSourceMapURL,"getFeaturePlan");e.i(47506);var ea=e.i(2929);let en=(0,e.i(94237).cva)("inline-block shrink-0",{variants:{size:{sm:"size-5",md:"size-8",lg:"size-12"}},defaultVariants:{size:"md"}}),el=[{r:9,spline:"0.12 0 0.04 1",opacity:1},{r:8.2,spline:"0.16 0 0.08 1",opacity:.95},{r:7.4,spline:"0.20 0 0.12 1",opacity:.9},{r:6.6,spline:"0.25 0 0.16 1",opacity:.84},{r:5.8,spline:"0.30 0 0.20 1",opacity:.76},{r:5,spline:"0.36 0 0.25 1",opacity:.67},{r:4.2,spline:"0.42 0 0.31 1",opacity:.56},{r:3.4,spline:"0.48 0 0.37 1",opacity:.44},{r:2.6,spline:"0.55 0 0.44 1",opacity:.32},{r:1.8,spline:"0.62 0 0.52 1",opacity:.2},{r:1,spline:"0.70 0 0.60 1",opacity:.1}];function ei({className:e,size:s="md",duration:a=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,r.cn)(en({size:s}),e),...n,children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:"comet-gooey",x:"-100%",y:"-100%",width:"300%",height:"300%",colorInterpolationFilters:"sRGB",children:[(0,t.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"2.5"}),(0,t.jsx)("feColorMatrix",{mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 -30",result:"goo"})]})}),(0,t.jsxs)("g",{filter:"url(#comet-gooey)",children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 50 50",to:"360 50 50",dur:`${a}s`,repeatCount:"indefinite"}),el.map(e=>(0,t.jsxs)("g",{children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"spline",values:"0 50 50;360 50 50",keyTimes:"0;1",keySplines:e.spline,dur:"1s",repeatCount:"indefinite"}),(0,t.jsx)("circle",{cx:"50",cy:"18",r:e.r,fill:"currentColor",opacity:e.opacity})]},e.r)),(0,t.jsxs)("circle",{cx:"50",cy:"50",r:"4",fill:"currentColor",opacity:"0.15",children:[(0,t.jsx)("animate",{attributeName:"r",values:"3;5;3",dur:"2s",repeatCount:"indefinite"}),(0,t.jsx)("animate",{attributeName:"opacity",values:"0.1;0.25;0.1",dur:"2s",repeatCount:"indefinite"})]})]})]})}var eo=e.i(11345),ed=e.i(76016),ec=e.i(35364),eu=e.i(81846),ex=e.i(16868);let em=(0,W.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);var ep=e.i(58481),eh=e.i(48306);e.i(50032);var ef=e.i(86254),eg=e.i(42076);let eb=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]);function ej({onReject:e,onApprove:n,approveLabel:l,approveVariant:i="default",revisionPlaceholder:o,isProcessing:d=!1,isRejecting:c=!1,children:u,chatInput:m,onChatInputChange:p}){let{t:h}=(0,a.useTranslation)("web"),f="warning"===i,g=f?ep.AlertTriangle:x.Check,b=f?"bg-orange-500/85":"bg-blue-500/85",[j,v]=(0,s.useState)(""),y=m??j,N=p??v,w=(0,C.useSoundAction)("approve"),k=d||c,[T,S]=(0,s.useState)([]),[R,M]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null),[z,$]=(0,s.useState)(!1),[E,D]=(0,s.useState)(!1),[L,F]=(0,s.useState)(!1),q=y.trim().length>0,O=q?z||E&&L:!z,B=(0,s.useRef)(0),U=(0,s.useRef)(crypto.randomUUID()),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){("Control"===e.key||"Meta"===e.key)&&D(!0),"Shift"===e.key&&F(!0)}function t(e){("Control"===e.key||"Meta"===e.key)&&D(!1),"Shift"===e.key&&F(!1)}function s(){D(!1),F(!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",s),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",s)}},[]);let W=(0,s.useCallback)(async e=>{for(let t of(A(null),e)){if(t.size>0xa00000)return void A(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!eb.has(e))return void A(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();S(s=>[...s,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let s=new FormData;s.append("file",t),s.append("sessionId",U.current);let r=await fetch("/api/attachments/upload",{method:"POST",body:s});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));S(t=>t.filter(t=>t.id!==e)),A(t.error??"Upload failed");return}let a=await r.json();S(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{S(t=>t.filter(t=>t.id!==e)),A("Upload failed")}}},[]),H=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,1===B.current&&M(!0)},[]),G=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,0===B.current&&M(!1)},[]),_=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),K=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&W(t)},[W]),Z=(0,s.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let s=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&s.push(t)}s.length>0&&(e.preventDefault(),W(s))},[W]),Q=(0,s.useCallback)(async()=>{try{let e=await (0,eg.pickFiles)();e&&S(t=>{let s=new Set(t.map(e=>e.path)),r=e.filter(e=>!s.has(e.path)).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,mimeType:"application/octet-stream",path:e.path}));return r.length>0?[...t,...r]:t})}catch{}},[]),J=(0,s.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),X=(0,s.useCallback)((e,t)=>{S(s=>s.map(s=>s.id===e?{...s,notes:t}:s))},[]),Y=(0,s.useCallback)(()=>{N(""),S([]),A(null)},[N]),ee=(0,s.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),V.current?.requestSubmit())},[]),et="u">typeof navigator&&/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl";return(0,t.jsxs)("div",{className:"border-border shrink-0 border-t",children:[u,e?(0,t.jsx)(P.TooltipProvider,{delayDuration:400,children:(0,t.jsx)("form",{ref:V,onSubmit:function(t){t.preventDefault();let s=y.trim();if(O)w.play(),n(),Y();else{if(!s||!e)return;e(s,T.filter(e=>!e.loading)),Y()}},className:"p-3",children:(0,t.jsx)("div",{role:"region","aria-label":h("createDrawer.fileDropZone"),"data-drag-over":R?"true":"false",onDragEnter:H,onDragLeave:G,onDragOver:_,onDrop:K,className:(0,r.cn)("rounded-md border-2 border-transparent transition-colors",R&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{className:"border-input focus-within:ring-ring/50 focus-within:border-ring flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow] focus-within:ring-[3px]",children:[(0,t.jsx)(eh.Textarea,{placeholder:o??"Ask AI to revise...","aria-label":o??"Ask AI to revise...",disabled:k,value:y,onChange:e=>N(e.target.value),onKeyDown:ee,onPaste:Z,rows:1,className:"max-h-[35dvh] min-h-9 flex-1 resize-none overflow-y-auto rounded-none border-0 py-2 shadow-none focus-visible:ring-0","data-testid":"drawer-chat-input"}),T.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:T.map(e=>(0,t.jsx)(ef.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>J(e.id),disabled:k,loading:e.loading,notes:e.notes,onNotesChange:t=>X(e.id,t)},e.id))}),I?(0,t.jsx)("p",{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)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:Q,disabled:k,"aria-label":h("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(ex.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"top",children:h("chat.attachFiles")})]}),(0,t.jsx)("div",{onMouseLeave:()=>$(!1),children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"submit",disabled:k,"data-testid":"drawer-action-submit",className:(0,r.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&&E&&!L?"border-primary bg-muted ring-primary/30 shadow-sm ring-1":"border-border bg-muted/50 hover:bg-muted shadow-sm"),children:[(0,t.jsx)("div",{className:(0,r.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,r.cn)("absolute inset-0 z-10 flex items-center justify-center gap-2 pe-8 transition-opacity duration-300",O?"opacity-0":"opacity-100"),children:[(0,t.jsx)(em,{className:"h-4 w-4 shrink-0"}),"Reject"]}),(0,t.jsxs)("span",{className:(0,r.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,r.cn)(`border-input/60 absolute inset-y-0 right-0 z-20 flex w-8 cursor-pointer items-center justify-center rounded-e-[5px] border-s ${b} transition-opacity duration-300`,!q&&!z&&"pointer-events-none opacity-0"),onMouseEnter:()=>$(!0),children:(0,t.jsx)(eo.ChevronLeft,{className:"h-4 w-4 text-white"})})]})}),f?null:(0,t.jsx)(P.TooltipContent,{side:"top",children:O?l:h("drawerActionBar.sendRevisionFeedback")})]})})]})]})})})}):(0,t.jsx)("div",{className:"flex items-center gap-2 px-4 pb-4",children:(0,t.jsx)(ec.Button,{type:"button",className:"flex-1",disabled:k,onClick:()=>{w.play(),n()},children:l})})]})}function ev({data:e,selections:a,onSelect:n,onApprove:l,onReject:i,isProcessing:o=!1,isRejecting:d=!1,showHeader:c=!1,chatInput:u,onChatInputChange:x}){let{question:m,context:p,questions:h,finalAction:f}=e,[g,b]=(0,s.useState)(0),j=(0,C.useSoundAction)("select"),v=(0,C.useSoundAction)("navigate"),y=h.length,N=g===y-1,w=h[g],k=(0,s.useMemo)(()=>Object.keys(a).length,[a]),T=(0,s.useCallback)((e,t)=>{j.play(),n(e,t),N||setTimeout(()=>b(e=>e+1),250)},[n,N,j]);return 0===y?null:(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[c?(0,t.jsxs)("div",{className:"border-border flex items-start gap-3 border-b pb-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full bg-amber-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground mb-1.5 text-sm font-bold",children:m}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:p})]})]}):null,(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("label",{className:"text-foreground min-w-0 flex-1 text-sm font-semibold",children:[g+1,". ",w.question]}),(0,t.jsx)("div",{className:"mt-1.5 flex shrink-0 gap-1",children:h.map((e,s)=>(0,t.jsx)("button",{type:"button","aria-label":`Go to question ${s+1}`,className:(0,r.cn)("h-1.5 rounded-full transition-all duration-200",s===g?"bg-primary w-4":"w-1.5",s!==g&&a[e.id]?"bg-primary/50":"",s===g||a[e.id]?"":"bg-muted-foreground/25"),onClick:()=>{v.play(),b(s)}},e.id))})]}),(0,t.jsx)("div",{className:"space-y-2",children:w.options.map((e,s)=>{let n=a[w.id]===e.id,l=String.fromCharCode(65+s);return(0,t.jsx)("button",{type:"button",className:(0,r.cn)("border-border w-full overflow-hidden rounded-md border px-3 py-3 text-start text-xs transition-all","hover:border-primary/70 hover:bg-primary/5 group",n&&"border-primary bg-primary/5",e.isNew&&"animate-option-highlight"),disabled:o,onClick:()=>T(w.id,e.id),children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("span",{className:"text-muted-foreground mt-0.5 font-mono text-xs",children:[l,"."]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-foreground mb-0.5 text-xs font-semibold wrap-break-word",children:e.label}),(0,t.jsx)("div",{className:"text-muted-foreground text-xs leading-snug",children:e.rationale})]}),e.recommended||e.isNew?(0,t.jsx)("div",{className:"shrink-0 pt-0.5",children:e.recommended?(0,t.jsx)(eu.Badge,{className:"px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):(0,t.jsx)(eu.Badge,{className:"border-transparent bg-emerald-600 px-1.5 py-0 text-[10px] whitespace-nowrap text-white hover:bg-emerald-600/80",children:"New"})}):null]})},e.id)})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:0===g||o,onClick:()=>{v.play(),b(e=>e-1)},children:[(0,t.jsx)(eo.ChevronLeft,{className:"me-1 h-4 w-4"}),"Previous"]}),N?null:(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>{v.play(),b(e=>e+1)},children:[a[w.id]?"Next":"Skip",(0,t.jsx)(ed.ChevronRight,{className:"ms-1 h-4 w-4"})]})]})]}),(0,t.jsx)(ej,{onReject:i,onApprove:()=>l(f.id),approveLabel:f.label,revisionPlaceholder:"Ask AI to refine requirements...",isProcessing:o,isRejecting:d,chatInput:u,onChatInputChange:x,children:(0,t.jsx)("div",{className:(0,r.cn)("bg-muted h-1.5 overflow-hidden",k>0&&k<y||o?"opacity-100":"opacity-0","transition-opacity duration-200"),"data-testid":"progress-bar-container",children:o?(0,t.jsx)("div",{className:"bg-primary animate-indeterminate-progress h-full w-1/3"}):(0,t.jsx)("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${y>0?k/y*100:0}%`},"data-testid":"progress-bar"})})})]})}var ey=e.i(427);let eN=(0,W.default)("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]),ew={p:({children:e})=>(0,t.jsx)("p",{className:"text-muted-foreground mb-2 text-xs leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"text-foreground font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:s})=>s?(0,t.jsx)("code",{className:`${s} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-muted my-2 overflow-x-auto rounded-lg border p-3",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"text-muted-foreground mb-2 list-disc space-y-1 ps-4 text-xs",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"text-muted-foreground mb-2 list-decimal space-y-1 ps-4 text-xs",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"leading-relaxed",children:e}),a:({children:e,href:s})=>(0,t.jsx)("a",{href:s,className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e})};function ek({decision:e,index:r}){let[a,n]=(0,s.useState)(!1),l=(0,C.useSoundAction)("expand"),i=(0,C.useSoundAction)("collapse");return(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:r+1}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.title}),(0,t.jsx)("p",{className:"text-muted-foreground mt-0.5 text-xs",children:e.chosen})]})]}),"decisionName"in e&&e.decisionName?(0,t.jsx)(eu.Badge,{variant:"secondary",className:"bg-primary/10 text-primary shrink-0",children:e.decisionName}):null]}),e.rationale?(0,t.jsx)(ey.default,{components:ew,children:e.rationale}):null]}),e.rejected.length>0?(0,t.jsxs)("div",{className:"border-border border-t",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{a?i.play():l.play(),n(e=>!e)},className:"text-muted-foreground hover:bg-muted/50 flex w-full items-center gap-1.5 px-4 py-3 text-xs font-medium transition-colors",children:[(0,t.jsx)(ed.ChevronRight,{className:`h-3.5 w-3.5 transition-transform ${a?"rotate-90":""}`}),(0,t.jsx)(ee.Layers,{className:"h-3.5 w-3.5"}),"Other Options Considered (",e.rejected.length,")"]}),a?(0,t.jsx)("div",{className:"space-y-1.5 px-4 pb-3",children:e.rejected.map(e=>(0,t.jsx)("div",{className:"bg-primary/5 rounded-md px-3 py-2",children:(0,t.jsx)("span",{className:"text-foreground text-xs",children:e})},e))}):null]}):null]})}function eC({data:e}){let{summary:s,decisions:r}=e;return 0===r.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:"Technical Implementation Plan Review"}),s?(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,t.jsx)(eN,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Technical Decisions"})]}),r.map((e,s)=>(0,t.jsx)(ek,{decision:e,index:s},e.title))]})}var eT=e.i(41698);function eS({item:e,index:s}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsx)("div",{className:"space-y-2 px-4 py-3",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:s+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.question}),(0,t.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,t.jsx)("p",{className:"text-muted-foreground min-w-0 truncate text-xs",children:e.selectedOption}),e.wasRecommended?(0,t.jsx)(eu.Badge,{className:"shrink-0 px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):null]})]})]})})})}function eR({data:e}){let{questions:s}=e;return 0===s.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eT.ClipboardList,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Product Decisions"})]}),s.map((e,s)=>(0,t.jsx)(eS,{item:e,index:s},e.question))]})}var eM=e.i(30702);let eI=(0,W.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);var eP=e.i(48923),eA=e.i(49228);let ez=(0,W.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),e$=(0,W.default)("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),eE=(0,W.default)("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var eD=e.i(81181),eL=e.i(99105),eF=e.i(35e3),eq=e.i(30090),eq=eq,eO=e.i(17406);function eB({status:e}){switch(e){case eO.CiStatus.Success:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)(eF.CheckCircle2,{className:"me-1 h-3.5 w-3.5"}),"Passing"]});case eO.CiStatus.Pending:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-yellow-50 text-yellow-700 hover:bg-yellow-50",children:[(0,t.jsx)(i.Loader2,{className:"me-1 h-3.5 w-3.5 animate-spin"}),"Pending"]});case eO.CiStatus.Failure:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-red-50 text-red-700 hover:bg-red-50",children:[(0,t.jsx)(eq.default,{className:"me-1 h-3.5 w-3.5"}),"Failing"]})}}var eU=e.i(12919);let eV=(0,W.default)("file-minus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);var eW=e.i(35749);let eH={added:{icon:eU.FilePlus,label:"A",className:"text-green-600"},modified:{icon:eW.FileEdit,label:"M",className:"text-amber-600"},deleted:{icon:eV,label:"D",className:"text-red-600"},renamed:{icon:eW.FileEdit,label:"R",className:"text-blue-600"}};function eG({status:e}){let s=eH[e],a=s.icon;return(0,t.jsx)(a,{className:(0,r.cn)("h-3.5 w-3.5 shrink-0",s.className)})}function e_({hunk:e}){return(0,t.jsxs)("div",{className:"border-border border-t first:border-t-0",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-muted-foreground px-3 py-1 font-mono text-[10px]",children:e.header}),(0,t.jsx)("div",{className:"font-mono text-[11px] leading-[18px]",children:e.lines.map(e=>(0,t.jsxs)("div",{className:(0,r.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,r.cn)("w-4 shrink-0 text-center select-none","added"===e.type&&"text-green-700 dark:text-green-400","removed"===e.type&&"text-red-700 dark:text-red-400"),children:"added"===e.type?"+":"removed"===e.type?"-":" "}),(0,t.jsx)("span",{className:"min-w-0 flex-1 pe-2 break-all whitespace-pre-wrap",children:e.content})]},`${e.type}-${e.oldNumber??""}-${e.newNumber??""}`))})]})}function eK({file:e}){let[a,n]=(0,s.useState)(!1),l=e.path.split("/").pop()??e.path,i=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,t.jsxs)("div",{className:"border-border border-b last:border-b-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(!a),className:"hover:bg-muted/50 flex w-full items-center gap-2 px-3 py-2 text-start",children:[(0,t.jsx)(ed.ChevronRight,{className:(0,r.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform duration-150",a&&"rotate-90")}),(0,t.jsx)(eG,{status:e.status}),(0,t.jsx)("span",{className:"text-foreground min-w-0 flex-1 truncate text-xs",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[i,"/"]}),l]}):l}),e.oldPath?(0,t.jsxs)("span",{className:"text-muted-foreground truncate text-[10px]",children:["← ",e.oldPath.split("/").pop()]}):null,(0,t.jsxs)("span",{className:"shrink-0 text-[10px]",children:[e.additions>0?(0,t.jsxs)("span",{className:"text-green-600",children:["+",e.additions]}):null,e.additions>0&&e.deletions>0?" ":null,e.deletions>0?(0,t.jsxs)("span",{className:"text-red-600",children:["-",e.deletions]}):null]})]}),a&&e.hunks.length>0?(0,t.jsx)("div",{className:"border-border overflow-x-auto border-t",children:e.hunks.map(e=>(0,t.jsx)(e_,{hunk:e},e.header))}):null]})}function eZ({fileDiffs:e}){return 0===e.length?null:(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)(D.FileText,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changed Files"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:["(",e.length,")"]})]})}),(0,t.jsx)("div",{className:"border-border border-t",children:e.map(e=>(0,t.jsx)(eK,{file:e},`${e.status}-${e.path}`))})]})}let eQ={Screenshot:e$,Video:eE,TestOutput:D.FileText,TerminalRecording:$.Terminal},eJ=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp"]),eX=new Set([".mp4",".webm",".mov"]);function eY({evidence:e}){var r,a;let n,[l,i]=(0,s.useState)(!0),o=eQ[e.type]??e$,d=(n=(r=e.relativePath).lastIndexOf("."))>=0?r.slice(n).toLowerCase():"",c=(a=e.relativePath,`/api/evidence?path=${encodeURIComponent(a)}`),u="Screenshot"===e.type||eJ.has(d),x="Video"===e.type||eX.has(d),m="TestOutput"===e.type||"TerminalRecording"===e.type;return(0,t.jsxs)("li",{className:"border-border rounded-md border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(!l),className:"flex w-full cursor-pointer items-center gap-2.5 px-3 py-2.5 text-start",children:[l?(0,t.jsx)(eL.ChevronDown,{className:"text-muted-foreground h-3 w-3 shrink-0"}):(0,t.jsx)(ed.ChevronRight,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)(o,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"text-foreground text-xs font-medium",children:e.description}),e.taskRef?(0,t.jsxs)("span",{className:"text-muted-foreground ms-1.5 text-[10px]",children:["(",e.taskRef,")"]}):null]}),(0,t.jsx)("a",{href:c,download:!0,onClick:e=>e.stopPropagation(),className:"text-muted-foreground hover:text-foreground shrink-0 rounded p-1 transition-colors","aria-label":"Download",children:(0,t.jsx)(eD.Download,{className:"h-3 w-3"})})]}),l&&c?(0,t.jsx)("div",{className:"border-border border-t px-3 py-2.5",children:u?(0,t.jsx)("img",{src:c,alt:e.description,className:"max-h-80 w-full rounded-md border object-contain",loading:"lazy"}):x?(0,t.jsx)("video",{src:c,controls:!0,className:"max-h-80 w-full rounded-md border",preload:"metadata",children:(0,t.jsx)("track",{kind:"captions"})}):m?(0,t.jsx)(e0,{url:c}):(0,t.jsx)("p",{className:"text-muted-foreground truncate font-mono text-[10px]",children:e.relativePath})}):null,null]})}function e0({url:e}){let[r,a]=(0,s.useState)(null),[n,l]=(0,s.useState)(!1);return n?r?(0,t.jsx)("pre",{className:"bg-muted/50 max-h-60 overflow-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:r}):(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");a(t.length>100?`${t.slice(0,100).join("\n")}
|
|
2
|
-
...`:e)}).catch(()=>a(null)).finally(()=>l(!0)),(0,t.jsx)("div",{className:"bg-muted/50 h-16 animate-pulse rounded-md"}))}function e1({evidence:e}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(e$,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Evidence"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"text-[10px]",children:e.length})]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(eY,{evidence:e},`${e.type}-${e.relativePath}`))})]})})}function e2({data:e,readOnly:s=!1,onApprove:r,onReject:a,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&&a?()=>a("Resolve merge conflicts",[]):r;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-emerald-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:s?"Merge History":"Merge Review"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s?"This feature was merged. Review the pull request details and evidence below.":d?"Review the pull request details and approve to merge.":"Review the changes and approve to merge."})]})]}),x?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(eA.GitBranch,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"font-mono text-[11px]",children:x.source}),(0,t.jsx)(ez,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"font-mono text-[11px]",children:x.target})]})}):null,d?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary flex items-center gap-1.5 text-sm font-semibold underline underline-offset-2",children:["PR #",d.number,(0,t.jsx)(eM.ExternalLink,{className:"h-3.5 w-3.5"})]}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"text-xs",children:d.status})]}),!1===d.mergeable?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Merge Status"}),(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-orange-50 text-orange-700 hover:bg-orange-50",children:[(0,t.jsx)(ep.AlertTriangle,{className:"me-1 h-3.5 w-3.5"}),"Conflicts"]})]}):null,d.ciStatus&&!0!==h?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"CI Status"}),(0,t.jsx)(eB,{status:d.ciStatus})]}):null,d.commitHash?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Commit"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(eP.GitCommitHorizontal,{className:"text-muted-foreground h-3.5 w-3.5"}),(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:d.commitHash.slice(0,7)})]})]}):null]})}):null,c?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(eI,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changes"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-3",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.filesChanged}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"files"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-green-600",children:["+",c.additions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"additions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-red-600",children:["-",c.deletions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"deletions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.commitCount}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"commits"})]})]})]})}):m?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(ep.AlertTriangle,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:m})]})}):null,p&&p.length>0?(0,t.jsx)(e1,{evidence:p}):null,u&&u.length>0?(0,t.jsx)(eZ,{fileDiffs:u}):null]}),!s&&(0,t.jsx)(ej,{onReject:a,onApprove:g,approveLabel:f?"Resolve Conflicts":"Approve Merge",approveVariant:f?"warning":"default",revisionPlaceholder:"Ask AI to revise before merging...",isProcessing:n,isRejecting:l,chatInput:i,onChatInputChange:o})]})}var e5=e.i(55016);let e3=(0,W.default)("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),e4=(0,W.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var e6=e.i(12103),e8=e.i(59311),e7=e.i(39200);let e9=(0,W.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var te=e.i(60253),tt=e.i(2287),ts=e.i(28267),tr=e.i(80436);let ta=(0,W.default)("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]),tn=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function tl(e){let t=e.lastIndexOf(".");return t>=0&&tn.has(e.slice(t).toLowerCase())}function ti(e){let t=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"",s=tl(e)?`image/${t.slice(1).replace("jpg","jpeg")}`:"",r=new URLSearchParams({path:e,...s&&{mimeType:s}});return`/api/attachments/preview?${r.toString()}`}let to=/(?:^|\s)@(\/[^\s]+)/g;function td({text:e,attachmentPaths:s}){let r=function(e){let t=[],s=0;for(let r of e.matchAll(to)){let a=r.index,n=a+(r[0].length-r[0].trimStart().length);n>s&&t.push({type:"text",value:e.slice(s,n)}),t.push({type:"attachment",path:r[1]}),s=a+r[0].length}return s<e.length&&t.push({type:"text",value:e.slice(s)}),t}(e),a=r.some(e=>"attachment"===e.type),n=s?.filter(Boolean)??[];return a||0!==n.length?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[r.map(e=>{if("text"===e.type){let s=e.value.trim();return s?(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:s},`text-${s.slice(0,40)}`):null}return(0,t.jsx)(tc,{path:e.path},`att-${e.path}`)}),n.map(e=>(0,t.jsx)(tc,{path:e},`extra-${e}`))]}):(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:e})}function tc({path:e}){let r=e.split("/").pop()??e,[a,n]=(0,s.useState)(!1);return tl(e)?a?(0,t.jsxs)("div",{"data-testid":"inline-attachment-image-error",className:"text-muted-foreground flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,t.jsx)(ta,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:r})]}):(0,t.jsxs)(tt.Dialog,{children:[(0,t.jsx)(tt.DialogTrigger,{asChild:!0,children:(0,t.jsx)("img",{src:ti(e),alt:r,"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)(tt.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)(ts.VisuallyHidden.Root,{children:(0,t.jsxs)(tt.DialogTitle,{children:["Preview: ",r]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:ti(e),alt:r,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:r})}),(0,t.jsx)("a",{href:ti(e),download:r,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${r}`,children:(0,t.jsx)(tr.DownloadIcon,{className:"h-4 w-4"})})]})]})]}):(0,t.jsx)("a",{href:ti(e),download:r,"data-testid":"inline-attachment-file",className:"text-primary text-sm underline underline-offset-2",children:r})}e.i(81803);var tu=e.i(72714),tx=e.i(41413),tm=e.i(86782),tp=e.i(29847);function th(e){if(0===e)return"0s";let t=Math.floor(e/1e3);if(0===t)return"<1s";let s=Math.floor(t/3600),r=Math.floor(t%3600/60),a=t%60;return s>0?`${s}h ${r}m`:r>0?`${r}m ${a}s`:`${a}s`}let tf=new Set(["pending","action-required","error"]);function tg(e){return e?.agentType?{agentType:e.agentType,modelId:e.modelId??""}:null}function tb({icon:e,title:s,children:r}){return(0,t.jsxs)("div",{className:"px-3 pt-4 pb-1",children:[(0,t.jsxs)("div",{className:"text-foreground mb-2 flex items-center gap-1.5 text-sm font-semibold tracking-wider uppercase",children:[(0,t.jsx)(e,{className:"size-4 opacity-50"}),s]}),r]})}function tj({children:e,className:s}){return(0,t.jsx)("div",{className:(0,r.cn)("bg-muted/60 rounded-md border border-transparent p-3",s),children:e})}function tv({label:e,children:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-foreground/40 text-[11px] font-medium tracking-wider uppercase",children:e}),(0,t.jsx)("span",{className:"text-sm leading-snug",children:s})]})}function ty({on:e,label:s}){return(0,t.jsxs)("span",{className:(0,r.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)(te.X,{className:"size-3"}),s]})}let tN={[eO.PrStatus.Open]:"text-blue-600 dark:text-blue-400",[eO.PrStatus.Merged]:"text-purple-600 dark:text-purple-400",[eO.PrStatus.Closed]:"text-red-600 dark:text-red-400"};function tw({data:e,pinnedConfig:a,syncStatus:n,syncLoading:l,syncError:i,onRefreshSync:o,onRebaseOnMain:d,rebaseLoading:c,rebaseError:u}){var x;let m,p,h,f,g,b,j="maintain"===e.lifecycle,v=function(e){let[t,r]=(0,s.useState)(null),a=(0,s.useRef)(null);return(0,s.useEffect)(()=>e?(r(th(Math.max(0,Date.now()-e))),a.current=setInterval(()=>{r(th(Math.max(0,Date.now()-e)))},1e3),()=>{a.current&&clearInterval(a.current)}):void r(null),[e]),t}("running"===e.state||"action-required"===e.state?e.startedAt:void 0),y=ea.featureNodeStateConfig[e.state],N=!!e.summary&&!(e.userQuery&&e.summary?.trim()===e.userQuery.trim());return(0,t.jsxs)("div",{"data-testid":"feature-drawer-status",className:"pb-4",children:[!j&&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,r.cn)("h-full rounded-full transition-all",y.progressClass),style:{width:`${e.progress}%`}})})}):null,e.oneLiner||e.userQuery||N?(0,t.jsx)(tb,{icon:e4,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)(td,{text:e.userQuery})}):null,N?(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:eP.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)(eM.ExternalLink,{className:"size-3"})]}),(0,t.jsx)("span",{className:(0,r.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)(ep.AlertTriangle,{className:"size-3 shrink-0"})," Conflicts"]}):null,e.pr.ciStatus&&!0!==e.hideCiStatus?(0,t.jsx)(eB,{status:e.pr.ciStatus}):null,e.pr.commitHash?(0,t.jsx)("code",{className:"text-foreground/40 ml-auto font-mono text-[11px]",children:e.pr.commitHash.slice(0,7)}):null]})})}):null,(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-3 pb-1",children:[e.branch?(0,t.jsx)(tj,{children:(0,t.jsxs)(tv,{label:"Branch",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(eA.GitBranch,{className:"text-foreground/30 size-3 shrink-0"}),(0,t.jsx)("code",{className:"font-mono text-[11px]",children:e.branch})]}),e.baseBranch?(0,t.jsxs)("span",{className:"text-foreground/30 block text-[10px]",children:["from ",e.baseBranch]}):null]})}):null,e.agentType||e.modelId?(0,t.jsx)(tj,{children:(0,t.jsx)(tv,{label:"Agent",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.agentType?(m=(0,tm.getAgentTypeIcon)(e.agentType),(0,t.jsx)(m,{className:"size-3.5 shrink-0 opacity-50"})):null,e.agentType?(0,t.jsx)("span",{children:tm.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,tp.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)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),(x=e.createdAt,p=Date.now(),(b=Math.floor((g=Math.floor((f=Math.floor((p-(h="string"==typeof x?new Date(x).getTime():x))/6e4))/60))/24))>30?new Date(h).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):b>0?`${b}d ago`:g>0?`${g}h ago`:f>0?`${f}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)(Y.Zap,{className:"size-3.5"})," Fast"]})})}):null,e.runtime||v?(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)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),e.runtime??v]})})}):null]}),e.blockedBy||e.errorMessage?(0,t.jsx)(tb,{icon:ep.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,d&&e.branch&&o?(0,t.jsx)(tb,{icon:e8.RefreshCw,title:"Branch Sync",children:(0,t.jsx)(tk,{syncStatus:n??null,syncLoading:l??!1,syncError:i??null,onRefreshSync:o,onRebaseOnMain:d,rebaseLoading:c??!1,rebaseError:u??null})}):null,(0,t.jsx)(tT,{data:e,pinnedConfig:a}),e.injectedSkills?.length?(0,t.jsx)(tS,{skills:e.injectedSkills}):null]})}function tk({syncStatus:e,syncLoading:s,syncError:n,onRefreshSync:l,onRebaseOnMain:i,rebaseLoading:o,rebaseError:d}){let{t:c}=(0,a.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:s&&!e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsx)("span",{className:"text-foreground/40",children:"Checking..."})]}):n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-red-500"}),(0,t.jsx)("span",{className:"text-destructive text-xs",children:n})]}):o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsxs)("span",{children:["Rebasing on ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),"..."]})]}):u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-orange-500"}),(0,t.jsxs)("span",{children:[e.behind," behind ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eF.CheckCircle2,{className:"size-3.5 text-green-500"}),(0,t.jsxs)("span",{children:["Up to date · ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):null}),(e||n)&&!o?(0,t.jsx)("button",{onClick:l,disabled:s,className:"text-foreground/30 hover:text-foreground/60 hover:bg-foreground/5 inline-flex size-6 items-center justify-center rounded-sm disabled:opacity-50","aria-label":c("branchSyncStatus.refreshSyncStatus"),children:(0,t.jsx)(e8.RefreshCw,{className:(0,r.cn)("size-3",s&&"animate-spin")})}):null]}),u&&!o?(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(tu.ActionButton,{label:c("branchSyncStatus.rebaseOnMain"),onClick:i,loading:!1,error:!!d,icon:Q,variant:"outline",size:"sm"})}):null,d?(0,t.jsx)("p",{className:"text-destructive pt-1 text-[11px]",children:d}):null]})}function tC({pinnedConfig:e}){let s=(0,tm.getAgentTypeIcon)(e.agentType),r=e.modelId?(0,tp.getModelMeta)(e.modelId).displayName||e.modelId:"No model selected";return(0,t.jsxs)(tj,{"data-testid":"feature-pinned-config-card",className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("div",{className:"text-foreground/40 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(e7.Settings,{className:"size-3"})," Pinned Execution"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(s,{className:"size-4 shrink-0 opacity-60"}),(0,t.jsx)("span",{className:"font-medium",children:tm.agentTypeLabels[e.agentType]??e.agentType}),(0,t.jsx)("span",{className:"text-foreground/20",children:"/"}),(0,t.jsx)("span",{className:"text-foreground/60",children:r})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Change the pinned agent and model before the next start, approval, or retry."})]}),(0,t.jsx)(tx.AgentModelPicker,{initialAgentType:e.agentType,initialModel:e.modelId,agentType:e.agentType,model:e.modelId,onSave:e.onSave,saveError:e.error,saving:e.saving,disabled:e.saving,mode:"settings"})]})}function tT({data:e,pinnedConfig:s}){var r;let a=null!=e.approvalGates||null!=e.push||null!=e.openPr||null!=e.ciWatchEnabled||null!=e.enableEvidence||null!=e.forkAndPr||null!=e.commitSpecs||null!=e.injectSkills,n=null!=s&&(r=e.state,tf.has(r));return a||n?(0,t.jsx)(tb,{icon:e7.Settings,title:"Settings",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[n?(0,t.jsx)(tC,{pinnedConfig:s}):null,a?(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)(e9,{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)(e3,{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.injectSkills?(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)(e6.Puzzle,{className:"size-3"})," Skills"]}),(0,t.jsx)("div",{className:"flex flex-col gap-0.5",children:(0,t.jsx)(ty,{on:e.injectSkills,label:"Inject"})})]}):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)(eA.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]}):null]})}):null}function tS({skills:e}){return(0,t.jsx)(tb,{icon:e6.Puzzle,title:"Feature Skills",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>(0,t.jsx)(eu.Badge,{variant:"secondary",children:e},e))})})}let tR=(0,W.default)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var eq=eq,tM=e.i(94819),tI=e.i(58860);let tP=(0,W.default)("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),tA=(0,W.default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);function tz(e,t){if(null!=e.durationMs&&e.durationMs>0)return e.durationMs;if(!e.completedAt&&e.startedAt){let s=new Date(e.startedAt).getTime();if(!Number.isNaN(s))return Math.max(0,t-s)}return 0}function t$(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tE(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 tD(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}let tL={analyze:"Analyzing",requirements:"Requirements",research:"Researching",plan:"Planning",implement:"Implementing",rebase:"Rebasing","fast-implement":"Fast Implement",evidence:"Evidence",validate:"Validating",repair:"Repairing",merge:"Merging"},tF={"run:started":{label:"started",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:d.Play},"run:resumed":{label:"resumed",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:X.RotateCcw},"run:completed":{label:"completed",colorClass:"text-emerald-600",bgClass:"bg-emerald-50 dark:bg-emerald-950/30",icon:eF.CheckCircle2},"run:failed":{label:"failed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:stopped":{label:"stopped",colorClass:"text-amber-600",bgClass:"bg-amber-50 dark:bg-amber-950/30",icon:c.Square},"run:crashed":{label:"crashed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:rejected":{label:"rejected",colorClass:"text-orange-600",bgClass:"bg-orange-50 dark:bg-orange-950/30",icon:tM.Ban}};function tq(e){return e.startsWith("run:")}function tO({timings:e,loading:r,error:n,rejectionFeedback:l}){let{t:o}=(0,a.useTranslation)("web"),d=function(e){let[t,r]=(0,s.useState)(Date.now),a=(0,s.useRef)(null);return(0,s.useEffect)(()=>(e&&e.some(e=>!e.phase.startsWith("run:")&&!e.completedAt&&e.startedAt)&&(a.current=setInterval(()=>r(Date.now()),1e3)),()=>{a.current&&(clearInterval(a.current),a.current=null)}),[e]),t}(e);if(r)return(0,t.jsx)("div",{"data-testid":"activity-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(n)return(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-base text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]});if(!e||0===e.length)return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(e5.Clock,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-base",children:o("activityTab.noActivityRecorded")})]});let c=e.filter(e=>!tq(e.phase)),u=Math.max(...c.map(e=>tz(e,d)),...c.map(e=>e.approvalWaitMs??0),0),x=function(e,t){if(!e.length)return[];let s=e.filter(e=>"run:rejected"===e.phase).length,r=t?.length??0,a=e;if(r>s){a=[...e];let n=e[e.length-1].agentRunId;for(let e=s;e<r;e++){let r=t[e];e>s&&a.push({agentRunId:n,phase:"run:resumed",startedAt:r.timestamp??`synthetic-resumed-${e}`}),a.push({agentRunId:n,phase:"run:rejected",startedAt:r.timestamp??`synthetic-${e}`})}}let n=[],l=[],i=0;for(let e of a)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+tz(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)(tB,{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 tB({iteration:e,showHeader:s,maxDurationMs:r,now:a}){let n=function(e){let t=[...e.timings].reverse().find(e=>tq(e.phase));if(!t)return null;switch(t.phase){case"run:rejected":return{label:"Rejected",colorClass:"text-orange-600",dotClass:"bg-orange-500"};case"run:completed":return{label:"Completed",colorClass:"text-emerald-600",dotClass:"bg-emerald-500"};case"run:failed":return{label:"Failed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:crashed":return{label:"Crashed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:stopped":return{label:"Stopped",colorClass:"text-amber-600",dotClass:"bg-amber-500"};default:return null}}(e);return(0,t.jsxs)("div",{"data-testid":`iteration-${e.number}`,className:"border-border/50 bg-card/50 flex flex-col overflow-hidden rounded-lg border",children:[s?(0,t.jsxs)("div",{className:"bg-muted/30 border-border/50 flex items-center justify-between border-b px-3 py-1.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground text-sm font-semibold tracking-wide",children:["Iteration ",e.number]}),n?(0,t.jsxs)("span",{className:`flex items-center gap-1 text-xs font-medium ${n.colorClass}`,children:[(0,t.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${n.dotClass}`}),n.label]}):null]}):null,(0,t.jsxs)("div",{className:"relative flex flex-col",children:[(0,t.jsx)("div",{className:"bg-border/60 absolute top-4 bottom-4 left-[21.5px] w-px"}),e.timings.map((s,n)=>{if(tq(s.phase)){let r,a="run:rejected"===s.phase,l="run:failed"===s.phase||"run:crashed"===s.phase||"run:stopped"===s.phase;if(a)r=e.rejectionMessage;else if(l){let t=[...e.timings].reverse().find(e=>!tq(e.phase)&&e.errorMessage);r=t?.errorMessage??s.errorMessage}return(0,t.jsx)(tU,{timing:s,message:r,attachments:a?e.rejectionAttachments:void 0,isFirst:0===n,isLast:n===e.timings.length-1},`${s.agentRunId}-${s.phase}-${s.startedAt}`)}return(0,t.jsx)(tV,{timing:s,maxDurationMs:r,now:a},`${s.agentRunId}-${s.phase}-${s.startedAt}`)})]})]})}function tU({timing:e,message:s,attachments:r,isFirst:a,isLast:n}){let l,i=tF[e.phase];if(!i)return null;let o=r&&r.length>0,d=i.icon;return(0,t.jsxs)("div",{className:`relative flex flex-col gap-1 px-3 ${a?"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:tE(String(e.startedAt))}):null]}),s?(l="run:failed"===e.phase||"run:crashed"===e.phase||"run:stopped"===e.phase,(0,t.jsxs)("div",{className:`ml-[26px] flex items-start gap-1.5 rounded-md px-2 py-1.5 ${l?"bg-red-50/50 dark:bg-red-950/20":"bg-orange-50/50 dark:bg-orange-950/20"}`,children:[l?(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-400"}):(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-orange-400"}),(0,t.jsxs)("span",{"data-testid":l?"error-message-text":"rejection-feedback-text",className:"text-muted-foreground text-xs leading-relaxed italic",children:["— ",s]})]})):null,o?(0,t.jsx)("div",{"data-testid":"rejection-feedback-attachments",className:"ml-[26px]",children:(0,t.jsx)(td,{text:"",attachmentPaths:r})}):null]})}function tV({timing:e,maxDurationMs:r,now:n}){let{t:l}=(0,a.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=tL[i]??i,p=c?`Phase ${o.replace("phase-","")}`:null!==o?`${m} #${o}`:m,h=tz(e,n),f=!e.completedAt&&!!e.startedAt,g=f?15:2,b=r>0?Math.max(g,h/r*100):g,j=e.completedAt?c?"bg-emerald-400":d?"bg-amber-500":"bg-emerald-500":"bg-blue-500",v=null!=e.inputTokens||null!=e.outputTokens?(e.inputTokens??0)+(e.outputTokens??0):null,[y,N]=(0,s.useState)(!1),w=(0,s.useCallback)(()=>{e.prompt&&navigator.clipboard.writeText(e.prompt).then(()=>{N(!0),setTimeout(()=>N(!1),1500)})},[e.prompt]);return(0,t.jsxs)("div",{className:`group/phase relative flex flex-col gap-0.5 px-3 py-1.5 ${d?"ms-4":""}`,children:[(0,t.jsxs)("div",{"data-testid":`timing-bar-${e.phase}`,className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"relative z-10 flex h-5 w-5 shrink-0 items-center justify-center",children:(0,t.jsx)("div",{className:`rounded-full ${f?"h-3 w-3 animate-pulse":"h-2.5 w-2.5"} ${f?"bg-blue-500":e.completedAt?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,t.jsx)("span",{className:`w-28 shrink-0 truncate text-sm font-medium ${d?"text-muted-foreground":"text-foreground/80"}`,children:p}),e.prompt?(0,t.jsx)("button",{type:"button",onClick:w,className:"text-muted-foreground/50 hover:text-foreground/70 -ms-1 shrink-0 opacity-0 transition-opacity group-hover/phase:opacity-100",title:l("activityTab.copyPromptToClipboard"),children:y?(0,t.jsx)(x.Check,{className:"h-3.5 w-3.5 text-emerald-500"}):(0,t.jsx)(u.Copy,{className:"h-3.5 w-3.5"})}):null,(0,t.jsx)("div",{className:`bg-muted relative min-w-0 flex-1 overflow-hidden rounded-full ${d?"h-1.5":"h-2"}`,children:f?(0,t.jsx)("div",{className:"absolute inset-0 rounded-full bg-blue-500/30",style:{backgroundImage:"linear-gradient(90deg, transparent 0%, rgb(59 130 246) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}):(0,t.jsx)("div",{className:`h-full rounded-full transition-all duration-300 ${j}`,style:{width:`${Math.min(b,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-sm font-medium tabular-nums",children:th(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:tE(e.startedAt)}):null,null!=v&&v>0?(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-50"}),t$(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)(tR,{className:"h-3 w-3 opacity-50"}),tD(e.costUsd)]}):null]}),null!=e.approvalWaitMs&&e.approvalWaitMs>0?(0,t.jsx)(tW,{timing:e,maxDurationMs:r}):null]})}function tW({timing:e,maxDurationMs:s}){let r=e.approvalWaitMs??0,a=s>0?Math.max(2,r/s*100):2;return(0,t.jsxs)("div",{"data-testid":`approval-wait-${e.phase}`,className:"ml-[26px] flex items-center gap-2 rounded-md bg-amber-50/50 px-1.5 py-1 dark:bg-amber-950/20",children:[(0,t.jsx)(tI.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(a,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-xs tabular-nums",children:th(r)})]})}function tH({totalExecMs:e,totalWaitMs:s,totalInputTokens:r,totalOutputTokens:n,totalCostUsd:l}){let{t:i}=(0,a.useTranslation)("web"),o=r+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)(tG,{icon:e5.Clock,label:i("activityTab.execution"),value:th(e)}),(0,t.jsx)(tG,{icon:tI.Timer,label:i("activityTab.wait"),value:s>0?th(s):"n/a"}),(0,t.jsx)(tG,{icon:e5.Clock,label:"Wall-clock",value:s>0?th(e+s):th(e)}),(0,t.jsx)(tG,{icon:tR,label:i("activityTab.cost"),value:l>0?tD(l):"n/a"}),(0,t.jsxs)("div",{className:"col-span-2 flex flex-col gap-0.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-40"}),"Tokens"]}),o>0?(0,t.jsxs)("span",{className:"flex items-center gap-2.5 text-sm tabular-nums",children:[(0,t.jsx)("span",{children:t$(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)(tP,{className:"h-3 w-3 text-blue-500 opacity-60"}),t$(r)]}),(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tA,{className:"h-3 w-3 text-emerald-500 opacity-60"}),t$(n)]})]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-sm italic tabular-nums",children:"n/a"})]})]})]})}function tG({icon:e,label:s,value:r,className:a=""}){let n="n/a"===r;return(0,t.jsxs)("div",{className:`flex flex-col gap-0.5 ${a}`,children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(e,{className:"h-3 w-3 opacity-40"}),s]}),(0,t.jsx)("span",{className:`text-sm tabular-nums ${n?"text-muted-foreground/40 italic":""}`,children:r})]})}var t_=e.i(7311),tK=e.i(44229);let tZ=(0,W.default)("coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]),tQ=(0,W.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);var tJ=e.i(86076);let tX=/^\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]\s+(?:\[([^\]]+)\]\s+)?(?:\[([^\]|]+)(?:\|([^\]]+))?\]\s+)?(.*)$/,tY=/^\[(tool-result|tool|text|delta|result|tokens|cmd|file|turn|thread|error|event|raw|WORKER)\]\s*(.*)/;function t0(e){let t=e.match(tX);if(!t)return{timestamp:null,phase:null,agent:null,model:null,tag:"raw",message:e,raw:e};let[,s,r,a,n,l]=t,i=null,o=null,d=null,c=l??"";if(null!=a&&null!=r)if(r.includes("|")){let[e,t]=r.split("|");o=e,d=t??null,c=`[${a}] ${l??""}`}else i=r,o=a,d=n??null;else if(null!=r)if(r.includes("|")){let[e,t]=r.split("|");o=e,d=t??null}else i=r;let u=c.match(tY),x="info";return u&&(x=u[1].toLowerCase(),c=u[2]),{timestamp:s??null,phase:i,agent:o,model:d,tag:x,message:c.trim(),raw:e}}function t1({content:e}){let r=(0,s.useMemo)(()=>e?e.split("\n").filter(e=>e.trim().length>0).map(t0):[],[e]);return 0===r.length?null:(0,t.jsx)("div",{className:"flex flex-col",children:r.map((e,s)=>(0,t.jsx)(t2,{line:e},s))})}function t2({line:e}){switch(e.tag){case"tool":return(0,t.jsx)(t4,{line:e});case"tool-result":return(0,t.jsx)(st,{line:e});case"text":case"delta":return(0,t.jsx)(t8,{line:e});case"result":return(0,t.jsx)(t7,{line:e});case"tokens":case"turn":return(0,t.jsx)(t9,{line:e});case"cmd":return(0,t.jsx)(ss,{line:e});case"file":return(0,t.jsx)(sr,{line:e});case"thread":case"event":case"info":return(0,t.jsx)(sn,{line:e});case"error":return(0,t.jsx)(sa,{line:e});case"worker":return(0,t.jsx)(se,{line:e});default:return(0,t.jsx)(sl,{line:e})}}function t5({value:e}){if(!e)return null;let s=e.replace(/^.*T/,"").replace("Z",""),r=s.split(":"),a=r.length>=3?`${r[1]}:${r[2].split(".")[0]}`:s;return(0,t.jsx)("span",{className:"text-muted-foreground/60 w-11 shrink-0 font-mono text-[10px]",children:a})}function t3({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 t4({line:e}){var s;let r,{toolName:a,args:n}=-1===(r=(s=e.message).indexOf(" "))?{toolName:s,args:""}:{toolName:s.slice(0,r),args:s.slice(r+1)},l=function(e,t){try{let s=JSON.parse(t);if("Read"===e&&s.file_path||"Write"===e&&s.file_path||"Edit"===e&&s.file_path)return s.file_path;if("Glob"===e&&s.pattern||"Grep"===e&&s.pattern)return s.pattern;if("Bash"===e&&s.command)return s.command;if("Task"===e&&s.description)return s.description}catch{if(t.length>0)return t}return null}(a,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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t6,{toolName:a}),(0,t.jsx)("span",{className:"text-xs font-semibold text-violet-600 dark:text-violet-400",children:a}),l?(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-xs break-all",children:l}):null]})]})}function t6({toolName:e}){let s=e.toLowerCase();return"bash"===s?(0,t.jsx)($.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"read"===s||"glob"===s||"grep"===s?(0,t.jsx)(D.FileText,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"write"===s||"edit"===s?(0,t.jsx)(tJ.FileCode,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):(0,t.jsx)($.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"})}function t8({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3 w-3 shrink-0 text-blue-500"}),(0,t.jsx)("span",{className:"text-foreground/80 min-w-0 text-xs leading-relaxed",children:e.message})]})]})}function t7({line:e}){var s;let r,a,{chars:n}=(r=(s=e.message).match(/^(\d+)\s+chars/),a=s.match(/session=(\S+)/),{chars:r?parseInt(r[1],10):0,sessionId:a?a[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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3 w-3 shrink-0 text-emerald-500"}),(0,t.jsxs)("span",{className:"text-xs font-medium text-emerald-600 dark:text-emerald-400",children:["Result: ",n.toLocaleString()," chars"]})]})]})}function t9({line:e}){let s,{inputTokens:r,outputTokens:a}=(s=e.message.match(/^(\d+)\s+in\s*\/\s*(\d+)\s+out/))?{inputTokens:parseInt(s[1],10),outputTokens:parseInt(s[2],10)}:{inputTokens:0,outputTokens:0};return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{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-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:r.toLocaleString()})," in / ",(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:a.toLocaleString()})," out"]})]})]})}function se({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tQ,{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 st({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(ez,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-400"}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-[11px] break-all",children:e.message})]})]})}function ss({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{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 sr({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tJ.FileCode,{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 sa({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3 w-3 shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"min-w-0 text-xs font-medium break-all text-red-700 dark:text-red-400",children:e.message})]})]})}function sn({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs break-all",children:e.message})]})}function sl({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 si({content:e,isConnected:r,error:n}){let{t:l}=(0,a.useTranslation)("web"),i=(0,s.useRef)(null),[o,d]=(0,s.useState)(!0),[c,u]=(0,s.useState)("structured"),x=(0,s.useCallback)(()=>{let e=i.current;e&&d(e.scrollHeight-e.scrollTop-e.clientHeight<40)},[]),m=(0,s.useCallback)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight,d(!0))},[]);return((0,s.useEffect)(()=>{o&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,o]),n)?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]}):e?(0,t.jsxs)("div",{className:"flex h-full flex-col","data-testid":"log-tab",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-1.5",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full ${r?"bg-emerald-500":"bg-zinc-400"}`}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:r?"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)(D.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)(tK.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)(t_.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)(t1,{content:e}):e})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)($.Terminal,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:l("logTab.noLogOutput")}),r?(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Waiting for log data..."}):null]})}let so=(0,W.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var sd=e.i(95812),sc=e.i(87889);let su=(0,W.default)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]),sx={Todo:{icon:sd.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:sc.Eye,colorClass:"text-amber-600",borderClass:"border-amber-200",label:"Review"}},sm={icon:sd.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Unknown"};function sp({tasks:e}){let{t:s}=(0,a.useTranslation)("web");return 0===e.length?(0,t.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 py-4",children:(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:s("taskProgress.noTasksDefined")})}):(0,t.jsxs)("div",{"data-testid":"task-progress-view",className:"flex flex-col gap-3",children:[(0,t.jsx)(sh,{tasks:e}),(0,t.jsx)("div",{"data-testid":"task-progress-list",className:"flex flex-col gap-2",children:e.map((e,s)=>(0,t.jsx)(sg,{task:e,index:s},e.title||`task-${s}`))})]})}function sh({tasks:e}){let{t:r}=(0,a.useTranslation)("web"),n=(0,s.useMemo)(()=>{let t=e.filter(e=>"Done"===e.state).length,s=e.filter(e=>"Work in Progress"===e.state).length,r=e.filter(e=>"Review"===e.state).length,a=e.filter(e=>"Done"!==e.state&&"Work in Progress"!==e.state&&"Review"!==e.state).length,n=e.length,l=n>0?Math.round(t/n*100):0;return{done:t,wip:s,review:r,todo:a,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)(sf,{icon:x.Check,label:r("taskProgress.done"),count:n.done,className:"text-emerald-600"}):null,n.wip>0?(0,t.jsx)(sf,{icon:i.Loader2,label:r("taskProgress.inProgress"),count:n.wip,className:"text-blue-600"}):null,n.review>0?(0,t.jsx)(sf,{icon:sc.Eye,label:r("taskProgress.review"),count:n.review,className:"text-amber-600"}):null,n.todo>0?(0,t.jsx)(sf,{icon:sd.Circle,label:r("taskProgress.todo"),count:n.todo,className:"text-muted-foreground"}):null]})]})}function sf({icon:e,label:s,count:a,className:n}){return(0,t.jsxs)("span",{className:(0,r.cn)("flex items-center gap-1 text-xs",n),children:[(0,t.jsx)(e,{className:"h-3 w-3"}),a," ",s]})}function sg({task:e,index:a}){let[n,l]=(0,s.useState)(!1),i=sx[e.state]??sm,o=i.icon,d=e.actionItems.length>0,c=(0,s.useCallback)(()=>{d&&l(e=>!e)},[d]);return(0,t.jsxs)("div",{"data-testid":`task-card-${a}`,className:(0,r.cn)("rounded-lg border",i.borderClass),children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!d,className:(0,r.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,r.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,r.cn)("text-sm font-medium",i.colorClass),children:e.title}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description}):null]}),d?(0,t.jsx)(ed.ChevronRight,{className:(0,r.cn)("text-muted-foreground mt-0.5 h-4 w-4 shrink-0 transition-transform",n&&"rotate-90")}):null]}),n&&d?(0,t.jsx)("div",{className:"border-t px-3 py-2.5",children:(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.actionItems.map((e,s)=>(0,t.jsx)(sb,{item:e},e.name||`ai-${s}`))})}):null]})}function sb({item:e}){let s=e.acceptanceCriteria.length,r=e.acceptanceCriteria.filter(e=>e.verified).length,a=s>0&&r===s;return(0,t.jsxs)("div",{"data-testid":"action-item",className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[a?(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,t.jsx)(su,{className:"text-muted-foreground mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.name}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-[11px]",children:e.description}):null]}),s>0?(0,t.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[r,"/",s]}):null]}),s>0?(0,t.jsx)("div",{className:"ms-5.5 flex flex-col gap-1",children:e.acceptanceCriteria.map((e,s)=>(0,t.jsx)(sj,{criterion:e},e.description||`ac-${s}`))}):null]})}function sj({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)(sd.Circle,{className:"text-muted-foreground mt-0.5 h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:(0,r.cn)("text-[11px]",e.verified?"text-muted-foreground line-through":"text-foreground"),children:e.description})]})}let sv={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 sy({plan:e,loading:s,error:r}){return s?(0,t.jsx)("div",{"data-testid":"plan-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):r?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:r})]}):e?(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Plan State"}),(0,t.jsx)(eu.Badge,{className:sv[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)(sp,{tasks:e.tasks})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(so,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"No plan created yet"})]})}var sN=e.i(28112);function sw(){return{data:null,loading:!1,error:null}}let sk=[{key:"overview",label:"Overview",icon:U.LayoutDashboard},{key:"activity",label:"Activity",icon:V.Activity},{key:"log",label:"Log",icon:H},{key:"plan",label:"Plan",icon:G},{key:"prd-review",label:"PRD Review",icon:_},{key:"tech-decisions",label:"Tech Decisions",icon:K.Cpu},{key:"product-decisions",label:"Product",icon:Z.Package},{key:"merge-review",label:"Merge Review",icon:Q},{key:"chat",label:"Chat",icon:J.MessageSquare}],sC={activity:async function(e){let t=await es(e);if("error"in t)throw Error(t.error);return{timings:t.timings,rejectionFeedback:t.rejectionFeedback}},plan:async function(e){let t=await er(e);if("error"in t)throw Error(t.error);return t.plan}};function sT({featureName:e,headerContent:a,featureNode:l,featureId:o,initialTab:u,urlTab:x,prdData:m,prdSelections:p,onPrdSelect:h,onPrdApprove:f,onPrdReject:g,isPrdLoading:b,techData:j,onTechApprove:v,onTechReject:y,isTechLoading:N,productData:w,mergeData:k,onMergeApprove:C,onMergeReject:T,isMergeLoading:S,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:$,rebaseError:E,isRejecting:D,chatInput:L,onChatInputChange:F,pinnedConfig:q,continuationActionsDisabled:O=!1,sseEvents:U,interactiveAgentEnabled:V=!0,onRetry:W,onStop:H,onStart:G}){let _,K=(0,n.usePathname)(),Z=(0,s.useMemo)(()=>(function(e,t=!0){let s=["overview","activity"];return e.hasAgentRun&&s.push("log"),e.hasPlan&&s.push("plan"),"requirements"===e.lifecycle&&"action-required"===e.state&&s.push("prd-review"),"implementation"===e.lifecycle&&"action-required"===e.state&&s.push("tech-decisions","product-decisions"),"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)&&s.push("merge-review"),"maintain"===e.lifecycle&&e.pr&&s.push("merge-review"),t&&s.push("chat"),s})(l,V),[l,V]),Q=(0,s.useMemo)(()=>sk.filter(e=>Z.includes(e.key)).map(e=>"merge-review"===e.key&&"maintain"===l.lifecycle?{...e,label:"Merge History"}:e),[Z,l.lifecycle]),J=(0,s.useMemo)(()=>{let e=K.match(/^(\/feature\/[^/]+)/);return e?e[1]:K},[K]),es=(0,s.useMemo)(()=>x&&Z.includes(x)?x:u&&Z.includes(u)?u:"overview",[]),[er,en]=(0,s.useState)(es),el=function(e){let[t,r]=(0,s.useState)(""),[a,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),o=(0,s.useRef)(null),d=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),n(!1)},[]);return(0,s.useEffect)(()=>{if(!e){r(""),n(!1),i(null);return}r(""),i(null);let t=new EventSource(`/api/feature-logs?featureId=${e}`);return o.current=t,t.onopen=()=>{n(!0)},t.addEventListener("initial",e=>{r(JSON.parse(e.data).content)}),t.addEventListener("log",e=>{let t=JSON.parse(e.data);r(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:a,error:l}}("log"===er?o:null),{tabs:eo,fetchTab:ed,refreshTab:ec}=function(e,t){let r=Object.keys(t),[a,n]=(0,s.useState)(()=>{let e={};for(let t of r)e[t]=sw();return e}),l=(0,s.useRef)(t);l.current=t;let i=(0,s.useRef)(e);i.current=e;let o=(0,s.useRef)(!0);(0,s.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);let d=(0,s.useRef)(e);(0,s.useEffect)(()=>{d.current!==e&&(d.current=e,n(e=>{let t={};for(let s of Object.keys(e))t[s]=sw();return t}))},[e]);let c=(0,s.useCallback)(async e=>{let t=l.current[e],s=i.current;if(t){o.current&&n(t=>t[e]?.data!==null?t:{...t,[e]:{...t[e],loading:!0,error:null}});try{let r=await t(s);o.current&&n(t=>({...t,[e]:{data:r,loading:!1,error:null}}))}catch(t){o.current&&n(s=>{let r=t instanceof Error?t.message:"Failed to fetch tab data",a=s[e]?.data??null;return{...s,[e]:{data:a,loading:!1,error:a?null:r}}})}}},[]),u=(0,s.useCallback)(async e=>{let t=a[e];t&&null!==t.data||t&&t.loading||await c(e)},[a,c]);return{tabs:a,fetchTab:u,refreshTab:(0,s.useCallback)(async e=>{await c(e)},[c])}}(o,sC),eu=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!eu.current)return;eu.current=!1;let e="overview"===er?J:`${J}/${er}`;e!==K&&window.history.pushState(null,"",e)},[er,J,K]);let ex=(0,s.useRef)(K);(0,s.useEffect)(()=>{if(ex.current===K||(ex.current=K,eu.current))return;let e=K.split("/"),t=e.length>=4?e[3]:void 0,s=t&&Z.includes(t)?t:"overview";s!==er&&(en(s),("activity"===s||"plan"===s)&&ed(s))},[K]);let em=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!em.current&&(em.current=!0,!x&&"overview"!==es)){let e=`${J}/${es}`;e!==K&&window.history.replaceState(null,"",e)}},[]);let ep=(0,s.useRef)(!1);(0,s.useEffect)(()=>{ep.current||(ep.current=!0,("activity"===er||"plan"===er)&&ed(er))},[er,ed]);let eh=(0,s.useRef)(o);(0,s.useEffect)(()=>{eh.current!==o&&(eh.current=o,en("overview"))},[o]);let ef=(0,s.useRef)(u);(0,s.useEffect)(()=>{if(ef.current!==u&&u&&Z.includes(u)){ef.current=u,en(u),("activity"===u||"plan"===u)&&ed(u);let e="overview"===u?J:`${J}/${u}`;e!==window.location.pathname&&window.history.replaceState(null,"",e)}},[u,Z,J,ed]),(0,s.useEffect)(()=>{Z.includes(er)||(en("overview"),window.location.pathname!==J&&window.history.replaceState(null,"",J))},[Z,er,J]);let eg=(0,s.useRef)(er);eg.current=er;let eb=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(!U||0===U.length||(eb.current>U.length&&(eb.current=0),U.length<=eb.current))return;let e=U.slice(eb.current);if(eb.current=U.length,!e.some(e=>e.featureId===o))return;ec("activity");let t=eg.current;"plan"===t&&ec(t)},[U,o,ec]);let ej="running"===l.state||"creating"===l.state;(0,s.useEffect)(()=>{if(!ej)return;let e=setInterval(()=>{ec("activity")},5e3);return()=>clearInterval(e)},[ej,ec]);let ey=(0,s.useCallback)(e=>{eu.current=!0,en(e),("activity"===e||"plan"===e)&&ed(e)},[ed]);return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsxs)(et.Tabs,{value:er,onValueChange:ey,className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(et.TabsList,{className:"bg-muted/50 h-auto w-full shrink-0 justify-start gap-0 rounded-none border-b p-0",children:Q.map(e=>{let s=e.icon;return(0,t.jsxs)(et.TabsTrigger,{value:e.key,className:"text-muted-foreground hover:bg-muted hover:text-foreground data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:border-t-primary [&:not([data-state=active])]:border-r-border relative h-auto rounded-none border-t-2 border-r border-t-transparent border-r-transparent bg-transparent px-3.5 py-2.5 text-[13px] font-normal shadow-none transition-none last:border-r-transparent data-[state=active]:shadow-none",children:[(0,t.jsx)(s,{className:"mr-1.5 size-4"}),e.label]},e.key)})}),(0,t.jsxs)("div",{className:"bg-muted/40 shrink-0 border-b",children:[e?(0,t.jsxs)("div",{className:"flex h-12 items-stretch gap-2 pr-0 pl-4","data-testid":"feature-drawer-header",children:[(0,t.jsx)("div",{className:"flex items-center",children:l.fastMode?(0,t.jsx)(Y.Zap,{className:"size-4 shrink-0 text-amber-500"}):(0,t.jsx)(ee.Layers,{className:"text-muted-foreground/50 size-4 shrink-0"})}),(0,t.jsx)("h2",{className:"text-foreground flex min-w-0 items-center truncate text-base font-semibold tracking-tight",children:e}),l.repositoryName?(0,t.jsxs)("span",{className:"animate-in fade-in flex shrink-0 items-center gap-1.5 self-center duration-200",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),l.remoteUrl?(0,t.jsx)("a",{href:l.remoteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground text-sm",children:l.repositoryName}):(0,t.jsx)("span",{className:"text-muted-foreground text-sm",children:l.repositoryName})]}):(0,t.jsxs)("span",{className:"flex items-center gap-1.5 self-center",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),(0,t.jsx)("span",{className:"bg-muted h-4 w-16 animate-pulse rounded"})]}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 cursor-default items-center self-stretch text-xs font-medium",children:[(0,t.jsxs)("div",{className:(0,r.cn)("flex items-center gap-1.5 self-stretch px-3",ea.featureNodeStateConfig[l.state].labelClass),children:["running"===l.state?(0,t.jsx)(ei,{size:"sm",className:"shrink-0"}):(_=ea.featureNodeStateConfig[l.state].icon,(0,t.jsx)(_,{className:"size-3.5 shrink-0"})),ea.featureNodeStateConfig[l.state].label]}),"pending"===l.state&&G?(0,t.jsxs)("button",{type:"button",onClick:()=>G(l.featureId),disabled:O,className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-green-500/10 hover:text-green-600 disabled:pointer-events-none disabled:opacity-50 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&&W?(0,t.jsxs)("button",{type:"button",onClick:()=>W(l.featureId),disabled:O,className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 disabled:pointer-events-none disabled:opacity-50 dark:hover:text-red-400","data-testid":"feature-drawer-retry-button",children:[(0,t.jsx)(X.RotateCcw,{className:"size-3.5"})," Retry"]}):"running"===l.state&&H?(0,t.jsxs)("button",{type:"button",onClick:()=>H(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 dark:hover:text-red-400","data-testid":"feature-drawer-stop-button",children:[(0,t.jsx)(c.Square,{className:"size-3.5"})," Stop"]}):null]})}),l.errorMessage?(0,t.jsxs)(P.TooltipContent,{side:"bottom",align:"end",sideOffset:4,className:"z-[100] max-w-xs cursor-pointer text-xs leading-relaxed select-text",onClick:()=>{navigator.clipboard.writeText(l.errorMessage)},children:[l.errorMessage,(0,t.jsx)("span",{className:"text-muted-foreground ml-1 text-[10px] italic",children:"(click to copy)"})]}):null]})})]}):null,a]}),(0,t.jsx)(et.TabsContent,{value:"overview",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tw,{data:l,pinnedConfig:q,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:$,rebaseError:E})}),(0,t.jsx)(et.TabsContent,{value:"activity",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tO,{timings:eo.activity.data?.timings??null,loading:eo.activity.loading,error:eo.activity.error,rejectionFeedback:eo.activity.data?.rejectionFeedback})}),(0,t.jsx)(et.TabsContent,{value:"log",className:"mt-0 flex-1 overflow-hidden",children:(0,t.jsx)(si,{content:el.content,isConnected:el.isConnected,error:el.error})}),(0,t.jsx)(et.TabsContent,{value:"plan",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(sy,{plan:eo.plan.data,loading:eo.plan.loading,error:eo.plan.error})}),Z.includes("prd-review")?(0,t.jsx)(et.TabsContent,{value:"prd-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:m?(0,t.jsx)(ev,{data:m,selections:p??{},onSelect:h??(()=>void 0),onApprove:f??(()=>void 0),onReject:g,isProcessing:!!(b||O),isRejecting:D,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,Z.includes("tech-decisions")?(0,t.jsx)(et.TabsContent,{value:"tech-decisions",className:"mt-0 flex min-h-0 flex-1 flex-col",children:j?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(eC,{data:j})}),(0,t.jsx)(sS,{onApprove:v??(()=>void 0),onReject:y,isProcessing:!!(N||O),isRejecting:D,chatInput:L,onChatInputChange:F})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,Z.includes("product-decisions")?(0,t.jsx)(et.TabsContent,{value:"product-decisions",className:"mt-0 flex-1 overflow-y-auto",children:null===w?(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):w?(0,t.jsx)(eR,{data:w}):(0,t.jsx)("p",{className:"text-muted-foreground p-4 text-center text-sm",children:"No product decisions available."})}):null,Z.includes("merge-review")?(0,t.jsx)(et.TabsContent,{value:"merge-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:k?(0,t.jsx)(e2,{data:k,readOnly:"maintain"===l.lifecycle,onApprove:C??(()=>void 0),onReject:T,isProcessing:!!(S||O),isRejecting:D,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:S?(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"}):(0,t.jsxs)("div",{className:"text-muted-foreground flex flex-col items-center gap-2 text-sm",children:[(0,t.jsx)(B.AlertCircle,{className:"h-6 w-6"}),(0,t.jsx)("span",{children:"Merge review data unavailable"})]})})}):null,Z.includes("chat")?(0,t.jsx)(et.TabsContent,{value:"chat",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(sN.ChatTab,{featureId:o,worktreePath:l.worktreePath})}):null]})})}function sS({onApprove:e,onReject:s,isProcessing:r,isRejecting:n,chatInput:l,onChatInputChange:i}){let{t:o}=(0,a.useTranslation)("web");return(0,t.jsx)(ej,{onReject:s,onApprove:e,approveLabel:o("featureDrawer.approvePlan"),revisionPlaceholder:"Ask AI to revise the plan...",isProcessing:r,isRejecting:n,chatInput:l,onChatInputChange:i})}var sR=e.i(4625),sM=e.i(65405),sI=e.i(35094);let sP=(0,h.createServerReference)("4089ba419d252df2932e22e127726b0ed9eb812fbf",h.callServer,void 0,h.findSourceMapURL,"rebaseFeature");var sA=e.i(99045);function sz(e){return"requirements"===e.lifecycle&&"action-required"===e.state?"prd-review":"implementation"===e.lifecycle&&"action-required"===e.state?"tech-decisions":"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)?"merge-review":"overview"}function s$(e,t,r,a,n,i){let[o,d]=(0,s.useState)(!1),c=(0,s.useRef)(r),u=(0,s.useRef)(a);return c.current=r,u.current=a,(0,s.useEffect)(()=>{if(u.current(),!e)return;let s=!1;return d(!0),t(e).then(e=>{s||c.current(e)}).catch(()=>{!s&&n&&l.toast.error(n)}).finally(()=>{s||d(!1)}),()=>{s=!0}},[e,t,n,i]),o}let sE=(0,h.createServerReference)("40cb2477a2b12750e5eeb0da363934cdb702aa9723",h.callServer,void 0,h.findSourceMapURL,"getFeatureDrawerData"),sD=(0,h.createServerReference)("40dd13a4cdfedceca73a23ea3290b416bf0c09dac4",h.callServer,void 0,h.findSourceMapURL,"getBranchSyncStatus"),sL=new Map,sF=(0,h.createServerReference)("70f4397a2e3f84777f96895c37f6850f2da894cc33",h.callServer,void 0,h.findSourceMapURL,"updateFeaturePinnedConfig");function sq({view:e,urlTab:h,interactiveAgentEnabled:z=!0}){var $,E;let D,L,F,q,B,U,V=(0,k.useFeatureFlags)(),{t:W}=(0,a.useTranslation)("web"),H=(0,n.useRouter)(),G=(0,C.useSoundAction)("reject"),[_,K]=(0,s.useState)(e),[Z,Q]=(0,s.useState)(()=>"feature"===e.type?tg(e.node):null),[J,X]=(0,s.useState)(()=>"feature"===e.type?tg(e.node):null),[Y,ee]=(0,s.useState)(!1),[et,es]=(0,s.useState)(null),er=(0,s.useRef)(null);(0,s.useEffect)(()=>{K(t=>"feature"===t.type&&"feature"===e.type&&t.node.featureId===e.node.featureId?{...e,node:{...t.node,...e.node}}:e)},[e]);let ea="feature"===_.type?_.node:null,en=!!ea&&($=ea.state,tf.has($));(0,s.useEffect)(()=>{if("feature"!==_.type||Y)return;let e=tg(_.node),t=e?`${_.node.featureId}:${e.agentType}:${e.modelId}`:`${_.node.featureId}:none`,s=er.current!==t;er.current=t,Q(e),X(e),s&&es(null)},[_,Y]);let{events:el}=(0,R.useAgentEventsContext)(),ei=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(ei.current>el.length&&(ei.current=0),!ea||el.length<=ei.current)return;let e=el.slice(ei.current);for(let t of(ei.current=el.length,(0,sA.resolveSseEventUpdates)(e)))t.featureId===ea.featureId&&"deleting"!==ea.state&&(void 0!==t.state||void 0!==t.lifecycle)&&K(e=>{if("feature"!==e.type)return e;let s={...e.node,...void 0!==t.state&&{state:t.state},...void 0!==t.lifecycle&&{lifecycle:t.lifecycle}};return{...e,node:s,initialTab:sz(s)}})},[el,ea]);let eo=(0,n.usePathname)().startsWith("/feature/");E=ea?.featureId??null,D=(0,s.useRef)(eo),L=(0,s.useRef)(!1),F=(0,s.useRef)(0),q=(0,s.useCallback)(async()=>{if(!E||L.current)return;L.current=!0;let e=F.current;try{let t=await sE(E);if(!t||e!==F.current)return;K(e=>(function(e,t){if("feature"!==e.type)return e;let s={...e.node,...t},r=s.state!==e.node.state||s.lifecycle!==e.node.lifecycle;return{...e,node:s,initialTab:r?sz(s):e.initialTab}})(e,t))}catch{}finally{L.current=!1}},[E,K]),B=(0,s.useRef)(!1),(0,s.useEffect)(()=>{!eo||D.current&&B.current||(B.current=!0,F.current+=1,L.current=!1,q()),D.current=eo},[eo,q]),(0,s.useEffect)(()=>{if(!eo||!E)return;let e=setInterval(()=>{q()},15e3);return()=>clearInterval(e)},[eo,E,q]);let ed=(0,s.useCallback)(()=>{H.push("/")},[H]),[ec,eu]=(0,s.useState)(""),[ex,em]=(0,s.useState)(null),[ep,eh]=(0,s.useState)({}),[ef,eg]=(0,s.useState)({}),[eb,ej]=(0,s.useState)(null),[ev,ey]=(0,s.useState)(void 0),[eN,ew]=(0,s.useState)(null),[ek,eC]=(0,s.useState)(!1),[eT,eS]=(0,s.useState)(!1),[eR,eM]=(0,s.useState)(!1),eI=`${ea?.featureId}:${ea?.state}`,eP=(0,s.useRef)(eI);(0,s.useEffect)(()=>{eI!==eP.current&&(eP.current=eI,eM(!1))},[eI]);let[eA,ez]=(0,s.useState)(!1),e$=(0,s.useRef)(!1),eE="feature"===_.type?_.initialTab:void 0;(0,s.useEffect)(()=>{eu("")},[eE]);let eD=(0,s.useRef)(0),eL=(0,s.useRef)(ea?.state),eF=(0,s.useRef)(ea?.lifecycle);(ea?.state!==eL.current||ea?.lifecycle!==eF.current)&&(eL.current=ea?.state,eF.current=ea?.lifecycle,eD.current+=1);let eq=eD.current,eO=s$(ea?.lifecycle==="requirements"&&ea?.state==="action-required"?ea.featureId:null,y,e=>{if(e.error)return void l.toast.error(e.error);if(e.questionnaire){em(e.questionnaire);let t={};for(let s of e.questionnaire.questions){let e=s.options.find(e=>e.recommended);e&&(t[s.id]=e.id)}eh(t),eg(t)}},()=>{eh({}),eg({}),em(null)},"Failed to load questionnaire",eq),eB=ea?.lifecycle==="implementation"&&ea?.state==="action-required"?ea.featureId:null,eU=s$(eB,N,e=>{e.error?l.toast.error(e.error):e.techDecisions&&ej(e.techDecisions)},()=>ej(null),"Failed to load tech decisions",eq),eV=s$(eB,y,e=>{e.productDecisions&&ey(e.productDecisions)},()=>ey(void 0),void 0,eq),eW=s$(ea?.lifecycle==="review"&&(ea?.state==="action-required"||ea?.state==="error")||ea?.lifecycle==="maintain"&&ea?.pr?ea.featureId:null,w,e=>{"error"in e?l.toast.error(e.error):ew(e)},()=>ew(null),"Failed to load merge review data",eq),eH=ec.trim().length>0,eG=ea?.lifecycle==="requirements"&&ea?.state==="action-required"&&Object.keys(ef).some(e=>ef[e]!==ep[e]),e_=(0,s.useCallback)(()=>{eu(""),eh({...ef})},[ef]),{attemptClose:eK}=(0,T.useGuardedDrawerClose)({open:eo,isDirty:eH||eG,onClose:ed,onReset:e_}),eZ=(0,s.useCallback)(async(e,t,s=[],r)=>{if(!Y&&ea?.featureId){e$.current=!0,ez(!0);try{let a=s.map(e=>e.path).filter(Boolean),n=s.filter(e=>e.notes?.trim()),i=n.length>0?`${e}
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36986,e=>{"use strict";var t=e.i(20314),s=e.i(79054),r=e.i(31777);e.i(41001);var a=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)("6039087a3381f6a6686ef42b534ddbf3f8f67bdd22",h.callServer,void 0,h.findSourceMapURL,"approveFeature");var g=e.i(92410),b=e.i(16129),j=e.i(65257);let v=(0,h.createServerReference)("709a84cd1e3ffa8578d58ff4eb4f39dd6538631e41",h.callServer,void 0,h.findSourceMapURL,"rejectFeature"),y=(0,h.createServerReference)("4083d006ea41189fa2953e9550aa68461da1b4b99c",h.callServer,void 0,h.findSourceMapURL,"getFeatureArtifact"),N=(0,h.createServerReference)("408176b887fbc26be0b73439d485b1cd75e14100d0",h.callServer,void 0,h.findSourceMapURL,"getResearchArtifact"),w=(0,h.createServerReference)("405394ebaf3f20fd317ae36dfee415d2e7460758af",h.callServer,void 0,h.findSourceMapURL,"getMergeReviewData");var k=e.i(75921),C=e.i(8361),T=e.i(30153),S=e.i(8537),R=e.i(39443);e.i(1650);var M=e.i(11495);e.i(99348);var I=e.i(5259),P=e.i(2828);e.i(31566);var A=e.i(65104),z=e.i(8986),$=e.i(38573),E=e.i(19933),D=e.i(70471),L=e.i(51251);let F="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40";function q({loading:e,error:s,icon:r}){return e?(0,t.jsx)(i.Loader2,{className:"size-3.5 animate-spin"}):s?(0,t.jsx)(L.CircleAlert,{className:"text-destructive size-3.5"}):(0,t.jsx)(r,{className:"size-4"})}function O({actions:e,repositoryPath:r,worktreePath:a,showSpecs:n}){let[l,i]=(0,s.useState)(!1);return(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInIde,disabled:e.ideLoading,"aria-label":"Open in IDE",children:(0,t.jsx)(q,{loading:e.ideLoading,error:e.ideError,icon:z.Code2})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open in IDE"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openInShell,disabled:e.shellLoading,"aria-label":"Open terminal",children:(0,t.jsx)(q,{loading:e.shellLoading,error:e.shellError,icon:$.Terminal})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open terminal"})]}),(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openFolder,disabled:e.folderLoading,"aria-label":"Open folder",children:(0,t.jsx)(q,{loading:e.folderLoading,error:e.folderError,icon:E.FolderOpen})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open folder"})]}),n?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:e.openSpecsFolder,disabled:e.specsLoading,"aria-label":"Open specs",children:(0,t.jsx)(q,{loading:e.specsLoading,error:e.specsError,icon:D.FileText})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:"Open specs"})]}):null,(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:F,onClick:()=>{navigator.clipboard.writeText(a??r),i(!0),setTimeout(()=>i(!1),2e3)},"aria-label":"Copy path",children:l?(0,t.jsx)(x.Check,{className:"size-3.5 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:l?"Copied!":"Copy path"})]})]})})}var B=e.i(79687),U=e.i(16489),V=e.i(74294),W=e.i(3645);let H=(0,W.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),G=(0,W.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),_=(0,W.default)("file-check",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var K=e.i(18532),Z=e.i(93192);let Q=(0,W.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var J=e.i(48109),X=e.i(38227),Y=e.i(53360),ee=e.i(76874),et=e.i(68304);let es=(0,h.createServerReference)("408ca5b81b3349b4c215f61818333e5fbb662c00f5",h.callServer,void 0,h.findSourceMapURL,"getFeaturePhaseTimings"),er=(0,h.createServerReference)("4036edf267a20af3a7289c742b0649f671be87bb7e",h.callServer,void 0,h.findSourceMapURL,"getFeaturePlan");e.i(47506);var ea=e.i(2929);let en=(0,e.i(94237).cva)("inline-block shrink-0",{variants:{size:{sm:"size-5",md:"size-8",lg:"size-12"}},defaultVariants:{size:"md"}}),el=[{r:9,spline:"0.12 0 0.04 1",opacity:1},{r:8.2,spline:"0.16 0 0.08 1",opacity:.95},{r:7.4,spline:"0.20 0 0.12 1",opacity:.9},{r:6.6,spline:"0.25 0 0.16 1",opacity:.84},{r:5.8,spline:"0.30 0 0.20 1",opacity:.76},{r:5,spline:"0.36 0 0.25 1",opacity:.67},{r:4.2,spline:"0.42 0 0.31 1",opacity:.56},{r:3.4,spline:"0.48 0 0.37 1",opacity:.44},{r:2.6,spline:"0.55 0 0.44 1",opacity:.32},{r:1.8,spline:"0.62 0 0.52 1",opacity:.2},{r:1,spline:"0.70 0 0.60 1",opacity:.1}];function ei({className:e,size:s="md",duration:a=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,r.cn)(en({size:s}),e),...n,children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("filter",{id:"comet-gooey",x:"-100%",y:"-100%",width:"300%",height:"300%",colorInterpolationFilters:"sRGB",children:[(0,t.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"2.5"}),(0,t.jsx)("feColorMatrix",{mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 -30",result:"goo"})]})}),(0,t.jsxs)("g",{filter:"url(#comet-gooey)",children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 50 50",to:"360 50 50",dur:`${a}s`,repeatCount:"indefinite"}),el.map(e=>(0,t.jsxs)("g",{children:[(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"spline",values:"0 50 50;360 50 50",keyTimes:"0;1",keySplines:e.spline,dur:"1s",repeatCount:"indefinite"}),(0,t.jsx)("circle",{cx:"50",cy:"18",r:e.r,fill:"currentColor",opacity:e.opacity})]},e.r)),(0,t.jsxs)("circle",{cx:"50",cy:"50",r:"4",fill:"currentColor",opacity:"0.15",children:[(0,t.jsx)("animate",{attributeName:"r",values:"3;5;3",dur:"2s",repeatCount:"indefinite"}),(0,t.jsx)("animate",{attributeName:"opacity",values:"0.1;0.25;0.1",dur:"2s",repeatCount:"indefinite"})]})]})]})}var eo=e.i(11345),ed=e.i(76016),ec=e.i(35364),eu=e.i(81846),ex=e.i(16868);let em=(0,W.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);var ep=e.i(58481),eh=e.i(48306);e.i(50032);var ef=e.i(86254),eg=e.i(42076);let eb=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]);function ej({onReject:e,onApprove:n,approveLabel:l,approveVariant:i="default",revisionPlaceholder:o,isProcessing:d=!1,isRejecting:c=!1,children:u,chatInput:m,onChatInputChange:p}){let{t:h}=(0,a.useTranslation)("web"),f="warning"===i,g=f?ep.AlertTriangle:x.Check,b=f?"bg-orange-500/85":"bg-blue-500/85",[j,v]=(0,s.useState)(""),y=m??j,N=p??v,w=(0,C.useSoundAction)("approve"),k=d||c,[T,S]=(0,s.useState)([]),[R,M]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null),[z,$]=(0,s.useState)(!1),[E,D]=(0,s.useState)(!1),[L,F]=(0,s.useState)(!1),q=y.trim().length>0,O=q?z||E&&L:!z,B=(0,s.useRef)(0),U=(0,s.useRef)(crypto.randomUUID()),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){("Control"===e.key||"Meta"===e.key)&&D(!0),"Shift"===e.key&&F(!0)}function t(e){("Control"===e.key||"Meta"===e.key)&&D(!1),"Shift"===e.key&&F(!1)}function s(){D(!1),F(!1)}return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",s),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",s)}},[]);let W=(0,s.useCallback)(async e=>{for(let t of(A(null),e)){if(t.size>0xa00000)return void A(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!eb.has(e))return void A(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();S(s=>[...s,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let s=new FormData;s.append("file",t),s.append("sessionId",U.current);let r=await fetch("/api/attachments/upload",{method:"POST",body:s});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));S(t=>t.filter(t=>t.id!==e)),A(t.error??"Upload failed");return}let a=await r.json();S(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{S(t=>t.filter(t=>t.id!==e)),A("Upload failed")}}},[]),H=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current+=1,1===B.current&&M(!0)},[]),G=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current-=1,0===B.current&&M(!1)},[]),_=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),K=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),B.current=0,M(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&W(t)},[W]),Z=(0,s.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let s=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&s.push(t)}s.length>0&&(e.preventDefault(),W(s))},[W]),Q=(0,s.useCallback)(async()=>{try{let e=await (0,eg.pickFiles)();e&&S(t=>{let s=new Set(t.map(e=>e.path)),r=e.filter(e=>!s.has(e.path)).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,mimeType:"application/octet-stream",path:e.path}));return r.length>0?[...t,...r]:t})}catch{}},[]),J=(0,s.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),X=(0,s.useCallback)((e,t)=>{S(s=>s.map(s=>s.id===e?{...s,notes:t}:s))},[]),Y=(0,s.useCallback)(()=>{N(""),S([]),A(null)},[N]),ee=(0,s.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),V.current?.requestSubmit())},[]),et="u">typeof navigator&&/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl";return(0,t.jsxs)("div",{className:"border-border shrink-0 border-t",children:[u,e?(0,t.jsx)(P.TooltipProvider,{delayDuration:400,children:(0,t.jsx)("form",{ref:V,onSubmit:function(t){t.preventDefault();let s=y.trim();if(O)w.play(),n(),Y();else{if(!s||!e)return;e(s,T.filter(e=>!e.loading)),Y()}},className:"p-3",children:(0,t.jsx)("div",{role:"region","aria-label":h("createDrawer.fileDropZone"),"data-drag-over":R?"true":"false",onDragEnter:H,onDragLeave:G,onDragOver:_,onDrop:K,className:(0,r.cn)("rounded-md border-2 border-transparent transition-colors",R&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{className:"border-input focus-within:ring-ring/50 focus-within:border-ring flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow] focus-within:ring-[3px]",children:[(0,t.jsx)(eh.Textarea,{placeholder:o??"Ask AI to revise...","aria-label":o??"Ask AI to revise...",disabled:k,value:y,onChange:e=>N(e.target.value),onKeyDown:ee,onPaste:Z,rows:1,className:"max-h-[35dvh] min-h-9 flex-1 resize-none overflow-y-auto rounded-none border-0 py-2 shadow-none focus-visible:ring-0","data-testid":"drawer-chat-input"}),T.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:T.map(e=>(0,t.jsx)(ef.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>J(e.id),disabled:k,loading:e.loading,notes:e.notes,onNotesChange:t=>X(e.id,t)},e.id))}),I?(0,t.jsx)("p",{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)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:Q,disabled:k,"aria-label":h("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(ex.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"top",children:h("chat.attachFiles")})]}),(0,t.jsx)("div",{onMouseLeave:()=>$(!1),children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"submit",disabled:k,"data-testid":"drawer-action-submit",className:(0,r.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&&E&&!L?"border-primary bg-muted ring-primary/30 shadow-sm ring-1":"border-border bg-muted/50 hover:bg-muted shadow-sm"),children:[(0,t.jsx)("div",{className:(0,r.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,r.cn)("absolute inset-0 z-10 flex items-center justify-center gap-2 pe-8 transition-opacity duration-300",O?"opacity-0":"opacity-100"),children:[(0,t.jsx)(em,{className:"h-4 w-4 shrink-0"}),"Reject"]}),(0,t.jsxs)("span",{className:(0,r.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,r.cn)(`border-input/60 absolute inset-y-0 right-0 z-20 flex w-8 cursor-pointer items-center justify-center rounded-e-[5px] border-s ${b} transition-opacity duration-300`,!q&&!z&&"pointer-events-none opacity-0"),onMouseEnter:()=>$(!0),children:(0,t.jsx)(eo.ChevronLeft,{className:"h-4 w-4 text-white"})})]})}),f?null:(0,t.jsx)(P.TooltipContent,{side:"top",children:O?l:h("drawerActionBar.sendRevisionFeedback")})]})})]})]})})})}):(0,t.jsx)("div",{className:"flex items-center gap-2 px-4 pb-4",children:(0,t.jsx)(ec.Button,{type:"button",className:"flex-1",disabled:k,onClick:()=>{w.play(),n()},children:l})})]})}function ev({data:e,selections:a,onSelect:n,onApprove:l,onReject:i,isProcessing:o=!1,isRejecting:d=!1,showHeader:c=!1,chatInput:u,onChatInputChange:x}){let{question:m,context:p,questions:h,finalAction:f}=e,[g,b]=(0,s.useState)(0),j=(0,C.useSoundAction)("select"),v=(0,C.useSoundAction)("navigate"),y=h.length,N=g===y-1,w=h[g],k=(0,s.useMemo)(()=>Object.keys(a).length,[a]),T=(0,s.useCallback)((e,t)=>{j.play(),n(e,t),N||setTimeout(()=>b(e=>e+1),250)},[n,N,j]);return 0===y?null:(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[c?(0,t.jsxs)("div",{className:"border-border flex items-start gap-3 border-b pb-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full bg-amber-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground mb-1.5 text-sm font-bold",children:m}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:p})]})]}):null,(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("label",{className:"text-foreground min-w-0 flex-1 text-sm font-semibold",children:[g+1,". ",w.question]}),(0,t.jsx)("div",{className:"mt-1.5 flex shrink-0 gap-1",children:h.map((e,s)=>(0,t.jsx)("button",{type:"button","aria-label":`Go to question ${s+1}`,className:(0,r.cn)("h-1.5 rounded-full transition-all duration-200",s===g?"bg-primary w-4":"w-1.5",s!==g&&a[e.id]?"bg-primary/50":"",s===g||a[e.id]?"":"bg-muted-foreground/25"),onClick:()=>{v.play(),b(s)}},e.id))})]}),(0,t.jsx)("div",{className:"space-y-2",children:w.options.map((e,s)=>{let n=a[w.id]===e.id,l=String.fromCharCode(65+s);return(0,t.jsx)("button",{type:"button",className:(0,r.cn)("border-border w-full overflow-hidden rounded-md border px-3 py-3 text-start text-xs transition-all","hover:border-primary/70 hover:bg-primary/5 group",n&&"border-primary bg-primary/5",e.isNew&&"animate-option-highlight"),disabled:o,onClick:()=>T(w.id,e.id),children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("span",{className:"text-muted-foreground mt-0.5 font-mono text-xs",children:[l,"."]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-foreground mb-0.5 text-xs font-semibold wrap-break-word",children:e.label}),(0,t.jsx)("div",{className:"text-muted-foreground text-xs leading-snug",children:e.rationale})]}),e.recommended||e.isNew?(0,t.jsx)("div",{className:"shrink-0 pt-0.5",children:e.recommended?(0,t.jsx)(eu.Badge,{className:"px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):(0,t.jsx)(eu.Badge,{className:"border-transparent bg-emerald-600 px-1.5 py-0 text-[10px] whitespace-nowrap text-white hover:bg-emerald-600/80",children:"New"})}):null]})},e.id)})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:0===g||o,onClick:()=>{v.play(),b(e=>e-1)},children:[(0,t.jsx)(eo.ChevronLeft,{className:"me-1 h-4 w-4"}),"Previous"]}),N?null:(0,t.jsxs)(ec.Button,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>{v.play(),b(e=>e+1)},children:[a[w.id]?"Next":"Skip",(0,t.jsx)(ed.ChevronRight,{className:"ms-1 h-4 w-4"})]})]})]}),(0,t.jsx)(ej,{onReject:i,onApprove:()=>l(f.id),approveLabel:f.label,revisionPlaceholder:"Ask AI to refine requirements...",isProcessing:o,isRejecting:d,chatInput:u,onChatInputChange:x,children:(0,t.jsx)("div",{className:(0,r.cn)("bg-muted h-1.5 overflow-hidden",k>0&&k<y||o?"opacity-100":"opacity-0","transition-opacity duration-200"),"data-testid":"progress-bar-container",children:o?(0,t.jsx)("div",{className:"bg-primary animate-indeterminate-progress h-full w-1/3"}):(0,t.jsx)("div",{className:"bg-primary h-full transition-all duration-300",style:{width:`${y>0?k/y*100:0}%`},"data-testid":"progress-bar"})})})]})}var ey=e.i(427);let eN=(0,W.default)("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]),ew={p:({children:e})=>(0,t.jsx)("p",{className:"text-muted-foreground mb-2 text-xs leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"text-foreground font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:s})=>s?(0,t.jsx)("code",{className:`${s} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-muted my-2 overflow-x-auto rounded-lg border p-3",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"text-muted-foreground mb-2 list-disc space-y-1 ps-4 text-xs",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"text-muted-foreground mb-2 list-decimal space-y-1 ps-4 text-xs",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"leading-relaxed",children:e}),a:({children:e,href:s})=>(0,t.jsx)("a",{href:s,className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e})};function ek({decision:e,index:r}){let[a,n]=(0,s.useState)(!1),l=(0,C.useSoundAction)("expand"),i=(0,C.useSoundAction)("collapse");return(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:r+1}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.title}),(0,t.jsx)("p",{className:"text-muted-foreground mt-0.5 text-xs",children:e.chosen})]})]}),"decisionName"in e&&e.decisionName?(0,t.jsx)(eu.Badge,{variant:"secondary",className:"bg-primary/10 text-primary shrink-0",children:e.decisionName}):null]}),e.rationale?(0,t.jsx)(ey.default,{components:ew,children:e.rationale}):null]}),e.rejected.length>0?(0,t.jsxs)("div",{className:"border-border border-t",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{a?i.play():l.play(),n(e=>!e)},className:"text-muted-foreground hover:bg-muted/50 flex w-full items-center gap-1.5 px-4 py-3 text-xs font-medium transition-colors",children:[(0,t.jsx)(ed.ChevronRight,{className:`h-3.5 w-3.5 transition-transform ${a?"rotate-90":""}`}),(0,t.jsx)(ee.Layers,{className:"h-3.5 w-3.5"}),"Other Options Considered (",e.rejected.length,")"]}),a?(0,t.jsx)("div",{className:"space-y-1.5 px-4 pb-3",children:e.rejected.map(e=>(0,t.jsx)("div",{className:"bg-primary/5 rounded-md px-3 py-2",children:(0,t.jsx)("span",{className:"text-foreground text-xs",children:e})},e))}):null]}):null]})}function eC({data:e}){let{summary:s,decisions:r}=e;return 0===r.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:"Technical Implementation Plan Review"}),s?(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,t.jsx)(eN,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Technical Decisions"})]}),r.map((e,s)=>(0,t.jsx)(ek,{decision:e,index:s},e.title))]})}var eT=e.i(41698);function eS({item:e,index:s}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsx)("div",{className:"space-y-2 px-4 py-3",children:(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",children:s+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"text-foreground text-sm leading-tight font-semibold",children:e.question}),(0,t.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,t.jsx)("p",{className:"text-muted-foreground min-w-0 truncate text-xs",children:e.selectedOption}),e.wasRecommended?(0,t.jsx)(eu.Badge,{className:"shrink-0 px-1.5 py-0 text-[10px] whitespace-nowrap",children:"AI Recommended"}):null]})]})]})})})}function eR({data:e}){let{questions:s}=e;return 0===s.length?null:(0,t.jsxs)("div",{className:"space-y-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eT.ClipboardList,{className:"text-primary h-4 w-4"}),(0,t.jsx)("h3",{className:"text-foreground text-sm font-bold",children:"Product Decisions"})]}),s.map((e,s)=>(0,t.jsx)(eS,{item:e,index:s},e.question))]})}var eM=e.i(30702);let eI=(0,W.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);var eP=e.i(48923),eA=e.i(49228);let ez=(0,W.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),e$=(0,W.default)("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),eE=(0,W.default)("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var eD=e.i(81181),eL=e.i(99105),eF=e.i(35e3),eq=e.i(30090),eq=eq,eO=e.i(17406);function eB({status:e}){switch(e){case eO.CiStatus.Success:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-green-50 text-green-700 hover:bg-green-50",children:[(0,t.jsx)(eF.CheckCircle2,{className:"me-1 h-3.5 w-3.5"}),"Passing"]});case eO.CiStatus.Pending:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-yellow-50 text-yellow-700 hover:bg-yellow-50",children:[(0,t.jsx)(i.Loader2,{className:"me-1 h-3.5 w-3.5 animate-spin"}),"Pending"]});case eO.CiStatus.Failure:return(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-red-50 text-red-700 hover:bg-red-50",children:[(0,t.jsx)(eq.default,{className:"me-1 h-3.5 w-3.5"}),"Failing"]})}}var eU=e.i(12919);let eV=(0,W.default)("file-minus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);var eW=e.i(35749);let eH={added:{icon:eU.FilePlus,label:"A",className:"text-green-600"},modified:{icon:eW.FileEdit,label:"M",className:"text-amber-600"},deleted:{icon:eV,label:"D",className:"text-red-600"},renamed:{icon:eW.FileEdit,label:"R",className:"text-blue-600"}};function eG({status:e}){let s=eH[e],a=s.icon;return(0,t.jsx)(a,{className:(0,r.cn)("h-3.5 w-3.5 shrink-0",s.className)})}function e_({hunk:e}){return(0,t.jsxs)("div",{className:"border-border border-t first:border-t-0",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-muted-foreground px-3 py-1 font-mono text-[10px]",children:e.header}),(0,t.jsx)("div",{className:"font-mono text-[11px] leading-[18px]",children:e.lines.map(e=>(0,t.jsxs)("div",{className:(0,r.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,r.cn)("w-4 shrink-0 text-center select-none","added"===e.type&&"text-green-700 dark:text-green-400","removed"===e.type&&"text-red-700 dark:text-red-400"),children:"added"===e.type?"+":"removed"===e.type?"-":" "}),(0,t.jsx)("span",{className:"min-w-0 flex-1 pe-2 break-all whitespace-pre-wrap",children:e.content})]},`${e.type}-${e.oldNumber??""}-${e.newNumber??""}`))})]})}function eK({file:e}){let[a,n]=(0,s.useState)(!1),l=e.path.split("/").pop()??e.path,i=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,t.jsxs)("div",{className:"border-border border-b last:border-b-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(!a),className:"hover:bg-muted/50 flex w-full items-center gap-2 px-3 py-2 text-start",children:[(0,t.jsx)(ed.ChevronRight,{className:(0,r.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform duration-150",a&&"rotate-90")}),(0,t.jsx)(eG,{status:e.status}),(0,t.jsx)("span",{className:"text-foreground min-w-0 flex-1 truncate text-xs",children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[i,"/"]}),l]}):l}),e.oldPath?(0,t.jsxs)("span",{className:"text-muted-foreground truncate text-[10px]",children:["← ",e.oldPath.split("/").pop()]}):null,(0,t.jsxs)("span",{className:"shrink-0 text-[10px]",children:[e.additions>0?(0,t.jsxs)("span",{className:"text-green-600",children:["+",e.additions]}):null,e.additions>0&&e.deletions>0?" ":null,e.deletions>0?(0,t.jsxs)("span",{className:"text-red-600",children:["-",e.deletions]}):null]})]}),a&&e.hunks.length>0?(0,t.jsx)("div",{className:"border-border overflow-x-auto border-t",children:e.hunks.map(e=>(0,t.jsx)(e_,{hunk:e},e.header))}):null]})}function eZ({fileDiffs:e}){return 0===e.length?null:(0,t.jsxs)("div",{className:"border-border rounded-lg border",children:[(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)(D.FileText,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changed Files"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:["(",e.length,")"]})]})}),(0,t.jsx)("div",{className:"border-border border-t",children:e.map(e=>(0,t.jsx)(eK,{file:e},`${e.status}-${e.path}`))})]})}let eQ={Screenshot:e$,Video:eE,TestOutput:D.FileText,TerminalRecording:$.Terminal},eJ=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp"]),eX=new Set([".mp4",".webm",".mov"]);function eY({evidence:e}){var r,a;let n,[l,i]=(0,s.useState)(!0),o=eQ[e.type]??e$,d=(n=(r=e.relativePath).lastIndexOf("."))>=0?r.slice(n).toLowerCase():"",c=(a=e.relativePath,`/api/evidence?path=${encodeURIComponent(a)}`),u="Screenshot"===e.type||eJ.has(d),x="Video"===e.type||eX.has(d),m="TestOutput"===e.type||"TerminalRecording"===e.type;return(0,t.jsxs)("li",{className:"border-border rounded-md border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(!l),className:"flex w-full cursor-pointer items-center gap-2.5 px-3 py-2.5 text-start",children:[l?(0,t.jsx)(eL.ChevronDown,{className:"text-muted-foreground h-3 w-3 shrink-0"}):(0,t.jsx)(ed.ChevronRight,{className:"text-muted-foreground h-3 w-3 shrink-0"}),(0,t.jsx)(o,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"text-foreground text-xs font-medium",children:e.description}),e.taskRef?(0,t.jsxs)("span",{className:"text-muted-foreground ms-1.5 text-[10px]",children:["(",e.taskRef,")"]}):null]}),(0,t.jsx)("a",{href:c,download:!0,onClick:e=>e.stopPropagation(),className:"text-muted-foreground hover:text-foreground shrink-0 rounded p-1 transition-colors","aria-label":"Download",children:(0,t.jsx)(eD.Download,{className:"h-3 w-3"})})]}),l&&c?(0,t.jsx)("div",{className:"border-border border-t px-3 py-2.5",children:u?(0,t.jsx)("img",{src:c,alt:e.description,className:"max-h-80 w-full rounded-md border object-contain",loading:"lazy"}):x?(0,t.jsx)("video",{src:c,controls:!0,className:"max-h-80 w-full rounded-md border",preload:"metadata",children:(0,t.jsx)("track",{kind:"captions"})}):m?(0,t.jsx)(e0,{url:c}):(0,t.jsx)("p",{className:"text-muted-foreground truncate font-mono text-[10px]",children:e.relativePath})}):null,null]})}function e0({url:e}){let[r,a]=(0,s.useState)(null),[n,l]=(0,s.useState)(!1);return n?r?(0,t.jsx)("pre",{className:"bg-muted/50 max-h-60 overflow-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:r}):(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");a(t.length>100?`${t.slice(0,100).join("\n")}
|
|
2
|
+
...`:e)}).catch(()=>a(null)).finally(()=>l(!0)),(0,t.jsx)("div",{className:"bg-muted/50 h-16 animate-pulse rounded-md"}))}function e1({evidence:e}){return(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(e$,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Evidence"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"text-[10px]",children:e.length})]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map(e=>(0,t.jsx)(eY,{evidence:e},`${e.type}-${e.relativePath}`))})]})})}function e2({data:e,readOnly:s=!1,onApprove:r,onReject:a,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&&a?()=>a("Resolve merge conflicts",[]):r;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-emerald-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h2",{className:"text-foreground text-sm font-bold",children:s?"Merge History":"Merge Review"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:s?"This feature was merged. Review the pull request details and evidence below.":d?"Review the pull request details and approve to merge.":"Review the changes and approve to merge."})]})]}),x?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(eA.GitBranch,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"secondary",className:"font-mono text-[11px]",children:x.source}),(0,t.jsx)(ez,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"font-mono text-[11px]",children:x.target})]})}):null,d?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"space-y-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary flex items-center gap-1.5 text-sm font-semibold underline underline-offset-2",children:["PR #",d.number,(0,t.jsx)(eM.ExternalLink,{className:"h-3.5 w-3.5"})]}),(0,t.jsx)(eu.Badge,{variant:"outline",className:"text-xs",children:d.status})]}),!1===d.mergeable?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Merge Status"}),(0,t.jsxs)(eu.Badge,{className:"border-transparent bg-orange-50 text-orange-700 hover:bg-orange-50",children:[(0,t.jsx)(ep.AlertTriangle,{className:"me-1 h-3.5 w-3.5"}),"Conflicts"]})]}):null,d.ciStatus&&!0!==h?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"CI Status"}),(0,t.jsx)(eB,{status:d.ciStatus})]}):null,d.commitHash?(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Commit"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(eP.GitCommitHorizontal,{className:"text-muted-foreground h-3.5 w-3.5"}),(0,t.jsx)("code",{className:"bg-muted text-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:d.commitHash.slice(0,7)})]})]}):null]})}):null,c?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,t.jsx)(eI,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-foreground text-xs font-semibold",children:"Changes"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-3",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.filesChanged}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"files"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-green-600",children:["+",c.additions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"additions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"text-sm font-bold text-red-600",children:["-",c.deletions]}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"deletions"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-foreground text-sm font-bold",children:c.commitCount}),(0,t.jsx)("div",{className:"text-muted-foreground text-[10px]",children:"commits"})]})]})]})}):m?(0,t.jsx)("div",{className:"border-border rounded-lg border",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3",children:[(0,t.jsx)(ep.AlertTriangle,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:m})]})}):null,p&&p.length>0?(0,t.jsx)(e1,{evidence:p}):null,u&&u.length>0?(0,t.jsx)(eZ,{fileDiffs:u}):null]}),!s&&(0,t.jsx)(ej,{onReject:a,onApprove:g,approveLabel:f?"Resolve Conflicts":"Approve Merge",approveVariant:f?"warning":"default",revisionPlaceholder:"Ask AI to revise before merging...",isProcessing:n,isRejecting:l,chatInput:i,onChatInputChange:o})]})}var e5=e.i(55016);let e3=(0,W.default)("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),e4=(0,W.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var e6=e.i(12103),e8=e.i(59311),e7=e.i(39200);let e9=(0,W.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var te=e.i(60253),tt=e.i(2287),ts=e.i(28267),tr=e.i(80436);let ta=(0,W.default)("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]),tn=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function tl(e){let t=e.lastIndexOf(".");return t>=0&&tn.has(e.slice(t).toLowerCase())}function ti(e){let t=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"",s=tl(e)?`image/${t.slice(1).replace("jpg","jpeg")}`:"",r=new URLSearchParams({path:e,...s&&{mimeType:s}});return`/api/attachments/preview?${r.toString()}`}let to=/(?:^|\s)@(\/[^\s]+)/g;function td({text:e,attachmentPaths:s}){let r=function(e){let t=[],s=0;for(let r of e.matchAll(to)){let a=r.index,n=a+(r[0].length-r[0].trimStart().length);n>s&&t.push({type:"text",value:e.slice(s,n)}),t.push({type:"attachment",path:r[1]}),s=a+r[0].length}return s<e.length&&t.push({type:"text",value:e.slice(s)}),t}(e),a=r.some(e=>"attachment"===e.type),n=s?.filter(Boolean)??[];return a||0!==n.length?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[r.map(e=>{if("text"===e.type){let s=e.value.trim();return s?(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:s},`text-${s.slice(0,40)}`):null}return(0,t.jsx)(tc,{path:e.path},`att-${e.path}`)}),n.map(e=>(0,t.jsx)(tc,{path:e},`extra-${e}`))]}):(0,t.jsx)("span",{className:"text-sm leading-relaxed",children:e})}function tc({path:e}){let r=e.split("/").pop()??e,[a,n]=(0,s.useState)(!1);return tl(e)?a?(0,t.jsxs)("div",{"data-testid":"inline-attachment-image-error",className:"text-muted-foreground flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,t.jsx)(ta,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:r})]}):(0,t.jsxs)(tt.Dialog,{children:[(0,t.jsx)(tt.DialogTrigger,{asChild:!0,children:(0,t.jsx)("img",{src:ti(e),alt:r,"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)(tt.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)(ts.VisuallyHidden.Root,{children:(0,t.jsxs)(tt.DialogTitle,{children:["Preview: ",r]})}),(0,t.jsx)("div",{className:"relative bg-black/90",children:(0,t.jsx)("img",{src:ti(e),alt:r,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:r})}),(0,t.jsx)("a",{href:ti(e),download:r,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${r}`,children:(0,t.jsx)(tr.DownloadIcon,{className:"h-4 w-4"})})]})]})]}):(0,t.jsx)("a",{href:ti(e),download:r,"data-testid":"inline-attachment-file",className:"text-primary text-sm underline underline-offset-2",children:r})}e.i(81803);var tu=e.i(72714),tx=e.i(41413),tm=e.i(86782),tp=e.i(29847);function th(e){if(0===e)return"0s";let t=Math.floor(e/1e3);if(0===t)return"<1s";let s=Math.floor(t/3600),r=Math.floor(t%3600/60),a=t%60;return s>0?`${s}h ${r}m`:r>0?`${r}m ${a}s`:`${a}s`}let tf=new Set(["pending","action-required","error"]);function tg(e){return e?.agentType?{agentType:e.agentType,modelId:e.modelId??""}:null}function tb({icon:e,title:s,children:r}){return(0,t.jsxs)("div",{className:"px-3 pt-4 pb-1",children:[(0,t.jsxs)("div",{className:"text-foreground mb-2 flex items-center gap-1.5 text-sm font-semibold tracking-wider uppercase",children:[(0,t.jsx)(e,{className:"size-4 opacity-50"}),s]}),r]})}function tj({children:e,className:s}){return(0,t.jsx)("div",{className:(0,r.cn)("bg-muted/60 rounded-md border border-transparent p-3",s),children:e})}function tv({label:e,children:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-foreground/40 text-[11px] font-medium tracking-wider uppercase",children:e}),(0,t.jsx)("span",{className:"text-sm leading-snug",children:s})]})}function ty({on:e,label:s}){return(0,t.jsxs)("span",{className:(0,r.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)(te.X,{className:"size-3"}),s]})}let tN={[eO.PrStatus.Open]:"text-blue-600 dark:text-blue-400",[eO.PrStatus.Merged]:"text-purple-600 dark:text-purple-400",[eO.PrStatus.Closed]:"text-red-600 dark:text-red-400"};function tw({data:e,pinnedConfig:a,syncStatus:n,syncLoading:l,syncError:i,onRefreshSync:o,onRebaseOnMain:d,rebaseLoading:c,rebaseError:u}){var x;let m,p,h,f,g,b,j="maintain"===e.lifecycle,v=function(e){let[t,r]=(0,s.useState)(null),a=(0,s.useRef)(null);return(0,s.useEffect)(()=>e?(r(th(Math.max(0,Date.now()-e))),a.current=setInterval(()=>{r(th(Math.max(0,Date.now()-e)))},1e3),()=>{a.current&&clearInterval(a.current)}):void r(null),[e]),t}("running"===e.state||"action-required"===e.state?e.startedAt:void 0),y=ea.featureNodeStateConfig[e.state],N=!!e.summary&&!(e.userQuery&&e.summary?.trim()===e.userQuery.trim());return(0,t.jsxs)("div",{"data-testid":"feature-drawer-status",className:"pb-4",children:[!j&&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,r.cn)("h-full rounded-full transition-all",y.progressClass),style:{width:`${e.progress}%`}})})}):null,e.oneLiner||e.userQuery||N?(0,t.jsx)(tb,{icon:e4,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)(td,{text:e.userQuery})}):null,N?(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:eP.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)(eM.ExternalLink,{className:"size-3"})]}),(0,t.jsx)("span",{className:(0,r.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)(ep.AlertTriangle,{className:"size-3 shrink-0"})," Conflicts"]}):null,e.pr.ciStatus&&!0!==e.hideCiStatus?(0,t.jsx)(eB,{status:e.pr.ciStatus}):null,e.pr.commitHash?(0,t.jsx)("code",{className:"text-foreground/40 ml-auto font-mono text-[11px]",children:e.pr.commitHash.slice(0,7)}):null]})})}):null,(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-3 pb-1",children:[e.branch?(0,t.jsx)(tj,{children:(0,t.jsxs)(tv,{label:"Branch",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(eA.GitBranch,{className:"text-foreground/30 size-3 shrink-0"}),(0,t.jsx)("code",{className:"font-mono text-[11px]",children:e.branch})]}),e.baseBranch?(0,t.jsxs)("span",{className:"text-foreground/30 block text-[10px]",children:["from ",e.baseBranch]}):null]})}):null,e.agentType||e.modelId?(0,t.jsx)(tj,{children:(0,t.jsx)(tv,{label:"Agent",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[e.agentType?(m=(0,tm.getAgentTypeIcon)(e.agentType),(0,t.jsx)(m,{className:"size-3.5 shrink-0 opacity-50"})):null,e.agentType?(0,t.jsx)("span",{children:tm.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,tp.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)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),(x=e.createdAt,p=Date.now(),(b=Math.floor((g=Math.floor((f=Math.floor((p-(h="string"==typeof x?new Date(x).getTime():x))/6e4))/60))/24))>30?new Date(h).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):b>0?`${b}d ago`:g>0?`${g}h ago`:f>0?`${f}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)(Y.Zap,{className:"size-3.5"})," Fast"]})})}):null,e.runtime||v?(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)(e5.Clock,{className:"text-foreground/30 size-3 shrink-0"}),e.runtime??v]})})}):null]}),e.blockedBy||e.errorMessage?(0,t.jsx)(tb,{icon:ep.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,d&&e.branch&&o?(0,t.jsx)(tb,{icon:e8.RefreshCw,title:"Branch Sync",children:(0,t.jsx)(tk,{syncStatus:n??null,syncLoading:l??!1,syncError:i??null,onRefreshSync:o,onRebaseOnMain:d,rebaseLoading:c??!1,rebaseError:u??null})}):null,(0,t.jsx)(tT,{data:e,pinnedConfig:a}),e.injectedSkills?.length?(0,t.jsx)(tS,{skills:e.injectedSkills}):null]})}function tk({syncStatus:e,syncLoading:s,syncError:n,onRefreshSync:l,onRebaseOnMain:i,rebaseLoading:o,rebaseError:d}){let{t:c}=(0,a.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:s&&!e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsx)("span",{className:"text-foreground/40",children:"Checking..."})]}):n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-red-500"}),(0,t.jsx)("span",{className:"text-destructive text-xs",children:n})]}):o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ei,{size:"sm"}),(0,t.jsxs)("span",{children:["Rebasing on ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),"..."]})]}):u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.AlertTriangle,{className:"size-3.5 text-orange-500"}),(0,t.jsxs)("span",{children:[e.behind," behind ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eF.CheckCircle2,{className:"size-3.5 text-green-500"}),(0,t.jsxs)("span",{children:["Up to date · ",(0,t.jsx)("code",{className:"font-mono text-[11px]",children:m}),e.ahead>0?(0,t.jsxs)("span",{className:"text-foreground/30 ml-1 text-[11px]",children:["· ",e.ahead," ahead"]}):null]})]}):null}),(e||n)&&!o?(0,t.jsx)("button",{onClick:l,disabled:s,className:"text-foreground/30 hover:text-foreground/60 hover:bg-foreground/5 inline-flex size-6 items-center justify-center rounded-sm disabled:opacity-50","aria-label":c("branchSyncStatus.refreshSyncStatus"),children:(0,t.jsx)(e8.RefreshCw,{className:(0,r.cn)("size-3",s&&"animate-spin")})}):null]}),u&&!o?(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)(tu.ActionButton,{label:c("branchSyncStatus.rebaseOnMain"),onClick:i,loading:!1,error:!!d,icon:Q,variant:"outline",size:"sm"})}):null,d?(0,t.jsx)("p",{className:"text-destructive pt-1 text-[11px]",children:d}):null]})}function tC({pinnedConfig:e}){let s=(0,tm.getAgentTypeIcon)(e.agentType),r=e.modelId?(0,tp.getModelMeta)(e.modelId).displayName||e.modelId:"No model selected";return(0,t.jsxs)(tj,{"data-testid":"feature-pinned-config-card",className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("div",{className:"text-foreground/40 flex items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,t.jsx)(e7.Settings,{className:"size-3"})," Pinned Execution"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(s,{className:"size-4 shrink-0 opacity-60"}),(0,t.jsx)("span",{className:"font-medium",children:tm.agentTypeLabels[e.agentType]??e.agentType}),(0,t.jsx)("span",{className:"text-foreground/20",children:"/"}),(0,t.jsx)("span",{className:"text-foreground/60",children:r})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Change the pinned agent and model before the next start, approval, or retry."})]}),(0,t.jsx)(tx.AgentModelPicker,{initialAgentType:e.agentType,initialModel:e.modelId,agentType:e.agentType,model:e.modelId,onSave:e.onSave,saveError:e.error,saving:e.saving,disabled:e.saving,mode:"settings"})]})}function tT({data:e,pinnedConfig:s}){var r;let a=null!=e.approvalGates||null!=e.push||null!=e.openPr||null!=e.ciWatchEnabled||null!=e.enableEvidence||null!=e.forkAndPr||null!=e.commitSpecs||null!=e.injectSkills,n=null!=s&&(r=e.state,tf.has(r));return a||n?(0,t.jsx)(tb,{icon:e7.Settings,title:"Settings",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[n?(0,t.jsx)(tC,{pinnedConfig:s}):null,a?(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)(e9,{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)(e3,{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.injectSkills?(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)(e6.Puzzle,{className:"size-3"})," Skills"]}),(0,t.jsx)("div",{className:"flex flex-col gap-0.5",children:(0,t.jsx)(ty,{on:e.injectSkills,label:"Inject"})})]}):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)(eA.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]}):null]})}):null}function tS({skills:e}){return(0,t.jsx)(tb,{icon:e6.Puzzle,title:"Feature Skills",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>(0,t.jsx)(eu.Badge,{variant:"secondary",children:e},e))})})}let tR=(0,W.default)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var eq=eq,tM=e.i(94819),tI=e.i(58860);let tP=(0,W.default)("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),tA=(0,W.default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);function tz(e,t){if(null!=e.durationMs&&e.durationMs>0)return e.durationMs;if(!e.completedAt&&e.startedAt){let s=new Date(e.startedAt).getTime();if(!Number.isNaN(s))return Math.max(0,t-s)}return 0}function t$(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tE(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 tD(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}let tL={analyze:"Analyzing",requirements:"Requirements",research:"Researching",plan:"Planning",implement:"Implementing",rebase:"Rebasing","fast-implement":"Fast Implement",evidence:"Evidence",validate:"Validating",repair:"Repairing",merge:"Merging"},tF={"run:started":{label:"started",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:d.Play},"run:resumed":{label:"resumed",colorClass:"text-blue-600",bgClass:"bg-blue-50 dark:bg-blue-950/30",icon:X.RotateCcw},"run:completed":{label:"completed",colorClass:"text-emerald-600",bgClass:"bg-emerald-50 dark:bg-emerald-950/30",icon:eF.CheckCircle2},"run:failed":{label:"failed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:stopped":{label:"stopped",colorClass:"text-amber-600",bgClass:"bg-amber-50 dark:bg-amber-950/30",icon:c.Square},"run:crashed":{label:"crashed",colorClass:"text-red-600",bgClass:"bg-red-50 dark:bg-red-950/30",icon:eq.default},"run:rejected":{label:"rejected",colorClass:"text-orange-600",bgClass:"bg-orange-50 dark:bg-orange-950/30",icon:tM.Ban}};function tq(e){return e.startsWith("run:")}function tO({timings:e,loading:r,error:n,rejectionFeedback:l}){let{t:o}=(0,a.useTranslation)("web"),d=function(e){let[t,r]=(0,s.useState)(Date.now),a=(0,s.useRef)(null);return(0,s.useEffect)(()=>(e&&e.some(e=>!e.phase.startsWith("run:")&&!e.completedAt&&e.startedAt)&&(a.current=setInterval(()=>r(Date.now()),1e3)),()=>{a.current&&(clearInterval(a.current),a.current=null)}),[e]),t}(e);if(r)return(0,t.jsx)("div",{"data-testid":"activity-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(n)return(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-base text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]});if(!e||0===e.length)return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(e5.Clock,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-base",children:o("activityTab.noActivityRecorded")})]});let c=e.filter(e=>!tq(e.phase)),u=Math.max(...c.map(e=>tz(e,d)),...c.map(e=>e.approvalWaitMs??0),0),x=function(e,t){if(!e.length)return[];let s=e.filter(e=>"run:rejected"===e.phase).length,r=t?.length??0,a=e;if(r>s){a=[...e];let n=e[e.length-1].agentRunId;for(let e=s;e<r;e++){let r=t[e];e>s&&a.push({agentRunId:n,phase:"run:resumed",startedAt:r.timestamp??`synthetic-resumed-${e}`}),a.push({agentRunId:n,phase:"run:rejected",startedAt:r.timestamp??`synthetic-${e}`})}}let n=[],l=[],i=0;for(let e of a)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+tz(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)(tB,{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 tB({iteration:e,showHeader:s,maxDurationMs:r,now:a}){let n=function(e){let t=[...e.timings].reverse().find(e=>tq(e.phase));if(!t)return null;switch(t.phase){case"run:rejected":return{label:"Rejected",colorClass:"text-orange-600",dotClass:"bg-orange-500"};case"run:completed":return{label:"Completed",colorClass:"text-emerald-600",dotClass:"bg-emerald-500"};case"run:failed":return{label:"Failed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:crashed":return{label:"Crashed",colorClass:"text-red-600",dotClass:"bg-red-500"};case"run:stopped":return{label:"Stopped",colorClass:"text-amber-600",dotClass:"bg-amber-500"};default:return null}}(e);return(0,t.jsxs)("div",{"data-testid":`iteration-${e.number}`,className:"border-border/50 bg-card/50 flex flex-col overflow-hidden rounded-lg border",children:[s?(0,t.jsxs)("div",{className:"bg-muted/30 border-border/50 flex items-center justify-between border-b px-3 py-1.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground text-sm font-semibold tracking-wide",children:["Iteration ",e.number]}),n?(0,t.jsxs)("span",{className:`flex items-center gap-1 text-xs font-medium ${n.colorClass}`,children:[(0,t.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${n.dotClass}`}),n.label]}):null]}):null,(0,t.jsxs)("div",{className:"relative flex flex-col",children:[(0,t.jsx)("div",{className:"bg-border/60 absolute top-4 bottom-4 left-[21.5px] w-px"}),e.timings.map((s,n)=>{if(tq(s.phase)){let r,a="run:rejected"===s.phase,l="run:failed"===s.phase||"run:crashed"===s.phase||"run:stopped"===s.phase;if(a)r=e.rejectionMessage;else if(l){let t=[...e.timings].reverse().find(e=>!tq(e.phase)&&e.errorMessage);r=t?.errorMessage??s.errorMessage}return(0,t.jsx)(tU,{timing:s,message:r,attachments:a?e.rejectionAttachments:void 0,isFirst:0===n,isLast:n===e.timings.length-1},`${s.agentRunId}-${s.phase}-${s.startedAt}`)}return(0,t.jsx)(tV,{timing:s,maxDurationMs:r,now:a},`${s.agentRunId}-${s.phase}-${s.startedAt}`)})]})]})}function tU({timing:e,message:s,attachments:r,isFirst:a,isLast:n}){let l,i=tF[e.phase];if(!i)return null;let o=r&&r.length>0,d=i.icon;return(0,t.jsxs)("div",{className:`relative flex flex-col gap-1 px-3 ${a?"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:tE(String(e.startedAt))}):null]}),s?(l="run:failed"===e.phase||"run:crashed"===e.phase||"run:stopped"===e.phase,(0,t.jsxs)("div",{className:`ml-[26px] flex items-start gap-1.5 rounded-md px-2 py-1.5 ${l?"bg-red-50/50 dark:bg-red-950/20":"bg-orange-50/50 dark:bg-orange-950/20"}`,children:[l?(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-red-400"}):(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-orange-400"}),(0,t.jsxs)("span",{"data-testid":l?"error-message-text":"rejection-feedback-text",className:"text-muted-foreground text-xs leading-relaxed italic",children:["— ",s]})]})):null,o?(0,t.jsx)("div",{"data-testid":"rejection-feedback-attachments",className:"ml-[26px]",children:(0,t.jsx)(td,{text:"",attachmentPaths:r})}):null]})}function tV({timing:e,maxDurationMs:r,now:n}){let{t:l}=(0,a.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=tL[i]??i,p=c?`Phase ${o.replace("phase-","")}`:null!==o?`${m} #${o}`:m,h=tz(e,n),f=!e.completedAt&&!!e.startedAt,g=f?15:2,b=r>0?Math.max(g,h/r*100):g,j=e.completedAt?c?"bg-emerald-400":d?"bg-amber-500":"bg-emerald-500":"bg-blue-500",v=null!=e.inputTokens||null!=e.outputTokens?(e.inputTokens??0)+(e.outputTokens??0):null,[y,N]=(0,s.useState)(!1),w=(0,s.useCallback)(()=>{e.prompt&&navigator.clipboard.writeText(e.prompt).then(()=>{N(!0),setTimeout(()=>N(!1),1500)})},[e.prompt]);return(0,t.jsxs)("div",{className:`group/phase relative flex flex-col gap-0.5 px-3 py-1.5 ${d?"ms-4":""}`,children:[(0,t.jsxs)("div",{"data-testid":`timing-bar-${e.phase}`,className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"relative z-10 flex h-5 w-5 shrink-0 items-center justify-center",children:(0,t.jsx)("div",{className:`rounded-full ${f?"h-3 w-3 animate-pulse":"h-2.5 w-2.5"} ${f?"bg-blue-500":e.completedAt?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,t.jsx)("span",{className:`w-28 shrink-0 truncate text-sm font-medium ${d?"text-muted-foreground":"text-foreground/80"}`,children:p}),e.prompt?(0,t.jsx)("button",{type:"button",onClick:w,className:"text-muted-foreground/50 hover:text-foreground/70 -ms-1 shrink-0 opacity-0 transition-opacity group-hover/phase:opacity-100",title:l("activityTab.copyPromptToClipboard"),children:y?(0,t.jsx)(x.Check,{className:"h-3.5 w-3.5 text-emerald-500"}):(0,t.jsx)(u.Copy,{className:"h-3.5 w-3.5"})}):null,(0,t.jsx)("div",{className:`bg-muted relative min-w-0 flex-1 overflow-hidden rounded-full ${d?"h-1.5":"h-2"}`,children:f?(0,t.jsx)("div",{className:"absolute inset-0 rounded-full bg-blue-500/30",style:{backgroundImage:"linear-gradient(90deg, transparent 0%, rgb(59 130 246) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}):(0,t.jsx)("div",{className:`h-full rounded-full transition-all duration-300 ${j}`,style:{width:`${Math.min(b,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-sm font-medium tabular-nums",children:th(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:tE(e.startedAt)}):null,null!=v&&v>0?(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-50"}),t$(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)(tR,{className:"h-3 w-3 opacity-50"}),tD(e.costUsd)]}):null]}),null!=e.approvalWaitMs&&e.approvalWaitMs>0?(0,t.jsx)(tW,{timing:e,maxDurationMs:r}):null]})}function tW({timing:e,maxDurationMs:s}){let r=e.approvalWaitMs??0,a=s>0?Math.max(2,r/s*100):2;return(0,t.jsxs)("div",{"data-testid":`approval-wait-${e.phase}`,className:"ml-[26px] flex items-center gap-2 rounded-md bg-amber-50/50 px-1.5 py-1 dark:bg-amber-950/20",children:[(0,t.jsx)(tI.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(a,100)}%`}})}),(0,t.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-end text-xs tabular-nums",children:th(r)})]})}function tH({totalExecMs:e,totalWaitMs:s,totalInputTokens:r,totalOutputTokens:n,totalCostUsd:l}){let{t:i}=(0,a.useTranslation)("web"),o=r+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)(tG,{icon:e5.Clock,label:i("activityTab.execution"),value:th(e)}),(0,t.jsx)(tG,{icon:tI.Timer,label:i("activityTab.wait"),value:s>0?th(s):"n/a"}),(0,t.jsx)(tG,{icon:e5.Clock,label:"Wall-clock",value:s>0?th(e+s):th(e)}),(0,t.jsx)(tG,{icon:tR,label:i("activityTab.cost"),value:l>0?tD(l):"n/a"}),(0,t.jsxs)("div",{className:"col-span-2 flex flex-col gap-0.5",children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(Y.Zap,{className:"h-3 w-3 opacity-40"}),"Tokens"]}),o>0?(0,t.jsxs)("span",{className:"flex items-center gap-2.5 text-sm tabular-nums",children:[(0,t.jsx)("span",{children:t$(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)(tP,{className:"h-3 w-3 text-blue-500 opacity-60"}),t$(r)]}),(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(tA,{className:"h-3 w-3 text-emerald-500 opacity-60"}),t$(n)]})]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-sm italic tabular-nums",children:"n/a"})]})]})]})}function tG({icon:e,label:s,value:r,className:a=""}){let n="n/a"===r;return(0,t.jsxs)("div",{className:`flex flex-col gap-0.5 ${a}`,children:[(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[(0,t.jsx)(e,{className:"h-3 w-3 opacity-40"}),s]}),(0,t.jsx)("span",{className:`text-sm tabular-nums ${n?"text-muted-foreground/40 italic":""}`,children:r})]})}var t_=e.i(7311),tK=e.i(44229);let tZ=(0,W.default)("coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]),tQ=(0,W.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);var tJ=e.i(86076);let tX=/^\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]\s+(?:\[([^\]]+)\]\s+)?(?:\[([^\]|]+)(?:\|([^\]]+))?\]\s+)?(.*)$/,tY=/^\[(tool-result|tool|text|delta|result|tokens|cmd|file|turn|thread|error|event|raw|WORKER)\]\s*(.*)/;function t0(e){let t=e.match(tX);if(!t)return{timestamp:null,phase:null,agent:null,model:null,tag:"raw",message:e,raw:e};let[,s,r,a,n,l]=t,i=null,o=null,d=null,c=l??"";if(null!=a&&null!=r)if(r.includes("|")){let[e,t]=r.split("|");o=e,d=t??null,c=`[${a}] ${l??""}`}else i=r,o=a,d=n??null;else if(null!=r)if(r.includes("|")){let[e,t]=r.split("|");o=e,d=t??null}else i=r;let u=c.match(tY),x="info";return u&&(x=u[1].toLowerCase(),c=u[2]),{timestamp:s??null,phase:i,agent:o,model:d,tag:x,message:c.trim(),raw:e}}function t1({content:e}){let r=(0,s.useMemo)(()=>e?e.split("\n").filter(e=>e.trim().length>0).map(t0):[],[e]);return 0===r.length?null:(0,t.jsx)("div",{className:"flex flex-col",children:r.map((e,s)=>(0,t.jsx)(t2,{line:e},s))})}function t2({line:e}){switch(e.tag){case"tool":return(0,t.jsx)(t4,{line:e});case"tool-result":return(0,t.jsx)(st,{line:e});case"text":case"delta":return(0,t.jsx)(t8,{line:e});case"result":return(0,t.jsx)(t7,{line:e});case"tokens":case"turn":return(0,t.jsx)(t9,{line:e});case"cmd":return(0,t.jsx)(ss,{line:e});case"file":return(0,t.jsx)(sr,{line:e});case"thread":case"event":case"info":return(0,t.jsx)(sn,{line:e});case"error":return(0,t.jsx)(sa,{line:e});case"worker":return(0,t.jsx)(se,{line:e});default:return(0,t.jsx)(sl,{line:e})}}function t5({value:e}){if(!e)return null;let s=e.replace(/^.*T/,"").replace("Z",""),r=s.split(":"),a=r.length>=3?`${r[1]}:${r[2].split(".")[0]}`:s;return(0,t.jsx)("span",{className:"text-muted-foreground/60 w-11 shrink-0 font-mono text-[10px]",children:a})}function t3({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 t4({line:e}){var s;let r,{toolName:a,args:n}=-1===(r=(s=e.message).indexOf(" "))?{toolName:s,args:""}:{toolName:s.slice(0,r),args:s.slice(r+1)},l=function(e,t){try{let s=JSON.parse(t);if("Read"===e&&s.file_path||"Write"===e&&s.file_path||"Edit"===e&&s.file_path)return s.file_path;if("Glob"===e&&s.pattern||"Grep"===e&&s.pattern)return s.pattern;if("Bash"===e&&s.command)return s.command;if("Task"===e&&s.description)return s.description}catch{if(t.length>0)return t}return null}(a,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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(t6,{toolName:a}),(0,t.jsx)("span",{className:"text-xs font-semibold text-violet-600 dark:text-violet-400",children:a}),l?(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-xs break-all",children:l}):null]})]})}function t6({toolName:e}){let s=e.toLowerCase();return"bash"===s?(0,t.jsx)($.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"read"===s||"glob"===s||"grep"===s?(0,t.jsx)(D.FileText,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):"write"===s||"edit"===s?(0,t.jsx)(tJ.FileCode,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"}):(0,t.jsx)($.Terminal,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-500"})}function t8({line:e}){return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(J.MessageSquare,{className:"mt-0.5 h-3 w-3 shrink-0 text-blue-500"}),(0,t.jsx)("span",{className:"text-foreground/80 min-w-0 text-xs leading-relaxed",children:e.message})]})]})}function t7({line:e}){var s;let r,a,{chars:n}=(r=(s=e.message).match(/^(\d+)\s+chars/),a=s.match(/session=(\S+)/),{chars:r?parseInt(r[1],10):0,sessionId:a?a[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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3 w-3 shrink-0 text-emerald-500"}),(0,t.jsxs)("span",{className:"text-xs font-medium text-emerald-600 dark:text-emerald-400",children:["Result: ",n.toLocaleString()," chars"]})]})]})}function t9({line:e}){let s,{inputTokens:r,outputTokens:a}=(s=e.message.match(/^(\d+)\s+in\s*\/\s*(\d+)\s+out/))?{inputTokens:parseInt(s[1],10),outputTokens:parseInt(s[2],10)}:{inputTokens:0,outputTokens:0};return(0,t.jsxs)("div",{className:"hover:bg-muted/50 flex items-start gap-2 px-3 py-1.5 transition-colors",children:[(0,t.jsx)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{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-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:r.toLocaleString()})," in / ",(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:a.toLocaleString()})," out"]})]})]})}function se({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tQ,{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 st({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(ez,{className:"mt-0.5 h-3 w-3 shrink-0 text-violet-400"}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 font-mono text-[11px] break-all",children:e.message})]})]})}function ss({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{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 sr({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(tJ.FileCode,{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 sa({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-1.5",children:[(0,t.jsx)(B.AlertCircle,{className:"mt-0.5 h-3 w-3 shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"min-w-0 text-xs font-medium break-all text-red-700 dark:text-red-400",children:e.message})]})]})}function sn({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)(t5,{value:e.timestamp}),(0,t.jsx)(t3,{phase:e.phase}),(0,t.jsx)("span",{className:"text-muted-foreground min-w-0 text-xs break-all",children:e.message})]})}function sl({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 si({content:e,isConnected:r,error:n}){let{t:l}=(0,a.useTranslation)("web"),i=(0,s.useRef)(null),[o,d]=(0,s.useState)(!0),[c,u]=(0,s.useState)("structured"),x=(0,s.useCallback)(()=>{let e=i.current;e&&d(e.scrollHeight-e.scrollTop-e.clientHeight<40)},[]),m=(0,s.useCallback)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight,d(!0))},[]);return((0,s.useEffect)(()=>{o&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,o]),n)?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:n})]}):e?(0,t.jsxs)("div",{className:"flex h-full flex-col","data-testid":"log-tab",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-1.5",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full ${r?"bg-emerald-500":"bg-zinc-400"}`}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:r?"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)(D.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)(tK.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)(t_.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)(t1,{content:e}):e})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)($.Terminal,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:l("logTab.noLogOutput")}),r?(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Waiting for log data..."}):null]})}let so=(0,W.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var sd=e.i(95812),sc=e.i(87889);let su=(0,W.default)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]),sx={Todo:{icon:sd.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:sc.Eye,colorClass:"text-amber-600",borderClass:"border-amber-200",label:"Review"}},sm={icon:sd.Circle,colorClass:"text-muted-foreground",borderClass:"border-border",label:"Unknown"};function sp({tasks:e}){let{t:s}=(0,a.useTranslation)("web");return 0===e.length?(0,t.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 py-4",children:(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:s("taskProgress.noTasksDefined")})}):(0,t.jsxs)("div",{"data-testid":"task-progress-view",className:"flex flex-col gap-3",children:[(0,t.jsx)(sh,{tasks:e}),(0,t.jsx)("div",{"data-testid":"task-progress-list",className:"flex flex-col gap-2",children:e.map((e,s)=>(0,t.jsx)(sg,{task:e,index:s},e.title||`task-${s}`))})]})}function sh({tasks:e}){let{t:r}=(0,a.useTranslation)("web"),n=(0,s.useMemo)(()=>{let t=e.filter(e=>"Done"===e.state).length,s=e.filter(e=>"Work in Progress"===e.state).length,r=e.filter(e=>"Review"===e.state).length,a=e.filter(e=>"Done"!==e.state&&"Work in Progress"!==e.state&&"Review"!==e.state).length,n=e.length,l=n>0?Math.round(t/n*100):0;return{done:t,wip:s,review:r,todo:a,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)(sf,{icon:x.Check,label:r("taskProgress.done"),count:n.done,className:"text-emerald-600"}):null,n.wip>0?(0,t.jsx)(sf,{icon:i.Loader2,label:r("taskProgress.inProgress"),count:n.wip,className:"text-blue-600"}):null,n.review>0?(0,t.jsx)(sf,{icon:sc.Eye,label:r("taskProgress.review"),count:n.review,className:"text-amber-600"}):null,n.todo>0?(0,t.jsx)(sf,{icon:sd.Circle,label:r("taskProgress.todo"),count:n.todo,className:"text-muted-foreground"}):null]})]})}function sf({icon:e,label:s,count:a,className:n}){return(0,t.jsxs)("span",{className:(0,r.cn)("flex items-center gap-1 text-xs",n),children:[(0,t.jsx)(e,{className:"h-3 w-3"}),a," ",s]})}function sg({task:e,index:a}){let[n,l]=(0,s.useState)(!1),i=sx[e.state]??sm,o=i.icon,d=e.actionItems.length>0,c=(0,s.useCallback)(()=>{d&&l(e=>!e)},[d]);return(0,t.jsxs)("div",{"data-testid":`task-card-${a}`,className:(0,r.cn)("rounded-lg border",i.borderClass),children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!d,className:(0,r.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,r.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,r.cn)("text-sm font-medium",i.colorClass),children:e.title}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description}):null]}),d?(0,t.jsx)(ed.ChevronRight,{className:(0,r.cn)("text-muted-foreground mt-0.5 h-4 w-4 shrink-0 transition-transform",n&&"rotate-90")}):null]}),n&&d?(0,t.jsx)("div",{className:"border-t px-3 py-2.5",children:(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.actionItems.map((e,s)=>(0,t.jsx)(sb,{item:e},e.name||`ai-${s}`))})}):null]})}function sb({item:e}){let s=e.acceptanceCriteria.length,r=e.acceptanceCriteria.filter(e=>e.verified).length,a=s>0&&r===s;return(0,t.jsxs)("div",{"data-testid":"action-item",className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[a?(0,t.jsx)(eF.CheckCircle2,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,t.jsx)(su,{className:"text-muted-foreground mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.name}),e.description?(0,t.jsx)("span",{className:"text-muted-foreground text-[11px]",children:e.description}):null]}),s>0?(0,t.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[11px]",children:[r,"/",s]}):null]}),s>0?(0,t.jsx)("div",{className:"ms-5.5 flex flex-col gap-1",children:e.acceptanceCriteria.map((e,s)=>(0,t.jsx)(sj,{criterion:e},e.description||`ac-${s}`))}):null]})}function sj({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)(sd.Circle,{className:"text-muted-foreground mt-0.5 h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:(0,r.cn)("text-[11px]",e.verified?"text-muted-foreground line-through":"text-foreground"),children:e.description})]})}let sv={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 sy({plan:e,loading:s,error:r}){return s?(0,t.jsx)("div",{"data-testid":"plan-tab-loading",className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):r?(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 text-sm text-red-600",children:[(0,t.jsx)(B.AlertCircle,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:r})]}):e?(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:"Plan State"}),(0,t.jsx)(eu.Badge,{className:sv[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)(sp,{tasks:e.tasks})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[(0,t.jsx)(so,{className:"text-muted-foreground h-8 w-8"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"No plan created yet"})]})}var sN=e.i(28112);function sw(){return{data:null,loading:!1,error:null}}let sk=[{key:"overview",label:"Overview",icon:U.LayoutDashboard},{key:"activity",label:"Activity",icon:V.Activity},{key:"log",label:"Log",icon:H},{key:"plan",label:"Plan",icon:G},{key:"prd-review",label:"PRD Review",icon:_},{key:"tech-decisions",label:"Tech Decisions",icon:K.Cpu},{key:"product-decisions",label:"Product",icon:Z.Package},{key:"merge-review",label:"Merge Review",icon:Q},{key:"chat",label:"Chat",icon:J.MessageSquare}],sC={activity:async function(e){let t=await es(e);if("error"in t)throw Error(t.error);return{timings:t.timings,rejectionFeedback:t.rejectionFeedback}},plan:async function(e){let t=await er(e);if("error"in t)throw Error(t.error);return t.plan}};function sT({featureName:e,headerContent:a,featureNode:l,featureId:o,initialTab:u,urlTab:x,prdData:m,prdSelections:p,onPrdSelect:h,onPrdApprove:f,onPrdReject:g,isPrdLoading:b,techData:j,onTechApprove:v,onTechReject:y,isTechLoading:N,productData:w,mergeData:k,onMergeApprove:C,onMergeReject:T,isMergeLoading:S,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:$,rebaseError:E,isRejecting:D,chatInput:L,onChatInputChange:F,pinnedConfig:q,continuationActionsDisabled:O=!1,sseEvents:U,interactiveAgentEnabled:V=!0,onRetry:W,onStop:H,onStart:G}){let _,K=(0,n.usePathname)(),Z=(0,s.useMemo)(()=>(function(e,t=!0){let s=["overview","activity"];return e.hasAgentRun&&s.push("log"),e.hasPlan&&s.push("plan"),"requirements"===e.lifecycle&&"action-required"===e.state&&s.push("prd-review"),"implementation"===e.lifecycle&&"action-required"===e.state&&s.push("tech-decisions","product-decisions"),"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)&&s.push("merge-review"),"maintain"===e.lifecycle&&e.pr&&s.push("merge-review"),t&&s.push("chat"),s})(l,V),[l,V]),Q=(0,s.useMemo)(()=>sk.filter(e=>Z.includes(e.key)).map(e=>"merge-review"===e.key&&"maintain"===l.lifecycle?{...e,label:"Merge History"}:e),[Z,l.lifecycle]),J=(0,s.useMemo)(()=>{let e=K.match(/^(\/feature\/[^/]+)/);return e?e[1]:K},[K]),es=(0,s.useMemo)(()=>x&&Z.includes(x)?x:u&&Z.includes(u)?u:"overview",[]),[er,en]=(0,s.useState)(es),el=function(e){let[t,r]=(0,s.useState)(""),[a,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),o=(0,s.useRef)(null),d=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null),n(!1)},[]);return(0,s.useEffect)(()=>{if(!e){r(""),n(!1),i(null);return}r(""),i(null);let t=new EventSource(`/api/feature-logs?featureId=${e}`);return o.current=t,t.onopen=()=>{n(!0)},t.addEventListener("initial",e=>{r(JSON.parse(e.data).content)}),t.addEventListener("log",e=>{let t=JSON.parse(e.data);r(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:a,error:l}}("log"===er?o:null),{tabs:eo,fetchTab:ed,refreshTab:ec}=function(e,t){let r=Object.keys(t),[a,n]=(0,s.useState)(()=>{let e={};for(let t of r)e[t]=sw();return e}),l=(0,s.useRef)(t);l.current=t;let i=(0,s.useRef)(e);i.current=e;let o=(0,s.useRef)(!0);(0,s.useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);let d=(0,s.useRef)(e);(0,s.useEffect)(()=>{d.current!==e&&(d.current=e,n(e=>{let t={};for(let s of Object.keys(e))t[s]=sw();return t}))},[e]);let c=(0,s.useCallback)(async e=>{let t=l.current[e],s=i.current;if(t){o.current&&n(t=>t[e]?.data!==null?t:{...t,[e]:{...t[e],loading:!0,error:null}});try{let r=await t(s);o.current&&n(t=>({...t,[e]:{data:r,loading:!1,error:null}}))}catch(t){o.current&&n(s=>{let r=t instanceof Error?t.message:"Failed to fetch tab data",a=s[e]?.data??null;return{...s,[e]:{data:a,loading:!1,error:a?null:r}}})}}},[]),u=(0,s.useCallback)(async e=>{let t=a[e];t&&null!==t.data||t&&t.loading||await c(e)},[a,c]);return{tabs:a,fetchTab:u,refreshTab:(0,s.useCallback)(async e=>{await c(e)},[c])}}(o,sC),eu=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!eu.current)return;eu.current=!1;let e="overview"===er?J:`${J}/${er}`;e!==K&&window.history.pushState(null,"",e)},[er,J,K]);let ex=(0,s.useRef)(K);(0,s.useEffect)(()=>{if(ex.current===K||(ex.current=K,eu.current))return;let e=K.split("/"),t=e.length>=4?e[3]:void 0,s=t&&Z.includes(t)?t:"overview";s!==er&&(en(s),("activity"===s||"plan"===s)&&ed(s))},[K]);let em=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!em.current&&(em.current=!0,!x&&"overview"!==es)){let e=`${J}/${es}`;e!==K&&window.history.replaceState(null,"",e)}},[]);let ep=(0,s.useRef)(!1);(0,s.useEffect)(()=>{ep.current||(ep.current=!0,("activity"===er||"plan"===er)&&ed(er))},[er,ed]);let eh=(0,s.useRef)(o);(0,s.useEffect)(()=>{eh.current!==o&&(eh.current=o,en("overview"))},[o]);let ef=(0,s.useRef)(u);(0,s.useEffect)(()=>{if(ef.current!==u&&u&&Z.includes(u)){ef.current=u,en(u),("activity"===u||"plan"===u)&&ed(u);let e="overview"===u?J:`${J}/${u}`;e!==window.location.pathname&&window.history.replaceState(null,"",e)}},[u,Z,J,ed]),(0,s.useEffect)(()=>{Z.includes(er)||(en("overview"),window.location.pathname!==J&&window.history.replaceState(null,"",J))},[Z,er,J]);let eg=(0,s.useRef)(er);eg.current=er;let eb=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(!U||0===U.length||(eb.current>U.length&&(eb.current=0),U.length<=eb.current))return;let e=U.slice(eb.current);if(eb.current=U.length,!e.some(e=>e.featureId===o))return;ec("activity");let t=eg.current;"plan"===t&&ec(t)},[U,o,ec]);let ej="running"===l.state||"creating"===l.state;(0,s.useEffect)(()=>{if(!ej)return;let e=setInterval(()=>{ec("activity")},5e3);return()=>clearInterval(e)},[ej,ec]);let ey=(0,s.useCallback)(e=>{eu.current=!0,en(e),("activity"===e||"plan"===e)&&ed(e)},[ed]);return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsxs)(et.Tabs,{value:er,onValueChange:ey,className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(et.TabsList,{className:"bg-muted/50 h-auto w-full shrink-0 justify-start gap-0 rounded-none border-b p-0",children:Q.map(e=>{let s=e.icon;return(0,t.jsxs)(et.TabsTrigger,{value:e.key,className:"text-muted-foreground hover:bg-muted hover:text-foreground data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:border-t-primary [&:not([data-state=active])]:border-r-border relative h-auto rounded-none border-t-2 border-r border-t-transparent border-r-transparent bg-transparent px-3.5 py-2.5 text-[13px] font-normal shadow-none transition-none last:border-r-transparent data-[state=active]:shadow-none",children:[(0,t.jsx)(s,{className:"mr-1.5 size-4"}),e.label]},e.key)})}),(0,t.jsxs)("div",{className:"bg-muted/40 shrink-0 border-b",children:[e?(0,t.jsxs)("div",{className:"flex h-12 items-stretch gap-2 pr-0 pl-4","data-testid":"feature-drawer-header",children:[(0,t.jsx)("div",{className:"flex items-center",children:l.fastMode?(0,t.jsx)(Y.Zap,{className:"size-4 shrink-0 text-amber-500"}):(0,t.jsx)(ee.Layers,{className:"text-muted-foreground/50 size-4 shrink-0"})}),(0,t.jsx)("h2",{className:"text-foreground flex min-w-0 items-center truncate text-base font-semibold tracking-tight",children:e}),l.repositoryName?(0,t.jsxs)("span",{className:"animate-in fade-in flex shrink-0 items-center gap-1.5 self-center duration-200",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),l.remoteUrl?(0,t.jsx)("a",{href:l.remoteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground text-sm",children:l.repositoryName}):(0,t.jsx)("span",{className:"text-muted-foreground text-sm",children:l.repositoryName})]}):(0,t.jsxs)("span",{className:"flex items-center gap-1.5 self-center",children:[(0,t.jsx)("span",{className:"text-muted-foreground/30 text-sm",children:"/"}),(0,t.jsx)("span",{className:"bg-muted h-4 w-16 animate-pulse rounded"})]}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 cursor-default items-center self-stretch text-xs font-medium",children:[(0,t.jsxs)("div",{className:(0,r.cn)("flex items-center gap-1.5 self-stretch px-3",ea.featureNodeStateConfig[l.state].labelClass),children:["running"===l.state?(0,t.jsx)(ei,{size:"sm",className:"shrink-0"}):(_=ea.featureNodeStateConfig[l.state].icon,(0,t.jsx)(_,{className:"size-3.5 shrink-0"})),ea.featureNodeStateConfig[l.state].label]}),"pending"===l.state&&G?(0,t.jsxs)("button",{type:"button",onClick:()=>G(l.featureId),disabled:O,className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-green-500/10 hover:text-green-600 disabled:pointer-events-none disabled:opacity-50 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&&W?(0,t.jsxs)("button",{type:"button",onClick:()=>W(l.featureId),disabled:O,className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 disabled:pointer-events-none disabled:opacity-50 dark:hover:text-red-400","data-testid":"feature-drawer-retry-button",children:[(0,t.jsx)(X.RotateCcw,{className:"size-3.5"})," Retry"]}):"running"===l.state&&H?(0,t.jsxs)("button",{type:"button",onClick:()=>H(l.featureId),className:"text-muted-foreground flex items-center gap-1 self-stretch px-3 hover:bg-red-500/10 hover:text-red-500 dark:hover:text-red-400","data-testid":"feature-drawer-stop-button",children:[(0,t.jsx)(c.Square,{className:"size-3.5"})," Stop"]}):null]})}),l.errorMessage?(0,t.jsxs)(P.TooltipContent,{side:"bottom",align:"end",sideOffset:4,className:"z-[100] max-w-xs cursor-pointer text-xs leading-relaxed select-text",onClick:()=>{navigator.clipboard.writeText(l.errorMessage)},children:[l.errorMessage,(0,t.jsx)("span",{className:"text-muted-foreground ml-1 text-[10px] italic",children:"(click to copy)"})]}):null]})})]}):null,a]}),(0,t.jsx)(et.TabsContent,{value:"overview",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tw,{data:l,pinnedConfig:q,syncStatus:R,syncLoading:M,syncError:I,onRefreshSync:A,onRebaseOnMain:z,rebaseLoading:$,rebaseError:E})}),(0,t.jsx)(et.TabsContent,{value:"activity",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(tO,{timings:eo.activity.data?.timings??null,loading:eo.activity.loading,error:eo.activity.error,rejectionFeedback:eo.activity.data?.rejectionFeedback})}),(0,t.jsx)(et.TabsContent,{value:"log",className:"mt-0 flex-1 overflow-hidden",children:(0,t.jsx)(si,{content:el.content,isConnected:el.isConnected,error:el.error})}),(0,t.jsx)(et.TabsContent,{value:"plan",className:"mt-0 flex-1 overflow-y-auto",children:(0,t.jsx)(sy,{plan:eo.plan.data,loading:eo.plan.loading,error:eo.plan.error})}),Z.includes("prd-review")?(0,t.jsx)(et.TabsContent,{value:"prd-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:m?(0,t.jsx)(ev,{data:m,selections:p??{},onSelect:h??(()=>void 0),onApprove:f??(()=>void 0),onReject:g,isProcessing:!!(b||O),isRejecting:D,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,Z.includes("tech-decisions")?(0,t.jsx)(et.TabsContent,{value:"tech-decisions",className:"mt-0 flex min-h-0 flex-1 flex-col",children:j?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(eC,{data:j})}),(0,t.jsx)(sS,{onApprove:v??(()=>void 0),onReject:y,isProcessing:!!(N||O),isRejecting:D,chatInput:L,onChatInputChange:F})]}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})})}):null,Z.includes("product-decisions")?(0,t.jsx)(et.TabsContent,{value:"product-decisions",className:"mt-0 flex-1 overflow-y-auto",children:null===w?(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"})}):w?(0,t.jsx)(eR,{data:w}):(0,t.jsx)("p",{className:"text-muted-foreground p-4 text-center text-sm",children:"No product decisions available."})}):null,Z.includes("merge-review")?(0,t.jsx)(et.TabsContent,{value:"merge-review",className:"mt-0 flex min-h-0 flex-1 flex-col",children:k?(0,t.jsx)(e2,{data:k,readOnly:"maintain"===l.lifecycle,onApprove:C??(()=>void 0),onReject:T,isProcessing:!!(S||O),isRejecting:D,chatInput:L,onChatInputChange:F}):(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:S?(0,t.jsx)(i.Loader2,{className:"text-muted-foreground h-6 w-6 animate-spin"}):(0,t.jsxs)("div",{className:"text-muted-foreground flex flex-col items-center gap-2 text-sm",children:[(0,t.jsx)(B.AlertCircle,{className:"h-6 w-6"}),(0,t.jsx)("span",{children:"Merge review data unavailable"})]})})}):null,Z.includes("chat")?(0,t.jsx)(et.TabsContent,{value:"chat",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(sN.ChatTab,{featureId:o,worktreePath:l.worktreePath})}):null]})})}function sS({onApprove:e,onReject:s,isProcessing:r,isRejecting:n,chatInput:l,onChatInputChange:i}){let{t:o}=(0,a.useTranslation)("web");return(0,t.jsx)(ej,{onReject:s,onApprove:e,approveLabel:o("featureDrawer.approvePlan"),revisionPlaceholder:"Ask AI to revise the plan...",isProcessing:r,isRejecting:n,chatInput:l,onChatInputChange:i})}var sR=e.i(43155),sM=e.i(58820),sI=e.i(3402);let sP=(0,h.createServerReference)("405da9f06d212a6e2046f77c34e4c7397e63c3cb64",h.callServer,void 0,h.findSourceMapURL,"rebaseFeature");var sA=e.i(99045);function sz(e){return"requirements"===e.lifecycle&&"action-required"===e.state?"prd-review":"implementation"===e.lifecycle&&"action-required"===e.state?"tech-decisions":"review"===e.lifecycle&&("action-required"===e.state||"error"===e.state)?"merge-review":"overview"}function s$(e,t,r,a,n,i){let[o,d]=(0,s.useState)(!1),c=(0,s.useRef)(r),u=(0,s.useRef)(a);return c.current=r,u.current=a,(0,s.useEffect)(()=>{if(u.current(),!e)return;let s=!1;return d(!0),t(e).then(e=>{s||c.current(e)}).catch(()=>{!s&&n&&l.toast.error(n)}).finally(()=>{s||d(!1)}),()=>{s=!0}},[e,t,n,i]),o}let sE=(0,h.createServerReference)("40d43ccb5d6f6ece2a2ed56786647bd6bf8e1a3729",h.callServer,void 0,h.findSourceMapURL,"getFeatureDrawerData"),sD=(0,h.createServerReference)("404b7d524f10c0160e4b06b4fa5a3404a7b44e5be7",h.callServer,void 0,h.findSourceMapURL,"getBranchSyncStatus"),sL=new Map,sF=(0,h.createServerReference)("70b3efd4db57fbc5b5f2c6fda0bcd3a0add9923fb3",h.callServer,void 0,h.findSourceMapURL,"updateFeaturePinnedConfig");function sq({view:e,urlTab:h,interactiveAgentEnabled:z=!0}){var $,E;let D,L,F,q,B,U,V=(0,k.useFeatureFlags)(),{t:W}=(0,a.useTranslation)("web"),H=(0,n.useRouter)(),G=(0,C.useSoundAction)("reject"),[_,K]=(0,s.useState)(e),[Z,Q]=(0,s.useState)(()=>"feature"===e.type?tg(e.node):null),[J,X]=(0,s.useState)(()=>"feature"===e.type?tg(e.node):null),[Y,ee]=(0,s.useState)(!1),[et,es]=(0,s.useState)(null),er=(0,s.useRef)(null);(0,s.useEffect)(()=>{K(t=>"feature"===t.type&&"feature"===e.type&&t.node.featureId===e.node.featureId?{...e,node:{...t.node,...e.node}}:e)},[e]);let ea="feature"===_.type?_.node:null,en=!!ea&&($=ea.state,tf.has($));(0,s.useEffect)(()=>{if("feature"!==_.type||Y)return;let e=tg(_.node),t=e?`${_.node.featureId}:${e.agentType}:${e.modelId}`:`${_.node.featureId}:none`,s=er.current!==t;er.current=t,Q(e),X(e),s&&es(null)},[_,Y]);let{events:el}=(0,R.useAgentEventsContext)(),ei=(0,s.useRef)(0);(0,s.useEffect)(()=>{if(ei.current>el.length&&(ei.current=0),!ea||el.length<=ei.current)return;let e=el.slice(ei.current);for(let t of(ei.current=el.length,(0,sA.resolveSseEventUpdates)(e)))t.featureId===ea.featureId&&"deleting"!==ea.state&&(void 0!==t.state||void 0!==t.lifecycle)&&K(e=>{if("feature"!==e.type)return e;let s={...e.node,...void 0!==t.state&&{state:t.state},...void 0!==t.lifecycle&&{lifecycle:t.lifecycle}};return{...e,node:s,initialTab:sz(s)}})},[el,ea]);let eo=(0,n.usePathname)().startsWith("/feature/");E=ea?.featureId??null,D=(0,s.useRef)(eo),L=(0,s.useRef)(!1),F=(0,s.useRef)(0),q=(0,s.useCallback)(async()=>{if(!E||L.current)return;L.current=!0;let e=F.current;try{let t=await sE(E);if(!t||e!==F.current)return;K(e=>(function(e,t){if("feature"!==e.type)return e;let s={...e.node,...t},r=s.state!==e.node.state||s.lifecycle!==e.node.lifecycle;return{...e,node:s,initialTab:r?sz(s):e.initialTab}})(e,t))}catch{}finally{L.current=!1}},[E,K]),B=(0,s.useRef)(!1),(0,s.useEffect)(()=>{!eo||D.current&&B.current||(B.current=!0,F.current+=1,L.current=!1,q()),D.current=eo},[eo,q]),(0,s.useEffect)(()=>{if(!eo||!E)return;let e=setInterval(()=>{q()},15e3);return()=>clearInterval(e)},[eo,E,q]);let ed=(0,s.useCallback)(()=>{H.push("/")},[H]),[ec,eu]=(0,s.useState)(""),[ex,em]=(0,s.useState)(null),[ep,eh]=(0,s.useState)({}),[ef,eg]=(0,s.useState)({}),[eb,ej]=(0,s.useState)(null),[ev,ey]=(0,s.useState)(void 0),[eN,ew]=(0,s.useState)(null),[ek,eC]=(0,s.useState)(!1),[eT,eS]=(0,s.useState)(!1),[eR,eM]=(0,s.useState)(!1),eI=`${ea?.featureId}:${ea?.state}`,eP=(0,s.useRef)(eI);(0,s.useEffect)(()=>{eI!==eP.current&&(eP.current=eI,eM(!1))},[eI]);let[eA,ez]=(0,s.useState)(!1),e$=(0,s.useRef)(!1),eE="feature"===_.type?_.initialTab:void 0;(0,s.useEffect)(()=>{eu("")},[eE]);let eD=(0,s.useRef)(0),eL=(0,s.useRef)(ea?.state),eF=(0,s.useRef)(ea?.lifecycle);(ea?.state!==eL.current||ea?.lifecycle!==eF.current)&&(eL.current=ea?.state,eF.current=ea?.lifecycle,eD.current+=1);let eq=eD.current,eO=s$(ea?.lifecycle==="requirements"&&ea?.state==="action-required"?ea.featureId:null,y,e=>{if(e.error)return void l.toast.error(e.error);if(e.questionnaire){em(e.questionnaire);let t={};for(let s of e.questionnaire.questions){let e=s.options.find(e=>e.recommended);e&&(t[s.id]=e.id)}eh(t),eg(t)}},()=>{eh({}),eg({}),em(null)},"Failed to load questionnaire",eq),eB=ea?.lifecycle==="implementation"&&ea?.state==="action-required"?ea.featureId:null,eU=s$(eB,N,e=>{e.error?l.toast.error(e.error):e.techDecisions&&ej(e.techDecisions)},()=>ej(null),"Failed to load tech decisions",eq),eV=s$(eB,y,e=>{e.productDecisions&&ey(e.productDecisions)},()=>ey(void 0),void 0,eq),eW=s$(ea?.lifecycle==="review"&&(ea?.state==="action-required"||ea?.state==="error")||ea?.lifecycle==="maintain"&&ea?.pr?ea.featureId:null,w,e=>{"error"in e?l.toast.error(e.error):ew(e)},()=>ew(null),"Failed to load merge review data",eq),eH=ec.trim().length>0,eG=ea?.lifecycle==="requirements"&&ea?.state==="action-required"&&Object.keys(ef).some(e=>ef[e]!==ep[e]),e_=(0,s.useCallback)(()=>{eu(""),eh({...ef})},[ef]),{attemptClose:eK}=(0,T.useGuardedDrawerClose)({open:eo,isDirty:eH||eG,onClose:ed,onReset:e_}),eZ=(0,s.useCallback)(async(e,t,s=[],r)=>{if(!Y&&ea?.featureId){e$.current=!0,ez(!0);try{let a=s.map(e=>e.path).filter(Boolean),n=s.filter(e=>e.notes?.trim()),i=n.length>0?`${e}
|
|
3
3
|
|
|
4
4
|
Image notes:
|
|
5
5
|
${n.map(e=>`- @${e.path}: ${e.notes.trim()}`).join("\n")}`:e,o=await v(ea.featureId,i,a);if(!o.rejected)return void l.toast.error(o.error??`Failed to reject ${t.toLowerCase()}`);G.play(),eu(""),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:ea.featureId}})),ed(),r?.()}finally{e$.current=!1,ez(!1)}}},[ea,ed,Y,G]),eQ=(0,s.useCallback)((e,t)=>eZ(e,"Requirements",t,()=>eh({})),[eZ]),eJ=(0,s.useCallback)((e,t)=>eZ(e,"Plan",t),[eZ]),eX=(0,s.useCallback)((e,t)=>eZ(e,"Merge",t),[eZ]),eY=(0,s.useCallback)(async e=>{if(Y||!ea?.featureId)return;let t=await f(ea.featureId);t.approved?(eu(""),l.toast.success(`${e} approved — agent resuming`),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:ea.featureId}})),ed()):l.toast.error(t.error??`Failed to approve ${e.toLowerCase()}`)},[ea,ed,Y]),e0=(0,s.useCallback)(async e=>{let t;if(Y||"feature"!==_.type||!ea)return;if(ex){let e=[];for(let[t,s]of Object.entries(ep)){let r=ex.questions.find(e=>e.id===t),a=r?.options.find(e=>e.id===s);r&&a&&e.push({questionId:r.question,selectedOption:a.label})}t={approved:!0,changedSelections:e}}let s=await f(ea.featureId,t);s.approved?(eu(""),l.toast.success("Requirements approved — agent resuming"),window.dispatchEvent(new CustomEvent("shep:feature-approved",{detail:{featureId:ea.featureId}})),eh({}),ed()):l.toast.error(s.error??"Failed to approve requirements")},[_,ea,Y,ex,ep,ed]),e1=(0,s.useCallback)(()=>eY("Plan"),[eY]),e2=(0,s.useCallback)(()=>eY("Merge"),[eY]),e5=(0,s.useCallback)(async(e,t,s,r)=>{eC(!0),eS(!1),window.dispatchEvent(new CustomEvent("shep:feature-delete-requested",{detail:{featureId:e,cleanup:t,cascadeDelete:s,closePr:r}})),H.push("/")},[H]),e3=(0,s.useCallback)(e=>{eM(!0),window.dispatchEvent(new CustomEvent("shep:feature-archive-requested",{detail:{featureId:e}})),H.push("/")},[H]),e4=(0,s.useCallback)(e=>{eM(!0),window.dispatchEvent(new CustomEvent("shep:feature-unarchive-requested",{detail:{featureId:e}})),H.push("/")},[H]),e6=(0,s.useCallback)(async e=>{if(Y)return;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}})),K(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[Y]),e8=(0,s.useCallback)(async e=>{let t=await (0,j.stopFeature)(e);t.stopped?(l.toast.success("Agent stopped"),K(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"error"}})):l.toast.error(t.error??"Failed to stop")},[]),e7=(0,s.useCallback)(async e=>{if(Y)return;let t=await (0,b.startFeature)(e);t.error?l.toast.error(t.error):(l.toast.success("Feature started"),K(e=>"feature"!==e.type?e:{...e,node:{...e.node,state:"running"}}))},[Y]),e9=(0,s.useCallback)(async(e,t)=>{var s;if(!ea)return{ok:!1,error:"Feature is not loaded"};if(s=ea.state,!tf.has(s))return{ok:!1,error:"Pinned execution can only be changed before start, approval, or retry"};let r=J??tg(ea),a={agentType:e,modelId:t};Q(a),es(null),ee(!0);try{let s=await sF(ea.featureId,e,t);if(!s.ok){let e=s.error??"Failed to save pinned config";return Q(r),es(e),l.toast.error(e),{ok:!1,error:e}}return X(a),K(e=>"feature"!==e.type||e.node.featureId!==ea.featureId?e:{...e,node:{...e.node,agentType:a.agentType,modelId:t}}),{ok:!0}}catch(t){let e=t instanceof Error?t.message:"Failed to save pinned config";return Q(r),es(e),l.toast.error(e),{ok:!1,error:e}}finally{ee(!1)}},[ea,J]),te=ea?.repositoryPath&&ea?.branch?{featureId:ea.featureId,repositoryPath:ea.repositoryPath,branch:ea.branch,worktreePath:ea.worktreePath,specPath:ea.specPath}:null,tt=function(e){let[t,r]=(0,s.useState)(!1),[a,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(!1),[x,m]=(0,s.useState)(null),[p,h]=(0,s.useState)(null),[f,g]=(0,s.useState)(null),[b,j]=(0,s.useState)(null),[v,y]=(0,s.useState)(null),N=(0,s.useRef)(null),w=(0,s.useRef)(null),k=(0,s.useRef)(null),C=(0,s.useRef)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=[N,w,k,C,T];return()=>{for(let t of e)t.current&&clearTimeout(t.current)}},[]);let S=(0,s.useCallback)(async(t,s,r,a,n)=>{if(e&&!n){a.current&&clearTimeout(a.current),s(!0),r(null);try{let s=await t({repositoryPath:e.repositoryPath,branch:e.branch});if(!s.success){let e=s.error??"An unexpected error occurred";r(e),a.current=setTimeout(()=>r(null),5e3)}}catch(e){r(e instanceof Error?e.message:"An unexpected error occurred"),a.current=setTimeout(()=>r(null),5e3)}finally{s(!1)}}},[e]);return{openInIde:(0,s.useCallback)(()=>S(sR.openIde,r,m,N,t),[S,t]),openInShell:(0,s.useCallback)(()=>S(sM.openShell,n,h,w,a),[S,a]),openFolder:(0,s.useCallback)(async()=>{if(e&&!l){k.current&&clearTimeout(k.current),i(!0),g(null);try{let t=e.worktreePath??e.repositoryPath,s=await (0,sI.openFolder)(t);if(!s.success){let e=s.error??"An unexpected error occurred";g(e),k.current=setTimeout(()=>g(null),5e3)}}catch(e){g(e instanceof Error?e.message:"An unexpected error occurred"),k.current=setTimeout(()=>g(null),5e3)}finally{i(!1)}}},[e,l]),openSpecsFolder:(0,s.useCallback)(async()=>{if(e?.specPath&&!o){C.current&&clearTimeout(C.current),d(!0),j(null);try{let t=await (0,sI.openFolder)(e.specPath);if(!t.success){let e=t.error??"An unexpected error occurred";j(e),C.current=setTimeout(()=>j(null),5e3)}}catch(e){j(e instanceof Error?e.message:"An unexpected error occurred"),C.current=setTimeout(()=>j(null),5e3)}finally{d(!1)}}},[e,o]),rebaseOnMain:(0,s.useCallback)(async()=>{if(e?.featureId&&!c){T.current&&clearTimeout(T.current),u(!0),y(null);try{let t=await sP(e.featureId);if(!t.success){let e=t.error??"An unexpected error occurred";y(e),T.current=setTimeout(()=>y(null),5e3)}}catch(e){y(e instanceof Error?e.message:"An unexpected error occurred"),T.current=setTimeout(()=>y(null),5e3)}finally{u(!1)}}},[e,c]),ideLoading:t,shellLoading:a,folderLoading:l,specsLoading:o,rebaseLoading:c,ideError:x,shellError:p,folderError:f,specsError:b,rebaseError:v}}(te),ts=V.gitRebaseSync&&ea?.branch&&ea?.remoteUrl?ea.featureId:null,{data:tr,loading:ta,error:tn,refresh:tl}=function(e){let[t,r]=(0,s.useState)(()=>{if(!e)return null;let t=sL.get(e);return t?t.data:null}),[a,n]=(0,s.useState)(!1),[l,i]=(0,s.useState)(null),o=(0,s.useRef)(e);o.current=e;let d=(0,s.useCallback)(async e=>{n(!0),i(null);try{let t=await sD(e);if(o.current!==e)return;if(t.success&&t.data){let s=t.data;sL.set(e,{data:s,timestamp:Date.now()}),r(s)}else i(t.error??"Failed to check sync status")}catch{if(o.current!==e)return;i("Failed to check sync status")}finally{o.current===e&&n(!1)}},[]);return(0,s.useEffect)(()=>{if(!e){r(null),i(null);return}let t=sL.get(e);t&&(r(t.data),Date.now()-t.timestamp<3e4)||d(e)},[e,d]),{data:t,loading:a,error:l,refresh:(0,s.useCallback)(()=>{e&&d(e)},[e,d])}}(ts),ti=(0,s.useRef)(tt.rebaseLoading);(0,s.useEffect)(()=>{!ti.current||tt.rebaseLoading||tt.rebaseError||tl(),ti.current=tt.rebaseLoading},[tt.rebaseLoading,tt.rebaseError,tl]);let to=ea?.repositoryPath&&ea.branch?{targetId:ea.featureId,targetType:"feature",repositoryPath:ea.repositoryPath,branch:ea.branch}:null,td=(0,S.useDeployAction)(to),tc="Booting"===td.status||"Ready"===td.status,[tu,tx]=(0,s.useState)(!1),tm=(0,s.useCallback)(()=>{ea?.featureId&&(navigator.clipboard.writeText(ea.featureId),tx(!0),setTimeout(()=>tx(!1),2e3))},[ea?.featureId]);if(ea){let e=ea.featureId.slice(0,8),s="text-muted-foreground hover:bg-foreground/8 hover:text-foreground inline-flex size-8 items-center justify-center rounded-[3px] disabled:opacity-40",a="bg-border/60 mx-1.5 h-5 w-px shrink-0";U=(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:[te&&ea?.state!=="done"?(0,t.jsx)(O,{actions:tt,repositoryPath:te.repositoryPath,worktreePath:te.worktreePath,showSpecs:!!te.specPath}):null,te&&ea?.state!=="done"&&V.envDeploy&&to?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:a}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:td.deployLoading||td.stopLoading,onClick:tc?td.stop:td.deploy,className:(0,r.cn)("inline-flex size-7 items-center justify-center rounded-[3px] disabled:opacity-40",tc?"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":W(tc?"featureDrawer.stopDevServer":"featureDrawer.startDevServer"),children:td.deployLoading||td.stopLoading?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):tc?(0,t.jsx)(c.Square,{className:"size-4"}):(0,t.jsx)(d.Play,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:W(tc?"featureDrawer.stopDevServer":"featureDrawer.startDevServer")})]})}),tc?(0,t.jsx)(I.DeploymentStatusBadge,{status:td.status,url:td.url,targetId:to?.targetId}):null]}):null,(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("code",{className:"text-muted-foreground/70 font-mono text-[10px] tracking-wide select-none",children:e}),(0,t.jsx)(P.TooltipProvider,{delayDuration:300,children:(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:tm,className:s,"aria-label":W("featureDrawer.copyFeatureId"),"data-testid":"feature-drawer-copy-id",children:tu?(0,t.jsx)(x.Check,{className:"size-4 text-green-500"}):(0,t.jsx)(u.Copy,{className:"size-4"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:W("featureDrawer.copyFeatureId")})]})}),ea.featureId?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:a}),(0,t.jsxs)(P.TooltipProvider,{delayDuration:300,children:["archived"===ea.state?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:eR,className:s,"data-testid":"feature-drawer-unarchive",onClick:()=>e4(ea.featureId),children:eR?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(p.ArchiveRestore,{className:"size-3"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:W("featureDrawer.unarchiveFeature")})]}):"deleting"!==ea.state?(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:eR,className:s,"data-testid":"feature-drawer-archive",onClick:()=>e3(ea.featureId),children:eR?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(m.Archive,{className:"size-3"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:W("featureDrawer.archiveFeature")})]}):null,(0,t.jsxs)(P.Tooltip,{children:[(0,t.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",disabled:ek,className:(0,r.cn)(s,"hover:bg-destructive/10 hover:text-destructive"),"data-testid":"feature-drawer-delete",onClick:()=>eS(!0),children:ek?(0,t.jsx)(i.Loader2,{className:"size-4 animate-spin"}):(0,t.jsx)(o.Trash2,{className:"size-3"})})}),(0,t.jsx)(P.TooltipContent,{side:"bottom",className:"text-xs",children:W("featureDrawer.deleteFeature")})]})]}),(0,t.jsx)(A.DeleteFeatureDialog,{open:eT,onOpenChange:eS,onConfirm:(e,t,s)=>e5(ea.featureId,e,t,s),isDeleting:ek,featureName:ea.name,featureId:ea.featureId,hasChildren:ea.hasChildren,hasOpenPr:!!ea.pr&&"Open"===ea.pr.status})]}):null]})]})})}let tp=null;if("feature"===_.type&&ea){let e={...ea,..."error"===ea.state&&{onRetry:e6},..."pending"===ea.state&&{onStart:e7}};tp=(0,t.jsx)(sT,{featureName:ea.name,headerContent:U,featureNode:e,featureId:ea.featureId,initialTab:_.initialTab,urlTab:h,sseEvents:el,prdData:ex,prdSelections:ep,onPrdSelect:(e,t)=>eh(s=>({...s,[e]:t})),onPrdApprove:e0,onPrdReject:eQ,isPrdLoading:eO,techData:eb,onTechApprove:e1,onTechReject:eJ,isTechLoading:eU,productData:eV?null:ev,mergeData:eN,onMergeApprove:e2,onMergeReject:eX,isMergeLoading:eW,syncStatus:ts?tr:void 0,syncLoading:ta,syncError:tn,onRefreshSync:ts?tl:void 0,onRebaseOnMain:ts?tt.rebaseOnMain:void 0,rebaseLoading:tt.rebaseLoading,rebaseError:tt.rebaseError,isRejecting:eA,chatInput:ec,onChatInputChange:eu,pinnedConfig:en&&Z?{...Z,saving:Y,error:et,onSave:e9}:void 0,continuationActionsDisabled:Y,interactiveAgentEnabled:z,onRetry:e6,onStop:e8,onStart:e7})}return(0,t.jsx)(M.BaseDrawer,{open:eo,onClose:eK,size:"lg",modal:!1,"data-testid":"feature"===_.type?"feature-drawer":"repository-drawer",children:tp})}e.s(["FeatureDrawerClient",()=>sq],36986)}]);
|