@decocms/mesh 2.71.0 → 2.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/client/assets/{AlertCircle-B2r4RYCl.js → AlertCircle-CHm1uTvc.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-DL3E-1B5.js → ArrowUp-CsvTcSKO.js} +1 -1
  3. package/dist/client/assets/{Calendar-BJyFA5MR.js → Calendar-RaRlGUMn.js} +1 -1
  4. package/dist/client/assets/{Check-VEx1ONnd.js → Check-CTaDpFbx.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-hgwi-82I.js → CheckCircle-BUL08lD-.js} +1 -1
  6. package/dist/client/assets/{CheckDone01-DIhXP9ft.js → CheckDone01-C9iBTpWu.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-B9Mxx2fi.js → ChevronDown-BmbIYWgz.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-in3TmXpP.js → ChevronRight-C7PRdwhN.js} +1 -1
  9. package/dist/client/assets/{Code01-QyeCluYo.js → Code01-BHb1dfFm.js} +1 -1
  10. package/dist/client/assets/{Copy01-JjoULgm7.js → Copy01-BHrubS15.js} +1 -1
  11. package/dist/client/assets/{DotsHorizontal-CO7zK7Nc.js → DotsHorizontal-BKEGXeRq.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DjjH7_Y2.js → DotsVertical-6bV4Jb02.js} +1 -1
  13. package/dist/client/assets/{Download01-CiJpDnb8.js → Download01-DCCcXkST.js} +1 -1
  14. package/dist/client/assets/{Edit01-DUGutI3c.js → Edit01-Ck6L4sn5.js} +1 -1
  15. package/dist/client/assets/{File02-DLP0uk3c.js → File02-Bdk2SiT1.js} +1 -1
  16. package/dist/client/assets/{File06-DCxDcy-i.js → File06-g3-IRgq5.js} +1 -1
  17. package/dist/client/assets/{FilterLines-Cc5F0HuO.js → FilterLines-CZJIfYWV.js} +1 -1
  18. package/dist/client/assets/{Globe02-BWyDEbcv.js → Globe02-nY9R9qg_.js} +1 -1
  19. package/dist/client/assets/{Grid01-DQKfO4pL.js → Grid01-CzUkHZSJ.js} +1 -1
  20. package/dist/client/assets/{Home02-DwMa7Dxn.js → Home02-D9mVq7KP.js} +1 -1
  21. package/dist/client/assets/{Image01-CURk6BcD.js → Image01-C213KIPf.js} +1 -1
  22. package/dist/client/assets/{Inbox01-BzO-o9k3.js → Inbox01-CXr_wpYC.js} +1 -1
  23. package/dist/client/assets/{InfoCircle-CwNQC8tM.js → InfoCircle-DEUMb_Ke.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-Css-DquB.js → LinkExternal01-CmQ2HPM6.js} +1 -1
  25. package/dist/client/assets/{List-CavdzHis.js → List-hntTIiNx.js} +1 -1
  26. package/dist/client/assets/{Loading01-CM7djb9Q.js → Loading01-B78uc8_j.js} +1 -1
  27. package/dist/client/assets/{Lock01-B6ThbWMN.js → Lock01-rY0GklCm.js} +1 -1
  28. package/dist/client/assets/{Pin01-D3bkVyHA.js → Pin01-B6bFgA7L.js} +1 -1
  29. package/dist/client/assets/{Play-BoQgM5dI.js → Play-CMxteKat.js} +1 -1
  30. package/dist/client/assets/{Plus-BhKqidCj.js → Plus-B1DSIk_Y.js} +1 -1
  31. package/dist/client/assets/{SearchMd-DZNqxRa2.js → SearchMd-rxhL9uWW.js} +1 -1
  32. package/dist/client/assets/{Settings01-P-PH04Nm.js → Settings01-BBpmfPia.js} +1 -1
  33. package/dist/client/assets/{Share07-BUD3TbCH.js → Share07-DNr4Gv0F.js} +1 -1
  34. package/dist/client/assets/{Terminal-CI6nX2Ah.js → Terminal-CvqFIFfF.js} +1 -1
  35. package/dist/client/assets/{Tool01-CMlMVnUR.js → Tool01-BWEJZQCA.js} +1 -1
  36. package/dist/client/assets/{Trash01-SLyaMDks.js → Trash01-CNJdNb2Z.js} +1 -1
  37. package/dist/client/assets/{Upload01-D7JbiLex.js → Upload01-CtypJgSZ.js} +1 -1
  38. package/dist/client/assets/{Users03-Chku9Yx2.js → Users03-B_SbeQBk.js} +1 -1
  39. package/dist/client/assets/{X-2IB63Q0x.js → X-mZzFkOTX.js} +1 -1
  40. package/dist/client/assets/{XClose-DSG07tz8.js → XClose-BwAC8sFB.js} +1 -1
  41. package/dist/client/assets/{agent-connections-preview-d9Roi18q.js → agent-connections-preview-DieWCUjN.js} +1 -1
  42. package/dist/client/assets/agent-detail-CViIjBwu.js +1 -0
  43. package/dist/client/assets/{agents-DdS_0nX9.js → agents-CyHP3pcb.js} +1 -1
  44. package/dist/client/assets/{alert-dialog-BmBtcfYg.js → alert-dialog-BN06wH-l.js} +1 -1
  45. package/dist/client/assets/{auth-catchall-DxqNbjWx.js → auth-catchall-DXrXBOXl.js} +1 -1
  46. package/dist/client/assets/{avatar-ydfTe0xi.js → avatar-2G5ouaDu.js} +1 -1
  47. package/dist/client/assets/{badge-B4Hap73o.js → badge-tOUVTd9z.js} +1 -1
  48. package/dist/client/assets/{binder-BMOA5_jw.js → binder-CbgCr5Rm.js} +1 -1
  49. package/dist/client/assets/{breadcrumb-CfCt3BHC.js → breadcrumb-JfdGMaRd.js} +1 -1
  50. package/dist/client/assets/{button-CIJQcfm2.js → button-BKtq_PYU.js} +1 -1
  51. package/dist/client/assets/{card-v4WZxiU8.js → card-C0u1Pmkw.js} +1 -1
  52. package/dist/client/assets/{checkbox-C09bNjVn.js → checkbox-DmCTNQLX.js} +1 -1
  53. package/dist/client/assets/{circle-alert-DuIKlbT4.js → circle-alert-BNmG-8Wh.js} +1 -1
  54. package/dist/client/assets/{collection-detail-C72vEJV3.js → collection-detail-CGH1Knd0.js} +3 -3
  55. package/dist/client/assets/{collection-search-BhGdJARf.js → collection-search-MQc1JOFA.js} +1 -1
  56. package/dist/client/assets/{collection-tab-D7lvZwh_.js → collection-tab-qHWWI3bH.js} +1 -1
  57. package/dist/client/assets/{collection-table-wrapper-BXL-ZhOo.js → collection-table-wrapper-L4Z0dyO1.js} +1 -1
  58. package/dist/client/assets/{collection-tabs-mdXwReEh.js → collection-tabs-CyRXUdkR.js} +1 -1
  59. package/dist/client/assets/{command-CwW6gorP.js → command-Bqwb_7NQ.js} +1 -1
  60. package/dist/client/assets/{connect-BW6N8ux-.js → connect-D30M34Bx.js} +1 -1
  61. package/dist/client/assets/{connection-card-DNYtrXwy.js → connection-card-CMQL70VR.js} +1 -1
  62. package/dist/client/assets/connection-detail-CQNN_rRv.js +1 -0
  63. package/dist/client/assets/{connections-CUhitW1a.js → connections-B7K4OdQw.js} +1 -1
  64. package/dist/client/assets/constants-DIAAKB_c.js +1 -0
  65. package/dist/client/assets/{constants-BQDDq09c.js → constants-PBHJ4h9F.js} +1 -1
  66. package/dist/client/assets/{create-organization-dialog-BIoGwH68.js → create-organization-dialog-BOgbyqMq.js} +1 -1
  67. package/dist/client/assets/{create-project-dialog-CfrpB8Yx.js → create-project-dialog-BxxiVX3V.js} +1 -1
  68. package/dist/client/assets/{dialog-Dn-qFsZM.js → dialog-B8Jtq_Yp.js} +1 -1
  69. package/dist/client/assets/{dropdown-menu-CFkIMuHp.js → dropdown-menu-C6Z4raJE.js} +1 -1
  70. package/dist/client/assets/{dynamic-plugin-layout-zcSRj9Fz.js → dynamic-plugin-layout-CDgkhjuC.js} +1 -1
  71. package/dist/client/assets/{empty-state-Bu5U3yVT.js → empty-state-B8XrD0Ub.js} +1 -1
  72. package/dist/client/assets/{empty-state-DfPGxaKS.js → empty-state-BXisfxVt.js} +1 -1
  73. package/dist/client/assets/{env-vars-editor-C889wc3R.js → env-vars-editor-8a4L674b.js} +1 -1
  74. package/dist/client/assets/{error-boundary-DRPYIYcG.js → error-boundary-D9qG4zZt.js} +1 -1
  75. package/dist/client/assets/{extract-connection-data-5ZTgwgJP.js → extract-connection-data-CCyj_Y1X.js} +1 -1
  76. package/dist/client/assets/{file-browser-CXMrgCnS.js → file-browser-DInIgvl2.js} +2 -2
  77. package/dist/client/assets/{form-CfZFG_36.js → form-DQap4sDh.js} +1 -1
  78. package/dist/client/assets/{grid-view-Chlr-V3g.js → grid-view-BKnSWUuB.js} +1 -1
  79. package/dist/client/assets/{home-CpZLe8AA.js → home-DvvANWHB.js} +1 -1
  80. package/dist/client/assets/{index-C4bOwCDG.js → index--tmJoUux.js} +6 -6
  81. package/dist/client/assets/{index-9tcRb7FE.js → index-BMXxQz0A.js} +1 -1
  82. package/dist/client/assets/index-C76QOf8q.js +1 -0
  83. package/dist/client/assets/{index-D5tmQFLM.js → index-CCcWAtA_.js} +27 -27
  84. package/dist/client/assets/{index-C6nYoI1C.css → index-CP_rYaE5.css} +1 -1
  85. package/dist/client/assets/{index-C9OcAHbi.js → index-D12lWWsR.js} +1 -1
  86. package/dist/client/assets/index-D5w8F0R7.js +1 -0
  87. package/dist/client/assets/{index-DtXqymrr.js → index-DFZdUy6e.js} +1 -1
  88. package/dist/client/assets/{index-BN26Duct.js → index-UwBLOz8J.js} +1 -1
  89. package/dist/client/assets/index-sFvIWgLs.js +1 -0
  90. package/dist/client/assets/{infiniteQueryObserver-CraWSqSX.js → infiniteQueryObserver-BdhSYRBe.js} +1 -1
  91. package/dist/client/assets/{input-BPn8NjNN.js → input-Dh6Cjukb.js} +1 -1
  92. package/dist/client/assets/{integration-icon-W7oxbRNq.js → integration-icon-Biu6JpM0.js} +1 -1
  93. package/dist/client/assets/{layout-BJr5Ak4k.js → layout-DWXfRazY.js} +1 -1
  94. package/dist/client/assets/{localstorage-keys-D5oAXPM1.js → localstorage-keys-BWsOCDUX.js} +1 -1
  95. package/dist/client/assets/{login-D4OqmnB6.js → login-DoPkmmdP.js} +1 -1
  96. package/dist/client/assets/{mcp-oauth-CNM1XpIG.js → mcp-oauth-BQMyy4a5.js} +1 -1
  97. package/dist/client/assets/{mcp-server-card-DesKazdH.js → mcp-server-card-DxnHyWDy.js} +1 -1
  98. package/dist/client/assets/{mcp-server-detail-Ys0ijxeQ.js → mcp-server-detail-BzBDrjZ5.js} +2 -2
  99. package/dist/client/assets/members-pjR_l8r-.js +3 -0
  100. package/dist/client/assets/{monaco-editor-CXE6czoW.js → monaco-editor-XyXN2SEV.js} +1 -1
  101. package/dist/client/assets/{monitoring-dsK6d0ku.js → monitoring-BiXkhP0l.js} +1 -1
  102. package/dist/client/assets/{oauth-callback-Cm1jfTrr.js → oauth-callback-COK_3Woz.js} +1 -1
  103. package/dist/client/assets/{page-Csuu4Y_T.js → page-Ca4TsO7U.js} +1 -1
  104. package/dist/client/assets/page-zhioOXqc.js +1 -0
  105. package/dist/client/assets/{plugin-empty-state-DGmTq0Hq.js → plugin-empty-state-BWDzgwMT.js} +1 -1
  106. package/dist/client/assets/{plugin-header-DS1bXx8D.js → plugin-header-Dm-T5OvY.js} +1 -1
  107. package/dist/client/assets/{popover-BnV2Ekkf.js → popover-Bn1QrYWJ.js} +1 -1
  108. package/dist/client/assets/{project-layout-DTHugbyC.js → project-layout-DQQxPJ7M.js} +1 -1
  109. package/dist/client/assets/{project-settings-UiQng0xL.js → project-settings-Bq572DKS.js} +1 -1
  110. package/dist/client/assets/{projects-list-B5fuxwCT.js → projects-list-D2y67tOl.js} +1 -1
  111. package/dist/client/assets/{registry-utils-DRiNpsKU.js → registry-utils-eTnhYK1Z.js} +1 -1
  112. package/dist/client/assets/{resizable-SZr0q_hI.js → resizable-Cth4qfOJ.js} +1 -1
  113. package/dist/client/assets/{select-iLE4SSQV.js → select-CJ01X7RE.js} +1 -1
  114. package/dist/client/assets/{shell-layout-Dvp4ZClm.js → shell-layout-Dmklwlc_.js} +2 -2
  115. package/dist/client/assets/{spinner-RsSCOmvl.js → spinner-CoIaSc2j.js} +1 -1
  116. package/dist/client/assets/{store-invite-DfN36OHe.js → store-invite-CM-bUgIj.js} +1 -1
  117. package/dist/client/assets/{switch-CZLIUnPD.js → switch-TZYuSAHJ.js} +1 -1
  118. package/dist/client/assets/{table-r40t1ij6.js → table-B7Ue2bk2.js} +1 -1
  119. package/dist/client/assets/{tasks-CnTQLuu3.js → tasks-DvdoE4Ok.js} +1 -1
  120. package/dist/client/assets/{textarea-CCeQpN_N.js → textarea-D6y1LKj_.js} +1 -1
  121. package/dist/client/assets/{tools-list-C3NaEQdF.js → tools-list-fxJEZlSp.js} +1 -1
  122. package/dist/client/assets/{typewriter-title-DESUJewE.js → typewriter-title-DR6tdNBL.js} +1 -1
  123. package/dist/client/assets/{use-binding-DMMSXp8M.js → use-binding-ucSDtQ56.js} +1 -1
  124. package/dist/client/assets/{use-connection-BSXprdTB.js → use-connection-BCPygOxC.js} +1 -1
  125. package/dist/client/assets/{use-create-virtual-mcp-Ca9rNRBg.js → use-create-virtual-mcp-u-AAtHmy.js} +1 -1
  126. package/dist/client/assets/use-deco-chat-open-DsNk3kZu.js +23 -0
  127. package/dist/client/assets/{use-install-from-registry-Bo257Imu.js → use-install-from-registry-f8JxKFFW.js} +1 -1
  128. package/dist/client/assets/{use-list-state-oI5CPziH.js → use-list-state-oNgAMbdK.js} +1 -1
  129. package/dist/client/assets/use-llm-Lxpo1ior.js +1 -0
  130. package/dist/client/assets/{use-mcp-prompts-IDdNIVsz.js → use-mcp-prompts-WwyO9-Nk.js} +1 -1
  131. package/dist/client/assets/{use-mcp-tools-1PW8j013.js → use-mcp-tools-eSLltC3i.js} +1 -1
  132. package/dist/client/assets/{use-mobile-Bji8rN8h.js → use-mobile-BUK8Wer1.js} +1 -1
  133. package/dist/client/assets/{use-organization-settings-DGMFFXzb.js → use-organization-settings-BR3GSp3x.js} +1 -1
  134. package/dist/client/assets/{use-project-Cs5eD30p.js → use-project-DLsFLh3O.js} +1 -1
  135. package/dist/client/assets/{use-virtual-mcp-CK08RGTF.js → use-virtual-mcp-ByfXJ3SB.js} +1 -1
  136. package/dist/client/assets/useInfiniteQuery-BcqgMbS1.js +1 -0
  137. package/dist/client/assets/{useMutation-CapnNHWF.js → useMutation-Cn2d2ilG.js} +1 -1
  138. package/dist/client/assets/useQuery-Dp4Sp9Q1.js +1 -0
  139. package/dist/client/assets/utils-CnoQZeDK.js +1 -0
  140. package/dist/client/assets/{view-mode-toggle-CoDook_S.js → view-mode-toggle-BJkt6e92.js} +1 -1
  141. package/dist/client/assets/{workflow-DDUMG-O3.js → workflow-BP45xRRH.js} +1 -1
  142. package/dist/client/index.html +2 -2
  143. package/dist/server/cli.js +167 -167
  144. package/dist/server/migrate.js +106 -106
  145. package/dist/server/server.js +146 -146
  146. package/package.json +1 -1
  147. package/dist/client/assets/agent-detail-DJwQyYDX.js +0 -1
  148. package/dist/client/assets/connection-detail-LtP9Y3ux.js +0 -1
  149. package/dist/client/assets/constants-CaS5DRuf.js +0 -1
  150. package/dist/client/assets/index-Bq-YlXEQ.js +0 -1
  151. package/dist/client/assets/index-C4-4zqx1.js +0 -1
  152. package/dist/client/assets/index-N9GUWdsk.js +0 -1
  153. package/dist/client/assets/members-Dg6HqXRE.js +0 -3
  154. package/dist/client/assets/page-BHnHevI-.js +0 -1
  155. package/dist/client/assets/use-deco-chat-open-C4c4LN3K.js +0 -23
  156. package/dist/client/assets/useInfiniteQuery-23ZWmdg7.js +0 -1
  157. package/dist/client/assets/useQuery-C7wGFtkw.js +0 -1
  158. package/dist/client/assets/utils-63Yxgxyo.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/mesh",
