@decocms/mesh 2.72.1 → 2.74.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 (171) hide show
  1. package/dist/client/assets/{AlertCircle-BOIQEKjW.js → AlertCircle-C_hR5usO.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-BRclUYsx.js → ArrowUp-DnJUZ1OS.js} +1 -1
  3. package/dist/client/assets/{Calendar-DydX5uRn.js → Calendar-Dnf0_EY9.js} +1 -1
  4. package/dist/client/assets/{Check-Bkb61eVw.js → Check-Sa4xK5Hg.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-ZkjIkaWv.js → CheckCircle-DRhauZbp.js} +1 -1
  6. package/dist/client/assets/{CheckDone01-BusS8ANA.js → CheckDone01-I6GfoGdi.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-DqJTvBdv.js → ChevronDown-DmXLJeAy.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-BBcOJkyP.js → ChevronRight-By4KEpZh.js} +1 -1
  9. package/dist/client/assets/{Code01-DEMYMNLO.js → Code01-h_k8K-1e.js} +1 -1
  10. package/dist/client/assets/{Copy01-BvgMlJ5t.js → Copy01-jvqvZrKj.js} +1 -1
  11. package/dist/client/assets/{DotsHorizontal-C3Pu-YCA.js → DotsHorizontal-CQJNqVgu.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DMOP2SMU.js → DotsVertical-gLXmVMYI.js} +1 -1
  13. package/dist/client/assets/{Download01-VwSgop8U.js → Download01-BKmVPJWY.js} +1 -1
  14. package/dist/client/assets/{Edit01-ByF-cYbh.js → Edit01-BT8zEtQL.js} +1 -1
  15. package/dist/client/assets/{File02-D6OcKUS4.js → File02-BNE7fmK0.js} +1 -1
  16. package/dist/client/assets/{File06-CkTcogsG.js → File06-WU23pV9H.js} +1 -1
  17. package/dist/client/assets/{FilterLines-BL17m8OO.js → FilterLines-DJEB3mgx.js} +1 -1
  18. package/dist/client/assets/{Globe02-CwdZK2H5.js → Globe02-Dp5eUbS2.js} +1 -1
  19. package/dist/client/assets/{Grid01-zbmmdox0.js → Grid01-CSAsqBFD.js} +1 -1
  20. package/dist/client/assets/{Home02-DPzckV1r.js → Home02-BUr926Eo.js} +1 -1
  21. package/dist/client/assets/{Image01-BuXlAy8i.js → Image01-BnbXZOf7.js} +1 -1
  22. package/dist/client/assets/{Inbox01-Czow08Bp.js → Inbox01-XFeiQPbg.js} +1 -1
  23. package/dist/client/assets/{InfoCircle-C8GtqndP.js → InfoCircle-5xWfOa8P.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-DJasjN8P.js → LinkExternal01-BJLPX8tt.js} +1 -1
  25. package/dist/client/assets/{List-BvAv-Mbv.js → List-kXpaJIIp.js} +1 -1
  26. package/dist/client/assets/{Loading01-DOPFYU4m.js → Loading01-D8zw0cyg.js} +1 -1
  27. package/dist/client/assets/{Lock01-BALKEl0l.js → Lock01-DCDiY4HG.js} +1 -1
  28. package/dist/client/assets/{Pin01-Dk_x7uai.js → Pin01-DWsvacVo.js} +1 -1
  29. package/dist/client/assets/{Play-CjfPPVn_.js → Play-Yhg_pcqU.js} +1 -1
  30. package/dist/client/assets/{Plus-WaQ7hmj5.js → Plus-BBD2SckJ.js} +1 -1
  31. package/dist/client/assets/{SearchMd-Ds-ERWzq.js → SearchMd-CGuwiAQe.js} +1 -1
  32. package/dist/client/assets/{Settings01-CMNXJNnf.js → Settings01-D7-sGWon.js} +1 -1
  33. package/dist/client/assets/{Share07-w2-wABEW.js → Share07-C8iek9k4.js} +1 -1
  34. package/dist/client/assets/{Terminal-CrrxpXUI.js → Terminal-CyioLjuI.js} +1 -1
  35. package/dist/client/assets/{Tool01-Cn8FHCpZ.js → Tool01-DF-lT9RC.js} +1 -1
  36. package/dist/client/assets/{Trash01-C-euKa34.js → Trash01-CLqhrRia.js} +1 -1
  37. package/dist/client/assets/{Upload01-Dc0hOrKX.js → Upload01-DrtXkSgF.js} +1 -1
  38. package/dist/client/assets/{Users03-zsvZ9QWQ.js → Users03-oV4Gx6fu.js} +1 -1
  39. package/dist/client/assets/{X-DUGfq2_H.js → X-CuhyLwhM.js} +1 -1
  40. package/dist/client/assets/{XClose-Cv_qbaYN.js → XClose-BFt2trBc.js} +1 -1
  41. package/dist/client/assets/{agent-connections-preview-C15fpCN8.js → agent-connections-preview-D4bn0NTx.js} +1 -1
  42. package/dist/client/assets/{agent-detail-BQXrWX9M.js → agent-detail-D8YR1Y7H.js} +1 -1
  43. package/dist/client/assets/{agents-NgYS-NWl.js → agents-BMyluA59.js} +1 -1
  44. package/dist/client/assets/{alert-dialog-B4H6MrIT.js → alert-dialog-BxcV0D_1.js} +2 -2
  45. package/dist/client/assets/{auth-catchall-GUc2KujY.js → auth-catchall-DLJkIPQ0.js} +1 -1
  46. package/dist/client/assets/{avatar-B-AS-16N.js → avatar-D3z5_V3I.js} +1 -1
  47. package/dist/client/assets/{badge-BFm6jM0d.js → badge-BklHLRcK.js} +1 -1
  48. package/dist/client/assets/{binder-C4CQlgMb.js → binder-ak1AkjZY.js} +1 -1
  49. package/dist/client/assets/{breadcrumb-Cvo4WJJ5.js → breadcrumb-B_Yxwj4p.js} +1 -1
  50. package/dist/client/assets/{button-Cl3WMTWk.js → button-CcO5M7F7.js} +1 -1
  51. package/dist/client/assets/{card-B-73zAje.js → card-BNt4WjQv.js} +1 -1
  52. package/dist/client/assets/{checkbox-kN_xGJfO.js → checkbox-CirsSPdM.js} +1 -1
  53. package/dist/client/assets/{circle-alert-BEtzK3t3.js → circle-alert-BcHtOytY.js} +1 -1
  54. package/dist/client/assets/{collection-detail-C9AV2Fn9.js → collection-detail-iX-6m_0X.js} +2 -2
  55. package/dist/client/assets/{collection-search-Aeh0FXZR.js → collection-search-Cyt8_oQV.js} +1 -1
  56. package/dist/client/assets/{collection-tab-CgMRLj1Y.js → collection-tab-Cbay3Q2-.js} +1 -1
  57. package/dist/client/assets/{collection-table-wrapper-CmBNNf0K.js → collection-table-wrapper-CFNweZN1.js} +1 -1
  58. package/dist/client/assets/{collection-tabs-2AUf3kZ2.js → collection-tabs-Dh2bhvAY.js} +1 -1
  59. package/dist/client/assets/{command-DICG2vo0.js → command-8Q_FGz0v.js} +1 -1
  60. package/dist/client/assets/{connect-DoxLTvbh.js → connect-1mhMrmD4.js} +1 -1
  61. package/dist/client/assets/{connection-card-ChzuU2dT.js → connection-card-BGd7kcn-.js} +1 -1
  62. package/dist/client/assets/connection-detail-dEdcHJ4u.js +1 -0
  63. package/dist/client/assets/connections-DmGFiu1f.js +1 -0
  64. package/dist/client/assets/{constants-1q3hobyw.js → constants-DuSOM18S.js} +1 -1
  65. package/dist/client/assets/constants-QC26G_cT.js +1 -0
  66. package/dist/client/assets/{create-organization-dialog-DWV2eGAF.js → create-organization-dialog-j_P7xuhv.js} +1 -1
  67. package/dist/client/assets/create-project-dialog-C-mSn_Ux.js +1 -0
  68. package/dist/client/assets/{dialog-BmGDp4UV.js → dialog-B_iTVR3h.js} +1 -1
  69. package/dist/client/assets/dropdown-menu-BTPpCOPE.js +1 -0
  70. package/dist/client/assets/{dynamic-plugin-layout-C_HHJRk0.js → dynamic-plugin-layout-BsqDni3U.js} +1 -1
  71. package/dist/client/assets/{empty-state-oU8PNga_.js → empty-state--JD6ZxUc.js} +1 -1
  72. package/dist/client/assets/{empty-state-DFIrBrC-.js → empty-state-Ct1fZFlf.js} +1 -1
  73. package/dist/client/assets/{env-vars-editor-Bmnp2cvo.js → env-vars-editor-B4EebJEK.js} +1 -1
  74. package/dist/client/assets/{error-boundary-D7C5xzme.js → error-boundary-DlgelpJG.js} +1 -1
  75. package/dist/client/assets/{extract-connection-data-CQQ4ZZEG.js → extract-connection-data-BM37afPK.js} +1 -1
  76. package/dist/client/assets/file-browser-DQeqPq9E.js +2 -0
  77. package/dist/client/assets/form-CSsv2IBt.js +1 -0
  78. package/dist/client/assets/grid-view-DBKftgaD.js +1 -0
  79. package/dist/client/assets/home-D16zlSya.js +1 -0
  80. package/dist/client/assets/{index-9vOB29ZB.js → index-BHu7Lc_d.js} +1 -1
  81. package/dist/client/assets/{index-BV-rIyOx.js → index-Bn2rDd42.js} +6 -6
  82. package/dist/client/assets/{index-CxyQJKsK.js → index-Bo7hWTur.js} +1 -1
  83. package/dist/client/assets/{index-5T3tdhiA.js → index-CHcJPAjT.js} +1 -1
  84. package/dist/client/assets/{index-BA6gcyzW.js → index-CZtqakWK.js} +14 -14
  85. package/dist/client/assets/{index-Dolyg0HI.js → index-DJCm-wAr.js} +1 -1
  86. package/dist/client/assets/index-DZ7G-bvr.js +1 -0
  87. package/dist/client/assets/index-a2nqbblp.js +1 -0
  88. package/dist/client/assets/{index-fCCl5Un_.js → index-fr6MaGoE.js} +1 -1
  89. package/dist/client/assets/{infiniteQueryObserver-CrYps4St.js → infiniteQueryObserver-VnhrjjoH.js} +1 -1
  90. package/dist/client/assets/{input-Dv5qvD5N.js → input-DBvMwxwE.js} +1 -1
  91. package/dist/client/assets/integration-icon-C8seGsuO.js +1 -0
  92. package/dist/client/assets/label-BjQxQJkg.js +1 -0
  93. package/dist/client/assets/layout-ZTsfxACA.js +1 -0
  94. package/dist/client/assets/{localstorage-keys-Ds2uOTRP.js → localstorage-keys-BhunmwZg.js} +1 -1
  95. package/dist/client/assets/{login-BpnfmGBt.js → login-H0BwFxqL.js} +1 -1
  96. package/dist/client/assets/{mcp-oauth-C_XpjqFg.js → mcp-oauth-ZUujauBG.js} +1 -1
  97. package/dist/client/assets/{mcp-server-card-CiGvO9aP.js → mcp-server-card-KgRAONYw.js} +1 -1
  98. package/dist/client/assets/{mcp-server-detail-SQfpDpYc.js → mcp-server-detail-Ce9SGjoZ.js} +2 -2
  99. package/dist/client/assets/members-C925BdC6.js +3 -0
  100. package/dist/client/assets/{monaco-editor-q53ZLBJ5.js → monaco-editor-D7Ghoc8y.js} +1 -1
  101. package/dist/client/assets/{monitoring-CK4xcQzM.js → monitoring-DI8QAuDx.js} +19 -19
  102. package/dist/client/assets/{oauth-callback-CeLfnx5m.js → oauth-callback-DqKFxIqr.js} +1 -1
  103. package/dist/client/assets/page-B2cjdb1f.js +1 -0
  104. package/dist/client/assets/{page-jzi-88Nr.js → page-DCfXF14g.js} +1 -1
  105. package/dist/client/assets/plugin-empty-state-BYB8Yhjv.js +1 -0
  106. package/dist/client/assets/plugin-header-CLRCQ1W3.js +1 -0
  107. package/dist/client/assets/popover-BkKSdvGf.js +1 -0
  108. package/dist/client/assets/{project-layout-CH4wXxX2.js → project-layout-DzX_Lv0I.js} +1 -1
  109. package/dist/client/assets/project-settings-lapjGGi3.js +1 -0
  110. package/dist/client/assets/projects-list-DZgOrcLS.js +1 -0
  111. package/dist/client/assets/{registry-utils-CqOx6XXE.js → registry-utils-BsLp7zXK.js} +1 -1
  112. package/dist/client/assets/{resizable-CZuYHBhW.js → resizable-CdUSPFqv.js} +1 -1
  113. package/dist/client/assets/select-J2aavKNi.js +1 -0
  114. package/dist/client/assets/{shell-layout-BxNK1bDI.js → shell-layout-DOBmQ9ah.js} +2 -2
  115. package/dist/client/assets/{spinner-BPZfVVyD.js → spinner-Bn-tqgsf.js} +1 -1
  116. package/dist/client/assets/{store-invite-ICTVmn8_.js → store-invite-C8stGp_k.js} +1 -1
  117. package/dist/client/assets/switch-CG0LWjwI.js +1 -0
  118. package/dist/client/assets/{table-BBnlXDKe.js → table-BNxQWMxG.js} +1 -1
  119. package/dist/client/assets/{tasks-CpdqRpYU.js → tasks-C_RAoHGr.js} +1 -1
  120. package/dist/client/assets/{textarea-DK_SwVx9.js → textarea-CKlKOzV4.js} +1 -1
  121. package/dist/client/assets/{tools-list-B5iaOgKy.js → tools-list-D0G5KWHg.js} +1 -1
  122. package/dist/client/assets/{typewriter-title-C_OsyMAQ.js → typewriter-title-BqfnndCW.js} +2 -2
  123. package/dist/client/assets/{use-binding-BVOuBiur.js → use-binding-Dgjl_Htk.js} +1 -1
  124. package/dist/client/assets/{use-connection-B8DnjeO8.js → use-connection-CVk8Bzpz.js} +1 -1
  125. package/dist/client/assets/{use-create-virtual-mcp-7fubOknm.js → use-create-virtual-mcp-BpXLuk-p.js} +1 -1
  126. package/dist/client/assets/{use-deco-chat-open-cMRvRYVG.js → use-deco-chat-open-CfZI9mqc.js} +5 -5
  127. package/dist/client/assets/{use-install-from-registry-ClVbT6BY.js → use-install-from-registry-5UUqPBO7.js} +1 -1
  128. package/dist/client/assets/{use-list-state-DjV5kR97.js → use-list-state-D_1V56-b.js} +1 -1
  129. package/dist/client/assets/{use-llm-H-K3anTg.js → use-llm-Ca3pgrIB.js} +1 -1
  130. package/dist/client/assets/{use-mcp-prompts-Chz_2-6S.js → use-mcp-prompts-Cn7tm6ug.js} +1 -1
  131. package/dist/client/assets/{use-mcp-tools-CXMetymP.js → use-mcp-tools-Ddi2i1Nb.js} +1 -1
  132. package/dist/client/assets/{use-mobile-B2CDnK8i.js → use-mobile-p03CcGW0.js} +1 -1
  133. package/dist/client/assets/{use-organization-settings-Bu92wRjl.js → use-organization-settings-DHZKDAPt.js} +1 -1
  134. package/dist/client/assets/{use-project-CzroiUzj.js → use-project-D-mK4K9b.js} +1 -1
  135. package/dist/client/assets/{use-virtual-mcp-ayu_K6US.js → use-virtual-mcp-C83o4Rih.js} +1 -1
  136. package/dist/client/assets/useInfiniteQuery-DDUEUpOZ.js +1 -0
  137. package/dist/client/assets/{useMutation-BOrtlNTb.js → useMutation-CnTeRHmv.js} +1 -1
  138. package/dist/client/assets/useQuery-Ct96KcZp.js +1 -0
  139. package/dist/client/assets/utils-Ckc2UwOp.js +1 -0
  140. package/dist/client/assets/{view-mode-toggle-CHHKGadJ.js → view-mode-toggle-CJkT6m07.js} +1 -1
  141. package/dist/client/assets/{workflow-BBKpGvON.js → workflow-2rDY9uo2.js} +1 -1
  142. package/dist/client/index.html +1 -1
  143. package/dist/server/cli.js +150 -150
  144. package/dist/server/migrate.js +1 -1
  145. package/dist/server/server.js +129 -129
  146. package/package.json +1 -1
  147. package/dist/client/assets/connection-detail-CVNpoyUm.js +0 -1
  148. package/dist/client/assets/connections-BHOwcUB0.js +0 -1
  149. package/dist/client/assets/constants-DzWq-50V.js +0 -1
  150. package/dist/client/assets/create-project-dialog-49RtElmv.js +0 -1
  151. package/dist/client/assets/dropdown-menu-6IaHSzwJ.js +0 -1
  152. package/dist/client/assets/file-browser-CHtfSNHu.js +0 -2
  153. package/dist/client/assets/form-qYB4UriD.js +0 -1
  154. package/dist/client/assets/grid-view-B4Eut3Xi.js +0 -1
  155. package/dist/client/assets/home-BYm3DFU4.js +0 -1
  156. package/dist/client/assets/index-BYzsWn1B.js +0 -1
  157. package/dist/client/assets/index-Vp0uDDij.js +0 -1
  158. package/dist/client/assets/integration-icon-DKM9NBX1.js +0 -1
  159. package/dist/client/assets/layout-B7afTuaN.js +0 -1
  160. package/dist/client/assets/members-CQSBREQS.js +0 -3
  161. package/dist/client/assets/page-CrfNBuC7.js +0 -1
  162. package/dist/client/assets/plugin-empty-state-Bnssy2Oj.js +0 -1
  163. package/dist/client/assets/plugin-header-DoQQAOys.js +0 -1
  164. package/dist/client/assets/popover-DuZ2ZN5J.js +0 -1
  165. package/dist/client/assets/project-settings-CKgnjrBp.js +0 -1
  166. package/dist/client/assets/projects-list-D0sSao6e.js +0 -1
  167. package/dist/client/assets/select-ODRW9YrY.js +0 -1
  168. package/dist/client/assets/switch-B-1QAIh-.js +0 -1
  169. package/dist/client/assets/useInfiniteQuery-TqDHdib1.js +0 -1
  170. package/dist/client/assets/useQuery-DDYln2BW.js +0 -1
  171. package/dist/client/assets/utils-CfR4kXxZ.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as D,c as re,j as s,p as Xt,u as je,g as me,K as ue,o as Et,ae as We,s as Ce,ba as yt,bg as St,v as Me,k as zt,h as Wt,t as le,q as es}from"./index-BV-rIyOx.js";import{C as ts,a as ss}from"./collection-table-wrapper-CmBNNf0K.js";import{C as De}from"./collection-search-Aeh0FXZR.js";import{P as Ee}from"./index-9vOB29ZB.js";import{B as ns,a as rs,b as os,c as is}from"./breadcrumb-Cvo4WJJ5.js";import{I as Ut,c as ye,b as Se,T as Ie,a as Oe}from"./integration-icon-DKM9NBX1.js";import{C as ze}from"./checkbox-kN_xGJfO.js";import{B as ie}from"./button-Cl3WMTWk.js";import{c as q}from"./utils-CfR4kXxZ.js";import{h as Vt}from"./use-connection-B8DnjeO8.js";import{u as bt,C as ct,a as dt,b as It,c as ls,d as as,e as cs,f as ds}from"./command-DICG2vo0.js";import{u as it}from"./useQuery-DDYln2BW.js";import{u as Ne}from"./useMutation-BOrtlNTb.js";import{u as ms,a as us}from"./use-llm-H-K3anTg.js";import{A as Pe}from"./avatar-B-AS-16N.js";import{B as we}from"./badge-BFm6jM0d.js";import{f as Ue,a as Ve,b as Be,c as Ge,d as $e,e as Fe,A as Ke,g as Qe}from"./alert-dialog-B4H6MrIT.js";import{D as Bt,f as Gt,a as $t,b as fs,c as hs,e as gs}from"./dialog-BmGDp4UV.js";import{D as Ct,a as jt,b as Tt,c as nt,d as xs,e as ps,f as bs,g as Cs}from"./dropdown-menu-6IaHSzwJ.js";import{i as js}from"./DotsHorizontal-C3Pu-YCA.js";import{i as qe}from"./Loading01-DOPFYU4m.js";import{i as Ts}from"./Lock01-BALKEl0l.js";import{s as rt}from"./Plus-WaQ7hmj5.js";import{s as Ft}from"./Trash01-C-euKa34.js";import{i as Ot}from"./X-DUGfq2_H.js";import{I as vs}from"./input-Dv5qvD5N.js";import{S as ve}from"./switch-B-1QAIh-.js";import{E as mt}from"./empty-state-oU8PNga_.js";import{E as Ns}from"./error-boundary-D7C5xzme.js";import{a as Es,F as wt,b as At,c as ys,d as _t,f as Lt}from"./form-qYB4UriD.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-ODRW9YrY.js";import{T as Ss}from"./textarea-DK_SwVx9.js";import{a as He,u as Ze}from"./constants-1q3hobyw.js";import{C as Rt}from"./card-B-73zAje.js";import{i as Kt}from"./DotsVertical-DMOP2SMU.js";import{i as Is}from"./index-5T3tdhiA.js";import{s as Qt}from"./XClose-Cv_qbaYN.js";import{a as Os,b as ws,P as As}from"./popover-DuZ2ZN5J.js";import{t as _s}from"./ChevronDown-DqJTvBdv.js";import"./ArrowUp-BRclUYsx.js";import"./Check-Bkb61eVw.js";import"./Grid01-zbmmdox0.js";import"./List-BvAv-Mbv.js";import"./view-mode-toggle-CHHKGadJ.js";import"./table-BBnlXDKe.js";import"./SearchMd-Ds-ERWzq.js";import"./ChevronRight-BBcOJkyP.js";import"./index-BYzsWn1B.js";import"./use-binding-BVOuBiur.js";import"./binder-C4CQlgMb.js";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:"M19 12H5m0 0 7 7m-7-7 7-7"}));qt.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 Ht=({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"}));Ht.displayName="SwitchHorizontal01";const Zt=[{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"}],Ls={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 Rs(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[],Projects:[]};for(const e of Zt)t[e.category]?.push(e);return t}function Ps(){return Zt.map(t=>({value:t.name,label:Ls[t.name],dangerous:t.dangerous}))}const Ms=D.memo(function(e){const n=re.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:d,totalToolsCount:i,onSelect:f,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let b;n[0]!==m?(b=q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=b):b=n[1];let a;n[2]!==r.icon||n[3]!==r.title?(a=s.jsx(Ut,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=a):a=n[4];let T;n[5]!==r.title?(T=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]=T):T=n[6];let h;n[7]!==f||n[8]!==a||n[9]!==T?(h=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:f,children:[a,T]}),n[7]=f,n[8]=a,n[9]=T,n[10]=h):h=n[10];let N;n[11]!==d||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(N=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",i]}),s.jsx(ze,{checked:o,onCheckedChange:x,onClick:zs})]}),n[11]=d,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=N):N=n[16];let p;return n[17]!==b||n[18]!==h||n[19]!==N?(p=s.jsxs("div",{className:b,children:[h,N]}),n[17]=b,n[18]=h,n[19]=N,n[20]=p):p=n[20],p}),Ds=D.memo(function(e){const n=re.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:d}=e,i=`tool-${r}-${l.name}`,f=o?"text-foreground":"text-muted-foreground";let x;n[0]!==f?(x=q("text-sm font-medium",f),n[0]=f,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 b;n[5]!==l.description?(b=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=b):b=n[6];let a;n[7]!==m||n[8]!==b?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,b]}),n[7]=m,n[8]=b,n[9]=a):a=n[9];const T=`tool-${r}-${l.name}`;let h;n[10]!==o||n[11]!==d||n[12]!==T?(h=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(ze,{id:T,checked:o,onCheckedChange:d,onClick:Us})}),n[10]=o,n[11]=d,n[12]=T,n[13]=h):h=n[13];let N;return n[14]!==i||n[15]!==a||n[16]!==h?(N=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:[a,h]}),n[14]=i,n[15]=a,n[16]=h,n[17]=N):N=n[17],N});function ks({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[d,i]=D.useState("all"),[f,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),b=Vt({searchTerm:o.trim()||void 0}),a=n?b.filter(g=>g.connection_type!=="VIRTUAL"?!0:Xt(g.connection_url)!==n):b,T=m.current,h=[...T.values()].map(g=>a.find(A=>A.id===g)).filter(g=>g!==void 0),N=a.filter(g=>!T.has(g.id)),p=[...h,...N],E=g=>{const A=t[g];return A!==void 0&&A.length>0},j=p.filter(g=>{if(d==="all")return!0;const A=E(g.id);return d==="selected"?A:d==="unselected"?!A:!0}),[u,y]=D.useState(p[0]?.id??null),v=u?p.find(g=>g.id===u)??null:null,P=v?.tools??[],I=(g,A)=>t[g]?.includes(A)??!1,w=(g,A)=>{const S=t[g]??[],C=S.includes(A),M={...t};if(C){const z=S.filter(B=>B!==A);z.length===0?delete M[g]:M[g]=z}else M[g]=[...S,A];e(M)},L=g=>{const A=p.find(B=>B.id===g);if(!A?.tools)return;const S=t[g]??[],C=A.tools.map(B=>B.name),M=S.length>0&&C.every(B=>S.includes(B)),z={...t};M?delete z[g]:(z[g]=C,y(g)),e(z)},O=g=>{y(g),x(!0)},R=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:q("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[s.jsx(De,{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:q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:j.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":d==="selected"?"No servers selected":d==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:j.map(g=>{const A=g.tools?.length??0,S=t[g.id]?.length??0;return s.jsx(Ms,{connection:g,isSelected:u===g.id,hasToolsEnabled:E(g.id),activeToolsCount:S,totalToolsCount:A,onSelect:()=>O(g.id),onToggle:()=>L(g.id)},g.id)})})})]}),s.jsx("div",{className:q("flex-1 flex-col",f?"flex":"hidden md:flex"),children:v?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:R,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(qt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(Ut,{icon:v.icon,name:v.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:v.title}),v.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:v.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(g=>s.jsx(Ds,{connectionId:v.id,tool:g,isSelected:I(v.id,g.name),onToggle:()=>w(v.id,g.name)},g.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 zs(t){return t.stopPropagation()}function Us(t){return t.stopPropagation()}const Pt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Vs(t){return t.replace(/-/g," ")}function Bs(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1,modelCount:0,allowsAllModels:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let d=!1,i=0,f=!1;for(const[x,m]of Object.entries(t)){if(x==="self"){m.includes("*")?n=!0:e.push(...m);continue}if(x==="models"){m.includes("*:*")?f=!0:i=m.length;continue}if(x==="*"){if(l=!0,m.includes("*"))d=!0;else for(const b of m)o.add(b);continue}if(r.push(x),m.includes("*"))d=!0;else for(const b of m)o.add(b)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:d,modelCount:i,allowsAllModels:f}}function Nt(){const{locator:t}=je(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ue.organizationRoles(t),queryFn:async()=>{try{const i=await me.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=Pt.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const f=i.role;if(!f||Pt.some(E=>E.value===f))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:b,allowsAllConnections:a,toolNames:T,allowsAllTools:h,modelCount:N,allowsAllModels:p}=Bs(i.permission);o.push({id:i.id,role:f,label:Vs(f),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:a?-1:b.length,allowsAllConnections:a,toolCount:h?-1:T.length,allowsAllTools:h,modelCount:p?-1:N,allowsAllModels:p})}const d=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:d,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Gs=Et({role:Et({id:Ce().optional(),slug:Ce().optional(),label:Ce()}),allowAllStaticPermissions:St(),staticPermissions:We(Ce()),toolSet:yt(Ce(),We(Ce())),allowAllModels:St(),modelSet:yt(Ce(),We(Ce())),memberIds:We(Ce())});function Jt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const $s=[{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 Fs(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 et(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ks(t){const e=re.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:d}=t,i=d===void 0?!1:d,[f,x]=D.useState(""),m=D.useDeferredValue(f);let b,a,T,h,N;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==f||e[6]!==r){const j=Rs(),u=Ps(),y=u.filter(R=>R.label.toLowerCase().includes(m.toLowerCase())),v=R=>{if(r.includes(R))o(r.filter(g=>g!==R));else{const g=[...r,R];g.length===u.length?(l(!0),o([])):o(g)}};T="flex flex-col h-full",e[12]!==f?(h=s.jsx("div",{className:"border-b border-border",children:s.jsx(De,{value:f,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=f,e[13]=h):h=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let I;e[14]!==P?(I=q("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=I):I=e[15];let w;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(w=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=w):w=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=L):L=e[21];let O;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(O=s.jsx("div",{onClick:Js,children:i?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:n,disabled:i,onCheckedChange:R=>{i||(l(R),o([]))}})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:n,disabled:i,onCheckedChange:R=>{i||(l(R),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=O):O=e[26],e[27]!==O||e[28]!==I||e[29]!==w?(N=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:I,onClick:w,children:[L,O]})}),e[27]=O,e[28]=I,e[29]=w,e[30]=N):N=e[30],b="flex-1 overflow-auto",a=Object.entries(j).map(R=>{const[g,A]=R,S=y.filter(C=>A.some(M=>M.name===C.value));return S.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:g}),s.jsx("div",{className:"space-y-1",children:S.map(C=>s.jsxs("div",{className:q("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 M=u.map(Zs);o(M.filter(z=>z!==C.value))}else v(C.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:C.label})}),s.jsx("div",{onClick:Hs,children:i?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:n||r.includes(C.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const M=u.map(qs);o(M.filter(z=>z!==C.value))}else v(C.value)}})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:n||r.includes(C.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const M=u.map(Qs);o(M.filter(z=>z!==C.value))}else v(C.value)}})})]},C.value))})]},g)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=f,e[6]=r,e[7]=b,e[8]=a,e[9]=T,e[10]=h,e[11]=N}else b=e[7],a=e[8],T=e[9],h=e[10],N=e[11];let p;e[31]!==b||e[32]!==a?(p=s.jsx("div",{className:b,children:a}),e[31]=b,e[32]=a,e[33]=p):p=e[33];let E;return e[34]!==T||e[35]!==h||e[36]!==N||e[37]!==p?(E=s.jsxs("div",{className:T,children:[h,N,p]}),e[34]=T,e[35]=h,e[36]=N,e[37]=p,e[38]=E):E=e[38],E}function Qs(t){return t.value}function qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){return t.value}function Js(t){return t.stopPropagation()}function Ys(t){const e=re.c(45),{connection:n,selectedModels:r,allowAllModels:l,onToggleModel:o,onToggleConnectionAll:d,allConnectionModelsSelected:i,searchQuery:f,readOnly:x}=t;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={pageSize:999},e[0]=m):m=e[0];const b=us(n.id,m);let a;e[1]!==b||e[2]!==f?(a=f.trim()?b.filter(w=>w.title.toLowerCase().includes(f.toLowerCase())||w.id.toLowerCase().includes(f.toLowerCase())||w.provider?.toLowerCase().includes(f.toLowerCase())):b,e[1]=b,e[2]=f,e[3]=a):a=e[3];const T=a;if(T.length===0)return null;let h;e[4]!==i||e[5]!==l||e[6]!==T||e[7]!==r?(h=l||i||r.includes("*")&&!l||T.every(w=>r.includes(w.id)||r.includes("*")),e[4]=i,e[5]=l,e[6]=T,e[7]=r,e[8]=h):h=e[8];const N=h;let p;e[9]!==n.icon||e[10]!==n.title?(p=n.icon?s.jsx("img",{src:n.icon,alt:n.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:n.title.slice(0,1).toUpperCase()}),e[9]=n.icon,e[10]=n.title,e[11]=p):p=e[11];let E;e[12]!==n.title?(E=s.jsx("h4",{className:"text-sm font-medium text-muted-foreground/75",children:n.title}),e[12]=n.title,e[13]=E):E=e[13];let j;e[14]!==p||e[15]!==E?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[p,E]}),e[14]=p,e[15]=E,e[16]=j):j=e[16];let u;e[17]!==N||e[18]!==l||e[19]!==n.id||e[20]!==b||e[21]!==d||e[22]!==x?(u=!x&&!l&&s.jsx(ve,{checked:N,onCheckedChange:()=>d(n.id,b)}),e[17]=N,e[18]=l,e[19]=n.id,e[20]=b,e[21]=d,e[22]=x,e[23]=u):u=e[23];let y;e[24]!==j||e[25]!==u?(y=s.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[j,u]}),e[24]=j,e[25]=u,e[26]=y):y=e[26];let v;if(e[27]!==l||e[28]!==n.id||e[29]!==T||e[30]!==o||e[31]!==x||e[32]!==r){let w;e[34]!==l||e[35]!==n.id||e[36]!==o||e[37]!==x||e[38]!==r?(w=L=>{const O=l||r.includes("*")||r.includes(L.id);return s.jsxs("div",{className:q("flex items-center justify-between gap-3 px-4 py-3",!x&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{x||l||o(n.id,L.id)},children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[L.logo&&s.jsx("img",{src:L.logo,className:"w-4 h-4 shrink-0 rounded-sm",alt:L.title}),s.jsx("span",{className:"text-sm truncate",children:L.title})]}),s.jsx("div",{onClick:Xs,children:x?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:O,disabled:!0})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:O,disabled:x||l,onCheckedChange:()=>{x||l||o(n.id,L.id)}})})]},L.id)},e[34]=l,e[35]=n.id,e[36]=o,e[37]=x,e[38]=r,e[39]=w):w=e[39],v=T.map(w),e[27]=l,e[28]=n.id,e[29]=T,e[30]=o,e[31]=x,e[32]=r,e[33]=v}else v=e[33];let P;e[40]!==v?(P=s.jsx("div",{className:"space-y-1",children:v}),e[40]=v,e[41]=P):P=e[41];let I;return e[42]!==P||e[43]!==y?(I=s.jsxs("div",{className:"mb-6 last:mb-0",children:[y,P]}),e[42]=P,e[43]=y,e[44]=I):I=e[44],I}function Xs(t){return t.stopPropagation()}function Ws(){const t=re.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(qe,{className:"size-4 animate-spin"}),"Loading models..."]}),t[0]=e):e=t[0],e}function en(t){const e=re.c(39),{allowAllModels:n,modelSet:r,onAllowAllChange:l,onModelSetChange:o,readOnly:d}=t,i=d===void 0?!1:d,[f,x]=D.useState(""),m=D.useDeferredValue(f),b=ms();let a;e[0]!==r||e[1]!==o?(a=(O,R)=>{const g=r[O]??[],A={...r};if(g.includes(R)){const S=g.filter(C=>C!==R);S.length===0?delete A[O]:A[O]=S}else A[O]=[...g,R];o(A)},e[0]=r,e[1]=o,e[2]=a):a=e[2];const T=a;let h;e[3]!==r||e[4]!==o?(h=(O,R)=>{const g=r[O]??[],A=R.map(sn),S=g.includes("*")||A.every(M=>g.includes(M)),C={...r};S?delete C[O]:C[O]=A,o(C)},e[3]=r,e[4]=o,e[5]=h):h=e[5];const N=h;let p;e[6]!==f?(p=s.jsx("div",{className:"border-b border-border",children:s.jsx(De,{value:f,onChange:x,placeholder:"Search models...",className:"border-b-0"})}),e[6]=f,e[7]=p):p=e[7];const E=!i&&"hover:bg-muted/50 cursor-pointer";let j;e[8]!==E?(j=q("flex items-center justify-between px-4 py-3 rounded-lg",E),e[8]=E,e[9]=j):j=e[9];let u;e[10]!==n||e[11]!==l||e[12]!==o||e[13]!==i?(u=()=>{if(i)return;const O=!n;l(O),O&&o({})},e[10]=n,e[11]=l,e[12]=o,e[13]=i,e[14]=u):u=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[15]=y):y=e[15];let v;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(v=s.jsx("div",{onClick:tn,children:i?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:n,disabled:!0})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:n,onCheckedChange:O=>{i||(l(O),O&&o({}))}})}),e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=v):v=e[20];let P;e[21]!==j||e[22]!==u||e[23]!==v?(P=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:j,onClick:u,children:[y,v]})}),e[21]=j,e[22]=u,e[23]=v,e[24]=P):P=e[24];let I;e[25]!==n||e[26]!==m||e[27]!==b||e[28]!==r||e[29]!==i||e[30]!==N||e[31]!==T?(I=b.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):b.map(O=>s.jsx(D.Suspense,{fallback:s.jsx(Ws,{}),children:s.jsx(Ys,{connection:O,selectedModels:r[O.id]??[],allowAllModels:n,onToggleModel:T,onToggleConnectionAll:N,allConnectionModelsSelected:(r[O.id]??[]).includes("*"),searchQuery:m,readOnly:i})},O.id)),e[25]=n,e[26]=m,e[27]=b,e[28]=r,e[29]=i,e[30]=N,e[31]=T,e[32]=I):I=e[32];let w;e[33]!==I?(w=s.jsx("div",{className:"flex-1 overflow-auto",children:I}),e[33]=I,e[34]=w):w=e[34];let L;return e[35]!==P||e[36]!==w||e[37]!==p?(L=s.jsxs("div",{className:"flex flex-col h-full",children:[p,P,w]}),e[35]=P,e[36]=w,e[37]=p,e[38]=L):L=e[38],L}function tn(t){return t.stopPropagation()}function sn(t){return t.id}function nn(t){const e=re.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[d,i]=D.useState(""),f=D.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,b]=D.useState(x),{data:a}=bt();let T,h,N,p,E,j,u,y,v,P,I;if(e[1]!==a?.data?.members||e[2]!==f||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==d||e[8]!==l){const M=a?.data?.members??[];let z;e[20]!==f?(z=U=>{const c=f.toLowerCase();return U.user?.name?.toLowerCase().includes(c)||U.user?.email?.toLowerCase().includes(c)},e[20]=f,e[21]=z):z=e[21];const B=M.filter(z),K=rn;let X;e[22]!==l?(X=U=>l.includes(U),e[22]=l,e[23]=X):X=e[23];const W=X;let ee;e[24]!==m?(ee=U=>{m.includes(U)?b(m.filter(c=>c!==U)):b([...m,U])},e[24]=m,e[25]=ee):ee=e[25];const oe=ee;let te;e[26]!==o||e[27]!==r||e[28]!==m?(te=()=>{o(m),b([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=te):te=e[29],N=te,h=Ue,P=n,I=r,T=Ve,y="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs(Be,{className:"px-6 pt-6",children:[s.jsx(Ge,{children:"Add Members to Role"}),s.jsx($e,{children:"Select members to add to this role."})]}),e[30]=v):v=e[30],j="flex flex-col h-80",e[31]!==d?(u=s.jsx(De,{value:d,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=d,e[32]=u):u=e[32],p="flex-1 overflow-auto",E=B.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:B.map(U=>{const c=K(U),_=W(U.id),V=m.includes(U.id);return s.jsxs("label",{className:q("flex items-center gap-3 p-2 rounded-lg",!c||_?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(ze,{checked:V||_,onCheckedChange:()=>{c&&!_&&oe(U.id)},disabled:!c||_}),s.jsx(Pe,{url:U.user?.image??void 0,fallback:Jt(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})]}),!c&&s.jsx(we,{variant:"secondary",className:"shrink-0",children:"Owner"}),_&&c&&s.jsx(we,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=a?.data?.members,e[2]=f,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=d,e[8]=l,e[9]=T,e[10]=h,e[11]=N,e[12]=p,e[13]=E,e[14]=j,e[15]=u,e[16]=y,e[17]=v,e[18]=P,e[19]=I}else T=e[9],h=e[10],N=e[11],p=e[12],E=e[13],j=e[14],u=e[15],y=e[16],v=e[17],P=e[18],I=e[19];let w;e[33]!==p||e[34]!==E?(w=s.jsx("div",{className:p,children:E}),e[33]=p,e[34]=E,e[35]=w):w=e[35];let L;e[36]!==w||e[37]!==j||e[38]!==u?(L=s.jsxs("div",{className:j,children:[u,w]}),e[36]=w,e[37]=j,e[38]=u,e[39]=L):L=e[39];let O;e[40]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Ke,{children:"Cancel"}),e[40]=O):O=e[40];const R=m.length===0,g=m.length>0&&`(${m.length})`;let A;e[41]!==N||e[42]!==R||e[43]!==g?(A=s.jsxs(Fe,{className:"px-6 pb-6",children:[O,s.jsxs(Qe,{onClick:N,disabled:R,children:["Add ",g]})]}),e[41]=N,e[42]=R,e[43]=g,e[44]=A):A=e[44];let S;e[45]!==T||e[46]!==L||e[47]!==A||e[48]!==y||e[49]!==v?(S=s.jsxs(T,{className:y,children:[v,L,A]}),e[45]=T,e[46]=L,e[47]=A,e[48]=y,e[49]=v,e[50]=S):S=e[50];let C;return e[51]!==h||e[52]!==S||e[53]!==P||e[54]!==I?(C=s.jsx(h,{open:P,onOpenChange:I,children:S}),e[51]=h,e[52]=S,e[53]=P,e[54]=I,e[55]=C):C=e[55],C}function rn(t){return t.role!=="owner"}function on(t){const e=re.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[d,i]=D.useState(""),f=D.useDeferredValue(d),[x,m]=D.useState(!1),{data:b}=bt();let a,T,h,N,p;if(e[0]!==b?.data?.members||e[1]!==f||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==d){const y=b?.data?.members??[];let v;e[11]!==n?(v=S=>n.includes(S.id),e[11]=n,e[12]=v):v=e[12];const P=y.filter(v);let I;e[13]!==f?(I=S=>{const C=f.toLowerCase();return S.user?.name?.toLowerCase().includes(C)||S.user?.email?.toLowerCase().includes(C)},e[13]=f,e[14]=I):I=e[14];const w=P.filter(I);let L;e[15]!==n||e[16]!==r?(L=S=>{r(n.filter(C=>C!==S))},e[15]=n,e[16]=r,e[17]=L):L=e[17];const O=L;let R;e[18]!==n||e[19]!==r?(R=S=>{r([...n,...S])},e[18]=n,e[19]=r,e[20]=R):R=e[20],a=R,N="flex flex-col h-full";let g;e[21]!==d?(g=s.jsx(De,{value:d,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=d,e[22]=g):g=e[22];let A;e[23]!==o?(A=o?s.jsx("div",{className:"pr-4",children:s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(rt,{size:16}),"Add Member"]})})}),s.jsx(Oe,{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(rt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=A):A=e[24],e[25]!==g||e[26]!==A?(p=s.jsxs("div",{className:"flex items-center border-b border-border",children:[g,A]}),e[25]=g,e[26]=A,e[27]=p):p=e[27],T="flex-1 overflow-auto",h=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."})]})}):w.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 "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:w.map(S=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Pe,{url:S.user?.image??void 0,fallback:Jt(S.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:S.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.user?.email})]}),o?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Ot,{size:16})})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>O(S.id),children:s.jsx(Ot,{size:16})})]},S.id))}),e[0]=b?.data?.members,e[1]=f,e[2]=n,e[3]=r,e[4]=o,e[5]=d,e[6]=a,e[7]=T,e[8]=h,e[9]=N,e[10]=p}else a=e[6],T=e[7],h=e[8],N=e[9],p=e[10];let E;e[28]!==T||e[29]!==h?(E=s.jsx("div",{className:T,children:h}),e[28]=T,e[29]=h,e[30]=E):E=e[30];let j;e[31]!==x||e[32]!==a||e[33]!==n?(j=s.jsx(nn,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:a}),e[31]=x,e[32]=a,e[33]=n,e[34]=j):j=e[34];let u;return e[35]!==N||e[36]!==p||e[37]!==E||e[38]!==j?(u=s.jsxs("div",{className:N,children:[p,E,j]}),e[35]=N,e[36]=p,e[37]=E,e[38]=j,e[39]=u):u=e[39],u}function ln(t){const e=re.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(qe,{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(on,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const an={owner:[],admin:[],user:[]};function tt(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:an[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:r.map(l=>l.id)}}function cn({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:d}=je(),i=Me(),f=Vt()??[],{customRoles:x,refetch:m}=Nt(),{data:b}=it({queryKey:ue.members(d),queryFn:()=>me.organization.listMembers()}),a=zt({resolver:Wt(Gs),defaultValues:et()}),T=a.formState.isValid,h=a.formState.isDirty,[N,p]=D.useState(null),[E,j]=D.useState(null),u=!a.watch("role.id")&&!a.watch("role.slug")&&!E,[y,v]=D.useState(null),[P,I]=D.useState(!1),[w,L]=D.useState(null),O=c=>{const _=c.permission||{},V=_.self||[],fe=V.includes("*"),J=fe?[]:V.filter(G=>G!=="*"),Y={};for(const[G,se]of Object.entries(_))if(!(G==="self"||G==="models"))if(G==="*")for(const ne of f)se.includes("*")?Y[ne.id]=ne.tools?.map(ae=>ae.name)??[]:Y[ne.id]=se;else{const ne=f.find(ae=>ae.id===G);ne&&(se.includes("*")?Y[G]=ne.tools?.map(ae=>ae.name)??[]:Y[G]=se)}const H=_.models||[],he=H.length===0||H.includes("*:*"),Z={};if(!he)for(const G of H){const se=G.indexOf(":");if(se===-1)continue;const ne=G.slice(0,se),ae=G.slice(se+1);Z[ne]||(Z[ne]=[]),Z[ne].push(ae)}const ce=(b?.data?.members??[]).filter(G=>G.role===c.role).map(G=>G.id);return{role:{id:c.id,slug:c.role,label:c.label},allowAllStaticPermissions:fe,staticPermissions:J,toolSet:Y,allowAllModels:he,modelSet:Z,memberIds:ce}},R=c=>{const _=O(c);a.reset(_),p(c.id??null),j(null)},g=()=>{a.reset(et()),p(null),j(null),o("mcp")},A=c=>{h&&T?(L(()=>()=>R(c)),I(!0)):R(c)},S=async()=>{h&&T&&await ee(),g()},C=c=>{if(h&&T)L(()=>()=>{const _=tt(c,b?.data?.members??[]);a.reset(_),j(c),p(null),o("org")}),I(!0);else{const _=tt(c,b?.data?.members??[]);a.reset(_),j(c),p(null),o("org")}},M=c=>{if(!c&&a.formState.isDirty&&T){L(()=>()=>{r(!1),a.reset(et()),j(null)}),I(!0);return}if(r(c),!c)a.reset(et()),j(null),p(null);else{const _=x[0];if(_)R(_);else{const V=tt("user",b?.data?.members??[]);a.reset(V),j("user"),p(null),o("org")}}},z=()=>{I(!1),w&&(w(),L(null))},B=c=>{const _={};c.allowAllStaticPermissions?_.self=["*"]:c.staticPermissions.length>0&&(_.self=c.staticPermissions);for(const[V,fe]of Object.entries(c.toolSet))if(fe.length>0){const Y=f.find(H=>H.id===V)?.tools?.map(H=>H.name)??[];Y.length>0&&Y.every(H=>fe.includes(H))?_[V]=["*"]:_[V]=fe}if(c.allowAllModels)_.models=["*:*"];else{const V=[];for(const[fe,J]of Object.entries(c.modelSet))if(J.length>0)for(const Y of J)V.push(`${fe}:${Y}`);_.models=V}return _},K=Ne({mutationFn:async c=>{const _=B(c),V=c.role.slug||c.role.label.toLowerCase().replace(/\s+/g,"-");if(c.role.slug&&!c.role.id){const Y=(b?.data?.members??[]).filter(Z=>Z.role===c.role.slug).map(Z=>Z.id),H=c.memberIds.filter(Z=>!Y.includes(Z)),he=Y.filter(Z=>!c.memberIds.includes(Z));for(const Z of H){const Q=await me.organization.updateMemberRole({memberId:Z,role:[c.role.slug]});if(Q?.error)throw new Error(Q.error.message)}for(const Z of he){const Q=await me.organization.updateMemberRole({memberId:Z,role:["user"]});if(Q?.error)throw new Error(Q.error.message)}return c}else if(c.role.id){const J=await me.organization.updateRole({roleId:c.role.id,data:{permission:_}});if(J?.error)throw new Error(J.error.message);const H=(b?.data?.members??[]).filter(Q=>Q.role===c.role.slug).map(Q=>Q.id),he=c.memberIds.filter(Q=>!H.includes(Q)),Z=H.filter(Q=>!c.memberIds.includes(Q));for(const Q of he){const ce=await me.organization.updateMemberRole({memberId:Q,role:[c.role.slug]});if(ce?.error)throw new Error(ce.error.message)}for(const Q of Z){const ce=await me.organization.updateMemberRole({memberId:Q,role:["user"]});if(ce?.error)throw new Error(ce.error.message)}return c}else{const J=await me.organization.createRole({role:V,permission:_});if(J?.error)throw new Error(J.error.message);for(const Y of c.memberIds){const H=await me.organization.updateMemberRole({memberId:Y,role:[V]});if(H?.error)throw new Error(H.error.message)}return{...c,role:{...c.role,id:J.data?.roleData?.id,slug:V}}}},onSuccess:(c,_)=>{i.invalidateQueries({queryKey:ue.members(d)}),i.invalidateQueries({queryKey:ue.organizationRoles(d)});const V=!_.role.id&&!_.role.slug,fe=_.role.slug&&!_.role.id;le.success(fe?"Members updated successfully!":V?"Role created successfully!":"Role updated successfully!"),m(),a.reset(c),c.role.id&&p(c.role.id),e?.()},onError:c=>{le.error(c instanceof Error?c.message:"Failed to save role")}}),X=Ne({mutationFn:async c=>{const _=await me.organization.deleteRole({roleId:c});if(_?.error)throw new Error(_.error.message);return _?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ue.members(d)}),i.invalidateQueries({queryKey:ue.organizationRoles(d)}),le.success("Role deleted successfully!"),m(),y?.id===N){const c=x.filter(_=>_.id!==y?.id);if(c[0])R(c[0]);else{const _=tt("user",b?.data?.members??[]);a.reset(_),j("user"),p(null),o("org")}}},onError:c=>{le.error(c instanceof Error?c.message:"Failed to delete role")}}),W=K.isPending||X.isPending,ee=async()=>{const c=a.getValues();if(!c.role.label.trim()){le.error("Role name is required"),a.setFocus("role.label");return}await K.mutateAsync(c)},oe=a.handleSubmit(c=>{if(!c.role.label.trim()){le.error("Role name is required"),a.setFocus("role.label");return}K.mutate(c)}),te=c=>{c.id&&v({id:c.id,label:c.label})},U=()=>{y?.id&&X.mutate(y.id),v(null)};return s.jsxs(Bt,{open:n,onOpenChange:M,children:[s.jsx(Gt,{asChild:!0,children:t}),s.jsx($t,{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:[$s.map(c=>{const _=E===c.role;return s.jsxs("div",{className:q("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",_?"bg-accent":"hover:bg-muted/50"),onClick:()=>C(c.role),children:[s.jsx("div",{className:q("shrink-0 size-3 rounded-full",c.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:c.label}),s.jsx(Ts,{size:14,className:"text-muted-foreground shrink-0"})]},c.role)}),x.map(c=>{const _=N===c.id;return s.jsxs("div",{className:q("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",_?"bg-accent":"hover:bg-muted/50"),onClick:()=>A(c),children:[s.jsx("div",{className:q("shrink-0 size-3 rounded-full",Fs(c.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:c.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:q("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",_&&"opacity-100 pointer-events-auto"),onClick:V=>V.stopPropagation(),children:s.jsx(js,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(nt,{className:"text-destructive",onClick:V=>{V.stopPropagation(),te(c)},children:[s.jsx(Ft,{size:16}),"Delete"]})})]})]},c.id)}),u&&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(vs,{...a.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(we,{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:S,disabled:W||h,className:"w-full h-10",children:[s.jsx(rt,{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:[!E&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:q("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:q("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("models"),className:q("h-7 rounded-lg px-2 border border-input transition-colors",l==="models"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Models"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:q("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"&&!E&&s.jsx(ks,{toolSet:a.watch("toolSet"),onToolSetChange:c=>a.setValue("toolSet",c,{shouldDirty:!0})}),l==="org"&&s.jsx(Ks,{allowAllStaticPermissions:a.watch("allowAllStaticPermissions"),staticPermissions:a.watch("staticPermissions"),onAllowAllChange:c=>a.setValue("allowAllStaticPermissions",c,{shouldDirty:!0}),onPermissionsChange:c=>a.setValue("staticPermissions",c,{shouldDirty:!0}),readOnly:!!E}),l==="models"&&s.jsx(en,{allowAllModels:a.watch("allowAllModels"),modelSet:a.watch("modelSet"),onAllowAllChange:c=>a.setValue("allowAllModels",c,{shouldDirty:!0}),onModelSetChange:c=>a.setValue("modelSet",c,{shouldDirty:!0}),readOnly:!!E}),l==="members"&&s.jsx(ln,{memberIds:a.watch("memberIds"),onMemberIdsChange:c=>a.setValue("memberIds",c,{shouldDirty:!0}),readOnly:E==="owner"})]}),(!E||E!=="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:()=>M(!1),disabled:W,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:oe,disabled:W||!T||!a.formState.isDirty,className:"h-10",children:K.isPending?"Saving...":u?"Create Role":"Save Changes"})]})]})]})}),s.jsx(Ue,{open:y!==null,onOpenChange:c=>!c&&v(null),children:s.jsxs(Ve,{children:[s.jsxs(Be,{children:[s.jsx(Ge,{children:"Delete Role"}),s.jsxs($e,{children:['Are you sure you want to delete the "',y?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Fe,{children:[s.jsx(Ke,{children:"Cancel"}),s.jsx(Qe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(Ue,{open:P,onOpenChange:I,children:s.jsxs(Ve,{children:[s.jsxs(Be,{children:[s.jsx(Ge,{children:"Discard Changes"}),s.jsx($e,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Fe,{children:[s.jsx(Ke,{onClick:()=>L(null),children:"Keep Editing"}),s.jsx(Qe,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const dn=Ce().email("Invalid email address");function mn(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 un({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=je(),l=Me(),{data:o}=me.useSession(),d=o?.user?.email,{roles:i,isLoading:f}=Nt(),x=i.filter(j=>j.role!=="owner"),m=zt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),b=m.watch("emailsText"),a=m.watch("role"),h=mn(b).filter(j=>{const u=dn.safeParse(j).success,y=!d||j!==d.toLowerCase();return u&&y}),N=Ne({mutationFn:async({emails:j,role:u})=>{if(!u)throw new Error("Please select a role");const y=await Promise.allSettled(j.map(async P=>{const I=await me.organization.inviteMember({email:P,role:u});if(I.error)throw new Error(I.error.message);return I.data})),v=y.filter(P=>P.status==="rejected");if(v.length>0)throw new Error(`Failed to invite ${v.length} member${v.length>1?"s":""}`);return y},onSuccess:(j,{emails:u})=>{l.invalidateQueries({queryKey:ue.members(r)}),l.invalidateQueries({queryKey:ue.invitations(r)}),le.success(u.length===1?"Member invited successfully!":`${u.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:j=>{le.error(j instanceof Error?j.message:"Failed to invite members")}}),p=j=>{if(h.length===0){le.error("Please enter at least one valid email address");return}if(!j.role){le.error("Please select a role");return}N.mutate({emails:h,role:j.role})},E=h.length>0&&!!a;return s.jsxs(Bt,{open:e,onOpenChange:n,children:[s.jsx(Gt,{asChild:!0,children:t}),s.jsxs($t,{className:"sm:max-w-lg",children:[s.jsx(fs,{children:s.jsx(hs,{children:"Invite members"})}),s.jsx(Es,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(p),className:"space-y-4",children:[s.jsx(wt,{control:m.control,name:"emailsText",render:({field:j})=>s.jsxs(At,{children:[s.jsx(ys,{children:"Email addresses"}),s.jsx(_t,{children:s.jsx(Ss,{...j,disabled:N.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(Lt,{})]})}),s.jsx(wt,{control:m.control,name:"role",render:({field:j})=>s.jsxs(At,{children:[s.jsx(_t,{children:s.jsxs(ft,{value:j.value,onValueChange:j.onChange,disabled:N.isPending||f,children:[s.jsx(ht,{className:"w-full",children:s.jsx(gt,{placeholder:"Select a role"})}),s.jsx(xt,{children:x.map(u=>{const y=[];return u.isBuiltin||(u.allowsAllStaticPermissions?y.push("Full org access"):u.staticPermissionCount&&u.staticPermissionCount>0&&y.push(`${u.staticPermissionCount} org perm${u.staticPermissionCount!==1?"s":""}`),u.allowsAllConnections?y.push("All connections"):u.connectionCount&&u.connectionCount>0&&y.push(`${u.connectionCount} connection${u.connectionCount!==1?"s":""}`),(u.connectionCount!==0||u.allowsAllConnections)&&(u.allowsAllTools?y.push("all tools"):u.toolCount&&u.toolCount>0&&y.push(`${u.toolCount} tool${u.toolCount!==1?"s":""}`))),s.jsx(pt,{value:u.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:u.label}),!u.isBuiltin&&y.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:y.join(", ")})]})},u.role)})})]})}),s.jsx(Lt,{})]})}),s.jsxs(gs,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:N.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:N.isPending||!E,children:N.isPending?"Inviting...":`Invite ${h.length||0} Member${h.length!==1?"s":""}`})]})]})})]})]})}function fn(){const t=re.c(9),{org:e,locator:n}=je();let r;t[0]!==e.id?(r={connectionId:He,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Ze(r);let o;t[2]!==n?(o=ue.invitations(n),t[2]=n,t[3]=o):o=t[3];let d;t[4]!==l?(d=async()=>{const f=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(f.structuredContent??f)?.invitations??[]},t[4]=l,t[5]=d):d=t[5];let i;return t[6]!==o||t[7]!==d?(i={queryKey:o,queryFn:d},t[6]=o,t[7]=d,t[8]=i):i=t[8],es(i)}function hn(){const t=re.c(5),{locator:e}=je(),n=Me();let r;t[0]!==e||t[1]!==n?(r={mutationFn:xn,onSuccess:()=>{n.invalidateQueries({queryKey:ue.invitations(e)}),le.success("Invitation cancelled")},onError:gn},t[0]=e,t[1]=n,t[2]=r):r=t[2];const l=Ne(r);let o;return t[3]!==l?(o={cancel:l},t[3]=l,t[4]=o):o=t[4],o}function gn(t){le.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function xn(t){const e=await me.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function pn(){const t=re.c(9),{org:e,locator:n}=je();let r;t[0]!==e.id?(r={connectionId:He,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Ze(r);let o;t[2]!==n?(o=ue.tags(n),t[2]=n,t[3]=o):o=t[3];let d;t[4]!==l?(d=async()=>{const f=await l.callTool({name:"TAGS_LIST",arguments:{}});return(f.structuredContent??f).tags},t[4]=l,t[5]=d):d=t[5];let i;return t[6]!==o||t[7]!==d?(i={queryKey:o,queryFn:d,staleTime:3e4},t[6]=o,t[7]=d,t[8]=i):i=t[8],it(i)}function bn(){const t=re.c(10),e=Me(),{org:n,locator:r}=je();let l;t[0]!==n.id?(l={connectionId:He,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Ze(l);let d;t[2]!==o?(d=async x=>{const m=await o.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=o,t[3]=d):d=t[3];let i;t[4]!==r||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ue.tags(r)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let f;return t[7]!==d||t[8]!==i?(f={mutationFn:d,onSuccess:i,onError:Cn},t[7]=d,t[8]=i,t[9]=f):f=t[9],Ne(f)}function Cn(t){le.error(t instanceof Error?t.message:"Failed to create tag")}function jn(t){const e=re.c(12),{org:n,locator:r}=je();let l;e[0]!==n.id?(l={connectionId:He,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const o=Ze(l);let d;e[2]!==r||e[3]!==t?(d=ue.memberTags(r,t),e[2]=r,e[3]=t,e[4]=d):d=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 f=!!t;let x;return e[8]!==d||e[9]!==i||e[10]!==f?(x={queryKey:d,queryFn:i,staleTime:3e4,enabled:f},e[8]=d,e[9]=i,e[10]=f,e[11]=x):x=e[11],it(x)}function Tn(){const t=re.c(10),e=Me(),{org:n,locator:r}=je();let l;t[0]!==n.id?(l={connectionId:He,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Ze(l);let d;t[2]!==o?(d=async x=>{const{memberId:m,tagIds:b}=x,a=await o.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:b}});return a.structuredContent??a},t[2]=o,t[3]=d):d=t[3];let i;t[4]!==r||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ue.memberTags(r,m.memberId)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let f;return t[7]!==d||t[8]!==i?(f={mutationFn:d,onSuccess:i,onError:vn},t[7]=d,t[8]=i,t[9]=f):f=t[9],Ne(f)}function vn(t){le.error(t instanceof Error?t.message:"Failed to update member tags")}function Yt(t){const e=re.c(44),{memberId:n,className:r,disabled:l,placeholder:o,maxDisplay:d}=t,i=l===void 0?!1:l,f=o===void 0?"Add tags...":o,x=d===void 0?2:d,[m,b]=D.useState(!1),[a,T]=D.useState(""),{data:h,isLoading:N}=pn(),p=h===void 0?[]:h,{data:E,isLoading:j}=jn(n),u=E===void 0?[]:E,y=bn(),v=Tn(),P=N||j,I=u.map(En);let w;e[0]!==a?(w=F=>F.name.toLowerCase().includes(a.toLowerCase()),e[0]=a,e[1]=w):w=e[1];const L=p.filter(w);let O;e[2]!==a?(O=F=>F.name.toLowerCase()===a.toLowerCase(),e[2]=a,e[3]=O):O=e[3];const R=p.find(O),g=a.trim()&&!R,A=async F=>{const be=I.includes(F.id)?I.filter(Ae=>Ae!==F.id):[...I,F.id];await v.mutateAsync({memberId:n,tagIds:be})},S=async()=>{if(!a.trim())return;const F=await y.mutateAsync(a.trim());await v.mutateAsync({memberId:n,tagIds:[...I,F.id]}),T("")},C=async F=>{const xe=I.filter(be=>be!==F);await v.mutateAsync({memberId:n,tagIds:xe})},M=y.isPending||v.isPending,z=ws;let B;e[4]!==m?(B=()=>b(!m),e[4]=m,e[5]=B):B=e[5];let K;e[6]!==r?(K=q("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",r),e[6]=r,e[7]=K):K=e[7];const X=i||P,W=P?s.jsx(qe,{size:14,className:"animate-spin text-muted-foreground"}):u.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[u.slice(0,x).map(Nn),u.length>x&&s.jsxs(we,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",u.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:f});let ee;e[8]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(_s,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=ee):ee=e[8];let oe;e[9]!==X||e[10]!==W||e[11]!==B||e[12]!==K?(oe=s.jsx(As,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:B,className:K,disabled:X,children:[W,ee]})}),e[9]=X,e[10]=W,e[11]=B,e[12]=K,e[13]=oe):oe=e[13];const te=Os,U="w-56 p-0",c="start";let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=()=>b(!1),e[14]=_):_=e[14];const V=cs,fe=!1;let J;e[15]!==a?(J=s.jsx(ds,{placeholder:"Search or create...",value:a,onValueChange:T,className:"h-9"}),e[15]=a,e[16]=J):J=e[16];const Y=as,H=u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(ct,{heading:"Selected",children:u.map(F=>s.jsx(dt,{onSelect:()=>A(F),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(ze,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:F.name})]}),s.jsx("button",{onClick:xe=>{xe.stopPropagation(),C(F.id)},className:"opacity-50 hover:opacity-100",disabled:M,children:s.jsx(Qt,{size:14})})]})},F.id))}),s.jsx(It,{})]}),he=ct,Z="Available",Q=L.length===0&&!g&&s.jsx(ls,{children:"No tags found."}),ce=L.filter(F=>!I.includes(F.id)).map(F=>s.jsx(dt,{onSelect:()=>A(F),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:F.name})]})},F.id));let G;e[17]!==he||e[18]!==Q||e[19]!==ce?(G=s.jsxs(he,{heading:Z,children:[Q,ce]}),e[17]=he,e[18]=Q,e[19]=ce,e[20]=G):G=e[20];let se;e[21]!==S||e[22]!==M||e[23]!==a||e[24]!==g?(se=g&&s.jsxs(s.Fragment,{children:[s.jsx(It,{}),s.jsx(ct,{children:s.jsx(dt,{onSelect:S,className:"cursor-pointer",disabled:M,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[M?s.jsx(qe,{size:14,className:"animate-spin"}):s.jsx(rt,{size:14}),s.jsxs("span",{children:['Create "',a.trim(),'"']})]})})})]}),e[21]=S,e[22]=M,e[23]=a,e[24]=g,e[25]=se):se=e[25];let ne;e[26]!==Y||e[27]!==H||e[28]!==G||e[29]!==se?(ne=s.jsxs(Y,{children:[H,G,se]}),e[26]=Y,e[27]=H,e[28]=G,e[29]=se,e[30]=ne):ne=e[30];let ae;e[31]!==V||e[32]!==J||e[33]!==ne?(ae=s.jsxs(V,{shouldFilter:fe,children:[J,ne]}),e[31]=V,e[32]=J,e[33]=ne,e[34]=ae):ae=e[34];let ge;e[35]!==te||e[36]!==_||e[37]!==ae?(ge=s.jsx(te,{className:U,align:c,onEscapeKeyDown:_,children:ae}),e[35]=te,e[36]=_,e[37]=ae,e[38]=ge):ge=e[38];let Te;return e[39]!==z||e[40]!==m||e[41]!==oe||e[42]!==ge?(Te=s.jsxs(z,{open:m,onOpenChange:b,children:[oe,ge]}),e[39]=z,e[40]=m,e[41]=oe,e[42]=ge,e[43]=Te):Te=e[43],Te}function Nn(t){return s.jsx(we,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function En(t){return t.id}const Mt=["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"],yn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Sn(t){const e=new Map;for(const[n,r]of Object.entries(yn))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,Mt[n%Mt.length]??"bg-neutral-400")}return e}function In(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function st(t){const e=re.c(79),{role:n,memberId:r,isOwner:l,roleColorMap:o,selectableRoles:d,onRoleChange:i,size:f,className:x}=t,m=f===void 0?"xs":f;let b,a,T,h,N,p,E,j,u,y,v;if(e[0]!==x||e[1]!==l||e[2]!==r||e[3]!==i||e[4]!==n||e[5]!==o||e[6]!==d||e[7]!==m){v=Symbol.for("react.early_return_sentinel");e:{const S=o.get(n)??"bg-neutral-400";if(l){let C;e[19]!==r||e[20]!==i?(C=U=>i(r,U),e[19]=r,e[20]=i,e[21]=C):C=e[21];let M;e[22]!==n?(M=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const z=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:q("size-2 rounded-full shrink-0",S)}),M]});let B;e[24]!==z?(B=s.jsx(gt,{children:z}),e[24]=z,e[25]=B):B=e[25];let K;e[26]!==x||e[27]!==m||e[28]!==B?(K=s.jsx(ht,{size:m,className:x,children:B}),e[26]=x,e[27]=m,e[28]=B,e[29]=K):K=e[29];let X;if(e[30]!==o||e[31]!==d){let U;e[33]!==o?(U=c=>{const _=o.get(c.role)??"bg-neutral-400";return s.jsx(pt,{value:c.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:q("size-3 rounded-full",_)}),s.jsx("span",{className:"capitalize",children:c.label})]})},c.role)},e[33]=o,e[34]=U):U=e[34],X=d.map(U),e[30]=o,e[31]=d,e[32]=X}else X=e[32];let W;e[35]!==X?(W=s.jsx(xt,{children:X}),e[35]=X,e[36]=W):W=e[36];let ee;e[37]!==l||e[38]!==n||e[39]!==C||e[40]!==K||e[41]!==W?(ee=s.jsx(Ie,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ft,{value:n,onValueChange:C,disabled:l,children:[K,W]})})}),e[37]=l,e[38]=n,e[39]=C,e[40]=K,e[41]=W,e[42]=ee):ee=e[42];let oe;e[43]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx(Oe,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=oe):oe=e[43];let te;e[44]!==ee?(te=s.jsx(ye,{children:s.jsxs(Se,{children:[ee,oe]})}),e[44]=ee,e[45]=te):te=e[45],v=te;break e}T=ft,j=n,e[46]!==r||e[47]!==i?(u=C=>i(r,C),e[46]=r,e[47]=i,e[48]=u):u=e[48],y=l,a=ht,p=m,E=x,b=gt,N="flex items-center gap-2 min-w-0",h=q("size-2 rounded-full shrink-0",S)}e[0]=x,e[1]=l,e[2]=r,e[3]=i,e[4]=n,e[5]=o,e[6]=d,e[7]=m,e[8]=b,e[9]=a,e[10]=T,e[11]=h,e[12]=N,e[13]=p,e[14]=E,e[15]=j,e[16]=u,e[17]=y,e[18]=v}else b=e[8],a=e[9],T=e[10],h=e[11],N=e[12],p=e[13],E=e[14],j=e[15],u=e[16],y=e[17],v=e[18];if(v!==Symbol.for("react.early_return_sentinel"))return v;let P;e[49]!==h?(P=s.jsx("div",{className:h}),e[49]=h,e[50]=P):P=e[50];let I;e[51]!==n?(I=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=I):I=e[52];let w;e[53]!==P||e[54]!==I||e[55]!==N?(w=s.jsxs("div",{className:N,children:[P,I]}),e[53]=P,e[54]=I,e[55]=N,e[56]=w):w=e[56];let L;e[57]!==b||e[58]!==w?(L=s.jsx(b,{children:w}),e[57]=b,e[58]=w,e[59]=L):L=e[59];let O;e[60]!==a||e[61]!==L||e[62]!==p||e[63]!==E?(O=s.jsx(a,{size:p,className:E,children:L}),e[60]=a,e[61]=L,e[62]=p,e[63]=E,e[64]=O):O=e[64];let R;if(e[65]!==o||e[66]!==d){let S;e[68]!==o?(S=C=>{const M=o.get(C.role)??"bg-neutral-400";return s.jsx(pt,{value:C.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:q("size-3 rounded-full",M)}),s.jsx("span",{className:"capitalize",children:C.label})]})},C.role)},e[68]=o,e[69]=S):S=e[69],R=d.map(S),e[65]=o,e[66]=d,e[67]=R}else R=e[67];let g;e[70]!==R?(g=s.jsx(xt,{children:R}),e[70]=R,e[71]=g):g=e[71];let A;return e[72]!==T||e[73]!==O||e[74]!==g||e[75]!==j||e[76]!==u||e[77]!==y?(A=s.jsxs(T,{value:j,onValueChange:u,disabled:y,children:[O,g]}),e[72]=T,e[73]=O,e[74]=g,e[75]=j,e[76]=u,e[77]=y,e[78]=A):A=e[78],A}function Dt(t){const e=re.c(51),{member:n,roles:r,onChangeRole:l,onRemove:o,isUpdating:d}=t,i=d===void 0?!1:d,f=n.role==="owner";let x,m,b,a,T,h,N,p,E;if(e[0]!==f||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==r){let O;e[15]!==n.role?(O=C=>C.role!==n.role&&C.role!=="owner",e[15]=n.role,e[16]=O):O=e[16];const R=r.filter(O);a=Ct;let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Kt,{size:20}),e[17]=g):g=e[17],e[18]!==f?(E=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:f,onClick:wn,children:g})}),e[18]=f,e[19]=E):E=e[19],b=Tt,N="end",p=On,m=xs;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ht,{size:16}),e[20]=A):A=e[20],e[21]!==i?(h=s.jsxs(ps,{disabled:i,children:[A,"Change Role"]}),e[21]=i,e[22]=h):h=e[22],x=bs;let S;e[23]!==i||e[24]!==n.id||e[25]!==l?(S=C=>{const M=[];return C.isBuiltin||(C.allowsAllStaticPermissions?M.push("Full org access"):C.staticPermissionCount&&C.staticPermissionCount>0&&M.push(`${C.staticPermissionCount} org perm${C.staticPermissionCount!==1?"s":""}`),C.allowsAllConnections?M.push("All connections"):C.connectionCount&&C.connectionCount>0&&M.push(`${C.connectionCount} connection${C.connectionCount!==1?"s":""}`),(C.connectionCount!==0||C.allowsAllConnections)&&(C.allowsAllTools?M.push("all tools"):C.toolCount&&C.toolCount>0&&M.push(`${C.toolCount} tool${C.toolCount!==1?"s":""}`))),s.jsxs(nt,{onClick:z=>{z.stopPropagation(),l(n.id,C.role)},disabled:i,children:[C.isBuiltin?s.jsx(vt,{size:16}):s.jsx(Is,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:C.label}),!C.isBuiltin&&M.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},C.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=S):S=e[26],T=R.map(S),e[0]=f,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]=b,e[9]=a,e[10]=T,e[11]=h,e[12]=N,e[13]=p,e[14]=E}else x=e[6],m=e[7],b=e[8],a=e[9],T=e[10],h=e[11],N=e[12],p=e[13],E=e[14];let j;e[27]!==x||e[28]!==T?(j=s.jsx(x,{children:T}),e[27]=x,e[28]=T,e[29]=j):j=e[29];let u;e[30]!==m||e[31]!==h||e[32]!==j?(u=s.jsxs(m,{children:[h,j]}),e[30]=m,e[31]=h,e[32]=j,e[33]=u):u=e[33];let y;e[34]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Cs,{}),e[34]=y):y=e[34];let v;e[35]!==n.id||e[36]!==o?(v=O=>{O.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=v):v=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ft,{size:16}),e[38]=P):P=e[38];let I;e[39]!==v?(I=s.jsxs(nt,{variant:"destructive",onClick:v,children:[P,"Remove Member"]}),e[39]=v,e[40]=I):I=e[40];let w;e[41]!==b||e[42]!==I||e[43]!==N||e[44]!==p||e[45]!==u?(w=s.jsxs(b,{align:N,onClick:p,children:[u,y,I]}),e[41]=b,e[42]=I,e[43]=N,e[44]=p,e[45]=u,e[46]=w):w=e[46];let L;return e[47]!==a||e[48]!==w||e[49]!==E?(L=s.jsxs(a,{children:[E,w]}),e[47]=a,e[48]=w,e[49]=E,e[50]=L):L=e[50],L}function On(t){return t.stopPropagation()}function wn(t){return t.stopPropagation()}function kt(t){const e=re.c(8),{invitationId:n,onCancel:r,isCancelling:l}=t,o=l===void 0?!1:l;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:_n,children:s.jsx(Kt,{size:20})})}),e[0]=d):d=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 f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Qt,{size:16}),e[4]=f):f=e[4];let x;return e[5]!==o||e[6]!==i?(x=s.jsxs(Ct,{children:[d,s.jsx(Tt,{align:"end",onClick:An,children:s.jsxs(nt,{variant:"destructive",onClick:i,disabled:o,children:[f,"Cancel Invitation"]})})]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function An(t){return t.stopPropagation()}function _n(t){return t.stopPropagation()}function Ln(){const t=re.c(79),{data:e}=bt(),{data:n}=fn(),r=hn(),l=Me(),{locator:o}=je(),[d,i]=D.useState(null),[f,x]=D.useState(null),[m,b]=D.useState(""),[a,T]=D.useState("table"),[h,N]=D.useState("member"),[p,E]=D.useState("asc"),j=e?.data?.members;let u;t[0]!==h?(u=k=>{h===k?E(Qn):(N(k),E("asc"))},t[0]=h,t[1]=u):u=t[1];const y=u;let v=j??[],P=n??[];if(m){const k=m.toLowerCase();v=v.filter($=>$.user?.name?.toLowerCase().includes(k)||$.user?.email?.toLowerCase().includes(k)||$.role?.toLowerCase().includes(k)),P=P.filter($=>$.email?.toLowerCase().includes(k)||$.role?.toLowerCase().includes(k))}if(h&&p){let k;t[2]!==p||t[3]!==h?(k=($,de)=>{let pe,ke;e:switch(h){case"member":{pe=$.user?.name||"",ke=de.user?.name||"";break e}case"role":{pe=$.role||"",ke=de.role||"";break e}case"joined":{pe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",ke=de.createdAt?typeof de.createdAt=="string"?de.createdAt:de.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?pe.localeCompare(ke):ke.localeCompare(pe)},t[2]=p,t[3]=h,t[4]=k):k=t[4],v=[...v].sort(k)}const I=v;let w;t[5]!==o||t[6]!==l?(w={mutationFn:Kn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(o)}),le.success("Member has been removed from the organization"),i(null)},onError:Fn},t[5]=o,t[6]=l,t[7]=w):w=t[7];const L=Ne(w);let O;t[8]!==o||t[9]!==l?(O={mutationFn:$n,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(o)}),le.success("Member's role has been updated")},onError:Gn},t[8]=o,t[9]=l,t[10]=O):O=t[10];const R=Ne(O);let g;t[11]!==o||t[12]!==l?(g={mutationFn:Bn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.invitations(o)}),le.success("Invitation role has been updated")},onError:Vn},t[11]=o,t[12]=l,t[13]=g):g=t[13];const A=Ne(g),{roles:S,customRoles:C}=Nt();let M;t[14]!==C?(M=Sn(C),t[14]=C,t[15]=M):M=t[15];const z=M;let B;t[16]!==S?(B=S.filter(Un),t[16]=S,t[17]=B):B=t[17];const K=B;let X;t[18]===Symbol.for("react.memo_cache_sentinel")?(X={id:"member",header:"Member",render:zn,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=X):X=t[18];let W;t[19]!==z||t[20]!==K||t[21]!==A||t[22]!==R?(W={id:"role",header:"Role",render:k=>k.type==="member"?s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:k.data.role==="owner",roleColorMap:z,selectableRoles:K,onRoleChange:($,de)=>R.mutate({memberId:$,role:de}),className:"w-36"}):s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:!1,roleColorMap:z,selectableRoles:K,onRoleChange:($,de)=>A.mutate({invitationId:$,role:de,email:k.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=z,t[20]=K,t[21]=A,t[22]=R,t[23]=W):W=t[23];let ee,oe;t[24]===Symbol.for("react.memo_cache_sentinel")?(ee={id:"tags",header:"Tags",render:kn,cellClassName:"w-40 shrink-0"},oe={id:"joined",header:"Joined",render:Dn,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=ee,t[25]=oe):(ee=t[24],oe=t[25]);let te;t[26]!==r.cancel.isPending||t[27]!==S||t[28]!==R?(te={id:"actions",header:"",render:k=>k.type==="member"?s.jsx(Dt,{member:k.data,roles:S,onChangeRole:($,de)=>R.mutate({memberId:$,role:de}),onRemove:i,isUpdating:R.isPending}):s.jsx(kt,{invitationId:k.data.id,onCancel:x,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=r.cancel.isPending,t[27]=S,t[28]=R,t[29]=te):te=t[29];let U;t[30]!==te||t[31]!==W?(U=[X,W,ee,oe,te],t[30]=te,t[31]=W,t[32]=U):U=t[32];const c=U;let _;t[33]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(cn,{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]=_):_=t[33];let V;t[34]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs("div",{className:"flex items-center gap-2",children:[_,s.jsx(un,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=V):V=t[34];const fe=V,J=[...I.map(Mn),...P.filter(Pn).map(Rn)],Y=Ee,H=!!f;let he;t[35]===Symbol.for("react.memo_cache_sentinel")?(he=()=>x(null),t[35]=he):he=t[35];let Z;t[36]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs(Be,{children:[s.jsx(Ge,{children:"Cancel Invitation"}),s.jsx($e,{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]=Z):Z=t[36];let Q;t[37]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Ke,{children:"Keep Invitation"}),t[37]=Q):Q=t[37];let ce;t[38]!==r.cancel||t[39]!==f?(ce=()=>{f&&(r.cancel.mutate(f),x(null))},t[38]=r.cancel,t[39]=f,t[40]=ce):ce=t[40];let G;t[41]!==r.cancel.isPending||t[42]!==ce?(G=s.jsxs(Ve,{children:[Z,s.jsxs(Fe,{children:[Q,s.jsx(Qe,{onClick:ce,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=r.cancel.isPending,t[42]=ce,t[43]=G):G=t[43];let se;t[44]!==H||t[45]!==G?(se=s.jsx(Ue,{open:H,onOpenChange:he,children:G}),t[44]=H,t[45]=G,t[46]=se):se=t[46];const ne=!!d;let ae;t[47]===Symbol.for("react.memo_cache_sentinel")?(ae=()=>i(null),t[47]=ae):ae=t[47];let ge;t[48]===Symbol.for("react.memo_cache_sentinel")?(ge=s.jsxs(Be,{children:[s.jsx(Ge,{children:"Remove Member"}),s.jsx($e,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=ge):ge=t[48];let Te;t[49]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(Ke,{children:"Cancel"}),t[49]=Te):Te=t[49];let F;t[50]!==d||t[51]!==L?(F=()=>d&&L.mutate(d),t[50]=d,t[51]=L,t[52]=F):F=t[52];let xe;t[53]!==L.isPending||t[54]!==F?(xe=s.jsxs(Ve,{children:[ge,s.jsxs(Fe,{children:[Te,s.jsx(Qe,{onClick:F,disabled:L.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=L.isPending,t[54]=F,t[55]=xe):xe=t[55];let be;t[56]!==ne||t[57]!==xe?(be=s.jsx(Ue,{open:ne,onOpenChange:ae,children:xe}),t[56]=ne,t[57]=xe,t[58]=be):be=t[58];let Ae;t[59]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx(Ee.Header.Left,{children:s.jsx(ns,{children:s.jsx(rs,{children:s.jsx(os,{children:s.jsx(is,{children:"Members"})})})})}),t[59]=Ae):Ae=t[59];let Je;t[60]===Symbol.for("react.memo_cache_sentinel")?(Je=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=Je):Je=t[60];let _e;t[61]!==y||t[62]!==p||t[63]!==h||t[64]!==a?(_e=s.jsxs(Ee.Header,{children:[Ae,s.jsxs(Ee.Header.Right,{children:[s.jsx(ts,{viewMode:a,onViewModeChange:T,sortKey:h,sortDirection:p,onSort:y,sortOptions:Je}),fe]})]}),t[61]=y,t[62]=p,t[63]=h,t[64]=a,t[65]=_e):_e=t[65];let Ye;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ye=k=>{k.key==="Escape"&&(b(""),k.target.blur())},t[66]=Ye):Ye=t[66];let Le;t[67]!==m?(Le=s.jsx(De,{value:m,onChange:b,placeholder:"Search members...",onKeyDown:Ye}),t[67]=m,t[68]=Le):Le=t[68];const lt=Ee,at=a==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:J.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:J.map(k=>{if(k.type==="invitation")return s.jsxs(Rt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(kt,{invitationId:k.data.id,onCancel:x,isCancelling:r.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Pe,{fallback:ot(k.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:k.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(we,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:!1,roleColorMap:z,selectableRoles:K,onRoleChange:(de,pe)=>A.mutate({invitationId:de,role:pe,email:k.data.email}),className:"w-fit"})]})]})]},`inv-${k.data.id}`);const $=k.data;return s.jsxs(Rt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Dt,{member:$,roles:S,onChangeRole:(de,pe)=>R.mutate({memberId:de,role:pe}),onRemove:i,isUpdating:R.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Pe,{url:$.user?.image??void 0,fallback:ot($.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(st,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:z,selectableRoles:K,onRoleChange:(de,pe)=>R.mutate({memberId:de,role:pe}),className:"w-fit"}),s.jsx(Yt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ss,{columns:c,data:J,isLoading:!1,sortKey:h,sortDirection:p,onSort:y,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 Re;t[69]!==lt.Content||t[70]!==at?(Re=s.jsx(lt.Content,{children:at}),t[69]=lt.Content,t[70]=at,t[71]=Re):Re=t[71];let Xe;return t[72]!==Y||t[73]!==se||t[74]!==be||t[75]!==_e||t[76]!==Le||t[77]!==Re?(Xe=s.jsxs(Y,{children:[se,be,_e,Le,Re]}),t[72]=Y,t[73]=se,t[74]=be,t[75]=_e,t[76]=Le,t[77]=Re,t[78]=Xe):Xe=t[78],Xe}function Rn(t){return{type:"invitation",data:t}}function Pn(t){return t.status==="pending"}function Mn(t){return{type:"member",data:t}}function Dn(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?In(t.data.createdAt):"N/A"}):s.jsx(we,{variant:"outline",children:"Pending"})}function kn(t){return t.type==="member"?s.jsx(Yt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function zn(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{url:t.data.user?.image??void 0,fallback:ot(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(Pe,{fallback:ot(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 Un(t){return t.role!=="owner"}function Vn(t){le.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Bn(t){const{invitationId:e,role:n,email:r}=t,l=await me.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const o=await me.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function Gn(t){le.error(t instanceof Error?t.message:"Failed to update role")}async function $n(t){const{memberId:e,role:n}=t,r=await me.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function Fn(t){le.error(t instanceof Error?t.message:"Failed to remove member")}async function Kn(t){const e=await me.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function Qn(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function $r(){const t=re.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ee,{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(Ns,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(qe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ln,{})})}),t[1]=n):n=t[1],n}export{$r 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-BV-rIyOx.js";import{V as ae,C as g}from"./index-BA6gcyzW.js";import{T as ce,i as me,a as de,t as fe}from"./typewriter-title-C_OsyMAQ.js";import{E as ue}from"./error-boundary-D7C5xzme.js";import{u as Z,S as Y}from"./use-deco-chat-open-cMRvRYVG.js";import{I as te,T as J,a as Q,b as X}from"./integration-icon-DKM9NBX1.js";import{P as pe,a as he,b as xe}from"./popover-DuZ2ZN5J.js";import{c as se}from"./utils-CfR4kXxZ.js";import{i as ge,d as je}from"./constants-1q3hobyw.js";import{b as be}from"./use-virtual-mcp-ayu_K6US.js";import{i as ye}from"./ChevronRight-BBcOJkyP.js";import{t as le}from"./Users03-zsvZ9QWQ.js";import{P as E}from"./index-9vOB29ZB.js";import{B as H}from"./button-Cl3WMTWk.js";import{c as Ne}from"./Pin01-Dk_x7uai.js";import{s as _e}from"./Plus-WaQ7hmj5.js";import{i as Se}from"./Share07-w2-wABEW.js";import"./X-DUGfq2_H.js";import"./spinner-BPZfVVyD.js";import"./use-mcp-prompts-Chz_2-6S.js";import"./useQuery-DDYln2BW.js";import"./dialog-BmGDp4UV.js";import"./form-qYB4UriD.js";import"./input-Dv5qvD5N.js";import"./AlertCircle-BOIQEKjW.js";import"./ArrowUp-BRclUYsx.js";import"./ChevronDown-DqJTvBdv.js";import"./Edit01-ByF-cYbh.js";import"./Check-Bkb61eVw.js";import"./Copy01-BvgMlJ5t.js";import"./Terminal-CrrxpXUI.js";import"./monaco-editor-q53ZLBJ5.js";import"./localstorage-keys-Ds2uOTRP.js";import"./useMutation-BOrtlNTb.js";import"./empty-state-oU8PNga_.js";import"./use-connection-B8DnjeO8.js";import"./generate-id-Dyweu44Y.js";import"./SearchMd-Ds-ERWzq.js";import"./Trash01-C-euKa34.js";import"./badge-BFm6jM0d.js";import"./Code01-DEMYMNLO.js";import"./infiniteQueryObserver-CrYps4St.js";import"./use-create-virtual-mcp-7fubOknm.js";import"./use-llm-H-K3anTg.js";import"./use-binding-BVOuBiur.js";import"./binder-C4CQlgMb.js";import"./select-ODRW9YrY.js";import"./index-BYzsWn1B.js";import"./File06-CkTcogsG.js";import"./Grid01-zbmmdox0.js";import"./Image01-BuXlAy8i.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 Ht(){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{Ht as default};
@@ -1 +0,0 @@
1
- import{c as n,j as t,$ as o}from"./index-BV-rIyOx.js";function c(){const s=n.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(o,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No storage connected"}),t.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an S3-compatible storage service to browse and manage files."})]}),s[0]=e):e=s[0],e}export{c as default};
@@ -1 +0,0 @@
1
- import{c as w,j as s,r as S,$ as y}from"./index-BV-rIyOx.js";import{i as _}from"./Check-Bkb61eVw.js";import{t as $}from"./ChevronDown-DqJTvBdv.js";function k(x){const e=w.c(32),{connections:l,selectedConnectionId:n,onConnectionChange:N}=x,[r,z]=S.useState(!1),C=S.useRef(null);let p;if(e[0]!==l||e[1]!==n){let t;e[3]!==n?(t=u=>u.id===n,e[3]=n,e[4]=t):t=e[4],p=l.find(t),e[0]=l,e[1]=n,e[2]=p}else p=e[2];const i=p;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=t=>{C.current?.contains(t.relatedTarget)||z(!1)},e[5]=j):j=e[5];const R=j;if(l.length===1){let t;e[6]!==i?(t=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(y,{size:16}),e[6]=i,e[7]=t):t=e[7];const u=i?.title||"Storage";let f;e[8]!==u?(f=s.jsx("span",{children:u}),e[8]=u,e[9]=f):f=e[9];let h;return e[10]!==t||e[11]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t,f]}),e[10]=t,e[11]=f,e[12]=h):h=e[12],h}let o;e[13]!==r?(o=()=>z(!r),e[13]=r,e[14]=o):o=e[14];let a;e[15]!==i?(a=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(y,{size:16}),e[15]=i,e[16]=a):a=e[16];const v=i?.title||"Select storage";let c;e[17]!==v?(c=s.jsx("span",{children:v}),e[17]=v,e[18]=c):c=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx($,{size:14}),e[19]=b):b=e[19];let d;e[20]!==o||e[21]!==a||e[22]!==c?(d=s.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md border border-border bg-background hover:bg-accent transition-colors",children:[a,c,b]}),e[20]=o,e[21]=a,e[22]=c,e[23]=d):d=e[23];let m;e[24]!==l||e[25]!==r||e[26]!==N||e[27]!==n?(m=r&&s.jsx("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-48 rounded-md border border-border bg-popover p-1 shadow-md",children:l.map(t=>s.jsxs("button",{type:"button",onClick:()=>{N(t.id),z(!1)},className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent transition-colors",children:[t.icon?s.jsx("img",{src:t.icon,alt:"",className:"size-4 rounded"}):s.jsx(y,{size:16}),s.jsx("span",{className:"flex-1 text-left",children:t.title}),t.id===n&&s.jsx(_,{size:14,className:"text-primary"})]},t.id))}),e[24]=l,e[25]=r,e[26]=N,e[27]=n,e[28]=m):m=e[28];let g;return e[29]!==d||e[30]!==m?(g=s.jsxs("div",{className:"relative",ref:C,onBlur:R,children:[d,m]}),e[29]=d,e[30]=m,e[31]=g):g=e[31],g}function O(x){const e=w.c(2);let l;return e[0]!==x?(l=s.jsx(k,{...x}),e[0]=x,e[1]=l):l=e[1],l}export{O as default};
@@ -1 +0,0 @@
1
- import{r as i,am as $,j as c,as as z,at as L,al as O,_,an as g,au as w,av as E,aw as G,ax as j,ay as H,az as K,aq as q,aA as B,aB as U,aC as V,aD as W,aE as Z,aF as J,c as R}from"./index-BV-rIyOx.js";import{c as Q}from"./utils-CfR4kXxZ.js";var m="Popover",[b]=q(m,[j]),P=j(),[X,d]=b(m),N=t=>{const{__scopePopover:e,children:o,open:r,defaultOpen:n,onOpenChange:a,modal:s=!1}=t,p=P(e),l=i.useRef(null),[u,h]=i.useState(!1),[x,f]=$({prop:r,defaultProp:n??!1,onChange:a,caller:m});return c.jsx(z,{...p,children:c.jsx(X,{scope:e,contentId:L(),triggerRef:l,open:x,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(C=>!C),[f]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>h(!0),[]),onCustomAnchorRemove:i.useCallback(()=>h(!1),[]),modal:s,children:o})})};N.displayName=m;var F="PopoverAnchor",Y=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(F,o),a=P(o),{onCustomAnchorAdd:s,onCustomAnchorRemove:p}=n;return i.useEffect(()=>(s(),()=>p()),[s,p]),c.jsx(w,{...a,...r,ref:e})});Y.displayName=F;var y="PopoverTrigger",S=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(y,o),a=P(o),s=O(e,n.triggerRef),p=c.jsx(_.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":I(n.open),...r,ref:s,onClick:g(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:c.jsx(w,{asChild:!0,...a,children:p})});S.displayName=y;var A="PopoverPortal",[ee,oe]=b(A,{forceMount:void 0}),D=t=>{const{__scopePopover:e,forceMount:o,children:r,container:n}=t,a=d(A,e);return c.jsx(ee,{scope:e,forceMount:o,children:c.jsx(E,{present:o||a.open,children:c.jsx(G,{asChild:!0,container:n,children:r})})})};D.displayName=A;var v="PopoverContent",M=i.forwardRef((t,e)=>{const o=oe(v,t.__scopePopover),{forceMount:r=o.forceMount,...n}=t,a=d(v,t.__scopePopover);return c.jsx(E,{present:r||a.open,children:a.modal?c.jsx(re,{...n,ref:e}):c.jsx(ne,{...n,ref:e})})});M.displayName=v;var te=B("PopoverContent.RemoveScroll"),re=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(null),n=O(e,r),a=i.useRef(!1);return i.useEffect(()=>{const s=r.current;if(s)return H(s)},[]),c.jsx(K,{as:te,allowPinchZoom:!0,children:c.jsx(T,{...t,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(t.onCloseAutoFocus,s=>{s.preventDefault(),a.current||o.triggerRef.current?.focus()}),onPointerDownOutside:g(t.onPointerDownOutside,s=>{const p=s.detail.originalEvent,l=p.button===0&&p.ctrlKey===!0,u=p.button===2||l;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:g(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),ne=i.forwardRef((t,e)=>{const o=d(v,t.__scopePopover),r=i.useRef(!1),n=i.useRef(!1);return c.jsx(T,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||o.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=a.target;o.triggerRef.current?.contains(s)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),T=i.forwardRef((t,e)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:h,...x}=t,f=d(v,o),C=P(o);return U(),c.jsx(V,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:a,children:c.jsx(W,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:c.jsx(Z,{"data-state":I(f.open),role:"dialog",id:f.contentId,...C,...x,ref:e,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),k="PopoverClose",ae=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=d(k,o);return c.jsx(_.button,{type:"button",...r,ref:e,onClick:g(t.onClick,()=>n.onOpenChange(!1))})});ae.displayName=k;var se="PopoverArrow",ce=i.forwardRef((t,e)=>{const{__scopePopover:o,...r}=t,n=P(o);return c.jsx(J,{...n,...r,ref:e})});ce.displayName=se;function I(t){return t?"open":"closed"}var ie=N,pe=S,le=D,ue=M;function ve(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(ie,{"data-slot":"popover",...o}),e[2]=o,e[3]=r):r=e[3],r}function ge(t){const e=R.c(4);let o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=c.jsx(pe,{"data-slot":"popover-trigger",...o}),e[2]=o,e[3]=r):r=e[3],r}function Pe(t){const e=R.c(12);let o,r,n,a;e[0]!==t?({className:o,align:n,sideOffset:a,...r}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=a):(o=e[1],r=e[2],n=e[3],a=e[4]);const s=n===void 0?"center":n,p=a===void 0?4:a;let l;e[5]!==o?(l=Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-lg overflow-hidden border p-4 shadow-md outline-hidden",o),e[5]=o,e[6]=l):l=e[6];let u;return e[7]!==s||e[8]!==r||e[9]!==p||e[10]!==l?(u=c.jsx(le,{children:c.jsx(ue,{"data-slot":"popover-content",align:s,sideOffset:p,className:l,...r})}),e[7]=s,e[8]=r,e[9]=p,e[10]=l,e[11]=u):u=e[11],u}export{ge as P,Pe as a,ve as b};
@@ -1 +0,0 @@
1
- import{c as H,u as W,v as X,O as Y,h as oe,k as ae,j as s,o as ce,s as G,K as U,t as R,r as q,aO as te,bp as ue,m as de,g as ge}from"./index-BV-rIyOx.js";import{P as Z}from"./index-9vOB29ZB.js";import{B as fe,a as pe,b as he,c as xe}from"./breadcrumb-Cvo4WJJ5.js";import{u as ee}from"./useMutation-BOrtlNTb.js";import{a as ie,u as re}from"./constants-1q3hobyw.js";import{B as L}from"./button-Cl3WMTWk.js";import{I as V}from"./input-Dv5qvD5N.js";import{T as je}from"./textarea-DK_SwVx9.js";import{F as Q,d as M,a as me,b as $,c as K,e as se,f as J,L as be}from"./form-qYB4UriD.js";import{u as ye}from"./useQuery-DDYln2BW.js";import{S as ve}from"./switch-B-1QAIh-.js";import{h as Ne}from"./use-connection-B8DnjeO8.js";import{a as Ce,c as Se}from"./use-binding-BVOuBiur.js";import{u as Pe}from"./use-install-from-registry-ClVbT6BY.js";import{i as we}from"./Loading01-DOPFYU4m.js";import{s as Ie}from"./Plus-WaQ7hmj5.js";import{S as Ee,a as Fe,b as De,c as _e,d as le}from"./select-ODRW9YrY.js";import{c as Oe}from"./utils-CfR4kXxZ.js";import{i as Te}from"./Upload01-Dc0hOrKX.js";import{i as Ae}from"./X-DUGfq2_H.js";import{c as ze,h as Be,d as ke,b as Re,A as Le,e as Ue,g as qe,a as Me,f as $e}from"./alert-dialog-B4H6MrIT.js";import"./ChevronRight-BBcOJkyP.js";import"./binder-C4CQlgMb.js";import"./extract-connection-data-CQQ4ZZEG.js";import"./constants-DzWq-50V.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-CqOx6XXE.js";import"./generate-id-Dyweu44Y.js";import"./index-BYzsWn1B.js";import"./Check-Bkb61eVw.js";import"./ChevronDown-DqJTvBdv.js";const Ke=ce({name:G().min(1,"Name is required").max(200,"Name is too long"),description:G().max(1e3,"Description is too long").nullable()});function Ge(){const e=H.c(58),{org:t,project:i}=W(),o=X(),d=i.slug===Y;let g;e[0]!==t.id?(g={connectionId:ie,orgId:t.id},e[0]=t.id,e[1]=g):g=e[1];const u=re(g);let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=oe(Ke),e[2]=x):x=e[2];const j=i.name??"",b=i.description??"";let a;e[3]!==j||e[4]!==b?(a={resolver:x,values:{name:j,description:b}},e[3]=j,e[4]=b,e[5]=a):a=e[5];const c=ae(a);let f;e[6]!==u||e[7]!==i.id?(f=async B=>{const _=await u.callTool({name:"PROJECT_UPDATE",arguments:{projectId:i.id,name:B.name,description:B.description||null}});return _.structuredContent??_},e[6]=u,e[7]=i.id,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==t.id||e[11]!==i.slug||e[12]!==o?(p=()=>{o.invalidateQueries({queryKey:U.project(t.id,i.slug)}),o.invalidateQueries({queryKey:U.projects(t.id)}),R.success("Project updated successfully"),c.reset(c.getValues())},e[9]=c,e[10]=t.id,e[11]=i.slug,e[12]=o,e[13]=p):p=e[13];let w;e[14]!==f||e[15]!==p?(w={mutationFn:f,onSuccess:p,onError:Qe},e[14]=f,e[15]=p,e[16]=w):w=e[16];const m=ee(w);let y;e[17]!==m?(y=async B=>{await m.mutateAsync(B)},e[17]=m,e[18]=y):y=e[18];const P=y,C=c.formState.isDirty;let I;e[19]!==c||e[20]!==P?(I=c.handleSubmit(P),e[19]=c,e[20]=P,e[21]=I):I=e[21];let S;e[22]!==d||e[23]!==m.isPending?(S=B=>{const{field:_}=B;return s.jsxs($,{children:[s.jsx(K,{children:"Project Name"}),s.jsx(M,{children:s.jsx(V,{placeholder:"My Project",..._,disabled:d||m.isPending})}),d&&s.jsx(se,{children:"The organization admin project name cannot be changed."}),s.jsx(J,{})]})},e[22]=d,e[23]=m.isPending,e[24]=S):S=e[24];let n;e[25]!==c.control||e[26]!==S?(n=s.jsx(Q,{control:c.control,name:"name",render:S}),e[25]=c.control,e[26]=S,e[27]=n):n=e[27];let r;e[28]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(K,{children:"Slug"}),e[28]=r):r=e[28];let l;e[29]!==i.slug?(l=s.jsx(M,{children:s.jsx(V,{value:i.slug,disabled:!0,className:"bg-muted"})}),e[29]=i.slug,e[30]=l):l=e[30];let h;e[31]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(se,{children:"The project slug cannot be changed after creation."}),e[31]=h):h=e[31];let v;e[32]!==l?(v=s.jsxs($,{children:[r,l,h]}),e[32]=l,e[33]=v):v=e[33];let N;e[34]!==m.isPending?(N=B=>{const{field:_}=B;return s.jsxs($,{children:[s.jsx(K,{children:"Description"}),s.jsx(M,{children:s.jsx(je,{placeholder:"Optional project description...",rows:3,..._,value:_.value??"",disabled:m.isPending})}),s.jsx(J,{})]})},e[34]=m.isPending,e[35]=N):N=e[35];let F;e[36]!==c.control||e[37]!==N?(F=s.jsx(Q,{control:c.control,name:"description",render:N}),e[36]=c.control,e[37]=N,e[38]=F):F=e[38];const O=!C||m.isPending,T=m.isPending?"Saving...":"Save Changes";let D;e[39]!==O||e[40]!==T?(D=s.jsx(L,{type:"submit",disabled:O,className:"min-w-24",children:T}),e[39]=O,e[40]=T,e[41]=D):D=e[41];let A;e[42]!==c||e[43]!==C||e[44]!==m.isPending?(A=C&&s.jsx(L,{type:"button",variant:"outline",onClick:()=>c.reset(),disabled:m.isPending,children:"Cancel"}),e[42]=c,e[43]=C,e[44]=m.isPending,e[45]=A):A=e[45];let z;e[46]!==D||e[47]!==A?(z=s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[D,A]}),e[46]=D,e[47]=A,e[48]=z):z=e[48];let E;e[49]!==n||e[50]!==v||e[51]!==F||e[52]!==z||e[53]!==I?(E=s.jsxs("form",{onSubmit:I,className:"space-y-6",children:[n,v,F,z]}),e[49]=n,e[50]=v,e[51]=F,e[52]=z,e[53]=I,e[54]=E):E=e[54];let k;return e[55]!==c||e[56]!==E?(k=s.jsx(me,{...c,children:E}),e[55]=c,e[56]=E,e[57]=k):k=e[57],k}function Qe(e){R.error("Failed to update project: "+(e instanceof Error?e.message:"Unknown error"))}function Je({value:e,onValueChange:t,placeholder:i="Select a connection...",binding:o,bindingType:d,onAddNew:g,className:u,disabled:x=!1}){const[j,b]=q.useState(!1),{installByBinding:a,isInstalling:c}=Pe(),f=j||c,p=Ne(),w=Ce({connections:p,binding:typeof o=="string"?o:void 0}),m=!o||!p?p??[]:typeof o=="string"?w:Array.isArray(o)&&o.length>0?p.filter(n=>Se(n,o)):p,y=(()=>{if(!d?.startsWith("@"))return null;const[n,r]=d.replace("@","").split("/");return n&&r?{scope:n,appName:r}:null})(),P=(()=>{let n=m;const r=Array.isArray(o)&&o.length>0;if(y&&!r&&(n=n.filter(l=>{const h=l.app_name,v=l.metadata?.scopeName;return h===y.appName&&v===y.scope})),e&&!n.some(l=>l.id===e)){const l=p?.find(h=>h.id===e);if(l)return[l,...n]}return n})(),C=d?.startsWith("@"),I=async()=>{if(C&&d){b(!0);try{const n=await a(d);n&&t(n.id)}finally{b(!1)}return}g?.()},S=P.find(n=>n.id===e);return s.jsxs(Ee,{value:e??"none",onValueChange:n=>t(n==="none"?null:n),disabled:x,children:[s.jsx(Fe,{size:"sm",className:Oe("w-[200px]",u),children:s.jsx(De,{placeholder:i,children:S?s.jsxs("div",{className:"flex items-center gap-2",children:[S.icon?s.jsx("img",{src:S.icon,alt:S.title,className:"w-4 h-4 rounded shrink-0"}):s.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:S.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"truncate",children:S.title})]}):i})}),s.jsxs(_e,{children:[s.jsx(le,{value:"none",children:"No connection"}),P.length===0?s.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):P.map(n=>s.jsx(le,{value:n.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[n.icon?s.jsx("img",{src:n.icon,alt:n.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:n.title.slice(0,1).toUpperCase()}),s.jsx("span",{children:n.title})]})},n.id)),(g||C)&&s.jsx("div",{className:"border-t border-border",children:s.jsx(L,{onPointerDown:n=>n.stopPropagation(),onClick:n=>{n.preventDefault(),n.stopPropagation(),I()},disabled:f||x,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:f?s.jsxs(s.Fragment,{children:[s.jsx(we,{size:16,className:"animate-spin"}),s.jsx("span",{children:"Connecting..."})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ie,{size:16}),s.jsx("span",{children:"Add Connection"})]})})})]})]})}const Ve=e=>{if(!e||typeof e!="object")return!1;const t=e;return t.type==="text"&&typeof t.text=="string"&&t.text.trim().toLowerCase().startsWith("error")},ne=e=>{const t=e.structuredContent??e,i=t&&typeof t=="object"?t:null,o=i?.content?.[0]?.text&&typeof i.content[0].text=="string"?i.content[0].text:null;if(i?.isError)throw new Error(o??"Tool call failed");if(Ve(t))throw new Error(t.text);return t};function He(e){return e.requiresMcpBinding===!0?!0:e.binding!==void 0}function We(e){const t=H.c(48),{plugin:i,isEnabled:o,isSaving:d,pendingBinding:g,description:u,label:x,icon:j,projectId:b,client:a,onBindingChange:c,onToggle:f}=e;let p;t[0]!==i?(p=He(i),t[0]=i,t[1]=p):p=t[1];const w=p;let m;t[2]!==i.id||t[3]!==b?(m=U.projectPluginConfig(b??"",i.id),t[2]=i.id,t[3]=b,t[4]=m):m=t[4];let y;t[5]!==a||t[6]!==i.id||t[7]!==b?(y=async()=>{if(!b)throw new Error("Project ID is required to load plugin config.");const E=await a.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:b,pluginId:i.id}});return ne(E)},t[5]=a,t[6]=i.id,t[7]=b,t[8]=y):y=t[8];const P=!!b&&w;let C;t[9]!==m||t[10]!==y||t[11]!==P?(C={queryKey:m,queryFn:y,enabled:P},t[9]=m,t[10]=y,t[11]=P,t[12]=C):C=t[12];const{data:I,isLoading:S}=ye(C),n=I?.config?.connectionId??null,r=g!==void 0?g:n;let l;t[13]!==j?(l=j&&s.jsx("div",{className:"flex-shrink-0 text-muted-foreground [&>svg]:size-4",children:j}),t[13]=j,t[14]=l):l=t[14];let h;t[15]!==x?(h=s.jsx("div",{className:"text-sm font-medium text-foreground",children:x}),t[15]=x,t[16]=h):h=t[16];let v;t[17]!==u?(v=u&&s.jsx("p",{className:"text-xs text-muted-foreground",children:u}),t[17]=u,t[18]=v):v=t[18];let N;t[19]!==h||t[20]!==v?(N=s.jsxs("div",{className:"min-w-0",children:[h,v]}),t[19]=h,t[20]=v,t[21]=N):N=t[21];let F;t[22]!==l||t[23]!==N?(F=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l,N]}),t[22]=l,t[23]=N,t[24]=F):F=t[24];let O;t[25]!==f||t[26]!==i.id?(O=E=>f(i.id,E),t[25]=f,t[26]=i.id,t[27]=O):O=t[27];let T;t[28]!==o||t[29]!==d||t[30]!==O?(T=s.jsx(ve,{checked:o,onCheckedChange:O,disabled:d}),t[28]=o,t[29]=d,t[30]=O,t[31]=T):T=t[31];let D;t[32]!==F||t[33]!==T?(D=s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[F,T]}),t[32]=F,t[33]=T,t[34]=D):D=t[34];let A;t[35]!==S||t[36]!==o||t[37]!==d||t[38]!==w||t[39]!==c||t[40]!==i.binding||t[41]!==i.id||t[42]!==r||t[43]!==n?(A=o&&w&&s.jsxs("div",{className:"mt-3 pl-7 flex items-center gap-3",children:[s.jsx(be,{className:"text-xs text-muted-foreground w-24",children:"Connection"}),s.jsx(Je,{value:r??null,onValueChange:E=>c(i.id,E,n),binding:i.binding,placeholder:"Select connection...",className:"w-56",disabled:d||S})]}),t[35]=S,t[36]=o,t[37]=d,t[38]=w,t[39]=c,t[40]=i.binding,t[41]=i.id,t[42]=r,t[43]=n,t[44]=A):A=t[44];let z;return t[45]!==D||t[46]!==A?(z=s.jsxs("div",{className:"py-3",children:[D,A]}),t[45]=D,t[46]=A,t[47]=z):z=t[47],z}function Ze(){const{org:e,project:t}=W(),i=X(),o=re({connectionId:ie,orgId:e.id}),[d,g]=q.useState({}),[u,x]=q.useState({}),[j,b]=q.useState(!1),a=t.enabledPlugins??[],c=n=>{const r=d[n];return r!==void 0?r:a.includes(n)},f=()=>{const n=new Set(a);for(const[r,l]of Object.entries(d))l?n.add(r):n.delete(r);return Array.from(n)},p=Object.keys(d).length>0||Object.keys(u).length>0,w=(n,r)=>{const l=a.includes(n);g(r===l?h=>{const{[n]:v,...N}=h;return N}:h=>({...h,[n]:r}))},m=(n,r,l)=>{if(r===l){x(h=>{const{[n]:v,...N}=h;return N});return}x(h=>({...h,[n]:r}))},y=ee({mutationFn:async n=>{const r=[];if(n.updatePlugins){const l=await o.callTool({name:"PROJECT_UPDATE",arguments:{projectId:t.id,enabledPlugins:n.enabledPlugins}});r.push(ne(l))}if(n.bindingUpdates.length>0){const l=await Promise.all(n.bindingUpdates.map(async({pluginId:h,connectionId:v})=>{const N=await o.callTool({name:"PROJECT_PLUGIN_CONFIG_UPDATE",arguments:{projectId:t.id,pluginId:h,connectionId:v}});return ne(N)}));r.push(...l)}return r},onSuccess:(n,r)=>{r.updatePlugins&&(i.invalidateQueries({queryKey:U.project(e.id,t.slug)}),i.invalidateQueries({queryKey:U.projects(e.id)})),r.bindingUpdates.forEach(({pluginId:l})=>{i.invalidateQueries({queryKey:U.projectPluginConfig(t.id??"",l)})}),g({}),x({}),R.success("Plugins updated successfully")},onError:n=>{R.error("Failed to update plugins: "+(n instanceof Error?n.message:"Unknown error"))},onSettled:()=>{b(!1)}}),P=()=>{b(!0),y.mutate({enabledPlugins:f(),updatePlugins:Object.keys(d).length>0,bindingUpdates:Object.entries(u).map(([n,r])=>({pluginId:n,connectionId:r}))})},C=()=>{g({}),x({})},I=n=>ue.find(r=>r.pluginId===n),S=n=>te.find(l=>l.id===n)?.description??null;return te.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for this project. Enabled plugins will appear in the sidebar."}),s.jsx("div",{className:"divide-y divide-border border-y border-border",children:te.map(n=>{const r=I(n.id),l=S(n.id),h=c(n.id);return s.jsx(We,{plugin:n,isEnabled:h,isSaving:j,pendingBinding:u[n.id],description:l,label:r?.label??n.id,icon:r?.icon,projectId:t.id,client:o,onBindingChange:m,onToggle:w},n.id)})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(L,{variant:"outline",onClick:C,disabled:!p||j,children:"Cancel"}),s.jsx(L,{onClick:P,disabled:!p||j,className:"min-w-24",children:j?"Saving...":"Save Changes"})]})]})}const Ye=ce({name:G().min(1,"Name is required").max(255,"Name is too long"),slug:G().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:G().optional()});function Xe(e){const t=H.c(24),{value:i,onChange:o,name:d}=e,g=q.useRef(null);let u;t[0]!==o?(u=S=>{const n=S.target.files?.[0];if(n){if(n.size>2097152){R.error("Image must be smaller than 2MB");return}const r=new FileReader;r.onerror=()=>{const l=r.error;console.error("FileReader error:",l),R.error(l?.message||"Failed to read image file. Please try again."),g.current&&(g.current.value="")},r.onloadend=()=>{if(r.readyState===FileReader.DONE&&r.result){const l=r.result;o(l)}},r.readAsDataURL(n)}},t[0]=o,t[1]=u):u=t[1];const x=u;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{g.current?.click()},t[2]=j):j=t[2];const b=j;let a;t[3]!==o?(a=S=>{S.stopPropagation(),o("")},t[3]=o,t[4]=a):a=t[4];const c=a;let f;t[5]!==x?(f=s.jsx("input",{type:"file",ref:g,className:"hidden",accept:"image/*",onChange:x}),t[5]=x,t[6]=f):f=t[6];let p;t[7]!==c||t[8]!==d||t[9]!==i?(p=i?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:i,alt:d||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:c,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(Ae,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:b,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(Te,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),t[7]=c,t[8]=d,t[9]=i,t[10]=p):p=t[10];const w=i?"Change Logo":"Upload Logo";let m;t[11]!==w?(m=s.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:b,className:"mb-2",children:w}),t[11]=w,t[12]=m):m=t[12];let y;t[13]!==c||t[14]!==i?(y=i&&s.jsx(L,{type:"button",variant:"ghost",size:"sm",onClick:c,className:"ml-2",children:"Remove"}),t[13]=c,t[14]=i,t[15]=y):y=t[15];let P;t[16]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),t[16]=P):P=t[16];let C;t[17]!==m||t[18]!==y?(C=s.jsxs("div",{className:"flex-1",children:[m,y,P]}),t[17]=m,t[18]=y,t[19]=C):C=t[19];let I;return t[20]!==C||t[21]!==f||t[22]!==p?(I=s.jsxs("div",{className:"flex items-start gap-4",children:[f,p,C]}),t[20]=C,t[21]=f,t[22]=p,t[23]=I):I=t[23],I}function et(){const e=de(),{org:t,project:i}=W(),o=X(),[d,g]=q.useState(!1),u=ae({resolver:oe(Ye),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),x=ee({mutationFn:async a=>{const c={name:a.name,slug:a.slug};a.logo&&(c.logo=a.logo);const f=await ge.organization.update({organizationId:t.id,data:c});if(f?.error)throw new Error(f.error.message||"Failed to update organization");return f},onSuccess:a=>{o.invalidateQueries({queryKey:U.organizations()}),o.invalidateQueries({queryKey:U.activeOrganization(t.slug)}),R.success("Organization settings updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/$project/settings",params:{org:a.data.slug,project:i.slug}})},onError:a=>{R.error(a instanceof Error?a.message:"Failed to update organization")},onSettled:()=>{g(!1)}}),j=a=>{g(!0),x.mutate(a)},b=u.formState.isDirty;return s.jsx(me,{...u,children:s.jsxs("form",{onSubmit:u.handleSubmit(j),className:"space-y-6",children:[s.jsx(Q,{control:u.control,name:"name",render:({field:a})=>s.jsxs($,{children:[s.jsx(K,{children:"Organization Name"}),s.jsx(M,{children:s.jsx(V,{placeholder:"My Organization",...a,disabled:d})}),s.jsx(J,{})]})}),s.jsx(Q,{control:u.control,name:"slug",render:({field:a})=>s.jsxs($,{children:[s.jsx(K,{children:"Organization Slug"}),s.jsx(M,{children:s.jsx(V,{placeholder:"my-organization",...a,disabled:d,onChange:c=>{const f=c.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");a.onChange(f)}})}),s.jsx(se,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(J,{})]})}),s.jsx(Q,{control:u.control,name:"logo",render:({field:a})=>s.jsxs($,{children:[s.jsx(K,{children:"Logo"}),s.jsx(M,{children:s.jsx(Xe,{value:a.value,onChange:a.onChange,name:u.watch("name")})}),s.jsx(J,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(L,{type:"submit",disabled:!b||d,className:"min-w-24",children:d?"Saving...":"Save Changes"}),b&&s.jsx(L,{type:"button",variant:"outline",onClick:()=>u.reset(),disabled:d,children:"Cancel"})]})]})})}function tt(){const e=H.c(44),{org:t,project:i}=W(),o=de(),d=X(),[g,u]=q.useState(""),[x,j]=q.useState(!1),b=i.slug===Y;let a;e[0]!==t.id?(a={connectionId:ie,orgId:t.id},e[0]=t.id,e[1]=a):a=e[1];const c=re(a);let f;e[2]!==c||e[3]!==i.id?(f=async()=>{const _=await c.callTool({name:"PROJECT_DELETE",arguments:{projectId:i.id}});return _.structuredContent??_},e[2]=c,e[3]=i.id,e[4]=f):f=e[4];let p;e[5]!==o||e[6]!==t.id||e[7]!==t.slug||e[8]!==d?(p=_=>{_.success?(d.invalidateQueries({queryKey:U.projects(t.id)}),R.success("Project deleted"),o({to:"/$org/$project",params:{org:t.slug,project:Y}})):R.error(_.message??"Failed to delete project")},e[5]=o,e[6]=t.id,e[7]=t.slug,e[8]=d,e[9]=p):p=e[9];let w;e[10]!==f||e[11]!==p?(w={mutationFn:f,onSuccess:p,onError:st},e[10]=f,e[11]=p,e[12]=w):w=e[12];const m=ee(w);if(b)return null;const y=g===i.name;let P;e[13]!==m?(P=()=>{m.mutate()},e[13]=m,e[14]=P):P=e[14];const C=P;let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=_=>{j(_),_||u("")},e[15]=I):I=e[15];const S=I;let n;e[16]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-destructive",children:"Danger Zone"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Irreversible and destructive actions."})]}),e[16]=n):n=e[16];let r;e[17]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Be,{asChild:!0,children:s.jsx(L,{variant:"destructive",children:"Delete Project"})}),e[17]=r):r=e[17];let l;e[18]!==i.name?(l=s.jsxs(ze,{children:['Delete "',i.name,'"?']}),e[18]=i.name,e[19]=l):l=e[19];let h;e[20]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ke,{children:"This action cannot be undone. All project data will be permanently deleted."}),e[20]=h):h=e[20];let v;e[21]!==l?(v=s.jsxs(Re,{children:[l,h]}),e[21]=l,e[22]=v):v=e[22];let N;e[23]!==i.name?(N=s.jsxs("p",{className:"text-sm mb-2",children:["Type ",s.jsx("strong",{children:i.name})," to confirm:"]}),e[23]=i.name,e[24]=N):N=e[24];let F;e[25]===Symbol.for("react.memo_cache_sentinel")?(F=_=>u(_.target.value),e[25]=F):F=e[25];let O;e[26]!==g||e[27]!==i.name?(O=s.jsx(V,{value:g,onChange:F,placeholder:i.name}),e[26]=g,e[27]=i.name,e[28]=O):O=e[28];let T;e[29]!==N||e[30]!==O?(T=s.jsxs("div",{className:"py-4",children:[N,O]}),e[29]=N,e[30]=O,e[31]=T):T=e[31];let D;e[32]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(Le,{children:"Cancel"}),e[32]=D):D=e[32];const A=!y||m.isPending,z=m.isPending?"Deleting...":"Delete Project";let E;e[33]!==C||e[34]!==A||e[35]!==z?(E=s.jsxs(Ue,{children:[D,s.jsx(qe,{onClick:C,disabled:A,className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:z})]}),e[33]=C,e[34]=A,e[35]=z,e[36]=E):E=e[36];let k;e[37]!==v||e[38]!==T||e[39]!==E?(k=s.jsxs(Me,{children:[v,T,E]}),e[37]=v,e[38]=T,e[39]=E,e[40]=k):k=e[40];let B;return e[41]!==x||e[42]!==k?(B=s.jsxs("div",{className:"border border-destructive/50 rounded-lg p-4 space-y-4",children:[n,s.jsxs($e,{open:x,onOpenChange:S,children:[r,k]})]}),e[41]=x,e[42]=k,e[43]=B):B=e[43],B}function st(e){R.error("Failed to delete project: "+(e instanceof Error?e.message:"Unknown error"))}function At(){const e=H.c(10),{project:t}=W(),i=t.slug===Y;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Z.Header,{children:s.jsx(Z.Header.Left,{children:s.jsx(fe,{children:s.jsx(pe,{children:s.jsx(he,{children:s.jsx(xe,{children:"Settings"})})})})})}),e[0]=o):o=e[0];let d;e[1]!==i?(d=i&&s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Organization"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Update your organization's name, slug, and logo."})]}),s.jsx(et,{})]}),e[1]=i,e[2]=d):d=e[2];let g;e[3]!==i?(g=!i&&s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"General"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Basic project information."})]}),s.jsx(Ge,{})]}),e[3]=i,e[4]=g):g=e[4];let u,x;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Plugins"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage which plugins are enabled and configure them."})]}),s.jsx(Ze,{})]}),x=s.jsx(tt,{}),e[5]=u,e[6]=x):(u=e[5],x=e[6]);let j;return e[7]!==d||e[8]!==g?(j=s.jsxs(Z,{children:[o,s.jsx(Z.Content,{children:s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"p-5 max-w-2xl",children:s.jsxs("div",{className:"space-y-8",children:[d,g,u,x]})})})})})]}),e[7]=d,e[8]=g,e[9]=j):j=e[9],j}export{At as default};
@@ -1 +0,0 @@
1
- import{aW as U,c as O,u as H,j as s,aN as G,r as I,m as M,O as V}from"./index-BV-rIyOx.js";import{a as q}from"./use-project-CzroiUzj.js";import{P as D}from"./index-9vOB29ZB.js";import{C as F}from"./collection-search-Aeh0FXZR.js";import{A as J}from"./avatar-B-AS-16N.js";import{c as K}from"./utils-CfR4kXxZ.js";import{f as W}from"./formatDistanceToNow-Cb2QZZJn.js";import{E as R}from"./empty-state-oU8PNga_.js";import{C as Q}from"./create-project-dialog-49RtElmv.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-Cvo4WJJ5.js";import{B as T}from"./button-Cl3WMTWk.js";import"./useQuery-DDYln2BW.js";import"./constants-1q3hobyw.js";import"./Loading01-DOPFYU4m.js";import"./SearchMd-Ds-ERWzq.js";import"./input-Dv5qvD5N.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./useMutation-BOrtlNTb.js";import"./dialog-BmGDp4UV.js";import"./X-DUGfq2_H.js";import"./form-qYB4UriD.js";import"./textarea-DK_SwVx9.js";import"./Check-Bkb61eVw.js";import"./ChevronRight-BBcOJkyP.js";const te=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function se(t){const e=O.c(58),{project:l,onSettingsClick:c}=t,{org:r}=H(),d=l.ui?.themeColor??"#60a5fa",b=l.ui?.bannerColor??d,m=l.ui?.banner?`url(${l.ui.banner})`:void 0;let i;e[0]!==b||e[1]!==m?(i={backgroundColor:b,backgroundImage:m,backgroundSize:"cover",backgroundPosition:"center"},e[0]=b,e[1]=m,e[2]=i):i=e[2];const _=i;let u;e[3]!==r.slug||e[4]!==l.slug?(u={org:r.slug,project:l.slug},e[3]=r.slug,e[4]=l.slug,e[5]=u):u=e[5];let f;e[6]!==c?(f=B=>{B.preventDefault(),B.stopPropagation(),c?.(B)},e[6]=c,e[7]=f):f=e[7];let x,v;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=K("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors","opacity-0 group-hover:opacity-100"),v=s.jsx(te,{className:"size-3.5 text-white"}),e[8]=x,e[9]=v):(x=e[8],v=e[9]);let g;e[10]!==f?(g=s.jsx("button",{type:"button",onClick:f,className:x,children:v}),e[10]=f,e[11]=g):g=e[11];let p;e[12]!==_||e[13]!==g?(p=s.jsx("div",{className:"h-20 relative",style:_,children:g}),e[12]=_,e[13]=g,e[14]=p):p=e[14];let n;e[15]!==l.name||e[16]!==l.ui||e[17]!==d?(n=l.ui?.icon?s.jsx("img",{src:l.ui.icon,alt:"",className:"size-8 rounded-md object-cover"}):s.jsx("div",{className:"size-8 rounded-md flex items-center justify-center",style:{backgroundColor:d},children:s.jsx("span",{className:"text-sm font-medium text-white",children:l.name.charAt(0).toUpperCase()})}),e[15]=l.name,e[16]=l.ui,e[17]=d,e[18]=n):n=e[18];let a;e[19]!==l.name?(a=s.jsx("h3",{className:"font-medium text-base text-foreground truncate",children:l.name}),e[19]=l.name,e[20]=a):a=e[20];let h;e[21]!==l.updatedAt?(h=W(new Date(l.updatedAt),{addSuffix:!0}),e[21]=l.updatedAt,e[22]=h):h=e[22];let j;e[23]!==h?(j=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edited"," ",h]}),e[23]=h,e[24]=j):j=e[24];let N;e[25]!==a||e[26]!==j?(N=s.jsxs("div",{className:"flex flex-col",children:[a,j]}),e[25]=a,e[26]=j,e[27]=N):N=e[27];let C;e[28]!==n||e[29]!==N?(C=s.jsxs("div",{className:"flex flex-col gap-4",children:[n,N]}),e[28]=n,e[29]=N,e[30]=C):C=e[30];let k;e[31]!==l.boundConnections?(k=l.boundConnections.slice(0,4).map(le),e[31]=l.boundConnections,e[32]=k):k=e[32];let P;e[33]!==l.boundConnections.length?(P=l.boundConnections.length>4&&s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsxs("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center text-xs text-muted-foreground",children:["+",l.boundConnections.length-4]})}),e[33]=l.boundConnections.length,e[34]=P):P=e[34];let y;e[35]!==k||e[36]!==P?(y=s.jsxs("div",{className:"flex pr-2",children:[k,P]}),e[35]=k,e[36]=P,e[37]=y):y=e[37];const z=r.logo??void 0;let w;e[38]!==r.name||e[39]!==z?(w=s.jsx(J,{url:z,fallback:r.name,size:"2xs",className:"shrink-0 rounded",objectFit:"cover"}),e[38]=r.name,e[39]=z,e[40]=w):w=e[40];let S;e[41]!==r.name?(S=s.jsx("span",{className:"truncate max-w-20",children:r.name}),e[41]=r.name,e[42]=S):S=e[42];let o;e[43]!==w||e[44]!==S?(o=s.jsxs("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[w,S]}),e[43]=w,e[44]=S,e[45]=o):o=e[45];let L;e[46]!==y||e[47]!==o?(L=s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[y,o]}),e[46]=y,e[47]=o,e[48]=L):L=e[48];let $;e[49]!==C||e[50]!==L?($=s.jsxs("div",{className:"flex flex-col flex-1 justify-between p-4",children:[C,L]}),e[49]=C,e[50]=L,e[51]=$):$=e[51];let A;e[52]!==$||e[53]!==p?(A=s.jsxs("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[p,$]}),e[52]=$,e[53]=p,e[54]=A):A=e[54];let E;return e[55]!==A||e[56]!==u?(E=s.jsx(G,{to:"/$org/$project",params:u,className:"block group",children:A}),e[55]=A,e[56]=u,e[57]=E):E=e[57],E}function le(t){return s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsx(re,{connection:t})},t.id)}function re(t){const e=O.c(13),{connection:l}=t;if(l.icon){let m;e[0]!==l.icon||e[1]!==l.title?(m=s.jsx("img",{src:l.icon,alt:l.title,className:"size-4 object-cover"}),e[0]=l.icon,e[1]=l.title,e[2]=m):m=e[2];let i;return e[3]!==l.title||e[4]!==m?(i=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:l.title,children:m}),e[3]=l.title,e[4]=m,e[5]=i):i=e[5],i}const c=l.title;let r;e[6]!==l.title?(r=l.title.charAt(0).toUpperCase(),e[6]=l.title,e[7]=r):r=e[7];let d;e[8]!==r?(d=s.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:r}),e[8]=r,e[9]=d):d=e[9];let b;return e[10]!==l.title||e[11]!==d?(b=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:c,children:d}),e[10]=l.title,e[11]=d,e[12]=b):b=e[12],b}function $e(){const t=O.c(40),{org:e}=H(),{data:l,isLoading:c}=q(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=M();let _,u,f,x,v,g,p,n,a;if(t[0]!==c||t[1]!==i||t[2]!==e.slug||t[3]!==l||t[4]!==r){const C=l?.filter(ie)?.filter(o=>o.name.toLowerCase().includes(r.toLowerCase())||o.description?.toLowerCase().includes(r.toLowerCase()))??[];let k;t[14]!==i||t[15]!==e.slug?(k=o=>{i({to:"/$org/$project/settings",params:{org:e.slug,project:o}})},t[14]=i,t[15]=e.slug,t[16]=k):k=t[16];const P=k;let y;t[17]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m(!0)},t[17]=y):y=t[17];const z=y;u=D;let w;t[18]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(D.Header.Left,{children:s.jsx(X,{children:s.jsx(Y,{children:s.jsx(Z,{children:s.jsx(ee,{children:"Projects"})})})})}),t[18]=w):w=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(D.Header,{children:[w,s.jsx(D.Header.Right,{children:s.jsx(T,{onClick:z,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Create new project"})})]}),t[19]=n):n=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o=>{o.key==="Escape"&&(d(""),o.target.blur())},t[20]=S):S=t[20],t[21]!==r?(a=s.jsx(F,{value:r,onChange:d,placeholder:"Search for a project...",onKeyDown:S}),t[21]=r,t[22]=a):a=t[22],_=D.Content,f="@container",t[23]!==c?(x=c&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:[...Array(4)].map(oe)})}),t[23]=c,t[24]=x):x=t[24],v=!c&&C.length===0&&r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(R,{title:"No projects found",description:`No projects match "${r}"`})}),g=!c&&C.length===0&&!r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(R,{title:"No projects yet",description:"Create a project to get started.",actions:s.jsx(T,{onClick:z,children:"Create new project"})})}),p=!c&&C.length>0&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:C.map(o=>s.jsx(se,{project:o,onSettingsClick:()=>P(o.slug)},o.id))})}),t[0]=c,t[1]=i,t[2]=e.slug,t[3]=l,t[4]=r,t[5]=_,t[6]=u,t[7]=f,t[8]=x,t[9]=v,t[10]=g,t[11]=p,t[12]=n,t[13]=a}else _=t[5],u=t[6],f=t[7],x=t[8],v=t[9],g=t[10],p=t[11],n=t[12],a=t[13];let h;t[25]!==_||t[26]!==f||t[27]!==x||t[28]!==v||t[29]!==g||t[30]!==p?(h=s.jsxs(_,{className:f,children:[x,v,g,p]}),t[25]=_,t[26]=f,t[27]=x,t[28]=v,t[29]=g,t[30]=p,t[31]=h):h=t[31];let j;t[32]!==b?(j=s.jsx(Q,{open:b,onOpenChange:m}),t[32]=b,t[33]=j):j=t[33];let N;return t[34]!==u||t[35]!==n||t[36]!==a||t[37]!==h||t[38]!==j?(N=s.jsxs(u,{children:[n,a,h,j]}),t[34]=u,t[35]=n,t[36]=a,t[37]=h,t[38]=j,t[39]=N):N=t[39],N}function oe(t,e){return s.jsx("div",{className:"h-[240px] rounded-xl bg-muted animate-pulse"},e)}function ie(t){return t.slug!==V}export{$e as default};
@@ -1 +0,0 @@
1
- import{r as c,a$ as rt,am as Ne,j as d,as as st,at as be,al as k,au as lt,_ as j,an as P,b0 as $,aw as at,Z as _e,ax as Ee,b1 as it,ao as ct,b2 as dt,ay as ut,aB as pt,az as ft,aC as mt,aD as ht,aq as vt,aA as gt,aE as xt,aF as St,c as ee}from"./index-BV-rIyOx.js";import{V as wt}from"./index-BYzsWn1B.js";import{i as Ct}from"./Check-Bkb61eVw.js";import{t as Re}from"./ChevronDown-DqJTvBdv.js";import{c as oe}from"./utils-CfR4kXxZ.js";function Pe(n,[e,t]){return Math.min(t,Math.max(e,n))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=it(J),[ne]=vt(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Nt,Pt]=ne(J),je=n=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:r,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=n,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[F,M]=c.useState(!1),re=rt(u),[_,O]=Ne({prop:o,defaultProp:r??!1,onChange:i,caller:J}),[U,q]=Ne({prop:s,defaultProp:l,onChange:a,caller:J}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(st,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Nt,{scope:n.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:b,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=c.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:o=!1,...r}=n,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(lt,{asChild:!0,...i,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...r,ref:a,onClick:P(r.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:P(r.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:P(r.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,children:i,placeholder:s="",...l}=n,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):i})});De.displayName=Oe;var _t="SelectIcon",ke=c.forwardRef((n,e)=>{const{__scopeSelect:t,children:o,...r}=n;return d.jsx(j.span,{"aria-hidden":!0,...r,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=n=>d.jsx(at,{asChild:!0,...n});Le.displayName=Et;var Q="SelectContent",Be=c.forwardRef((n,e)=>{const t=G(Q,n.__scopeSelect),[o,r]=c.useState();if($(()=>{r(new DocumentFragment)},[]),!t.open){const i=o;return i?_e.createPortal(d.jsx(Ve,{scope:n.__scopeSelect,children:d.jsx(de.Slot,{scope:n.__scopeSelect,children:d.jsx("div",{children:n.children})})}),i):null}return d.jsx(He,{...n,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=gt("SelectContent.RemoveScroll"),He=c.forwardRef((n,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=n,m=G(Q,t),[x,F]=c.useState(null),[M,re]=c.useState(null),_=k(e,f=>F(f)),[O,U]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return ut(x)},[x]),pt();const E=c.useCallback(f=>{const[T,...R]=B().map(N=>N.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const N of f)if(N===I||(N?.scrollIntoView({block:"nearest"}),N===T&&M&&(M.scrollTop=0),N===y&&M&&(M.scrollTop=M.scrollHeight),N?.focus(),document.activeElement!==I))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),c.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(U(f),y&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(ft,{as:jt,allowPinchZoom:!0,children:d.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:P(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,N=y.indexOf(I);y=y.slice(N+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:o,...r}=n,i=G(Q,t),s=Y(Q,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,_=>h(_)),b=ue(t),w=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const _=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const I=q.left-O.left,N=U.left-I,Z=_.left-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,N=window.innerWidth-U.right-I,Z=window.innerWidth-_.right-N,X=_.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Pe(N,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ie=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const N=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ie,se+(I?he:0)+N+D),X=T+Z;l.style.height=X+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[F,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...r,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((n,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:r=A,...i}=n,s=pe(t);return d.jsx(xt,{...s,...i,ref:e,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=c.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:o,...r}=n,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=be();return d.jsx(Dt,{scope:t,id:r,children:d.jsx(j.div,{role:"group","aria-labelledby":r,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=kt(We,t);return d.jsx(j.div,{id:r.id,...o,ref:e})});Bt.displayName=We;var ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((n,e)=>{const{__scopeSelect:t,value:o,disabled:r=!1,textValue:i,...s}=n,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[b,w]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,r)),p=be(),v=c.useRef("touch"),C=()=>{r||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:r,textId:p,isSelected:u,onItemTextChange:c.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:r,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...s,ref:S,onFocus:P(s.onFocus,()=>w(!0)),onBlur:P(s.onBlur,()=>w(!1)),onClick:P(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:P(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:P(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:P(s.onPointerMove,m=>{v.current=m.pointerType,r?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,...i}=n,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Pt(le,t),[h,g]=c.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=c.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...i,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Ze=c.forwardRef((n,e)=>{const t=Y(Ce,n.__scopeSelect),o=Te(Ce,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=Ce;var ye="SelectScrollDownButton",Xe=c.forwardRef((n,e)=>{const t=Y(ye,n.__scopeSelect),o=Te(ye,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=ye;var Je=c.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:o,...r}=n,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:P(r.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:P(r.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(St,{...r,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=c.forwardRef(({__scopeSelect:n,value:e,...t},o)=>{const r=c.useRef(null),i=k(o,r),s=ct(e);return c.useEffect(()=>{const l=r.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...wt,...t.style},ref:i,defaultValue:e})});Qe.displayName=Ut;function et(n){return n===""||n===void 0}function tt(n){const e=dt(n),t=c.useRef(""),o=c.useRef(0),r=c.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,r,i]}function ot(n,e,t){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let s=Wt(n,Math.max(i,0));r.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return a!==t?a:void 0}function Wt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;const nt=({size:n=24,color:e="currentColor",...t})=>c.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},c.createElement("path",{d:"m18 15-6-6-6 6"}));nt.displayName="ChevronUp";function uo(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(n){const e=ee.c(13);let t,o,r,i;e[0]!==n?({className:o,size:i,children:t,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"default":i;let l;e[5]!==o?(l=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...r,children:[t,a]}),e[8]=t,e[9]=r,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(n){const e=ee.c(25);let t,o,r,i,s;e[0]!==n?({className:o,children:t,position:i,hideScrollButtons:s,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i,e[5]=s):(t=e[1],o=e[2],r=e[3],i=e[4],s=e[5]);const l=i===void 0?"popper":i,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Xt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==r||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",className:h,position:l,...r,children:[g,S,p]})}),e[18]=l,e[19]=r,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(n){const e=ee.c(16);let t,o,r,i;e[0]!==n?({className:o,children:t,hideCheck:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?!1:i;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(Ct,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==r||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...r,children:[a,u]}),e[11]=r,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(nt,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}function ro(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Pe as e,nt as n};
@@ -1 +0,0 @@
1
- import{r as c,j as i,_ as C,al as y,am as T,an as I,ao as M,ap as H,aq as q,c as z}from"./index-BV-rIyOx.js";import{c as g}from"./utils-CfR4kXxZ.js";var b="Switch",[A]=q(b),[U,L]=A(b),E=c.forwardRef((s,e)=>{const{__scopeSwitch:t,name:r,checked:a,defaultChecked:n,required:o,disabled:d,value:u="on",onCheckedChange:k,form:l,...w}=s,[p,h]=c.useState(null),v=y(e,m=>h(m)),x=c.useRef(!1),S=p?l||!!p.closest("form"):!0,[f,N]=T({prop:a,defaultProp:n??!1,onChange:k,caller:b});return i.jsxs(U,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":o,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...w,ref:v,onClick:I(s.onClick,m=>{N(B=>!B),S&&(x.current=m.isPropagationStopped(),x.current||m.stopPropagation())})}),S&&i.jsx(R,{control:p,bubbles:!x.current,name:r,value:u,checked:f,required:o,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});E.displayName=b;var P="SwitchThumb",_=c.forwardRef((s,e)=>{const{__scopeSwitch:t,...r}=s,a=L(P,t);return i.jsx(C.span,{"data-state":j(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});_.displayName=P;var O="SwitchBubbleInput",R=c.forwardRef(({__scopeSwitch:s,control:e,checked:t,bubbles:r=!0,...a},n)=>{const o=c.useRef(null),d=y(o,n),u=M(t),k=H(e);return c.useEffect(()=>{const l=o.current;if(!l)return;const w=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&h){const v=new Event("click",{bubbles:r});h.call(l,t),l.dispatchEvent(v)}},[u,t,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...a,tabIndex:-1,ref:d,style:{...a.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});R.displayName=O;function j(s){return s?"checked":"unchecked"}var $=E,D=_;function X(s){const e=z.c(9);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(D,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==a?(o=i.jsx($,{"data-slot":"switch",className:a,...r,children:n}),e[6]=r,e[7]=a,e[8]=o):o=e[8],o}export{X as S};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-CrYps4St.js";import{a0 as i}from"./index-BV-rIyOx.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{a0 as u,a3 as s}from"./index-BV-rIyOx.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -1 +0,0 @@
1
- import{a7 as a,a8 as t}from"./index-BV-rIyOx.js";function e(...r){return a(t(r))}export{e as c};