import{e as b,q as k,G as q,cm as P,j as n,cn as E,b7 as R,K as S,o as K}from"./index-DjCrtoJM.js";import{P as j}from"./index-D7vPwljU.js";import{d as _}from"./use-organization-settings-DYscqYOA.js";import{S as I}from"./switch-Co2WNb8L.js";import{n as Q}from"./Container-Dt-ev6Gi.js";import{b as w,S as z,a as F,c as N}from"./settings-section-DDBr5t6q.js";import{R as T}from"./require-capability-XeIce_Pd.js";import"./sidebar-D0YkKw2Q.js";import"./LayoutLeft-DOdRMzln.js";import"./tooltip-MvXJgTec.js";import"./sheet-BwcUAu7J.js";import"./X-BUrHvnq3.js";import"./use-mcp-client-Wf5qUXFF.js";import"./card-DeDg0Mpx.js";import"./ArrowUpRight-7-SM74wR.js";import"./use-capability-COL6vTbP.js";import"./access-gate-CGZv0aLQ.js";import"./capability-load-error-B_GRCsfG.js";function U(){const e=b.c(17),{org:t,project:s}=k(),r=q();let d;e[0]!==s.enabledPlugins?(d=s.enabledPlugins??[],e[0]=s.enabledPlugins,e[1]=d):d=e[1];const a=d,l=_();let m;e[2]!==t||e[3]!==s.slug||e[4]!==r?(m=()=>{r.invalidateQueries({queryKey:S.project(t.id,s.slug)}),r.invalidateQueries({queryKey:S.projects(t.id)}),r.invalidateQueries({predicate:i=>{const o=i.queryKey;return o[1]===t.id&&o[3]==="collection"&&o[4]==="VIRTUAL_MCP"}})},e[2]=t,e[3]=s.slug,e[4]=r,e[5]=m):m=e[5];const x=m;let p;e[6]!==x||e[7]!==l||e[8]!==a?(p=(i,o)=>{const u=new Set(a);o?u.add(i):u.delete(i),l.mutate({enabled_plugins:Array.from(u)},{onSuccess:x,onError:G})},e[6]=x,e[7]=l,e[8]=a,e[9]=p):p=e[9];const g=p,y=D,C=A;if(P.length===0){let i;return e[10]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),e[10]=i):i=e[10],i}let c;e[11]!==g||e[12]!==l||e[13]!==a?(c=P.map(i=>{const o=y(i.id),u=C(i.id),h=a.includes(i.id);return n.jsx(w,{title:o?.label??i.id,description:u??void 0,icon:n.jsx("span",{className:"text-muted-foreground [&>svg]:size-4",children:o?.icon??n.jsx(Q,{size:14})}),onClick:()=>!l.isPending&&g(i.id,!h),action:n.jsx(I,{checked:h,onCheckedChange:v=>g(i.id,v),disabled:l.isPending,onClick:$})},i.id)}),e[11]=g,e[12]=l,e[13]=a,e[14]=c):c=e[14];let f;return e[15]!==c?(f=n.jsx(z,{children:n.jsx(F,{children:c})}),e[15]=c,e[16]=f):f=e[16],f}function $(e){return e.stopPropagation()}function A(e){return P.find(s=>s.id===e)?.description??null}function D(e){const t=E.find(r=>r.pluginId===e);if(t)return{label:t.label,icon:t.items[0]?.icon};const s=R.find(r=>r.pluginId===e);return s?{label:s.label,icon:s.icon}:null}function G(e){K.error("Failed to update plugin: "+(e instanceof Error?e.message:"Unknown error"))}function M(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(j,{children:n.jsx(j.Content,{children:n.jsx(j.Body,{children:n.jsxs(N,{children:[n.jsx(j.Title,{children:"Plugins"}),n.jsx(U,{})]})})})}),e[0]=t):t=e[0],t}function ae(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(T,{capability:"org:manage",area:"plugins",children:n.jsx(M,{})}),e[0]=t):t=e[0],t}export{ae as default};
