@mrpatronz/nexusflow 2.7.0 → 2.8.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/README.md +16 -14
- package/dist/agent/ClaudeSdkAdapter.d.ts.map +1 -1
- package/dist/agent/ClaudeSdkAdapter.js +31 -8
- package/dist/agent/ClaudeSdkAdapter.js.map +1 -1
- package/dist/agent/ClaudeSdkAdapter.test.js +18 -6
- package/dist/agent/ClaudeSdkAdapter.test.js.map +1 -1
- package/dist/agent/CodexCliAdapter.d.ts +1 -1
- package/dist/agent/CodexCliAdapter.d.ts.map +1 -1
- package/dist/agent/CodexCliAdapter.js +5 -4
- package/dist/agent/CodexCliAdapter.js.map +1 -1
- package/dist/agent/CodexCliAdapter.test.js +16 -1
- package/dist/agent/CodexCliAdapter.test.js.map +1 -1
- package/dist/agent/CodexSdkAdapter.d.ts.map +1 -1
- package/dist/agent/CodexSdkAdapter.js +6 -0
- package/dist/agent/CodexSdkAdapter.js.map +1 -1
- package/dist/agent/ProviderRegistry.d.ts +5 -0
- package/dist/agent/ProviderRegistry.d.ts.map +1 -1
- package/dist/agent/ProviderRegistry.js +15 -0
- package/dist/agent/ProviderRegistry.js.map +1 -1
- package/dist/agent/ProviderRegistry.test.js +19 -0
- package/dist/agent/ProviderRegistry.test.js.map +1 -1
- package/dist/agent/adapters.d.ts.map +1 -1
- package/dist/agent/adapters.js +5 -0
- package/dist/agent/adapters.js.map +1 -1
- package/dist/agent/mcp-config.d.ts +16 -0
- package/dist/agent/mcp-config.d.ts.map +1 -0
- package/dist/agent/mcp-config.js +28 -0
- package/dist/agent/mcp-config.js.map +1 -0
- package/dist/agent/mcp-config.test.d.ts +2 -0
- package/dist/agent/mcp-config.test.d.ts.map +1 -0
- package/dist/agent/mcp-config.test.js +22 -0
- package/dist/agent/mcp-config.test.js.map +1 -0
- package/dist/agent/models.d.ts +10 -0
- package/dist/agent/models.d.ts.map +1 -0
- package/dist/agent/models.js +35 -0
- package/dist/agent/models.js.map +1 -0
- package/dist/agent/models.test.d.ts +2 -0
- package/dist/agent/models.test.d.ts.map +1 -0
- package/dist/agent/models.test.js +40 -0
- package/dist/agent/models.test.js.map +1 -0
- package/dist/agent/orchestrator.d.ts +65 -0
- package/dist/agent/orchestrator.d.ts.map +1 -0
- package/dist/agent/orchestrator.js +260 -0
- package/dist/agent/orchestrator.js.map +1 -0
- package/dist/agent/orchestrator.test.d.ts +2 -0
- package/dist/agent/orchestrator.test.d.ts.map +1 -0
- package/dist/agent/orchestrator.test.js +284 -0
- package/dist/agent/orchestrator.test.js.map +1 -0
- package/dist/agent/session.d.ts +1 -0
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +3 -2
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/session.test.js +9 -0
- package/dist/agent/session.test.js.map +1 -1
- package/dist/agent/smoke-chat.test.d.ts +2 -0
- package/dist/agent/smoke-chat.test.d.ts.map +1 -0
- package/dist/agent/smoke-chat.test.js +166 -0
- package/dist/agent/smoke-chat.test.js.map +1 -0
- package/dist/commands/commands.test.js +3 -0
- package/dist/commands/commands.test.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +2 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +3 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +9 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/knowledge.d.ts +9 -0
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +59 -2
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/knowledge.test.js +14 -1
- package/dist/commands/knowledge.test.js.map +1 -1
- package/dist/commands/mcp.d.ts +7 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +7 -2
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/progress.d.ts +4 -0
- package/dist/commands/progress.d.ts.map +1 -0
- package/dist/commands/progress.js +33 -0
- package/dist/commands/progress.js.map +1 -0
- package/dist/commands/refresh.d.ts +1 -0
- package/dist/commands/refresh.d.ts.map +1 -1
- package/dist/commands/refresh.js +17 -2
- package/dist/commands/refresh.js.map +1 -1
- package/dist/commands/remote.d.ts +4 -0
- package/dist/commands/remote.d.ts.map +1 -0
- package/dist/commands/remote.js +28 -0
- package/dist/commands/remote.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +14 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/status.test.d.ts +2 -0
- package/dist/commands/status.test.d.ts.map +1 -0
- package/dist/commands/status.test.js +31 -0
- package/dist/commands/status.test.js.map +1 -0
- package/dist/core/analysis-cache.d.ts +13 -3
- package/dist/core/analysis-cache.d.ts.map +1 -1
- package/dist/core/analysis-cache.js +41 -31
- package/dist/core/analysis-cache.js.map +1 -1
- package/dist/core/analysis-cache.test.js +50 -8
- package/dist/core/analysis-cache.test.js.map +1 -1
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +61 -0
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/generation-lock.d.ts +58 -0
- package/dist/core/generation-lock.d.ts.map +1 -0
- package/dist/core/generation-lock.js +233 -0
- package/dist/core/generation-lock.js.map +1 -0
- package/dist/core/generation-lock.test.d.ts +2 -0
- package/dist/core/generation-lock.test.d.ts.map +1 -0
- package/dist/core/generation-lock.test.js +134 -0
- package/dist/core/generation-lock.test.js.map +1 -0
- package/dist/core/isolate.test.js +30 -0
- package/dist/core/isolate.test.js.map +1 -1
- package/dist/core/knowledge.d.ts +20 -0
- package/dist/core/knowledge.d.ts.map +1 -1
- package/dist/core/knowledge.js +184 -36
- package/dist/core/knowledge.js.map +1 -1
- package/dist/core/knowledge.test.js +93 -15
- package/dist/core/knowledge.test.js.map +1 -1
- package/dist/core/locks.d.ts +4 -2
- package/dist/core/locks.d.ts.map +1 -1
- package/dist/core/locks.js +55 -7
- package/dist/core/locks.js.map +1 -1
- package/dist/core/locks.test.js +48 -0
- package/dist/core/locks.test.js.map +1 -1
- package/dist/core/progress.d.ts +21 -0
- package/dist/core/progress.d.ts.map +1 -0
- package/dist/core/progress.js +40 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/progress.test.d.ts +2 -0
- package/dist/core/progress.test.d.ts.map +1 -0
- package/dist/core/progress.test.js +52 -0
- package/dist/core/progress.test.js.map +1 -0
- package/dist/core/refresh.d.ts +5 -0
- package/dist/core/refresh.d.ts.map +1 -1
- package/dist/core/refresh.js +25 -0
- package/dist/core/refresh.js.map +1 -1
- package/dist/core/refresh.test.js +20 -0
- package/dist/core/refresh.test.js.map +1 -1
- package/dist/core/status.d.ts +2 -0
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/status.js +6 -1
- package/dist/core/status.js.map +1 -1
- package/dist/core/sync.d.ts.map +1 -1
- package/dist/core/sync.js +22 -1
- package/dist/core/sync.js.map +1 -1
- package/dist/core/sync.test.js +27 -0
- package/dist/core/sync.test.js.map +1 -1
- package/dist/core/workspace-git.d.ts +15 -0
- package/dist/core/workspace-git.d.ts.map +1 -0
- package/dist/core/workspace-git.js +131 -0
- package/dist/core/workspace-git.js.map +1 -0
- package/dist/core/workspace-git.test.d.ts +2 -0
- package/dist/core/workspace-git.test.d.ts.map +1 -0
- package/dist/core/workspace-git.test.js +52 -0
- package/dist/core/workspace-git.test.js.map +1 -0
- package/dist/core/workspace-skills-workflow.integration.test.js +15 -0
- package/dist/core/workspace-skills-workflow.integration.test.js.map +1 -1
- package/dist/core/workspace.create.test.js +5 -2
- package/dist/core/workspace.create.test.js.map +1 -1
- package/dist/core/workspace.d.ts.map +1 -1
- package/dist/core/workspace.js +11 -6
- package/dist/core/workspace.js.map +1 -1
- package/dist/generators/antigravity.d.ts.map +1 -1
- package/dist/generators/antigravity.js +2 -1
- package/dist/generators/antigravity.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +5 -3
- package/dist/generators/base.js.map +1 -1
- package/dist/generators/claude.d.ts.map +1 -1
- package/dist/generators/claude.js +4 -1
- package/dist/generators/claude.js.map +1 -1
- package/dist/generators/codex.d.ts.map +1 -1
- package/dist/generators/codex.js +2 -1
- package/dist/generators/codex.js.map +1 -1
- package/dist/generators/copilot.d.ts.map +1 -1
- package/dist/generators/copilot.js +4 -3
- package/dist/generators/copilot.js.map +1 -1
- package/dist/generators/cursor.d.ts.map +1 -1
- package/dist/generators/cursor.js +6 -3
- package/dist/generators/cursor.js.map +1 -1
- package/dist/generators/index.d.ts +2 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +79 -45
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/knowledge-migration.test.d.ts +2 -0
- package/dist/generators/knowledge-migration.test.d.ts.map +1 -0
- package/dist/generators/knowledge-migration.test.js +22 -0
- package/dist/generators/knowledge-migration.test.js.map +1 -0
- package/dist/generators/plan-generator.d.ts.map +1 -1
- package/dist/generators/plan-generator.js +18 -9
- package/dist/generators/plan-generator.js.map +1 -1
- package/dist/generators/plan-generator.test.js +4 -1
- package/dist/generators/plan-generator.test.js.map +1 -1
- package/dist/gui/assets/AgentsPage-B4fx43rd.js +3 -0
- package/dist/gui/assets/{CSPContext-BG7no5S_.js → CSPContext-DBUu9tE0.js} +1 -1
- package/dist/gui/assets/{DashboardPage-ByGTwAQa.js → DashboardPage-DH52G8IG.js} +1 -1
- package/dist/gui/assets/{GettingStartedPage-Xjx3M3RH.js → GettingStartedPage-BlTrQhvi.js} +1 -1
- package/dist/gui/assets/ProjectsPage-BPVSLPXv.js +1 -0
- package/dist/gui/assets/ScaffoldRepoInline-ywcpq9PX.js +1 -0
- package/dist/gui/assets/{SettingsPage-B9iN6hsv.js → SettingsPage-RQr8SalV.js} +1 -1
- package/dist/gui/assets/SkillsPage-CYoSRrwx.js +6 -0
- package/dist/gui/assets/StartWorkPage-DBKK4lFi.js +1 -0
- package/dist/gui/assets/{StrategiesPage-DDu3jwJx.js → StrategiesPage-C36TZgDX.js} +1 -1
- package/dist/gui/assets/WorkspacesPage-DxEONvSq.js +6 -0
- package/dist/gui/assets/{alert-dialog-CdqVrvZl.js → alert-dialog-CQAX2yRx.js} +1 -1
- package/dist/gui/assets/index-BF6pre6G.css +2 -0
- package/dist/gui/assets/index-C_rwnBzF.js +52 -0
- package/dist/gui/assets/isElementDisabled-uy_EOitH.js +1 -0
- package/dist/gui/assets/textarea-ByfoCb54.js +1 -0
- package/dist/gui/assets/{useAriaLabelledBy-DfRdwH8a.js → useAriaLabelledBy-ClesgjMe.js} +1 -1
- package/dist/gui/assets/useValueChanged-DeYvGnKs.js +1 -0
- package/dist/gui/assets/{vsc-D6UPv2ii.js → vsc-DFh0-53h.js} +1 -1
- package/dist/gui/index.html +5 -7
- package/dist/harness/claude.d.ts +3 -1
- package/dist/harness/claude.d.ts.map +1 -1
- package/dist/harness/claude.js +4 -2
- package/dist/harness/claude.js.map +1 -1
- package/dist/harness/codex.d.ts +3 -1
- package/dist/harness/codex.d.ts.map +1 -1
- package/dist/harness/codex.js +64 -12
- package/dist/harness/codex.js.map +1 -1
- package/dist/harness/contract.test.d.ts +2 -0
- package/dist/harness/contract.test.d.ts.map +1 -0
- package/dist/harness/contract.test.js +426 -0
- package/dist/harness/contract.test.js.map +1 -0
- package/dist/harness/harness.test.js +16 -1
- package/dist/harness/harness.test.js.map +1 -1
- package/dist/harness/types.d.ts +7 -1
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/index.js +52 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +8 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +11 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +6 -2
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +232 -14
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/tools.test.js +130 -6
- package/dist/mcp/tools.test.js.map +1 -1
- package/dist/resources/materializer.d.ts.map +1 -1
- package/dist/resources/materializer.js +11 -3
- package/dist/resources/materializer.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +37 -6
- package/dist/server.js.map +1 -1
- package/dist/server.test.js +37 -1
- package/dist/server.test.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/gui/assets/AgentsPage-YyYRodOR.js +0 -3
- package/dist/gui/assets/ProjectsPage-BMdhqAGs.js +0 -1
- package/dist/gui/assets/ScaffoldRepoInline-gXyYSIz5.js +0 -1
- package/dist/gui/assets/SkillsPage-CxcsbIsQ.js +0 -6
- package/dist/gui/assets/StartWorkPage-DPVHcdy4.js +0 -1
- package/dist/gui/assets/WorkspacesPage-BWRmP0mY.js +0 -2
- package/dist/gui/assets/index-CZoZQkeC.css +0 -2
- package/dist/gui/assets/index-wy68EqfB.js +0 -50
- package/dist/gui/assets/isElementDisabled-D_fu2zfc.js +0 -1
- package/dist/gui/assets/store-D5DUHbxn.js +0 -3
- package/dist/gui/assets/styles-CVwNuFCx.js +0 -1
- package/dist/gui/assets/textarea-BNRuIXNs.js +0 -1
- package/dist/gui/assets/useValueChanged-CStSGSsD.js +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{n as o}from"./CSPContext-BG7no5S_.js";import{t as ee}from"./chevron-down-qTL8HPug.js";import{a as s,c as te,i as ne,l as re,n as ie,o as ae,r as c,s as l,t as oe,u as se}from"./square-DlIYnlSq.js";import{t as u}from"./code-xml-jFAa3-TT.js";import{t as ce}from"./cpu-Cdwd84Jz.js";import{a as le,h as ue,m as de}from"./store-D5DUHbxn.js";import{t as d}from"./trash-2-CtR35_eF.js";import{t as f}from"./zap-CWG_Lvki.js";import{$ as fe,B as pe,Ft as p,Ht as m,Lt as me,Mt as he,N as ge,V as _e,Vt as h,X as ve,Z as ye,a as be,c as g,d as _,et as xe,f as v,jt as y,l as b,o as x,ot as Se,p as Ce,s as S,st as we}from"./index-wy68EqfB.js";import{t as C}from"./badge-CAohJGj6.js";import{t as Te}from"./card-BKXzd_5L.js";import{a as Ee,i as De,n as Oe,r as ke,t as Ae}from"./empty-BdlgbifD.js";import{t as w}from"./label-CG5exjag.js";import{t as je}from"./textarea-BNRuIXNs.js";var Me=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Ne=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Pe=r(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Fe=r(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Ie=r(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),T=t(e(),1),E=n(),D={"git-pull-request":ae,"flask-conical":l,package:ne,database:re,"shield-check":c,terminal:y,zap:f,cpu:ce,layers:s,boxes:m,code:u},Le=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function O({showToast:e}){let[t,n]=(0,T.useState)(`global`),[r,s]=(0,T.useState)(``),[ne,re]=(0,T.useState)({}),[ae,c]=(0,T.useState)(!1),[l,u]=(0,T.useState)(null),[ce,f]=(0,T.useState)(!1),[y,O]=(0,T.useState)(null),[Re,k]=(0,T.useState)(!1),[A,j]=(0,T.useState)(`edit`),[ze,M]=(0,T.useState)(!1),[N,P]=(0,T.useState)(null),[Be,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(null),[R,Ve]=(0,T.useState)(null),[z,B]=(0,T.useState)(null),{data:V=[],isLoading:He}=fe(),{data:H=[],isLoading:Ue}=xe(t===`global`?void 0:t),{data:We=[]}=we(),{data:U,isLoading:Ge,isError:Ke}=Se(t===`global`?``:t),[W,G]=(0,T.useState)(null),qe=ye(),Je=_e(),K=ve(),Ye=pe(),q=ge(),J=t!==`global`,Y=new Set(W??U?.enabledSkills??[]),X=!J||!Ge&&!Ke&&!!U;(0,T.useEffect)(()=>{if(!J){G(null);return}U&&G([...U.enabledSkills])},[J,t,U]);let Xe=e=>{re(t=>({...t,[e]:!t[e]}))},Z=H.filter(e=>{if(!r.trim())return!0;let t=r.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),Ze=V.reduce((e,t)=>(e[t.id]=Z.filter(e=>e.category===t.id),e),{}),Q=Z.filter(e=>!e.category||!V.some(t=>t.id===e.category)),Qe=e=>{u(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),c(!0)},$e=async()=>{if(!(!l||!l.name?.trim()))try{await qe.mutateAsync({id:l.id,name:l.name.trim(),description:l.description,icon:l.icon,color:l.color}),e?.(`Category saved successfully`,`success`),c(!1),u(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},et=(e,t)=>{t.stopPropagation(),L({type:`category`,id:e.id,title:e.name}),F(!0)},$=(e,t)=>{O(e||{name:``,title:``,category:t||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
|
|
2
|
-
|
|
3
|
-
Instructions and playbook for the AI assistant.
|
|
4
|
-
`,custom:!0}),k(!!e),j(`edit`),f(!0)},tt=e=>{if(!y)return;let t={...y,title:e};!Re&&!y.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),O(t)},nt=async()=>{if(!y||!y.name?.trim()||!y.description?.trim()||!y.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}try{await K.mutateAsync({id:y.id,name:y.name.trim(),title:y.title||y.name,category:y.category||`general`,description:y.description||``,tags:y.tags||[],allowedTools:y.allowedTools||[],content:y.content}),e?.(`Skill package saved successfully`,`success`),f(!1),O(null)}catch(t){e?.(`Failed to save skill`,`error`),console.error(t)}},rt=(e,t)=>{t.stopPropagation(),L({type:`skill`,id:e.id,title:e.title||e.name}),F(!0)},it=async()=>{if(I)try{I.type===`category`?(await Je.mutateAsync(I.id),e?.(`Category deleted`,`info`)):(await Ye.mutateAsync(I.id),e?.(`Skill package deleted`,`info`)),F(!1),L(null)}catch(t){e?.(`Failed to delete item`,`error`),console.error(t)}},at=e=>{if(!J||!X||W===null)return;let t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(Array.from(t))},ot=()=>{if(!y||y.custom!==!1)return;let e=`${y.name}-copy`;O({...y,id:void 0,name:e,title:`${y.title||y.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),k(!0)},st=(e,t)=>{if(!J||!X||W===null)return;let n=Ze[e]||[],r=new Set(W);for(let e of n)t?r.add(e.id):r.delete(e.id);G(Array.from(r))},ct=async()=>{if(!(!U||W===null||!J))try{await q.mutateAsync({workspaceId:t,expectedRevision:U.revision??0,enabledSkills:W,enabledAgents:U.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},lt=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Ve(t)},ut=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,z!==t&&B(t)},dt=()=>{B(null)},ft=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||R;if(Ve(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||J||i.category===n||(await K.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},pt=(e,t)=>{t.stopPropagation(),P(e),M(!0)},mt=async t=>{if(!N||N.category===t){M(!1),P(null);return}await K.mutateAsync({id:N.id,name:N.name,title:N.title,description:N.description,tags:N.tags,allowedTools:N.allowedTools,content:N.content,category:t}),e?.(`Skill moved to category`,`success`),M(!1),P(null)};return(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,E.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,E.jsx)(`div`,{children:(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,E.jsx)(m,{className:`h-6 w-6`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,E.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,E.jsx)(a,{render:(0,E.jsx)(le,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,E.jsx)(me,{className:`h-4 w-4 text-muted-foreground`}),(0,E.jsx)(w,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,E.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,E.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),We.map(e=>(0,E.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),J&&(0,E.jsx)(a,{size:`sm`,onClick:ct,disabled:!X||q.isPending||W===null,children:q.isPending?`Saving…`:`Save selection`}),!J&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>Qe(),className:`flex items-center gap-1.5`,children:[(0,E.jsx)(p,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`New Category`})]}),(0,E.jsxs)(a,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,E.jsx)(he,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`New Skill`})]})]})]})]}),(0,E.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,E.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,E.jsx)(ue,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,E.jsx)(o,{value:r,onChange:e=>s(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),r&&(0,E.jsx)(`button`,{onClick:()=>s(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(de,{className:`h-3.5 w-3.5`})})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsxs)(`span`,{children:[`Showing `,(0,E.jsx)(`strong`,{className:`text-foreground`,children:Z.length}),` of`,` `,(0,E.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),J&&(0,E.jsxs)(C,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,Y.size,` active)`]})]})]}),(0,E.jsx)(Ce,{className:`flex-1 p-6`,children:He||Ue||J&&Ge?(0,E.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,E.jsx)(be,{}),(0,E.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):J&&Ke?(0,E.jsx)(Ae,{className:`py-12 border border-dashed rounded-xl`,children:(0,E.jsxs)(ke,{children:[(0,E.jsx)(Ee,{children:`Workspace resources could not be loaded`}),(0,E.jsx)(Oe,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Z.length===0&&r?(0,E.jsxs)(Ae,{className:`py-12 border border-dashed rounded-xl`,children:[(0,E.jsx)(De,{children:(0,E.jsx)(ue,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,E.jsxs)(ke,{children:[(0,E.jsx)(Ee,{children:`No matching skills found`}),(0,E.jsxs)(Oe,{children:[`No skills matched your search query "`,r,`".`]})]}),(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>s(``),children:`Clear Search`})]}):(0,E.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=D[e.icon||`boxes`]||m,n=Ze[e.id]||[],r=!!ne[e.id],o=z===e.id,s=n.length>0&&n.every(e=>Y.has(e.id));return(0,E.jsxs)(`div`,{onDragOver:t=>ut(t,e.id),onDragLeave:dt,onDrop:t=>ft(t,e.id),className:i(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,o?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,E.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>Xe(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Xe(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,E.jsx)(t,{className:`h-4 w-4`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,E.jsxs)(C,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,E.jsx)(C,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[J&&n.length>0&&(0,E.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>st(e.id,!s),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:s?`Deselect all in category`:`Select all in category`,children:[s?(0,E.jsx)(ie,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,E.jsx)(oe,{className:`h-3.5 w-3.5 mr-1`}),(0,E.jsx)(`span`,{children:s?`Deselect All`:`Select All`})]}),!J&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,E.jsx)(p,{className:`h-3.5 w-3.5`})}),!J&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>Qe(e),title:`Edit category`,children:(0,E.jsx)(Fe,{className:`h-3 w-3`})}),!J&&e.custom&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>et(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,E.jsx)(d,{className:`h-3 w-3`})}),(0,E.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,E.jsx)(se,{className:`h-4 w-4`}):(0,E.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,E.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,E.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!J&&(0,E.jsxs)(E.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,E.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,E.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=Y.has(e.id);return(0,E.jsxs)(Te,{draggable:!J&&!!e.custom,onDragStart:t=>{!J&&e.custom&<(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:i(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,J&&!t&&`opacity-60 bg-muted/20`,R===e.id&&`opacity-40 border-dashed`),children:[(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,E.jsx)(Pe,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),J?(0,E.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),at(e.id)},disabled:!X||q.isPending,className:i(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,E.jsx)(h,{className:i(`h-3 w-3`,!t&&`opacity-0`)}),(0,E.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]}):(0,E.jsx)(C,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,E.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,2).map(e=>(0,E.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,E.jsx)(Ie,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!J&&e.custom&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>pt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(Me,{className:`h-3 w-3`})}),!J&&e.custom&&(0,E.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>rt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive`,children:(0,E.jsx)(d,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),Q.length>0&&(0,E.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,E.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,E.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,E.jsx)(C,{variant:`outline`,className:`text-[10px]`,children:Q.length})]})}),(0,E.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:Q.map(e=>(0,E.jsxs)(Te,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60`,children:[(0,E.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,E.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),J&&(0,E.jsx)(a,{size:`xs`,variant:Y.has(e.id)?`default`:`outline`,disabled:!X||q.isPending,onClick:t=>{t.stopPropagation(),at(e.id)},children:Y.has(e.id)?`Enabled`:`Disabled`})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]},e.id))})]})]})}),(0,E.jsx)(x,{open:ae,onOpenChange:c,children:(0,E.jsxs)(_,{className:`sm:max-w-lg`,children:[(0,E.jsxs)(b,{children:[(0,E.jsx)(v,{children:l?.id?`Edit Skill Category`:`Create Skill Category`}),(0,E.jsx)(S,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,E.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,E.jsx)(o,{id:`cat-name`,value:l?.name||``,onChange:e=>u(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,E.jsx)(o,{id:`cat-desc`,value:l?.description||``,onChange:e=>u(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{className:`text-xs font-medium`,children:`Icon`}),(0,E.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(D).map(e=>{let t=D[e];return(0,E.jsx)(`button`,{type:`button`,onClick:()=>u(t=>t?{...t,icon:e}:null),className:i(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,(l?.icon||`boxes`)===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,E.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{className:`text-xs font-medium`,children:`Color Accent`}),(0,E.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Le.map(e=>{let t=l?.color===e.value;return(0,E.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>u(t=>t?{...t,color:e.value}:null),className:i(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,E.jsx)(h,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,E.jsxs)(g,{children:[(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>c(!1),children:`Cancel`}),(0,E.jsx)(a,{variant:`default`,size:`sm`,onClick:$e,disabled:!l?.name?.trim(),children:`Save Category`})]})]})}),(0,E.jsx)(x,{open:ce,onOpenChange:f,children:(0,E.jsxs)(_,{className:`sm:max-w-3xl max-h-[90vh] flex flex-col`,children:[(0,E.jsx)(b,{children:(0,E.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(v,{children:y?.id?`Edit Skill Package`:`Create New Skill`}),(0,E.jsx)(S,{children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>j(`edit`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,A===`edit`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,E.jsx)(te,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`Edit`})]}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>j(`preview`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,A===`preview`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,E.jsx)(Ne,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,E.jsx)(Ce,{className:`flex-1 pr-4 py-2`,children:A===`edit`?(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,E.jsx)(o,{id:`skill-title`,value:y?.title||``,onChange:e=>tt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,E.jsx)(o,{id:`skill-name`,value:y?.name||``,disabled:!!y?.id,onChange:e=>{k(!0),O(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,E.jsx)(`select`,{id:`skill-cat`,value:y?.category||``,onChange:e=>O(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,E.jsx)(o,{id:`skill-tags`,value:y?.tags?.join(`, `)||``,onChange:e=>O(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. git, pr, quality`,className:`mt-1 text-xs font-mono`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,E.jsx)(o,{id:`skill-desc`,value:y?.description||``,onChange:e=>O(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(w,{htmlFor:`skill-content`,className:`text-xs font-medium`,children:`Playbook Instructions (Markdown)`}),(0,E.jsx)(je,{id:`skill-content`,value:y?.content||``,onChange:e=>O(t=>t?{...t,content:e.target.value}:null),rows:12,placeholder:`# Playbook Title
|
|
5
|
-
|
|
6
|
-
Detailed instructions for the AI assistant...`,className:`mt-1 font-mono text-xs leading-relaxed`})]})]}):(0,E.jsxs)(`div`,{className:`p-4 border rounded-xl bg-card/40 prose prose-sm dark:prose-invert max-w-none`,children:[(0,E.jsxs)(`div`,{className:`mb-4 pb-3 border-b`,children:[(0,E.jsx)(`h2`,{className:`text-lg font-bold m-0`,children:y?.title||y?.name}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground m-0 mt-1`,children:y?.description})]}),(0,E.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans bg-transparent p-0 border-0`,children:y?.content||`*(No playbook markdown provided)*`})]})}),(0,E.jsxs)(g,{className:`mt-4 pt-3 border-t`,children:[(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>f(!1),children:`Cancel`}),(0,E.jsx)(a,{variant:`default`,size:`sm`,onClick:y?.custom===!1?ot:nt,disabled:!y?.name?.trim()||!y?.description?.trim()||!y?.content?.trim(),children:y?.custom===!1?`Create editable copy`:`Save Skill`})]})]})}),(0,E.jsx)(x,{open:ze,onOpenChange:M,children:(0,E.jsxs)(_,{className:`sm:max-w-md`,children:[(0,E.jsxs)(b,{children:[(0,E.jsx)(v,{children:`Move Skill to Category`}),(0,E.jsxs)(S,{children:[`Select the destination category box for "`,N?.title||N?.name,`".`]})]}),(0,E.jsx)(`div`,{className:`space-y-2 py-2`,children:V.map(e=>{let t=D[e.icon||`boxes`]||m,n=N?.category===e.id;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>mt(e.id),className:i(`w-full p-3 rounded-lg border text-left flex items-center justify-between transition-colors`,n?`border-primary bg-primary/10`:`border-border hover:bg-muted/50 text-foreground`),children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`p-1.5 rounded text-white flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,E.jsx)(t,{className:`h-4 w-4`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`font-semibold text-xs`,children:e.name}),e.description&&(0,E.jsx)(`div`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:e.description})]})]}),n&&(0,E.jsx)(C,{variant:`secondary`,className:`text-[10px]`,children:`Current`})]},e.id)})}),(0,E.jsx)(g,{children:(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>M(!1),children:`Cancel`})})]})}),(0,E.jsx)(x,{open:Be,onOpenChange:F,children:(0,E.jsxs)(_,{className:`sm:max-w-md`,children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(v,{className:`text-destructive`,children:[`Delete `,I?.type===`category`?`Category`:`Skill`]}),(0,E.jsxs)(S,{children:[`Are you sure you want to delete "`,I?.title,`"? This action cannot be undone.`]})]}),(0,E.jsxs)(g,{className:`mt-4`,children:[(0,E.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>F(!1),children:`Cancel`}),(0,E.jsx)(a,{variant:`destructive`,size:`sm`,onClick:it,children:`Delete Permanently`})]})]})})]})}export{O as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{n as o}from"./CSPContext-BG7no5S_.js";import{t as s}from"./bot-C2HWrAft.js";import{t as c}from"./chevron-down-qTL8HPug.js";import{t as l}from"./code-xml-jFAa3-TT.js";import{n as u,r as d,t as f}from"./ScaffoldRepoInline-gXyYSIz5.js";import{t as p}from"./git-branch-Cfj9D8yW.js";import{a as m,d as h,f as g}from"./store-D5DUHbxn.js";import{t as _}from"./zap-CWG_Lvki.js";import{Bt as v,Ct as y,D as b,Dt as x,E as S,Et as ee,G as C,Ht as te,J as ne,Kt as w,L as T,Lt as re,M as ie,Mt as ae,O as oe,Ot as E,P as se,Pt as D,Rt as ce,St as O,T as le,Tt as ue,Vt as k,a as A,bt as de,ct as fe,d as j,et as pe,f as me,it as M,j as he,jt as N,k as ge,l as P,n as _e,nt as ve,o as ye,q as F,rt as I,s as L,t as R,u as z,wt as be,yt as B,zt as V}from"./index-wy68EqfB.js";import{t as xe}from"./badge-CAohJGj6.js";import{a as H,i as U,n as W,r as Se,t as Ce}from"./empty-BdlgbifD.js";import{t as we}from"./textarea-BNRuIXNs.js";import{n as Te,t as G}from"./vsc-D6UPv2ii.js";var Ee=r(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),De=r(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Oe=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),K=t(e(),1),q={status:`idle`,steps:[]};function ke(){let[e,t]=(0,K.useState)(q),n=(0,K.useRef)(null),r=w(),i=(0,K.useCallback)(()=>{n.current?.close(),n.current=null},[]);return(0,K.useEffect)(()=>i,[i]),{progress:e,start:(0,K.useCallback)(e=>{i(),t({status:`running`,steps:[]});let a=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=a;let o=0;a.addEventListener(`progress`,n=>{o=0;try{let a=JSON.parse(n.data);t({status:a.status===`completed`||a.status===`failed`?a.status:`running`,steps:a.steps??[],error:a.error,workspacePath:a.workspacePath,workspaceId:a.feature?.id??e}),(a.status===`completed`||a.status===`failed`)&&(i(),r.invalidateQueries({queryKey:[`workspaces`]}),r.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}),a.onerror=()=>{o+=1,!(a.readyState!==EventSource.CLOSED&&o<5)&&(t(e=>e.status===`running`?{...e,status:`failed`,error:e.error??`Lost connection to the creation stream.`}:e),i())}},[i,r]),reset:(0,K.useCallback)(()=>{i(),t(q)},[i])}}var J=n(),Y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Ae={codex:E,claude:B,vscode:G,"vscode-insiders":Te,cursor:de,antigravity:De,powershell:N,cmd:N,terminal:N,intellij:O,webstorm:ue,pycharm:y,sublime:be,zed:x,windsurf:ee},X={codex:`bg-foreground text-background`,claude:`bg-[#D97757] text-white`,vscode:`bg-[#007ACC] text-white`,"vscode-insiders":`bg-[#24A148] text-white`,cursor:`bg-zinc-950 text-white dark:bg-white dark:text-zinc-950`,antigravity:`bg-violet-600 text-white`,powershell:`bg-sky-700 text-white`,cmd:`bg-zinc-800 text-amber-400`,terminal:`bg-zinc-800 text-emerald-400`,intellij:`bg-fuchsia-600 text-white`,webstorm:`bg-cyan-600 text-white`,pycharm:`bg-lime-600 text-zinc-950`,sublime:`bg-orange-500 text-white`,zed:`bg-red-600 text-white`,windsurf:`bg-teal-600 text-white`};function Z({icon:e}){let t=Ae[e]??l;return(0,J.jsx)(`span`,{className:i(`grid size-10 shrink-0 place-items-center rounded-xl shadow-sm`,X[e]),"aria-hidden":`true`,children:(0,J.jsx)(t,{className:`size-5`})})}function Q({target:e,busy:t,launching:n,preferred:r,onLaunch:a}){return(0,J.jsxs)(`button`,{type:`button`,disabled:!e.available||t,onClick:()=>a(e),"aria-label":`Open workspace in ${e.name}`,className:i(`flex min-h-20 w-full items-center gap-3 rounded-xl border p-3 text-left outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`),children:[(0,J.jsx)(Z,{icon:e.icon}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),n?(0,J.jsx)(A,{className:`size-4`}):r?(0,J.jsx)(xe,{size:`sm`,variant:`secondary`,children:`Preferred`}):null]}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})}function je({session:e,busy:t,launching:n,onResume:r}){let a=e.desktopHandoff.method===`direct`,o=a?`Codex Desktop`:`Claude Desktop`;return(0,J.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>r(e),"aria-label":a?`Resume ${e.title} in Codex Desktop`:`Move ${e.title} to Claude Desktop`,className:i(`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 p-3 text-left outline-none transition-colors`,`hover:border-primary/45 hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-65`),children:[(0,J.jsx)(Z,{icon:a?`codex`:`claude`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium text-foreground`,title:e.title,children:e.title}),n?(0,J.jsx)(A,{className:`size-4 shrink-0`}):a?(0,J.jsx)(ce,{className:`size-4 shrink-0 text-muted-foreground`}):(0,J.jsx)(V,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,J.jsxs)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:[a?`Open this existing task in ${o}`:`Resume in Claude Code, then type /desktop`,` · `,new Date(e.updatedAt).toLocaleString()]})]})]})}function Me({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)(null),p=(0,K.useRef)(!1),m=I(),h=M(e,i),g=se().data?.config,_=m.data?.filter(e=>e.available)??[],v=_.filter(e=>e.kind===`ai-app`),y=g?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[g.defaultEditor]:void 0,b=_.filter(e=>e.kind===`editor`).toSorted((e,t)=>Number(t.id===y)-Number(e.id===y)),x=new Set(_.map(e=>e.id)),S=(h.data??[]).filter(e=>e.desktopHandoff&&x.has(e.desktopHandoff.targetId)),ee=n||_.length>0,C=async t=>{if(!p.current){p.current=!0,u(null),f(null),c(t.id);try{await fe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await m.refetch()}finally{c(null),p.current=!1}}},te=async t=>{if(!(p.current||!t.desktopHandoff||!Y.test(t.id))){p.current=!0,u(null),f(null),c(`session:${t.id}`);try{if(t.desktopHandoff.method===`guided`){await R(`claude --resume ${t.id}`),f(`Claude resume command copied. With a Claude subscription login, run it in this workspace, then type /desktop in Claude to move the session into Claude Desktop.`);return}await fe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.desktopHandoff.targetId,action:`resume`,sessionId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await Promise.all([m.refetch(),h.refetch()])}finally{c(null),p.current=!1}}},ne=()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),o(!1)},w=()=>Promise.all([m.refetch(),h.refetch()]),T=m.isFetching||h.isFetching;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(a,{variant:`outline`,className:r,onClick:()=>o(!0),children:[(0,J.jsx)(Oe,{}),`Open with…`]}),(0,J.jsx)(ye,{open:i,onOpenChange:e=>{o(e),e||(u(null),f(null))},children:(0,J.jsxs)(j,{className:`max-w-2xl`,"aria-busy":s!==null,children:[(0,J.jsxs)(P,{children:[(0,J.jsx)(me,{children:`Open workspace with…`}),(0,J.jsx)(L,{children:`Continue recent AI work or start in an installed coding app or editor. AI apps may use their own online services.`})]}),(0,J.jsxs)(z,{className:`space-y-5`,children:[l&&(0,J.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-foreground`,children:l}),d&&(0,J.jsx)(`div`,{role:`status`,className:`rounded-lg border border-primary/25 bg-primary/5 px-3 py-2 text-sm text-foreground`,children:d}),h.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,J.jsx)(A,{className:`size-4`}),` Checking recent sessions…`]}):S.length>0?(0,J.jsxs)(`section`,{"aria-labelledby":`recent-sessions-heading`,children:[(0,J.jsx)(`h3`,{id:`recent-sessions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Continue recent work`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:S.map(e=>(0,J.jsx)(je,{session:e,busy:s!==null,launching:s===`session:${e.id}`,onResume:te},`${e.assistant}:${e.id}`))})]}):h.isError?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent sessions could not be checked. Starting new work is still available.`}):null,n&&(0,J.jsxs)(`section`,{"aria-labelledby":`current-editor-heading`,children:[(0,J.jsx)(`h3`,{id:`current-editor-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Current window`}),(0,J.jsxs)(`button`,{type:`button`,disabled:s!==null,onClick:ne,className:`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 p-3 text-left outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-65`,children:[(0,J.jsx)(Z,{icon:`vscode`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:`Current VS Code window`}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:`Open through the installed NexusFlow extension.`})]})]})]}),m.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,J.jsx)(A,{}),` Checking apps on this computer…`]}):m.isError?(0,J.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive-foreground`,children:m.error instanceof Error?m.error.message:`Could not check available apps.`}):(0,J.jsxs)(J.Fragment,{children:[v.length>0&&(0,J.jsxs)(`section`,{"aria-labelledby":`ai-apps-heading`,children:[(0,J.jsx)(`h3`,{id:`ai-apps-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`AI coding apps`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:v.map(e=>(0,J.jsx)(Q,{target:e,busy:s!==null,launching:s===e.id,onLaunch:C},e.id))})]}),b.length>0&&(0,J.jsxs)(`section`,{"aria-labelledby":`editors-heading`,children:[(0,J.jsx)(`h3`,{id:`editors-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Code editors`}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:b.map(e=>(0,J.jsx)(Q,{target:e,busy:s!==null,launching:s===e.id,preferred:e.id===y,onLaunch:C},e.id))})]}),!ee&&(0,J.jsx)(Ce,{className:`rounded-xl border border-dashed py-8 md:p-8`,children:(0,J.jsxs)(Se,{children:[(0,J.jsx)(U,{variant:`icon`,children:(0,J.jsx)(Ee,{})}),(0,J.jsx)(H,{className:`text-base`,children:`No compatible apps detected`}),(0,J.jsx)(W,{children:`Install a supported coding app or add its command to PATH, then recheck.`})]})})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:T?`Checking recent sessions and apps…`:`Can’t find your app or session? Recheck detection.`}),(0,J.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void w(),disabled:T||s!==null,children:[(0,J.jsx)(D,{className:T?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}var Ne=`__ad-hoc__`,Pe=new URLSearchParams(window.location.search).get(`env`)===`vscode`,Fe=[{value:`in-place`,icon:_,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:p,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function Ie({repo:e,value:t,onChange:n,enabled:r}){let i=F(e.path,r),a=(0,K.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,J.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,J.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,J.jsx)(`datalist`,{id:s,children:a.map(e=>(0,J.jsx)(`option`,{value:e},e))})]})}function Le({step:e}){return(0,J.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,J.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,J.jsx)(k,{className:`size-3`}):e.status===`running`?(0,J.jsx)(A,{className:`size-3`}):e.status===`failed`?(0,J.jsx)(v,{className:`size-3`}):null}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,J.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function Re(){let e=h(),[t]=g(),n=C(),r=ne(),l=ie(),p=ve(),_=pe(),v=he(),y=T(),{progress:x,start:ee,reset:w}=ke(),[E,se]=(0,K.useState)(t.get(`project`)??Ne),[D,ce]=(0,K.useState)(`in-place`),[O,ue]=(0,K.useState)(``),[k,de]=(0,K.useState)(``),[j,me]=(0,K.useState)(``),[M,N]=(0,K.useState)([]),[P,ye]=(0,K.useState)(!1),[F,I]=(0,K.useState)([]),[L,R]=(0,K.useState)([]),[z,be]=(0,K.useState)([]),[B,V]=(0,K.useState)(``),[H,U]=(0,K.useState)(``),[W,Se]=(0,K.useState)(!1),[Ce,Te]=(0,K.useState)(null),[G,Ee]=(0,K.useState)({}),[De,Oe]=(0,K.useState)(!1),[q,Y]=(0,K.useState)(null),Ae=(0,K.useRef)(!1);(0,K.useEffect)(()=>{!Ae.current&&l.data&&(Ae.current=!0,I(l.data.filter(e=>e.detected).map(e=>e.name)))},[l.data]);let X=(0,K.useMemo)(()=>(n.data??[]).find(e=>e.id===E)??null,[n.data,E]),Z=(0,K.useMemo)(()=>X?X.repos.map(e=>({name:_e(e.path),path:e.path,defaultBranch:e.defaultBranch})):(r.data??[]).filter(e=>M.includes(e.path)),[X,r.data,M]),Q=D===`in-place`,je=(Q?k.trim().length>0:O.trim().length>0)&&Z.length>0&&j.trim().length>0,Re=e=>{V(e),Te(null);let t=(p.data??[]).find(t=>t.id===e);U(t?.content??``)},ze=async()=>{if(!j.trim()){Y(`Describe what you are building first — the suggestion is based on it.`);return}Y(null),Se(!0);try{let e=await fe(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:j,repos:Z})});V(e.suggestedWorkflowId),U(e.customInstructions),Te(e.difficulty)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{Se(!1)}},$=(0,K.useRef)(!1),Be=async()=>{if($.current||y.isPending||!je)return;$.current=!0,Y(null);let e={mode:D,projectId:X?.id,...Q?{name:k.trim()}:{branchName:O.trim()},description:j.trim(),repos:Z.map(e=>({...e,existingBranch:!Q&&G[e.path]?.trim()?G[e.path].trim():void 0})),assistants:F,enabledSkills:L.length>0?L:void 0,enabledAgents:z.length>0?z:void 0,teamworkInstructions:H.trim()||void 0};try{let{jobId:t}=await y.mutateAsync(e);ee(t)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{$.current=!1}};if(x.status!==`idle`){let t=x.steps.find(e=>e.status===`failed`);return(0,J.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:x.status===`running`?`Setting up your workspace…`:x.status===`completed`?`Workspace ready`:`Workspace creation failed`}),(0,J.jsx)(`ul`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:x.steps.map(e=>(0,J.jsx)(Le,{step:e},e.id))}),x.status===`failed`&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??x.error??`Something went wrong.`}),x.status===`completed`&&x.workspacePath&&(0,J.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:x.workspacePath}),q&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:q}),(0,J.jsxs)(`div`,{"data-testid":`workspace-ready-actions`,className:`mt-6 flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[x.status===`completed`&&x.workspaceId&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent(x.workspaceId)}`),children:`Open workspace`}),x.workspacePath&&(0,J.jsx)(Me,{workspaceId:x.workspaceId,workspacePath:x.workspacePath,isVsCode:Pe,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),x.status===`failed`&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(a,{variant:`default`,onClick:w,children:`Back to form (edit & retry)`}),(0,J.jsx)(a,{variant:`outline`,onClick:()=>window.location.reload(),children:`Start over (clear form)`})]}),x.status===`running`&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`}),(0,J.jsx)(a,{variant:`outline`,size:`sm`,onClick:w,children:`Cancel creation`})]})]})]})}return(0,J.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,J.jsxs)(`header`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,J.jsxs)(le,{value:E,onValueChange:e=>typeof e==`string`&&se(e),children:[(0,J.jsx)(oe,{className:`w-full`,"aria-label":`Project`,children:(0,J.jsx)(ge,{children:X?X.name:`Ad-hoc — pick repositories manually`})}),(0,J.jsxs)(b,{alignItemWithTrigger:!1,children:[(n.data??[]).map(e=>(0,J.jsx)(S,{value:e.id,children:e.name},e.id)),(0,J.jsx)(S,{value:Ne,children:`Ad-hoc — pick repositories manually`})]})]}),X?(0,J.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:X.repos.map(e=>(0,J.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(u,{repos:r.data??[],selectedPaths:M,onToggle:e=>N(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:r.isLoading}),(0,J.jsx)(f,{onCreated:e=>N(t=>[...t,e.path])})]}),(n.data??[]).length===0&&!n.isLoading&&(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,J.jsx)(m,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=D===`in-place`?`worktree`:`in-place`;ce(t),document.getElementById(`mode-${t}`)?.focus()}},children:Fe.map(e=>(0,J.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":D===e.value,tabIndex:D===e.value?0:-1,onClick:()=>ce(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,D===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,J.jsx)(e.icon,{className:i(`size-4`,D===e.value?`text-primary`:`text-muted-foreground`)}),(0,J.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,J.jsx)(`section`,{children:Q?(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,J.jsx)(o,{value:k,onChange:e=>de(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,J.jsx)(o,{value:O,onChange:e=>ue(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Z.length>0&&(0,J.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>Oe(e.target.open),children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Z.map(e=>(0,J.jsx)(Ie,{repo:e,enabled:De,value:G[e.path]??``,onChange:t=>Ee(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,J.jsx)(`section`,{children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,J.jsx)(we,{value:j,onChange:e=>me(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,J.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>ye(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":P,children:[`Advanced`,(0,J.jsx)(c,{className:i(`size-4 text-muted-foreground transition-transform`,P&&`rotate-180`)})]}),P&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(l.data??[]).map(e=>(0,J.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,J.jsx)(d,{checked:F.includes(e.name),onCheckedChange:()=>I(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,J.jsxs)(a,{size:`xs`,variant:`outline`,onClick:ze,disabled:W,children:[W?(0,J.jsx)(A,{}):(0,J.jsx)(ae,{}),`Suggest with AI`]})]}),(0,J.jsxs)(le,{value:B,onValueChange:e=>typeof e==`string`&&Re(e),children:[(0,J.jsx)(oe,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,J.jsx)(ge,{children:(p.data??[]).find(e=>e.id===B)?.name??`None`})}),(0,J.jsxs)(b,{alignItemWithTrigger:!1,children:[(0,J.jsx)(S,{value:``,children:`None`}),(p.data??[]).map(e=>(0,J.jsx)(S,{value:e.id,children:e.name},e.id))]})]}),Ce&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,J.jsx)(`span`,{className:`font-medium`,children:Ce}),` difficulty.`]}),(0,J.jsx)(we,{value:H,onChange:e=>U(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,J.jsx)(te,{className:`size-4 text-primary`}),`Agent Skills (`,L.length,` selected)`]}),(_.data??[]).length>0&&(0,J.jsx)(a,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{let e=(_.data??[]).map(e=>e.id);R(L.length===e.length?[]:e)},className:`text-xs text-muted-foreground hover:text-foreground h-6 px-2`,children:L.length===(_.data??[]).length&&(_.data??[]).length>0?`Deselect All`:`Select All`})]}),(0,J.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-lg border border-border bg-card/50 p-2 space-y-1.5`,children:_.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center justify-center p-4 gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{className:`size-3`}),`Loading skills...`]}):(_.data??[]).length===0?(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground p-2 text-center`,children:`No skills available in catalog.`}):(_.data??[]).map(e=>{let t=L.includes(e.id);return(0,J.jsxs)(`label`,{className:i(`flex items-center justify-between gap-2 rounded-md p-2 text-xs cursor-pointer border transition-colors`,t?`border-primary/50 bg-primary/5 text-foreground`:`border-transparent hover:bg-muted/50 text-muted-foreground`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,J.jsx)(d,{checked:t,onCheckedChange:()=>R(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,J.jsx)(`span`,{className:`font-mono font-medium truncate`,children:e.title||e.name})]}),(0,J.jsx)(xe,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.category})]},e.id)})})]}),(v.data??[]).length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:(0,J.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,J.jsx)(s,{className:`size-4 text-purple-400`}),`Codex Native Agents (`,z.length,` selected)`]})}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(v.data??[]).map(e=>{let t=z.includes(e.id);return(0,J.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`text-muted-foreground hover:bg-muted/50`),children:[(0,J.jsx)(d,{checked:t,onCheckedChange:()=>be(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,J.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.id)})})]})]})]}),q&&(0,J.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,J.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(re,{className:`size-3.5`}),Z.length,` repositor`,Z.length===1?`y`:`ies`,` selected`]}),(0,J.jsxs)(a,{onClick:Be,disabled:!je||y.isPending,children:[y.isPending?(0,J.jsx)(A,{}):null,Q?`Start working`:`Create workspace`]})]})]})]})}export{Re as StartWorkPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f}from"./button-BDDZnIHx.js";import{$ as p,$t as m,A as h,C as g,D as _,E as v,F as y,Fn as b,Ft as x,H as S,I as C,It as w,J as T,Jn as E,Jt as D,Kt as O,L as k,Lt as A,M as j,N as M,O as N,On as P,P as F,Pn as I,Q as ee,Qn as L,R,Rn as te,S as z,Sn as B,St as V,T as H,Tt as U,Un as ne,X as re,Xn as ie,Xt as ae,Yn as oe,Yt as se,Z as ce,Zn as le,Zt as ue,_ as de,_t as fe,at as pe,bt as me,ct as he,d as ge,dn as _e,en as ve,et as ye,f as be,g as xe,gt as Se,h as Ce,it as we,j as Te,jn as Ee,k as De,ln as W,m as Oe,n as ke,on as Ae,p as je,q as Me,qn as Ne,sn as Pe,t as Fe,tt as Ie,un as G,v as Le,vt as Re,w as ze,x as Be,xt as Ve,y as He,z as Ue,zn as We}from"./CSPContext-BG7no5S_.js";import{t as Ge}from"./bot-C2HWrAft.js";import{t as Ke}from"./chevron-down-qTL8HPug.js";import{a as qe,c as Je,i as Ye,l as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt,u as nt}from"./square-DlIYnlSq.js";import{t as rt}from"./code-xml-jFAa3-TT.js";import{t as it}from"./cpu-Cdwd84Jz.js";import{a as at,h as ot,m as st,n as ct,r as lt,t as ut}from"./store-D5DUHbxn.js";import{t as dt}from"./trash-2-CtR35_eF.js";import{t as ft}from"./zap-CWG_Lvki.js";import{_ as pt,a as mt,c as ht,d as gt,f as _t,l as vt,n as yt,o as bt,s as xt,t as St,u as Ct,x as wt,y as Tt}from"./isElementDisabled-D_fu2zfc.js";import{$ as Et,A as Dt,At as Ot,Ft as kt,Ht as At,It as jt,K as Mt,Lt as Nt,M as Pt,Mt as Ft,N as It,Ot as Lt,Pt as Rt,Q as zt,Rt as Bt,U as Vt,Ut as Ht,Vt as K,W as Ut,Wt,_t as Gt,a as q,at as Kt,ct as qt,dt as Jt,et as Yt,ft as Xt,gt as Zt,ht as Qt,i as J,j as $t,jt as Y,lt as en,mt as tn,n as nn,ot as rn,pt as an,r as on,rt as sn,t as cn,ut as X,vt as ln,w as un,xt as dn,yt as fn,zt as Z}from"./index-wy68EqfB.js";import{t as pn}from"./badge-CAohJGj6.js";import{t as mn}from"./card-BKXzd_5L.js";import{a as hn,i as gn,n as _n,r as vn,t as yn}from"./empty-BdlgbifD.js";import{t as bn}from"./textarea-BNRuIXNs.js";import{n as xn,t as Sn}from"./vsc-D6UPv2ii.js";var Cn=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),wn=a(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Tn=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),En=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Dn=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),On=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),kn=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),An=a(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),jn=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Mn=a(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Q=t(e(),1);function Nn(){let[,e]=Q.useState({});return Q.useCallback(()=>{e({})},[])}function Pn(e){let t=_e(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Tt(n)!==a||Tt(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Fn(e){let{popupElement:t,positionerElement:r,content:i,mounted:a,onMeasureLayout:o,onMeasureLayoutComplete:c,side:l,direction:u}=e,d=se(t,!0,!1),f=ue(),p=Q.useRef(null),m=Q.useRef(!0),h=Q.useRef(s),g=G(o),_=G(c),v=Q.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:n},[l,u]);W(()=>{if(!a){h.current=s,m.current=!0,p.current=null;return}if(!t||!r)return;h.current=Ln(t,v),Rn(t,`auto`);let e=In(t,`position`,`static`),n=In(t,`transform`,`none`),i=In(t,`scale`,`1`),o=Ln(r,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),n(),o()}function l(){c(),i()}if(g?.(),m.current||p.current===null){zn(r,`max-content`);let e=Pn(t);return p.current=e,zn(r,e),l(),_?.(null,e),m.current=!1,()=>{h.current(),h.current=s}}zn(r,`max-content`);let u=p.current,y=Pn(t);p.current=y,Rn(t,u),l(),_?.(u,y),zn(r,y);let b=new AbortController;return f.request(()=>{Rn(t,y),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),h.current(),h.current=s}},[i,t,r,d,f,a,g,_,v])}function In(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Ln(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(In(e,r,i));return n.length?()=>{n.forEach(e=>e())}:s}function Rn(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function zn(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var Bn=t(L(),1),$=i();function Vn(e){let{store:t,side:n,cssVars:r,children:i}=e,a=be(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=yt(c?o:null),m=Gn(s,l),h=Q.useRef(null),[g,_]=Q.useState(null),[v,y]=Q.useState(null),b=Q.useRef(null),x=Q.useRef(null),S=se(b,!0,!1),C=ue(),[w,T]=Q.useState(null),[E,D]=Q.useState(!1);W(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let O=G(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),k=G(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&T(e)}),A=Q.useRef(null);W(()=>{(!c||!u)&&(A.current=null)},[c,u]),W(()=>{if(o&&p&&o!==p&&A.current!==o&&h.current){_(h.current),D(!0);let e=Wn(p,o);y(e),C.request(()=>{Bn.flushSync(()=>{D(!1)}),S(()=>{_(null),T(null),h.current=null})}),A.current=o}},[o,p,g,S,C]),W(()=>{let e=b.current;if(!e)return;let t=U(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let j=g!=null,M;M=j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:je(!0),ref:x,style:{...w?{[r.popupWidth]:`${w.width}px`,[r.popupHeight]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":E?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:i},m),W(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),Fn({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:a});let N={activationDirection:Hn(v),transitioning:j};return{children:M,state:N}}function Hn(e){if(e)return`${Un(e.horizontal,5,`right`,`left`)} ${Un(e.vertical,5,`down`,`up`)}`}function Un(e,t,n,r){return e>t?n:e<-t?r:``}function Wn(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function Gn(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return W(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var Kn=Q.createContext(void 0);function qn(){let e=Q.useContext(Kn);if(e===void 0)throw Error(u(64));return e}var Jn=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),Yn={tabActivationDirection:e=>({[Jn.activationDirection]:e})},Xn=Q.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Q.useRef([]),[p,h]=Q.useState(()=>new Map),[g,_]=P({controlled:c,default:r,name:`Tabs`,state:`value`}),v=c!==void 0,[y,x]=Q.useState(()=>new Map),S=Q.useRef(void 0),C=Q.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of y.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[y]),[w,T]=Q.useState(()=>({previousValue:g,tabActivationDirection:`none`})),{previousValue:E,tabActivationDirection:D}=w,O=D,k=!1;E!==g&&(O=Zn(E,g,a,y),k=E!=null&&g!=null&&C(g)==null);let A=k?E:g,j=E!==A||D!==O;W(()=>{j&&T({previousValue:A,tabActivationDirection:O})},[A,j,O]);let M=G((e,t)=>{t.activationDirection=Zn(g,e,a,y),i?.(e,t),!t.isCanceled&&_(e)}),N=G((e,t)=>{i?.(e,m(t,void 0,void 0,{activationDirection:`none`}))}),F=G((e,t)=>{h(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=G((e,t)=>{h(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),ee=Q.useCallback(e=>p.get(e),[p]),L=Q.useCallback(e=>{for(let t of y.values())if(e===t?.value)return t?.id},[y]),R=Q.useMemo(()=>({getTabElementBySelectedValue:C,getTabIdByPanelValue:L,getTabPanelIdByValue:ee,onValueChange:M,orientation:a,registerMountedTabPanel:F,setTabMap:x,unregisterMountedTabPanel:I,tabActivationDirection:O,value:g}),[C,L,ee,M,a,F,x,I,O,g]),z=Q.useMemo(()=>{for(let e of y.values())if(e!=null&&e.value===g)return e},[y,g]),B=Q.useMemo(()=>{for(let e of y.values())if(e!=null&&!e.disabled)return e.value},[y]),V=Q.useRef(!d),H=Q.useRef(r),U=Q.useRef(d),ne=Q.useRef(!1);W(()=>{if(v)return;function e(e,t){_(e),T(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),N(e,t),V.current=!1}if(y.size===0){ne.current&&g!==null&&!S.current?.isConnected&&e(null,te);return}ne.current=!0,S.current=y.keys().next().value;let t=z?.disabled,n=z==null&&g!==null;if(!t&&g===H.current&&(U.current=!1),U.current&&t&&g===H.current)return;let r=V.current;if(t||n){let n=B??null;if(g===n){V.current=!1;return}let i=te;r?i=b:t&&(i=Ee),e(n,i);return}r&&z!=null&&(N(g,b),V.current=!1)},[B,v,N,z,_,y,g]);let re=o(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:u,stateAttributesMapping:Yn});return(0,$.jsx)(Kn.Provider,{value:R,children:(0,$.jsx)(ht,{elementsRef:f,children:re})})});function Zn(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var Qn=`data-composite-item-active`,$n=Q.createContext(void 0);function er(){let e=Q.useContext($n);if(e===void 0)throw Error(u(65));return e}var tr=Q.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:h}=qn(),{activateOnFocus:g,highlightedTabIndex:_,onTabActivation:v,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:S}=er(),C=ve(s),{compositeProps:T,compositeRef:E,index:D}=tn({metadata:Q.useMemo(()=>({disabled:r,id:C,value:a}),[r,C,a])}),O=a===d,k=Q.useRef(!1),A=Q.useRef(null);W(()=>{let e=A.current;if(e)return y(e)},[y]),W(()=>{if(k.current){k.current=!1;return}if(!(O&&D>-1&&_!==D))return;let e=S;if(e!=null){let t=x(U(e));if(t&&w(e,t))return}r||b(D)},[O,D,_,b,r,S]);let{getButtonProps:j,buttonRef:M}=Ae({disabled:r,native:c,focusableWhenDisabled:!0}),N=f(a),P=Q.useRef(!1),F=Q.useRef(!1);function I(e){O||r||v(a,m(We,e.nativeEvent,void 0,{activationDirection:`none`}))}function ee(e){O||(D>-1&&!r&&b(D),!r&&g&&(!P.current||P.current&&F.current)&&v(a,m(We,e.nativeEvent,void 0,{activationDirection:`none`})))}function L(e){if(O||r)return;P.current=!0;function t(){P.current=!1,F.current=!1}(!e.button||e.button===0)&&(F.current=!0,U(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:O,orientation:p,tabActivationDirection:h},ref:[t,M,E,A],props:[T,{role:`tab`,"aria-controls":N,"aria-selected":O,id:C,onClick:I,onFocus:ee,onPointerDown:L,[Qn]:O?``:void 0,onKeyDownCapture(){k.current=!0}},u,j],stateAttributesMapping:Yn})}),nr=Me();function rr(){return s}function ir(){return!1}function ar(){return!0}function or(){return(0,nr.useSyncExternalStore)(rr,ir,ar)}var sr=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),cr={...Yn,activeTabPosition:()=>null,activeTabSize:()=>null},lr=Q.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Fe(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=qn(),{tabsListElement:p,registerIndicatorUpdateListener:m}=er(),h=or(),g=Nn();Q.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=Pn(e),{width:r,height:i}=Pn(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[sr.activeTabLeft]:`${_}px`,[sr.activeTabRight]:`${v}px`,[sr.activeTabTop]:`${y}px`,[sr.activeTabBottom]:`${b}px`,[sr.activeTabWidth]:`${x}px`,[sr.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:cr});return f==null?null:(0,$.jsxs)(Q.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),ur=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=ie.startingStyle]=`startingStyle`,e[e.endingStyle=ie.endingStyle]=`endingStyle`,e}({}),dr={...Yn,...le},fr=Q.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=qn(),h=ve(),{ref:g,index:_}=wt({metadata:Q.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=ae(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Q.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:je(!v),[ur.index]:_},c],stateAttributesMapping:dr});return D({open:v,ref:T,onComplete(){v||x(!1)}}),W(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),pr=[];function mr(e){let{loopFocus:t=!0,orientation:n=`both`,grid:i,onLoop:a,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=pr}=e,[m,h]=Q.useState(0),g=i!=null,y=Q.useRef(null),b=r(y,l),x=Q.useRef([]),S=Q.useRef(!1),C=s??m,w=G((e,t=!1)=>{if((c??h)(e),t){let t=x.current[e];_(y.current,t,o,n)}}),T=G(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)w(i);else if(Ve(t,C,f)){let e=Se(t,{disabledIndices:f});me(t,e)||w(e)}_(y.current,r,o,n)});W(()=>{if(f==null||s!=null||!S.current)return;let e=x.current;if(Ve(e,C,f)){let t=Se(e,{disabledIndices:f});me(e,t)||w(t)}},[f,s,C,x,w]);let E=G((e,t,n)=>a?a(e,t,n,x):n),D=G(e=>{let r=u?He:Ce;if(!r.has(e.key)||hr(e,p)||!y.current)return;let s=o===`rtl`,c=s?xe:de,l={horizontal:c,vertical:Oe,both:c}[n],m=s?de:xe,h={horizontal:m,vertical:Le,both:m}[n],_=A(e.nativeEvent);if(_!=null&&v(_)&&!St(_)){let t=_.selectionStart,n=_.selectionEnd,r=_.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let b=C,S=Re(x,f),T=fe(x,f);i!=null&&(b=i({disabledIndices:f,elementsRef:x,event:e,highlightedIndex:C,loopFocus:t,maxIndex:T,minIndex:S,onLoop:E,orientation:n,rtl:s}));let D={horizontal:[c],vertical:[Oe],both:[c,Oe]}[n],O={horizontal:[m],vertical:[Le],both:[m,Le]}[n],k=g?r:{horizontal:u?z:Be,vertical:u?H:ze,both:r}[n];u&&(e.key===`Home`?b=S:e.key===`End`&&(b=T)),b===C&&(D.includes(e.key)||O.includes(e.key))&&(t&&b===T&&D.includes(e.key)?(b=S,a&&(b=a(e,C,b,x))):t&&b===S&&O.includes(e.key)?(b=T,a&&(b=a(e,C,b,x))):b=Se(x.current,{startingIndex:b,decrement:O.includes(e.key),disabledIndices:f})),b!==C&&!me(x.current,b)&&(d&&e.stopPropagation(),k.has(e.key)&&e.preventDefault(),w(b,!0),queueMicrotask(()=>{x.current[b]?.focus()}))});return{props:{ref:b,onFocus(e){let t=y.current,n=A(e.nativeEvent);!t||n==null||!v(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:D},highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,disabledIndices:f,onMapChange:T,relayKeyboardEvent:D}}function hr(e,t){for(let n of g.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function gr(e){let{render:t,className:r,style:i,refs:a=d,props:s=d,state:c=n,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=mr({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:be(),disabledIndices:x,modifierKeys:S}),M=o(w,e,{state:c,ref:a,props:[E,...s,T],stateAttributesMapping:l}),N=Q.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,$.jsx)(Pe.Provider,{value:N,children:(0,$.jsx)(ht,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}var _r=Q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:f,tabActivationDirection:p}=qn(),[m,h]=Q.useState(0),[g,_]=Q.useState(null),v=Q.useRef(new Set),y=Q.useRef(new Set),b=Q.useRef(null);W(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=G(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=G(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=G((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:p},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=Q.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,x,S,C,h,g]);return(0,$.jsx)($n.Provider,{value:E,children:(0,$.jsx)(gr,{render:a,className:r,style:o,state:w,refs:[t,_],props:[T,s],stateAttributesMapping:Yn,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:d})})});function vr({className:e,...t}){return(0,$.jsx)(Xn,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function yr({className:e,...t}){return(0,$.jsxs)(_r,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(lr,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function br({className:e,...t}){return(0,$.jsx)(tr,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function xr({className:e,...t}){return(0,$.jsx)(fr,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Sr=Q.createContext(void 0);function Cr(e){let t=Q.useContext(Sr);if(t===void 0&&!e)throw Error(u(47));return t}function wr(){return{...ut(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Tr={...lt,disabled:T(e=>e.disabled),instantType:T(e=>e.instantType),openMethod:T(e=>e.openMethod),openChangeReason:T(e=>e.openChangeReason),modal:T(e=>e.modal),focusManagerModal:T(e=>e.focusManagerModal),stickIfOpen:T(e=>e.stickIfOpen),titleElementId:T(e=>e.titleElementId),descriptionElementId:T(e=>e.descriptionElementId),openOnHover:T(e=>e.openOnHover),closeDelay:T(e=>e.closeDelay),hasViewport:T(e=>e.hasViewport)},Er=class e extends S{constructor(e,t,n=!1){let r={...wr(),...e},i=new N;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=ct(i,t,n),super(r,{popupRef:Q.createRef(),backdropRef:Q.createRef(),internalBackdropRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new O,triggerElements:i},Tr)}setOpen=(e,t)=>{let n=t.reason===ne,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=h(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};j(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Bn.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=R(t,(t,r)=>new e(n,t,r));return Q.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Dr({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Er.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});F(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),h=Ie()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),k(u,d),M(u);let{forceUnmount:g}=y(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:h}),Q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let _=Q.useCallback(()=>{u.setOpen(!1,m(I))},[u]);Q.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:_}),[g,_]);let v=d||f,b=Q.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Sr.Provider,{value:b,children:[v&&(0,$.jsx)(kr,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Or(e){return Cr(!0)?(0,$.jsx)(Dr,{props:e}):(0,$.jsx)(p,{children:(0,$.jsx)(Dr,{props:e})})}function kr({store:e,modal:t}){let r=re(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return C(e,{activeTriggerProps:r.reference??n,inactiveTriggerProps:r.trigger??n,popupProps:Q.useMemo(()=>l(De,r.floating),[r.floating])}),null}var Ar=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=Cr(!0),_=c?.store??g?.store;if(!_)throw Error(u(74));let v=ve(m),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),S=_.useState(`triggerPopupId`,v),C=Q.useRef(null),{registerTrigger:w,isMountedByThisTrigger:T}=Ue(v,C,_,{payload:l,disabled:a,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),A=_.useState(`focusManagerModal`),j=Zt(b,{enabled:!a&&b!=null&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Qt(),restMs:f,delay:{close:p},triggerElementRef:C,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),M=pt(b,{enabled:b!=null,stickIfOpen:O}),N=mt(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),P=_.useState(`triggerProps`,T),{getButtonProps:F,buttonRef:I}=Ae({disabled:a,native:s}),ee={open(e){return e&&D===`trigger-press`?E.open(e):oe.open(e)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:te}=an(_,C),z=o(`button`,e,{state:{disabled:a,open:x},ref:[I,t,w,C],props:[M.reference,j,P,N,{[pe]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":S},h,F],stateAttributesMapping:ee});return T&&!A?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(V,{ref:L,onFocus:R}),(0,$.jsx)(Q.Fragment,{children:z},v),(0,$.jsx)(V,{ref:_.context.triggerFocusTargetRef,onFocus:te})]}):(0,$.jsx)(Q.Fragment,{children:z},v)}),jr=Q.createContext(void 0);function Mr(){let e=Q.useContext(jr);if(e===void 0)throw Error(u(45));return e}var Nr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Cr();return i.useState(`mounted`)||n?(0,$.jsx)(jr.Provider,{value:n,children:(0,$.jsx)(we,{ref:t,...r})}):null}),Pr=Q.createContext(void 0);function Fr(){let e=Q.useContext(Pr);if(!e)throw Error(u(46));return e}var Ir=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=he,..._}=e,{store:v}=Cr(),y=Mr(),b=ye(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=Q.useRef(null),N=se(O,!1,!1),P=vt({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?Ct:void 0}),F=x.useState(`domReferenceElement`);W(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]),bt(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let I=Q.useCallback(e=>{v.set(`positionerElement`,e)},[v]),L=xt(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,I],hidden:!S,inert:!C});return(0,$.jsxs)(Pr.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&(0,$.jsx)(ge,{ref:v.context.internalBackdropRef,inert:je(!C),cutout:T}),(0,$.jsx)(ee,{id:b,children:L})]})}),Lr=Q.createContext(void 0);function Rr(){let[e,t]=Q.useState(0),n=G(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function zr(e){let{value:t,children:n}=e;return(0,$.jsx)(Lr.Provider,{value:t,children:n})}var Br={...Ne,...le},Vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Cr(),u=Fr(),d=_t(!0)!=null,{context:f,hasClosePart:p}=Rr(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),O=l.useState(`disabled`),k=l.useState(`openOnHover`),A=l.useState(`closeDelay`),j=c.id??E;D({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),Gt(T,{enabled:k&&!O,closeDelay:A});let M=a===void 0?Te(l.context.popupRef):a,N=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,N);let P=Q.useCallback(e=>{l.set(`popupElement`,e)},[l]),F=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,P],props:[v,{id:j,role:`dialog`,...De,"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&He.has(e.key)&&e.stopPropagation()}},gt(_),c],stateAttributesMapping:Br});return(0,$.jsx)(ce,{context:T,openInteractionType:h,modal:N,disabled:!S||C===`trigger-hover`,initialFocus:M,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:B(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(zr,{value:f,children:F})})}),Hr=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Ur={activationDirection:e=>e?{"data-activation-direction":e}:null},Wr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Cr(),{side:l}=Fr(),u=c.useState(`instantType`),{children:d,state:f}=Vn({store:c,side:l,cssVars:Hr,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:Ur})}),Gr=Or;function Kr({className:e,children:t,...n}){return(0,$.jsx)(Ar,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function qr({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(Nr,{children:(0,$.jsx)(Ir,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(Vr,{className:c(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(Wr,{className:c(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function Jr({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(Gr,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(Kr,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(kt,{size:14}),` Add repository`]})}),(0,$.jsxs)(qr,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ot,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(ke,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var Yr=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;default:return`agy --conversation ${t}`}},Xr=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(ln,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(fn,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(Lt,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(dn,{className:`size-2.5`})});default:return null}},Zr=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},Qr=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let l=sn(),u=Vt(),d=Pt(),p=d.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=d.data?.find(e=>e.name===`claude`)?.detected??!1,h=d.data?.find(e=>e.name===`codex`)?.detected??!1,g=d.data?.find(e=>e.name===`copilot`)?.detected??!1,_=!!l.data?.some(e=>e.id===`antigravity`&&e.available),v=!!l.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),ee=e=>{I(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),te=async t=>{try{await qt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),s?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;s?.(t,`error`)}},z=async t=>{if(!C){w(t);try{await u.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{w(null)}}},B=async(t,n)=>{if(!L.current){L.current=!0,S(t);try{await u.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n});let r=Yr(n,t);E({assistant:n,cmd:r,timestamp:new Date}),s?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=Yr(n,t);await cn(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),L.current=!1}}},V=async t=>{if(!(!v||R.current)){R.current=t,b(t);try{await o(e,t,`codex`)}finally{R.current=null,b(null)}}},H=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),U=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return H(e,D)},[t,N,j,D]),ne=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),re=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`claude`),D),[t,D]),ie=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`codex`),D),[t,D]),ae=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`copilot`),D),[t,D]),oe=t=>e.assistants?.includes(t)??!1,se=[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:oe(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:ne,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(ln,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:oe(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:re,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(fn,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:oe(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:ie,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(Lt,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:oe(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:ae,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(dn,{className:`size-3`})})}];return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(ot,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:c(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),[`antigravity`,`claude`,`codex`,`copilot`].map(e=>{let n=t.filter(t=>t.assistant===e).length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e?`all`:e),className:c(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e,` (`,n,`)`]},e)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(q,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(en,{children:[(0,$.jsxs)(Xt,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(Wt,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(Ke,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(Jt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(X,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await cn(T.cmd),s?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(Z,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(mn,{className:`divide-y divide-border overflow-hidden surface-card`,children:U.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):U.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[Xr(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Zr(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void B(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Dn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void V(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=Yr(e.assistant,e.id);await cn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Z,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:se.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(mn,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>ee(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(Ke,{size:14}):(0,$.jsx)(nt,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(J,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)(J,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void z(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(kt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>void te(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void z(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(kt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Zr(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void B(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Dn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void V(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=Yr(e.assistant,e.id);await cn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Z,{size:12})})]})]},e.id))})]},e.id)})})]})};function $r({ws:e}){let t=e.branchName,n=Kt(t),r=zt(t),i=Ut(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),s=(0,Q.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Q.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[p,m]=(0,Q.useState)(`classic`),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=[...o.map(e=>e.name),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=Dt(t,_,!0),S=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Q.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Q.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Ot,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(J,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(tt,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(jt,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(J,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-3 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(jt,{size:13}),` Start All Services`]}),(0,$.jsxs)(f,{size:`sm`,variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(tt,{size:13}),` Stop All`]})]})]}),(o.length>0||d.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-md border border-border/80 bg-card shadow-xs lg:grid-cols-12 surface-card`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border/80 bg-muted/20 p-4 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Y,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(An,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(tt,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(jt,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),d.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(J,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(J,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:c(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(dt,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(On,{size:13}):(0,$.jsx)(En,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var ei=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)({}),[x,S]=(0,Q.useState)({}),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:e.split(`
|
|
2
|
-
`).map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})});return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Nt,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:n,children:[(0,$.jsx)(Rt,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:r,children:[r?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Rt,{size:11}),` Sync All`]}),(0,$.jsx)(f,{size:`sm`,onClick:()=>p(!0),disabled:t.every(e=>e.files.length===0)||s,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>l(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),c&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(jn,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(ke,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&g(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{p(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>g(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(q,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(q,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-6`,children:t.every(e=>e.files.length===0)?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(K,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):t.map(e=>{if(e.files.length===0)return null;let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card p-6 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center mb-4 flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground`,children:e.repoName}),(0,$.jsxs)(J,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/40 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground`,title:e.repoPath,children:e.repoPath})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!_[n],i=!!x[n],a=y[n]||``,o=C[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-muted/20 transition-colors hover:border-foreground/15`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>D(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(Ke,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(nt,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px]`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),E(n),setTimeout(()=>E(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:T===n?(0,$.jsx)(K,{size:12,className:`text-success-foreground`}):(0,$.jsx)(Z,{size:12})})}),O(a)]})})]},t.file)})})]},e.repoName)})})]})},ti=({ws:e,knowledgeContent:t,knowledgeLoading:n,isEditingKnowledge:r,editedKnowledge:i,saveKnowledgeLoading:a,setEditedKnowledge:o,setIsEditingKnowledge:s,handleSaveKnowledge:c})=>{let[l,u]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 surface-card`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Ht,{size:16,className:`text-primary`}),` Persistent Knowledge Memory (nexusflow-knowledge.md)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&t&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(f,{size:`xs`,variant:l===`preview`?`secondary`:`ghost`,onClick:()=>u(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Je,{size:11}),` Preview`]}),(0,$.jsxs)(f,{size:`xs`,variant:l===`raw`?`secondary`:`ghost`,onClick:()=>u(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Cn,{size:11}),` Raw`]})]}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`outline`,size:`xs`,onClick:()=>{o(t),s(!1)},disabled:a,children:`Cancel`}),(0,$.jsxs)(f,{size:`xs`,onClick:()=>c(e.branchName),disabled:a,children:[a?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(jn,{size:10}),` Save`]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`xs`,onClick:()=>s(!0),disabled:n,children:[(0,$.jsx)(Mn,{size:10}),` Edit Knowledge`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(Rt,{className:`animate-spin text-primary`,size:20})}):r?(0,$.jsx)(bn,{className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:i,onChange:e=>o(e.target.value)}):t?l===`preview`?(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto rounded-md border border-border/70 bg-muted/20 p-4`,children:(0,$.jsx)(un,{content:t})}):(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border/70 bg-muted/30 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No knowledge file generated yet.`})]})},ni=({planContent:e,planLoading:t})=>{let[n,r]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 surface-card`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Tn,{size:16,className:`text-primary`}),` Inter-Repo Implementation Plan (nexusflow-plan.md)`]}),e&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(f,{size:`xs`,variant:n===`preview`?`secondary`:`ghost`,onClick:()=>r(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Je,{size:11}),` Preview`]}),(0,$.jsxs)(f,{size:`xs`,variant:n===`raw`?`secondary`:`ghost`,onClick:()=>r(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Cn,{size:11}),` Raw`]})]})]}),t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(Rt,{className:`animate-spin text-primary`,size:20})}):e?n===`preview`?(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto rounded-md border border-border/70 bg-muted/20 p-4`,children:(0,$.jsx)(un,{content:e})}):(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border/70 bg-muted/30 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No implementation plan generated yet.`})]})},ri={"git-pull-request":Qe,"flask-conical":et,package:Ye,database:Xe,"shield-check":$e,terminal:Y,zap:ft,cpu:it,layers:qe,boxes:At};function ii({ws:e,showToast:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(!1),{data:m=[],isLoading:h}=Et(),{data:g=[],isLoading:_}=Yt(e.branchName),{data:v=[],isLoading:y}=$t(),{data:b,isLoading:x,isError:S}=rn(e.branchName),C=It(),w=Mt(),T=(0,Q.useMemo)(()=>new Set(o??b?.enabledSkills??[]),[o,b?.enabledSkills]),E=(0,Q.useMemo)(()=>new Set(l??b?.enabledAgents??[]),[l,b?.enabledAgents]);(0,Q.useEffect)(()=>{b&&(s([...b.enabledSkills??[]]),u([...b.enabledAgents??[]]))},[b]);let D=(0,Q.useMemo)(()=>{if(!b||o===null||l===null)return!1;let e=new Set(b.enabledSkills??[]),t=new Set(b.enabledAgents??[]);return!!(o.length!==e.size||o.some(t=>!e.has(t))||l.length!==t.size||l.some(e=>!t.has(e)))},[b,o,l]),O=e=>{a(t=>({...t,[e]:!t[e]}))},k=e=>{if(o===null)return;let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(Array.from(t))},A=e=>{if(l===null)return;let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(Array.from(t))},j=(e,t,n)=>{if(o===null)return;let r=new Set(o);for(let e of n)t?r.add(e.id):r.delete(e.id);s(Array.from(r))},M=async()=>{if(!(!b||o===null||l===null)){p(!0);try{await C.mutateAsync({workspaceId:e.branchName,expectedRevision:b.revision??0,enabledSkills:o,enabledAgents:l,enabledCategories:m.map(e=>e.id)}),await w.mutateAsync({workspaceId:e.branchName}),t?.(`Skills & agents deployed successfully to workspace context!`,`success`)}catch(e){t?.(e instanceof Error?e.message:`Failed to deploy skills`,`error`)}finally{p(!1)}}},N=(0,Q.useMemo)(()=>{if(!n.trim())return g;let e=n.toLowerCase();return g.filter(t=>t.title?.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags?.some(t=>t.toLowerCase().includes(e)))},[g,n]),P=(0,Q.useMemo)(()=>{if(!n.trim())return v;let e=n.toLowerCase();return v.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[v,n]),F=(0,Q.useMemo)(()=>{let e={};for(let t of m)e[t.id]=N.filter(e=>e.category===t.id);return e},[m,N]);return h||_||y||x?(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(q,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]}):S?(0,$.jsx)(yn,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(vn,{children:[(0,$.jsx)(hn,{children:`Could not load workspace skills config`}),(0,$.jsx)(_n,{children:`Unable to read .nexusflow/skills.json for this workspace.`})]})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(mn,{className:`p-4 bg-card/70 flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,$.jsx)(At,{className:`h-5 w-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-bold text-foreground`,children:`Workspace Skills & Agents`}),(0,$.jsxs)(pn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[T.size,` Skills Active`]}),E.size>0&&(0,$.jsxs)(pn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[E.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Choose which reusable Agent Skills and Codex Agents to deploy into this workspace.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,onClick:M,disabled:d||!D&&T.size===0&&E.size===0,className:`flex items-center gap-1.5 shadow-sm`,children:[d?(0,$.jsx)(q,{className:`size-3.5`}):(0,$.jsx)(Ft,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:d?`Deploying…`:D?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(f,{render:(0,$.jsx)(at,{to:`/skills`}),variant:`outline`,size:`sm`,className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Bt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Resource Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ot,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(ke,{value:n,onChange:e=>r(e.target.value),placeholder:`Filter skills & agents by keyword...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),n&&(0,$.jsx)(`button`,{onClick:()=>r(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(st,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[m.map(e=>{let t=ri[e.icon||`boxes`]||At,r=F[e.id]||[];if(n&&r.length===0)return null;let a=!!i[e.id],o=r.length>0&&r.every(e=>T.has(e.id));return(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!a,onClick:()=>O(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),O(e.id))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md text-white shadow-xs flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,$.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(pn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[r.filter(e=>T.has(e.id)).length,`/`,r.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[r.length>0&&(0,$.jsxs)(f,{variant:`ghost`,size:`xs`,onClick:()=>j(e.id,!o,r),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[o?(0,$.jsx)(Ze,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(tt,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:o?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a?(0,$.jsx)(nt,{className:`h-4 w-4`}):(0,$.jsx)(Ke,{className:`h-4 w-4`})})]})]}),!a&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:r.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground py-2 text-center`,children:`No skills in this category.`}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:r.map(e=>{let t=T.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>k(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),k(e.id))},className:c(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-primary/60 bg-primary/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(K,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsx)(pn,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.custom?`Custom`:`Template`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`}),e.tags&&e.tags.length>0&&(0,$.jsx)(`div`,{className:`mt-2 pl-6 flex items-center gap-1 flex-wrap`,children:e.tags.slice(0,3).map(e=>(0,$.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground bg-muted/60 px-1 py-0.2 rounded`,children:[`#`,e]},e))})]},e.id)})})})]},e.id)}),P.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsx)(`div`,{className:`p-3 flex items-center justify-between border-b border-border/40 select-none`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-purple-600 text-white shadow-xs flex items-center justify-center`,children:(0,$.jsx)(Ge,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Codex Native Agents`}),(0,$.jsxs)(pn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[P.filter(e=>E.has(e.id)).length,`/`,P.length,` active`]})]})})]})}),(0,$.jsx)(`div`,{className:`p-3 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:P.map(e=>{let t=E.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>A(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),A(e.id))},className:c(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-purple-600 bg-purple-600 text-white`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(K,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(pn,{variant:`secondary`,className:`text-[9px] px-1 py-0 shrink-0`,children:`.codex/agents`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`})]},e.id)})})})]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.nexusflow/skills.json`}),` and materialize files into `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.agents/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.claude/skills/`}),`, and `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.codex/agents/`}),`.`]})]})}var ai=(e,t)=>{let n=`${e} ${t}`.toLowerCase();return n.includes(`insiders`)?(0,$.jsx)(xn,{size:15,className:`text-[#24C05A] shrink-0`}):n.includes(`code`)||n.includes(`vscode`)?(0,$.jsx)(Sn,{size:15,className:`text-[#007ACC] shrink-0`}):n.includes(`antigravity`)?(0,$.jsx)(ln,{className:`size-3.5 shrink-0`}):n.includes(`cursor`)?(0,$.jsx)(Ft,{size:14,className:`text-purple-400 shrink-0`}):n.includes(`powershell`)||n.includes(`pwsh`)?(0,$.jsx)(Y,{size:14,className:`text-sky-400 shrink-0`}):n.includes(`cmd`)||n.includes(`command prompt`)?(0,$.jsx)(Y,{size:14,className:`text-amber-400 shrink-0`}):(0,$.jsx)(rt,{size:14,className:`shrink-0`})},oi=[{value:`overview`,label:`Overview`},{value:`changes`,label:`Changes`},{value:`services`,label:`Services`},{value:`sessions`,label:`Sessions`},{value:`knowledge`,label:`Knowledge`},{value:`plan`,label:`Plan`},{value:`skills`,label:`Skills`}];function si(e){let{workspaces:t,workspaceStatuses:n,selectedId:r,subTab:i,onSelectTab:a,handleCopyPrompt:o,handleDeleteWorkspace:s,deleteWsLoading:l,repos:u,addRepoLoading:d,handleAddRepo:p,showToast:m,sessionProps:h,changesProps:g,knowledgeProps:_,planProps:v}=e,y=t.find(e=>e.branchName===r)??null,b=y?.mode??`worktree`,x=Kt(y?.branchName??null).data?.services??[],S=rn(y?.branchName??null).data,{data:C=[],isLoading:w}=Yt(y?.branchName),T=C.filter(e=>S?.enabledSkills?.includes(e.id)),E=y?y.repos.map(e=>{let t=nn(e),n=g.gitChanges?.find(e=>e.repoName===t),r=n?n.files?.length??0:null,i=x.filter(e=>(e.cwd??``).split(/[\\/]/).includes(t));return{name:t,changedCount:r,ports:Array.from(new Set(i.map(e=>e.port).filter(e=>typeof e==`number`))),serviceCount:i.length}}):[],D=y?u.filter(e=>!y.repos.includes(e.path)):[],O=sn(),[k,A]=(0,Q.useState)(null),j=O.data?.filter(e=>e.kind===`editor`&&e.available)??[],M=j.find(e=>e.id===`vscode-insiders`)||j.find(e=>e.id===`vscode`)||j[0],N=async e=>{if(!(k||!y)){A(e);try{await qt(`/api/workspace/${encodeURIComponent(y.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:e})}),m?.(`Opened workspace in ${e}.`,`success`)}catch(t){m?.(`Failed to open ${e}: ${t instanceof Error?t.message:String(t)}`,`error`)}finally{A(null)}}};return(0,$.jsx)(`div`,{className:`flex flex-col h-full animate-fade-in w-full min-w-0 bg-background`,children:y?(0,$.jsx)(`div`,{className:`flex-1 min-w-0 h-full overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col`,children:(()=>{if(!y)return null;let e=n[y.branchName],t=b===`in-place`?null:e?on(e.syncStatus):null;return(0,$.jsxs)(`div`,{className:`flex flex-col min-w-0 pb-8`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/80 bg-card/40 px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate font-mono text-base sm:text-lg font-bold text-foreground tracking-tight`,title:y.branchName,children:y.branchName}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{await cn(y.branchName)&&m?.(`Copied branch name to clipboard.`,`success`)},className:`text-muted-foreground hover:text-foreground transition-colors p-0.5 cursor-pointer`,title:`Copy branch name`,children:(0,$.jsx)(Z,{size:13})}),(0,$.jsx)(`span`,{className:`inline-flex items-center rounded border border-border/80 bg-muted/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground uppercase tracking-wider`,children:b===`in-place`?`In-place`:`Worktree`})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2.5 font-mono text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[y.repos.length,` `,y.repos.length===1?`repo`:`repos`]}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[`Created `,new Date(y.createdAt).toLocaleDateString()]}),e&&e.changedFiles>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-amber-400 font-semibold`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-400`}),e.changedFiles,` modified`]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-400`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}),`Clean`]})]}),e&&e.runningServices>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-400`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400 animate-pulse`}),e.runningServices,` active`]})]}),t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,$.jsx)(Rt,{size:10}),` `,t.label]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[M&&(j.length>1?(0,$.jsxs)(`div`,{className:`inline-flex h-8 items-center rounded-md border border-border bg-card shadow-xs`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!!k,onClick:()=>void N(M.id),title:`Open workspace in ${M.name}`,className:`inline-flex h-full items-center gap-1.5 px-3 text-xs font-semibold text-foreground hover:bg-accent transition-colors cursor-pointer rounded-l-md`,children:[k===M.id?(0,$.jsx)(q,{className:`size-3.5`}):ai(M.id,M.name),(0,$.jsx)(`span`,{children:M.name})]}),(0,$.jsxs)(en,{children:[(0,$.jsx)(Xt,{className:`inline-flex h-full w-6 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent border-l border-border transition-colors cursor-pointer rounded-r-md`,children:(0,$.jsx)(Ke,{size:12})}),(0,$.jsxs)(Jt,{align:`end`,className:`w-52`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Open Workspace In`}),j.map(e=>(0,$.jsxs)(X,{onClick:()=>void N(e.id),className:c(`flex items-center justify-between text-xs`,e.id===M.id&&`font-semibold text-primary`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[ai(e.id,e.name),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.id===M.id&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:`(default)`})]},e.id))]})]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:!!k,onClick:()=>void N(M.id),title:`Open workspace in ${M.name}`,className:`font-medium`,children:[k===M.id?(0,$.jsx)(q,{className:`size-3.5`}):ai(M.id,M.name),(0,$.jsx)(`span`,{children:M.name})]})),(0,$.jsxs)(en,{children:[(0,$.jsx)(Xt,{className:`grid size-8 place-items-center rounded-md border border-border bg-card text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer`,children:(0,$.jsx)(wn,{size:14})}),(0,$.jsxs)(Jt,{align:`end`,className:`w-48`,children:[(0,$.jsxs)(X,{onClick:()=>o(y),className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(Z,{size:13}),` `,(0,$.jsx)(`span`,{children:`Copy AI Context`})]}),(0,$.jsxs)(X,{onClick:()=>void s(y.branchName),disabled:l===y.branchName,className:`flex items-center gap-2 text-xs text-destructive hover:bg-destructive/10`,children:[(0,$.jsx)(dt,{size:13}),(0,$.jsx)(`span`,{children:l===y.branchName?`Deleting…`:`Delete Workspace`})]})]})]})]})]})}),(0,$.jsx)(`div`,{className:`px-5 pt-3`,children:(0,$.jsxs)(vr,{value:i,onValueChange:e=>typeof e==`string`&&a(y.branchName,e),className:`mb-4`,children:[(0,$.jsx)(yr,{className:`max-w-full overflow-x-auto`,children:oi.map(e=>(0,$.jsx)(br,{value:e.value,children:e.value===`sessions`?`AI & Sessions`:e.label},e.value))}),(0,$.jsxs)(xr,{value:i,className:`animate-fade-in pt-3`,children:[i===`overview`&&(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsxs)(mn,{className:`divide-y divide-border overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between bg-muted/20`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-border bg-card text-foreground shadow-xs`,children:y.assistants[0]===`claude`?(0,$.jsx)(fn,{className:`size-4 text-[#D97757]`}):y.assistants[0]===`codex`?(0,$.jsx)(Lt,{className:`size-4 text-foreground`}):y.assistants[0]===`copilot`?(0,$.jsx)(dn,{className:`size-4 text-blue-400`}):(0,$.jsx)(ln,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs sm:text-sm font-semibold text-foreground capitalize`,children:y.assistants[0]||`Antigravity`}),(0,$.jsx)(J,{tone:`running`,children:`Configured AI`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Workspace rules, prompt templates, and skills ready.`})]})]}),(0,$.jsx)(f,{size:`sm`,variant:`default`,onClick:()=>a(y.branchName,`sessions`),children:`AI Sessions & Harnesses →`})]}),y.description&&(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5`,children:`Description`}),(0,$.jsx)(`div`,{className:`text-xs sm:text-sm leading-relaxed text-foreground/90`,children:(0,$.jsx)(un,{content:y.description})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,$.jsxs)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Mapped Repositories (`,y.repos.length,`)`]}),D.length>0&&(0,$.jsx)(Jr,{repos:D,disabled:d,onAdd:e=>{window.confirm(`Add repository "${nn(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&p(y.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60`,children:E.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between py-2.5 first:pt-0 last:pb-0 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 font-mono min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`size-2 rounded-full shrink-0`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-warning`:`bg-success`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`${e.changedCount} uncommitted changes`:`Clean`}),(0,$.jsx)(`span`,{className:`truncate font-semibold text-foreground`,children:e.name})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground font-mono shrink-0`,children:[e.ports.map(e=>(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/80 px-1.5 py-0.5 text-[11px] text-running-foreground`,children:[`:`,e]},e)),(0,$.jsx)(`span`,{children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} changed`:`clean`})]})]},e.name))})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Active Skills & Capabilities`}),(0,$.jsxs)(`span`,{className:c(`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium font-mono border`,T.length>0?`border-primary/20 bg-primary/10 text-primary`:`border-border/70 bg-muted/60 text-muted-foreground`),children:[T.length,` active`]})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>a(y.branchName,`skills`),className:`text-xs gap-1.5`,children:[(0,$.jsx)(kn,{size:12}),(0,$.jsx)(`span`,{children:`Manage Skills`})]})]}),w?(0,$.jsx)(`div`,{className:`h-10 rounded bg-muted/40 animate-pulse`}):T.length===0?(0,$.jsxs)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 px-3 py-3 sm:flex sm:items-center sm:justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`No active skills configured`}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:`Attach PR review toolkits, linters, or test runners to enhance AI assistant context in this workspace.`})]}),(0,$.jsx)(f,{size:`xs`,variant:`ghost`,onClick:()=>a(y.branchName,`skills`),className:`shrink-0 text-primary hover:text-primary mt-2 sm:mt-0 font-medium`,children:`Configure Skills →`})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:T.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between p-2.5 rounded-md border border-border/80 bg-card/60 hover:bg-card transition-colors shadow-2xs gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-5 place-items-center rounded bg-primary/10 text-primary shrink-0`,children:(0,$.jsx)(kn,{size:11})}),(0,$.jsx)(`span`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title||e.name,children:e.title||e.name})]}),(0,$.jsx)(`span`,{className:c(`text-[10px] font-mono uppercase px-1 py-0.5 rounded border shrink-0`,e.custom?`border-purple-500/20 bg-purple-500/10 text-purple-400`:`border-border/70 bg-muted text-muted-foreground`),children:e.custom?`Custom`:`Template`})]}),e.description&&(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed`,children:e.description})]},e.id))})]})]})}),i===`sessions`&&(0,$.jsx)(Qr,{ws:y,showToast:m,...h}),i===`services`&&(0,$.jsx)($r,{ws:y}),i===`changes`&&(0,$.jsx)(ei,{ws:y,...g}),i===`knowledge`&&(0,$.jsx)(ti,{ws:y,..._}),i===`plan`&&(0,$.jsx)(ni,{...v}),i===`skills`&&(0,$.jsx)(ii,{ws:y,showToast:m})]})]})})]})})()})}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(yn,{children:(0,$.jsxs)(vn,{children:[(0,$.jsx)(gn,{variant:`icon`,children:(0,$.jsx)(Nt,{})}),(0,$.jsx)(hn,{children:`No workspace selected`}),(0,$.jsx)(_n,{children:`Select a workspace from the sidebar to inspect git changes, services, context, or launch AI assistants.`})]})})})})})}export{si as WorkspacesPage};
|