import{e as k,j as o,q as L,f as T,r as $,B as M,t as N}from"./index-DjCrtoJM.js";import{s as q}from"./Plus-DrYyBDmj.js";import{i as S}from"./Zap-DAhQN3Qe.js";import{S as D}from"./search-input-BOFnCDgB.js";import{P as l}from"./index-D7vPwljU.js";import{E as b}from"./empty-state-ZcLmoTrQ.js";import{c as O}from"./use-automations-CsEWrXaA.js";import{k as V}from"./use-navigate-to-agent-Cyv38GW6.js";import{A as F}from"./automation-list-row-DeSlvYhB.js";import{h as G}from"./use-mcp-client-Wf5qUXFF.js";import{a as H}from"./use-virtual-mcp-3Wk6GVmY.js";import{R as J}from"./require-capability-XeIce_Pd.js";import"./SearchMd-Dq0euRWv.js";import"./sidebar-D0YkKw2Q.js";import"./LayoutLeft-DOdRMzln.js";import"./tooltip-MvXJgTec.js";import"./sheet-BwcUAu7J.js";import"./X-BUrHvnq3.js";import"./alert-dialog-CstddcEP.js";import"./dropdown-menu-D2S2HMhI.js";import"./Check-CkY-NLLZ.js";import"./ChevronRight-BJRYs8bt.js";import"./DotsVertical-BwZzHCbU.js";import"./agent-icon-DbC1U9Lv.js";import"./AlertCircle-CNjNg2wb.js";import"./Tool01-Nn7pl58k.js";import"./SwitchHorizontal01-BjyN-RbX.js";import"./RefreshCcw01-eSV0Gr10.js";import"./XCircle-Bz32In76.js";import"./ArrowUpRight-7-SM74wR.js";import"./ZapSquare-DdYqdyu4.js";import"./Users03-Dc2Q2YCx.js";import"./CheckCircle-DYKqL__C.js";import"./ChevronDown-B8XrNXeE.js";import"./ChevronLeft-B6gErU0k.js";import"./ChevronUp-CgxnjYlU.js";import"./Container-Dt-ev6Gi.js";import"./Eye-Co-ItdFE.js";import"./ZoomOut-BP5vTMyD.js";import"./Globe01-BnLBFtky.js";import"./FilterLines-DwPmuK2v.js";import"./Star01-ChWAyIjY.js";import"./Palette-Cu3PTFf5.js";import"./HardDrive-DmPQQU2w.js";import"./Stars02-WR3K9Daq.js";import"./Key01-BuFH2ztD.js";import"./LinkExternal01-ZepkFy5p.js";import"./Monitor01-5IIvvy6H.js";import"./Sun-BIJajZBA.js";import"./Play-4vubxqND.js";import"./Settings02-B_z2JeIq.js";import"./Shield01-Dmf7TklI.js";import"./Stars01-DbI-YGmK.js";import"./Trash01-BW2v6vxa.js";import"./Upload01-CyW8Wv9e.js";import"./User01-BBVMvdD1.js";import"./Users01-3QXDJ7kM.js";import"./XClose-D4SdKRIc.js";import"./use-collections-BTo2RzuF.js";import"./use-capability-COL6vTbP.js";import"./access-gate-CGZv0aLQ.js";import"./capability-load-error-B_GRCsfG.js";function K(){const t=k.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,B=H(),R=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(B.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const m=y.get(e.virtual_mcp_id);if(m&&m.title.toLowerCase().includes(g))return!0}return!1}),P=(e,m)=>{const A=m&&y.has(m)?m:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),R(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let a;t[10]!==h.Content||t[11]!==s?(a=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=a):a=t[12];let c;return t[13]!==x||t[14]!==a?(c=o.jsx(x,{children:a}),t[13]=x,t[14]=a,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function eo(){const t=k.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{eo as default};
