// @bun
import{Button as P}from"@contractspec/lib.design-system";import{PlugZap as L,ToggleRight as k}from"lucide-react";import{jsx as r,jsxs as l}from"react/jsx-runtime";function y({id:p,provider:v,name:w,category:f,enabled:o=!0,lastSyncAt:a,status:b="connected",onToggle:c,onConfigure:u}){return l("div",{className:"flex flex-col gap-4 rounded-2xl border border-border bg-card p-4 shadow-sm",children:[l("header",{className:"flex items-center justify-between",children:[l("div",{children:[r("p",{className:"font-semibold text-xl",children:w}),r("p",{className:"text-muted-foreground text-sm",children:v})]}),l(P,{variant:"outline",size:"sm",className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 font-semibold text-xs uppercase tracking-wide ${b==="connected"?"text-emerald-500 bg-emerald-500/10 border-emerald-500/30":b==="error"?"text-red-500 bg-red-500/10 border-red-500/30":"text-gray-500 bg-gray-500/10 border-gray-500/30"}`,onPress:()=>c?.(p,!o),children:[r(k,{className:"h-3.5 w-3.5"}),o?"Enabled":"Disabled"]})]}),l("div",{className:"text-muted-foreground text-sm",children:[f&&r("span",{className:"font-medium",children:f}),l("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-xs uppercase tracking-wide",children:[l("span",{className:"inline-flex items-center gap-1",children:[r(L,{className:"h-3 w-3"}),b]}),l("span",{children:["Last sync:"," ",a?new Date(a).toLocaleString():"Not synced yet"]})]})]}),l("footer",{className:"flex items-center gap-2",children:[r(P,{className:"flex-1",onPress:()=>u?.(p),children:"Configure"}),r(P,{variant:"ghost",className:"flex-1",onPress:()=>c?.(p,!o),children:o?"Disconnect":"Connect"})]})]})}import{Input as z}from"@contractspec/lib.design-system";import{Select as E,SelectContent as R,SelectItem as B,SelectTrigger as Z,SelectValue as $}from"@contractspec/lib.ui-kit-web/ui/select";import{Boxes as n,Search as q}from"lucide-react";import*as N from"react";import{jsx as e,jsxs as m}from"react/jsx-runtime";function Q({integrations:p,onToggle:v,onConfigure:w}){let[f,o]=N.useState(""),[a,b]=N.useState("all"),c=N.useMemo(()=>Array.from(new Set(p.map((d)=>d.category))),[p]),u=p.filter((d)=>{let D=d.name.toLowerCase().includes(f.toLowerCase())||d.provider.toLowerCase().includes(f.toLowerCase()),s=a==="all"?!0:d.category===a;return D&&s});return m("div",{className:"space-y-4 rounded-2xl border border-border bg-card p-4",children:[m("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[m("div",{children:[e("p",{className:"font-semibold text-sm uppercase tracking-wide",children:"Integration marketplace"}),e("p",{className:"text-muted-foreground text-sm",children:"Connect AI providers, payments, analytics, and internal tools with BYOK controls."})]}),e(n,{className:"h-5 w-5 text-muted-foreground"})]}),m("div",{className:"flex flex-wrap gap-3",children:[m("div",{className:"relative min-w-[200px] flex-1",children:[e(q,{className:"pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e(z,{type:"search","aria-label":"Search providers",className:"w-full py-2 pr-3 pl-9 text-sm",value:f,onChange:(d)=>o(d.target.value),placeholder:"Search providers"})]}),m(E,{value:a,onValueChange:b,children:[e(Z,{className:"w-[200px]",children:e($,{placeholder:"All categories"})}),m(R,{children:[e(B,{value:"all",children:"All categories"}),c.map((d)=>e(B,{value:d,children:d},d))]})]})]}),e("div",{className:"grid gap-4 md:grid-cols-2",children:u.length?u.map((d)=>e(y,{id:d.id,provider:d.provider,name:d.name,category:d.category,enabled:d.enabled,status:d.status,lastSyncAt:d.lastSyncAt,onToggle:v,onConfigure:w},d.id)):e("div",{className:"rounded-xl border border-border border-dashed p-6 text-center text-muted-foreground text-sm md:col-span-2",children:"No integrations match your filters."})})]})}export{Q as IntegrationMarketplace};
