@decocms/mesh 2.20.0 → 2.20.2

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.
Files changed (146) hide show
  1. package/dist/client/assets/{AlertCircle-CkNvGXW2.js → AlertCircle-CI2U-jkN.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-BsUDOBX0.js → ArrowLeft-B3km7toT.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-Xq_0RBx_.js → ArrowUp-BF7mM4C2.js} +1 -1
  4. package/dist/client/assets/{Check-DijrPXQx.js → Check-BQkm1TiP.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DASi-DMo.js → ChevronDown-DP6jvip7.js} +1 -1
  6. package/dist/client/assets/{Code01-C0ZFF6Hl.js → Code01-qXTn9GK9.js} +1 -1
  7. package/dist/client/assets/{Copy01-BQZg7H8u.js → Copy01-CEYn2daS.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-CjU9uXdh.js → DotsHorizontal-C2Nr-D-f.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-D6TZm5RT.js → DotsVertical-BPP4U4GQ.js} +1 -1
  10. package/dist/client/assets/{Download01-BTR8eSV6.js → Download01-BkDXja2z.js} +1 -1
  11. package/dist/client/assets/{Edit01-BsdLQ-QO.js → Edit01-Cq0mQDLh.js} +1 -1
  12. package/dist/client/assets/{File06-Bm9rDm48.js → File06-KMD38I-q.js} +1 -1
  13. package/dist/client/assets/{FilterLines-Dg_ubOas.js → FilterLines-Bojt6HPl.js} +1 -1
  14. package/dist/client/assets/{FlipBackward-BZkXBjUF.js → FlipBackward-C-K9FamE.js} +1 -1
  15. package/dist/client/assets/{GitBranch01-DYs19mSG.js → GitBranch01-DGTCzEh5.js} +1 -1
  16. package/dist/client/assets/{Grid01-CTb93Z2I.js → Grid01-D4lXvveX.js} +1 -1
  17. package/dist/client/assets/{Home02-CAgSUdC-.js → Home02-DPdZvu8L.js} +1 -1
  18. package/dist/client/assets/{Image01-CUinB3ac.js → Image01-C0R6SF_P.js} +1 -1
  19. package/dist/client/assets/{Inbox01-tMW4EgP4.js → Inbox01-BsOUYwQZ.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-DqeM4n2r.js → InfoCircle-BgIkbjJr.js} +1 -1
  21. package/dist/client/assets/{Key01-BDVEoltU.js → Key01-DTwk4FpG.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-C2ZOZHgx.js → LinkExternal01-DmruqAb9.js} +1 -1
  23. package/dist/client/assets/{List-jMJevXfS.js → List-BsSZz32j.js} +1 -1
  24. package/dist/client/assets/{Loading01-6JGza9Vp.js → Loading01-Ae5ezbtD.js} +1 -1
  25. package/dist/client/assets/{Lock01-DAc7yIAH.js → Lock01-BuQSktMF.js} +1 -1
  26. package/dist/client/assets/{Play-BWxFDrEk.js → Play-DKlNHVjf.js} +1 -1
  27. package/dist/client/assets/{Plus-Dcgso5EP.js → Plus-CdG75X26.js} +1 -1
  28. package/dist/client/assets/{SearchMd-CbnCIalV.js → SearchMd-GFaonOaJ.js} +1 -1
  29. package/dist/client/assets/{Terminal-DNtUg1U7.js → Terminal-C6mZx-5A.js} +1 -1
  30. package/dist/client/assets/{Trash01-CzA8mxf_.js → Trash01-BWIN9RL_.js} +1 -1
  31. package/dist/client/assets/{Upload01-BPJ4Vq2H.js → Upload01-CaBE4VYK.js} +1 -1
  32. package/dist/client/assets/{X-C7-BOCtk.js → X-C18ho617.js} +1 -1
  33. package/dist/client/assets/{XClose-COetRF8H.js → XClose-CfwoKknl.js} +1 -1
  34. package/dist/client/assets/{alert-dialog-Mcf5ObRp.js → alert-dialog-CCJCsKzK.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-JCvomRO1.js → auth-catchall-C33VWmDE.js} +1 -1
  36. package/dist/client/assets/{avatar-D0pQKePK.js → avatar-B7xnPXuk.js} +1 -1
  37. package/dist/client/assets/{badge-9bzwrgbk.js → badge-BVO6I0sW.js} +1 -1
  38. package/dist/client/assets/{binder-B4r3FJOG.js → binder-By0LBK9Y.js} +1 -1
  39. package/dist/client/assets/{button-C_Xg9B1B.js → button-CGmrzkpY.js} +1 -1
  40. package/dist/client/assets/{card-BXLd4InC.js → card-DIjMh1NO.js} +1 -1
  41. package/dist/client/assets/{checkbox-z9w2qryt.js → checkbox-DYViXeUc.js} +1 -1
  42. package/dist/client/assets/{collection-detail-zSSQWfP2.js → collection-detail-DtlOJm8P.js} +1 -1
  43. package/dist/client/assets/{collection-display-button-DNzo_eaI.js → collection-display-button-CtkxsCB_.js} +1 -1
  44. package/dist/client/assets/{collection-header-DMI-enxo.js → collection-header-B4qcjEt5.js} +1 -1
  45. package/dist/client/assets/{collection-page-CPVm36im.js → collection-page-s-RR5fU6.js} +1 -1
  46. package/dist/client/assets/{collection-search-NPXhv3P8.js → collection-search-BVb42O45.js} +1 -1
  47. package/dist/client/assets/{collection-tab-DoDfK_be.js → collection-tab-CvrhLJCU.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-CH0cDKjW.js → collection-table-wrapper-BohFZqii.js} +1 -1
  49. package/dist/client/assets/{connection-DoXpv3Ov.js → connection-ChwHK0-S.js} +1 -1
  50. package/dist/client/assets/{connection-card-zeRxy9uc.js → connection-card-DMMfNQUo.js} +1 -1
  51. package/dist/client/assets/{connection-detail-vV4L4jYp.js → connection-detail-D9bORT-_.js} +1 -1
  52. package/dist/client/assets/{connections-DNpwgzUU.js → connections-CRhyn7eO.js} +1 -1
  53. package/dist/client/assets/constants-J0aH6mLs.js +1 -0
  54. package/dist/client/assets/{create-organization-dialog-Ro3igzlR.js → create-organization-dialog-CtbMd6S_.js} +1 -1
  55. package/dist/client/assets/{dialog-C9Agm5JE.js → dialog-DJJ2cvEE.js} +1 -1
  56. package/dist/client/assets/{dropdown-menu-fQ8f1M5d.js → dropdown-menu-CAeD2aIb.js} +1 -1
  57. package/dist/client/assets/{dynamic-plugin-layout-B3cv12GM.js → dynamic-plugin-layout-BeSg8wRq.js} +1 -1
  58. package/dist/client/assets/{empty-state-DdUozeuW.js → empty-state-BkAB-hls.js} +1 -1
  59. package/dist/client/assets/{empty-state-DBRX3hef.js → empty-state-wP9uukGJ.js} +1 -1
  60. package/dist/client/assets/{env-vars-editor-BXw6d8cC.js → env-vars-editor-DuH6BBdA.js} +1 -1
  61. package/dist/client/assets/{error-boundary-yHT4ni_0.js → error-boundary-BUvK8Sry.js} +1 -1
  62. package/dist/client/assets/{extract-connection-data-PVjaut0P.js → extract-connection-data-BLs0SRok.js} +1 -1
  63. package/dist/client/assets/{file-browser-Bh7hl3h8.js → file-browser-DuR45yyf.js} +2 -2
  64. package/dist/client/assets/{form-D_wQlmgT.js → form-DiGzBnRK.js} +1 -1
  65. package/dist/client/assets/gateway-detail-BCBmyW-G.js +1 -0
  66. package/dist/client/assets/{gateways-B0QSXg4v.js → gateways-BgSVXbfx.js} +1 -1
  67. package/dist/client/assets/{grid-view-BsHjiotE.js → grid-view-Db741zGU.js} +1 -1
  68. package/dist/client/assets/{home-m3uBo7L5.js → home-BtJc_wcZ.js} +1 -1
  69. package/dist/client/assets/{index-QjJpaT60.js → index-CL_rL7XJ.js} +4 -4
  70. package/dist/client/assets/{index-Cg8UjPnN.js → index-D4QCsSzb.js} +1 -1
  71. package/dist/client/assets/index-DUA-vRuy.js +1 -0
  72. package/dist/client/assets/{index-DZBCLPmz.js → index-Diww4UW3.js} +2 -2
  73. package/dist/client/assets/{index-3IJwc3nu.js → index-DjRWdLI4.js} +1 -1
  74. package/dist/client/assets/index-H07QDM93.css +1 -0
  75. package/dist/client/assets/{infiniteQueryObserver-CB9iuYaY.js → infiniteQueryObserver-BmbQcWdI.js} +1 -1
  76. package/dist/client/assets/{input-DrOaW48H.js → input-CrURMEZe.js} +1 -1
  77. package/dist/client/assets/{layout-B4oQiZN6.js → layout-kp8TTJc9.js} +1 -1
  78. package/dist/client/assets/{lazy-highlighter-CSmD3B45.js → lazy-highlighter-dN3WcL6s.js} +1 -1
  79. package/dist/client/assets/{localstorage-keys-ColTY5EO.js → localstorage-keys-BVANkONM.js} +1 -1
  80. package/dist/client/assets/{login-BdRlUNll.js → login-CnuJ6k4x.js} +1 -1
  81. package/dist/client/assets/{mcp-oauth-CcVuDlog.js → mcp-oauth-CdcIczUJ.js} +1 -1
  82. package/dist/client/assets/{mcp-server-card-BnclXini.js → mcp-server-card-VZUBDTRj.js} +1 -1
  83. package/dist/client/assets/{mcp-server-detail-DTSTQPDK.js → mcp-server-detail-CIR0FKMd.js} +1 -1
  84. package/dist/client/assets/{members-BAse2YpR.js → members-bQTH1spX.js} +1 -1
  85. package/dist/client/assets/{monaco-editor-BtLswDg1.js → monaco-editor-CDRbE4GY.js} +1 -1
  86. package/dist/client/assets/{monitoring-FELvrXqN.js → monitoring-Cb41cf-X.js} +1 -1
  87. package/dist/client/assets/{oauth-callback-sXSk4y6N.js → oauth-callback-z6t0OToi.js} +1 -1
  88. package/dist/client/assets/{page-IVcVoGr6.js → page-CcKdSzCp.js} +1 -1
  89. package/dist/client/assets/{page-c25MW39x.js → page-SWPgLEpC.js} +1 -1
  90. package/dist/client/assets/{pin-to-sidebar-button-D7zfHxC-.js → pin-to-sidebar-button-DIwkO0Tx.js} +1 -1
  91. package/dist/client/assets/{plugin-empty-state-DINK0udh.js → plugin-empty-state-B-glkOMH.js} +1 -1
  92. package/dist/client/assets/{plugin-header-BaOkI6uW.js → plugin-header-BA0z5mBU.js} +1 -1
  93. package/dist/client/assets/{plugins-DU28fvG7.js → plugins-Cq62fkYj.js} +1 -1
  94. package/dist/client/assets/{popover-DDq46px5.js → popover-Bx7diZ86.js} +1 -1
  95. package/dist/client/assets/{project-context-provider-CwtkfEWe.js → project-context-provider-DulCVL2k.js} +1 -1
  96. package/dist/client/assets/{registry-utils-nz3H3-qh.js → registry-utils-8Lvx2XTy.js} +1 -1
  97. package/dist/client/assets/{resizable-ZYLqRZrr.js → resizable-Gk1RjNnW.js} +1 -1
  98. package/dist/client/assets/{resource-tabs-Dv00g9SH.js → resource-tabs-ACbF96qo.js} +1 -1
  99. package/dist/client/assets/{select-Cgab7LNB.js → select-C8LOz7vA.js} +1 -1
  100. package/dist/client/assets/{settings-CUngx_cw.js → settings-BXJ6BGel.js} +1 -1
  101. package/dist/client/assets/shell-layout-CFRw9Ru3.js +3 -0
  102. package/dist/client/assets/{spinner-ISlo4YZH.js → spinner-BF56RAKQ.js} +1 -1
  103. package/dist/client/assets/{switch-BDCe2nGJ.js → switch-DJBd8Fzb.js} +1 -1
  104. package/dist/client/assets/{textarea-BL4bZEBo.js → textarea-C_zgj3Sp.js} +1 -1
  105. package/dist/client/assets/{tool-set-selector-CWxawPKU.js → tool-set-selector-B9rTBahU.js} +1 -1
  106. package/dist/client/assets/{tools-list-BAdvjUaK.js → tools-list-mr-l2d8l.js} +1 -1
  107. package/dist/client/assets/{tooltip-CpJ7mUzE.js → tooltip-Suu_Gpqh.js} +1 -1
  108. package/dist/client/assets/{typewriter-title-vVGiDyZ3.js → typewriter-title-DM-oRxie.js} +1 -1
  109. package/dist/client/assets/{use-binding-DGnotkAI.js → use-binding-D6wv_5fO.js} +1 -1
  110. package/dist/client/assets/{use-collections-BmF5uRR6.js → use-collections-CXETocKO.js} +1 -1
  111. package/dist/client/assets/{use-connection-CD3KQhdl.js → use-connection-CCXutWLD.js} +1 -1
  112. package/dist/client/assets/{use-connection-resources-Bk8Paqb0.js → use-connection-resources-D0st76bP.js} +1 -1
  113. package/dist/client/assets/{use-create-gateway-Buvj1BPg.js → use-create-gateway-BlLsktgc.js} +1 -1
  114. package/dist/client/assets/{use-gateway-HT97xIYl.js → use-gateway-DD-xEZju.js} +1 -1
  115. package/dist/client/assets/{use-gateway-system-prompt-DPiQIOlu.js → use-gateway-system-prompt-zGJSEzce.js} +1 -1
  116. package/dist/client/assets/{use-list-state-DceT21J-.js → use-list-state-AndcW8aD.js} +1 -1
  117. package/dist/client/assets/{use-mcp-C2xjgZVM.js → use-mcp-D9llr83X.js} +1 -1
  118. package/dist/client/assets/{use-members-D-h9QOxK.js → use-members-CB2ebBfn.js} +1 -1
  119. package/dist/client/assets/{use-mobile-BH2x5CB1.js → use-mobile-DssCtDl6.js} +1 -1
  120. package/dist/client/assets/{use-organization-settings-BMsrsPvw.js → use-organization-settings-CQXtXtZs.js} +1 -1
  121. package/dist/client/assets/{use-tool-call-BmQnCqef.js → use-tool-call-BmvKn7jp.js} +1 -1
  122. package/dist/client/assets/useInfiniteQuery-BttwTOfK.js +1 -0
  123. package/dist/client/assets/{useMutation-DV6K6Nze.js → useMutation-Dl1MMkEC.js} +1 -1
  124. package/dist/client/assets/useQuery-Bvk0U2ed.js +1 -0
  125. package/dist/client/assets/{value-BiYWDF0x.js → value-DaPOjTmC.js} +1 -1
  126. package/dist/client/assets/{view-mode-toggle-DPk8_aIn.js → view-mode-toggle-BLClM-0g.js} +1 -1
  127. package/dist/client/assets/{workflow-B_8Qc7GH.js → workflow-CQ7PQ7Dg.js} +1 -1
  128. package/dist/client/index.html +2 -2
  129. package/dist/server/cli.js +1 -1
  130. package/dist/server/node_modules/kysely/README.md +3 -1
  131. package/dist/server/node_modules/kysely/dist/cjs/index.d.ts +3 -1
  132. package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.d.ts +1 -1
  133. package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.js +75 -68
  134. package/dist/server/node_modules/kysely/dist/esm/index.d.ts +3 -1
  135. package/dist/server/node_modules/kysely/dist/esm/migration/migrator.d.ts +1 -1
  136. package/dist/server/node_modules/kysely/dist/esm/migration/migrator.js +75 -68
  137. package/dist/server/node_modules/kysely/package.json +13 -13
  138. package/dist/server/server.js +1 -1
  139. package/package.json +1 -1
  140. package/dist/client/assets/constants-CBp9PjFO.js +0 -1
  141. package/dist/client/assets/gateway-detail-B6I6y-jz.js +0 -1
  142. package/dist/client/assets/index-Dh9ePU0t.css +0 -1
  143. package/dist/client/assets/index-DiisCGqz.js +0 -1
  144. package/dist/client/assets/shell-layout-IdYGAQZJ.js +0 -3
  145. package/dist/client/assets/useInfiniteQuery-hrzJXDha.js +0 -1
  146. package/dist/client/assets/useQuery-mZS4-X0F.js +0 -1
