@decocms/mesh 2.64.1 → 2.64.3

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 (190) hide show
  1. package/dist/client/assets/{AlertCircle-exKB88m_.js → AlertCircle-C47UrlAO.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-NeI_Sm5E.js → ArrowUp-NpHWyg3u.js} +1 -1
  3. package/dist/client/assets/{Calendar-ChE-VbnE.js → Calendar-B649-aT8.js} +1 -1
  4. package/dist/client/assets/{Check-DqzdHNMw.js → Check-hF_kXZiK.js} +1 -1
  5. package/dist/client/assets/CheckCircle-BIFyDkzk.js +1 -0
  6. package/dist/client/assets/{ChevronDown-DNLmRmxT.js → ChevronDown-CwChLZoe.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BOG2FNn-.js → ChevronRight-0gQ-Lwyj.js} +1 -1
  8. package/dist/client/assets/{Code01-D9NkYkuA.js → Code01-DSEEeIpb.js} +1 -1
  9. package/dist/client/assets/{Copy01-BLooCkZe.js → Copy01-BY9LQ_eS.js} +1 -1
  10. package/dist/client/assets/{DotsHorizontal-r_tIL4Ov.js → DotsHorizontal-Bk4oST9u.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-BeH4d2j5.js → DotsVertical-CcQ5Tk1w.js} +1 -1
  12. package/dist/client/assets/{Download01-7dhNcBFv.js → Download01-BY55TLNH.js} +1 -1
  13. package/dist/client/assets/{Edit01-Zee8_Yir.js → Edit01-HUE0OI4J.js} +1 -1
  14. package/dist/client/assets/{File02-B0e9oXtX.js → File02-DfFeU8B6.js} +1 -1
  15. package/dist/client/assets/{File06-CNHRuvsg.js → File06-CV2OmgsQ.js} +1 -1
  16. package/dist/client/assets/{FilterLines-DxGB60xi.js → FilterLines-D6yXcgYG.js} +1 -1
  17. package/dist/client/assets/Globe02-DqbzCrT0.js +1 -0
  18. package/dist/client/assets/{Grid01-BGQX-rj4.js → Grid01-DshI78vi.js} +1 -1
  19. package/dist/client/assets/{Home02-Cj_b_3Nv.js → Home02-BCiKvL0o.js} +1 -1
  20. package/dist/client/assets/{Image01-DPdsVLq5.js → Image01-BR8oz0fK.js} +1 -1
  21. package/dist/client/assets/{Inbox01-DVXsLh-J.js → Inbox01-DqHW7WgR.js} +1 -1
  22. package/dist/client/assets/{InfoCircle-D-NOn_9O.js → InfoCircle-zJUw_W0n.js} +1 -1
  23. package/dist/client/assets/{Key01-B8mXK7o_.js → Key01-Bzha2Tgh.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-pdytjGUU.js → LinkExternal01-ybeItDxA.js} +1 -1
  25. package/dist/client/assets/{List-DwdxUhFm.js → List-B7BO0eBJ.js} +1 -1
  26. package/dist/client/assets/{Loading01--EdyQou6.js → Loading01-BpkkTLVp.js} +1 -1
  27. package/dist/client/assets/{Lock01-MF1zrVD-.js → Lock01-D4BGdzZt.js} +1 -1
  28. package/dist/client/assets/{Pin01-CDSgnzFS.js → Pin01-DnWh89mj.js} +1 -1
  29. package/dist/client/assets/{Play-CGl18U0a.js → Play-COkFzcB7.js} +1 -1
  30. package/dist/client/assets/{Plus-CKeAhIyX.js → Plus-8ovTaJHc.js} +1 -1
  31. package/dist/client/assets/{SearchMd-BH2aZiBv.js → SearchMd-SRsVDK9N.js} +1 -1
  32. package/dist/client/assets/{Share07-BIhcsqZd.js → Share07-6unHB4nq.js} +1 -1
  33. package/dist/client/assets/{Terminal-CRout4QP.js → Terminal--fMComVX.js} +1 -1
  34. package/dist/client/assets/{Tool01-PF9kQMj1.js → Tool01-BZbzIS2w.js} +1 -1
  35. package/dist/client/assets/{Trash01-DWmC_leT.js → Trash01-BhWwFORM.js} +1 -1
  36. package/dist/client/assets/{Upload01-Bykolsxu.js → Upload01-B2SsaI_Z.js} +1 -1
  37. package/dist/client/assets/{Users03-Bll7QSmr.js → Users03-8GhqNBdf.js} +1 -1
  38. package/dist/client/assets/{X-DPo-5hWo.js → X-BNK0mLul.js} +1 -1
  39. package/dist/client/assets/{XClose-BgTbSIyK.js → XClose-CxBh99Dw.js} +1 -1
  40. package/dist/client/assets/agent-connections-preview-C9hG7NOc.js +1 -0
  41. package/dist/client/assets/agent-detail-2FW7R_Kw.js +1 -0
  42. package/dist/client/assets/agents-DLxYaiBc.js +1 -0
  43. package/dist/client/assets/alert-dialog-Cg14vDvh.js +7 -0
  44. package/dist/client/assets/{auth-catchall-DM4kJVyq.js → auth-catchall-oZsZy72p.js} +1 -1
  45. package/dist/client/assets/badge-tO1xwt4d.js +1 -0
  46. package/dist/client/assets/{binder-Rtvfp3ct.js → binder-_fA_QfCQ.js} +1 -1
  47. package/dist/client/assets/{breadcrumb-CPuY6F-0.js → breadcrumb-B1KWdwh9.js} +1 -1
  48. package/dist/client/assets/{button-DZky_O5b.js → button-CWzK0IXA.js} +1 -1
  49. package/dist/client/assets/{card-B7MutzeW.js → card-uLixd1BQ.js} +1 -1
  50. package/dist/client/assets/{checkbox-FfI3AO16.js → checkbox-B81riJiI.js} +1 -1
  51. package/dist/client/assets/{circle-alert-D_EfZXyv.js → circle-alert-CChO7Clp.js} +1 -1
  52. package/dist/client/assets/{collapsible-BoMwbmju.js → collapsible-C_w2O0ke.js} +7 -7
  53. package/dist/client/assets/{collection-detail-BtpKZhJa.js → collection-detail-DWdOXH1z.js} +3 -3
  54. package/dist/client/assets/{collection-search-76irKOdK.js → collection-search-jBfTOehF.js} +1 -1
  55. package/dist/client/assets/collection-tab-B_8SPzV6.js +1 -0
  56. package/dist/client/assets/collection-table-wrapper-DtjpsgWF.js +1 -0
  57. package/dist/client/assets/collection-tabs-JS9xYoKs.js +1 -0
  58. package/dist/client/assets/connect-qqRP-4pj.js +1 -0
  59. package/dist/client/assets/connection-card-CYM4Wn_Y.js +1 -0
  60. package/dist/client/assets/connection-detail-DY6ai_fO.js +1 -0
  61. package/dist/client/assets/connections-C29FK0Jd.js +1 -0
  62. package/dist/client/assets/constants-Chp3RuVB.js +1 -0
  63. package/dist/client/assets/constants-DUMQK_Jq.js +1 -0
  64. package/dist/client/assets/{create-organization-dialog-CAVp9V3U.js → create-organization-dialog-CNKyQgDY.js} +1 -1
  65. package/dist/client/assets/{dialog-BfMrinrm.js → dialog-BiNw4dY-.js} +1 -1
  66. package/dist/client/assets/differenceInSeconds-NQ4PDo0z.js +1 -0
  67. package/dist/client/assets/dropdown-menu-D0wZWcOa.js +1 -0
  68. package/dist/client/assets/dynamic-plugin-layout-6AKBQQJO.js +1 -0
  69. package/dist/client/assets/{empty-state-Cg4cXdfL.js → empty-state-DrSUCtH7.js} +1 -1
  70. package/dist/client/assets/{empty-state-D1xTHC6z.js → empty-state-yKA0Dnoy.js} +1 -1
  71. package/dist/client/assets/{env-vars-editor-BKxl8k2Z.js → env-vars-editor-BXoRftCH.js} +1 -1
  72. package/dist/client/assets/{error-boundary-gLETJlNI.js → error-boundary-DMzArMGc.js} +1 -1
  73. package/dist/client/assets/extract-connection-data-Cegvn5cS.js +1 -0
  74. package/dist/client/assets/file-browser-CJvaY_Ab.js +2 -0
  75. package/dist/client/assets/{form-BmYBK--9.js → form-3eNCom8C.js} +1 -1
  76. package/dist/client/assets/grid-view-DBknMzh4.js +1 -0
  77. package/dist/client/assets/home-D-rgYO4-.js +1 -0
  78. package/dist/client/assets/index-6SKae0YQ.js +25 -0
  79. package/dist/client/assets/{index-C_wS7kU0.js → index-8f9n1Jea.js} +2 -2
  80. package/dist/client/assets/index-BLFsiDnl.js +1 -0
  81. package/dist/client/assets/index-Bgvel9yL.js +1 -0
  82. package/dist/client/assets/index-Bj5Q4dXx.css +1 -0
  83. package/dist/client/assets/{index-BgOoHyXW.js → index-DkVMZPZp.js} +2 -2
  84. package/dist/client/assets/{index-Ce8gkgBF.js → index-DyvOt7HW.js} +1 -1
  85. package/dist/client/assets/{index-DJ2Jm9li.js → index-ssfNqXSw.js} +1 -1
  86. package/dist/client/assets/{infiniteQueryObserver-DeNzkqh2.js → infiniteQueryObserver-BRy8d1pq.js} +1 -1
  87. package/dist/client/assets/{input-BzaoEOCn.js → input-BKM3goZw.js} +1 -1
  88. package/dist/client/assets/layout-B7iU_InR.js +1 -0
  89. package/dist/client/assets/localstorage-keys-DVhuzRr7.js +1 -0
  90. package/dist/client/assets/login-BWXaWv5V.js +1 -0
  91. package/dist/client/assets/{mcp-oauth-CwgwnIPj.js → mcp-oauth-D7Oz8tNV.js} +1 -1
  92. package/dist/client/assets/mcp-server-card-CfIOHPGJ.js +1 -0
  93. package/dist/client/assets/mcp-server-detail-C78CCQ6k.js +2 -0
  94. package/dist/client/assets/members-duFQ3ptf.js +3 -0
  95. package/dist/client/assets/{monaco-editor-ClMv24Rj.js → monaco-editor-DcchC01p.js} +1 -1
  96. package/dist/client/assets/{monitoring-Dt3Jqymb.js → monitoring-B7FviaI2.js} +5 -5
  97. package/dist/client/assets/{oauth-callback-CiHGnzYq.js → oauth-callback-Cr23Dy5V.js} +1 -1
  98. package/dist/client/assets/page-Ad6Sa48d.js +1 -0
  99. package/dist/client/assets/page-D37Vnx0X.js +1 -0
  100. package/dist/client/assets/{plugin-empty-state-CBcxf1BJ.js → plugin-empty-state-b364WWC7.js} +1 -1
  101. package/dist/client/assets/{plugin-header-CcZgfMpE.js → plugin-header-Cf8zeBUs.js} +1 -1
  102. package/dist/client/assets/{plugins-DTsvxiGH.js → plugins-BH2WU-Ku.js} +1 -1
  103. package/dist/client/assets/{popover-DUJwUSSM.js → popover-C0G-pXcc.js} +1 -1
  104. package/dist/client/assets/registry-utils-DFPURwxl.js +1 -0
  105. package/dist/client/assets/{resizable-84bjYGaV.js → resizable-DQrwcKJh.js} +1 -1
  106. package/dist/client/assets/select-Df9aMNs1.js +1 -0
  107. package/dist/client/assets/settings-C0Akd5oR.js +1 -0
  108. package/dist/client/assets/shell-layout-pk6n67Pv.js +12 -0
  109. package/dist/client/assets/{spinner-C10QwZNL.js → spinner-D8NZVmaU.js} +1 -1
  110. package/dist/client/assets/{store-invite-C76m8rKU.js → store-invite-B2dM3aW8.js} +1 -1
  111. package/dist/client/assets/{switch-CtUEm8Xv.js → switch-Cv7KL0jJ.js} +1 -1
  112. package/dist/client/assets/table-CWx1lOcJ.js +1 -0
  113. package/dist/client/assets/{textarea-DKyvCB8I.js → textarea-BQ5-74yh.js} +1 -1
  114. package/dist/client/assets/tools-list-BIQssT5E.js +1 -0
  115. package/dist/client/assets/{typewriter-title-BUQDml2i.js → typewriter-title-f-tG2rqy.js} +2 -2
  116. package/dist/client/assets/use-binding-CDLcDLTQ.js +23 -0
  117. package/dist/client/assets/use-connection-BNgYG_2P.js +1 -0
  118. package/dist/client/assets/use-create-virtual-mcp-DkV_YHpf.js +1 -0
  119. package/dist/client/assets/{use-deco-chat-open-94yXlVsB.js → use-deco-chat-open-LwA291qT.js} +1 -1
  120. package/dist/client/assets/use-list-state-BfUltaaz.js +1 -0
  121. package/dist/client/assets/{use-mcp-prompts-DkUA9eji.js → use-mcp-prompts-CHXMWYZ1.js} +1 -1
  122. package/dist/client/assets/{use-members-Bohb_YFO.js → use-members-BfS3S-UM.js} +1 -1
  123. package/dist/client/assets/{use-mobile-BpwfxiEP.js → use-mobile-BXQipnb5.js} +1 -1
  124. package/dist/client/assets/use-organization-settings-DZiQDtex.js +1 -0
  125. package/dist/client/assets/use-virtual-mcp-CEZ5nKxx.js +1 -0
  126. package/dist/client/assets/useInfiniteQuery-Do9q2S3P.js +1 -0
  127. package/dist/client/assets/useMutation-CFQDhqDA.js +1 -0
  128. package/dist/client/assets/useQuery-BSKCoFrF.js +1 -0
  129. package/dist/client/assets/{view-mode-toggle-DC9CalE4.js → view-mode-toggle-Cz9APct2.js} +1 -1
  130. package/dist/client/assets/workflow-CfBvHdI5.js +1 -0
  131. package/dist/client/index.html +2 -2
  132. package/dist/server/cli.js +149 -149
  133. package/dist/server/migrate.js +128 -128
  134. package/dist/server/node_modules/kysely/dist/cjs/kysely.js +4 -1
  135. package/dist/server/node_modules/kysely/dist/cjs/query-compiler/default-query-compiler.js +4 -4
  136. package/dist/server/node_modules/kysely/dist/esm/kysely.js +4 -1
  137. package/dist/server/node_modules/kysely/dist/esm/query-compiler/default-query-compiler.js +4 -4
  138. package/dist/server/node_modules/kysely/package.json +9 -9
  139. package/dist/server/server.js +130 -130
  140. package/package.json +1 -1
  141. package/dist/client/assets/agent-detail-CpwZc1b1.js +0 -1
  142. package/dist/client/assets/agents-oKjI60eC.js +0 -1
  143. package/dist/client/assets/alert-dialog-CAM8sgWL.js +0 -7
  144. package/dist/client/assets/avatar-BKY-flI3.js +0 -1
  145. package/dist/client/assets/badge-CTM0uIWD.js +0 -1
  146. package/dist/client/assets/collection-tab-keDulUWT.js +0 -1
  147. package/dist/client/assets/collection-table-wrapper-BJq8wZxV.js +0 -1
  148. package/dist/client/assets/connect-C2-6ppjk.js +0 -1
  149. package/dist/client/assets/connection-card-B3jQjBgZ.js +0 -1
  150. package/dist/client/assets/connection-detail-Hc-xgFqj.js +0 -1
  151. package/dist/client/assets/connections-CUoG-mV_.js +0 -1
  152. package/dist/client/assets/constants-D6nN-s6F.js +0 -1
  153. package/dist/client/assets/constants-G7VjePam.js +0 -1
  154. package/dist/client/assets/dropdown-menu-ez_4ZmAk.js +0 -1
  155. package/dist/client/assets/dynamic-plugin-layout-Ct7KFYp2.js +0 -1
  156. package/dist/client/assets/extract-connection-data-ErflmyS5.js +0 -1
  157. package/dist/client/assets/file-browser-CBHo45M0.js +0 -2
  158. package/dist/client/assets/grid-view-C-dwKiE-.js +0 -1
  159. package/dist/client/assets/home-BDN98qz3.js +0 -1
  160. package/dist/client/assets/index-BPkoxqog.css +0 -1
  161. package/dist/client/assets/index-BZabJ6cV.js +0 -25
  162. package/dist/client/assets/index-C37GOiqD.js +0 -1
  163. package/dist/client/assets/index-DWCFQK0J.js +0 -1
  164. package/dist/client/assets/layout-CodKePSg.js +0 -1
  165. package/dist/client/assets/localstorage-keys-D6GRYm3g.js +0 -1
  166. package/dist/client/assets/login-1vYqawvH.js +0 -1
  167. package/dist/client/assets/mcp-server-card-DIRrlGUw.js +0 -1
  168. package/dist/client/assets/mcp-server-detail-CSLx-xgM.js +0 -2
  169. package/dist/client/assets/members-DGtdEsXJ.js +0 -3
  170. package/dist/client/assets/page-BmajQcYq.js +0 -1
  171. package/dist/client/assets/page-Dh7IL0BH.js +0 -1
  172. package/dist/client/assets/pin-to-sidebar-button-C4cbmw2S.js +0 -1
  173. package/dist/client/assets/registry-utils-DJNRhqR6.js +0 -1
  174. package/dist/client/assets/resource-tabs-CVxcKDVM.js +0 -1
  175. package/dist/client/assets/select-iwsI8D5M.js +0 -1
  176. package/dist/client/assets/settings-BgsuV025.js +0 -1
  177. package/dist/client/assets/shell-layout-BNFkBUbX.js +0 -12
  178. package/dist/client/assets/table-BM-vLnK2.js +0 -1
  179. package/dist/client/assets/tools-list-DRICPoNu.js +0 -1
  180. package/dist/client/assets/use-binding-COwUQLKP.js +0 -23
  181. package/dist/client/assets/use-collections-CE5nYbrV.js +0 -1
  182. package/dist/client/assets/use-connection-sLATlyBj.js +0 -1
  183. package/dist/client/assets/use-create-virtual-mcp-CAqC56mj.js +0 -1
  184. package/dist/client/assets/use-list-state-vuNkB3yR.js +0 -1
  185. package/dist/client/assets/use-organization-settings-OSGN2_Jg.js +0 -1
  186. package/dist/client/assets/use-virtual-mcp-XIWHgsHo.js +0 -1
  187. package/dist/client/assets/useInfiniteQuery-C5DCUMiS.js +0 -1
  188. package/dist/client/assets/useMutation-Ngf5wAT3.js +0 -1
  189. package/dist/client/assets/useQuery-BlNmU8Jq.js +0 -1
  190. package/dist/client/assets/workflow-DutOEPT0.js +0 -1