3
- "version": "2.71.0",
3
+ "version": "2.72.0",
4
4
  "description": "MCP Mesh - Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{r as _,j as t,b6 as dt,_ as xe,an as Ne,b5 as mt,av as ut,a_ as ft,am as pt,at as xt,b7 as Ue,aq as ht,c as T,u as he,V as gt,s as bt,t as Oe,m as jt,a as vt,O as He,bs as Nt,k as yt,h as Ct,aN as _t,ai as Tt}from"./index-D5tmQFLM.js";import{i as St,a as wt,b as kt,u as It,C as Et,c as At}from"./use-deco-chat-open-C4c4LN3K.js";import{E as Ot}from"./empty-state-Bu5U3yVT.js";import{E as pe,i as Dt}from"./error-boundary-DRPYIYcG.js";import{I as ge,T as ce,c as ye,b as de,a as me}from"./integration-icon-W7oxbRNq.js";import{I as $t,R as Rt,a as Lt,S as Pt,P as zt}from"./index-C4-4zqx1.js";import{B as De}from"./badge-B4Hap73o.js";import{B as X}from"./button-CIJQcfm2.js";import{I as Me}from"./input-BPn8NjNN.js";import{S as Vt}from"./switch-CZLIUnPD.js";import{T as Mt}from"./textarea-CCeQpN_N.js";import{h as Ft,f as Bt}from"./use-connection-BSXprdTB.js";import{u as Gt,a as Ut}from"./use-virtual-mcp-CK08RGTF.js";import{i as We}from"./ChevronRight-in3TmXpP.js";import{n as Ht}from"./select-iLE4SSQV.js";import{i as $e}from"./File02-DLP0uk3c.js";import{i as Ke}from"./Loading01-CM7djb9Q.js";import{i as Wt}from"./Play-BoQgM5dI.js";import{s as Fe}from"./Plus-BhKqidCj.js";import{i as Kt}from"./Share07-BUD3TbCH.js";import{a as Re}from"./Tool01-CMlMVnUR.js";import{B as qt,a as Jt,b as Be,d as Yt,e as Zt,c as Qt}from"./breadcrumb-CfCt3BHC.js";import{a as Xt,V as es}from"./layout-BJr5Ak4k.js";import{C as ts}from"./collection-search-BhGdJARf.js";import{C as Le}from"./checkbox-C09bNjVn.js";import{e as ss,a as qe,D as Je,b as ls,c as os}from"./dialog-Dn-qFsZM.js";import{c as J}from"./utils-63Yxgxyo.js";import{u as Pe}from"./constants-BQDDq09c.js";import{c as ns}from"./use-mcp-tools-1PW8j013.js";import{c as rs,u as is}from"./use-mcp-prompts-IDdNIVsz.js";import{s as Ye}from"./slugify-CEUa2lfQ.js";import{i as Ze}from"./Check-VEx1ONnd.js";import{i as as}from"./Code01-QyeCluYo.js";import{a as cs}from"./Copy01-JjoULgm7.js";import{i as Ce}from"./InfoCircle-CwNQC8tM.js";import{A as ds}from"./agent-connections-preview-d9Roi18q.js";import"./use-binding-DMMSXp8M.js";import"./binder-BMOA5_jw.js";import"./localstorage-keys-D5oAXPM1.js";import"./useQuery-C7wGFtkw.js";import"./useMutation-CapnNHWF.js";import"./popover-BnV2Ekkf.js";import"./ChevronDown-B9Mxx2fi.js";import"./File06-DCxDcy-i.js";import"./Grid01-DQKfO4pL.js";import"./Image01-CURk6BcD.js";import"./SearchMd-DZNqxRa2.js";import"./index-9tcRb7FE.js";import"./Pin01-D3bkVyHA.js";import"./use-organization-settings-DGMFFXzb.js";import"./index-Bq-YlXEQ.js";import"./X-2IB63Q0x.js";import"./infiniteQueryObserver-CraWSqSX.js";const Qe=({size:o=24,color:e="currentColor",...s})=>_.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},_.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));Qe.displayName="Circle";const Xe=({size:o=24,color:e="currentColor",...s})=>_.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},_.createElement("path",{d:"M9 2v3m6-3v3M9 19v3m6-3v3m4-13h3m-3 5h3M2 9h3m-3 5h3m4.8 5h4.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C19 16.72 19 15.88 19 14.2V9.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C16.72 5 15.88 5 14.2 5H9.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C5 7.28 5 8.12 5 9.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C7.28 19 8.12 19 9.8 19Z"}));Xe.displayName="CpuChip02";const be=({size:o=24,color:e="currentColor",...s})=>_.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},_.createElement("path",{d:"m9.75 20.75 1.473.818c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l1.473-.818m-9-2.5-1.427-.793c-.3-.166-.45-.25-.558-.368a1 1 0 0 1-.215-.364C3 16.573 3 16.401 3 16.06V14.5m0-5V7.942c0-.343 0-.514.05-.667a1 1 0 0 1 .215-.364c.109-.119.258-.202.558-.368L5.25 5.75m4.5-2.5 1.473-.818c.284-.158.425-.237.576-.267a1 1 0 0 1 .402 0c.15.03.292.11.576.267l1.473.818m4.5 2.5 1.427.793c.3.166.45.25.558.368a1 1 0 0 1 .215.364c.05.153.05.324.05.667V9.5m0 5v1.559c0 .342 0 .514-.05.666a.999.999 0 0 1-.215.364c-.109.119-.258.202-.558.368l-1.427.793m-9-7.5L12 12m0 0 2.25-1.25M12 12v2.5M3 7l2.25 1.25m13.5 0L21 7m-9 12.5V22"}));be.displayName="CubeOutline";var je="Tabs",[ms]=ht(je,[Ue]),et=Ue(),[us,ze]=ms(je),tt=_.forwardRef((o,e)=>{const{__scopeTabs:s,value:r,onValueChange:l,defaultValue:n,orientation:c="horizontal",dir:i,activationMode:a="automatic",...m}=o,u=ft(i),[d,f]=pt({prop:r,onChange:l,defaultProp:n??"",caller:je});return t.jsx(us,{scope:s,baseId:xt(),value:d,onValueChange:f,orientation:c,dir:u,activationMode:a,children:t.jsx(xe.div,{dir:u,"data-orientation":c,...m,ref:e})})});tt.displayName=je;var st="TabsList",lt=_.forwardRef((o,e)=>{const{__scopeTabs:s,loop:r=!0,...l}=o,n=ze(st,s),c=et(s);return t.jsx(mt,{asChild:!0,...c,orientation:n.orientation,dir:n.dir,loop:r,children:t.jsx(xe.div,{role:"tablist","aria-orientation":n.orientation,...l,ref:e})})});lt.displayName=st;var ot="TabsTrigger",nt=_.forwardRef((o,e)=>{const{__scopeTabs:s,value:r,disabled:l=!1,...n}=o,c=ze(ot,s),i=et(s),a=at(c.baseId,r),m=ct(c.baseId,r),u=r===c.value;return t.jsx(dt,{asChild:!0,...i,focusable:!l,active:u,children:t.jsx(xe.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:a,...n,ref:e,onMouseDown:Ne(o.onMouseDown,d=>{!l&&d.button===0&&d.ctrlKey===!1?c.onValueChange(r):d.preventDefault()}),onKeyDown:Ne(o.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&c.onValueChange(r)}),onFocus:Ne(o.onFocus,()=>{const d=c.activationMode!=="manual";!u&&!l&&d&&c.onValueChange(r)})})})});nt.displayName=ot;var rt="TabsContent",it=_.forwardRef((o,e)=>{const{__scopeTabs:s,value:r,forceMount:l,children:n,...c}=o,i=ze(rt,s),a=at(i.baseId,r),m=ct(i.baseId,r),u=r===i.value,d=_.useRef(u);return _.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),t.jsx(ut,{present:l||u,children:({present:f})=>t.jsx(xe.div,{"data-state":u?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":a,hidden:!f,id:m,tabIndex:0,...c,ref:e,style:{...o.style,animationDuration:d.current?"0s":void 0},children:f&&n})})});it.displayName=rt;function at(o,e){return`${o}-trigger-${e}`}function ct(o,e){return`${o}-content-${e}`}var fs=tt,ps=lt,xs=nt,hs=it;function gs(o){const e=T.c(10);let s,r,l;e[0]!==o?({className:s,variant:l,...r}=o,e[0]=o,e[1]=s,e[2]=r,e[3]=l):(s=e[1],r=e[2],l=e[3]);const n=l===void 0?"pill":l;let c;e[4]!==s?(c=J("flex flex-col gap-2",s),e[4]=s,e[5]=c):c=e[5];let i;return e[6]!==r||e[7]!==c||e[8]!==n?(i=t.jsx(fs,{"data-slot":"tabs","data-variant":n,className:c,...r}),e[6]=r,e[7]=c,e[8]=n,e[9]=i):i=e[9],i}function bs(o){const e=T.c(11);let s,r,l;e[0]!==o?({className:s,variant:l,...r}=o,e[0]=o,e[1]=s,e[2]=r,e[3]=l):(s=e[1],r=e[2],l=e[3]);const n=l||"pill",c=n==="underline"?"flex h-[52px] items-center border-b border-border":n==="canvas"?"flex h-10 items-center bg-background relative":"bg-muted text-muted-foreground inline-flex h-10 w-fit items-center justify-center rounded-xl p-[3px]";let i;e[4]!==s||e[5]!==c?(i=J(c,s),e[4]=s,e[5]=c,e[6]=i):i=e[6];let a;return e[7]!==n||e[8]!==r||e[9]!==i?(a=t.jsx(ps,{"data-slot":"tabs-list","data-variant":n,className:i,...r}),e[7]=n,e[8]=r,e[9]=i,e[10]=a):a=e[10],a}function _e(o){const e=T.c(11);let s,r,l;e[0]!==o?({className:s,variant:l,...r}=o,e[0]=o,e[1]=s,e[2]=r,e[3]=l):(s=e[1],r=e[2],l=e[3]);const n=l||"pill",c=n==="underline"?"cursor-pointer flex items-center h-full px-3 relative text-sm whitespace-nowrap border-b-2 mb-[-1px] transition-all text-muted-foreground border-transparent hover:text-foreground data-[state=active]:text-foreground data-[state=active]:border-foreground disabled:pointer-events-none disabled:opacity-50":n==="canvas"?"cursor-pointer flex items-center h-full px-3 gap-2.5 text-sm whitespace-nowrap transition-all border-r border-b border-border [&>*]:opacity-50 data-[state=active]:[&>*]:opacity-100 data-[state=active]:border-b-0 last:border-r-0 disabled:pointer-events-none max-w-2xs":"data-[state=active]:bg-background dark:data-[state=active]:text-foreground cursor-pointer focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";let i;e[4]!==s||e[5]!==c?(i=J(c,s),e[4]=s,e[5]=c,e[6]=i):i=e[6];let a;return e[7]!==n||e[8]!==r||e[9]!==i?(a=t.jsx(xs,{"data-slot":"tabs-trigger","data-variant":n,className:i,...r}),e[7]=n,e[8]=r,e[9]=i,e[10]=a):a=e[10],a}function Te(o){const e=T.c(8);let s,r;e[0]!==o?({className:s,...r}=o,e[0]=o,e[1]=s,e[2]=r):(s=e[1],r=e[2]);let l;e[3]!==s?(l=J("flex-1 outline-none h-full",s),e[3]=s,e[4]=l):l=e[4];let n;return e[5]!==r||e[6]!==l?(n=t.jsx(hs,{"data-slot":"tabs-content",className:l,...r}),e[5]=r,e[6]=l,e[7]=n):n=e[7],n}function Se(o){return o===null?"all":o?.length??0}function js(o,e){const s=o[e];if(!s)return"";const r=[];return s.tools===null?r.push("all tools"):s.tools&&s.tools.length>0&&r.push(`${s.tools.length} tools`),s.resources===null?r.push("all resources"):s.resources&&s.resources.length>0&&r.push(`${s.resources.length} resources`),s.prompts===null?r.push("all prompts"):s.prompts&&s.prompts.length>0&&r.push(`${s.prompts.length} prompts`),r.join(", ")}function vs(o,e){const s=o[e];return s?!((s.tools===void 0||s.tools!==null&&s.tools.length===0)&&(s.resources===void 0||s.resources!==null&&s.resources.length===0)&&(s.prompts===void 0||s.prompts!==null&&s.prompts.length===0)):!1}const Ns={tools:null,resources:null,prompts:null};function we(){const o=T.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Ke,{className:"animate-spin text-muted-foreground",size:24})}),o[0]=e):e=o[0],e}function ke(o){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:o})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(Dt,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function ys(o){const e=T.c(18),{item:s,isSelected:r,onToggle:l,disabled:n}=o,c=n?"cursor-not-allowed opacity-50":"cursor-pointer",i=r?"bg-accent/25":"hover:bg-muted/50";let a;e[0]!==c||e[1]!==i?(a=J("flex items-start gap-3 p-4 rounded-lg transition-colors",c,i),e[0]=c,e[1]=i,e[2]=a):a=e[2];let m;e[3]!==s.name?(m=t.jsx("p",{className:"text-sm font-medium leading-none",children:s.name}),e[3]=s.name,e[4]=m):m=e[4];let u;e[5]!==s.description?(u=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[5]=s.description,e[6]=u):u=e[6];let d;e[7]!==m||e[8]!==u?(d=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[m,u]}),e[7]=m,e[8]=u,e[9]=d):d=e[9];let f;e[10]!==n||e[11]!==r||e[12]!==l?(f=t.jsx(Le,{checked:r,onCheckedChange:l,disabled:n,className:"mt-0.5"}),e[10]=n,e[11]=r,e[12]=l,e[13]=f):f=e[13];let h;return e[14]!==a||e[15]!==d||e[16]!==f?(h=t.jsxs("label",{className:a,children:[d,f]}),e[14]=a,e[15]=d,e[16]=f,e[17]=h):h=e[17],h}function Ve(o){const e=T.c(32),{items:s,selections:r,onToggle:l,onToggleAll:n,emptyMessage:c,disabled:i}=o;let a,m,u,d,f;if(e[0]!==i||e[1]!==c||e[2]!==s||e[3]!==l||e[4]!==n||e[5]!==r){f=Symbol.for("react.early_return_sentinel");e:{const p=s.map(Cs);if(s.length===0){let C;e[11]!==c?(C=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:c})}),e[11]=c,e[12]=C):C=e[12],f=C;break e}u="flex flex-col h-full";const N=i?"cursor-not-allowed opacity-50":"cursor-pointer";let j;e[13]!==N?(j=J("flex items-start gap-3 p-4",N),e[13]=N,e[14]=j):j=e[14];let v;e[15]!==s.length?(v=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("span",{className:"text-sm font-medium",children:["Select All (",s.length,")"]})}),e[15]=s.length,e[16]=v):v=e[16];const g=r===null;let y;e[17]!==i||e[18]!==n||e[19]!==g?(y=t.jsx(Le,{checked:g,onCheckedChange:n,disabled:i,className:"mt-0.5"}),e[17]=i,e[18]=n,e[19]=g,e[20]=y):y=e[20],e[21]!==y||e[22]!==j||e[23]!==v?(d=t.jsx("div",{className:"px-4 border-b border-border shrink-0",children:t.jsxs("label",{className:j,children:[v,y]})}),e[21]=y,e[22]=j,e[23]=v,e[24]=d):d=e[24],a="flex-1 overflow-auto px-4 py-3 space-y-1",m=s.map(C=>t.jsx(ys,{item:C,isSelected:r===null||r?.includes(C.id),onToggle:()=>l(C.id,p),disabled:i},C.id))}e[0]=i,e[1]=c,e[2]=s,e[3]=l,e[4]=n,e[5]=r,e[6]=a,e[7]=m,e[8]=u,e[9]=d,e[10]=f}else a=e[6],m=e[7],u=e[8],d=e[9],f=e[10];if(f!==Symbol.for("react.early_return_sentinel"))return f;let h;e[25]!==a||e[26]!==m?(h=t.jsx("div",{className:a,children:m}),e[25]=a,e[26]=m,e[27]=h):h=e[27];let x;return e[28]!==u||e[29]!==d||e[30]!==h?(x=t.jsxs("div",{className:u,children:[d,h]}),e[28]=u,e[29]=d,e[30]=h,e[31]=x):x=e[31],x}function Cs(o){return o.id}function _s(o){const e=T.c(13),{connectionId:s,selections:r,onToggle:l,onToggleAll:n,disabled:c}=o,{org:i}=he();let a;e[0]!==s||e[1]!==i.id?(a={connectionId:s,orgId:i.id},e[0]=s,e[1]=i.id,e[2]=a):a=e[2];const m=Pe(a);let u;e[3]!==m?(u={client:m},e[3]=m,e[4]=u):u=e[4];const{data:d}=ns(u);let f;e[5]!==d.tools?(f=d.tools.map(Ts),e[5]=d.tools,e[6]=f):f=e[6];const h=f;let x;return e[7]!==c||e[8]!==h||e[9]!==l||e[10]!==n||e[11]!==r?(x=t.jsx(Ve,{items:h,selections:r,onToggle:l,onToggleAll:n,emptyMessage:"No tools available",disabled:c}),e[7]=c,e[8]=h,e[9]=l,e[10]=n,e[11]=r,e[12]=x):x=e[12],x}function Ts(o){return{id:o.name,name:o.name,description:o.description}}function Ss(o){const e=T.c(13),{connectionId:s,selections:r,onToggle:l,onToggleAll:n,disabled:c}=o,{org:i}=he();let a;e[0]!==s||e[1]!==i.id?(a={connectionId:s,orgId:i.id},e[0]=s,e[1]=i.id,e[2]=a):a=e[2];const m=Pe(a);let u;e[3]!==m?(u={client:m},e[3]=m,e[4]=u):u=e[4];const{data:d}=rs(u);let f;e[5]!==d.resources?(f=d.resources.map(ws),e[5]=d.resources,e[6]=f):f=e[6];const h=f;let x;return e[7]!==c||e[8]!==h||e[9]!==l||e[10]!==n||e[11]!==r?(x=t.jsx(Ve,{items:h,selections:r,onToggle:l,onToggleAll:n,emptyMessage:"No resources available",disabled:c}),e[7]=c,e[8]=h,e[9]=l,e[10]=n,e[11]=r,e[12]=x):x=e[12],x}function ws(o){return{id:o.name||o.uri,name:o.name||o.uri,description:o.description}}function ks(o){const e=T.c(13),{connectionId:s,selections:r,onToggle:l,onToggleAll:n,disabled:c}=o,{org:i}=he();let a;e[0]!==s||e[1]!==i.id?(a={connectionId:s,orgId:i.id},e[0]=s,e[1]=i.id,e[2]=a):a=e[2];const m=Pe(a);let u;e[3]!==m?(u={client:m},e[3]=m,e[4]=u):u=e[4];const{data:d}=is(u);let f;e[5]!==d.prompts?(f=d.prompts.map(Is),e[5]=d.prompts,e[6]=f):f=e[6];const h=f;let x;return e[7]!==c||e[8]!==h||e[9]!==l||e[10]!==n||e[11]!==r?(x=t.jsx(Ve,{items:h,selections:r,onToggle:l,onToggleAll:n,emptyMessage:"No prompts available",disabled:c}),e[7]=c,e[8]=h,e[9]=l,e[10]=n,e[11]=r,e[12]=x):x=e[12],x}function Is(o){return{id:o.name,name:o.name,description:o.description}}function Es(o){const e=T.c(24),{connection:s,isSelected:r,hasSelections:l,summary:n,onClick:c,onToggleAll:i,disabled:a}=o,m=a?"cursor-not-allowed opacity-50":"cursor-pointer",u=r?"bg-accent":"hover:bg-muted/50";let d;e[0]!==m||e[1]!==u?(d=J("flex items-center gap-2 p-2 h-12 rounded-lg transition-colors",m,u),e[0]=m,e[1]=u,e[2]=d):d=e[2];const f=a?void 0:c;let h;e[3]!==s.icon||e[4]!==s.title?(h=t.jsx(ge,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[3]=s.icon,e[4]=s.title,e[5]=h):h=e[5];let x;e[6]!==s.title?(x=t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[6]=s.title,e[7]=x):x=e[7];let p;e[8]!==l||e[9]!==n?(p=l&&n&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n}),e[8]=l,e[9]=n,e[10]=p):p=e[10];let N;e[11]!==x||e[12]!==p?(N=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[x,p]}),e[11]=x,e[12]=p,e[13]=N):N=e[13];let j;e[14]!==a||e[15]!==l||e[16]!==i?(j=t.jsx(Le,{checked:l,onCheckedChange:i,onClick:As,disabled:a,className:"shrink-0"}),e[14]=a,e[15]=l,e[16]=i,e[17]=j):j=e[17];let v;return e[18]!==d||e[19]!==f||e[20]!==h||e[21]!==N||e[22]!==j?(v=t.jsxs("div",{className:d,onClick:f,children:[h,N,j]}),e[18]=d,e[19]=f,e[20]=h,e[21]=N,e[22]=j,e[23]=v):v=e[23],v}function As(o){return o.stopPropagation()}function Os(o){const e=T.c(22),{allConnections:s,searchTerm:r,selectedId:l,hasSelections:n,getSelectionSummary:c,onConnectionClick:i,onToggleAll:a,disabled:m}=o;let u;e[0]!==s||e[1]!==r?(u=r?s.filter(x=>x.title.toLowerCase().includes(r.toLowerCase())||x.description?.toLowerCase().includes(r.toLowerCase())):s,e[0]=s,e[1]=r,e[2]=u):u=e[2];const d=u;if(d.length===0){const x=r?"No connections found":"No connections available";let p;return e[3]!==x?(p=t.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground p-4",children:x}),e[3]=x,e[4]=p):p=e[4],p}let f;if(e[5]!==m||e[6]!==d||e[7]!==c||e[8]!==n||e[9]!==i||e[10]!==a||e[11]!==l){let x;e[13]!==m||e[14]!==c||e[15]!==n||e[16]!==i||e[17]!==a||e[18]!==l?(x=p=>t.jsx(Es,{connection:p,isSelected:l===p.id,hasSelections:n(p.id),summary:c(p.id),onClick:()=>i(p.id),onToggleAll:()=>a(p.id),disabled:m},p.id),e[13]=m,e[14]=c,e[15]=n,e[16]=i,e[17]=a,e[18]=l,e[19]=x):x=e[19],f=d.map(x),e[5]=m,e[6]=d,e[7]=c,e[8]=n,e[9]=i,e[10]=a,e[11]=l,e[12]=f}else f=e[12];let h;return e[20]!==f?(h=t.jsx("div",{className:"flex flex-col gap-0.5",children:f}),e[20]=f,e[21]=h):h=e[21],h}function Ds(o){const e=T.c(75),{currentConnection:s,activeTab:r,selectedId:l,formData:n,toggleTool:c,toggleResource:i,togglePrompt:a,toggleAllTools:m,toggleAllResources:u,toggleAllPrompts:d,onTabChange:f}=o;let h;e[0]!==s.icon||e[1]!==s.title?(h=t.jsx(ge,{icon:s.icon,name:s.title,size:"md",className:"shrink-0"}),e[0]=s.icon,e[1]=s.title,e[2]=h):h=e[2];let x;e[3]!==s.title?(x=t.jsx("h2",{className:"text-lg font-semibold truncate",children:s.title}),e[3]=s.title,e[4]=x):x=e[4];let p;e[5]!==s.description?(p=s.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s.description}),e[5]=s.description,e[6]=p):p=e[6];let N;e[7]!==x||e[8]!==p?(N=t.jsxs("div",{className:"flex-1 min-w-0",children:[x,p]}),e[7]=x,e[8]=p,e[9]=N):N=e[9];let j;e[10]!==h||e[11]!==N?(j=t.jsx("div",{className:"p-6 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[h,N]})}),e[10]=h,e[11]=N,e[12]=j):j=e[12];let v;e[13]!==f?(v=F=>f(F),e[13]=f,e[14]=v):v=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsxs(_e,{value:"tools",variant:"underline",className:"gap-2",children:[t.jsx(Re,{size:16}),"Tools"]}),e[15]=g):g=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs(_e,{value:"resources",variant:"underline",className:"gap-2",children:[t.jsx(be,{size:16}),"Resources"]}),e[16]=y):y=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(bs,{variant:"underline",className:"shrink-0 px-6",children:[g,y,t.jsxs(_e,{value:"prompts",variant:"underline",className:"gap-2",children:[t.jsx($e,{size:16}),"Prompts"]})]}),e[17]=C):C=e[17];let z;e[18]===Symbol.for("react.memo_cache_sentinel")?(z=ke("Tools not supported by this server"),e[18]=z):z=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(we,{}),e[19]=w):w=e[19];let O;e[20]!==n||e[21]!==l?(O=n[l]?n[l].tools:[],e[20]=n,e[21]=l,e[22]=O):O=e[22];let S;e[23]!==l||e[24]!==c?(S=(F,Z)=>c(l,F,Z),e[23]=l,e[24]=c,e[25]=S):S=e[25];let k;e[26]!==l||e[27]!==m?(k=()=>m(l),e[26]=l,e[27]=m,e[28]=k):k=e[28];let E;e[29]!==l||e[30]!==O||e[31]!==S||e[32]!==k?(E=t.jsx(Te,{value:"tools",className:"flex-1 overflow-hidden mt-0",children:t.jsx(pe,{fallback:z,children:t.jsx(_.Suspense,{fallback:w,children:t.jsx(_s,{connectionId:l,selections:O,onToggle:S,onToggleAll:k})})})}),e[29]=l,e[30]=O,e[31]=S,e[32]=k,e[33]=E):E=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=ke("Resources not supported by this server"),e[34]=D):D=e[34];let L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx(we,{}),e[35]=L):L=e[35];let I;e[36]!==n||e[37]!==l?(I=n[l]?n[l].resources:[],e[36]=n,e[37]=l,e[38]=I):I=e[38];let A;e[39]!==l||e[40]!==i?(A=(F,Z)=>i(l,F,Z),e[39]=l,e[40]=i,e[41]=A):A=e[41];let $;e[42]!==l||e[43]!==u?($=()=>u(l),e[42]=l,e[43]=u,e[44]=$):$=e[44];let P;e[45]!==l||e[46]!==I||e[47]!==A||e[48]!==$?(P=t.jsx(Te,{value:"resources",className:"flex-1 overflow-hidden mt-0",children:t.jsx(pe,{fallback:D,children:t.jsx(_.Suspense,{fallback:L,children:t.jsx(Ss,{connectionId:l,selections:I,onToggle:A,onToggleAll:$})})})}),e[45]=l,e[46]=I,e[47]=A,e[48]=$,e[49]=P):P=e[49];let q;e[50]===Symbol.for("react.memo_cache_sentinel")?(q=ke("Prompts not supported by this server"),e[50]=q):q=e[50];let Y;e[51]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx(we,{}),e[51]=Y):Y=e[51];let B;e[52]!==n||e[53]!==l?(B=n[l]?n[l].prompts:[],e[52]=n,e[53]=l,e[54]=B):B=e[54];let W;e[55]!==l||e[56]!==a?(W=(F,Z)=>a(l,F,Z),e[55]=l,e[56]=a,e[57]=W):W=e[57];let G;e[58]!==l||e[59]!==d?(G=()=>d(l),e[58]=l,e[59]=d,e[60]=G):G=e[60];let K;e[61]!==l||e[62]!==B||e[63]!==W||e[64]!==G?(K=t.jsx(Te,{value:"prompts",className:"flex-1 overflow-hidden mt-0",children:t.jsx(pe,{fallback:q,children:t.jsx(_.Suspense,{fallback:Y,children:t.jsx(ks,{connectionId:l,selections:B,onToggle:W,onToggleAll:G})})})}),e[61]=l,e[62]=B,e[63]=W,e[64]=G,e[65]=K):K=e[65];let U;e[66]!==r||e[67]!==E||e[68]!==P||e[69]!==K||e[70]!==v?(U=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:t.jsxs(gs,{value:r,onValueChange:v,variant:"underline",className:"flex-1 flex flex-col overflow-hidden",children:[C,E,P,K]})}),e[66]=r,e[67]=E,e[68]=P,e[69]=K,e[70]=v,e[71]=U):U=e[71];let H;return e[72]!==U||e[73]!==j?(H=t.jsxs(t.Fragment,{children:[j,U]}),e[72]=U,e[73]=j,e[74]=H):H=e[74],H}function $s(o){const e={};for(const s of o)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function Ie(o){return Object.entries(o).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function Rs(o,e){switch(e.type){case"SET_SEARCH_TERM":return{...o,searchTerm:e.payload};case"SET_SELECTED":return{...o,selectedId:e.payload};case"SET_ACTIVE_TAB":return{...o,activeTab:e.payload};case"RESET":return{searchTerm:"",selectedId:e.payload.selectedId??e.payload.firstConnectionId??null,activeTab:"tools"};case"SELECT_CONNECTION":return{...o,selectedId:e.payload,activeTab:"tools"};default:return o}}const Ge=(o,e)=>o.find(s=>s.id===e)??o[0];function Ls(o){const e=T.c(79),{open:s,onOpenChange:r,selectedId:l,form:n,connections:c}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];const a=Ft(i);let m;e[1]!==a||e[2]!==l?(m=Ge(a,l)?.id??null,e[1]=a,e[2]=l,e[3]=m):m=e[3];let u;e[4]!==m?(u={activeTab:"tools",searchTerm:"",selectedId:m},e[4]=m,e[5]=u):u=e[5];const[d,f]=_.useReducer(Rs,u);let h;e[6]!==c?(h=c??[],e[6]=c,e[7]=h):h=e[7];let x;e[8]!==h?(x=$s(h),e[8]=h,e[9]=x):x=e[9];const p=x;let N;e[10]!==a||e[11]!==d.selectedId?(N=Ge(a,d.selectedId),e[10]=a,e[11]=d.selectedId,e[12]=N):N=e[12];const j=N;let v;e[13]!==p?(v=b=>vs(p,b),e[13]=p,e[14]=v):v=e[14];const g=v;let y;e[15]!==p?(y=b=>js(p,b),e[15]=p,e[16]=y):y=e[16];const C=y;let z;e[17]!==n||e[18]!==p?(z=(b,R,V,Q)=>{const ie=p[b]?.[R];let M;ie===null?M=Q.filter(ve=>ve!==V):ie?.includes(V)?M=ie.filter(ve=>ve!==V):(M=[...ie??[],V],M.length===Q.length&&(M=null));const ae={...p};ae[b]?ae[b]={...ae[b]}:ae[b]={tools:null,resources:null,prompts:null},ae[b][R]=M,n.setValue("connections",Ie(ae),{shouldDirty:!0,shouldTouch:!0})},e[17]=n,e[18]=p,e[19]=z):z=e[19];const w=z;let O;e[20]!==n||e[21]!==p?(O=(b,R)=>{const ie=p[b]?.[R]===null?[]:null,M={...p};M[b]?M[b]={...M[b]}:M[b]={tools:null,resources:null,prompts:null},M[b][R]=ie,n.setValue("connections",Ie(M),{shouldDirty:!0,shouldTouch:!0})},e[20]=n,e[21]=p,e[22]=O):O=e[22];const S=O;let k;e[23]!==w?(k=(b,R,V)=>w(b,"tools",R,V),e[23]=w,e[24]=k):k=e[24];const E=k;let D;e[25]!==w?(D=(b,R,V)=>w(b,"resources",R,V),e[25]=w,e[26]=D):D=e[26];const L=D;let I;e[27]!==w?(I=(b,R,V)=>w(b,"prompts",R,V),e[27]=w,e[28]=I):I=e[28];const A=I;let $;e[29]!==S?($=b=>S(b,"tools"),e[29]=S,e[30]=$):$=e[30];const P=$;let q;e[31]!==S?(q=b=>S(b,"resources"),e[31]=S,e[32]=q):q=e[32];const Y=q;let B;e[33]!==S?(B=b=>S(b,"prompts"),e[33]=S,e[34]=B):B=e[34];const W=B;let G;e[35]!==n||e[36]!==p?(G=b=>{const R=p[b],V=R&&R.tools===null&&R.resources===null&&R.prompts===null,Q={...p};V?delete Q[b]:Q[b]=Ns,n.setValue("connections",Ie(Q),{shouldDirty:!0,shouldTouch:!0})},e[35]=n,e[36]=p,e[37]=G):G=e[37];const K=G;let U;e[38]!==a||e[39]!==r||e[40]!==l?(U=b=>{b&&f({type:"RESET",payload:{selectedId:l,firstConnectionId:a[0]?.id??null}}),r(b)},e[38]=a,e[39]=r,e[40]=l,e[41]=U):U=e[41];const H=U;let F;e[42]===Symbol.for("react.memo_cache_sentinel")?(F=b=>{f({type:"SELECT_CONNECTION",payload:b})},e[42]=F):F=e[42];const Z=F;let ue;e[43]===Symbol.for("react.memo_cache_sentinel")?(ue=b=>f({type:"SET_SEARCH_TERM",payload:b}),e[43]=ue):ue=e[43];let ee;e[44]!==d.searchTerm?(ee=t.jsx(ts,{value:d.searchTerm,onChange:ue,placeholder:"Search connections..."}),e[44]=d.searchTerm,e[45]=ee):ee=e[45];let te;e[46]!==a||e[47]!==d.searchTerm||e[48]!==d.selectedId||e[49]!==C||e[50]!==g||e[51]!==K?(te=t.jsx("div",{className:"flex-1 overflow-auto p-2",children:t.jsx(Os,{allConnections:a,searchTerm:d.searchTerm,selectedId:d.selectedId,hasSelections:g,getSelectionSummary:C,onConnectionClick:Z,onToggleAll:K})}),e[46]=a,e[47]=d.searchTerm,e[48]=d.selectedId,e[49]=C,e[50]=g,e[51]=K,e[52]=te):te=e[52];let se;e[53]!==ee||e[54]!==te?(se=t.jsxs("div",{className:"w-full sm:w-72 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:[ee,te]}),e[53]=ee,e[54]=te,e[55]=se):se=e[55];let le;e[56]!==j||e[57]!==d.activeTab||e[58]!==d.selectedId||e[59]!==p||e[60]!==W||e[61]!==Y||e[62]!==P||e[63]!==A||e[64]!==L||e[65]!==E?(le=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:j&&d.selectedId?t.jsx(Ds,{currentConnection:j,activeTab:d.activeTab,selectedId:d.selectedId,formData:p,toggleTool:E,toggleResource:L,togglePrompt:A,toggleAllTools:P,toggleAllResources:Y,toggleAllPrompts:W,onTabChange:b=>f({type:"SET_ACTIVE_TAB",payload:b})},d.selectedId):t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Select a connection to view its tools, resources, and prompts"})}),e[56]=j,e[57]=d.activeTab,e[58]=d.selectedId,e[59]=p,e[60]=W,e[61]=Y,e[62]=P,e[63]=A,e[64]=L,e[65]=E,e[66]=le):le=e[66];let oe;e[67]!==se||e[68]!==le?(oe=t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[se,le]}),e[67]=se,e[68]=le,e[69]=oe):oe=e[69];let ne;e[70]!==H?(ne=t.jsx(ss,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(X,{variant:"outline",onClick:()=>H(!1),children:"Done"})}),e[70]=H,e[71]=ne):ne=e[71];let re;e[72]!==oe||e[73]!==ne?(re=t.jsxs(qe,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[oe,ne]}),e[72]=oe,e[73]=ne,e[74]=re):re=e[74];let fe;return e[75]!==H||e[76]!==s||e[77]!==re?(fe=t.jsx(Je,{open:s,onOpenChange:H,children:re}),e[75]=H,e[76]=s,e[77]=re,e[78]=fe):fe=e[78],fe}const Ps=gt.pick({title:!0,description:!0,status:!0,metadata:!0,connections:!0}).extend({title:bt().min(1,"Name is required").max(255)});function zs(o){const e=T.c(8);let s,r;e[0]!==o?({className:s,...r}=o,e[0]=o,e[1]=s,e[2]=r):(s=e[1],r=e[2]);let l;e[3]!==s?(l=J("grid gap-3",s),e[3]=s,e[4]=l):l=e[4];let n;return e[5]!==r||e[6]!==l?(n=t.jsx(Rt,{"data-slot":"radio-group",className:l,...r}),e[5]=r,e[6]=l,e[7]=n):n=e[7],n}function Ee(o){const e=T.c(9);let s,r;e[0]!==o?({className:s,...r}=o,e[0]=o,e[1]=s,e[2]=r):(s=e[1],r=e[2]);let l;e[3]!==s?(l=J("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=l):l=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Lt,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(Qe,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=n):n=e[5];let c;return e[6]!==r||e[7]!==l?(c=t.jsx($t,{"data-slot":"radio-group-item",className:l,...r,children:n}),e[6]=r,e[7]=l,e[8]=c):c=e[8],c}function Vs(o){const s=new TextEncoder().encode(o),r=Array.from(s,l=>String.fromCharCode(l)).join("");return btoa(r)}function Ms(o){const e=T.c(10),{url:s}=o,[r,l]=_.useState(!1);let n;e[0]!==s?(n=async()=>{await navigator.clipboard.writeText(s),l(!0),Oe.success("Agent URL copied to clipboard"),setTimeout(()=>l(!1),2e3)},e[0]=s,e[1]=n):n=e[1];const c=n;let i;e[2]!==r?(i=r?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(cs,{size:20}),e[2]=r,e[3]=i):i=e[3];const a=r?"Copied!":"Copy URL";let m;e[4]!==a?(m=t.jsx("span",{className:"text-xs font-medium",children:a}),e[4]=a,e[5]=m):m=e[5];let u;return e[6]!==c||e[7]!==i||e[8]!==m?(u=t.jsxs(X,{type:"button",variant:"outline",onClick:c,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[i,m]}),e[6]=c,e[7]=i,e[8]=m,e[9]=u):u=e[9],u}function Fs(o){const e=T.c(7),{url:s,serverName:r}=o;let l;e[0]!==r||e[1]!==s?(l=()=>{const m=Ye(r),d=Vs(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),f=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(m)}&config=${encodeURIComponent(d)}`;window.open(f,"_blank"),Oe.success("Opening Cursor...")},e[0]=r,e[1]=s,e[2]=l):l=e[2];const n=l;let c,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),i=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=c,e[4]=i):(c=e[3],i=e[4]);let a;return e[5]!==n?(a=t.jsxs(X,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,i]}),e[5]=n,e[6]=a):a=e[6],a}function Bs(o){const e=T.c(11),{url:s,serverName:r}=o,[l,n]=_.useState(!1);let c;e[0]!==r||e[1]!==s?(c=async()=>{const f=Ye(r),x=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),p=`claude mcp add-json "${f}" '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(p),n(!0),Oe.success("Claude Code command copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=r,e[1]=s,e[2]=c):c=e[2];const i=c;let a;e[3]!==l?(a=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=l,e[4]=a):a=e[4];const m=l?"Copied!":"Install on Claude";let u;e[5]!==m?(u=t.jsx("span",{className:"text-xs font-medium",children:m}),e[5]=m,e[6]=u):u=e[6];let d;return e[7]!==i||e[8]!==a||e[9]!==u?(d=t.jsxs(X,{type:"button",variant:"outline",onClick:i,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,u]}),e[7]=i,e[8]=a,e[9]=u,e[10]=d):d=e[10],d}function Gs(o){const e=T.c(40),{open:s,onOpenChange:r,virtualMcp:l}=o,[n,c]=_.useState("code_execution");let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=P=>{(P==="passthrough"||P==="smart_tool_selection"||P==="code_execution")&&c(P)},e[0]=i):i=e[0];const a=i;let m;e[1]!==n||e[2]!==l.id?(m=new URL(`/mcp/virtual-mcp/${l.id}`,window.location.origin),m.searchParams.set("mode",n),e[1]=n,e[2]=l.id,e[3]=m):m=e[3];let u;e[4]!==l.id||e[5]!==l.title?(u=l.title||`agent-${l.id?.slice(0,8)??"default"}`,e[4]=l.id,e[5]=l.title,e[6]=u):u=e[6];const d=u;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ls,{children:t.jsx(os,{children:"Share Agent"})}),e[7]=f):f=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=h):h=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(St,{className:"size-5 text-muted-foreground"})}),e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=p):p=e[10];let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(ce,{asChild:!0,children:t.jsx(Ce,{className:"size-3.5 text-muted-foreground"})}),e[11]=N):N=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[x,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[p,t.jsx(ye,{children:t.jsxs(de,{children:[N,t.jsx(me,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Ee,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(wt,{className:"size-5 text-muted-foreground"})}),e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=g):g=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(ce,{asChild:!0,children:t.jsx(Ce,{className:"size-3.5 text-muted-foreground"})}),e[15]=y):y=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[v,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[g,t.jsx(ye,{children:t.jsxs(de,{children:[y,t.jsx(me,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Ee,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=C):C=e[16];let z;e[17]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(as,{className:"size-5 text-muted-foreground"})}),e[17]=z):z=e[17];let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=w):w=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(ce,{asChild:!0,children:t.jsx(Ce,{className:"size-3.5 text-muted-foreground"})}),e[19]=O):O=e[19];let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[z,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[w,t.jsx(ye,{children:t.jsxs(de,{children:[O,t.jsx(me,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Ee,{id:"mode-code",value:"code_execution"}),t.jsx(De,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=S):S=e[20];let k;e[21]!==n?(k=t.jsxs("div",{className:"flex flex-col gap-3",children:[h,t.jsxs(zs,{value:n,onValueChange:a,className:"flex flex-col gap-4.5",children:[j,C,S]})]}),e[21]=n,e[22]=k):k=e[22];let E;e[23]!==m.href?(E=t.jsx(Ms,{url:m.href}),e[23]=m.href,e[24]=E):E=e[24];let D,L;e[25]!==d||e[26]!==m.href?(D=t.jsx(Fs,{url:m.href,serverName:d}),L=t.jsx(Bs,{url:m.href,serverName:d}),e[25]=d,e[26]=m.href,e[27]=D,e[28]=L):(D=e[27],L=e[28]);let I;e[29]!==E||e[30]!==D||e[31]!==L?(I=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[E,D,L]})}),e[29]=E,e[30]=D,e[31]=L,e[32]=I):I=e[32];let A;e[33]!==k||e[34]!==I?(A=t.jsxs(qe,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[f,t.jsxs("div",{className:"flex flex-col gap-6",children:[k,I]})]}),e[33]=k,e[34]=I,e[35]=A):A=e[35];let $;return e[36]!==r||e[37]!==s||e[38]!==A?($=t.jsx(Je,{open:s,onOpenChange:r,children:A}),e[36]=r,e[37]=s,e[38]=A,e[39]=$):$=e[39],$}function Us(o,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...o,shareDialogOpen:e.payload};case"SET_CONNECTION_DIALOG_OPEN":return{...o,connectionDialogOpen:e.payload};case"SET_EDITING_CONNECTION_ID":return{...o,editingConnectionId:e.payload};case"SET_SKILLS_OPEN":return{...o,skillsOpen:e.payload};default:return o}}function Ae(o){const e=T.c(27),{connection_id:s,selected_tools:r,selected_resources:l,selected_prompts:n,onClick:c}=o,i=Bt(s);if(!i)return null;let a;e[0]!==r?(a=Se(r),e[0]=r,e[1]=a):a=e[1];const m=a;let u;e[2]!==l?(u=Se(l),e[2]=l,e[3]=u):u=e[3];const d=u;let f;e[4]!==n?(f=Se(n),e[4]=n,e[5]=f):f=e[5];const h=f;let x;e[6]!==i.icon||e[7]!==i.title?(x=t.jsx(ge,{icon:i.icon,name:i.title,size:"xs"}),e[6]=i.icon,e[7]=i.title,e[8]=x):x=e[8];let p;e[9]!==i.title?(p=t.jsx("p",{className:"flex-1 text-sm font-normal text-foreground truncate",children:i.title}),e[9]=i.title,e[10]=p):p=e[10];let N;e[11]!==m?(N=m!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:m==="all"?"all":m}),t.jsx(Re,{size:12})]}),e[11]=m,e[12]=N):N=e[12];let j;e[13]!==d?(j=d!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:d==="all"?"all":d}),t.jsx(be,{size:12})]}),e[13]=d,e[14]=j):j=e[14];let v;e[15]!==h?(v=h!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:h==="all"?"all":h}),t.jsx($e,{size:12})]}),e[15]=h,e[16]=v):v=e[16];let g;e[17]!==N||e[18]!==j||e[19]!==v?(g=t.jsxs(De,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[N,j,v]}),e[17]=N,e[18]=j,e[19]=v,e[20]=g):g=e[20];let y;e[21]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(We,{size:16,className:"text-muted-foreground shrink-0"}),e[21]=y):y=e[21];let C;return e[22]!==c||e[23]!==x||e[24]!==p||e[25]!==g?(C=t.jsxs("div",{onClick:c,className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border hover:bg-accent/50 transition-colors cursor-pointer",children:[x,p,g,y]}),e[22]=c,e[23]=x,e[24]=p,e[25]=g,e[26]=C):C=e[26],C}Ae.Fallback=function(){return t.jsxs("div",{className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border",children:[t.jsx("div",{className:"size-5 rounded bg-muted animate-pulse shrink-0"}),t.jsx("div",{className:"flex-1 h-4 rounded bg-muted animate-pulse"}),t.jsxs(De,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(Re,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(be,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx($e,{size:12})]})]}),t.jsx(We,{size:16,className:"text-muted-foreground shrink-0"})]})};function Hs({virtualMcp:o}){const{org:e}=he(),r=Nt().location.href,l=Ut(),n=yt({resolver:Ct(Ps),defaultValues:o}),c=n.watch("connections"),[i,a]=_.useReducer(Us,{shareDialogOpen:!1,connectionDialogOpen:!1,editingConnectionId:null,skillsOpen:!1}),[,m]=kt(),{setVirtualMcpId:u}=It();_.useEffect(()=>{m(!0),u(o.id)},[o.id]);const d=()=>{u(o.id),m(!0)},f=n.formState.isDirty,h=async()=>{const g=n.getValues(),y=await l.update.mutateAsync({id:o.id,data:g});n.reset(y)},x=()=>{n.reset(o)},p=()=>{a({type:"SET_EDITING_CONNECTION_ID",payload:null}),a({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},N=g=>{a({type:"SET_EDITING_CONNECTION_ID",payload:g}),a({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},j=l.update.isPending,v=t.jsx(qt,{children:t.jsxs(Jt,{children:[t.jsx(Be,{children:t.jsx(Yt,{asChild:!0,children:t.jsx(_t,{to:"/$org/$project/agents",params:{org:e.slug,project:He},children:"Agents"})})}),t.jsx(Zt,{}),t.jsx(Be,{children:t.jsx(Qt,{children:o.title})})]})});return t.jsxs(Xt,{breadcrumb:v,children:[t.jsxs(es,{children:[t.jsx(Pt,{onSave:h,onUndo:x,isDirty:f,isSaving:j}),t.jsxs(de,{delayDuration:0,children:[t.jsx(ce,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsxs(X,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 border border-input",onClick:d,"aria-label":"Test Agent",children:[t.jsx(Wt,{size:14}),"Test Agent"]})})}),t.jsx(me,{side:"bottom",children:"Test this agent in chat"})]}),t.jsxs(de,{delayDuration:0,children:[t.jsx(ce,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(X,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:()=>a({type:"SET_SHARE_DIALOG_OPEN",payload:!0}),"aria-label":"Share",children:t.jsx(Kt,{size:14})})})}),t.jsx(me,{side:"bottom",children:"Share"})]}),t.jsx(zt,{title:o.title,url:r,icon:o.icon??"cpu_chip"})]}),t.jsx("div",{className:"flex h-full w-full bg-background overflow-auto",children:t.jsxs("div",{className:"flex flex-col w-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 p-6 shrink-0",children:[t.jsxs("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[t.jsx(ge,{icon:o.icon,name:n.watch("title")||"Agent",size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(Xe,{})}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsx(Me,{...n.register("title"),className:"h-auto py-0.5 text-lg! font-medium leading-7 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Agent Name"}),t.jsx(Me,{...n.register("description"),className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})]})]}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Vt,{checked:n.watch("status")==="active",onCheckedChange:g=>n.setValue("status",g?"active":"inactive",{shouldDirty:!0})})})]}),t.jsxs(Et,{open:i.skillsOpen,onOpenChange:g=>a({type:"SET_SKILLS_OPEN",payload:g}),className:"border-t border-border shrink-0 max-h-[400px] overflow-hidden flex flex-col",children:[c.length===0?t.jsxs("button",{type:"button",onClick:p,className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"h-7 px-2 inline-flex items-center justify-center gap-1 rounded-md text-sm text-muted-foreground",children:[t.jsx(Fe,{size:14}),"Add"]})]}):t.jsx(At,{asChild:!0,children:t.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"ease-(--ease-out-expo)",style:{width:i.skillsOpen?0:"auto",marginRight:i.skillsOpen?0:4,opacity:i.skillsOpen?0:1,pointerEvents:i.skillsOpen?"none":"auto",transitionProperty:"all",transitionDuration:i.skillsOpen?"0ms":"200ms"},children:t.jsx(ds,{connectionIds:c.map(g=>g.connection_id),maxVisibleIcons:2})}),t.jsxs("div",{role:"button",tabIndex:0,className:"h-7 inline-flex items-center justify-center rounded-md text-sm text-muted-foreground overflow-hidden transition-all duration-200 ease-(--ease-out-expo) hover:bg-accent hover:text-accent-foreground",style:{width:i.skillsOpen?"auto":28,paddingLeft:i.skillsOpen?8:0,paddingRight:i.skillsOpen?8:0,gap:i.skillsOpen?4:0},onPointerDown:g=>{g.stopPropagation()},onClick:g=>{g.stopPropagation(),g.preventDefault(),p()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),g.preventDefault(),p())},children:[t.jsx(Fe,{size:14,className:"shrink-0"}),t.jsx("span",{className:"overflow-hidden whitespace-nowrap transition-all duration-200 ease-(--ease-out-expo)",style:{width:i.skillsOpen?"auto":0,opacity:i.skillsOpen?1:0},children:"Add"})]}),t.jsx("div",{className:"h-7 inline-flex items-center justify-center overflow-hidden transition-all duration-200 ease-(--ease-out-expo)",style:{width:i.skillsOpen?28:0,opacity:i.skillsOpen?1:0},children:t.jsx(Ht,{size:16,className:"shrink-0"})})]})]})}),t.jsx("div",{className:"grid overflow-hidden transition-[grid-template-rows] duration-200 ease-(--ease-out-expo)",style:{gridTemplateRows:i.skillsOpen?"1fr":"0fr"},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsx("div",{className:"overflow-y-auto max-h-[300px] mask-[linear-gradient(to_bottom,black_calc(100%-40px),transparent_100%)]",children:t.jsx("div",{className:"flex flex-col gap-2 px-6 pb-4 pt-2",children:c.map(g=>t.jsx(_.Suspense,{fallback:t.jsx(Ae.Fallback,{}),children:t.jsx(Ae,{connection_id:g.connection_id,selected_tools:g.selected_tools,selected_resources:g.selected_resources,selected_prompts:g.selected_prompts,onClick:()=>N(g.connection_id)})},g.connection_id))})})})})]}),t.jsxs("div",{className:"flex flex-col flex-1 p-6 border-t border-border overflow-auto",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Instructions"}),t.jsx(Tt,{name:"metadata.instructions",control:n.control,render:({field:g})=>t.jsx(Mt,{...g,value:g.value??"",placeholder:"Write instructions here...",className:"min-h-[200px] resize-none text-sm placeholder:text-muted-foreground/50 leading-relaxed border-0 rounded-none shadow-none px-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-0 bg-transparent"})})]})]})}),t.jsx(Ls,{open:i.connectionDialogOpen,onOpenChange:g=>a({type:"SET_CONNECTION_DIALOG_OPEN",payload:g}),selectedId:i.editingConnectionId,form:n,connections:c}),t.jsx(Gs,{open:i.shareDialogOpen,onOpenChange:g=>a({type:"SET_SHARE_DIALOG_OPEN",payload:g}),virtualMcp:o})]})}function Ws(){const o=T.c(6),e=jt();let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/agents/$agentId"},o[0]=s):s=o[0];const r=vt(s),{org:l,agentId:n}=r,c=Gt(n);if(!c){let a;return o[1]!==e||o[2]!==l?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ot,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(X,{variant:"outline",onClick:()=>e({to:"/$org/$project/agents",params:{org:l,project:He}}),children:"Back to agents"})})}),o[1]=e,o[2]=l,o[3]=a):a=o[3],a}let i;return o[4]!==c?(i=t.jsx(Hs,{virtualMcp:c}),o[4]=c,o[5]=i):i=o[5],i}function Wl(){const o=T.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(pe,{children:t.jsx(_.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ke,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ws,{})})}),o[0]=e):e=o[0],e}export{Wl as default};