@@ -1 +1 @@
1
- import{r as B,c as V,j as a}from"./index-DZBCLPmz.js";import{b as O,T as q,c as J}from"./tooltip-CpJ7mUzE.js";import{c as M,B as K}from"./button-C_Xg9B1B.js";import{s as Q}from"./registry-utils-nz3H3-qh.js";import{i as X}from"./Lock01-DAc7yIAH.js";import{s as Y}from"./Plus-Dcgso5EP.js";import{i as ee}from"./Terminal-DNtUg1U7.js";import{C as te}from"./card-BXLd4InC.js";import{I as se}from"./empty-state-DBRX3hef.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(Q,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(ee,{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,m=t?s.protocol:null,c=t?s.isInstalling:!1,d=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(se,{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(X,{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]!==m?(k=t&&m&&a.jsx(re,{protocol:m}),e[18]=t,e[19]=m,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(O,{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(q,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(J,{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]!==d||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(K,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(Y,{size:16}),c?"Connecting...":d||"Connect"]}),e[53]=d,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(te,{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 m=e,c=null;if(e.includes("/")){const d=e.split("/");d.length>=2&&(c=d[0]||null,m=ie(e))}if(!c){const d=l?.scopeName,p=l?.appName;d&&p?c=`${d}/${p}`:d&&(c=d)}return l?.friendly_name&&(m=l.friendly_name),{icon:n,scopeName:c,displayName:m,description:i,isVerified:r,canInstall:f}}function Ne(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 m;e[5]!==n?(m=c=>{const d=ce(c);return a.jsx(oe,{...d,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=m):m=e[6],o=l.map(m),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{Ne as M,oe as a,W as b,ie as e};
1
+ import{r as B,c as V,j as a}from"./index-Diww4UW3.js";import{b as O,T as q,c as J}from"./tooltip-Suu_Gpqh.js";import{c as M,B as K}from"./button-CGmrzkpY.js";import{s as Q}from"./registry-utils-8Lvx2XTy.js";import{i as X}from"./Lock01-BuQSktMF.js";import{s as Y}from"./Plus-CdG75X26.js";import{i as ee}from"./Terminal-C6mZx-5A.js";import{C as te}from"./card-DIjMh1NO.js";import{I as se}from"./empty-state-wP9uukGJ.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(Q,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(ee,{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,m=t?s.protocol:null,c=t?s.isInstalling:!1,d=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(se,{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(X,{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]!==m?(k=t&&m&&a.jsx(re,{protocol:m}),e[18]=t,e[19]=m,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(O,{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(q,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(J,{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]!==d||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(K,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(Y,{size:16}),c?"Connecting...":d||"Connect"]}),e[53]=d,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(te,{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 m=e,c=null;if(e.includes("/")){const d=e.split("/");d.length>=2&&(c=d[0]||null,m=ie(e))}if(!c){const d=l?.scopeName,p=l?.appName;d&&p?c=`${d}/${p}`:d&&(c=d)}return l?.friendly_name&&(m=l.friendly_name),{icon:n,scopeName:c,displayName:m,description:i,isVerified:r,canInstall:f}}function Ne(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 m;e[5]!==n?(m=c=>{const d=ce(c);return a.jsx(oe,{...d,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=m):m=e[6],o=l.map(m),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{Ne as M,oe as a,W as b,ie as e};
@@ -1 +1 @@
1
- import{r as q,c as R,j as s,f as $e,d as Qe,b as Xe,a as Ye,t as Le}from"./index-DZBCLPmz.js";import{i as Ze}from"./AlertCircle-CkNvGXW2.js";import{i as De}from"./Loading01-6JGza9Vp.js";import{B as ae,c as Je}from"./button-C_Xg9B1B.js";import{i as et}from"./ArrowLeft-BsUDOBX0.js";import{I as Re,E as tt}from"./empty-state-DBRX3hef.js";import{i as st,e as ot}from"./extract-connection-data-PVjaut0P.js";import{t as rt}from"./ChevronDown-DASi-DMo.js";import{s as Pe}from"./Plus-Dcgso5EP.js";import{D as nt,c as it,a as lt,b as at}from"./dropdown-menu-fQ8f1M5d.js";import{n as Me}from"./LinkExternal01-C2ZOZHgx.js";import{T as ct,R as dt}from"./tools-list-BAdvjUaK.js";import{R as mt}from"./resource-tabs-Dv00g9SH.js";import{s as ft,f as ut,g as pt,c as xt}from"./registry-utils-nz3H3-qh.js";import{a as ht,b as gt,e as vt}from"./mcp-server-card-BnclXini.js";import{i as bt}from"./Terminal-DNtUg1U7.js";import{a as jt,u as yt,b as Nt}from"./use-connection-CD3KQhdl.js";import{u as St}from"./use-binding-DGnotkAI.js";import{u as Ct}from"./use-tool-call-BmQnCqef.js";import{u as wt}from"./use-mcp-C2xjgZVM.js";import{u as _t,L as It}from"./localstorage-keys-ColTY5EO.js";import{u as Ee}from"./project-context-provider-CwtkfEWe.js";import{s as kt}from"./slugify-CEUa2lfQ.js";import{e as Tt,g as Lt}from"./github-icon-Dp3wHhYE.js";import{i as Pt}from"./InfoCircle-DqeM4n2r.js";import{c as Mt}from"./connection-DoXpv3Ov.js";import"./constants-CBp9PjFO.js";import"./generate-id-Dyweu44Y.js";import"./Grid01-CTb93Z2I.js";import"./useQuery-mZS4-X0F.js";import"./File06-Bm9rDm48.js";import"./collection-display-button-DNzo_eaI.js";import"./ArrowUp-Xq_0RBx_.js";import"./Check-DijrPXQx.js";import"./List-jMJevXfS.js";import"./tooltip-CpJ7mUzE.js";import"./view-mode-toggle-DPk8_aIn.js";import"./collection-search-NPXhv3P8.js";import"./SearchMd-CbnCIalV.js";import"./input-DrOaW48H.js";import"./collection-table-wrapper-CH0cDKjW.js";import"./card-BXLd4InC.js";import"./layout-B4oQiZN6.js";import"./badge-9bzwrgbk.js";import"./Lock01-DAc7yIAH.js";import"./use-collections-BmF5uRR6.js";import"./useMutation-DV6K6Nze.js";import"./binder-B4r3FJOG.js";const Ae=({size:t=24,color:e="currentColor",...o})=>q.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},q.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"}));Ae.displayName="SearchLg";function Vt(t){const e=R.c(3),{message:o}=t,r=o===void 0?"Loading MCP Server details...":o;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(De,{size:48,className:"animate-spin mb-4"}),e[0]=n):n=e[0];let i;return e[1]!==r?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,s.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),e[1]=r,e[2]=i):i=e[2],i}function $t(t){const e=R.c(9),{error:o,onBack:r}=t,n=o instanceof Error?o.message:o;let i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ze,{size:48,className:"text-destructive mb-4"}),a=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading MCP Server"}),e[0]=i,e[1]=a):(i=e[0],a=e[1]);let c;e[2]!==n?(c=s.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:n}),e[2]=n,e[3]=c):c=e[3];let l;e[4]!==r?(l=s.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]=l):l=e[5];let d;return e[6]!==c||e[7]!==l?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,a,c,l]}),e[6]=c,e[7]=l,e[8]=d):d=e[8],d}function Dt(t){const e=R.c(5),{onBack:o}=t;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ae,{size:48,className:"text-muted-foreground mb-4"}),n=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"MCP Server not found"}),i=s.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 a;return e[3]!==o?(a=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,n,i,s.jsx("button",{onClick:o,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]=o,e[4]=a):a=e[4],a}function Rt(t){const e=R.c(3),{onBack:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(et,{}),e[0]=r):r=e[0];let n;return e[1]!==o?(n=s.jsx("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:s.jsx("div",{className:"flex h-full px-2 border-r items-center",children:s.jsx(ae,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:o,"aria-label":"Go back",children:r})})}),e[1]=o,e[2]=n):n=e[2],n}function Ve(t){const e=R.c(28),{versions:o,selectedIndex:r,onSelect:n,isInstalling:i,variant:a,showLabel:c}=t,l=i===void 0?!1:i,d=a===void 0?"brand":a,_=c===void 0?!1:c,p=o[r],y=_?"sm":"default",b=d==="brand"&&"rounded-l-none px-2 border-l-2 border-l-white/50";let I;e[0]!==b?(I=Je("shrink-0 cursor-pointer",b),e[0]=b,e[1]=I):I=e[1];let m;e[2]!==p?.server?.version||e[3]!==_?(m=_&&s.jsxs("span",{className:"mr-1",children:["v",p?.server?.version||"unknown"]}),e[2]=p?.server?.version,e[3]=_,e[4]=m):m=e[4];const N=_?14:20;let f;e[5]!==N?(f=s.jsx(rt,{size:N}),e[5]=N,e[6]=f):f=e[6];let v;e[7]!==l||e[8]!==y||e[9]!==I||e[10]!==m||e[11]!==f||e[12]!==d?(v=s.jsx(nt,{asChild:!0,children:s.jsxs(ae,{variant:d,disabled:l,size:y,className:I,children:[m,f]})}),e[7]=l,e[8]=y,e[9]=I,e[10]=m,e[11]=f,e[12]=d,e[13]=v):v=e[13];let x;if(e[14]!==l||e[15]!==n||e[16]!==r||e[17]!==o){let g;e[19]!==l||e[20]!==n||e[21]!==r?(g=(S,C)=>{const P=S._meta?.["io.modelcontextprotocol.registry/official"];return s.jsx(it,{onClick:()=>n(C),disabled:l,className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"font-medium text-sm",children:["v",S.server?.version||"unknown"]}),P?.isLatest&&s.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),C===r&&s.jsx(st,{size:16,className:"text-muted-foreground shrink-0"})]})},C)},e[19]=l,e[20]=n,e[21]=r,e[22]=g):g=e[22],x=o.map(g),e[14]=l,e[15]=n,e[16]=r,e[17]=o,e[18]=x}else x=e[18];let k;e[23]!==x?(k=s.jsx(lt,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:x}),e[23]=x,e[24]=k):k=e[24];let j;return e[25]!==v||e[26]!==k?(j=s.jsxs(at,{children:[v,k]}),e[25]=v,e[26]=k,e[27]=j):j=e[27],j}function Et(t){const e=R.c(46),{data:o,itemVersions:r,onInstall:n,canInstall:i,isInstalling:a,hideInstallControls:c,selectedVersionIndex:l,onVersionChange:d}=t,_=i===void 0?!0:i,p=a===void 0?!1:a,y=c===void 0?!1:c,[b,I]=q.useState(0),m=l??b;let N;e[0]!==d?(N=U=>{I(U),d?.(U)},e[0]=d,e[1]=N):N=e[1];const f=N,v=r[m]||r[0];let x;e[2]!==v?.server?.remotes?(x=v?.server?.remotes??[],e[2]=v?.server?.remotes,e[3]=x):x=e[3];const k=x;let j;e[4]!==v?.server?.packages?(j=v?.server?.packages??[],e[4]=v?.server?.packages,e[5]=j):j=e[5];const S=j.length>0,C=k.length>0,P=k.findIndex(Ut),h=P>=0?P:0;let K;e[6]!==h||e[7]!==S||e[8]!==C||e[9]!==n||e[10]!==m?(K=()=>{C?n(m,h,void 0):S&&n(m,void 0,0)},e[6]=h,e[7]=S,e[8]=C,e[9]=n,e[10]=m,e[11]=K):K=e[11];const E=K;let G;e[12]!==r||e[13]!==n||e[14]!==f?(G=U=>{f(U);const J=r[U],W=J?.server?.remotes??[],Q=J?.server?.packages??[];if(W.length>0){const X=W.findIndex(At);n(U,X>=0?X:0,void 0)}else Q.length>0&&n(U,void 0,0)},e[12]=r,e[13]=n,e[14]=f,e[15]=G):G=e[15];const L=G;let V;e[16]!==o.icon||e[17]!==o.name?(V=s.jsx(Re,{icon:o.icon,name:o.name,size:"lg",className:"shrink-0 shadow-sm"}),e[16]=o.icon,e[17]=o.name,e[18]=V):V=e[18];let M;e[19]!==o.name?(M=s.jsx("h1",{className:"text-3xl font-medium",children:o.name}),e[19]=o.name,e[20]=M):M=e[20];let z;e[21]!==o.verified?(z=o.verified&&s.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[21]=o.verified,e[22]=z):z=e[22];let O;e[23]!==M||e[24]!==z?(O=s.jsxs("div",{className:"flex items-center gap-2",children:[M,z]}),e[23]=M,e[24]=z,e[25]=O):O=e[25];let H;e[26]!==o.shortDescription?(H=o.shortDescription&&s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:o.shortDescription}),e[26]=o.shortDescription,e[27]=H):H=e[27];let $;e[28]!==O||e[29]!==H?($=s.jsxs("div",{className:"flex-1 min-w-0",children:[O,H]}),e[28]=O,e[29]=H,e[30]=$):$=e[30];let A;e[31]!==_||e[32]!==E||e[33]!==L||e[34]!==y||e[35]!==p||e[36]!==r||e[37]!==m||e[38]!==f?(A=_&&!y?s.jsx("div",{className:"shrink-0 flex items-center gap-2",children:r.length>1?s.jsxs("div",{className:"flex",children:[s.jsxs(ae,{variant:"brand",onClick:E,disabled:p,className:"shrink-0 rounded-r-none cursor-pointer",children:[s.jsx(Pe,{size:20}),p?"Connecting...":"Connect"]}),s.jsx(Ve,{versions:r,selectedIndex:m,onSelect:L,isInstalling:p,variant:"brand"})]}):s.jsxs(ae,{variant:"brand",onClick:E,disabled:r.length===0||p,className:"shrink-0 cursor-pointer",children:[s.jsx(Pe,{size:20}),p?"Connecting...":"Connect"]})}):y?r.length>1?s.jsx("div",{className:"shrink-0",children:s.jsx(Ve,{versions:r,selectedIndex:m,onSelect:f,isInstalling:p,variant:"outline",showLabel:!0})}):null:s.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[31]=_,e[32]=E,e[33]=L,e[34]=y,e[35]=p,e[36]=r,e[37]=m,e[38]=f,e[39]=A):A=e[39];let w;e[40]!==$||e[41]!==A?(w=s.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[$,A]}),e[40]=$,e[41]=A,e[42]=w):w=e[42];let T;return e[43]!==w||e[44]!==V?(T=s.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[V,w]}),e[43]=w,e[44]=V,e[45]=T):T=e[45],T}function At(t){return t.type?.toLowerCase()==="http"||t.type?.toLowerCase()==="streamable-http"}function Ut(t){return t.type?.toLowerCase()==="http"||t.type?.toLowerCase()==="streamable-http"}function Bt(t){if(!t)return"—";try{const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function zt(t){const e=R.c(47),{data:o,publisherInfo:r,selectedItem:n}=t;let i;e[0]!==o.description?(i=o.description&&s.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[s.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),s.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:o.description})]}),e[0]=o.description,e[1]=i):i=e[1];const a=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher;let c;e[2]!==r.logo||e[3]!==a?(c=s.jsx(Re,{icon:r.logo,name:a,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=r.logo,e[3]=a,e[4]=c):c=e[4];let l;e[5]!==o.publisher?(l=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher.charAt(0).toUpperCase()+o.publisher.slice(1),e[5]=o.publisher,e[6]=l):l=e[6];let d;e[7]!==l?(d=s.jsx("div",{className:"font-medium",children:l}),e[7]=l,e[8]=d):d=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("div",{className:"text-xs text-muted-foreground",children:"Publisher"}),e[9]=_):_=e[9];let p;e[10]!==d?(p=s.jsxs("div",{children:[d,_]}),e[10]=d,e[11]=p):p=e[11];let y;e[12]!==c||e[13]!==p?(y=s.jsx("div",{className:"px-5 border-b border-border",children:s.jsxs("div",{className:"flex items-center gap-3 py-5",children:[c,p]})}),e[12]=c,e[13]=p,e[14]=y):y=e[14];let b;e[15]!==o.version?(b=o.version&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Version"}),s.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",o.version]})]}),e[15]=o.version,e[16]=b):b=e[16];let I;e[17]!==o.tags?(I=o.tags&&o.tags.length>0&&s.jsxs("div",{className:"flex justify-between items-start text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:o.tags.map(Ft)})]}),e[17]=o.tags,e[18]=I):I=e[18];let m;e[19]!==o.categories?(m=o.categories&&o.categories.length>0&&s.jsxs("div",{className:"flex justify-between items-start text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:o.categories.map(Ot)})]}),e[19]=o.categories,e[20]=m):m=e[20];let N;e[21]!==o.connectionType?(N=o.connectionType&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:o.connectionType})]}),e[21]=o.connectionType,e[22]=N):N=e[22];let f;e[23]!==o.schemaVersion?(f=o.schemaVersion&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:o.schemaVersion})]}),e[23]=o.schemaVersion,e[24]=f):f=e[24];let v;e[25]!==o.websiteUrl?(v=o.websiteUrl&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Website"}),s.jsxs("a",{href:o.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"Visit"}),s.jsx(Me,{size:14})]})]}),e[25]=o.websiteUrl,e[26]=v):v=e[26];let x;e[27]!==o.repository?(x=o.repository?.url&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Source"}),s.jsxs("a",{href:o.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"GitHub"}),s.jsx(Me,{size:14})]})]}),e[27]=o.repository,e[28]=x):x=e[28];let k;e[29]!==I||e[30]!==m||e[31]!==N||e[32]!==f||e[33]!==v||e[34]!==x||e[35]!==b?(k=s.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[b,I,m,N,f,v,x]}),e[29]=I,e[30]=m,e[31]=N,e[32]=f,e[33]=v,e[34]=x,e[35]=b,e[36]=k):k=e[36];let j;e[37]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[37]=j):j=e[37];let g;e[38]!==n.updated_at?(g=Bt(n.updated_at),e[38]=n.updated_at,e[39]=g):g=e[39];let S;e[40]!==g?(S=s.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[j,s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:g})]}),e[40]=g,e[41]=S):S=e[41];let C;return e[42]!==i||e[43]!==k||e[44]!==S||e[45]!==y?(C=s.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,y,k,S]}),e[42]=i,e[43]=k,e[44]=S,e[45]=y,e[46]=C):C=e[46],C}function Ot(t){return s.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:t},t)}function Ft(t){return s.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:t},t)}const Gt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],Ht={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 Wt(t){if(!t)return"Local";try{return new URL(t).hostname}catch{return t}}function qt(t){if(!t)return"local";try{const e=new URL(t).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function Kt(t){const e=Ht[t.toLowerCase()];return e||t.replace(/[-_]/g," ").replace(/\b\w/g,o=>o.toUpperCase())}function Qt(t){if(!t)return"http";const e=t.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function Xt(t){return t.map((e,o)=>{const r=Qt(e.type),n=Wt(e.url),i=qt(e.url),a=e.title||e.name||Kt(i);return{index:o,protocol:r,url:e.url,hostname:n,serviceName:i,displayName:a,name:e.name,title:e.title,description:e.description,_type:e._type,_index:e._index}})}function Yt(t){const e=R.c(2),{protocol:o,className:r}=t;let n;return e[0]!==r?(n={http:s.jsx(ft,{className:r}),sse:s.jsx(gt,{className:r}),stdio:s.jsx(bt,{className:r})},e[0]=r,e[1]=n):n=e[1],n[o]}function Zt(t){const e=R.c(10),{options:o,selected:r,onSelect:n}=t;if(o.length<=1)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"text-sm text-muted-foreground",children:"Protocol:"}),e[0]=i):i=e[0];let a;if(e[1]!==n||e[2]!==o||e[3]!==r){let l;e[5]!==n||e[6]!==r?(l=d=>s.jsxs(ae,{variant:r===d.value?"default":"outline",size:"sm",onClick:()=>n(d.value),className:"cursor-pointer",children:[s.jsx(Yt,{protocol:d.value==="all"?"http":d.value,className:"w-4 h-4 mr-1"}),d.label]},d.value),e[5]=n,e[6]=r,e[7]=l):l=e[7],a=o.map(l),e[1]=n,e[2]=o,e[3]=r,e[4]=a}else a=e[4];let c;return e[8]!==a?(c=s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i,s.jsx("div",{className:"flex gap-1",children:a})]}),e[8]=a,e[9]=c):c=e[9],c}function Jt(t){const e=R.c(11),{servers:o,onInstall:r,isInstalling:n,icon:i,mcpName:a,showStdio:c}=t,l=n===void 0?!1:n,d=c===void 0?!1:c,_=d?o:o.filter(os),p=Xt(_),y=p.length<13?"all":"http",[b,I]=q.useState(y);let m;e:{if(b==="all"){m="all";break e}let h;if(e[0]!==b?(h=E=>E.protocol===b,e[0]=b,e[1]=h):h=e[1],p.some(h)){m=b;break e}if(p.length<13){m="all";break e}m=p[0]?.protocol??"http"}const N=m,f=N==="all"?p:p.filter(h=>h.protocol===N),v=new Set(p.map(ss));let x=Gt.filter(h=>h.value==="all"||v.has(h.value));d||(x=x.filter(ts));const k=v.size<=1?x.filter(es):x,j="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4";let g;e[2]!==i||e[3]!==l||e[4]!==a||e[5]!==r?(g=h=>s.jsx(ht,{variant:"server",icon:i??null,displayName:h.displayName,description:h.description??null,hostname:h.hostname,protocol:h.protocol,isInstalling:l,onClick:()=>r({type:h.protocol,url:h.url,name:h.name,title:h.title,description:h.description,_type:h._type,_index:h._index})},`${h.hostname}-${h.protocol}-${h.index}`),e[2]=i,e[3]=l,e[4]=a,e[5]=r,e[6]=g):g=e[6];const S=f.map(g);let C;e[7]!==S?(C=s.jsx("div",{className:j,children:S}),e[7]=S,e[8]=C):C=e[8];let P;return e[9]!==f.length?(P=f.length===0&&s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No servers match the selected filter."}),e[9]=f.length,e[10]=P):P=e[10],s.jsxs("div",{className:"p-5",children:[s.jsx(Zt,{options:k,selected:N,onSelect:I}),C,P]})}function es(t){return t.value!=="all"}function ts(t){return t.value!=="stdio"}function ss(t){return t.protocol}function os(t){return t.type?.toLowerCase()!=="stdio"}function rs(t){const e=R.c(29),{data:o,availableTabs:r,effectiveActiveTabId:n,effectiveTools:i,isLoadingTools:a,onTabChange:c,servers:l,onInstallServer:d,isInstalling:_,mcpIcon:p,mcpName:y,showStdio:b}=t,I=a===void 0?!1:a;let m;e[0]!==l?(m=l===void 0?[]:l,e[0]=l,e[1]=m):m=e[1];const N=m,f=_===void 0?!1:_,v=b===void 0?!1:b;let x;e[2]!==i?(x=i.map(ns),e[2]=i,e[3]=x):x=e[3];const k=x;let j;e[4]!==r||e[5]!==n||e[6]!==c?(j=r.length>0&&s.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:s.jsx(mt,{tabs:r,activeTab:n,onTabChange:c})}),e[4]=r,e[5]=n,e[6]=c,e[7]=j):j=e[7];let g;e[8]!==n||e[9]!==f||e[10]!==p||e[11]!==y||e[12]!==d||e[13]!==N||e[14]!==v?(g=n==="servers"&&N.length>0&&s.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:s.jsx(Jt,{servers:N,onInstall:h=>d?.(h),isInstalling:f,icon:p,mcpName:y,showStdio:v})}),e[8]=n,e[9]=f,e[10]=p,e[11]=y,e[12]=d,e[13]=N,e[14]=v,e[15]=g):g=e[15];let S;e[16]!==n||e[17]!==i.length||e[18]!==I||e[19]!==k?(S=n==="tools"&&s.jsx("div",{className:"flex flex-col flex-1",children:I?s.jsxs("div",{className:"flex items-center justify-center p-8",children:[s.jsx(De,{size:24,className:"animate-spin"}),s.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?s.jsx(ct,{tools:k,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):s.jsx(tt,{image:null,title:"No tools available",description:"This MCP Server doesn't have any tools."})}),e[16]=n,e[17]=i.length,e[18]=I,e[19]=k,e[20]=S):S=e[20];let C;e[21]!==o?.repository||e[22]!==n?(C=n==="readme"&&s.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:s.jsx(dt,{repository:o?.repository})}),e[21]=o?.repository,e[22]=n,e[23]=C):C=e[23];let P;return e[24]!==C||e[25]!==j||e[26]!==g||e[27]!==S?(P=s.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[j,g,S,C]}),e[24]=C,e[25]=j,e[26]=g,e[27]=S,e[28]=P):P=e[28],P}function ns(t){const e=t;return{name:e.name||"",description:e.description||void 0}}function is(t,e){if(!t||!e)return;const o=e.toLowerCase();return t.find(r=>r.app_name?.toLowerCase()===o||r.app_id?.toLowerCase()===o||r.title.toLowerCase()===o)||t.find(r=>r.title.toLowerCase().includes(o))}function ls(t,e,o,r,n){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:r?.icon||void 0,count:n??t.length};const i=e.toLowerCase(),a=t.filter(l=>(l._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":l.publisher||l._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:o?.icon||a[0]?.publisher_logo||a[0]?.icon||void 0,count:a.length}}function as(t){const e=t._meta?.["mcp.mesh"],o=t._meta?.["io.modelcontextprotocol.registry/official"],r=t.server,n=pt(r.remotes?.[0]?.type),i=xt(r.$schema),a=o?"io.modelcontextprotocol.registry/official":t.publisher||e?.scopeName||"Unknown",c=Lt(r.repository),l=t.icon||t.image||t.logo||r.icons?.[0]?.src||c||null,d=t.name||t.title||t.server?.title||"Unnamed Item",_=vt(d),p=e?.friendly_name||_,y=e?.mesh_description||t.description||t.summary||r?.description||"",b=e?.short_description||null,I=e?.tags||[],m=e?.categories||[];return{name:p,description:y,shortDescription:b,icon:l,verified:t.verified||e?.verified,publisher:a,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:i??null,connectionType:n,connectionUrl:null,remoteUrl:null,tags:I,categories:m,tools:t.tools||r.tools||e?.tools||[],models:t.models||r.models||e?.models||[],emails:t.emails||r.emails||e?.emails||[],analytics:t.analytics||r.analytics||e?.analytics,cdn:t.cdn||r.cdn||e?.cdn}}class cs extends q.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,o){console.error("Store MCP server detail error:",e,o)}render(){return this.state.hasError?s.jsx($t,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function ds(){const t=R.c(67),{org:e}=Ee(),o=$e();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const{appName:n}=Qe(r);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[1]=i):i=t[1];const{registryId:a,serverName:c,stdio:l}=Xe(i);let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=It.storeShowStdio(),t[2]=d):d=t[2];const[_,p]=_t(d,ys),y=l==="true"?!0:l==="false"?!1:_;l!==void 0&&l==="true"!==_&&p(l==="true");const[b,I]=q.useState(null),[m,N]=q.useState(null),f=jt(),v=yt(),{data:x}=Ye.useSession(),k=St(v),j=a||k[0]?.id||"",g=Nt(j),S=ut(g?.tools),C=g?.tools&&g.tools.find(js)?.name||"",P=g?.tools&&g.tools.find(bs)?.name||"",h=Mt(j),K=!!c;let E,G;K?(E=C||P,G={name:c}):(E=S,G={});const{data:L}=Ct({toolCaller:h,toolName:E,toolInputParams:G,scope:j});let V=[],M=[],z=null;if(L){if(Array.isArray(L))V=L;else if(typeof L=="object"&&L!==null)if("totalCount"in L&&typeof L.totalCount=="number"&&(z=L.totalCount),"item"in L&&L.item){const u=L.item,D=u.id||"",Z=u.server,le=u._meta;let B;t[3]!==u.title||t[4]!==D||t[5]!==Z||t[6]!==le?(B=[{id:D,title:u.title,server:Z,_meta:le}],t[3]=u.title,t[4]=D,t[5]=Z,t[6]=le,t[7]=B):B=t[7],V=B}else{let u;"versions"in L&&Array.isArray(L.versions)?u="versions":"servers"in L&&Array.isArray(L.servers)?u="servers":u=Object.keys(L).find(D=>Array.isArray(L[D])),u&&(V=L[u],(u==="versions"||E?.includes("VERSIONS"))&&(M=V))}}const O=M.findIndex(vs),H=O>=0?O:0,$=m??H;let A;t[8]!==n?(A=u=>{const D=u.name||u.title||u.server.title||"";return kt(D)===n},t[8]=n,t[9]=A):A=t[9];let w=V.find(A);if(!w&&c){let u;t[10]!==c?(u=D=>D.server.name===c||D.name===c||D.title===c,t[10]=c,t[11]=u):u=t[11],w=V.find(u)}const T=w?as(w):null,U=(T?.tools?.length||0)>0,J=w?.server?.remotes?.[0]?.url||null,W=!U&&!!J,Q=wt({url:W?J:""}),ye=W&&Q.state==="connecting";let X;t[12]!==Q||t[13]!==W?(X=W&&Q.state==="ready"?(Q.tools||[]).map(gs):[],t[12]=Q,t[13]=W,t[14]=X):X=t[14];const Te=X,ce=U?T?.tools||[]:Te,Ue=is(v,T?.publisher),Ne=T?ls(V,T.publisher,Ue,g??null,z):{count:0},Be=T?.repository?Tt(T.repository):null,ze=w?.server?.remotes??[],Oe=w?.server?.packages??[],Se=[...ze.map(hs),...Oe.map(xs)],de=y?Se:Se.filter(ps),ee=de.length>1;let te;t[15]!==ee||t[16]!==de.length?(te={id:"servers",label:"Servers",count:de.length,visible:ee},t[15]=ee,t[16]=de.length,t[17]=te):te=t[17];const Ce=!!T?.repository&&!!Be;let se;t[18]!==Ce?(se={id:"readme",label:"README",visible:Ce},t[18]=Ce,t[19]=se):se=t[19];const we=U||Te.length>0||ye&&!!J;let oe;t[20]!==ce.length||t[21]!==we?(oe={id:"tools",label:"Tools",count:ce.length,visible:we},t[20]=ce.length,t[21]=we,t[22]=oe):oe=t[22];let me;t[23]!==te||t[24]!==se||t[25]!==oe?(me=[te,se,oe].filter(us),t[23]=te,t[24]=se,t[25]=oe,t[26]=me):me=t[26];const F=me;let fe;t[27]!==F?(fe=F.find(fs)?.id||F.find(ms)?.id||F[0]?.id||"overview",t[27]=F,t[28]=fe):fe=t[28];const _e=fe;let ue;t[29]!==b||t[30]!==F||t[31]!==_e?(ue=b&&F.find(u=>u.id===b)?b:_e,t[29]=b,t[30]=F,t[31]=_e,t[32]=ue):ue=t[32];const Fe=ue;let pe;t[33]!==f||t[34]!==M||t[35]!==o||t[36]!==e||t[37]!==w||t[38]!==x?(pe=async(u,D,Z)=>{const le=M[u??0]||w;if(!le||!e||!x?.user?.id)return;const B=ot(le,e.id,x.user.id,{remoteIndex:Z===void 0?D??0:void 0,packageIndex:Z}),We=B.connection_type==="STDIO",qe=!!B.connection_url,Ke=We&&B.connection_headers&&typeof B.connection_headers=="object"&&"command"in B.connection_headers;if(!qe&&!Ke){Le.error("This MCP Server cannot be connected: no connection method available");return}try{const{id:Ie}=await f.create.mutateAsync(B);o({to:"/$org/mcps/$connectionId",params:{org:e.slug,connectionId:Ie}})}catch(Ie){const ke=Ie;Le.error(`Failed to connect MCP Server: ${ke instanceof Error?ke.message:String(ke)}`)}},t[33]=f,t[34]=M,t[35]=o,t[36]=e,t[37]=w,t[38]=x,t[39]=pe):pe=t[39];const Y=pe;let xe;t[40]!==o||t[41]!==e.slug?(xe=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[40]=o,t[41]=e.slug,t[42]=xe):xe=t[42];const re=xe;if(!w){let u;return t[43]!==re?(u=s.jsx(Dt,{onBack:re}),t[43]=re,t[44]=u):u=t[44],u}if(!T)return null;const Ge=(w?.server?.remotes?.length??0)>0,He=(w?.server?.packages?.length??0)>0,ne=Ge||He;let he;t[45]!==re?(he=s.jsx(Rt,{onBack:re}),t[45]=re,t[46]=he):he=t[46];let ge;t[47]!==ne?(ge=!ne&&s.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[s.jsx(Pt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t[47]=ne,t[48]=ge):ge=t[48];let ie;t[49]!==M||t[50]!==w?(ie=M.length>0?M:[w],t[49]=M,t[50]=w,t[51]=ie):ie=t[51];let ve;t[52]!==f.create.isPending||t[53]!==ne||t[54]!==T||t[55]!==$||t[56]!==Y||t[57]!==ee||t[58]!==ie?(ve=s.jsx(Et,{data:T,itemVersions:ie,onInstall:Y,canInstall:ne,isInstalling:f.create.isPending,hideInstallControls:ee,selectedVersionIndex:$,onVersionChange:N}),t[52]=f.create.isPending,t[53]=ne,t[54]=T,t[55]=$,t[56]=Y,t[57]=ee,t[58]=ie,t[59]=ve):ve=t[59];let be;t[60]!==T||t[61]!==Ne||t[62]!==w?(be=s.jsx(zt,{data:T,publisherInfo:Ne,selectedItem:w}),t[60]=T,t[61]=Ne,t[62]=w,t[63]=be):be=t[63];let je;return t[64]!==$||t[65]!==Y?(je=u=>{u._type==="remote"?Y($,u._index,void 0):Y($,void 0,u._index)},t[64]=$,t[65]=Y,t[66]=je):je=t[66],s.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[he,s.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:s.jsx("div",{className:"h-full",children:s.jsxs("div",{className:"h-full",children:[ge,ve,s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[be,s.jsx(rs,{data:T,availableTabs:F,effectiveActiveTabId:Fe,effectiveTools:ce,isLoadingTools:ye,onTabChange:I,servers:Se,onInstallServer:je,isInstalling:f.create.isPending,mcpIcon:T.icon,mcpName:T.name,showStdio:y})]})]})})})]})}function ms(t){return t.id==="readme"}function fs(t){return t.id==="servers"}function us(t){return t.visible}function ps(t){return t.type?.toLowerCase()!=="stdio"}function xs(t,e){return{type:"stdio",url:void 0,name:t.name||t.identifier,title:t.name||t.identifier?.replace(/^@[^/]+\//,""),description:t.environmentVariables?.length?`Requires ${t.environmentVariables.length} environment variable(s)`:void 0,_type:"package",_index:e}}function hs(t,e){return{...t,_type:"remote",_index:e}}function gs(t){return{name:t.name,description:t.description}}function vs(t){return t._meta?.["io.modelcontextprotocol.registry/official"]?.isLatest===!0}function bs(t){return t.name.endsWith("_GET")}function js(t){return t.name.endsWith("_VERSIONS")}function ys(){return!1}function go(){const t=R.c(6),{org:e}=Ee(),o=$e();let r;t[0]!==o||t[1]!==e.slug?(r=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[0]=o,t[1]=e.slug,t[2]=r):r=t[2];const n=r;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(q.Suspense,{fallback:s.jsx(Vt,{}),children:s.jsx(ds,{})}),t[3]=i):i=t[3];let a;return t[4]!==n?(a=s.jsx(cs,{onBack:n,children:i}),t[4]=n,t[5]=a):a=t[5],a}export{go as default};
1
+ import{r as q,c as R,j as s,f as $e,d as Qe,b as Xe,a as Ye,t as Le}from"./index-Diww4UW3.js";import{i as Ze}from"./AlertCircle-CI2U-jkN.js";import{i as De}from"./Loading01-Ae5ezbtD.js";import{B as ae,c as Je}from"./button-CGmrzkpY.js";import{i as et}from"./ArrowLeft-B3km7toT.js";import{I as Re,E as tt}from"./empty-state-wP9uukGJ.js";import{i as st,e as ot}from"./extract-connection-data-BLs0SRok.js";import{t as rt}from"./ChevronDown-DP6jvip7.js";import{s as Pe}from"./Plus-CdG75X26.js";import{D as nt,c as it,a as lt,b as at}from"./dropdown-menu-CAeD2aIb.js";import{n as Me}from"./LinkExternal01-DmruqAb9.js";import{T as ct,R as dt}from"./tools-list-mr-l2d8l.js";import{R as mt}from"./resource-tabs-ACbF96qo.js";import{s as ft,f as ut,g as pt,c as xt}from"./registry-utils-8Lvx2XTy.js";import{a as ht,b as gt,e as vt}from"./mcp-server-card-VZUBDTRj.js";import{i as bt}from"./Terminal-C6mZx-5A.js";import{a as jt,u as yt,b as Nt}from"./use-connection-CCXutWLD.js";import{u as St}from"./use-binding-D6wv_5fO.js";import{u as Ct}from"./use-tool-call-BmvKn7jp.js";import{u as wt}from"./use-mcp-D9llr83X.js";import{u as _t,L as It}from"./localstorage-keys-BVANkONM.js";import{u as Ee}from"./project-context-provider-DulCVL2k.js";import{s as kt}from"./slugify-CEUa2lfQ.js";import{e as Tt,g as Lt}from"./github-icon-Dp3wHhYE.js";import{i as Pt}from"./InfoCircle-BgIkbjJr.js";import{c as Mt}from"./connection-ChwHK0-S.js";import"./constants-J0aH6mLs.js";import"./generate-id-Dyweu44Y.js";import"./Grid01-D4lXvveX.js";import"./useQuery-Bvk0U2ed.js";import"./File06-KMD38I-q.js";import"./collection-display-button-CtkxsCB_.js";import"./ArrowUp-BF7mM4C2.js";import"./Check-BQkm1TiP.js";import"./List-BsSZz32j.js";import"./tooltip-Suu_Gpqh.js";import"./view-mode-toggle-BLClM-0g.js";import"./collection-search-BVb42O45.js";import"./SearchMd-GFaonOaJ.js";import"./input-CrURMEZe.js";import"./collection-table-wrapper-BohFZqii.js";import"./card-DIjMh1NO.js";import"./layout-kp8TTJc9.js";import"./badge-BVO6I0sW.js";import"./Lock01-BuQSktMF.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./binder-By0LBK9Y.js";const Ae=({size:t=24,color:e="currentColor",...o})=>q.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},q.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"}));Ae.displayName="SearchLg";function Vt(t){const e=R.c(3),{message:o}=t,r=o===void 0?"Loading MCP Server details...":o;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(De,{size:48,className:"animate-spin mb-4"}),e[0]=n):n=e[0];let i;return e[1]!==r?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,s.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),e[1]=r,e[2]=i):i=e[2],i}function $t(t){const e=R.c(9),{error:o,onBack:r}=t,n=o instanceof Error?o.message:o;let i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ze,{size:48,className:"text-destructive mb-4"}),a=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading MCP Server"}),e[0]=i,e[1]=a):(i=e[0],a=e[1]);let c;e[2]!==n?(c=s.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:n}),e[2]=n,e[3]=c):c=e[3];let l;e[4]!==r?(l=s.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]=l):l=e[5];let d;return e[6]!==c||e[7]!==l?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,a,c,l]}),e[6]=c,e[7]=l,e[8]=d):d=e[8],d}function Dt(t){const e=R.c(5),{onBack:o}=t;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ae,{size:48,className:"text-muted-foreground mb-4"}),n=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"MCP Server not found"}),i=s.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 a;return e[3]!==o?(a=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,n,i,s.jsx("button",{onClick:o,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]=o,e[4]=a):a=e[4],a}function Rt(t){const e=R.c(3),{onBack:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(et,{}),e[0]=r):r=e[0];let n;return e[1]!==o?(n=s.jsx("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:s.jsx("div",{className:"flex h-full px-2 border-r items-center",children:s.jsx(ae,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:o,"aria-label":"Go back",children:r})})}),e[1]=o,e[2]=n):n=e[2],n}function Ve(t){const e=R.c(28),{versions:o,selectedIndex:r,onSelect:n,isInstalling:i,variant:a,showLabel:c}=t,l=i===void 0?!1:i,d=a===void 0?"brand":a,_=c===void 0?!1:c,p=o[r],y=_?"sm":"default",b=d==="brand"&&"rounded-l-none px-2 border-l-2 border-l-white/50";let I;e[0]!==b?(I=Je("shrink-0 cursor-pointer",b),e[0]=b,e[1]=I):I=e[1];let m;e[2]!==p?.server?.version||e[3]!==_?(m=_&&s.jsxs("span",{className:"mr-1",children:["v",p?.server?.version||"unknown"]}),e[2]=p?.server?.version,e[3]=_,e[4]=m):m=e[4];const N=_?14:20;let f;e[5]!==N?(f=s.jsx(rt,{size:N}),e[5]=N,e[6]=f):f=e[6];let v;e[7]!==l||e[8]!==y||e[9]!==I||e[10]!==m||e[11]!==f||e[12]!==d?(v=s.jsx(nt,{asChild:!0,children:s.jsxs(ae,{variant:d,disabled:l,size:y,className:I,children:[m,f]})}),e[7]=l,e[8]=y,e[9]=I,e[10]=m,e[11]=f,e[12]=d,e[13]=v):v=e[13];let x;if(e[14]!==l||e[15]!==n||e[16]!==r||e[17]!==o){let g;e[19]!==l||e[20]!==n||e[21]!==r?(g=(S,C)=>{const P=S._meta?.["io.modelcontextprotocol.registry/official"];return s.jsx(it,{onClick:()=>n(C),disabled:l,className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"font-medium text-sm",children:["v",S.server?.version||"unknown"]}),P?.isLatest&&s.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),C===r&&s.jsx(st,{size:16,className:"text-muted-foreground shrink-0"})]})},C)},e[19]=l,e[20]=n,e[21]=r,e[22]=g):g=e[22],x=o.map(g),e[14]=l,e[15]=n,e[16]=r,e[17]=o,e[18]=x}else x=e[18];let k;e[23]!==x?(k=s.jsx(lt,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:x}),e[23]=x,e[24]=k):k=e[24];let j;return e[25]!==v||e[26]!==k?(j=s.jsxs(at,{children:[v,k]}),e[25]=v,e[26]=k,e[27]=j):j=e[27],j}function Et(t){const e=R.c(46),{data:o,itemVersions:r,onInstall:n,canInstall:i,isInstalling:a,hideInstallControls:c,selectedVersionIndex:l,onVersionChange:d}=t,_=i===void 0?!0:i,p=a===void 0?!1:a,y=c===void 0?!1:c,[b,I]=q.useState(0),m=l??b;let N;e[0]!==d?(N=U=>{I(U),d?.(U)},e[0]=d,e[1]=N):N=e[1];const f=N,v=r[m]||r[0];let x;e[2]!==v?.server?.remotes?(x=v?.server?.remotes??[],e[2]=v?.server?.remotes,e[3]=x):x=e[3];const k=x;let j;e[4]!==v?.server?.packages?(j=v?.server?.packages??[],e[4]=v?.server?.packages,e[5]=j):j=e[5];const S=j.length>0,C=k.length>0,P=k.findIndex(Ut),h=P>=0?P:0;let K;e[6]!==h||e[7]!==S||e[8]!==C||e[9]!==n||e[10]!==m?(K=()=>{C?n(m,h,void 0):S&&n(m,void 0,0)},e[6]=h,e[7]=S,e[8]=C,e[9]=n,e[10]=m,e[11]=K):K=e[11];const E=K;let G;e[12]!==r||e[13]!==n||e[14]!==f?(G=U=>{f(U);const J=r[U],W=J?.server?.remotes??[],Q=J?.server?.packages??[];if(W.length>0){const X=W.findIndex(At);n(U,X>=0?X:0,void 0)}else Q.length>0&&n(U,void 0,0)},e[12]=r,e[13]=n,e[14]=f,e[15]=G):G=e[15];const L=G;let V;e[16]!==o.icon||e[17]!==o.name?(V=s.jsx(Re,{icon:o.icon,name:o.name,size:"lg",className:"shrink-0 shadow-sm"}),e[16]=o.icon,e[17]=o.name,e[18]=V):V=e[18];let M;e[19]!==o.name?(M=s.jsx("h1",{className:"text-3xl font-medium",children:o.name}),e[19]=o.name,e[20]=M):M=e[20];let z;e[21]!==o.verified?(z=o.verified&&s.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[21]=o.verified,e[22]=z):z=e[22];let O;e[23]!==M||e[24]!==z?(O=s.jsxs("div",{className:"flex items-center gap-2",children:[M,z]}),e[23]=M,e[24]=z,e[25]=O):O=e[25];let H;e[26]!==o.shortDescription?(H=o.shortDescription&&s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:o.shortDescription}),e[26]=o.shortDescription,e[27]=H):H=e[27];let $;e[28]!==O||e[29]!==H?($=s.jsxs("div",{className:"flex-1 min-w-0",children:[O,H]}),e[28]=O,e[29]=H,e[30]=$):$=e[30];let A;e[31]!==_||e[32]!==E||e[33]!==L||e[34]!==y||e[35]!==p||e[36]!==r||e[37]!==m||e[38]!==f?(A=_&&!y?s.jsx("div",{className:"shrink-0 flex items-center gap-2",children:r.length>1?s.jsxs("div",{className:"flex",children:[s.jsxs(ae,{variant:"brand",onClick:E,disabled:p,className:"shrink-0 rounded-r-none cursor-pointer",children:[s.jsx(Pe,{size:20}),p?"Connecting...":"Connect"]}),s.jsx(Ve,{versions:r,selectedIndex:m,onSelect:L,isInstalling:p,variant:"brand"})]}):s.jsxs(ae,{variant:"brand",onClick:E,disabled:r.length===0||p,className:"shrink-0 cursor-pointer",children:[s.jsx(Pe,{size:20}),p?"Connecting...":"Connect"]})}):y?r.length>1?s.jsx("div",{className:"shrink-0",children:s.jsx(Ve,{versions:r,selectedIndex:m,onSelect:f,isInstalling:p,variant:"outline",showLabel:!0})}):null:s.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[31]=_,e[32]=E,e[33]=L,e[34]=y,e[35]=p,e[36]=r,e[37]=m,e[38]=f,e[39]=A):A=e[39];let w;e[40]!==$||e[41]!==A?(w=s.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[$,A]}),e[40]=$,e[41]=A,e[42]=w):w=e[42];let T;return e[43]!==w||e[44]!==V?(T=s.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[V,w]}),e[43]=w,e[44]=V,e[45]=T):T=e[45],T}function At(t){return t.type?.toLowerCase()==="http"||t.type?.toLowerCase()==="streamable-http"}function Ut(t){return t.type?.toLowerCase()==="http"||t.type?.toLowerCase()==="streamable-http"}function Bt(t){if(!t)return"—";try{const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function zt(t){const e=R.c(47),{data:o,publisherInfo:r,selectedItem:n}=t;let i;e[0]!==o.description?(i=o.description&&s.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[s.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),s.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:o.description})]}),e[0]=o.description,e[1]=i):i=e[1];const a=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher;let c;e[2]!==r.logo||e[3]!==a?(c=s.jsx(Re,{icon:r.logo,name:a,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=r.logo,e[3]=a,e[4]=c):c=e[4];let l;e[5]!==o.publisher?(l=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher.charAt(0).toUpperCase()+o.publisher.slice(1),e[5]=o.publisher,e[6]=l):l=e[6];let d;e[7]!==l?(d=s.jsx("div",{className:"font-medium",children:l}),e[7]=l,e[8]=d):d=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("div",{className:"text-xs text-muted-foreground",children:"Publisher"}),e[9]=_):_=e[9];let p;e[10]!==d?(p=s.jsxs("div",{children:[d,_]}),e[10]=d,e[11]=p):p=e[11];let y;e[12]!==c||e[13]!==p?(y=s.jsx("div",{className:"px-5 border-b border-border",children:s.jsxs("div",{className:"flex items-center gap-3 py-5",children:[c,p]})}),e[12]=c,e[13]=p,e[14]=y):y=e[14];let b;e[15]!==o.version?(b=o.version&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Version"}),s.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",o.version]})]}),e[15]=o.version,e[16]=b):b=e[16];let I;e[17]!==o.tags?(I=o.tags&&o.tags.length>0&&s.jsxs("div",{className:"flex justify-between items-start text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:o.tags.map(Ft)})]}),e[17]=o.tags,e[18]=I):I=e[18];let m;e[19]!==o.categories?(m=o.categories&&o.categories.length>0&&s.jsxs("div",{className:"flex justify-between items-start text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:o.categories.map(Ot)})]}),e[19]=o.categories,e[20]=m):m=e[20];let N;e[21]!==o.connectionType?(N=o.connectionType&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:o.connectionType})]}),e[21]=o.connectionType,e[22]=N):N=e[22];let f;e[23]!==o.schemaVersion?(f=o.schemaVersion&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:o.schemaVersion})]}),e[23]=o.schemaVersion,e[24]=f):f=e[24];let v;e[25]!==o.websiteUrl?(v=o.websiteUrl&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Website"}),s.jsxs("a",{href:o.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"Visit"}),s.jsx(Me,{size:14})]})]}),e[25]=o.websiteUrl,e[26]=v):v=e[26];let x;e[27]!==o.repository?(x=o.repository?.url&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Source"}),s.jsxs("a",{href:o.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"GitHub"}),s.jsx(Me,{size:14})]})]}),e[27]=o.repository,e[28]=x):x=e[28];let k;e[29]!==I||e[30]!==m||e[31]!==N||e[32]!==f||e[33]!==v||e[34]!==x||e[35]!==b?(k=s.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[b,I,m,N,f,v,x]}),e[29]=I,e[30]=m,e[31]=N,e[32]=f,e[33]=v,e[34]=x,e[35]=b,e[36]=k):k=e[36];let j;e[37]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[37]=j):j=e[37];let g;e[38]!==n.updated_at?(g=Bt(n.updated_at),e[38]=n.updated_at,e[39]=g):g=e[39];let S;e[40]!==g?(S=s.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[j,s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:g})]}),e[40]=g,e[41]=S):S=e[41];let C;return e[42]!==i||e[43]!==k||e[44]!==S||e[45]!==y?(C=s.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,y,k,S]}),e[42]=i,e[43]=k,e[44]=S,e[45]=y,e[46]=C):C=e[46],C}function Ot(t){return s.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:t},t)}function Ft(t){return s.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:t},t)}const Gt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],Ht={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 Wt(t){if(!t)return"Local";try{return new URL(t).hostname}catch{return t}}function qt(t){if(!t)return"local";try{const e=new URL(t).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function Kt(t){const e=Ht[t.toLowerCase()];return e||t.replace(/[-_]/g," ").replace(/\b\w/g,o=>o.toUpperCase())}function Qt(t){if(!t)return"http";const e=t.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function Xt(t){return t.map((e,o)=>{const r=Qt(e.type),n=Wt(e.url),i=qt(e.url),a=e.title||e.name||Kt(i);return{index:o,protocol:r,url:e.url,hostname:n,serviceName:i,displayName:a,name:e.name,title:e.title,description:e.description,_type:e._type,_index:e._index}})}function Yt(t){const e=R.c(2),{protocol:o,className:r}=t;let n;return e[0]!==r?(n={http:s.jsx(ft,{className:r}),sse:s.jsx(gt,{className:r}),stdio:s.jsx(bt,{className:r})},e[0]=r,e[1]=n):n=e[1],n[o]}function Zt(t){const e=R.c(10),{options:o,selected:r,onSelect:n}=t;if(o.length<=1)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"text-sm text-muted-foreground",children:"Protocol:"}),e[0]=i):i=e[0];let a;if(e[1]!==n||e[2]!==o||e[3]!==r){let l;e[5]!==n||e[6]!==r?(l=d=>s.jsxs(ae,{variant:r===d.value?"default":"outline",size:"sm",onClick:()=>n(d.value),className:"cursor-pointer",children:[s.jsx(Yt,{protocol:d.value==="all"?"http":d.value,className:"w-4 h-4 mr-1"}),d.label]},d.value),e[5]=n,e[6]=r,e[7]=l):l=e[7],a=o.map(l),e[1]=n,e[2]=o,e[3]=r,e[4]=a}else a=e[4];let c;return e[8]!==a?(c=s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i,s.jsx("div",{className:"flex gap-1",children:a})]}),e[8]=a,e[9]=c):c=e[9],c}function Jt(t){const e=R.c(11),{servers:o,onInstall:r,isInstalling:n,icon:i,mcpName:a,showStdio:c}=t,l=n===void 0?!1:n,d=c===void 0?!1:c,_=d?o:o.filter(os),p=Xt(_),y=p.length<13?"all":"http",[b,I]=q.useState(y);let m;e:{if(b==="all"){m="all";break e}let h;if(e[0]!==b?(h=E=>E.protocol===b,e[0]=b,e[1]=h):h=e[1],p.some(h)){m=b;break e}if(p.length<13){m="all";break e}m=p[0]?.protocol??"http"}const N=m,f=N==="all"?p:p.filter(h=>h.protocol===N),v=new Set(p.map(ss));let x=Gt.filter(h=>h.value==="all"||v.has(h.value));d||(x=x.filter(ts));const k=v.size<=1?x.filter(es):x,j="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4";let g;e[2]!==i||e[3]!==l||e[4]!==a||e[5]!==r?(g=h=>s.jsx(ht,{variant:"server",icon:i??null,displayName:h.displayName,description:h.description??null,hostname:h.hostname,protocol:h.protocol,isInstalling:l,onClick:()=>r({type:h.protocol,url:h.url,name:h.name,title:h.title,description:h.description,_type:h._type,_index:h._index})},`${h.hostname}-${h.protocol}-${h.index}`),e[2]=i,e[3]=l,e[4]=a,e[5]=r,e[6]=g):g=e[6];const S=f.map(g);let C;e[7]!==S?(C=s.jsx("div",{className:j,children:S}),e[7]=S,e[8]=C):C=e[8];let P;return e[9]!==f.length?(P=f.length===0&&s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No servers match the selected filter."}),e[9]=f.length,e[10]=P):P=e[10],s.jsxs("div",{className:"p-5",children:[s.jsx(Zt,{options:k,selected:N,onSelect:I}),C,P]})}function es(t){return t.value!=="all"}function ts(t){return t.value!=="stdio"}function ss(t){return t.protocol}function os(t){return t.type?.toLowerCase()!=="stdio"}function rs(t){const e=R.c(29),{data:o,availableTabs:r,effectiveActiveTabId:n,effectiveTools:i,isLoadingTools:a,onTabChange:c,servers:l,onInstallServer:d,isInstalling:_,mcpIcon:p,mcpName:y,showStdio:b}=t,I=a===void 0?!1:a;let m;e[0]!==l?(m=l===void 0?[]:l,e[0]=l,e[1]=m):m=e[1];const N=m,f=_===void 0?!1:_,v=b===void 0?!1:b;let x;e[2]!==i?(x=i.map(ns),e[2]=i,e[3]=x):x=e[3];const k=x;let j;e[4]!==r||e[5]!==n||e[6]!==c?(j=r.length>0&&s.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:s.jsx(mt,{tabs:r,activeTab:n,onTabChange:c})}),e[4]=r,e[5]=n,e[6]=c,e[7]=j):j=e[7];let g;e[8]!==n||e[9]!==f||e[10]!==p||e[11]!==y||e[12]!==d||e[13]!==N||e[14]!==v?(g=n==="servers"&&N.length>0&&s.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:s.jsx(Jt,{servers:N,onInstall:h=>d?.(h),isInstalling:f,icon:p,mcpName:y,showStdio:v})}),e[8]=n,e[9]=f,e[10]=p,e[11]=y,e[12]=d,e[13]=N,e[14]=v,e[15]=g):g=e[15];let S;e[16]!==n||e[17]!==i.length||e[18]!==I||e[19]!==k?(S=n==="tools"&&s.jsx("div",{className:"flex flex-col flex-1",children:I?s.jsxs("div",{className:"flex items-center justify-center p-8",children:[s.jsx(De,{size:24,className:"animate-spin"}),s.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?s.jsx(ct,{tools:k,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):s.jsx(tt,{image:null,title:"No tools available",description:"This MCP Server doesn't have any tools."})}),e[16]=n,e[17]=i.length,e[18]=I,e[19]=k,e[20]=S):S=e[20];let C;e[21]!==o?.repository||e[22]!==n?(C=n==="readme"&&s.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:s.jsx(dt,{repository:o?.repository})}),e[21]=o?.repository,e[22]=n,e[23]=C):C=e[23];let P;return e[24]!==C||e[25]!==j||e[26]!==g||e[27]!==S?(P=s.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[j,g,S,C]}),e[24]=C,e[25]=j,e[26]=g,e[27]=S,e[28]=P):P=e[28],P}function ns(t){const e=t;return{name:e.name||"",description:e.description||void 0}}function is(t,e){if(!t||!e)return;const o=e.toLowerCase();return t.find(r=>r.app_name?.toLowerCase()===o||r.app_id?.toLowerCase()===o||r.title.toLowerCase()===o)||t.find(r=>r.title.toLowerCase().includes(o))}function ls(t,e,o,r,n){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:r?.icon||void 0,count:n??t.length};const i=e.toLowerCase(),a=t.filter(l=>(l._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":l.publisher||l._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:o?.icon||a[0]?.publisher_logo||a[0]?.icon||void 0,count:a.length}}function as(t){const e=t._meta?.["mcp.mesh"],o=t._meta?.["io.modelcontextprotocol.registry/official"],r=t.server,n=pt(r.remotes?.[0]?.type),i=xt(r.$schema),a=o?"io.modelcontextprotocol.registry/official":t.publisher||e?.scopeName||"Unknown",c=Lt(r.repository),l=t.icon||t.image||t.logo||r.icons?.[0]?.src||c||null,d=t.name||t.title||t.server?.title||"Unnamed Item",_=vt(d),p=e?.friendly_name||_,y=e?.mesh_description||t.description||t.summary||r?.description||"",b=e?.short_description||null,I=e?.tags||[],m=e?.categories||[];return{name:p,description:y,shortDescription:b,icon:l,verified:t.verified||e?.verified,publisher:a,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:i??null,connectionType:n,connectionUrl:null,remoteUrl:null,tags:I,categories:m,tools:t.tools||r.tools||e?.tools||[],models:t.models||r.models||e?.models||[],emails:t.emails||r.emails||e?.emails||[],analytics:t.analytics||r.analytics||e?.analytics,cdn:t.cdn||r.cdn||e?.cdn}}class cs extends q.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,o){console.error("Store MCP server detail error:",e,o)}render(){return this.state.hasError?s.jsx($t,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function ds(){const t=R.c(67),{org:e}=Ee(),o=$e();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const{appName:n}=Qe(r);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[1]=i):i=t[1];const{registryId:a,serverName:c,stdio:l}=Xe(i);let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=It.storeShowStdio(),t[2]=d):d=t[2];const[_,p]=_t(d,ys),y=l==="true"?!0:l==="false"?!1:_;l!==void 0&&l==="true"!==_&&p(l==="true");const[b,I]=q.useState(null),[m,N]=q.useState(null),f=jt(),v=yt(),{data:x}=Ye.useSession(),k=St(v),j=a||k[0]?.id||"",g=Nt(j),S=ut(g?.tools),C=g?.tools&&g.tools.find(js)?.name||"",P=g?.tools&&g.tools.find(bs)?.name||"",h=Mt(j),K=!!c;let E,G;K?(E=C||P,G={name:c}):(E=S,G={});const{data:L}=Ct({toolCaller:h,toolName:E,toolInputParams:G,scope:j});let V=[],M=[],z=null;if(L){if(Array.isArray(L))V=L;else if(typeof L=="object"&&L!==null)if("totalCount"in L&&typeof L.totalCount=="number"&&(z=L.totalCount),"item"in L&&L.item){const u=L.item,D=u.id||"",Z=u.server,le=u._meta;let B;t[3]!==u.title||t[4]!==D||t[5]!==Z||t[6]!==le?(B=[{id:D,title:u.title,server:Z,_meta:le}],t[3]=u.title,t[4]=D,t[5]=Z,t[6]=le,t[7]=B):B=t[7],V=B}else{let u;"versions"in L&&Array.isArray(L.versions)?u="versions":"servers"in L&&Array.isArray(L.servers)?u="servers":u=Object.keys(L).find(D=>Array.isArray(L[D])),u&&(V=L[u],(u==="versions"||E?.includes("VERSIONS"))&&(M=V))}}const O=M.findIndex(vs),H=O>=0?O:0,$=m??H;let A;t[8]!==n?(A=u=>{const D=u.name||u.title||u.server.title||"";return kt(D)===n},t[8]=n,t[9]=A):A=t[9];let w=V.find(A);if(!w&&c){let u;t[10]!==c?(u=D=>D.server.name===c||D.name===c||D.title===c,t[10]=c,t[11]=u):u=t[11],w=V.find(u)}const T=w?as(w):null,U=(T?.tools?.length||0)>0,J=w?.server?.remotes?.[0]?.url||null,W=!U&&!!J,Q=wt({url:W?J:""}),ye=W&&Q.state==="connecting";let X;t[12]!==Q||t[13]!==W?(X=W&&Q.state==="ready"?(Q.tools||[]).map(gs):[],t[12]=Q,t[13]=W,t[14]=X):X=t[14];const Te=X,ce=U?T?.tools||[]:Te,Ue=is(v,T?.publisher),Ne=T?ls(V,T.publisher,Ue,g??null,z):{count:0},Be=T?.repository?Tt(T.repository):null,ze=w?.server?.remotes??[],Oe=w?.server?.packages??[],Se=[...ze.map(hs),...Oe.map(xs)],de=y?Se:Se.filter(ps),ee=de.length>1;let te;t[15]!==ee||t[16]!==de.length?(te={id:"servers",label:"Servers",count:de.length,visible:ee},t[15]=ee,t[16]=de.length,t[17]=te):te=t[17];const Ce=!!T?.repository&&!!Be;let se;t[18]!==Ce?(se={id:"readme",label:"README",visible:Ce},t[18]=Ce,t[19]=se):se=t[19];const we=U||Te.length>0||ye&&!!J;let oe;t[20]!==ce.length||t[21]!==we?(oe={id:"tools",label:"Tools",count:ce.length,visible:we},t[20]=ce.length,t[21]=we,t[22]=oe):oe=t[22];let me;t[23]!==te||t[24]!==se||t[25]!==oe?(me=[te,se,oe].filter(us),t[23]=te,t[24]=se,t[25]=oe,t[26]=me):me=t[26];const F=me;let fe;t[27]!==F?(fe=F.find(fs)?.id||F.find(ms)?.id||F[0]?.id||"overview",t[27]=F,t[28]=fe):fe=t[28];const _e=fe;let ue;t[29]!==b||t[30]!==F||t[31]!==_e?(ue=b&&F.find(u=>u.id===b)?b:_e,t[29]=b,t[30]=F,t[31]=_e,t[32]=ue):ue=t[32];const Fe=ue;let pe;t[33]!==f||t[34]!==M||t[35]!==o||t[36]!==e||t[37]!==w||t[38]!==x?(pe=async(u,D,Z)=>{const le=M[u??0]||w;if(!le||!e||!x?.user?.id)return;const B=ot(le,e.id,x.user.id,{remoteIndex:Z===void 0?D??0:void 0,packageIndex:Z}),We=B.connection_type==="STDIO",qe=!!B.connection_url,Ke=We&&B.connection_headers&&typeof B.connection_headers=="object"&&"command"in B.connection_headers;if(!qe&&!Ke){Le.error("This MCP Server cannot be connected: no connection method available");return}try{const{id:Ie}=await f.create.mutateAsync(B);o({to:"/$org/mcps/$connectionId",params:{org:e.slug,connectionId:Ie}})}catch(Ie){const ke=Ie;Le.error(`Failed to connect MCP Server: ${ke instanceof Error?ke.message:String(ke)}`)}},t[33]=f,t[34]=M,t[35]=o,t[36]=e,t[37]=w,t[38]=x,t[39]=pe):pe=t[39];const Y=pe;let xe;t[40]!==o||t[41]!==e.slug?(xe=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[40]=o,t[41]=e.slug,t[42]=xe):xe=t[42];const re=xe;if(!w){let u;return t[43]!==re?(u=s.jsx(Dt,{onBack:re}),t[43]=re,t[44]=u):u=t[44],u}if(!T)return null;const Ge=(w?.server?.remotes?.length??0)>0,He=(w?.server?.packages?.length??0)>0,ne=Ge||He;let he;t[45]!==re?(he=s.jsx(Rt,{onBack:re}),t[45]=re,t[46]=he):he=t[46];let ge;t[47]!==ne?(ge=!ne&&s.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[s.jsx(Pt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t[47]=ne,t[48]=ge):ge=t[48];let ie;t[49]!==M||t[50]!==w?(ie=M.length>0?M:[w],t[49]=M,t[50]=w,t[51]=ie):ie=t[51];let ve;t[52]!==f.create.isPending||t[53]!==ne||t[54]!==T||t[55]!==$||t[56]!==Y||t[57]!==ee||t[58]!==ie?(ve=s.jsx(Et,{data:T,itemVersions:ie,onInstall:Y,canInstall:ne,isInstalling:f.create.isPending,hideInstallControls:ee,selectedVersionIndex:$,onVersionChange:N}),t[52]=f.create.isPending,t[53]=ne,t[54]=T,t[55]=$,t[56]=Y,t[57]=ee,t[58]=ie,t[59]=ve):ve=t[59];let be;t[60]!==T||t[61]!==Ne||t[62]!==w?(be=s.jsx(zt,{data:T,publisherInfo:Ne,selectedItem:w}),t[60]=T,t[61]=Ne,t[62]=w,t[63]=be):be=t[63];let je;return t[64]!==$||t[65]!==Y?(je=u=>{u._type==="remote"?Y($,u._index,void 0):Y($,void 0,u._index)},t[64]=$,t[65]=Y,t[66]=je):je=t[66],s.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[he,s.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:s.jsx("div",{className:"h-full",children:s.jsxs("div",{className:"h-full",children:[ge,ve,s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[be,s.jsx(rs,{data:T,availableTabs:F,effectiveActiveTabId:Fe,effectiveTools:ce,isLoadingTools:ye,onTabChange:I,servers:Se,onInstallServer:je,isInstalling:f.create.isPending,mcpIcon:T.icon,mcpName:T.name,showStdio:y})]})]})})})]})}function ms(t){return t.id==="readme"}function fs(t){return t.id==="servers"}function us(t){return t.visible}function ps(t){return t.type?.toLowerCase()!=="stdio"}function xs(t,e){return{type:"stdio",url:void 0,name:t.name||t.identifier,title:t.name||t.identifier?.replace(/^@[^/]+\//,""),description:t.environmentVariables?.length?`Requires ${t.environmentVariables.length} environment variable(s)`:void 0,_type:"package",_index:e}}function hs(t,e){return{...t,_type:"remote",_index:e}}function gs(t){return{name:t.name,description:t.description}}function vs(t){return t._meta?.["io.modelcontextprotocol.registry/official"]?.isLatest===!0}function bs(t){return t.name.endsWith("_GET")}function js(t){return t.name.endsWith("_VERSIONS")}function ys(){return!1}function go(){const t=R.c(6),{org:e}=Ee(),o=$e();let r;t[0]!==o||t[1]!==e.slug?(r=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[0]=o,t[1]=e.slug,t[2]=r):r=t[2];const n=r;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(q.Suspense,{fallback:s.jsx(Vt,{}),children:s.jsx(ds,{})}),t[3]=i):i=t[3];let a;return t[4]!==n?(a=s.jsx(cs,{onBack:n,children:i}),t[4]=n,t[5]=a):a=t[5],a}export{go as default};
@@ -1,3 +1,3 @@
1
- import{r as G,K as le,a as J,y as fs,I as He,J as Ms,L as zs,z as ue,x as qe,E as ys,B as ks,t as X,j as t,c as de,v as Ds}from"./index-DZBCLPmz.js";import{C as Bs}from"./collection-header-DMI-enxo.js";import{C as es}from"./collection-page-CPVm36im.js";import{C as Ze}from"./collection-search-NPXhv3P8.js";import{C as Us}from"./collection-table-wrapper-CH0cDKjW.js";import{T as Gs}from"./tool-set-selector-CWxawPKU.js";import{u as Vs}from"./use-connection-CD3KQhdl.js";import{u as ls}from"./use-members-D-h9QOxK.js";import{W as $s}from"./well-known-mcp-DOEdYmKO.js";import{u as je}from"./project-context-provider-CwtkfEWe.js";import{u as Ss}from"./useQuery-mZS4-X0F.js";import{A as Ce}from"./avatar-D0pQKePK.js";import{B as ve}from"./badge-9bzwrgbk.js";import{c as re,B as ee}from"./button-C_Xg9B1B.js";import{C as Fs}from"./checkbox-z9w2qryt.js";import{f as Ee,a as ye,b as Se,c as Ie,d as Te,e as we,A as Oe,g as Ae}from"./alert-dialog-Mcf5ObRp.js";import{d as Is,e as Ts,c as ws,a as Ks,D as Qs,f as qs}from"./dialog-C9Agm5JE.js";import{b as as,D as cs,a as ds,c as Ke,e as Zs,f as Ys,g as Ws,d as Hs}from"./dropdown-menu-fQ8f1M5d.js";import{i as Xs}from"./DotsHorizontal-CjU9uXdh.js";import{i as Os}from"./Loading01-6JGza9Vp.js";import{i as Js}from"./Lock01-DAc7yIAH.js";import{s as ss}from"./Plus-Dcgso5EP.js";import{s as As}from"./Trash01-CzA8mxf_.js";import{i as hs}from"./X-C7-BOCtk.js";import{I as et}from"./input-DrOaW48H.js";import{S as Ge}from"./switch-BDCe2nGJ.js";import{a as Re,c as _e,b as Pe,T as Le}from"./tooltip-CpJ7mUzE.js";import{u as fe}from"./useMutation-DV6K6Nze.js";import{E as Xe}from"./empty-state-DBRX3hef.js";import{E as st}from"./error-boundary-yHT4ni_0.js";import{a as tt,F as gs,b as ps,c as nt,d as xs,f as bs}from"./form-D_wQlmgT.js";import{S as ts,a as ns,b as rs,c as is,d as os}from"./select-Cgab7LNB.js";import{T as rt}from"./textarea-BL4bZEBo.js";import{c as it}from"./connection-DoXpv3Ov.js";import{C as Cs}from"./card-BXLd4InC.js";import{i as Rs}from"./DotsVertical-D6TZm5RT.js";import{i as ot}from"./Key01-BDVEoltU.js";import{s as lt}from"./XClose-COetRF8H.js";import"./collection-display-button-DNzo_eaI.js";import"./ArrowUp-Xq_0RBx_.js";import"./Check-DijrPXQx.js";import"./Grid01-CTb93Z2I.js";import"./List-jMJevXfS.js";import"./view-mode-toggle-DPk8_aIn.js";import"./SearchMd-CbnCIalV.js";import"./ArrowLeft-BsUDOBX0.js";import"./use-collections-BmF5uRR6.js";import"./ChevronDown-DASi-DMo.js";const ms=({size:s=24,color:e="currentColor",...n})=>G.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},G.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"}));ms.displayName="Shield01";const _s=({size:s=24,color:e="currentColor",...n})=>G.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},G.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));_s.displayName="SwitchHorizontal01";const Ps=[{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_GATEWAY_CREATE",description:"Create gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_LIST",description:"List gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_GET",description:"View gateway details",category:"Gateways"},{name:"COLLECTION_GATEWAY_UPDATE",description:"Update gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_DELETE",description:"Delete gateways",category:"Gateways",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}],at={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_GATEWAY_CREATE:"Create gateways",COLLECTION_GATEWAY_LIST:"List gateways",COLLECTION_GATEWAY_GET:"View gateway details",COLLECTION_GATEWAY_UPDATE:"Update gateways",COLLECTION_GATEWAY_DELETE:"Delete gateways",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"};function ct(){const s={Organizations:[],Connections:[],Gateways:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Ps)s[e.category]?.push(e);return s}function dt(){return Ps.map(s=>({value:s.name,label:at[s.name],dangerous:s.dangerous}))}const js=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function mt(s){return s.replace(/-/g," ")}function ut(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const o=[];let a=!1;const i=new Set;let h=!1;for(const[l,p]of Object.entries(s)){if(l===$s.SELF){p.includes("*")?n=!0:e.push(...p);continue}if(l==="*"){if(a=!0,p.includes("*"))h=!0;else for(const E of p)i.add(E);continue}if(o.push(l),p.includes("*"))h=!0;else for(const E of p)i.add(E)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:o,allowsAllConnections:a,toolNames:Array.from(i),allowsAllTools:h}}function us(){const{locator:s}=je(),{data:e,isLoading:n,error:o,refetch:a}=Ss({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await J.organization.listRoles();return l?.error?(console.error("[useOrganizationRoles] API error:",l.error),[]):l?.data??[]}catch(l){return console.error("[useOrganizationRoles] Fetch error:",l),[]}},staleTime:3e4}),i=js.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const p=l.role;if(!p||js.some(C=>C.value===p))continue;const{staticPermissions:E,allowsAllStaticPermissions:f,connectionIds:w,allowsAllConnections:d,toolNames:S,allowsAllTools:u}=ut(l.permission);i.push({id:l.id,role:p,label:mt(p),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:f?-1:E.length,allowsAllStaticPermissions:f,connectionCount:d?-1:w.length,allowsAllConnections:d,toolCount:u?-1:S.length,allowsAllTools:u})}const h=i.filter(l=>!l.isBuiltin);return{roles:i,customRoles:h,builtinRoles:i.filter(l=>l.isBuiltin),isLoading:n,error:o,refetch:a}}const ft=fs({role:fs({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:zs(),staticPermissions:He(ue()),toolSet:Ms(ue(),He(ue())),memberIds:He(ue())});function Ls(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const ht=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Je=["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 gt(s){if(!s)return"bg-neutral-400";let e=0;for(let o=0;o<s.length;o++){const a=s.charCodeAt(o);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%Je.length;return Je[n]??Je[0]}function Ve(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function pt(s){const e=de.c(39),{allowAllStaticPermissions:n,staticPermissions:o,onAllowAllChange:a,onPermissionsChange:i,readOnly:h}=s,l=h===void 0?!1:h,[p,E]=G.useState(""),f=G.useDeferredValue(p);let w,d,S,u,C;if(e[0]!==n||e[1]!==f||e[2]!==a||e[3]!==i||e[4]!==l||e[5]!==p||e[6]!==o){const g=ct(),c=dt(),N=c.filter(y=>y.label.toLowerCase().includes(f.toLowerCase())),I=y=>{if(o.includes(y))i(o.filter(_=>_!==y));else{const _=[...o,y];_.length===c.length?(a(!0),i([])):i(_)}};S="flex flex-col h-full",e[12]!==p?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(Ze,{value:p,onChange:E,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=p,e[13]=u):u=e[13];const P=!l&&"hover:bg-muted/50 cursor-pointer";let T;e[14]!==P?(T=re("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=T):T=e[15];let A;e[16]!==n||e[17]!==a||e[18]!==i||e[19]!==l?(A=()=>{if(l)return;a(!n),i([])},e[16]=n,e[17]=a,e[18]=i,e[19]=l,e[20]=A):A=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=O):O=e[21];let L;e[22]!==n||e[23]!==a||e[24]!==i||e[25]!==l?(L=t.jsx("div",{onClick:Nt,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ge,{checked:n,disabled:l,onCheckedChange:y=>{l||(a(y),i([]))}})})}),t.jsx(Le,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ge,{checked:n,disabled:l,onCheckedChange:y=>{l||(a(y),i([]))}})}),e[22]=n,e[23]=a,e[24]=i,e[25]=l,e[26]=L):L=e[26],e[27]!==L||e[28]!==T||e[29]!==A?(C=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:T,onClick:A,children:[O,L]})}),e[27]=L,e[28]=T,e[29]=A,e[30]=C):C=e[30],w="flex-1 overflow-auto",d=Object.entries(g).map(y=>{const[_,z]=y,v=N.filter(m=>z.some(M=>M.name===m.value));return v.length===0?null:t.jsxs("div",{className:"mb-6 last:mb-0",children:[t.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:_}),t.jsx("div",{className:"space-y-1",children:v.map(m=>t.jsxs("div",{className:re("flex items-center justify-between gap-3 px-4 py-3",!l&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!l)if(n){a(!1);const M=c.map(jt);i(M.filter(V=>V!==m.value))}else I(m.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:m.label})}),t.jsx("div",{onClick:Ct,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ge,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(bt);i(M.filter(V=>V!==m.value))}else I(m.value)}})})}),t.jsx(Le,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ge,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(xt);i(M.filter(V=>V!==m.value))}else I(m.value)}})})]},m.value))})]},_)}),e[0]=n,e[1]=f,e[2]=a,e[3]=i,e[4]=l,e[5]=p,e[6]=o,e[7]=w,e[8]=d,e[9]=S,e[10]=u,e[11]=C}else w=e[7],d=e[8],S=e[9],u=e[10],C=e[11];let x;e[31]!==w||e[32]!==d?(x=t.jsx("div",{className:w,children:d}),e[31]=w,e[32]=d,e[33]=x):x=e[33];let j;return e[34]!==S||e[35]!==u||e[36]!==C||e[37]!==x?(j=t.jsxs("div",{className:S,children:[u,C,x]}),e[34]=S,e[35]=u,e[36]=C,e[37]=x,e[38]=j):j=e[38],j}function xt(s){return s.value}function bt(s){return s.value}function Ct(s){return s.stopPropagation()}function jt(s){return s.value}function Nt(s){return s.stopPropagation()}function vt(s){const e=de.c(56),{open:n,onOpenChange:o,selectedMemberIds:a,onAddMembers:i}=s,[h,l]=G.useState(""),p=G.useDeferredValue(h);let E;e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0];const[f,w]=G.useState(E),{data:d}=ls();let S,u,C,x,j,g,c,N,I,P,T;if(e[1]!==d?.data?.members||e[2]!==p||e[3]!==i||e[4]!==o||e[5]!==n||e[6]!==f||e[7]!==h||e[8]!==a){const M=d?.data?.members??[];let V;e[20]!==p?(V=D=>{const r=p.toLowerCase();return D.user?.name?.toLowerCase().includes(r)||D.user?.email?.toLowerCase().includes(r)},e[20]=p,e[21]=V):V=e[21];const se=M.filter(V),F=Et;let K;e[22]!==a?(K=D=>a.includes(D),e[22]=a,e[23]=K):K=e[23];const Q=K;let Y;e[24]!==f?(Y=D=>{f.includes(D)?w(f.filter(r=>r!==D)):w([...f,D])},e[24]=f,e[25]=Y):Y=e[25];const ne=Y;let te;e[26]!==i||e[27]!==o||e[28]!==f?(te=()=>{i(f),w([]),o(!1)},e[26]=i,e[27]=o,e[28]=f,e[29]=te):te=e[29],C=te,u=Ee,P=n,T=o,S=ye,N="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsxs(Se,{className:"px-6 pt-6",children:[t.jsx(Ie,{children:"Add Members to Role"}),t.jsx(Te,{children:"Select members to add to this role."})]}),e[30]=I):I=e[30],g="flex flex-col h-80",e[31]!==h?(c=t.jsx(Ze,{value:h,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=h,e[32]=c):c=e[32],x="flex-1 overflow-auto",j=se.length===0?t.jsx("div",{className:"flex items-center justify-center h-full px-6",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:h?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:se.map(D=>{const r=F(D),b=Q(D.id),$=f.includes(D.id);return t.jsxs("label",{className:re("flex items-center gap-3 p-2 rounded-lg",!r||b?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(Fs,{checked:$||b,onCheckedChange:()=>{r&&!b&&ne(D.id)},disabled:!r||b}),t.jsx(Ce,{url:D.user?.image??void 0,fallback:Ls(D.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:D.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.user?.email})]}),!r&&t.jsx(ve,{variant:"secondary",className:"shrink-0",children:"Owner"}),b&&r&&t.jsx(ve,{variant:"outline",className:"shrink-0",children:"Added"})]},D.id)})}),e[1]=d?.data?.members,e[2]=p,e[3]=i,e[4]=o,e[5]=n,e[6]=f,e[7]=h,e[8]=a,e[9]=S,e[10]=u,e[11]=C,e[12]=x,e[13]=j,e[14]=g,e[15]=c,e[16]=N,e[17]=I,e[18]=P,e[19]=T}else S=e[9],u=e[10],C=e[11],x=e[12],j=e[13],g=e[14],c=e[15],N=e[16],I=e[17],P=e[18],T=e[19];let A;e[33]!==x||e[34]!==j?(A=t.jsx("div",{className:x,children:j}),e[33]=x,e[34]=j,e[35]=A):A=e[35];let O;e[36]!==A||e[37]!==g||e[38]!==c?(O=t.jsxs("div",{className:g,children:[c,A]}),e[36]=A,e[37]=g,e[38]=c,e[39]=O):O=e[39];let L;e[40]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(Oe,{children:"Cancel"}),e[40]=L):L=e[40];const y=f.length===0,_=f.length>0&&`(${f.length})`;let z;e[41]!==C||e[42]!==y||e[43]!==_?(z=t.jsxs(we,{className:"px-6 pb-6",children:[L,t.jsxs(Ae,{onClick:C,disabled:y,children:["Add ",_]})]}),e[41]=C,e[42]=y,e[43]=_,e[44]=z):z=e[44];let v;e[45]!==S||e[46]!==O||e[47]!==z||e[48]!==N||e[49]!==I?(v=t.jsxs(S,{className:N,children:[I,O,z]}),e[45]=S,e[46]=O,e[47]=z,e[48]=N,e[49]=I,e[50]=v):v=e[50];let m;return e[51]!==u||e[52]!==v||e[53]!==P||e[54]!==T?(m=t.jsx(u,{open:P,onOpenChange:T,children:v}),e[51]=u,e[52]=v,e[53]=P,e[54]=T,e[55]=m):m=e[55],m}function Et(s){return s.role!=="owner"}function yt(s){const e=de.c(40),{memberIds:n,onMemberIdsChange:o,readOnly:a}=s,i=a===void 0?!1:a,[h,l]=G.useState(""),p=G.useDeferredValue(h),[E,f]=G.useState(!1),{data:w}=ls();let d,S,u,C,x;if(e[0]!==w?.data?.members||e[1]!==p||e[2]!==n||e[3]!==o||e[4]!==i||e[5]!==h){const N=w?.data?.members??[];let I;e[11]!==n?(I=v=>n.includes(v.id),e[11]=n,e[12]=I):I=e[12];const P=N.filter(I);let T;e[13]!==p?(T=v=>{const m=p.toLowerCase();return v.user?.name?.toLowerCase().includes(m)||v.user?.email?.toLowerCase().includes(m)},e[13]=p,e[14]=T):T=e[14];const A=P.filter(T);let O;e[15]!==n||e[16]!==o?(O=v=>{o(n.filter(m=>m!==v))},e[15]=n,e[16]=o,e[17]=O):O=e[17];const L=O;let y;e[18]!==n||e[19]!==o?(y=v=>{o([...n,...v])},e[18]=n,e[19]=o,e[20]=y):y=e[20],d=y,C="flex flex-col h-full";let _;e[21]!==h?(_=t.jsx(Ze,{value:h,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=h,e[22]=_):_=e[22];let z;e[23]!==i?(z=i?t.jsx("div",{className:"pr-4",children:t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(ss,{size:16}),"Add Member"]})})}),t.jsx(Le,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):t.jsx("div",{className:"pr-4",children:t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[t.jsx(ss,{size:16}),"Add Member"]})}),e[23]=i,e[24]=z):z=e[24],e[25]!==_||e[26]!==z?(x=t.jsxs("div",{className:"flex items-center border-b border-border",children:[_,z]}),e[25]=_,e[26]=z,e[27]=x):x=e[27],S="flex-1 overflow-auto",u=P.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):A.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',h,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:A.map(v=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(Ce,{url:v.user?.image??void 0,fallback:Ls(v.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:v.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.user?.email})]}),i?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(hs,{size:16})})})}),t.jsx(Le,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>L(v.id),children:t.jsx(hs,{size:16})})]},v.id))}),e[0]=w?.data?.members,e[1]=p,e[2]=n,e[3]=o,e[4]=i,e[5]=h,e[6]=d,e[7]=S,e[8]=u,e[9]=C,e[10]=x}else d=e[6],S=e[7],u=e[8],C=e[9],x=e[10];let j;e[28]!==S||e[29]!==u?(j=t.jsx("div",{className:S,children:u}),e[28]=S,e[29]=u,e[30]=j):j=e[30];let g;e[31]!==E||e[32]!==d||e[33]!==n?(g=t.jsx(vt,{open:E,onOpenChange:f,selectedMemberIds:n,onAddMembers:d}),e[31]=E,e[32]=d,e[33]=n,e[34]=g):g=e[34];let c;return e[35]!==C||e[36]!==x||e[37]!==j||e[38]!==g?(c=t.jsxs("div",{className:C,children:[x,j,g]}),e[35]=C,e[36]=x,e[37]=j,e[38]=g,e[39]=c):c=e[39],c}function St(s){const e=de.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Os,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let o;return e[1]!==s?(o=t.jsx(G.Suspense,{fallback:n,children:t.jsx(yt,{...s})}),e[1]=s,e[2]=o):o=e[2],o}const It={owner:[],admin:[],user:[]};function $e(s,e){const n=s==="owner"||s==="admin",o=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:It[s],toolSet:{},memberIds:o.map(a=>a.id)}}function Tt({trigger:s,onSuccess:e}){const[n,o]=G.useState(!1),[a,i]=G.useState("mcp"),{locator:h}=je(),l=qe(),p=Vs()??[],{customRoles:E,refetch:f}=us(),{data:w}=Ss({queryKey:le.members(h),queryFn:()=>J.organization.listMembers()}),d=ys({resolver:ks(ft),defaultValues:Ve()}),S=d.formState.isValid,u=d.formState.isDirty,[C,x]=G.useState(null),[j,g]=G.useState(null),c=!d.watch("role.id")&&!d.watch("role.slug")&&!j,[N,I]=G.useState(null),[P,T]=G.useState(!1),[A,O]=G.useState(null),L=r=>{const b=r.permission||{},$=b.self||[],oe=$.includes("*"),ie=oe?[]:$.filter(k=>k!=="*"),W={};for(const[k,B]of Object.entries(b))if(k!=="self")if(k==="*")for(const Z of p)B.includes("*")?W[Z.id]=Z.tools?.map(ae=>ae.name)??[]:W[Z.id]=B;else{const Z=p.find(ae=>ae.id===k);Z&&(B.includes("*")?W[k]=Z.tools?.map(ae=>ae.name)??[]:W[k]=B)}const me=(w?.data?.members??[]).filter(k=>k.role===r.role).map(k=>k.id);return{role:{id:r.id,slug:r.role,label:r.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:W,memberIds:me}},y=r=>{const b=L(r);d.reset(b),x(r.id??null),g(null)},_=()=>{d.reset(Ve()),x(null),g(null),i("mcp")},z=r=>{u&&S?(O(()=>()=>y(r)),T(!0)):y(r)},v=async()=>{u&&S&&await Y(),_()},m=r=>{if(u&&S)O(()=>()=>{const b=$e(r,w?.data?.members??[]);d.reset(b),g(r),x(null),i("org")}),T(!0);else{const b=$e(r,w?.data?.members??[]);d.reset(b),g(r),x(null),i("org")}},M=r=>{if(!r&&d.formState.isDirty&&S){O(()=>()=>{o(!1),d.reset(Ve()),g(null)}),T(!0);return}if(o(r),!r)d.reset(Ve()),g(null),x(null);else{const b=E[0];if(b)y(b);else{const $=$e("user",w?.data?.members??[]);d.reset($),g("user"),x(null),i("org")}}},V=()=>{T(!1),A&&(A(),O(null))},se=r=>{const b={};r.allowAllStaticPermissions?b.self=["*"]:r.staticPermissions.length>0&&(b.self=r.staticPermissions);for(const[$,oe]of Object.entries(r.toolSet))if(oe.length>0){const W=p.find(q=>q.id===$)?.tools?.map(q=>q.name)??[];W.length>0&&W.every(q=>oe.includes(q))?b[$]=["*"]:b[$]=oe}return b},F=fe({mutationFn:async r=>{const b=se(r),$=r.role.slug||r.role.label.toLowerCase().replace(/\s+/g,"-");if(r.role.slug&&!r.role.id){const W=(w?.data?.members??[]).filter(k=>k.role===r.role.slug).map(k=>k.id),q=r.memberIds.filter(k=>!W.includes(k)),me=W.filter(k=>!r.memberIds.includes(k));for(const k of q){const B=await J.organization.updateMemberRole({memberId:k,role:[r.role.slug]});if(B?.error)throw new Error(B.error.message)}for(const k of me){const B=await J.organization.updateMemberRole({memberId:k,role:["user"]});if(B?.error)throw new Error(B.error.message)}return r}else if(r.role.id){const ie=await J.organization.updateRole({roleId:r.role.id,data:{permission:b}});if(ie?.error)throw new Error(ie.error.message);const q=(w?.data?.members??[]).filter(B=>B.role===r.role.slug).map(B=>B.id),me=r.memberIds.filter(B=>!q.includes(B)),k=q.filter(B=>!r.memberIds.includes(B));for(const B of me){const Z=await J.organization.updateMemberRole({memberId:B,role:[r.role.slug]});if(Z?.error)throw new Error(Z.error.message)}for(const B of k){const Z=await J.organization.updateMemberRole({memberId:B,role:["user"]});if(Z?.error)throw new Error(Z.error.message)}return r}else{const ie=await J.organization.createRole({role:$,permission:b});if(ie?.error)throw new Error(ie.error.message);for(const W of r.memberIds){const q=await J.organization.updateMemberRole({memberId:W,role:[$]});if(q?.error)throw new Error(q.error.message)}return{...r,role:{...r.role,id:ie.data?.roleData?.id,slug:$}}}},onSuccess:(r,b)=>{l.invalidateQueries({queryKey:le.members(h)}),l.invalidateQueries({queryKey:le.organizationRoles(h)});const $=!b.role.id&&!b.role.slug,oe=b.role.slug&&!b.role.id;X.success(oe?"Members updated successfully!":$?"Role created successfully!":"Role updated successfully!"),f(),d.reset(r),r.role.id&&x(r.role.id),e?.()},onError:r=>{X.error(r instanceof Error?r.message:"Failed to save role")}}),K=fe({mutationFn:async r=>{const b=await J.organization.deleteRole({roleId:r});if(b?.error)throw new Error(b.error.message);return b?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(h)}),l.invalidateQueries({queryKey:le.organizationRoles(h)}),X.success("Role deleted successfully!"),f(),N?.id===C){const r=E.filter(b=>b.id!==N?.id);if(r[0])y(r[0]);else{const b=$e("user",w?.data?.members??[]);d.reset(b),g("user"),x(null),i("org")}}},onError:r=>{X.error(r instanceof Error?r.message:"Failed to delete role")}}),Q=F.isPending||K.isPending,Y=async()=>{const r=d.getValues();if(!r.role.label.trim()){X.error("Role name is required"),d.setFocus("role.label");return}await F.mutateAsync(r)},ne=d.handleSubmit(r=>{if(!r.role.label.trim()){X.error("Role name is required"),d.setFocus("role.label");return}F.mutate(r)}),te=r=>{r.id&&I({id:r.id,label:r.label})},D=()=>{N?.id&&K.mutate(N.id),I(null)};return t.jsxs(Is,{open:n,onOpenChange:M,children:[t.jsx(Ts,{asChild:!0,children:s}),t.jsx(ws,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[t.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:[t.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:t.jsxs("div",{className:"flex flex-col gap-1",children:[ht.map(r=>{const b=j===r.role;return t.jsxs("div",{className:re("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>m(r.role),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",r.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsx(Js,{size:14,className:"text-muted-foreground shrink-0"})]},r.role)}),E.map(r=>{const b=C===r.id;return t.jsxs("div",{className:re("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>z(r),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",gt(r.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsxs(as,{children:[t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:re("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",b&&"opacity-100 pointer-events-auto"),onClick:$=>$.stopPropagation(),children:t.jsx(Xs,{size:14})})}),t.jsx(ds,{align:"end",children:t.jsxs(Ke,{className:"text-destructive",onClick:$=>{$.stopPropagation(),te(r)},children:[t.jsx(As,{size:16}),"Delete"]})})]})]},r.id)}),c&&t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[t.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),t.jsx(et,{...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}),t.jsx(ve,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),t.jsx("div",{className:"px-3.5 pb-3.5",children:t.jsxs(ee,{variant:"outline",size:"default",onClick:v,disabled:Q||u,className:"w-full h-10",children:[t.jsx(ss,{size:16}),"Create new role"]})})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!j&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("mcp"),className:re("h-8 rounded-lg px-2 py-1",a==="mcp"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"MCP Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("org"),className:re("h-8 rounded-lg px-2 py-1",a==="org"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Organization Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("members"),className:re("h-8 rounded-lg px-2 py-1",a==="members"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Members"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[a==="mcp"&&!j&&t.jsx(Gs,{toolSet:d.watch("toolSet"),onToolSetChange:r=>d.setValue("toolSet",r,{shouldDirty:!0})}),a==="org"&&t.jsx(pt,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:r=>d.setValue("allowAllStaticPermissions",r,{shouldDirty:!0}),onPermissionsChange:r=>d.setValue("staticPermissions",r,{shouldDirty:!0}),readOnly:!!j}),a==="members"&&t.jsx(St,{memberIds:d.watch("memberIds"),onMemberIdsChange:r=>d.setValue("memberIds",r,{shouldDirty:!0}),readOnly:j==="owner"})]}),(!j||j!=="owner")&&t.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[t.jsx(ee,{variant:"outline",onClick:()=>M(!1),disabled:Q,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:ne,disabled:Q||!S||!d.formState.isDirty,className:"h-10",children:F.isPending?"Saving...":c?"Create Role":"Save Changes"})]})]})]})}),t.jsx(Ee,{open:N!==null,onOpenChange:r=>!r&&I(null),children:t.jsxs(ye,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Delete Role"}),t.jsxs(Te,{children:['Are you sure you want to delete the "',N?.label,'" role? This action cannot be undone.']})]}),t.jsxs(we,{children:[t.jsx(Oe,{children:"Cancel"}),t.jsx(Ae,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Ee,{open:P,onOpenChange:T,children:t.jsxs(ye,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Discard Changes"}),t.jsx(Te,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(we,{children:[t.jsx(Oe,{onClick:()=>O(null),children:"Keep Editing"}),t.jsx(Ae,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const wt=ue().email("Invalid email address");function Ot(s){if(!s.trim())return[];const e=s.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function At({trigger:s}){const[e,n]=G.useState(!1),{locator:o}=je(),a=qe(),{data:i}=J.useSession(),h=i?.user?.email,{roles:l,isLoading:p}=us(),E=l.filter(g=>g.role!=="owner"),f=ys({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),w=f.watch("emailsText"),d=f.watch("role"),u=Ot(w).filter(g=>{const c=wt.safeParse(g).success,N=!h||g!==h.toLowerCase();return c&&N}),C=fe({mutationFn:async({emails:g,role:c})=>{if(!c)throw new Error("Please select a role");const N=await Promise.allSettled(g.map(async P=>{const T=await J.organization.inviteMember({email:P,role:c});if(T.error)throw new Error(T.error.message);return T.data})),I=N.filter(P=>P.status==="rejected");if(I.length>0)throw new Error(`Failed to invite ${I.length} member${I.length>1?"s":""}`);return N},onSuccess:(g,{emails:c})=>{a.invalidateQueries({queryKey:le.members(o)}),a.invalidateQueries({queryKey:le.invitations(o)}),X.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),f.reset({emailsText:"",role:"user"}),n(!1)},onError:g=>{X.error(g instanceof Error?g.message:"Failed to invite members")}}),x=g=>{if(u.length===0){X.error("Please enter at least one valid email address");return}if(!g.role){X.error("Please select a role");return}C.mutate({emails:u,role:g.role})},j=u.length>0&&!!d;return t.jsxs(Is,{open:e,onOpenChange:n,children:[t.jsx(Ts,{asChild:!0,children:s}),t.jsxs(ws,{className:"sm:max-w-lg",children:[t.jsx(Ks,{children:t.jsx(Qs,{children:"Invite members"})}),t.jsx(tt,{...f,children:t.jsxs("form",{onSubmit:f.handleSubmit(x),className:"space-y-4",children:[t.jsx(gs,{control:f.control,name:"emailsText",render:({field:g})=>t.jsxs(ps,{children:[t.jsx(nt,{children:"Email addresses"}),t.jsx(xs,{children:t.jsx(rt,{...g,disabled:C.isPending,placeholder:`Enter email addresses separated by commas or new lines
1
+ import{r as G,K as le,a as J,y as fs,I as He,J as Ms,L as zs,z as ue,x as qe,E as ys,B as ks,t as X,j as t,c as de,v as Ds}from"./index-Diww4UW3.js";import{C as Bs}from"./collection-header-B4qcjEt5.js";import{C as es}from"./collection-page-s-RR5fU6.js";import{C as Ze}from"./collection-search-BVb42O45.js";import{C as Us}from"./collection-table-wrapper-BohFZqii.js";import{T as Gs}from"./tool-set-selector-B9rTBahU.js";import{u as Vs}from"./use-connection-CCXutWLD.js";import{u as ls}from"./use-members-CB2ebBfn.js";import{W as $s}from"./well-known-mcp-DOEdYmKO.js";import{u as je}from"./project-context-provider-DulCVL2k.js";import{u as Ss}from"./useQuery-Bvk0U2ed.js";import{A as Ce}from"./avatar-B7xnPXuk.js";import{B as ve}from"./badge-BVO6I0sW.js";import{c as re,B as ee}from"./button-CGmrzkpY.js";import{C as Fs}from"./checkbox-DYViXeUc.js";import{f as Ee,a as ye,b as Se,c as Ie,d as Te,e as we,A as Oe,g as Ae}from"./alert-dialog-CCJCsKzK.js";import{d as Is,e as Ts,c as ws,a as Ks,D as Qs,f as qs}from"./dialog-DJJ2cvEE.js";import{b as as,D as cs,a as ds,c as Ke,e as Zs,f as Ys,g as Ws,d as Hs}from"./dropdown-menu-CAeD2aIb.js";import{i as Xs}from"./DotsHorizontal-C2Nr-D-f.js";import{i as Os}from"./Loading01-Ae5ezbtD.js";import{i as Js}from"./Lock01-BuQSktMF.js";import{s as ss}from"./Plus-CdG75X26.js";import{s as As}from"./Trash01-BWIN9RL_.js";import{i as hs}from"./X-C18ho617.js";import{I as et}from"./input-CrURMEZe.js";import{S as Ge}from"./switch-DJBd8Fzb.js";import{a as Re,c as _e,b as Pe,T as Le}from"./tooltip-Suu_Gpqh.js";import{u as fe}from"./useMutation-Dl1MMkEC.js";import{E as Xe}from"./empty-state-wP9uukGJ.js";import{E as st}from"./error-boundary-BUvK8Sry.js";import{a as tt,F as gs,b as ps,c as nt,d as xs,f as bs}from"./form-DiGzBnRK.js";import{S as ts,a as ns,b as rs,c as is,d as os}from"./select-C8LOz7vA.js";import{T as rt}from"./textarea-C_zgj3Sp.js";import{c as it}from"./connection-ChwHK0-S.js";import{C as Cs}from"./card-DIjMh1NO.js";import{i as Rs}from"./DotsVertical-BPP4U4GQ.js";import{i as ot}from"./Key01-DTwk4FpG.js";import{s as lt}from"./XClose-CfwoKknl.js";import"./collection-display-button-CtkxsCB_.js";import"./ArrowUp-BF7mM4C2.js";import"./Check-BQkm1TiP.js";import"./Grid01-D4lXvveX.js";import"./List-BsSZz32j.js";import"./view-mode-toggle-BLClM-0g.js";import"./SearchMd-GFaonOaJ.js";import"./ArrowLeft-B3km7toT.js";import"./use-collections-CXETocKO.js";import"./ChevronDown-DP6jvip7.js";const ms=({size:s=24,color:e="currentColor",...n})=>G.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},G.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"}));ms.displayName="Shield01";const _s=({size:s=24,color:e="currentColor",...n})=>G.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},G.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));_s.displayName="SwitchHorizontal01";const Ps=[{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_GATEWAY_CREATE",description:"Create gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_LIST",description:"List gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_GET",description:"View gateway details",category:"Gateways"},{name:"COLLECTION_GATEWAY_UPDATE",description:"Update gateways",category:"Gateways"},{name:"COLLECTION_GATEWAY_DELETE",description:"Delete gateways",category:"Gateways",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}],at={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_GATEWAY_CREATE:"Create gateways",COLLECTION_GATEWAY_LIST:"List gateways",COLLECTION_GATEWAY_GET:"View gateway details",COLLECTION_GATEWAY_UPDATE:"Update gateways",COLLECTION_GATEWAY_DELETE:"Delete gateways",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"};function ct(){const s={Organizations:[],Connections:[],Gateways:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Ps)s[e.category]?.push(e);return s}function dt(){return Ps.map(s=>({value:s.name,label:at[s.name],dangerous:s.dangerous}))}const js=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function mt(s){return s.replace(/-/g," ")}function ut(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const o=[];let a=!1;const i=new Set;let h=!1;for(const[l,p]of Object.entries(s)){if(l===$s.SELF){p.includes("*")?n=!0:e.push(...p);continue}if(l==="*"){if(a=!0,p.includes("*"))h=!0;else for(const E of p)i.add(E);continue}if(o.push(l),p.includes("*"))h=!0;else for(const E of p)i.add(E)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:o,allowsAllConnections:a,toolNames:Array.from(i),allowsAllTools:h}}function us(){const{locator:s}=je(),{data:e,isLoading:n,error:o,refetch:a}=Ss({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await J.organization.listRoles();return l?.error?(console.error("[useOrganizationRoles] API error:",l.error),[]):l?.data??[]}catch(l){return console.error("[useOrganizationRoles] Fetch error:",l),[]}},staleTime:3e4}),i=js.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const p=l.role;if(!p||js.some(C=>C.value===p))continue;const{staticPermissions:E,allowsAllStaticPermissions:f,connectionIds:w,allowsAllConnections:d,toolNames:S,allowsAllTools:u}=ut(l.permission);i.push({id:l.id,role:p,label:mt(p),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:f?-1:E.length,allowsAllStaticPermissions:f,connectionCount:d?-1:w.length,allowsAllConnections:d,toolCount:u?-1:S.length,allowsAllTools:u})}const h=i.filter(l=>!l.isBuiltin);return{roles:i,customRoles:h,builtinRoles:i.filter(l=>l.isBuiltin),isLoading:n,error:o,refetch:a}}const ft=fs({role:fs({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:zs(),staticPermissions:He(ue()),toolSet:Ms(ue(),He(ue())),memberIds:He(ue())});function Ls(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const ht=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Je=["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 gt(s){if(!s)return"bg-neutral-400";let e=0;for(let o=0;o<s.length;o++){const a=s.charCodeAt(o);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%Je.length;return Je[n]??Je[0]}function Ve(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function pt(s){const e=de.c(39),{allowAllStaticPermissions:n,staticPermissions:o,onAllowAllChange:a,onPermissionsChange:i,readOnly:h}=s,l=h===void 0?!1:h,[p,E]=G.useState(""),f=G.useDeferredValue(p);let w,d,S,u,C;if(e[0]!==n||e[1]!==f||e[2]!==a||e[3]!==i||e[4]!==l||e[5]!==p||e[6]!==o){const g=ct(),c=dt(),N=c.filter(y=>y.label.toLowerCase().includes(f.toLowerCase())),I=y=>{if(o.includes(y))i(o.filter(_=>_!==y));else{const _=[...o,y];_.length===c.length?(a(!0),i([])):i(_)}};S="flex flex-col h-full",e[12]!==p?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(Ze,{value:p,onChange:E,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=p,e[13]=u):u=e[13];const P=!l&&"hover:bg-muted/50 cursor-pointer";let T;e[14]!==P?(T=re("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=T):T=e[15];let A;e[16]!==n||e[17]!==a||e[18]!==i||e[19]!==l?(A=()=>{if(l)return;a(!n),i([])},e[16]=n,e[17]=a,e[18]=i,e[19]=l,e[20]=A):A=e[20];let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=O):O=e[21];let L;e[22]!==n||e[23]!==a||e[24]!==i||e[25]!==l?(L=t.jsx("div",{onClick:Nt,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ge,{checked:n,disabled:l,onCheckedChange:y=>{l||(a(y),i([]))}})})}),t.jsx(Le,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ge,{checked:n,disabled:l,onCheckedChange:y=>{l||(a(y),i([]))}})}),e[22]=n,e[23]=a,e[24]=i,e[25]=l,e[26]=L):L=e[26],e[27]!==L||e[28]!==T||e[29]!==A?(C=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:T,onClick:A,children:[O,L]})}),e[27]=L,e[28]=T,e[29]=A,e[30]=C):C=e[30],w="flex-1 overflow-auto",d=Object.entries(g).map(y=>{const[_,z]=y,v=N.filter(m=>z.some(M=>M.name===m.value));return v.length===0?null:t.jsxs("div",{className:"mb-6 last:mb-0",children:[t.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:_}),t.jsx("div",{className:"space-y-1",children:v.map(m=>t.jsxs("div",{className:re("flex items-center justify-between gap-3 px-4 py-3",!l&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!l)if(n){a(!1);const M=c.map(jt);i(M.filter(V=>V!==m.value))}else I(m.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:m.label})}),t.jsx("div",{onClick:Ct,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ge,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(bt);i(M.filter(V=>V!==m.value))}else I(m.value)}})})}),t.jsx(Le,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ge,{checked:n||o.includes(m.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const M=c.map(xt);i(M.filter(V=>V!==m.value))}else I(m.value)}})})]},m.value))})]},_)}),e[0]=n,e[1]=f,e[2]=a,e[3]=i,e[4]=l,e[5]=p,e[6]=o,e[7]=w,e[8]=d,e[9]=S,e[10]=u,e[11]=C}else w=e[7],d=e[8],S=e[9],u=e[10],C=e[11];let x;e[31]!==w||e[32]!==d?(x=t.jsx("div",{className:w,children:d}),e[31]=w,e[32]=d,e[33]=x):x=e[33];let j;return e[34]!==S||e[35]!==u||e[36]!==C||e[37]!==x?(j=t.jsxs("div",{className:S,children:[u,C,x]}),e[34]=S,e[35]=u,e[36]=C,e[37]=x,e[38]=j):j=e[38],j}function xt(s){return s.value}function bt(s){return s.value}function Ct(s){return s.stopPropagation()}function jt(s){return s.value}function Nt(s){return s.stopPropagation()}function vt(s){const e=de.c(56),{open:n,onOpenChange:o,selectedMemberIds:a,onAddMembers:i}=s,[h,l]=G.useState(""),p=G.useDeferredValue(h);let E;e[0]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[0]=E):E=e[0];const[f,w]=G.useState(E),{data:d}=ls();let S,u,C,x,j,g,c,N,I,P,T;if(e[1]!==d?.data?.members||e[2]!==p||e[3]!==i||e[4]!==o||e[5]!==n||e[6]!==f||e[7]!==h||e[8]!==a){const M=d?.data?.members??[];let V;e[20]!==p?(V=D=>{const r=p.toLowerCase();return D.user?.name?.toLowerCase().includes(r)||D.user?.email?.toLowerCase().includes(r)},e[20]=p,e[21]=V):V=e[21];const se=M.filter(V),F=Et;let K;e[22]!==a?(K=D=>a.includes(D),e[22]=a,e[23]=K):K=e[23];const Q=K;let Y;e[24]!==f?(Y=D=>{f.includes(D)?w(f.filter(r=>r!==D)):w([...f,D])},e[24]=f,e[25]=Y):Y=e[25];const ne=Y;let te;e[26]!==i||e[27]!==o||e[28]!==f?(te=()=>{i(f),w([]),o(!1)},e[26]=i,e[27]=o,e[28]=f,e[29]=te):te=e[29],C=te,u=Ee,P=n,T=o,S=ye,N="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsxs(Se,{className:"px-6 pt-6",children:[t.jsx(Ie,{children:"Add Members to Role"}),t.jsx(Te,{children:"Select members to add to this role."})]}),e[30]=I):I=e[30],g="flex flex-col h-80",e[31]!==h?(c=t.jsx(Ze,{value:h,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=h,e[32]=c):c=e[32],x="flex-1 overflow-auto",j=se.length===0?t.jsx("div",{className:"flex items-center justify-center h-full px-6",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:h?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:se.map(D=>{const r=F(D),b=Q(D.id),$=f.includes(D.id);return t.jsxs("label",{className:re("flex items-center gap-3 p-2 rounded-lg",!r||b?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(Fs,{checked:$||b,onCheckedChange:()=>{r&&!b&&ne(D.id)},disabled:!r||b}),t.jsx(Ce,{url:D.user?.image??void 0,fallback:Ls(D.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:D.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.user?.email})]}),!r&&t.jsx(ve,{variant:"secondary",className:"shrink-0",children:"Owner"}),b&&r&&t.jsx(ve,{variant:"outline",className:"shrink-0",children:"Added"})]},D.id)})}),e[1]=d?.data?.members,e[2]=p,e[3]=i,e[4]=o,e[5]=n,e[6]=f,e[7]=h,e[8]=a,e[9]=S,e[10]=u,e[11]=C,e[12]=x,e[13]=j,e[14]=g,e[15]=c,e[16]=N,e[17]=I,e[18]=P,e[19]=T}else S=e[9],u=e[10],C=e[11],x=e[12],j=e[13],g=e[14],c=e[15],N=e[16],I=e[17],P=e[18],T=e[19];let A;e[33]!==x||e[34]!==j?(A=t.jsx("div",{className:x,children:j}),e[33]=x,e[34]=j,e[35]=A):A=e[35];let O;e[36]!==A||e[37]!==g||e[38]!==c?(O=t.jsxs("div",{className:g,children:[c,A]}),e[36]=A,e[37]=g,e[38]=c,e[39]=O):O=e[39];let L;e[40]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(Oe,{children:"Cancel"}),e[40]=L):L=e[40];const y=f.length===0,_=f.length>0&&`(${f.length})`;let z;e[41]!==C||e[42]!==y||e[43]!==_?(z=t.jsxs(we,{className:"px-6 pb-6",children:[L,t.jsxs(Ae,{onClick:C,disabled:y,children:["Add ",_]})]}),e[41]=C,e[42]=y,e[43]=_,e[44]=z):z=e[44];let v;e[45]!==S||e[46]!==O||e[47]!==z||e[48]!==N||e[49]!==I?(v=t.jsxs(S,{className:N,children:[I,O,z]}),e[45]=S,e[46]=O,e[47]=z,e[48]=N,e[49]=I,e[50]=v):v=e[50];let m;return e[51]!==u||e[52]!==v||e[53]!==P||e[54]!==T?(m=t.jsx(u,{open:P,onOpenChange:T,children:v}),e[51]=u,e[52]=v,e[53]=P,e[54]=T,e[55]=m):m=e[55],m}function Et(s){return s.role!=="owner"}function yt(s){const e=de.c(40),{memberIds:n,onMemberIdsChange:o,readOnly:a}=s,i=a===void 0?!1:a,[h,l]=G.useState(""),p=G.useDeferredValue(h),[E,f]=G.useState(!1),{data:w}=ls();let d,S,u,C,x;if(e[0]!==w?.data?.members||e[1]!==p||e[2]!==n||e[3]!==o||e[4]!==i||e[5]!==h){const N=w?.data?.members??[];let I;e[11]!==n?(I=v=>n.includes(v.id),e[11]=n,e[12]=I):I=e[12];const P=N.filter(I);let T;e[13]!==p?(T=v=>{const m=p.toLowerCase();return v.user?.name?.toLowerCase().includes(m)||v.user?.email?.toLowerCase().includes(m)},e[13]=p,e[14]=T):T=e[14];const A=P.filter(T);let O;e[15]!==n||e[16]!==o?(O=v=>{o(n.filter(m=>m!==v))},e[15]=n,e[16]=o,e[17]=O):O=e[17];const L=O;let y;e[18]!==n||e[19]!==o?(y=v=>{o([...n,...v])},e[18]=n,e[19]=o,e[20]=y):y=e[20],d=y,C="flex flex-col h-full";let _;e[21]!==h?(_=t.jsx(Ze,{value:h,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=h,e[22]=_):_=e[22];let z;e[23]!==i?(z=i?t.jsx("div",{className:"pr-4",children:t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(ss,{size:16}),"Add Member"]})})}),t.jsx(Le,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):t.jsx("div",{className:"pr-4",children:t.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[t.jsx(ss,{size:16}),"Add Member"]})}),e[23]=i,e[24]=z):z=e[24],e[25]!==_||e[26]!==z?(x=t.jsxs("div",{className:"flex items-center border-b border-border",children:[_,z]}),e[25]=_,e[26]=z,e[27]=x):x=e[27],S="flex-1 overflow-auto",u=P.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):A.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',h,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:A.map(v=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(Ce,{url:v.user?.image??void 0,fallback:Ls(v.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:v.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.user?.email})]}),i?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Pe,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(hs,{size:16})})})}),t.jsx(Le,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>L(v.id),children:t.jsx(hs,{size:16})})]},v.id))}),e[0]=w?.data?.members,e[1]=p,e[2]=n,e[3]=o,e[4]=i,e[5]=h,e[6]=d,e[7]=S,e[8]=u,e[9]=C,e[10]=x}else d=e[6],S=e[7],u=e[8],C=e[9],x=e[10];let j;e[28]!==S||e[29]!==u?(j=t.jsx("div",{className:S,children:u}),e[28]=S,e[29]=u,e[30]=j):j=e[30];let g;e[31]!==E||e[32]!==d||e[33]!==n?(g=t.jsx(vt,{open:E,onOpenChange:f,selectedMemberIds:n,onAddMembers:d}),e[31]=E,e[32]=d,e[33]=n,e[34]=g):g=e[34];let c;return e[35]!==C||e[36]!==x||e[37]!==j||e[38]!==g?(c=t.jsxs("div",{className:C,children:[x,j,g]}),e[35]=C,e[36]=x,e[37]=j,e[38]=g,e[39]=c):c=e[39],c}function St(s){const e=de.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Os,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let o;return e[1]!==s?(o=t.jsx(G.Suspense,{fallback:n,children:t.jsx(yt,{...s})}),e[1]=s,e[2]=o):o=e[2],o}const It={owner:[],admin:[],user:[]};function $e(s,e){const n=s==="owner"||s==="admin",o=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:It[s],toolSet:{},memberIds:o.map(a=>a.id)}}function Tt({trigger:s,onSuccess:e}){const[n,o]=G.useState(!1),[a,i]=G.useState("mcp"),{locator:h}=je(),l=qe(),p=Vs()??[],{customRoles:E,refetch:f}=us(),{data:w}=Ss({queryKey:le.members(h),queryFn:()=>J.organization.listMembers()}),d=ys({resolver:ks(ft),defaultValues:Ve()}),S=d.formState.isValid,u=d.formState.isDirty,[C,x]=G.useState(null),[j,g]=G.useState(null),c=!d.watch("role.id")&&!d.watch("role.slug")&&!j,[N,I]=G.useState(null),[P,T]=G.useState(!1),[A,O]=G.useState(null),L=r=>{const b=r.permission||{},$=b.self||[],oe=$.includes("*"),ie=oe?[]:$.filter(k=>k!=="*"),W={};for(const[k,B]of Object.entries(b))if(k!=="self")if(k==="*")for(const Z of p)B.includes("*")?W[Z.id]=Z.tools?.map(ae=>ae.name)??[]:W[Z.id]=B;else{const Z=p.find(ae=>ae.id===k);Z&&(B.includes("*")?W[k]=Z.tools?.map(ae=>ae.name)??[]:W[k]=B)}const me=(w?.data?.members??[]).filter(k=>k.role===r.role).map(k=>k.id);return{role:{id:r.id,slug:r.role,label:r.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:W,memberIds:me}},y=r=>{const b=L(r);d.reset(b),x(r.id??null),g(null)},_=()=>{d.reset(Ve()),x(null),g(null),i("mcp")},z=r=>{u&&S?(O(()=>()=>y(r)),T(!0)):y(r)},v=async()=>{u&&S&&await Y(),_()},m=r=>{if(u&&S)O(()=>()=>{const b=$e(r,w?.data?.members??[]);d.reset(b),g(r),x(null),i("org")}),T(!0);else{const b=$e(r,w?.data?.members??[]);d.reset(b),g(r),x(null),i("org")}},M=r=>{if(!r&&d.formState.isDirty&&S){O(()=>()=>{o(!1),d.reset(Ve()),g(null)}),T(!0);return}if(o(r),!r)d.reset(Ve()),g(null),x(null);else{const b=E[0];if(b)y(b);else{const $=$e("user",w?.data?.members??[]);d.reset($),g("user"),x(null),i("org")}}},V=()=>{T(!1),A&&(A(),O(null))},se=r=>{const b={};r.allowAllStaticPermissions?b.self=["*"]:r.staticPermissions.length>0&&(b.self=r.staticPermissions);for(const[$,oe]of Object.entries(r.toolSet))if(oe.length>0){const W=p.find(q=>q.id===$)?.tools?.map(q=>q.name)??[];W.length>0&&W.every(q=>oe.includes(q))?b[$]=["*"]:b[$]=oe}return b},F=fe({mutationFn:async r=>{const b=se(r),$=r.role.slug||r.role.label.toLowerCase().replace(/\s+/g,"-");if(r.role.slug&&!r.role.id){const W=(w?.data?.members??[]).filter(k=>k.role===r.role.slug).map(k=>k.id),q=r.memberIds.filter(k=>!W.includes(k)),me=W.filter(k=>!r.memberIds.includes(k));for(const k of q){const B=await J.organization.updateMemberRole({memberId:k,role:[r.role.slug]});if(B?.error)throw new Error(B.error.message)}for(const k of me){const B=await J.organization.updateMemberRole({memberId:k,role:["user"]});if(B?.error)throw new Error(B.error.message)}return r}else if(r.role.id){const ie=await J.organization.updateRole({roleId:r.role.id,data:{permission:b}});if(ie?.error)throw new Error(ie.error.message);const q=(w?.data?.members??[]).filter(B=>B.role===r.role.slug).map(B=>B.id),me=r.memberIds.filter(B=>!q.includes(B)),k=q.filter(B=>!r.memberIds.includes(B));for(const B of me){const Z=await J.organization.updateMemberRole({memberId:B,role:[r.role.slug]});if(Z?.error)throw new Error(Z.error.message)}for(const B of k){const Z=await J.organization.updateMemberRole({memberId:B,role:["user"]});if(Z?.error)throw new Error(Z.error.message)}return r}else{const ie=await J.organization.createRole({role:$,permission:b});if(ie?.error)throw new Error(ie.error.message);for(const W of r.memberIds){const q=await J.organization.updateMemberRole({memberId:W,role:[$]});if(q?.error)throw new Error(q.error.message)}return{...r,role:{...r.role,id:ie.data?.roleData?.id,slug:$}}}},onSuccess:(r,b)=>{l.invalidateQueries({queryKey:le.members(h)}),l.invalidateQueries({queryKey:le.organizationRoles(h)});const $=!b.role.id&&!b.role.slug,oe=b.role.slug&&!b.role.id;X.success(oe?"Members updated successfully!":$?"Role created successfully!":"Role updated successfully!"),f(),d.reset(r),r.role.id&&x(r.role.id),e?.()},onError:r=>{X.error(r instanceof Error?r.message:"Failed to save role")}}),K=fe({mutationFn:async r=>{const b=await J.organization.deleteRole({roleId:r});if(b?.error)throw new Error(b.error.message);return b?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(h)}),l.invalidateQueries({queryKey:le.organizationRoles(h)}),X.success("Role deleted successfully!"),f(),N?.id===C){const r=E.filter(b=>b.id!==N?.id);if(r[0])y(r[0]);else{const b=$e("user",w?.data?.members??[]);d.reset(b),g("user"),x(null),i("org")}}},onError:r=>{X.error(r instanceof Error?r.message:"Failed to delete role")}}),Q=F.isPending||K.isPending,Y=async()=>{const r=d.getValues();if(!r.role.label.trim()){X.error("Role name is required"),d.setFocus("role.label");return}await F.mutateAsync(r)},ne=d.handleSubmit(r=>{if(!r.role.label.trim()){X.error("Role name is required"),d.setFocus("role.label");return}F.mutate(r)}),te=r=>{r.id&&I({id:r.id,label:r.label})},D=()=>{N?.id&&K.mutate(N.id),I(null)};return t.jsxs(Is,{open:n,onOpenChange:M,children:[t.jsx(Ts,{asChild:!0,children:s}),t.jsx(ws,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[t.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:[t.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:t.jsxs("div",{className:"flex flex-col gap-1",children:[ht.map(r=>{const b=j===r.role;return t.jsxs("div",{className:re("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>m(r.role),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",r.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsx(Js,{size:14,className:"text-muted-foreground shrink-0"})]},r.role)}),E.map(r=>{const b=C===r.id;return t.jsxs("div",{className:re("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",b?"bg-accent":"hover:bg-muted/50"),onClick:()=>z(r),children:[t.jsx("div",{className:re("shrink-0 size-3 rounded-full",gt(r.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:r.label}),t.jsxs(as,{children:[t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:re("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",b&&"opacity-100 pointer-events-auto"),onClick:$=>$.stopPropagation(),children:t.jsx(Xs,{size:14})})}),t.jsx(ds,{align:"end",children:t.jsxs(Ke,{className:"text-destructive",onClick:$=>{$.stopPropagation(),te(r)},children:[t.jsx(As,{size:16}),"Delete"]})})]})]},r.id)}),c&&t.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[t.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),t.jsx(et,{...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}),t.jsx(ve,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),t.jsx("div",{className:"px-3.5 pb-3.5",children:t.jsxs(ee,{variant:"outline",size:"default",onClick:v,disabled:Q||u,className:"w-full h-10",children:[t.jsx(ss,{size:16}),"Create new role"]})})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!j&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("mcp"),className:re("h-8 rounded-lg px-2 py-1",a==="mcp"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"MCP Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("org"),className:re("h-8 rounded-lg px-2 py-1",a==="org"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Organization Permissions"}),t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>i("members"),className:re("h-8 rounded-lg px-2 py-1",a==="members"?"bg-muted border-input text-foreground":"border-input text-muted-foreground bg-transparent"),children:"Members"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[a==="mcp"&&!j&&t.jsx(Gs,{toolSet:d.watch("toolSet"),onToolSetChange:r=>d.setValue("toolSet",r,{shouldDirty:!0})}),a==="org"&&t.jsx(pt,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:r=>d.setValue("allowAllStaticPermissions",r,{shouldDirty:!0}),onPermissionsChange:r=>d.setValue("staticPermissions",r,{shouldDirty:!0}),readOnly:!!j}),a==="members"&&t.jsx(St,{memberIds:d.watch("memberIds"),onMemberIdsChange:r=>d.setValue("memberIds",r,{shouldDirty:!0}),readOnly:j==="owner"})]}),(!j||j!=="owner")&&t.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[t.jsx(ee,{variant:"outline",onClick:()=>M(!1),disabled:Q,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:ne,disabled:Q||!S||!d.formState.isDirty,className:"h-10",children:F.isPending?"Saving...":c?"Create Role":"Save Changes"})]})]})]})}),t.jsx(Ee,{open:N!==null,onOpenChange:r=>!r&&I(null),children:t.jsxs(ye,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Delete Role"}),t.jsxs(Te,{children:['Are you sure you want to delete the "',N?.label,'" role? This action cannot be undone.']})]}),t.jsxs(we,{children:[t.jsx(Oe,{children:"Cancel"}),t.jsx(Ae,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Ee,{open:P,onOpenChange:T,children:t.jsxs(ye,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Discard Changes"}),t.jsx(Te,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(we,{children:[t.jsx(Oe,{onClick:()=>O(null),children:"Keep Editing"}),t.jsx(Ae,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const wt=ue().email("Invalid email address");function Ot(s){if(!s.trim())return[];const e=s.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function At({trigger:s}){const[e,n]=G.useState(!1),{locator:o}=je(),a=qe(),{data:i}=J.useSession(),h=i?.user?.email,{roles:l,isLoading:p}=us(),E=l.filter(g=>g.role!=="owner"),f=ys({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),w=f.watch("emailsText"),d=f.watch("role"),u=Ot(w).filter(g=>{const c=wt.safeParse(g).success,N=!h||g!==h.toLowerCase();return c&&N}),C=fe({mutationFn:async({emails:g,role:c})=>{if(!c)throw new Error("Please select a role");const N=await Promise.allSettled(g.map(async P=>{const T=await J.organization.inviteMember({email:P,role:c});if(T.error)throw new Error(T.error.message);return T.data})),I=N.filter(P=>P.status==="rejected");if(I.length>0)throw new Error(`Failed to invite ${I.length} member${I.length>1?"s":""}`);return N},onSuccess:(g,{emails:c})=>{a.invalidateQueries({queryKey:le.members(o)}),a.invalidateQueries({queryKey:le.invitations(o)}),X.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),f.reset({emailsText:"",role:"user"}),n(!1)},onError:g=>{X.error(g instanceof Error?g.message:"Failed to invite members")}}),x=g=>{if(u.length===0){X.error("Please enter at least one valid email address");return}if(!g.role){X.error("Please select a role");return}C.mutate({emails:u,role:g.role})},j=u.length>0&&!!d;return t.jsxs(Is,{open:e,onOpenChange:n,children:[t.jsx(Ts,{asChild:!0,children:s}),t.jsxs(ws,{className:"sm:max-w-lg",children:[t.jsx(Ks,{children:t.jsx(Qs,{children:"Invite members"})}),t.jsx(tt,{...f,children:t.jsxs("form",{onSubmit:f.handleSubmit(x),className:"space-y-4",children:[t.jsx(gs,{control:f.control,name:"emailsText",render:({field:g})=>t.jsxs(ps,{children:[t.jsx(nt,{children:"Email addresses"}),t.jsx(xs,{children:t.jsx(rt,{...g,disabled:C.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"})}),t.jsx(bs,{})]})}),t.jsx(gs,{control:f.control,name:"role",render:({field:g})=>t.jsxs(ps,{children:[t.jsx(xs,{children:t.jsxs(ts,{value:g.value,onValueChange:g.onChange,disabled:C.isPending||p,children:[t.jsx(ns,{className:"w-full",children:t.jsx(rs,{placeholder:"Select a role"})}),t.jsx(is,{children:E.map(c=>{const N=[];return c.isBuiltin||(c.allowsAllStaticPermissions?N.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&N.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?N.push("All connections"):c.connectionCount&&c.connectionCount>0&&N.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?N.push("all tools"):c.toolCount&&c.toolCount>0&&N.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),t.jsx(os,{value:c.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:c.label}),!c.isBuiltin&&N.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:N.join(", ")})]})},c.role)})})]})}),t.jsx(bs,{})]})}),t.jsxs(qs,{children:[t.jsx(ee,{variant:"outline",onClick:()=>{f.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:C.isPending,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:C.isPending||!j,children:C.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function Rt(){const s=de.c(6),{locator:e}=je();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n=it(),s[0]=n):n=s[0];const o=n;let a;s[1]!==e?(a=le.invitations(e),s[1]=e,s[2]=a):a=s[2];let i;s[3]===Symbol.for("react.memo_cache_sentinel")?(i=async()=>(await o("ORGANIZATION_GET",{}))?.invitations??[],s[3]=i):i=s[3];let h;return s[4]!==a?(h={queryKey:a,queryFn:i},s[4]=a,s[5]=h):h=s[5],Ds(h)}function _t(){const s=de.c(5),{locator:e}=je(),n=qe();let o;s[0]!==e||s[1]!==n?(o={mutationFn:Lt,onSuccess:()=>{n.invalidateQueries({queryKey:le.invitations(e)}),X.success("Invitation cancelled")},onError:Pt},s[0]=e,s[1]=n,s[2]=o):o=s[2];const a=fe(o);let i;return s[3]!==a?(i={cancel:a},s[3]=a,s[4]=i):i=s[4],i}function Pt(s){X.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Lt(s){const e=await J.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const Ns=["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"],Mt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Qe(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function zt(s){const e=new Map;for(const[n,o]of Object.entries(Mt))e.set(n,o);for(let n=0;n<s.length;n++){const o=s[n];o&&!e.has(o.role)&&e.set(o.role,Ns[n%Ns.length]??"bg-neutral-400")}return e}function kt(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Fe(s){const e=de.c(79),{role:n,memberId:o,isOwner:a,roleColorMap:i,selectableRoles:h,onRoleChange:l,size:p,className:E}=s,f=p===void 0?"xs":p;let w,d,S,u,C,x,j,g,c,N,I;if(e[0]!==E||e[1]!==a||e[2]!==o||e[3]!==l||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f){I=Symbol.for("react.early_return_sentinel");e:{const v=i.get(n)??"bg-neutral-400";if(a){let m;e[19]!==o||e[20]!==l?(m=D=>l(o,D),e[19]=o,e[20]=l,e[21]=m):m=e[21];let M;e[22]!==n?(M=t.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const V=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:re("size-2 rounded-full shrink-0",v)}),M]});let se;e[24]!==V?(se=t.jsx(rs,{children:V}),e[24]=V,e[25]=se):se=e[25];let F;e[26]!==E||e[27]!==f||e[28]!==se?(F=t.jsx(ns,{size:f,className:E,children:se}),e[26]=E,e[27]=f,e[28]=se,e[29]=F):F=e[29];let K;if(e[30]!==i||e[31]!==h){let D;e[33]!==i?(D=r=>{const b=i.get(r.role)??"bg-neutral-400";return t.jsx(os,{value:r.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:re("size-3 rounded-full",b)}),t.jsx("span",{className:"capitalize",children:r.label})]})},r.role)},e[33]=i,e[34]=D):D=e[34],K=h.map(D),e[30]=i,e[31]=h,e[32]=K}else K=e[32];let Q;e[35]!==K?(Q=t.jsx(is,{children:K}),e[35]=K,e[36]=Q):Q=e[36];let Y;e[37]!==a||e[38]!==n||e[39]!==m||e[40]!==F||e[41]!==Q?(Y=t.jsx(Pe,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(ts,{value:n,onValueChange:m,disabled:a,children:[F,Q]})})}),e[37]=a,e[38]=n,e[39]=m,e[40]=F,e[41]=Q,e[42]=Y):Y=e[42];let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Le,{children:t.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=ne):ne=e[43];let te;e[44]!==Y?(te=t.jsx(Re,{children:t.jsxs(_e,{children:[Y,ne]})}),e[44]=Y,e[45]=te):te=e[45],I=te;break e}S=ts,g=n,e[46]!==o||e[47]!==l?(c=m=>l(o,m),e[46]=o,e[47]=l,e[48]=c):c=e[48],N=a,d=ns,x=f,j=E,w=rs,C="flex items-center gap-2 min-w-0",u=re("size-2 rounded-full shrink-0",v)}e[0]=E,e[1]=a,e[2]=o,e[3]=l,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=w,e[9]=d,e[10]=S,e[11]=u,e[12]=C,e[13]=x,e[14]=j,e[15]=g,e[16]=c,e[17]=N,e[18]=I}else w=e[8],d=e[9],S=e[10],u=e[11],C=e[12],x=e[13],j=e[14],g=e[15],c=e[16],N=e[17],I=e[18];if(I!==Symbol.for("react.early_return_sentinel"))return I;let P;e[49]!==u?(P=t.jsx("div",{className:u}),e[49]=u,e[50]=P):P=e[50];let T;e[51]!==n?(T=t.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=T):T=e[52];let A;e[53]!==P||e[54]!==T||e[55]!==C?(A=t.jsxs("div",{className:C,children:[P,T]}),e[53]=P,e[54]=T,e[55]=C,e[56]=A):A=e[56];let O;e[57]!==w||e[58]!==A?(O=t.jsx(w,{children:A}),e[57]=w,e[58]=A,e[59]=O):O=e[59];let L;e[60]!==d||e[61]!==O||e[62]!==x||e[63]!==j?(L=t.jsx(d,{size:x,className:j,children:O}),e[60]=d,e[61]=O,e[62]=x,e[63]=j,e[64]=L):L=e[64];let y;if(e[65]!==i||e[66]!==h){let v;e[68]!==i?(v=m=>{const M=i.get(m.role)??"bg-neutral-400";return t.jsx(os,{value:m.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:re("size-3 rounded-full",M)}),t.jsx("span",{className:"capitalize",children:m.label})]})},m.role)},e[68]=i,e[69]=v):v=e[69],y=h.map(v),e[65]=i,e[66]=h,e[67]=y}else y=e[67];let _;e[70]!==y?(_=t.jsx(is,{children:y}),e[70]=y,e[71]=_):_=e[71];let z;return e[72]!==S||e[73]!==L||e[74]!==_||e[75]!==g||e[76]!==c||e[77]!==N?(z=t.jsxs(S,{value:g,onValueChange:c,disabled:N,children:[L,_]}),e[72]=S,e[73]=L,e[74]=_,e[75]=g,e[76]=c,e[77]=N,e[78]=z):z=e[78],z}function vs(s){const e=de.c(51),{member:n,roles:o,onChangeRole:a,onRemove:i,isUpdating:h}=s,l=h===void 0?!1:h,p=n.role==="owner";let E,f,w,d,S,u,C,x,j;if(e[0]!==p||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==o){let L;e[15]!==n.role?(L=m=>m.role!==n.role&&m.role!=="owner",e[15]=n.role,e[16]=L):L=e[16];const y=o.filter(L);d=as;let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(Rs,{size:20}),e[17]=_):_=e[17],e[18]!==p?(j=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:p,onClick:Bt,children:_})}),e[18]=p,e[19]=j):j=e[19],w=ds,C="end",x=Dt,f=Zs;let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(_s,{size:16}),e[20]=z):z=e[20],e[21]!==l?(u=t.jsxs(Ys,{disabled:l,children:[z,"Change Role"]}),e[21]=l,e[22]=u):u=e[22],E=Ws;let v;e[23]!==l||e[24]!==n.id||e[25]!==a?(v=m=>{const M=[];return m.isBuiltin||(m.allowsAllStaticPermissions?M.push("Full org access"):m.staticPermissionCount&&m.staticPermissionCount>0&&M.push(`${m.staticPermissionCount} org perm${m.staticPermissionCount!==1?"s":""}`),m.allowsAllConnections?M.push("All connections"):m.connectionCount&&m.connectionCount>0&&M.push(`${m.connectionCount} connection${m.connectionCount!==1?"s":""}`),(m.connectionCount!==0||m.allowsAllConnections)&&(m.allowsAllTools?M.push("all tools"):m.toolCount&&m.toolCount>0&&M.push(`${m.toolCount} tool${m.toolCount!==1?"s":""}`))),t.jsxs(Ke,{onClick:V=>{V.stopPropagation(),a(n.id,m.role)},disabled:l,children:[m.isBuiltin?t.jsx(ms,{size:16}):t.jsx(ot,{size:16}),t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{children:m.label}),!m.isBuiltin&&M.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},m.role)},e[23]=l,e[24]=n.id,e[25]=a,e[26]=v):v=e[26],S=y.map(v),e[0]=p,e[1]=l,e[2]=n.id,e[3]=n.role,e[4]=a,e[5]=o,e[6]=E,e[7]=f,e[8]=w,e[9]=d,e[10]=S,e[11]=u,e[12]=C,e[13]=x,e[14]=j}else E=e[6],f=e[7],w=e[8],d=e[9],S=e[10],u=e[11],C=e[12],x=e[13],j=e[14];let g;e[27]!==E||e[28]!==S?(g=t.jsx(E,{children:S}),e[27]=E,e[28]=S,e[29]=g):g=e[29];let c;e[30]!==f||e[31]!==u||e[32]!==g?(c=t.jsxs(f,{children:[u,g]}),e[30]=f,e[31]=u,e[32]=g,e[33]=c):c=e[33];let N;e[34]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Hs,{}),e[34]=N):N=e[34];let I;e[35]!==n.id||e[36]!==i?(I=L=>{L.stopPropagation(),i(n.id)},e[35]=n.id,e[36]=i,e[37]=I):I=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(As,{size:16}),e[38]=P):P=e[38];let T;e[39]!==I?(T=t.jsxs(Ke,{variant:"destructive",onClick:I,children:[P,"Remove Member"]}),e[39]=I,e[40]=T):T=e[40];let A;e[41]!==w||e[42]!==T||e[43]!==C||e[44]!==x||e[45]!==c?(A=t.jsxs(w,{align:C,onClick:x,children:[c,N,T]}),e[41]=w,e[42]=T,e[43]=C,e[44]=x,e[45]=c,e[46]=A):A=e[46];let O;return e[47]!==d||e[48]!==A||e[49]!==j?(O=t.jsxs(d,{children:[j,A]}),e[47]=d,e[48]=A,e[49]=j,e[50]=O):O=e[50],O}function Dt(s){return s.stopPropagation()}function Bt(s){return s.stopPropagation()}function Es(s){const e=de.c(8),{invitationId:n,onCancel:o,isCancelling:a}=s,i=a===void 0?!1:a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(cs,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Gt,children:t.jsx(Rs,{size:20})})}),e[0]=h):h=e[0];let l;e[1]!==n||e[2]!==o?(l=f=>{f.stopPropagation(),o(n)},e[1]=n,e[2]=o,e[3]=l):l=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(lt,{size:16}),e[4]=p):p=e[4];let E;return e[5]!==i||e[6]!==l?(E=t.jsxs(as,{children:[h,t.jsx(ds,{align:"end",onClick:Ut,children:t.jsxs(Ke,{variant:"destructive",onClick:l,disabled:i,children:[p,"Cancel Invitation"]})})]}),e[5]=i,e[6]=l,e[7]=E):E=e[7],E}function Ut(s){return s.stopPropagation()}function Gt(s){return s.stopPropagation()}function Vt(){const s=de.c(74),{data:e}=ls(),{data:n}=Rt(),o=_t(),a=qe(),{locator:i}=je(),[h,l]=G.useState(null),[p,E]=G.useState(null),[f,w]=G.useState(""),[d,S]=G.useState("table"),[u,C]=G.useState("member"),[x,j]=G.useState("asc"),g=e?.data?.members;let c;s[0]!==u?(c=R=>{u===R?j(sn):(C(R),j("asc"))},s[0]=u,s[1]=c):c=s[1];const N=c;let I=g??[],P=n??[];if(f){const R=f.toLowerCase();I=I.filter(U=>U.user?.name?.toLowerCase().includes(R)||U.user?.email?.toLowerCase().includes(R)||U.role?.toLowerCase().includes(R)),P=P.filter(U=>U.email?.toLowerCase().includes(R)||U.role?.toLowerCase().includes(R))}if(u&&x){let R;s[2]!==x||s[3]!==u?(R=(U,H)=>{let ce,Ne;e:switch(u){case"member":{ce=U.user?.name||"",Ne=H.user?.name||"";break e}case"role":{ce=U.role||"",Ne=H.role||"";break e}case"joined":{ce=U.createdAt?typeof U.createdAt=="string"?U.createdAt:U.createdAt.toISOString():"",Ne=H.createdAt?typeof H.createdAt=="string"?H.createdAt:H.createdAt.toISOString():"";break e}default:return 0}return x==="asc"?ce.localeCompare(Ne):Ne.localeCompare(ce)},s[2]=x,s[3]=u,s[4]=R):R=s[4],I=[...I].sort(R)}const T=I;let A;s[5]!==i||s[6]!==a?(A={mutationFn:en,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(i)}),X.success("Member has been removed from the organization"),l(null)},onError:Jt},s[5]=i,s[6]=a,s[7]=A):A=s[7];const O=fe(A);let L;s[8]!==i||s[9]!==a?(L={mutationFn:Xt,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(i)}),X.success("Member's role has been updated")},onError:Ht},s[8]=i,s[9]=a,s[10]=L):L=s[10];const y=fe(L);let _;s[11]!==i||s[12]!==a?(_={mutationFn:Wt,onSuccess:()=>{a.invalidateQueries({queryKey:le.invitations(i)}),X.success("Invitation role has been updated")},onError:Yt},s[11]=i,s[12]=a,s[13]=_):_=s[13];const z=fe(_),{roles:v,customRoles:m}=us();let M;s[14]!==m?(M=zt(m),s[14]=m,s[15]=M):M=s[15];const V=M;let se;s[16]!==v?(se=v.filter(Zt),s[16]=v,s[17]=se):se=s[17];const F=se;let K;s[18]===Symbol.for("react.memo_cache_sentinel")?(K={id:"member",header:"Member",render:qt,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=K):K=s[18];let Q;s[19]!==V||s[20]!==F||s[21]!==z||s[22]!==y?(Q={id:"role",header:"Role",render:R=>R.type==="member"?t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:R.data.role==="owner",roleColorMap:V,selectableRoles:F,onRoleChange:(U,H)=>y.mutate({memberId:U,role:H}),className:"w-36"}):t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:!1,roleColorMap:V,selectableRoles:F,onRoleChange:(U,H)=>z.mutate({invitationId:U,role:H,email:R.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},s[19]=V,s[20]=F,s[21]=z,s[22]=y,s[23]=Q):Q=s[23];let Y;s[24]===Symbol.for("react.memo_cache_sentinel")?(Y={id:"joined",header:"Joined",render:Qt,cellClassName:"w-48 shrink-0",sortable:!0},s[24]=Y):Y=s[24];let ne;s[25]!==o.cancel.isPending||s[26]!==v||s[27]!==y?(ne={id:"actions",header:"",render:R=>R.type==="member"?t.jsx(vs,{member:R.data,roles:v,onChangeRole:(U,H)=>y.mutate({memberId:U,role:H}),onRemove:l,isUpdating:y.isPending}):t.jsx(Es,{invitationId:R.data.id,onCancel:E,isCancelling:o.cancel.isPending}),cellClassName:"w-12 shrink-0"},s[25]=o.cancel.isPending,s[26]=v,s[27]=y,s[28]=ne):ne=s[28];let te;s[29]!==Q||s[30]!==ne?(te=[K,Q,Y,ne],s[29]=Q,s[30]=ne,s[31]=te):te=s[31];const D=te;let r;s[32]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Tt,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(ms,{size:16}),"Manage Roles"]})}),s[32]=r):r=s[32];let b;s[33]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[r,t.jsx(At,{trigger:t.jsx(ee,{size:"sm",children:"Invite Member"})})]}),s[33]=b):b=s[33];const $=b,oe=[...T.map(Kt),...P.filter(Ft).map($t)],ie=es,W=!!p;let q;s[34]===Symbol.for("react.memo_cache_sentinel")?(q=()=>E(null),s[34]=q):q=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Se,{children:[t.jsx(Ie,{children:"Cancel Invitation"}),t.jsx(Te,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),s[35]=me):me=s[35];let k;s[36]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Oe,{children:"Keep Invitation"}),s[36]=k):k=s[36];let B;s[37]!==o.cancel||s[38]!==p?(B=()=>{p&&(o.cancel.mutate(p),E(null))},s[37]=o.cancel,s[38]=p,s[39]=B):B=s[39];let Z;s[40]!==o.cancel.isPending||s[41]!==B?(Z=t.jsxs(ye,{children:[me,t.jsxs(we,{children:[k,t.jsx(Ae,{onClick:B,disabled:o.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=o.cancel.isPending,s[41]=B,s[42]=Z):Z=s[42];let ae;s[43]!==W||s[44]!==Z?(ae=t.jsx(Ee,{open:W,onOpenChange:q,children:Z}),s[43]=W,s[44]=Z,s[45]=ae):ae=s[45];const Ye=!!h;let Me;s[46]===Symbol.for("react.memo_cache_sentinel")?(Me=()=>l(null),s[46]=Me):Me=s[46];let ze;s[47]===Symbol.for("react.memo_cache_sentinel")?(ze=t.jsxs(Se,{children:[t.jsx(Ie,{children:"Remove Member"}),t.jsx(Te,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=ze):ze=s[47];let ke;s[48]===Symbol.for("react.memo_cache_sentinel")?(ke=t.jsx(Oe,{children:"Cancel"}),s[48]=ke):ke=s[48];let he;s[49]!==h||s[50]!==O?(he=()=>h&&O.mutate(h),s[49]=h,s[50]=O,s[51]=he):he=s[51];let ge;s[52]!==O.isPending||s[53]!==he?(ge=t.jsxs(ye,{children:[ze,t.jsxs(we,{children:[ke,t.jsx(Ae,{onClick:he,disabled:O.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=O.isPending,s[53]=he,s[54]=ge):ge=s[54];let pe;s[55]!==Ye||s[56]!==ge?(pe=t.jsx(Ee,{open:Ye,onOpenChange:Me,children:ge}),s[55]=Ye,s[56]=ge,s[57]=pe):pe=s[57];let De;s[58]===Symbol.for("react.memo_cache_sentinel")?(De=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[58]=De):De=s[58];let xe;s[59]!==N||s[60]!==x||s[61]!==u||s[62]!==d?(xe=t.jsx(Bs,{title:"Members",viewMode:d,onViewModeChange:S,sortKey:u,sortDirection:x,onSort:N,sortOptions:De,ctaButton:$}),s[59]=N,s[60]=x,s[61]=u,s[62]=d,s[63]=xe):xe=s[63];let Be;s[64]===Symbol.for("react.memo_cache_sentinel")?(Be=R=>{R.key==="Escape"&&(w(""),R.target.blur())},s[64]=Be):Be=s[64];let be;s[65]!==f?(be=t.jsx(Ze,{value:f,onChange:w,placeholder:"Search members...",onKeyDown:Be}),s[65]=f,s[66]=be):be=s[66];const We=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:oe.length===0?t.jsx(Xe,{title:"No members found",description:f?`No members match "${f}"`:"Invite members to get started."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:oe.map(R=>{if(R.type==="invitation")return t.jsxs(Cs,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(Es,{invitationId:R.data.id,onCancel:E,isCancelling:o.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{fallback:Qe(R.data.email),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:R.data.email}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(ve,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(Fe,{role:R.data.role,memberId:R.data.id,isOwner:!1,roleColorMap:V,selectableRoles:F,onRoleChange:(H,ce)=>z.mutate({invitationId:H,role:ce,email:R.data.email}),className:"w-fit"})]})]})]},`inv-${R.data.id}`);const U=R.data;return t.jsxs(Cs,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(vs,{member:U,roles:v,onChangeRole:(H,ce)=>y.mutate({memberId:H,role:ce}),onRemove:l,isUpdating:y.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{url:U.user?.image??void 0,fallback:Qe(U.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:U.user?.name||"Unknown"}),t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:U.user?.email}),t.jsx(Fe,{role:U.role,memberId:U.id,isOwner:U.role==="owner",roleColorMap:V,selectableRoles:F,onRoleChange:(H,ce)=>y.mutate({memberId:H,role:ce}),className:"w-fit"})]})]})]},U.id)})})}):t.jsx(Us,{columns:D,data:oe,isLoading:!1,sortKey:u,sortDirection:x,onSort:N,emptyState:f?t.jsx(Xe,{title:"No members found",description:`No members match "${f}"`}):t.jsx(Xe,{title:"No members found",description:"Invite members to get started."})});let Ue;return s[67]!==ie||s[68]!==ae||s[69]!==pe||s[70]!==xe||s[71]!==be||s[72]!==We?(Ue=t.jsxs(ie,{children:[ae,pe,xe,be,We]}),s[67]=ie,s[68]=ae,s[69]=pe,s[70]=xe,s[71]=be,s[72]=We,s[73]=Ue):Ue=s[73],Ue}function $t(s){return{type:"invitation",data:s}}function Ft(s){return s.status==="pending"}function Kt(s){return{type:"member",data:s}}function Qt(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?kt(s.data.createdAt):"N/A"}):t.jsx(ve,{variant:"outline",children:"Pending"})}function qt(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{url:s.data.user?.image??void 0,fallback:Qe(s.data.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.user?.name||"Unknown"}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.data.user?.email})]})]}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{fallback:Qe(s.data.email),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.email}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Zt(s){return s.role!=="owner"}function Yt(s){X.error(s instanceof Error?s.message:"Failed to update invitation role")}async function Wt(s){const{invitationId:e,role:n,email:o}=s,a=await J.organization.cancelInvitation({invitationId:e});if(a?.error)throw new Error(a.error.message);const i=await J.organization.inviteMember({email:o,role:n});if(i?.error)throw new Error(i.error.message)}function Ht(s){X.error(s instanceof Error?s.message:"Failed to update role")}async function Xt(s){const{memberId:e,role:n}=s,o=await J.organization.updateMemberRole({memberId:e,role:[n]});if(o?.error)throw new Error(o.error.message)}function Jt(s){X.error(s instanceof Error?s.message:"Failed to remove member")}async function en(s){const e=await J.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function sn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Hn(){const s=de.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(st,{fallback:e,children:t.jsx(G.Suspense,{fallback:t.jsx(es,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Os,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(Vt,{})})}),s[1]=n):n=s[1],n}export{Hn as default};
@@ -1,4 +1,4 @@
1
- import{r as a,H as N,j as _,c as Me,aV as te}from"./index-DZBCLPmz.js";import{S as me}from"./spinner-ISlo4YZH.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.
1
+ import{r as a,H as N,j as _,c as Me,aV as te}from"./index-Diww4UW3.js";import{S as me}from"./spinner-BF56RAKQ.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(Je)(r),i=k(B.changes)(e),u=k(He)(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 He(e,t){return W(t)?t(e.current):t}function Je(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
 
