import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./react-CClhXMB2.js";import{c as n,f as r,i}from"./uiIdentityOverlay-Ba7GNj7m.js";import{n as a,t as o}from"./button-DO50qOGv.js";import{t as s}from"./jsx-runtime-CyI9ICYU.js";import{A as c,P as l,R as u,V as d}from"./index-N9uRPknx.js";var f=r(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),p=e(t(),1),m=s(),h={root:i({id:`project.extensions.agents.area`,c3ComponentId:`c3-120`,c3ComponentLabel:`extensions`}),section:i({id:`project.extensions.agents.section`,c3ComponentId:`c3-120`,c3ComponentLabel:`extensions`}),sectionToggle:i({id:`project.extensions.agents.section-toggle.action`,c3ComponentId:`c3-120`,c3ComponentLabel:`extensions`})};function g(){return h}function _({id:e,label:t,content:r,expanded:i,onToggle:s}){return(0,m.jsxs)(`div`,{className:`border-b border-border last:border-b-0`,children:[(0,m.jsxs)(o,{type:`button`,variant:`none`,className:`flex h-auto w-full items-center justify-start gap-2 rounded-none px-3 py-2 text-left hover:bg-accent/30`,onClick:()=>s(e),...n(h.sectionToggle),children:[(0,m.jsx)(d,{className:a(`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200`,i&&`rotate-90`)}),(0,m.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:t})]}),i&&(0,m.jsx)(`div`,{className:`px-3 pb-3 pl-8`,children:(0,m.jsx)(`pre`,{className:`text-sm text-muted-foreground whitespace-pre-wrap break-words leading-relaxed`,children:r})})]})}function v({icon:e,title:t,children:r}){return(0,m.jsxs)(`div`,{className:`rounded-lg border border-border bg-card overflow-hidden`,...n(h.section),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 border-b border-border bg-muted/30`,children:[(0,m.jsx)(e,{className:`size-4 text-muted-foreground shrink-0`}),(0,m.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:t})]}),(0,m.jsx)(`div`,{children:r})]})}function y({localPath:e}){let[t,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(!0),[o,s]=(0,p.useState)(null),[d,g]=(0,p.useState)(new Set),y=(0,p.useCallback)(e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return(0,p.useEffect)(()=>{a(!0),s(null),r(null);let t=encodeURIComponent(e);Promise.all([fetch(`/api/ext/agents/claude-md?projectPath=${t}`).then(e=>{if(!e.ok)throw Error(`claude-md: ${e.status}`);return e.json()}),fetch(`/api/ext/agents/skills?projectPath=${t}`).then(e=>{if(!e.ok)throw Error(`skills: ${e.status}`);return e.json()}),fetch(`/api/ext/agents/agents-md?projectPath=${t}`).then(e=>{if(!e.ok)throw Error(`agents-md: ${e.status}`);return e.json()})]).then(([e,t,n])=>{r({claudeMd:e,skills:t,agentsMd:n})}).catch(e=>{s(e instanceof Error?e.message:String(e))}).finally(()=>{a(!1)})},[e]),i?(0,m.jsx)(`div`,{className:`flex items-center justify-center p-8`,...n(h.root),children:(0,m.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})}):o?(0,m.jsx)(`div`,{className:`p-4`,...n(h.root),children:(0,m.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Failed to load agent data: `,o]})}):t?(0,m.jsxs)(`div`,{className:`p-4 space-y-4 overflow-y-auto h-full`,...n(h.root),children:[(0,m.jsx)(v,{icon:u,title:`CLAUDE.md`,children:t.claudeMd.sections.length===0?(0,m.jsx)(`p`,{className:`px-3 py-3 text-sm text-muted-foreground italic`,children:`No CLAUDE.md found`}):t.claudeMd.sections.map((e,t)=>(0,m.jsx)(_,{id:`claude-${t}`,label:e.heading||`(preamble)`,content:e.content,expanded:d.has(`claude-${t}`),onToggle:y},`claude-${t}`))}),(0,m.jsx)(v,{icon:f,title:`Skills`,children:t.skills.skills.length===0?(0,m.jsx)(`p`,{className:`px-3 py-3 text-sm text-muted-foreground italic`,children:`No skills found`}):t.skills.skills.map((e,t)=>(0,m.jsx)(_,{id:`skill-${t}`,label:e.filename,content:e.content,expanded:d.has(`skill-${t}`),onToggle:y},`skill-${t}`))}),(0,m.jsx)(v,{icon:c,title:`Agents`,children:t.agentsMd.found?t.agentsMd.sections.length===0?(0,m.jsx)(`p`,{className:`px-3 py-3 text-sm text-muted-foreground italic`,children:`agents.md is empty`}):t.agentsMd.sections.map((e,t)=>(0,m.jsx)(_,{id:`agent-${t}`,label:e.heading||`(preamble)`,content:e.content,expanded:d.has(`agent-${t}`),onToggle:y},`agent-${t}`)):(0,m.jsx)(`p`,{className:`px-3 py-3 text-sm text-muted-foreground italic`,children:`No agents.md found`})})]}):null}export{y as default,g as getAgentsExtensionUiIdentityDescriptors};