import{u as v,g as $,w as _,r as N,j as e,c as L}from"./index-DkVMZPZp.js";import{e as R}from"./constants-Chp3RuVB.js";import{C as z}from"./collection-tab-B_8SPzV6.js";import{d as A,e as F}from"./use-connection-BNgYG_2P.js";import{B as k}from"./button-CWzK0IXA.js";import{E as H}from"./empty-state-yKA0Dnoy.js";import{P as w}from"./index-ssfNqXSw.js";import{B as M,a as O,b as T,e as V}from"./breadcrumb-B1KWdwh9.js";import{a as q,b as D}from"./use-binding-CDLcDLTQ.js";import{i as G}from"./Loading01-BpkkTLVp.js";import"./generate-id-Dyweu44Y.js";import"./collection-table-wrapper-DtjpsgWF.js";import"./dropdown-menu-D0wZWcOa.js";import"./ChevronRight-0gQ-Lwyj.js";import"./ArrowUp-NpHWyg3u.js";import"./Check-hF_kXZiK.js";import"./Grid01-DshI78vi.js";import"./List-B7BO0eBJ.js";import"./view-mode-toggle-Cz9APct2.js";import"./table-CWx1lOcJ.js";import"./collection-search-jBfTOehF.js";import"./SearchMd-SRsVDK9N.js";import"./input-BKM3goZw.js";import"./card-uLixd1BQ.js";import"./Copy01-BY9LQ_eS.js";import"./DotsVertical-CcQ5Tk1w.js";import"./Edit01-HUE0OI4J.js";import"./use-list-state-BfUltaaz.js";import"./alert-dialog-Cg14vDvh.js";import"./useQuery-BSKCoFrF.js";import"./use-mobile-BXQipnb5.js";import"./Trash01-BhWwFORM.js";import"./empty-state-DrSUCtH7.js";import"./Inbox01-DqHW7WgR.js";import"./constants-DUMQK_Jq.js";import"./Plus-8ovTaJHc.js";import"./layout-B7iU_InR.js";import"./useMutation-CFQDhqDA.js";import"./binder-_fA_QfCQ.js";function J({title:i,description:t,wellKnownMcp:o,imageSrc:n,onConnected:s}){const l=A(),{org:{slug:m}}=v(),{data:C}=$.useSession(),d=_(),[a,y]=N.useState(!1),r=async()=>{if(!(!o||!C?.user?.id)){y(!0);try{const c=await l.create.mutateAsync(o);s?.(c.id),d({to:"/$org/mcps/$connectionId",params:{org:m,connectionId:c.id}})}finally{y(!1)}}},j=()=>{d({to:"/$org/mcps",params:{org:m},search:{action:"create"}})};return e.jsx(H,{image:n?e.jsx("img",{src:n,alt:i,width:336,height:320,className:"max-w-full h-auto"}):null,title:i,description:t,actions:e.jsxs(e.Fragment,{children:[e.jsxs(k,{variant:"outline",onClick:r,disabled:a||!o,children:[o?.icon&&e.jsx("img",{src:o.icon,alt:"",className:"size-4"}),a?"Installing...":`Install ${o?.title||"MCP"}`]}),e.jsx(k,{variant:"outline",onClick:j,children:"Custom Connection"})]})})}function Q(i){const t=L.c(28),{bindingName:o,collectionName:n,title:s,emptyState:l,wellKnownMcp:m}=i,{org:C}=v(),d=F();let a;t[0]!==d||t[1]!==o?(a={connections:d,binding:o},t[0]=d,t[1]=o,t[2]=a):a=t[2];const r=q(a)[0],j=D(r);let c;if(t[3]!==n||t[4]!==j){let h;t[6]!==n?(h=W=>W.name.toLowerCase()===n.toLowerCase(),t[6]=n,t[7]=h):h=t[7],c=j.find(h),t[3]=n,t[4]=j,t[5]=c}else c=t[5];const b=c,[P,E]=N.useState(null),B=r&&b&&(r.id||P);let p;t[8]!==s?(p=e.jsx(w.Header,{children:e.jsx(w.Header.Left,{children:e.jsx(M,{children:e.jsx(O,{children:e.jsx(T,{children:e.jsx(V,{children:s})})})})})}),t[8]=s,t[9]=p):p=t[9];let S;t[10]===Symbol.for("react.memo_cache_sentinel")?(S=e.jsx(G,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t[10]=S):S=t[10];let u;t[11]!==s?(u=s.toLowerCase(),t[11]=s,t[12]=u):u=t[12];let f;t[13]!==u?(f=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[S,e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Loading ",u,"..."]})]}),t[13]=u,t[14]=f):f=t[14];let g;t[15]!==b||t[16]!==r||t[17]!==l||t[18]!==C||t[19]!==B||t[20]!==m?(g=B?e.jsx(z,{connectionId:r.id,org:C.slug,activeCollection:b}):e.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:e.jsx(J,{title:l.title,description:l.description,wellKnownMcp:m,imageSrc:l.imageSrc,onConnected:h=>{E(h)}})}),t[15]=b,t[16]=r,t[17]=l,t[18]=C,t[19]=B,t[20]=m,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==g?(x=e.jsx(w.Content,{children:e.jsx(N.Suspense,{fallback:f,children:g})}),t[22]=f,t[23]=g,t[24]=x):x=t[24];let I;return t[25]!==p||t[26]!==x?(I=e.jsxs(w,{children:[p,x]}),t[25]=p,t[26]=x,t[27]=I):I=t[27],I}function _t(){const i=L.c(1);let t;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=e.jsx(Q,{bindingName:"WORKFLOW",collectionName:"workflow",title:"Workflows",emptyState:{title:"Create Workflows",description:"Install MCP Studio to create and manage automated workflows with multiple steps and integrations."},wellKnownMcp:R()}),i[0]=t):t=i[0],t}export{_t as default};