@@ -1 +0,0 @@
1
- import{r as q,c as W,j as t,m as Re,O as Se,aN as ct,u as at,bt as Ge,ad as Nt,p as yt,bs as ze,o as lt,b9 as _t,bh as Ct,s as K,ae as Je,af as St,a as wt,f as Tt,v as kt,h as Pt,k as It,i as $t,t as Ce,K as Ye}from"./index-D5tmQFLM.js";import{E as ye}from"./empty-state-Bu5U3yVT.js";import{E as dt}from"./error-boundary-DRPYIYcG.js";import{E as At,r as Vt,e as mt}from"./env-vars-editor-C889wc3R.js";import{P as We,S as Mt}from"./index-C4-4zqx1.js";import{b as Dt,a as Ot}from"./use-binding-DMMSXp8M.js";import{u as Et,S as Rt}from"./index-C4bOwCDG.js";import{f as Xe,g as ut}from"./use-connection-BSXprdTB.js";import{u as Lt}from"./constants-BQDDq09c.js";import{d as Ut}from"./use-mcp-tools-1PW8j013.js";import{b as Ft,d as Bt}from"./use-mcp-prompts-IDdNIVsz.js";import{a as zt}from"./mcp-oauth-CNM1XpIG.js";import{b as Ze,c as Wt,d as Xt,e as Kt,B as qt,a as Ht}from"./breadcrumb-CfCt3BHC.js";import{B as Fe}from"./button-CIJQcfm2.js";import{C as Qt}from"./collection-tabs-mdXwReEh.js";import{i as Ee}from"./Loading01-CM7djb9Q.js";import{V as Ke,a as Gt}from"./layout-BJr5Ak4k.js";import{C as Jt}from"./collection-tab-D7lvZwh_.js";import{I as qe,n as Yt}from"./integration-icon-W7oxbRNq.js";import{B as Be}from"./badge-B4Hap73o.js";import{D as Zt,a as es,b as ts,c as et}from"./dropdown-menu-CFkIMuHp.js";import{F as J,a as ss,b as Y,d as H,f as Z,c as te,e as ns}from"./form-CfZFG_36.js";import{I as ee}from"./input-BPn8NjNN.js";import{S as tt,a as st,b as nt,c as ot,d as G}from"./select-iLE4SSQV.js";import{i as pt}from"./CheckCircle-hgwi-82I.js";import{t as os}from"./ChevronDown-B9Mxx2fi.js";import{s as Oe}from"./Globe02-BWyDEbcv.js";import{i as rs}from"./Terminal-CI6nX2Ah.js";import{s as is}from"./Trash01-SLyaMDks.js";import{t as He}from"./Users03-Chku9Yx2.js";import{s as cs}from"./XClose-DSG07tz8.js";import{U as as}from"./use-list-state-oI5CPziH.js";import{b as ls,a as ds}from"./use-virtual-mcp-CK08RGTF.js";import{i as ms}from"./ChevronRight-in3TmXpP.js";import{s as us}from"./Plus-BhKqidCj.js";import{f as ps}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as ft,C as xt}from"./collection-table-wrapper-BXL-ZhOo.js";import{C as ht}from"./collection-search-BhGdJARf.js";import{C as gt}from"./card-v4WZxiU8.js";import{R as fs,T as xs}from"./tools-list-C3NaEQdF.js";import"./utils-63Yxgxyo.js";import"./Pin01-D3bkVyHA.js";import"./use-organization-settings-DGMFFXzb.js";import"./useMutation-CapnNHWF.js";import"./binder-BMOA5_jw.js";import"./File06-DCxDcy-i.js";import"./index-N9GUWdsk.js";import"./constants-CaS5DRuf.js";import"./registry-utils-DRiNpsKU.js";import"./extract-connection-data-5ZTgwgJP.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-Bo257Imu.js";import"./index-C9OcAHbi.js";import"./circle-alert-DuIKlbT4.js";import"./index-BN26Duct.js";import"./X-2IB63Q0x.js";import"./use-deco-chat-open-C4c4LN3K.js";import"./Code01-QyeCluYo.js";import"./infiniteQueryObserver-CraWSqSX.js";import"./localstorage-keys-D5oAXPM1.js";import"./useQuery-C7wGFtkw.js";import"./popover-BnV2Ekkf.js";import"./Grid01-DQKfO4pL.js";import"./Image01-CURk6BcD.js";import"./SearchMd-DZNqxRa2.js";import"./spinner-RsSCOmvl.js";import"./dialog-Dn-qFsZM.js";import"./AlertCircle-B2r4RYCl.js";import"./ArrowUp-DL3E-1B5.js";import"./Edit01-DUGutI3c.js";import"./Check-VEx1ONnd.js";import"./Copy01-JjoULgm7.js";import"./monaco-editor-CXE6czoW.js";import"./use-create-virtual-mcp-Ca9rNRBg.js";import"./index-Bq-YlXEQ.js";import"./DotsVertical-DjjH7_Y2.js";import"./empty-state-DfPGxaKS.js";import"./Inbox01-BzO-o9k3.js";import"./alert-dialog-BmBtcfYg.js";import"./index-9tcRb7FE.js";import"./avatar-ydfTe0xi.js";import"./use-mobile-Bji8rN8h.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./List-CavdzHis.js";import"./view-mode-toggle-CoDook_S.js";import"./table-r40t1ij6.js";const jt=({size:s=24,color:e="currentColor",...n})=>q.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},q.createElement("path",{d:"M2 10s2.005-2.732 3.634-4.362A9 9 0 1 1 12 21a9.004 9.004 0 0 1-8.648-6.5M2 10V4m0 6h6"}));jt.displayName="RefreshCcw01";function hs(s){const e=W.c(13),{virtualMcp:n,org:o}=s;let r;e[0]!==o||e[1]!==n.id?(r={org:o,project:Se,agentId:n.id},e[0]=o,e[1]=n.id,e[2]=r):r=e[2];let c;e[3]!==n.icon||e[4]!==n.title?(c=n.icon?t.jsx("img",{src:n.icon,alt:n.title,className:"w-5 h-5 rounded-md object-cover shrink-0"}):t.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0",children:t.jsx(He,{size:16,className:"text-primary"})}),e[3]=n.icon,e[4]=n.title,e[5]=c):c=e[5];let a;e[6]!==n.title?(a=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[6]=n.title,e[7]=a):a=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ms,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[8]=f):f=e[8];let u;return e[9]!==r||e[10]!==c||e[11]!==a?(u=t.jsxs(ct,{to:"/$org/$project/agents/$agentId",params:r,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[c,a,f]}),e[9]=r,e[10]=c,e[11]=a,e[12]=u):u=e[12],u}function rt(s){const e=W.c(20),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a,hasExistingVirtualMcps:f}=s,u=Re(),p=ds();let x;e[0]!==p.create||e[1]!==r||e[2]!==c||e[3]!==n||e[4]!==o||e[5]!==u||e[6]!==a?(x=async()=>{const d=await p.create.mutateAsync({title:`${o} Agent`,description:r??null,icon:c??null,status:"active",connections:[{connection_id:n,selected_tools:null,selected_resources:null,selected_prompts:null}]});u({to:"/$org/$project/agents/$agentId",params:{org:a,project:Se,agentId:d.id}})},e[0]=p.create,e[1]=r,e[2]=c,e[3]=n,e[4]=o,e[5]=u,e[6]=a,e[7]=x):x=e[7];const m=x;if(f){let d;e[8]!==p.create.isPending?(d=p.create.isPending?t.jsx(Ee,{size:16,className:"animate-spin"}):t.jsx(us,{size:16}),e[8]=p.create.isPending,e[9]=d):d=e[9];let l;return e[10]!==p.create.isPending||e[11]!==m||e[12]!==d?(l=t.jsx(Fe,{variant:"ghost",className:"size-6 p-0",onClick:m,disabled:p.create.isPending,children:d}),e[10]=p.create.isPending,e[11]=m,e[12]=d,e[13]=l):l=e[13],l}let i;e[14]!==p.create.isPending?(i=p.create.isPending?t.jsx(Ee,{className:"animate-spin text-muted-foreground"}):t.jsx(He,{className:"size-3 text-muted-foreground"}),e[14]=p.create.isPending,e[15]=i):i=e[15];let b;return e[16]!==p.create.isPending||e[17]!==m||e[18]!==i?(b=t.jsxs(Fe,{variant:"outline",size:"sm",onClick:m,disabled:p.create.isPending,children:[i,"Create an agent"]}),e[16]=p.create.isPending,e[17]=m,e[18]=i,e[19]=b):b=e[19],b}function gs(s){const e=W.c(26),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a}=s;let f;e[0]!==n?(f={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=f):f=e[1];const u=ls(f);if(!(u.length>0)){let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=l):l=e[2];let j;return e[3]!==r||e[4]!==c||e[5]!==n||e[6]!==o||e[7]!==a?(j=t.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[l,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a,hasExistingVirtualMcps:!1})]}),e[3]=r,e[4]=c,e[5]=n,e[6]=o,e[7]=a,e[8]=j):j=e[8],j}let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=e[9];let m;e[10]!==r||e[11]!==c||e[12]!==n||e[13]!==o||e[14]!==a?(m=t.jsx("div",{className:"flex flex-col gap-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[x,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a,hasExistingVirtualMcps:!0})]})}),e[10]=r,e[11]=c,e[12]=n,e[13]=o,e[14]=a,e[15]=m):m=e[15];let i;if(e[16]!==a||e[17]!==u){let l;e[19]!==a?(l=j=>t.jsx(hs,{virtualMcp:j,org:a},j.id),e[19]=a,e[20]=l):l=e[20],i=u.map(l),e[16]=a,e[17]=u,e[18]=i}else i=e[18];let b;e[21]!==i?(b=t.jsx("div",{className:"flex flex-col gap-2",children:i}),e[21]=i,e[22]=b):b=e[22];let d;return e[23]!==m||e[24]!==b?(d=t.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[m,b]}),e[23]=m,e[24]=b,e[25]=d):d=e[25],d}function js({form:s,connection:e,hasOAuthToken:n,onReauthenticate:o,onRemoveOAuth:r}){const c=Ge({control:s.control,name:"ui_type"}),a=Ge({control:s.control,name:"connection_url"}),{stdioEnabled:f}=Nt(),u=(()=>{if(typeof a!="string"||!a)return!1;try{const i=new URL(a);return i.hostname==="api.githubcopilot.com"&&i.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),p=f||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",m=x?yt(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(He,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),m&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:m})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsx(J,{control:s.control,name:"ui_type",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),c!=="NPX"&&c!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(H,{children:t.jsxs(st,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(nt,{})]})}),t.jsxs(ot,{children:[t.jsx(G,{value:"HTTP",children:"HTTP"}),t.jsx(G,{value:"SSE",children:"SSE"}),t.jsx(G,{value:"Websocket",children:"Websocket"}),p&&t.jsxs(t.Fragment,{children:[t.jsx(G,{value:"NPX",children:"NPX Package"}),t.jsx(G,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(J,{control:s.control,name:"connection_url",render:({field:b})=>t.jsx(Y,{className:"flex-1 min-w-0",children:t.jsx(H,{children:t.jsx(ee,{placeholder:"https://example.com/mcp",...b,value:b.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(H,{children:t.jsx(st,{className:"h-10",children:t.jsx(nt,{})})}),t.jsxs(ot,{children:[t.jsx(G,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(G,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(G,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"Websocket"]})}),p&&t.jsxs(t.Fragment,{children:[t.jsx(G,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Yt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(G,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(rs,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Z,{})]})}),c==="NPX"&&t.jsx(J,{control:s.control,name:"npx_package",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(H,{children:t.jsx(ee,{placeholder:"@perplexity-ai/mcp-server",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),c==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(J,{control:s.control,name:"stdio_command",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(H,{children:t.jsx(ee,{placeholder:"node, bun, python...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),t.jsx(J,{control:s.control,name:"stdio_args",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(H,{children:t.jsx(ee,{placeholder:"arg1 arg2 --flag value",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Z,{})]})})]}),t.jsx(J,{control:s.control,name:"stdio_cwd",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(H,{children:t.jsx(ee,{placeholder:"/path/to/project (optional)",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})})]}),(c==="NPX"||c==="STDIO")&&t.jsx(J,{control:s.control,name:"env_vars",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(H,{children:t.jsx(At,{value:i.value??[],onChange:i.onChange})}),t.jsx(Z,{})]})}),c!=="NPX"&&c!=="STDIO"&&t.jsx(J,{control:s.control,name:"connection_token",render:({field:i})=>t.jsxs(Y,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:u?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Zt,{children:[t.jsx(es,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Be,{variant:"success",className:"gap-1.5",children:[t.jsx(pt,{size:12}),"Authenticated via OAuth",t.jsx(os,{size:12})]})})}),t.jsxs(ts,{align:"start",children:[t.jsxs(et,{onClick:o,children:[t.jsx(jt,{size:16}),"Re-authenticate"]}),t.jsxs(et,{variant:"destructive",onClick:r,children:[t.jsx(is,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&i.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>i.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(cs,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(H,{children:t.jsx(ee,{type:"password",placeholder:u?"Paste your GitHub PAT":"Enter access token...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),u&&t.jsxs(ns,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(Z,{})]})})]})}function bs(s){const e=W.c(43),{form:n,connection:o,isMCPAuthenticated:r,hasOAuthToken:c,onReauthenticate:a,onRemoveOAuth:f}=s,{org:u}=at();let p;e[0]!==o.icon||e[1]!==o.title?(p=t.jsx(qe,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=p):p=e[2];let x;e[3]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(J,{control:n.control,name:"title",render:Ns}),t.jsx(J,{control:n.control,name:"description",render:vs})]}),e[3]=n.control,e[4]=x):x=e[4];let m;e[5]!==p||e[6]!==x?(m=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[p,x]}),e[5]=p,e[6]=x,e[7]=m):m=e[7];let i;e[8]!==o||e[9]!==n||e[10]!==c||e[11]!==a||e[12]!==f?(i=t.jsx(js,{form:n,connection:o,hasOAuthToken:c,onReauthenticate:a,onRemoveOAuth:f}),e[8]=o,e[9]=n,e[10]=c,e[11]=a,e[12]=f,e[13]=i):i=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=b):b=e[14];let d;e[15]!==r?(d=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b,r?t.jsxs(Be,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[t.jsx(pt,{size:12}),"Connected"]}):t.jsx(Be,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=r,e[16]=d):d=e[16];let l;e[17]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=l):l=e[17];let j;e[18]!==o.created_by?(j=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[l,t.jsx(as,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=j):j=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=T):T=e[20];let v;e[21]!==o.updated_at?(v=o.updated_at?ps(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=v):v=e[22];let y;e[23]!==v?(y=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[T,t.jsx("span",{className:"text-sm text-foreground",children:v})]}),e[23]=v,e[24]=y):y=e[24];let _;e[25]!==y||e[26]!==d||e[27]!==j?(_=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[d,j,y]}),e[25]=y,e[26]=d,e[27]=j,e[28]=_):_=e[28];let N;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==u.slug?(N=t.jsx(gs,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:u.slug}),e[29]=o.description,e[30]=o.icon,e[31]=o.id,e[32]=o.title,e[33]=u.slug,e[34]=N):N=e[34];let h;e[35]!==_||e[36]!==N||e[37]!==m||e[38]!==i?(h=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[m,i,_,N]}),e[35]=_,e[36]=N,e[37]=m,e[38]=i,e[39]=h):h=e[39];let k;return e[40]!==n||e[41]!==h?(k=t.jsx(ss,{...n,children:h}),e[40]=n,e[41]=h,e[42]=k):k=e[42],k}function vs(s){const{field:e}=s;return t.jsxs(Y,{className:"w-full space-y-0",children:[t.jsx(H,{children:t.jsx(ee,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Z,{})]})}function Ns(s){const{field:e}=s;return t.jsxs(Y,{className:"flex-1 space-y-0",children:[t.jsx(H,{children:t.jsx(ee,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Z,{})]})}function ys(s){const e=W.c(42),{prompts:n,connectionId:o,org:r,connectionTitle:c,connectionIcon:a,onPromptClick:f,showToolbar:u,emptyMessage:p}=s,x=u===void 0?!0:u,m=p===void 0?"This connection doesn't have any prompts yet.":p,i=Re(),d=ze().location.href,[l,j]=q.useState(""),[T,v]=q.useState("table"),[y,_]=q.useState("name"),[N,h]=q.useState("asc");let k;e[0]!==N||e[1]!==y?(k=S=>{y===S?(h(Ts),N==="desc"&&_(void 0)):(_(S),h("asc"))},e[0]=N,e[1]=y,e[2]=k):k=e[2];const B=k;let $;e[3]!==o||e[4]!==i||e[5]!==f||e[6]!==r?($=S=>{f?f(S):o&&r&&i({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:Se,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(S.name)}})},e[3]=o,e[4]=i,e[5]=f,e[6]=r,e[7]=$):$=e[7];const M=$;let A;if(e[8]!==n||e[9]!==l||e[10]!==N||e[11]!==y){const S=!n||n.length===0?[]:l.trim()?(()=>{const Q=l.toLowerCase();return n.filter(X=>X.name.toLowerCase().includes(Q)||X.description&&X.description.toLowerCase().includes(Q))})():n;A=!y||!N?S:[...S].sort((Q,X)=>{const se=Q[y]||"",ne=X[y]||"",oe=String(se).localeCompare(String(ne));return N==="asc"?oe:-oe}),e[8]=n,e[9]=l,e[10]=N,e[11]=y,e[12]=A}else A=e[12];const I=A;let R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=[{id:"name",header:"Name",render:ws,sortable:!0},{id:"description",header:"Description",render:Ss,cellClassName:"flex-1",sortable:!0}],e[13]=R):R=e[13];const L=R;let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=L.filter(Cs).map(_s),e[14]=C):C=e[14];const z=C;let P;e[15]!==a||e[16]!==c||e[17]!==B||e[18]!==x||e[19]!==N||e[20]!==y||e[21]!==d||e[22]!==T?(P=x&&t.jsxs(Ke,{children:[t.jsx(xt,{viewMode:T,onViewModeChange:v,sortKey:y,sortDirection:N,onSort:B,sortOptions:z}),t.jsx(We,{title:c?`${c}: Prompts`:"Prompts",url:d,icon:a??"description"})]}),e[15]=a,e[16]=c,e[17]=B,e[18]=x,e[19]=N,e[20]=y,e[21]=d,e[22]=T,e[23]=P):P=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{S.key==="Escape"&&(j(""),S.target.blur())},e[24]=D):D=e[24];let V;e[25]!==l?(V=t.jsx(ht,{value:l,onChange:j,placeholder:"Search prompts...",onKeyDown:D}),e[25]=l,e[26]=V):V=e[26];let g;e[27]!==m||e[28]!==M||e[29]!==B||e[30]!==l||e[31]!==N||e[32]!==y||e[33]!==I||e[34]!==T?(g=T==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:I.length===0?t.jsx(ye,{image:null,title:l?"No prompts found":"No prompts available",description:l?"Try adjusting your search terms":m}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:I.map(S=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>M(S),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(qe,{icon:null,name:S.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:S.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:S.description||"No description"})]})]})},S.name))})}):t.jsx(ft,{columns:L,data:I,isLoading:!1,sortKey:y,sortDirection:N,onSort:B,onRowClick:S=>M(S),emptyState:t.jsx(ye,{image:null,title:l?"No prompts found":"No prompts available",description:l?"Try adjusting your search terms":m})}),e[27]=m,e[28]=M,e[29]=B,e[30]=l,e[31]=N,e[32]=y,e[33]=I,e[34]=T,e[35]=g):g=e[35];let F;e[36]!==V||e[37]!==g?(F=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[V,g]}),e[36]=V,e[37]=g,e[38]=F):F=e[38];let O;return e[39]!==F||e[40]!==P?(O=t.jsxs(t.Fragment,{children:[P,F]}),e[39]=F,e[40]=P,e[41]=O):O=e[41],O}function _s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Cs(s){return s.sortable}function Ss(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ws(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function Ts(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function ks(s){const e=W.c(6),{prompts:n,connectionId:o,org:r}=s,c=Xe(o),a=c?.title,f=c?.icon;let u;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==a||e[4]!==f?(u=t.jsx(ys,{prompts:n,connectionId:o,org:r,connectionTitle:a,connectionIcon:f}),e[0]=o,e[1]=r,e[2]=n,e[3]=a,e[4]=f,e[5]=u):u=e[5],u}function Ps(s){const e=W.c(2),{repository:n}=s;let o;return e[0]!==n?(o=t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(fs,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function Is(s){const e=W.c(39),{resources:n,connectionTitle:o,connectionIcon:r,onResourceClick:c,showToolbar:a,emptyMessage:f}=s,u=a===void 0?!0:a,p=f===void 0?"This connection doesn't have any resources yet.":f,m=ze().location.href,[i,b]=q.useState(""),[d,l]=q.useState("table"),[j,T]=q.useState("name"),[v,y]=q.useState("asc");let _;e[0]!==v||e[1]!==j?(_=g=>{j===g?(y(Es),v==="desc"&&T(void 0)):(T(g),y("asc"))},e[0]=v,e[1]=j,e[2]=_):_=e[2];const N=_;let h;e[3]!==c?(h=g=>{c&&c(g)},e[3]=c,e[4]=h):h=e[4];const k=h;let B;if(e[5]!==n||e[6]!==i||e[7]!==v||e[8]!==j){const g=!n||n.length===0?[]:i.trim()?(()=>{const F=i.toLowerCase();return n.filter(O=>O.uri.toLowerCase().includes(F)||O.name&&O.name.toLowerCase().includes(F)||O.description&&O.description.toLowerCase().includes(F))})():n;B=!j||!v?g:[...g].sort((F,O)=>{const S=F[j]||"",Q=O[j]||"",X=String(S).localeCompare(String(Q));return v==="asc"?X:-X}),e[5]=n,e[6]=i,e[7]=v,e[8]=j,e[9]=B}else B=e[9];const $=B;let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=[{id:"name",header:"Name",render:Os,sortable:!0},{id:"uri",header:"URI",render:Ds,sortable:!0},{id:"description",header:"Description",render:Ms,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Vs,sortable:!0}],e[10]=M):M=e[10];const A=M;let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=A.filter(As).map($s),e[11]=I):I=e[11];const R=I;let L;e[12]!==r||e[13]!==o||e[14]!==N||e[15]!==u||e[16]!==v||e[17]!==j||e[18]!==m||e[19]!==d?(L=u&&t.jsxs(Ke,{children:[t.jsx(xt,{viewMode:d,onViewModeChange:l,sortKey:j,sortDirection:v,onSort:N,sortOptions:R}),t.jsx(We,{title:o?`${o}: Resources`:"Resources",url:m,icon:r??"folder"})]}),e[12]=r,e[13]=o,e[14]=N,e[15]=u,e[16]=v,e[17]=j,e[18]=m,e[19]=d,e[20]=L):L=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=g=>{g.key==="Escape"&&(b(""),g.target.blur())},e[21]=C):C=e[21];let z;e[22]!==i?(z=t.jsx(ht,{value:i,onChange:b,placeholder:"Search resources...",onKeyDown:C}),e[22]=i,e[23]=z):z=e[23];let P;e[24]!==p||e[25]!==k||e[26]!==N||e[27]!==i||e[28]!==v||e[29]!==j||e[30]!==$||e[31]!==d?(P=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:$.length===0?t.jsx(ye,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":p}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:$.map(g=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>k(g),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(qe,{icon:null,name:g.name||g.uri,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name||g.uri}),t.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:g.uri}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:g.description})]})]})},g.uri))})}):t.jsx(ft,{columns:A,data:$,isLoading:!1,sortKey:j,sortDirection:v,onSort:N,onRowClick:g=>k(g),emptyState:t.jsx(ye,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":p})}),e[24]=p,e[25]=k,e[26]=N,e[27]=i,e[28]=v,e[29]=j,e[30]=$,e[31]=d,e[32]=P):P=e[32];let D;e[33]!==z||e[34]!==P?(D=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[z,P]}),e[33]=z,e[34]=P,e[35]=D):D=e[35];let V;return e[36]!==D||e[37]!==L?(V=t.jsxs(t.Fragment,{children:[L,D]}),e[36]=D,e[37]=L,e[38]=V):V=e[38],V}function $s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function As(s){return s.sortable}function Vs(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Ms(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ds(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Os(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Es(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Rs(s){const e=W.c(6),{resources:n,connectionId:o,org:r}=s,c=Xe(o),a=c?.title,f=c?.icon;let u;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==a||e[4]!==f?(u=t.jsx(Is,{resources:n,connectionId:o,org:r,connectionTitle:a,connectionIcon:f}),e[0]=o,e[1]=r,e[2]=n,e[3]=a,e[4]=f,e[5]=u):u=e[5],u}const Ls=lt({key:K().min(1,"Key is required"),value:K()}),Us=lt({title:K().min(1,"Name is required"),description:K().nullable().optional(),ui_type:St(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:K().optional(),connection_token:K().nullable().optional(),npx_package:K().optional(),stdio_command:K().optional(),stdio_args:K().optional(),stdio_cwd:K().optional(),env_vars:Je(Ls).optional(),configuration_scopes:Je(K()).nullable().optional(),configuration_state:_t(K(),Ct()).nullable().optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Fs(s){const e=W.c(5),{tools:n,connectionId:o,org:r,isLoading:c}=s;let a;return e[0]!==o||e[1]!==c||e[2]!==r||e[3]!==n?(a=t.jsx(xs,{tools:n,connectionId:o,org:r,isLoading:c}),e[0]=o,e[1]=c,e[2]=r,e[3]=n,e[4]=a):a=e[4],a}function Bs(s){return s.command==="npx"}function zs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Ws(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Xs(s,e){const n={command:"npx",args:["-y",s]},o=mt(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Ks(s,e,n,o){const r={command:s};e.trim()&&(r.args=e.trim().split(/\s+/)),n?.trim()&&(r.cwd=n.trim());const c=mt(o);return Object.keys(c).length>0&&(r.envVars=c),r}function it(s,e){const n={title:s.title,description:s.description??"",configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&$t(s.connection_headers)){const o=s.connection_headers,r=Vt(o.envVars);if(Bs(o)){const a=zs(o);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const c=Ws(o);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function qs(s){let e,n=null,o=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xs(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ks(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",o=s.connection_token||null),{title:s.title,description:s.description||null,connection_type:e,connection_url:n,...o&&{connection_token:o},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Hs(s){const e=W.c(117),{connection:n,connectionId:o,org:r,requestedTabId:c,collections:a,onUpdate:f,isUpdating:u,prompts:p,resources:x,tools:m,isLoadingTools:i}=s;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={from:"/$org/$project/mcps/$connectionId"},e[0]=b):b=e[0];const d=Re(b),l=kt(),T=ze().location.href,v=ut();let y;e[1]!==o?(y={connectionId:o},e[1]=o,e[2]=y):y=e[2];const _=Et(y),h=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let k;e[3]!==n?(k={connections:[n],binding:"MCP"},e[3]=n,e[4]=k):k=e[4];const $=Ot(k).length>0,M=n?.metadata?.repository,A=!!M?.url;let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=Pt(Us),e[5]=I):I=e[5];let R;e[6]!==n?(R=it(n),e[6]=n,e[7]=R):R=e[7];let L;e[8]!==R?(L={resolver:I,values:R},e[8]=R,e[9]=L):L=e[9];const C=It(L),z=C.formState.isDirty;let P;e[10]!==C||e[11]!==f?(P=async()=>{if(!await C.trigger())return;const U=C.getValues(),Ne=qs(U);await f(Ne),C.reset(U)},e[10]=C,e[11]=f,e[12]=P):P=e[12];const D=P;let V;e[13]!==n||e[14]!==C?(V=()=>{C.reset(it(n))},e[13]=n,e[14]=C,e[15]=V):V=e[15];const g=V;let F;e[16]!==n.id||e[17]!==v||e[18]!==l?(F=async()=>{const{token:w,tokenInfo:U,error:Ne}=await zt({connectionId:n.id});if(Ne||!w){Ce.error(`Authentication failed: ${Ne}`);return}if(U)try{const De=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:U.accessToken,refreshToken:U.refreshToken,expiresIn:U.expiresIn,scope:U.scope,clientId:U.clientId,clientSecret:U.clientSecret,tokenEndpoint:U.tokenEndpoint})});if(!De.ok)console.error("Failed to save OAuth token:",await De.text()),await v.update.mutateAsync({id:n.id,data:{connection_token:w}});else try{await v.update.mutateAsync({id:n.id,data:{}})}catch(Qe){console.warn("Failed to refresh connection tools after OAuth:",Qe)}}catch(De){console.error("Error saving OAuth token:",De),await v.update.mutateAsync({id:n.id,data:{connection_token:w}})}else await v.update.mutateAsync({id:n.id,data:{connection_token:w}});const vt=new URL(`/mcp/${n.id}`,window.location.origin);await l.invalidateQueries({queryKey:Ye.isMCPAuthenticated(vt.href,null)}),Ce.success("Authentication successful")},e[16]=n.id,e[17]=v,e[18]=l,e[19]=F):F=e[19];const O=F;let S;e[20]!==n.id||e[21]!==l?(S=async()=>{try{const w=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!w.ok){const Ne=await w.text();Ce.error(`Failed to remove OAuth: ${Ne}`);return}const U=new URL(`/mcp/${n.id}`,window.location.origin);await l.invalidateQueries({queryKey:Ye.isMCPAuthenticated(U.href,null)}),Ce.success("OAuth removed. You can now re-authenticate with a different account.")}catch(w){console.error("Error removing OAuth token:",w),Ce.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=l,e[22]=S):S=e[22];const Q=S,X=m.length,se=p.length,ne=x.length,oe=X>0||i;let we;e[23]===Symbol.for("react.memo_cache_sentinel")?(we={id:"settings",label:"Settings"},e[23]=we):we=e[23];let re;e[24]!==i||e[25]!==h||e[26]!==oe||e[27]!==X?(re=h&&oe?[{id:"tools",label:"Tools",count:i?void 0:X}]:[],e[24]=i,e[25]=h,e[26]=oe,e[27]=X,e[28]=re):re=e[28];let ie;e[29]!==h||e[30]!==se?(ie=h&&se>0?[{id:"prompts",label:"Prompts",count:se}]:[],e[29]=h,e[30]=se,e[31]=ie):ie=e[31];let ce;e[32]!==h||e[33]!==ne?(ce=h&&ne>0?[{id:"resources",label:"Resources",count:ne}]:[],e[32]=h,e[33]=ne,e[34]=ce):ce=e[34];let Te;if(e[35]!==a||e[36]!==A||e[37]!==h||e[38]!==re||e[39]!==ie||e[40]!==ce){let w;e[42]!==A?(w=A?[{id:"readme",label:"README"}]:[],e[42]=A,e[43]=w):w=e[43],Te=[we,...re,...ie,...ce,...h?(a||[]).map(Gs):[],...w],e[35]=a,e[36]=A,e[37]=h,e[38]=re,e[39]=ie,e[40]=ce,e[41]=Te}else Te=e[41];const _e=Te,bt=h&&_e.some(Qs)?"tools":"settings",E=_e.some(w=>w.id===c)?c:bt;let ke;e[44]!==d?(ke=w=>{d({search:U=>({...U,tab:w}),replace:!0})},e[44]=d,e[45]=ke):ke=e[45];const ae=ke;let le;e[46]!==a?(le=a||[],e[46]=a,e[47]=le):le=e[47];let Pe;if(e[48]!==E||e[49]!==le){let w;e[51]!==E?(w=U=>U.name===E,e[51]=E,e[52]=w):w=e[52],Pe=le.find(w),e[48]=E,e[49]=le,e[50]=Pe}else Pe=e[50];const Ie=Pe;let de;e[53]!==r?(de=t.jsx(Ze,{children:t.jsx(Xt,{asChild:!0,children:t.jsx(ct,{to:"/$org/$project/mcps",params:{org:r,project:Se},children:"Connections"})})}),e[53]=r,e[54]=de):de=e[54];let $e;e[55]===Symbol.for("react.memo_cache_sentinel")?($e=t.jsx(Kt,{}),e[55]=$e):$e=e[55];let me;e[56]!==n.title?(me=t.jsx(Ze,{children:t.jsx(Wt,{children:n.title})}),e[56]=n.title,e[57]=me):me=e[57];let Ae;e[58]!==de||e[59]!==me?(Ae=t.jsx(qt,{children:t.jsxs(Ht,{children:[de,$e,me]})}),e[58]=de,e[59]=me,e[60]=Ae):Ae=e[60];const Le=Ae;let ue;e[61]!==D||e[62]!==g||e[63]!==z||e[64]!==u?(ue=t.jsx(Mt,{onSave:D,onUndo:g,isDirty:z,isSaving:u}),e[61]=D,e[62]=g,e[63]=z,e[64]=u,e[65]=ue):ue=e[65];const Ue=n.icon??"settings";let pe;e[66]!==n.title||e[67]!==Ue||e[68]!==T?(pe=t.jsx(We,{title:n.title,url:T,icon:Ue}),e[66]=n.title,e[67]=Ue,e[68]=T,e[69]=pe):pe=e[69];let fe;e[70]!==ue||e[71]!==pe?(fe=t.jsxs(Ke,{children:[ue,pe]}),e[70]=ue,e[71]=pe,e[72]=fe):fe=e[72];let xe;e[73]!==_.hasOAuthToken||e[74]!==n||e[75]!==C||e[76]!==O||e[77]!==Q||e[78]!==h?(xe=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(bs,{form:C,connection:n,isMCPAuthenticated:h,hasOAuthToken:_.hasOAuthToken,onReauthenticate:O,onRemoveOAuth:Q})}),e[73]=_.hasOAuthToken,e[74]=n,e[75]=C,e[76]=O,e[77]=Q,e[78]=h,e[79]=xe):xe=e[79];let he;e[80]!==E||e[81]!==ae||e[82]!==_e?(he=t.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:t.jsx(Qt,{tabs:_e,activeTab:E,onTabChange:ae,className:"flex-1"})}),e[80]=E,e[81]=ae,e[82]=_e,e[83]=he):he=e[83];let Ve;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ee,{size:32,className:"animate-spin text-muted-foreground"})}),e[84]=Ve):Ve=e[84];let ge;e[85]!==Ie||e[86]!==E||e[87]!==_.isServerError||e[88]!==_.supportsOAuth||e[89]!==n||e[90]!==o||e[91]!==C||e[92]!==O||e[93]!==ae||e[94]!==$||e[95]!==A||e[96]!==i||e[97]!==h||e[98]!==r||e[99]!==p||e[100]!==M||e[101]!==x||e[102]!==m?(ge=t.jsx(q.Suspense,{fallback:Ve,children:E==="tools"?t.jsx(Fs,{tools:m,connectionId:o,org:r,isLoading:i}):E==="prompts"?t.jsx(ks,{prompts:p,connectionId:o,org:r}):E==="resources"?t.jsx(Rs,{resources:x,connectionId:o,org:r}):E==="settings"?t.jsx(Rt,{connection:n,form:C,hasMcpBinding:$,isMCPAuthenticated:h,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:O,onViewReadme:A?()=>ae("readme"):void 0}):E==="readme"&&A?t.jsx(Ps,{repository:M}):Ie&&h?t.jsx(Jt,{connectionId:o,org:r,activeCollection:Ie},E):t.jsx(ye,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[85]=Ie,e[86]=E,e[87]=_.isServerError,e[88]=_.supportsOAuth,e[89]=n,e[90]=o,e[91]=C,e[92]=O,e[93]=ae,e[94]=$,e[95]=A,e[96]=i,e[97]=h,e[98]=r,e[99]=p,e[100]=M,e[101]=x,e[102]=m,e[103]=ge):ge=e[103];let je;e[104]!==E||e[105]!==ge?(je=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(dt,{children:ge},E)}),e[104]=E,e[105]=ge,e[106]=je):je=e[106];let be;e[107]!==he||e[108]!==je?(be=t.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[he,je]}),e[107]=he,e[108]=je,e[109]=be):be=e[109];let ve;e[110]!==xe||e[111]!==be?(ve=t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[xe,be]}),e[110]=xe,e[111]=be,e[112]=ve):ve=e[112];let Me;return e[113]!==Le||e[114]!==fe||e[115]!==ve?(Me=t.jsxs(Gt,{breadcrumb:Le,children:[fe,ve]}),e[113]=Le,e[114]=fe,e[115]=ve,e[116]=Me):Me=e[116],Me}function Qs(s){return s.id==="tools"}function Gs(s){return{id:s.name,label:s.displayName}}function Js(){const s=W.c(43);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$connectionId"},s[0]=e):e=s[0];const n=Re(e);let o;s[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/$project/mcps/$connectionId"},s[1]=o):o=s[1];const{connectionId:r,org:c}=wt(o),{org:a}=at();let f;s[2]===Symbol.for("react.memo_cache_sentinel")?(f={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=f):f=s[2];const p=Tt(f).tab??"",x=Xe(r),m=ut(),i=Dt(x??void 0);let b;s[3]!==r||s[4]!==a.id?(b={connectionId:r,orgId:a.id},s[3]=r,s[4]=a.id,s[5]=b):b=s[5];const d=Lt(b);let l;s[6]!==d?(l={client:d},s[6]=d,s[7]=l):l=s[7];const{data:j}=Ft(l);let T;s[8]!==d?(T={client:d},s[8]=d,s[9]=T):T=s[9];const{data:v}=Bt(T),_=!(x?.connection_type==="VIRTUAL")&&x?.tools&&x.tools.length>0,N=!_;let h;s[10]!==d||s[11]!==N?(h={client:d,enabled:N},s[10]=d,s[11]=N,s[12]=h):h=s[12];const{data:k,isLoading:B}=Ut(h);let $;s[13]!==j?.prompts?($=j?.prompts??[],s[13]=j?.prompts,s[14]=$):$=s[14];let M;s[15]!==$?(M=$.map(en),s[15]=$,s[16]=M):M=s[16];const A=M;let I;s[17]!==v?.resources?(I=v?.resources??[],s[17]=v?.resources,s[18]=I):I=s[18];let R;s[19]!==I?(R=I.map(Zs),s[19]=I,s[20]=R):R=s[20];const L=R;let C;s[21]!==x||s[22]!==_||s[23]!==k?.tools?(C=_?x.tools??[]:(k?.tools??[]).map(Ys),s[21]=x,s[22]=_,s[23]=k?.tools,s[24]=C):C=s[24];const z=C;let P;s[25]!==m.update||s[26]!==r?(P=async g=>{await m.update.mutateAsync({id:r,data:g})},s[25]=m.update,s[26]=r,s[27]=P):P=s[27];const D=P;if(!x){let g;return s[28]!==n||s[29]!==c?(g=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ye,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(Fe,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:c,project:Se}}),children:"Back to connections"})})}),s[28]=n,s[29]=c,s[30]=g):g=s[30],g}let V;return s[31]!==m.update.isPending||s[32]!==i||s[33]!==x||s[34]!==r||s[35]!==D||s[36]!==B||s[37]!==c||s[38]!==A||s[39]!==p||s[40]!==L||s[41]!==z?(V=t.jsx(Hs,{org:c,connection:x,connectionId:r,requestedTabId:p,collections:i,onUpdate:D,isUpdating:m.update.isPending,prompts:A,resources:L,tools:z,isLoadingTools:B}),s[31]=m.update.isPending,s[32]=i,s[33]=x,s[34]=r,s[35]=D,s[36]=B,s[37]=c,s[38]=A,s[39]=p,s[40]=L,s[41]=z,s[42]=V):V=s[42],V}function Ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema}}function Zs(s){return{uri:s.uri,name:s.name,description:s.description}}function en(s){return{name:s.name,description:s.description}}function tn(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(dt,{children:t.jsx(q.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ee,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Js,{})})}),s[0]=e):e=s[0],e}function Ro(){const s=W.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(tn,{}),s[0]=e):e=s[0],e}export{Ro as default};
@@ -1 +0,0 @@
1
- import{F as t,G as a}from"./index-D5tmQFLM.js";const e=t(a,{target:"draft-7"});export{e as B};
@@ -1 +0,0 @@
1
- import{c as i,r as u,j as c}from"./index-D5tmQFLM.js";import{c as a}from"./utils-63Yxgxyo.js";function x(n,e){const s=u.Children.toArray(n);for(const l of s)if(u.isValidElement(l)&&l.type===e)return l;return null}function b(n){const e=i.c(5),{children:s,className:l}=n;let t;e[0]!==l?(t=a("flex flex-col h-full bg-background overflow-hidden",l),e[0]=l,e[1]=t):t=e[1];let r;return e[2]!==s||e[3]!==t?(r=c.jsx("div",{className:t,children:s}),e[2]=s,e[3]=t,e[4]=r):r=e[4],r}function p(n){const e=i.c(10),{children:s,className:l}=n;let t;e[0]!==s?(t=x(s,h),e[0]=s,e[1]=t):t=e[1];const r=t;let f;e[2]!==s?(f=x(s,g),e[2]=s,e[3]=f):f=e[3];const m=f;let o;e[4]!==l?(o=a("shrink-0 w-full bg-background border-b border-border h-12 overflow-x-auto","flex items-center justify-between gap-3 px-4 min-w-max",l),e[4]=l,e[5]=o):o=e[5];let d;return e[6]!==r||e[7]!==m||e[8]!==o?(d=c.jsxs("div",{className:o,children:[r,m]}),e[6]=r,e[7]=m,e[8]=o,e[9]=d):d=e[9],d}function h(n){const e=i.c(5),{children:s,className:l}=n;let t;e[0]!==l?(t=a("flex items-center gap-2 flex-shrink-0 overflow-hidden",l),e[0]=l,e[1]=t):t=e[1];let r;return e[2]!==s||e[3]!==t?(r=c.jsx("div",{className:t,children:s}),e[2]=s,e[3]=t,e[4]=r):r=e[4],r}function g(n){const e=i.c(5),{children:s,className:l}=n;let t;e[0]!==l?(t=a("flex items-center gap-2 flex-shrink-0 overflow-hidden border-l border-border pl-3",l),e[0]=l,e[1]=t):t=e[1];let r;return e[2]!==s||e[3]!==t?(r=c.jsx("div",{className:t,children:s}),e[2]=s,e[3]=t,e[4]=r):r=e[4],r}function j(n){const e=i.c(5),{children:s,className:l}=n;let t;e[0]!==l?(t=a("flex-1 overflow-auto",l),e[0]=l,e[1]=t):t=e[1];let r;return e[2]!==s||e[3]!==t?(r=c.jsx("div",{className:t,children:s}),e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const w=Object.assign(b,{Header:Object.assign(p,{Left:h,Right:g}),Content:j});export{w as P};
@@ -1 +0,0 @@
1
- import{r as v,c as S,u as K,j as a,a_ as W,am as $,b5 as X,_,al as E,b6 as Y,an as k,b7 as w,av as Z,aq as I,ao as J,ap as Q}from"./index-D5tmQFLM.js";import{B as j}from"./button-CIJQcfm2.js";import{T as ee,a as oe,c as te,b as re}from"./integration-icon-W7oxbRNq.js";import{c as ae}from"./Pin01-D3bkVyHA.js";import{u as se,a as ie}from"./use-organization-settings-DGMFFXzb.js";import{i as ne}from"./Loading01-CM7djb9Q.js";const A=({size:n=24,color:e="currentColor",...o})=>v.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},v.createElement("path",{d:"M3 9h13.5a4.5 4.5 0 1 1 0 9H12M3 9l4-4M3 9l4 4"}));A.displayName="FlipBackward";const N=({size:n=24,color:e="currentColor",...o})=>v.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},v.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));N.displayName="Save01";function ye(n){const e=S.c(19),{title:o,url:s,icon:r}=n,{org:t}=K(),c=se(t.id),R=ie(t.id);let p;e[0]!==c?.sidebar_items||e[1]!==s?(p=c?.sidebar_items?.some(C=>C.url===s),e[0]=c?.sidebar_items,e[1]=s,e[2]=p):p=e[2];const u=!!p;let f;e[3]!==R.update||e[4]!==r||e[5]!==u||e[6]!==c?.sidebar_items||e[7]!==o||e[8]!==s?(f=async()=>{const C=c?.sidebar_items||[];let y;u?y=C.filter(H=>H.url!==s):y=[...C,{title:o,url:s,icon:r}],await R.update.mutateAsync({sidebar_items:y})},e[3]=R.update,e[4]=r,e[5]=u,e[6]=c?.sidebar_items,e[7]=o,e[8]=s,e[9]=f):f=e[9];const l=f,m=u?"secondary":"outline";let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx(ae,{size:16}),e[10]=i):i=e[10];let d;e[11]!==l||e[12]!==m?(d=a.jsx(ee,{asChild:!0,children:a.jsx(j,{onClick:l,size:"icon",variant:m,className:"size-7 border border-input",children:i})}),e[11]=l,e[12]=m,e[13]=d):d=e[13];const b=u?"Pinned":"Pin to sidebar";let h;e[14]!==b?(h=a.jsx(oe,{children:b}),e[14]=b,e[15]=h):h=e[15];let x;return e[16]!==d||e[17]!==h?(x=a.jsx(te,{children:a.jsxs(re,{children:[d,h]})}),e[16]=d,e[17]=h,e[18]=x):x=e[18],x}function ke(n){const e=S.c(15),{onSave:o,onUndo:s,isDirty:r,isSaving:t,saveLabel:c,undoLabel:R}=n,p=c===void 0?"Save":c,u=R===void 0?"Undo":R;if(!r)return null;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx(A,{size:14}),e[0]=f):f=e[0];let l;e[1]!==t||e[2]!==s||e[3]!==u?(l=a.jsxs(j,{variant:"outline",size:"sm",onClick:s,disabled:t,"aria-label":u,children:[f,u]}),e[1]=t,e[2]=s,e[3]=u,e[4]=l):l=e[4];let m;e[5]!==t?(m=t?a.jsx(ne,{size:14,className:"animate-spin"}):a.jsx(N,{size:14}),e[5]=t,e[6]=m):m=e[6];let i;e[7]!==t||e[8]!==o||e[9]!==p||e[10]!==m?(i=a.jsxs(j,{variant:"default",size:"sm",onClick:o,disabled:t,"aria-label":p,children:[m,p]}),e[7]=t,e[8]=o,e[9]=p,e[10]=m,e[11]=i):i=e[11];let d;return e[12]!==l||e[13]!==i?(d=a.jsxs(a.Fragment,{children:[l,i]}),e[12]=l,e[13]=i,e[14]=d):d=e[14],d}var P="Radio",[ce,G]=I(P),[de,le]=ce(P),L=v.forwardRef((n,e)=>{const{__scopeRadio:o,name:s,checked:r=!1,required:t,disabled:c,value:R="on",onCheck:p,form:u,...f}=n,[l,m]=v.useState(null),i=E(e,h=>m(h)),d=v.useRef(!1),b=l?u||!!l.closest("form"):!0;return a.jsxs(de,{scope:o,checked:r,disabled:c,children:[a.jsx(_.button,{type:"button",role:"radio","aria-checked":r,"data-state":B(r),"data-disabled":c?"":void 0,disabled:c,value:R,...f,ref:i,onClick:k(n.onClick,h=>{r||p?.(),b&&(d.current=h.isPropagationStopped(),d.current||h.stopPropagation())})}),b&&a.jsx(T,{control:l,bubbles:!d.current,name:s,value:R,checked:r,required:t,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});L.displayName=P;var z="RadioIndicator",M=v.forwardRef((n,e)=>{const{__scopeRadio:o,forceMount:s,...r}=n,t=le(z,o);return a.jsx(Z,{present:s||t.checked,children:a.jsx(_.span,{"data-state":B(t.checked),"data-disabled":t.disabled?"":void 0,...r,ref:e})})});M.displayName=z;var ue="RadioBubbleInput",T=v.forwardRef(({__scopeRadio:n,control:e,checked:o,bubbles:s=!0,...r},t)=>{const c=v.useRef(null),R=E(c,t),p=J(o),u=Q(e);return v.useEffect(()=>{const f=c.current;if(!f)return;const l=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(l,"checked").set;if(p!==o&&i){const d=new Event("click",{bubbles:s});i.call(f,o),f.dispatchEvent(d)}},[p,o,s]),a.jsx(_.input,{type:"radio","aria-hidden":!0,defaultChecked:o,...r,tabIndex:-1,ref:R,style:{...r.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});T.displayName=ue;function B(n){return n?"checked":"unchecked"}var pe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],g="RadioGroup",[fe]=I(g,[w,G]),D=w(),O=G(),[me,ve]=fe(g),F=v.forwardRef((n,e)=>{const{__scopeRadioGroup:o,name:s,defaultValue:r,value:t,required:c=!1,disabled:R=!1,orientation:p,dir:u,loop:f=!0,onValueChange:l,...m}=n,i=D(o),d=W(u),[b,h]=$({prop:t,defaultProp:r??null,onChange:l,caller:g});return a.jsx(me,{scope:o,name:s,required:c,disabled:R,value:b,onValueChange:h,children:a.jsx(X,{asChild:!0,...i,orientation:p,dir:d,loop:f,children:a.jsx(_.div,{role:"radiogroup","aria-required":c,"aria-orientation":p,"data-disabled":R?"":void 0,dir:d,...m,ref:e})})})});F.displayName=g;var V="RadioGroupItem",U=v.forwardRef((n,e)=>{const{__scopeRadioGroup:o,disabled:s,...r}=n,t=ve(V,o),c=t.disabled||s,R=D(o),p=O(o),u=v.useRef(null),f=E(e,u),l=t.value===r.value,m=v.useRef(!1);return v.useEffect(()=>{const i=b=>{pe.includes(b.key)&&(m.current=!0)},d=()=>m.current=!1;return document.addEventListener("keydown",i),document.addEventListener("keyup",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",d)}},[]),a.jsx(Y,{asChild:!0,...R,focusable:!c,active:l,children:a.jsx(L,{disabled:c,required:t.required,checked:l,...p,...r,name:t.name,ref:f,onCheck:()=>t.onValueChange(r.value),onKeyDown:k(i=>{i.key==="Enter"&&i.preventDefault()}),onFocus:k(r.onFocus,()=>{m.current&&u.current?.click()})})})});U.displayName=V;var Re="RadioGroupIndicator",q=v.forwardRef((n,e)=>{const{__scopeRadioGroup:o,...s}=n,r=O(o);return a.jsx(M,{...r,...s,ref:e})});q.displayName=Re;var je=F,Ee=U,Pe=q;export{Ee as I,ye as P,je as R,ke as S,Pe as a};
@@ -1 +0,0 @@
1
- import{r as n,at as L,_ as R,R as ke,x as Ee,y as xe,w as Se,aY as q}from"./index-D5tmQFLM.js";const Ce=({size:t=24,color:l="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:l,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M17 9a1.99 1.99 0 0 0-.586-1.414A1.994 1.994 0 0 0 15 7m0 8a6 6 0 1 0-5.946-5.193c.058.434.087.651.068.789a.853.853 0 0 1-.117.346c-.068.121-.187.24-.426.479l-5.11 5.11c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C3 17.296 3 17.418 3 17.663V19.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H7v-2h2v-2h2l1.58-1.58c.238-.238.357-.357.478-.425a.852.852 0 0 1 .346-.117c.138-.02.355.01.789.068.264.036.533.054.807.054Z"}));Ce.displayName="Key01";var de=1,Ie=.9,Re=.8,Ae=.17,Z=.1,Q=.999,Me=.9999,$e=.99,De=/[\\\/_+.#"@\[\(\{&]/,Ke=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:$e;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,S,k,C;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:De.test(t.charAt(i-1))?(h*=Re,k=t.slice(u,i-1).match(Ke),k&&u>0&&(h*=Math.pow(Q,k.length))):Fe.test(t.charAt(i-1))?(h*=Ie,C=t.slice(u,i-1).match(ve),C&&u>0&&(h*=Math.pow(Q,C.length))):(h*=Ae,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Me)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(S=ee(t,l,r,f,i+1,c+2,d),S*Z>h&&(h=S*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Le(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var j='[cmdk-group=""]',_='[cmdk-group-items=""]',Ve='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",K="data-value",je=(t,l,r)=>Le(t,l,r),pe=n.createContext(void 0),P=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=F(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=F(()=>new Set),u=F(()=>new Map),c=F(()=>new Map),d=F(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:S,shouldFilter:k,loop:C,disablePointerSelection:H=!1,vimBindings:A=!0,...B}=t,N=L(),ne=L(),U=L(),M=n.useRef(null),w=Ye();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,E.emit()}},[p]),$(()=>{w(6,ae)},[]);let E=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,x;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")G(),T(),w(1,Y);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(U);y?y.focus():(a=document.getElementById(N))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,E.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(x=(g=v.current).onValueChange)==null||x.call(g,y);return}}E.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),W=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{T(),E.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{G(),T(),r.current.value||Y(),E.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{G(),s?.getAttribute("id")===e&&Y(),E.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:N,inputId:U,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:je;return e?m(e,r.current.search,o):0}function T(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(x=>{let y=e.get(x);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;V().sort((a,m)=>{var g,x;let y=a.getAttribute("id"),O=m.getAttribute("id");return((g=e.get(O))!=null?g:0)-((x=e.get(y))!=null?x:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${j}[${K}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function Y(){let e=V().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(K);E.setState("value",o||void 0)}function G(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let x=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],O=le(x,y);r.current.filtered.items.set(g,O),O>0&&m++}for(let[g,x]of u.current)for(let y of x)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(j))==null?void 0:o.querySelector(Ve))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function V(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function J(e){let o=V()[e];o&&E.setState("value",o.getAttribute(K))}function X(e){var o;let s=D(),a=V(),m=a.findIndex(x=>x===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&E.setState("value",g.getAttribute(K))}function ue(e){let o=D(),s=o?.closest(j),a;for(;s&&!a;)s=e>0?We(s,j):Te(s,j),a=s?.querySelector(fe);a?E.setState("value",a.getAttribute(K)):X(e)}let ie=()=>J(V().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):X(1)},ce=e=>{e.preventDefault(),e.metaKey?J(0):e.altKey?ue(-1):X(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:e=>{var o;(o=B.onKeyDown)==null||o.call(B,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),J(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Je},b),z(t,e=>n.createElement(he.Provider,{value:E},n.createElement(pe.Provider,{value:W},e))))}),qe=n.forwardRef((t,l)=>{var r,f;let u=L(),c=n.useRef(null),d=n.useContext(ge),v=P(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),S=I(w=>w.value&&w.value===p.current),k=I(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,C),()=>w.removeEventListener(te,C)},[k,t.onSelect,t.disabled]);function C(){var w,E;H(),(E=(w=b.current).onSelect)==null||E.call(w,p.current)}function H(){h.setState("value",p.current,!0)}if(!k)return null;let{disabled:A,value:B,onSelect:N,forceMount:ne,keywords:U,...M}=t;return n.createElement(R.div,{ref:q(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!S,"data-disabled":!!A,"data-selected":!!S,onPointerMove:A||v.getDisablePointerSelection()?void 0:H,onClick:A?void 0:C},t.children)}),Pe=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=L(),v=n.useRef(null),b=n.useRef(null),i=L(),p=P(),h=I(k=>u||p.filter()===!1?!0:k.search?k.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let S=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:q(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,k=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:S},k))))}),Be=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=I(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:q(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=I(i=>i.search),v=I(i=>i.selectedItemId),b=P();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),ze=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=I(i=>i.selectedItemId),b=P();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,S=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let k=i.offsetHeight;p.style.setProperty("--cmdk-list-height",k.toFixed(1)+"px")})});return S.observe(i),()=>{cancelAnimationFrame(h),S.unobserve(i)}}},[]),n.createElement(R.div,{ref:q(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:q(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),He=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(ke,{open:r,onOpenChange:f},n.createElement(Ee,{container:d},n.createElement(xe,{"cmdk-overlay":"",className:u}),n.createElement(Se,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ne=n.forwardRef((t,l)=>I(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),Ue=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ze=Object.assign(be,{List:ze,Item:qe,Input:Oe,Group:Pe,Separator:Be,Dialog:He,Empty:Ne,Loading:Ue});function We(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function F(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function I(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=P();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(K,v),u.current=v}),u}var Ye=()=>{let[t,l]=n.useState(),r=F(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ze as _,Ce as i};
@@ -1,3 +0,0 @@
1
- import{r as D,c as le,j as s,p as Jt,u as Ce,g as ae,K as ce,o as Et,ae as at,s as ve,b9 as Yt,bf as Xt,v as _e,k as Dt,h as Wt,t as ne,q as es}from"./index-D5tmQFLM.js";import{C as ts,a as ss}from"./collection-table-wrapper-BXL-ZhOo.js";import{C as Ke}from"./collection-search-BhGdJARf.js";import{P as Ne}from"./index-Bq-YlXEQ.js";import{B as ns,a as rs,b as is,c as os}from"./breadcrumb-CfCt3BHC.js";import{I as zt,c as Le,b as Re,T as Pe,a as Me}from"./integration-icon-W7oxbRNq.js";import{C as De}from"./checkbox-C09bNjVn.js";import{B as ie}from"./button-CIJQcfm2.js";import{c as Y}from"./utils-63Yxgxyo.js";import{h as kt}from"./use-connection-BSXprdTB.js";import{u as bt,C as ct,a as dt,b as yt,c as ls,d as as,e as cs,f as ds}from"./command-CwW6gorP.js";import{u as it}from"./useQuery-C7wGFtkw.js";import{u as Te}from"./useMutation-CapnNHWF.js";import{A as Ae}from"./avatar-ydfTe0xi.js";import{B as Ee}from"./badge-B4Hap73o.js";import{f as ze,a as ke,b as Ue,c as Ve,d as Ge,e as Be,A as $e,g as Fe}from"./alert-dialog-BmBtcfYg.js";import{D as Ut,f as Vt,a as Gt,b as ms,c as us,e as fs}from"./dialog-Dn-qFsZM.js";import{D as Ct,a as jt,b as Tt,c as tt,d as hs,e as gs,f as xs,g as ps}from"./dropdown-menu-CFkIMuHp.js";import{i as bs}from"./DotsHorizontal-CO7zK7Nc.js";import{i as st}from"./Loading01-CM7djb9Q.js";import{i as Cs}from"./Lock01-B6ThbWMN.js";import{s as nt}from"./Plus-BhKqidCj.js";import{s as Bt}from"./Trash01-SLyaMDks.js";import{i as St}from"./X-2IB63Q0x.js";import{I as js}from"./input-BPn8NjNN.js";import{S as Ye}from"./switch-CZLIUnPD.js";import{E as mt}from"./empty-state-Bu5U3yVT.js";import{E as Ts}from"./error-boundary-DRPYIYcG.js";import{a as vs,F as It,b as Ot,c as Ns,d as At,f as _t}from"./form-CfZFG_36.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-iLE4SSQV.js";import{T as Es}from"./textarea-CCeQpN_N.js";import{a as qe,u as Qe}from"./constants-BQDDq09c.js";import{C as wt}from"./card-v4WZxiU8.js";import{i as $t}from"./DotsVertical-DjjH7_Y2.js";import{i as ys}from"./index-N9GUWdsk.js";import{s as Ft}from"./XClose-DSG07tz8.js";import{a as Ss,b as Is,P as Os}from"./popover-BnV2Ekkf.js";import{t as As}from"./ChevronDown-B9Mxx2fi.js";import"./ArrowUp-DL3E-1B5.js";import"./Check-VEx1ONnd.js";import"./Grid01-DQKfO4pL.js";import"./List-CavdzHis.js";import"./view-mode-toggle-CoDook_S.js";import"./table-r40t1ij6.js";import"./SearchMd-DZNqxRa2.js";import"./ChevronRight-in3TmXpP.js";import"./index-9tcRb7FE.js";const Kt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));Kt.displayName="ArrowLeft";const vt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));vt.displayName="Shield01";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));qt.displayName="SwitchHorizontal01";const Qt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"},{name:"PROJECT_LIST",description:"List projects in organization",category:"Projects"},{name:"PROJECT_GET",description:"View project details",category:"Projects"},{name:"PROJECT_CREATE",description:"Create new project",category:"Projects"},{name:"PROJECT_UPDATE",description:"Update project",category:"Projects"},{name:"PROJECT_DELETE",description:"Delete project",category:"Projects",dangerous:!0},{name:"PROJECT_PLUGIN_CONFIG_GET",description:"View project plugin configuration",category:"Projects"},{name:"PROJECT_PLUGIN_CONFIG_UPDATE",description:"Update project plugin configuration",category:"Projects"}],_s={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags",PROJECT_LIST:"List projects",PROJECT_GET:"View project details",PROJECT_CREATE:"Create project",PROJECT_UPDATE:"Update project",PROJECT_DELETE:"Delete project",PROJECT_PLUGIN_CONFIG_GET:"View plugin config",PROJECT_PLUGIN_CONFIG_UPDATE:"Update plugin config"};function ws(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[],Projects:[]};for(const e of Qt)t[e.category]?.push(e);return t}function Ls(){return Qt.map(t=>({value:t.name,label:_s[t.name],dangerous:t.dangerous}))}const Rs=D.memo(function(e){const n=le.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:c,totalToolsCount:i,onSelect:u,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let C;n[0]!==m?(C=Y("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=C):C=n[1];let d;n[2]!==r.icon||n[3]!==r.title?(d=s.jsx(zt,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=d):d=n[4];let v;n[5]!==r.title?(v=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=v):v=n[6];let g;n[7]!==u||n[8]!==d||n[9]!==v?(g=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:u,children:[d,v]}),n[7]=u,n[8]=d,n[9]=v,n[10]=g):g=n[10];let j;n[11]!==c||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(j=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",i]}),s.jsx(De,{checked:o,onCheckedChange:x,onClick:Ds})]}),n[11]=c,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=j):j=n[16];let b;return n[17]!==C||n[18]!==g||n[19]!==j?(b=s.jsxs("div",{className:C,children:[g,j]}),n[17]=C,n[18]=g,n[19]=j,n[20]=b):b=n[20],b}),Ps=D.memo(function(e){const n=le.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:c}=e,i=`tool-${r}-${l.name}`,u=o?"text-foreground":"text-muted-foreground";let x;n[0]!==u?(x=Y("text-sm font-medium",u),n[0]=u,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let C;n[5]!==l.description?(C=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=C):C=n[6];let d;n[7]!==m||n[8]!==C?(d=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,C]}),n[7]=m,n[8]=C,n[9]=d):d=n[9];const v=`tool-${r}-${l.name}`;let g;n[10]!==o||n[11]!==c||n[12]!==v?(g=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(De,{id:v,checked:o,onCheckedChange:c,onClick:zs})}),n[10]=o,n[11]=c,n[12]=v,n[13]=g):g=n[13];let j;return n[14]!==i||n[15]!==d||n[16]!==g?(j=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[d,g]}),n[14]=i,n[15]=d,n[16]=g,n[17]=j):j=n[17],j});function Ms({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[c,i]=D.useState("all"),[u,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),C=kt({searchTerm:o.trim()||void 0}),d=n?C.filter(h=>h.connection_type!=="VIRTUAL"?!0:Jt(h.connection_url)!==n):C,v=m.current,g=[...v.values()].map(h=>d.find(S=>S.id===h)).filter(h=>h!==void 0),j=d.filter(h=>!v.has(h.id)),b=[...g,...j],I=h=>{const S=t[h];return S!==void 0&&S.length>0},T=b.filter(h=>{if(c==="all")return!0;const S=I(h.id);return c==="selected"?S:c==="unselected"?!S:!0}),[f,O]=D.useState(b[0]?.id??null),N=f?b.find(h=>h.id===f)??null:null,P=N?.tools??[],A=(h,S)=>t[h]?.includes(S)??!1,R=(h,S)=>{const E=t[h]??[],p=E.includes(S),L={...t};if(p){const k=E.filter(G=>G!==S);k.length===0?delete L[h]:L[h]=k}else L[h]=[...E,S];e(L)},w=h=>{const S=b.find(G=>G.id===h);if(!S?.tools)return;const E=t[h]??[],p=S.tools.map(G=>G.name),L=E.length>0&&p.every(G=>E.includes(G)),k={...t};L?delete k[h]:(k[h]=p,O(h)),e(k)},M=h=>{O(h),x(!0)},_=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:Y("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[s.jsx(Ke,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:Y("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:Y("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:Y("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:T.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:T.map(h=>{const S=h.tools?.length??0,E=t[h.id]?.length??0;return s.jsx(Rs,{connection:h,isSelected:f===h.id,hasToolsEnabled:I(h.id),activeToolsCount:E,totalToolsCount:S,onSelect:()=>M(h.id),onToggle:()=>w(h.id)},h.id)})})})]}),s.jsx("div",{className:Y("flex-1 flex-col",u?"flex":"hidden md:flex"),children:N?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:_,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Kt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(zt,{icon:N.icon,name:N.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:N.title}),N.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:N.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(h=>s.jsx(Ps,{connectionId:N.id,tool:h,isSelected:A(N.id,h.name),onToggle:()=>R(N.id,h.name)},h.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Ds(t){return t.stopPropagation()}function zs(t){return t.stopPropagation()}const Lt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function ks(t){return t.replace(/-/g," ")}function Us(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let c=!1;for(const[i,u]of Object.entries(t)){if(i==="self"){u.includes("*")?n=!0:e.push(...u);continue}if(i==="*"){if(l=!0,u.includes("*"))c=!0;else for(const x of u)o.add(x);continue}if(r.push(i),u.includes("*"))c=!0;else for(const x of u)o.add(x)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:c}}function Nt(){const{locator:t}=Ce(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ce.organizationRoles(t),queryFn:async()=>{try{const i=await ae.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=Lt.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const u=i.role;if(!u||Lt.some(j=>j.value===u))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:C,allowsAllConnections:d,toolNames:v,allowsAllTools:g}=Us(i.permission);o.push({id:i.id,role:u,label:ks(u),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:d?-1:C.length,allowsAllConnections:d,toolCount:g?-1:v.length,allowsAllTools:g})}const c=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:c,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Vs=Et({role:Et({id:ve().optional(),slug:ve().optional(),label:ve()}),allowAllStaticPermissions:Xt(),staticPermissions:at(ve()),toolSet:Yt(ve(),at(ve())),memberIds:at(ve())});function Ht(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const Gs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Bs(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function Xe(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},memberIds:[]}}function $s(t){const e=le.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:c}=t,i=c===void 0?!1:c,[u,x]=D.useState(""),m=D.useDeferredValue(u);let C,d,v,g,j;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r){const T=ws(),f=Ls(),O=f.filter(_=>_.label.toLowerCase().includes(m.toLowerCase())),N=_=>{if(r.includes(_))o(r.filter(h=>h!==_));else{const h=[...r,_];h.length===f.length?(l(!0),o([])):o(h)}};v="flex flex-col h-full",e[12]!==u?(g=s.jsx("div",{className:"border-b border-border",children:s.jsx(Ke,{value:u,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=u,e[13]=g):g=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let A;e[14]!==P?(A=Y("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=A):A=e[15];let R;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(R=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=R):R=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=w):w=e[21];let M;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(M=s.jsx("div",{onClick:Hs,children:i?s.jsx(Le,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Ye,{checked:n,disabled:i,onCheckedChange:_=>{i||(l(_),o([]))}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Ye,{checked:n,disabled:i,onCheckedChange:_=>{i||(l(_),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=M):M=e[26],e[27]!==M||e[28]!==A||e[29]!==R?(j=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:A,onClick:R,children:[w,M]})}),e[27]=M,e[28]=A,e[29]=R,e[30]=j):j=e[30],C="flex-1 overflow-auto",d=Object.entries(T).map(_=>{const[h,S]=_,E=O.filter(p=>S.some(L=>L.name===p.value));return E.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:E.map(p=>s.jsxs("div",{className:Y("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const L=f.map(Qs);o(L.filter(k=>k!==p.value))}else N(p.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:p.label})}),s.jsx("div",{onClick:qs,children:i?s.jsx(Le,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(Ye,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const L=f.map(Ks);o(L.filter(k=>k!==p.value))}else N(p.value)}})})}),s.jsx(Me,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(Ye,{checked:n||r.includes(p.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const L=f.map(Fs);o(L.filter(k=>k!==p.value))}else N(p.value)}})})]},p.value))})]},h)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=C,e[8]=d,e[9]=v,e[10]=g,e[11]=j}else C=e[7],d=e[8],v=e[9],g=e[10],j=e[11];let b;e[31]!==C||e[32]!==d?(b=s.jsx("div",{className:C,children:d}),e[31]=C,e[32]=d,e[33]=b):b=e[33];let I;return e[34]!==v||e[35]!==g||e[36]!==j||e[37]!==b?(I=s.jsxs("div",{className:v,children:[g,j,b]}),e[34]=v,e[35]=g,e[36]=j,e[37]=b,e[38]=I):I=e[38],I}function Fs(t){return t.value}function Ks(t){return t.value}function qs(t){return t.stopPropagation()}function Qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){const e=le.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[c,i]=D.useState(""),u=D.useDeferredValue(c);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,C]=D.useState(x),{data:d}=bt();let v,g,j,b,I,T,f,O,N,P,A;if(e[1]!==d?.data?.members||e[2]!==u||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==c||e[8]!==l){const L=d?.data?.members??[];let k;e[20]!==u?(k=U=>{const a=u.toLowerCase();return U.user?.name?.toLowerCase().includes(a)||U.user?.email?.toLowerCase().includes(a)},e[20]=u,e[21]=k):k=e[21];const G=L.filter(k),q=Js;let Q;e[22]!==l?(Q=U=>l.includes(U),e[22]=l,e[23]=Q):Q=e[23];const H=Q;let Z;e[24]!==m?(Z=U=>{m.includes(U)?C(m.filter(a=>a!==U)):C([...m,U])},e[24]=m,e[25]=Z):Z=e[25];const se=Z;let X;e[26]!==o||e[27]!==r||e[28]!==m?(X=()=>{o(m),C([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=X):X=e[29],j=X,g=ze,P=n,A=r,v=ke,O="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Ue,{className:"px-6 pt-6",children:[s.jsx(Ve,{children:"Add Members to Role"}),s.jsx(Ge,{children:"Select members to add to this role."})]}),e[30]=N):N=e[30],T="flex flex-col h-80",e[31]!==c?(f=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=c,e[32]=f):f=e[32],b="flex-1 overflow-auto",I=G.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:G.map(U=>{const a=q(U),y=H(U.id),F=m.includes(U.id);return s.jsxs("label",{className:Y("flex items-center gap-3 p-2 rounded-lg",!a||y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(De,{checked:F||y,onCheckedChange:()=>{a&&!y&&se(U.id)},disabled:!a||y}),s.jsx(Ae,{url:U.user?.image??void 0,fallback:Ht(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!a&&s.jsx(Ee,{variant:"secondary",className:"shrink-0",children:"Owner"}),y&&a&&s.jsx(Ee,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=d?.data?.members,e[2]=u,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=c,e[8]=l,e[9]=v,e[10]=g,e[11]=j,e[12]=b,e[13]=I,e[14]=T,e[15]=f,e[16]=O,e[17]=N,e[18]=P,e[19]=A}else v=e[9],g=e[10],j=e[11],b=e[12],I=e[13],T=e[14],f=e[15],O=e[16],N=e[17],P=e[18],A=e[19];let R;e[33]!==b||e[34]!==I?(R=s.jsx("div",{className:b,children:I}),e[33]=b,e[34]=I,e[35]=R):R=e[35];let w;e[36]!==R||e[37]!==T||e[38]!==f?(w=s.jsxs("div",{className:T,children:[f,R]}),e[36]=R,e[37]=T,e[38]=f,e[39]=w):w=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx($e,{children:"Cancel"}),e[40]=M):M=e[40];const _=m.length===0,h=m.length>0&&`(${m.length})`;let S;e[41]!==j||e[42]!==_||e[43]!==h?(S=s.jsxs(Be,{className:"px-6 pb-6",children:[M,s.jsxs(Fe,{onClick:j,disabled:_,children:["Add ",h]})]}),e[41]=j,e[42]=_,e[43]=h,e[44]=S):S=e[44];let E;e[45]!==v||e[46]!==w||e[47]!==S||e[48]!==O||e[49]!==N?(E=s.jsxs(v,{className:O,children:[N,w,S]}),e[45]=v,e[46]=w,e[47]=S,e[48]=O,e[49]=N,e[50]=E):E=e[50];let p;return e[51]!==g||e[52]!==E||e[53]!==P||e[54]!==A?(p=s.jsx(g,{open:P,onOpenChange:A,children:E}),e[51]=g,e[52]=E,e[53]=P,e[54]=A,e[55]=p):p=e[55],p}function Js(t){return t.role!=="owner"}function Ys(t){const e=le.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[c,i]=D.useState(""),u=D.useDeferredValue(c),[x,m]=D.useState(!1),{data:C}=bt();let d,v,g,j,b;if(e[0]!==C?.data?.members||e[1]!==u||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==c){const O=C?.data?.members??[];let N;e[11]!==n?(N=E=>n.includes(E.id),e[11]=n,e[12]=N):N=e[12];const P=O.filter(N);let A;e[13]!==u?(A=E=>{const p=u.toLowerCase();return E.user?.name?.toLowerCase().includes(p)||E.user?.email?.toLowerCase().includes(p)},e[13]=u,e[14]=A):A=e[14];const R=P.filter(A);let w;e[15]!==n||e[16]!==r?(w=E=>{r(n.filter(p=>p!==E))},e[15]=n,e[16]=r,e[17]=w):w=e[17];const M=w;let _;e[18]!==n||e[19]!==r?(_=E=>{r([...n,...E])},e[18]=n,e[19]=r,e[20]=_):_=e[20],d=_,j="flex flex-col h-full";let h;e[21]!==c?(h=s.jsx(Ke,{value:c,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=c,e[22]=h):h=e[22];let S;e[23]!==o?(S=o?s.jsx("div",{className:"pr-4",children:s.jsx(Le,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(nt,{size:16}),"Add Member"]})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(nt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=S):S=e[24],e[25]!==h||e[26]!==S?(b=s.jsxs("div",{className:"flex items-center border-b border-border",children:[h,S]}),e[25]=h,e[26]=S,e[27]=b):b=e[27],v="flex-1 overflow-auto",g=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:R.map(E=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Ae,{url:E.user?.image??void 0,fallback:Ht(E.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:E.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.user?.email})]}),o?s.jsx(Le,{children:s.jsxs(Re,{children:[s.jsx(Pe,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(St,{size:16})})})}),s.jsx(Me,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(E.id),children:s.jsx(St,{size:16})})]},E.id))}),e[0]=C?.data?.members,e[1]=u,e[2]=n,e[3]=r,e[4]=o,e[5]=c,e[6]=d,e[7]=v,e[8]=g,e[9]=j,e[10]=b}else d=e[6],v=e[7],g=e[8],j=e[9],b=e[10];let I;e[28]!==v||e[29]!==g?(I=s.jsx("div",{className:v,children:g}),e[28]=v,e[29]=g,e[30]=I):I=e[30];let T;e[31]!==x||e[32]!==d||e[33]!==n?(T=s.jsx(Zs,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:d}),e[31]=x,e[32]=d,e[33]=n,e[34]=T):T=e[34];let f;return e[35]!==j||e[36]!==b||e[37]!==I||e[38]!==T?(f=s.jsxs("div",{className:j,children:[b,I,T]}),e[35]=j,e[36]=b,e[37]=I,e[38]=T,e[39]=f):f=e[39],f}function Xs(t){const e=le.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(Ys,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const Ws={owner:[],admin:[],user:[]};function We(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:Ws[t],toolSet:{},memberIds:r.map(l=>l.id)}}function en({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:c}=Ce(),i=_e(),u=kt()??[],{customRoles:x,refetch:m}=Nt(),{data:C}=it({queryKey:ce.members(c),queryFn:()=>ae.organization.listMembers()}),d=Dt({resolver:Wt(Vs),defaultValues:Xe()}),v=d.formState.isValid,g=d.formState.isDirty,[j,b]=D.useState(null),[I,T]=D.useState(null),f=!d.watch("role.id")&&!d.watch("role.slug")&&!I,[O,N]=D.useState(null),[P,A]=D.useState(!1),[R,w]=D.useState(null),M=a=>{const y=a.permission||{},F=y.self||[],me=F.includes("*"),te=me?[]:F.filter(V=>V!=="*"),W={};for(const[V,B]of Object.entries(y))if(V!=="self")if(V==="*")for(const J of u)B.includes("*")?W[J.id]=J.tools?.map(re=>re.name)??[]:W[J.id]=B;else{const J=u.find(re=>re.id===V);J&&(B.includes("*")?W[V]=J.tools?.map(re=>re.name)??[]:W[V]=B)}const de=(C?.data?.members??[]).filter(V=>V.role===a.role).map(V=>V.id);return{role:{id:a.id,slug:a.role,label:a.label},allowAllStaticPermissions:me,staticPermissions:te,toolSet:W,memberIds:de}},_=a=>{const y=M(a);d.reset(y),b(a.id??null),T(null)},h=()=>{d.reset(Xe()),b(null),T(null),o("mcp")},S=a=>{g&&v?(w(()=>()=>_(a)),A(!0)):_(a)},E=async()=>{g&&v&&await Z(),h()},p=a=>{if(g&&v)w(()=>()=>{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}),A(!0);else{const y=We(a,C?.data?.members??[]);d.reset(y),T(a),b(null),o("org")}},L=a=>{if(!a&&d.formState.isDirty&&v){w(()=>()=>{r(!1),d.reset(Xe()),T(null)}),A(!0);return}if(r(a),!a)d.reset(Xe()),T(null),b(null);else{const y=x[0];if(y)_(y);else{const F=We("user",C?.data?.members??[]);d.reset(F),T("user"),b(null),o("org")}}},k=()=>{A(!1),R&&(R(),w(null))},G=a=>{const y={};a.allowAllStaticPermissions?y.self=["*"]:a.staticPermissions.length>0&&(y.self=a.staticPermissions);for(const[F,me]of Object.entries(a.toolSet))if(me.length>0){const W=u.find(ee=>ee.id===F)?.tools?.map(ee=>ee.name)??[];W.length>0&&W.every(ee=>me.includes(ee))?y[F]=["*"]:y[F]=me}return y},q=Te({mutationFn:async a=>{const y=G(a),F=a.role.slug||a.role.label.toLowerCase().replace(/\s+/g,"-");if(a.role.slug&&!a.role.id){const W=(C?.data?.members??[]).filter(V=>V.role===a.role.slug).map(V=>V.id),ee=a.memberIds.filter(V=>!W.includes(V)),de=W.filter(V=>!a.memberIds.includes(V));for(const V of ee){const B=await ae.organization.updateMemberRole({memberId:V,role:[a.role.slug]});if(B?.error)throw new Error(B.error.message)}for(const V of de){const B=await ae.organization.updateMemberRole({memberId:V,role:["user"]});if(B?.error)throw new Error(B.error.message)}return a}else if(a.role.id){const te=await ae.organization.updateRole({roleId:a.role.id,data:{permission:y}});if(te?.error)throw new Error(te.error.message);const ee=(C?.data?.members??[]).filter(B=>B.role===a.role.slug).map(B=>B.id),de=a.memberIds.filter(B=>!ee.includes(B)),V=ee.filter(B=>!a.memberIds.includes(B));for(const B of de){const J=await ae.organization.updateMemberRole({memberId:B,role:[a.role.slug]});if(J?.error)throw new Error(J.error.message)}for(const B of V){const J=await ae.organization.updateMemberRole({memberId:B,role:["user"]});if(J?.error)throw new Error(J.error.message)}return a}else{const te=await ae.organization.createRole({role:F,permission:y});if(te?.error)throw new Error(te.error.message);for(const W of a.memberIds){const ee=await ae.organization.updateMemberRole({memberId:W,role:[F]});if(ee?.error)throw new Error(ee.error.message)}return{...a,role:{...a.role,id:te.data?.roleData?.id,slug:F}}}},onSuccess:(a,y)=>{i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)});const F=!y.role.id&&!y.role.slug,me=y.role.slug&&!y.role.id;ne.success(me?"Members updated successfully!":F?"Role created successfully!":"Role updated successfully!"),m(),d.reset(a),a.role.id&&b(a.role.id),e?.()},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to save role")}}),Q=Te({mutationFn:async a=>{const y=await ae.organization.deleteRole({roleId:a});if(y?.error)throw new Error(y.error.message);return y?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ce.members(c)}),i.invalidateQueries({queryKey:ce.organizationRoles(c)}),ne.success("Role deleted successfully!"),m(),O?.id===j){const a=x.filter(y=>y.id!==O?.id);if(a[0])_(a[0]);else{const y=We("user",C?.data?.members??[]);d.reset(y),T("user"),b(null),o("org")}}},onError:a=>{ne.error(a instanceof Error?a.message:"Failed to delete role")}}),H=q.isPending||Q.isPending,Z=async()=>{const a=d.getValues();if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}await q.mutateAsync(a)},se=d.handleSubmit(a=>{if(!a.role.label.trim()){ne.error("Role name is required"),d.setFocus("role.label");return}q.mutate(a)}),X=a=>{a.id&&N({id:a.id,label:a.label})},U=()=>{O?.id&&Q.mutate(O.id),N(null)};return s.jsxs(Ut,{open:n,onOpenChange:L,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsx(Gt,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[Gs.map(a=>{const y=I===a.role;return s.jsxs("div",{className:Y("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>p(a.role),children:[s.jsx("div",{className:Y("shrink-0 size-3 rounded-full",a.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsx(Cs,{size:14,className:"text-muted-foreground shrink-0"})]},a.role)}),x.map(a=>{const y=j===a.id;return s.jsxs("div",{className:Y("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",y?"bg-accent":"hover:bg-muted/50"),onClick:()=>S(a),children:[s.jsx("div",{className:Y("shrink-0 size-3 rounded-full",Bs(a.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:a.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:Y("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",y&&"opacity-100 pointer-events-auto"),onClick:F=>F.stopPropagation(),children:s.jsx(bs,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(tt,{className:"text-destructive",onClick:F=>{F.stopPropagation(),X(a)},children:[s.jsx(Bt,{size:16}),"Delete"]})})]})]},a.id)}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(js,{...d.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(Ee,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:E,disabled:H||g,className:"w-full h-10",children:[s.jsx(nt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!I&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:Y("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:Y("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:Y("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!I&&s.jsx(Ms,{toolSet:d.watch("toolSet"),onToolSetChange:a=>d.setValue("toolSet",a,{shouldDirty:!0})}),l==="org"&&s.jsx($s,{allowAllStaticPermissions:d.watch("allowAllStaticPermissions"),staticPermissions:d.watch("staticPermissions"),onAllowAllChange:a=>d.setValue("allowAllStaticPermissions",a,{shouldDirty:!0}),onPermissionsChange:a=>d.setValue("staticPermissions",a,{shouldDirty:!0}),readOnly:!!I}),l==="members"&&s.jsx(Xs,{memberIds:d.watch("memberIds"),onMemberIdsChange:a=>d.setValue("memberIds",a,{shouldDirty:!0}),readOnly:I==="owner"})]}),(!I||I!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>L(!1),disabled:H,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:se,disabled:H||!v||!d.formState.isDirty,className:"h-10",children:q.isPending?"Saving...":f?"Create Role":"Save Changes"})]})]})]})}),s.jsx(ze,{open:O!==null,onOpenChange:a=>!a&&N(null),children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Delete Role"}),s.jsxs(Ge,{children:['Are you sure you want to delete the "',O?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Be,{children:[s.jsx($e,{children:"Cancel"}),s.jsx(Fe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(ze,{open:P,onOpenChange:A,children:s.jsxs(ke,{children:[s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Discard Changes"}),s.jsx(Ge,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Be,{children:[s.jsx($e,{onClick:()=>w(null),children:"Keep Editing"}),s.jsx(Fe,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const tn=ve().email("Invalid email address");function sn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function nn({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=Ce(),l=_e(),{data:o}=ae.useSession(),c=o?.user?.email,{roles:i,isLoading:u}=Nt(),x=i.filter(T=>T.role!=="owner"),m=Dt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),C=m.watch("emailsText"),d=m.watch("role"),g=sn(C).filter(T=>{const f=tn.safeParse(T).success,O=!c||T!==c.toLowerCase();return f&&O}),j=Te({mutationFn:async({emails:T,role:f})=>{if(!f)throw new Error("Please select a role");const O=await Promise.allSettled(T.map(async P=>{const A=await ae.organization.inviteMember({email:P,role:f});if(A.error)throw new Error(A.error.message);return A.data})),N=O.filter(P=>P.status==="rejected");if(N.length>0)throw new Error(`Failed to invite ${N.length} member${N.length>1?"s":""}`);return O},onSuccess:(T,{emails:f})=>{l.invalidateQueries({queryKey:ce.members(r)}),l.invalidateQueries({queryKey:ce.invitations(r)}),ne.success(f.length===1?"Member invited successfully!":`${f.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:T=>{ne.error(T instanceof Error?T.message:"Failed to invite members")}}),b=T=>{if(g.length===0){ne.error("Please enter at least one valid email address");return}if(!T.role){ne.error("Please select a role");return}j.mutate({emails:g,role:T.role})},I=g.length>0&&!!d;return s.jsxs(Ut,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Gt,{className:"sm:max-w-lg",children:[s.jsx(ms,{children:s.jsx(us,{children:"Invite members"})}),s.jsx(vs,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(b),className:"space-y-4",children:[s.jsx(It,{control:m.control,name:"emailsText",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(Ns,{children:"Email addresses"}),s.jsx(At,{children:s.jsx(Es,{...T,disabled:j.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
- e.g. user1@example.com, user2@example.com
3
- or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(_t,{})]})}),s.jsx(It,{control:m.control,name:"role",render:({field:T})=>s.jsxs(Ot,{children:[s.jsx(At,{children:s.jsxs(ft,{value:T.value,onValueChange:T.onChange,disabled:j.isPending||u,children:[s.jsx(ht,{className:"w-full",children:s.jsx(gt,{placeholder:"Select a role"})}),s.jsx(xt,{children:x.map(f=>{const O=[];return f.isBuiltin||(f.allowsAllStaticPermissions?O.push("Full org access"):f.staticPermissionCount&&f.staticPermissionCount>0&&O.push(`${f.staticPermissionCount} org perm${f.staticPermissionCount!==1?"s":""}`),f.allowsAllConnections?O.push("All connections"):f.connectionCount&&f.connectionCount>0&&O.push(`${f.connectionCount} connection${f.connectionCount!==1?"s":""}`),(f.connectionCount!==0||f.allowsAllConnections)&&(f.allowsAllTools?O.push("all tools"):f.toolCount&&f.toolCount>0&&O.push(`${f.toolCount} tool${f.toolCount!==1?"s":""}`))),s.jsx(pt,{value:f.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:f.label}),!f.isBuiltin&&O.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:O.join(", ")})]})},f.role)})})]})}),s.jsx(_t,{})]})}),s.jsxs(fs,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:j.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:j.isPending||!I,children:j.isPending?"Inviting...":`Invite ${g.length||0} Member${g.length!==1?"s":""}`})]})]})})]})]})}function rn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ce.invitations(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(u.structuredContent??u)?.invitations??[]},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c},t[6]=o,t[7]=c,t[8]=i):i=t[8],es(i)}function on(){const t=le.c(5),{locator:e}=Ce(),n=_e();let r;t[0]!==e||t[1]!==n?(r={mutationFn:an,onSuccess:()=>{n.invalidateQueries({queryKey:ce.invitations(e)}),ne.success("Invitation cancelled")},onError:ln},t[0]=e,t[1]=n,t[2]=r):r=t[2];const l=Te(r);let o;return t[3]!==l?(o={cancel:l},t[3]=l,t[4]=o):o=t[4],o}function ln(t){ne.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function an(t){const e=await ae.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function cn(){const t=le.c(9),{org:e,locator:n}=Ce();let r;t[0]!==e.id?(r={connectionId:qe,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Qe(r);let o;t[2]!==n?(o=ce.tags(n),t[2]=n,t[3]=o):o=t[3];let c;t[4]!==l?(c=async()=>{const u=await l.callTool({name:"TAGS_LIST",arguments:{}});return(u.structuredContent??u).tags},t[4]=l,t[5]=c):c=t[5];let i;return t[6]!==o||t[7]!==c?(i={queryKey:o,queryFn:c,staleTime:3e4},t[6]=o,t[7]=c,t[8]=i):i=t[8],it(i)}function dn(){const t=le.c(10),e=_e(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const m=await o.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ce.tags(r)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:mn},t[7]=c,t[8]=i,t[9]=u):u=t[9],Te(u)}function mn(t){ne.error(t instanceof Error?t.message:"Failed to create tag")}function un(t){const e=le.c(12),{org:n,locator:r}=Ce();let l;e[0]!==n.id?(l={connectionId:qe,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const o=Qe(l);let c;e[2]!==r||e[3]!==t?(c=ce.memberTags(r,t),e[2]=r,e[3]=t,e[4]=c):c=e[4];let i;e[5]!==o||e[6]!==t?(i=async()=>{const m=await o.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=o,e[6]=t,e[7]=i):i=e[7];const u=!!t;let x;return e[8]!==c||e[9]!==i||e[10]!==u?(x={queryKey:c,queryFn:i,staleTime:3e4,enabled:u},e[8]=c,e[9]=i,e[10]=u,e[11]=x):x=e[11],it(x)}function fn(){const t=le.c(10),e=_e(),{org:n,locator:r}=Ce();let l;t[0]!==n.id?(l={connectionId:qe,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Qe(l);let c;t[2]!==o?(c=async x=>{const{memberId:m,tagIds:C}=x,d=await o.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:C}});return d.structuredContent??d},t[2]=o,t[3]=c):c=t[3];let i;t[4]!==r||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ce.memberTags(r,m.memberId)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let u;return t[7]!==c||t[8]!==i?(u={mutationFn:c,onSuccess:i,onError:hn},t[7]=c,t[8]=i,t[9]=u):u=t[9],Te(u)}function hn(t){ne.error(t instanceof Error?t.message:"Failed to update member tags")}function Zt(t){const e=le.c(44),{memberId:n,className:r,disabled:l,placeholder:o,maxDisplay:c}=t,i=l===void 0?!1:l,u=o===void 0?"Add tags...":o,x=c===void 0?2:c,[m,C]=D.useState(!1),[d,v]=D.useState(""),{data:g,isLoading:j}=cn(),b=g===void 0?[]:g,{data:I,isLoading:T}=un(n),f=I===void 0?[]:I,O=dn(),N=fn(),P=j||T,A=f.map(xn);let R;e[0]!==d?(R=K=>K.name.toLowerCase().includes(d.toLowerCase()),e[0]=d,e[1]=R):R=e[1];const w=b.filter(R);let M;e[2]!==d?(M=K=>K.name.toLowerCase()===d.toLowerCase(),e[2]=d,e[3]=M):M=e[3];const _=b.find(M),h=d.trim()&&!_,S=async K=>{const be=A.includes(K.id)?A.filter(ye=>ye!==K.id):[...A,K.id];await N.mutateAsync({memberId:n,tagIds:be})},E=async()=>{if(!d.trim())return;const K=await O.mutateAsync(d.trim());await N.mutateAsync({memberId:n,tagIds:[...A,K.id]}),v("")},p=async K=>{const ge=A.filter(be=>be!==K);await N.mutateAsync({memberId:n,tagIds:ge})},L=O.isPending||N.isPending,k=Is;let G;e[4]!==m?(G=()=>C(!m),e[4]=m,e[5]=G):G=e[5];let q;e[6]!==r?(q=Y("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",r),e[6]=r,e[7]=q):q=e[7];const Q=i||P,H=P?s.jsx(st,{size:14,className:"animate-spin text-muted-foreground"}):f.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[f.slice(0,x).map(gn),f.length>x&&s.jsxs(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",f.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:u});let Z;e[8]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(As,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Z):Z=e[8];let se;e[9]!==Q||e[10]!==H||e[11]!==G||e[12]!==q?(se=s.jsx(Os,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:G,className:q,disabled:Q,children:[H,Z]})}),e[9]=Q,e[10]=H,e[11]=G,e[12]=q,e[13]=se):se=e[13];const X=Ss,U="w-56 p-0",a="start";let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=()=>C(!1),e[14]=y):y=e[14];const F=cs,me=!1;let te;e[15]!==d?(te=s.jsx(ds,{placeholder:"Search or create...",value:d,onValueChange:v,className:"h-9"}),e[15]=d,e[16]=te):te=e[16];const W=as,ee=f.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(ct,{heading:"Selected",children:f.map(K=>s.jsx(dt,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]}),s.jsx("button",{onClick:ge=>{ge.stopPropagation(),p(K.id)},className:"opacity-50 hover:opacity-100",disabled:L,children:s.jsx(Ft,{size:14})})]})},K.id))}),s.jsx(yt,{})]}),de=ct,V="Available",B=w.length===0&&!h&&s.jsx(ls,{children:"No tags found."}),J=w.filter(K=>!A.includes(K.id)).map(K=>s.jsx(dt,{onSelect:()=>S(K),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:K.name})]})},K.id));let re;e[17]!==de||e[18]!==B||e[19]!==J?(re=s.jsxs(de,{heading:V,children:[B,J]}),e[17]=de,e[18]=B,e[19]=J,e[20]=re):re=e[20];let ue;e[21]!==E||e[22]!==L||e[23]!==d||e[24]!==h?(ue=h&&s.jsxs(s.Fragment,{children:[s.jsx(yt,{}),s.jsx(ct,{children:s.jsx(dt,{onSelect:E,className:"cursor-pointer",disabled:L,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[L?s.jsx(st,{size:14,className:"animate-spin"}):s.jsx(nt,{size:14}),s.jsxs("span",{children:['Create "',d.trim(),'"']})]})})})]}),e[21]=E,e[22]=L,e[23]=d,e[24]=h,e[25]=ue):ue=e[25];let pe;e[26]!==W||e[27]!==ee||e[28]!==re||e[29]!==ue?(pe=s.jsxs(W,{children:[ee,re,ue]}),e[26]=W,e[27]=ee,e[28]=re,e[29]=ue,e[30]=pe):pe=e[30];let fe;e[31]!==F||e[32]!==te||e[33]!==pe?(fe=s.jsxs(F,{shouldFilter:me,children:[te,pe]}),e[31]=F,e[32]=te,e[33]=pe,e[34]=fe):fe=e[34];let he;e[35]!==X||e[36]!==y||e[37]!==fe?(he=s.jsx(X,{className:U,align:a,onEscapeKeyDown:y,children:fe}),e[35]=X,e[36]=y,e[37]=fe,e[38]=he):he=e[38];let je;return e[39]!==k||e[40]!==m||e[41]!==se||e[42]!==he?(je=s.jsxs(k,{open:m,onOpenChange:C,children:[se,he]}),e[39]=k,e[40]=m,e[41]=se,e[42]=he,e[43]=je):je=e[43],je}function gn(t){return s.jsx(Ee,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function xn(t){return t.id}const Rt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],pn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function bn(t){const e=new Map;for(const[n,r]of Object.entries(pn))e.set(n,r);for(let n=0;n<t.length;n++){const r=t[n];r&&!e.has(r.role)&&e.set(r.role,Rt[n%Rt.length]??"bg-neutral-400")}return e}function Cn(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function et(t){const e=le.c(79),{role:n,memberId:r,isOwner:l,roleColorMap:o,selectableRoles:c,onRoleChange:i,size:u,className:x}=t,m=u===void 0?"xs":u;let C,d,v,g,j,b,I,T,f,O,N;if(e[0]!==x||e[1]!==l||e[2]!==r||e[3]!==i||e[4]!==n||e[5]!==o||e[6]!==c||e[7]!==m){N=Symbol.for("react.early_return_sentinel");e:{const E=o.get(n)??"bg-neutral-400";if(l){let p;e[19]!==r||e[20]!==i?(p=U=>i(r,U),e[19]=r,e[20]=i,e[21]=p):p=e[21];let L;e[22]!==n?(L=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=L):L=e[23];const k=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:Y("size-2 rounded-full shrink-0",E)}),L]});let G;e[24]!==k?(G=s.jsx(gt,{children:k}),e[24]=k,e[25]=G):G=e[25];let q;e[26]!==x||e[27]!==m||e[28]!==G?(q=s.jsx(ht,{size:m,className:x,children:G}),e[26]=x,e[27]=m,e[28]=G,e[29]=q):q=e[29];let Q;if(e[30]!==o||e[31]!==c){let U;e[33]!==o?(U=a=>{const y=o.get(a.role)??"bg-neutral-400";return s.jsx(pt,{value:a.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Y("size-3 rounded-full",y)}),s.jsx("span",{className:"capitalize",children:a.label})]})},a.role)},e[33]=o,e[34]=U):U=e[34],Q=c.map(U),e[30]=o,e[31]=c,e[32]=Q}else Q=e[32];let H;e[35]!==Q?(H=s.jsx(xt,{children:Q}),e[35]=Q,e[36]=H):H=e[36];let Z;e[37]!==l||e[38]!==n||e[39]!==p||e[40]!==q||e[41]!==H?(Z=s.jsx(Pe,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ft,{value:n,onValueChange:p,disabled:l,children:[q,H]})})}),e[37]=l,e[38]=n,e[39]=p,e[40]=q,e[41]=H,e[42]=Z):Z=e[42];let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(Me,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=se):se=e[43];let X;e[44]!==Z?(X=s.jsx(Le,{children:s.jsxs(Re,{children:[Z,se]})}),e[44]=Z,e[45]=X):X=e[45],N=X;break e}v=ft,T=n,e[46]!==r||e[47]!==i?(f=p=>i(r,p),e[46]=r,e[47]=i,e[48]=f):f=e[48],O=l,d=ht,b=m,I=x,C=gt,j="flex items-center gap-2 min-w-0",g=Y("size-2 rounded-full shrink-0",E)}e[0]=x,e[1]=l,e[2]=r,e[3]=i,e[4]=n,e[5]=o,e[6]=c,e[7]=m,e[8]=C,e[9]=d,e[10]=v,e[11]=g,e[12]=j,e[13]=b,e[14]=I,e[15]=T,e[16]=f,e[17]=O,e[18]=N}else C=e[8],d=e[9],v=e[10],g=e[11],j=e[12],b=e[13],I=e[14],T=e[15],f=e[16],O=e[17],N=e[18];if(N!==Symbol.for("react.early_return_sentinel"))return N;let P;e[49]!==g?(P=s.jsx("div",{className:g}),e[49]=g,e[50]=P):P=e[50];let A;e[51]!==n?(A=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=A):A=e[52];let R;e[53]!==P||e[54]!==A||e[55]!==j?(R=s.jsxs("div",{className:j,children:[P,A]}),e[53]=P,e[54]=A,e[55]=j,e[56]=R):R=e[56];let w;e[57]!==C||e[58]!==R?(w=s.jsx(C,{children:R}),e[57]=C,e[58]=R,e[59]=w):w=e[59];let M;e[60]!==d||e[61]!==w||e[62]!==b||e[63]!==I?(M=s.jsx(d,{size:b,className:I,children:w}),e[60]=d,e[61]=w,e[62]=b,e[63]=I,e[64]=M):M=e[64];let _;if(e[65]!==o||e[66]!==c){let E;e[68]!==o?(E=p=>{const L=o.get(p.role)??"bg-neutral-400";return s.jsx(pt,{value:p.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:Y("size-3 rounded-full",L)}),s.jsx("span",{className:"capitalize",children:p.label})]})},p.role)},e[68]=o,e[69]=E):E=e[69],_=c.map(E),e[65]=o,e[66]=c,e[67]=_}else _=e[67];let h;e[70]!==_?(h=s.jsx(xt,{children:_}),e[70]=_,e[71]=h):h=e[71];let S;return e[72]!==v||e[73]!==M||e[74]!==h||e[75]!==T||e[76]!==f||e[77]!==O?(S=s.jsxs(v,{value:T,onValueChange:f,disabled:O,children:[M,h]}),e[72]=v,e[73]=M,e[74]=h,e[75]=T,e[76]=f,e[77]=O,e[78]=S):S=e[78],S}function Pt(t){const e=le.c(51),{member:n,roles:r,onChangeRole:l,onRemove:o,isUpdating:c}=t,i=c===void 0?!1:c,u=n.role==="owner";let x,m,C,d,v,g,j,b,I;if(e[0]!==u||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==r){let M;e[15]!==n.role?(M=p=>p.role!==n.role&&p.role!=="owner",e[15]=n.role,e[16]=M):M=e[16];const _=r.filter(M);d=Ct;let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx($t,{size:20}),e[17]=h):h=e[17],e[18]!==u?(I=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:u,onClick:Tn,children:h})}),e[18]=u,e[19]=I):I=e[19],C=Tt,j="end",b=jn,m=hs;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(qt,{size:16}),e[20]=S):S=e[20],e[21]!==i?(g=s.jsxs(gs,{disabled:i,children:[S,"Change Role"]}),e[21]=i,e[22]=g):g=e[22],x=xs;let E;e[23]!==i||e[24]!==n.id||e[25]!==l?(E=p=>{const L=[];return p.isBuiltin||(p.allowsAllStaticPermissions?L.push("Full org access"):p.staticPermissionCount&&p.staticPermissionCount>0&&L.push(`${p.staticPermissionCount} org perm${p.staticPermissionCount!==1?"s":""}`),p.allowsAllConnections?L.push("All connections"):p.connectionCount&&p.connectionCount>0&&L.push(`${p.connectionCount} connection${p.connectionCount!==1?"s":""}`),(p.connectionCount!==0||p.allowsAllConnections)&&(p.allowsAllTools?L.push("all tools"):p.toolCount&&p.toolCount>0&&L.push(`${p.toolCount} tool${p.toolCount!==1?"s":""}`))),s.jsxs(tt,{onClick:k=>{k.stopPropagation(),l(n.id,p.role)},disabled:i,children:[p.isBuiltin?s.jsx(vt,{size:16}):s.jsx(ys,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:p.label}),!p.isBuiltin&&L.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:L.join(", ")})]})]},p.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=E):E=e[26],v=_.map(E),e[0]=u,e[1]=i,e[2]=n.id,e[3]=n.role,e[4]=l,e[5]=r,e[6]=x,e[7]=m,e[8]=C,e[9]=d,e[10]=v,e[11]=g,e[12]=j,e[13]=b,e[14]=I}else x=e[6],m=e[7],C=e[8],d=e[9],v=e[10],g=e[11],j=e[12],b=e[13],I=e[14];let T;e[27]!==x||e[28]!==v?(T=s.jsx(x,{children:v}),e[27]=x,e[28]=v,e[29]=T):T=e[29];let f;e[30]!==m||e[31]!==g||e[32]!==T?(f=s.jsxs(m,{children:[g,T]}),e[30]=m,e[31]=g,e[32]=T,e[33]=f):f=e[33];let O;e[34]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(ps,{}),e[34]=O):O=e[34];let N;e[35]!==n.id||e[36]!==o?(N=M=>{M.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=N):N=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Bt,{size:16}),e[38]=P):P=e[38];let A;e[39]!==N?(A=s.jsxs(tt,{variant:"destructive",onClick:N,children:[P,"Remove Member"]}),e[39]=N,e[40]=A):A=e[40];let R;e[41]!==C||e[42]!==A||e[43]!==j||e[44]!==b||e[45]!==f?(R=s.jsxs(C,{align:j,onClick:b,children:[f,O,A]}),e[41]=C,e[42]=A,e[43]=j,e[44]=b,e[45]=f,e[46]=R):R=e[46];let w;return e[47]!==d||e[48]!==R||e[49]!==I?(w=s.jsxs(d,{children:[I,R]}),e[47]=d,e[48]=R,e[49]=I,e[50]=w):w=e[50],w}function jn(t){return t.stopPropagation()}function Tn(t){return t.stopPropagation()}function Mt(t){const e=le.c(8),{invitationId:n,onCancel:r,isCancelling:l}=t,o=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Nn,children:s.jsx($t,{size:20})})}),e[0]=c):c=e[0];let i;e[1]!==n||e[2]!==r?(i=m=>{m.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=i):i=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ft,{size:16}),e[4]=u):u=e[4];let x;return e[5]!==o||e[6]!==i?(x=s.jsxs(Ct,{children:[c,s.jsx(Tt,{align:"end",onClick:vn,children:s.jsxs(tt,{variant:"destructive",onClick:i,disabled:o,children:[u,"Cancel Invitation"]})})]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function vn(t){return t.stopPropagation()}function Nn(t){return t.stopPropagation()}function En(){const t=le.c(79),{data:e}=bt(),{data:n}=rn(),r=on(),l=_e(),{locator:o}=Ce(),[c,i]=D.useState(null),[u,x]=D.useState(null),[m,C]=D.useState(""),[d,v]=D.useState("table"),[g,j]=D.useState("member"),[b,I]=D.useState("asc"),T=e?.data?.members;let f;t[0]!==g?(f=z=>{g===z?I(kn):(j(z),I("asc"))},t[0]=g,t[1]=f):f=t[1];const O=f;let N=T??[],P=n??[];if(m){const z=m.toLowerCase();N=N.filter($=>$.user?.name?.toLowerCase().includes(z)||$.user?.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z)),P=P.filter($=>$.email?.toLowerCase().includes(z)||$.role?.toLowerCase().includes(z))}if(g&&b){let z;t[2]!==b||t[3]!==g?(z=($,oe)=>{let xe,we;e:switch(g){case"member":{xe=$.user?.name||"",we=oe.user?.name||"";break e}case"role":{xe=$.role||"",we=oe.role||"";break e}case"joined":{xe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",we=oe.createdAt?typeof oe.createdAt=="string"?oe.createdAt:oe.createdAt.toISOString():"";break e}default:return 0}return b==="asc"?xe.localeCompare(we):we.localeCompare(xe)},t[2]=b,t[3]=g,t[4]=z):z=t[4],N=[...N].sort(z)}const A=N;let R;t[5]!==o||t[6]!==l?(R={mutationFn:zn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.members(o)}),ne.success("Member has been removed from the organization"),i(null)},onError:Dn},t[5]=o,t[6]=l,t[7]=R):R=t[7];const w=Te(R);let M;t[8]!==o||t[9]!==l?(M={mutationFn:Mn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.members(o)}),ne.success("Member's role has been updated")},onError:Pn},t[8]=o,t[9]=l,t[10]=M):M=t[10];const _=Te(M);let h;t[11]!==o||t[12]!==l?(h={mutationFn:Rn,onSuccess:()=>{l.invalidateQueries({queryKey:ce.invitations(o)}),ne.success("Invitation role has been updated")},onError:Ln},t[11]=o,t[12]=l,t[13]=h):h=t[13];const S=Te(h),{roles:E,customRoles:p}=Nt();let L;t[14]!==p?(L=bn(p),t[14]=p,t[15]=L):L=t[15];const k=L;let G;t[16]!==E?(G=E.filter(wn),t[16]=E,t[17]=G):G=t[17];const q=G;let Q;t[18]===Symbol.for("react.memo_cache_sentinel")?(Q={id:"member",header:"Member",render:_n,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=Q):Q=t[18];let H;t[19]!==k||t[20]!==q||t[21]!==S||t[22]!==_?(H={id:"role",header:"Role",render:z=>z.type==="member"?s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:z.data.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>_.mutate({memberId:$,role:oe}),className:"w-36"}):s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:($,oe)=>S.mutate({invitationId:$,role:oe,email:z.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=k,t[20]=q,t[21]=S,t[22]=_,t[23]=H):H=t[23];let Z,se;t[24]===Symbol.for("react.memo_cache_sentinel")?(Z={id:"tags",header:"Tags",render:An,cellClassName:"w-40 shrink-0"},se={id:"joined",header:"Joined",render:On,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=Z,t[25]=se):(Z=t[24],se=t[25]);let X;t[26]!==r.cancel.isPending||t[27]!==E||t[28]!==_?(X={id:"actions",header:"",render:z=>z.type==="member"?s.jsx(Pt,{member:z.data,roles:E,onChangeRole:($,oe)=>_.mutate({memberId:$,role:oe}),onRemove:i,isUpdating:_.isPending}):s.jsx(Mt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=r.cancel.isPending,t[27]=E,t[28]=_,t[29]=X):X=t[29];let U;t[30]!==X||t[31]!==H?(U=[Q,H,Z,se,X],t[30]=X,t[31]=H,t[32]=U):U=t[32];const a=U;let y;t[33]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(en,{trigger:s.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(vt,{size:16}),"Manage Roles"]})}),t[33]=y):y=t[33];let F;t[34]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs("div",{className:"flex items-center gap-2",children:[y,s.jsx(nn,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=F):F=t[34];const me=F,te=[...A.map(In),...P.filter(Sn).map(yn)],W=Ne,ee=!!u;let de;t[35]===Symbol.for("react.memo_cache_sentinel")?(de=()=>x(null),t[35]=de):de=t[35];let V;t[36]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Cancel Invitation"}),s.jsx(Ge,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[36]=V):V=t[36];let B;t[37]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx($e,{children:"Keep Invitation"}),t[37]=B):B=t[37];let J;t[38]!==r.cancel||t[39]!==u?(J=()=>{u&&(r.cancel.mutate(u),x(null))},t[38]=r.cancel,t[39]=u,t[40]=J):J=t[40];let re;t[41]!==r.cancel.isPending||t[42]!==J?(re=s.jsxs(ke,{children:[V,s.jsxs(Be,{children:[B,s.jsx(Fe,{onClick:J,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=r.cancel.isPending,t[42]=J,t[43]=re):re=t[43];let ue;t[44]!==ee||t[45]!==re?(ue=s.jsx(ze,{open:ee,onOpenChange:de,children:re}),t[44]=ee,t[45]=re,t[46]=ue):ue=t[46];const pe=!!c;let fe;t[47]===Symbol.for("react.memo_cache_sentinel")?(fe=()=>i(null),t[47]=fe):fe=t[47];let he;t[48]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsxs(Ue,{children:[s.jsx(Ve,{children:"Remove Member"}),s.jsx(Ge,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=he):he=t[48];let je;t[49]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx($e,{children:"Cancel"}),t[49]=je):je=t[49];let K;t[50]!==c||t[51]!==w?(K=()=>c&&w.mutate(c),t[50]=c,t[51]=w,t[52]=K):K=t[52];let ge;t[53]!==w.isPending||t[54]!==K?(ge=s.jsxs(ke,{children:[he,s.jsxs(Be,{children:[je,s.jsx(Fe,{onClick:K,disabled:w.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=w.isPending,t[54]=K,t[55]=ge):ge=t[55];let be;t[56]!==pe||t[57]!==ge?(be=s.jsx(ze,{open:pe,onOpenChange:fe,children:ge}),t[56]=pe,t[57]=ge,t[58]=be):be=t[58];let ye;t[59]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(Ne.Header.Left,{children:s.jsx(ns,{children:s.jsx(rs,{children:s.jsx(is,{children:s.jsx(os,{children:"Members"})})})})}),t[59]=ye):ye=t[59];let He;t[60]===Symbol.for("react.memo_cache_sentinel")?(He=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=He):He=t[60];let Se;t[61]!==O||t[62]!==b||t[63]!==g||t[64]!==d?(Se=s.jsxs(Ne.Header,{children:[ye,s.jsxs(Ne.Header.Right,{children:[s.jsx(ts,{viewMode:d,onViewModeChange:v,sortKey:g,sortDirection:b,onSort:O,sortOptions:He}),me]})]}),t[61]=O,t[62]=b,t[63]=g,t[64]=d,t[65]=Se):Se=t[65];let Ze;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ze=z=>{z.key==="Escape"&&(C(""),z.target.blur())},t[66]=Ze):Ze=t[66];let Ie;t[67]!==m?(Ie=s.jsx(Ke,{value:m,onChange:C,placeholder:"Search members...",onKeyDown:Ze}),t[67]=m,t[68]=Ie):Ie=t[68];const ot=Ne,lt=d==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:te.length===0?s.jsx(mt,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(z=>{if(z.type==="invitation")return s.jsxs(wt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Mt,{invitationId:z.data.id,onCancel:x,isCancelling:r.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{fallback:rt(z.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:z.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ee,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(et,{role:z.data.role,memberId:z.data.id,isOwner:!1,roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>S.mutate({invitationId:oe,role:xe,email:z.data.email}),className:"w-fit"})]})]})]},`inv-${z.data.id}`);const $=z.data;return s.jsxs(wt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Pt,{member:$,roles:E,onChangeRole:(oe,xe)=>_.mutate({memberId:oe,role:xe}),onRemove:i,isUpdating:_.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ae,{url:$.user?.image??void 0,fallback:rt($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),s.jsx(et,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:k,selectableRoles:q,onRoleChange:(oe,xe)=>_.mutate({memberId:oe,role:xe}),className:"w-fit"}),s.jsx(Zt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ss,{columns:a,data:te,isLoading:!1,sortKey:g,sortDirection:b,onSort:O,emptyState:m?s.jsx(mt,{title:"No members found",description:`No members match "${m}"`}):s.jsx(mt,{title:"No members found",description:"Invite members to get started."})});let Oe;t[69]!==ot.Content||t[70]!==lt?(Oe=s.jsx(ot.Content,{children:lt}),t[69]=ot.Content,t[70]=lt,t[71]=Oe):Oe=t[71];let Je;return t[72]!==W||t[73]!==ue||t[74]!==be||t[75]!==Se||t[76]!==Ie||t[77]!==Oe?(Je=s.jsxs(W,{children:[ue,be,Se,Ie,Oe]}),t[72]=W,t[73]=ue,t[74]=be,t[75]=Se,t[76]=Ie,t[77]=Oe,t[78]=Je):Je=t[78],Je}function yn(t){return{type:"invitation",data:t}}function Sn(t){return t.status==="pending"}function In(t){return{type:"member",data:t}}function On(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?Cn(t.data.createdAt):"N/A"}):s.jsx(Ee,{variant:"outline",children:"Pending"})}function An(t){return t.type==="member"?s.jsx(Zt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function _n(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{url:t.data.user?.image??void 0,fallback:rt(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{fallback:rt(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function wn(t){return t.role!=="owner"}function Ln(t){ne.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Rn(t){const{invitationId:e,role:n,email:r}=t,l=await ae.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const o=await ae.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function Pn(t){ne.error(t instanceof Error?t.message:"Failed to update role")}async function Mn(t){const{memberId:e,role:n}=t,r=await ae.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function Dn(t){ne.error(t instanceof Error?t.message:"Failed to remove member")}async function zn(t){const e=await ae.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function kn(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Lr(){const t=le.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ne,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ts,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(Ne,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(st,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(En,{})})}),t[1]=n):n=t[1],n}export{Lr as default};
@@ -1 +0,0 @@
1
- import{c as b,j as s,r as A,u as ne,g as oe,t as ee}from"./index-D5tmQFLM.js";import{V as ae,C as g}from"./index-BN26Duct.js";import{T as ce,i as me,a as de,t as fe}from"./typewriter-title-DESUJewE.js";import{E as ue}from"./error-boundary-DRPYIYcG.js";import{u as Z,S as Y}from"./use-deco-chat-open-C4c4LN3K.js";import{I as te,T as J,a as Q,b as X}from"./integration-icon-W7oxbRNq.js";import{P as pe,a as he,b as xe}from"./popover-BnV2Ekkf.js";import{c as se}from"./utils-63Yxgxyo.js";import{i as ge,d as je}from"./constants-BQDDq09c.js";import{b as be}from"./use-virtual-mcp-CK08RGTF.js";import{i as ye}from"./ChevronRight-in3TmXpP.js";import{t as le}from"./Users03-Chku9Yx2.js";import{P as E}from"./index-Bq-YlXEQ.js";import{B as H}from"./button-CIJQcfm2.js";import{c as Ne}from"./Pin01-D3bkVyHA.js";import{s as _e}from"./Plus-BhKqidCj.js";import{i as Se}from"./Share07-BUD3TbCH.js";import"./X-2IB63Q0x.js";import"./spinner-RsSCOmvl.js";import"./use-mcp-prompts-IDdNIVsz.js";import"./useQuery-C7wGFtkw.js";import"./dialog-Dn-qFsZM.js";import"./form-CfZFG_36.js";import"./input-BPn8NjNN.js";import"./AlertCircle-B2r4RYCl.js";import"./ArrowUp-DL3E-1B5.js";import"./ChevronDown-B9Mxx2fi.js";import"./Edit01-DUGutI3c.js";import"./Check-VEx1ONnd.js";import"./Copy01-JjoULgm7.js";import"./Terminal-CI6nX2Ah.js";import"./monaco-editor-CXE6czoW.js";import"./localstorage-keys-D5oAXPM1.js";import"./useMutation-CapnNHWF.js";import"./empty-state-Bu5U3yVT.js";import"./use-connection-BSXprdTB.js";import"./generate-id-Dyweu44Y.js";import"./SearchMd-DZNqxRa2.js";import"./Trash01-SLyaMDks.js";import"./badge-B4Hap73o.js";import"./Code01-QyeCluYo.js";import"./infiniteQueryObserver-CraWSqSX.js";import"./use-create-virtual-mcp-Ca9rNRBg.js";import"./use-binding-DMMSXp8M.js";import"./binder-BMOA5_jw.js";import"./select-iLE4SSQV.js";import"./index-9tcRb7FE.js";import"./File06-DCxDcy-i.js";import"./Grid01-DQKfO4pL.js";import"./Image01-CURk6BcD.js";function ve(e){const t=b.c(15),{agent:l}=e,{setVirtualMcpId:p}=Z();let r;t[0]!==l.id||t[1]!==p?(r=()=>{p(l.id)},t[0]=l.id,t[1]=p,t[2]=r):r=t[2];const i=r;let m;t[3]===Symbol.for("react.memo_cache_sentinel")?(m=se("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=m):m=t[3];const d=`Select agent ${l.title}`;let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(le,{size:20}),t[4]=n):n=t[4];let c;t[5]!==l.icon||t[6]!==l.title?(c=s.jsx(te,{icon:l.icon,name:l.title,fallbackIcon:n}),t[5]=l.icon,t[6]=l.title,t[7]=c):c=t[7];let o;t[8]!==l.title?(o=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:l.title}),t[8]=l.title,t[9]=o):o=t[9];let a;return t[10]!==i||t[11]!==d||t[12]!==c||t[13]!==o?(a=s.jsxs("button",{type:"button",onClick:i,className:m,"aria-label":d,children:[c,o]}),t[10]=i,t[11]=d,t[12]=c,t[13]=o,t[14]=a):a=t[14],a}function Ce(e){const t=b.c(14),{virtualMcps:l,selectedVirtualMcpId:p,onVirtualMcpChange:r}=e,[i,m]=A.useState(!1),d=A.useRef(null);let n,c;t[0]!==i?(n=()=>{i&&setTimeout(()=>{d.current?.focus()},0)},c=[i],t[0]=i,t[1]=n,t[2]=c):(n=t[1],c=t[2]),A.useEffect(n,c);let o;t[3]!==r?(o=y=>{r(y),m(!1)},t[3]=r,t[4]=o):o=t[4];const a=o;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=se("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(pe,{asChild:!0,children:s.jsxs("button",{type:"button",className:f,"aria-label":"See all agents",children:[s.jsx("div",{className:"size-12 rounded-lg bg-accent flex items-center justify-center shrink-0",children:s.jsx(ye,{size:24,className:"text-foreground"})}),s.jsx("p",{className:"text-sm text-foreground text-center leading-tight",children:"See all"})]})}),t[6]=u):u=t[6];let h;t[7]!==a||t[8]!==p||t[9]!==l?(h=s.jsx(he,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(ae,{virtualMcps:l,selectedVirtualMcpId:p,onVirtualMcpChange:a,searchInputRef:d})}),t[7]=a,t[8]=p,t[9]=l,t[10]=h):h=t[10];let j;return t[11]!==i||t[12]!==h?(j=s.jsxs(xe,{open:i,onOpenChange:m,children:[u,h]}),t[11]=i,t[12]=h,t[13]=j):j=t[13],j}function we(){const e=b.c(20),t=be(),{selectedVirtualMcp:l,setVirtualMcpId:p}=Z();let r,i,m,d,n,c;if(e[0]!==t){n=Symbol.for("react.early_return_sentinel");e:{const h=t.filter(ze).slice(0,6);if(h.length===0){n=null;break e}c=t.map(Te),m="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=d):d=e[7],r="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",i=h.map(ke)}e[0]=t,e[1]=r,e[2]=i,e[3]=m,e[4]=d,e[5]=n,e[6]=c}else r=e[1],i=e[2],m=e[3],d=e[4],n=e[5],c=e[6];if(n!==Symbol.for("react.early_return_sentinel"))return n;const o=l?.id??null;let a;e[8]!==p||e[9]!==o||e[10]!==c?(a=s.jsx(Ce,{virtualMcps:c,selectedVirtualMcpId:o,onVirtualMcpChange:p}),e[8]=p,e[9]=o,e[10]=c,e[11]=a):a=e[11];let f;e[12]!==r||e[13]!==i||e[14]!==a?(f=s.jsxs("div",{className:r,children:[i,a]}),e[12]=r,e[13]=i,e[14]=a,e[15]=f):f=e[15];let u;return e[16]!==m||e[17]!==d||e[18]!==f?(u=s.jsxs("div",{className:m,children:[d,f]}),e[16]=m,e[17]=d,e[18]=f,e[19]=u):u=e[19],u}function ke(e){return s.jsx(ve,{agent:e},e.id??"default")}function Te(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function ze(e){return e.id!==null&&!ge(e.id)}function Me(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Y,{className:"h-5 w-40 mb-4"}),e[0]=t):t=e[0];let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"w-full max-w-[800px]",children:[t,s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",children:Array.from({length:7}).map(Ie)})]}),e[1]=l):l=e[1],l}function Ie(e,t){return s.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 self-stretch",children:[s.jsx(Y,{className:"size-6 rounded-md shrink-0"}),s.jsx(Y,{className:"h-4 w-full"})]},t)}function Pe(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(A.Suspense,{fallback:s.jsx(Me,{}),children:s.jsx(we,{})}),e[0]=t):t=e[0],t}function $e(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function Ve(){const e=b.c(61),{org:t}=ne(),{data:l}=oe.useSession(),{modelsConnections:p,isChatEmpty:r,activeThreadId:i,createThread:m,switchToThread:d,threads:n,selectedVirtualMcp:c}=Z();let o;if(e[0]!==i||e[1]!==n){let x;e[3]!==i?(x=re=>re.id===i,e[3]=i,e[4]=x):x=e[4],o=n.find(x),e[0]=i,e[1]=n,e[2]=o}else o=e[2];const a=o,[f,u]=A.useState(!1);let h;e[5]!==l?.user?.name?(h=l?.user?.name?.split(" ")[0]||"there",e[5]=l?.user?.name,e[6]=h):h=e[6];const j=h;let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=$e(),e[7]=y):y=e[7];const ie=y;let R;e[8]!==t.id?(R=je(t.id),e[8]=t.id,e[9]=R):R=e[9];const B=c??R;if(p.length===0){let x;return e[10]!==t?(x=s.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:s.jsx(g.NoLlmBindingEmptyState,{org:t})}),e[10]=t,e[11]=x):x=e[11],x}let N;e[12]!==a?(N=a?.title&&s.jsx(ce,{text:a.title,className:"text-sm font-medium text-foreground"}),e[12]=a,e[13]=N):N=e[13];let _;e[14]!==N?(_=s.jsx(E.Header.Left,{className:"gap-2",children:N}),e[14]=N,e[15]=_):_=e[15];let S;e[16]!==m?(S=()=>m(),e[16]=m,e[17]=S):S=e[17];let L;e[18]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(_e,{size:16}),e[18]=L):L=e[18];let v;e[19]!==r||e[20]!==S?(v=s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:S,disabled:r,"aria-label":"New chat",children:L})}),e[19]=r,e[20]=S,e[21]=v):v=e[21];let O;e[22]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Q,{children:"New chat"}),e[22]=O):O=e[22];let C;e[23]!==v?(C=s.jsxs(X,{children:[v,O]}),e[23]=v,e[24]=C):C=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=()=>u(!0),e[25]=D):D=e[25];let F;e[26]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs(X,{children:[s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:D,"aria-label":"Chat history",children:s.jsx(me,{size:16})})}),s.jsx(Q,{children:"Chat history"})]}),e[26]=F):F=e[26];let W;e[27]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Ne,{size:16}),e[27]=W):W=e[27];let w;e[28]!==r?(w=s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ee,disabled:r,"aria-label":"Pin chat",children:W})}),e[28]=r,e[29]=w):w=e[29];let q;e[30]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Q,{children:"Pin chat"}),e[30]=q):q=e[30];let k;e[31]!==w?(k=s.jsxs(X,{children:[w,q]}),e[31]=w,e[32]=k):k=e[32];let G;e[33]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(Se,{size:16}),e[33]=G):G=e[33];let T;e[34]!==r?(T=s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ae,disabled:r,"aria-label":"Share chat",children:G})}),e[34]=r,e[35]=T):T=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Q,{children:"Share chat"}),e[36]=K):K=e[36];let z;e[37]!==T?(z=s.jsxs(X,{children:[T,K]}),e[37]=T,e[38]=z):z=e[38];let M;e[39]!==C||e[40]!==k||e[41]!==z?(M=s.jsxs(E.Header.Right,{className:"gap-1",children:[C,F,k,z]}),e[39]=C,e[40]=k,e[41]=z,e[42]=M):M=e[42];let I;e[43]!==M||e[44]!==_?(I=s.jsxs(E.Header,{className:"flex-none z-10 bg-background",children:[_,M]}),e[43]=M,e[44]=_,e[45]=I):I=e[45];let P;e[46]!==B||e[47]!==r||e[48]!==j?(P=r?s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(te,{icon:B.icon,name:B.title,size:"md",fallbackIcon:s.jsx(le,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-foreground",children:[ie," ",j,","]}),s.jsx("p",{className:"text-base text-muted-foreground opacity-50 mb-0",children:"What are we building today?"})]}),s.jsx("div",{className:"w-full -mt-1",children:s.jsx(g.Input,{})}),s.jsx(g.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(Pe,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(g.Main,{children:s.jsx(g.Messages,{})}),s.jsx(g.Footer,{children:s.jsx(g.Input,{})})]}),e[46]=B,e[47]=r,e[48]=j,e[49]=P):P=e[49];let $;e[50]!==d?($=async x=>{await d(x),u(!1)},e[50]=d,e[51]=$):$=e[51];let V;e[52]!==i||e[53]!==f||e[54]!==$||e[55]!==n?(V=s.jsx(de,{open:f,onOpenChange:u,threads:n,activeThreadId:i,onThreadSelect:$}),e[52]=i,e[53]=f,e[54]=$,e[55]=n,e[56]=V):V=e[56];let U;return e[57]!==I||e[58]!==P||e[59]!==V?(U=s.jsxs(g,{className:"bg-background",children:[I,P,V]}),e[57]=I,e[58]=P,e[59]=V,e[60]=U):U=e[60],U}function Ae(){ee.info("Share feature coming soon")}function Ee(){ee.info("Pin feature coming soon")}function He(e){const t=b.c(14),{error:l,onRetry:p}=e,r=l?.message?.includes("401")||l?.message?.toLowerCase().includes("unauthorized");let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(E.Header,{className:"flex-none",children:[s.jsx(E.Header.Left,{className:"gap-2"}),s.jsx(E.Header.Right,{className:"gap-1"})]}),t[0]=i):i=t[0];let m;t[1]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(fe,{className:"h-6 w-6 text-destructive"})}),t[1]=m):m=t[1];const d=r?"Unable to load models":"Something went wrong";let n;t[2]!==d?(n=s.jsx("h3",{className:"text-lg font-medium",children:d}),t[2]=d,t[3]=n):n=t[3];const c=r?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":l?.message||"An unexpected error occurred";let o;t[4]!==c?(o=s.jsx("p",{className:"text-sm text-muted-foreground",children:c}),t[4]=c,t[5]=o):o=t[5];let a;t[6]!==n||t[7]!==o?(a=s.jsxs("div",{className:"space-y-2",children:[n,o]}),t[6]=n,t[7]=o,t[8]=a):a=t[8];let f;t[9]!==p?(f=s.jsx(H,{variant:"outline",onClick:p,children:"Try again"}),t[9]=p,t[10]=f):f=t[10];let u;return t[11]!==a||t[12]!==f?(u=s.jsxs(g,{className:"bg-background",children:[i,s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:s.jsxs("div",{className:"max-w-sm space-y-4",children:[m,a,f]})})]}),t[11]=a,t[12]=f,t[13]=u):u=t[13],u}function Et(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(ue,{fallback:Re,children:s.jsx(A.Suspense,{fallback:s.jsx(g.Skeleton,{className:"bg-background"}),children:s.jsx(Ve,{})})}),e[0]=t):t=e[0],t}function Re(e){const{error:t,resetError:l}=e;return s.jsx(He,{error:t,onRetry:l})}export{Et as default};