@decocms/mesh 2.59.2 → 2.59.4

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 (174) hide show
  1. package/dist/client/assets/{AlertCircle--GzH2vta.js → AlertCircle-DcHEglIM.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-DzpTEYvO.js → ArrowLeft-Dlm4CF9d.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BfBrilbk.js → ArrowUp-CC-2uYGu.js} +1 -1
  4. package/dist/client/assets/Calendar-PdB3o_9d.js +1 -0
  5. package/dist/client/assets/{Check-CXkamnnr.js → Check-BzMGOxMB.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-DaqG_J6Z.js → ChevronDown-BV0rwdFr.js} +1 -1
  7. package/dist/client/assets/{Code01-BNQVP8-g.js → Code01-KWN4ist8.js} +1 -1
  8. package/dist/client/assets/{Copy01-CpBgXJFP.js → Copy01-DH_iV9-n.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-BDAFctKq.js → DotsHorizontal-CFL9xkGv.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-D5MnD2QZ.js → DotsVertical-DOgWrY6o.js} +1 -1
  11. package/dist/client/assets/{Download01-4Tu3o0-K.js → Download01-npnn9kWB.js} +1 -1
  12. package/dist/client/assets/{Edit01-7Ak8JL9W.js → Edit01-CH6U7DHj.js} +1 -1
  13. package/dist/client/assets/File02-Cuc-ZPtg.js +1 -0
  14. package/dist/client/assets/{File06-C7QVLRp6.js → File06-BUwGdOjl.js} +1 -1
  15. package/dist/client/assets/{FilterLines-UNZ5Kk_X.js → FilterLines-ia0H5bBk.js} +1 -1
  16. package/dist/client/assets/{Grid01-C_dMOr-7.js → Grid01-DmaR0g3f.js} +1 -1
  17. package/dist/client/assets/{Home02-Cfg1gm8U.js → Home02-Cagj2miO.js} +1 -1
  18. package/dist/client/assets/{Image01-C6IcS9Ip.js → Image01-BCcbzsoK.js} +1 -1
  19. package/dist/client/assets/{Inbox01-D1IW7Je7.js → Inbox01-DoVQ3gCk.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-Dwuc2RiH.js → InfoCircle-qTETvFXb.js} +1 -1
  21. package/dist/client/assets/{Key01-CrwOIsjX.js → Key01-CHZQ8Cf-.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-yVEf-2cT.js → LinkExternal01-Cq8yx7fP.js} +1 -1
  23. package/dist/client/assets/{List-d88_8fTd.js → List-DZ53jWcW.js} +1 -1
  24. package/dist/client/assets/{Loading01-Bf56vlFv.js → Loading01-Bo9vDQAp.js} +1 -1
  25. package/dist/client/assets/{Lock01-CQ0bp8OP.js → Lock01-C1QZkjy0.js} +1 -1
  26. package/dist/client/assets/{Pin01-DBKe5RmK.js → Pin01-NWg5BL2M.js} +1 -1
  27. package/dist/client/assets/Play-D2yqwct8.js +1 -0
  28. package/dist/client/assets/{Plus-CcqPpwU0.js → Plus-DAW17Fqf.js} +1 -1
  29. package/dist/client/assets/{SearchMd-Ns-pswyj.js → SearchMd-D9E7kgub.js} +1 -1
  30. package/dist/client/assets/{Share07-B5yrbjwk.js → Share07-CN4FUsWW.js} +1 -1
  31. package/dist/client/assets/{Terminal-qZhwvVsv.js → Terminal-1HZulC_H.js} +1 -1
  32. package/dist/client/assets/Tool01-Ir04gLyn.js +1 -0
  33. package/dist/client/assets/{Trash01-DVYV3BJw.js → Trash01-BUkAP1vf.js} +1 -1
  34. package/dist/client/assets/{Upload01-CCAaxnrW.js → Upload01-DPPzM8Sw.js} +1 -1
  35. package/dist/client/assets/{Users03-CSRHEIl2.js → Users03-DscKVk_U.js} +1 -1
  36. package/dist/client/assets/{X-Dz8JZ2ZX.js → X-DyyqPnhR.js} +1 -1
  37. package/dist/client/assets/{XClose-BhgPfyG3.js → XClose-nvPI0OtD.js} +1 -1
  38. package/dist/client/assets/agent-detail-pV-lC3Zh.js +1 -0
  39. package/dist/client/assets/{agents-4MJAHJGV.js → agents-DepniFRU.js} +1 -1
  40. package/dist/client/assets/{alert-dialog-5t1wq8Xl.js → alert-dialog-QzYPe_ae.js} +3 -3
  41. package/dist/client/assets/{auth-catchall-CTOFzXVU.js → auth-catchall-COlMpx6Y.js} +1 -1
  42. package/dist/client/assets/{avatar-Cx4ORVtq.js → avatar-KkS1NpLz.js} +1 -1
  43. package/dist/client/assets/{badge-DfeUgg96.js → badge-CfH2vrIM.js} +1 -1
  44. package/dist/client/assets/{binder-Dh-m11Sm.js → binder-Cyeq_Zec.js} +1 -1
  45. package/dist/client/assets/{button-C83AQWC1.js → button-D_0RTXDt.js} +1 -1
  46. package/dist/client/assets/{card-CbXWWn3M.js → card-BmOa96dk.js} +1 -1
  47. package/dist/client/assets/{checkbox-DcPieRc5.js → checkbox-CUtYbeQD.js} +1 -1
  48. package/dist/client/assets/{circle-alert-ChrxIBwd.js → circle-alert-BnmazpCh.js} +1 -1
  49. package/dist/client/assets/collapsible-0N2BB6Bm.js +23 -0
  50. package/dist/client/assets/{collection-detail-B_qs3xwg.js → collection-detail-CeAvZaUS.js} +4 -4
  51. package/dist/client/assets/{collection-display-button-DlAEKbje.js → collection-display-button-Cm0zQnM_.js} +1 -1
  52. package/dist/client/assets/{collection-header-Fc9BtUxQ.js → collection-header-CbT_At3k.js} +1 -1
  53. package/dist/client/assets/{collection-page-DvzZtNQd.js → collection-page-CpAhF9Tg.js} +1 -1
  54. package/dist/client/assets/collection-search-DRZ8ScZP.js +1 -0
  55. package/dist/client/assets/{collection-tab-BB_A78nH.js → collection-tab-CyuO9CaU.js} +1 -1
  56. package/dist/client/assets/{collection-table-wrapper-Ch8oh2UW.js → collection-table-wrapper-CspbeKNx.js} +1 -1
  57. package/dist/client/assets/connect-Dx3Myol5.js +1 -0
  58. package/dist/client/assets/{connection-card-BZU7F7-m.js → connection-card-C6VYrDSx.js} +1 -1
  59. package/dist/client/assets/connection-detail-BAO1w9SL.js +1 -0
  60. package/dist/client/assets/{connections-dluTnyJM.js → connections-xwpD87cp.js} +1 -1
  61. package/dist/client/assets/{constants-ytntCGH9.js → constants-D8fdcBr8.js} +1 -1
  62. package/dist/client/assets/constants-rfrR0uMr.js +1 -0
  63. package/dist/client/assets/{create-organization-dialog-GjXRxTaj.js → create-organization-dialog-D96wehG4.js} +1 -1
  64. package/dist/client/assets/{dialog-D_ebnPDF.js → dialog-B-A0vnh-.js} +1 -1
  65. package/dist/client/assets/dropdown-menu-CMmh8IDN.js +1 -0
  66. package/dist/client/assets/{dynamic-plugin-layout-DrCIvG61.js → dynamic-plugin-layout-D5OcFZH0.js} +1 -1
  67. package/dist/client/assets/{empty-state-CxA9hap0.js → empty-state-BS0aVQHO.js} +1 -1
  68. package/dist/client/assets/{empty-state-Cr5g6Vh9.js → empty-state-DKQ_J1zp.js} +1 -1
  69. package/dist/client/assets/{env-vars-editor-DXJo5cdV.js → env-vars-editor-BFfuzqB5.js} +1 -1
  70. package/dist/client/assets/{error-boundary-Dg0Af8BA.js → error-boundary-ynZ9rF8y.js} +1 -1
  71. package/dist/client/assets/{extract-connection-data-BYPMZtVW.js → extract-connection-data-5Dbbyfmc.js} +1 -1
  72. package/dist/client/assets/file-browser-DWYmbjoP.js +2 -0
  73. package/dist/client/assets/{form-BISYEAnP.js → form-DngqlMy0.js} +1 -1
  74. package/dist/client/assets/grid-view-DBdpM4tG.js +1 -0
  75. package/dist/client/assets/home-Dh3O7N9x.js +1 -0
  76. package/dist/client/assets/index-B8BaCPuX.js +25 -0
  77. package/dist/client/assets/index-BWcrkV98.js +1 -0
  78. package/dist/client/assets/index-BtGsFE3_.js +233 -0
  79. package/dist/client/assets/{index-B-pYSGnK.js → index-C_CYTppS.js} +1 -1
  80. package/dist/client/assets/index-CqeIU8-o.css +1 -0
  81. package/dist/client/assets/index-DaiP89U7.js +1 -0
  82. package/dist/client/assets/{index-C8OOnmm1.js → index-Dho9MRVw.js} +2 -2
  83. package/dist/client/assets/{infiniteQueryObserver-B1N6PF-z.js → infiniteQueryObserver-DDmbfPGP.js} +1 -1
  84. package/dist/client/assets/{input-CrR0FEof.js → input-trZWilTG.js} +1 -1
  85. package/dist/client/assets/layout-BZ8_9wgI.js +1 -0
  86. package/dist/client/assets/localstorage-keys-B7V7cQcH.js +1 -0
  87. package/dist/client/assets/{login-BFXWEB6t.js → login-D61ut3BQ.js} +1 -1
  88. package/dist/client/assets/{mcp-oauth-BkqLXiLL.js → mcp-oauth-kjSe-9sd.js} +1 -1
  89. package/dist/client/assets/{mcp-server-card-CkDDvd5o.js → mcp-server-card-DkR0AaJs.js} +1 -1
  90. package/dist/client/assets/{mcp-server-detail-CuItqIIY.js → mcp-server-detail-Bq0lDMH3.js} +2 -2
  91. package/dist/client/assets/members-DqAGtLhZ.js +3 -0
  92. package/dist/client/assets/{monaco-editor-gim9RLZ3.js → monaco-editor-KzPiR_VS.js} +4 -4
  93. package/dist/client/assets/{monitoring-AmN2oTrM.js → monitoring-DkEahA8B.js} +5 -5
  94. package/dist/client/assets/{oauth-callback-BO8hRY4t.js → oauth-callback-C_OPSpWp.js} +1 -1
  95. package/dist/client/assets/page-BQkgsSw9.js +1 -0
  96. package/dist/client/assets/{page-BcZkyr2a.js → page-DWOf0lbq.js} +1 -1
  97. package/dist/client/assets/{pin-to-sidebar-button-DbV8w54G.js → pin-to-sidebar-button-Cdnz6iok.js} +1 -1
  98. package/dist/client/assets/plugin-empty-state-Dr-6CK5g.js +1 -0
  99. package/dist/client/assets/plugin-header-CAC6QLaV.js +1 -0
  100. package/dist/client/assets/plugins-57qT4Dil.js +1 -0
  101. package/dist/client/assets/popover-Bkt9Kfhi.js +1 -0
  102. package/dist/client/assets/{registry-utils-DekIcM3F.js → registry-utils-tiv71gSA.js} +1 -1
  103. package/dist/client/assets/{resizable-V4jINWPU.js → resizable-BdOXbYHL.js} +1 -1
  104. package/dist/client/assets/{resource-tabs-BsRvwnyx.js → resource-tabs-G-U5EIhm.js} +1 -1
  105. package/dist/client/assets/select-reGYS0Ly.js +1 -0
  106. package/dist/client/assets/settings-zvu2qyde.js +1 -0
  107. package/dist/client/assets/shell-layout-C-8OlUFV.js +3 -0
  108. package/dist/client/assets/{spinner-CwfYynNt.js → spinner-E8mBz_Z6.js} +1 -1
  109. package/dist/client/assets/{store-invite-BErtY6PV.js → store-invite-DnYGNBjx.js} +1 -1
  110. package/dist/client/assets/switch-t5mcsF2Z.js +1 -0
  111. package/dist/client/assets/{textarea-DRMuRqUv.js → textarea-x7X_L353.js} +1 -1
  112. package/dist/client/assets/{tools-list-DesNUyav.js → tools-list-DQZuaE9M.js} +1 -1
  113. package/dist/client/assets/tooltip-Cw2xVvTD.js +1 -0
  114. package/dist/client/assets/typewriter-title-BK26jx8M.js +16 -0
  115. package/dist/client/assets/use-binding-BVBmgj67.js +23 -0
  116. package/dist/client/assets/use-collections-CVO4vm4G.js +1 -0
  117. package/dist/client/assets/{use-connection-TLrid9RM.js → use-connection-BU-nKbTz.js} +1 -1
  118. package/dist/client/assets/{use-create-virtual-mcp-Bi6QQFl1.js → use-create-virtual-mcp-Cr2fOp7g.js} +1 -1
  119. package/dist/client/assets/use-deco-chat-open-D-b5da72.js +1 -0
  120. package/dist/client/assets/{use-list-state-DuKw_MMV.js → use-list-state-ClsnlmlI.js} +1 -1
  121. package/dist/client/assets/use-mcp-prompts-B5zcyY9X.js +1 -0
  122. package/dist/client/assets/{use-members-g_5Yt7ve.js → use-members-CVUMGKct.js} +1 -1
  123. package/dist/client/assets/{use-mobile-DQ806XzQ.js → use-mobile-VoJXvE1W.js} +1 -1
  124. package/dist/client/assets/use-organization-settings-CeE0FyqT.js +1 -0
  125. package/dist/client/assets/{use-virtual-mcp-C8lLKpyG.js → use-virtual-mcp-DbjvrtSR.js} +1 -1
  126. package/dist/client/assets/useInfiniteQuery-CVAyTLiO.js +1 -0
  127. package/dist/client/assets/useMutation-Lj_Cbq0P.js +1 -0
  128. package/dist/client/assets/useQuery-C2zqJzGD.js +1 -0
  129. package/dist/client/assets/useSuspenseInfiniteQuery-BS0TxHG_.js +1 -0
  130. package/dist/client/assets/{view-mode-toggle-jPeow5hv.js → view-mode-toggle-BagEO4CJ.js} +1 -1
  131. package/dist/client/assets/{workflow-pPSpZECL.js → workflow-BuhbYm_s.js} +1 -1
  132. package/dist/client/index.html +2 -2
  133. package/dist/server/cli.js +169 -169
  134. package/dist/server/migrate.js +176 -176
  135. package/dist/server/server.js +160 -160
  136. package/package.json +1 -1
  137. package/dist/client/assets/FlipBackward-Cc_OirbM.js +0 -1
  138. package/dist/client/assets/Play-l95VP5u9.js +0 -1
  139. package/dist/client/assets/agent-detail-nBBUtMd0.js +0 -1
  140. package/dist/client/assets/collection-search-bOTNZP0b.js +0 -1
  141. package/dist/client/assets/connect-DYIKCRWy.js +0 -1
  142. package/dist/client/assets/connection-detail-D3-I_W38.js +0 -1
  143. package/dist/client/assets/constants-CnfPGmdA.js +0 -1
  144. package/dist/client/assets/dropdown-menu-CzQCi3DZ.js +0 -1
  145. package/dist/client/assets/file-browser-2RP-n1Xp.js +0 -2
  146. package/dist/client/assets/grid-view-BzgHSliB.js +0 -1
  147. package/dist/client/assets/home-CZ1MSx2E.js +0 -1
  148. package/dist/client/assets/index-CIvJ2wFV.js +0 -255
  149. package/dist/client/assets/index-CmUKmcyS.js +0 -1
  150. package/dist/client/assets/index-HgNYu27A.js +0 -1
  151. package/dist/client/assets/index-c6ju_hIh.js +0 -25
  152. package/dist/client/assets/index-cFLiAqt_.css +0 -1
  153. package/dist/client/assets/layout-BGZtLEwK.js +0 -1
  154. package/dist/client/assets/localstorage-keys-N4jrVxvr.js +0 -1
  155. package/dist/client/assets/members-C3Nvqq2t.js +0 -3
  156. package/dist/client/assets/page-D-IBJ4SW.js +0 -1
  157. package/dist/client/assets/plugin-empty-state-Df2LAyPv.js +0 -1
  158. package/dist/client/assets/plugin-header-e5FObvvx.js +0 -1
  159. package/dist/client/assets/plugins-BOsIh96E.js +0 -1
  160. package/dist/client/assets/popover-B2yKs5LA.js +0 -1
  161. package/dist/client/assets/select-BlFReF6r.js +0 -1
  162. package/dist/client/assets/settings-cRTESMAX.js +0 -1
  163. package/dist/client/assets/shell-layout-BfC0vVyw.js +0 -3
  164. package/dist/client/assets/switch-DjW_2nBx.js +0 -1
  165. package/dist/client/assets/tool-set-selector-Btgo2YwH.js +0 -1
  166. package/dist/client/assets/tooltip-aHeHMhKh.js +0 -1
  167. package/dist/client/assets/typewriter-title-DRU6uRKP.js +0 -16
  168. package/dist/client/assets/use-binding-C2mDgpbB.js +0 -23
  169. package/dist/client/assets/use-collections-CkAaybvR.js +0 -1
  170. package/dist/client/assets/use-mcp-prompts-D5tApqEs.js +0 -1
  171. package/dist/client/assets/use-organization-settings-C-IzAdi1.js +0 -1
  172. package/dist/client/assets/useInfiniteQuery-BUOCgX3w.js +0 -1
  173. package/dist/client/assets/useMutation-C4aXMLv3.js +0 -1
  174. package/dist/client/assets/useQuery-DNOH3p7p.js +0 -1