@@ -1,4 +1,4 @@
1
- import{U as _O,V as SO,r as g,c as ie,f as ia,j as v,t as wr,W as Da,X as Qe,Y as Te,H as Re,Z as PO,$ as OO,a0 as CO,a1 as jO,a2 as AO,a3 as mn,a4 as NO,a5 as EO,a6 as oa,a7 as ho,a8 as Er,m as jr,a9 as MO,b as TO,K as IO}from"./index-DZBCLPmz.js";import{c as vo}from"./connection-DoXpv3Ov.js";import{C as yf}from"./collection-header-DMI-enxo.js";import{C as kO}from"./collection-page-CPVm36im.js";import{C as DO}from"./collection-search-NPXhv3P8.js";import{I as Fn,n as bf,E as w1}from"./empty-state-DBRX3hef.js";import{E as Ja}from"./error-boundary-yHT4ni_0.js";import{B as Bn}from"./badge-9bzwrgbk.js";import{B as Ee,c as te,b as lv}from"./button-C_Xg9B1B.js";import{t as fi}from"./ChevronDown-DASi-DMo.js";import{i as _1,c as RO}from"./Grid01-CTb93Z2I.js";import{u as pn}from"./project-context-provider-CwtkfEWe.js";import{P as sa,a as la,b as ua}from"./popover-DDq46px5.js";import{c as ei,b as ti,T as ri}from"./tooltip-CpJ7mUzE.js";import{i as uv}from"./Check-DijrPXQx.js";import{a as vs}from"./Copy01-BQZg7H8u.js";import{n as cv}from"./Download01-BTR8eSV6.js";import{i as S1}from"./FilterLines-Dg_ubOas.js";import{i as LO}from"./Key01-BDVEoltU.js";import{i as $O,n as qO}from"./Play-BWxFDrEk.js";import{M as fv,s as FO}from"./monaco-editor-BtLswDg1.js";import{r as BO,_ as gn}from"./index-Cg8UjPnN.js";import{d as mo,i as zO,e as WO,T as ms}from"./value-BiYWDF0x.js";import{u as md}from"./use-connection-CD3KQhdl.js";import{u as P1,i as UO}from"./use-gateway-HT97xIYl.js";import{u as KO}from"./use-members-D-h9QOxK.js";import{i as HO}from"./Code01-C0ZFF6Hl.js";import{s as YO}from"./Plus-Dcgso5EP.js";import{s as GO}from"./Trash01-CzA8mxf_.js";import{I as qn}from"./input-DrOaW48H.js";import{C as dv}from"./checkbox-z9w2qryt.js";import{i as VO}from"./SearchMd-CbnCIalV.js";import{e as XO,S as hv,a as vv,b as mv,c as pv,d as Ra}from"./select-Cgab7LNB.js";import{I as ZO}from"./infiniteQueryObserver-CB9iuYaY.js";import{T as QO}from"./textarea-BL4bZEBo.js";import{R as JO}from"./resource-tabs-Dv00g9SH.js";import{u as pd}from"./use-tool-call-BmQnCqef.js";import"./collection-display-button-DNzo_eaI.js";import"./dropdown-menu-fQ8f1M5d.js";import"./ArrowUp-Xq_0RBx_.js";import"./List-jMJevXfS.js";import"./view-mode-toggle-DPk8_aIn.js";import"./Loading01-6JGza9Vp.js";import"./spinner-ISlo4YZH.js";import"./use-collections-BmF5uRR6.js";import"./useMutation-DV6K6Nze.js";import"./useQuery-mZS4-X0F.js";function eC(e,t){return _O({...e,enabled:!0,suspense:!0,throwOnError:SO},ZO,t)}const O1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"m15 18-6-6 6-6"}));O1.displayName="ChevronLeft";const C1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"M9.5 15V9m5 6V9m7.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));C1.displayName="PauseCircle";const j1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),g.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}));j1.displayName="PlayCircle";const A1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"M4 7c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C5.602 4 6.068 4 7 4h10c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C20 5.602 20 6.068 20 7M9 20h6M12 4v16"}));A1.displayName="Type01";function gd(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function tC(e,t){t===void 0&&(t=e,e=mo);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(o){var s=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[s](o-s)}}const xf={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function _r(e){return e.filter(t=>t.key.trim()).map(t=>{const r=encodeURIComponent(t.key.trim()),n=encodeURIComponent(t.value||"");return`${r}:${t.operator}:${n}`}).join(",")}function rC(e){return e?e.split(",").map(t=>{const[r,n,...a]=t.split(":");return{key:decodeURIComponent(r||""),operator:n||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function La(e){return e.filter(t=>t.key.trim()).map(t=>{switch(t.operator){case"eq":return`${t.key}=${t.value}`;case"contains":return`${t.key}~${t.value}`;case"exists":return`${t.key}?`}}).join(`
1
+ import{U as _O,V as SO,r as g,c as ie,f as ia,j as v,t as wr,W as Da,X as Qe,Y as Te,H as Re,Z as PO,$ as OO,a0 as CO,a1 as jO,a2 as AO,a3 as mn,a4 as NO,a5 as EO,a6 as oa,a7 as ho,a8 as Er,m as jr,a9 as MO,b as TO,K as IO}from"./index-Diww4UW3.js";import{c as vo}from"./connection-ChwHK0-S.js";import{C as yf}from"./collection-header-B4qcjEt5.js";import{C as kO}from"./collection-page-s-RR5fU6.js";import{C as DO}from"./collection-search-BVb42O45.js";import{I as Fn,n as bf,E as w1}from"./empty-state-wP9uukGJ.js";import{E as Ja}from"./error-boundary-BUvK8Sry.js";import{B as Bn}from"./badge-BVO6I0sW.js";import{B as Ee,c as te,b as lv}from"./button-CGmrzkpY.js";import{t as fi}from"./ChevronDown-DP6jvip7.js";import{i as _1,c as RO}from"./Grid01-D4lXvveX.js";import{u as pn}from"./project-context-provider-DulCVL2k.js";import{P as sa,a as la,b as ua}from"./popover-Bx7diZ86.js";import{c as ei,b as ti,T as ri}from"./tooltip-Suu_Gpqh.js";import{i as uv}from"./Check-BQkm1TiP.js";import{a as vs}from"./Copy01-CEYn2daS.js";import{n as cv}from"./Download01-BkDXja2z.js";import{i as S1}from"./FilterLines-Bojt6HPl.js";import{i as LO}from"./Key01-DTwk4FpG.js";import{i as $O,n as qO}from"./Play-DKlNHVjf.js";import{M as fv,s as FO}from"./monaco-editor-CDRbE4GY.js";import{r as BO,_ as gn}from"./index-D4QCsSzb.js";import{d as mo,i as zO,e as WO,T as ms}from"./value-DaPOjTmC.js";import{u as md}from"./use-connection-CCXutWLD.js";import{u as P1,i as UO}from"./use-gateway-DD-xEZju.js";import{u as KO}from"./use-members-CB2ebBfn.js";import{i as HO}from"./Code01-qXTn9GK9.js";import{s as YO}from"./Plus-CdG75X26.js";import{s as GO}from"./Trash01-BWIN9RL_.js";import{I as qn}from"./input-CrURMEZe.js";import{C as dv}from"./checkbox-DYViXeUc.js";import{i as VO}from"./SearchMd-GFaonOaJ.js";import{e as XO,S as hv,a as vv,b as mv,c as pv,d as Ra}from"./select-C8LOz7vA.js";import{I as ZO}from"./infiniteQueryObserver-BmbQcWdI.js";import{T as QO}from"./textarea-C_zgj3Sp.js";import{R as JO}from"./resource-tabs-ACbF96qo.js";import{u as pd}from"./use-tool-call-BmvKn7jp.js";import"./collection-display-button-CtkxsCB_.js";import"./dropdown-menu-CAeD2aIb.js";import"./ArrowUp-BF7mM4C2.js";import"./List-BsSZz32j.js";import"./view-mode-toggle-BLClM-0g.js";import"./Loading01-Ae5ezbtD.js";import"./spinner-BF56RAKQ.js";import"./use-collections-CXETocKO.js";import"./useMutation-Dl1MMkEC.js";import"./useQuery-Bvk0U2ed.js";function eC(e,t){return _O({...e,enabled:!0,suspense:!0,throwOnError:SO},ZO,t)}const O1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"m15 18-6-6 6-6"}));O1.displayName="ChevronLeft";const C1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"M9.5 15V9m5 6V9m7.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));C1.displayName="PauseCircle";const j1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),g.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}));j1.displayName="PlayCircle";const A1=({size:e=24,color:t="currentColor",...r})=>g.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},g.createElement("path",{d:"M4 7c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C5.602 4 6.068 4 7 4h10c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C20 5.602 20 6.068 20 7M9 20h6M12 4v16"}));A1.displayName="Type01";function gd(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function tC(e,t){t===void 0&&(t=e,e=mo);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(o){var s=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[s](o-s)}}const xf={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function _r(e){return e.filter(t=>t.key.trim()).map(t=>{const r=encodeURIComponent(t.key.trim()),n=encodeURIComponent(t.value||"");return`${r}:${t.operator}:${n}`}).join(",")}function rC(e){return e?e.split(",").map(t=>{const[r,n,...a]=t.split(":");return{key:decodeURIComponent(r||""),operator:n||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function La(e){return e.filter(t=>t.key.trim()).map(t=>{switch(t.operator){case"eq":return`${t.key}=${t.value}`;case"contains":return`${t.key}~${t.value}`;case"exists":return`${t.key}?`}}).join(`
2
2
  `)}function gv(e){return e.trim()?e.split(`