@@ -1 +0,0 @@
1
- import{C as i,L as r,O as l,P as u,V as C,i as c,p as P,u as p}from"./index-BgOoHyXW.js";import{u as M,a as g,b as L,c as d,d as f,e as x,f as S,g as y}from"./use-collections-CE5nYbrV.js";import{u as T,a as h,b as A}from"./use-connection-sLATlyBj.js";import{S as e}from"./constants-G7VjePam.js";import{K as b,a as V,W,c as w,g as I,b as O,d as _,e as D,f as E,h as Q,i as j,u as G}from"./constants-G7VjePam.js";import{g as k,l as v,a as F,r as H,u as J,b as N,c as Y,d as q}from"./use-mcp-prompts-DkUA9eji.js";import{u as B,a as X,b as Z}from"./use-virtual-mcp-XIWHgsHo.js";import{a as ss,h as es,i as os}from"./mcp-oauth-CwgwnIPj.js";import"./useMutation-Ngf5wAT3.js";import"./useQuery-BlNmU8Jq.js";export{i as ConnectionEntitySchema,b as KEYS,r as Locator,l as ORG_ADMIN_PROJECT_SLUG,u as ProjectContextProvider,V as SELF_MCP_ALIAS_ID,e as StreamableHTTPClientTransport,C as VirtualMCPEntitySchema,W as WellKnownOrgMCPId,ss as authenticateMcp,w as createMCPClient,I as getDecopilotId,k as getPrompt,O as getWellKnownCommunityRegistryConnection,_ as getWellKnownDecopilotVirtualMCP,D as getWellKnownMcpStudioConnection,E as getWellKnownOpenRouterConnection,Q as getWellKnownRegistryConnection,es as handleOAuthCallback,os as isConnectionAuthenticated,j as isDecopilot,c as isStdioParameters,v as listPrompts,F as listResources,P as parseVirtualUrl,H as readResource,M as useCollectionActions,g as useCollectionItem,L as useCollectionList,T as useConnection,h as useConnectionActions,A as useConnections,G as useMCPClient,J as useMCPPromptsList,N as useMCPPromptsListQuery,Y as useMCPResourcesList,q as useMCPResourcesListQuery,d as useMCPToolCall,f as useMCPToolCallMutation,x as useMCPToolCallQuery,S as useMCPToolsList,y as useMCPToolsListQuery,p as useProjectContext,B as useVirtualMCP,X as useVirtualMCPActions,Z as useVirtualMCPs};
@@ -1 +0,0 @@
1
- import{r as c,c as O,j as n,aZ as U,am as q,a_ as H,ak as x,al as y,a$ as K,an as k,b0 as S,av as T,aq as _,ao as W,ap as $}from"./index-BgOoHyXW.js";import{B as w}from"./button-DZky_O5b.js";import{i as Z}from"./Loading01--EdyQou6.js";const g=({size:r=24,color:e="currentColor",...o})=>c.createElement("svg",{viewBox:"0 0 24 24",width:r,height:r,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},c.createElement("path",{d:"M3 9h13.5a4.5 4.5 0 1 1 0 9H12M3 9l4-4M3 9l4 4"}));g.displayName="FlipBackward";const j=({size:r=24,color:e="currentColor",...o})=>c.createElement("svg",{viewBox:"0 0 24 24",width:r,height:r,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},c.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));j.displayName="Save01";function ce(r){const e=O.c(15),{onSave:o,onUndo:d,isDirty:t,isSaving:a,saveLabel:l,undoLabel:R}=r,f=l===void 0?"Save":l,v=R===void 0?"Undo":R;if(!t)return null;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(g,{size:14}),e[0]=m):m=e[0];let i;e[1]!==a||e[2]!==d||e[3]!==v?(i=n.jsxs(w,{variant:"outline",size:"sm",onClick:d,disabled:a,"aria-label":v,children:[m,v]}),e[1]=a,e[2]=d,e[3]=v,e[4]=i):i=e[4];let p;e[5]!==a?(p=a?n.jsx(Z,{size:14,className:"animate-spin"}):n.jsx(j,{size:14}),e[5]=a,e[6]=p):p=e[6];let s;e[7]!==a||e[8]!==o||e[9]!==f||e[10]!==p?(s=n.jsxs(w,{variant:"default",size:"sm",onClick:o,disabled:a,"aria-label":f,children:[p,f]}),e[7]=a,e[8]=o,e[9]=f,e[10]=p,e[11]=s):s=e[11];let u;return e[12]!==i||e[13]!==s?(u=n.jsxs(n.Fragment,{children:[i,s]}),e[12]=i,e[13]=s,e[14]=u):u=e[14],u}var E="Radio",[X,I]=_(E),[Y,J]=X(E),P=c.forwardRef((r,e)=>{const{__scopeRadio:o,name:d,checked:t=!1,required:a,disabled:l,value:R="on",onCheck:f,form:v,...m}=r,[i,p]=c.useState(null),s=y(e,C=>p(C)),u=c.useRef(!1),h=i?v||!!i.closest("form"):!0;return n.jsxs(Y,{scope:o,checked:t,disabled:l,children:[n.jsx(x.button,{type:"button",role:"radio","aria-checked":t,"data-state":L(t),"data-disabled":l?"":void 0,disabled:l,value:R,...m,ref:s,onClick:k(r.onClick,C=>{t||f?.(),h&&(u.current=C.isPropagationStopped(),u.current||C.stopPropagation())})}),h&&n.jsx(G,{control:i,bubbles:!u.current,name:d,value:R,checked:t,required:a,disabled:l,form:v,style:{transform:"translateX(-100%)"}})]})});P.displayName=E;var N="RadioIndicator",A=c.forwardRef((r,e)=>{const{__scopeRadio:o,forceMount:d,...t}=r,a=J(N,o);return n.jsx(T,{present:d||a.checked,children:n.jsx(x.span,{"data-state":L(a.checked),"data-disabled":a.disabled?"":void 0,...t,ref:e})})});A.displayName=N;var Q="RadioBubbleInput",G=c.forwardRef(({__scopeRadio:r,control:e,checked:o,bubbles:d=!0,...t},a)=>{const l=c.useRef(null),R=y(l,a),f=W(o),v=$(e);return c.useEffect(()=>{const m=l.current;if(!m)return;const i=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(i,"checked").set;if(f!==o&&s){const u=new Event("click",{bubbles:d});s.call(m,o),m.dispatchEvent(u)}},[f,o,d]),n.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:o,...t,tabIndex:-1,ref:R,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});G.displayName=Q;function L(r){return r?"checked":"unchecked"}var ee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b="RadioGroup",[oe]=_(b,[S,I]),M=S(),D=I(),[ae,re]=oe(b),B=c.forwardRef((r,e)=>{const{__scopeRadioGroup:o,name:d,defaultValue:t,value:a,required:l=!1,disabled:R=!1,orientation:f,dir:v,loop:m=!0,onValueChange:i,...p}=r,s=M(o),u=U(v),[h,C]=q({prop:a,defaultProp:t??null,onChange:i,caller:b});return n.jsx(ae,{scope:o,name:d,required:l,disabled:R,value:h,onValueChange:C,children:n.jsx(H,{asChild:!0,...s,orientation:f,dir:u,loop:m,children:n.jsx(x.div,{role:"radiogroup","aria-required":l,"aria-orientation":f,"data-disabled":R?"":void 0,dir:u,...p,ref:e})})})});B.displayName=b;var z="RadioGroupItem",F=c.forwardRef((r,e)=>{const{__scopeRadioGroup:o,disabled:d,...t}=r,a=re(z,o),l=a.disabled||d,R=M(o),f=D(o),v=c.useRef(null),m=y(e,v),i=a.value===t.value,p=c.useRef(!1);return c.useEffect(()=>{const s=h=>{ee.includes(h.key)&&(p.current=!0)},u=()=>p.current=!1;return document.addEventListener("keydown",s),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",s),document.removeEventListener("keyup",u)}},[]),n.jsx(K,{asChild:!0,...R,focusable:!l,active:i,children:n.jsx(P,{disabled:l,required:a.required,checked:i,...f,...t,name:a.name,ref:m,onCheck:()=>a.onValueChange(t.value),onKeyDown:k(s=>{s.key==="Enter"&&s.preventDefault()}),onFocus:k(t.onFocus,()=>{p.current&&v.current?.click()})})})});F.displayName=z;var te="RadioGroupIndicator",V=c.forwardRef((r,e)=>{const{__scopeRadioGroup:o,...d}=r,t=D(o);return n.jsx(A,{...t,...d,ref:e})});V.displayName=te;var de=B,le=F,ue=V;export{le as I,de as R,ce as S,ue as a};
@@ -1 +0,0 @@
1
- import{c as b,r as x,a2 as j,j as n}from"./index-BgOoHyXW.js";import{P as f}from"./index-DJ2Jm9li.js";const h=x.createContext(null);function g(u){const e=b.c(3),{children:l}=u,t=x.useContext(h);if(!t?.tabsEl)return null;let s;return e[0]!==l||e[1]!==t.tabsEl?(s=j.createPortal(l,t.tabsEl),e[0]=l,e[1]=t.tabsEl,e[2]=s):s=e[2],s}function v(u){const e=b.c(3),{children:l}=u,t=x.useContext(h);if(!t?.actionsEl)return null;let s;return e[0]!==l||e[1]!==t.actionsEl?(s=j.createPortal(l,t.actionsEl),e[0]=l,e[1]=t.actionsEl,e[2]=s):s=e[2],s}function P(u){const e=b.c(16),{children:l,breadcrumb:t}=u,[s,p]=x.useState(null),[d,w]=x.useState(null);let c;e[0]!==d||e[1]!==s?(c={tabsEl:s,actionsEl:d},e[0]=d,e[1]=s,e[2]=c):c=e[2];let r;e[3]!==t?(r=n.jsx(f.Header.Left,{children:t}),e[3]=t,e[4]=r):r=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs(f.Header.Right,{children:[n.jsx("div",{ref:p,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),n.jsx("div",{ref:w,className:"flex items-center gap-2 shrink-0"})]}),e[5]=m):m=e[5];let a;e[6]!==r?(a=n.jsxs(f.Header,{children:[r,m]}),e[6]=r,e[7]=a):a=e[7];let o;e[8]!==l?(o=n.jsx(f.Content,{children:l}),e[8]=l,e[9]=o):o=e[9];let i;e[10]!==a||e[11]!==o?(i=n.jsxs(f,{children:[a,o]}),e[10]=a,e[11]=o,e[12]=i):i=e[12];let E;return e[13]!==c||e[14]!==i?(E=n.jsx(h,{value:c,children:i}),e[13]=c,e[14]=i,e[15]=E):E=e[15],E}export{v as V,g as a,P as b};
@@ -1 +0,0 @@
1
- import{c as O,a1 as I}from"./index-BgOoHyXW.js";import{u as M}from"./useQuery-BlNmU8Jq.js";import{u as x}from"./useMutation-Ngf5wAT3.js";function L(t){try{return JSON.parse(t)}catch{return}}function y(t,s){const e=localStorage.getItem(t),o=e?L(e):void 0,n=typeof s=="function"?s(o):o??s;if(o===void 0||n!==o)try{const a=JSON.stringify(n);localStorage.setItem(t,a)}catch{}return n}function A(t,s){const e=O.c(25),o=I();let n;e[0]!==t?(n=["localStorage",t],e[0]=t,e[1]=n):n=e[1];const a=n;let r,i;e[2]!==s||e[3]!==t?(r=()=>y(t,s),i=()=>y(t,s),e[2]=s,e[3]=t,e[4]=r,e[5]=i):(r=e[4],i=e[5]);let m;e[6]!==a||e[7]!==r||e[8]!==i?(m={queryKey:a,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},e[6]=a,e[7]=r,e[8]=i,e[9]=m):m=e[9];const{data:v}=M(m);let l;e[10]!==t?(l=async c=>{const $=JSON.stringify(c);return localStorage.setItem(t,$),c},e[10]=t,e[11]=l):l=e[11];let h;e[12]!==o||e[13]!==a?(h=c=>{o.setQueryData(a,c)},e[12]=o,e[13]=a,e[14]=h):h=e[14];let u;e[15]!==l||e[16]!==h?(u={mutationFn:l,onSuccess:h},e[15]=l,e[16]=h,e[17]=u):u=e[17];const g=x(u);let d;e[18]!==g||e[19]!==o||e[20]!==a?(d=c=>{const $=o.getQueryData(a),C=typeof c=="function"?c($):c;g.mutate(C)},e[18]=g,e[19]=o,e[20]=a,e[21]=d):d=e[21];const S=d,p=v;let f;return e[22]!==S||e[23]!==p?(f=[p,S],e[22]=S,e[23]=p,e[24]=f):f=e[24],f}const D={assistantChatThreads:t=>`mesh:assistant-chat:threads:${t}`,messages:(t,s)=>`mesh:messages:${t}:${s}`,decoChatOpen:()=>"mesh:decochat:open",chatSelectedModel:t=>`mesh:chat:selectedModel:${t}`,chatSelectedMode:t=>`mesh:chat:selectedMode:${t}`,assistantChatActiveThread:t=>`mesh:assistant-chat:active-thread:${t}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:t=>`mesh:store:selected-registry:${t}`,orgHomeQuickstart:t=>`mesh:org-home:quickstart:${t}`,storeShowStdio:()=>"mesh:store:show-stdio",developerMode:()=>"mesh:user:developer-mode",pluginConnection:(t,s)=>`mesh:plugin:connection:${t}:${s}`};export{D as L,A as u};
@@ -1 +0,0 @@
1
- import{m as k,r as p,g as j,j as e,f as z,S as L,N as R,c as U}from"./index-BgOoHyXW.js";import{u as T}from"./useMutation-Ngf5wAT3.js";import{c as b,B as P}from"./button-DZky_O5b.js";import{I as E}from"./input-BzaoEOCn.js";function B({redirectUrl:r}){const{emailAndPassword:t}=k(),[s,d]=p.useState(""),[o,u]=p.useState(""),[l,v]=p.useState(""),[i,N]=p.useState(()=>globalThis.localStorage?.getItem("hasLoggedIn")!=="true"),[m,h]=p.useState(""),g=T({mutationFn:async({email:a,password:n,name:C})=>{try{if(i){const c=await j.signUp.email({email:a,password:n,name:C||""});if(c.error)throw new Error(c.error.message||"Sign up failed");return c}else{const c=await j.signIn.email({email:a,password:n});if(c.error)throw new Error(c.error.message||"Sign in failed");return c}}catch(c){throw c instanceof Error?c:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),r&&(window.location.href=r)}}),y=a=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),x=()=>{s.trim()&&!y(s)&&h("Invalid email address")},S=a=>{if(a.preventDefault(),!y(s)){h("Invalid email address");return}g.mutate({email:s,password:o,name:l})},_=a=>n=>{a(n.target.value),I&&g.reset(),a===d&&m&&h("")},f=g.isPending,I=g.error,w=i?s.trim()&&o.trim()&&l.trim():s.trim()&&o.trim(),A=a=>{if(!a)return null;const n=a.message.toLowerCase();return n.includes("unauthorized")||n.includes("401")?"Invalid email or password. Please try again.":n.includes("already exists")||n.includes("409")?"An account with this email already exists. Try signing in instead.":n.includes("network")||n.includes("fetch")?"Network error. Please check your connection and try again.":n.includes("rate limit")||n.includes("429")?"Too many attempts. Please wait a moment and try again.":a.message||"An error occurred. Please try again."};return e.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:i?"Create your account":"Login or signup below"})}),I&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:A(I)}),t.enabled&&e.jsxs("form",{onSubmit:S,className:"grid gap-4",children:[e.jsx("div",{className:b("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",i?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:b("p-1",!i&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(E,{type:"text",placeholder:"Your name",value:l,onChange:_(v),required:!0,disabled:f||!i,"aria-hidden":!i})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(E,{type:"email",placeholder:"you@example.com",value:s,onChange:_(d),onBlur:x,required:!0,disabled:f,"aria-invalid":!!m}),m&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:m})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Password"}),e.jsx(E,{type:"password",placeholder:"••••••••",value:o,onChange:_(u),required:!0,disabled:f})]}),e.jsx("div",{className:b("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",w?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:b("p-1",!w&&"pointer-events-none"),children:e.jsx(P,{type:"submit",disabled:f||!w,className:b("w-full font-semibold"),size:"lg","aria-hidden":!w,children:f?i?"Creating account...":"Signing in...":"Continue"})})})]}),e.jsx("div",{className:"text-center",children:e.jsx(P,{type:"button",variant:"link",onClick:()=>{N(!i),v(""),h(""),g.reset()},disabled:f,className:"text-sm text-muted-foreground hover:text-foreground",children:i?"Already have an account? Sign in":"Don't have an account? Sign up"})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function M(r){if(!r.client_id||r.response_type!=="code")return null;const t=new URLSearchParams;return r.client_id&&t.set("client_id",r.client_id),r.redirect_uri&&t.set("redirect_uri",r.redirect_uri),r.response_type&&t.set("response_type",r.response_type),r.state&&t.set("state",r.state),r.scope&&t.set("scope",r.scope),r.code_challenge&&t.set("code_challenge",r.code_challenge),r.code_challenge_method&&t.set("code_challenge_method",r.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function q(r){const t=U.c(5),{callbackURL:s,providerId:d}=r;let o,u;t[0]!==s||t[1]!==d?(o=()=>{(async()=>await j.signIn.sso({providerId:d,callbackURL:s}))()},u=[d,s],t[0]=s,t[1]=d,t[2]=o,t[3]=u):(o=t[2],u=t[3]),p.useEffect(o,u);let l;return t[4]===Symbol.for("react.memo_cache_sentinel")?(l=e.jsx(L,{}),t[4]=l):l=t[4],l}function Y(){const r=j.useSession(),t=z({from:"/login"}),{next:s="/",client_id:d,redirect_uri:o,response_type:u,state:l,scope:v,code_challenge:i,code_challenge_method:N}=t,{sso:m,emailAndPassword:h,magicLink:g,socialProviders:y}=k(),x=M({client_id:d,redirect_uri:o,response_type:u,state:l,scope:v,code_challenge:i,code_challenge_method:N}),S=x||s;return r.data?x?(window.location.href=x,e.jsx(L,{})):e.jsx(R,{to:s}):m.enabled?e.jsx(q,{callbackURL:S,providerId:m.providerId}):h.enabled||g.enabled||y.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e.jsx(B,{redirectUrl:x})]})]}):e.jsx("div",{children:"No login options available"})}export{Y as default};
@@ -1 +0,0 @@
1
- import{r as B,c as V,j as a}from"./index-BgOoHyXW.js";import{I as O,T as q,a as J,c as K}from"./empty-state-D1xTHC6z.js";import{c as M,B as Q}from"./button-DZky_O5b.js";import{s as X}from"./registry-utils-DJNRhqR6.js";import{i as Y}from"./Lock01-MF1zrVD-.js";import{s as ee}from"./Plus-CKeAhIyX.js";import{i as te}from"./Terminal-CRout4QP.js";import{C as se}from"./card-B7MutzeW.js";import{g as le}from"./github-icon-Dp3wHhYE.js";const U=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";const W=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 10 4.08 10 5.2 10Zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 22 4.08 22 5.2 22Z"}));W.displayName="Server01";function ie(s){if(!s.includes("/"))return s;const e=s.split("/"),l=e[0],i=e[1];if(!l||!i)return s;if(l.includes(".")){const n=l.split("."),r=n[n.length-1]||l,o=i.replace(/^mcp-?/,"").replace(/-?mcp$/,"").replace(/^server-?/,"").replace(/-?server$/,"");return!o||o.length<2?r:o}return i}function ae(s){const e=V.c(2),{protocol:l,className:i}=s;let n;return e[0]!==i?(n={http:a.jsx(X,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(te,{className:i})},e[0]=i,e[1]=n):n=e[1],n[l]}function ne(s){switch(s){case"http":return"HTTP";case"sse":return"SSE";case"stdio":return"STDIO"}}function re(s){const e=V.c(9),{protocol:l}=s;let i;e[0]!==l?(i=M("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium shrink-0",{http:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",sse:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",stdio:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"}[l]),e[0]=l,e[1]=i):i=e[1];let n,r;e[2]!==l?(n=a.jsx(ae,{protocol:l,className:"w-3 h-3"}),r=ne(l),e[2]=l,e[3]=n,e[4]=r):(n=e[3],r=e[4]);let o;return e[5]!==i||e[6]!==n||e[7]!==r?(o=a.jsxs("div",{className:i,children:[n,r]}),e[5]=i,e[6]=n,e[7]=r,e[8]=o):o=e[8],o}function oe(s){const e=V.c(68),{icon:l,displayName:i,description:n,onClick:r}=s,t=(s.variant??"store")==="server",f=t?s.hostname:null,d=t?s.protocol:null,c=t?s.isInstalling:!1,m=t?s.actionLabel:void 0,p=t?null:s.scopeName,_=t?!1:s.isVerified,x=t?!0:s.canInstall,H=t?"p-4":"p-6";let u;e[0]!==H?(u=M("cursor-pointer hover:bg-muted/50 transition-colors",H),e[0]=H,e[1]=u):u=e[1];const R=t?"gap-3":"gap-4";let h;e[2]!==R?(h=M("flex flex-col h-full relative",R),e[2]=R,e[3]=h):h=e[3];const Z=t?"sm":"md";let g;e[4]!==i||e[5]!==l||e[6]!==Z?(g=a.jsx(O,{icon:l,name:i,size:Z,className:"shadow-sm shrink-0"}),e[4]=i,e[5]=l,e[6]=Z,e[7]=g):g=e[7];const G=t?"text-sm":"text-base";let v;e[8]!==G?(v=M("flex items-center gap-2 font-medium min-w-0",G),e[8]=G,e[9]=v):v=e[9];let j;e[10]!==i?(j=a.jsx("span",{className:"truncate",children:i}),e[10]=i,e[11]=j):j=e[11];let N;e[12]!==t||e[13]!==_?(N=!t&&_&&a.jsx(U,{size:16,className:"text-success shrink-0"}),e[12]=t,e[13]=_,e[14]=N):N=e[14];let C;e[15]!==x||e[16]!==t?(C=!t&&!x&&a.jsx(Y,{size:16,className:"text-muted-foreground shrink-0"}),e[15]=x,e[16]=t,e[17]=C):C=e[17];let k;e[18]!==t||e[19]!==d?(k=t&&d&&a.jsx(re,{protocol:d}),e[18]=t,e[19]=d,e[20]=k):k=e[20];let b;e[21]!==C||e[22]!==k||e[23]!==v||e[24]!==j||e[25]!==N?(b=a.jsx(q,{asChild:!0,children:a.jsxs("div",{className:v,children:[j,N,C,k]})}),e[21]=C,e[22]=k,e[23]=v,e[24]=j,e[25]=N,e[26]=b):b=e[26];let w;e[27]!==i?(w=a.jsx("p",{children:i}),e[27]=i,e[28]=w):w=e[28];let y;e[29]!==x||e[30]!==t?(y=!t&&!x&&a.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[29]=x,e[30]=t,e[31]=y):y=e[31];let I;e[32]!==w||e[33]!==y?(I=a.jsxs(J,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(K,{children:[b,I]}),e[35]=b,e[36]=I,e[37]=$):$=e[37];let L;e[38]!==f||e[39]!==t||e[40]!==p?(L=(p||f)&&a.jsx("div",{className:M("text-muted-foreground truncate",t?"text-xs mt-0.5":"text-sm"),children:p||f}),e[38]=f,e[39]=t,e[40]=p,e[41]=L):L=e[41];let P;e[42]!==$||e[43]!==L?(P=a.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[$,L]})}),e[42]=$,e[43]=L,e[44]=P):P=e[44];let S;e[45]!==P||e[46]!==g?(S=a.jsxs("div",{className:"flex gap-3",children:[g,P]}),e[45]=P,e[46]=g,e[47]=S):S=e[47];let T;e[48]!==n?(T=n&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:n}),e[48]=n,e[49]=T):T=e[49];let E;e[50]!==n||e[51]!==t?(E=!n&&!t&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:"No description available"}),e[50]=n,e[51]=t,e[52]=E):E=e[52];let z;e[53]!==m||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(Q,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(ee,{size:16}),c?"Connecting...":m||"Connect"]}),e[53]=m,e[54]=c,e[55]=t,e[56]=r,e[57]=z):z=e[57];let D;e[58]!==S||e[59]!==T||e[60]!==E||e[61]!==z||e[62]!==h?(D=a.jsxs("div",{className:h,children:[S,T,E,z]}),e[58]=S,e[59]=T,e[60]=E,e[61]=z,e[62]=h,e[63]=D):D=e[63];let A;return e[64]!==r||e[65]!==u||e[66]!==D?(A=a.jsx(se,{className:u,onClick:r,children:D}),e[64]=r,e[65]=u,e[66]=D,e[67]=A):A=e[67],A}function ce(s){const e=s.title||s.server.title||s.id||"Unnamed Item",l=s._meta?.["mcp.mesh"],i=l?.short_description||l?.mesh_description||s.server.description||null,n=s.server.icons?.[0]?.src||le(s.server.repository)||null,r=l?.verified??!1,o=(s.server.remotes?.length??0)>0,t=(s.server.packages?.length??0)>0,f=o||t;let d=e,c=null;if(e.includes("/")){const m=e.split("/");m.length>=2&&(c=m[0]||null,d=ie(e))}if(!c){const m=l?.scopeName,p=l?.appName;m&&p?c=`${m}/${p}`:m&&(c=m)}return l?.friendly_name&&(d=l.friendly_name),{icon:n,scopeName:c,displayName:d,description:i,isVerified:r,canInstall:f}}function je(s){const e=V.c(12),{items:l,title:i,onItemClick:n}=s;if(l.length===0)return null;let r;e[0]!==i?(r=i&&a.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:a.jsx("h2",{className:"text-lg font-medium",children:i})}),e[0]=i,e[1]=r):r=e[1];let o;if(e[2]!==l||e[3]!==n){let d;e[5]!==n?(d=c=>{const m=ce(c);return a.jsx(oe,{...m,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=d):d=e[6],o=l.map(d),e[2]=l,e[3]=n,e[4]=o}else o=e[4];let t;e[7]!==o?(t=a.jsx("div",{className:"grid grid-cols-4 gap-4",children:o}),e[7]=o,e[8]=t):t=e[8];let f;return e[9]!==r||e[10]!==t?(f=a.jsxs("div",{className:"flex flex-col gap-4",children:[r,t]}),e[9]=r,e[10]=t,e[11]=f):f=e[11],f}export{je as M,oe as a,W as b,ie as e};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BgOoHyXW.js","assets/index-BPkoxqog.css","assets/index-C37GOiqD.js","assets/use-collections-CE5nYbrV.js","assets/useMutation-Ngf5wAT3.js","assets/useQuery-BlNmU8Jq.js","assets/constants-G7VjePam.js","assets/use-connection-sLATlyBj.js","assets/use-mcp-prompts-DkUA9eji.js","assets/use-virtual-mcp-XIWHgsHo.js","assets/mcp-oauth-CwgwnIPj.js"])))=>i.map(i=>d[i]);
2
- import{r as F,c as E,j as t,u as he,l as ge,a as ke,f as Le,g as Pe,bm as ce,K as Me,q as Ve,v as de}from"./index-BgOoHyXW.js";import{i as De}from"./AlertCircle-exKB88m_.js";import{i as ve}from"./Loading01--EdyQou6.js";import{P as me}from"./index-DJ2Jm9li.js";import{I as be,E as Ee}from"./empty-state-D1xTHC6z.js";import{B as te,c as Re}from"./button-DZky_O5b.js";import{i as $e,e as Ae}from"./extract-connection-data-ErflmyS5.js";import{t as Be}from"./ChevronDown-DNLmRmxT.js";import{s as fe}from"./Plus-CKeAhIyX.js";import{a as Ue,c as ze,b as Oe,D as Fe}from"./dropdown-menu-ez_4ZmAk.js";import{n as ue}from"./LinkExternal01-pdytjGUU.js";import{T as He,R as Ge}from"./tools-list-DRICPoNu.js";import{R as We}from"./resource-tabs-CVxcKDVM.js";import{s as qe,f as Ke,g as Qe,c as Ye}from"./registry-utils-DJNRhqR6.js";import{a as Xe,b as Ze,e as Je}from"./mcp-server-card-DIRrlGUw.js";import{i as et}from"./Terminal-CRout4QP.js";import{B as tt,a as st,b as pe,d as ot,e as rt,c as nt}from"./breadcrumb-CPuY6F-0.js";import{u as it}from"./use-binding-COwUQLKP.js";import{u as lt}from"./useQuery-BlNmU8Jq.js";import{c as at}from"./use-collections-CE5nYbrV.js";import{a as ct,b as dt,u as mt}from"./use-connection-sLATlyBj.js";import{u as ft}from"./constants-G7VjePam.js";import{u as ut,L as pt}from"./localstorage-keys-D6GRYm3g.js";import{s as xt}from"./slugify-CEUa2lfQ.js";import{e as ht,g as gt}from"./github-icon-Dp3wHhYE.js";import{i as vt}from"./InfoCircle-D-NOn_9O.js";import"./constants-D6nN-s6F.js";import"./generate-id-Dyweu44Y.js";import"./ChevronRight-BOG2FNn-.js";import"./File06-CNHRuvsg.js";import"./collection-table-wrapper-BJq8wZxV.js";import"./ArrowUp-NeI_Sm5E.js";import"./Check-DqzdHNMw.js";import"./Grid01-BGQX-rj4.js";import"./List-DwdxUhFm.js";import"./view-mode-toggle-DC9CalE4.js";import"./table-BM-vLnK2.js";import"./collection-search-76irKOdK.js";import"./SearchMd-BH2aZiBv.js";import"./input-BzaoEOCn.js";import"./card-B7MutzeW.js";import"./layout-CodKePSg.js";import"./badge-CTM0uIWD.js";import"./Lock01-MF1zrVD-.js";import"./binder-Rtvfp3ct.js";import"./useMutation-Ngf5wAT3.js";const je=({size:o=24,color:e="currentColor",...s})=>F.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},F.createElement("path",{d:"m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"}));je.displayName="SearchLg";function bt(o){const e=E.c(3),{message:s}=o,r=s===void 0?"Loading MCP Server details...":s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(ve,{size:48,className:"animate-spin mb-4"}),e[0]=n):n=e[0];let i;return e[1]!==r?(i=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,t.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),e[1]=r,e[2]=i):i=e[2],i}function jt(o){const e=E.c(9),{error:s,onBack:r}=o,n=s instanceof Error?s.message:s;let i,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(De,{size:48,className:"text-destructive mb-4"}),c=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading MCP Server"}),e[0]=i,e[1]=c):(i=e[0],c=e[1]);let u;e[2]!==n?(u=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:n}),e[2]=n,e[3]=u):u=e[3];let d;e[4]!==r?(d=t.jsx("button",{onClick:r,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back"}),e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==u||e[7]!==d?(m=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,c,u,d]}),e[6]=u,e[7]=d,e[8]=m):m=e[8],m}function yt(o){const e=E.c(5),{onBack:s}=o;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(je,{size:48,className:"text-muted-foreground mb-4"}),n=t.jsx("h3",{className:"text-lg font-medium mb-2",children:"MCP Server not found"}),i=t.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"The MCP Server you're looking for doesn't exist in this store."}),e[0]=r,e[1]=n,e[2]=i):(r=e[0],n=e[1],i=e[2]);let c;return e[3]!==s?(c=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,n,i,t.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back to Store"})]}),e[3]=s,e[4]=c):c=e[4],c}function Nt(o){const e=E.c(2),{breadcrumb:s}=o;let r;return e[0]!==s?(r=t.jsx(me.Header,{children:t.jsx(me.Header.Left,{children:s})}),e[0]=s,e[1]=r):r=e[1],r}function xe(o){const e=E.c(28),{versions:s,selectedIndex:r,onSelect:n,isInstalling:i,variant:c,showLabel:u}=o,d=i===void 0?!1:i,m=c===void 0?"brand":c,I=u===void 0?!1:u,p=s[r],C=I?"sm":"default",j=m==="brand"&&"rounded-l-none px-2 border-l-2 border-l-white/50";let y;e[0]!==j?(y=Re("shrink-0 cursor-pointer",j),e[0]=j,e[1]=y):y=e[1];let f;e[2]!==p?.server?.version||e[3]!==I?(f=I&&t.jsxs("span",{className:"mr-1",children:["v",p?.server?.version||"unknown"]}),e[2]=p?.server?.version,e[3]=I,e[4]=f):f=e[4];const N=I?14:20;let h;e[5]!==N?(h=t.jsx(Be,{size:N}),e[5]=N,e[6]=h):h=e[6];let x;e[7]!==d||e[8]!==C||e[9]!==y||e[10]!==f||e[11]!==h||e[12]!==m?(x=t.jsx(Ue,{asChild:!0,children:t.jsxs(te,{variant:m,disabled:d,size:C,className:y,children:[f,h]})}),e[7]=d,e[8]=C,e[9]=y,e[10]=f,e[11]=h,e[12]=m,e[13]=x):x=e[13];let g;if(e[14]!==d||e[15]!==n||e[16]!==r||e[17]!==s){let S;e[19]!==d||e[20]!==n||e[21]!==r?(S=(v,b)=>{const P=v._meta?.["io.modelcontextprotocol.registry/official"];return t.jsx(ze,{onClick:()=>n(b),disabled:d,className:"cursor-pointer",children:t.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"font-medium text-sm",children:["v",v.server?.version||"unknown"]}),P?.isLatest&&t.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),b===r&&t.jsx($e,{size:16,className:"text-muted-foreground shrink-0"})]})},b)},e[19]=d,e[20]=n,e[21]=r,e[22]=S):S=e[22],g=s.map(S),e[14]=d,e[15]=n,e[16]=r,e[17]=s,e[18]=g}else g=e[18];let _;e[23]!==g?(_=t.jsx(Oe,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:g}),e[23]=g,e[24]=_):_=e[24];let w;return e[25]!==x||e[26]!==_?(w=t.jsxs(Fe,{children:[x,_]}),e[25]=x,e[26]=_,e[27]=w):w=e[27],w}function St(o){const e=E.c(46),{data:s,itemVersions:r,onInstall:n,canInstall:i,isInstalling:c,hideInstallControls:u,selectedVersionIndex:d,onVersionChange:m}=o,I=i===void 0?!0:i,p=c===void 0?!1:c,C=u===void 0?!1:u,[j,y]=F.useState(0),f=d??j;let N;e[0]!==m?(N=B=>{y(B),m?.(B)},e[0]=m,e[1]=N):N=e[1];const h=N,x=r[f]||r[0];let g;e[2]!==x?.server?.remotes?(g=x?.server?.remotes??[],e[2]=x?.server?.remotes,e[3]=g):g=e[3];const _=g;let w;e[4]!==x?.server?.packages?(w=x?.server?.packages??[],e[4]=x?.server?.packages,e[5]=w):w=e[5];const v=w.length>0,b=_.length>0,P=_.findIndex(wt),a=P>=0?P:0;let M;e[6]!==a||e[7]!==v||e[8]!==b||e[9]!==n||e[10]!==f?(M=()=>{b?n(f,a,void 0):v&&n(f,void 0,0)},e[6]=a,e[7]=v,e[8]=b,e[9]=n,e[10]=f,e[11]=M):M=e[11];const V=M;let H;e[12]!==r||e[13]!==n||e[14]!==h?(H=B=>{h(B);const X=r[B],Z=X?.server?.remotes??[],se=X?.server?.packages??[];if(Z.length>0){const J=Z.findIndex(Ct);n(B,J>=0?J:0,void 0)}else se.length>0&&n(B,void 0,0)},e[12]=r,e[13]=n,e[14]=h,e[15]=H):H=e[15];const K=H;let $;e[16]!==s.icon||e[17]!==s.name?($=t.jsx(be,{icon:s.icon,name:s.name,size:"lg",className:"shrink-0 shadow-sm"}),e[16]=s.icon,e[17]=s.name,e[18]=$):$=e[18];let k;e[19]!==s.name?(k=t.jsx("h1",{className:"text-3xl font-medium",children:s.name}),e[19]=s.name,e[20]=k):k=e[20];let T;e[21]!==s.verified?(T=s.verified&&t.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[21]=s.verified,e[22]=T):T=e[22];let A;e[23]!==k||e[24]!==T?(A=t.jsxs("div",{className:"flex items-center gap-2",children:[k,T]}),e[23]=k,e[24]=T,e[25]=A):A=e[25];let D;e[26]!==s.shortDescription?(D=s.shortDescription&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.shortDescription}),e[26]=s.shortDescription,e[27]=D):D=e[27];let U;e[28]!==A||e[29]!==D?(U=t.jsxs("div",{className:"flex-1 min-w-0",children:[A,D]}),e[28]=A,e[29]=D,e[30]=U):U=e[30];let z;e[31]!==I||e[32]!==V||e[33]!==K||e[34]!==C||e[35]!==p||e[36]!==r||e[37]!==f||e[38]!==h?(z=I&&!C?t.jsx("div",{className:"shrink-0 flex items-center gap-2",children:r.length>1?t.jsxs("div",{className:"flex",children:[t.jsxs(te,{variant:"brand",onClick:V,disabled:p,className:"shrink-0 rounded-r-none cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]}),t.jsx(xe,{versions:r,selectedIndex:f,onSelect:K,isInstalling:p,variant:"brand"})]}):t.jsxs(te,{variant:"brand",onClick:V,disabled:r.length===0||p,className:"shrink-0 cursor-pointer",children:[t.jsx(fe,{size:20}),p?"Connecting...":"Connect"]})}):C?r.length>1?t.jsx("div",{className:"shrink-0",children:t.jsx(xe,{versions:r,selectedIndex:f,onSelect:h,isInstalling:p,variant:"outline",showLabel:!0})}):null:t.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[31]=I,e[32]=V,e[33]=K,e[34]=C,e[35]=p,e[36]=r,e[37]=f,e[38]=h,e[39]=z):z=e[39];let O;e[40]!==U||e[41]!==z?(O=t.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[U,z]}),e[40]=U,e[41]=z,e[42]=O):O=e[42];let G;return e[43]!==O||e[44]!==$?(G=t.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[$,O]}),e[43]=O,e[44]=$,e[45]=G):G=e[45],G}function Ct(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function wt(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function It(o){if(!o)return"—";try{const e=new Date(o);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function _t(o){const e=E.c(47),{data:s,publisherInfo:r,selectedItem:n}=o;let i;e[0]!==s.description?(i=s.description&&t.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[t.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.description})]}),e[0]=s.description,e[1]=i):i=e[1];const c=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher;let u;e[2]!==r.logo||e[3]!==c?(u=t.jsx(be,{icon:r.logo,name:c,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=r.logo,e[3]=c,e[4]=u):u=e[4];let d;e[5]!==s.publisher?(d=s.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":s.publisher.charAt(0).toUpperCase()+s.publisher.slice(1),e[5]=s.publisher,e[6]=d):d=e[6];let m;e[7]!==d?(m=t.jsx("div",{className:"font-medium",children:d}),e[7]=d,e[8]=m):m=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"text-xs text-muted-foreground",children:"Publisher"}),e[9]=I):I=e[9];let p;e[10]!==m?(p=t.jsxs("div",{children:[m,I]}),e[10]=m,e[11]=p):p=e[11];let C;e[12]!==u||e[13]!==p?(C=t.jsx("div",{className:"px-5 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-3 py-5",children:[u,p]})}),e[12]=u,e[13]=p,e[14]=C):C=e[14];let j;e[15]!==s.version?(j=s.version&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Version"}),t.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",s.version]})]}),e[15]=s.version,e[16]=j):j=e[16];let y;e[17]!==s.tags?(y=s.tags&&s.tags.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.tags.map(kt)})]}),e[17]=s.tags,e[18]=y):y=e[18];let f;e[19]!==s.categories?(f=s.categories&&s.categories.length>0&&t.jsxs("div",{className:"flex justify-between items-start text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Categories"}),t.jsx("div",{className:"flex flex-wrap gap-1 justify-end max-w-[60%]",children:s.categories.map(Tt)})]}),e[19]=s.categories,e[20]=f):f=e[20];let N;e[21]!==s.connectionType?(N=s.connectionType&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:s.connectionType})]}),e[21]=s.connectionType,e[22]=N):N=e[22];let h;e[23]!==s.schemaVersion?(h=s.schemaVersion&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),t.jsx("span",{className:"text-muted-foreground text-xs",children:s.schemaVersion})]}),e[23]=s.schemaVersion,e[24]=h):h=e[24];let x;e[25]!==s.websiteUrl?(x=s.websiteUrl&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Website"}),t.jsxs("a",{href:s.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"Visit"}),t.jsx(ue,{size:14})]})]}),e[25]=s.websiteUrl,e[26]=x):x=e[26];let g;e[27]!==s.repository?(g=s.repository?.url&&t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-foreground text-sm",children:"Source"}),t.jsxs("a",{href:s.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[t.jsx("span",{children:"GitHub"}),t.jsx(ue,{size:14})]})]}),e[27]=s.repository,e[28]=g):g=e[28];let _;e[29]!==y||e[30]!==f||e[31]!==N||e[32]!==h||e[33]!==x||e[34]!==g||e[35]!==j?(_=t.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[j,y,f,N,h,x,g]}),e[29]=y,e[30]=f,e[31]=N,e[32]=h,e[33]=x,e[34]=g,e[35]=j,e[36]=_):_=e[36];let w;e[37]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[37]=w):w=e[37];let S;e[38]!==n.updated_at?(S=It(n.updated_at),e[38]=n.updated_at,e[39]=S):S=e[39];let v;e[40]!==S?(v=t.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[w,t.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:S})]}),e[40]=S,e[41]=v):v=e[41];let b;return e[42]!==i||e[43]!==_||e[44]!==v||e[45]!==C?(b=t.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,C,_,v]}),e[42]=i,e[43]=_,e[44]=v,e[45]=C,e[46]=b):b=e[46],b}function Tt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}function kt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}const Lt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],Pt={docs:"Documentation",bindings:"Workers Bindings",builds:"Workers Builds",observability:"Observability",radar:"Radar",containers:"Containers",browser:"Browser Rendering",logs:"Logpush",autorag:"AutoRAG",auditlogs:"Audit Logs",graphql:"GraphQL",dex:"DEX Monitoring",casb:"CASB"};function Mt(o){if(!o)return"Local";try{return new URL(o).hostname}catch{return o}}function Vt(o){if(!o)return"local";try{const e=new URL(o).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function Dt(o){const e=Pt[o.toLowerCase()];return e||o.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Et(o){if(!o)return"http";const e=o.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function Rt(o){return o.map((e,s)=>{const r=Et(e.type),n=Mt(e.url),i=Vt(e.url),c=e.title||e.name||Dt(i);return{index:s,protocol:r,url:e.url,hostname:n,serviceName:i,displayName:c,name:e.name,title:e.title,description:e.description,_type:e._type,_index:e._index}})}function $t(o){const e=E.c(2),{protocol:s,className:r}=o;let n;return e[0]!==r?(n={http:t.jsx(qe,{className:r}),sse:t.jsx(Ze,{className:r}),stdio:t.jsx(et,{className:r})},e[0]=r,e[1]=n):n=e[1],n[s]}function At(o){const e=E.c(10),{options:s,selected:r,onSelect:n}=o;if(s.length<=1)return null;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"text-sm text-muted-foreground",children:"Protocol:"}),e[0]=i):i=e[0];let c;if(e[1]!==n||e[2]!==s||e[3]!==r){let d;e[5]!==n||e[6]!==r?(d=m=>t.jsxs(te,{variant:r===m.value?"default":"outline",size:"sm",onClick:()=>n(m.value),className:"cursor-pointer",children:[t.jsx($t,{protocol:m.value==="all"?"http":m.value,className:"w-4 h-4 mr-1"}),m.label]},m.value),e[5]=n,e[6]=r,e[7]=d):d=e[7],c=s.map(d),e[1]=n,e[2]=s,e[3]=r,e[4]=c}else c=e[4];let u;return e[8]!==c?(u=t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i,t.jsx("div",{className:"flex gap-1",children:c})]}),e[8]=c,e[9]=u):u=e[9],u}function Bt(o){const e=E.c(11),{servers:s,onInstall:r,isInstalling:n,icon:i,mcpName:c,showStdio:u}=o,d=n===void 0?!1:n,m=u===void 0?!1:u,I=m?s:s.filter(Ft),p=Rt(I),C=p.length<13?"all":"http",[j,y]=F.useState(C);let f;e:{if(j==="all"){f="all";break e}let a;if(e[0]!==j?(a=V=>V.protocol===j,e[0]=j,e[1]=a):a=e[1],p.some(a)){f=j;break e}if(p.length<13){f="all";break e}f=p[0]?.protocol??"http"}const N=f,h=N==="all"?p:p.filter(a=>a.protocol===N),x=new Set(p.map(Ot));let g=Lt.filter(a=>a.value==="all"||x.has(a.value));m||(g=g.filter(zt));const _=x.size<=1?g.filter(Ut):g,w="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4";let S;e[2]!==i||e[3]!==d||e[4]!==c||e[5]!==r?(S=a=>t.jsx(Xe,{variant:"server",icon:i??null,displayName:a.displayName,description:a.description??null,hostname:a.hostname,protocol:a.protocol,isInstalling:d,onClick:()=>r({type:a.protocol,url:a.url,name:a.name,title:a.title,description:a.description,_type:a._type,_index:a._index})},`${a.hostname}-${a.protocol}-${a.index}`),e[2]=i,e[3]=d,e[4]=c,e[5]=r,e[6]=S):S=e[6];const v=h.map(S);let b;e[7]!==v?(b=t.jsx("div",{className:w,children:v}),e[7]=v,e[8]=b):b=e[8];let P;return e[9]!==h.length?(P=h.length===0&&t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No servers match the selected filter."}),e[9]=h.length,e[10]=P):P=e[10],t.jsxs("div",{className:"p-5",children:[t.jsx(At,{options:_,selected:N,onSelect:y}),b,P]})}function Ut(o){return o.value!=="all"}function zt(o){return o.value!=="stdio"}function Ot(o){return o.protocol}function Ft(o){return o.type?.toLowerCase()!=="stdio"}function Ht(o){const e=E.c(29),{data:s,availableTabs:r,effectiveActiveTabId:n,effectiveTools:i,isLoadingTools:c,onTabChange:u,servers:d,onInstallServer:m,isInstalling:I,mcpIcon:p,mcpName:C,showStdio:j}=o,y=c===void 0?!1:c;let f;e[0]!==d?(f=d===void 0?[]:d,e[0]=d,e[1]=f):f=e[1];const N=f,h=I===void 0?!1:I,x=j===void 0?!1:j;let g;e[2]!==i?(g=i.map(Gt),e[2]=i,e[3]=g):g=e[3];const _=g;let w;e[4]!==r||e[5]!==n||e[6]!==u?(w=r.length>0&&t.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:t.jsx(We,{tabs:r,activeTab:n,onTabChange:u})}),e[4]=r,e[5]=n,e[6]=u,e[7]=w):w=e[7];let S;e[8]!==n||e[9]!==h||e[10]!==p||e[11]!==C||e[12]!==m||e[13]!==N||e[14]!==x?(S=n==="servers"&&N.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(Bt,{servers:N,onInstall:a=>m?.(a),isInstalling:h,icon:p,mcpName:C,showStdio:x})}),e[8]=n,e[9]=h,e[10]=p,e[11]=C,e[12]=m,e[13]=N,e[14]=x,e[15]=S):S=e[15];let v;e[16]!==n||e[17]!==i.length||e[18]!==y||e[19]!==_?(v=n==="tools"&&t.jsx("div",{className:"flex flex-col flex-1",children:y?t.jsxs("div",{className:"flex items-center justify-center p-8",children:[t.jsx(ve,{size:24,className:"animate-spin"}),t.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?t.jsx(He,{tools:_,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):t.jsx(Ee,{image:null,title:"No tools available",description:"This MCP Server doesn't have any tools."})}),e[16]=n,e[17]=i.length,e[18]=y,e[19]=_,e[20]=v):v=e[20];let b;e[21]!==s?.repository||e[22]!==n?(b=n==="readme"&&t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(Ge,{repository:s?.repository})}),e[21]=s?.repository,e[22]=n,e[23]=b):b=e[23];let P;return e[24]!==b||e[25]!==w||e[26]!==S||e[27]!==v?(P=t.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[w,S,v,b]}),e[24]=b,e[25]=w,e[26]=S,e[27]=v,e[28]=P):P=e[28],P}function Gt(o){const e=o;return{name:e.name||"",description:e.description||void 0}}function Wt(o,e){if(!o||!e)return;const s=e.toLowerCase();return o.find(r=>r.app_name?.toLowerCase()===s||r.app_id?.toLowerCase()===s||r.title.toLowerCase()===s)||o.find(r=>r.title.toLowerCase().includes(s))}function qt(o,e,s,r,n){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:r?.icon||void 0,count:n??o.length};const i=e.toLowerCase(),c=o.filter(d=>(d._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":d.publisher||d._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:s?.icon||c[0]?.publisher_logo||c[0]?.icon||void 0,count:c.length}}function Kt(o){const e=o._meta?.["mcp.mesh"],s=o._meta?.["io.modelcontextprotocol.registry/official"],r=o.server,n=Qe(r.remotes?.[0]?.type),i=Ye(r.$schema),c=s?"io.modelcontextprotocol.registry/official":o.publisher||e?.scopeName||"Unknown",u=gt(r.repository),d=o.icon||o.image||o.logo||r.icons?.[0]?.src||u||null,m=o.name||o.title||o.server?.title||"Unnamed Item",I=Je(m),p=e?.friendly_name||I,C=e?.mesh_description||o.description||o.summary||r?.description||"",j=e?.short_description||null,y=e?.tags||[],f=e?.categories||[];return{name:p,description:C,shortDescription:j,icon:d,verified:o.verified||e?.verified,publisher:c,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:i??null,connectionType:n,connectionUrl:null,remoteUrl:null,tags:y,categories:f,tools:o.tools||r.tools||e?.tools||[],models:o.models||r.models||e?.models||[],emails:o.emails||r.emails||e?.emails||[],analytics:o.analytics||r.analytics||e?.analytics,cdn:o.cdn||r.cdn||e?.cdn}}class Qt extends F.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,s){console.error("Store MCP server detail error:",e,s)}render(){return this.state.hasError?t.jsx(jt,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function Yt(){const{org:o}=he(),e=ge(),{appName:s}=ke({strict:!1}),{registryId:r,serverName:n,stdio:i}=Le({strict:!1}),[c,u]=ut(pt.storeShowStdio(),()=>!1),d=i==="true"?!0:i==="false"?!1:c;i!==void 0&&i==="true"!==c&&u(i==="true");const[m,I]=F.useState(null),[p,C]=F.useState(null),j=ct(),y=dt(),{data:f}=Pe.useSession(),N=it(y),h=r||N[0]?.id||"",x=mt(h),g=Ke(x?.tools),_=x?.tools&&x.tools.find(L=>L.name.endsWith("_VERSIONS"))?.name||"",w=x?.tools&&x.tools.find(L=>L.name.endsWith("_GET"))?.name||"",S=!!n;let v="",b={};S?(v=_||w,b={name:n}):(v=g,b={});const P=ft({connectionId:h||null,orgId:o.id}),{data:a}=at({client:P,toolName:v,toolArguments:b,select:l=>l.structuredContent??l});let M=[],V=[],H=null;if(a){if(Array.isArray(a))M=a;else if(typeof a=="object"&&a!==null)if("totalCount"in a&&typeof a.totalCount=="number"&&(H=a.totalCount),"item"in a&&a.item){const l=a.item;M=[{id:l.id||"",title:l.title,server:l.server,_meta:l._meta}]}else{let l;"versions"in a&&Array.isArray(a.versions)?l="versions":"servers"in a&&Array.isArray(a.servers)?l="servers":l=Object.keys(a).find(L=>Array.isArray(a[L])),l&&(M=a[l],(l==="versions"||v?.includes("VERSIONS"))&&(V=M))}}const K=(()=>{const l=V.findIndex(L=>L._meta?.["io.modelcontextprotocol.registry/official"]?.isLatest===!0);return l>=0?l:0})(),$=p??K;let k=M.find(l=>{const L=l.name||l.title||l.server.title||"";return xt(L)===s});!k&&n&&(k=M.find(l=>l.server.name===n||l.name===n||l.title===n));const T=k?Kt(k):null,A=(T?.tools?.length||0)>0,D=k?.server?.remotes?.[0]?.url||null,U=!A&&!!D,z=lt({queryKey:Me.remoteMcpTools(D),queryFn:async()=>{if(!D)return[];const{Client:l}=await ce(async()=>{const{Client:R}=await import("./index-BgOoHyXW.js").then(q=>q.cp);return{Client:R}},__vite__mapDeps([0,1])),{StreamableHTTPClientTransport:L}=await ce(async()=>{const{StreamableHTTPClientTransport:R}=await import("./index-C37GOiqD.js");return{StreamableHTTPClientTransport:R}},__vite__mapDeps([2,0,1,3,4,5,6,7,8,9,10])),W=new l({name:"mesh-store",version:"1.0.0"}),ee=new L(new URL(D),{requestInit:{headers:{Accept:"application/json, text/event-stream","Content-Type":"application/json"}}});try{return await W.connect(ee),((await W.listTools()).tools||[]).map(q=>({name:q.name,description:q.description}))}finally{await W.close().catch(console.error)}},enabled:U}),O=U&&z.isLoading,G=z.data??[],B=A?T?.tools||[]:G,X=Wt(y,T?.publisher),Z=T?qt(M,T.publisher,X,x??null,H):{count:0},se=T?.repository?ht(T.repository):null,ne=k?.server?.remotes??[],J=k?.server?.packages??[],oe=[...ne.map((l,L)=>({...l,_type:"remote",_index:L})),...J.map((l,L)=>({type:"stdio",url:void 0,name:l.name||l.identifier,title:l.name||l.identifier?.replace(/^@[^/]+\//,""),description:l.environmentVariables?.length?`Requires ${l.environmentVariables.length} environment variable(s)`:void 0,_type:"package",_index:L}))],ie=d?oe:oe.filter(l=>l.type?.toLowerCase()!=="stdio"),le=ie.length>1,Q=[{id:"servers",label:"Servers",count:ie.length,visible:le},{id:"readme",label:"README",visible:!!T?.repository&&!!se},{id:"tools",label:"Tools",count:B.length,visible:A||G.length>0||O&&!!D}].filter(l=>l.visible),ye=Q.find(l=>l.id==="servers")?.id||Q.find(l=>l.id==="readme")?.id||Q[0]?.id||"overview",Ne=m&&Q.find(l=>l.id===m)?m:ye,re=async(l,L,W)=>{const ee=V[l??0]||k;if(!ee||!o||!f?.user?.id)return;const R=Ae(ee,o.id,f.user.id,{remoteIndex:W===void 0?L??0:void 0,packageIndex:W}),q=R.connection_type==="STDIO",_e=!!R.connection_url,Te=q&&R.connection_headers&&typeof R.connection_headers=="object"&&"command"in R.connection_headers;if(!_e&&!Te){de.error("This MCP Server cannot be connected: no connection method available");return}try{const{id:Y}=await j.create.mutateAsync(R);e({to:"/$org/mcps/$connectionId",params:{org:o.slug,connectionId:Y}})}catch(Y){de.error(`Failed to connect MCP Server: ${Y instanceof Error?Y.message:String(Y)}`)}},Se=()=>{e({to:"/$org/store",params:{org:o.slug}})};if(!k)return t.jsx(yt,{onBack:Se});if(!T)return null;const Ce=(k?.server?.remotes?.length??0)>0,we=(k?.server?.packages?.length??0)>0,ae=Ce||we,Ie=t.jsx(tt,{children:t.jsxs(st,{children:[t.jsx(pe,{children:t.jsx(ot,{asChild:!0,children:t.jsx(Ve,{to:"/$org/store",params:{org:o.slug},children:"Store"})})}),t.jsx(rt,{}),t.jsx(pe,{children:t.jsx(nt,{children:T.name})})]})});return t.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[t.jsx(Nt,{breadcrumb:Ie}),t.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.jsx("div",{className:"h-full",children:t.jsxs("div",{className:"h-full",children:[!ae&&t.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[t.jsx(vt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t.jsx(St,{data:T,itemVersions:V.length>0?V:[k],onInstall:re,canInstall:ae,isInstalling:j.create.isPending,hideInstallControls:le,selectedVersionIndex:$,onVersionChange:C}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[t.jsx(_t,{data:T,publisherInfo:Z,selectedItem:k}),t.jsx(Ht,{data:T,availableTabs:Q,effectiveActiveTabId:Ne,effectiveTools:B,isLoadingTools:O,onTabChange:I,servers:oe,onInstallServer:l=>{l._type==="remote"?re($,l._index,void 0):re($,void 0,l._index)},isInstalling:j.create.isPending,mcpIcon:T.icon,mcpName:T.name,showStdio:d})]})]})})})]})}function Fs(){const o=E.c(6),{org:e}=he(),s=ge();let r;o[0]!==s||o[1]!==e.slug?(r=()=>{s({to:"/$org/store",params:{org:e.slug}})},o[0]=s,o[1]=e.slug,o[2]=r):r=o[2];const n=r;let i;o[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(F.Suspense,{fallback:t.jsx(bt,{}),children:t.jsx(Yt,{})}),o[3]=i):i=o[3];let c;return o[4]!==n?(c=t.jsx(Qt,{onBack:n,children:i}),o[4]=n,o[5]=c):c=o[5],c}export{Fs as default};
@@ -1,3 +0,0 @@
1
- import{r as D,c as ae,j as t,p as $t,u as Ne,g as se,K as le,o as pt,n as tt,s as ue,b8 as Ft,be as Gt,a1 as Xe,k as Ot,h as Kt,v as te,x as Qt}from"./index-BgOoHyXW.js";import{C as qt,a as Ht}from"./collection-table-wrapper-BJq8wZxV.js";import{C as ke}from"./collection-search-76irKOdK.js";import{P as fe}from"./index-DJ2Jm9li.js";import{B as Zt,a as Yt,b as Xt,c as Jt}from"./breadcrumb-CPuY6F-0.js";import{I as wt,b as Te,c as Se,T as ye,a as Ie,E as st}from"./empty-state-D1xTHC6z.js";import{C as dt}from"./checkbox-FfI3AO16.js";import{c as K,B as ee}from"./button-DZky_O5b.js";import{b as At}from"./use-connection-sLATlyBj.js";import{u as mt}from"./use-members-Bohb_YFO.js";import{u as Rt}from"./useQuery-BlNmU8Jq.js";import{u as he}from"./useMutation-Ngf5wAT3.js";import{A as ve}from"./avatar-BKY-flI3.js";import{B as Oe}from"./badge-CTM0uIWD.js";import{f as we,a as Ae,b as Re,c as _e,d as Le,e as Pe,A as Me,g as De}from"./alert-dialog-CAM8sgWL.js";import{D as _t,f as Lt,a as Pt,b as Wt,c as es,e as ts}from"./dialog-BfMrinrm.js";import{D as ut,a as ft,b as ht,c as Ze,d as ss,e as ns,f as rs,g as is}from"./dropdown-menu-ez_4ZmAk.js";import{i as os}from"./DotsHorizontal-r_tIL4Ov.js";import{i as Mt}from"./Loading01--EdyQou6.js";import{i as ls}from"./Lock01-MF1zrVD-.js";import{s as rt}from"./Plus-CKeAhIyX.js";import{s as Dt}from"./Trash01-DWmC_leT.js";import{i as bt}from"./X-DPo-5hWo.js";import{I as as}from"./input-BzaoEOCn.js";import{S as Ke}from"./switch-CtUEm8Xv.js";import{E as cs}from"./error-boundary-gLETJlNI.js";import{a as ds,F as Ct,b as jt,c as ms,d as vt,f as Nt}from"./form-BmYBK--9.js";import{S as it,a as ot,b as lt,c as at,d as ct}from"./select-iwsI8D5M.js";import{T as us}from"./textarea-DKyvCB8I.js";import{a as fs,u as hs}from"./constants-G7VjePam.js";import{C as Et}from"./card-B7MutzeW.js";import{i as kt}from"./DotsVertical-BeH4d2j5.js";import{i as gs}from"./Key01-B8mXK7o_.js";import{s as xs}from"./XClose-BgTbSIyK.js";import"./ArrowUp-NeI_Sm5E.js";import"./Check-DqzdHNMw.js";import"./Grid01-BGQX-rj4.js";import"./List-DwdxUhFm.js";import"./view-mode-toggle-DC9CalE4.js";import"./table-BM-vLnK2.js";import"./SearchMd-BH2aZiBv.js";import"./ChevronRight-BOG2FNn-.js";import"./use-collections-CE5nYbrV.js";import"./ChevronDown-DNLmRmxT.js";const zt=({size:s=24,color:e="currentColor",...n})=>D.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},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));zt.displayName="ArrowLeft";const gt=({size:s=24,color:e="currentColor",...n})=>D.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},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));gt.displayName="Shield01";const Ut=({size:s=24,color:e="currentColor",...n})=>D.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},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));Ut.displayName="SwitchHorizontal01";const Bt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"}],ps={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages"};function bs(){const s={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Bt)s[e.category]?.push(e);return s}function Cs(){return Bt.map(s=>({value:s.name,label:ps[s.name],dangerous:s.dangerous}))}const js=D.memo(function(e){const n=ae.c(21),{connection:r,isSelected:a,hasToolsEnabled:o,activeToolsCount:m,totalToolsCount:l,onSelect:x,onToggle:j}=e,h=a?"bg-accent/50":"hover:bg-muted/50";let v;n[0]!==h?(v=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=v):v=n[1];let c;n[2]!==r.icon||n[3]!==r.title?(c=t.jsx(wt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=c):c=n[4];let N;n[5]!==r.title?(N=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=N):N=n[6];let u;n[7]!==x||n[8]!==c||n[9]!==N?(u=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:x,children:[c,N]}),n[7]=x,n[8]=c,n[9]=N,n[10]=u):u=n[10];let b;n[11]!==m||n[12]!==r.tools||n[13]!==o||n[14]!==j||n[15]!==l?(b=r.tools&&r.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[m,"/",l]}),t.jsx(dt,{checked:o,onCheckedChange:j,onClick:Es})]}),n[11]=m,n[12]=r.tools,n[13]=o,n[14]=j,n[15]=l,n[16]=b):b=n[16];let p;return n[17]!==v||n[18]!==u||n[19]!==b?(p=t.jsxs("div",{className:v,children:[u,b]}),n[17]=v,n[18]=u,n[19]=b,n[20]=p):p=n[20],p}),vs=D.memo(function(e){const n=ae.c(18),{connectionId:r,tool:a,isSelected:o,onToggle:m}=e,l=`tool-${r}-${a.name}`,x=o?"text-foreground":"text-muted-foreground";let j;n[0]!==x?(j=K("text-sm font-medium",x),n[0]=x,n[1]=j):j=n[1];let h;n[2]!==j||n[3]!==a.name?(h=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:j,children:a.name})}),n[2]=j,n[3]=a.name,n[4]=h):h=n[4];let v;n[5]!==a.description?(v=a.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),n[5]=a.description,n[6]=v):v=n[6];let c;n[7]!==h||n[8]!==v?(c=t.jsxs("div",{className:"flex-1 min-w-0",children:[h,v]}),n[7]=h,n[8]=v,n[9]=c):c=n[9];const N=`tool-${r}-${a.name}`;let u;n[10]!==o||n[11]!==m||n[12]!==N?(u=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(dt,{id:N,checked:o,onCheckedChange:m,onClick:Ts})}),n[10]=o,n[11]=m,n[12]=N,n[13]=u):u=n[13];let b;return n[14]!==l||n[15]!==c||n[16]!==u?(b=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:l,children:[c,u]}),n[14]=l,n[15]=c,n[16]=u,n[17]=b):b=n[17],b});function Ns({toolSet:s,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,a]=D.useState(""),o=D.useDeferredValue(r),[m,l]=D.useState("all"),[x,j]=D.useState(!1),h=D.useRef(new Set(Object.keys(s))),v=At({searchTerm:o.trim()||void 0}),c=n?v.filter(d=>d.connection_type!=="VIRTUAL"?!0:$t(d.connection_url)!==n):v,N=h.current,u=[...N.values()].map(d=>c.find(S=>S.id===d)).filter(d=>d!==void 0),b=c.filter(d=>!N.has(d.id)),p=[...u,...b],y=d=>{const S=s[d];return S!==void 0&&S.length>0},C=p.filter(d=>{if(m==="all")return!0;const S=y(d.id);return m==="selected"?S:m==="unselected"?!S:!0}),[f,I]=D.useState(p[0]?.id??null),T=f?p.find(d=>d.id===f)??null:null,P=T?.tools??[],A=(d,S)=>s[d]?.includes(S)??!1,_=(d,S)=>{const E=s[d]??[],g=E.includes(S),L={...s};if(g){const z=E.filter(F=>F!==S);z.length===0?delete L[d]:L[d]=z}else L[d]=[...E,S];e(L)},R=d=>{const S=p.find(F=>F.id===d);if(!S?.tools)return;const E=s[d]??[],g=S.tools.map(F=>F.name),L=E.length>0&&g.every(F=>E.includes(F)),z={...s};L?delete z[d]:(z[d]=g,I(d)),e(z)},k=d=>{I(d),j(!0)},w=()=>{j(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",x&&"hidden md:flex"),children:[t.jsx(ke,{value:r,onChange:a,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>l("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>l("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>l("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:C.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:C.map(d=>{const S=d.tools?.length??0,E=s[d.id]?.length??0;return t.jsx(js,{connection:d,isSelected:f===d.id,hasToolsEnabled:y(d.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>k(d.id),onToggle:()=>R(d.id)},d.id)})})})]}),t.jsx("div",{className:K("flex-1 flex-col",x?"flex":"hidden md:flex"),children:T?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(ee,{variant:"ghost",size:"sm",onClick:w,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(zt,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(wt,{icon:T.icon,name:T.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:T.title}),T.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:P.map(d=>t.jsx(vs,{connectionId:T.id,tool:d,isSelected:A(T.id,d.name),onToggle:()=>_(T.id,d.name)},d.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Es(s){return s.stopPropagation()}function Ts(s){return s.stopPropagation()}const Tt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Ss(s){return s.replace(/-/g," ")}function ys(s){if(!s)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let a=!1;const o=new Set;let m=!1;for(const[l,x]of Object.entries(s)){if(l==="self"){x.includes("*")?n=!0:e.push(...x);continue}if(l==="*"){if(a=!0,x.includes("*"))m=!0;else for(const j of x)o.add(j);continue}if(r.push(l),x.includes("*"))m=!0;else for(const j of x)o.add(j)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:a,toolNames:Array.from(o),allowsAllTools:m}}function xt(){const{locator:s}=Ne(),{data:e,isLoading:n,error:r,refetch:a}=Rt({queryKey:le.organizationRoles(s),queryFn:async()=>{try{const l=await se.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}),o=Tt.map(l=>({role:l.value,label:l.label,isBuiltin:l.isBuiltin}));if(e&&Array.isArray(e))for(const l of e){const x=l.role;if(!x||Tt.some(b=>b.value===x))continue;const{staticPermissions:j,allowsAllStaticPermissions:h,connectionIds:v,allowsAllConnections:c,toolNames:N,allowsAllTools:u}=ys(l.permission);o.push({id:l.id,role:x,label:Ss(x),isBuiltin:!1,permission:l.permission??void 0,staticPermissionCount:h?-1:j.length,allowsAllStaticPermissions:h,connectionCount:c?-1:v.length,allowsAllConnections:c,toolCount:u?-1:N.length,allowsAllTools:u})}const m=o.filter(l=>!l.isBuiltin);return{roles:o,customRoles:m,builtinRoles:o.filter(l=>l.isBuiltin),isLoading:n,error:r,refetch:a}}const Is=pt({role:pt({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:Gt(),staticPermissions:tt(ue()),toolSet:Ft(ue(),tt(ue())),memberIds:tt(ue())});function Vt(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Os=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],nt=["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 ws(s){if(!s)return"bg-neutral-400";let e=0;for(let r=0;r<s.length;r++){const a=s.charCodeAt(r);e=(e<<5)-e+a,e=e&e}const n=Math.abs(e)%nt.length;return nt[n]??nt[0]}function Qe(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function As(s){const e=ae.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:a,onPermissionsChange:o,readOnly:m}=s,l=m===void 0?!1:m,[x,j]=D.useState(""),h=D.useDeferredValue(x);let v,c,N,u,b;if(e[0]!==n||e[1]!==h||e[2]!==a||e[3]!==o||e[4]!==l||e[5]!==x||e[6]!==r){const C=bs(),f=Cs(),I=f.filter(w=>w.label.toLowerCase().includes(h.toLowerCase())),T=w=>{if(r.includes(w))o(r.filter(d=>d!==w));else{const d=[...r,w];d.length===f.length?(a(!0),o([])):o(d)}};N="flex flex-col h-full",e[12]!==x?(u=t.jsx("div",{className:"border-b border-border",children:t.jsx(ke,{value:x,onChange:j,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=x,e[13]=u):u=e[13];const P=!l&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=K("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let _;e[16]!==n||e[17]!==a||e[18]!==o||e[19]!==l?(_=()=>{if(l)return;a(!n),o([])},e[16]=n,e[17]=a,e[18]=o,e[19]=l,e[20]=_):_=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=R):R=e[21];let k;e[22]!==n||e[23]!==a||e[24]!==o||e[25]!==l?(k=t.jsx("div",{onClick:Ms,children:l?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ke,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ke,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})}),e[22]=n,e[23]=a,e[24]=o,e[25]=l,e[26]=k):k=e[26],e[27]!==k||e[28]!==A||e[29]!==_?(b=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:A,onClick:_,children:[R,k]})}),e[27]=k,e[28]=A,e[29]=_,e[30]=b):b=e[30],v="flex-1 overflow-auto",c=Object.entries(C).map(w=>{const[d,S]=w,E=I.filter(g=>S.some(L=>L.name===g.value));return E.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:d}),t.jsx("div",{className:"space-y-1",children:E.map(g=>t.jsxs("div",{className:K("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 L=f.map(Ps);o(L.filter(z=>z!==g.value))}else T(g.value)},children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("span",{className:"text-sm",children:g.label})}),t.jsx("div",{onClick:Ls,children:l?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(Ke,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(_s);o(L.filter(z=>z!==g.value))}else T(g.value)}})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx(Ke,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(Rs);o(L.filter(z=>z!==g.value))}else T(g.value)}})})]},g.value))})]},d)}),e[0]=n,e[1]=h,e[2]=a,e[3]=o,e[4]=l,e[5]=x,e[6]=r,e[7]=v,e[8]=c,e[9]=N,e[10]=u,e[11]=b}else v=e[7],c=e[8],N=e[9],u=e[10],b=e[11];let p;e[31]!==v||e[32]!==c?(p=t.jsx("div",{className:v,children:c}),e[31]=v,e[32]=c,e[33]=p):p=e[33];let y;return e[34]!==N||e[35]!==u||e[36]!==b||e[37]!==p?(y=t.jsxs("div",{className:N,children:[u,b,p]}),e[34]=N,e[35]=u,e[36]=b,e[37]=p,e[38]=y):y=e[38],y}function Rs(s){return s.value}function _s(s){return s.value}function Ls(s){return s.stopPropagation()}function Ps(s){return s.value}function Ms(s){return s.stopPropagation()}function Ds(s){const e=ae.c(56),{open:n,onOpenChange:r,selectedMemberIds:a,onAddMembers:o}=s,[m,l]=D.useState(""),x=D.useDeferredValue(m);let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0];const[h,v]=D.useState(j),{data:c}=mt();let N,u,b,p,y,C,f,I,T,P,A;if(e[1]!==c?.data?.members||e[2]!==x||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==h||e[7]!==m||e[8]!==a){const L=c?.data?.members??[];let z;e[20]!==x?(z=B=>{const i=x.toLowerCase();return B.user?.name?.toLowerCase().includes(i)||B.user?.email?.toLowerCase().includes(i)},e[20]=x,e[21]=z):z=e[21];const F=L.filter(z),Q=ks;let q;e[22]!==a?(q=B=>a.includes(B),e[22]=a,e[23]=q):q=e[23];const H=q;let X;e[24]!==h?(X=B=>{h.includes(B)?v(h.filter(i=>i!==B)):v([...h,B])},e[24]=h,e[25]=X):X=e[25];const re=X;let ne;e[26]!==o||e[27]!==r||e[28]!==h?(ne=()=>{o(h),v([]),r(!1)},e[26]=o,e[27]=r,e[28]=h,e[29]=ne):ne=e[29],b=ne,u=we,P=n,A=r,N=Ae,I="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(Re,{className:"px-6 pt-6",children:[t.jsx(_e,{children:"Add Members to Role"}),t.jsx(Le,{children:"Select members to add to this role."})]}),e[30]=T):T=e[30],C="flex flex-col h-80",e[31]!==m?(f=t.jsx(ke,{value:m,onChange:l,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=m,e[32]=f):f=e[32],p="flex-1 overflow-auto",y=F.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:m?"No members found":"No members available"})}):t.jsx("div",{className:"px-6 py-2 space-y-1",children:F.map(B=>{const i=Q(B),O=H(B.id),G=h.includes(B.id);return t.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!i||O?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[t.jsx(dt,{checked:G||O,onCheckedChange:()=>{i&&!O&&re(B.id)},disabled:!i||O}),t.jsx(ve,{url:B.user?.image??void 0,fallback:Vt(B.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:B.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:B.user?.email})]}),!i&&t.jsx(Oe,{variant:"secondary",className:"shrink-0",children:"Owner"}),O&&i&&t.jsx(Oe,{variant:"outline",className:"shrink-0",children:"Added"})]},B.id)})}),e[1]=c?.data?.members,e[2]=x,e[3]=o,e[4]=r,e[5]=n,e[6]=h,e[7]=m,e[8]=a,e[9]=N,e[10]=u,e[11]=b,e[12]=p,e[13]=y,e[14]=C,e[15]=f,e[16]=I,e[17]=T,e[18]=P,e[19]=A}else N=e[9],u=e[10],b=e[11],p=e[12],y=e[13],C=e[14],f=e[15],I=e[16],T=e[17],P=e[18],A=e[19];let _;e[33]!==p||e[34]!==y?(_=t.jsx("div",{className:p,children:y}),e[33]=p,e[34]=y,e[35]=_):_=e[35];let R;e[36]!==_||e[37]!==C||e[38]!==f?(R=t.jsxs("div",{className:C,children:[f,_]}),e[36]=_,e[37]=C,e[38]=f,e[39]=R):R=e[39];let k;e[40]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Me,{children:"Cancel"}),e[40]=k):k=e[40];const w=h.length===0,d=h.length>0&&`(${h.length})`;let S;e[41]!==b||e[42]!==w||e[43]!==d?(S=t.jsxs(Pe,{className:"px-6 pb-6",children:[k,t.jsxs(De,{onClick:b,disabled:w,children:["Add ",d]})]}),e[41]=b,e[42]=w,e[43]=d,e[44]=S):S=e[44];let E;e[45]!==N||e[46]!==R||e[47]!==S||e[48]!==I||e[49]!==T?(E=t.jsxs(N,{className:I,children:[T,R,S]}),e[45]=N,e[46]=R,e[47]=S,e[48]=I,e[49]=T,e[50]=E):E=e[50];let g;return e[51]!==u||e[52]!==E||e[53]!==P||e[54]!==A?(g=t.jsx(u,{open:P,onOpenChange:A,children:E}),e[51]=u,e[52]=E,e[53]=P,e[54]=A,e[55]=g):g=e[55],g}function ks(s){return s.role!=="owner"}function zs(s){const e=ae.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:a}=s,o=a===void 0?!1:a,[m,l]=D.useState(""),x=D.useDeferredValue(m),[j,h]=D.useState(!1),{data:v}=mt();let c,N,u,b,p;if(e[0]!==v?.data?.members||e[1]!==x||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==m){const I=v?.data?.members??[];let T;e[11]!==n?(T=E=>n.includes(E.id),e[11]=n,e[12]=T):T=e[12];const P=I.filter(T);let A;e[13]!==x?(A=E=>{const g=x.toLowerCase();return E.user?.name?.toLowerCase().includes(g)||E.user?.email?.toLowerCase().includes(g)},e[13]=x,e[14]=A):A=e[14];const _=P.filter(A);let R;e[15]!==n||e[16]!==r?(R=E=>{r(n.filter(g=>g!==E))},e[15]=n,e[16]=r,e[17]=R):R=e[17];const k=R;let w;e[18]!==n||e[19]!==r?(w=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=w):w=e[20],c=w,b="flex flex-col h-full";let d;e[21]!==m?(d=t.jsx(ke,{value:m,onChange:l,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=m,e[22]=d):d=e[22];let S;e[23]!==o?(S=o?t.jsx("div",{className:"pr-4",children:t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(rt,{size:16}),"Add Member"]})})}),t.jsx(Ie,{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:()=>h(!0),children:[t.jsx(rt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==d||e[26]!==S?(p=t.jsxs("div",{className:"flex items-center border-b border-border",children:[d,S]}),e[25]=d,e[26]=S,e[27]=p):p=e[27],N="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."})]})}):_.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 "',m,'"']})}):t.jsx("div",{className:"p-4 space-y-2",children:_.map(E=>t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[t.jsx(ve,{url:E.user?.image??void 0,fallback:Vt(E.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:E.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?t.jsx(Te,{children:t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(bt,{size:16})})})}),t.jsx(Ie,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>k(E.id),children:t.jsx(bt,{size:16})})]},E.id))}),e[0]=v?.data?.members,e[1]=x,e[2]=n,e[3]=r,e[4]=o,e[5]=m,e[6]=c,e[7]=N,e[8]=u,e[9]=b,e[10]=p}else c=e[6],N=e[7],u=e[8],b=e[9],p=e[10];let y;e[28]!==N||e[29]!==u?(y=t.jsx("div",{className:N,children:u}),e[28]=N,e[29]=u,e[30]=y):y=e[30];let C;e[31]!==j||e[32]!==c||e[33]!==n?(C=t.jsx(Ds,{open:j,onOpenChange:h,selectedMemberIds:n,onAddMembers:c}),e[31]=j,e[32]=c,e[33]=n,e[34]=C):C=e[34];let f;return e[35]!==b||e[36]!==p||e[37]!==y||e[38]!==C?(f=t.jsxs("div",{className:b,children:[p,y,C]}),e[35]=b,e[36]=p,e[37]=y,e[38]=C,e[39]=f):f=e[39],f}function Us(s){const e=ae.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(Mt,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==s?(r=t.jsx(D.Suspense,{fallback:n,children:t.jsx(zs,{...s})}),e[1]=s,e[2]=r):r=e[2],r}const Bs={owner:[],admin:[],user:[]};function qe(s,e){const n=s==="owner"||s==="admin",r=e.filter(a=>a.role===s);return{role:{slug:s,label:s.charAt(0).toUpperCase()+s.slice(1)},allowAllStaticPermissions:n,staticPermissions:Bs[s],toolSet:{},memberIds:r.map(a=>a.id)}}function Vs({trigger:s,onSuccess:e}){const[n,r]=D.useState(!1),[a,o]=D.useState("mcp"),{locator:m}=Ne(),l=Xe(),x=At()??[],{customRoles:j,refetch:h}=xt(),{data:v}=Rt({queryKey:le.members(m),queryFn:()=>se.organization.listMembers()}),c=Ot({resolver:Kt(Is),defaultValues:Qe()}),N=c.formState.isValid,u=c.formState.isDirty,[b,p]=D.useState(null),[y,C]=D.useState(null),f=!c.watch("role.id")&&!c.watch("role.slug")&&!y,[I,T]=D.useState(null),[P,A]=D.useState(!1),[_,R]=D.useState(null),k=i=>{const O=i.permission||{},G=O.self||[],oe=G.includes("*"),ie=oe?[]:G.filter(U=>U!=="*"),J={};for(const[U,V]of Object.entries(O))if(U!=="self")if(U==="*")for(const Y of x)V.includes("*")?J[Y.id]=Y.tools?.map(ce=>ce.name)??[]:J[Y.id]=V;else{const Y=x.find(ce=>ce.id===U);Y&&(V.includes("*")?J[U]=Y.tools?.map(ce=>ce.name)??[]:J[U]=V)}const me=(v?.data?.members??[]).filter(U=>U.role===i.role).map(U=>U.id);return{role:{id:i.id,slug:i.role,label:i.label},allowAllStaticPermissions:oe,staticPermissions:ie,toolSet:J,memberIds:me}},w=i=>{const O=k(i);c.reset(O),p(i.id??null),C(null)},d=()=>{c.reset(Qe()),p(null),C(null),o("mcp")},S=i=>{u&&N?(R(()=>()=>w(i)),A(!0)):w(i)},E=async()=>{u&&N&&await X(),d()},g=i=>{if(u&&N)R(()=>()=>{const O=qe(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}),A(!0);else{const O=qe(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}},L=i=>{if(!i&&c.formState.isDirty&&N){R(()=>()=>{r(!1),c.reset(Qe()),C(null)}),A(!0);return}if(r(i),!i)c.reset(Qe()),C(null),p(null);else{const O=j[0];if(O)w(O);else{const G=qe("user",v?.data?.members??[]);c.reset(G),C("user"),p(null),o("org")}}},z=()=>{A(!1),_&&(_(),R(null))},F=i=>{const O={};i.allowAllStaticPermissions?O.self=["*"]:i.staticPermissions.length>0&&(O.self=i.staticPermissions);for(const[G,oe]of Object.entries(i.toolSet))if(oe.length>0){const J=x.find(Z=>Z.id===G)?.tools?.map(Z=>Z.name)??[];J.length>0&&J.every(Z=>oe.includes(Z))?O[G]=["*"]:O[G]=oe}return O},Q=he({mutationFn:async i=>{const O=F(i),G=i.role.slug||i.role.label.toLowerCase().replace(/\s+/g,"-");if(i.role.slug&&!i.role.id){const J=(v?.data?.members??[]).filter(U=>U.role===i.role.slug).map(U=>U.id),Z=i.memberIds.filter(U=>!J.includes(U)),me=J.filter(U=>!i.memberIds.includes(U));for(const U of Z){const V=await se.organization.updateMemberRole({memberId:U,role:[i.role.slug]});if(V?.error)throw new Error(V.error.message)}for(const U of me){const V=await se.organization.updateMemberRole({memberId:U,role:["user"]});if(V?.error)throw new Error(V.error.message)}return i}else if(i.role.id){const ie=await se.organization.updateRole({roleId:i.role.id,data:{permission:O}});if(ie?.error)throw new Error(ie.error.message);const Z=(v?.data?.members??[]).filter(V=>V.role===i.role.slug).map(V=>V.id),me=i.memberIds.filter(V=>!Z.includes(V)),U=Z.filter(V=>!i.memberIds.includes(V));for(const V of me){const Y=await se.organization.updateMemberRole({memberId:V,role:[i.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const V of U){const Y=await se.organization.updateMemberRole({memberId:V,role:["user"]});if(Y?.error)throw new Error(Y.error.message)}return i}else{const ie=await se.organization.createRole({role:G,permission:O});if(ie?.error)throw new Error(ie.error.message);for(const J of i.memberIds){const Z=await se.organization.updateMemberRole({memberId:J,role:[G]});if(Z?.error)throw new Error(Z.error.message)}return{...i,role:{...i.role,id:ie.data?.roleData?.id,slug:G}}}},onSuccess:(i,O)=>{l.invalidateQueries({queryKey:le.members(m)}),l.invalidateQueries({queryKey:le.organizationRoles(m)});const G=!O.role.id&&!O.role.slug,oe=O.role.slug&&!O.role.id;te.success(oe?"Members updated successfully!":G?"Role created successfully!":"Role updated successfully!"),h(),c.reset(i),i.role.id&&p(i.role.id),e?.()},onError:i=>{te.error(i instanceof Error?i.message:"Failed to save role")}}),q=he({mutationFn:async i=>{const O=await se.organization.deleteRole({roleId:i});if(O?.error)throw new Error(O.error.message);return O?.data},onSuccess:()=>{if(l.invalidateQueries({queryKey:le.members(m)}),l.invalidateQueries({queryKey:le.organizationRoles(m)}),te.success("Role deleted successfully!"),h(),I?.id===b){const i=j.filter(O=>O.id!==I?.id);if(i[0])w(i[0]);else{const O=qe("user",v?.data?.members??[]);c.reset(O),C("user"),p(null),o("org")}}},onError:i=>{te.error(i instanceof Error?i.message:"Failed to delete role")}}),H=Q.isPending||q.isPending,X=async()=>{const i=c.getValues();if(!i.role.label.trim()){te.error("Role name is required"),c.setFocus("role.label");return}await Q.mutateAsync(i)},re=c.handleSubmit(i=>{if(!i.role.label.trim()){te.error("Role name is required"),c.setFocus("role.label");return}Q.mutate(i)}),ne=i=>{i.id&&T({id:i.id,label:i.label})},B=()=>{I?.id&&q.mutate(I.id),T(null)};return t.jsxs(_t,{open:n,onOpenChange:L,children:[t.jsx(Lt,{asChild:!0,children:s}),t.jsx(Pt,{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:[Os.map(i=>{const O=y===i.role;return t.jsxs("div",{className:K("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",O?"bg-accent":"hover:bg-muted/50"),onClick:()=>g(i.role),children:[t.jsx("div",{className:K("shrink-0 size-3 rounded-full",i.color)}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsx(ls,{size:14,className:"text-muted-foreground shrink-0"})]},i.role)}),j.map(i=>{const O=b===i.id;return t.jsxs("div",{className:K("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",O?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(i),children:[t.jsx("div",{className:K("shrink-0 size-3 rounded-full",ws(i.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsxs(ut,{children:[t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"icon",className:K("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",O&&"opacity-100 pointer-events-auto"),onClick:G=>G.stopPropagation(),children:t.jsx(os,{size:14})})}),t.jsx(ht,{align:"end",children:t.jsxs(Ze,{className:"text-destructive",onClick:G=>{G.stopPropagation(),ne(i)},children:[t.jsx(Dt,{size:16}),"Delete"]})})]})]},i.id)}),f&&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(as,{...c.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(Oe,{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:E,disabled:H||u,className:"w-full h-10",children:[t.jsx(rt,{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:[!y&&t.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:K("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:()=>o("org"),className:K("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:()=>o("members"),className:K("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"&&!y&&t.jsx(Ns,{toolSet:c.watch("toolSet"),onToolSetChange:i=>c.setValue("toolSet",i,{shouldDirty:!0})}),a==="org"&&t.jsx(As,{allowAllStaticPermissions:c.watch("allowAllStaticPermissions"),staticPermissions:c.watch("staticPermissions"),onAllowAllChange:i=>c.setValue("allowAllStaticPermissions",i,{shouldDirty:!0}),onPermissionsChange:i=>c.setValue("staticPermissions",i,{shouldDirty:!0}),readOnly:!!y}),a==="members"&&t.jsx(Us,{memberIds:c.watch("memberIds"),onMemberIdsChange:i=>c.setValue("memberIds",i,{shouldDirty:!0}),readOnly:y==="owner"})]}),(!y||y!=="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:()=>L(!1),disabled:H,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:re,disabled:H||!N||!c.formState.isDirty,className:"h-10",children:Q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),t.jsx(we,{open:I!==null,onOpenChange:i=>!i&&T(null),children:t.jsxs(Ae,{children:[t.jsxs(Re,{children:[t.jsx(_e,{children:"Delete Role"}),t.jsxs(Le,{children:['Are you sure you want to delete the "',I?.label,'" role? This action cannot be undone.']})]}),t.jsxs(Pe,{children:[t.jsx(Me,{children:"Cancel"}),t.jsx(De,{onClick:B,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(we,{open:P,onOpenChange:A,children:t.jsxs(Ae,{children:[t.jsxs(Re,{children:[t.jsx(_e,{children:"Discard Changes"}),t.jsx(Le,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(Pe,{children:[t.jsx(Me,{onClick:()=>R(null),children:"Keep Editing"}),t.jsx(De,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const $s=ue().email("Invalid email address");function Fs(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 Gs({trigger:s}){const[e,n]=D.useState(!1),{locator:r}=Ne(),a=Xe(),{data:o}=se.useSession(),m=o?.user?.email,{roles:l,isLoading:x}=xt(),j=l.filter(C=>C.role!=="owner"),h=Ot({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),v=h.watch("emailsText"),c=h.watch("role"),u=Fs(v).filter(C=>{const f=$s.safeParse(C).success,I=!m||C!==m.toLowerCase();return f&&I}),b=he({mutationFn:async({emails:C,role:f})=>{if(!f)throw new Error("Please select a role");const I=await Promise.allSettled(C.map(async P=>{const A=await se.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),T=I.filter(P=>P.status==="rejected");if(T.length>0)throw new Error(`Failed to invite ${T.length} member${T.length>1?"s":""}`);return I},onSuccess:(C,{emails:f})=>{a.invalidateQueries({queryKey:le.members(r)}),a.invalidateQueries({queryKey:le.invitations(r)}),te.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),h.reset({emailsText:"",role:"user"}),n(!1)},onError:C=>{te.error(C instanceof Error?C.message:"Failed to invite members")}}),p=C=>{if(u.length===0){te.error("Please enter at least one valid email address");return}if(!C.role){te.error("Please select a role");return}b.mutate({emails:u,role:C.role})},y=u.length>0&&!!c;return t.jsxs(_t,{open:e,onOpenChange:n,children:[t.jsx(Lt,{asChild:!0,children:s}),t.jsxs(Pt,{className:"sm:max-w-lg",children:[t.jsx(Wt,{children:t.jsx(es,{children:"Invite members"})}),t.jsx(ds,{...h,children:t.jsxs("form",{onSubmit:h.handleSubmit(p),className:"space-y-4",children:[t.jsx(Ct,{control:h.control,name:"emailsText",render:({field:C})=>t.jsxs(jt,{children:[t.jsx(ms,{children:"Email addresses"}),t.jsx(vt,{children:t.jsx(us,{...C,disabled:b.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
- e.g. user1@example.com, user2@example.com
3
- or one per line`,className:"min-h-[120px] resize-none"})}),t.jsx(Nt,{})]})}),t.jsx(Ct,{control:h.control,name:"role",render:({field:C})=>t.jsxs(jt,{children:[t.jsx(vt,{children:t.jsxs(it,{value:C.value,onValueChange:C.onChange,disabled:b.isPending||x,children:[t.jsx(ot,{className:"w-full",children:t.jsx(lt,{placeholder:"Select a role"})}),t.jsx(at,{children:j.map(f=>{const I=[];return f.isBuiltin||(f.allowsAllStaticPermissions?I.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&I.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?I.push("All connections"):f.connectionCount&&f.connectionCount>0&&I.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?I.push("all tools"):f.toolCount&&f.toolCount>0&&I.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),t.jsx(ct,{value:f.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:f.label}),!f.isBuiltin&&I.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:I.join(", ")})]})},f.role)})})]})}),t.jsx(Nt,{})]})}),t.jsxs(ts,{children:[t.jsx(ee,{variant:"outline",onClick:()=>{h.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:b.isPending,children:"Cancel"}),t.jsx(ee,{type:"submit",disabled:b.isPending||!y,children:b.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function Ks(){const s=ae.c(9),{org:e,locator:n}=Ne();let r;s[0]!==e.id?(r={connectionId:fs,orgId:e.id},s[0]=e.id,s[1]=r):r=s[1];const a=hs(r);let o;s[2]!==n?(o=le.invitations(n),s[2]=n,s[3]=o):o=s[3];let m;s[4]!==a?(m=async()=>{const x=await a.callTool({name:"ORGANIZATION_GET",arguments:{}});return(x.structuredContent??x)?.invitations??[]},s[4]=a,s[5]=m):m=s[5];let l;return s[6]!==o||s[7]!==m?(l={queryKey:o,queryFn:m},s[6]=o,s[7]=m,s[8]=l):l=s[8],Qt(l)}function Qs(){const s=ae.c(5),{locator:e}=Ne(),n=Xe();let r;s[0]!==e||s[1]!==n?(r={mutationFn:Hs,onSuccess:()=>{n.invalidateQueries({queryKey:le.invitations(e)}),te.success("Invitation cancelled")},onError:qs},s[0]=e,s[1]=n,s[2]=r):r=s[2];const a=he(r);let o;return s[3]!==a?(o={cancel:a},s[3]=a,s[4]=o):o=s[4],o}function qs(s){te.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Hs(s){const e=await se.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const St=["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"],Zs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ye(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ys(s){const e=new Map;for(const[n,r]of Object.entries(Zs))e.set(n,r);for(let n=0;n<s.length;n++){const r=s[n];r&&!e.has(r.role)&&e.set(r.role,St[n%St.length]??"bg-neutral-400")}return e}function Xs(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function He(s){const e=ae.c(79),{role:n,memberId:r,isOwner:a,roleColorMap:o,selectableRoles:m,onRoleChange:l,size:x,className:j}=s,h=x===void 0?"xs":x;let v,c,N,u,b,p,y,C,f,I,T;if(e[0]!==j||e[1]!==a||e[2]!==r||e[3]!==l||e[4]!==n||e[5]!==o||e[6]!==m||e[7]!==h){T=Symbol.for("react.early_return_sentinel");e:{const E=o.get(n)??"bg-neutral-400";if(a){let g;e[19]!==r||e[20]!==l?(g=B=>l(r,B),e[19]=r,e[20]=l,e[21]=g):g=e[21];let L;e[22]!==n?(L=t.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=L):L=e[23];const z=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("div",{className:K("size-2 rounded-full shrink-0",E)}),L]});let F;e[24]!==z?(F=t.jsx(lt,{children:z}),e[24]=z,e[25]=F):F=e[25];let Q;e[26]!==j||e[27]!==h||e[28]!==F?(Q=t.jsx(ot,{size:h,className:j,children:F}),e[26]=j,e[27]=h,e[28]=F,e[29]=Q):Q=e[29];let q;if(e[30]!==o||e[31]!==m){let B;e[33]!==o?(B=i=>{const O=o.get(i.role)??"bg-neutral-400";return t.jsx(ct,{value:i.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:K("size-3 rounded-full",O)}),t.jsx("span",{className:"capitalize",children:i.label})]})},i.role)},e[33]=o,e[34]=B):B=e[34],q=m.map(B),e[30]=o,e[31]=m,e[32]=q}else q=e[32];let H;e[35]!==q?(H=t.jsx(at,{children:q}),e[35]=q,e[36]=H):H=e[36];let X;e[37]!==a||e[38]!==n||e[39]!==g||e[40]!==Q||e[41]!==H?(X=t.jsx(ye,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(it,{value:n,onValueChange:g,disabled:a,children:[Q,H]})})}),e[37]=a,e[38]=n,e[39]=g,e[40]=Q,e[41]=H,e[42]=X):X=e[42];let re;e[43]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Ie,{children:t.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=re):re=e[43];let ne;e[44]!==X?(ne=t.jsx(Te,{children:t.jsxs(Se,{children:[X,re]})}),e[44]=X,e[45]=ne):ne=e[45],T=ne;break e}N=it,C=n,e[46]!==r||e[47]!==l?(f=g=>l(r,g),e[46]=r,e[47]=l,e[48]=f):f=e[48],I=a,c=ot,p=h,y=j,v=lt,b="flex items-center gap-2 min-w-0",u=K("size-2 rounded-full shrink-0",E)}e[0]=j,e[1]=a,e[2]=r,e[3]=l,e[4]=n,e[5]=o,e[6]=m,e[7]=h,e[8]=v,e[9]=c,e[10]=N,e[11]=u,e[12]=b,e[13]=p,e[14]=y,e[15]=C,e[16]=f,e[17]=I,e[18]=T}else v=e[8],c=e[9],N=e[10],u=e[11],b=e[12],p=e[13],y=e[14],C=e[15],f=e[16],I=e[17],T=e[18];if(T!==Symbol.for("react.early_return_sentinel"))return T;let P;e[49]!==u?(P=t.jsx("div",{className:u}),e[49]=u,e[50]=P):P=e[50];let A;e[51]!==n?(A=t.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=A):A=e[52];let _;e[53]!==P||e[54]!==A||e[55]!==b?(_=t.jsxs("div",{className:b,children:[P,A]}),e[53]=P,e[54]=A,e[55]=b,e[56]=_):_=e[56];let R;e[57]!==v||e[58]!==_?(R=t.jsx(v,{children:_}),e[57]=v,e[58]=_,e[59]=R):R=e[59];let k;e[60]!==c||e[61]!==R||e[62]!==p||e[63]!==y?(k=t.jsx(c,{size:p,className:y,children:R}),e[60]=c,e[61]=R,e[62]=p,e[63]=y,e[64]=k):k=e[64];let w;if(e[65]!==o||e[66]!==m){let E;e[68]!==o?(E=g=>{const L=o.get(g.role)??"bg-neutral-400";return t.jsx(ct,{value:g.role,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:K("size-3 rounded-full",L)}),t.jsx("span",{className:"capitalize",children:g.label})]})},g.role)},e[68]=o,e[69]=E):E=e[69],w=m.map(E),e[65]=o,e[66]=m,e[67]=w}else w=e[67];let d;e[70]!==w?(d=t.jsx(at,{children:w}),e[70]=w,e[71]=d):d=e[71];let S;return e[72]!==N||e[73]!==k||e[74]!==d||e[75]!==C||e[76]!==f||e[77]!==I?(S=t.jsxs(N,{value:C,onValueChange:f,disabled:I,children:[k,d]}),e[72]=N,e[73]=k,e[74]=d,e[75]=C,e[76]=f,e[77]=I,e[78]=S):S=e[78],S}function yt(s){const e=ae.c(51),{member:n,roles:r,onChangeRole:a,onRemove:o,isUpdating:m}=s,l=m===void 0?!1:m,x=n.role==="owner";let j,h,v,c,N,u,b,p,y;if(e[0]!==x||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==r){let k;e[15]!==n.role?(k=g=>g.role!==n.role&&g.role!=="owner",e[15]=n.role,e[16]=k):k=e[16];const w=r.filter(k);c=ut;let d;e[17]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(kt,{size:20}),e[17]=d):d=e[17],e[18]!==x?(y=t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:x,onClick:Ws,children:d})}),e[18]=x,e[19]=y):y=e[19],v=ht,b="end",p=Js,h=ss;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Ut,{size:16}),e[20]=S):S=e[20],e[21]!==l?(u=t.jsxs(ns,{disabled:l,children:[S,"Change Role"]}),e[21]=l,e[22]=u):u=e[22],j=rs;let E;e[23]!==l||e[24]!==n.id||e[25]!==a?(E=g=>{const L=[];return g.isBuiltin||(g.allowsAllStaticPermissions?L.push("Full org access"):g.staticPermissionCount&&g.staticPermissionCount>0&&L.push(`${g.staticPermissionCount} org perm${g.staticPermissionCount!==1?"s":""}`),g.allowsAllConnections?L.push("All connections"):g.connectionCount&&g.connectionCount>0&&L.push(`${g.connectionCount} connection${g.connectionCount!==1?"s":""}`),(g.connectionCount!==0||g.allowsAllConnections)&&(g.allowsAllTools?L.push("all tools"):g.toolCount&&g.toolCount>0&&L.push(`${g.toolCount} tool${g.toolCount!==1?"s":""}`))),t.jsxs(Ze,{onClick:z=>{z.stopPropagation(),a(n.id,g.role)},disabled:l,children:[g.isBuiltin?t.jsx(gt,{size:16}):t.jsx(gs,{size:16}),t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{children:g.label}),!g.isBuiltin&&L.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:L.join(", ")})]})]},g.role)},e[23]=l,e[24]=n.id,e[25]=a,e[26]=E):E=e[26],N=w.map(E),e[0]=x,e[1]=l,e[2]=n.id,e[3]=n.role,e[4]=a,e[5]=r,e[6]=j,e[7]=h,e[8]=v,e[9]=c,e[10]=N,e[11]=u,e[12]=b,e[13]=p,e[14]=y}else j=e[6],h=e[7],v=e[8],c=e[9],N=e[10],u=e[11],b=e[12],p=e[13],y=e[14];let C;e[27]!==j||e[28]!==N?(C=t.jsx(j,{children:N}),e[27]=j,e[28]=N,e[29]=C):C=e[29];let f;e[30]!==h||e[31]!==u||e[32]!==C?(f=t.jsxs(h,{children:[u,C]}),e[30]=h,e[31]=u,e[32]=C,e[33]=f):f=e[33];let I;e[34]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(is,{}),e[34]=I):I=e[34];let T;e[35]!==n.id||e[36]!==o?(T=k=>{k.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=T):T=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Dt,{size:16}),e[38]=P):P=e[38];let A;e[39]!==T?(A=t.jsxs(Ze,{variant:"destructive",onClick:T,children:[P,"Remove Member"]}),e[39]=T,e[40]=A):A=e[40];let _;e[41]!==v||e[42]!==A||e[43]!==b||e[44]!==p||e[45]!==f?(_=t.jsxs(v,{align:b,onClick:p,children:[f,I,A]}),e[41]=v,e[42]=A,e[43]=b,e[44]=p,e[45]=f,e[46]=_):_=e[46];let R;return e[47]!==c||e[48]!==_||e[49]!==y?(R=t.jsxs(c,{children:[y,_]}),e[47]=c,e[48]=_,e[49]=y,e[50]=R):R=e[50],R}function Js(s){return s.stopPropagation()}function Ws(s){return s.stopPropagation()}function It(s){const e=ae.c(8),{invitationId:n,onCancel:r,isCancelling:a}=s,o=a===void 0?!1:a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ft,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:tn,children:t.jsx(kt,{size:20})})}),e[0]=m):m=e[0];let l;e[1]!==n||e[2]!==r?(l=h=>{h.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=l):l=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(xs,{size:16}),e[4]=x):x=e[4];let j;return e[5]!==o||e[6]!==l?(j=t.jsxs(ut,{children:[m,t.jsx(ht,{align:"end",onClick:en,children:t.jsxs(Ze,{variant:"destructive",onClick:l,disabled:o,children:[x,"Cancel Invitation"]})})]}),e[5]=o,e[6]=l,e[7]=j):j=e[7],j}function en(s){return s.stopPropagation()}function tn(s){return s.stopPropagation()}function sn(){const s=ae.c(78),{data:e}=mt(),{data:n}=Ks(),r=Qs(),a=Xe(),{locator:o}=Ne(),[m,l]=D.useState(null),[x,j]=D.useState(null),[h,v]=D.useState(""),[c,N]=D.useState("table"),[u,b]=D.useState("member"),[p,y]=D.useState("asc"),C=e?.data?.members;let f;s[0]!==u?(f=M=>{u===M?y(xn):(b(M),y("asc"))},s[0]=u,s[1]=f):f=s[1];const I=f;let T=C??[],P=n??[];if(h){const M=h.toLowerCase();T=T.filter($=>$.user?.name?.toLowerCase().includes(M)||$.user?.email?.toLowerCase().includes(M)||$.role?.toLowerCase().includes(M)),P=P.filter($=>$.email?.toLowerCase().includes(M)||$.role?.toLowerCase().includes(M))}if(u&&p){let M;s[2]!==p||s[3]!==u?(M=($,W)=>{let de,Ee;e:switch(u){case"member":{de=$.user?.name||"",Ee=W.user?.name||"";break e}case"role":{de=$.role||"",Ee=W.role||"";break e}case"joined":{de=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",Ee=W.createdAt?typeof W.createdAt=="string"?W.createdAt:W.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?de.localeCompare(Ee):Ee.localeCompare(de)},s[2]=p,s[3]=u,s[4]=M):M=s[4],T=[...T].sort(M)}const A=T;let _;s[5]!==o||s[6]!==a?(_={mutationFn:gn,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(o)}),te.success("Member has been removed from the organization"),l(null)},onError:hn},s[5]=o,s[6]=a,s[7]=_):_=s[7];const R=he(_);let k;s[8]!==o||s[9]!==a?(k={mutationFn:fn,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(o)}),te.success("Member's role has been updated")},onError:un},s[8]=o,s[9]=a,s[10]=k):k=s[10];const w=he(k);let d;s[11]!==o||s[12]!==a?(d={mutationFn:mn,onSuccess:()=>{a.invalidateQueries({queryKey:le.invitations(o)}),te.success("Invitation role has been updated")},onError:dn},s[11]=o,s[12]=a,s[13]=d):d=s[13];const S=he(d),{roles:E,customRoles:g}=xt();let L;s[14]!==g?(L=Ys(g),s[14]=g,s[15]=L):L=s[15];const z=L;let F;s[16]!==E?(F=E.filter(cn),s[16]=E,s[17]=F):F=s[17];const Q=F;let q;s[18]===Symbol.for("react.memo_cache_sentinel")?(q={id:"member",header:"Member",render:an,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=q):q=s[18];let H;s[19]!==z||s[20]!==Q||s[21]!==S||s[22]!==w?(H={id:"role",header:"Role",render:M=>M.type==="member"?t.jsx(He,{role:M.data.role,memberId:M.data.id,isOwner:M.data.role==="owner",roleColorMap:z,selectableRoles:Q,onRoleChange:($,W)=>w.mutate({memberId:$,role:W}),className:"w-36"}):t.jsx(He,{role:M.data.role,memberId:M.data.id,isOwner:!1,roleColorMap:z,selectableRoles:Q,onRoleChange:($,W)=>S.mutate({invitationId:$,role:W,email:M.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},s[19]=z,s[20]=Q,s[21]=S,s[22]=w,s[23]=H):H=s[23];let X;s[24]===Symbol.for("react.memo_cache_sentinel")?(X={id:"joined",header:"Joined",render:ln,cellClassName:"w-48 shrink-0",sortable:!0},s[24]=X):X=s[24];let re;s[25]!==r.cancel.isPending||s[26]!==E||s[27]!==w?(re={id:"actions",header:"",render:M=>M.type==="member"?t.jsx(yt,{member:M.data,roles:E,onChangeRole:($,W)=>w.mutate({memberId:$,role:W}),onRemove:l,isUpdating:w.isPending}):t.jsx(It,{invitationId:M.data.id,onCancel:j,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},s[25]=r.cancel.isPending,s[26]=E,s[27]=w,s[28]=re):re=s[28];let ne;s[29]!==H||s[30]!==re?(ne=[q,H,X,re],s[29]=H,s[30]=re,s[31]=ne):ne=s[31];const B=ne;let i;s[32]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Vs,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(gt,{size:16}),"Manage Roles"]})}),s[32]=i):i=s[32];let O;s[33]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs("div",{className:"flex items-center gap-2",children:[i,t.jsx(Gs,{trigger:t.jsx(ee,{size:"sm",children:"Invite Member"})})]}),s[33]=O):O=s[33];const G=O,oe=[...A.map(on),...P.filter(rn).map(nn)],ie=fe,J=!!x;let Z;s[34]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>j(null),s[34]=Z):Z=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Re,{children:[t.jsx(_e,{children:"Cancel Invitation"}),t.jsx(Le,{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 U;s[36]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(Me,{children:"Keep Invitation"}),s[36]=U):U=s[36];let V;s[37]!==r.cancel||s[38]!==x?(V=()=>{x&&(r.cancel.mutate(x),j(null))},s[37]=r.cancel,s[38]=x,s[39]=V):V=s[39];let Y;s[40]!==r.cancel.isPending||s[41]!==V?(Y=t.jsxs(Ae,{children:[me,t.jsxs(Pe,{children:[U,t.jsx(De,{onClick:V,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=r.cancel.isPending,s[41]=V,s[42]=Y):Y=s[42];let ce;s[43]!==J||s[44]!==Y?(ce=t.jsx(we,{open:J,onOpenChange:Z,children:Y}),s[43]=J,s[44]=Y,s[45]=ce):ce=s[45];const Je=!!m;let ze;s[46]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>l(null),s[46]=ze):ze=s[46];let Ue;s[47]===Symbol.for("react.memo_cache_sentinel")?(Ue=t.jsxs(Re,{children:[t.jsx(_e,{children:"Remove Member"}),t.jsx(Le,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=Ue):Ue=s[47];let Be;s[48]===Symbol.for("react.memo_cache_sentinel")?(Be=t.jsx(Me,{children:"Cancel"}),s[48]=Be):Be=s[48];let ge;s[49]!==m||s[50]!==R?(ge=()=>m&&R.mutate(m),s[49]=m,s[50]=R,s[51]=ge):ge=s[51];let xe;s[52]!==R.isPending||s[53]!==ge?(xe=t.jsxs(Ae,{children:[Ue,t.jsxs(Pe,{children:[Be,t.jsx(De,{onClick:ge,disabled:R.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=R.isPending,s[53]=ge,s[54]=xe):xe=s[54];let pe;s[55]!==Je||s[56]!==xe?(pe=t.jsx(we,{open:Je,onOpenChange:ze,children:xe}),s[55]=Je,s[56]=xe,s[57]=pe):pe=s[57];let Ve;s[58]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsx(fe.Header.Left,{children:t.jsx(Zt,{children:t.jsx(Yt,{children:t.jsx(Xt,{children:t.jsx(Jt,{children:"Members"})})})})}),s[58]=Ve):Ve=s[58];let $e;s[59]===Symbol.for("react.memo_cache_sentinel")?($e=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[59]=$e):$e=s[59];let be;s[60]!==I||s[61]!==p||s[62]!==u||s[63]!==c?(be=t.jsxs(fe.Header,{children:[Ve,t.jsxs(fe.Header.Right,{children:[t.jsx(qt,{viewMode:c,onViewModeChange:N,sortKey:u,sortDirection:p,onSort:I,sortOptions:$e}),G]})]}),s[60]=I,s[61]=p,s[62]=u,s[63]=c,s[64]=be):be=s[64];let Fe;s[65]===Symbol.for("react.memo_cache_sentinel")?(Fe=M=>{M.key==="Escape"&&(v(""),M.target.blur())},s[65]=Fe):Fe=s[65];let Ce;s[66]!==h?(Ce=t.jsx(ke,{value:h,onChange:v,placeholder:"Search members...",onKeyDown:Fe}),s[66]=h,s[67]=Ce):Ce=s[67];const We=fe,et=c==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:oe.length===0?t.jsx(st,{title:"No members found",description:h?`No members match "${h}"`:"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(M=>{if(M.type==="invitation")return t.jsxs(Et,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(It,{invitationId:M.data.id,onCancel:j,isCancelling:r.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ve,{fallback:Ye(M.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:M.data.email}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(Oe,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(He,{role:M.data.role,memberId:M.data.id,isOwner:!1,roleColorMap:z,selectableRoles:Q,onRoleChange:(W,de)=>S.mutate({invitationId:W,role:de,email:M.data.email}),className:"w-fit"})]})]})]},`inv-${M.data.id}`);const $=M.data;return t.jsxs(Et,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(yt,{member:$,roles:E,onChangeRole:(W,de)=>w.mutate({memberId:W,role:de}),onRemove:l,isUpdating:w.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ve,{url:$.user?.image??void 0,fallback:Ye($.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:$.user?.name||"Unknown"}),t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),t.jsx(He,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:z,selectableRoles:Q,onRoleChange:(W,de)=>w.mutate({memberId:W,role:de}),className:"w-fit"})]})]})]},$.id)})})}):t.jsx(Ht,{columns:B,data:oe,isLoading:!1,sortKey:u,sortDirection:p,onSort:I,emptyState:h?t.jsx(st,{title:"No members found",description:`No members match "${h}"`}):t.jsx(st,{title:"No members found",description:"Invite members to get started."})});let je;s[68]!==We.Content||s[69]!==et?(je=t.jsx(We.Content,{children:et}),s[68]=We.Content,s[69]=et,s[70]=je):je=s[70];let Ge;return s[71]!==ie||s[72]!==ce||s[73]!==pe||s[74]!==be||s[75]!==Ce||s[76]!==je?(Ge=t.jsxs(ie,{children:[ce,pe,be,Ce,je]}),s[71]=ie,s[72]=ce,s[73]=pe,s[74]=be,s[75]=Ce,s[76]=je,s[77]=Ge):Ge=s[77],Ge}function nn(s){return{type:"invitation",data:s}}function rn(s){return s.status==="pending"}function on(s){return{type:"member",data:s}}function ln(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?Xs(s.data.createdAt):"N/A"}):t.jsx(Oe,{variant:"outline",children:"Pending"})}function an(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ve,{url:s.data.user?.image??void 0,fallback:Ye(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(ve,{fallback:Ye(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 cn(s){return s.role!=="owner"}function dn(s){te.error(s instanceof Error?s.message:"Failed to update invitation role")}async function mn(s){const{invitationId:e,role:n,email:r}=s,a=await se.organization.cancelInvitation({invitationId:e});if(a?.error)throw new Error(a.error.message);const o=await se.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function un(s){te.error(s instanceof Error?s.message:"Failed to update role")}async function fn(s){const{memberId:e,role:n}=s,r=await se.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function hn(s){te.error(s instanceof Error?s.message:"Failed to remove member")}async function gn(s){const e=await se.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function xn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function lr(){const s=ae.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(fe,{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(cs,{fallback:e,children:t.jsx(D.Suspense,{fallback:t.jsx(fe,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Mt,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(sn,{})})}),s[1]=n):n=s[1],n}export{lr as default};
@@ -1 +0,0 @@
1
- import{c as H,r as D,u as X,x as ue,K as le,bs as fe,j as s,l as oe,g as xe,b6 as ge,aN as pe}from"./index-BgOoHyXW.js";import{P as Q}from"./index-DJ2Jm9li.js";import{B as he,a as je,b as ve,c as ye}from"./breadcrumb-CPuY6F-0.js";import{i as ie}from"./FilterLines-DxGB60xi.js";import{n as be}from"./Inbox01-DVXsLh-J.js";import{i as Z}from"./Loading01--EdyQou6.js";import{i as ae}from"./SearchMd-BH2aZiBv.js";import{u as Ne}from"./useInfiniteQuery-C5DCUMiS.js";import{a as Ce,f as Se,b as we}from"./registry-utils-DJNRhqR6.js";import{u as Te,h as Ie,b as Re}from"./constants-G7VjePam.js";import{u as Pe,a as ce,b as $e}from"./use-connection-sLATlyBj.js";import{s as ke}from"./slugify-CEUa2lfQ.js";import{C as Le}from"./collection-search-76irKOdK.js";import{M as re}from"./mcp-server-card-DIRrlGUw.js";import{c as me,B as U}from"./button-DZky_O5b.js";import{I as ze}from"./input-BzaoEOCn.js";import{b as Fe,P as Ke,a as Ae}from"./popover-DUJwUSSM.js";import{i as Ee}from"./Check-DqzdHNMw.js";import{t as Be}from"./ChevronDown-DNLmRmxT.js";import{s as J}from"./XClose-BgTbSIyK.js";import{d as De,a as Me,b as Ve,c as Oe,S as We}from"./select-iwsI8D5M.js";import{s as _e}from"./Plus-CKeAhIyX.js";import{E as qe}from"./empty-state-D1xTHC6z.js";import{u as He}from"./use-binding-COwUQLKP.js";import{L as Ge,u as Qe}from"./localstorage-keys-D6GRYm3g.js";import"./ChevronRight-BOG2FNn-.js";import"./infiniteQueryObserver-DeNzkqh2.js";import"./use-collections-CE5nYbrV.js";import"./useMutation-Ngf5wAT3.js";import"./useQuery-BlNmU8Jq.js";import"./Lock01-MF1zrVD-.js";import"./Terminal-CRout4QP.js";import"./card-B7MutzeW.js";import"./github-icon-Dp3wHhYE.js";import"./binder-Rtvfp3ct.js";function Ue(t,e){const l=H.c(4),[n,c]=D.useState(t),r=D.useRef(null),a=D.useRef(!0);let i,m;return l[0]!==e||l[1]!==t?(i=()=>{if(a.current){a.current=!1;return}return r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{c(t)},e),()=>{r.current&&clearTimeout(r.current)}},m=[t,e],l[0]=e,l[1]=t,l[2]=i,l[3]=m):(i=l[2],m=l[3]),D.useEffect(i,m),n}function Ye(t){const e=H.c(14),l=D.useRef(null),n=`scroll-position:${t}`,c=D.useRef(null);let r;e[0]!==n?(r=()=>{l.current&&sessionStorage.setItem(n,String(l.current.scrollTop))},e[0]=n,e[1]=r):r=e[1];const a=r;let i;e[2]!==n?(i=()=>{if(c.current===n)return;const d=sessionStorage.getItem(n);if(d&&l.current){const j=Number.parseInt(d,10);l.current.scrollTop=j}c.current=n},e[2]=n,e[3]=i):i=e[3];const m=i;let y;e[4]!==m||e[5]!==n?(y=()=>{c.current!==n&&m()},e[4]=m,e[5]=n,e[6]=y):y=e[6];const p=y;let o;e[7]!==m||e[8]!==n?(o=d=>{l.current=d,d&&c.current!==n&&requestAnimationFrame(()=>{m()})},e[7]=m,e[8]=n,e[9]=o):o=e[9];const b=o;let f;return e[10]!==p||e[11]!==a||e[12]!==b?(f={scrollRef:b,saveScrollPosition:a,handleScroll:p},e[10]=p,e[11]=a,e[12]=b,e[13]=f):f=e[13],f}const Je=24;function Ze(t){const e=H.c(53),{registryId:l,listToolName:n,filtersToolName:c,search:r}=t,{org:a}=X();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[0]=i):i=e[0];const[m,y]=D.useState(i);let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[1]=p):p=e[1];const[o,b]=D.useState(p),f=l||null;let d;e[2]!==a.id||e[3]!==f?(d={connectionId:f,orgId:a.id},e[2]=a.id,e[3]=f,e[4]=d):d=e[4];const j=Te(d),I=!!c;let N;e[5]!==c||e[6]!==l?(N=le.toolCall(l,c||"no-filters","{}"),e[5]=c,e[6]=l,e[7]=N):N=e[7];let C;e[8]!==j||e[9]!==c?(C=async()=>{if(!c)return{tags:[],categories:[]};const B=await j.callTool({name:c,arguments:{}});return B.structuredContent??B},e[8]=j,e[9]=c,e[10]=C):C=e[10];let L;e[11]!==N||e[12]!==C?(L={queryKey:N,queryFn:C,staleTime:36e5},e[11]=N,e[12]=C,e[13]=L):L=e[13];const{data:$}=ue(L);let v,S,w;if(e[14]!==n||e[15]!==l||e[16]!==r||e[17]!==o||e[18]!==m){const B=r?.trim()?{operator:"or",conditions:[{field:["name"],operator:"contains",value:r},{field:["title"],operator:"contains",value:r},{field:["description"],operator:"contains",value:r}]}:void 0;v={limit:Je,...m.length>0&&{tags:m},...o.length>0&&{categories:o},...B&&{where:B}},w=Ne,S=le.toolCall(l,n,JSON.stringify(v)),e[14]=n,e[15]=l,e[16]=r,e[17]=o,e[18]=m,e[19]=v,e[20]=S,e[21]=w}else v=e[19],S=e[20],w=e[21];let T;e[22]!==j||e[23]!==v||e[24]!==n?(T=async B=>{const{pageParam:te}=B,de=te?{...v,cursor:te}:v,se=await j.callTool({name:n,arguments:de});return se.structuredContent??se},e[22]=j,e[23]=v,e[24]=n,e[25]=T):T=e[25];let z;e[26]!==T||e[27]!==S?(z={queryKey:S,queryFn:T,initialPageParam:void 0,getNextPageParam:Xe,staleTime:36e5,placeholderData:fe},e[26]=T,e[27]=S,e[28]=z):z=e[28];const{data:A,fetchNextPage:k,hasNextPage:u,isFetchingNextPage:x,isFetching:g,isLoading:R}=w(z);let P;e:{if(!A?.pages||A.pages.length===0){P=null;break e}const B=A.pages[0];if(typeof B=="object"&&B!==null&&"totalCount"in B&&typeof B.totalCount=="number"){P=B.totalCount;break e}P=null}const K=P,h=A?.pages;let F;e[29]!==h?(F=Ce(h),e[29]=h,e[30]=F):F=e[30];const E=F;let V;e[31]!==r||e[32]!==o.length||e[33]!==m.length?(V=m.length>0||o.length>0||!!r?.trim(),e[31]=r,e[32]=o.length,e[33]=m.length,e[34]=V):V=e[34];const O=V,_=g&&!x&&!R&&O;let q;e[35]!==k||e[36]!==u||e[37]!==x?(q=()=>{u&&!x&&k()},e[35]=k,e[36]=u,e[37]=x,e[38]=q):q=e[38];const M=q,W=u??!1,G=I?$?.tags:void 0,ee=I?$?.categories:void 0;let Y;return e[39]!==O||e[40]!==g||e[41]!==x||e[42]!==_||e[43]!==R||e[44]!==E||e[45]!==M||e[46]!==o||e[47]!==m||e[48]!==W||e[49]!==G||e[50]!==ee||e[51]!==K?(Y={items:E,totalCount:K,hasMore:W,isLoadingMore:x,isFiltering:_,isInitialLoading:R,isFetching:g,loadMore:M,availableTags:G,availableCategories:ee,selectedTags:m,selectedCategories:o,setSelectedTags:y,setSelectedCategories:b,hasActiveFilters:O},e[39]=O,e[40]=g,e[41]=x,e[42]=_,e[43]=R,e[44]=E,e[45]=M,e[46]=o,e[47]=m,e[48]=W,e[49]=G,e[50]=ee,e[51]=K,e[52]=Y):Y=e[52],Y}function Xe(t){if(typeof t=="object"&&t!==null){const e=t.nextCursor||t.cursor;if(e)return e}}function et(t,e){return[...t].sort((l,n)=>n.count-l.count).slice(0,e)}function ne(t){const e=H.c(52),{label:l,items:n,selectedItems:c,onToggle:r,onClear:a}=t,[i,m]=D.useState(""),[y,p]=D.useState(!1);let o,b,f,d,j,I,N,C,L,$,v;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==y||e[4]!==i||e[5]!==c){const k=[...i?n.filter(F=>F.value.toLowerCase().includes(i.toLowerCase())):n].sort(tt);f=c.length,b=Fe,L=y,$=p;let u;e[17]!==l?(u=s.jsx("span",{children:l}),e[17]=l,e[18]=u):u=e[18];let x;e[19]!==f?(x=f>0&&s.jsx("span",{className:"ml-1 rounded-full bg-primary text-primary-foreground px-1.5 py-0.5 text-[10px] font-medium",children:f}),e[19]=f,e[20]=x):x=e[20];let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Be,{size:14,className:"opacity-50"}),e[21]=g):g=e[21],e[22]!==x||e[23]!==u?(v=s.jsx(Ke,{asChild:!0,children:s.jsxs(U,{variant:"outline",size:"sm",className:"h-7 px-3 gap-1.5 text-xs font-normal flex-1",children:[u,x,g]})}),e[22]=x,e[23]=u,e[24]=v):v=e[24],o=Ae,I="w-64 p-0",N="start";let R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(ae,{size:16,className:"text-muted-foreground shrink-0"}),e[25]=R):R=e[25];let P;e[26]!==l?(P=l.toLowerCase(),e[26]=l,e[27]=P):P=e[27];const K=`Search ${P}...`;let h;e[28]===Symbol.for("react.memo_cache_sentinel")?(h=F=>m(F.target.value),e[28]=h):h=e[28],e[29]!==i||e[30]!==K?(C=s.jsx("div",{className:"shrink-0 w-full border-b border-border h-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-10 px-4 cursor-text",children:[R,s.jsx(ze,{type:"text",placeholder:K,value:i,onChange:h,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[29]=i,e[30]=K,e[31]=C):C=e[31],d="max-h-64 overflow-y-auto p-1 flex flex-col gap-1",j=k.length===0?s.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground text-center",children:"No results found"}):k.map(F=>{const E=c.includes(F.value);return s.jsxs("button",{onClick:()=>r(F.value),className:me("w-full flex items-center justify-between px-2 py-1.5 text-sm rounded cursor-pointer transition-colors",E?"bg-accent/50 text-foreground":"hover:bg-muted text-foreground"),children:[s.jsxs("span",{className:"truncate flex items-center gap-2",children:[E&&s.jsx(Ee,{size:16,className:"text-muted-foreground shrink-0"}),F.value]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-2 shrink-0",children:F.count})]},F.value)}),e[0]=n,e[1]=l,e[2]=r,e[3]=y,e[4]=i,e[5]=c,e[6]=o,e[7]=b,e[8]=f,e[9]=d,e[10]=j,e[11]=I,e[12]=N,e[13]=C,e[14]=L,e[15]=$,e[16]=v}else o=e[6],b=e[7],f=e[8],d=e[9],j=e[10],I=e[11],N=e[12],C=e[13],L=e[14],$=e[15],v=e[16];let S;e[32]!==d||e[33]!==j?(S=s.jsx("div",{className:d,children:j}),e[32]=d,e[33]=j,e[34]=S):S=e[34];let w;e[35]!==l||e[36]!==a||e[37]!==f?(w=f>0&&s.jsx("div",{className:"p-2 border-t border-border",children:s.jsxs(U,{variant:"ghost",size:"sm",onClick:a,className:"w-full text-xs text-muted-foreground hover:text-foreground",children:["Clear ",l.toLowerCase()]})}),e[35]=l,e[36]=a,e[37]=f,e[38]=w):w=e[38];let T;e[39]!==o||e[40]!==w||e[41]!==I||e[42]!==N||e[43]!==C||e[44]!==S?(T=s.jsxs(o,{className:I,align:N,children:[C,S,w]}),e[39]=o,e[40]=w,e[41]=I,e[42]=N,e[43]=C,e[44]=S,e[45]=T):T=e[45];let z;return e[46]!==b||e[47]!==T||e[48]!==L||e[49]!==$||e[50]!==v?(z=s.jsxs(b,{open:L,onOpenChange:$,children:[v,T]}),e[46]=b,e[47]=T,e[48]=L,e[49]=$,e[50]=v,e[51]=z):z=e[51],z}function tt(t,e){return e.count-t.count}function st(t){const e=H.c(67),{availableTags:l,availableCategories:n,selectedTags:c,selectedCategories:r,onTagChange:a,onCategoryChange:i}=t,m=l&&l.length>0||n&&n.length>0,y=c.length>0||r.length>0;if(!m)return null;let p;e[0]!==a||e[1]!==c?(p=u=>{c.includes(u)?a(c.filter(x=>x!==u)):a([...c,u])},e[0]=a,e[1]=c,e[2]=p):p=e[2];const o=p;let b;e[3]!==i||e[4]!==r?(b=u=>{r.includes(u)?i(r.filter(x=>x!==u)):i([...r,u])},e[3]=i,e[4]=r,e[5]=b):b=e[5];const f=b;let d;e[6]!==i||e[7]!==a?(d=()=>{a([]),i([])},e[6]=i,e[7]=a,e[8]=d):d=e[8];const j=d;let I,N,C,L,$,v,S;if(e[9]!==n||e[10]!==l||e[11]!==i||e[12]!==a||e[13]!==r||e[14]!==c||e[15]!==f||e[16]!==o){const u=n?et(n,6):[];I=r,N=c,S=new Set(u.map(lt)),$="flex items-center border-b border-border";let x;e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:s.jsx(ie,{size:16})}),e[24]=x):x=e[24];let g;e[25]!==n||e[26]!==i||e[27]!==r||e[28]!==f?(g=n&&n.length>0&&s.jsx(ne,{label:"Categories",items:n,selectedItems:r,onToggle:f,onClear:()=>i([])}),e[25]=n,e[26]=i,e[27]=r,e[28]=f,e[29]=g):g=e[29];let R;e[30]!==l||e[31]!==a||e[32]!==c||e[33]!==o?(R=l&&l.length>0&&s.jsx(ne,{label:"Tags",items:l,selectedItems:c,onToggle:o,onClear:()=>a([])}),e[30]=l,e[31]=a,e[32]=c,e[33]=o,e[34]=R):R=e[34],e[35]!==R||e[36]!==g?(v=s.jsxs("div",{className:"flex items-center gap-3 flex-wrap px-5 py-3 border-r border-border",children:[x,g,R]}),e[35]=R,e[36]=g,e[37]=v):v=e[37],C="flex items-center gap-3 flex-wrap px-5 py-3";let P;e[38]!==r||e[39]!==f?(P=K=>{const h=r.includes(K.value);return s.jsxs("div",{onClick:()=>f(K.value),className:me("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer",h?"bg-primary text-primary-foreground hover:bg-primary/80":"bg-muted hover:bg-accent text-muted-foreground"),children:[s.jsx("span",{children:K.value}),h&&s.jsx("span",{onClick:F=>{F.stopPropagation(),f(K.value)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},K.value)},e[38]=r,e[39]=f,e[40]=P):P=e[40],L=u.map(P),e[9]=n,e[10]=l,e[11]=i,e[12]=a,e[13]=r,e[14]=c,e[15]=f,e[16]=o,e[17]=I,e[18]=N,e[19]=C,e[20]=L,e[21]=$,e[22]=v,e[23]=S}else I=e[17],N=e[18],C=e[19],L=e[20],$=e[21],v=e[22],S=e[23];let w;if(e[41]!==I||e[42]!==f||e[43]!==S){let u;e[45]!==S?(u=g=>!S.has(g),e[45]=S,e[46]=u):u=e[46];let x;e[47]!==f?(x=g=>s.jsxs("div",{onClick:()=>f(g),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[s.jsx("span",{children:g}),s.jsx("span",{onClick:R=>{R.stopPropagation(),f(g)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},`cat-${g}`),e[47]=f,e[48]=x):x=e[48],w=I.filter(u).map(x),e[41]=I,e[42]=f,e[43]=S,e[44]=w}else w=e[44];let T;if(e[49]!==N||e[50]!==o){let u;e[52]!==o?(u=x=>s.jsxs("div",{onClick:()=>o(x),className:"inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer bg-primary text-primary-foreground hover:bg-accent/50",children:[s.jsx("span",{children:x}),s.jsx("span",{onClick:g=>{g.stopPropagation(),o(x)},className:"hover:bg-primary/20 rounded-full p-0.5 -mr-1 cursor-pointer flex items-center",children:s.jsx(J,{size:12})})]},`tag-${x}`),e[52]=o,e[53]=u):u=e[53],T=N.map(u),e[49]=N,e[50]=o,e[51]=T}else T=e[51];let z;e[54]!==j||e[55]!==y?(z=y&&s.jsxs(U,{variant:"ghost",size:"sm",onClick:j,className:"h-7 text-xs text-muted-foreground hover:text-foreground gap-1 px-2",children:[s.jsx(J,{size:14}),"Clear all"]}),e[54]=j,e[55]=y,e[56]=z):z=e[56];let A;e[57]!==z||e[58]!==C||e[59]!==L||e[60]!==w||e[61]!==T?(A=s.jsxs("div",{className:C,children:[L,w,T,z]}),e[57]=z,e[58]=C,e[59]=L,e[60]=w,e[61]=T,e[62]=A):A=e[62];let k;return e[63]!==A||e[64]!==$||e[65]!==v?(k=s.jsxs("div",{className:$,children:[v,A]}),e[63]=A,e[64]=$,e[65]=v,e[66]=k):k=e[66],k}function lt(t){return t.value}function rt(t,e){if(!e)return t;const l=e.toLowerCase();return t.filter(n=>(n.name||n.title||"").toLowerCase().includes(l)||(n.description||n.server.description||"").toLowerCase().includes(l))}function nt(t){return t.verified===!0||t._meta?.["mcp.mesh"]?.verified===!0}function ot(t){const e=H.c(54),{registryId:l,listToolName:n,filtersToolName:c}=t,[r,a]=D.useState(""),i=Ue(r,300),m=oe(),{org:y}=X(),{scrollRef:p,saveScrollPosition:o,handleScroll:b}=Ye(`store-discovery:${l}`);let f;e[0]!==i||e[1]!==c||e[2]!==n||e[3]!==l?(f={registryId:l,listToolName:n,filtersToolName:c,search:i},e[0]=i,e[1]=c,e[2]=n,e[3]=l,e[4]=f):f=e[4];const{items:d,hasMore:j,isLoadingMore:I,isInitialLoading:N,isFetching:C,loadMore:L,availableTags:$,availableCategories:v,selectedTags:S,selectedCategories:w,setSelectedTags:T,setSelectedCategories:z,hasActiveFilters:A}=Ze(f);let k,u,x,g;e[5]!==i||e[6]!==C||e[7]!==N||e[8]!==d||e[9]!==r?(k=r?rt(d,r):d,u=(r!==i||C)&&!N&&!!r,g=k.filter(nt),x=k.filter(M=>!g.find(W=>W.id===M.id)),e[5]=i,e[6]=C,e[7]=N,e[8]=d,e[9]=r,e[10]=k,e[11]=u,e[12]=x,e[13]=g):(k=e[10],u=e[11],x=e[12],g=e[13]);const R=x;let P;e[14]!==m||e[15]!==y.slug||e[16]!==l||e[17]!==o?(P=M=>{o();const W=ke(M.name||M.title||M.server.title||""),G=M.server.name;m({to:"/$org/store/$appName",params:{org:y.slug,appName:W},search:{registryId:l,serverName:G}})},e[14]=m,e[15]=y.slug,e[16]=l,e[17]=o,e[18]=P):P=e[18];const K=P;let h;e[19]!==b||e[20]!==j||e[21]!==I||e[22]!==L?(h=M=>{if(b(),!j||I)return;const W=M.currentTarget;W.scrollHeight-W.scrollTop-W.clientHeight<200&&L()},e[19]=b,e[20]=j,e[21]=I,e[22]=L,e[23]=h):h=e[23];const F=h;let E;e[24]!==u||e[25]!==r?(E=s.jsx(Le,{value:r,onChange:a,placeholder:"Search for an MCP Server...",isSearching:u}),e[24]=u,e[25]=r,e[26]=E):E=e[26];let V;e[27]!==v||e[28]!==$||e[29]!==w||e[30]!==S||e[31]!==z||e[32]!==T?(V=s.jsx(st,{availableTags:$,availableCategories:v,selectedTags:S,selectedCategories:w,onTagChange:T,onCategoryChange:z}),e[27]=v,e[28]=$,e[29]=w,e[30]=S,e[31]=z,e[32]=T,e[33]=V):V=e[33];let O;e[34]!==R||e[35]!==k||e[36]!==K||e[37]!==A||e[38]!==j||e[39]!==N||e[40]!==I||e[41]!==u||e[42]!==d||e[43]!==r||e[44]!==g?(O=s.jsx("div",{className:"p-5",children:s.jsx("div",{children:N?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):d.length===0&&!A?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(be,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No items available"}),s.jsx("p",{className:"text-muted-foreground",children:"This store doesn't have any available items yet."})]}):d.length===0&&A&&!r?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(ie,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No matching items"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your filters to find more results."})]}):r&&k.length===0&&!u?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(ae,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No results found"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search terms."})]}):s.jsxs("div",{className:"flex flex-col gap-8",children:[u&&k.length===0&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching..."})]}),g.length>0&&s.jsx(re,{items:g,title:"Verified",onItemClick:K}),R.length>0&&s.jsx(re,{items:R,title:g.length>0?"All":"",onItemClick:K}),j&&I&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Z,{size:20,className:"animate-spin"}),s.jsx("span",{className:"text-sm",children:"Loading more items..."})]})})]})})}),e[34]=R,e[35]=k,e[36]=K,e[37]=A,e[38]=j,e[39]=N,e[40]=I,e[41]=u,e[42]=d,e[43]=r,e[44]=g,e[45]=O):O=e[45];let _;e[46]!==F||e[47]!==p||e[48]!==O?(_=s.jsx("div",{ref:p,className:"flex-1 overflow-y-auto",onScroll:F,children:O}),e[46]=F,e[47]=p,e[48]=O,e[49]=_):_=e[49];let q;return e[50]!==E||e[51]!==V||e[52]!==_?(q=s.jsxs("div",{className:"flex flex-col h-full",children:[E,V,_]}),e[50]=E,e[51]=V,e[52]=_,e[53]=q):q=e[53],q}function it(t){const e=H.c(8),{registryId:l}=t,n=Pe(l),c=n?.tools;let r;e[0]!==c?(r=Se(c),e[0]=c,e[1]=r):r=e[1];const a=r;if(!a)throw new Error("This registry does not support listing store items.");const i=n?.tools;let m;e[2]!==i?(m=we(i),e[2]=i,e[3]=m):m=e[3];const p=m||void 0;let o;return e[4]!==a||e[5]!==l||e[6]!==p?(o=s.jsx(ot,{registryId:l,listToolName:a,filtersToolName:p}),e[4]=a,e[5]=l,e[6]=p,e[7]=o):o=e[7],o}function at(t){const e=H.c(15),{registries:l,value:n,onValueChange:c,onAddWellKnown:r,wellKnownRegistries:a,placeholder:i}=t,m=i===void 0?"Select a registry...":i;let y;e[0]!==m?(y=s.jsx(Me,{size:"sm",className:"w-auto min-w-[160px]",children:s.jsx(Ve,{placeholder:m})}),e[0]=m,e[1]=y):y=e[1];let p;e[2]!==l?(p=l.map(ct),e[2]=l,e[3]=p):p=e[3];let o;e[4]!==r||e[5]!==a?(o=a.length>0&&s.jsxs("div",{className:"border-t border-border pt-1",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Other known registries"}),a.map(d=>s.jsxs("button",{onClick:j=>{j.preventDefault(),j.stopPropagation(),r(d)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[d.icon?s.jsx("img",{src:d.icon,alt:d.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:d.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"flex-1",children:d.title})]}),s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center text-muted-foreground",children:s.jsx(_e,{size:16})})]},d.id??d.title))]}),e[4]=r,e[5]=a,e[6]=o):o=e[6];let b;e[7]!==p||e[8]!==o?(b=s.jsxs(Oe,{children:[p,o]}),e[7]=p,e[8]=o,e[9]=b):b=e[9];let f;return e[10]!==c||e[11]!==y||e[12]!==b||e[13]!==n?(f=s.jsxs(We,{value:n,onValueChange:c,children:[y,b]}),e[10]=c,e[11]=y,e[12]=b,e[13]=n,e[14]=f):f=e[14],f}function ct(t){return s.jsx(De,{className:"cursor-pointer",value:t.id??t.name,children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?s.jsx("img",{src:t.icon,alt:t.name,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.name.slice(0,1).toUpperCase()}),s.jsx("span",{children:t.name})]})},t.id??t.name)}function mt({registries:t,onConnected:e}){const l=ce(),{org:{slug:n}}=X(),{data:c}=xe.useSession(),r=oe(),[a,i]=D.useState(!1),m=t[0],y=async()=>{if(!(!m||!c?.user?.id)){i(!0);try{const o=await l.create.mutateAsync(m);e?.(o.id)}finally{i(!1)}}},p=()=>{r({to:"/$org/mcps",params:{org:n},search:{action:"create"}})};return s.jsx(qe,{image:s.jsx("img",{src:"/store-empty-state.svg",alt:"No store connected",width:336,height:320,className:"max-w-full h-auto"}),title:"Connect to registry",description:"Connect to discover and use Connections from the community.",actions:s.jsxs(s.Fragment,{children:[s.jsxs(U,{variant:"outline",onClick:y,disabled:a||!m,children:[m?.icon&&s.jsx("img",{src:m.icon,alt:"",className:"size-4"}),a?"Installing...":"Install Registry"]}),s.jsx(U,{variant:"outline",onClick:p,children:"Custom Connection"})]})})}function Ut(){const t=H.c(42),{org:e}=X(),l=$e(),n=ce(),c=ge(),r=c.location.pathname.includes("/store/")&&c.location.pathname.split("/").length>3,a=He(l);let i;t[0]!==a?(i=a.map(ft),t[0]=a,t[1]=i):i=t[1];const m=i;let y;t[2]!==e.slug?(y=Ge.selectedRegistry(e.slug),t[2]=e.slug,t[3]=y):y=t[3];const[p,o]=Qe(y,ut);let b;if(t[4]!==a||t[5]!==p){let h;t[7]!==p?(h=F=>F.id===p,t[7]=p,t[8]=h):h=t[8],b=a.find(h),t[4]=a,t[5]=p,t[6]=b}else b=t[6];const d=b?.id||a[0]?.id||"";let j;t[9]!==e.id?(j=Ie(e.id),t[9]=e.id,t[10]=j):j=t[10];let I;t[11]!==j?(I=[j],t[11]=j,t[12]=I):I=t[12];const N=I;let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=[Re()],t[13]=C):C=t[13];const L=C;let $;t[14]!==n.create||t[15]!==o?($=async h=>{const F=await n.create.mutateAsync(h);o(F.id)},t[14]=n.create,t[15]=o,t[16]=$):$=t[16];const v=$;let S;t[17]!==a?(S=new Set(a.map(dt)),t[17]=a,t[18]=S):S=t[18];const w=S;let T;t[19]!==w||t[20]!==N?(T=N.filter(h=>h.id&&!w.has(h.id)),t[19]=w,t[20]=N,t[21]=T):T=t[21];const z=T;let A;t[22]!==w?(A=L.filter(h=>h.id&&!w.has(h.id)),t[22]=w,t[23]=A):A=t[23];const k=A;if(r){let h;return t[24]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(pe,{}),t[24]=h):h=t[24],h}let u;t[25]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Q.Header.Left,{children:s.jsx(he,{children:s.jsx(je,{children:s.jsx(ve,{children:s.jsx(ye,{children:"Store"})})})})}),t[25]=u):u=t[25];let x;t[26]!==v?(x=async h=>v(h),t[26]=v,t[27]=x):x=t[27];let g;t[28]!==z||t[29]!==d||t[30]!==m||t[31]!==o||t[32]!==x?(g=s.jsxs(Q.Header,{children:[u,s.jsx(Q.Header.Right,{children:s.jsx(at,{wellKnownRegistries:z,registries:m,value:d,onValueChange:o,onAddWellKnown:x,placeholder:"Select store..."})})]}),t[28]=z,t[29]=d,t[30]=m,t[31]=o,t[32]=x,t[33]=g):g=t[33];let R;t[34]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading store items..."})]}),t[34]=R):R=t[34];let P;t[35]!==k||t[36]!==d||t[37]!==o?(P=s.jsx(Q.Content,{children:s.jsx(D.Suspense,{fallback:R,children:d?s.jsx(it,{registryId:d}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:s.jsx(mt,{registries:k,onConnected:h=>{o(h)}})})})}),t[35]=k,t[36]=d,t[37]=o,t[38]=P):P=t[38];let K;return t[39]!==g||t[40]!==P?(K=s.jsxs(Q,{children:[g,P]}),t[39]=g,t[40]=P,t[41]=K):K=t[41],K}function dt(t){return t.id}function ut(t){return t??""}function ft(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{Ut as default};
@@ -1 +0,0 @@
1
- import{c as b,j as s,r as $,u as ie,g as re,v as Z}from"./index-BgOoHyXW.js";import{V as ne,C as g}from"./index-C_wS7kU0.js";import{T as oe,i as ae,a as ce,t as me}from"./typewriter-title-BUQDml2i.js";import{E as de}from"./error-boundary-gLETJlNI.js";import{u as Y,S as X}from"./collapsible-BoMwbmju.js";import{I as ee,T as G,a as K,c as J}from"./empty-state-D1xTHC6z.js";import{P as fe,a as ue,b as he}from"./popover-DUJwUSSM.js";import{c as te,B as V}from"./button-DZky_O5b.js";import{i as xe,d as pe}from"./constants-G7VjePam.js";import{b as ge}from"./use-virtual-mcp-XIWHgsHo.js";import{i as je}from"./ChevronRight-BOG2FNn-.js";import{t as se}from"./Users03-Bll7QSmr.js";import{P as A}from"./index-DJ2Jm9li.js";import{c as be}from"./Pin01-CDSgnzFS.js";import{s as Ne}from"./Plus-CKeAhIyX.js";import{i as ye}from"./Share07-BIhcsqZd.js";import"./X-DPo-5hWo.js";import"./spinner-C10QwZNL.js";import"./use-mcp-prompts-DkUA9eji.js";import"./useQuery-BlNmU8Jq.js";import"./dialog-BfMrinrm.js";import"./form-BmYBK--9.js";import"./input-BzaoEOCn.js";import"./AlertCircle-exKB88m_.js";import"./ArrowUp-NeI_Sm5E.js";import"./ChevronDown-DNLmRmxT.js";import"./Edit01-Zee8_Yir.js";import"./Check-DqzdHNMw.js";import"./Copy01-BLooCkZe.js";import"./Terminal-CRout4QP.js";import"./monaco-editor-ClMv24Rj.js";import"./localstorage-keys-D6GRYm3g.js";import"./useMutation-Ngf5wAT3.js";import"./use-connection-sLATlyBj.js";import"./use-collections-CE5nYbrV.js";import"./generate-id-Dyweu44Y.js";import"./SearchMd-BH2aZiBv.js";import"./Trash01-DWmC_leT.js";import"./badge-CTM0uIWD.js";import"./Code01-D9NkYkuA.js";import"./infiniteQueryObserver-DeNzkqh2.js";import"./use-create-virtual-mcp-CAqC56mj.js";import"./use-binding-COwUQLKP.js";import"./binder-Rtvfp3ct.js";import"./select-iwsI8D5M.js";import"./File06-CNHRuvsg.js";import"./Grid01-BGQX-rj4.js";import"./Image01-DPdsVLq5.js";function _e(e){const t=b.c(15),{agent:l}=e,{setVirtualMcpId:h}=Y();let i;t[0]!==l.id||t[1]!==h?(i=()=>{h(l.id)},t[0]=l.id,t[1]=h,t[2]=i):i=t[2];const r=i;let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=te("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=a):a=t[3];const c=`Select agent ${l.title}`;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(se,{size:20}),t[4]=d):d=t[4];let n;t[5]!==l.icon||t[6]!==l.title?(n=s.jsx(ee,{icon:l.icon,name:l.title,fallbackIcon:d}),t[5]=l.icon,t[6]=l.title,t[7]=n):n=t[7];let o;t[8]!==l.title?(o=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:l.title}),t[8]=l.title,t[9]=o):o=t[9];let m;return t[10]!==r||t[11]!==c||t[12]!==n||t[13]!==o?(m=s.jsxs("button",{type:"button",onClick:r,className:a,"aria-label":c,children:[n,o]}),t[10]=r,t[11]=c,t[12]=n,t[13]=o,t[14]=m):m=t[14],m}function Se(e){const t=b.c(14),{virtualMcps:l,selectedVirtualMcpId:h,onVirtualMcpChange:i}=e,[r,a]=$.useState(!1),c=$.useRef(null);let d,n;t[0]!==r?(d=()=>{r&&setTimeout(()=>{c.current?.focus()},0)},n=[r],t[0]=r,t[1]=d,t[2]=n):(d=t[1],n=t[2]),$.useEffect(d,n);let o;t[3]!==i?(o=Q=>{i(Q),a(!1)},t[3]=i,t[4]=o):o=t[4];const m=o;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=te("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(fe,{asChild:!0,children:s.jsxs("button",{type:"button",className:f,"aria-label":"See all agents",children:[s.jsx("div",{className:"size-12 rounded-lg bg-accent flex items-center justify-center shrink-0",children:s.jsx(je,{size:24,className:"text-foreground"})}),s.jsx("p",{className:"text-sm text-foreground text-center leading-tight",children:"See all"})]})}),t[6]=u):u=t[6];let x;t[7]!==m||t[8]!==h||t[9]!==l?(x=s.jsx(ue,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(ne,{virtualMcps:l,selectedVirtualMcpId:h,onVirtualMcpChange:m,searchInputRef:c})}),t[7]=m,t[8]=h,t[9]=l,t[10]=x):x=t[10];let j;return t[11]!==r||t[12]!==x?(j=s.jsxs(he,{open:r,onOpenChange:a,children:[u,x]}),t[11]=r,t[12]=x,t[13]=j):j=t[13],j}function ve(){const e=b.c(20),t=ge(),{selectedVirtualMcp:l,setVirtualMcpId:h}=Y();let i,r,a,c,d,n;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const x=t.filter(ke).slice(0,6);if(x.length===0){d=null;break e}n=t.map(we),a="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=c):c=e[7],i="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",r=x.map(Ce)}e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c,e[5]=d,e[6]=n}else i=e[1],r=e[2],a=e[3],c=e[4],d=e[5],n=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;const o=l?.id??null;let m;e[8]!==h||e[9]!==o||e[10]!==n?(m=s.jsx(Se,{virtualMcps:n,selectedVirtualMcpId:o,onVirtualMcpChange:h}),e[8]=h,e[9]=o,e[10]=n,e[11]=m):m=e[11];let f;e[12]!==i||e[13]!==r||e[14]!==m?(f=s.jsxs("div",{className:i,children:[r,m]}),e[12]=i,e[13]=r,e[14]=m,e[15]=f):f=e[15];let u;return e[16]!==a||e[17]!==c||e[18]!==f?(u=s.jsxs("div",{className:a,children:[c,f]}),e[16]=a,e[17]=c,e[18]=f,e[19]=u):u=e[19],u}function Ce(e){return s.jsx(_e,{agent:e},e.id??"default")}function we(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function ke(e){return e.id!==null&&!xe(e.id)}function ze(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(X,{className:"h-5 w-40 mb-4"}),e[0]=t):t=e[0];let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"w-full max-w-[800px]",children:[t,s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",children:Array.from({length:7}).map(Te)})]}),e[1]=l):l=e[1],l}function Te(e,t){return s.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 self-stretch",children:[s.jsx(X,{className:"size-6 rounded-md shrink-0"}),s.jsx(X,{className:"h-4 w-full"})]},t)}function Me(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx($.Suspense,{fallback:s.jsx(ze,{}),children:s.jsx(ve,{})}),e[0]=t):t=e[0],t}function Ie(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function Pe(){const e=b.c(60),{org:t}=ie(),{data:l}=re.useSession(),{modelsConnections:h,isChatEmpty:i,activeThreadId:r,setActiveThreadId:a,threads:c,selectedVirtualMcp:d}=Y();let n;if(e[0]!==r||e[1]!==c){let p;e[3]!==r?(p=le=>le.id===r,e[3]=r,e[4]=p):p=e[4],n=c.find(p),e[0]=r,e[1]=c,e[2]=n}else n=e[2];const o=n,[m,f]=$.useState(!1);let u;e[5]!==l?.user?.name?(u=l?.user?.name?.split(" ")[0]||"there",e[5]=l?.user?.name,e[6]=u):u=e[6];const x=u;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=Ie(),e[7]=j):j=e[7];const Q=j;let E;e[8]!==t.id?(E=pe(t.id),e[8]=t.id,e[9]=E):E=e[9];const H=d??E;if(h.length===0){let p;return e[10]!==t?(p=s.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:s.jsx(g.NoLlmBindingEmptyState,{org:t})}),e[10]=t,e[11]=p):p=e[11],p}let N;e[12]!==o||e[13]!==i?(N=s.jsx(A.Header.Left,{className:"gap-2",children:!i&&o?.title?s.jsx(oe,{text:o.title,className:"text-sm font-medium text-foreground"}):s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[12]=o,e[13]=i,e[14]=N):N=e[14];let y;e[15]!==a?(y=()=>a(crypto.randomUUID()),e[15]=a,e[16]=y):y=e[16];let R;e[17]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ne,{size:16}),e[17]=R):R=e[17];let _;e[18]!==i||e[19]!==y?(_=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:y,disabled:i,"aria-label":"New chat",children:R})}),e[18]=i,e[19]=y,e[20]=_):_=e[20];let B;e[21]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(K,{children:"New chat"}),e[21]=B):B=e[21];let S;e[22]!==_?(S=s.jsxs(J,{children:[_,B]}),e[22]=_,e[23]=S):S=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=()=>f(!0),e[24]=L):L=e[24];let O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsxs(J,{children:[s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:L,"aria-label":"Chat history",children:s.jsx(ae,{size:16})})}),s.jsx(K,{children:"Chat history"})]}),e[25]=O):O=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(be,{size:16}),e[26]=D):D=e[26];let v;e[27]!==i?(v=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ae,disabled:i,"aria-label":"Pin chat",children:D})}),e[27]=i,e[28]=v):v=e[28];let F;e[29]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(K,{children:"Pin chat"}),e[29]=F):F=e[29];let C;e[30]!==v?(C=s.jsxs(J,{children:[v,F]}),e[30]=v,e[31]=C):C=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(ye,{size:16}),e[32]=U):U=e[32];let w;e[33]!==i?(w=s.jsx(G,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:$e,disabled:i,"aria-label":"Share chat",children:U})}),e[33]=i,e[34]=w):w=e[34];let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(K,{children:"Share chat"}),e[35]=W):W=e[35];let k;e[36]!==w?(k=s.jsxs(J,{children:[w,W]}),e[36]=w,e[37]=k):k=e[37];let z;e[38]!==C||e[39]!==k||e[40]!==S?(z=s.jsxs(A.Header.Right,{className:"gap-1",children:[S,O,C,k]}),e[38]=C,e[39]=k,e[40]=S,e[41]=z):z=e[41];let T;e[42]!==z||e[43]!==N?(T=s.jsxs(A.Header,{className:"flex-none",children:[N,z]}),e[42]=z,e[43]=N,e[44]=T):T=e[44];let M;e[45]!==H||e[46]!==i||e[47]!==x?(M=i?s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(ee,{icon:H.icon,name:H.title,size:"md",fallbackIcon:s.jsx(se,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-foreground",children:[Q," ",x,","]}),s.jsx("p",{className:"text-base text-muted-foreground opacity-50 mb-0",children:"What are we building today?"})]}),s.jsx("div",{className:"w-full -mt-1",children:s.jsx(g.Input,{})}),s.jsx(g.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(Me,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(g.Main,{children:s.jsx(g.Messages,{})}),s.jsx(g.Footer,{children:s.jsx(g.Input,{})})]}),e[45]=H,e[46]=i,e[47]=x,e[48]=M):M=e[48];let I;e[49]!==a?(I=p=>{a(p),f(!1)},e[49]=a,e[50]=I):I=e[50];let P;e[51]!==r||e[52]!==m||e[53]!==I||e[54]!==c?(P=s.jsx(ce,{open:m,onOpenChange:f,threads:c,activeThreadId:r,onThreadSelect:I}),e[51]=r,e[52]=m,e[53]=I,e[54]=c,e[55]=P):P=e[55];let q;return e[56]!==T||e[57]!==M||e[58]!==P?(q=s.jsxs(g,{className:"bg-background",children:[T,M,P]}),e[56]=T,e[57]=M,e[58]=P,e[59]=q):q=e[59],q}function $e(){Z.info("Share feature coming soon")}function Ae(){Z.info("Pin feature coming soon")}function Ve(e){const t=b.c(14),{error:l,onRetry:h}=e,i=l?.message?.includes("401")||l?.message?.toLowerCase().includes("unauthorized");let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs(A.Header,{className:"flex-none",children:[s.jsx(A.Header.Left,{className:"gap-2",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),s.jsx(A.Header.Right,{className:"gap-1"})]}),t[0]=r):r=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(me,{className:"h-6 w-6 text-destructive"})}),t[1]=a):a=t[1];const c=i?"Unable to load models":"Something went wrong";let d;t[2]!==c?(d=s.jsx("h3",{className:"text-lg font-medium",children:c}),t[2]=c,t[3]=d):d=t[3];const n=i?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":l?.message||"An unexpected error occurred";let o;t[4]!==n?(o=s.jsx("p",{className:"text-sm text-muted-foreground",children:n}),t[4]=n,t[5]=o):o=t[5];let m;t[6]!==d||t[7]!==o?(m=s.jsxs("div",{className:"space-y-2",children:[d,o]}),t[6]=d,t[7]=o,t[8]=m):m=t[8];let f;t[9]!==h?(f=s.jsx(V,{variant:"outline",onClick:h,children:"Try again"}),t[9]=h,t[10]=f):f=t[10];let u;return t[11]!==m||t[12]!==f?(u=s.jsxs(g,{className:"bg-background",children:[r,s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:s.jsxs("div",{className:"max-w-sm space-y-4",children:[a,m,f]})})]}),t[11]=m,t[12]=f,t[13]=u):u=t[13],u}function Pt(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(de,{fallback:Ee,children:s.jsx($.Suspense,{fallback:s.jsx(g.Skeleton,{className:"bg-background"}),children:s.jsx(Pe,{})})}),e[0]=t):t=e[0],t}function Ee(e){const{error:t,resetError:l}=e;return s.jsx(Ve,{error:t,onRetry:l})}export{Pt as default};
@@ -1 +0,0 @@
1
- import{c as T,u as z,j as n}from"./index-BgOoHyXW.js";import{B as y}from"./button-DZky_O5b.js";import{T as C,a as S,b as B,c as v}from"./empty-state-D1xTHC6z.js";import{c as A}from"./Pin01-CDSgnzFS.js";import{u as E,a as I}from"./use-organization-settings-OSGN2_Jg.js";function $(h){const e=T.c(19),{title:u,url:t,icon:p}=h,{org:_}=z(),s=E(_.id),f=I(_.id);let a;e[0]!==s?.sidebar_items||e[1]!==t?(a=s?.sidebar_items?.some(m=>m.url===t),e[0]=s?.sidebar_items,e[1]=t,e[2]=a):a=e[2];const r=!!a;let l;e[3]!==f.update||e[4]!==p||e[5]!==r||e[6]!==s?.sidebar_items||e[7]!==u||e[8]!==t?(l=async()=>{const m=s?.sidebar_items||[];let j;r?j=m.filter(P=>P.url!==t):j=[...m,{title:u,url:t,icon:p}],await f.update.mutateAsync({sidebar_items:j})},e[3]=f.update,e[4]=p,e[5]=r,e[6]=s?.sidebar_items,e[7]=u,e[8]=t,e[9]=l):l=e[9];const b=l,x=r?"secondary":"outline";let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(A,{size:16}),e[10]=c):c=e[10];let i;e[11]!==b||e[12]!==x?(i=n.jsx(C,{asChild:!0,children:n.jsx(y,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:c})}),e[11]=b,e[12]=x,e[13]=i):i=e[13];const g=r?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=n.jsx(S,{children:g}),e[14]=g,e[15]=o):o=e[15];let d;return e[16]!==i||e[17]!==o?(d=n.jsx(B,{children:n.jsxs(v,{children:[i,o]})}),e[16]=i,e[17]=o,e[18]=d):d=e[18],d}export{$ as P};
@@ -1 +0,0 @@
1
- import{r as o}from"./index-BgOoHyXW.js";import{c as s}from"./constants-G7VjePam.js";const c=({size:t=24,color:n="currentColor",...e})=>o.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:n,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e},o.createElement("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10m0-20a15.3 15.3 0 0 0-4 10 15.3 15.3 0 0 0 4 10m0-20C6.477 2 2 6.477 2 12s4.477 10 10 10m0-20c5.523 0 10 4.477 10 10s-4.477 10-10 10M2.5 9h19m-19 6h19"}));c.displayName="Globe02";function m(t){return t?t.find(e=>e.name.endsWith("_LIST"))?.name??"":""}function d(t){return t?t.find(e=>e.name.endsWith("_FILTERS"))?.name??"":""}function h(t){if(!t)return[];const n=[];for(const e of t){let r=[];if(Array.isArray(e))r=e;else if(typeof e=="object"&&e!==null){const i=Object.keys(e).find(a=>Array.isArray(e[a]));i&&(r=e[i])}n.push(...r)}return n}const l={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function y(t){return t?l[t]??t.toUpperCase():null}function T(t){return t?t.match(/schemas\/([\d-]+)/)?.[1]??null:null}function b(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null){const n=Object.keys(t).find(e=>Array.isArray(t[e]));if(n)return t[n]}return[]}async function A(t,n,e,r){const i=await s({connectionId:t,orgId:n});try{const a=await i.callTool({name:e,arguments:r});return a.structuredContent??a}finally{await i.close().catch(console.error)}}export{h as a,d as b,T as c,A as d,b as e,m as f,y as g,c as s};
@@ -1 +0,0 @@
1
- import{c as x,j as u}from"./index-BgOoHyXW.js";import{c,B as p}from"./button-DZky_O5b.js";import{B as g}from"./badge-CTM0uIWD.js";function j(f){const e=x.c(12),{tabs:d,activeTab:n,onTabChange:s,className:l}=f;let t;e[0]!==l?(t=c("flex items-center gap-2 overflow-x-auto no-scrollbar",l),e[0]=l,e[1]=t):t=e[1];let o;if(e[2]!==n||e[3]!==s||e[4]!==d){let i;e[6]!==n||e[7]!==s?(i=r=>{const m=n===r.id;return u.jsxs(p,{variant:"outline",size:"sm",onClick:()=>s(r.id),className:c("h-8 rounded-lg border border-transparent bg-transparent px-3 py-1 hover:bg-muted",m&&"bg-muted border-input text-foreground font-medium",!m&&"text-muted-foreground font-normal"),children:[r.label,r.count!==void 0&&u.jsx(g,{variant:"secondary",className:c("ml-2 h-5 min-w-5 px-1 rounded-full text-[10px] font-mono",m?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:r.count})]},r.id)},e[6]=n,e[7]=s,e[8]=i):i=e[8],o=d.map(i),e[2]=n,e[3]=s,e[4]=d,e[5]=o}else o=e[5];let a;return e[9]!==t||e[10]!==o?(a=u.jsx("div",{className:t,children:o}),e[9]=t,e[10]=o,e[11]=a):a=e[11],a}export{j as R};
@@ -1 +0,0 @@
1
- import{r as c,aZ as rt,am as Ne,j as d,as as st,at as be,al as k,au as lt,ak as j,an as P,b1 as $,aw as at,a2 as _e,ax as Ee,b2 as it,ao as ct,b3 as dt,ay as ut,aB as pt,az as ft,aC as mt,aD as ht,aq as vt,aA as gt,aE as xt,aF as St,c as ee}from"./index-BgOoHyXW.js";import{V as wt}from"./empty-state-D1xTHC6z.js";import{i as Ct}from"./Check-DqzdHNMw.js";import{t as Re}from"./ChevronDown-DNLmRmxT.js";import{c as oe}from"./button-DZky_O5b.js";function Pe(n,[e,t]){return Math.min(t,Math.max(e,n))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=it(J),[ne]=vt(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=n=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:r,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=n,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[F,M]=c.useState(!1),re=rt(u),[_,O]=Ne({prop:o,defaultProp:r??!1,onChange:i,caller:J}),[U,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(st,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:n.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:b,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=c.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:o=!1,...r}=n,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(lt,{asChild:!0,...i,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...r,ref:a,onClick:P(r.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(r.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(r.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,children:i,placeholder:s="",...l}=n,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):i})});De.displayName=Oe;var _t="SelectIcon",ke=c.forwardRef((n,e)=>{const{__scopeSelect:t,children:o,...r}=n;return d.jsx(j.span,{"aria-hidden":!0,...r,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=n=>d.jsx(at,{asChild:!0,...n});Le.displayName=Et;var Q="SelectContent",Be=c.forwardRef((n,e)=>{const t=G(Q,n.__scopeSelect),[o,r]=c.useState();if($(()=>{r(new DocumentFragment)},[]),!t.open){const i=o;return i?_e.createPortal(d.jsx(Ve,{scope:n.__scopeSelect,children:d.jsx(de.Slot,{scope:n.__scopeSelect,children:d.jsx("div",{children:n.children})})}),i):null}return d.jsx(He,{...n,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=gt("SelectContent.RemoveScroll"),He=c.forwardRef((n,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=n,m=G(Q,t),[x,F]=c.useState(null),[M,re]=c.useState(null),_=k(e,f=>F(f)),[O,U]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return ut(x)},[x]),pt();const E=c.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),c.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(U(f),y&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(ft,{as:jt,allowPinchZoom:!0,children:d.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:o,...r}=n,i=G(Q,t),s=Y(Q,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,_=>h(_)),b=ue(t),w=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const _=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ie=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ie,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[F,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...r,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((n,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:r=A,...i}=n,s=pe(t);return d.jsx(xt,{...s,...i,ref:e,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=c.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:o,...r}=n,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=be();return d.jsx(Dt,{scope:t,id:r,children:d.jsx(j.div,{role:"group","aria-labelledby":r,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=kt(We,t);return d.jsx(j.div,{id:r.id,...o,ref:e})});Bt.displayName=We;var ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((n,e)=>{const{__scopeSelect:t,value:o,disabled:r=!1,textValue:i,...s}=n,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[b,w]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,r)),p=be(),v=c.useRef("touch"),C=()=>{r||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:r,textId:p,isSelected:u,onItemTextChange:c.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:r,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,r?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,...i}=n,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=c.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=c.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...i,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=c.forwardRef((n,e)=>{const t=Y(Ce,n.__scopeSelect),o=Te(Ce,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=c.forwardRef((n,e)=>{const t=Y(ye,n.__scopeSelect),o=Te(ye,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=c.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:o,...r}=n,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(r.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(r.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(St,{...r,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=c.forwardRef(({__scopeSelect:n,value:e,...t},o)=>{const r=c.useRef(null),i=k(o,r),s=ct(e);return c.useEffect(()=>{const l=r.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...wt,...t.style},ref:i,defaultValue:e})});Qe.displayName=Ut;function et(n){return n===""||n===void 0}function tt(n){const e=dt(n),t=c.useRef(""),o=c.useRef(0),r=c.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,r,i]}function ot(n,e,t){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let s=Wt(n,Math.max(i,0));r.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return a!==t?a:void 0}function Wt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;const nt=({size:n=24,color:e="currentColor",...t})=>c.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},c.createElement("path",{d:"m18 15-6-6-6 6"}));nt.displayName="ChevronUp";function uo(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(n){const e=ee.c(13);let t,o,r,i;e[0]!==n?({className:o,size:i,children:t,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"default":i;let l;e[5]!==o?(l=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...r,children:[t,a]}),e[8]=t,e[9]=r,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(n){const e=ee.c(25);let t,o,r,i,s;e[0]!==n?({className:o,children:t,position:i,hideScrollButtons:s,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i,e[5]=s):(t=e[1],o=e[2],r=e[3],i=e[4],s=e[5]);const l=i===void 0?"popper":i,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==r||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",className:h,position:l,...r,children:[g,S,p]})}),e[18]=l,e[19]=r,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(n){const e=ee.c(16);let t,o,r,i;e[0]!==n?({className:o,children:t,hideCheck:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?!1:i;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(Ct,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==r||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...r,children:[a,u]}),e[11]=r,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(nt,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}function ro(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e,nt as n};
@@ -1 +0,0 @@
1
- import{r as w,l as U,u as $,a1 as D,k as K,h as Q,v as C,K as M,g as A,j as e,q as H,c as T,o as W,s as k}from"./index-BgOoHyXW.js";import{P as N}from"./index-DJ2Jm9li.js";import{B as Y,a as Z,b as G,c as J}from"./breadcrumb-CPuY6F-0.js";import{u as V}from"./useMutation-Ngf5wAT3.js";import{B as S}from"./button-DZky_O5b.js";import{a as X,F as R,b as E,c as O,d as B,f as I,e as _}from"./form-BmYBK--9.js";import{I as q}from"./input-BzaoEOCn.js";import{i as ee}from"./ChevronRight-BOG2FNn-.js";import{i as se}from"./Upload01-Bykolsxu.js";import{i as re}from"./X-DPo-5hWo.js";const P=({size:d=24,color:s="currentColor",...t})=>w.createElement("svg",{viewBox:"0 0 24 24",width:d,height:d,stroke:s,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},w.createElement("path",{d:"m2 14.5 9.642 4.821c.131.066.197.099.266.111.06.012.123.012.184 0 .069-.012.135-.045.266-.11L22 14.5m-20-5 9.642-4.821c.131-.066.197-.098.266-.111a.5.5 0 0 1 .184 0c.069.013.135.045.266.111L22 9.5l-9.642 4.821a1.028 1.028 0 0 1-.266.111.501.501 0 0 1-.184 0c-.069-.012-.135-.045-.266-.11L2 9.5Z"}));P.displayName="LayersTwo01";const te=W({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function oe(d){const s=T.c(24),{value:t,onChange:a,name:m}=d,o=w.useRef(null);let u;s[0]!==a?(u=F=>{const L=F.target.files?.[0];if(L){if(L.size>2097152){C.error("Image must be smaller than 2MB");return}const c=new FileReader;c.onerror=()=>{const y=c.error;console.error("FileReader error:",y),C.error(y?.message||"Failed to read image file. Please try again."),o.current&&(o.current.value="")},c.onloadend=()=>{if(c.readyState===FileReader.DONE&&c.result){const y=c.result;a(y)}},c.readAsDataURL(L)}},s[0]=a,s[1]=u):u=s[1];const j=u;let l;s[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current?.click()},s[2]=l):l=s[2];const r=l;let i;s[3]!==a?(i=F=>{F.stopPropagation(),a("")},s[3]=a,s[4]=i):i=s[4];const n=i;let g;s[5]!==j?(g=e.jsx("input",{type:"file",ref:o,className:"hidden",accept:"image/*",onChange:j}),s[5]=j,s[6]=g):g=s[6];let x;s[7]!==n||s[8]!==m||s[9]!==t?(x=t?e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:e.jsx("img",{src:t,alt:m||"Organization logo",className:"w-full h-full object-cover"})}),e.jsx("button",{type:"button",onClick:n,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:e.jsx(re,{className:"h-3 w-3"})})]}):e.jsxs("button",{type:"button",onClick:r,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[e.jsx(se,{className:"h-5 w-5"}),e.jsx("span",{className:"text-xs",children:"Upload"})]}),s[7]=n,s[8]=m,s[9]=t,s[10]=x):x=s[10];const z=t?"Change Logo":"Upload Logo";let h;s[11]!==z?(h=e.jsx(S,{type:"button",variant:"outline",size:"sm",onClick:r,className:"mb-2",children:z}),s[11]=z,s[12]=h):h=s[12];let f;s[13]!==n||s[14]!==t?(f=t&&e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:n,className:"ml-2",children:"Remove"}),s[13]=n,s[14]=t,s[15]=f):f=s[15];let b;s[16]===Symbol.for("react.memo_cache_sentinel")?(b=e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),s[16]=b):b=s[16];let p;s[17]!==h||s[18]!==f?(p=e.jsxs("div",{className:"flex-1",children:[h,f,b]}),s[17]=h,s[18]=f,s[19]=p):p=s[19];let v;return s[20]!==p||s[21]!==g||s[22]!==x?(v=e.jsxs("div",{className:"flex items-start gap-4",children:[g,x,p]}),s[20]=p,s[21]=g,s[22]=x,s[23]=v):v=s[23],v}function he(){const d=U(),{org:s}=$(),t=D(),[a,m]=w.useState(!1),o=K({resolver:Q(te),values:{name:s.name??"",slug:s.slug??"",logo:s.logo??""}}),u=V({mutationFn:async r=>{const i={name:r.name,slug:r.slug};r.logo&&(i.logo=r.logo);const n=await A.organization.update({organizationId:s.id,data:i});if(n?.error)throw new Error(n.error.message||"Failed to update organization");return n},onSuccess:r=>{t.invalidateQueries({queryKey:M.organizations()}),t.invalidateQueries({queryKey:M.activeOrganization(s.slug)}),C.success("Organization settings updated successfully"),r?.data?.slug&&r.data.slug!==s.slug&&d({to:"/$org/settings",params:{org:r.data.slug}})},onError:r=>{C.error(r instanceof Error?r.message:"Failed to update organization")},onSettled:()=>{m(!1)}}),j=r=>{m(!0),u.mutate(r)},l=o.formState.isDirty;return e.jsxs(N,{children:[e.jsx(N.Header,{children:e.jsx(N.Header.Left,{children:e.jsx(Y,{children:e.jsx(Z,{children:e.jsx(G,{children:e.jsx(J,{children:"Settings"})})})})})}),e.jsx(N.Content,{children:e.jsx("div",{className:"flex h-full",children:e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"p-5 max-w-2xl",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Organization"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Update your organization's name, slug, and logo."})]}),e.jsx(X,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(j),className:"space-y-6",children:[e.jsx(R,{control:o.control,name:"name",render:({field:r})=>e.jsxs(E,{children:[e.jsx(O,{children:"Organization Name"}),e.jsx(B,{children:e.jsx(q,{placeholder:"My Organization",...r,disabled:a})}),e.jsx(I,{})]})}),e.jsx(R,{control:o.control,name:"slug",render:({field:r})=>e.jsxs(E,{children:[e.jsx(O,{children:"Organization Slug"}),e.jsx(B,{children:e.jsx(q,{placeholder:"my-organization",...r,disabled:a,onChange:i=>{const n=i.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");r.onChange(n)}})}),e.jsx(_,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),e.jsx(I,{})]})}),e.jsx(R,{control:o.control,name:"logo",render:({field:r})=>e.jsxs(E,{children:[e.jsx(O,{children:"Logo"}),e.jsx(B,{children:e.jsx(oe,{value:r.value,onChange:r.onChange,name:o.watch("name")})}),e.jsx(I,{})]})}),e.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[e.jsx(S,{type:"submit",disabled:!l||a,className:"min-w-24",children:a?"Saving...":"Save Changes"}),l&&e.jsx(S,{type:"button",variant:"outline",onClick:()=>o.reset(),disabled:a,children:"Cancel"})]})]})}),e.jsxs("div",{className:"border-t border-border pt-6 mt-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"More Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Additional configuration options for your organization."})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(H,{to:"/$org/settings/plugins",params:{org:s.slug},className:"flex items-center justify-between p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(P,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"Plugins"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for your organization"})]})]}),e.jsx(ee,{className:"h-5 w-5 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]})})})})})]})}export{he as default};