1import{b as c,o as v,K as g,a as x,t as p,j as e,bG as b,ac as y,L as w,h as f,aA as C}from"./index-BNSlZW3b.js";import"./branding-provider-DePoo6JG.js";import"./domain-branding-provider-MkpWjPqk.js";import"./secondary-nav-store-BF5t__Jl.js";import{P as I,b as P}from"./page-header-DYIHlZ-n.js";import{B as L}from"./badge-B8Onwl7T.js";import{I as S}from"./integration-icons-BNXeYXwh.js";import{P as h}from"./plug-CSDvEUIM.js";import{E as z}from"./external-link-CLc1Gtl2.js";import"./arrow-left-C9Dss__s.js";import"./shopping-cart-BwzeOTB4.js";import"./globe-DJI1Lwd1.js";import"./credit-card-D2GgnEyx.js";function k(){const[t,n]=c.useState(""),a=v(),o=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,l=o.get("success"),d=o.get("error");c.useEffect(()=>{l&&(g.success(`${l} connected successfully!`),a({to:"/settings/integrations",replace:!0})),d&&(g.error(`Failed to connect ${d}. Please try again.`),a({to:"/settings/integrations",replace:!0}))},[l,d,a]);const{data:i,isLoading:j}=x(p.workflow.listAvailableIntegrations.queryOptions()),{data:m}=x(p.workflow.listIntegrationConnections.queryOptions({integrationType:"__all__"})),N=c.useMemo(()=>{const s={};if(m)for(const r of m)s[r.integrationType]=(s[r.integrationType]??0)+1;return s},[m]),u=c.useMemo(()=>{if(!i)return[];if(!t)return i;const s=t.toLowerCase();return i.filter(r=>r.name.toLowerCase().includes(s)||r.description.toLowerCase().includes(s))},[i,t]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(I,{title:"Integrations"}),e.jsx(P,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(b,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(y,{placeholder:"Search integrations...",value:t,onChange:s=>n(s.target.value),className:"pl-9"})]}),j?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3].map(s=>e.jsx("div",{className:"h-32 bg-muted animate-pulse rounded-lg"},s))}):u.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(h,{className:"size-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{className:"text-sm",children:t?"No integrations found":"No integrations available"})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:u.map(s=>e.jsx(E,{integration:s,connectionCount:N[s.slug]??0},s.slug))})]})})]})}function E({integration:t,connectionCount:n}){const a=n>0,o=S[t.icon]??h;return e.jsxs(w,{to:"/settings/integrations/$slug",params:{slug:t.slug},className:f("group relative flex flex-col gap-3 rounded-lg border p-4","transition-all hover:border-foreground
1/20 hover:shadow-sm",a&&"border-green-500/30 bg-green-500/5"),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:f("flex size-10 items-center justify-center rounded-lg border bg-background",a&&"border-green-500/30"),children:e.jsx(o,{className:"size-5 text-foreground"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:t.authType.replace("_"," ")})]})]}),a&&e.jsxs(L,{variant:"secondary",className:"text-green-600 bg-green-500/10",children:[e.jsx(C,{className:"size-3"}),n," connected"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),e.jsx("div",{className:"flex items-center justify-between mt-auto pt-1",children:e.jsxs("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:[a?"Manage":"Connect",e.jsx(z,{className:"inline size-3 ml-1"})]})})]})}const K=k;export{K as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.