import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,f as i,t as a,u as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Gs as l,Us as u}from"./paths-Ci1iwL5Y.js";import{b as d,x as f}from"./startupProfiler-CAntGAbs.js";import{l as p,o as m}from"./stringUtils-KZoO4GUd.js";import{DC as h,EC as g,Ym as _,ha as v,na as y,qm as b}from"./loadAgentsDir-C_wFhytF.js";function x(e,t){let n=t.trim();if(n===``)return e.slice();let r=n.toLowerCase().split(/\s+/);return e.filter(e=>{let t=`${e.name} ${e.description}`.toLowerCase();return r.every(e=>t.includes(e))})}var S=e((()=>{}));function C(e){return e===`plugin`?`plugin`:e===`mcp`?`mcp`:u(e)}function w({onExit:e,commands:t}){let[n,a]=(0,T.useState)(``),c=(0,T.useMemo)(()=>t.filter(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`commands_DEPRECATED`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)),[t]),l=(0,T.useMemo)(()=>x(c.map(e=>({...e,name:v(e),description:e.description??``})),n),[c,n]),u=(0,T.useMemo)(()=>{let e={policySettings:[],userSettings:[],projectSettings:[],localSettings:[],flagSettings:[],plugin:[],mcp:[]};for(let t of l){let n=t.source;n in e&&e[n].push(t)}for(let t of Object.values(e))t.sort((e,t)=>v(e).localeCompare(v(t)));return e},[l]),f=()=>{e(`Skills dialog dismissed`,{display:`system`})};if(c.length===0)return(0,E.jsxs)(i,{title:`Skills`,subtitle:`No skills found`,onCancel:f,hideInputGuide:!0,children:[(0,E.jsx)(r,{dimColor:!0,children:`Create skills in .claude/skills/ or ~/.claude/skills/`}),(0,E.jsx)(r,{dimColor:!0,italic:!0,children:(0,E.jsx)(g,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`close`})})]});let m=e=>{switch(e){case`projectSettings`:case`localSettings`:return{label:`local`,color:`yellow`};case`userSettings`:return{label:`global`,color:`cyan`};case`policySettings`:return{label:`managed`,color:`magenta`};default:return}},h=(e,t)=>{let n=`~${d(b(e))}`,i=e.source===`plugin`?e.pluginInfo?.pluginManifest.name:void 0,a=m(e.source);return(0,E.jsxs)(s,{children:[(0,E.jsx)(r,{color:t?`suggestion`:void 0,children:v(e)}),a&&(0,E.jsxs)(r,{color:a.color,children:[` [`,a.label,`]`]}),(0,E.jsxs)(r,{dimColor:!0,children:[i?` · ${i}`:``,` · `,C(e.source),` · `,n,` tokens`]})]})};return(0,E.jsx)(o,{title:`Skills`,placeholder:`Type to filter skills…`,items:(0,T.useMemo)(()=>D.flatMap(e=>u[e]),[u]),getKey:e=>`${e.name}-${e.source}`,visibleCount:12,direction:`down`,onQueryChange:a,onSelect:t=>{e(`/${v(t)}`,{display:`user`})},onCancel:f,emptyMessage:e=>e.trim()?`No skills matching "${e.trim()}"`:`No skills found`,matchLabel:n.trim()===``?`${c.length} ${p(c.length,`skill`)}`:`${l.length}/${c.length} ${p(c.length,`skill`)}`,selectAction:`invoke skill`,renderItem:(e,t)=>h(e,t)})}var T,E,D,O=e((()=>{n(),T=t(n(),1),y(),a(),_(),f(),l(),m(),h(),S(),E=c(),D=[`projectSettings`,`localSettings`,`userSettings`,`flagSettings`,`policySettings`,`plugin`,`mcp`]}));async function k(e,t){return(0,A.jsx)(w,{onExit:e,commands:t.options.commands})}var A;e((()=>{n(),O(),A=c()}))();export{k as call};