@decocms/mesh 2.68.0 → 2.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-COLM9TSp.js → AlertCircle-CrLCfZT0.js} +1 -1
- package/dist/client/assets/{ArrowUp-DuCoD-_2.js → ArrowUp-deTSI0E8.js} +1 -1
- package/dist/client/assets/{Calendar-8BjmK9Wb.js → Calendar-BaFebt3t.js} +1 -1
- package/dist/client/assets/{Check-BecGNPr2.js → Check-DTUUSvp-.js} +1 -1
- package/dist/client/assets/{CheckCircle-Cl7dWyoO.js → CheckCircle-BoFrCz54.js} +1 -1
- package/dist/client/assets/{ChevronDown-C80wx8LH.js → ChevronDown-DeD12W57.js} +1 -1
- package/dist/client/assets/{ChevronRight-BXGDS3zi.js → ChevronRight-8Yl-zCCi.js} +1 -1
- package/dist/client/assets/{Code01-BRpoqzI0.js → Code01-C2qL6p3f.js} +1 -1
- package/dist/client/assets/{Copy01-D9gO8dra.js → Copy01-CqWuZ9K-.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DREtot34.js → DotsHorizontal-4eEmoKn5.js} +1 -1
- package/dist/client/assets/{DotsVertical-CiHvrgFY.js → DotsVertical-BYXFslta.js} +1 -1
- package/dist/client/assets/{Download01-Bb-ZK_lB.js → Download01-DDoxVok6.js} +1 -1
- package/dist/client/assets/{Edit01-CkiAniBs.js → Edit01-BD2PlTCM.js} +1 -1
- package/dist/client/assets/{File02-D7VIQXmG.js → File02-D_ZJmgQJ.js} +1 -1
- package/dist/client/assets/{File06-DHJFu4Cl.js → File06-iSPwdYi1.js} +1 -1
- package/dist/client/assets/{FilterLines-B49cFETF.js → FilterLines-uGkpVOX8.js} +1 -1
- package/dist/client/assets/{Globe02-BJwDZf3m.js → Globe02-BhcJ1ruM.js} +1 -1
- package/dist/client/assets/{Grid01-ClvGNPyN.js → Grid01-B9LzvODL.js} +1 -1
- package/dist/client/assets/{Home02-0S7UZMux.js → Home02-DCnIiCxj.js} +1 -1
- package/dist/client/assets/{Image01-DzdAD7GX.js → Image01-BYZhOfgB.js} +1 -1
- package/dist/client/assets/{Inbox01-Uwm1ba1e.js → Inbox01-CUvjj3IH.js} +1 -1
- package/dist/client/assets/{InfoCircle-BZgIauqE.js → InfoCircle-DzQgROgs.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CVq4HepO.js → LinkExternal01-D33uvRa3.js} +1 -1
- package/dist/client/assets/{List-BTqXaORG.js → List-C1dM-VCr.js} +1 -1
- package/dist/client/assets/{Loading01-hzhOha89.js → Loading01-3CQcIIbt.js} +1 -1
- package/dist/client/assets/{Lock01-EOSVXDa6.js → Lock01-aFdw7wqo.js} +1 -1
- package/dist/client/assets/{Pin01-BOx0EQEM.js → Pin01-ChRD6YtE.js} +1 -1
- package/dist/client/assets/{Play-CccLeNTU.js → Play-B5QcYkt5.js} +1 -1
- package/dist/client/assets/{Plus-DgXpTyQu.js → Plus-CP35U6Iv.js} +1 -1
- package/dist/client/assets/{SearchMd-BrXcSv99.js → SearchMd-DTs0TtNF.js} +1 -1
- package/dist/client/assets/{Share07-C98mjjh2.js → Share07-DGflfftp.js} +1 -1
- package/dist/client/assets/{Terminal-5tYfgjqm.js → Terminal-Djd_0g5K.js} +1 -1
- package/dist/client/assets/{Tool01-CwTrOkBb.js → Tool01-A-03PfQ_.js} +1 -1
- package/dist/client/assets/{Trash01-CFVOYbE4.js → Trash01-Ck6jzVhZ.js} +1 -1
- package/dist/client/assets/{Upload01-p-_YhXOd.js → Upload01-CsBiVkrb.js} +1 -1
- package/dist/client/assets/{Users03-BwgyAH-8.js → Users03-B-DO1n7F.js} +1 -1
- package/dist/client/assets/{X-CNmc5JFs.js → X-BnxI_xD6.js} +1 -1
- package/dist/client/assets/{XClose-yK9GZfOf.js → XClose-DvgsYIZw.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-f9cNTUxC.js → agent-connections-preview-CYQwMlB4.js} +1 -1
- package/dist/client/assets/{agent-detail-B6pgG8nu.js → agent-detail-tHoRcKR8.js} +1 -1
- package/dist/client/assets/{agents-B3jt9h7_.js → agents-CNdtweuU.js} +1 -1
- package/dist/client/assets/{alert-dialog-C5BMlV_B.js → alert-dialog-DN6po1tq.js} +1 -1
- package/dist/client/assets/{auth-catchall-RCCLXWIU.js → auth-catchall-Bt6aq6Tb.js} +1 -1
- package/dist/client/assets/{badge-obBgL92k.js → badge-DIFY1rsD.js} +1 -1
- package/dist/client/assets/{binder-B-gKzuCI.js → binder-Dg2rfYkp.js} +1 -1
- package/dist/client/assets/{breadcrumb-rJChBiJd.js → breadcrumb-CJBikxW8.js} +1 -1
- package/dist/client/assets/{button-CQ8Kjf8O.js → button-CKIyuXIq.js} +1 -1
- package/dist/client/assets/{card-DLwzKTus.js → card-MU9VbmJ4.js} +1 -1
- package/dist/client/assets/{checkbox-2HWXGeDR.js → checkbox-BomYVgbH.js} +1 -1
- package/dist/client/assets/{circle-alert-DW33AE25.js → circle-alert-BcHAU0vN.js} +1 -1
- package/dist/client/assets/{collection-detail-EWZbXFTn.js → collection-detail-CZFVa2Zq.js} +1 -1
- package/dist/client/assets/{collection-search-DsJ7tYYh.js → collection-search-CECpIAiD.js} +1 -1
- package/dist/client/assets/{collection-tab-Bw9wDafH.js → collection-tab-D12suO7P.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DJPMRDfl.js → collection-table-wrapper-CzqGMTIb.js} +1 -1
- package/dist/client/assets/{collection-tabs-DKE_sesv.js → collection-tabs-Dd6S7hPE.js} +1 -1
- package/dist/client/assets/{command-Bkn5ljJp.js → command-BLAC1NoH.js} +1 -1
- package/dist/client/assets/{connect-D81s0hqa.js → connect-VopSOjzi.js} +1 -1
- package/dist/client/assets/{connection-card-BTdUyxaq.js → connection-card-C7cdqtZc.js} +1 -1
- package/dist/client/assets/{connection-detail-Dg_Jlpqx.js → connection-detail-Cm-idmqc.js} +1 -1
- package/dist/client/assets/{connections-DrB7wAkw.js → connections-DqIiaOoJ.js} +1 -1
- package/dist/client/assets/constants-DBJOqOcW.js +1 -0
- package/dist/client/assets/{constants-DZRJwikT.js → constants-DwkB1age.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-B4oPD4mb.js → create-organization-dialog-QVwT9MeU.js} +1 -1
- package/dist/client/assets/{dialog-DNf7oKHG.js → dialog-CjI8rs-6.js} +1 -1
- package/dist/client/assets/{dropdown-menu-oqWMuO1Y.js → dropdown-menu-CoO02CsY.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-DTrgJ2ut.js → dynamic-plugin-layout-DxUJHFK2.js} +1 -1
- package/dist/client/assets/{empty-state-CsFQa3KR.js → empty-state-CQab9dR0.js} +1 -1
- package/dist/client/assets/{empty-state-CQfuZLBd.js → empty-state-VwVcPCE1.js} +1 -1
- package/dist/client/assets/{env-vars-editor-DR9qXTlp.js → env-vars-editor-BMhfk7Zf.js} +1 -1
- package/dist/client/assets/{error-boundary-DtmbPa7H.js → error-boundary-C8CO11ML.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CXNq0UhM.js → extract-connection-data-DwTMOpOf.js} +1 -1
- package/dist/client/assets/{file-browser-K6aJ-90B.js → file-browser-BqPRsorK.js} +2 -2
- package/dist/client/assets/{form-DOuqKZXC.js → form-CO4xV9gA.js} +1 -1
- package/dist/client/assets/{grid-view-DNCUOIul.js → grid-view-CDgwvRTT.js} +1 -1
- package/dist/client/assets/{home-Hunp1pBK.js → home-Bgf631v9.js} +1 -1
- package/dist/client/assets/{index-BXIoP_MZ.js → index-810mvVLg.js} +1 -1
- package/dist/client/assets/{index-CMcaW4mM.js → index-Bc7QzOnC.js} +1 -1
- package/dist/client/assets/{index-C98gN7aR.js → index-BdSNJxPZ.js} +1 -1
- package/dist/client/assets/{index-D4MF_YMK.js → index-CHQ9-Q-G.js} +2 -2
- package/dist/client/assets/{index-CoTLSWKV.js → index-CNwEt7K8.js} +1 -1
- package/dist/client/assets/{index-DwckbwiB.js → index-CrNYs5dK.js} +1 -1
- package/dist/client/assets/{index-B_zasBnB.js → index-CvZXtRPz.js} +1 -1
- package/dist/client/assets/{index-Dv6ogWGy.js → index-aWpPBjkT.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-BzntX6sG.js → infiniteQueryObserver-CKMx30vn.js} +1 -1
- package/dist/client/assets/{input-DTmWYrzg.js → input-BrgRsDcE.js} +1 -1
- package/dist/client/assets/{layout-CmTDyJx0.js → layout-D8nQ7DGi.js} +1 -1
- package/dist/client/assets/{localstorage-keys-C5qg7tJd.js → localstorage-keys-BiLB-Ybm.js} +1 -1
- package/dist/client/assets/{login-2cPT-FUQ.js → login-COXBU4ri.js} +1 -1
- package/dist/client/assets/{mcp-oauth-l5FY9ha9.js → mcp-oauth-i2Um3a9A.js} +1 -1
- package/dist/client/assets/{mcp-server-card-DxTDJUfL.js → mcp-server-card-B_tcMycX.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-Cl5inBKq.js → mcp-server-detail-CCPdSS0H.js} +2 -2
- package/dist/client/assets/{members-ByaVzqHg.js → members-DNx_w5eC.js} +1 -1
- package/dist/client/assets/{monaco-editor-B_aNlfTE.js → monaco-editor-qYykGrlT.js} +1 -1
- package/dist/client/assets/{monitoring-mhA92Ixp.js → monitoring-BuIkRBxN.js} +1 -1
- package/dist/client/assets/{oauth-callback-D0QR_Mie.js → oauth-callback-B24XRb9Q.js} +1 -1
- package/dist/client/assets/{page-Btm7NQl7.js → page-Buen7bnX.js} +1 -1
- package/dist/client/assets/{page-DjUdRkou.js → page-NaxcVK27.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CqhE8dhS.js → plugin-empty-state-CNA6ghy_.js} +1 -1
- package/dist/client/assets/{plugin-header-HKvKg_58.js → plugin-header-ColWGLS5.js} +1 -1
- package/dist/client/assets/{plugins-DNaRCBWX.js → plugins-Bwp1vQes.js} +1 -1
- package/dist/client/assets/{popover-BaiBgi1w.js → popover-CjUGVjON.js} +1 -1
- package/dist/client/assets/{registry-utils-dFRqfWcz.js → registry-utils-TFnNkGPj.js} +1 -1
- package/dist/client/assets/{resizable-DlZWYzwB.js → resizable-DQA2LWqr.js} +1 -1
- package/dist/client/assets/{select-D4-WItce.js → select-JdRjOrBE.js} +1 -1
- package/dist/client/assets/{settings-DHZ7pBp9.js → settings-C5BA4Ik8.js} +1 -1
- package/dist/client/assets/{shell-layout-y-_rL17R.js → shell-layout-Dz2AUt47.js} +1 -1
- package/dist/client/assets/{spinner-DBvjLIGS.js → spinner-CEhxpPPn.js} +1 -1
- package/dist/client/assets/{store-invite-C_UIm-oL.js → store-invite-2RTGhZRS.js} +1 -1
- package/dist/client/assets/{switch-C7P9CpyX.js → switch-DKkhDe7l.js} +1 -1
- package/dist/client/assets/{table-BQWoR2xQ.js → table-CBtv9zrT.js} +1 -1
- package/dist/client/assets/{textarea-JbvjK4Se.js → textarea-BBk7k5wE.js} +1 -1
- package/dist/client/assets/{tools-list-ZEvuh1uO.js → tools-list-DGAPFCDO.js} +1 -1
- package/dist/client/assets/{typewriter-title-b4BeUK0_.js → typewriter-title-XDUo1EGk.js} +1 -1
- package/dist/client/assets/{use-binding-B1zV-Y0z.js → use-binding-HsWp1jWu.js} +1 -1
- package/dist/client/assets/{use-connection-zcRZ_mrS.js → use-connection-UwIAiUmR.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-C5P9SCxC.js → use-create-virtual-mcp-CG-Wp4A9.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-CfetKXkW.js → use-deco-chat-open-Da_cfFLg.js} +2 -2
- package/dist/client/assets/{use-list-state-DlKabQs5.js → use-list-state-Dxbvm2sV.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-4APAdxvp.js → use-mcp-prompts-DDPkiTOB.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CBaz6cWu.js → use-mcp-tools-BKgKiBFS.js} +1 -1
- package/dist/client/assets/{use-mobile-DCUge7v5.js → use-mobile-CtC8_4UP.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DzncoO7n.js → use-organization-settings-TImCLEbo.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-D69PZZns.js → use-virtual-mcp-BIZk_q3v.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-wjoMRbc3.js +1 -0
- package/dist/client/assets/{useMutation-Cc1z0I0J.js → useMutation-C8K1KoTI.js} +1 -1
- package/dist/client/assets/useQuery-CImYAWdS.js +1 -0
- package/dist/client/assets/{view-mode-toggle-I9cNNgTM.js → view-mode-toggle-BiRjYen1.js} +1 -1
- package/dist/client/assets/{workflow-CFz7sZz-.js → workflow-TGPdc23k.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/constants-CtcvnfJ2.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DO7FQ9J7.js +0 -1
- package/dist/client/assets/useQuery-BdnAz8Zk.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as B,c as V,j as a}from"./index-
|
|
1
|
+
import{r as B,c as V,j as a}from"./index-CHQ9-Q-G.js";import{I as O,T as q,a as J,b as K}from"./empty-state-VwVcPCE1.js";import{c as M,B as Q}from"./button-CKIyuXIq.js";import{s as X}from"./Globe02-BhcJ1ruM.js";import{i as Y}from"./Lock01-aFdw7wqo.js";import{s as ee}from"./Plus-CP35U6Iv.js";import{i as te}from"./Terminal-Djd_0g5K.js";import{C as se}from"./card-MU9VbmJ4.js";import{g as le}from"./github-icon-Dp3wHhYE.js";const U=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";const W=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 10 4.08 10 5.2 10Zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 22 4.08 22 5.2 22Z"}));W.displayName="Server01";function ie(s){if(!s.includes("/"))return s;const e=s.split("/"),l=e[0],i=e[1];if(!l||!i)return s;if(l.includes(".")){const n=l.split("."),r=n[n.length-1]||l,o=i.replace(/^mcp-?/,"").replace(/-?mcp$/,"").replace(/^server-?/,"").replace(/-?server$/,"");return!o||o.length<2?r:o}return i}function ae(s){const e=V.c(2),{protocol:l,className:i}=s;let n;return e[0]!==i?(n={http:a.jsx(X,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(te,{className:i})},e[0]=i,e[1]=n):n=e[1],n[l]}function ne(s){switch(s){case"http":return"HTTP";case"sse":return"SSE";case"stdio":return"STDIO"}}function re(s){const e=V.c(9),{protocol:l}=s;let i;e[0]!==l?(i=M("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium shrink-0",{http:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",sse:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",stdio:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"}[l]),e[0]=l,e[1]=i):i=e[1];let n,r;e[2]!==l?(n=a.jsx(ae,{protocol:l,className:"w-3 h-3"}),r=ne(l),e[2]=l,e[3]=n,e[4]=r):(n=e[3],r=e[4]);let o;return e[5]!==i||e[6]!==n||e[7]!==r?(o=a.jsxs("div",{className:i,children:[n,r]}),e[5]=i,e[6]=n,e[7]=r,e[8]=o):o=e[8],o}function oe(s){const e=V.c(68),{icon:l,displayName:i,description:n,onClick:r}=s,t=(s.variant??"store")==="server",f=t?s.hostname:null,d=t?s.protocol:null,c=t?s.isInstalling:!1,m=t?s.actionLabel:void 0,p=t?null:s.scopeName,_=t?!1:s.isVerified,x=t?!0:s.canInstall,H=t?"p-4":"p-6";let u;e[0]!==H?(u=M("cursor-pointer hover:bg-muted/50 transition-colors",H),e[0]=H,e[1]=u):u=e[1];const R=t?"gap-3":"gap-4";let h;e[2]!==R?(h=M("flex flex-col h-full relative",R),e[2]=R,e[3]=h):h=e[3];const Z=t?"sm":"md";let g;e[4]!==i||e[5]!==l||e[6]!==Z?(g=a.jsx(O,{icon:l,name:i,size:Z,className:"shadow-sm shrink-0"}),e[4]=i,e[5]=l,e[6]=Z,e[7]=g):g=e[7];const G=t?"text-sm":"text-base";let v;e[8]!==G?(v=M("flex items-center gap-2 font-medium min-w-0",G),e[8]=G,e[9]=v):v=e[9];let j;e[10]!==i?(j=a.jsx("span",{className:"truncate",children:i}),e[10]=i,e[11]=j):j=e[11];let N;e[12]!==t||e[13]!==_?(N=!t&&_&&a.jsx(U,{size:16,className:"text-success shrink-0"}),e[12]=t,e[13]=_,e[14]=N):N=e[14];let C;e[15]!==x||e[16]!==t?(C=!t&&!x&&a.jsx(Y,{size:16,className:"text-muted-foreground shrink-0"}),e[15]=x,e[16]=t,e[17]=C):C=e[17];let k;e[18]!==t||e[19]!==d?(k=t&&d&&a.jsx(re,{protocol:d}),e[18]=t,e[19]=d,e[20]=k):k=e[20];let b;e[21]!==C||e[22]!==k||e[23]!==v||e[24]!==j||e[25]!==N?(b=a.jsx(q,{asChild:!0,children:a.jsxs("div",{className:v,children:[j,N,C,k]})}),e[21]=C,e[22]=k,e[23]=v,e[24]=j,e[25]=N,e[26]=b):b=e[26];let w;e[27]!==i?(w=a.jsx("p",{children:i}),e[27]=i,e[28]=w):w=e[28];let y;e[29]!==x||e[30]!==t?(y=!t&&!x&&a.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[29]=x,e[30]=t,e[31]=y):y=e[31];let I;e[32]!==w||e[33]!==y?(I=a.jsxs(J,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(K,{children:[b,I]}),e[35]=b,e[36]=I,e[37]=$):$=e[37];let L;e[38]!==f||e[39]!==t||e[40]!==p?(L=(p||f)&&a.jsx("div",{className:M("text-muted-foreground truncate",t?"text-xs mt-0.5":"text-sm"),children:p||f}),e[38]=f,e[39]=t,e[40]=p,e[41]=L):L=e[41];let P;e[42]!==$||e[43]!==L?(P=a.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[$,L]})}),e[42]=$,e[43]=L,e[44]=P):P=e[44];let S;e[45]!==P||e[46]!==g?(S=a.jsxs("div",{className:"flex gap-3",children:[g,P]}),e[45]=P,e[46]=g,e[47]=S):S=e[47];let T;e[48]!==n?(T=n&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:n}),e[48]=n,e[49]=T):T=e[49];let E;e[50]!==n||e[51]!==t?(E=!n&&!t&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:"No description available"}),e[50]=n,e[51]=t,e[52]=E):E=e[52];let z;e[53]!==m||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(Q,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(ee,{size:16}),c?"Connecting...":m||"Connect"]}),e[53]=m,e[54]=c,e[55]=t,e[56]=r,e[57]=z):z=e[57];let D;e[58]!==S||e[59]!==T||e[60]!==E||e[61]!==z||e[62]!==h?(D=a.jsxs("div",{className:h,children:[S,T,E,z]}),e[58]=S,e[59]=T,e[60]=E,e[61]=z,e[62]=h,e[63]=D):D=e[63];let A;return e[64]!==r||e[65]!==u||e[66]!==D?(A=a.jsx(se,{className:u,onClick:r,children:D}),e[64]=r,e[65]=u,e[66]=D,e[67]=A):A=e[67],A}function ce(s){const e=s.title||s.server.title||s.id||"Unnamed Item",l=s._meta?.["mcp.mesh"],i=l?.short_description||l?.mesh_description||s.server.description||null,n=s.server.icons?.[0]?.src||le(s.server.repository)||null,r=l?.verified??!1,o=(s.server.remotes?.length??0)>0,t=(s.server.packages?.length??0)>0,f=o||t;let d=e,c=null;if(e.includes("/")){const m=e.split("/");m.length>=2&&(c=m[0]||null,d=ie(e))}if(!c){const m=l?.scopeName,p=l?.appName;m&&p?c=`${m}/${p}`:m&&(c=m)}return l?.friendly_name&&(d=l.friendly_name),{icon:n,scopeName:c,displayName:d,description:i,isVerified:r,canInstall:f}}function je(s){const e=V.c(12),{items:l,title:i,onItemClick:n}=s;if(l.length===0)return null;let r;e[0]!==i?(r=i&&a.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:a.jsx("h2",{className:"text-lg font-medium",children:i})}),e[0]=i,e[1]=r):r=e[1];let o;if(e[2]!==l||e[3]!==n){let d;e[5]!==n?(d=c=>{const m=ce(c);return a.jsx(oe,{...m,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=d):d=e[6],o=l.map(d),e[2]=l,e[3]=n,e[4]=o}else o=e[4];let t;e[7]!==o?(t=a.jsx("div",{className:"grid grid-cols-4 gap-4",children:o}),e[7]=o,e[8]=t):t=e[8];let f;return e[9]!==r||e[10]!==t?(f=a.jsxs("div",{className:"flex flex-col gap-4",children:[r,t]}),e[9]=r,e[10]=t,e[11]=f):f=e[11],f}export{je as M,oe as a,W as b,ie as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as F,c as E,j as t,u as he,v as ge,a as ke,f as Le,g as Pe,bo as ce,K as Me,l as Ve,t as de}from"./index-D4MF_YMK.js";import{i as De}from"./AlertCircle-COLM9TSp.js";import{i as ve}from"./Loading01-hzhOha89.js";import{P as me}from"./index-Dv6ogWGy.js";import{I as be,E as Ee}from"./empty-state-CQfuZLBd.js";import{B as te,c as $e}from"./button-CQ8Kjf8O.js";import{i as Re}from"./CheckCircle-Cl7dWyoO.js";import{t as Ae}from"./ChevronDown-C80wx8LH.js";import{s as fe}from"./Plus-DgXpTyQu.js";import{a as Be,c as Ue,b as ze,D as Oe}from"./dropdown-menu-oqWMuO1Y.js";import{n as ue}from"./LinkExternal01-CVq4HepO.js";import{T as Fe,R as He}from"./tools-list-ZEvuh1uO.js";import{C as Ge}from"./collection-tabs-DKE_sesv.js";import{s as We}from"./Globe02-BJwDZf3m.js";import{a as qe,b as Ke,e as Qe}from"./mcp-server-card-DxTDJUfL.js";import{i as Ye}from"./Terminal-5tYfgjqm.js";import{B as Xe,a as Ze,b as pe,c as Je,d as et,e as tt}from"./breadcrumb-rJChBiJd.js";import{u as st}from"./use-binding-B1zV-Y0z.js";import{u as ot}from"./useQuery-BdnAz8Zk.js";import{g as rt,h as nt,f as it}from"./use-connection-zcRZ_mrS.js";import{u as lt}from"./constants-DZRJwikT.js";import{u as at}from"./use-mcp-tools-CBaz6cWu.js";import{u as ct,L as dt}from"./localstorage-keys-C5qg7tJd.js";import{e as mt}from"./extract-connection-data-CXNq0UhM.js";import{s as ft}from"./slugify-CEUa2lfQ.js";import{e as ut,g as pt}from"./github-icon-Dp3wHhYE.js";import{f as xt,g as ht,c as gt}from"./registry-utils-dFRqfWcz.js";import{i as vt}from"./InfoCircle-BZgIauqE.js";import"./ChevronRight-BXGDS3zi.js";import"./File06-DHJFu4Cl.js";import"./collection-table-wrapper-DJPMRDfl.js";import"./ArrowUp-DuCoD-_2.js";import"./Check-BecGNPr2.js";import"./Grid01-ClvGNPyN.js";import"./List-BTqXaORG.js";import"./view-mode-toggle-I9cNNgTM.js";import"./table-BQWoR2xQ.js";import"./collection-search-DsJ7tYYh.js";import"./SearchMd-BrXcSv99.js";import"./input-DTmWYrzg.js";import"./card-DLwzKTus.js";import"./layout-CmTDyJx0.js";import"./badge-obBgL92k.js";import"./Lock01-EOSVXDa6.js";import"./binder-B-gKzuCI.js";import"./useMutation-Cc1z0I0J.js";import"./constants-CtcvnfJ2.js";import"./generate-id-Dyweu44Y.js";const je=({size:o=24,color:e="currentColor",...s})=>F.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},F.createElement("path",{d:"m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"}));je.displayName="SearchLg";function bt(o){const e=E.c(3),{message:s}=o,r=s===void 0?"Loading MCP Server details...":s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(ve,{size:48,className:"animate-spin mb-4"}),e[0]=n):n=e[0];let i;return e[1]!==r?(i=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,t.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),e[1]=r,e[2]=i):i=e[2],i}function jt(o){const e=E.c(9),{error:s,onBack:r}=o,n=s instanceof Error?s.message:s;let i,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(De,{size:48,className:"text-destructive mb-4"}),c=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading MCP Server"}),e[0]=i,e[1]=c):(i=e[0],c=e[1]);let u;e[2]!==n?(u=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:n}),e[2]=n,e[3]=u):u=e[3];let d;e[4]!==r?(d=t.jsx("button",{onClick:r,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back"}),e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==u||e[7]!==d?(m=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,c,u,d]}),e[6]=u,e[7]=d,e[8]=m):m=e[8],m}function yt(o){const e=E.c(5),{onBack:s}=o;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(je,{size:48,className:"text-muted-foreground mb-4"}),n=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"MCP Server not found"}),i=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"The MCP Server you're looking for doesn't exist in this store."}),e[0]=r,e[1]=n,e[2]=i):(r=e[0],n=e[1],i=e[2]);let c;return e[3]!==s?(c=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,n,i,t.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back to Store"})]}),e[3]=s,e[4]=c):c=e[4],c}function Nt(o){const e=E.c(2),{breadcrumb:s}=o;let r;return e[0]!==s?(r=t.jsx(me.Header,{children:t.jsx(me.Header.Left,{children:s})}),e[0]=s,e[1]=r):r=e[1],r}function xe(o){const e=E.c(28),{versions:s,selectedIndex:r,onSelect:n,isInstalling:i,variant:c,showLabel:u}=o,d=i===void 0?!1:i,m=c===void 0?"brand":c,I=u===void 0?!1:u,p=s[r],S=I?"sm":"default",j=m==="brand"&&"rounded-l-none px-2 border-l-2 border-l-white/50";let y;e[0]!==j?(y=$e("shrink-0 cursor-pointer",j),e[0]=j,e[1]=y):y=e[1];let f;e[2]!==p?.server?.version||e[3]!==I?(f=I&&t.jsxs("span",{className:"mr-1",children:["v",p?.server?.version||"unknown"]}),e[2]=p?.server?.version,e[3]=I,e[4]=f):f=e[4];const N=I?14:20;let h;e[5]!==N?(h=t.jsx(Ae,{size:N}),e[5]=N,e[6]=h):h=e[6];let x;e[7]!==d||e[8]!==S||e[9]!==y||e[10]!==f||e[11]!==h||e[12]!==m?(x=t.jsx(Be,{asChild:!0,children:t.jsxs(te,{variant:m,disabled:d,size:S,className:y,children:[f,h]})}),e[7]=d,e[8]=S,e[9]=y,e[10]=f,e[11]=h,e[12]=m,e[13]=x):x=e[13];let g;if(e[14]!==d||e[15]!==n||e[16]!==r||e[17]!==s){let C;e[19]!==d||e[20]!==n||e[21]!==r?(C=(v,b)=>{const P=v._meta?.["io.modelcontextprotocol.registry/official"];return t.jsx(Ue,{onClick:()=>n(b),disabled:d,className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"font-medium text-sm",children:["v",v.server?.version||"unknown"]}),P?.isLatest&&t.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),b===r&&t.jsx(Re,{size:16,className:"text-muted-foreground shrink-0"})]})},b)},e[19]=d,e[20]=n,e[21]=r,e[22]=C):C=e[22],g=s.map(C),e[14]=d,e[15]=n,e[16]=r,e[17]=s,e[18]=g}else g=e[18];let _;e[23]!==g?(_=t.jsx(ze,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:g}),e[23]=g,e[24]=_):_=e[24];let w;return e[25]!==x||e[26]!==_?(w=t.jsxs(Oe,{children:[x,_]}),e[25]=x,e[26]=_,e[27]=w):w=e[27],w}function Ct(o){const e=E.c(46),{data:s,itemVersions:r,onInstall:n,canInstall:i,isInstalling:c,hideInstallControls:u,selectedVersionIndex:d,onVersionChange:m}=o,I=i===void 0?!0:i,p=c===void 0?!1:c,S=u===void 0?!1:u,[j,y]=F.useState(0),f=d??j;let N;e[0]!==m?(N=B=>{y(B),m?.(B)},e[0]=m,e[1]=N):N=e[1];const h=N,x=r[f]||r[0];let g;e[2]!==x?.server?.remotes?(g=x?.server?.remotes??[],e[2]=x?.server?.remotes,e[3]=g):g=e[3];const _=g;let w;e[4]!==x?.server?.packages?(w=x?.server?.packages??[],e[4]=x?.server?.packages,e[5]=w):w=e[5];const v=w.length>0,b=_.length>0,P=_.findIndex(wt),a=P>=0?P:0;let M;e[6]!==a||e[7]!==v||e[8]!==b||e[9]!==n||e[10]!==f?(M=()=>{b?n(f,a,void 0):v&&n(f,void 0,0)},e[6]=a,e[7]=v,e[8]=b,e[9]=n,e[10]=f,e[11]=M):M=e[11];const V=M;let H;e[12]!==r||e[13]!==n||e[14]!==h?(H=B=>{h(B);const X=r[B],Z=X?.server?.remotes??[],se=X?.server?.packages??[];if(Z.length>0){const J=Z.findIndex(St);n(B,J>=0?J:0,void 0)}else se.length>0&&n(B,void 0,0)},e[12]=r,e[13]=n,e[14]=h,e[15]=H):H=e[15];const K=H;let R;e[16]!==s.icon||e[17]!==s.name?(R=t.jsx(be,{icon:s.icon,name:s.name,size:"lg",className:"shrink-0 shadow-sm"}),e[16]=s.icon,e[17]=s.name,e[18]=R):R=e[18];let k;e[19]!==s.name?(k=t.jsx("h1",{className:"text-3xl font-medium",children:s.name}),e[19]=s.name,e[20]=k):k=e[20];let T;e[21]!==s.verified?(T=s.verified&&t.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[21]=s.verified,e[22]=T):T=e[22];let A;e[23]!==k||e[24]!==T?(A=t.jsxs("div",{className:"flex items-center gap-2",children:[k,T]}),e[23]=k,e[24]=T,e[25]=A):A=e[25];let D;e[26]!==s.shortDescription?(D=s.shortDescription&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.shortDescription}),e[26]=s.shortDescription,e[27]=D):D=e[27];let U;e[28]!==A||e[29]!==D?(U=t.jsxs("div",{className:"flex-1 min-w-0",children:[A,D]}),e[28]=A,e[29]=D,e[30]=U):U=e[30];let z;e[31]!==I||e[32]!==V||e[33]!==K||e[34]!==S||e[35]!==p||e[36]!==r||e[37]!==f||e[38]!==h?(z=I&&!S?t.jsx("div",{className:"shrink-0 flex items-center gap-2",children:r.length>1?t.jsxs("div",{className:"flex",children:[t.jsxs(te,{variant:"brand",onClick:V,disabled:p,className:"shrink-0 rounded-r-none cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]}),t.jsx(xe,{versions:r,selectedIndex:f,onSelect:K,isInstalling:p,variant:"brand"})]}):t.jsxs(te,{variant:"brand",onClick:V,disabled:r.length===0||p,className:"shrink-0 cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]})}):S?r.length>1?t.jsx("div",{className:"shrink-0",children:t.jsx(xe,{versions:r,selectedIndex:f,onSelect:h,isInstalling:p,variant:"outline",showLabel:!0})}):null:t.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[31]=I,e[32]=V,e[33]=K,e[34]=S,e[35]=p,e[36]=r,e[37]=f,e[38]=h,e[39]=z):z=e[39];let O;e[40]!==U||e[41]!==z?(O=t.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[U,z]}),e[40]=U,e[41]=z,e[42]=O):O=e[42];let G;return e[43]!==O||e[44]!==R?(G=t.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[R,O]}),e[43]=O,e[44]=R,e[45]=G):G=e[45],G}function St(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function wt(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function It(o){if(!o)return"—";try{const e=new Date(o);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function _t(o){const e=E.c(47),{data:s,publisherInfo:r,selectedItem:n}=o;let i;e[0]!==s.description?(i=s.description&&t.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[t.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.description})]}),e[0]=s.description,e[1]=i):i=e[1];const c=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher;let u;e[2]!==r.logo||e[3]!==c?(u=t.jsx(be,{icon:r.logo,name:c,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=r.logo,e[3]=c,e[4]=u):u=e[4];let d;e[5]!==s.publisher?(d=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher.charAt(0).toUpperCase()+s.publisher.slice(1),e[5]=s.publisher,e[6]=d):d=e[6];let m;e[7]!==d?(m=t.jsx("div",{className:"font-medium",children:d}),e[7]=d,e[8]=m):m=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"text-xs text-muted-foreground",children:"Publisher"}),e[9]=I):I=e[9];let p;e[10]!==m?(p=t.jsxs("div",{children:[m,I]}),e[10]=m,e[11]=p):p=e[11];let S;e[12]!==u||e[13]!==p?(S=t.jsx("div",{className:"px-5 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-3 py-5",children:[u,p]})}),e[12]=u,e[13]=p,e[14]=S):S=e[14];let j;e[15]!==s.version?(j=s.version&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Version"}),t.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",s.version]})]}),e[15]=s.version,e[16]=j):j=e[16];let y;e[17]!==s.tags?(y=s.tags&&s.tags.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.tags.map(kt)})]}),e[17]=s.tags,e[18]=y):y=e[18];let f;e[19]!==s.categories?(f=s.categories&&s.categories.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Categories"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.categories.map(Tt)})]}),e[19]=s.categories,e[20]=f):f=e[20];let N;e[21]!==s.connectionType?(N=s.connectionType&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:s.connectionType})]}),e[21]=s.connectionType,e[22]=N):N=e[22];let h;e[23]!==s.schemaVersion?(h=s.schemaVersion&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),t.jsx("span",{className:"text-muted-foreground text-xs",children:s.schemaVersion})]}),e[23]=s.schemaVersion,e[24]=h):h=e[24];let x;e[25]!==s.websiteUrl?(x=s.websiteUrl&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Website"}),t.jsxs("a",{href:s.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"Visit"}),t.jsx(ue,{size:14})]})]}),e[25]=s.websiteUrl,e[26]=x):x=e[26];let g;e[27]!==s.repository?(g=s.repository?.url&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Source"}),t.jsxs("a",{href:s.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"GitHub"}),t.jsx(ue,{size:14})]})]}),e[27]=s.repository,e[28]=g):g=e[28];let _;e[29]!==y||e[30]!==f||e[31]!==N||e[32]!==h||e[33]!==x||e[34]!==g||e[35]!==j?(_=t.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[j,y,f,N,h,x,g]}),e[29]=y,e[30]=f,e[31]=N,e[32]=h,e[33]=x,e[34]=g,e[35]=j,e[36]=_):_=e[36];let w;e[37]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[37]=w):w=e[37];let C;e[38]!==n.updated_at?(C=It(n.updated_at),e[38]=n.updated_at,e[39]=C):C=e[39];let v;e[40]!==C?(v=t.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[w,t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:C})]}),e[40]=C,e[41]=v):v=e[41];let b;return e[42]!==i||e[43]!==_||e[44]!==v||e[45]!==S?(b=t.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,S,_,v]}),e[42]=i,e[43]=_,e[44]=v,e[45]=S,e[46]=b):b=e[46],b}function Tt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}function kt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}const Lt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],Pt={docs:"Documentation",bindings:"Workers Bindings",builds:"Workers Builds",observability:"Observability",radar:"Radar",containers:"Containers",browser:"Browser Rendering",logs:"Logpush",autorag:"AutoRAG",auditlogs:"Audit Logs",graphql:"GraphQL",dex:"DEX Monitoring",casb:"CASB"};function Mt(o){if(!o)return"Local";try{return new URL(o).hostname}catch{return o}}function Vt(o){if(!o)return"local";try{const e=new URL(o).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function Dt(o){const e=Pt[o.toLowerCase()];return e||o.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Et(o){if(!o)return"http";const e=o.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function $t(o){return o.map((e,s)=>{const r=Et(e.type),n=Mt(e.url),i=Vt(e.url),c=e.title||e.name||Dt(i);return{index:s,protocol:r,url:e.url,hostname:n,serviceName:i,displayName:c,name:e.name,title:e.title,description:e.description,_type:e._type,_index:e._index}})}function Rt(o){const e=E.c(2),{protocol:s,className:r}=o;let n;return e[0]!==r?(n={http:t.jsx(We,{className:r}),sse:t.jsx(Ke,{className:r}),stdio:t.jsx(Ye,{className:r})},e[0]=r,e[1]=n):n=e[1],n[s]}function At(o){const e=E.c(10),{options:s,selected:r,onSelect:n}=o;if(s.length<=1)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"text-sm text-muted-foreground",children:"Protocol:"}),e[0]=i):i=e[0];let c;if(e[1]!==n||e[2]!==s||e[3]!==r){let d;e[5]!==n||e[6]!==r?(d=m=>t.jsxs(te,{variant:r===m.value?"default":"outline",size:"sm",onClick:()=>n(m.value),className:"cursor-pointer",children:[t.jsx(Rt,{protocol:m.value==="all"?"http":m.value,className:"w-4 h-4 mr-1"}),m.label]},m.value),e[5]=n,e[6]=r,e[7]=d):d=e[7],c=s.map(d),e[1]=n,e[2]=s,e[3]=r,e[4]=c}else c=e[4];let u;return e[8]!==c?(u=t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i,t.jsx("div",{className:"flex gap-1",children:c})]}),e[8]=c,e[9]=u):u=e[9],u}function Bt(o){const e=E.c(11),{servers:s,onInstall:r,isInstalling:n,icon:i,mcpName:c,showStdio:u}=o,d=n===void 0?!1:n,m=u===void 0?!1:u,I=m?s:s.filter(Ft),p=$t(I),S=p.length<13?"all":"http",[j,y]=F.useState(S);let f;e:{if(j==="all"){f="all";break e}let a;if(e[0]!==j?(a=V=>V.protocol===j,e[0]=j,e[1]=a):a=e[1],p.some(a)){f=j;break e}if(p.length<13){f="all";break e}f=p[0]?.protocol??"http"}const N=f,h=N==="all"?p:p.filter(a=>a.protocol===N),x=new Set(p.map(Ot));let g=Lt.filter(a=>a.value==="all"||x.has(a.value));m||(g=g.filter(zt));const _=x.size<=1?g.filter(Ut):g,w="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4";let C;e[2]!==i||e[3]!==d||e[4]!==c||e[5]!==r?(C=a=>t.jsx(qe,{variant:"server",icon:i??null,displayName:a.displayName,description:a.description??null,hostname:a.hostname,protocol:a.protocol,isInstalling:d,onClick:()=>r({type:a.protocol,url:a.url,name:a.name,title:a.title,description:a.description,_type:a._type,_index:a._index})},`${a.hostname}-${a.protocol}-${a.index}`),e[2]=i,e[3]=d,e[4]=c,e[5]=r,e[6]=C):C=e[6];const v=h.map(C);let b;e[7]!==v?(b=t.jsx("div",{className:w,children:v}),e[7]=v,e[8]=b):b=e[8];let P;return e[9]!==h.length?(P=h.length===0&&t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No servers match the selected filter."}),e[9]=h.length,e[10]=P):P=e[10],t.jsxs("div",{className:"p-5",children:[t.jsx(At,{options:_,selected:N,onSelect:y}),b,P]})}function Ut(o){return o.value!=="all"}function zt(o){return o.value!=="stdio"}function Ot(o){return o.protocol}function Ft(o){return o.type?.toLowerCase()!=="stdio"}function Ht(o){const e=E.c(29),{data:s,availableTabs:r,effectiveActiveTabId:n,effectiveTools:i,isLoadingTools:c,onTabChange:u,servers:d,onInstallServer:m,isInstalling:I,mcpIcon:p,mcpName:S,showStdio:j}=o,y=c===void 0?!1:c;let f;e[0]!==d?(f=d===void 0?[]:d,e[0]=d,e[1]=f):f=e[1];const N=f,h=I===void 0?!1:I,x=j===void 0?!1:j;let g;e[2]!==i?(g=i.map(Gt),e[2]=i,e[3]=g):g=e[3];const _=g;let w;e[4]!==r||e[5]!==n||e[6]!==u?(w=r.length>0&&t.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:t.jsx(Ge,{tabs:r,activeTab:n,onTabChange:u})}),e[4]=r,e[5]=n,e[6]=u,e[7]=w):w=e[7];let C;e[8]!==n||e[9]!==h||e[10]!==p||e[11]!==S||e[12]!==m||e[13]!==N||e[14]!==x?(C=n==="servers"&&N.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(Bt,{servers:N,onInstall:a=>m?.(a),isInstalling:h,icon:p,mcpName:S,showStdio:x})}),e[8]=n,e[9]=h,e[10]=p,e[11]=S,e[12]=m,e[13]=N,e[14]=x,e[15]=C):C=e[15];let v;e[16]!==n||e[17]!==i.length||e[18]!==y||e[19]!==_?(v=n==="tools"&&t.jsx("div",{className:"flex flex-col flex-1",children:y?t.jsxs("div",{className:"flex items-center justify-center p-8",children:[t.jsx(ve,{size:24,className:"animate-spin"}),t.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?t.jsx(Fe,{tools:_,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):t.jsx(Ee,{image:null,title:"No tools available",description:"This MCP Server doesn't have any tools."})}),e[16]=n,e[17]=i.length,e[18]=y,e[19]=_,e[20]=v):v=e[20];let b;e[21]!==s?.repository||e[22]!==n?(b=n==="readme"&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(He,{repository:s?.repository})}),e[21]=s?.repository,e[22]=n,e[23]=b):b=e[23];let P;return e[24]!==b||e[25]!==w||e[26]!==C||e[27]!==v?(P=t.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[w,C,v,b]}),e[24]=b,e[25]=w,e[26]=C,e[27]=v,e[28]=P):P=e[28],P}function Gt(o){const e=o;return{name:e.name||"",description:e.description||void 0}}function Wt(o,e){if(!o||!e)return;const s=e.toLowerCase();return o.find(r=>r.app_name?.toLowerCase()===s||r.app_id?.toLowerCase()===s||r.title.toLowerCase()===s)||o.find(r=>r.title.toLowerCase().includes(s))}function qt(o,e,s,r,n){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:r?.icon||void 0,count:n??o.length};const i=e.toLowerCase(),c=o.filter(d=>(d._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":d.publisher||d._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:s?.icon||c[0]?.publisher_logo||c[0]?.icon||void 0,count:c.length}}function Kt(o){const e=o._meta?.["mcp.mesh"],s=o._meta?.["io.modelcontextprotocol.registry/official"],r=o.server,n=ht(r.remotes?.[0]?.type),i=gt(r.$schema),c=s?"io.modelcontextprotocol.registry/official":o.publisher||e?.scopeName||"Unknown",u=pt(r.repository),d=o.icon||o.image||o.logo||r.icons?.[0]?.src||u||null,m=o.name||o.title||o.server?.title||"Unnamed Item",I=Qe(m),p=e?.friendly_name||I,S=e?.mesh_description||o.description||o.summary||r?.description||"",j=e?.short_description||null,y=e?.tags||[],f=e?.categories||[];return{name:p,description:S,shortDescription:j,icon:d,verified:o.verified||e?.verified,publisher:c,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:i??null,connectionType:n,connectionUrl:null,remoteUrl:null,tags:y,categories:f,tools:o.tools||r.tools||e?.tools||[],models:o.models||r.models||e?.models||[],emails:o.emails||r.emails||e?.emails||[],analytics:o.analytics||r.analytics||e?.analytics,cdn:o.cdn||r.cdn||e?.cdn}}class Qt extends F.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,s){console.error("Store MCP server detail error:",e,s)}render(){return this.state.hasError?t.jsx(jt,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function Yt(){const{org:o}=he(),e=ge(),{appName:s}=ke({strict:!1}),{registryId:r,serverName:n,stdio:i}=Le({strict:!1}),[c,u]=ct(dt.storeShowStdio(),()=>!1),d=i==="true"?!0:i==="false"?!1:c;i!==void 0&&i==="true"!==c&&u(i==="true");const[m,I]=F.useState(null),[p,S]=F.useState(null),j=rt(),y=nt(),{data:f}=Pe.useSession(),N=st(y),h=r||N[0]?.id||"",x=it(h),g=xt(x?.tools),_=x?.tools&&x.tools.find(L=>L.name.endsWith("_VERSIONS"))?.name||"",w=x?.tools&&x.tools.find(L=>L.name.endsWith("_GET"))?.name||"",C=!!n;let v="",b={};C?(v=_||w,b={name:n}):(v=g,b={});const P=lt({connectionId:h||null,orgId:o.id}),{data:a}=at({client:P,toolName:v,toolArguments:b,select:l=>l.structuredContent??l});let M=[],V=[],H=null;if(a){if(Array.isArray(a))M=a;else if(typeof a=="object"&&a!==null)if("totalCount"in a&&typeof a.totalCount=="number"&&(H=a.totalCount),"item"in a&&a.item){const l=a.item;M=[{id:l.id||"",title:l.title,server:l.server,_meta:l._meta}]}else{let l;"versions"in a&&Array.isArray(a.versions)?l="versions":"servers"in a&&Array.isArray(a.servers)?l="servers":l=Object.keys(a).find(L=>Array.isArray(a[L])),l&&(M=a[l],(l==="versions"||v?.includes("VERSIONS"))&&(V=M))}}const K=(()=>{const l=V.findIndex(L=>L._meta?.["io.modelcontextprotocol.registry/official"]?.isLatest===!0);return l>=0?l:0})(),R=p??K;let k=M.find(l=>{const L=l.name||l.title||l.server.title||"";return ft(L)===s});!k&&n&&(k=M.find(l=>l.server.name===n||l.name===n||l.title===n));const T=k?Kt(k):null,A=(T?.tools?.length||0)>0,D=k?.server?.remotes?.[0]?.url||null,U=!A&&!!D,z=ot({queryKey:Me.remoteMcpTools(D),queryFn:async()=>{if(!D)return[];const{Client:l}=await ce(async()=>{const{Client:$}=await import("./index-D4MF_YMK.js").then(q=>q.cg);return{Client:$}},__vite__mapDeps([0,1])),{StreamableHTTPClientTransport:L}=await ce(async()=>{const{StreamableHTTPClientTransport:$}=await import("./index-CoTLSWKV.js");return{StreamableHTTPClientTransport:$}},__vite__mapDeps([2,0,1,3,4,5,6,7,8,9,10])),W=new l({name:"mesh-store",version:"1.0.0"}),ee=new L(new URL(D),{requestInit:{headers:{Accept:"application/json, text/event-stream","Content-Type":"application/json"}}});try{return await W.connect(ee),((await W.listTools()).tools||[]).map(q=>({name:q.name,description:q.description}))}finally{await W.close().catch(console.error)}},enabled:U}),O=U&&z.isLoading,G=z.data??[],B=A?T?.tools||[]:G,X=Wt(y,T?.publisher),Z=T?qt(M,T.publisher,X,x??null,H):{count:0},se=T?.repository?ut(T.repository):null,ne=k?.server?.remotes??[],J=k?.server?.packages??[],oe=[...ne.map((l,L)=>({...l,_type:"remote",_index:L})),...J.map((l,L)=>({type:"stdio",url:void 0,name:l.name||l.identifier,title:l.name||l.identifier?.replace(/^@[^/]+\//,""),description:l.environmentVariables?.length?`Requires ${l.environmentVariables.length} environment variable(s)`:void 0,_type:"package",_index:L}))],ie=d?oe:oe.filter(l=>l.type?.toLowerCase()!=="stdio"),le=ie.length>1,Q=[{id:"servers",label:"Servers",count:ie.length,visible:le},{id:"readme",label:"README",visible:!!T?.repository&&!!se},{id:"tools",label:"Tools",count:B.length,visible:A||G.length>0||O&&!!D}].filter(l=>l.visible),ye=Q.find(l=>l.id==="servers")?.id||Q.find(l=>l.id==="readme")?.id||Q[0]?.id||"overview",Ne=m&&Q.find(l=>l.id===m)?m:ye,re=async(l,L,W)=>{const ee=V[l??0]||k;if(!ee||!o||!f?.user?.id)return;const $=mt(ee,o.id,f.user.id,{remoteIndex:W===void 0?L??0:void 0,packageIndex:W}),q=$.connection_type==="STDIO",_e=!!$.connection_url,Te=q&&$.connection_headers&&typeof $.connection_headers=="object"&&"command"in $.connection_headers;if(!_e&&!Te){de.error("This MCP Server cannot be connected: no connection method available");return}try{const{id:Y}=await j.create.mutateAsync($);e({to:"/$org/mcps/$connectionId",params:{org:o.slug,connectionId:Y}})}catch(Y){de.error(`Failed to connect MCP Server: ${Y instanceof Error?Y.message:String(Y)}`)}},Ce=()=>{e({to:"/$org/store",params:{org:o.slug}})};if(!k)return t.jsx(yt,{onBack:Ce});if(!T)return null;const Se=(k?.server?.remotes?.length??0)>0,we=(k?.server?.packages?.length??0)>0,ae=Se||we,Ie=t.jsx(Xe,{children:t.jsxs(Ze,{children:[t.jsx(pe,{children:t.jsx(Je,{asChild:!0,children:t.jsx(Ve,{to:"/$org/store",params:{org:o.slug},children:"Store"})})}),t.jsx(et,{}),t.jsx(pe,{children:t.jsx(tt,{children:T.name})})]})});return t.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[t.jsx(Nt,{breadcrumb:Ie}),t.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.jsx("div",{className:"h-full",children:t.jsxs("div",{className:"h-full",children:[!ae&&t.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[t.jsx(vt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t.jsx(Ct,{data:T,itemVersions:V.length>0?V:[k],onInstall:re,canInstall:ae,isInstalling:j.create.isPending,hideInstallControls:le,selectedVersionIndex:R,onVersionChange:S}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[t.jsx(_t,{data:T,publisherInfo:Z,selectedItem:k}),t.jsx(Ht,{data:T,availableTabs:Q,effectiveActiveTabId:Ne,effectiveTools:B,isLoadingTools:O,onTabChange:I,servers:oe,onInstallServer:l=>{l._type==="remote"?re(R,l._index,void 0):re(R,void 0,l._index)},isInstalling:j.create.isPending,mcpIcon:T.icon,mcpName:T.name,showStdio:d})]})]})})})]})}function Gs(){const o=E.c(6),{org:e}=he(),s=ge();let r;o[0]!==s||o[1]!==e.slug?(r=()=>{s({to:"/$org/store",params:{org:e.slug}})},o[0]=s,o[1]=e.slug,o[2]=r):r=o[2];const n=r;let i;o[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(F.Suspense,{fallback:t.jsx(bt,{}),children:t.jsx(Yt,{})}),o[3]=i):i=o[3];let c;return o[4]!==n?(c=t.jsx(Qt,{onBack:n,children:i}),o[4]=n,o[5]=c):c=o[5],c}export{Gs as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CHQ9-Q-G.js","assets/index-Cy9rBAOX.css","assets/index-CNwEt7K8.js","assets/use-connection-UwIAiUmR.js","assets/useMutation-C8K1KoTI.js","assets/constants-DwkB1age.js","assets/use-mcp-tools-BKgKiBFS.js","assets/useQuery-CImYAWdS.js","assets/use-mcp-prompts-DDPkiTOB.js","assets/use-virtual-mcp-BIZk_q3v.js","assets/mcp-oauth-i2Um3a9A.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as F,c as E,j as t,u as he,v as ge,a as ke,f as Le,g as Pe,bo as ce,K as Me,l as Ve,t as de}from"./index-CHQ9-Q-G.js";import{i as De}from"./AlertCircle-CrLCfZT0.js";import{i as ve}from"./Loading01-3CQcIIbt.js";import{P as me}from"./index-aWpPBjkT.js";import{I as be,E as Ee}from"./empty-state-VwVcPCE1.js";import{B as te,c as $e}from"./button-CKIyuXIq.js";import{i as Re}from"./CheckCircle-BoFrCz54.js";import{t as Ae}from"./ChevronDown-DeD12W57.js";import{s as fe}from"./Plus-CP35U6Iv.js";import{a as Be,c as Ue,b as ze,D as Oe}from"./dropdown-menu-CoO02CsY.js";import{n as ue}from"./LinkExternal01-D33uvRa3.js";import{T as Fe,R as He}from"./tools-list-DGAPFCDO.js";import{C as Ge}from"./collection-tabs-Dd6S7hPE.js";import{s as We}from"./Globe02-BhcJ1ruM.js";import{a as qe,b as Ke,e as Qe}from"./mcp-server-card-B_tcMycX.js";import{i as Ye}from"./Terminal-Djd_0g5K.js";import{B as Xe,a as Ze,b as pe,c as Je,d as et,e as tt}from"./breadcrumb-CJBikxW8.js";import{u as st}from"./use-binding-HsWp1jWu.js";import{u as ot}from"./useQuery-CImYAWdS.js";import{g as rt,h as nt,f as it}from"./use-connection-UwIAiUmR.js";import{u as lt}from"./constants-DwkB1age.js";import{u as at}from"./use-mcp-tools-BKgKiBFS.js";import{u as ct,L as dt}from"./localstorage-keys-BiLB-Ybm.js";import{e as mt}from"./extract-connection-data-DwTMOpOf.js";import{s as ft}from"./slugify-CEUa2lfQ.js";import{e as ut,g as pt}from"./github-icon-Dp3wHhYE.js";import{f as xt,g as ht,c as gt}from"./registry-utils-TFnNkGPj.js";import{i as vt}from"./InfoCircle-DzQgROgs.js";import"./ChevronRight-8Yl-zCCi.js";import"./File06-iSPwdYi1.js";import"./collection-table-wrapper-CzqGMTIb.js";import"./ArrowUp-deTSI0E8.js";import"./Check-DTUUSvp-.js";import"./Grid01-B9LzvODL.js";import"./List-C1dM-VCr.js";import"./view-mode-toggle-BiRjYen1.js";import"./table-CBtv9zrT.js";import"./collection-search-CECpIAiD.js";import"./SearchMd-DTs0TtNF.js";import"./input-BrgRsDcE.js";import"./card-MU9VbmJ4.js";import"./layout-D8nQ7DGi.js";import"./badge-DIFY1rsD.js";import"./Lock01-aFdw7wqo.js";import"./binder-Dg2rfYkp.js";import"./useMutation-C8K1KoTI.js";import"./constants-DBJOqOcW.js";import"./generate-id-Dyweu44Y.js";const je=({size:o=24,color:e="currentColor",...s})=>F.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},F.createElement("path",{d:"m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"}));je.displayName="SearchLg";function bt(o){const e=E.c(3),{message:s}=o,r=s===void 0?"Loading MCP Server details...":s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(ve,{size:48,className:"animate-spin mb-4"}),e[0]=n):n=e[0];let i;return e[1]!==r?(i=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,t.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),e[1]=r,e[2]=i):i=e[2],i}function jt(o){const e=E.c(9),{error:s,onBack:r}=o,n=s instanceof Error?s.message:s;let i,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(De,{size:48,className:"text-destructive mb-4"}),c=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading MCP Server"}),e[0]=i,e[1]=c):(i=e[0],c=e[1]);let u;e[2]!==n?(u=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:n}),e[2]=n,e[3]=u):u=e[3];let d;e[4]!==r?(d=t.jsx("button",{onClick:r,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back"}),e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==u||e[7]!==d?(m=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,c,u,d]}),e[6]=u,e[7]=d,e[8]=m):m=e[8],m}function yt(o){const e=E.c(5),{onBack:s}=o;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(je,{size:48,className:"text-muted-foreground mb-4"}),n=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"MCP Server not found"}),i=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"The MCP Server you're looking for doesn't exist in this store."}),e[0]=r,e[1]=n,e[2]=i):(r=e[0],n=e[1],i=e[2]);let c;return e[3]!==s?(c=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,n,i,t.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back to Store"})]}),e[3]=s,e[4]=c):c=e[4],c}function Nt(o){const e=E.c(2),{breadcrumb:s}=o;let r;return e[0]!==s?(r=t.jsx(me.Header,{children:t.jsx(me.Header.Left,{children:s})}),e[0]=s,e[1]=r):r=e[1],r}function xe(o){const e=E.c(28),{versions:s,selectedIndex:r,onSelect:n,isInstalling:i,variant:c,showLabel:u}=o,d=i===void 0?!1:i,m=c===void 0?"brand":c,I=u===void 0?!1:u,p=s[r],S=I?"sm":"default",j=m==="brand"&&"rounded-l-none px-2 border-l-2 border-l-white/50";let y;e[0]!==j?(y=$e("shrink-0 cursor-pointer",j),e[0]=j,e[1]=y):y=e[1];let f;e[2]!==p?.server?.version||e[3]!==I?(f=I&&t.jsxs("span",{className:"mr-1",children:["v",p?.server?.version||"unknown"]}),e[2]=p?.server?.version,e[3]=I,e[4]=f):f=e[4];const N=I?14:20;let h;e[5]!==N?(h=t.jsx(Ae,{size:N}),e[5]=N,e[6]=h):h=e[6];let x;e[7]!==d||e[8]!==S||e[9]!==y||e[10]!==f||e[11]!==h||e[12]!==m?(x=t.jsx(Be,{asChild:!0,children:t.jsxs(te,{variant:m,disabled:d,size:S,className:y,children:[f,h]})}),e[7]=d,e[8]=S,e[9]=y,e[10]=f,e[11]=h,e[12]=m,e[13]=x):x=e[13];let g;if(e[14]!==d||e[15]!==n||e[16]!==r||e[17]!==s){let C;e[19]!==d||e[20]!==n||e[21]!==r?(C=(v,b)=>{const P=v._meta?.["io.modelcontextprotocol.registry/official"];return t.jsx(Ue,{onClick:()=>n(b),disabled:d,className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"font-medium text-sm",children:["v",v.server?.version||"unknown"]}),P?.isLatest&&t.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),b===r&&t.jsx(Re,{size:16,className:"text-muted-foreground shrink-0"})]})},b)},e[19]=d,e[20]=n,e[21]=r,e[22]=C):C=e[22],g=s.map(C),e[14]=d,e[15]=n,e[16]=r,e[17]=s,e[18]=g}else g=e[18];let _;e[23]!==g?(_=t.jsx(ze,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:g}),e[23]=g,e[24]=_):_=e[24];let w;return e[25]!==x||e[26]!==_?(w=t.jsxs(Oe,{children:[x,_]}),e[25]=x,e[26]=_,e[27]=w):w=e[27],w}function Ct(o){const e=E.c(46),{data:s,itemVersions:r,onInstall:n,canInstall:i,isInstalling:c,hideInstallControls:u,selectedVersionIndex:d,onVersionChange:m}=o,I=i===void 0?!0:i,p=c===void 0?!1:c,S=u===void 0?!1:u,[j,y]=F.useState(0),f=d??j;let N;e[0]!==m?(N=B=>{y(B),m?.(B)},e[0]=m,e[1]=N):N=e[1];const h=N,x=r[f]||r[0];let g;e[2]!==x?.server?.remotes?(g=x?.server?.remotes??[],e[2]=x?.server?.remotes,e[3]=g):g=e[3];const _=g;let w;e[4]!==x?.server?.packages?(w=x?.server?.packages??[],e[4]=x?.server?.packages,e[5]=w):w=e[5];const v=w.length>0,b=_.length>0,P=_.findIndex(wt),a=P>=0?P:0;let M;e[6]!==a||e[7]!==v||e[8]!==b||e[9]!==n||e[10]!==f?(M=()=>{b?n(f,a,void 0):v&&n(f,void 0,0)},e[6]=a,e[7]=v,e[8]=b,e[9]=n,e[10]=f,e[11]=M):M=e[11];const V=M;let H;e[12]!==r||e[13]!==n||e[14]!==h?(H=B=>{h(B);const X=r[B],Z=X?.server?.remotes??[],se=X?.server?.packages??[];if(Z.length>0){const J=Z.findIndex(St);n(B,J>=0?J:0,void 0)}else se.length>0&&n(B,void 0,0)},e[12]=r,e[13]=n,e[14]=h,e[15]=H):H=e[15];const K=H;let R;e[16]!==s.icon||e[17]!==s.name?(R=t.jsx(be,{icon:s.icon,name:s.name,size:"lg",className:"shrink-0 shadow-sm"}),e[16]=s.icon,e[17]=s.name,e[18]=R):R=e[18];let k;e[19]!==s.name?(k=t.jsx("h1",{className:"text-3xl font-medium",children:s.name}),e[19]=s.name,e[20]=k):k=e[20];let T;e[21]!==s.verified?(T=s.verified&&t.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[21]=s.verified,e[22]=T):T=e[22];let A;e[23]!==k||e[24]!==T?(A=t.jsxs("div",{className:"flex items-center gap-2",children:[k,T]}),e[23]=k,e[24]=T,e[25]=A):A=e[25];let D;e[26]!==s.shortDescription?(D=s.shortDescription&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.shortDescription}),e[26]=s.shortDescription,e[27]=D):D=e[27];let U;e[28]!==A||e[29]!==D?(U=t.jsxs("div",{className:"flex-1 min-w-0",children:[A,D]}),e[28]=A,e[29]=D,e[30]=U):U=e[30];let z;e[31]!==I||e[32]!==V||e[33]!==K||e[34]!==S||e[35]!==p||e[36]!==r||e[37]!==f||e[38]!==h?(z=I&&!S?t.jsx("div",{className:"shrink-0 flex items-center gap-2",children:r.length>1?t.jsxs("div",{className:"flex",children:[t.jsxs(te,{variant:"brand",onClick:V,disabled:p,className:"shrink-0 rounded-r-none cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]}),t.jsx(xe,{versions:r,selectedIndex:f,onSelect:K,isInstalling:p,variant:"brand"})]}):t.jsxs(te,{variant:"brand",onClick:V,disabled:r.length===0||p,className:"shrink-0 cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]})}):S?r.length>1?t.jsx("div",{className:"shrink-0",children:t.jsx(xe,{versions:r,selectedIndex:f,onSelect:h,isInstalling:p,variant:"outline",showLabel:!0})}):null:t.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[31]=I,e[32]=V,e[33]=K,e[34]=S,e[35]=p,e[36]=r,e[37]=f,e[38]=h,e[39]=z):z=e[39];let O;e[40]!==U||e[41]!==z?(O=t.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[U,z]}),e[40]=U,e[41]=z,e[42]=O):O=e[42];let G;return e[43]!==O||e[44]!==R?(G=t.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[R,O]}),e[43]=O,e[44]=R,e[45]=G):G=e[45],G}function St(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function wt(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function It(o){if(!o)return"—";try{const e=new Date(o);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function _t(o){const e=E.c(47),{data:s,publisherInfo:r,selectedItem:n}=o;let i;e[0]!==s.description?(i=s.description&&t.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[t.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.description})]}),e[0]=s.description,e[1]=i):i=e[1];const c=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher;let u;e[2]!==r.logo||e[3]!==c?(u=t.jsx(be,{icon:r.logo,name:c,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=r.logo,e[3]=c,e[4]=u):u=e[4];let d;e[5]!==s.publisher?(d=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher.charAt(0).toUpperCase()+s.publisher.slice(1),e[5]=s.publisher,e[6]=d):d=e[6];let m;e[7]!==d?(m=t.jsx("div",{className:"font-medium",children:d}),e[7]=d,e[8]=m):m=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"text-xs text-muted-foreground",children:"Publisher"}),e[9]=I):I=e[9];let p;e[10]!==m?(p=t.jsxs("div",{children:[m,I]}),e[10]=m,e[11]=p):p=e[11];let S;e[12]!==u||e[13]!==p?(S=t.jsx("div",{className:"px-5 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-3 py-5",children:[u,p]})}),e[12]=u,e[13]=p,e[14]=S):S=e[14];let j;e[15]!==s.version?(j=s.version&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Version"}),t.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",s.version]})]}),e[15]=s.version,e[16]=j):j=e[16];let y;e[17]!==s.tags?(y=s.tags&&s.tags.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.tags.map(kt)})]}),e[17]=s.tags,e[18]=y):y=e[18];let f;e[19]!==s.categories?(f=s.categories&&s.categories.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Categories"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.categories.map(Tt)})]}),e[19]=s.categories,e[20]=f):f=e[20];let N;e[21]!==s.connectionType?(N=s.connectionType&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:s.connectionType})]}),e[21]=s.connectionType,e[22]=N):N=e[22];let h;e[23]!==s.schemaVersion?(h=s.schemaVersion&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),t.jsx("span",{className:"text-muted-foreground text-xs",children:s.schemaVersion})]}),e[23]=s.schemaVersion,e[24]=h):h=e[24];let x;e[25]!==s.websiteUrl?(x=s.websiteUrl&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Website"}),t.jsxs("a",{href:s.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"Visit"}),t.jsx(ue,{size:14})]})]}),e[25]=s.websiteUrl,e[26]=x):x=e[26];let g;e[27]!==s.repository?(g=s.repository?.url&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Source"}),t.jsxs("a",{href:s.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"GitHub"}),t.jsx(ue,{size:14})]})]}),e[27]=s.repository,e[28]=g):g=e[28];let _;e[29]!==y||e[30]!==f||e[31]!==N||e[32]!==h||e[33]!==x||e[34]!==g||e[35]!==j?(_=t.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[j,y,f,N,h,x,g]}),e[29]=y,e[30]=f,e[31]=N,e[32]=h,e[33]=x,e[34]=g,e[35]=j,e[36]=_):_=e[36];let w;e[37]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[37]=w):w=e[37];let C;e[38]!==n.updated_at?(C=It(n.updated_at),e[38]=n.updated_at,e[39]=C):C=e[39];let v;e[40]!==C?(v=t.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[w,t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:C})]}),e[40]=C,e[41]=v):v=e[41];let b;return e[42]!==i||e[43]!==_||e[44]!==v||e[45]!==S?(b=t.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,S,_,v]}),e[42]=i,e[43]=_,e[44]=v,e[45]=S,e[46]=b):b=e[46],b}function Tt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}function kt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}const Lt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],Pt={docs:"Documentation",bindings:"Workers Bindings",builds:"Workers Builds",observability:"Observability",radar:"Radar",containers:"Containers",browser:"Browser Rendering",logs:"Logpush",autorag:"AutoRAG",auditlogs:"Audit Logs",graphql:"GraphQL",dex:"DEX Monitoring",casb:"CASB"};function Mt(o){if(!o)return"Local";try{return new URL(o).hostname}catch{return o}}function Vt(o){if(!o)return"local";try{const e=new URL(o).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function Dt(o){const e=Pt[o.toLowerCase()];return e||o.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Et(o){if(!o)return"http";const e=o.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function $t(o){return o.map((e,s)=>{const r=Et(e.type),n=Mt(e.url),i=Vt(e.url),c=e.title||e.name||Dt(i);return{index:s,protocol:r,url:e.url,hostname:n,serviceName:i,displayName:c,name:e.name,title:e.title,description:e.description,_type:e._type,_index:e._index}})}function Rt(o){const e=E.c(2),{protocol:s,className:r}=o;let n;return e[0]!==r?(n={http:t.jsx(We,{className:r}),sse:t.jsx(Ke,{className:r}),stdio:t.jsx(Ye,{className:r})},e[0]=r,e[1]=n):n=e[1],n[s]}function At(o){const e=E.c(10),{options:s,selected:r,onSelect:n}=o;if(s.length<=1)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"text-sm text-muted-foreground",children:"Protocol:"}),e[0]=i):i=e[0];let c;if(e[1]!==n||e[2]!==s||e[3]!==r){let d;e[5]!==n||e[6]!==r?(d=m=>t.jsxs(te,{variant:r===m.value?"default":"outline",size:"sm",onClick:()=>n(m.value),className:"cursor-pointer",children:[t.jsx(Rt,{protocol:m.value==="all"?"http":m.value,className:"w-4 h-4 mr-1"}),m.label]},m.value),e[5]=n,e[6]=r,e[7]=d):d=e[7],c=s.map(d),e[1]=n,e[2]=s,e[3]=r,e[4]=c}else c=e[4];let u;return e[8]!==c?(u=t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i,t.jsx("div",{className:"flex gap-1",children:c})]}),e[8]=c,e[9]=u):u=e[9],u}function Bt(o){const e=E.c(11),{servers:s,onInstall:r,isInstalling:n,icon:i,mcpName:c,showStdio:u}=o,d=n===void 0?!1:n,m=u===void 0?!1:u,I=m?s:s.filter(Ft),p=$t(I),S=p.length<13?"all":"http",[j,y]=F.useState(S);let f;e:{if(j==="all"){f="all";break e}let a;if(e[0]!==j?(a=V=>V.protocol===j,e[0]=j,e[1]=a):a=e[1],p.some(a)){f=j;break e}if(p.length<13){f="all";break e}f=p[0]?.protocol??"http"}const N=f,h=N==="all"?p:p.filter(a=>a.protocol===N),x=new Set(p.map(Ot));let g=Lt.filter(a=>a.value==="all"||x.has(a.value));m||(g=g.filter(zt));const _=x.size<=1?g.filter(Ut):g,w="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4";let C;e[2]!==i||e[3]!==d||e[4]!==c||e[5]!==r?(C=a=>t.jsx(qe,{variant:"server",icon:i??null,displayName:a.displayName,description:a.description??null,hostname:a.hostname,protocol:a.protocol,isInstalling:d,onClick:()=>r({type:a.protocol,url:a.url,name:a.name,title:a.title,description:a.description,_type:a._type,_index:a._index})},`${a.hostname}-${a.protocol}-${a.index}`),e[2]=i,e[3]=d,e[4]=c,e[5]=r,e[6]=C):C=e[6];const v=h.map(C);let b;e[7]!==v?(b=t.jsx("div",{className:w,children:v}),e[7]=v,e[8]=b):b=e[8];let P;return e[9]!==h.length?(P=h.length===0&&t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No servers match the selected filter."}),e[9]=h.length,e[10]=P):P=e[10],t.jsxs("div",{className:"p-5",children:[t.jsx(At,{options:_,selected:N,onSelect:y}),b,P]})}function Ut(o){return o.value!=="all"}function zt(o){return o.value!=="stdio"}function Ot(o){return o.protocol}function Ft(o){return o.type?.toLowerCase()!=="stdio"}function Ht(o){const e=E.c(29),{data:s,availableTabs:r,effectiveActiveTabId:n,effectiveTools:i,isLoadingTools:c,onTabChange:u,servers:d,onInstallServer:m,isInstalling:I,mcpIcon:p,mcpName:S,showStdio:j}=o,y=c===void 0?!1:c;let f;e[0]!==d?(f=d===void 0?[]:d,e[0]=d,e[1]=f):f=e[1];const N=f,h=I===void 0?!1:I,x=j===void 0?!1:j;let g;e[2]!==i?(g=i.map(Gt),e[2]=i,e[3]=g):g=e[3];const _=g;let w;e[4]!==r||e[5]!==n||e[6]!==u?(w=r.length>0&&t.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:t.jsx(Ge,{tabs:r,activeTab:n,onTabChange:u})}),e[4]=r,e[5]=n,e[6]=u,e[7]=w):w=e[7];let C;e[8]!==n||e[9]!==h||e[10]!==p||e[11]!==S||e[12]!==m||e[13]!==N||e[14]!==x?(C=n==="servers"&&N.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(Bt,{servers:N,onInstall:a=>m?.(a),isInstalling:h,icon:p,mcpName:S,showStdio:x})}),e[8]=n,e[9]=h,e[10]=p,e[11]=S,e[12]=m,e[13]=N,e[14]=x,e[15]=C):C=e[15];let v;e[16]!==n||e[17]!==i.length||e[18]!==y||e[19]!==_?(v=n==="tools"&&t.jsx("div",{className:"flex flex-col flex-1",children:y?t.jsxs("div",{className:"flex items-center justify-center p-8",children:[t.jsx(ve,{size:24,className:"animate-spin"}),t.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?t.jsx(Fe,{tools:_,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):t.jsx(Ee,{image:null,title:"No tools available",description:"This MCP Server doesn't have any tools."})}),e[16]=n,e[17]=i.length,e[18]=y,e[19]=_,e[20]=v):v=e[20];let b;e[21]!==s?.repository||e[22]!==n?(b=n==="readme"&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(He,{repository:s?.repository})}),e[21]=s?.repository,e[22]=n,e[23]=b):b=e[23];let P;return e[24]!==b||e[25]!==w||e[26]!==C||e[27]!==v?(P=t.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[w,C,v,b]}),e[24]=b,e[25]=w,e[26]=C,e[27]=v,e[28]=P):P=e[28],P}function Gt(o){const e=o;return{name:e.name||"",description:e.description||void 0}}function Wt(o,e){if(!o||!e)return;const s=e.toLowerCase();return o.find(r=>r.app_name?.toLowerCase()===s||r.app_id?.toLowerCase()===s||r.title.toLowerCase()===s)||o.find(r=>r.title.toLowerCase().includes(s))}function qt(o,e,s,r,n){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:r?.icon||void 0,count:n??o.length};const i=e.toLowerCase(),c=o.filter(d=>(d._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":d.publisher||d._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:s?.icon||c[0]?.publisher_logo||c[0]?.icon||void 0,count:c.length}}function Kt(o){const e=o._meta?.["mcp.mesh"],s=o._meta?.["io.modelcontextprotocol.registry/official"],r=o.server,n=ht(r.remotes?.[0]?.type),i=gt(r.$schema),c=s?"io.modelcontextprotocol.registry/official":o.publisher||e?.scopeName||"Unknown",u=pt(r.repository),d=o.icon||o.image||o.logo||r.icons?.[0]?.src||u||null,m=o.name||o.title||o.server?.title||"Unnamed Item",I=Qe(m),p=e?.friendly_name||I,S=e?.mesh_description||o.description||o.summary||r?.description||"",j=e?.short_description||null,y=e?.tags||[],f=e?.categories||[];return{name:p,description:S,shortDescription:j,icon:d,verified:o.verified||e?.verified,publisher:c,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:i??null,connectionType:n,connectionUrl:null,remoteUrl:null,tags:y,categories:f,tools:o.tools||r.tools||e?.tools||[],models:o.models||r.models||e?.models||[],emails:o.emails||r.emails||e?.emails||[],analytics:o.analytics||r.analytics||e?.analytics,cdn:o.cdn||r.cdn||e?.cdn}}class Qt extends F.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,s){console.error("Store MCP server detail error:",e,s)}render(){return this.state.hasError?t.jsx(jt,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function Yt(){const{org:o}=he(),e=ge(),{appName:s}=ke({strict:!1}),{registryId:r,serverName:n,stdio:i}=Le({strict:!1}),[c,u]=ct(dt.storeShowStdio(),()=>!1),d=i==="true"?!0:i==="false"?!1:c;i!==void 0&&i==="true"!==c&&u(i==="true");const[m,I]=F.useState(null),[p,S]=F.useState(null),j=rt(),y=nt(),{data:f}=Pe.useSession(),N=st(y),h=r||N[0]?.id||"",x=it(h),g=xt(x?.tools),_=x?.tools&&x.tools.find(L=>L.name.endsWith("_VERSIONS"))?.name||"",w=x?.tools&&x.tools.find(L=>L.name.endsWith("_GET"))?.name||"",C=!!n;let v="",b={};C?(v=_||w,b={name:n}):(v=g,b={});const P=lt({connectionId:h||null,orgId:o.id}),{data:a}=at({client:P,toolName:v,toolArguments:b,select:l=>l.structuredContent??l});let M=[],V=[],H=null;if(a){if(Array.isArray(a))M=a;else if(typeof a=="object"&&a!==null)if("totalCount"in a&&typeof a.totalCount=="number"&&(H=a.totalCount),"item"in a&&a.item){const l=a.item;M=[{id:l.id||"",title:l.title,server:l.server,_meta:l._meta}]}else{let l;"versions"in a&&Array.isArray(a.versions)?l="versions":"servers"in a&&Array.isArray(a.servers)?l="servers":l=Object.keys(a).find(L=>Array.isArray(a[L])),l&&(M=a[l],(l==="versions"||v?.includes("VERSIONS"))&&(V=M))}}const K=(()=>{const l=V.findIndex(L=>L._meta?.["io.modelcontextprotocol.registry/official"]?.isLatest===!0);return l>=0?l:0})(),R=p??K;let k=M.find(l=>{const L=l.name||l.title||l.server.title||"";return ft(L)===s});!k&&n&&(k=M.find(l=>l.server.name===n||l.name===n||l.title===n));const T=k?Kt(k):null,A=(T?.tools?.length||0)>0,D=k?.server?.remotes?.[0]?.url||null,U=!A&&!!D,z=ot({queryKey:Me.remoteMcpTools(D),queryFn:async()=>{if(!D)return[];const{Client:l}=await ce(async()=>{const{Client:$}=await import("./index-CHQ9-Q-G.js").then(q=>q.cg);return{Client:$}},__vite__mapDeps([0,1])),{StreamableHTTPClientTransport:L}=await ce(async()=>{const{StreamableHTTPClientTransport:$}=await import("./index-CNwEt7K8.js");return{StreamableHTTPClientTransport:$}},__vite__mapDeps([2,0,1,3,4,5,6,7,8,9,10])),W=new l({name:"mesh-store",version:"1.0.0"}),ee=new L(new URL(D),{requestInit:{headers:{Accept:"application/json, text/event-stream","Content-Type":"application/json"}}});try{return await W.connect(ee),((await W.listTools()).tools||[]).map(q=>({name:q.name,description:q.description}))}finally{await W.close().catch(console.error)}},enabled:U}),O=U&&z.isLoading,G=z.data??[],B=A?T?.tools||[]:G,X=Wt(y,T?.publisher),Z=T?qt(M,T.publisher,X,x??null,H):{count:0},se=T?.repository?ut(T.repository):null,ne=k?.server?.remotes??[],J=k?.server?.packages??[],oe=[...ne.map((l,L)=>({...l,_type:"remote",_index:L})),...J.map((l,L)=>({type:"stdio",url:void 0,name:l.name||l.identifier,title:l.name||l.identifier?.replace(/^@[^/]+\//,""),description:l.environmentVariables?.length?`Requires ${l.environmentVariables.length} environment variable(s)`:void 0,_type:"package",_index:L}))],ie=d?oe:oe.filter(l=>l.type?.toLowerCase()!=="stdio"),le=ie.length>1,Q=[{id:"servers",label:"Servers",count:ie.length,visible:le},{id:"readme",label:"README",visible:!!T?.repository&&!!se},{id:"tools",label:"Tools",count:B.length,visible:A||G.length>0||O&&!!D}].filter(l=>l.visible),ye=Q.find(l=>l.id==="servers")?.id||Q.find(l=>l.id==="readme")?.id||Q[0]?.id||"overview",Ne=m&&Q.find(l=>l.id===m)?m:ye,re=async(l,L,W)=>{const ee=V[l??0]||k;if(!ee||!o||!f?.user?.id)return;const $=mt(ee,o.id,f.user.id,{remoteIndex:W===void 0?L??0:void 0,packageIndex:W}),q=$.connection_type==="STDIO",_e=!!$.connection_url,Te=q&&$.connection_headers&&typeof $.connection_headers=="object"&&"command"in $.connection_headers;if(!_e&&!Te){de.error("This MCP Server cannot be connected: no connection method available");return}try{const{id:Y}=await j.create.mutateAsync($);e({to:"/$org/mcps/$connectionId",params:{org:o.slug,connectionId:Y}})}catch(Y){de.error(`Failed to connect MCP Server: ${Y instanceof Error?Y.message:String(Y)}`)}},Ce=()=>{e({to:"/$org/store",params:{org:o.slug}})};if(!k)return t.jsx(yt,{onBack:Ce});if(!T)return null;const Se=(k?.server?.remotes?.length??0)>0,we=(k?.server?.packages?.length??0)>0,ae=Se||we,Ie=t.jsx(Xe,{children:t.jsxs(Ze,{children:[t.jsx(pe,{children:t.jsx(Je,{asChild:!0,children:t.jsx(Ve,{to:"/$org/store",params:{org:o.slug},children:"Store"})})}),t.jsx(et,{}),t.jsx(pe,{children:t.jsx(tt,{children:T.name})})]})});return t.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[t.jsx(Nt,{breadcrumb:Ie}),t.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.jsx("div",{className:"h-full",children:t.jsxs("div",{className:"h-full",children:[!ae&&t.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[t.jsx(vt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t.jsx(Ct,{data:T,itemVersions:V.length>0?V:[k],onInstall:re,canInstall:ae,isInstalling:j.create.isPending,hideInstallControls:le,selectedVersionIndex:R,onVersionChange:S}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[t.jsx(_t,{data:T,publisherInfo:Z,selectedItem:k}),t.jsx(Ht,{data:T,availableTabs:Q,effectiveActiveTabId:Ne,effectiveTools:B,isLoadingTools:O,onTabChange:I,servers:oe,onInstallServer:l=>{l._type==="remote"?re(R,l._index,void 0):re(R,void 0,l._index)},isInstalling:j.create.isPending,mcpIcon:T.icon,mcpName:T.name,showStdio:d})]})]})})})]})}function Gs(){const o=E.c(6),{org:e}=he(),s=ge();let r;o[0]!==s||o[1]!==e.slug?(r=()=>{s({to:"/$org/store",params:{org:e.slug}})},o[0]=s,o[1]=e.slug,o[2]=r):r=o[2];const n=r;let i;o[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(F.Suspense,{fallback:t.jsx(bt,{}),children:t.jsx(Yt,{})}),o[3]=i):i=o[3];let c;return o[4]!==n?(c=t.jsx(Qt,{onBack:n,children:i}),o[4]=n,o[5]=c):c=o[5],c}export{Gs as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as D,c as le,j as s,p as Yt,u as Ce,g as ae,K as ce,o as Et,ad as at,s as ve,ba as Xt,bg as Jt,F as we,k as Dt,h as Wt,t as ne,E as es}from"./index-D4MF_YMK.js";import{C as ts,a as ss}from"./collection-table-wrapper-DJPMRDfl.js";import{C as Ke}from"./collection-search-DsJ7tYYh.js";import{P as Ne}from"./index-Dv6ogWGy.js";import{B as ns,a as rs,b as is,e as os}from"./breadcrumb-rJChBiJd.js";import{I as zt,c as _e,b as Re,T as Pe,a as Me,E as ct}from"./empty-state-CQfuZLBd.js";import{C as De}from"./checkbox-2HWXGeDR.js";import{c as X,B as ie}from"./button-CQ8Kjf8O.js";import{h as kt}from"./use-connection-zcRZ_mrS.js";import{u as bt,C as dt,a as mt,b as yt,c as ls,d as as,e as cs,f as ds}from"./command-Bkn5ljJp.js";import{u as it}from"./useQuery-BdnAz8Zk.js";import{u as Te}from"./useMutation-Cc1z0I0J.js";import{f as ze,a as ke,b as Ue,c as Ve,d as Be,e as Ge,A as $e,g as Fe,h as Ae}from"./alert-dialog-C5BMlV_B.js";import{B as Ee}from"./badge-obBgL92k.js";import{D as Ut,f as Vt,a as Bt,b as ms,c as us,e as fs}from"./dialog-DNf7oKHG.js";import{D as Ct,a as jt,b as Tt,c as tt,d as hs,e as gs,f as xs,g as ps}from"./dropdown-menu-oqWMuO1Y.js";import{i as bs}from"./DotsHorizontal-DREtot34.js";import{i as st}from"./Loading01-hzhOha89.js";import{i as Cs}from"./Lock01-EOSVXDa6.js";import{s as nt}from"./Plus-DgXpTyQu.js";import{s as Gt}from"./Trash01-CFVOYbE4.js";import{i as St}from"./X-CNmc5JFs.js";import{I as js}from"./input-DTmWYrzg.js";import{S as Xe}from"./switch-C7P9CpyX.js";import{E as Ts}from"./error-boundary-DtmbPa7H.js";import{a as vs,F as It,b as Ot,c as Ns,d as At,f as wt}from"./form-DOuqKZXC.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-D4-WItce.js";import{T as Es}from"./textarea-JbvjK4Se.js";import{a as qe,u as Qe}from"./constants-DZRJwikT.js";import{C as Lt}from"./card-DLwzKTus.js";import{i as $t}from"./DotsVertical-CiHvrgFY.js";import{i as ys}from"./index-CMcaW4mM.js";import{s as Ft}from"./XClose-yK9GZfOf.js";import{a as Ss,b as Is,P as Os}from"./popover-BaiBgi1w.js";import{t as As}from"./ChevronDown-C80wx8LH.js";import"./ArrowUp-DuCoD-_2.js";import"./Check-BecGNPr2.js";import"./Grid01-ClvGNPyN.js";import"./List-BTqXaORG.js";import"./view-mode-toggle-I9cNNgTM.js";import"./table-BQWoR2xQ.js";import"./SearchMd-BrXcSv99.js";import"./ChevronRight-BXGDS3zi.js";const Kt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));Kt.displayName="ArrowLeft";const vt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));vt.displayName="Shield01";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));qt.displayName="SwitchHorizontal01";const Qt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"}],ws={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags"};function Ls(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[]};for(const e of Qt)t[e.category]?.push(e);return t}function _s(){return Qt.map(t=>({value:t.name,label:ws[t.name],dangerous:t.dangerous}))}const Rs=D.memo(function(e){const n=le.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:c,totalToolsCount:i,onSelect:u,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let C;n[0]!==m?(C=X("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=C):C=n[1];let d;n[2]!==r.icon||n[3]!==r.title?(d=s.jsx(zt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=d):d=n[4];let v;n[5]!==r.title?(v=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=v):v=n[6];let g;n[7]!==u||n[8]!==d||n[9]!==v?(g=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:u,children:[d,v]}),n[7]=u,n[8]=d,n[9]=v,n[10]=g):g=n[10];let j;n[11]!==c||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(j=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",i]}),s.jsx(De,{checked:o,onCheckedChange:x,onClick:Ds})]}),n[11]=c,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=j):j=n[16];let b;return n[17]!==C||n[18]!==g||n[19]!==j?(b=s.jsxs("div",{className:C,children:[g,j]}),n[17]=C,n[18]=g,n[19]=j,n[20]=b):b=n[20],b}),Ps=D.memo(function(e){const n=le.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:c}=e,i=`tool-${r}-${l.name}`,u=o?"text-foreground":"text-muted-foreground";let x;n[0]!==u?(x=X("text-sm font-medium",u),n[0]=u,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let C;n[5]!==l.description?(C=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=C):C=n[6];let d;n[7]!==m||n[8]!==C?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,C]}),n[7]=m,n[8]=C,n[9]=d):d=n[9];const v=`tool-${r}-${l.name}`;let g;n[10]!==o||n[11]!==c||n[12]!==v?(g=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(De,{id:v,checked:o,onCheckedChange:c,onClick:zs})}),n[10]=o,n[11]=c,n[12]=v,n[13]=g):g=n[13];let j;return n[14]!==i||n[15]!==d||n[16]!==g?(j=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[d,g]}),n[14]=i,n[15]=d,n[16]=g,n[17]=j):j=n[17],j});function Ms({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[c,i]=D.useState("all"),[u,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),C=kt({searchTerm:o.trim()||void 0}),d=n?C.filter(h=>h.connection_type!=="VIRTUAL"?!0:Yt(h.connection_url)!==n):C,v=m.current,g=[...v.values()].map(h=>d.find(S=>S.id===h)).filter(h=>h!==void 0),j=d.filter(h=>!v.has(h.id)),b=[...g,...j],I=h=>{const S=t[h];return S!==void 0&&S.length>0},T=b.filter(h=>{if(c==="all")return!0;const S=I(h.id);return c==="selected"?S:c==="unselected"?!S:!0}),[f,O]=D.useState(b[0]?.id??null),N=f?b.find(h=>h.id===f)??null:null,P=N?.tools??[],A=(h,S)=>t[h]?.includes(S)??!1,R=(h,S)=>{const E=t[h]??[],p=E.includes(S),_={...t};if(p){const k=E.filter(B=>B!==S);k.length===0?delete _[h]:_[h]=k}else _[h]=[...E,S];e(_)},L=h=>{const S=b.find(B=>B.id===h);if(!S?.tools)return;const E=t[h]??[],p=S.tools.map(B=>B.name),_=E.length>0&&p.every(B=>E.includes(B)),k={...t};_?delete k[h]:(k[h]=p,O(h)),e(k)},M=h=>{O(h),x(!0)},w=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:X("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[s.jsx(Ke,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:T.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:T.map(h=>{const S=h.tools?.length??0,E=t[h.id]?.length??0;return s.jsx(Rs,{connection:h,isSelected:f===h.id,hasToolsEnabled:I(h.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>M(h.id),onToggle:()=>L(h.id)},h.id)})})})]}),s.jsx("div",{className:X("flex-1 flex-col",u?"flex":"hidden md:flex"),children:N?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Kt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(zt,{icon:N.icon,name:N.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.title}),N.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:N.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(h=>s.jsx(Ps,{connectionId:N.id,tool:h,isSelected:A(N.id,h.name),onToggle:()=>R(N.id,h.name)},h.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Ds(t){return t.stopPropagation()}function zs(t){return t.stopPropagation()}const _t=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function ks(t){return t.replace(/-/g," ")}function Us(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let c=!1;for(const[i,u]of Object.entries(t)){if(i==="self"){u.includes("*")?n=!0:e.push(...u);continue}if(i==="*"){if(l=!0,u.includes("*"))c=!0;else for(const x of u)o.add(x);continue}if(r.push(i),u.includes("*"))c=!0;else for(const x of u)o.add(x)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:c}}function Nt(){const{locator:t}=Ce(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ce.organizationRoles(t),queryFn:async()=>{try{const i=await ae.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=_t.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const u=i.role;if(!u||_t.some(j=>j.value===u))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:C,allowsAllConnections:d,toolNames:v,allowsAllTools:g}=Us(i.permission);o.push({id:i.id,role:u,label:ks(u),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:d?-1:C.length,allowsAllConnections:d,toolCount:g?-1:v.length,allowsAllTools:g})}const c=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:c,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Vs=Et({role:Et({id:ve().optional(),slug:ve().optional(),label:ve()}),allowAllStaticPermissions:Jt(),staticPermissions:at(ve()),toolSet:Xt(ve(),at(ve())),memberIds:at(ve())});function Ht(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Bs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Gs(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function Je(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function $s(t){const e=le.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:c}=t,i=c===void 0?!1:c,[u,x]=D.useState(""),m=D.useDeferredValue(u);let C,d,v,g,j;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r){const T=Ls(),f=_s(),O=f.filter(w=>w.label.toLowerCase().includes(m.toLowerCase())),N=w=>{if(r.includes(w))o(r.filter(h=>h!==w));else{const h=[...r,w];h.length===f.length?(l(!0),o([])):o(h)}};v="flex flex-col h-full",e[12]!==u?(g=s.jsx("div",{className:"border-b border-border",children:s.jsx(Ke,{value:u,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=u,e[13]=g):g=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=X("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let R;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(R=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=R):R=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=L):L=e[21];let M;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(M=s.jsx("div",{onClick:Hs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=M):M=e[26],e[27]!==M||e[28]!==A||e[29]!==R?(j=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:A,onClick:R,children:[L,M]})}),e[27]=M,e[28]=A,e[29]=R,e[30]=j):j=e[30],C="flex-1 overflow-auto",d=Object.entries(T).map(w=>{const[h,S]=w,E=O.filter(p=>S.some(_=>_.name===p.value));return E.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:E.map(p=>s.jsxs("div",{className:X("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const _=f.map(Qs);o(_.filter(k=>k!==p.value))}else N(p.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:p.label})}),s.jsx("div",{onClick:qs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Ks);o(_.filter(k=>k!==p.value))}else N(p.value)}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Fs);o(_.filter(k=>k!==p.value))}else N(p.value)}})})]},p.value))})]},h)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=C,e[8]=d,e[9]=v,e[10]=g,e[11]=j}else C=e[7],d=e[8],v=e[9],g=e[10],j=e[11];let b;e[31]!==C||e[32]!==d?(b=s.jsx("div",{className:C,children:d}),e[31]=C,e[32]=d,e[33]=b):b=e[33];let I;return e[34]!==v||e[35]!==g||e[36]!==j||e[37]!==b?(I=s.jsxs("div",{className:v,children:[g,j,b]}),e[34]=v,e[35]=g,e[36]=j,e[37]=b,e[38]=I):I=e[38],I}function Fs(t){return t.value}function Ks(t){return t.value}function qs(t){return t.stopPropagation()}function Qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){const e=le.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[c,i]=D.useState(""),u=D.useDeferredValue(c);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,C]=D.useState(x),{data:d}=bt();let v,g,j,b,I,T,f,O,N,P,A;if(e[1]!==d?.data?.members||e[2]!==u||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==c||e[8]!==l){const _=d?.data?.members??[];let k;e[20]!==u?(k=U=>{const a=u.toLowerCase();return U.user?.name?.toLowerCase().includes(a)||U.user?.email?.toLowerCase().includes(a)},e[20]=u,e[21]=k):k=e[21];const B=_.filter(k),q=Ys;let Q;e[22]!==l?(Q=U=>l.includes(U),e[22]=l,e[23]=Q):Q=e[23];const H=Q;let Z;e[24]!==m?(Z=U=>{m.includes(U)?C(m.filter(a=>a!==U)):C([...m,U])},e[24]=m,e[25]=Z):Z=e[25];const se=Z;let J;e[26]!==o||e[27]!==r||e[28]!==m?(J=()=>{o(m),C([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=J):J=e[29],j=J,g=ze,P=n,A=r,v=ke,O="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Ue,{className:"px-6 pt-6",children:[s.jsx(Ve,{children:"Add Members to Role"}),s.jsx(Be,{children:"Select members to add to this role."})]}),e[30]=N):N=e[30],T="flex flex-col h-80",e[31]!==c?(f=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=c,e[32]=f):f=e[32],b="flex-1 overflow-auto",I=B.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:B.map(U=>{const a=q(U),y=H(U.id),F=m.includes(U.id);return s.jsxs("label",{className:X("flex items-center gap-3 p-2 rounded-lg",!a||y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(De,{checked:F||y,onCheckedChange:()=>{a&&!y&&se(U.id)},disabled:!a||y}),s.jsx(Ae,{url:U.user?.image??void 0,fallback:Ht(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!a&&s.jsx(Ee,{variant:"secondary",className:"shrink-0",children:"Owner"}),y&&a&&s.jsx(Ee,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=d?.data?.members,e[2]=u,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=c,e[8]=l,e[9]=v,e[10]=g,e[11]=j,e[12]=b,e[13]=I,e[14]=T,e[15]=f,e[16]=O,e[17]=N,e[18]=P,e[19]=A}else v=e[9],g=e[10],j=e[11],b=e[12],I=e[13],T=e[14],f=e[15],O=e[16],N=e[17],P=e[18],A=e[19];let R;e[33]!==b||e[34]!==I?(R=s.jsx("div",{className:b,children:I}),e[33]=b,e[34]=I,e[35]=R):R=e[35];let L;e[36]!==R||e[37]!==T||e[38]!==f?(L=s.jsxs("div",{className:T,children:[f,R]}),e[36]=R,e[37]=T,e[38]=f,e[39]=L):L=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx($e,{children:"Cancel"}),e[40]=M):M=e[40];const w=m.length===0,h=m.length>0&&`(${m.length})`;let S;e[41]!==j||e[42]!==w||e[43]!==h?(S=s.jsxs(Ge,{className:"px-6 pb-6",children:[M,s.jsxs(Fe,{onClick:j,disabled:w,children:["Add ",h]})]}),e[41]=j,e[42]=w,e[43]=h,e[44]=S):S=e[44];let E;e[45]!==v||e[46]!==L||e[47]!==S||e[48]!==O||e[49]!==N?(E=s.jsxs(v,{className:O,children:[N,L,S]}),e[45]=v,e[46]=L,e[47]=S,e[48]=O,e[49]=N,e[50]=E):E=e[50];let p;return e[51]!==g||e[52]!==E||e[53]!==P||e[54]!==A?(p=s.jsx(g,{open:P,onOpenChange:A,children:E}),e[51]=g,e[52]=E,e[53]=P,e[54]=A,e[55]=p):p=e[55],p}function Ys(t){return t.role!=="owner"}function Xs(t){const e=le.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[c,i]=D.useState(""),u=D.useDeferredValue(c),[x,m]=D.useState(!1),{data:C}=bt();let d,v,g,j,b;if(e[0]!==C?.data?.members||e[1]!==u||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==c){const O=C?.data?.members??[];let N;e[11]!==n?(N=E=>n.includes(E.id),e[11]=n,e[12]=N):N=e[12];const P=O.filter(N);let A;e[13]!==u?(A=E=>{const p=u.toLowerCase();return E.user?.name?.toLowerCase().includes(p)||E.user?.email?.toLowerCase().includes(p)},e[13]=u,e[14]=A):A=e[14];const R=P.filter(A);let L;e[15]!==n||e[16]!==r?(L=E=>{r(n.filter(p=>p!==E))},e[15]=n,e[16]=r,e[17]=L):L=e[17];const M=L;let w;e[18]!==n||e[19]!==r?(w=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=w):w=e[20],d=w,j="flex flex-col h-full";let h;e[21]!==c?(h=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=c,e[22]=h):h=e[22];let S;e[23]!==o?(S=o?s.jsx("div",{className:"pr-4",children:s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(nt,{size:16}),"Add Member"]})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(nt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==h||e[26]!==S?(b=s.jsxs("div",{className:"flex items-center border-b border-border",children:[h,S]}),e[25]=h,e[26]=S,e[27]=b):b=e[27],v="flex-1 overflow-auto",g=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(E=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Ae,{url:E.user?.image??void 0,fallback:Ht(E.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(St,{size:16})})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(E.id),children:s.jsx(St,{size:16})})]},E.id))}),e[0]=C?.data?.members,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=c,e[6]=d,e[7]=v,e[8]=g,e[9]=j,e[10]=b}else d=e[6],v=e[7],g=e[8],j=e[9],b=e[10];let I;e[28]!==v||e[29]!==g?(I=s.jsx("div",{className:v,children:g}),e[28]=v,e[29]=g,e[30]=I):I=e[30];let T;e[31]!==x||e[32]!==d||e[33]!==n?(T=s.jsx(Zs,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:d}),e[31]=x,e[32]=d,e[33]=n,e[34]=T):T=e[34];let f;return e[35]!==j||e[36]!==b||e[37]!==I||e[38]!==T?(f=s.jsxs("div",{className:j,children:[b,I,T]}),e[35]=j,e[36]=b,e[37]=I,e[38]=T,e[39]=f):f=e[39],f}function Js(t){const e=le.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(Xs,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const Ws={owner:[],admin:[],user:[]};function We(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:Ws[t],toolSet:{},memberIds:r.map(l=>l.id)}}function en({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:c}=Ce(),i=we(),u=kt()??[],{customRoles:x,refetch:m}=Nt(),{data:C}=it({queryKey:ce.members(c),queryFn:()=>ae.organization.listMembers()}),d=Dt({resolver:Wt(Vs),defaultValues:Je()}),v=d.formState.isValid,g=d.formState.isDirty,[j,b]=D.useState(null),[I,T]=D.useState(null),f=!d.watch("role.id")&&!d.watch("role.slug")&&!I,[O,N]=D.useState(null),[P,A]=D.useState(!1),[R,L]=D.useState(null),M=a=>{const y=a.permission||{},F=y.self||[],me=F.includes("*"),te=me?[]:F.filter(V=>V!=="*"),W={};for(const[V,G]of Object.entries(y))if(V!=="self")if(V==="*")for(const Y of u)G.includes("*")?W[Y.id]=Y.tools?.map(re=>re.name)??[]:W[Y.id]=G;else{const Y=u.find(re=>re.id===V);Y&&(G.includes("*")?W[V]=Y.tools?.map(re=>re.name)??[]:W[V]=G)}const de=(C?.data?.members??[]).filter(V=>V.role===a.role).map(V=>V.id);return{role:{id:a.id,slug:a.role,label:a.label},allowAllStaticPermissions:me,staticPermissions:te,toolSet:W,memberIds:de}},w=a=>{const y=M(a);d.reset(y),b(a.id??null),T(null)},h=()=>{d.reset(Je()),b(null),T(null),o("mcp")},S=a=>{g&&v?(L(()=>()=>w(a)),A(!0)):w(a)},E=async()=>{g&&v&&await Z(),h()},p=a=>{if(g&&v)L(()=>()=>{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}),A(!0);else{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}},_=a=>{if(!a&&d.formState.isDirty&&v){L(()=>()=>{r(!1),d.reset(Je()),T(null)}),A(!0);return}if(r(a),!a)d.reset(Je()),T(null),b(null);else{const y=x[0];if(y)w(y);else{const F=We("user",C?.data?.members??[]);d.reset(F),T("user"),b(null),o("org")}}},k=()=>{A(!1),R&&(R(),L(null))},B=a=>{const y={};a.allowAllStaticPermissions?y.self=["*"]:a.staticPermissions.length>0&&(y.self=a.staticPermissions);for(const[F,me]of Object.entries(a.toolSet))if(me.length>0){const W=u.find(ee=>ee.id===F)?.tools?.map(ee=>ee.name)??[];W.length>0&&W.every(ee=>me.includes(ee))?y[F]=["*"]:y[F]=me}return y},q=Te({mutationFn:async a=>{const y=B(a),F=a.role.slug||a.role.label.toLowerCase().replace(/\s+/g,"-");if(a.role.slug&&!a.role.id){const W=(C?.data?.members??[]).filter(V=>V.role===a.role.slug).map(V=>V.id),ee=a.memberIds.filter(V=>!W.includes(V)),de=W.filter(V=>!a.memberIds.includes(V));for(const V of ee){const G=await ae.organization.updateMemberRole({memberId:V,role:[a.role.slug]});if(G?.error)throw new Error(G.error.message)}for(const V of de){const G=await ae.organization.updateMemberRole({memberId:V,role:["user"]});if(G?.error)throw new Error(G.error.message)}return a}else if(a.role.id){const te=await ae.organization.updateRole({roleId:a.role.id,data:{permission:y}});if(te?.error)throw new Error(te.error.message);const ee=(C?.data?.members??[]).filter(G=>G.role===a.role.slug).map(G=>G.id),de=a.memberIds.filter(G=>!ee.includes(G)),V=ee.filter(G=>!a.memberIds.includes(G));for(const G of de){const Y=await ae.organization.updateMemberRole({memberId:G,role:[a.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const G of V){const Y=await ae.organization.updateMemberRole({memberId:G,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return a}else{const te=await ae.organization.createRole({role:F,permission:y});if(te?.error)throw new Error(te.error.message);for(const W of a.memberIds){const ee=await ae.organization.updateMemberRole({memberId:W,role:[F]});if(ee?.error)throw new Error(ee.error.message)}return{...a,role:{...a.role,id:te.data?.roleData?.id,slug:F}}}},onSuccess:(a,y)=>{i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)});const F=!y.role.id&&!y.role.slug,me=y.role.slug&&!y.role.id;ne.success(me?"Members updated successfully!":F?"Role created successfully!":"Role updated successfully!"),m(),d.reset(a),a.role.id&&b(a.role.id),e?.()},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to save role")}}),Q=Te({mutationFn:async a=>{const y=await ae.organization.deleteRole({roleId:a});if(y?.error)throw new Error(y.error.message);return y?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)}),ne.success("Role deleted successfully!"),m(),O?.id===j){const a=x.filter(y=>y.id!==O?.id);if(a[0])w(a[0]);else{const y=We("user",C?.data?.members??[]);d.reset(y),T("user"),b(null),o("org")}}},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to delete role")}}),H=q.isPending||Q.isPending,Z=async()=>{const a=d.getValues();if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}await q.mutateAsync(a)},se=d.handleSubmit(a=>{if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}q.mutate(a)}),J=a=>{a.id&&N({id:a.id,label:a.label})},U=()=>{O?.id&&Q.mutate(O.id),N(null)};return s.jsxs(Ut,{open:n,onOpenChange:_,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsx(Bt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[Bs.map(a=>{const y=I===a.role;return s.jsxs("div",{className:X("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>p(a.role),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",a.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsx(Cs,{size:14,className:"text-muted-foreground shrink-0"})]},a.role)}),x.map(a=>{const y=j===a.id;return s.jsxs("div",{className:X("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(a),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",Gs(a.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:X("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",y&&"opacity-100 pointer-events-auto"),onClick:F=>F.stopPropagation(),children:s.jsx(bs,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(tt,{className:"text-destructive",onClick:F=>{F.stopPropagation(),J(a)},children:[s.jsx(Gt,{size:16}),"Delete"]})})]})]},a.id)}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(js,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(Ee,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:E,disabled:H||g,className:"w-full h-10",children:[s.jsx(nt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!I&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!I&&s.jsx(Ms,{toolSet:d.watch("toolSet"),onToolSetChange:a=>d.setValue("toolSet",a,{shouldDirty:!0})}),l==="org"&&s.jsx($s,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:a=>d.setValue("allowAllStaticPermissions",a,{shouldDirty:!0}),onPermissionsChange:a=>d.setValue("staticPermissions",a,{shouldDirty:!0}),readOnly:!!I}),l==="members"&&s.jsx(Js,{memberIds:d.watch("memberIds"),onMemberIdsChange:a=>d.setValue("memberIds",a,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>_(!1),disabled:H,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:se,disabled:H||!v||!d.formState.isDirty,className:"h-10",children:q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),s.jsx(ze,{open:O!==null,onOpenChange:a=>!a&&N(null),children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Delete Role"}),s.jsxs(Be,{children:['Are you sure you want to delete the "',O?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Ge,{children:[s.jsx($e,{children:"Cancel"}),s.jsx(Fe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(ze,{open:P,onOpenChange:A,children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Discard Changes"}),s.jsx(Be,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Ge,{children:[s.jsx($e,{onClick:()=>L(null),children:"Keep Editing"}),s.jsx(Fe,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const tn=ve().email("Invalid email address");function sn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function nn({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=Ce(),l=we(),{data:o}=ae.useSession(),c=o?.user?.email,{roles:i,isLoading:u}=Nt(),x=i.filter(T=>T.role!=="owner"),m=Dt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),C=m.watch("emailsText"),d=m.watch("role"),g=sn(C).filter(T=>{const f=tn.safeParse(T).success,O=!c||T!==c.toLowerCase();return f&&O}),j=Te({mutationFn:async({emails:T,role:f})=>{if(!f)throw new Error("Please select a role");const O=await Promise.allSettled(T.map(async P=>{const A=await ae.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),N=O.filter(P=>P.status==="rejected");if(N.length>0)throw new Error(`Failed to invite ${N.length} member${N.length>1?"s":""}`);return O},onSuccess:(T,{emails:f})=>{l.invalidateQueries({queryKey:ce.members(r)}),l.invalidateQueries({queryKey:ce.invitations(r)}),ne.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:T=>{ne.error(T instanceof Error?T.message:"Failed to invite members")}}),b=T=>{if(g.length===0){ne.error("Please enter at least one valid email address");return}if(!T.role){ne.error("Please select a role");return}j.mutate({emails:g,role:T.role})},I=g.length>0&&!!d;return s.jsxs(Ut,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Bt,{className:"sm:max-w-lg",children:[s.jsx(ms,{children:s.jsx(us,{children:"Invite members"})}),s.jsx(vs,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(b),className:"space-y-4",children:[s.jsx(It,{control:m.control,name:"emailsText",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(Ns,{children:"Email addresses"}),s.jsx(At,{children:s.jsx(Es,{...T,disabled:j.isPending,placeholder:`Enter email addresses separated by commas or new lines
|
|
1
|
+
import{r as D,c as le,j as s,p as Yt,u as Ce,g as ae,K as ce,o as Et,ad as at,s as ve,ba as Xt,bg as Jt,F as we,k as Dt,h as Wt,t as ne,E as es}from"./index-CHQ9-Q-G.js";import{C as ts,a as ss}from"./collection-table-wrapper-CzqGMTIb.js";import{C as Ke}from"./collection-search-CECpIAiD.js";import{P as Ne}from"./index-aWpPBjkT.js";import{B as ns,a as rs,b as is,e as os}from"./breadcrumb-CJBikxW8.js";import{I as zt,c as _e,b as Re,T as Pe,a as Me,E as ct}from"./empty-state-VwVcPCE1.js";import{C as De}from"./checkbox-BomYVgbH.js";import{c as X,B as ie}from"./button-CKIyuXIq.js";import{h as kt}from"./use-connection-UwIAiUmR.js";import{u as bt,C as dt,a as mt,b as yt,c as ls,d as as,e as cs,f as ds}from"./command-BLAC1NoH.js";import{u as it}from"./useQuery-CImYAWdS.js";import{u as Te}from"./useMutation-C8K1KoTI.js";import{f as ze,a as ke,b as Ue,c as Ve,d as Be,e as Ge,A as $e,g as Fe,h as Ae}from"./alert-dialog-DN6po1tq.js";import{B as Ee}from"./badge-DIFY1rsD.js";import{D as Ut,f as Vt,a as Bt,b as ms,c as us,e as fs}from"./dialog-CjI8rs-6.js";import{D as Ct,a as jt,b as Tt,c as tt,d as hs,e as gs,f as xs,g as ps}from"./dropdown-menu-CoO02CsY.js";import{i as bs}from"./DotsHorizontal-4eEmoKn5.js";import{i as st}from"./Loading01-3CQcIIbt.js";import{i as Cs}from"./Lock01-aFdw7wqo.js";import{s as nt}from"./Plus-CP35U6Iv.js";import{s as Gt}from"./Trash01-Ck6jzVhZ.js";import{i as St}from"./X-BnxI_xD6.js";import{I as js}from"./input-BrgRsDcE.js";import{S as Xe}from"./switch-DKkhDe7l.js";import{E as Ts}from"./error-boundary-C8CO11ML.js";import{a as vs,F as It,b as Ot,c as Ns,d as At,f as wt}from"./form-CO4xV9gA.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-JdRjOrBE.js";import{T as Es}from"./textarea-BBk7k5wE.js";import{a as qe,u as Qe}from"./constants-DwkB1age.js";import{C as Lt}from"./card-MU9VbmJ4.js";import{i as $t}from"./DotsVertical-BYXFslta.js";import{i as ys}from"./index-Bc7QzOnC.js";import{s as Ft}from"./XClose-DvgsYIZw.js";import{a as Ss,b as Is,P as Os}from"./popover-CjUGVjON.js";import{t as As}from"./ChevronDown-DeD12W57.js";import"./ArrowUp-deTSI0E8.js";import"./Check-DTUUSvp-.js";import"./Grid01-B9LzvODL.js";import"./List-C1dM-VCr.js";import"./view-mode-toggle-BiRjYen1.js";import"./table-CBtv9zrT.js";import"./SearchMd-DTs0TtNF.js";import"./ChevronRight-8Yl-zCCi.js";const Kt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));Kt.displayName="ArrowLeft";const vt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));vt.displayName="Shield01";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));qt.displayName="SwitchHorizontal01";const Qt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"}],ws={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags"};function Ls(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[]};for(const e of Qt)t[e.category]?.push(e);return t}function _s(){return Qt.map(t=>({value:t.name,label:ws[t.name],dangerous:t.dangerous}))}const Rs=D.memo(function(e){const n=le.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:c,totalToolsCount:i,onSelect:u,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let C;n[0]!==m?(C=X("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=C):C=n[1];let d;n[2]!==r.icon||n[3]!==r.title?(d=s.jsx(zt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=d):d=n[4];let v;n[5]!==r.title?(v=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=v):v=n[6];let g;n[7]!==u||n[8]!==d||n[9]!==v?(g=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:u,children:[d,v]}),n[7]=u,n[8]=d,n[9]=v,n[10]=g):g=n[10];let j;n[11]!==c||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(j=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",i]}),s.jsx(De,{checked:o,onCheckedChange:x,onClick:Ds})]}),n[11]=c,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=j):j=n[16];let b;return n[17]!==C||n[18]!==g||n[19]!==j?(b=s.jsxs("div",{className:C,children:[g,j]}),n[17]=C,n[18]=g,n[19]=j,n[20]=b):b=n[20],b}),Ps=D.memo(function(e){const n=le.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:c}=e,i=`tool-${r}-${l.name}`,u=o?"text-foreground":"text-muted-foreground";let x;n[0]!==u?(x=X("text-sm font-medium",u),n[0]=u,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let C;n[5]!==l.description?(C=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=C):C=n[6];let d;n[7]!==m||n[8]!==C?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,C]}),n[7]=m,n[8]=C,n[9]=d):d=n[9];const v=`tool-${r}-${l.name}`;let g;n[10]!==o||n[11]!==c||n[12]!==v?(g=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(De,{id:v,checked:o,onCheckedChange:c,onClick:zs})}),n[10]=o,n[11]=c,n[12]=v,n[13]=g):g=n[13];let j;return n[14]!==i||n[15]!==d||n[16]!==g?(j=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[d,g]}),n[14]=i,n[15]=d,n[16]=g,n[17]=j):j=n[17],j});function Ms({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[c,i]=D.useState("all"),[u,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),C=kt({searchTerm:o.trim()||void 0}),d=n?C.filter(h=>h.connection_type!=="VIRTUAL"?!0:Yt(h.connection_url)!==n):C,v=m.current,g=[...v.values()].map(h=>d.find(S=>S.id===h)).filter(h=>h!==void 0),j=d.filter(h=>!v.has(h.id)),b=[...g,...j],I=h=>{const S=t[h];return S!==void 0&&S.length>0},T=b.filter(h=>{if(c==="all")return!0;const S=I(h.id);return c==="selected"?S:c==="unselected"?!S:!0}),[f,O]=D.useState(b[0]?.id??null),N=f?b.find(h=>h.id===f)??null:null,P=N?.tools??[],A=(h,S)=>t[h]?.includes(S)??!1,R=(h,S)=>{const E=t[h]??[],p=E.includes(S),_={...t};if(p){const k=E.filter(B=>B!==S);k.length===0?delete _[h]:_[h]=k}else _[h]=[...E,S];e(_)},L=h=>{const S=b.find(B=>B.id===h);if(!S?.tools)return;const E=t[h]??[],p=S.tools.map(B=>B.name),_=E.length>0&&p.every(B=>E.includes(B)),k={...t};_?delete k[h]:(k[h]=p,O(h)),e(k)},M=h=>{O(h),x(!0)},w=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:X("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[s.jsx(Ke,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:X("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:T.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:T.map(h=>{const S=h.tools?.length??0,E=t[h.id]?.length??0;return s.jsx(Rs,{connection:h,isSelected:f===h.id,hasToolsEnabled:I(h.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>M(h.id),onToggle:()=>L(h.id)},h.id)})})})]}),s.jsx("div",{className:X("flex-1 flex-col",u?"flex":"hidden md:flex"),children:N?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Kt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(zt,{icon:N.icon,name:N.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.title}),N.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:N.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(h=>s.jsx(Ps,{connectionId:N.id,tool:h,isSelected:A(N.id,h.name),onToggle:()=>R(N.id,h.name)},h.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Ds(t){return t.stopPropagation()}function zs(t){return t.stopPropagation()}const _t=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function ks(t){return t.replace(/-/g," ")}function Us(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let c=!1;for(const[i,u]of Object.entries(t)){if(i==="self"){u.includes("*")?n=!0:e.push(...u);continue}if(i==="*"){if(l=!0,u.includes("*"))c=!0;else for(const x of u)o.add(x);continue}if(r.push(i),u.includes("*"))c=!0;else for(const x of u)o.add(x)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:c}}function Nt(){const{locator:t}=Ce(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ce.organizationRoles(t),queryFn:async()=>{try{const i=await ae.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=_t.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const u=i.role;if(!u||_t.some(j=>j.value===u))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:C,allowsAllConnections:d,toolNames:v,allowsAllTools:g}=Us(i.permission);o.push({id:i.id,role:u,label:ks(u),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:d?-1:C.length,allowsAllConnections:d,toolCount:g?-1:v.length,allowsAllTools:g})}const c=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:c,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Vs=Et({role:Et({id:ve().optional(),slug:ve().optional(),label:ve()}),allowAllStaticPermissions:Jt(),staticPermissions:at(ve()),toolSet:Xt(ve(),at(ve())),memberIds:at(ve())});function Ht(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Bs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Gs(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function Je(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function $s(t){const e=le.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:c}=t,i=c===void 0?!1:c,[u,x]=D.useState(""),m=D.useDeferredValue(u);let C,d,v,g,j;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r){const T=Ls(),f=_s(),O=f.filter(w=>w.label.toLowerCase().includes(m.toLowerCase())),N=w=>{if(r.includes(w))o(r.filter(h=>h!==w));else{const h=[...r,w];h.length===f.length?(l(!0),o([])):o(h)}};v="flex flex-col h-full",e[12]!==u?(g=s.jsx("div",{className:"border-b border-border",children:s.jsx(Ke,{value:u,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=u,e[13]=g):g=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=X("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let R;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(R=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=R):R=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=L):L=e[21];let M;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(M=s.jsx("div",{onClick:Hs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n,disabled:i,onCheckedChange:w=>{i||(l(w),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=M):M=e[26],e[27]!==M||e[28]!==A||e[29]!==R?(j=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:A,onClick:R,children:[L,M]})}),e[27]=M,e[28]=A,e[29]=R,e[30]=j):j=e[30],C="flex-1 overflow-auto",d=Object.entries(T).map(w=>{const[h,S]=w,E=O.filter(p=>S.some(_=>_.name===p.value));return E.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:E.map(p=>s.jsxs("div",{className:X("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const _=f.map(Qs);o(_.filter(k=>k!==p.value))}else N(p.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:p.label})}),s.jsx("div",{onClick:qs,children:i?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Ks);o(_.filter(k=>k!==p.value))}else N(p.value)}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Xe,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const _=f.map(Fs);o(_.filter(k=>k!==p.value))}else N(p.value)}})})]},p.value))})]},h)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=C,e[8]=d,e[9]=v,e[10]=g,e[11]=j}else C=e[7],d=e[8],v=e[9],g=e[10],j=e[11];let b;e[31]!==C||e[32]!==d?(b=s.jsx("div",{className:C,children:d}),e[31]=C,e[32]=d,e[33]=b):b=e[33];let I;return e[34]!==v||e[35]!==g||e[36]!==j||e[37]!==b?(I=s.jsxs("div",{className:v,children:[g,j,b]}),e[34]=v,e[35]=g,e[36]=j,e[37]=b,e[38]=I):I=e[38],I}function Fs(t){return t.value}function Ks(t){return t.value}function qs(t){return t.stopPropagation()}function Qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){const e=le.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[c,i]=D.useState(""),u=D.useDeferredValue(c);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,C]=D.useState(x),{data:d}=bt();let v,g,j,b,I,T,f,O,N,P,A;if(e[1]!==d?.data?.members||e[2]!==u||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==c||e[8]!==l){const _=d?.data?.members??[];let k;e[20]!==u?(k=U=>{const a=u.toLowerCase();return U.user?.name?.toLowerCase().includes(a)||U.user?.email?.toLowerCase().includes(a)},e[20]=u,e[21]=k):k=e[21];const B=_.filter(k),q=Ys;let Q;e[22]!==l?(Q=U=>l.includes(U),e[22]=l,e[23]=Q):Q=e[23];const H=Q;let Z;e[24]!==m?(Z=U=>{m.includes(U)?C(m.filter(a=>a!==U)):C([...m,U])},e[24]=m,e[25]=Z):Z=e[25];const se=Z;let J;e[26]!==o||e[27]!==r||e[28]!==m?(J=()=>{o(m),C([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=J):J=e[29],j=J,g=ze,P=n,A=r,v=ke,O="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Ue,{className:"px-6 pt-6",children:[s.jsx(Ve,{children:"Add Members to Role"}),s.jsx(Be,{children:"Select members to add to this role."})]}),e[30]=N):N=e[30],T="flex flex-col h-80",e[31]!==c?(f=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=c,e[32]=f):f=e[32],b="flex-1 overflow-auto",I=B.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:B.map(U=>{const a=q(U),y=H(U.id),F=m.includes(U.id);return s.jsxs("label",{className:X("flex items-center gap-3 p-2 rounded-lg",!a||y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(De,{checked:F||y,onCheckedChange:()=>{a&&!y&&se(U.id)},disabled:!a||y}),s.jsx(Ae,{url:U.user?.image??void 0,fallback:Ht(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!a&&s.jsx(Ee,{variant:"secondary",className:"shrink-0",children:"Owner"}),y&&a&&s.jsx(Ee,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=d?.data?.members,e[2]=u,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=c,e[8]=l,e[9]=v,e[10]=g,e[11]=j,e[12]=b,e[13]=I,e[14]=T,e[15]=f,e[16]=O,e[17]=N,e[18]=P,e[19]=A}else v=e[9],g=e[10],j=e[11],b=e[12],I=e[13],T=e[14],f=e[15],O=e[16],N=e[17],P=e[18],A=e[19];let R;e[33]!==b||e[34]!==I?(R=s.jsx("div",{className:b,children:I}),e[33]=b,e[34]=I,e[35]=R):R=e[35];let L;e[36]!==R||e[37]!==T||e[38]!==f?(L=s.jsxs("div",{className:T,children:[f,R]}),e[36]=R,e[37]=T,e[38]=f,e[39]=L):L=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx($e,{children:"Cancel"}),e[40]=M):M=e[40];const w=m.length===0,h=m.length>0&&`(${m.length})`;let S;e[41]!==j||e[42]!==w||e[43]!==h?(S=s.jsxs(Ge,{className:"px-6 pb-6",children:[M,s.jsxs(Fe,{onClick:j,disabled:w,children:["Add ",h]})]}),e[41]=j,e[42]=w,e[43]=h,e[44]=S):S=e[44];let E;e[45]!==v||e[46]!==L||e[47]!==S||e[48]!==O||e[49]!==N?(E=s.jsxs(v,{className:O,children:[N,L,S]}),e[45]=v,e[46]=L,e[47]=S,e[48]=O,e[49]=N,e[50]=E):E=e[50];let p;return e[51]!==g||e[52]!==E||e[53]!==P||e[54]!==A?(p=s.jsx(g,{open:P,onOpenChange:A,children:E}),e[51]=g,e[52]=E,e[53]=P,e[54]=A,e[55]=p):p=e[55],p}function Ys(t){return t.role!=="owner"}function Xs(t){const e=le.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[c,i]=D.useState(""),u=D.useDeferredValue(c),[x,m]=D.useState(!1),{data:C}=bt();let d,v,g,j,b;if(e[0]!==C?.data?.members||e[1]!==u||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==c){const O=C?.data?.members??[];let N;e[11]!==n?(N=E=>n.includes(E.id),e[11]=n,e[12]=N):N=e[12];const P=O.filter(N);let A;e[13]!==u?(A=E=>{const p=u.toLowerCase();return E.user?.name?.toLowerCase().includes(p)||E.user?.email?.toLowerCase().includes(p)},e[13]=u,e[14]=A):A=e[14];const R=P.filter(A);let L;e[15]!==n||e[16]!==r?(L=E=>{r(n.filter(p=>p!==E))},e[15]=n,e[16]=r,e[17]=L):L=e[17];const M=L;let w;e[18]!==n||e[19]!==r?(w=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=w):w=e[20],d=w,j="flex flex-col h-full";let h;e[21]!==c?(h=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=c,e[22]=h):h=e[22];let S;e[23]!==o?(S=o?s.jsx("div",{className:"pr-4",children:s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(nt,{size:16}),"Add Member"]})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(nt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==h||e[26]!==S?(b=s.jsxs("div",{className:"flex items-center border-b border-border",children:[h,S]}),e[25]=h,e[26]=S,e[27]=b):b=e[27],v="flex-1 overflow-auto",g=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(E=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Ae,{url:E.user?.image??void 0,fallback:Ht(E.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?s.jsx(_e,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(St,{size:16})})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(E.id),children:s.jsx(St,{size:16})})]},E.id))}),e[0]=C?.data?.members,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=c,e[6]=d,e[7]=v,e[8]=g,e[9]=j,e[10]=b}else d=e[6],v=e[7],g=e[8],j=e[9],b=e[10];let I;e[28]!==v||e[29]!==g?(I=s.jsx("div",{className:v,children:g}),e[28]=v,e[29]=g,e[30]=I):I=e[30];let T;e[31]!==x||e[32]!==d||e[33]!==n?(T=s.jsx(Zs,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:d}),e[31]=x,e[32]=d,e[33]=n,e[34]=T):T=e[34];let f;return e[35]!==j||e[36]!==b||e[37]!==I||e[38]!==T?(f=s.jsxs("div",{className:j,children:[b,I,T]}),e[35]=j,e[36]=b,e[37]=I,e[38]=T,e[39]=f):f=e[39],f}function Js(t){const e=le.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(Xs,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const Ws={owner:[],admin:[],user:[]};function We(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:Ws[t],toolSet:{},memberIds:r.map(l=>l.id)}}function en({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:c}=Ce(),i=we(),u=kt()??[],{customRoles:x,refetch:m}=Nt(),{data:C}=it({queryKey:ce.members(c),queryFn:()=>ae.organization.listMembers()}),d=Dt({resolver:Wt(Vs),defaultValues:Je()}),v=d.formState.isValid,g=d.formState.isDirty,[j,b]=D.useState(null),[I,T]=D.useState(null),f=!d.watch("role.id")&&!d.watch("role.slug")&&!I,[O,N]=D.useState(null),[P,A]=D.useState(!1),[R,L]=D.useState(null),M=a=>{const y=a.permission||{},F=y.self||[],me=F.includes("*"),te=me?[]:F.filter(V=>V!=="*"),W={};for(const[V,G]of Object.entries(y))if(V!=="self")if(V==="*")for(const Y of u)G.includes("*")?W[Y.id]=Y.tools?.map(re=>re.name)??[]:W[Y.id]=G;else{const Y=u.find(re=>re.id===V);Y&&(G.includes("*")?W[V]=Y.tools?.map(re=>re.name)??[]:W[V]=G)}const de=(C?.data?.members??[]).filter(V=>V.role===a.role).map(V=>V.id);return{role:{id:a.id,slug:a.role,label:a.label},allowAllStaticPermissions:me,staticPermissions:te,toolSet:W,memberIds:de}},w=a=>{const y=M(a);d.reset(y),b(a.id??null),T(null)},h=()=>{d.reset(Je()),b(null),T(null),o("mcp")},S=a=>{g&&v?(L(()=>()=>w(a)),A(!0)):w(a)},E=async()=>{g&&v&&await Z(),h()},p=a=>{if(g&&v)L(()=>()=>{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}),A(!0);else{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}},_=a=>{if(!a&&d.formState.isDirty&&v){L(()=>()=>{r(!1),d.reset(Je()),T(null)}),A(!0);return}if(r(a),!a)d.reset(Je()),T(null),b(null);else{const y=x[0];if(y)w(y);else{const F=We("user",C?.data?.members??[]);d.reset(F),T("user"),b(null),o("org")}}},k=()=>{A(!1),R&&(R(),L(null))},B=a=>{const y={};a.allowAllStaticPermissions?y.self=["*"]:a.staticPermissions.length>0&&(y.self=a.staticPermissions);for(const[F,me]of Object.entries(a.toolSet))if(me.length>0){const W=u.find(ee=>ee.id===F)?.tools?.map(ee=>ee.name)??[];W.length>0&&W.every(ee=>me.includes(ee))?y[F]=["*"]:y[F]=me}return y},q=Te({mutationFn:async a=>{const y=B(a),F=a.role.slug||a.role.label.toLowerCase().replace(/\s+/g,"-");if(a.role.slug&&!a.role.id){const W=(C?.data?.members??[]).filter(V=>V.role===a.role.slug).map(V=>V.id),ee=a.memberIds.filter(V=>!W.includes(V)),de=W.filter(V=>!a.memberIds.includes(V));for(const V of ee){const G=await ae.organization.updateMemberRole({memberId:V,role:[a.role.slug]});if(G?.error)throw new Error(G.error.message)}for(const V of de){const G=await ae.organization.updateMemberRole({memberId:V,role:["user"]});if(G?.error)throw new Error(G.error.message)}return a}else if(a.role.id){const te=await ae.organization.updateRole({roleId:a.role.id,data:{permission:y}});if(te?.error)throw new Error(te.error.message);const ee=(C?.data?.members??[]).filter(G=>G.role===a.role.slug).map(G=>G.id),de=a.memberIds.filter(G=>!ee.includes(G)),V=ee.filter(G=>!a.memberIds.includes(G));for(const G of de){const Y=await ae.organization.updateMemberRole({memberId:G,role:[a.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const G of V){const Y=await ae.organization.updateMemberRole({memberId:G,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return a}else{const te=await ae.organization.createRole({role:F,permission:y});if(te?.error)throw new Error(te.error.message);for(const W of a.memberIds){const ee=await ae.organization.updateMemberRole({memberId:W,role:[F]});if(ee?.error)throw new Error(ee.error.message)}return{...a,role:{...a.role,id:te.data?.roleData?.id,slug:F}}}},onSuccess:(a,y)=>{i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)});const F=!y.role.id&&!y.role.slug,me=y.role.slug&&!y.role.id;ne.success(me?"Members updated successfully!":F?"Role created successfully!":"Role updated successfully!"),m(),d.reset(a),a.role.id&&b(a.role.id),e?.()},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to save role")}}),Q=Te({mutationFn:async a=>{const y=await ae.organization.deleteRole({roleId:a});if(y?.error)throw new Error(y.error.message);return y?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)}),ne.success("Role deleted successfully!"),m(),O?.id===j){const a=x.filter(y=>y.id!==O?.id);if(a[0])w(a[0]);else{const y=We("user",C?.data?.members??[]);d.reset(y),T("user"),b(null),o("org")}}},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to delete role")}}),H=q.isPending||Q.isPending,Z=async()=>{const a=d.getValues();if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}await q.mutateAsync(a)},se=d.handleSubmit(a=>{if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}q.mutate(a)}),J=a=>{a.id&&N({id:a.id,label:a.label})},U=()=>{O?.id&&Q.mutate(O.id),N(null)};return s.jsxs(Ut,{open:n,onOpenChange:_,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsx(Bt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[Bs.map(a=>{const y=I===a.role;return s.jsxs("div",{className:X("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>p(a.role),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",a.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsx(Cs,{size:14,className:"text-muted-foreground shrink-0"})]},a.role)}),x.map(a=>{const y=j===a.id;return s.jsxs("div",{className:X("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(a),children:[s.jsx("div",{className:X("shrink-0 size-3 rounded-full",Gs(a.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:X("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",y&&"opacity-100 pointer-events-auto"),onClick:F=>F.stopPropagation(),children:s.jsx(bs,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(tt,{className:"text-destructive",onClick:F=>{F.stopPropagation(),J(a)},children:[s.jsx(Gt,{size:16}),"Delete"]})})]})]},a.id)}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(js,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(Ee,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:E,disabled:H||g,className:"w-full h-10",children:[s.jsx(nt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!I&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:X("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!I&&s.jsx(Ms,{toolSet:d.watch("toolSet"),onToolSetChange:a=>d.setValue("toolSet",a,{shouldDirty:!0})}),l==="org"&&s.jsx($s,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:a=>d.setValue("allowAllStaticPermissions",a,{shouldDirty:!0}),onPermissionsChange:a=>d.setValue("staticPermissions",a,{shouldDirty:!0}),readOnly:!!I}),l==="members"&&s.jsx(Js,{memberIds:d.watch("memberIds"),onMemberIdsChange:a=>d.setValue("memberIds",a,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>_(!1),disabled:H,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:se,disabled:H||!v||!d.formState.isDirty,className:"h-10",children:q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),s.jsx(ze,{open:O!==null,onOpenChange:a=>!a&&N(null),children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Delete Role"}),s.jsxs(Be,{children:['Are you sure you want to delete the "',O?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Ge,{children:[s.jsx($e,{children:"Cancel"}),s.jsx(Fe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(ze,{open:P,onOpenChange:A,children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Discard Changes"}),s.jsx(Be,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Ge,{children:[s.jsx($e,{onClick:()=>L(null),children:"Keep Editing"}),s.jsx(Fe,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const tn=ve().email("Invalid email address");function sn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function nn({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=Ce(),l=we(),{data:o}=ae.useSession(),c=o?.user?.email,{roles:i,isLoading:u}=Nt(),x=i.filter(T=>T.role!=="owner"),m=Dt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),C=m.watch("emailsText"),d=m.watch("role"),g=sn(C).filter(T=>{const f=tn.safeParse(T).success,O=!c||T!==c.toLowerCase();return f&&O}),j=Te({mutationFn:async({emails:T,role:f})=>{if(!f)throw new Error("Please select a role");const O=await Promise.allSettled(T.map(async P=>{const A=await ae.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),N=O.filter(P=>P.status==="rejected");if(N.length>0)throw new Error(`Failed to invite ${N.length} member${N.length>1?"s":""}`);return O},onSuccess:(T,{emails:f})=>{l.invalidateQueries({queryKey:ce.members(r)}),l.invalidateQueries({queryKey:ce.invitations(r)}),ne.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:T=>{ne.error(T instanceof Error?T.message:"Failed to invite members")}}),b=T=>{if(g.length===0){ne.error("Please enter at least one valid email address");return}if(!T.role){ne.error("Please select a role");return}j.mutate({emails:g,role:T.role})},I=g.length>0&&!!d;return s.jsxs(Ut,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Bt,{className:"sm:max-w-lg",children:[s.jsx(ms,{children:s.jsx(us,{children:"Invite members"})}),s.jsx(vs,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(b),className:"space-y-4",children:[s.jsx(It,{control:m.control,name:"emailsText",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(Ns,{children:"Email addresses"}),s.jsx(At,{children:s.jsx(Es,{...T,disabled:j.isPending,placeholder:`Enter email addresses separated by commas or new lines
|
|
2
2
|
e.g. user1@example.com, user2@example.com
|
|
3
3
|
or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(wt,{})]})}),s.jsx(It,{control:m.control,name:"role",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(At,{children:s.jsxs(ft,{value:T.value,onValueChange:T.onChange,disabled:j.isPending||u,children:[s.jsx(ht,{className:"w-full",children:s.jsx(gt,{placeholder:"Select a role"})}),s.jsx(xt,{children:x.map(f=>{const O=[];return f.isBuiltin||(f.allowsAllStaticPermissions?O.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&O.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?O.push("All connections"):f.connectionCount&&f.connectionCount>0&&O.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?O.push("all tools"):f.toolCount&&f.toolCount>0&&O.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),s.jsx(pt,{value:f.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:f.label}),!f.isBuiltin&&O.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:O.join(", ")})]})},f.role)})})]})}),s.jsx(wt,{})]})}),s.jsxs(fs,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:j.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:j.isPending||!I,children:j.isPending?"Inviting...":`Invite ${g.length||0} Member${g.length!==1?"s":""}`})]})]})})]})]})}function rn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ce.invitations(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(u.structuredContent??u)?.invitations??[]},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c},t[6]=o,t[7]=c,t[8]=i):i=t[8],es(i)}function on(){const t=le.c(5),{locator:e}=Ce(),n=we();let r;t[0]!==e||t[1]!==n?(r={mutationFn:an,onSuccess:()=>{n.invalidateQueries({queryKey:ce.invitations(e)}),ne.success("Invitation cancelled")},onError:ln},t[0]=e,t[1]=n,t[2]=r):r=t[2];const l=Te(r);let o;return t[3]!==l?(o={cancel:l},t[3]=l,t[4]=o):o=t[4],o}function ln(t){ne.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function an(t){const e=await ae.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function cn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ce.tags(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"TAGS_LIST",arguments:{}});return(u.structuredContent??u).tags},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c,staleTime:3e4},t[6]=o,t[7]=c,t[8]=i):i=t[8],it(i)}function dn(){const t=le.c(10),e=we(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const m=await o.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ce.tags(r)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:mn},t[7]=c,t[8]=i,t[9]=u):u=t[9],Te(u)}function mn(t){ne.error(t instanceof Error?t.message:"Failed to create tag")}function un(t){const e=le.c(12),{org:n,locator:r}=Ce();let l;e[0]!==n.id?(l={connectionId:qe,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const o=Qe(l);let c;e[2]!==r||e[3]!==t?(c=ce.memberTags(r,t),e[2]=r,e[3]=t,e[4]=c):c=e[4];let i;e[5]!==o||e[6]!==t?(i=async()=>{const m=await o.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=o,e[6]=t,e[7]=i):i=e[7];const u=!!t;let x;return e[8]!==c||e[9]!==i||e[10]!==u?(x={queryKey:c,queryFn:i,staleTime:3e4,enabled:u},e[8]=c,e[9]=i,e[10]=u,e[11]=x):x=e[11],it(x)}function fn(){const t=le.c(10),e=we(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const{memberId:m,tagIds:C}=x,d=await o.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:C}});return d.structuredContent??d},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ce.memberTags(r,m.memberId)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:hn},t[7]=c,t[8]=i,t[9]=u):u=t[9],Te(u)}function hn(t){ne.error(t instanceof Error?t.message:"Failed to update member tags")}function Zt(t){const e=le.c(44),{memberId:n,className:r,disabled:l,placeholder:o,maxDisplay:c}=t,i=l===void 0?!1:l,u=o===void 0?"Add tags...":o,x=c===void 0?2:c,[m,C]=D.useState(!1),[d,v]=D.useState(""),{data:g,isLoading:j}=cn(),b=g===void 0?[]:g,{data:I,isLoading:T}=un(n),f=I===void 0?[]:I,O=dn(),N=fn(),P=j||T,A=f.map(xn);let R;e[0]!==d?(R=K=>K.name.toLowerCase().includes(d.toLowerCase()),e[0]=d,e[1]=R):R=e[1];const L=b.filter(R);let M;e[2]!==d?(M=K=>K.name.toLowerCase()===d.toLowerCase(),e[2]=d,e[3]=M):M=e[3];const w=b.find(M),h=d.trim()&&!w,S=async K=>{const be=A.includes(K.id)?A.filter(ye=>ye!==K.id):[...A,K.id];await N.mutateAsync({memberId:n,tagIds:be})},E=async()=>{if(!d.trim())return;const K=await O.mutateAsync(d.trim());await N.mutateAsync({memberId:n,tagIds:[...A,K.id]}),v("")},p=async K=>{const ge=A.filter(be=>be!==K);await N.mutateAsync({memberId:n,tagIds:ge})},_=O.isPending||N.isPending,k=Is;let B;e[4]!==m?(B=()=>C(!m),e[4]=m,e[5]=B):B=e[5];let q;e[6]!==r?(q=X("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",r),e[6]=r,e[7]=q):q=e[7];const Q=i||P,H=P?s.jsx(st,{size:14,className:"animate-spin text-muted-foreground"}):f.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[f.slice(0,x).map(gn),f.length>x&&s.jsxs(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",f.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let Z;e[8]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(As,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Z):Z=e[8];let se;e[9]!==Q||e[10]!==H||e[11]!==B||e[12]!==q?(se=s.jsx(Os,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:B,className:q,disabled:Q,children:[H,Z]})}),e[9]=Q,e[10]=H,e[11]=B,e[12]=q,e[13]=se):se=e[13];const J=Ss,U="w-56 p-0",a="start";let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=()=>C(!1),e[14]=y):y=e[14];const F=cs,me=!1;let te;e[15]!==d?(te=s.jsx(ds,{placeholder:"Search or create...",value:d,onValueChange:v,className:"h-9"}),e[15]=d,e[16]=te):te=e[16];const W=as,ee=f.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(dt,{heading:"Selected",children:f.map(K=>s.jsx(mt,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]}),s.jsx("button",{onClick:ge=>{ge.stopPropagation(),p(K.id)},className:"opacity-50 hover:opacity-100",disabled:_,children:s.jsx(Ft,{size:14})})]})},K.id))}),s.jsx(yt,{})]}),de=dt,V="Available",G=L.length===0&&!h&&s.jsx(ls,{children:"No tags found."}),Y=L.filter(K=>!A.includes(K.id)).map(K=>s.jsx(mt,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]})},K.id));let re;e[17]!==de||e[18]!==G||e[19]!==Y?(re=s.jsxs(de,{heading:V,children:[G,Y]}),e[17]=de,e[18]=G,e[19]=Y,e[20]=re):re=e[20];let ue;e[21]!==E||e[22]!==_||e[23]!==d||e[24]!==h?(ue=h&&s.jsxs(s.Fragment,{children:[s.jsx(yt,{}),s.jsx(dt,{children:s.jsx(mt,{onSelect:E,className:"cursor-pointer",disabled:_,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[_?s.jsx(st,{size:14,className:"animate-spin"}):s.jsx(nt,{size:14}),s.jsxs("span",{children:['Create "',d.trim(),'"']})]})})})]}),e[21]=E,e[22]=_,e[23]=d,e[24]=h,e[25]=ue):ue=e[25];let pe;e[26]!==W||e[27]!==ee||e[28]!==re||e[29]!==ue?(pe=s.jsxs(W,{children:[ee,re,ue]}),e[26]=W,e[27]=ee,e[28]=re,e[29]=ue,e[30]=pe):pe=e[30];let fe;e[31]!==F||e[32]!==te||e[33]!==pe?(fe=s.jsxs(F,{shouldFilter:me,children:[te,pe]}),e[31]=F,e[32]=te,e[33]=pe,e[34]=fe):fe=e[34];let he;e[35]!==J||e[36]!==y||e[37]!==fe?(he=s.jsx(J,{className:U,align:a,onEscapeKeyDown:y,children:fe}),e[35]=J,e[36]=y,e[37]=fe,e[38]=he):he=e[38];let je;return e[39]!==k||e[40]!==m||e[41]!==se||e[42]!==he?(je=s.jsxs(k,{open:m,onOpenChange:C,children:[se,he]}),e[39]=k,e[40]=m,e[41]=se,e[42]=he,e[43]=je):je=e[43],je}function gn(t){return s.jsx(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function xn(t){return t.id}const Rt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],pn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function bn(t){const e=new Map;for(const[n,r]of Object.entries(pn))e.set(n,r);for(let n=0;n<t.length;n++){const r=t[n];r&&!e.has(r.role)&&e.set(r.role,Rt[n%Rt.length]??"bg-neutral-400")}return e}function Cn(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function et(t){const e=le.c(79),{role:n,memberId:r,isOwner:l,roleColorMap:o,selectableRoles:c,onRoleChange:i,size:u,className:x}=t,m=u===void 0?"xs":u;let C,d,v,g,j,b,I,T,f,O,N;if(e[0]!==x||e[1]!==l||e[2]!==r||e[3]!==i||e[4]!==n||e[5]!==o||e[6]!==c||e[7]!==m){N=Symbol.for("react.early_return_sentinel");e:{const E=o.get(n)??"bg-neutral-400";if(l){let p;e[19]!==r||e[20]!==i?(p=U=>i(r,U),e[19]=r,e[20]=i,e[21]=p):p=e[21];let _;e[22]!==n?(_=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=_):_=e[23];const k=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:X("size-2 rounded-full shrink-0",E)}),_]});let B;e[24]!==k?(B=s.jsx(gt,{children:k}),e[24]=k,e[25]=B):B=e[25];let q;e[26]!==x||e[27]!==m||e[28]!==B?(q=s.jsx(ht,{size:m,className:x,children:B}),e[26]=x,e[27]=m,e[28]=B,e[29]=q):q=e[29];let Q;if(e[30]!==o||e[31]!==c){let U;e[33]!==o?(U=a=>{const y=o.get(a.role)??"bg-neutral-400";return s.jsx(pt,{value:a.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:X("size-3 rounded-full",y)}),s.jsx("span",{className:"capitalize",children:a.label})]})},a.role)},e[33]=o,e[34]=U):U=e[34],Q=c.map(U),e[30]=o,e[31]=c,e[32]=Q}else Q=e[32];let H;e[35]!==Q?(H=s.jsx(xt,{children:Q}),e[35]=Q,e[36]=H):H=e[36];let Z;e[37]!==l||e[38]!==n||e[39]!==p||e[40]!==q||e[41]!==H?(Z=s.jsx(Pe,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ft,{value:n,onValueChange:p,disabled:l,children:[q,H]})})}),e[37]=l,e[38]=n,e[39]=p,e[40]=q,e[41]=H,e[42]=Z):Z=e[42];let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(Me,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=se):se=e[43];let J;e[44]!==Z?(J=s.jsx(_e,{children:s.jsxs(Re,{children:[Z,se]})}),e[44]=Z,e[45]=J):J=e[45],N=J;break e}v=ft,T=n,e[46]!==r||e[47]!==i?(f=p=>i(r,p),e[46]=r,e[47]=i,e[48]=f):f=e[48],O=l,d=ht,b=m,I=x,C=gt,j="flex items-center gap-2 min-w-0",g=X("size-2 rounded-full shrink-0",E)}e[0]=x,e[1]=l,e[2]=r,e[3]=i,e[4]=n,e[5]=o,e[6]=c,e[7]=m,e[8]=C,e[9]=d,e[10]=v,e[11]=g,e[12]=j,e[13]=b,e[14]=I,e[15]=T,e[16]=f,e[17]=O,e[18]=N}else C=e[8],d=e[9],v=e[10],g=e[11],j=e[12],b=e[13],I=e[14],T=e[15],f=e[16],O=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let P;e[49]!==g?(P=s.jsx("div",{className:g}),e[49]=g,e[50]=P):P=e[50];let A;e[51]!==n?(A=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=A):A=e[52];let R;e[53]!==P||e[54]!==A||e[55]!==j?(R=s.jsxs("div",{className:j,children:[P,A]}),e[53]=P,e[54]=A,e[55]=j,e[56]=R):R=e[56];let L;e[57]!==C||e[58]!==R?(L=s.jsx(C,{children:R}),e[57]=C,e[58]=R,e[59]=L):L=e[59];let M;e[60]!==d||e[61]!==L||e[62]!==b||e[63]!==I?(M=s.jsx(d,{size:b,className:I,children:L}),e[60]=d,e[61]=L,e[62]=b,e[63]=I,e[64]=M):M=e[64];let w;if(e[65]!==o||e[66]!==c){let E;e[68]!==o?(E=p=>{const _=o.get(p.role)??"bg-neutral-400";return s.jsx(pt,{value:p.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:X("size-3 rounded-full",_)}),s.jsx("span",{className:"capitalize",children:p.label})]})},p.role)},e[68]=o,e[69]=E):E=e[69],w=c.map(E),e[65]=o,e[66]=c,e[67]=w}else w=e[67];let h;e[70]!==w?(h=s.jsx(xt,{children:w}),e[70]=w,e[71]=h):h=e[71];let S;return e[72]!==v||e[73]!==M||e[74]!==h||e[75]!==T||e[76]!==f||e[77]!==O?(S=s.jsxs(v,{value:T,onValueChange:f,disabled:O,children:[M,h]}),e[72]=v,e[73]=M,e[74]=h,e[75]=T,e[76]=f,e[77]=O,e[78]=S):S=e[78],S}function Pt(t){const e=le.c(51),{member:n,roles:r,onChangeRole:l,onRemove:o,isUpdating:c}=t,i=c===void 0?!1:c,u=n.role==="owner";let x,m,C,d,v,g,j,b,I;if(e[0]!==u||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==r){let M;e[15]!==n.role?(M=p=>p.role!==n.role&&p.role!=="owner",e[15]=n.role,e[16]=M):M=e[16];const w=r.filter(M);d=Ct;let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx($t,{size:20}),e[17]=h):h=e[17],e[18]!==u?(I=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Tn,children:h})}),e[18]=u,e[19]=I):I=e[19],C=Tt,j="end",b=jn,m=hs;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(qt,{size:16}),e[20]=S):S=e[20],e[21]!==i?(g=s.jsxs(gs,{disabled:i,children:[S,"Change Role"]}),e[21]=i,e[22]=g):g=e[22],x=xs;let E;e[23]!==i||e[24]!==n.id||e[25]!==l?(E=p=>{const _=[];return p.isBuiltin||(p.allowsAllStaticPermissions?_.push("Full org access"):p.staticPermissionCount&&p.staticPermissionCount>0&&_.push(`${p.staticPermissionCount} org perm${p.staticPermissionCount!==1?"s":""}`),p.allowsAllConnections?_.push("All connections"):p.connectionCount&&p.connectionCount>0&&_.push(`${p.connectionCount} connection${p.connectionCount!==1?"s":""}`),(p.connectionCount!==0||p.allowsAllConnections)&&(p.allowsAllTools?_.push("all tools"):p.toolCount&&p.toolCount>0&&_.push(`${p.toolCount} tool${p.toolCount!==1?"s":""}`))),s.jsxs(tt,{onClick:k=>{k.stopPropagation(),l(n.id,p.role)},disabled:i,children:[p.isBuiltin?s.jsx(vt,{size:16}):s.jsx(ys,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:p.label}),!p.isBuiltin&&_.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:_.join(", ")})]})]},p.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=E):E=e[26],v=w.map(E),e[0]=u,e[1]=i,e[2]=n.id,e[3]=n.role,e[4]=l,e[5]=r,e[6]=x,e[7]=m,e[8]=C,e[9]=d,e[10]=v,e[11]=g,e[12]=j,e[13]=b,e[14]=I}else x=e[6],m=e[7],C=e[8],d=e[9],v=e[10],g=e[11],j=e[12],b=e[13],I=e[14];let T;e[27]!==x||e[28]!==v?(T=s.jsx(x,{children:v}),e[27]=x,e[28]=v,e[29]=T):T=e[29];let f;e[30]!==m||e[31]!==g||e[32]!==T?(f=s.jsxs(m,{children:[g,T]}),e[30]=m,e[31]=g,e[32]=T,e[33]=f):f=e[33];let O;e[34]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(ps,{}),e[34]=O):O=e[34];let N;e[35]!==n.id||e[36]!==o?(N=M=>{M.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=N):N=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Gt,{size:16}),e[38]=P):P=e[38];let A;e[39]!==N?(A=s.jsxs(tt,{variant:"destructive",onClick:N,children:[P,"Remove Member"]}),e[39]=N,e[40]=A):A=e[40];let R;e[41]!==C||e[42]!==A||e[43]!==j||e[44]!==b||e[45]!==f?(R=s.jsxs(C,{align:j,onClick:b,children:[f,O,A]}),e[41]=C,e[42]=A,e[43]=j,e[44]=b,e[45]=f,e[46]=R):R=e[46];let L;return e[47]!==d||e[48]!==R||e[49]!==I?(L=s.jsxs(d,{children:[I,R]}),e[47]=d,e[48]=R,e[49]=I,e[50]=L):L=e[50],L}function jn(t){return t.stopPropagation()}function Tn(t){return t.stopPropagation()}function Mt(t){const e=le.c(8),{invitationId:n,onCancel:r,isCancelling:l}=t,o=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Nn,children:s.jsx($t,{size:20})})}),e[0]=c):c=e[0];let i;e[1]!==n||e[2]!==r?(i=m=>{m.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=i):i=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ft,{size:16}),e[4]=u):u=e[4];let x;return e[5]!==o||e[6]!==i?(x=s.jsxs(Ct,{children:[c,s.jsx(Tt,{align:"end",onClick:vn,children:s.jsxs(tt,{variant:"destructive",onClick:i,disabled:o,children:[u,"Cancel Invitation"]})})]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function vn(t){return t.stopPropagation()}function Nn(t){return t.stopPropagation()}function En(){const t=le.c(79),{data:e}=bt(),{data:n}=rn(),r=on(),l=we(),{locator:o}=Ce(),[c,i]=D.useState(null),[u,x]=D.useState(null),[m,C]=D.useState(""),[d,v]=D.useState("table"),[g,j]=D.useState("member"),[b,I]=D.useState("asc"),T=e?.data?.members;let f;t[0]!==g?(f=z=>{g===z?I(kn):(j(z),I("asc"))},t[0]=g,t[1]=f):f=t[1];const O=f;let N=T??[],P=n??[];if(m){const z=m.toLowerCase();N=N.filter($=>$.user?.name?.toLowerCase().includes(z)||$.user?.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z)),P=P.filter($=>$.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z))}if(g&&b){let z;t[2]!==b||t[3]!==g?(z=($,oe)=>{let xe,Le;e:switch(g){case"member":{xe=$.user?.name||"",Le=oe.user?.name||"";break e}case"role":{xe=$.role||"",Le=oe.role||"";break e}case"joined":{xe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",Le=oe.createdAt?typeof oe.createdAt=="string"?oe.createdAt:oe.createdAt.toISOString():"";break e}default:return 0}return b==="asc"?xe.localeCompare(Le):Le.localeCompare(xe)},t[2]=b,t[3]=g,t[4]=z):z=t[4],N=[...N].sort(z)}const A=N;let R;t[5]!==o||t[6]!==l?(R={mutationFn:zn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.members(o)}),ne.success("Member has been removed from the organization"),i(null)},onError:Dn},t[5]=o,t[6]=l,t[7]=R):R=t[7];const L=Te(R);let M;t[8]!==o||t[9]!==l?(M={mutationFn:Mn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.members(o)}),ne.success("Member's role has been updated")},onError:Pn},t[8]=o,t[9]=l,t[10]=M):M=t[10];const w=Te(M);let h;t[11]!==o||t[12]!==l?(h={mutationFn:Rn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.invitations(o)}),ne.success("Invitation role has been updated")},onError:_n},t[11]=o,t[12]=l,t[13]=h):h=t[13];const S=Te(h),{roles:E,customRoles:p}=Nt();let _;t[14]!==p?(_=bn(p),t[14]=p,t[15]=_):_=t[15];const k=_;let B;t[16]!==E?(B=E.filter(Ln),t[16]=E,t[17]=B):B=t[17];const q=B;let Q;t[18]===Symbol.for("react.memo_cache_sentinel")?(Q={id:"member",header:"Member",render:wn,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=Q):Q=t[18];let H;t[19]!==k||t[20]!==q||t[21]!==S||t[22]!==w?(H={id:"role",header:"Role",render:z=>z.type==="member"?s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:z.data.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>w.mutate({memberId:$,role:oe}),className:"w-36"}):s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>S.mutate({invitationId:$,role:oe,email:z.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=k,t[20]=q,t[21]=S,t[22]=w,t[23]=H):H=t[23];let Z,se;t[24]===Symbol.for("react.memo_cache_sentinel")?(Z={id:"tags",header:"Tags",render:An,cellClassName:"w-40 shrink-0"},se={id:"joined",header:"Joined",render:On,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=Z,t[25]=se):(Z=t[24],se=t[25]);let J;t[26]!==r.cancel.isPending||t[27]!==E||t[28]!==w?(J={id:"actions",header:"",render:z=>z.type==="member"?s.jsx(Pt,{member:z.data,roles:E,onChangeRole:($,oe)=>w.mutate({memberId:$,role:oe}),onRemove:i,isUpdating:w.isPending}):s.jsx(Mt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=r.cancel.isPending,t[27]=E,t[28]=w,t[29]=J):J=t[29];let U;t[30]!==J||t[31]!==H?(U=[Q,H,Z,se,J],t[30]=J,t[31]=H,t[32]=U):U=t[32];const a=U;let y;t[33]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(en,{trigger:s.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(vt,{size:16}),"Manage Roles"]})}),t[33]=y):y=t[33];let F;t[34]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs("div",{className:"flex items-center gap-2",children:[y,s.jsx(nn,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=F):F=t[34];const me=F,te=[...A.map(In),...P.filter(Sn).map(yn)],W=Ne,ee=!!u;let de;t[35]===Symbol.for("react.memo_cache_sentinel")?(de=()=>x(null),t[35]=de):de=t[35];let V;t[36]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Cancel Invitation"}),s.jsx(Be,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[36]=V):V=t[36];let G;t[37]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx($e,{children:"Keep Invitation"}),t[37]=G):G=t[37];let Y;t[38]!==r.cancel||t[39]!==u?(Y=()=>{u&&(r.cancel.mutate(u),x(null))},t[38]=r.cancel,t[39]=u,t[40]=Y):Y=t[40];let re;t[41]!==r.cancel.isPending||t[42]!==Y?(re=s.jsxs(ke,{children:[V,s.jsxs(Ge,{children:[G,s.jsx(Fe,{onClick:Y,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=r.cancel.isPending,t[42]=Y,t[43]=re):re=t[43];let ue;t[44]!==ee||t[45]!==re?(ue=s.jsx(ze,{open:ee,onOpenChange:de,children:re}),t[44]=ee,t[45]=re,t[46]=ue):ue=t[46];const pe=!!c;let fe;t[47]===Symbol.for("react.memo_cache_sentinel")?(fe=()=>i(null),t[47]=fe):fe=t[47];let he;t[48]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Remove Member"}),s.jsx(Be,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=he):he=t[48];let je;t[49]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx($e,{children:"Cancel"}),t[49]=je):je=t[49];let K;t[50]!==c||t[51]!==L?(K=()=>c&&L.mutate(c),t[50]=c,t[51]=L,t[52]=K):K=t[52];let ge;t[53]!==L.isPending||t[54]!==K?(ge=s.jsxs(ke,{children:[he,s.jsxs(Ge,{children:[je,s.jsx(Fe,{onClick:K,disabled:L.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=L.isPending,t[54]=K,t[55]=ge):ge=t[55];let be;t[56]!==pe||t[57]!==ge?(be=s.jsx(ze,{open:pe,onOpenChange:fe,children:ge}),t[56]=pe,t[57]=ge,t[58]=be):be=t[58];let ye;t[59]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(Ne.Header.Left,{children:s.jsx(ns,{children:s.jsx(rs,{children:s.jsx(is,{children:s.jsx(os,{children:"Members"})})})})}),t[59]=ye):ye=t[59];let He;t[60]===Symbol.for("react.memo_cache_sentinel")?(He=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=He):He=t[60];let Se;t[61]!==O||t[62]!==b||t[63]!==g||t[64]!==d?(Se=s.jsxs(Ne.Header,{children:[ye,s.jsxs(Ne.Header.Right,{children:[s.jsx(ts,{viewMode:d,onViewModeChange:v,sortKey:g,sortDirection:b,onSort:O,sortOptions:He}),me]})]}),t[61]=O,t[62]=b,t[63]=g,t[64]=d,t[65]=Se):Se=t[65];let Ze;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ze=z=>{z.key==="Escape"&&(C(""),z.target.blur())},t[66]=Ze):Ze=t[66];let Ie;t[67]!==m?(Ie=s.jsx(Ke,{value:m,onChange:C,placeholder:"Search members...",onKeyDown:Ze}),t[67]=m,t[68]=Ie):Ie=t[68];const ot=Ne,lt=d==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:te.length===0?s.jsx(ct,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(z=>{if(z.type==="invitation")return s.jsxs(Lt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Mt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{fallback:rt(z.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:z.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ee,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>S.mutate({invitationId:oe,role:xe,email:z.data.email}),className:"w-fit"})]})]})]},`inv-${z.data.id}`);const $=z.data;return s.jsxs(Lt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Pt,{member:$,roles:E,onChangeRole:(oe,xe)=>w.mutate({memberId:oe,role:xe}),onRemove:i,isUpdating:w.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{url:$.user?.image??void 0,fallback:rt($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),s.jsx(et,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>w.mutate({memberId:oe,role:xe}),className:"w-fit"}),s.jsx(Zt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ss,{columns:a,data:te,isLoading:!1,sortKey:g,sortDirection:b,onSort:O,emptyState:m?s.jsx(ct,{title:"No members found",description:`No members match "${m}"`}):s.jsx(ct,{title:"No members found",description:"Invite members to get started."})});let Oe;t[69]!==ot.Content||t[70]!==lt?(Oe=s.jsx(ot.Content,{children:lt}),t[69]=ot.Content,t[70]=lt,t[71]=Oe):Oe=t[71];let Ye;return t[72]!==W||t[73]!==ue||t[74]!==be||t[75]!==Se||t[76]!==Ie||t[77]!==Oe?(Ye=s.jsxs(W,{children:[ue,be,Se,Ie,Oe]}),t[72]=W,t[73]=ue,t[74]=be,t[75]=Se,t[76]=Ie,t[77]=Oe,t[78]=Ye):Ye=t[78],Ye}function yn(t){return{type:"invitation",data:t}}function Sn(t){return t.status==="pending"}function In(t){return{type:"member",data:t}}function On(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?Cn(t.data.createdAt):"N/A"}):s.jsx(Ee,{variant:"outline",children:"Pending"})}function An(t){return t.type==="member"?s.jsx(Zt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function wn(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{url:t.data.user?.image??void 0,fallback:rt(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{fallback:rt(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Ln(t){return t.role!=="owner"}function _n(t){ne.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Rn(t){const{invitationId:e,role:n,email:r}=t,l=await ae.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const o=await ae.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function Pn(t){ne.error(t instanceof Error?t.message:"Failed to update role")}async function Mn(t){const{memberId:e,role:n}=t,r=await ae.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function Dn(t){ne.error(t instanceof Error?t.message:"Failed to remove member")}async function zn(t){const e=await ae.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function kn(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Or(){const t=le.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ne,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ts,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(Ne,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(En,{})})}),t[1]=n):n=t[1],n}export{Or as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,bt as N,j as _,c as Me,bo as te}from"./index-
|
|
1
|
+
import{r as a,bt as N,j as _,c as Me,bo as te}from"./index-CHQ9-Q-G.js";import{S as me}from"./spinner-CEhxpPPn.js";const Pe=({size:e=24,color:t="currentColor",...r})=>a.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},a.createElement("path",{d:"M12 6v6l4 2m6-2c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Pe.displayName="Clock";function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Re(e){if(Array.isArray(e))return e}function Se(e,t,r){return(t=Ve(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,u,l=[],c=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(O){g=!0,o=O}finally{try{if(!c&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(g)throw o}}return l}}function Te(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Se(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _e(e,t){if(e==null)return{};var r,n,o=Ce(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Ce(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ie(e,t){return Re(e)||xe(e,t)||Ae(e,t)||Te()}function Le(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ve(e){var t=Le(e,"string");return typeof t=="symbol"?t:t+""}function Ae(e,t){if(e){if(typeof e=="string")return ue(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}function $e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?le(Object(r),!0).forEach(function(n){$e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ne(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function k(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Q(e){return{}.toString.call(e).includes("Object")}function De(e){return!Object.keys(e).length}function W(e){return typeof e=="function"}function ze(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ke(e,t){return Q(t)||T("changeType"),Object.keys(t).some(function(r){return!ze(e,r)})&&T("changeField"),t}function Ke(e){W(e)||T("selectorType")}function We(e){W(e)||Q(e)||T("handlerType"),Q(e)&&Object.values(e).some(function(t){return!W(t)})&&T("handlersType")}function qe(e){e||T("initialIsRequired"),Q(e)||T("initialType"),De(e)&&T("initialContent")}function Fe(e,t){throw new Error(e[t]||e.default)}var Ue={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},T=k(Fe)(Ue),B={changes:ke,selector:Ke,handler:We,initial:qe};function Be(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};B.initial(e),B.handler(t);var r={current:e},n=k(Qe)(r,t),o=k(He)(r),i=k(B.changes)(e),u=k(Je)(r);function l(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(O){return O};return B.selector(g),g(r.current)}function c(g){Ne(n,o,i,u)(g)}return[l,c]}function Je(e,t){return W(t)?t(e.current):t}function He(e,t){return e.current=fe(fe({},e.current),t),t}function Qe(e,t,r){return W(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Ge={create:Be},Ye={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ze(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Xe(e){return{}.toString.call(e).includes("Object")}function et(e){return e||de("configIsRequired"),Xe(e)||de("configType"),e.urls?(tt(),{paths:{vs:e.urls.monacoBase}}):e}function tt(){console.warn(he.deprecation)}function rt(e,t){throw new Error(e[t]||e.default)}var he={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|