import{u as k,e as L,f as P,r as v,j as e,c as B}from"./index-DJrCN3i2.js";import{b as _}from"./constants-CQBwKZNg.js";import{C as R}from"./collection-tab-D0RO0CcF.js";import{a as z,b as A}from"./use-connection-DXi2YQyF.js";import{B as y}from"./button-CvJoPChh.js";import{E as F}from"./empty-state-Ct8nX8re.js";import{C as M}from"./collection-header-k71cK-lF.js";import{a as O,b as H}from"./use-binding-hMYM9l94.js";import{i as T}from"./Loading01-C7lL3UEX.js";import"./generate-id-Dyweu44Y.js";import"./collection-display-button-Ct4YNN53.js";import"./dropdown-menu-DJCZCaVG.js";import"./Grid01-Dib_0u4G.js";import"./ArrowUp-C_dzgGyM.js";import"./Check-rWpHI8gM.js";import"./List-BXWuxsJI.js";import"./tooltip-X0aARx7t.js";import"./view-mode-toggle-uP_0P-Q4.js";import"./collection-search-DRAHEgKw.js";import"./SearchMd--9TE30ud.js";import"./input-z3sZIpoP.js";import"./card-Bcqw3W4A.js";import"./Copy01-DoovYO7Z.js";import"./DotsVertical-ZFxA3aY_.js";import"./Edit01-BbH3QU1f.js";import"./use-list-state-CJ7Gqypi.js";import"./use-mobile-BFUJE28S.js";import"./Trash01-BML4V2Hg.js";import"./collection-table-wrapper-DXOj93c5.js";import"./empty-state-G8RiHLmX.js";import"./Inbox01-DKPhOTqf.js";import"./avatar-DHhEwgut.js";import"./useQuery-Cc2WyvHU.js";import"./pin-to-sidebar-button-SwV4uptA.js";import"./use-organization-settings-Cqvrqw7g.js";import"./useMutation-Bv8zH83E.js";import"./use-collections-DX9zmS5Y.js";import"./constants-CSeHBPkf.js";import"./alert-dialog-CmbyBQPM.js";import"./Plus-C_fl4PEA.js";import"./layout-CvmMcuAx.js";import"./ArrowLeft-B43nR51t.js";import"./binder-D1E-ZiIS.js";function V({title:i,description:t,wellKnownMcp:o,imageSrc:n,onConnected:s}){const r=z(),{org:{slug:m}}=k(),{data:h}=L.useSession(),p=P(),[a,w]=v.useState(!1),l=async()=>{if(!(!o||!h?.user?.id)){w(!0);try{const c=await r.create.mutateAsync(o);s?.(c.id),p({to:"/$org/mcps/$connectionId",params:{org:m,connectionId:c.id}})}finally{w(!1)}}},j=()=>{p({to:"/$org/mcps",params:{org:m},search:{action:"create"}})};return e.jsx(F,{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(y,{variant:"outline",onClick:l,disabled:a||!o,children:[o?.icon&&e.jsx("img",{src:o.icon,alt:"",className:"size-4"}),a?"Installing...":`Install ${o?.title||"MCP"}`]}),e.jsx(y,{variant:"outline",onClick:j,children:"Custom Connection"})]})})}function q(i){const t=B.c(28),{bindingName:o,collectionName:n,title:s,emptyState:r,wellKnownMcp:m}=i,{org:h}=k(),p=A();let a;t[0]!==p||t[1]!==o?(a={connections:p,binding:o},t[0]=p,t[1]=o,t[2]=a):a=t[2];const l=O(a)[0],j=H(l);let c;if(t[3]!==n||t[4]!==j){let C;t[6]!==n?(C=$=>$.name.toLowerCase()===n.toLowerCase(),t[6]=n,t[7]=C):C=t[7],c=j.find(C),t[3]=n,t[4]=j,t[5]=c}else c=t[5];const S=c,[E,W]=v.useState(null),N=l&&S&&(l.id||E);let d;t[8]!==s?(d=e.jsx(M,{title:s}),t[8]=s,t[9]=d):d=t[9];let b;t[10]===Symbol.for("react.memo_cache_sentinel")?(b=e.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t[10]=b):b=t[10];let f;t[11]!==s?(f=s.toLowerCase(),t[11]=s,t[12]=f):f=t[12];let u;t[13]!==f?(u=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[b,e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Loading ",f,"..."]})]}),t[13]=f,t[14]=u):u=t[14];let g;t[15]!==S||t[16]!==l||t[17]!==r||t[18]!==h||t[19]!==N||t[20]!==m?(g=N?e.jsx(R,{connectionId:l.id,org:h.slug,activeCollection:S}):e.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:e.jsx(V,{title:r.title,description:r.description,wellKnownMcp:m,imageSrc:r.imageSrc,onConnected:C=>{W(C)}})}),t[15]=S,t[16]=l,t[17]=r,t[18]=h,t[19]=N,t[20]=m,t[21]=g):g=t[21];let x;t[22]!==u||t[23]!==g?(x=e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(v.Suspense,{fallback:u,children:g})}),t[22]=u,t[23]=g,t[24]=x):x=t[24];let I;return t[25]!==d||t[26]!==x?(I=e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d,x]}),t[25]=d,t[26]=x,t[27]=I):I=t[27],I}function _t(){const i=B.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:_()}),i[0]=t):t=i[0],t}export{_t as default};