@@ -1 +1 @@
1
- import{a1 as d,a2 as f,a3 as v,a4 as b}from"./index-C8OOnmm1.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
1
+ import{af as d,ag as u,ah as v,ai as b}from"./index-Dho9MRVw.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:u()})}getOptimisticResult(e){return e.behavior=u(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",f=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:f,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!f}}};export{N as I};
@@ -1 +1 @@
1
- import{c as s,j as a}from"./index-C8OOnmm1.js";import{c as d}from"./button-C83AQWC1.js";function p(l){const e=s.c(10);let i,r,t;e[0]!==l?({className:i,type:t,...r}=l,e[0]=l,e[1]=i,e[2]=r,e[3]=t):(i=e[1],r=e[2],t=e[3]);let n;e[4]!==i?(n=d("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-lg border bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] bg-background","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n||e[8]!==t?(o=a.jsx("input",{type:t,"data-slot":"input",className:n,...r}),e[6]=r,e[7]=n,e[8]=t,e[9]=o):o=e[9],o}export{p as I};
1
+ import{c as s,j as a}from"./index-Dho9MRVw.js";import{c as d}from"./button-D_0RTXDt.js";function p(l){const e=s.c(10);let i,r,t;e[0]!==l?({className:i,type:t,...r}=l,e[0]=l,e[1]=i,e[2]=r,e[3]=t):(i=e[1],r=e[2],t=e[3]);let n;e[4]!==i?(n=d("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-lg border bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] bg-background","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n||e[8]!==t?(o=a.jsx("input",{type:t,"data-slot":"input",className:n,...r}),e[6]=r,e[7]=n,e[8]=t,e[9]=o):o=e[9],o}export{p as I};
@@ -0,0 +1 @@
1
+ import{c as E,r as f,ab as v,j as l}from"./index-Dho9MRVw.js";import{B as w}from"./button-D_0RTXDt.js";import{i as k}from"./ArrowLeft-Dlm4CF9d.js";const j=f.createContext(null);function S(x){const e=E.c(3),{children:n}=x,s=f.useContext(j);if(!s?.tabsEl)return null;let t;return e[0]!==n||e[1]!==s.tabsEl?(t=v.createPortal(n,s.tabsEl),e[0]=n,e[1]=s.tabsEl,e[2]=t):t=e[2],t}function _(x){const e=E.c(3),{children:n}=x,s=f.useContext(j);if(!s?.actionsEl)return null;let t;return e[0]!==n||e[1]!==s.actionsEl?(t=v.createPortal(n,s.actionsEl),e[0]=n,e[1]=s.actionsEl,e[2]=t):t=e[2],t}function B(x){const e=E.c(20),{children:n,onBack:s,title:t}=x,[b,N]=f.useState(null),[p,g]=f.useState(null);let i;e[0]!==p||e[1]!==b?(i={tabsEl:b,actionsEl:p},e[0]=p,e[1]=b,e[2]=i):i=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsx(k,{}),e[3]=u):u=e[3];let c;e[4]!==s?(c=l.jsx("div",{className:"flex h-full px-2 border-r items-center",children:l.jsx(w,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:s,children:u})}),e[4]=s,e[5]=c):c=e[5];let r;e[6]!==t?(r=t&&l.jsx("div",{className:"flex items-center gap-2 px-2",children:l.jsx("p",{className:"text-sm font-medium",children:t})}),e[6]=t,e[7]=r):r=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsxs("div",{className:"flex px-4 items-center gap-0 flex-1 min-w-0",children:[l.jsx("div",{ref:N,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),l.jsx("div",{ref:g,className:"flex items-center gap-2 ml-auto shrink-0"})]}),e[8]=d):d=e[8];let a;e[9]!==c||e[10]!==r?(a=l.jsxs("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:[c,r,d]}),e[9]=c,e[10]=r,e[11]=a):a=e[11];let o;e[12]!==n?(o=l.jsx("div",{className:"flex-1 overflow-auto",children:n}),e[12]=n,e[13]=o):o=e[13];let m;e[14]!==a||e[15]!==o?(m=l.jsxs("div",{className:"flex flex-col h-full bg-background",children:[a,o]}),e[14]=a,e[15]=o,e[16]=m):m=e[16];let h;return e[17]!==i||e[18]!==m?(h=l.jsx(j,{value:i,children:m}),e[17]=i,e[18]=m,e[19]=h):h=e[19],h}export{_ as V,S as a,B as b};
@@ -0,0 +1 @@
1
+ import{c as O,aa as I}from"./index-Dho9MRVw.js";import{u as x}from"./useQuery-C2zqJzGD.js";import{u as L}from"./useMutation-Lj_Cbq0P.js";function Q(e){try{return JSON.parse(e)}catch{return}}function y(e,s){const t=localStorage.getItem(e),o=t?Q(t):void 0,n=typeof s=="function"?s(o):o??s;if(o===void 0||n!==o)try{const a=JSON.stringify(n);localStorage.setItem(e,a)}catch{}return n}function A(e,s){const t=O.c(25),o=I();let n;t[0]!==e?(n=["localStorage",e],t[0]=e,t[1]=n):n=t[1];const a=n;let r,i;t[2]!==s||t[3]!==e?(r=()=>y(e,s),i=()=>y(e,s),t[2]=s,t[3]=e,t[4]=r,t[5]=i):(r=t[4],i=t[5]);let u;t[6]!==a||t[7]!==r||t[8]!==i?(u={queryKey:a,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},t[6]=a,t[7]=r,t[8]=i,t[9]=u):u=t[9];const{data:v}=x(u);let l;t[10]!==e?(l=async c=>{const $=JSON.stringify(c);return localStorage.setItem(e,$),c},t[10]=e,t[11]=l):l=t[11];let m;t[12]!==o||t[13]!==a?(m=c=>{o.setQueryData(a,c)},t[12]=o,t[13]=a,t[14]=m):m=t[14];let h;t[15]!==l||t[16]!==m?(h={mutationFn:l,onSuccess:m},t[15]=l,t[16]=m,t[17]=h):h=t[17];const g=L(h);let d;t[18]!==g||t[19]!==o||t[20]!==a?(d=c=>{const $=o.getQueryData(a),C=typeof c=="function"?c($):c;g.mutate(C)},t[18]=g,t[19]=o,t[20]=a,t[21]=d):d=t[21];const p=d,S=v;let f;return t[22]!==p||t[23]!==S?(f=[S,p],t[22]=p,t[23]=S,t[24]=f):f=t[24],f}const D={assistantChatThreads:e=>`mesh:assistant-chat:threads:${e}`,messages:(e,s)=>`mesh:messages:${e}:${s}`,decoChatOpen:()=>"mesh:decochat:open",chatSelectedModel:e=>`mesh:chat:selectedModel:${e}`,assistantChatActiveThread:e=>`mesh:assistant-chat:active-thread:${e}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:e=>`mesh:store:selected-registry:${e}`,orgHomeQuickstart:e=>`mesh:org-home:quickstart:${e}`,storeShowStdio:()=>"mesh:store:show-stdio",developerMode:()=>"mesh:user:developer-mode",pluginConnection:(e,s)=>`mesh:plugin:connection:${e}:${s}`};export{D as L,A as u};
@@ -1 +1 @@
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-C8OOnmm1.js";import{u as T}from"./useMutation-C4aXMLv3.js";import{c as b,B as P}from"./button-C83AQWC1.js";import{I as E}from"./input-CrR0FEof.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
+ 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-Dho9MRVw.js";import{u as T}from"./useMutation-Lj_Cbq0P.js";import{c as b,B as P}from"./button-D_0RTXDt.js";import{I as E}from"./input-trZWilTG.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 +1 @@
1
- import{a7 as P,a8 as $,a9 as V,aa as x}from"./index-C8OOnmm1.js";function I(n){let e=0;for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}const T=new Map,O="mcp:oauth:callback:";class N{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${window.location.origin}/oauth/callback`,this._windowMode=e.windowMode??"popup";const t=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...t&&{scope:t}},T.set(I(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const s=window.screenX+(window.outerWidth-600)/2,o=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${s},top=${o},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){T.delete(I(this.serverUrl))}}async function K(n){const e=n.meshUrl??window.location.origin,t=new URL(`/mcp/${n.connectionId}`,e),r=new N({serverUrl:t.href,clientName:n.clientName,clientUri:n.clientUri,callbackUrl:n.callbackUrl,scope:n.scope,windowMode:n.windowMode}),s={fn:null};try{const o=new Promise((l,u)=>{const w=n.timeout||12e4;let m,h=!1;const M=r.state(),g=`${O}${M}`,d=()=>{window.removeEventListener("message",A),window.removeEventListener("storage",v),clearTimeout(m);try{localStorage.removeItem(g)}catch{}};s.fn=a=>{h||(h=!0,d(),u(a))};const S=async a=>{if(h)return;if(h=!0,!a.success){d(),u(new Error(a.error||"OAuth authentication failed"));return}const{code:k,state:C}=a;if(!k){d(),u(new Error("Missing authorization code"));return}if(r.getStoredState()!==C){d(),u(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const b=(await P(t))?.authorization_servers?.[0]||t,U=await $(b),p=r.clientInformation();if(!p){d(),u(new Error("Client information not found"));return}const L=r.codeVerifier(),R=await V(b,{metadata:U,clientInformation:p,authorizationCode:k,codeVerifier:L,redirectUri:r.redirectUrl,resource:new URL(t)});d(),l({tokens:R,clientId:p.client_id??null,clientSecret:"client_secret"in p?p.client_secret:null,tokenEndpoint:U?.token_endpoint??null})}catch(y){d(),u(y)}},A=async a=>{a.origin===window.location.origin&&a.data?.type==="mcp:oauth:callback"&&await S(a.data)},v=async a=>{if(!(a.key!==g||!a.newValue))try{const k=JSON.parse(a.newValue);await S(k)}catch{}};window.addEventListener("message",A),window.addEventListener("storage",v),m=setTimeout(()=>{h||(h=!0,d(),u(new Error("OAuth authentication timeout")))},w)});if(o.catch(()=>{}),await x(r,{serverUrl:t})==="REDIRECT"){const l=await o;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint},error:null}}const i=r.tokens(),c=r.clientInformation();return{token:i?.access_token||null,tokenInfo:i?{accessToken:i.access_token,refreshToken:i.refresh_token??null,expiresIn:i.expires_in??null,scope:i.scope??null,clientId:c?.client_id??null,clientSecret:c&&"client_secret"in c?c.client_secret:null,tokenEndpoint:null}:null,error:null}}catch(o){return s.fn&&s.fn(o instanceof Error?o:new Error(String(o))),{token:null,tokenInfo:null,error:o instanceof Error?o.message:String(o)}}finally{r.cleanup()}}function _(n,e){if(window.opener&&!window.opener.closed)return window.opener.postMessage(n,window.location.origin),!0;if(e)try{const t=`${O}${e}`;return localStorage.setItem(t,JSON.stringify(n)),!0}catch{}return!1}async function W(){const n=new URLSearchParams(window.location.search),e=n.get("code");let t=n.get("state");const r=n.get("error"),s=n.get("error_description");let o=t;if(t)try{const i=atob(t),c=JSON.parse(i);c.clientState&&(o=c.clientState)}catch{}if(r){const i=s||r;return _({type:"mcp:oauth:callback",success:!1,error:i},o),{success:!1,error:i}}if(!e||!t){const i="Missing code or state parameter";return _({type:"mcp:oauth:callback",success:!1,error:i},o),{success:!1,error:i}}return t=o||t,_({type:"mcp:oauth:callback",success:!0,code:e,state:t},t)?{success:!0}:{success:!1,error:"Parent window not available"}}function E(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function z(n){try{const e=E();return(e?new URL(n,e):new URL(n)).pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}async function H(n,e){try{const t=`/api/connections/${n}/oauth-token/status`,r=e?new URL(t,e).href:t,s=await fetch(r,{credentials:e?"omit":"include"});return s.ok?{hasToken:(await s.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function j({url:n,token:e,meshUrl:t}){try{const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json, text/event-stream");const s=await fetch(n,{method:"POST",headers:r,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),o=z(n),f=E(),i=t??(f?new URL(n,f).origin:new URL(n).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(o?await H(o,i):{hasToken:!1}).hasToken};let c;try{const w=await s.json();c=w.error||w.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:c||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:c||`HTTP ${s.status}`}}catch(r){return console.error("[isConnectionAuthenticated] Error:",r),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:r.message}}}export{K as a,W as h,j as i};
1
+ import{aj as P,ak as $,al as V,am as x}from"./index-Dho9MRVw.js";function I(n){let e=0;for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(16)}const T=new Map,O="mcp:oauth:callback:";class N{serverUrl;_clientMetadata;_redirectUrl;_windowMode;_state=null;_codeVerifier=null;_clientInfo=null;_tokens=null;constructor(e){this.serverUrl=e.serverUrl,this._redirectUrl=e.callbackUrl??`${window.location.origin}/oauth/callback`,this._windowMode=e.windowMode??"popup";const t=e.scope?Array.isArray(e.scope)?e.scope.join(" "):e.scope:void 0;this._clientMetadata={redirect_uris:[this._redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:e.clientName??"@decocms/mesh MCP client",...t&&{scope:t}},T.set(I(this.serverUrl),this)}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return this._state||(this._state=crypto.randomUUID()),this._state}getStoredState(){return this._state}clientInformation(){return this._clientInfo??void 0}saveClientInformation(e){this._clientInfo=e}tokens(){return this._tokens??void 0}saveTokens(e){this._tokens=e}redirectToAuthorization(e){if(this._windowMode==="tab"){if(!window.open(e.toString(),"_blank"))throw new Error("Tab was blocked")}else{const s=window.screenX+(window.outerWidth-600)/2,o=window.screenY+(window.outerHeight-700)/2;if(!window.open(e.toString(),"mcp-oauth",`width=600,height=700,left=${s},top=${o},popup=yes`)&&!window.open(e.toString(),"_blank"))throw new Error("Popup was blocked")}}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this._codeVerifier)throw new Error("Code verifier not found");return this._codeVerifier}invalidateCredentials(){this._clientInfo=null,this._tokens=null,this._codeVerifier=null,this._state=null}getServerUrl(){return this.serverUrl}cleanup(){T.delete(I(this.serverUrl))}}async function J(n){const e=n.meshUrl??window.location.origin,t=new URL(`/mcp/${n.connectionId}`,e),r=new N({serverUrl:t.href,clientName:n.clientName,clientUri:n.clientUri,callbackUrl:n.callbackUrl,scope:n.scope,windowMode:n.windowMode}),s={fn:null};try{const o=new Promise((l,u)=>{const w=n.timeout||12e4;let m,h=!1;const M=r.state(),g=`${O}${M}`,d=()=>{window.removeEventListener("message",A),window.removeEventListener("storage",v),clearTimeout(m);try{localStorage.removeItem(g)}catch{}};s.fn=a=>{h||(h=!0,d(),u(a))};const S=async a=>{if(h)return;if(h=!0,!a.success){d(),u(new Error(a.error||"OAuth authentication failed"));return}const{code:k,state:C}=a;if(!k){d(),u(new Error("Missing authorization code"));return}if(r.getStoredState()!==C){d(),u(new Error("OAuth state mismatch - possible CSRF attack"));return}try{const b=(await P(t))?.authorization_servers?.[0]||t,U=await $(b),p=r.clientInformation();if(!p){d(),u(new Error("Client information not found"));return}const L=r.codeVerifier(),R=await V(b,{metadata:U,clientInformation:p,authorizationCode:k,codeVerifier:L,redirectUri:r.redirectUrl,resource:new URL(t)});d(),l({tokens:R,clientId:p.client_id??null,clientSecret:"client_secret"in p?p.client_secret:null,tokenEndpoint:U?.token_endpoint??null})}catch(y){d(),u(y)}},A=async a=>{a.origin===window.location.origin&&a.data?.type==="mcp:oauth:callback"&&await S(a.data)},v=async a=>{if(!(a.key!==g||!a.newValue))try{const k=JSON.parse(a.newValue);await S(k)}catch{}};window.addEventListener("message",A),window.addEventListener("storage",v),m=setTimeout(()=>{h||(h=!0,d(),u(new Error("OAuth authentication timeout")))},w)});if(o.catch(()=>{}),await x(r,{serverUrl:t})==="REDIRECT"){const l=await o;return{token:l.tokens.access_token,tokenInfo:{accessToken:l.tokens.access_token,refreshToken:l.tokens.refresh_token??null,expiresIn:l.tokens.expires_in??null,scope:l.tokens.scope??null,clientId:l.clientId,clientSecret:l.clientSecret,tokenEndpoint:l.tokenEndpoint},error:null}}const i=r.tokens(),c=r.clientInformation();return{token:i?.access_token||null,tokenInfo:i?{accessToken:i.access_token,refreshToken:i.refresh_token??null,expiresIn:i.expires_in??null,scope:i.scope??null,clientId:c?.client_id??null,clientSecret:c&&"client_secret"in c?c.client_secret:null,tokenEndpoint:null}:null,error:null}}catch(o){return s.fn&&s.fn(o instanceof Error?o:new Error(String(o))),{token:null,tokenInfo:null,error:o instanceof Error?o.message:String(o)}}finally{r.cleanup()}}function _(n,e){if(window.opener&&!window.opener.closed)return window.opener.postMessage(n,window.location.origin),!0;if(e)try{const t=`${O}${e}`;return localStorage.setItem(t,JSON.stringify(n)),!0}catch{}return!1}async function K(){const n=new URLSearchParams(window.location.search),e=n.get("code");let t=n.get("state");const r=n.get("error"),s=n.get("error_description");let o=t;if(t)try{const i=atob(t),c=JSON.parse(i);c.clientState&&(o=c.clientState)}catch{}if(r){const i=s||r;return _({type:"mcp:oauth:callback",success:!1,error:i},o),{success:!1,error:i}}if(!e||!t){const i="Missing code or state parameter";return _({type:"mcp:oauth:callback",success:!1,error:i},o),{success:!1,error:i}}return t=o||t,_({type:"mcp:oauth:callback",success:!0,code:e,state:t},t)?{success:!0}:{success:!1,error:"Parent window not available"}}function E(){if(typeof window<"u"&&window.location?.origin)return window.location.origin}function z(n){try{const e=E();return(e?new URL(n,e):new URL(n)).pathname.match(/^\/mcp\/([^/]+)/)?.[1]??null}catch{return null}}async function H(n,e){try{const t=`/api/connections/${n}/oauth-token/status`,r=e?new URL(t,e).href:t,s=await fetch(r,{credentials:e?"omit":"include"});return s.ok?{hasToken:(await s.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}}async function W({url:n,token:e,meshUrl:t}){try{const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json, text/event-stream");const s=await fetch(n,{method:"POST",headers:r,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"@decocms/mesh MCP client",version:"1.0.0"}}})}),o=z(n),f=E(),i=t??(f?new URL(n,f).origin:new URL(n).origin);if(s.ok)return{isAuthenticated:!0,supportsOAuth:!1,hasOAuthToken:(o?await H(o,i):{hasToken:!1}).hasToken};let c;try{const w=await s.json();c=w.error||w.message}catch{}return s.status>=500?{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:c||`HTTP ${s.status}`,isServerError:!0}:{isAuthenticated:!1,supportsOAuth:!!s.headers.get("WWW-Authenticate"),hasOAuthToken:!1,error:c||`HTTP ${s.status}`}}catch(r){return console.error("[isConnectionAuthenticated] Error:",r),{isAuthenticated:!1,supportsOAuth:!1,hasOAuthToken:!1,error:r.message}}}export{J as a,K as h,W as i};
@@ -1 +1 @@
1
- import{r as B,c as V,j as a}from"./index-C8OOnmm1.js";import{T as O,a as q,c as J}from"./tooltip-aHeHMhKh.js";import{c as M,B as K}from"./button-C83AQWC1.js";import{s as Q}from"./registry-utils-DekIcM3F.js";import{i as X}from"./Lock01-CQ0bp8OP.js";import{s as Y}from"./Plus-CcqPpwU0.js";import{i as ee}from"./Terminal-qZhwvVsv.js";import{C as te}from"./card-CbXWWn3M.js";import{I as se}from"./empty-state-Cr5g6Vh9.js";import{g as le}from"./github-icon-Dp3wHhYE.js";const U=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";const W=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 10 4.08 10 5.2 10Zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 22 4.08 22 5.2 22Z"}));W.displayName="Server01";function ie(s){if(!s.includes("/"))return s;const e=s.split("/"),l=e[0],i=e[1];if(!l||!i)return s;if(l.includes(".")){const n=l.split("."),r=n[n.length-1]||l,o=i.replace(/^mcp-?/,"").replace(/-?mcp$/,"").replace(/^server-?/,"").replace(/-?server$/,"");return!o||o.length<2?r:o}return i}function ae(s){const e=V.c(2),{protocol:l,className:i}=s;let n;return e[0]!==i?(n={http:a.jsx(Q,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(ee,{className:i})},e[0]=i,e[1]=n):n=e[1],n[l]}function ne(s){switch(s){case"http":return"HTTP";case"sse":return"SSE";case"stdio":return"STDIO"}}function re(s){const e=V.c(9),{protocol:l}=s;let i;e[0]!==l?(i=M("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium shrink-0",{http:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",sse:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",stdio:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"}[l]),e[0]=l,e[1]=i):i=e[1];let n,r;e[2]!==l?(n=a.jsx(ae,{protocol:l,className:"w-3 h-3"}),r=ne(l),e[2]=l,e[3]=n,e[4]=r):(n=e[3],r=e[4]);let o;return e[5]!==i||e[6]!==n||e[7]!==r?(o=a.jsxs("div",{className:i,children:[n,r]}),e[5]=i,e[6]=n,e[7]=r,e[8]=o):o=e[8],o}function oe(s){const e=V.c(68),{icon:l,displayName:i,description:n,onClick:r}=s,t=(s.variant??"store")==="server",f=t?s.hostname:null,m=t?s.protocol:null,c=t?s.isInstalling:!1,d=t?s.actionLabel:void 0,p=t?null:s.scopeName,_=t?!1:s.isVerified,x=t?!0:s.canInstall,H=t?"p-4":"p-6";let u;e[0]!==H?(u=M("cursor-pointer hover:bg-muted/50 transition-colors",H),e[0]=H,e[1]=u):u=e[1];const R=t?"gap-3":"gap-4";let h;e[2]!==R?(h=M("flex flex-col h-full relative",R),e[2]=R,e[3]=h):h=e[3];const Z=t?"sm":"md";let g;e[4]!==i||e[5]!==l||e[6]!==Z?(g=a.jsx(se,{icon:l,name:i,size:Z,className:"shadow-sm shrink-0"}),e[4]=i,e[5]=l,e[6]=Z,e[7]=g):g=e[7];const G=t?"text-sm":"text-base";let v;e[8]!==G?(v=M("flex items-center gap-2 font-medium min-w-0",G),e[8]=G,e[9]=v):v=e[9];let j;e[10]!==i?(j=a.jsx("span",{className:"truncate",children:i}),e[10]=i,e[11]=j):j=e[11];let N;e[12]!==t||e[13]!==_?(N=!t&&_&&a.jsx(U,{size:16,className:"text-success shrink-0"}),e[12]=t,e[13]=_,e[14]=N):N=e[14];let C;e[15]!==x||e[16]!==t?(C=!t&&!x&&a.jsx(X,{size:16,className:"text-muted-foreground shrink-0"}),e[15]=x,e[16]=t,e[17]=C):C=e[17];let k;e[18]!==t||e[19]!==m?(k=t&&m&&a.jsx(re,{protocol:m}),e[18]=t,e[19]=m,e[20]=k):k=e[20];let b;e[21]!==C||e[22]!==k||e[23]!==v||e[24]!==j||e[25]!==N?(b=a.jsx(O,{asChild:!0,children:a.jsxs("div",{className:v,children:[j,N,C,k]})}),e[21]=C,e[22]=k,e[23]=v,e[24]=j,e[25]=N,e[26]=b):b=e[26];let w;e[27]!==i?(w=a.jsx("p",{children:i}),e[27]=i,e[28]=w):w=e[28];let y;e[29]!==x||e[30]!==t?(y=!t&&!x&&a.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[29]=x,e[30]=t,e[31]=y):y=e[31];let I;e[32]!==w||e[33]!==y?(I=a.jsxs(q,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(J,{children:[b,I]}),e[35]=b,e[36]=I,e[37]=$):$=e[37];let L;e[38]!==f||e[39]!==t||e[40]!==p?(L=(p||f)&&a.jsx("div",{className:M("text-muted-foreground truncate",t?"text-xs mt-0.5":"text-sm"),children:p||f}),e[38]=f,e[39]=t,e[40]=p,e[41]=L):L=e[41];let P;e[42]!==$||e[43]!==L?(P=a.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[$,L]})}),e[42]=$,e[43]=L,e[44]=P):P=e[44];let S;e[45]!==P||e[46]!==g?(S=a.jsxs("div",{className:"flex gap-3",children:[g,P]}),e[45]=P,e[46]=g,e[47]=S):S=e[47];let T;e[48]!==n?(T=n&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:n}),e[48]=n,e[49]=T):T=e[49];let E;e[50]!==n||e[51]!==t?(E=!n&&!t&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:"No description available"}),e[50]=n,e[51]=t,e[52]=E):E=e[52];let z;e[53]!==d||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(K,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(Y,{size:16}),c?"Connecting...":d||"Connect"]}),e[53]=d,e[54]=c,e[55]=t,e[56]=r,e[57]=z):z=e[57];let D;e[58]!==S||e[59]!==T||e[60]!==E||e[61]!==z||e[62]!==h?(D=a.jsxs("div",{className:h,children:[S,T,E,z]}),e[58]=S,e[59]=T,e[60]=E,e[61]=z,e[62]=h,e[63]=D):D=e[63];let A;return e[64]!==r||e[65]!==u||e[66]!==D?(A=a.jsx(te,{className:u,onClick:r,children:D}),e[64]=r,e[65]=u,e[66]=D,e[67]=A):A=e[67],A}function ce(s){const e=s.title||s.server.title||s.id||"Unnamed Item",l=s._meta?.["mcp.mesh"],i=l?.short_description||l?.mesh_description||s.server.description||null,n=s.server.icons?.[0]?.src||le(s.server.repository)||null,r=l?.verified??!1,o=(s.server.remotes?.length??0)>0,t=(s.server.packages?.length??0)>0,f=o||t;let m=e,c=null;if(e.includes("/")){const d=e.split("/");d.length>=2&&(c=d[0]||null,m=ie(e))}if(!c){const d=l?.scopeName,p=l?.appName;d&&p?c=`${d}/${p}`:d&&(c=d)}return l?.friendly_name&&(m=l.friendly_name),{icon:n,scopeName:c,displayName:m,description:i,isVerified:r,canInstall:f}}function Ne(s){const e=V.c(12),{items:l,title:i,onItemClick:n}=s;if(l.length===0)return null;let r;e[0]!==i?(r=i&&a.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:a.jsx("h2",{className:"text-lg font-medium",children:i})}),e[0]=i,e[1]=r):r=e[1];let o;if(e[2]!==l||e[3]!==n){let m;e[5]!==n?(m=c=>{const d=ce(c);return a.jsx(oe,{...d,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=m):m=e[6],o=l.map(m),e[2]=l,e[3]=n,e[4]=o}else o=e[4];let t;e[7]!==o?(t=a.jsx("div",{className:"grid grid-cols-4 gap-4",children:o}),e[7]=o,e[8]=t):t=e[8];let f;return e[9]!==r||e[10]!==t?(f=a.jsxs("div",{className:"flex flex-col gap-4",children:[r,t]}),e[9]=r,e[10]=t,e[11]=f):f=e[11],f}export{Ne as M,oe as a,W as b,ie as e};
1
+ import{r as B,c as V,j as a}from"./index-Dho9MRVw.js";import{T as O,a as q,c as J}from"./tooltip-Cw2xVvTD.js";import{c as M,B as K}from"./button-D_0RTXDt.js";import{s as Q}from"./registry-utils-tiv71gSA.js";import{i as X}from"./Lock01-C1QZkjy0.js";import{s as Y}from"./Plus-DAW17Fqf.js";import{i as ee}from"./Terminal-1HZulC_H.js";import{C as te}from"./card-BmOa96dk.js";import{I as se}from"./empty-state-DKQ_J1zp.js";import{g as le}from"./github-icon-Dp3wHhYE.js";const U=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";const W=({size:s=24,color:e="currentColor",...l})=>B.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},B.createElement("path",{d:"M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 10 4.08 10 5.2 10Zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 22 4.08 22 5.2 22Z"}));W.displayName="Server01";function ie(s){if(!s.includes("/"))return s;const e=s.split("/"),l=e[0],i=e[1];if(!l||!i)return s;if(l.includes(".")){const n=l.split("."),r=n[n.length-1]||l,o=i.replace(/^mcp-?/,"").replace(/-?mcp$/,"").replace(/^server-?/,"").replace(/-?server$/,"");return!o||o.length<2?r:o}return i}function ae(s){const e=V.c(2),{protocol:l,className:i}=s;let n;return e[0]!==i?(n={http:a.jsx(Q,{className:i}),sse:a.jsx(W,{className:i}),stdio:a.jsx(ee,{className:i})},e[0]=i,e[1]=n):n=e[1],n[l]}function ne(s){switch(s){case"http":return"HTTP";case"sse":return"SSE";case"stdio":return"STDIO"}}function re(s){const e=V.c(9),{protocol:l}=s;let i;e[0]!==l?(i=M("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium shrink-0",{http:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",sse:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",stdio:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"}[l]),e[0]=l,e[1]=i):i=e[1];let n,r;e[2]!==l?(n=a.jsx(ae,{protocol:l,className:"w-3 h-3"}),r=ne(l),e[2]=l,e[3]=n,e[4]=r):(n=e[3],r=e[4]);let o;return e[5]!==i||e[6]!==n||e[7]!==r?(o=a.jsxs("div",{className:i,children:[n,r]}),e[5]=i,e[6]=n,e[7]=r,e[8]=o):o=e[8],o}function oe(s){const e=V.c(68),{icon:l,displayName:i,description:n,onClick:r}=s,t=(s.variant??"store")==="server",f=t?s.hostname:null,m=t?s.protocol:null,c=t?s.isInstalling:!1,d=t?s.actionLabel:void 0,p=t?null:s.scopeName,_=t?!1:s.isVerified,x=t?!0:s.canInstall,H=t?"p-4":"p-6";let u;e[0]!==H?(u=M("cursor-pointer hover:bg-muted/50 transition-colors",H),e[0]=H,e[1]=u):u=e[1];const R=t?"gap-3":"gap-4";let h;e[2]!==R?(h=M("flex flex-col h-full relative",R),e[2]=R,e[3]=h):h=e[3];const Z=t?"sm":"md";let g;e[4]!==i||e[5]!==l||e[6]!==Z?(g=a.jsx(se,{icon:l,name:i,size:Z,className:"shadow-sm shrink-0"}),e[4]=i,e[5]=l,e[6]=Z,e[7]=g):g=e[7];const G=t?"text-sm":"text-base";let v;e[8]!==G?(v=M("flex items-center gap-2 font-medium min-w-0",G),e[8]=G,e[9]=v):v=e[9];let j;e[10]!==i?(j=a.jsx("span",{className:"truncate",children:i}),e[10]=i,e[11]=j):j=e[11];let N;e[12]!==t||e[13]!==_?(N=!t&&_&&a.jsx(U,{size:16,className:"text-success shrink-0"}),e[12]=t,e[13]=_,e[14]=N):N=e[14];let C;e[15]!==x||e[16]!==t?(C=!t&&!x&&a.jsx(X,{size:16,className:"text-muted-foreground shrink-0"}),e[15]=x,e[16]=t,e[17]=C):C=e[17];let k;e[18]!==t||e[19]!==m?(k=t&&m&&a.jsx(re,{protocol:m}),e[18]=t,e[19]=m,e[20]=k):k=e[20];let b;e[21]!==C||e[22]!==k||e[23]!==v||e[24]!==j||e[25]!==N?(b=a.jsx(O,{asChild:!0,children:a.jsxs("div",{className:v,children:[j,N,C,k]})}),e[21]=C,e[22]=k,e[23]=v,e[24]=j,e[25]=N,e[26]=b):b=e[26];let w;e[27]!==i?(w=a.jsx("p",{children:i}),e[27]=i,e[28]=w):w=e[28];let y;e[29]!==x||e[30]!==t?(y=!t&&!x&&a.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[29]=x,e[30]=t,e[31]=y):y=e[31];let I;e[32]!==w||e[33]!==y?(I=a.jsxs(q,{children:[w,y]}),e[32]=w,e[33]=y,e[34]=I):I=e[34];let $;e[35]!==b||e[36]!==I?($=a.jsxs(J,{children:[b,I]}),e[35]=b,e[36]=I,e[37]=$):$=e[37];let L;e[38]!==f||e[39]!==t||e[40]!==p?(L=(p||f)&&a.jsx("div",{className:M("text-muted-foreground truncate",t?"text-xs mt-0.5":"text-sm"),children:p||f}),e[38]=f,e[39]=t,e[40]=p,e[41]=L):L=e[41];let P;e[42]!==$||e[43]!==L?(P=a.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:a.jsxs("div",{className:"min-w-0 flex-1",children:[$,L]})}),e[42]=$,e[43]=L,e[44]=P):P=e[44];let S;e[45]!==P||e[46]!==g?(S=a.jsxs("div",{className:"flex gap-3",children:[g,P]}),e[45]=P,e[46]=g,e[47]=S):S=e[47];let T;e[48]!==n?(T=n&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:n}),e[48]=n,e[49]=T):T=e[49];let E;e[50]!==n||e[51]!==t?(E=!n&&!t&&a.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:"No description available"}),e[50]=n,e[51]=t,e[52]=E):E=e[52];let z;e[53]!==d||e[54]!==c||e[55]!==t||e[56]!==r?(z=t&&a.jsxs(K,{variant:"outline",size:"sm",onClick:F=>{F.stopPropagation(),r()},disabled:c,className:"w-full mt-auto cursor-pointer",children:[a.jsx(Y,{size:16}),c?"Connecting...":d||"Connect"]}),e[53]=d,e[54]=c,e[55]=t,e[56]=r,e[57]=z):z=e[57];let D;e[58]!==S||e[59]!==T||e[60]!==E||e[61]!==z||e[62]!==h?(D=a.jsxs("div",{className:h,children:[S,T,E,z]}),e[58]=S,e[59]=T,e[60]=E,e[61]=z,e[62]=h,e[63]=D):D=e[63];let A;return e[64]!==r||e[65]!==u||e[66]!==D?(A=a.jsx(te,{className:u,onClick:r,children:D}),e[64]=r,e[65]=u,e[66]=D,e[67]=A):A=e[67],A}function ce(s){const e=s.title||s.server.title||s.id||"Unnamed Item",l=s._meta?.["mcp.mesh"],i=l?.short_description||l?.mesh_description||s.server.description||null,n=s.server.icons?.[0]?.src||le(s.server.repository)||null,r=l?.verified??!1,o=(s.server.remotes?.length??0)>0,t=(s.server.packages?.length??0)>0,f=o||t;let m=e,c=null;if(e.includes("/")){const d=e.split("/");d.length>=2&&(c=d[0]||null,m=ie(e))}if(!c){const d=l?.scopeName,p=l?.appName;d&&p?c=`${d}/${p}`:d&&(c=d)}return l?.friendly_name&&(m=l.friendly_name),{icon:n,scopeName:c,displayName:m,description:i,isVerified:r,canInstall:f}}function Ne(s){const e=V.c(12),{items:l,title:i,onItemClick:n}=s;if(l.length===0)return null;let r;e[0]!==i?(r=i&&a.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:a.jsx("h2",{className:"text-lg font-medium",children:i})}),e[0]=i,e[1]=r):r=e[1];let o;if(e[2]!==l||e[3]!==n){let m;e[5]!==n?(m=c=>{const d=ce(c);return a.jsx(oe,{...d,onClick:()=>n(c)},c.id)},e[5]=n,e[6]=m):m=e[6],o=l.map(m),e[2]=l,e[3]=n,e[4]=o}else o=e[4];let t;e[7]!==o?(t=a.jsx("div",{className:"grid grid-cols-4 gap-4",children:o}),e[7]=o,e[8]=t):t=e[8];let f;return e[9]!==r||e[10]!==t?(f=a.jsxs("div",{className:"flex flex-col gap-4",children:[r,t]}),e[9]=r,e[10]=t,e[11]=f):f=e[11],f}export{Ne as M,oe as a,W as b,ie as e};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C8OOnmm1.js","assets/index-cFLiAqt_.css","assets/index-HgNYu27A.js","assets/use-collections-CkAaybvR.js","assets/useMutation-C4aXMLv3.js","assets/useQuery-DNOH3p7p.js","assets/constants-ytntCGH9.js","assets/use-connection-TLrid9RM.js","assets/use-mcp-prompts-D5tApqEs.js","assets/use-virtual-mcp-C8lLKpyG.js","assets/mcp-oauth-BkqLXiLL.js"])))=>i.map(i=>d[i]);
2
- import{r as F,c as E,j as t,u as xe,l as he,a as Ie,f as _e,g as Te,bw as de,K as ke,ab as me}from"./index-C8OOnmm1.js";import{i as Le}from"./AlertCircle--GzH2vta.js";import{i as ge}from"./Loading01-Bf56vlFv.js";import{B as X,c as Pe}from"./button-C83AQWC1.js";import{i as Me}from"./ArrowLeft-DzpTEYvO.js";import{I as ve,E as Ve}from"./empty-state-Cr5g6Vh9.js";import{i as De,e as Ee}from"./extract-connection-data-BYPMZtVW.js";import{t as Re}from"./ChevronDown-DaqG_J6Z.js";import{s as fe}from"./Plus-CcqPpwU0.js";import{a as $e,c as Ae,b as Ue,D as Be}from"./dropdown-menu-CzQCi3DZ.js";import{n as ue}from"./LinkExternal01-yVEf-2cT.js";import{T as ze,R as Oe}from"./tools-list-DesNUyav.js";import{R as Fe}from"./resource-tabs-BsRvwnyx.js";import{s as Ge,f as He,g as We,c as qe}from"./registry-utils-DekIcM3F.js";import{a as Ke,b as Qe,e as Ye}from"./mcp-server-card-CkDDvd5o.js";import{i as Xe}from"./Terminal-qZhwvVsv.js";import{u as Ze}from"./use-binding-C2mDgpbB.js";import{u as Je}from"./useQuery-DNOH3p7p.js";import{c as et}from"./use-collections-CkAaybvR.js";import{a as tt,b as st,u as ot}from"./use-connection-TLrid9RM.js";import{u as rt}from"./constants-ytntCGH9.js";import{u as nt,L as it}from"./localstorage-keys-N4jrVxvr.js";import{s as lt}from"./slugify-CEUa2lfQ.js";import{e as at,g as ct}from"./github-icon-Dp3wHhYE.js";import{i as dt}from"./InfoCircle-Dwuc2RiH.js";import"./constants-CnfPGmdA.js";import"./generate-id-Dyweu44Y.js";import"./Grid01-C_dMOr-7.js";import"./File06-C7QVLRp6.js";import"./collection-display-button-DlAEKbje.js";import"./ArrowUp-BfBrilbk.js";import"./Check-CXkamnnr.js";import"./List-d88_8fTd.js";import"./tooltip-aHeHMhKh.js";import"./view-mode-toggle-jPeow5hv.js";import"./collection-search-bOTNZP0b.js";import"./SearchMd-Ns-pswyj.js";import"./input-CrR0FEof.js";import"./collection-table-wrapper-Ch8oh2UW.js";import"./card-CbXWWn3M.js";import"./layout-BGZtLEwK.js";import"./badge-DfeUgg96.js";import"./Lock01-CQ0bp8OP.js";import"./binder-Dh-m11Sm.js";import"./useMutation-C4aXMLv3.js";const be=({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"}));be.displayName="SearchLg";function mt(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(ge,{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 ft(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(Le,{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 ut(o){const e=E.c(5),{onBack:s}=o;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(be,{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 pt(o){const e=E.c(3),{onBack:s}=o;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Me,{}),e[0]=r):r=e[0];let n;return e[1]!==s?(n=t.jsx("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:t.jsx("div",{className:"flex h-full px-2 border-r items-center",children:t.jsx(X,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:s,"aria-label":"Go back",children:r})})}),e[1]=s,e[2]=n):n=e[2],n}function pe(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=Pe("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(Re,{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($e,{asChild:!0,children:t.jsxs(X,{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(Ae,{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(De,{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(Ue,{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(Be,{children:[x,_]}),e[25]=x,e[26]=_,e[27]=w):w=e[27],w}function xt(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=U=>{y(U),m?.(U)},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(gt),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 G;e[12]!==r||e[13]!==n||e[14]!==h?(G=U=>{h(U);const Z=r[U],J=Z?.server?.remotes??[],se=Z?.server?.packages??[];if(J.length>0){const ee=J.findIndex(ht);n(U,ee>=0?ee:0,void 0)}else se.length>0&&n(U,void 0,0)},e[12]=r,e[13]=n,e[14]=h,e[15]=G):G=e[15];const K=G;let $;e[16]!==s.icon||e[17]!==s.name?($=t.jsx(ve,{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 B;e[28]!==A||e[29]!==D?(B=t.jsxs("div",{className:"flex-1 min-w-0",children:[A,D]}),e[28]=A,e[29]=D,e[30]=B):B=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(X,{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(pe,{versions:r,selectedIndex:f,onSelect:K,isInstalling:p,variant:"brand"})]}):t.jsxs(X,{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(pe,{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]!==B||e[41]!==z?(O=t.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[B,z]}),e[40]=B,e[41]=z,e[42]=O):O=e[42];let H;return e[43]!==O||e[44]!==$?(H=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]=H):H=e[45],H}function ht(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function gt(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function vt(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 bt(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(ve,{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(yt)})]}),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(jt)})]}),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=vt(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 jt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}function yt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}const Nt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],St={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 Ct(o){if(!o)return"Local";try{return new URL(o).hostname}catch{return o}}function wt(o){if(!o)return"local";try{const e=new URL(o).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function It(o){const e=St[o.toLowerCase()];return e||o.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function _t(o){if(!o)return"http";const e=o.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function Tt(o){return o.map((e,s)=>{const r=_t(e.type),n=Ct(e.url),i=wt(e.url),c=e.title||e.name||It(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 kt(o){const e=E.c(2),{protocol:s,className:r}=o;let n;return e[0]!==r?(n={http:t.jsx(Ge,{className:r}),sse:t.jsx(Qe,{className:r}),stdio:t.jsx(Xe,{className:r})},e[0]=r,e[1]=n):n=e[1],n[s]}function Lt(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(X,{variant:r===m.value?"default":"outline",size:"sm",onClick:()=>n(m.value),className:"cursor-pointer",children:[t.jsx(kt,{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 Pt(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(Et),p=Tt(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(Dt));let g=Nt.filter(a=>a.value==="all"||x.has(a.value));m||(g=g.filter(Vt));const _=x.size<=1?g.filter(Mt):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(Ke,{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(Lt,{options:_,selected:N,onSelect:y}),b,P]})}function Mt(o){return o.value!=="all"}function Vt(o){return o.value!=="stdio"}function Dt(o){return o.protocol}function Et(o){return o.type?.toLowerCase()!=="stdio"}function Rt(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($t),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(Fe,{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(Pt,{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(ge,{size:24,className:"animate-spin"}),t.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?t.jsx(ze,{tools:_,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):t.jsx(Ve,{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(Oe,{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 $t(o){const e=o;return{name:e.name||"",description:e.description||void 0}}function At(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 Ut(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 Bt(o){const e=o._meta?.["mcp.mesh"],s=o._meta?.["io.modelcontextprotocol.registry/official"],r=o.server,n=We(r.remotes?.[0]?.type),i=qe(r.$schema),c=s?"io.modelcontextprotocol.registry/official":o.publisher||e?.scopeName||"Unknown",u=ct(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=Ye(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 zt 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(ft,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function Ot(){const{org:o}=xe(),e=he(),{appName:s}=Ie({strict:!1}),{registryId:r,serverName:n,stdio:i}=_e({strict:!1}),[c,u]=nt(it.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=tt(),y=st(),{data:f}=Te.useSession(),N=Ze(y),h=r||N[0]?.id||"",x=ot(h),g=He(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=rt({connectionId:h||null,orgId:o.id}),{data:a}=et({client:P,toolName:v,toolArguments:b,select:l=>l.structuredContent??l});let M=[],V=[],G=null;if(a){if(Array.isArray(a))M=a;else if(typeof a=="object"&&a!==null)if("totalCount"in a&&typeof a.totalCount=="number"&&(G=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 lt(L)===s});!k&&n&&(k=M.find(l=>l.server.name===n||l.name===n||l.title===n));const T=k?Bt(k):null,A=(T?.tools?.length||0)>0,D=k?.server?.remotes?.[0]?.url||null,B=!A&&!!D,z=Je({queryKey:ke.remoteMcpTools(D),queryFn:async()=>{if(!D)return[];const{Client:l}=await de(async()=>{const{Client:R}=await import("./index-C8OOnmm1.js").then(q=>q.cp);return{Client:R}},__vite__mapDeps([0,1])),{StreamableHTTPClientTransport:L}=await de(async()=>{const{StreamableHTTPClientTransport:R}=await import("./index-HgNYu27A.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"}),te=new L(new URL(D),{requestInit:{headers:{Accept:"application/json, text/event-stream","Content-Type":"application/json"}}});try{return await W.connect(te),((await W.listTools()).tools||[]).map(q=>({name:q.name,description:q.description}))}finally{await W.close().catch(console.error)}},enabled:B}),O=B&&z.isLoading,H=z.data??[],U=A?T?.tools||[]:H,Z=At(y,T?.publisher),J=T?Ut(M,T.publisher,Z,x??null,G):{count:0},se=T?.repository?at(T.repository):null,ne=k?.server?.remotes??[],ee=k?.server?.packages??[],oe=[...ne.map((l,L)=>({...l,_type:"remote",_index:L})),...ee.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:U.length,visible:A||H.length>0||O&&!!D}].filter(l=>l.visible),je=Q.find(l=>l.id==="servers")?.id||Q.find(l=>l.id==="readme")?.id||Q[0]?.id||"overview",ye=m&&Q.find(l=>l.id===m)?m:je,re=async(l,L,W)=>{const te=V[l??0]||k;if(!te||!o||!f?.user?.id)return;const R=Ee(te,o.id,f.user.id,{remoteIndex:W===void 0?L??0:void 0,packageIndex:W}),q=R.connection_type==="STDIO",Ce=!!R.connection_url,we=q&&R.connection_headers&&typeof R.connection_headers=="object"&&"command"in R.connection_headers;if(!Ce&&!we){me.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){me.error(`Failed to connect MCP Server: ${Y instanceof Error?Y.message:String(Y)}`)}},ae=()=>{e({to:"/$org/store",params:{org:o.slug}})};if(!k)return t.jsx(ut,{onBack:ae});if(!T)return null;const Ne=(k?.server?.remotes?.length??0)>0,Se=(k?.server?.packages?.length??0)>0,ce=Ne||Se;return t.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[t.jsx(pt,{onBack:ae}),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:[!ce&&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(dt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t.jsx(xt,{data:T,itemVersions:V.length>0?V:[k],onInstall:re,canInstall:ce,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(bt,{data:T,publisherInfo:J,selectedItem:k}),t.jsx(Rt,{data:T,availableTabs:Q,effectiveActiveTabId:ye,effectiveTools:U,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 Ds(){const o=E.c(6),{org:e}=xe(),s=he();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(mt,{}),children:t.jsx(Ot,{})}),o[3]=i):i=o[3];let c;return o[4]!==n?(c=t.jsx(zt,{onBack:n,children:i}),o[4]=n,o[5]=c):c=o[5],c}export{Ds as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dho9MRVw.js","assets/index-CqeIU8-o.css","assets/index-DaiP89U7.js","assets/use-collections-CVO4vm4G.js","assets/useMutation-Lj_Cbq0P.js","assets/useQuery-C2zqJzGD.js","assets/constants-D8fdcBr8.js","assets/use-connection-BU-nKbTz.js","assets/use-mcp-prompts-B5zcyY9X.js","assets/use-virtual-mcp-DbjvrtSR.js","assets/mcp-oauth-kjSe-9sd.js"])))=>i.map(i=>d[i]);
2
+ import{r as F,c as E,j as t,u as xe,l as he,a as Ie,f as _e,g as Te,bl as de,K as ke,an as me}from"./index-Dho9MRVw.js";import{i as Le}from"./AlertCircle-DcHEglIM.js";import{i as ge}from"./Loading01-Bo9vDQAp.js";import{B as X,c as Pe}from"./button-D_0RTXDt.js";import{i as Me}from"./ArrowLeft-Dlm4CF9d.js";import{I as ve,E as Ve}from"./empty-state-DKQ_J1zp.js";import{i as De,e as Ee}from"./extract-connection-data-5Dbbyfmc.js";import{t as Re}from"./ChevronDown-BV0rwdFr.js";import{s as fe}from"./Plus-DAW17Fqf.js";import{a as $e,c as Ae,b as Ue,D as Be}from"./dropdown-menu-CMmh8IDN.js";import{n as ue}from"./LinkExternal01-Cq8yx7fP.js";import{T as ze,R as Oe}from"./tools-list-DQZuaE9M.js";import{R as Fe}from"./resource-tabs-G-U5EIhm.js";import{s as Ge,f as He,g as We,c as qe}from"./registry-utils-tiv71gSA.js";import{a as Ke,b as Qe,e as Ye}from"./mcp-server-card-DkR0AaJs.js";import{i as Xe}from"./Terminal-1HZulC_H.js";import{u as Ze}from"./use-binding-BVBmgj67.js";import{u as Je}from"./useQuery-C2zqJzGD.js";import{c as et}from"./use-collections-CVO4vm4G.js";import{a as tt,b as st,u as ot}from"./use-connection-BU-nKbTz.js";import{u as rt}from"./constants-D8fdcBr8.js";import{u as nt,L as it}from"./localstorage-keys-B7V7cQcH.js";import{s as lt}from"./slugify-CEUa2lfQ.js";import{e as at,g as ct}from"./github-icon-Dp3wHhYE.js";import{i as dt}from"./InfoCircle-qTETvFXb.js";import"./constants-rfrR0uMr.js";import"./generate-id-Dyweu44Y.js";import"./Grid01-DmaR0g3f.js";import"./File06-BUwGdOjl.js";import"./collection-display-button-Cm0zQnM_.js";import"./ArrowUp-CC-2uYGu.js";import"./Check-BzMGOxMB.js";import"./List-DZ53jWcW.js";import"./tooltip-Cw2xVvTD.js";import"./view-mode-toggle-BagEO4CJ.js";import"./collection-search-DRZ8ScZP.js";import"./SearchMd-D9E7kgub.js";import"./input-trZWilTG.js";import"./collection-table-wrapper-CspbeKNx.js";import"./card-BmOa96dk.js";import"./layout-BZ8_9wgI.js";import"./badge-CfH2vrIM.js";import"./Lock01-C1QZkjy0.js";import"./binder-Cyeq_Zec.js";import"./useMutation-Lj_Cbq0P.js";const be=({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"}));be.displayName="SearchLg";function mt(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(ge,{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 ft(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(Le,{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 ut(o){const e=E.c(5),{onBack:s}=o;let r,n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(be,{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 pt(o){const e=E.c(3),{onBack:s}=o;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Me,{}),e[0]=r):r=e[0];let n;return e[1]!==s?(n=t.jsx("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:t.jsx("div",{className:"flex h-full px-2 border-r items-center",children:t.jsx(X,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:s,"aria-label":"Go back",children:r})})}),e[1]=s,e[2]=n):n=e[2],n}function pe(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=Pe("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(Re,{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($e,{asChild:!0,children:t.jsxs(X,{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(Ae,{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(De,{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(Ue,{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(Be,{children:[x,_]}),e[25]=x,e[26]=_,e[27]=w):w=e[27],w}function xt(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=U=>{y(U),m?.(U)},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(gt),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 G;e[12]!==r||e[13]!==n||e[14]!==h?(G=U=>{h(U);const Z=r[U],J=Z?.server?.remotes??[],se=Z?.server?.packages??[];if(J.length>0){const ee=J.findIndex(ht);n(U,ee>=0?ee:0,void 0)}else se.length>0&&n(U,void 0,0)},e[12]=r,e[13]=n,e[14]=h,e[15]=G):G=e[15];const K=G;let $;e[16]!==s.icon||e[17]!==s.name?($=t.jsx(ve,{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 B;e[28]!==A||e[29]!==D?(B=t.jsxs("div",{className:"flex-1 min-w-0",children:[A,D]}),e[28]=A,e[29]=D,e[30]=B):B=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(X,{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(pe,{versions:r,selectedIndex:f,onSelect:K,isInstalling:p,variant:"brand"})]}):t.jsxs(X,{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(pe,{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]!==B||e[41]!==z?(O=t.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[B,z]}),e[40]=B,e[41]=z,e[42]=O):O=e[42];let H;return e[43]!==O||e[44]!==$?(H=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]=H):H=e[45],H}function ht(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function gt(o){return o.type?.toLowerCase()==="http"||o.type?.toLowerCase()==="streamable-http"}function vt(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 bt(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(ve,{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(yt)})]}),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(jt)})]}),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=vt(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 jt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}function yt(o){return t.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:o},o)}const Nt=[{value:"http",label:"HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"STDIO"},{value:"all",label:"All"}],St={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 Ct(o){if(!o)return"Local";try{return new URL(o).hostname}catch{return o}}function wt(o){if(!o)return"local";try{const e=new URL(o).hostname;return e.split(".")[0]||e}catch{return"unknown"}}function It(o){const e=St[o.toLowerCase()];return e||o.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function _t(o){if(!o)return"http";const e=o.toLowerCase();return e==="sse"?"sse":e==="stdio"?"stdio":"http"}function Tt(o){return o.map((e,s)=>{const r=_t(e.type),n=Ct(e.url),i=wt(e.url),c=e.title||e.name||It(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 kt(o){const e=E.c(2),{protocol:s,className:r}=o;let n;return e[0]!==r?(n={http:t.jsx(Ge,{className:r}),sse:t.jsx(Qe,{className:r}),stdio:t.jsx(Xe,{className:r})},e[0]=r,e[1]=n):n=e[1],n[s]}function Lt(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(X,{variant:r===m.value?"default":"outline",size:"sm",onClick:()=>n(m.value),className:"cursor-pointer",children:[t.jsx(kt,{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 Pt(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(Et),p=Tt(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(Dt));let g=Nt.filter(a=>a.value==="all"||x.has(a.value));m||(g=g.filter(Vt));const _=x.size<=1?g.filter(Mt):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(Ke,{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(Lt,{options:_,selected:N,onSelect:y}),b,P]})}function Mt(o){return o.value!=="all"}function Vt(o){return o.value!=="stdio"}function Dt(o){return o.protocol}function Et(o){return o.type?.toLowerCase()!=="stdio"}function Rt(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($t),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(Fe,{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(Pt,{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(ge,{size:24,className:"animate-spin"}),t.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?t.jsx(ze,{tools:_,showToolbar:!1,emptyMessage:"This MCP Server doesn't have any tools."}):t.jsx(Ve,{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(Oe,{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 $t(o){const e=o;return{name:e.name||"",description:e.description||void 0}}function At(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 Ut(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 Bt(o){const e=o._meta?.["mcp.mesh"],s=o._meta?.["io.modelcontextprotocol.registry/official"],r=o.server,n=We(r.remotes?.[0]?.type),i=qe(r.$schema),c=s?"io.modelcontextprotocol.registry/official":o.publisher||e?.scopeName||"Unknown",u=ct(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=Ye(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 zt 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(ft,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function Ot(){const{org:o}=xe(),e=he(),{appName:s}=Ie({strict:!1}),{registryId:r,serverName:n,stdio:i}=_e({strict:!1}),[c,u]=nt(it.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=tt(),y=st(),{data:f}=Te.useSession(),N=Ze(y),h=r||N[0]?.id||"",x=ot(h),g=He(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=rt({connectionId:h||null,orgId:o.id}),{data:a}=et({client:P,toolName:v,toolArguments:b,select:l=>l.structuredContent??l});let M=[],V=[],G=null;if(a){if(Array.isArray(a))M=a;else if(typeof a=="object"&&a!==null)if("totalCount"in a&&typeof a.totalCount=="number"&&(G=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 lt(L)===s});!k&&n&&(k=M.find(l=>l.server.name===n||l.name===n||l.title===n));const T=k?Bt(k):null,A=(T?.tools?.length||0)>0,D=k?.server?.remotes?.[0]?.url||null,B=!A&&!!D,z=Je({queryKey:ke.remoteMcpTools(D),queryFn:async()=>{if(!D)return[];const{Client:l}=await de(async()=>{const{Client:R}=await import("./index-Dho9MRVw.js").then(q=>q.co);return{Client:R}},__vite__mapDeps([0,1])),{StreamableHTTPClientTransport:L}=await de(async()=>{const{StreamableHTTPClientTransport:R}=await import("./index-DaiP89U7.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"}),te=new L(new URL(D),{requestInit:{headers:{Accept:"application/json, text/event-stream","Content-Type":"application/json"}}});try{return await W.connect(te),((await W.listTools()).tools||[]).map(q=>({name:q.name,description:q.description}))}finally{await W.close().catch(console.error)}},enabled:B}),O=B&&z.isLoading,H=z.data??[],U=A?T?.tools||[]:H,Z=At(y,T?.publisher),J=T?Ut(M,T.publisher,Z,x??null,G):{count:0},se=T?.repository?at(T.repository):null,ne=k?.server?.remotes??[],ee=k?.server?.packages??[],oe=[...ne.map((l,L)=>({...l,_type:"remote",_index:L})),...ee.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:U.length,visible:A||H.length>0||O&&!!D}].filter(l=>l.visible),je=Q.find(l=>l.id==="servers")?.id||Q.find(l=>l.id==="readme")?.id||Q[0]?.id||"overview",ye=m&&Q.find(l=>l.id===m)?m:je,re=async(l,L,W)=>{const te=V[l??0]||k;if(!te||!o||!f?.user?.id)return;const R=Ee(te,o.id,f.user.id,{remoteIndex:W===void 0?L??0:void 0,packageIndex:W}),q=R.connection_type==="STDIO",Ce=!!R.connection_url,we=q&&R.connection_headers&&typeof R.connection_headers=="object"&&"command"in R.connection_headers;if(!Ce&&!we){me.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){me.error(`Failed to connect MCP Server: ${Y instanceof Error?Y.message:String(Y)}`)}},ae=()=>{e({to:"/$org/store",params:{org:o.slug}})};if(!k)return t.jsx(ut,{onBack:ae});if(!T)return null;const Ne=(k?.server?.remotes?.length??0)>0,Se=(k?.server?.packages?.length??0)>0,ce=Ne||Se;return t.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[t.jsx(pt,{onBack:ae}),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:[!ce&&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(dt,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t.jsx(xt,{data:T,itemVersions:V.length>0?V:[k],onInstall:re,canInstall:ce,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(bt,{data:T,publisherInfo:J,selectedItem:k}),t.jsx(Rt,{data:T,availableTabs:Q,effectiveActiveTabId:ye,effectiveTools:U,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 Ds(){const o=E.c(6),{org:e}=xe(),s=he();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(mt,{}),children:t.jsx(Ot,{})}),o[3]=i):i=o[3];let c;return o[4]!==n?(c=t.jsx(zt,{onBack:n,children:i}),o[4]=n,o[5]=c):c=o[5],c}export{Ds as default};
@@ -0,0 +1,3 @@
1
+ import{r as k,c as ae,j as t,p as zt,u as je,g as se,K as le,o as ht,n as Xe,s as ue,aq as Ut,ap as Vt,aa as Ze,k as St,h as Bt,an as te,q as $t}from"./index-Dho9MRVw.js";import{C as Ft}from"./collection-header-CbT_At3k.js";import{C as et}from"./collection-page-CpAhF9Tg.js";import{C as Me}from"./collection-search-DRZ8ScZP.js";import{C as Gt}from"./collection-table-wrapper-CspbeKNx.js";import{I as It,E as Je}from"./empty-state-DKQ_J1zp.js";import{C as lt}from"./checkbox-CUtYbeQD.js";import{c as K,B as ee}from"./button-D_0RTXDt.js";import{i as Kt}from"./ArrowLeft-Dlm4CF9d.js";import{b as yt}from"./use-connection-BU-nKbTz.js";import{u as at}from"./use-members-CVUMGKct.js";import{u as Ot}from"./useQuery-C2zqJzGD.js";import{u as fe}from"./useMutation-Lj_Cbq0P.js";import{A as Ce}from"./avatar-KkS1NpLz.js";import{B as Ne}from"./badge-CfH2vrIM.js";import{f as Ee,a as Te,b as Se,c as Ie,d as ye,e as Oe,A as we,g as Ae}from"./alert-dialog-QzYPe_ae.js";import{D as wt,f as At,a as Rt,b as Qt,c as qt,e as Zt}from"./dialog-B-A0vnh-.js";import{D as ct,a as dt,b as mt,c as Qe,d as Ht,e as Yt,f as Xt,g as Jt}from"./dropdown-menu-CMmh8IDN.js";import{i as Wt}from"./DotsHorizontal-CFL9xkGv.js";import{i as _t}from"./Loading01-Bo9vDQAp.js";import{i as es}from"./Lock01-C1QZkjy0.js";import{s as tt}from"./Plus-DAW17Fqf.js";import{s as Lt}from"./Trash01-BUkAP1vf.js";import{i as gt}from"./X-DyyqPnhR.js";import{I as ts}from"./input-trZWilTG.js";import{S as $e}from"./switch-t5mcsF2Z.js";import{b as Re,c as _e,T as Le,a as Pe}from"./tooltip-Cw2xVvTD.js";import{E as ss}from"./error-boundary-ynZ9rF8y.js";import{a as ns,F as xt,b as pt,c as rs,d as bt,f as Ct}from"./form-DngqlMy0.js";import{S as st,a as nt,b as rt,c as it,d as ot}from"./select-reGYS0Ly.js";import{T as is}from"./textarea-x7X_L353.js";import{a as os,u as ls}from"./constants-D8fdcBr8.js";import{C as jt}from"./card-BmOa96dk.js";import{i as Pt}from"./DotsVertical-DOgWrY6o.js";import{i as as}from"./Key01-CHZQ8Cf-.js";import{s as cs}from"./XClose-nvPI0OtD.js";import"./collection-display-button-Cm0zQnM_.js";import"./ArrowUp-CC-2uYGu.js";import"./Check-BzMGOxMB.js";import"./Grid01-DmaR0g3f.js";import"./List-DZ53jWcW.js";import"./view-mode-toggle-BagEO4CJ.js";import"./SearchMd-D9E7kgub.js";import"./use-collections-CVO4vm4G.js";import"./ChevronDown-BV0rwdFr.js";const ut=({size:s=24,color:e="currentColor",...n})=>k.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},k.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"}));ut.displayName="Shield01";const Mt=({size:s=24,color:e="currentColor",...n})=>k.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},k.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));Mt.displayName="SwitchHorizontal01";const Dt=[{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"}],ds={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 ms(){const s={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[]};for(const e of Dt)s[e.category]?.push(e);return s}function us(){return Dt.map(s=>({value:s.name,label:ds[s.name],dangerous:s.dangerous}))}const fs=k.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(It,{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(lt,{checked:o,onCheckedChange:j,onClick:xs})]}),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}),hs=k.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(lt,{id:N,checked:o,onCheckedChange:m,onClick:ps})}),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 gs({toolSet:s,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,a]=k.useState(""),o=k.useDeferredValue(r),[m,l]=k.useState("all"),[x,j]=k.useState(!1),h=k.useRef(new Set(Object.keys(s))),v=yt({searchTerm:o.trim()||void 0}),c=n?v.filter(d=>d.connection_type!=="VIRTUAL"?!0:zt(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],I=d=>{const S=s[d];return S!==void 0&&S.length>0},C=p.filter(d=>{if(m==="all")return!0;const S=I(d.id);return m==="selected"?S:m==="unselected"?!S:!0}),[f,y]=k.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,y(d)),e(z)},D=d=>{y(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(Me,{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(fs,{connection:d,isSelected:f===d.id,hasToolsEnabled:I(d.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>D(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(Kt,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(It,{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(hs,{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 xs(s){return s.stopPropagation()}function ps(s){return s.stopPropagation()}const vt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function bs(s){return s.replace(/-/g," ")}function Cs(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 ft(){const{locator:s}=je(),{data:e,isLoading:n,error:r,refetch:a}=Ot({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=vt.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||vt.some(b=>b.value===x))continue;const{staticPermissions:j,allowsAllStaticPermissions:h,connectionIds:v,allowsAllConnections:c,toolNames:N,allowsAllTools:u}=Cs(l.permission);o.push({id:l.id,role:x,label:bs(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 js=ht({role:ht({id:ue().optional(),slug:ue().optional(),label:ue()}),allowAllStaticPermissions:Vt(),staticPermissions:Xe(ue()),toolSet:Ut(ue(),Xe(ue())),memberIds:Xe(ue())});function kt(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const vs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],We=["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 Ns(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)%We.length;return We[n]??We[0]}function Fe(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function Es(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]=k.useState(""),h=k.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=ms(),f=us(),y=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(Me,{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 D;e[22]!==n||e[23]!==a||e[24]!==o||e[25]!==l?(D=t.jsx("div",{onClick:Os,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsx($e,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx($e,{checked:n,disabled:l,onCheckedChange:w=>{l||(a(w),o([]))}})}),e[22]=n,e[23]=a,e[24]=o,e[25]=l,e[26]=D):D=e[26],e[27]!==D||e[28]!==A||e[29]!==_?(b=t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:A,onClick:_,children:[R,D]})}),e[27]=D,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=y.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(ys);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:Is,children:l?t.jsx(Re,{children:t.jsxs(_e,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsx($e,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(Ss);o(L.filter(z=>z!==g.value))}else T(g.value)}})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):t.jsx($e,{checked:n||r.includes(g.value),disabled:l,onCheckedChange:()=>{if(!l)if(n){a(!1);const L=f.map(Ts);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 I;return e[34]!==N||e[35]!==u||e[36]!==b||e[37]!==p?(I=t.jsxs("div",{className:N,children:[u,b,p]}),e[34]=N,e[35]=u,e[36]=b,e[37]=p,e[38]=I):I=e[38],I}function Ts(s){return s.value}function Ss(s){return s.value}function Is(s){return s.stopPropagation()}function ys(s){return s.value}function Os(s){return s.stopPropagation()}function ws(s){const e=ae.c(56),{open:n,onOpenChange:r,selectedMemberIds:a,onAddMembers:o}=s,[m,l]=k.useState(""),x=k.useDeferredValue(m);let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[0]=j):j=e[0];const[h,v]=k.useState(j),{data:c}=at();let N,u,b,p,I,C,f,y,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=V=>{const i=x.toLowerCase();return V.user?.name?.toLowerCase().includes(i)||V.user?.email?.toLowerCase().includes(i)},e[20]=x,e[21]=z):z=e[21];const F=L.filter(z),Q=As;let q;e[22]!==a?(q=V=>a.includes(V),e[22]=a,e[23]=q):q=e[23];const Z=q;let X;e[24]!==h?(X=V=>{h.includes(V)?v(h.filter(i=>i!==V)):v([...h,V])},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=Ee,P=n,A=r,N=Te,y="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(Se,{className:"px-6 pt-6",children:[t.jsx(Ie,{children:"Add Members to Role"}),t.jsx(ye,{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(Me,{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",I=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(V=>{const i=Q(V),O=Z(V.id),G=h.includes(V.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(lt,{checked:G||O,onCheckedChange:()=>{i&&!O&&re(V.id)},disabled:!i||O}),t.jsx(Ce,{url:V.user?.image??void 0,fallback:kt(V.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:V.user?.name||"Unknown"}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:V.user?.email})]}),!i&&t.jsx(Ne,{variant:"secondary",className:"shrink-0",children:"Owner"}),O&&i&&t.jsx(Ne,{variant:"outline",className:"shrink-0",children:"Added"})]},V.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]=I,e[14]=C,e[15]=f,e[16]=y,e[17]=T,e[18]=P,e[19]=A}else N=e[9],u=e[10],b=e[11],p=e[12],I=e[13],C=e[14],f=e[15],y=e[16],T=e[17],P=e[18],A=e[19];let _;e[33]!==p||e[34]!==I?(_=t.jsx("div",{className:p,children:I}),e[33]=p,e[34]=I,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 D;e[40]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(we,{children:"Cancel"}),e[40]=D):D=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(Oe,{className:"px-6 pb-6",children:[D,t.jsxs(Ae,{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]!==y||e[49]!==T?(E=t.jsxs(N,{className:y,children:[T,R,S]}),e[45]=N,e[46]=R,e[47]=S,e[48]=y,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 As(s){return s.role!=="owner"}function Rs(s){const e=ae.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:a}=s,o=a===void 0?!1:a,[m,l]=k.useState(""),x=k.useDeferredValue(m),[j,h]=k.useState(!1),{data:v}=at();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 y=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=y.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 D=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(Me,{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(Re,{children:t.jsxs(_e,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsxs(ee,{variant:"outline",size:"sm",disabled:!0,children:[t.jsx(tt,{size:16}),"Add Member"]})})}),t.jsx(Pe,{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(tt,{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(Ce,{url:E.user?.image??void 0,fallback:kt(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(Re,{children:t.jsxs(_e,{children:[t.jsx(Le,{asChild:!0,children:t.jsx("div",{children:t.jsx(ee,{variant:"ghost",size:"sm",disabled:!0,children:t.jsx(gt,{size:16})})})}),t.jsx(Pe,{children:t.jsx("p",{children:"Owner membership cannot be changed"})})]})}):t.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>D(E.id),children:t.jsx(gt,{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 I;e[28]!==N||e[29]!==u?(I=t.jsx("div",{className:N,children:u}),e[28]=N,e[29]=u,e[30]=I):I=e[30];let C;e[31]!==j||e[32]!==c||e[33]!==n?(C=t.jsx(ws,{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]!==I||e[38]!==C?(f=t.jsxs("div",{className:b,children:[p,I,C]}),e[35]=b,e[36]=p,e[37]=I,e[38]=C,e[39]=f):f=e[39],f}function _s(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(_t,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==s?(r=t.jsx(k.Suspense,{fallback:n,children:t.jsx(Rs,{...s})}),e[1]=s,e[2]=r):r=e[2],r}const Ls={owner:[],admin:[],user:[]};function Ge(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:Ls[s],toolSet:{},memberIds:r.map(a=>a.id)}}function Ps({trigger:s,onSuccess:e}){const[n,r]=k.useState(!1),[a,o]=k.useState("mcp"),{locator:m}=je(),l=Ze(),x=yt()??[],{customRoles:j,refetch:h}=ft(),{data:v}=Ot({queryKey:le.members(m),queryFn:()=>se.organization.listMembers()}),c=St({resolver:Bt(js),defaultValues:Fe()}),N=c.formState.isValid,u=c.formState.isDirty,[b,p]=k.useState(null),[I,C]=k.useState(null),f=!c.watch("role.id")&&!c.watch("role.slug")&&!I,[y,T]=k.useState(null),[P,A]=k.useState(!1),[_,R]=k.useState(null),D=i=>{const O=i.permission||{},G=O.self||[],oe=G.includes("*"),ie=oe?[]:G.filter(U=>U!=="*"),J={};for(const[U,B]of Object.entries(O))if(U!=="self")if(U==="*")for(const Y of x)B.includes("*")?J[Y.id]=Y.tools?.map(ce=>ce.name)??[]:J[Y.id]=B;else{const Y=x.find(ce=>ce.id===U);Y&&(B.includes("*")?J[U]=Y.tools?.map(ce=>ce.name)??[]:J[U]=B)}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=D(i);c.reset(O),p(i.id??null),C(null)},d=()=>{c.reset(Fe()),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=Ge(i,v?.data?.members??[]);c.reset(O),C(i),p(null),o("org")}),A(!0);else{const O=Ge(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(Fe()),C(null)}),A(!0);return}if(r(i),!i)c.reset(Fe()),C(null),p(null);else{const O=j[0];if(O)w(O);else{const G=Ge("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(H=>H.id===G)?.tools?.map(H=>H.name)??[];J.length>0&&J.every(H=>oe.includes(H))?O[G]=["*"]:O[G]=oe}return O},Q=fe({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),H=i.memberIds.filter(U=>!J.includes(U)),me=J.filter(U=>!i.memberIds.includes(U));for(const U of H){const B=await se.organization.updateMemberRole({memberId:U,role:[i.role.slug]});if(B?.error)throw new Error(B.error.message)}for(const U of me){const B=await se.organization.updateMemberRole({memberId:U,role:["user"]});if(B?.error)throw new Error(B.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 H=(v?.data?.members??[]).filter(B=>B.role===i.role.slug).map(B=>B.id),me=i.memberIds.filter(B=>!H.includes(B)),U=H.filter(B=>!i.memberIds.includes(B));for(const B of me){const Y=await se.organization.updateMemberRole({memberId:B,role:[i.role.slug]});if(Y?.error)throw new Error(Y.error.message)}for(const B of U){const Y=await se.organization.updateMemberRole({memberId:B,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 H=await se.organization.updateMemberRole({memberId:J,role:[G]});if(H?.error)throw new Error(H.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=fe({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(),y?.id===b){const i=j.filter(O=>O.id!==y?.id);if(i[0])w(i[0]);else{const O=Ge("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")}}),Z=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})},V=()=>{y?.id&&q.mutate(y.id),T(null)};return t.jsxs(wt,{open:n,onOpenChange:L,children:[t.jsx(At,{asChild:!0,children:s}),t.jsx(Rt,{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:[vs.map(i=>{const O=I===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(es,{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",Ns(i.label))}),t.jsx("p",{className:"text-sm font-medium truncate flex-1",children:i.label}),t.jsxs(ct,{children:[t.jsx(dt,{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(Wt,{size:14})})}),t.jsx(mt,{align:"end",children:t.jsxs(Qe,{className:"text-destructive",onClick:G=>{G.stopPropagation(),ne(i)},children:[t.jsx(Lt,{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(ts,{...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(Ne,{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:Z||u,className:"w-full h-10",children:[t.jsx(tt,{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:[!I&&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"&&!I&&t.jsx(gs,{toolSet:c.watch("toolSet"),onToolSetChange:i=>c.setValue("toolSet",i,{shouldDirty:!0})}),a==="org"&&t.jsx(Es,{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:!!I}),a==="members"&&t.jsx(_s,{memberIds:c.watch("memberIds"),onMemberIdsChange:i=>c.setValue("memberIds",i,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="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:Z,className:"h-10",children:"Cancel"}),t.jsx(ee,{onClick:re,disabled:Z||!N||!c.formState.isDirty,className:"h-10",children:Q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),t.jsx(Ee,{open:y!==null,onOpenChange:i=>!i&&T(null),children:t.jsxs(Te,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Delete Role"}),t.jsxs(ye,{children:['Are you sure you want to delete the "',y?.label,'" role? This action cannot be undone.']})]}),t.jsxs(Oe,{children:[t.jsx(we,{children:"Cancel"}),t.jsx(Ae,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t.jsx(Ee,{open:P,onOpenChange:A,children:t.jsxs(Te,{children:[t.jsxs(Se,{children:[t.jsx(Ie,{children:"Discard Changes"}),t.jsx(ye,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),t.jsxs(Oe,{children:[t.jsx(we,{onClick:()=>R(null),children:"Keep Editing"}),t.jsx(Ae,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const Ms=ue().email("Invalid email address");function Ds(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 ks({trigger:s}){const[e,n]=k.useState(!1),{locator:r}=je(),a=Ze(),{data:o}=se.useSession(),m=o?.user?.email,{roles:l,isLoading:x}=ft(),j=l.filter(C=>C.role!=="owner"),h=St({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),v=h.watch("emailsText"),c=h.watch("role"),u=Ds(v).filter(C=>{const f=Ms.safeParse(C).success,y=!m||C!==m.toLowerCase();return f&&y}),b=fe({mutationFn:async({emails:C,role:f})=>{if(!f)throw new Error("Please select a role");const y=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=y.filter(P=>P.status==="rejected");if(T.length>0)throw new Error(`Failed to invite ${T.length} member${T.length>1?"s":""}`);return y},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})},I=u.length>0&&!!c;return t.jsxs(wt,{open:e,onOpenChange:n,children:[t.jsx(At,{asChild:!0,children:s}),t.jsxs(Rt,{className:"sm:max-w-lg",children:[t.jsx(Qt,{children:t.jsx(qt,{children:"Invite members"})}),t.jsx(ns,{...h,children:t.jsxs("form",{onSubmit:h.handleSubmit(p),className:"space-y-4",children:[t.jsx(xt,{control:h.control,name:"emailsText",render:({field:C})=>t.jsxs(pt,{children:[t.jsx(rs,{children:"Email addresses"}),t.jsx(bt,{children:t.jsx(is,{...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(Ct,{})]})}),t.jsx(xt,{control:h.control,name:"role",render:({field:C})=>t.jsxs(pt,{children:[t.jsx(bt,{children:t.jsxs(st,{value:C.value,onValueChange:C.onChange,disabled:b.isPending||x,children:[t.jsx(nt,{className:"w-full",children:t.jsx(rt,{placeholder:"Select a role"})}),t.jsx(it,{children:j.map(f=>{const y=[];return f.isBuiltin||(f.allowsAllStaticPermissions?y.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&y.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?y.push("All connections"):f.connectionCount&&f.connectionCount>0&&y.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?y.push("all tools"):f.toolCount&&f.toolCount>0&&y.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),t.jsx(ot,{value:f.role,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:f.label}),!f.isBuiltin&&y.length>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:y.join(", ")})]})},f.role)})})]})}),t.jsx(Ct,{})]})}),t.jsxs(Zt,{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||!I,children:b.isPending?"Inviting...":`Invite ${u.length||0} Member${u.length!==1?"s":""}`})]})]})})]})]})}function zs(){const s=ae.c(9),{org:e,locator:n}=je();let r;s[0]!==e.id?(r={connectionId:os,orgId:e.id},s[0]=e.id,s[1]=r):r=s[1];const a=ls(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],$t(l)}function Us(){const s=ae.c(5),{locator:e}=je(),n=Ze();let r;s[0]!==e||s[1]!==n?(r={mutationFn:Bs,onSuccess:()=>{n.invalidateQueries({queryKey:le.invitations(e)}),te.success("Invitation cancelled")},onError:Vs},s[0]=e,s[1]=n,s[2]=r):r=s[2];const a=fe(r);let o;return s[3]!==a?(o={cancel:a},s[3]=a,s[4]=o):o=s[4],o}function Vs(s){te.error(s instanceof Error?s.message:"Failed to cancel invitation")}async function Bs(s){const e=await se.organization.cancelInvitation({invitationId:s});if(e?.error)throw new Error(e.error.message);return e.data}const Nt=["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"],$s={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function qe(s){return s?s.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Fs(s){const e=new Map;for(const[n,r]of Object.entries($s))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,Nt[n%Nt.length]??"bg-neutral-400")}return e}function Gs(s){return new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Ke(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,I,C,f,y,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=V=>l(r,V),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(rt,{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(nt,{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 V;e[33]!==o?(V=i=>{const O=o.get(i.role)??"bg-neutral-400";return t.jsx(ot,{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]=V):V=e[34],q=m.map(V),e[30]=o,e[31]=m,e[32]=q}else q=e[32];let Z;e[35]!==q?(Z=t.jsx(it,{children:q}),e[35]=q,e[36]=Z):Z=e[36];let X;e[37]!==a||e[38]!==n||e[39]!==g||e[40]!==Q||e[41]!==Z?(X=t.jsx(Le,{asChild:!0,children:t.jsx("div",{className:"w-fit",children:t.jsxs(st,{value:n,onValueChange:g,disabled:a,children:[Q,Z]})})}),e[37]=a,e[38]=n,e[39]=g,e[40]=Q,e[41]=Z,e[42]=X):X=e[42];let re;e[43]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Pe,{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(Re,{children:t.jsxs(_e,{children:[X,re]})}),e[44]=X,e[45]=ne):ne=e[45],T=ne;break e}N=st,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],y=a,c=nt,p=h,I=j,v=rt,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]=I,e[15]=C,e[16]=f,e[17]=y,e[18]=T}else v=e[8],c=e[9],N=e[10],u=e[11],b=e[12],p=e[13],I=e[14],C=e[15],f=e[16],y=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 D;e[60]!==c||e[61]!==R||e[62]!==p||e[63]!==I?(D=t.jsx(c,{size:p,className:I,children:R}),e[60]=c,e[61]=R,e[62]=p,e[63]=I,e[64]=D):D=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(ot,{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(it,{children:w}),e[70]=w,e[71]=d):d=e[71];let S;return e[72]!==N||e[73]!==D||e[74]!==d||e[75]!==C||e[76]!==f||e[77]!==y?(S=t.jsxs(N,{value:C,onValueChange:f,disabled:y,children:[D,d]}),e[72]=N,e[73]=D,e[74]=d,e[75]=C,e[76]=f,e[77]=y,e[78]=S):S=e[78],S}function Et(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,I;if(e[0]!==x||e[1]!==l||e[2]!==n.id||e[3]!==n.role||e[4]!==a||e[5]!==r){let D;e[15]!==n.role?(D=g=>g.role!==n.role&&g.role!=="owner",e[15]=n.role,e[16]=D):D=e[16];const w=r.filter(D);c=ct;let d;e[17]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Pt,{size:20}),e[17]=d):d=e[17],e[18]!==x?(I=t.jsx(dt,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:x,onClick:Qs,children:d})}),e[18]=x,e[19]=I):I=e[19],v=mt,b="end",p=Ks,h=Ht;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Mt,{size:16}),e[20]=S):S=e[20],e[21]!==l?(u=t.jsxs(Yt,{disabled:l,children:[S,"Change Role"]}),e[21]=l,e[22]=u):u=e[22],j=Xt;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(Qe,{onClick:z=>{z.stopPropagation(),a(n.id,g.role)},disabled:l,children:[g.isBuiltin?t.jsx(ut,{size:16}):t.jsx(as,{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]=I}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],I=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 y;e[34]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Jt,{}),e[34]=y):y=e[34];let T;e[35]!==n.id||e[36]!==o?(T=D=>{D.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(Lt,{size:16}),e[38]=P):P=e[38];let A;e[39]!==T?(A=t.jsxs(Qe,{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,y,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]!==I?(R=t.jsxs(c,{children:[I,_]}),e[47]=c,e[48]=_,e[49]=I,e[50]=R):R=e[50],R}function Ks(s){return s.stopPropagation()}function Qs(s){return s.stopPropagation()}function Tt(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(dt,{asChild:!0,children:t.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Zs,children:t.jsx(Pt,{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(cs,{size:16}),e[4]=x):x=e[4];let j;return e[5]!==o||e[6]!==l?(j=t.jsxs(ct,{children:[m,t.jsx(mt,{align:"end",onClick:qs,children:t.jsxs(Qe,{variant:"destructive",onClick:l,disabled:o,children:[x,"Cancel Invitation"]})})]}),e[5]=o,e[6]=l,e[7]=j):j=e[7],j}function qs(s){return s.stopPropagation()}function Zs(s){return s.stopPropagation()}function Hs(){const s=ae.c(74),{data:e}=at(),{data:n}=zs(),r=Us(),a=Ze(),{locator:o}=je(),[m,l]=k.useState(null),[x,j]=k.useState(null),[h,v]=k.useState(""),[c,N]=k.useState("table"),[u,b]=k.useState("member"),[p,I]=k.useState("asc"),C=e?.data?.members;let f;s[0]!==u?(f=M=>{u===M?I(cn):(b(M),I("asc"))},s[0]=u,s[1]=f):f=s[1];const y=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,ve;e:switch(u){case"member":{de=$.user?.name||"",ve=W.user?.name||"";break e}case"role":{de=$.role||"",ve=W.role||"";break e}case"joined":{de=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",ve=W.createdAt?typeof W.createdAt=="string"?W.createdAt:W.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?de.localeCompare(ve):ve.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:an,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(o)}),te.success("Member has been removed from the organization"),l(null)},onError:ln},s[5]=o,s[6]=a,s[7]=_):_=s[7];const R=fe(_);let D;s[8]!==o||s[9]!==a?(D={mutationFn:on,onSuccess:()=>{a.invalidateQueries({queryKey:le.members(o)}),te.success("Member's role has been updated")},onError:rn},s[8]=o,s[9]=a,s[10]=D):D=s[10];const w=fe(D);let d;s[11]!==o||s[12]!==a?(d={mutationFn:nn,onSuccess:()=>{a.invalidateQueries({queryKey:le.invitations(o)}),te.success("Invitation role has been updated")},onError:sn},s[11]=o,s[12]=a,s[13]=d):d=s[13];const S=fe(d),{roles:E,customRoles:g}=ft();let L;s[14]!==g?(L=Fs(g),s[14]=g,s[15]=L):L=s[15];const z=L;let F;s[16]!==E?(F=E.filter(tn),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:en,cellClassName:"flex-1 min-w-0",sortable:!0},s[18]=q):q=s[18];let Z;s[19]!==z||s[20]!==Q||s[21]!==S||s[22]!==w?(Z={id:"role",header:"Role",render:M=>M.type==="member"?t.jsx(Ke,{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(Ke,{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]=Z):Z=s[23];let X;s[24]===Symbol.for("react.memo_cache_sentinel")?(X={id:"joined",header:"Joined",render:Ws,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(Et,{member:M.data,roles:E,onChangeRole:($,W)=>w.mutate({memberId:$,role:W}),onRemove:l,isUpdating:w.isPending}):t.jsx(Tt,{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]!==Z||s[30]!==re?(ne=[q,Z,X,re],s[29]=Z,s[30]=re,s[31]=ne):ne=s[31];const V=ne;let i;s[32]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ps,{trigger:t.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[t.jsx(ut,{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(ks,{trigger:t.jsx(ee,{size:"sm",children:"Invite Member"})})]}),s[33]=O):O=s[33];const G=O,oe=[...A.map(Js),...P.filter(Xs).map(Ys)],ie=et,J=!!x;let H;s[34]===Symbol.for("react.memo_cache_sentinel")?(H=()=>j(null),s[34]=H):H=s[34];let me;s[35]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsxs(Se,{children:[t.jsx(Ie,{children:"Cancel Invitation"}),t.jsx(ye,{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(we,{children:"Keep Invitation"}),s[36]=U):U=s[36];let B;s[37]!==r.cancel||s[38]!==x?(B=()=>{x&&(r.cancel.mutate(x),j(null))},s[37]=r.cancel,s[38]=x,s[39]=B):B=s[39];let Y;s[40]!==r.cancel.isPending||s[41]!==B?(Y=t.jsxs(Te,{children:[me,t.jsxs(Oe,{children:[U,t.jsx(Ae,{onClick:B,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),s[40]=r.cancel.isPending,s[41]=B,s[42]=Y):Y=s[42];let ce;s[43]!==J||s[44]!==Y?(ce=t.jsx(Ee,{open:J,onOpenChange:H,children:Y}),s[43]=J,s[44]=Y,s[45]=ce):ce=s[45];const He=!!m;let De;s[46]===Symbol.for("react.memo_cache_sentinel")?(De=()=>l(null),s[46]=De):De=s[46];let ke;s[47]===Symbol.for("react.memo_cache_sentinel")?(ke=t.jsxs(Se,{children:[t.jsx(Ie,{children:"Remove Member"}),t.jsx(ye,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),s[47]=ke):ke=s[47];let ze;s[48]===Symbol.for("react.memo_cache_sentinel")?(ze=t.jsx(we,{children:"Cancel"}),s[48]=ze):ze=s[48];let he;s[49]!==m||s[50]!==R?(he=()=>m&&R.mutate(m),s[49]=m,s[50]=R,s[51]=he):he=s[51];let ge;s[52]!==R.isPending||s[53]!==he?(ge=t.jsxs(Te,{children:[ke,t.jsxs(Oe,{children:[ze,t.jsx(Ae,{onClick:he,disabled:R.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),s[52]=R.isPending,s[53]=he,s[54]=ge):ge=s[54];let xe;s[55]!==He||s[56]!==ge?(xe=t.jsx(Ee,{open:He,onOpenChange:De,children:ge}),s[55]=He,s[56]=ge,s[57]=xe):xe=s[57];let Ue;s[58]===Symbol.for("react.memo_cache_sentinel")?(Ue=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],s[58]=Ue):Ue=s[58];let pe;s[59]!==y||s[60]!==p||s[61]!==u||s[62]!==c?(pe=t.jsx(Ft,{title:"Members",viewMode:c,onViewModeChange:N,sortKey:u,sortDirection:p,onSort:y,sortOptions:Ue,ctaButton:G}),s[59]=y,s[60]=p,s[61]=u,s[62]=c,s[63]=pe):pe=s[63];let Ve;s[64]===Symbol.for("react.memo_cache_sentinel")?(Ve=M=>{M.key==="Escape"&&(v(""),M.target.blur())},s[64]=Ve):Ve=s[64];let be;s[65]!==h?(be=t.jsx(Me,{value:h,onChange:v,placeholder:"Search members...",onKeyDown:Ve}),s[65]=h,s[66]=be):be=s[66];const Ye=c==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:oe.length===0?t.jsx(Je,{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(jt,{className:"transition-colors relative opacity-75",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(Tt,{invitationId:M.data.id,onCancel:j,isCancelling:r.cancel.isPending})}),t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Ce,{fallback:qe(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(Ne,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),t.jsx(Ke,{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(jt,{className:"transition-colors relative",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10",children:t.jsx(Et,{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(Ce,{url:$.user?.image??void 0,fallback:qe($.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(Ke,{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(Gt,{columns:V,data:oe,isLoading:!1,sortKey:u,sortDirection:p,onSort:y,emptyState:h?t.jsx(Je,{title:"No members found",description:`No members match "${h}"`}):t.jsx(Je,{title:"No members found",description:"Invite members to get started."})});let Be;return s[67]!==ie||s[68]!==ce||s[69]!==xe||s[70]!==pe||s[71]!==be||s[72]!==Ye?(Be=t.jsxs(ie,{children:[ce,xe,pe,be,Ye]}),s[67]=ie,s[68]=ce,s[69]=xe,s[70]=pe,s[71]=be,s[72]=Ye,s[73]=Be):Be=s[73],Be}function Ys(s){return{type:"invitation",data:s}}function Xs(s){return s.status==="pending"}function Js(s){return{type:"member",data:s}}function Ws(s){return s.type==="member"?t.jsx("span",{className:"text-sm text-foreground",children:s.data.createdAt?Gs(s.data.createdAt):"N/A"}):t.jsx(Ne,{variant:"outline",children:"Pending"})}function en(s){return s.type==="member"?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{url:s.data.user?.image??void 0,fallback:qe(s.data.user?.name),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.user?.name||"Unknown"}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.data.user?.email})]})]}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ce,{fallback:qe(s.data.email),shape:"circle",size:"sm"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:s.data.email}),t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function tn(s){return s.role!=="owner"}function sn(s){te.error(s instanceof Error?s.message:"Failed to update invitation role")}async function nn(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 rn(s){te.error(s instanceof Error?s.message:"Failed to update role")}async function on(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 ln(s){te.error(s instanceof Error?s.message:"Failed to remove member")}async function an(s){const e=await se.organization.removeMember({memberIdOrEmail:s});if(e?.error)throw new Error(e.error.message)}function cn(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function tr(){const s=ae.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(et,{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(ss,{fallback:e,children:t.jsx(k.Suspense,{fallback:t.jsx(et,{children:t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(_t,{size:32,className:"animate-spin text-muted-foreground"})})}),children:t.jsx(Hs,{})})}),s[1]=n):n=s[1],n}export{tr as default};