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