decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
2 lines (1 loc) • 5.68 kB
JavaScript
import{c as ie,r as U,m as ce,j as t}from"./index-ztdGKvBm.js";import{B as le}from"./badge-DcUertOZ.js";import{C as ne}from"./checkbox-QUuOza1H.js";import{t as ae}from"./ChevronDown-XsLJSrfl.js";import{a as de,C as me,b as oe,c as ue,e as fe,f as he}from"./command-C3tlrKUq.js";import{a as xe,b as pe,P as ge}from"./popover-C4oz5B-L.js";const ve=[];function Ve(r){const e=ie.c(68),{options:a,onValueChange:o,defaultValue:W,placeholder:X,animation:Z,maxCount:ee,modalPopover:te,className:M,disabled:se,onSearchChange:S}=r,d=W===void 0?ve:W,$=X===void 0?"Select items":X,P=Z===void 0?0:Z,k=ee===void 0?3:ee,J=te===void 0?!1:te,Y=se===void 0?!1:se,[s,y]=U.useState(d),[F,_]=U.useState(!1);let V,E;e[0]!==d||e[1]!==s?(V=()=>{JSON.stringify(s)!==JSON.stringify(d)&&y(d)},E=[d,s],e[0]=d,e[1]=s,e[2]=V,e[3]=E):(V=e[2],E=e[3]),U.useEffect(V,E);let O;e[4]!==o||e[5]!==s?(O=l=>{if(l.key==="Enter")_(!0);else if(l.key==="Backspace"&&!l.currentTarget.value){const n=[...s];n.pop(),y(n),o(n)}},e[4]=o,e[5]=s,e[6]=O):O=e[6];const G=O;let D;e[7]!==o||e[8]!==s?(D=l=>{const n=s.includes(l.value)?s.filter(w=>w!==l.value):[...s,l.value];y(n),o(n)},e[7]=o,e[8]=s,e[9]=D):D=e[9];const c=D;let I;e[10]!==o?(I=()=>{y([]),o([])},e[10]=o,e[11]=I):I=e[11];const L=I;let z;e[12]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{_(Ne)},e[12]=z):z=e[12];const re=z;let A;e[13]!==L||e[14]!==o||e[15]!==a||e[16]!==s.length?(A=()=>{if(s.length===a.length)L();else{const l=a.map(Ce);y(l),o(l)}},e[13]=L,e[14]=o,e[15]=a,e[16]=s.length,e[17]=A):A=e[17];const i=A;let m;e[18]!==M?(m=ce("focus-ring aria-invalid:bg-destructive/10 aria-invalid:shadow-[inset_0_0_0_1px_var(--destructive)] flex h-[var(--studio-control-height,2.25rem)] w-full max-w-xs items-center justify-between gap-2 rounded-[var(--studio-control-radius,var(--radius-lg))] bg-[var(--studio-input-background)] pr-3 pl-1.5 text-sm shadow-edge transition-[background-color,box-shadow] hover:bg-sidebar disabled:pointer-events-none disabled:text-subtle-foreground",M),e[18]=M,e[19]=m):m=e[19];let u;e[20]!==P||e[21]!==k||e[22]!==a||e[23]!==$||e[24]!==s?(u=s.length>0?t.jsxs("div",{className:"flex items-center justify-between w-full min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[s.slice(0,k).map(l=>{const n=a.find(Q=>Q.value===l),w=n?.icon;return t.jsxs(le,{variant:"outline",size:"lg",className:"bg-card max-w-28",style:{animationDuration:`${P}s`},children:[w&&t.jsx(w,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:n?.label})]},l)}),s.length>k&&t.jsxs(le,{variant:"outline",size:"lg",className:"bg-card flex-shrink-0",style:{animationDuration:`${P}s`},children:["+",s.length-k]})]}),t.jsx("div",{className:"flex items-center shrink-0 ml-2",children:t.jsx(ae,{className:"text-muted-foreground size-3.5 shrink-0"})})]}):t.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[t.jsx("span",{className:"text-subtle-foreground pl-1.5 text-sm",children:$}),t.jsx(ae,{className:"text-muted-foreground size-3.5 shrink-0"})]}),e[20]=P,e[21]=k,e[22]=a,e[23]=$,e[24]=s,e[25]=u):u=e[25];let f;e[26]!==Y||e[27]!==m||e[28]!==u?(f=t.jsx(xe,{asChild:!0,children:t.jsx("button",{type:"button",onClick:re,className:m,disabled:Y,children:u})}),e[26]=Y,e[27]=m,e[28]=u,e[29]=f):f=e[29];let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=()=>_(!1),e[30]=R):R=e[30];const q=!S;let h;e[31]!==G||e[32]!==S?(h=t.jsx(de,{placeholder:"Search...",onKeyDown:G,onValueChange:S,className:"rounded-t-xl"}),e[31]=G,e[32]=S,e[33]=h):h=e[33];let T;e[34]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(me,{children:"No results found."}),e[34]=T):T=e[34];let x;e[35]!==i?(x=()=>{i()},e[35]=i,e[36]=x):x=e[36];let p;e[37]!==i?(p=l=>{l.stopPropagation(),i()},e[37]=i,e[38]=p):p=e[38];const H=s.length===a.length&&a.length>0;let g;e[39]!==H||e[40]!==i?(g=t.jsx(ne,{checked:H,onCheckedChange:i,className:"mr-2 [&_svg]:!text-primary-foreground",onClick:be}),e[39]=H,e[40]=i,e[41]=g):g=e[41];let B;e[42]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx("span",{children:"(Select All)"}),e[42]=B):B=e[42];let v;e[43]!==p||e[44]!==g?(v=t.jsxs("div",{className:"flex items-center w-full",onClick:p,children:[g,B]}),e[43]=p,e[44]=g,e[45]=v):v=e[45];let j;e[46]!==x||e[47]!==v?(j=t.jsx(oe,{onSelect:x,className:"cursor-pointer",children:v},"all"),e[46]=x,e[47]=v,e[48]=j):j=e[48];let b;if(e[49]!==a||e[50]!==s||e[51]!==c){let l;e[53]!==s||e[54]!==c?(l=n=>{const w=s.includes(n.value);return t.jsx(oe,{onSelect:()=>{c(n)},className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center w-full",onClick:Q=>{Q.stopPropagation(),c(n)},children:[t.jsx(ne,{checked:w,onCheckedChange:()=>{c(n)},className:"mr-2 [&_svg]:!text-primary-foreground",onClick:je}),n.icon&&t.jsx(n.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:n.label})]})},n.value)},e[53]=s,e[54]=c,e[55]=l):l=e[55],b=a.map(l),e[49]=a,e[50]=s,e[51]=c,e[52]=b}else b=e[52];let C;e[56]!==j||e[57]!==b?(C=t.jsxs(ue,{className:"rounded-b-xl",children:[T,t.jsxs(fe,{children:[j,b]})]}),e[56]=j,e[57]=b,e[58]=C):C=e[58];let N;e[59]!==q||e[60]!==h||e[61]!==C?(N=t.jsx(pe,{className:"w-auto p-0 max-w-xs rounded-xl",align:"start",onEscapeKeyDown:R,children:t.jsxs(he,{shouldFilter:q,className:"rounded-xl",children:[h,C]})}),e[59]=q,e[60]=h,e[61]=C,e[62]=N):N=e[62];let K;return e[63]!==F||e[64]!==J||e[65]!==f||e[66]!==N?(K=t.jsxs(ge,{open:F,onOpenChange:_,modal:J,children:[f,N]}),e[63]=F,e[64]=J,e[65]=f,e[66]=N,e[67]=K):K=e[67],K}function je(r){return r.stopPropagation()}function be(r){return r.stopPropagation()}function Ce(r){return r.value}function Ne(r){return!r}export{Ve as M};