import{u as k,g as L,l as P,r as v,j as e,c as B}from"./index-DRfiwyin.js";import{d as _}from"./constants-Du17bl3K.js";import{C as R}from"./collection-tab-DW5J5Rcf.js";import{a as z,b as A}from"./use-connection-OBpvJNdN.js";import{B as y}from"./button-CeWJVmxi.js";import{E as F}from"./empty-state-Bela0y7T.js";import{C as M}from"./collection-header-BDNwcI63.js";import{a as O,b as H}from"./use-binding-CFkX7WWE.js";import{i as T}from"./Loading01-CBit2OkB.js";import"./generate-id-Dyweu44Y.js";import"./collection-display-button-ORK43lCu.js";import"./dropdown-menu-Bgaw3jHI.js";import"./Grid01-_pZ0S8Aw.js";import"./ArrowUp-Xjgpd-4O.js";import"./Check-BIIQB2ND.js";import"./List-woAiKaoC.js";import"./tooltip-b9KrGUQh.js";import"./view-mode-toggle-DXwbKZcL.js";import"./collection-search-DQW4Qa5C.js";import"./SearchMd-CWl7F5--.js";import"./input-C0eVsZrm.js";import"./card-tqt6y22p.js";import"./Copy01-C6ITopn8.js";import"./DotsVertical-LfgiwwDj.js";import"./Edit01-D6aeYdbq.js";import"./use-list-state-DgPvNuS6.js";import"./use-mobile-RBfpNDKE.js";import"./Trash01-LSa5KJ2F.js";import"./collection-table-wrapper-Ca2ezslr.js";import"./empty-state-C0R1ToKF.js";import"./Inbox01-DkGOALG_.js";import"./avatar-wH2f-Qw0.js";import"./useQuery-D7d4NSI6.js";import"./pin-to-sidebar-button-Cw2UVVqF.js";import"./Pin01-D4jz86CA.js";import"./use-organization-settings-CdyBZZsk.js";import"./useMutation-7RHZ_A0u.js";import"./use-collections-Bp1ohxBF.js";import"./constants-rgG8x45G.js";import"./alert-dialog-BDsz2_Qt.js";import"./Plus-DOnRVZBz.js";import"./layout-_kEtsrFb.js";import"./ArrowLeft-D16Hv3DC.js";import"./binder-L7_kPjYG.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 I;t[10]===Symbol.for("react.memo_cache_sentinel")?(I=e.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t[10]=I):I=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:[I,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 b;return t[25]!==d||t[26]!==x?(b=e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d,x]}),t[25]=d,t[26]=x,t[27]=b):b=t[27],b}function Rt(){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{Rt as default};