3
3
  `).map(t=>t.trim()).filter(t=>t.length>0).map(t=>{if(t.endsWith("?"))return{key:t.slice(0,-1),operator:"exists",value:""};if(t.includes("=")){const[r,...n]=t.split("=");return{key:r||"",operator:"eq",value:n.join("=")}}if(t.includes("~")){const[r,...n]=t.split("~");return{key:r||"",operator:"contains",value:n.join("~")}}return{key:t,operator:"exists",value:""}}):[]}function nC(e){const t={},r={},n=[];for(const a of e)if(a.key.trim())switch(a.operator){case"eq":a.value&&(t[a.key]=a.value);break;case"contains":a.value&&(r[a.key]=`%${a.value}%`);break;case"exists":n.push(a.key);break}return{properties:Object.keys(t).length>0?t:void 0,propertyPatterns:Object.keys(r).length>0?r:void 0,propertyKeys:n.length>0?n:void 0}}function yv(e){if(!e)return{content:"null",isTruncated:!1,originalSize:4};const t=JSON.stringify(e,null,2),r=t.length;return r<=xf.maxJsonRenderSize?{content:t,isTruncated:!1,originalSize:r}:{content:t.slice(0,xf.maxJsonRenderSize)+`
4
4
 
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-DZBCLPmz.js";import{i as n}from"./Loading01-6JGza9Vp.js";import{h as l}from"./mcp-oauth-CcVuDlog.js";function h(){const[s,c]=i.useState(null),[r,a]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[r&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!r&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":r?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):r?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};
1
+ import{r as i,j as e}from"./index-Diww4UW3.js";import{i as n}from"./Loading01-Ae5ezbtD.js";import{h as l}from"./mcp-oauth-CdcIczUJ.js";function h(){const[s,c]=i.useState(null),[r,a]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{const t=await l();if(!t.success){c(t.error||"MCP authentication failed"),setTimeout(()=>{window.close()},3e3);return}a(!0),setTimeout(()=>{window.close()},1500)}catch(t){c(t instanceof Error?t.message:String(t)),setTimeout(()=>{window.close()},3e3)}})()},[]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:e.jsxs("div",{className:"w-full max-w-md flex flex-col items-center justify-center gap-8",children:[r&&e.jsx("img",{src:"/empty-state-success.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),!r&&!s&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(n,{size:32,className:"animate-spin text-primary"})}),s&&e.jsx("img",{src:"/empty-state-error.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-foreground",children:s?"Authentication Failed":r?"Authentication Successful":"Authentication in progress..."}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-2",children:"An error occurred during authentication:"}),e.jsx("p",{className:"text-destructive",children:s}),e.jsxs("p",{className:"mt-2",children:[e.jsx("br",{}),"This window will close automatically."]})]}):r?e.jsxs("p",{children:["Authentication complete.",e.jsx("br",{}),"This window will close automatically."]}):e.jsx("p",{children:"Processing authentication..."})})]})]})})}export{h as default};