decocms 2.306.13 → 2.306.14

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 (183) hide show
  1. package/dist/client/assets/{AlertCircle-UghQPlAa.js → AlertCircle-VdAWApZT.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-1BfkUm85.js → ArrowNarrowLeft-Cb6jcK-n.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-1rqShrTM.js → ArrowUpRight-B2ZjjZJQ.js} +1 -1
  4. package/dist/client/assets/{Check-DBWnyOFJ.js → Check-BiM2-TvW.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-CBMgXE-F.js → CheckCircle-Ch05HHgc.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-D452dgSU.js → ChevronDown-v_6fVP4M.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-DoY3rcf9.js → ChevronRight-Dzob6m1m.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-BlZFoG59.js → ChevronUp-CUfrmF0I.js} +1 -1
  9. package/dist/client/assets/{Container-BQVUd9tN.js → Container-D0YzBjXF.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CAgAGLKz.js → DotsVertical-D--w_iaX.js} +1 -1
  11. package/dist/client/assets/{LinkExternal01-CGcDVdEi.js → LinkExternal01-QD8wgK8o.js} +1 -1
  12. package/dist/client/assets/{Lock01-FiMk9Cv6.js → Lock01-DJV5JMDy.js} +1 -1
  13. package/dist/client/assets/{Palette-DXyBGBQu.js → Palette-CEmO1kUS.js} +1 -1
  14. package/dist/client/assets/{Play-CDjH79to.js → Play-CRDhnWxZ.js} +1 -1
  15. package/dist/client/assets/{Plus-FC_C8qkl.js → Plus-DDMryLp9.js} +1 -1
  16. package/dist/client/assets/{RefreshCcw01-Cd8Km121.js → RefreshCcw01-BNG_5rJW.js} +1 -1
  17. package/dist/client/assets/{SearchMd-B780aQOS.js → SearchMd-BL69FKVv.js} +1 -1
  18. package/dist/client/assets/{Settings02--XuHa5eI.js → Settings02-CHdnS1Le.js} +1 -1
  19. package/dist/client/assets/{Shield01-Bg1T1EGa.js → Shield01-CDWmokZC.js} +1 -1
  20. package/dist/client/assets/{Star01-DRidtrYn.js → Star01-C0QV--XQ.js} +1 -1
  21. package/dist/client/assets/{Sun-Bpli4t2N.js → Sun-B4qv1AhA.js} +1 -1
  22. package/dist/client/assets/{Tool01-NWIcFn9q.js → Tool01-DZ5nMk2X.js} +1 -1
  23. package/dist/client/assets/{Trash01-4w6_aW9X.js → Trash01-EHajsAd0.js} +1 -1
  24. package/dist/client/assets/{User01-CxpWRrdM.js → User01-DMVSPQ8_.js} +1 -1
  25. package/dist/client/assets/{Users03-CK1Aa1HI.js → Users03-Bpy5JElG.js} +1 -1
  26. package/dist/client/assets/{X-BGh8G2l7.js → X-BdF-Ta2X.js} +1 -1
  27. package/dist/client/assets/{XCircle-CYGTZyzW.js → XCircle-Mzs74oa5.js} +1 -1
  28. package/dist/client/assets/{XClose-Dz5yGfpm.js → XClose-BKDvrGgg.js} +1 -1
  29. package/dist/client/assets/{Zap-Druw6RpX.js → Zap-B1XrF636.js} +1 -1
  30. package/dist/client/assets/{ZapSquare-BLhBRchY.js → ZapSquare-CM6EGSyy.js} +1 -1
  31. package/dist/client/assets/{accordion-DdQd4o33.js → accordion-BG6WV2yf.js} +1 -1
  32. package/dist/client/assets/{agent-icon-CznXZlOI.js → agent-icon-CkZZqRPj.js} +1 -1
  33. package/dist/client/assets/{agents-list-CaQhK_9Q.js → agents-list-Gt0A9Rtw.js} +1 -1
  34. package/dist/client/assets/ai-providers-vZDvpB2X.js +1 -0
  35. package/dist/client/assets/{alert-dialog-BiN56dOX.js → alert-dialog-BiImvuLv.js} +1 -1
  36. package/dist/client/assets/{auth-catchall-6Av77aQi.js → auth-catchall-CI5uzK_0.js} +1 -1
  37. package/dist/client/assets/{automation-list-row-DdlSuO-v.js → automation-list-row-DgBTeHKk.js} +1 -1
  38. package/dist/client/assets/{automations-BMuo3AXx.js → automations-1RQ_Ya9s.js} +1 -1
  39. package/dist/client/assets/{avatar-Z1wN1pq-.js → avatar-q80j4hVX.js} +1 -1
  40. package/dist/client/assets/{badge-CTmf2TW8.js → badge-C8h2D-cf.js} +1 -1
  41. package/dist/client/assets/{brand-context-CUDRGuTh.js → brand-context--QAUCooh.js} +1 -1
  42. package/dist/client/assets/{card-Bd8klEwI.js → card-Dv-Qnw_l.js} +1 -1
  43. package/dist/client/assets/{chat-context-DGU47jw7.js → chat-context-Cs8XiFv-.js} +1 -1
  44. package/dist/client/assets/{checkbox-B3EwrxkO.js → checkbox-cUUI4UbZ.js} +1 -1
  45. package/dist/client/assets/{collection-detail-Cgmw3RVY.js → collection-detail-DdBUKeCk.js} +1 -1
  46. package/dist/client/assets/{collection-display-button-DMmbKfya.js → collection-display-button-CTTtVxZI.js} +1 -1
  47. package/dist/client/assets/{collection-search-D-x3SJ1z.js → collection-search-BEV6zp35.js} +1 -1
  48. package/dist/client/assets/{collection-search-Do2r8Bif.js → collection-search-CSWcPc5L.js} +1 -1
  49. package/dist/client/assets/{collection-table-wrapper-CtvRahI-.js → collection-table-wrapper-DQYbUgU8.js} +1 -1
  50. package/dist/client/assets/{collection-tabs-BKqleLTU.js → collection-tabs-CfplzF48.js} +1 -1
  51. package/dist/client/assets/{collections-67ZnQ_LS.js → collections-ohRmFoyb.js} +1 -1
  52. package/dist/client/assets/{command-BAMG06m5.js → command-DDwhSRvD.js} +1 -1
  53. package/dist/client/assets/{connection-card-DQm8aezN.js → connection-card-D5kgRWc3.js} +1 -1
  54. package/dist/client/assets/{connection-detail-BhxCMY6j.js → connection-detail-Bn-xI-SY.js} +1 -1
  55. package/dist/client/assets/{connection-form-helpers--6zqXj9i.js → connection-form-helpers-Bi1lg2fC.js} +1 -1
  56. package/dist/client/assets/{connections-C0gQbHBs.js → connections-0dR0fYEw.js} +1 -1
  57. package/dist/client/assets/{constants-BDk5hb7z.js → constants-B0iAJAyD.js} +1 -1
  58. package/dist/client/assets/{constants-DXQgV2hu.js → constants-BGb3csMB.js} +1 -1
  59. package/dist/client/assets/{dialog-DUgfuVrb.js → dialog-B9k-J44Q.js} +1 -1
  60. package/dist/client/assets/{domain-settings-DpONcUPd.js → domain-settings-BDwmEILK.js} +1 -1
  61. package/dist/client/assets/{drawer-DeyjQQc7.js → drawer-C2prDcqZ.js} +1 -1
  62. package/dist/client/assets/{dropdown-menu-Cbx_bdO_.js → dropdown-menu-DCt7nnpF.js} +1 -1
  63. package/dist/client/assets/{dynamic-plugin-layout-D7HG8B_t.js → dynamic-plugin-layout-DMU6tYwj.js} +1 -1
  64. package/dist/client/assets/{empty-state-BIAZXmQO.js → empty-state-DMA3XSg2.js} +1 -1
  65. package/dist/client/assets/{empty-state-BnjbbhBR.js → empty-state-DkUQz5Y_.js} +1 -1
  66. package/dist/client/assets/{extract-connection-data-Dgw7Sgd3.js → extract-connection-data-Du0Nr7p1.js} +1 -1
  67. package/dist/client/assets/{features-De6GvAAs.js → features-DS7y3VlZ.js} +1 -1
  68. package/dist/client/assets/{form-O0xus6j8.js → form-kltPHESZ.js} +1 -1
  69. package/dist/client/assets/{general-tEcdYerZ.js → general-DdyLkb4p.js} +1 -1
  70. package/dist/client/assets/{index-CdFJkiAN.js → index-B5mfsg_s.js} +1 -1
  71. package/dist/client/assets/{index-DdsW868M.js → index-BCJLKe3B.js} +1 -1
  72. package/dist/client/assets/{index-DJiWK6lj.js → index-BFJo4vrg.js} +1 -1
  73. package/dist/client/assets/{index-CZLTTN-z.js → index-BKV2fRzm.js} +1 -1
  74. package/dist/client/assets/{index-CuVn0uMY.js → index-BPz6vLPS.js} +1 -1
  75. package/dist/client/assets/{index-XGdWuQyL.js → index-BikT2EMs.js} +1 -1
  76. package/dist/client/assets/{index-Dcg8Qevd.js → index-CHrUmZgp.js} +2 -2
  77. package/dist/client/assets/{index-DZjKh5eS.js → index-CPTlnotN.js} +3 -3
  78. package/dist/client/assets/{index-DV-VioVg.js → index-Che5DeTo.js} +1 -1
  79. package/dist/client/assets/{index-CG3ceZHc.js → index-CxB2xnH4.js} +1 -1
  80. package/dist/client/assets/{index-i68m5nvc.js → index-D9ZWPEnV.js} +1 -1
  81. package/dist/client/assets/{index-DPM8__xA.js → index-DB0YdXxd.js} +1 -1
  82. package/dist/client/assets/index-DKSxK_Wl.js +1 -0
  83. package/dist/client/assets/{index-CqFBXkjQ.js → index-DV65bUQf.js} +1 -1
  84. package/dist/client/assets/{index-DtUGvIts.js → index-Dq__xIAQ.js} +1 -1
  85. package/dist/client/assets/{index-EV8zcDnc.js → index-jJk33FDJ.js} +1 -1
  86. package/dist/client/assets/{infiniteQueryObserver-D9yYekai.js → infiniteQueryObserver-BondwvTH.js} +1 -1
  87. package/dist/client/assets/{input-Cvo2jJQf.js → input-Do0Zx2-t.js} +1 -1
  88. package/dist/client/assets/{integration-icon-DTJ2wb4X.js → integration-icon-BU0UtHw1.js} +1 -1
  89. package/dist/client/assets/{label-_jNQo8Ll.js → label-xFeGPJPK.js} +1 -1
  90. package/dist/client/assets/{layout-DbwGS2qx.js → layout-Bh0Tzv5J.js} +1 -1
  91. package/dist/client/assets/{lean-canvas-recruit-modal-tP8fRQib.js → lean-canvas-recruit-modal-Bi0R10xw.js} +1 -1
  92. package/dist/client/assets/{login-DehPjhCM.js → login-DFLXeUmR.js} +1 -1
  93. package/dist/client/assets/{members-BMPf1BpS.js → members-DMjA2IwS.js} +1 -1
  94. package/dist/client/assets/{monaco-editor-BVARKKWN.js → monaco-editor-BZYPmAIH.js} +1 -1
  95. package/dist/client/assets/{monitoring-stats-row-D7tWgW-Q.js → monitoring-stats-row-B44nIKev.js} +1 -1
  96. package/dist/client/assets/{oauth-callback-l4PY6t1A.js → oauth-callback-CoQK7QX3.js} +1 -1
  97. package/dist/client/assets/{oauth-callback-ai-provider-DC-UED8v.js → oauth-callback-ai-provider-DWII6eI4.js} +1 -1
  98. package/dist/client/assets/{onboarding-Bd6pQbk3.js → onboarding-D-GymYEI.js} +1 -1
  99. package/dist/client/assets/{org-layout-COoj2PVG.js → org-layout-B4d_ZkIu.js} +1 -1
  100. package/dist/client/assets/{org-plugin-layout-DGnpwRtk.js → org-plugin-layout-PFHlgq8g.js} +1 -1
  101. package/dist/client/assets/{pair-_253DGSq.js → pair-BVw6SD1z.js} +1 -1
  102. package/dist/client/assets/{plugin-empty-state-CakFVZ2i.js → plugin-empty-state-9i7dQecv.js} +1 -1
  103. package/dist/client/assets/{plugin-header-6TMFE3Ls.js → plugin-header-Yv_MlSUJ.js} +1 -1
  104. package/dist/client/assets/{plugin-layout-3m9okTPI.js → plugin-layout-CmfsA57I.js} +1 -1
  105. package/dist/client/assets/{popover-DNu8C4Ll.js → popover-C6TGJ7tP.js} +1 -1
  106. package/dist/client/assets/{profile-CLBWN3L8.js → profile-B5Uqg-1n.js} +1 -1
  107. package/dist/client/assets/{project-app-view-5ZnU4fo7.js → project-app-view-Cym9YWZI.js} +1 -1
  108. package/dist/client/assets/registry-D_eMoOoM.js +2 -0
  109. package/dist/client/assets/{registry-layout-Hazgpecz.js → registry-layout-DN05Co_7.js} +1 -1
  110. package/dist/client/assets/{required-auth-layout-Cg8CZTlk.js → required-auth-layout-BgC3m76H.js} +1 -1
  111. package/dist/client/assets/{reset-password-CzwUFBho.js → reset-password-DIKcKBJA.js} +1 -1
  112. package/dist/client/assets/{roles-DUtgWupV.js → roles-YwWd0IU_.js} +1 -1
  113. package/dist/client/assets/{scroll-area-DGEAK3pH.js → scroll-area-Dm9XewPU.js} +1 -1
  114. package/dist/client/assets/{search-input-C50ImRzg.js → search-input-B6ULbBJE.js} +1 -1
  115. package/dist/client/assets/{select-DkBE5ypj.js → select-CQme0ALA.js} +1 -1
  116. package/dist/client/assets/{select-model-B9xghDV8.js → select-model-DXawshPk.js} +1 -1
  117. package/dist/client/assets/{settings-layout-u6gOtHmU.js → settings-layout-B6BcNt_F.js} +1 -1
  118. package/dist/client/assets/{settings-section-DeAx6MsQ.js → settings-section-CX6DrRQc.js} +1 -1
  119. package/dist/client/assets/{shell-layout-xLg1cKrj.js → shell-layout-BYMnLoch.js} +1 -1
  120. package/dist/client/assets/{skeleton-BL7idETO.js → skeleton-CcWsdROd.js} +1 -1
  121. package/dist/client/assets/{sso-UHrPOY4-.js → sso-Bn24EPSu.js} +1 -1
  122. package/dist/client/assets/{store-CCrp-zDu.js → store-CnYcJcjA.js} +1 -1
  123. package/dist/client/assets/store-registry-avYOji8Y.js +2 -0
  124. package/dist/client/assets/{switch-Ba2DX0J8.js → switch-iFtU_Uj0.js} +1 -1
  125. package/dist/client/assets/{table-Dpjp6sno.js → table-CrLtxirL.js} +1 -1
  126. package/dist/client/assets/{tabs-CUXWIghp.js → tabs-CLXQLaZb.js} +1 -1
  127. package/dist/client/assets/{task-status-D6HaLDfU.js → task-status-CAq0fkQN.js} +1 -1
  128. package/dist/client/assets/{textarea-e7WVG0Uq.js → textarea-Biq9f3vB.js} +1 -1
  129. package/dist/client/assets/{toggle-group-Bzjy8IQq.js → toggle-group-Dj5MlNbV.js} +1 -1
  130. package/dist/client/assets/{tools-list-ddVo-6Vs.js → tools-list-CEc7i5TR.js} +1 -1
  131. package/dist/client/assets/{tooltip-sn7TXXXA.js → tooltip-oz4PgHaK.js} +1 -1
  132. package/dist/client/assets/{types-ClFDwb3j.js → types-0ZrdjKIw.js} +1 -1
  133. package/dist/client/assets/{use-ai-providers-D1ZzNZfi.js → use-ai-providers-BfAEQYsq.js} +1 -1
  134. package/dist/client/assets/{use-collections-DDocavcC.js → use-collections-wkyc_t0D.js} +1 -1
  135. package/dist/client/assets/{use-connection-wzOJDB7e.js → use-connection-BUWHubVp.js} +1 -1
  136. package/dist/client/assets/{use-copy-D0VCYdzD.js → use-copy-B_R6LHdW.js} +1 -1
  137. package/dist/client/assets/{use-create-virtual-mcp-BQ9UAVGc.js → use-create-virtual-mcp-BZc2oenO.js} +1 -1
  138. package/dist/client/assets/{use-debounced-autosave-vxXjJ2-V.js → use-debounced-autosave-Xsez6aVB.js} +1 -1
  139. package/dist/client/assets/{use-decopilot-events-CQn9-0iO.js → use-decopilot-events-Dr4V34eZ.js} +1 -1
  140. package/dist/client/assets/{use-delete-connection-C1mV-M2x.js → use-delete-connection-BLaFqj11.js} +1 -1
  141. package/dist/client/assets/{use-infinite-scroll-CyUixfAd.js → use-infinite-scroll-B6tdlom4.js} +1 -1
  142. package/dist/client/assets/{use-list-state-BkqBgDIi.js → use-list-state-CJyagGju.js} +1 -1
  143. package/dist/client/assets/{use-mcp-tools-Cu2GPPjO.js → use-mcp-tools-bTkNBvHW.js} +1 -1
  144. package/dist/client/assets/{use-members-Bw_9meIY.js → use-members-DzIKSYZr.js} +1 -1
  145. package/dist/client/assets/{use-navigate-to-agent-BvnJAyr6.js → use-navigate-to-agent-DC4juKfS.js} +1 -1
  146. package/dist/client/assets/{use-org-auth-client-uXh4lV5h.js → use-org-auth-client-C9dbWRTq.js} +1 -1
  147. package/dist/client/assets/{use-org-sso-Co0XjU-j.js → use-org-sso-Oco51-Ud.js} +1 -1
  148. package/dist/client/assets/{use-organization-roles-CXi0dKrO.js → use-organization-roles-CKRT39Yc.js} +1 -1
  149. package/dist/client/assets/{use-organization-settings-OER3kM7D.js → use-organization-settings-B78MMPj6.js} +1 -1
  150. package/dist/client/assets/{use-registry-connections-LYUFCGgQ.js → use-registry-connections-BfK6vb9O.js} +1 -1
  151. package/dist/client/assets/{use-status-sounds-CQVr-jwf.js → use-status-sounds-CD6ccTBR.js} +1 -1
  152. package/dist/client/assets/{use-tasks-B8ZzLgVK.js → use-tasks-LY5kqeAJ.js} +1 -1
  153. package/dist/client/assets/{use-view-mode-ti5AMLDX.js → use-view-mode-Bp7xTow9.js} +1 -1
  154. package/dist/client/assets/{use-virtual-mcp-Cvy2Xx_N.js → use-virtual-mcp-BBYFAnp2.js} +1 -1
  155. package/dist/client/assets/useInfiniteQuery-7WbFFwUo.js +1 -0
  156. package/dist/client/assets/useSuspenseInfiniteQuery-aIoxf3FE.js +1 -0
  157. package/dist/client/assets/{user-Dst4Prvf.js → user-40IaywxT.js} +1 -1
  158. package/dist/client/assets/{view-mode-toggle-Ca3EQ8LL.js → view-mode-toggle-b04RsQAD.js} +1 -1
  159. package/dist/client/assets/{workflow-BUQXpyzH.js → workflow-BzGWQKQG.js} +1 -1
  160. package/dist/client/assets/workflow-detail-DpYh98qm.js +1 -0
  161. package/dist/client/index.html +1 -1
  162. package/dist/server/cli.js +12 -1
  163. package/dist/server/node_modules/xtend/.jshintrc +30 -0
  164. package/dist/server/node_modules/xtend/LICENSE +20 -0
  165. package/dist/server/node_modules/xtend/README.md +32 -0
  166. package/dist/server/node_modules/xtend/immutable.js +19 -0
  167. package/dist/server/node_modules/xtend/mutable.js +17 -0
  168. package/dist/server/node_modules/xtend/package.json +55 -0
  169. package/dist/server/node_modules/xtend/test.js +103 -0
  170. package/dist/server/server.js +11 -0
  171. package/package.json +1 -1
  172. package/dist/client/assets/ai-providers-C_QaV2LV.js +0 -1
  173. package/dist/client/assets/index-BZ6nkz4a.js +0 -1
  174. package/dist/client/assets/registry-D_jmaKr2.js +0 -2
  175. package/dist/client/assets/store-registry-dlSCWL84.js +0 -2
  176. package/dist/client/assets/useInfiniteQuery-eCacXMD5.js +0 -1
  177. package/dist/client/assets/useSuspenseInfiniteQuery-Ck-t1SMi.js +0 -1
  178. package/dist/client/assets/workflow-detail-DLo-hD09.js +0 -1
  179. package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
  180. package/dist/server/node_modules/ansi-styles/index.js +0 -223
  181. package/dist/server/node_modules/ansi-styles/license +0 -9
  182. package/dist/server/node_modules/ansi-styles/package.json +0 -54
  183. package/dist/server/node_modules/ansi-styles/readme.md +0 -173
@@ -1 +1 @@
1
- import{e as P,j as t,b as D,z as q,D as B,P as G,t as y,x as R}from"./index-Dcg8Qevd.js";import{P as E}from"./index-DtUGvIts.js";import{A as U}from"./avatar-Z1wN1pq-.js";import{S as I}from"./switch-Ba2DX0J8.js";import{S as F,a as H,d as V,c as Y}from"./select-DkBE5ypj.js";import{T as K,a as L}from"./toggle-group-Bzjy8IQq.js";import{I as J}from"./input-Cvo2jJQf.js";import{n as M,a as O,i as Q}from"./Sun-Bpli4t2N.js";import{i as W}from"./Play-CDjH79to.js";import{u as X}from"./use-debounced-autosave-vxXjJ2-V.js";import{p as Z,q as ee}from"./question-004-sINsf4GQ.js";import"./index-DPM8__xA.js";import{d as te,b as C,S as T,a as $}from"./settings-section-DeAx6MsQ.js";import"./tooltip-sn7TXXXA.js";import"./X-BGh8G2l7.js";import"./User01-CxpWRrdM.js";import"./Check-DBWnyOFJ.js";import"./ChevronDown-D452dgSU.js";import"./ChevronUp-BlZFoG59.js";import"./card-Bd8klEwI.js";import"./ArrowUpRight-1rqShrTM.js";function oe(){const e=P.c(19),{data:o,isPending:n}=D.useSession(),l=o?.user,s=l?.image,i=l?.name??"";let a;e[0]!==i?(a={values:{name:i}},e[0]=i,e[1]=a):a=e[1];const r=q(a);let p;e[2]!==r?(p={save:async()=>{if(!r.formState.isDirty)return;const{name:b}=r.getValues();try{await D.updateUser({name:b}),y("profile_updated",{fields:["name"]}),r.reset({name:b})}catch{R.error("Failed to update profile")}}},e[2]=r,e[3]=p):p=e[3];const{schedule:j,flush:u}=X(p);if(n)return null;const v=l?.name??"U";let c;e[4]!==v||e[5]!==s?(c=t.jsx(C,{title:"Avatar",action:t.jsx(U,{url:s,fallback:v,shape:"circle",size:"base"})}),e[4]=v,e[5]=s,e[6]=c):c=e[6];let f;e[7]!==u||e[8]!==j?(f=b=>{const{field:_}=b;return t.jsx(J,{id:"display-name",..._,onChange:S=>{_.onChange(S),j()},onBlur:()=>{_.onBlur(),u()},onKeyDown:S=>{S.key==="Enter"&&u()},placeholder:"Your name",className:"w-[280px]"})},e[7]=u,e[8]=j,e[9]=f):f=e[9];let x;e[10]!==r.control||e[11]!==f?(x=t.jsx(C,{title:"Display name",action:t.jsx(B,{control:r.control,name:"name",render:f})}),e[10]=r.control,e[11]=f,e[12]=x):x=e[12];const g=l?.email;let d;e[13]!==g?(d=t.jsx(C,{title:"Email",action:t.jsx("span",{className:"text-sm text-muted-foreground",children:g})}),e[13]=g,e[14]=d):d=e[14];let h;return e[15]!==c||e[16]!==x||e[17]!==d?(h=t.jsx(T,{children:t.jsxs($,{children:[c,x,d]})}),e[15]=c,e[16]=x,e[17]=d,e[18]=h):h=e[18],h}function ne(){const e=P.c(48),[o,n]=G();let l;e[0]!==n?(l=async m=>{if(m&&await Notification.requestPermission()!=="granted"){y("preferences_notifications_permission_denied"),R.error("Notifications denied. Please enable them in your browser settings."),n(re);return}y("preferences_notifications_toggled",{enabled:m}),n(N=>({...N,enableNotifications:m}))},e[0]=n,e[1]=l):l=e[1];const s=l;let i;e[2]!==n?(i=m=>{m&&(y("preferences_theme_changed",{to_value:m}),n(N=>({...N,theme:m})))},e[2]=n,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(L,{value:"light","aria-label":"Light theme",children:t.jsx(M,{size:14})}),e[4]=a):a=e[4];let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(L,{value:"dark","aria-label":"Dark theme",children:t.jsx(O,{size:14})}),e[5]=r):r=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(L,{value:"system","aria-label":"System theme",children:t.jsx(Q,{size:14})}),e[6]=p):p=e[6];let j;e[7]!==o.theme||e[8]!==i?(j=t.jsx(C,{title:"Theme",description:"Your preferred color scheme.",action:t.jsxs(K,{type:"single",size:"sm",variant:"outline",value:o.theme,onValueChange:i,children:[a,r,p]})}),e[7]=o.theme,e[8]=i,e[9]=j):j=e[9];let u;e[10]!==s||e[11]!==o.enableNotifications?(u=typeof Notification<"u"?()=>s(!o.enableNotifications):void 0,e[10]=s,e[11]=o.enableNotifications,e[12]=u):u=e[12];let v;e[13]!==s||e[14]!==o.enableNotifications?(v=t.jsx(I,{disabled:typeof Notification>"u",checked:o.enableNotifications,onCheckedChange:s}),e[13]=s,e[14]=o.enableNotifications,e[15]=v):v=e[15];let c;e[16]!==u||e[17]!==v?(c=t.jsx(C,{title:"Notifications",description:"Receive browser notifications for important events.",onClick:u,action:v}),e[16]=u,e[17]=v,e[18]=c):c=e[18];let f;e[19]!==o.enableSounds||e[20]!==n?(f=()=>{y("preferences_sounds_toggled",{enabled:!o.enableSounds}),n(le)},e[19]=o.enableSounds,e[20]=n,e[21]=f):f=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("button",{type:"button","aria-label":"Preview notification sound",onClick:se,className:"size-6 rounded flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors cursor-pointer",children:t.jsx(W,{size:11})}),e[22]=x):x=e[22];let g;e[23]!==n?(g=m=>{y("preferences_sounds_toggled",{enabled:m}),n(N=>({...N,enableSounds:m}))},e[23]=n,e[24]=g):g=e[24];let d;e[25]!==o.enableSounds||e[26]!==g?(d=t.jsxs("div",{className:"flex items-center gap-2",children:[x,t.jsx(I,{checked:o.enableSounds,onCheckedChange:g})]}),e[25]=o.enableSounds,e[26]=g,e[27]=d):d=e[27];let h;e[28]!==d||e[29]!==f?(h=t.jsx(C,{title:"Sounds",description:"Play sounds for agent actions and notifications.",onClick:f,action:d}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let b;e[31]!==n?(b=m=>{y("preferences_tool_approval_changed",{to_value:m}),n(N=>({...N,toolApprovalLevel:m}))},e[31]=n,e[32]=b):b=e[32];let _;e[33]!==o.toolApprovalLevel?(_={readonly:"Ask before edit",auto:"Auto approve"}[o.toolApprovalLevel]??"Ask before edit",e[33]=o.toolApprovalLevel,e[34]=_):_=e[34];let S;e[35]!==_?(S=t.jsx(H,{className:"w-36 h-7 text-xs",children:t.jsx("span",{children:_})}),e[35]=_,e[36]=S):S=e[36];let k;e[37]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(V,{value:"readonly",textValue:"Ask before edit",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:"Ask before edit"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),e[37]=k):k=e[37];let w;e[38]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsxs(Y,{children:[k,t.jsx(V,{value:"auto",textValue:"Auto approve",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:"Auto approve"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all without approval"})]})})]}),e[38]=w):w=e[38];let A;e[39]!==o.toolApprovalLevel||e[40]!==b||e[41]!==S?(A=t.jsx(C,{title:"Tool Approval",description:"Control how tools are approved before execution.",action:t.jsxs(F,{value:o.toolApprovalLevel,onValueChange:b,children:[S,w]})}),e[39]=o.toolApprovalLevel,e[40]=b,e[41]=S,e[42]=A):A=e[42];let z;return e[43]!==h||e[44]!==A||e[45]!==j||e[46]!==c?(z=t.jsx(T,{title:"Preferences",children:t.jsxs($,{children:[j,c,h,A]})}),e[43]=h,e[44]=A,e[45]=j,e[46]=c,e[47]=z):z=e[47],z}function se(){y("preferences_sounds_previewed"),Z(ee.dataUri).catch(ie)}function ie(){}function le(e){return{...e,enableSounds:!e.enableSounds}}function re(e){return{...e,enableNotifications:!1}}function ae(){const e=P.c(11),[o,n]=G();let l;e[0]!==o.experimental_vibecode||e[1]!==n?(l=()=>{y("preferences_experimental_vibecode_toggled",{enabled:!o.experimental_vibecode}),n(ce)},e[0]=o.experimental_vibecode,e[1]=n,e[2]=l):l=e[2];let s;e[3]!==n?(s=r=>{y("preferences_experimental_vibecode_toggled",{enabled:r}),n(p=>({...p,experimental_vibecode:r}))},e[3]=n,e[4]=s):s=e[4];let i;e[5]!==o.experimental_vibecode||e[6]!==s?(i=t.jsx(I,{checked:o.experimental_vibecode,onCheckedChange:s}),e[5]=o.experimental_vibecode,e[6]=s,e[7]=i):i=e[7];let a;return e[8]!==l||e[9]!==i?(a=t.jsx(T,{title:"Experimental",children:t.jsx($,{children:t.jsx(C,{title:"Import from GitHub",description:"Enable importing agents from GitHub repositories.",onClick:l,action:i})})}),e[8]=l,e[9]=i,e[10]=a):a=e[10],a}function ce(e){return{...e,experimental_vibecode:!e.experimental_vibecode}}function fe(){const e=P.c(1);let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(E,{children:t.jsx(E.Content,{children:t.jsx(E.Body,{children:t.jsxs(te,{children:[t.jsx(E.Title,{children:"Profile & Preferences"}),t.jsx(oe,{}),t.jsx(ne,{}),t.jsx(ae,{})]})})})}),e[0]=o):o=e[0],o}function Le(){const e=P.c(1);let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(fe,{}),e[0]=o):o=e[0],o}export{Le as default};
1
+ import{e as P,j as t,b as D,z as q,D as B,P as G,t as y,x as R}from"./index-CHrUmZgp.js";import{P as E}from"./index-Dq__xIAQ.js";import{A as U}from"./avatar-q80j4hVX.js";import{S as I}from"./switch-iFtU_Uj0.js";import{S as F,a as H,d as V,c as Y}from"./select-CQme0ALA.js";import{T as K,a as L}from"./toggle-group-Dj5MlNbV.js";import{I as J}from"./input-Do0Zx2-t.js";import{n as M,a as O,i as Q}from"./Sun-B4qv1AhA.js";import{i as W}from"./Play-CRDhnWxZ.js";import{u as X}from"./use-debounced-autosave-Xsez6aVB.js";import{p as Z,q as ee}from"./question-004-sINsf4GQ.js";import"./index-DB0YdXxd.js";import{d as te,b as C,S as T,a as $}from"./settings-section-CX6DrRQc.js";import"./tooltip-oz4PgHaK.js";import"./X-BdF-Ta2X.js";import"./User01-DMVSPQ8_.js";import"./Check-BiM2-TvW.js";import"./ChevronDown-v_6fVP4M.js";import"./ChevronUp-CUfrmF0I.js";import"./card-Dv-Qnw_l.js";import"./ArrowUpRight-B2ZjjZJQ.js";function oe(){const e=P.c(19),{data:o,isPending:n}=D.useSession(),l=o?.user,s=l?.image,i=l?.name??"";let a;e[0]!==i?(a={values:{name:i}},e[0]=i,e[1]=a):a=e[1];const r=q(a);let p;e[2]!==r?(p={save:async()=>{if(!r.formState.isDirty)return;const{name:b}=r.getValues();try{await D.updateUser({name:b}),y("profile_updated",{fields:["name"]}),r.reset({name:b})}catch{R.error("Failed to update profile")}}},e[2]=r,e[3]=p):p=e[3];const{schedule:j,flush:u}=X(p);if(n)return null;const v=l?.name??"U";let c;e[4]!==v||e[5]!==s?(c=t.jsx(C,{title:"Avatar",action:t.jsx(U,{url:s,fallback:v,shape:"circle",size:"base"})}),e[4]=v,e[5]=s,e[6]=c):c=e[6];let f;e[7]!==u||e[8]!==j?(f=b=>{const{field:_}=b;return t.jsx(J,{id:"display-name",..._,onChange:S=>{_.onChange(S),j()},onBlur:()=>{_.onBlur(),u()},onKeyDown:S=>{S.key==="Enter"&&u()},placeholder:"Your name",className:"w-[280px]"})},e[7]=u,e[8]=j,e[9]=f):f=e[9];let x;e[10]!==r.control||e[11]!==f?(x=t.jsx(C,{title:"Display name",action:t.jsx(B,{control:r.control,name:"name",render:f})}),e[10]=r.control,e[11]=f,e[12]=x):x=e[12];const g=l?.email;let d;e[13]!==g?(d=t.jsx(C,{title:"Email",action:t.jsx("span",{className:"text-sm text-muted-foreground",children:g})}),e[13]=g,e[14]=d):d=e[14];let h;return e[15]!==c||e[16]!==x||e[17]!==d?(h=t.jsx(T,{children:t.jsxs($,{children:[c,x,d]})}),e[15]=c,e[16]=x,e[17]=d,e[18]=h):h=e[18],h}function ne(){const e=P.c(48),[o,n]=G();let l;e[0]!==n?(l=async m=>{if(m&&await Notification.requestPermission()!=="granted"){y("preferences_notifications_permission_denied"),R.error("Notifications denied. Please enable them in your browser settings."),n(re);return}y("preferences_notifications_toggled",{enabled:m}),n(N=>({...N,enableNotifications:m}))},e[0]=n,e[1]=l):l=e[1];const s=l;let i;e[2]!==n?(i=m=>{m&&(y("preferences_theme_changed",{to_value:m}),n(N=>({...N,theme:m})))},e[2]=n,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(L,{value:"light","aria-label":"Light theme",children:t.jsx(M,{size:14})}),e[4]=a):a=e[4];let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(L,{value:"dark","aria-label":"Dark theme",children:t.jsx(O,{size:14})}),e[5]=r):r=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(L,{value:"system","aria-label":"System theme",children:t.jsx(Q,{size:14})}),e[6]=p):p=e[6];let j;e[7]!==o.theme||e[8]!==i?(j=t.jsx(C,{title:"Theme",description:"Your preferred color scheme.",action:t.jsxs(K,{type:"single",size:"sm",variant:"outline",value:o.theme,onValueChange:i,children:[a,r,p]})}),e[7]=o.theme,e[8]=i,e[9]=j):j=e[9];let u;e[10]!==s||e[11]!==o.enableNotifications?(u=typeof Notification<"u"?()=>s(!o.enableNotifications):void 0,e[10]=s,e[11]=o.enableNotifications,e[12]=u):u=e[12];let v;e[13]!==s||e[14]!==o.enableNotifications?(v=t.jsx(I,{disabled:typeof Notification>"u",checked:o.enableNotifications,onCheckedChange:s}),e[13]=s,e[14]=o.enableNotifications,e[15]=v):v=e[15];let c;e[16]!==u||e[17]!==v?(c=t.jsx(C,{title:"Notifications",description:"Receive browser notifications for important events.",onClick:u,action:v}),e[16]=u,e[17]=v,e[18]=c):c=e[18];let f;e[19]!==o.enableSounds||e[20]!==n?(f=()=>{y("preferences_sounds_toggled",{enabled:!o.enableSounds}),n(le)},e[19]=o.enableSounds,e[20]=n,e[21]=f):f=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("button",{type:"button","aria-label":"Preview notification sound",onClick:se,className:"size-6 rounded flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors cursor-pointer",children:t.jsx(W,{size:11})}),e[22]=x):x=e[22];let g;e[23]!==n?(g=m=>{y("preferences_sounds_toggled",{enabled:m}),n(N=>({...N,enableSounds:m}))},e[23]=n,e[24]=g):g=e[24];let d;e[25]!==o.enableSounds||e[26]!==g?(d=t.jsxs("div",{className:"flex items-center gap-2",children:[x,t.jsx(I,{checked:o.enableSounds,onCheckedChange:g})]}),e[25]=o.enableSounds,e[26]=g,e[27]=d):d=e[27];let h;e[28]!==d||e[29]!==f?(h=t.jsx(C,{title:"Sounds",description:"Play sounds for agent actions and notifications.",onClick:f,action:d}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let b;e[31]!==n?(b=m=>{y("preferences_tool_approval_changed",{to_value:m}),n(N=>({...N,toolApprovalLevel:m}))},e[31]=n,e[32]=b):b=e[32];let _;e[33]!==o.toolApprovalLevel?(_={readonly:"Ask before edit",auto:"Auto approve"}[o.toolApprovalLevel]??"Ask before edit",e[33]=o.toolApprovalLevel,e[34]=_):_=e[34];let S;e[35]!==_?(S=t.jsx(H,{className:"w-36 h-7 text-xs",children:t.jsx("span",{children:_})}),e[35]=_,e[36]=S):S=e[36];let k;e[37]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(V,{value:"readonly",textValue:"Ask before edit",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:"Ask before edit"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),e[37]=k):k=e[37];let w;e[38]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsxs(Y,{children:[k,t.jsx(V,{value:"auto",textValue:"Auto approve",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{className:"font-medium",children:"Auto approve"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all without approval"})]})})]}),e[38]=w):w=e[38];let A;e[39]!==o.toolApprovalLevel||e[40]!==b||e[41]!==S?(A=t.jsx(C,{title:"Tool Approval",description:"Control how tools are approved before execution.",action:t.jsxs(F,{value:o.toolApprovalLevel,onValueChange:b,children:[S,w]})}),e[39]=o.toolApprovalLevel,e[40]=b,e[41]=S,e[42]=A):A=e[42];let z;return e[43]!==h||e[44]!==A||e[45]!==j||e[46]!==c?(z=t.jsx(T,{title:"Preferences",children:t.jsxs($,{children:[j,c,h,A]})}),e[43]=h,e[44]=A,e[45]=j,e[46]=c,e[47]=z):z=e[47],z}function se(){y("preferences_sounds_previewed"),Z(ee.dataUri).catch(ie)}function ie(){}function le(e){return{...e,enableSounds:!e.enableSounds}}function re(e){return{...e,enableNotifications:!1}}function ae(){const e=P.c(11),[o,n]=G();let l;e[0]!==o.experimental_vibecode||e[1]!==n?(l=()=>{y("preferences_experimental_vibecode_toggled",{enabled:!o.experimental_vibecode}),n(ce)},e[0]=o.experimental_vibecode,e[1]=n,e[2]=l):l=e[2];let s;e[3]!==n?(s=r=>{y("preferences_experimental_vibecode_toggled",{enabled:r}),n(p=>({...p,experimental_vibecode:r}))},e[3]=n,e[4]=s):s=e[4];let i;e[5]!==o.experimental_vibecode||e[6]!==s?(i=t.jsx(I,{checked:o.experimental_vibecode,onCheckedChange:s}),e[5]=o.experimental_vibecode,e[6]=s,e[7]=i):i=e[7];let a;return e[8]!==l||e[9]!==i?(a=t.jsx(T,{title:"Experimental",children:t.jsx($,{children:t.jsx(C,{title:"Import from GitHub",description:"Enable importing agents from GitHub repositories.",onClick:l,action:i})})}),e[8]=l,e[9]=i,e[10]=a):a=e[10],a}function ce(e){return{...e,experimental_vibecode:!e.experimental_vibecode}}function fe(){const e=P.c(1);let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(E,{children:t.jsx(E.Content,{children:t.jsx(E.Body,{children:t.jsxs(te,{children:[t.jsx(E.Title,{children:"Profile & Preferences"}),t.jsx(oe,{}),t.jsx(ne,{}),t.jsx(ae,{})]})})})}),e[0]=o):o=e[0],o}function Le(){const e=P.c(1);let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(fe,{}),e[0]=o):o=e[0],o}export{Le as default};
@@ -1 +1 @@
1
- import{e as E,s as H,j as N}from"./index-Dcg8Qevd.js";import{m as O,k as $,s as v}from"./pair-_253DGSq.js";import{u as L}from"./constants-DXQgV2hu.js";import{a as k,c as q}from"./use-mcp-tools-Cu2GPPjO.js";import{c as B}from"./content-blocks-o63cs2vh.js";import{g as Y,M as G,b as w}from"./types-ClFDwb3j.js";import{c as V,b as z}from"./chat-context-DGU47jw7.js";import{u as F}from"./shell-layout-xLg1cKrj.js";import"./agent-icon-CznXZlOI.js";import"./AlertCircle-UghQPlAa.js";import"./Tool01-NWIcFn9q.js";import"./XClose-Dz5yGfpm.js";import"./RefreshCcw01-Cd8Km121.js";import"./ArrowNarrowLeft-1BfkUm85.js";import"./XCircle-CYGTZyzW.js";import"./ArrowUpRight-1rqShrTM.js";import"./ZapSquare-BLhBRchY.js";import"./Users03-CK1Aa1HI.js";import"./CheckCircle-CBMgXE-F.js";import"./Check-DBWnyOFJ.js";import"./ChevronDown-D452dgSU.js";import"./ChevronRight-DoY3rcf9.js";import"./ChevronUp-BlZFoG59.js";import"./DotsVertical-CAgAGLKz.js";import"./Container-BQVUd9tN.js";import"./Star01-DRidtrYn.js";import"./Palette-DXyBGBQu.js";import"./SearchMd-B780aQOS.js";import"./index-DtUGvIts.js";import"./tooltip-sn7TXXXA.js";import"./X-BGh8G2l7.js";import"./LinkExternal01-CGcDVdEi.js";import"./Lock01-FiMk9Cv6.js";import"./Sun-Bpli4t2N.js";import"./Play-CDjH79to.js";import"./Plus-FC_C8qkl.js";import"./Settings02--XuHa5eI.js";import"./Shield01-Bg1T1EGa.js";import"./Trash01-4w6_aW9X.js";import"./User01-CxpWRrdM.js";import"./Zap-Druw6RpX.js";import"./index-CZLTTN-z.js";import"./use-copy-D0VCYdzD.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./dialog-DUgfuVrb.js";import"./integration-icon-DTJ2wb4X.js";import"./use-virtual-mcp-Cvy2Xx_N.js";import"./use-collections-DDocavcC.js";import"./use-ai-providers-D1ZzNZfi.js";import"./use-decopilot-events-CQn9-0iO.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-tasks-B8ZzLgVK.js";import"./use-organization-settings-OER3kM7D.js";import"./required-auth-layout-Cg8CZTlk.js";import"./use-org-sso-Co0XjU-j.js";const J={};function K(S){const t=E.c(37),{client:s,resourceURI:P,tool:e,connectionId:n,orgId:p,args:a}=S,{sendMessage:c}=V(),{setAppContext:f,clearAppContext:g}=z(),{setChatOpen:u,openTab:r}=F(),m=`${n}:${e.name}`;let o;t[0]!==r?(o=h=>h==="inline"?(r("0"),"inline"):"fullscreen",t[0]=r,t[1]=o):o=t[1];const d=o,l=a??J;let i;t[2]!==s||t[3]!==e.name||t[4]!==l?(i={client:s,toolName:e.name,toolArguments:l},t[2]=s,t[3]=e.name,t[4]=l,t[5]=i):i=t[5];const{data:T}=q(i);let R;if(t[6]!==e._meta||t[7]!==e.name){const h=$(e._meta);R=v(e.name,h),t[6]=e._meta,t[7]=e.name,t[8]=R}else R=t[8];const U=R;let x;t[9]!==e.inputSchema?(x=e.inputSchema??{type:"object"},t[9]=e.inputSchema,t[10]=x):x=t[10];let A;t[11]!==U||t[12]!==x||t[13]!==e?(A={...e,name:U,inputSchema:x},t[11]=U,t[12]=x,t[13]=e,t[14]=A):A=t[14];const y=A;let _;t[15]!==c||t[16]!==u?(_=h=>{const b=B(h.content);b.content.length>0&&(u(!0),c({tiptapDoc:b}))},t[15]=c,t[16]=u,t[17]=_):_=t[17];const D=_;let C;t[18]!==y?(C={tool:y},t[18]=y,t[19]=C):C=t[19];let I;t[20]!==f||t[21]!==m?(I=h=>f(m,h),t[20]=f,t[21]=m,t[22]=I):I=t[22];let M;t[23]!==g||t[24]!==m?(M=()=>g(m),t[23]=g,t[24]=m,t[25]=M):M=t[25];let j;return t[26]!==s||t[27]!==D||t[28]!==d||t[29]!==p||t[30]!==P||t[31]!==C||t[32]!==I||t[33]!==M||t[34]!==l||t[35]!==T?(j=N.jsx(G,{resourceURI:P,orgId:p,toolInfo:C,toolInput:l,toolResult:T,displayMode:"fullscreen",minHeight:w.fullscreen.minHeight,maxHeight:w.fullscreen.maxHeight,client:s,onMessage:D,onUpdateModelContext:I,onTeardown:M,onRequestDisplayMode:d,className:"h-full"}),t[26]=s,t[27]=D,t[28]=d,t[29]=p,t[30]=P,t[31]=C,t[32]=I,t[33]=M,t[34]=l,t[35]=T,t[36]=j):j=t[36],j}function Wt(S){const t=E.c(23),{connectionId:s,toolName:P,args:e}=S,{org:n}=H();let p;t[0]!==s||t[1]!==n.id||t[2]!==n.slug?(p={connectionId:s,orgId:n.id,orgSlug:n.slug},t[0]=s,t[1]=n.id,t[2]=n.slug,t[3]=p):p=t[3];const a=L(p);let c;t[4]!==a?(c={client:a},t[4]=a,t[5]=c):c=t[5];const{data:f}=k(c),g=decodeURIComponent(P);let u;t[6]!==g?(u=O(g),t[6]=g,t[7]=u):u=t[7];const r=u;let m,o;if(t[8]!==r||t[9]!==f.tools){let i;t[12]!==r?(i=T=>T.name===r,t[12]=r,t[13]=i):i=t[13],o=f.tools.find(i),m=o?._meta?Y(o._meta):void 0,t[8]=r,t[9]=f.tools,t[10]=m,t[11]=o}else m=t[10],o=t[11];const d=m;if(!o||!d){let i;return t[14]!==r?(i=N.jsx("div",{className:"flex items-center justify-center h-full w-full",children:N.jsxs("p",{className:"text-sm text-muted-foreground",children:['Tool "',r,'" not found or has no UI']})}),t[14]=r,t[15]=i):i=t[15],i}let l;return t[16]!==e||t[17]!==a||t[18]!==s||t[19]!==n.id||t[20]!==d||t[21]!==o?(l=N.jsx(K,{client:a,resourceURI:d,tool:o,connectionId:s,orgId:n.id,args:e}),t[16]=e,t[17]=a,t[18]=s,t[19]=n.id,t[20]=d,t[21]=o,t[22]=l):l=t[22],l}export{Wt as AppViewContent};
1
+ import{e as E,s as H,j as N}from"./index-CHrUmZgp.js";import{m as O,k as $,s as v}from"./pair-BVw6SD1z.js";import{u as L}from"./constants-BGb3csMB.js";import{a as k,c as q}from"./use-mcp-tools-bTkNBvHW.js";import{c as B}from"./content-blocks-o63cs2vh.js";import{g as Y,M as G,b as w}from"./types-0ZrdjKIw.js";import{c as V,b as z}from"./chat-context-Cs8XiFv-.js";import{u as F}from"./shell-layout-BYMnLoch.js";import"./agent-icon-CkZZqRPj.js";import"./AlertCircle-VdAWApZT.js";import"./Tool01-DZ5nMk2X.js";import"./XClose-BKDvrGgg.js";import"./RefreshCcw01-BNG_5rJW.js";import"./ArrowNarrowLeft-Cb6jcK-n.js";import"./XCircle-Mzs74oa5.js";import"./ArrowUpRight-B2ZjjZJQ.js";import"./ZapSquare-CM6EGSyy.js";import"./Users03-Bpy5JElG.js";import"./CheckCircle-Ch05HHgc.js";import"./Check-BiM2-TvW.js";import"./ChevronDown-v_6fVP4M.js";import"./ChevronRight-Dzob6m1m.js";import"./ChevronUp-CUfrmF0I.js";import"./DotsVertical-D--w_iaX.js";import"./Container-D0YzBjXF.js";import"./Star01-C0QV--XQ.js";import"./Palette-CEmO1kUS.js";import"./SearchMd-BL69FKVv.js";import"./index-Dq__xIAQ.js";import"./tooltip-oz4PgHaK.js";import"./X-BdF-Ta2X.js";import"./LinkExternal01-QD8wgK8o.js";import"./Lock01-DJV5JMDy.js";import"./Sun-B4qv1AhA.js";import"./Play-CRDhnWxZ.js";import"./Plus-DDMryLp9.js";import"./Settings02-CHdnS1Le.js";import"./Shield01-CDWmokZC.js";import"./Trash01-EHajsAd0.js";import"./User01-DMVSPQ8_.js";import"./Zap-B1XrF636.js";import"./index-BKV2fRzm.js";import"./use-copy-B_R6LHdW.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./dialog-B9k-J44Q.js";import"./integration-icon-BU0UtHw1.js";import"./use-virtual-mcp-BBYFAnp2.js";import"./use-collections-wkyc_t0D.js";import"./use-ai-providers-BfAEQYsq.js";import"./use-decopilot-events-Dr4V34eZ.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-tasks-LY5kqeAJ.js";import"./use-organization-settings-B78MMPj6.js";import"./required-auth-layout-BgC3m76H.js";import"./use-org-sso-Oco51-Ud.js";const J={};function K(S){const t=E.c(37),{client:s,resourceURI:P,tool:e,connectionId:n,orgId:p,args:a}=S,{sendMessage:c}=V(),{setAppContext:f,clearAppContext:g}=z(),{setChatOpen:u,openTab:r}=F(),m=`${n}:${e.name}`;let o;t[0]!==r?(o=h=>h==="inline"?(r("0"),"inline"):"fullscreen",t[0]=r,t[1]=o):o=t[1];const d=o,l=a??J;let i;t[2]!==s||t[3]!==e.name||t[4]!==l?(i={client:s,toolName:e.name,toolArguments:l},t[2]=s,t[3]=e.name,t[4]=l,t[5]=i):i=t[5];const{data:T}=q(i);let R;if(t[6]!==e._meta||t[7]!==e.name){const h=$(e._meta);R=v(e.name,h),t[6]=e._meta,t[7]=e.name,t[8]=R}else R=t[8];const U=R;let x;t[9]!==e.inputSchema?(x=e.inputSchema??{type:"object"},t[9]=e.inputSchema,t[10]=x):x=t[10];let A;t[11]!==U||t[12]!==x||t[13]!==e?(A={...e,name:U,inputSchema:x},t[11]=U,t[12]=x,t[13]=e,t[14]=A):A=t[14];const y=A;let _;t[15]!==c||t[16]!==u?(_=h=>{const b=B(h.content);b.content.length>0&&(u(!0),c({tiptapDoc:b}))},t[15]=c,t[16]=u,t[17]=_):_=t[17];const D=_;let C;t[18]!==y?(C={tool:y},t[18]=y,t[19]=C):C=t[19];let I;t[20]!==f||t[21]!==m?(I=h=>f(m,h),t[20]=f,t[21]=m,t[22]=I):I=t[22];let M;t[23]!==g||t[24]!==m?(M=()=>g(m),t[23]=g,t[24]=m,t[25]=M):M=t[25];let j;return t[26]!==s||t[27]!==D||t[28]!==d||t[29]!==p||t[30]!==P||t[31]!==C||t[32]!==I||t[33]!==M||t[34]!==l||t[35]!==T?(j=N.jsx(G,{resourceURI:P,orgId:p,toolInfo:C,toolInput:l,toolResult:T,displayMode:"fullscreen",minHeight:w.fullscreen.minHeight,maxHeight:w.fullscreen.maxHeight,client:s,onMessage:D,onUpdateModelContext:I,onTeardown:M,onRequestDisplayMode:d,className:"h-full"}),t[26]=s,t[27]=D,t[28]=d,t[29]=p,t[30]=P,t[31]=C,t[32]=I,t[33]=M,t[34]=l,t[35]=T,t[36]=j):j=t[36],j}function Wt(S){const t=E.c(23),{connectionId:s,toolName:P,args:e}=S,{org:n}=H();let p;t[0]!==s||t[1]!==n.id||t[2]!==n.slug?(p={connectionId:s,orgId:n.id,orgSlug:n.slug},t[0]=s,t[1]=n.id,t[2]=n.slug,t[3]=p):p=t[3];const a=L(p);let c;t[4]!==a?(c={client:a},t[4]=a,t[5]=c):c=t[5];const{data:f}=k(c),g=decodeURIComponent(P);let u;t[6]!==g?(u=O(g),t[6]=g,t[7]=u):u=t[7];const r=u;let m,o;if(t[8]!==r||t[9]!==f.tools){let i;t[12]!==r?(i=T=>T.name===r,t[12]=r,t[13]=i):i=t[13],o=f.tools.find(i),m=o?._meta?Y(o._meta):void 0,t[8]=r,t[9]=f.tools,t[10]=m,t[11]=o}else m=t[10],o=t[11];const d=m;if(!o||!d){let i;return t[14]!==r?(i=N.jsx("div",{className:"flex items-center justify-center h-full w-full",children:N.jsxs("p",{className:"text-sm text-muted-foreground",children:['Tool "',r,'" not found or has no UI']})}),t[14]=r,t[15]=i):i=t[15],i}let l;return t[16]!==e||t[17]!==a||t[18]!==s||t[19]!==n.id||t[20]!==d||t[21]!==o?(l=N.jsx(K,{client:a,resourceURI:d,tool:o,connectionId:s,orgId:n.id,args:e}),t[16]=e,t[17]=a,t[18]=s,t[19]=n.id,t[20]=d,t[21]=o,t[22]=l):l=t[22],l}export{Wt as AppViewContent};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/registry-layout-DN05Co_7.js","assets/index-CHrUmZgp.js","assets/index-B_4-KoG_.css","assets/ArrowNarrowLeft-Cb6jcK-n.js","assets/CheckCircle-Ch05HHgc.js","assets/Container-D0YzBjXF.js","assets/Settings02-CHdnS1Le.js","assets/XCircle-Mzs74oa5.js","assets/constants-BGb3csMB.js","assets/useInfiniteQuery-7WbFFwUo.js","assets/infiniteQueryObserver-BondwvTH.js","assets/badge-C8h2D-cf.js","assets/input-Do0Zx2-t.js","assets/dropdown-menu-DCt7nnpF.js","assets/Check-BiM2-TvW.js","assets/ChevronRight-Dzob6m1m.js","assets/DotsVertical-D--w_iaX.js","assets/table-CrLtxirL.js","assets/toggle-group-Dj5MlNbV.js","assets/use-view-mode-Bp7xTow9.js","assets/tooltip-oz4PgHaK.js","assets/SearchMd-BL69FKVv.js","assets/dialog-B9k-J44Q.js","assets/X-BdF-Ta2X.js","assets/AlertCircle-VdAWApZT.js","assets/alert-dialog-BiImvuLv.js","assets/card-Dv-Qnw_l.js","assets/Trash01-EHajsAd0.js","assets/label-xFeGPJPK.js","assets/select-CQme0ALA.js","assets/ChevronDown-v_6fVP4M.js","assets/ChevronUp-CUfrmF0I.js","assets/switch-iFtU_Uj0.js","assets/textarea-Biq9f3vB.js","assets/RefreshCcw01-BNG_5rJW.js","assets/checkbox-cUUI4UbZ.js","assets/LinkExternal01-QD8wgK8o.js","assets/use-copy-B_R6LHdW.js","assets/Plus-DDMryLp9.js","assets/Play-CRDhnWxZ.js"])))=>i.map(i=>d[i]);
2
+ import{e as a,j as t,r,l as i,_ as o}from"./index-CHrUmZgp.js";const n=r.lazy(()=>o(()=>import("./registry-layout-DN05Co_7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])));function c(){const s=a.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(i,{size:20,className:"animate-spin text-muted-foreground"})}),children:t.jsx(n,{})}),s[0]=e):e=s[0],e}export{c as default};
@@ -1,4 +1,4 @@
1
- import{e as Y,s as ie,n as Ie,o as ke,a as je,x as V,r as P,j as t,B as G,l as Le,c as Z,G as Fs,F as Bs}from"./index-Dcg8Qevd.js";import{i as Qs}from"./ArrowNarrowLeft-1BfkUm85.js";import{i as qe}from"./CheckCircle-CBMgXE-F.js";import{n as Vs}from"./Container-BQVUd9tN.js";import{a as Gs}from"./Settings02--XuHa5eI.js";import{b as Jt,n as Ks,a as ds,f as Zt,g as Ys,h as us,d as Hs,e as Ws,i as Js,c as St,t as Zs,j as Xs}from"./XCircle-CYGTZyzW.js";import{S as ce,u as oe,d as er}from"./constants-DXQgV2hu.js";import{u as ms}from"./useInfiniteQuery-eCacXMD5.js";import{B as q}from"./badge-CTmf2TW8.js";import{I as ae}from"./input-Cvo2jJQf.js";import{a as dt,c as Ce,D as ut,b as mt,j as Xt,k as es,i as tr}from"./dropdown-menu-Cbx_bdO_.js";import{c as Mt,d as Et,a as Fe,e as ue,b as Dt,T as me}from"./table-Dpjp6sno.js";import{T as sr,a as ts}from"./toggle-group-Bzjy8IQq.js";import{u as rr}from"./use-view-mode-ti5AMLDX.js";import{i as At}from"./DotsVertical-CAgAGLKz.js";import{i as nr,a as ir}from"./SearchMd-B780aQOS.js";import{c as xt,d as ht,e as pt,D as ft,a as gt,b as jt}from"./dialog-DUgfuVrb.js";import{i as Ke}from"./AlertCircle-UghQPlAa.js";import{c as Ye,b as He,d as We,f as Je,g as Ze,e as Xe,a as et,A as tt}from"./alert-dialog-BiN56dOX.js";import{C as ne}from"./card-Bd8klEwI.js";import{s as st}from"./Trash01-4w6_aW9X.js";import{L as X}from"./label-_jNQo8Ll.js";import{S as lr,a as ar,b as or,c as cr,d as Rt}from"./select-DkBE5ypj.js";import{S as Oe}from"./switch-Ba2DX0J8.js";import{T as vt}from"./textarea-e7WVG0Uq.js";import{a as $t,c as dr,i as ur,s as xs,b as mr}from"./RefreshCcw01-Cd8Km121.js";import{i as xr}from"./X-BGh8G2l7.js";import{t as hr}from"./ChevronDown-D452dgSU.js";import{n as pr}from"./ChevronUp-BlZFoG59.js";import{C as ss}from"./checkbox-B3EwrxkO.js";import{n as fr}from"./LinkExternal01-CGcDVdEi.js";import{u as Tt}from"./use-copy-D0VCYdzD.js";import{i as It}from"./Check-DBWnyOFJ.js";import{s as gr}from"./Plus-FC_C8qkl.js";import{a as jr,b as vr,T as br}from"./tooltip-sn7TXXXA.js";import{i as yr}from"./Play-CDjH79to.js";import"./infiniteQueryObserver-D9yYekai.js";import"./ChevronRight-DoY3rcf9.js";const $e="private-registry",Nr=`
1
+ import{e as Y,s as ie,n as Ie,o as ke,a as je,x as V,r as P,j as t,B as G,l as Le,c as Z,G as Fs,F as Bs}from"./index-CHrUmZgp.js";import{i as Qs}from"./ArrowNarrowLeft-Cb6jcK-n.js";import{i as qe}from"./CheckCircle-Ch05HHgc.js";import{n as Vs}from"./Container-D0YzBjXF.js";import{a as Gs}from"./Settings02-CHdnS1Le.js";import{b as Jt,n as Ks,a as ds,f as Zt,g as Ys,h as us,d as Hs,e as Ws,i as Js,c as St,t as Zs,j as Xs}from"./XCircle-Mzs74oa5.js";import{S as ce,u as oe,d as er}from"./constants-BGb3csMB.js";import{u as ms}from"./useInfiniteQuery-7WbFFwUo.js";import{B as q}from"./badge-C8h2D-cf.js";import{I as ae}from"./input-Do0Zx2-t.js";import{a as dt,c as Ce,D as ut,b as mt,j as Xt,k as es,i as tr}from"./dropdown-menu-DCt7nnpF.js";import{c as Mt,d as Et,a as Fe,e as ue,b as Dt,T as me}from"./table-CrLtxirL.js";import{T as sr,a as ts}from"./toggle-group-Dj5MlNbV.js";import{u as rr}from"./use-view-mode-Bp7xTow9.js";import{i as At}from"./DotsVertical-D--w_iaX.js";import{i as nr,a as ir}from"./SearchMd-BL69FKVv.js";import{c as xt,d as ht,e as pt,D as ft,a as gt,b as jt}from"./dialog-B9k-J44Q.js";import{i as Ke}from"./AlertCircle-VdAWApZT.js";import{c as Ye,b as He,d as We,f as Je,g as Ze,e as Xe,a as et,A as tt}from"./alert-dialog-BiImvuLv.js";import{C as ne}from"./card-Dv-Qnw_l.js";import{s as st}from"./Trash01-EHajsAd0.js";import{L as X}from"./label-xFeGPJPK.js";import{S as lr,a as ar,b as or,c as cr,d as Rt}from"./select-CQme0ALA.js";import{S as Oe}from"./switch-iFtU_Uj0.js";import{T as vt}from"./textarea-Biq9f3vB.js";import{a as $t,c as dr,i as ur,s as xs,b as mr}from"./RefreshCcw01-BNG_5rJW.js";import{i as xr}from"./X-BdF-Ta2X.js";import{t as hr}from"./ChevronDown-v_6fVP4M.js";import{n as pr}from"./ChevronUp-CUfrmF0I.js";import{C as ss}from"./checkbox-cUUI4UbZ.js";import{n as fr}from"./LinkExternal01-QD8wgK8o.js";import{u as Tt}from"./use-copy-B_R6LHdW.js";import{i as It}from"./Check-BiM2-TvW.js";import{s as gr}from"./Plus-DDMryLp9.js";import{a as jr,b as vr,T as br}from"./tooltip-oz4PgHaK.js";import{i as yr}from"./Play-CRDhnWxZ.js";import"./infiniteQueryObserver-BondwvTH.js";import"./ChevronRight-Dzob6m1m.js";const $e="private-registry",Nr=`
2
2
  You are an MCP tool tester running automated integration checks.
3
3
 
4
4
  Goal:
@@ -1 +1 @@
1
- import{e as c,j as i,A as a,S as u,h,k as f,U as m,N as x}from"./index-Dcg8Qevd.js";function g(){const t=c.c(5),s=m().location.href;let r;t[0]!==s?(r=s==="/login"||s.startsWith("/login?"),t[0]=s,t[1]=r):r=t[1];const n=r;let o;if(t[2]!==s||t[3]!==n){const l=n?{}:{next:s};o=i.jsx(x,{to:"/login",search:l,replace:!0}),t[2]=s,t[3]=n,t[4]=o}else o=t[4];return o}function d(t){const e=c.c(6),{children:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(a,{children:i.jsx(u,{})}),e[0]=r):r=e[0];let n;e[1]!==s?(n=i.jsx(h,{children:s}),e[1]=s,e[2]=n):n=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(f,{children:i.jsx(g,{})}),e[3]=o):o=e[3];let l;return e[4]!==n?(l=i.jsxs(i.Fragment,{children:[r,n,o]}),e[4]=n,e[5]=l):l=e[5],l}export{d as R};
1
+ import{e as c,j as i,A as a,S as u,h,k as f,U as m,N as x}from"./index-CHrUmZgp.js";function g(){const t=c.c(5),s=m().location.href;let r;t[0]!==s?(r=s==="/login"||s.startsWith("/login?"),t[0]=s,t[1]=r):r=t[1];const n=r;let o;if(t[2]!==s||t[3]!==n){const l=n?{}:{next:s};o=i.jsx(x,{to:"/login",search:l,replace:!0}),t[2]=s,t[3]=n,t[4]=o}else o=t[4];return o}function d(t){const e=c.c(6),{children:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(a,{children:i.jsx(u,{})}),e[0]=r):r=e[0];let n;e[1]!==s?(n=i.jsx(h,{children:s}),e[1]=s,e[2]=n):n=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(f,{children:i.jsx(g,{})}),e[3]=o):o=e[3];let l;return e[4]!==n?(l=i.jsxs(i.Fragment,{children:[r,n,o]}),e[4]=n,e[5]=l):l=e[5],l}export{d as R};
@@ -1 +1 @@
1
- import{e as q,d as Y,f as A,r as B,a as G,j as s,B as z,b as K}from"./index-Dcg8Qevd.js";import{I as L}from"./input-Cvo2jJQf.js";function H(){const e=q.c(45);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/reset-password"},e[0]=n):n=e[0];const{token:r,error:h}=Y(n),a=A(),[o,D]=B.useState(""),[l,M]=B.useState(""),[t,T]=B.useState(!1),i=h==="INVALID_TOKEN";let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j={mutationFn:O,onSuccess:()=>{T(!0)}},e[1]=j):j=e[1];const w=G(j),v=o===l,c=o.length>=8&&l.length>=8&&v,d=w.isPending,N=w.error;let y;e[2]!==c||e[3]!==o||e[4]!==w||e[5]!==r?(y=b=>{b.preventDefault(),!(!r||!c)&&w.mutate({newPassword:o,token:r})},e[2]=c,e[3]=o,e[4]=w,e[5]=r,e[6]=y):y=e[6];const F=y;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e[7]=k):k=e[7];let S,_,P,C;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),_=s.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),P=s.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),C=s.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e[8]=S,e[9]=_,e[10]=P,e[11]=C):(S=e[8],_=e[9],P=e[10],C=e[11]);let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"flex justify-center",children:s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e[12]=E):E=e[12];const I=t?"Password reset successful":"Set a new password";let m;e[13]!==I?(m=s.jsx("div",{className:"text-center space-y-1",children:s.jsx("p",{className:"text-sm text-foreground/70",children:I})}),e[13]=I,e[14]=m):m=e[14];let u;e[15]!==i||e[16]!==a||e[17]!==t||e[18]!==r?(u=(i||!r&&!t)&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:"This reset link is invalid or has expired."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Back to login"})]}),e[15]=i,e[16]=a,e[17]=t,e[18]=r,e[19]=u):u=e[19];let x;e[20]!==N?(x=N&&s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:N.message||"Failed to reset password. Please try again."}),e[20]=N,e[21]=x):x=e[21];let f;e[22]!==a||e[23]!==t?(f=t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Your password has been reset. You can now sign in with your new password."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Go to login"})]}),e[22]=a,e[23]=t,e[24]=f):f=e[24];let g;e[25]!==c||e[26]!==l||e[27]!==F||e[28]!==i||e[29]!==d||e[30]!==o||e[31]!==v||e[32]!==t||e[33]!==r?(g=r&&!i&&!t&&s.jsxs("form",{onSubmit:F,className:"grid gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"New password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:o,onChange:b=>D(b.target.value),required:!0,minLength:8,disabled:d})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Confirm password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:l,onChange:b=>M(b.target.value),required:!0,minLength:8,disabled:d}),l&&!v&&s.jsx("p",{className:"text-xs text-destructive mt-1.5",children:"Passwords do not match"})]}),s.jsx(z,{type:"submit",disabled:d||!c,className:"w-full font-semibold",size:"lg",children:d?"Resetting...":"Reset password"})]}),e[25]=c,e[26]=l,e[27]=F,e[28]=i,e[29]=d,e[30]=o,e[31]=v,e[32]=t,e[33]=r,e[34]=g):g=e[34];let p;e[35]!==a||e[36]!==t?(p=!t&&s.jsx("div",{className:"text-center",children:s.jsx(z,{type:"button",variant:"link",onClick:()=>a({to:"/login"}),className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"})}),e[35]=a,e[36]=t,e[37]=p):p=e[37];let R;return e[38]!==m||e[39]!==u||e[40]!==x||e[41]!==f||e[42]!==g||e[43]!==p?(R=s.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[k,s.jsxs("div",{className:"relative z-10",children:[S,_,P,C,s.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[E,m,u,x,f,g,p]})]})]}),e[38]=m,e[39]=u,e[40]=x,e[41]=f,e[42]=g,e[43]=p,e[44]=R):R=e[44],R}async function O(e){const{newPassword:n,token:r}=e,h=await K.resetPassword({newPassword:n,token:r});if(h.error)throw new Error(h.error.message||"Failed to reset password");return h}export{H as default};
1
+ import{e as q,d as Y,f as A,r as B,a as G,j as s,B as z,b as K}from"./index-CHrUmZgp.js";import{I as L}from"./input-Do0Zx2-t.js";function H(){const e=q.c(45);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/reset-password"},e[0]=n):n=e[0];const{token:r,error:h}=Y(n),a=A(),[o,D]=B.useState(""),[l,M]=B.useState(""),[t,T]=B.useState(!1),i=h==="INVALID_TOKEN";let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j={mutationFn:O,onSuccess:()=>{T(!0)}},e[1]=j):j=e[1];const w=G(j),v=o===l,c=o.length>=8&&l.length>=8&&v,d=w.isPending,N=w.error;let y;e[2]!==c||e[3]!==o||e[4]!==w||e[5]!==r?(y=b=>{b.preventDefault(),!(!r||!c)&&w.mutate({newPassword:o,token:r})},e[2]=c,e[3]=o,e[4]=w,e[5]=r,e[6]=y):y=e[6];const F=y;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--primary-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e[7]=k):k=e[7];let S,_,P,C;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),_=s.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-primary-foreground/15"}),P=s.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),C=s.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-primary-foreground/15"}),e[8]=S,e[9]=_,e[10]=P,e[11]=C):(S=e[8],_=e[9],P=e[10],C=e[11]);let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("div",{className:"flex justify-center",children:s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e[12]=E):E=e[12];const I=t?"Password reset successful":"Set a new password";let m;e[13]!==I?(m=s.jsx("div",{className:"text-center space-y-1",children:s.jsx("p",{className:"text-sm text-foreground/70",children:I})}),e[13]=I,e[14]=m):m=e[14];let u;e[15]!==i||e[16]!==a||e[17]!==t||e[18]!==r?(u=(i||!r&&!t)&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:"This reset link is invalid or has expired."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Back to login"})]}),e[15]=i,e[16]=a,e[17]=t,e[18]=r,e[19]=u):u=e[19];let x;e[20]!==N?(x=N&&s.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:N.message||"Failed to reset password. Please try again."}),e[20]=N,e[21]=x):x=e[21];let f;e[22]!==a||e[23]!==t?(f=t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Your password has been reset. You can now sign in with your new password."}),s.jsx(z,{onClick:()=>a({to:"/login"}),className:"w-full font-semibold",size:"lg",children:"Go to login"})]}),e[22]=a,e[23]=t,e[24]=f):f=e[24];let g;e[25]!==c||e[26]!==l||e[27]!==F||e[28]!==i||e[29]!==d||e[30]!==o||e[31]!==v||e[32]!==t||e[33]!==r?(g=r&&!i&&!t&&s.jsxs("form",{onSubmit:F,className:"grid gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"New password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:o,onChange:b=>D(b.target.value),required:!0,minLength:8,disabled:d})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Confirm password"}),s.jsx(L,{type:"password",placeholder:"••••••••",value:l,onChange:b=>M(b.target.value),required:!0,minLength:8,disabled:d}),l&&!v&&s.jsx("p",{className:"text-xs text-destructive mt-1.5",children:"Passwords do not match"})]}),s.jsx(z,{type:"submit",disabled:d||!c,className:"w-full font-semibold",size:"lg",children:d?"Resetting...":"Reset password"})]}),e[25]=c,e[26]=l,e[27]=F,e[28]=i,e[29]=d,e[30]=o,e[31]=v,e[32]=t,e[33]=r,e[34]=g):g=e[34];let p;e[35]!==a||e[36]!==t?(p=!t&&s.jsx("div",{className:"text-center",children:s.jsx(z,{type:"button",variant:"link",onClick:()=>a({to:"/login"}),className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"})}),e[35]=a,e[36]=t,e[37]=p):p=e[37];let R;return e[38]!==m||e[39]!==u||e[40]!==x||e[41]!==f||e[42]!==g||e[43]!==p?(R=s.jsxs("main",{className:"relative flex min-h-screen items-center justify-center bg-gradient-to-br from-primary to-primary/75 p-4",children:[k,s.jsxs("div",{className:"relative z-10",children:[S,_,P,C,s.jsxs("div",{className:"mx-auto w-full min-w-[400px] max-w-md grid gap-6 bg-card p-10 border border-primary-foreground/20",children:[E,m,u,x,f,g,p]})]})]}),e[38]=m,e[39]=u,e[40]=x,e[41]=f,e[42]=g,e[43]=p,e[44]=R):R=e[44],R}async function O(e){const{newPassword:n,token:r}=e,h=await K.resetPassword({newPassword:n,token:r});if(h.error)throw new Error(h.error.message||"Failed to reset password");return h}export{H as default};
@@ -1 +1 @@
1
- import{r as B,s as Se,K as re,aM as ft,j as s,c as Q,l as xe,B as le,e as q,n as Ye,o as $e,z as ht,C as xt,a as Fe,x as ue,t as je,H as Me,aK as _e,J as se,aI as Pe,a_ as Le,y as gt,E as pt,f as bt,d as Tt}from"./index-Dcg8Qevd.js";import{u as Et}from"./use-organization-roles-CXi0dKrO.js";import{u as Re}from"./use-org-auth-client-uXh4lV5h.js";import{B as fe}from"./badge-CTmf2TW8.js";import{A as Qe,a as Ke,b as qe,c as He,d as Ze,f as Xe,e as Je,g as We}from"./alert-dialog-BiN56dOX.js";import{D as It,a as _t,b as St,c as Nt}from"./dropdown-menu-Cbx_bdO_.js";import{i as Ct}from"./DotsVertical-CAgAGLKz.js";import{i as et}from"./Lock01-FiMk9Cv6.js";import{s as Ae}from"./Plus-FC_C8qkl.js";import{s as At}from"./Trash01-4w6_aW9X.js";import{C as jt}from"./collection-table-wrapper-CtvRahI-.js";import{P as te}from"./index-DtUGvIts.js";import{E as ke}from"./empty-state-BnjbbhBR.js";import{S as Oe}from"./search-input-C50ImRzg.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ve}from"./integration-icon-DTJ2wb4X.js";import{u as Rt}from"./use-infinite-scroll-CyUixfAd.js";import{C as we}from"./checkbox-B3EwrxkO.js";import{i as Ot}from"./RefreshCcw01-Cd8Km121.js";import{u as vt}from"./useSuspenseInfiniteQuery-Ck-t1SMi.js";import{u as wt,S as yt}from"./constants-DXQgV2hu.js";import{C as Mt}from"./collection-search-D-x3SJ1z.js";import{u as lt}from"./use-members-Bw_9meIY.js";import{u as Pt}from"./use-connection-wzOJDB7e.js";import{u as Lt,c as kt}from"./use-ai-providers-D1ZzNZfi.js";import{A as nt}from"./avatar-Z1wN1pq-.js";import{S as he}from"./switch-Ba2DX0J8.js";import{c as ge,T as pe,a as be,b as Te}from"./tooltip-sn7TXXXA.js";import{S as De,a as Ge,b as Ue}from"./settings-section-DeAx6MsQ.js";import{t as Dt}from"./ChevronDown-D452dgSU.js";import{i as Gt}from"./ChevronRight-DoY3rcf9.js";import{i as Be}from"./X-BGh8G2l7.js";import"./Check-DBWnyOFJ.js";import"./table-Dpjp6sno.js";import"./XClose-Dz5yGfpm.js";import"./SearchMd-B780aQOS.js";import"./Container-BQVUd9tN.js";import"./agent-icon-CznXZlOI.js";import"./AlertCircle-UghQPlAa.js";import"./Tool01-NWIcFn9q.js";import"./ArrowNarrowLeft-1BfkUm85.js";import"./XCircle-CYGTZyzW.js";import"./ArrowUpRight-1rqShrTM.js";import"./ZapSquare-BLhBRchY.js";import"./Users03-CK1Aa1HI.js";import"./CheckCircle-CBMgXE-F.js";import"./ChevronUp-BlZFoG59.js";import"./Star01-DRidtrYn.js";import"./Palette-DXyBGBQu.js";import"./LinkExternal01-CGcDVdEi.js";import"./Sun-Bpli4t2N.js";import"./Play-CDjH79to.js";import"./Settings02--XuHa5eI.js";import"./Shield01-Bg1T1EGa.js";import"./User01-CxpWRrdM.js";import"./Zap-Druw6RpX.js";import"./infiniteQueryObserver-D9yYekai.js";import"./use-collections-DDocavcC.js";import"./card-Bd8klEwI.js";const ye="basic-usage",ot=[{id:ye,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","AUTOMATION_GET","AUTOMATION_LIST","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","VM_START","VM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS","AI_PROVIDER_CLI_ACTIVATE"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}],Ut=new Set(ot.find(t=>t.id===ye)?.tools??[]);function Bt(){const t=new Map;for(const e of ot){if(e.id===ye)continue;const l=t.get(e.section)??[];l.push(e),t.set(e.section,l)}return Array.from(t.entries()).map(([e,l])=>({section:e,capabilities:l}))}function Vt(t,e,l){return l?!0:t.tools.every(n=>e.includes(n))}function zt(t,e,l){if(l){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const n=new Set(e);for(const o of t.tools)n.delete(o);return Array.from(n)}const Yt=B.memo(function(e){const l=q.c(21),{connection:n,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:g}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;l[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),l[0]=h,l[1]=r):r=l[1];let x;l[2]!==n.icon||l[3]!==n.title?(x=s.jsx(ve,{icon:n.icon,name:n.title,size:"xs"}),l[2]=n.icon,l[3]=n.title,l[4]=x):x=l[4];let i;l[5]!==n.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),l[5]=n.title,l[6]=i):i=l[6];let c;l[7]!==m||l[8]!==x||l[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[x,i]}),l[7]=m,l[8]=x,l[9]=i,l[10]=c):c=l[10];let E;l[11]!==d||l[12]!==n.tools||l[13]!==a||l[14]!==g||l[15]!==p?(E=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",p]}),s.jsx(we,{checked:a,onCheckedChange:g,onClick:Qt})]}),l[11]=d,l[12]=n.tools,l[13]=a,l[14]=g,l[15]=p,l[16]=E):E=l[16];let b;return l[17]!==r||l[18]!==c||l[19]!==E?(b=s.jsxs("div",{className:r,children:[c,E]}),l[17]=r,l[18]=c,l[19]=E,l[20]=b):b=l[20],b}),$t=B.memo(function(e){const l=q.c(18),{connectionId:n,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${n}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let g;l[0]!==m?(g=Q("text-sm font-medium",m),l[0]=m,l[1]=g):g=l[1];let h;l[2]!==g||l[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:g,children:o.name})}),l[2]=g,l[3]=o.name,l[4]=h):h=l[4];let r;l[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),l[5]=o.description,l[6]=r):r=l[6];let x;l[7]!==h||l[8]!==r?(x=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),l[7]=h,l[8]=r,l[9]=x):x=l[9];const i=`tool-${n}-${o.name}`;let c;l[10]!==a||l[11]!==d||l[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),l[10]=a,l[11]=d,l[12]=i,l[13]=c):c=l[13];let E;return l[14]!==p||l[15]!==x||l[16]!==c?(E=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[x,c]}),l[14]=p,l[15]=x,l[16]=c,l[17]=E):E=l[17],E});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:l,searchQuery:n}){const[o,a]=B.useState(""),d=n!==void 0?n:o,p=B.useDeferredValue(d),[m,g]=B.useState("all"),[h,r]=B.useState(!1),x=B.useRef(new Set(Object.keys(t))),{org:i}=Se(),c=wt({connectionId:yt,orgId:i.id,orgSlug:i.slug}),E=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,j=!!l,S={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:0,...j&&{include_virtual:!0}},R=JSON.stringify(S),{data:_,fetchNextPage:A,hasNextPage:f,isFetchingNextPage:N}=vt({queryKey:re.collectionListInfinite(c,i.id,"","CONNECTIONS",R),queryFn:async({pageParam:T=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:T,...j&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,k)=>{if(T?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(T=>T?.items??[])??[],v=Rt(A,f??!1,N),u=l?w.filter(T=>T.connection_type!=="VIRTUAL"?!0:ft(T.connection_url)!==l):w,y=x.current,C=[...y.values()].map(T=>u.find(k=>k.id===T)).filter(T=>T!==void 0),D=u.filter(T=>!y.has(T.id)),G=[...C,...D],$=T=>{const k=t[T];return k!==void 0&&k.length>0},L=G.filter(T=>{if(m==="all")return!0;const k=$(T.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(T=>T.id===V)??null:null,M=O?.tools??[],Y=(T,k)=>t[T]?.includes(k)??!1,K=(T,k)=>{const F=t[T]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[T]:H[T]=Z}else H[T]=[...F,k];e(H)},J=T=>{const k=G.find(X=>X.id===T);if(!k?.tools)return;const F=t[T]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[T]:(Z[T]=ee,z(T)),e(Z)},W=T=>{z(T),r(!0)},ne=()=>{r(!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",h&&"hidden md:flex"),children:[n===void 0&&s.jsx(Mt,{value:o,onChange:a,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:L.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[L.map(T=>{const k=T.tools?.length??0,F=t[T.id]?.length??0;return s.jsx(Yt,{connection:T,isSelected:V===T.id,hasToolsEnabled:$(T.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(T.id),onToggle:()=>J(T.id)},T.id)}),s.jsx("div",{ref:v,className:"h-4"}),N&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:Q("flex-1 flex-col",h?"flex":"hidden md:flex"),children:O?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(le,{variant:"ghost",size:"sm",onClick:ne,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Ot,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ve,{icon:O.icon,name:O.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:O.title}),O.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:O.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:M.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:M.map(T=>s.jsx($t,{connectionId:O.id,tool:T,isSelected:Y(O.id,T.name),onToggle:()=>K(O.id,T.name)},T.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 Qt(t){return t.stopPropagation()}function Kt(t){return t.stopPropagation()}const Ne=["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"],qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function it(t){if(!t)return"bg-neutral-400";let e=0;for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);e=(e<<5)-e+o,e=e&e}const l=Math.abs(e)%Ne.length;return Ne[l]??Ne[0]}function Ve(t,e){return e?qt[t]??"bg-neutral-400":it(t)}const Ht=Me({role:Me({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Le(),staticPermissions:_e(se()),toolSet:Pe(se(),_e(se())),allowAllModels:Le(),modelSet:Pe(se(),_e(se())),memberIds:_e(se())});function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ze(t,e,l){const n=s.jsx(he,{checked:t,disabled:e,onCheckedChange:l});return e?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:n})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):n}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:l,staticPermissions:n,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let g;e[0]!==p?(g=p.trim().toLowerCase(),e[0]=p,e[1]=g):g=e[1];const h=B.useDeferredValue(g);let r;if(e[2]!==l||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==n){const x=Bt(),i=(R,_)=>{if(!m){if(l&&_){const A=x.flatMap(Wt).flatMap(Jt);o(!1),a(A.filter(f=>!R.tools.includes(f)));return}l||a(zt(R,n,!_))}};let c;e[10]!==h?(c=R=>{const{section:_,capabilities:A}=R;return{section:_,capabilities:A.filter(f=>!h||f.label.toLowerCase().includes(h)||f.description.toLowerCase().includes(h))}},e[10]=h,e[11]=c):c=e[11];const E=x.map(c).filter(Xt);let b;e[12]!==l||e[13]!==o||e[14]!==a?(b=()=>{o(!l),a([])},e[12]=l,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==l||e[17]!==m||e[18]!==b?(I=ze(l,m,b),e[16]=l,e[17]=m,e[18]=b,e[19]=I):I=e[19];let j;e[20]!==l||e[21]!==o||e[22]!==a||e[23]!==m?(j=m?void 0:()=>{o(!l),a([])},e[20]=l,e[21]=o,e[22]=a,e[23]=m,e[24]=j):j=e[24];let S;e[25]!==I||e[26]!==j?(S=s.jsx(De,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:I,onClick:j})})}),e[25]=I,e[26]=j,e[27]=S):S=e[27],r=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[S,E.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):E.map(R=>{const{section:_,capabilities:A}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:A.map(f=>{const N=Vt(f,n,l);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(gt,{size:12,className:"text-amber-500 shrink-0"})]}),description:f.description,action:ze(N,m,()=>i(f,N)),onClick:m?void 0:()=>i(f,N)},f.id)})})},_)})]})}),e[2]=l,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=n,e[9]=r}else r=e[9];return r}function Xt(t){return t.capabilities.length>0}function Jt(t){return t.tools}function Wt(t){return t.capabilities}const at={anthropic:"Anthropic",openrouter:"OpenRouter"},es={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ts(t,e){const l=t.indexOf("/"),n=l>0?t.slice(0,l):e;return n.startsWith("~")?n.slice(1):n}function ss(t){return es[t]??at[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ns(t){const e=q.c(44),{connectionId:l,subProviderId:n,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:g,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:x,readOnly:i,defaultExpanded:c}=t,[E,b]=B.useState(c),I=c||E,j=b,[S,R]=B.useState(ct);let _;e[0]!==h||e[1]!==g||e[2]!==m?(_=v=>g||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=g,e[2]=m,e[3]=_):_=e[3];const A=_;let f;if(e[4]!==A||e[5]!==d){let v;e[7]!==A?(v=u=>A(u.id),e[7]=A,e[8]=v):v=e[8],f=d.filter(v),e[4]=A,e[5]=d,e[6]=f}else f=e[6];const N=f.length;let w;if(e[9]!==p||e[10]!==g||e[11]!==l||e[12]!==N||e[13]!==I||e[14]!==a||e[15]!==A||e[16]!==d||e[17]!==x||e[18]!==r||e[19]!==i||e[20]!==n||e[21]!==o||e[22]!==S){const v=d.slice(0,S),u=d.length>S;let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=()=>j(as),e[24]=y):y=e[24];const C=a??tt[n]??st;let D;e[25]!==o||e[26]!==C?(D=s.jsx(ve,{icon:C,name:o,size:"sm"}),e[25]=o,e[26]=C,e[27]=D):D=e[27];let G;e[28]!==o?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=G):G=e[29];let $;e[30]!==D||e[31]!==G?($=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[D,G]}),e[30]=D,e[31]=G,e[32]=$):$=e[32];let L;e[33]!==N||e[34]!==d.length?(L=s.jsxs(fe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[N,"/",d.length," enabled"]}),e[33]=N,e[34]=d.length,e[35]=L):L=e[35];let V;e[36]!==I?(V=I?s.jsx(Dt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Gt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=I,e[37]=V):V=e[37];let z;e[38]!==V||e[39]!==L?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[L,V]}),e[38]=V,e[39]=L,e[40]=z):z=e[40];let O;e[41]!==z||e[42]!==$?(O=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:y,children:[$,z]}),e[41]=z,e[42]=$,e[43]=O):O=e[43],w=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[O,I&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[v.map(M=>{const Y=A(M.id),K=()=>{if(!i){if(g){x(l,p,M.id);return}r(l,M.id)}};return s.jsxs("div",{className:Q("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:K,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:rs,children:i?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:Y,disabled:!0,onCheckedChange:is})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:Y,onCheckedChange:K})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>R(os),children:["Show more (",d.length-S," remaining)"]})]})]}),e[9]=p,e[10]=g,e[11]=l,e[12]=N,e[13]=I,e[14]=a,e[15]=A,e[16]=d,e[17]=x,e[18]=r,e[19]=i,e[20]=n,e[21]=o,e[22]=S,e[23]=w}else w=e[23];return w}function os(t){return t+ct}function is(){}function rs(t){return t.stopPropagation()}function as(t){return!t}function cs(t){const e=q.c(33),{connection:l,selectedModels:n,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:g}=t,h=kt(l.id);let r,x,i,c,E;if(e[0]!==p||e[1]!==o||e[2]!==l.id||e[3]!==l.label||e[4]!==l.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==n){E=Symbol.for("react.early_return_sentinel");e:{let j;e[16]!==l.label?(j=C=>({...C,id:C.modelId,provider:l.label}),e[16]=l.label,e[17]=j):j=e[17];const S=h.filter(fs).map(j),R=m.trim().toLowerCase(),_=R?S.filter(C=>C.title.toLowerCase().includes(R)||C.id.toLowerCase().includes(R)||C.provider?.toLowerCase().includes(R)):S;if(_.length===0){E=null;break e}const A=new Map;for(const C of _){const D=ts(C.id,l.providerId),G=A.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ls(C.title),logo:C.logo}),!G.logo&&C.logo&&(G.logo=C.logo),A.set(D,G)}const f=Array.from(A.entries()).map(us).sort(ms),N=f.length===1||R.length>0;i="flex flex-col gap-3";const w=tt[l.providerId]??st;let v;e[18]!==l.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:l.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=l.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[l.providerId]??l.providerId;let y;e[21]!==u?(y=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=y):y=e[22],e[23]!==y||e[24]!==v?(c=s.jsxs("div",{className:"flex items-center gap-2",children:[v,y]}),e[23]=y,e[24]=v,e[25]=c):c=e[25],r="flex flex-col gap-3",x=f.map(C=>s.jsx(ns,{connectionId:l.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:S.map(ds),selectedModels:n,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:g,defaultExpanded:N},C.id))}e[0]=p,e[1]=o,e[2]=l.id,e[3]=l.label,e[4]=l.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=g,e[9]=m,e[10]=n,e[11]=r,e[12]=x,e[13]=i,e[14]=c,e[15]=E}else r=e[11],x=e[12],i=e[13],c=e[14],E=e[15];if(E!==Symbol.for("react.early_return_sentinel"))return E;let b;e[26]!==r||e[27]!==x?(b=s.jsx("div",{className:r,children:x}),e[26]=r,e[27]=x,e[28]=b):b=e[28];let I;return e[29]!==i||e[30]!==c||e[31]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[29]=i,e[30]=c,e[31]=b,e[32]=I):I=e[32],I}function ds(t){return t.id}function ms(t,e){return t.name.localeCompare(e.name)}function us(t){const[e,l]=t;return{id:e,name:ss(e),logo:l.logo,models:l.models}}function fs(t,e,l){return l.findIndex(n=>n.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:l,modelSet:n,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,g=B.useDeferredValue(p),h=Lt();let r;e[0]!==n||e[1]!==a?(r=(f,N)=>{const w=n[f]??[],v={...n};if(w.includes(N)){const u=w.filter(y=>y!==N);u.length===0?delete v[f]:v[f]=u}else v[f]=[...w,N];a(v)},e[0]=n,e[1]=a,e[2]=r):r=e[2];const x=r;let i;e[3]!==n||e[4]!==o||e[5]!==a?(i=(f,N,w)=>{o(!1),a({...n,[f]:N.filter(v=>v!==w)})},e[3]=n,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,E=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==E?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",E),e[7]=E,e[8]=b):b=e[8];let I;e[9]!==l||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!l;o(f),f&&a({})},e[9]=l,e[10]=o,e[11]=a,e[12]=m,e[13]=I):I=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=j):j=e[14];let S;e[15]!==l||e[16]!==o||e[17]!==a||e[18]!==m?(S=s.jsx("div",{onClick:gs,children:m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:l,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:l,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=l,e[16]=o,e[17]=a,e[18]=m,e[19]=S):S=e[19];let R;e[20]!==b||e[21]!==I||e[22]!==S?(R=s.jsxs("div",{className:b,onClick:I,children:[j,S]}),e[20]=b,e[21]=I,e[22]=S,e[23]=R):R=e[23];let _;e[24]!==h||e[25]!==l||e[26]!==g||e[27]!==c||e[28]!==n||e[29]!==m||e[30]!==x?(_=h.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):h.map(f=>s.jsx(B.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(xe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:n[f.id]??[],allowAllModels:l,onToggleModel:x,onExitAllowAll:c,allConnectionModelsSelected:(n[f.id]??[]).includes("*"),searchQuery:g,readOnly:m})},f.id)),e[24]=h,e[25]=l,e[26]=g,e[27]=c,e[28]=n,e[29]=m,e[30]=x,e[31]=_):_=e[31];let A;return e[32]!==_||e[33]!==R?(A=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[R,_]}),e[32]=_,e[33]=R,e[34]=A):A=e[34],A}function xs(){}function gs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:l,onOpenChange:n,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[h,r]=B.useState(g),{data:x}=lt();let i,c,E,b,I,j,S,R,_,A,f;if(e[1]!==x?.data?.members||e[2]!==m||e[3]!==a||e[4]!==n||e[5]!==l||e[6]!==h||e[7]!==d||e[8]!==o){const $=x?.data?.members??[];let L;e[20]!==m?(L=O=>{const M=m.toLowerCase();return O.user?.name?.toLowerCase().includes(M)||O.user?.email?.toLowerCase().includes(M)},e[20]=m,e[21]=L):L=e[21];const V=$.filter(L);let z;e[22]!==a||e[23]!==n||e[24]!==h?(z=()=>{a(h),r([]),n(!1)},e[22]=a,e[23]=n,e[24]=h,e[25]=z):z=e[25],E=z,c=Qe,A=l,f=n,i=Ke,R="sm:max-w-md p-0 overflow-hidden",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(He,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],j="flex flex-col h-80",e[27]!==d?(S=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:p,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=S):S=e[28],b="flex-1 overflow-auto",I=V.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:V.map(O=>{const M=O.role!=="owner",Y=o.includes(O.id),K=h.includes(O.id);return s.jsxs("label",{className:Q("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:K||Y,onCheckedChange:()=>{!M||Y||r(J=>J.includes(O.id)?J.filter(W=>W!==O.id):[...J,O.id])},disabled:!M||Y}),s.jsx(nt,{url:O.user?.image??void 0,fallback:rt(O.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:O.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:O.user?.email})]}),!M&&s.jsx(fe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(fe,{variant:"outline",className:"shrink-0",children:"Added"})]},O.id)})}),e[1]=x?.data?.members,e[2]=m,e[3]=a,e[4]=n,e[5]=l,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=E,e[12]=b,e[13]=I,e[14]=j,e[15]=S,e[16]=R,e[17]=_,e[18]=A,e[19]=f}else i=e[9],c=e[10],E=e[11],b=e[12],I=e[13],j=e[14],S=e[15],R=e[16],_=e[17],A=e[18],f=e[19];let N;e[29]!==b||e[30]!==I?(N=s.jsx("div",{className:b,children:I}),e[29]=b,e[30]=I,e[31]=N):N=e[31];let w;e[32]!==N||e[33]!==j||e[34]!==S?(w=s.jsxs("div",{className:j,children:[S,N]}),e[32]=N,e[33]=j,e[34]=S,e[35]=w):w=e[35];let v;e[36]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Xe,{children:"Cancel"}),e[36]=v):v=e[36];const u=h.length===0,y=h.length>0&&`(${h.length})`;let C;e[37]!==E||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:E,disabled:u,children:["Add ",y]})]}),e[37]=E,e[38]=u,e[39]=y,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==w||e[43]!==C||e[44]!==R||e[45]!==_?(D=s.jsxs(i,{className:R,children:[_,w,C]}),e[41]=i,e[42]=w,e[43]=C,e[44]=R,e[45]=_,e[46]=D):D=e[46];let G;return e[47]!==c||e[48]!==D||e[49]!==A||e[50]!==f?(G=s.jsx(c,{open:A,onOpenChange:f,children:D}),e[47]=c,e[48]=D,e[49]=A,e[50]=f,e[51]=G):G=e[51],G}function bs(t){const e=q.c(28),{memberIds:l,onMemberIdsChange:n,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,g=B.useDeferredValue(a),{data:h}=lt();let r,x,i;if(e[0]!==h?.data?.members||e[1]!==g||e[2]!==l||e[3]!==n||e[4]!==m||e[5]!==a){const j=h?.data?.members??[];let S;e[9]!==l?(S=f=>l.includes(f.id),e[9]=l,e[10]=S):S=e[10];const R=j.filter(S);let _;e[11]!==g?(_=f=>{const N=g.toLowerCase();return f.user?.name?.toLowerCase().includes(N)||f.user?.email?.toLowerCase().includes(N)},e[11]=g,e[12]=_):_=e[12];const A=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",x=R.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-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):A.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 "',a,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:A.map(f=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(nt,{url:f.user?.image??void 0,fallback:rt(f.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:f.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.user?.email})]}),m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(le,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n(l.filter(N=>N!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=g,e[2]=l,e[3]=n,e[4]=m,e[5]=a,e[6]=r,e[7]=x,e[8]=i}else r=e[6],x=e[7],i=e[8];let c;e[13]!==r||e[14]!==x?(c=s.jsx("div",{className:r,children:x}),e[13]=r,e[14]=x,e[15]=c):c=e[15];let E;e[16]!==l||e[17]!==n?(E=j=>n([...l,...j]),e[16]=l,e[17]=n,e[18]=E):E=e[18];let b;e[19]!==d||e[20]!==l||e[21]!==p||e[22]!==E?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:l,onAddMembers:E}),e[19]=d,e[20]=l,e[21]=p,e[22]=E,e[23]=b):b=e[23];let I;return e[24]!==i||e[25]!==c||e[26]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[24]=i,e[25]=c,e[26]=b,e[27]=I):I=e[27],I}function Ts(t){const e=q.c(3);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=l):l=e[0];let n;return e[1]!==t?(n=s.jsx(B.Suspense,{fallback:l,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=n):n=e[2],n}const Es={owner:[],admin:[],user:[]};function Is(t,e,l,n){if(l?.permission!=null&&n)return dt({id:l.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:l.permission},e,n);const o=t==="owner"||t==="admin";return{role:{id:l?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Es[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,l){const n=t.permission||{},o=n.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,x]of Object.entries(n))if(!(r==="self"||r==="models"))if(r==="*")for(const i of l)p[i.id]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x;else{const i=l.find(c=>c.id===r);i&&(p[r]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x)}const m=n.models||[],g=m.length===0||m.includes("*:*"),h={};if(!g)for(const r of m){const x=r.indexOf(":");if(x===-1)continue;const i=r.slice(0,x),c=r.slice(x+1);h[i]||(h[i]=[]),h[i].push(c)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:a,staticPermissions:d,toolSet:p,allowAllModels:g,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const l={};if(t.allowAllStaticPermissions)l.self=["*"];else{const n=new Set(t.staticPermissions);for(const o of Ut)n.add(o);n.size>0&&(l.self=Array.from(n))}for(const[n,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===n)?.tools?.map(p=>p.name)??[];l[n]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)l.models=["*:*"];else{const n=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)n.push(`${o}:${d}`);n.length>0&&(l.models=n)}return l}function Ss(t,e,l){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,l):t.kind==="custom"?dt(t.role,e,l):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ns(t){const e=q.c(5),{readOnly:l,onOpen:n}=t;if(l){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(le,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=d):d=e[0];let p;return e[1]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ge,{children:s.jsxs(pe,{children:[d,s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}),e[1]=p):p=e[1],p}let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Ae,{size:16}),e[2]=o):o=e[2];let a;return e[3]!==n?(a=s.jsxs(le,{variant:"outline",size:"sm",onClick:n,children:[o,"Add Member"]}),e[3]=n,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:l}=Se(),n=Re(),o=Pt();let a;e[0]!==l?(a=re.members(l),e[0]=l,e[1]=a):a=e[1];let d;e[2]!==n?(d=()=>n.organization.listMembers(),e[2]=n,e[3]=d):d=e[3];let p;e[4]!==a||e[5]!==d?(p={queryKey:a,queryFn:d},e[4]=a,e[5]=d,e[6]=p):p=e[6];const{data:m,isPending:g}=Ye(p);if(g||!o){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=i):i=e[7],i}let h;e[8]!==m?.data?.members?(h=m?.data?.members??[],e[8]=m?.data?.members,e[9]=h):h=e[9];const r=h;let x;return e[10]!==o||e[11]!==r||e[12]!==t?(x=s.jsx(As,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=x):x=e[13],x}function As({target:t,onBack:e,onSaved:l,members:n,connections:o}){const{locator:a}=Se(),d=Re(),p=$e(),m=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,x]=B.useState(m?"org":"mcp"),i=ht({resolver:xt(Ht),defaultValues:Ss(t,n,o)}),c=i.formState.isValid,E=i.formState.isDirty,b=Fe({mutationFn:async u=>{const y=_s(u,o),C=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),D=u.role.slug==="owner"&&!u.role.id,G=(u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,$=async L=>{const V=n.filter(M=>M.role===L).map(M=>M.id),z=u.memberIds.filter(M=>!V.includes(M)),O=V.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[L]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of O){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(D)return await $("owner"),u;if(u.role.id){const L=await d.organization.updateRole({roleId:u.role.id,data:{permission:y}});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),u}else if(G){const L=await d.organization.createRole({role:u.role.slug,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),{...u,role:{...u.role,id:L.data?.roleData?.id}}}else{const L=await d.organization.createRole({role:C,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");for(const V of u.memberIds){const z=await d.organization.updateMemberRole({memberId:V,role:[C]});if(z?.error)throw new Error(z.error.message)}return{...u,role:{...u.role,id:L.data?.roleData?.id,slug:C}}}},onSuccess:(u,y)=>{p.invalidateQueries({queryKey:re.members(a)}),p.invalidateQueries({queryKey:re.organizationRoles(a)});const C=!y.role.id&&!y.role.slug,D=y.role.slug==="owner"&&!y.role.id;je(D?"role_members_updated":C?"role_created":"role_updated",{role_slug:y.role.slug??null}),ue.success(D?"Members updated successfully!":C?"Role created successfully!":"Role updated successfully!"),i.reset(u),l(u.role.id)},onError:u=>{ue.error(u instanceof Error?u.message:"Failed to save role")}}),I=i.handleSubmit(u=>{if(!u.role.label.trim()){ue.error("Role name is required"),i.setFocus("role.label");return}b.mutate(u)}),j=!g,S=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,A]=B.useState(""),[f,N]=B.useState(!1),w=u=>{x(u),A("")},v={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:Q("flex flex-col",r!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:j&&s.jsxs(s.Fragment,{children:[s.jsx(le,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(le,{size:"sm",onClick:I,disabled:b.isPending||!c||!E,children:b.isPending?"Saving...":h?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ve(t.role,!0):t.kind==="custom"?Ve(t.role.role,!1):it(i.watch("role.label")))}),g&&s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),h?s.jsx("input",{...i.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:!0}):s.jsx("span",{className:"truncate",children:S})]})}),s.jsx("div",{className:"flex items-center gap-2",children:R.map(u=>s.jsx("button",{type:"button",onClick:()=>w(u.id),className:Q("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",r===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Oe,{value:_,onChange:A,placeholder:v[r]??"Search...",className:"w-full md:w-[375px]"}),r==="members"&&s.jsx(Ns,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>N(!0)})]})]})}),s.jsx("div",{className:Q("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",r!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:Q(r!=="org"&&"h-full overflow-hidden",r!=="models"&&r!=="org"&&"border border-border rounded-xl bg-card"),children:[r==="mcp"&&!g&&s.jsx(Ft,{toolSet:i.watch("toolSet"),onToolSetChange:u=>i.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),r==="org"&&s.jsx(Zt,{allowAllStaticPermissions:i.watch("allowAllStaticPermissions"),staticPermissions:i.watch("staticPermissions"),onAllowAllChange:u=>i.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>i.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="models"&&s.jsx(hs,{allowAllModels:i.watch("allowAllModels"),modelSet:i.watch("modelSet"),onAllowAllChange:u=>i.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>i.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="members"&&s.jsx(Ts,{memberIds:i.watch("memberIds"),onMemberIdsChange:u=>i.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&t.role==="owner",searchQuery:_,addMemberDialogOpen:f,onAddMemberDialogOpenChange:N})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}const Rs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["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 Os(t){if(!t)return"bg-neutral-400";let e=0;for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);e=(e<<5)-e+o,e=e&e}const l=Math.abs(e)%Ce.length;return Ce[l]??Ce[0]}const vs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ws(t,e){return e?vs[t]??"bg-neutral-400":Os(t)}function ys(){const t=q.c(77),[e,l]=B.useState(""),[n,o]=B.useState(null),a=bt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:p}=Tt(d),{locator:m}=Se(),g=Re(),h=$e(),{customRoles:r,refetch:x}=Et();let i;t[1]!==a?(i=P=>a({to:".",search:U=>({...U,role:P})}),t[1]=a,t[2]=i):i=t[2];const c=i;let E;e:{if(!p){E=null;break e}if(p==="new"){E={kind:"new"};break e}if(p.startsWith("builtin-")){E={kind:"builtin",role:p.slice(8)};break e}let P;t[3]!==p?(P=oe=>oe.id===p,t[3]=p,t[4]=P):P=t[4];const U=r.find(P);E=U?{kind:"custom",role:U}:null}const b=E;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let j;t[7]!==g?(j=()=>g.organization.listMembers(),t[7]=g,t[8]=j):j=t[8];let S;t[9]!==I||t[10]!==j?(S={queryKey:I,queryFn:j},t[9]=I,t[10]=j,t[11]=S):S=t[11];const{data:R}=Ye(S);let _;t[12]!==R?.data?.members?(_=R?.data?.members??[],t[12]=R?.data?.members,t[13]=_):_=t[13];const A=_;let f;t[14]!==A?(f=P=>A.filter(U=>U.role===P).length,t[14]=A,t[15]=f):f=t[15];const N=f;let w;if(t[16]!==r||t[17]!==N||t[18]!==e){let P;t[20]!==N?(P=ie=>({kind:"builtin",role:{...ie,memberCount:N(ie.role)}}),t[20]=N,t[21]=P):P=t[21];const U=Rs.map(P);let oe;t[22]!==N?(oe=ie=>({kind:"custom",role:{...ie,memberCount:N(ie.role)}}),t[22]=N,t[23]=oe):oe=t[23];const mt=r.map(oe);if(w=[...U,...mt],e){const ie=e.toLowerCase();w=w.filter(ut=>ut.role.label.toLowerCase().includes(ie))}t[16]=r,t[17]=N,t[18]=e,t[19]=w}else w=t[19];let v;t[24]!==g?(v=async P=>{const U=await g.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=g,t[25]=v):v=t[25];const u=Fe({mutationFn:v,onSuccess:(P,U)=>{je("role_deleted",{role_id:U}),h.invalidateQueries({queryKey:re.members(m)}),h.invalidateQueries({queryKey:re.organizationRoles(m)}),ue.success("Role deleted successfully!"),x(),b?.kind==="custom"&&b.role.id===U&&c(void 0)},onError:Us});let y,C,D,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Gs,cellClassName:"flex-1 min-w-0",sortable:!0},y={id:"type",header:"Type",render:Ds,cellClassName:"w-28 shrink-0"},C={id:"permissions",header:"Permissions",render:ks,cellClassName:"flex-1 min-w-0"},D={id:"members",header:"Members",render:Ls,cellClassName:"w-24 shrink-0"},t[26]=y,t[27]=C,t[28]=D,t[29]=G):(y=t[26],C=t[27],D=t[28],G=t[29]);let $;t[30]===Symbol.for("react.memo_cache_sentinel")?($=[G,y,C,D,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(It,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ps,children:s.jsx(Ct,{size:16})})}),s.jsx(St,{align:"end",onClick:Ms,children:s.jsxs(Nt,{variant:"destructive",onClick:()=>{const U=P.role;U.id&&o({id:U.id,label:U.label})},children:[s.jsx(At,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=$):$=t[30];const L=$;let V;t[31]!==c?(V=P=>{if(P.kind==="builtin")c(`builtin-${P.role.role}`);else{const U=P.role;c(U.id)}},t[31]=c,t[32]=V):V=t[32];const z=V;if(b){let P;t[33]!==c?(P=()=>c(void 0),t[33]=c,t[34]=P):P=t[34];let U;return t[35]!==x||t[36]!==c?(U=()=>{x(),c(void 0)},t[35]=x,t[36]=c,t[37]=U):U=t[37],s.jsx(Cs,{target:b,onBack:P,onSaved:U},js(b))}let O;t[38]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(te.Title,{children:"Roles"}),t[38]=O):O=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(l(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:l,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let K;t[42]!==c?(K=()=>c("new"),t[42]=c,t[43]=K):K=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Ae,{size:16}),t[44]=J):J=t[44];let W;t[45]!==K?(W=s.jsxs(le,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let ne;t[47]!==Y||t[48]!==W?(ne=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=ne):ne=t[49];let T;t[50]!==e?(T=e?s.jsx(ke,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(ke,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=T):T=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==T?(k=s.jsx(jt,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:T}),t[52]=w,t[53]=L,t[54]=z,t[55]=T,t[56]=k):k=t[56];let F;t[57]!==ne||t[58]!==k?(F=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[O,ne,k]})})}),t[57]=ne,t[58]=k,t[59]=F):F=t[59];const ee=n!==null;let H;t[60]===Symbol.for("react.memo_cache_sentinel")?(H=P=>!P&&o(null),t[60]=H):H=t[60];let Z;t[61]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(He,{children:"Delete Role"}),t[61]=Z):Z=t[61];const X=n?.label;let ae;t[62]!==X?(ae=s.jsxs(qe,{children:[Z,s.jsxs(Ze,{children:['Are you sure you want to delete the "',X,'" role? This action cannot be undone.']})]}),t[62]=X,t[63]=ae):ae=t[63];let Ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Xe,{children:"Cancel"}),t[64]=Ee):Ee=t[64];let ce;t[65]!==u||t[66]!==n?(ce=s.jsxs(Je,{children:[Ee,s.jsx(We,{onClick:()=>{n?.id&&u.mutate(n.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=n,t[67]=ce):ce=t[67];let de;t[68]!==ae||t[69]!==ce?(de=s.jsxs(Ke,{children:[ae,ce]}),t[68]=ae,t[69]=ce,t[70]=de):de=t[70];let me;t[71]!==ee||t[72]!==de?(me=s.jsx(Qe,{open:ee,onOpenChange:H,children:de}),t[71]=ee,t[72]=de,t[73]=me):me=t[73];let Ie;return t[74]!==F||t[75]!==me?(Ie=s.jsxs(te,{children:[F,me]}),t[74]=F,t[75]=me,t[76]=Ie):Ie=t[76],Ie}function Ms(t){return t.stopPropagation()}function Ps(t){return t.stopPropagation()}function Ls(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ks(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,l=[];return e.allowsAllStaticPermissions?l.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&l.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?l.push("All connections"):e.connectionCount&&e.connectionCount>0&&l.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:l.length>0?l.join(", "):"No permissions"})}function Ds(t){return t.kind==="builtin"?s.jsx(fe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(fe,{variant:"outline",className:"text-xs",children:"Custom"})}function Gs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",ws(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(et,{size:12,className:"text-muted-foreground shrink-0"})]})}function Us(t,e){je("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),ue.error(t instanceof Error?t.message:"Failed to delete role")}function Fl(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{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 roles"})})}),t[0]=e):e=t[0];let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(pt,{fallback:e,children:s.jsx(B.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=l):l=t[1],l}export{Fl as default};
1
+ import{r as B,s as Se,K as re,aM as ft,j as s,c as Q,l as xe,B as le,e as q,n as Ye,o as $e,z as ht,C as xt,a as Fe,x as ue,t as je,H as Me,aK as _e,J as se,aI as Pe,a_ as Le,y as gt,E as pt,f as bt,d as Tt}from"./index-CHrUmZgp.js";import{u as Et}from"./use-organization-roles-CKRT39Yc.js";import{u as Re}from"./use-org-auth-client-C9dbWRTq.js";import{B as fe}from"./badge-C8h2D-cf.js";import{A as Qe,a as Ke,b as qe,c as He,d as Ze,f as Xe,e as Je,g as We}from"./alert-dialog-BiImvuLv.js";import{D as It,a as _t,b as St,c as Nt}from"./dropdown-menu-DCt7nnpF.js";import{i as Ct}from"./DotsVertical-D--w_iaX.js";import{i as et}from"./Lock01-DJV5JMDy.js";import{s as Ae}from"./Plus-DDMryLp9.js";import{s as At}from"./Trash01-EHajsAd0.js";import{C as jt}from"./collection-table-wrapper-DQYbUgU8.js";import{P as te}from"./index-Dq__xIAQ.js";import{E as ke}from"./empty-state-DkUQz5Y_.js";import{S as Oe}from"./search-input-B6ULbBJE.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ve}from"./integration-icon-BU0UtHw1.js";import{u as Rt}from"./use-infinite-scroll-B6tdlom4.js";import{C as we}from"./checkbox-cUUI4UbZ.js";import{i as Ot}from"./RefreshCcw01-BNG_5rJW.js";import{u as vt}from"./useSuspenseInfiniteQuery-aIoxf3FE.js";import{u as wt,S as yt}from"./constants-BGb3csMB.js";import{C as Mt}from"./collection-search-BEV6zp35.js";import{u as lt}from"./use-members-DzIKSYZr.js";import{u as Pt}from"./use-connection-BUWHubVp.js";import{u as Lt,c as kt}from"./use-ai-providers-BfAEQYsq.js";import{A as nt}from"./avatar-q80j4hVX.js";import{S as he}from"./switch-iFtU_Uj0.js";import{c as ge,T as pe,a as be,b as Te}from"./tooltip-oz4PgHaK.js";import{S as De,a as Ge,b as Ue}from"./settings-section-CX6DrRQc.js";import{t as Dt}from"./ChevronDown-v_6fVP4M.js";import{i as Gt}from"./ChevronRight-Dzob6m1m.js";import{i as Be}from"./X-BdF-Ta2X.js";import"./Check-BiM2-TvW.js";import"./table-CrLtxirL.js";import"./XClose-BKDvrGgg.js";import"./SearchMd-BL69FKVv.js";import"./Container-D0YzBjXF.js";import"./agent-icon-CkZZqRPj.js";import"./AlertCircle-VdAWApZT.js";import"./Tool01-DZ5nMk2X.js";import"./ArrowNarrowLeft-Cb6jcK-n.js";import"./XCircle-Mzs74oa5.js";import"./ArrowUpRight-B2ZjjZJQ.js";import"./ZapSquare-CM6EGSyy.js";import"./Users03-Bpy5JElG.js";import"./CheckCircle-Ch05HHgc.js";import"./ChevronUp-CUfrmF0I.js";import"./Star01-C0QV--XQ.js";import"./Palette-CEmO1kUS.js";import"./LinkExternal01-QD8wgK8o.js";import"./Sun-B4qv1AhA.js";import"./Play-CRDhnWxZ.js";import"./Settings02-CHdnS1Le.js";import"./Shield01-CDWmokZC.js";import"./User01-DMVSPQ8_.js";import"./Zap-B1XrF636.js";import"./infiniteQueryObserver-BondwvTH.js";import"./use-collections-wkyc_t0D.js";import"./card-Dv-Qnw_l.js";const ye="basic-usage",ot=[{id:ye,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","AUTOMATION_GET","AUTOMATION_LIST","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","VM_START","VM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS","AI_PROVIDER_CLI_ACTIVATE"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}],Ut=new Set(ot.find(t=>t.id===ye)?.tools??[]);function Bt(){const t=new Map;for(const e of ot){if(e.id===ye)continue;const l=t.get(e.section)??[];l.push(e),t.set(e.section,l)}return Array.from(t.entries()).map(([e,l])=>({section:e,capabilities:l}))}function Vt(t,e,l){return l?!0:t.tools.every(n=>e.includes(n))}function zt(t,e,l){if(l){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const n=new Set(e);for(const o of t.tools)n.delete(o);return Array.from(n)}const Yt=B.memo(function(e){const l=q.c(21),{connection:n,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:g}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;l[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),l[0]=h,l[1]=r):r=l[1];let x;l[2]!==n.icon||l[3]!==n.title?(x=s.jsx(ve,{icon:n.icon,name:n.title,size:"xs"}),l[2]=n.icon,l[3]=n.title,l[4]=x):x=l[4];let i;l[5]!==n.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),l[5]=n.title,l[6]=i):i=l[6];let c;l[7]!==m||l[8]!==x||l[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[x,i]}),l[7]=m,l[8]=x,l[9]=i,l[10]=c):c=l[10];let E;l[11]!==d||l[12]!==n.tools||l[13]!==a||l[14]!==g||l[15]!==p?(E=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",p]}),s.jsx(we,{checked:a,onCheckedChange:g,onClick:Qt})]}),l[11]=d,l[12]=n.tools,l[13]=a,l[14]=g,l[15]=p,l[16]=E):E=l[16];let b;return l[17]!==r||l[18]!==c||l[19]!==E?(b=s.jsxs("div",{className:r,children:[c,E]}),l[17]=r,l[18]=c,l[19]=E,l[20]=b):b=l[20],b}),$t=B.memo(function(e){const l=q.c(18),{connectionId:n,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${n}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let g;l[0]!==m?(g=Q("text-sm font-medium",m),l[0]=m,l[1]=g):g=l[1];let h;l[2]!==g||l[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:g,children:o.name})}),l[2]=g,l[3]=o.name,l[4]=h):h=l[4];let r;l[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),l[5]=o.description,l[6]=r):r=l[6];let x;l[7]!==h||l[8]!==r?(x=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),l[7]=h,l[8]=r,l[9]=x):x=l[9];const i=`tool-${n}-${o.name}`;let c;l[10]!==a||l[11]!==d||l[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),l[10]=a,l[11]=d,l[12]=i,l[13]=c):c=l[13];let E;return l[14]!==p||l[15]!==x||l[16]!==c?(E=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[x,c]}),l[14]=p,l[15]=x,l[16]=c,l[17]=E):E=l[17],E});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:l,searchQuery:n}){const[o,a]=B.useState(""),d=n!==void 0?n:o,p=B.useDeferredValue(d),[m,g]=B.useState("all"),[h,r]=B.useState(!1),x=B.useRef(new Set(Object.keys(t))),{org:i}=Se(),c=wt({connectionId:yt,orgId:i.id,orgSlug:i.slug}),E=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,j=!!l,S={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:0,...j&&{include_virtual:!0}},R=JSON.stringify(S),{data:_,fetchNextPage:A,hasNextPage:f,isFetchingNextPage:N}=vt({queryKey:re.collectionListInfinite(c,i.id,"","CONNECTIONS",R),queryFn:async({pageParam:T=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:T,...j&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,k)=>{if(T?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(T=>T?.items??[])??[],v=Rt(A,f??!1,N),u=l?w.filter(T=>T.connection_type!=="VIRTUAL"?!0:ft(T.connection_url)!==l):w,y=x.current,C=[...y.values()].map(T=>u.find(k=>k.id===T)).filter(T=>T!==void 0),D=u.filter(T=>!y.has(T.id)),G=[...C,...D],$=T=>{const k=t[T];return k!==void 0&&k.length>0},L=G.filter(T=>{if(m==="all")return!0;const k=$(T.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(T=>T.id===V)??null:null,M=O?.tools??[],Y=(T,k)=>t[T]?.includes(k)??!1,K=(T,k)=>{const F=t[T]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[T]:H[T]=Z}else H[T]=[...F,k];e(H)},J=T=>{const k=G.find(X=>X.id===T);if(!k?.tools)return;const F=t[T]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[T]:(Z[T]=ee,z(T)),e(Z)},W=T=>{z(T),r(!0)},ne=()=>{r(!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",h&&"hidden md:flex"),children:[n===void 0&&s.jsx(Mt,{value:o,onChange:a,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:L.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[L.map(T=>{const k=T.tools?.length??0,F=t[T.id]?.length??0;return s.jsx(Yt,{connection:T,isSelected:V===T.id,hasToolsEnabled:$(T.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(T.id),onToggle:()=>J(T.id)},T.id)}),s.jsx("div",{ref:v,className:"h-4"}),N&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:Q("flex-1 flex-col",h?"flex":"hidden md:flex"),children:O?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(le,{variant:"ghost",size:"sm",onClick:ne,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Ot,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ve,{icon:O.icon,name:O.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:O.title}),O.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:O.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:M.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:M.map(T=>s.jsx($t,{connectionId:O.id,tool:T,isSelected:Y(O.id,T.name),onToggle:()=>K(O.id,T.name)},T.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 Qt(t){return t.stopPropagation()}function Kt(t){return t.stopPropagation()}const Ne=["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"],qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function it(t){if(!t)return"bg-neutral-400";let e=0;for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);e=(e<<5)-e+o,e=e&e}const l=Math.abs(e)%Ne.length;return Ne[l]??Ne[0]}function Ve(t,e){return e?qt[t]??"bg-neutral-400":it(t)}const Ht=Me({role:Me({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Le(),staticPermissions:_e(se()),toolSet:Pe(se(),_e(se())),allowAllModels:Le(),modelSet:Pe(se(),_e(se())),memberIds:_e(se())});function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ze(t,e,l){const n=s.jsx(he,{checked:t,disabled:e,onCheckedChange:l});return e?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:n})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):n}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:l,staticPermissions:n,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let g;e[0]!==p?(g=p.trim().toLowerCase(),e[0]=p,e[1]=g):g=e[1];const h=B.useDeferredValue(g);let r;if(e[2]!==l||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==n){const x=Bt(),i=(R,_)=>{if(!m){if(l&&_){const A=x.flatMap(Wt).flatMap(Jt);o(!1),a(A.filter(f=>!R.tools.includes(f)));return}l||a(zt(R,n,!_))}};let c;e[10]!==h?(c=R=>{const{section:_,capabilities:A}=R;return{section:_,capabilities:A.filter(f=>!h||f.label.toLowerCase().includes(h)||f.description.toLowerCase().includes(h))}},e[10]=h,e[11]=c):c=e[11];const E=x.map(c).filter(Xt);let b;e[12]!==l||e[13]!==o||e[14]!==a?(b=()=>{o(!l),a([])},e[12]=l,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==l||e[17]!==m||e[18]!==b?(I=ze(l,m,b),e[16]=l,e[17]=m,e[18]=b,e[19]=I):I=e[19];let j;e[20]!==l||e[21]!==o||e[22]!==a||e[23]!==m?(j=m?void 0:()=>{o(!l),a([])},e[20]=l,e[21]=o,e[22]=a,e[23]=m,e[24]=j):j=e[24];let S;e[25]!==I||e[26]!==j?(S=s.jsx(De,{title:"General",children:s.jsx(Ge,{children:s.jsx(Ue,{title:"All organization permissions",description:"Grant full access to all features below",action:I,onClick:j})})}),e[25]=I,e[26]=j,e[27]=S):S=e[27],r=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[S,E.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):E.map(R=>{const{section:_,capabilities:A}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:A.map(f=>{const N=Vt(f,n,l);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(gt,{size:12,className:"text-amber-500 shrink-0"})]}),description:f.description,action:ze(N,m,()=>i(f,N)),onClick:m?void 0:()=>i(f,N)},f.id)})})},_)})]})}),e[2]=l,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=n,e[9]=r}else r=e[9];return r}function Xt(t){return t.capabilities.length>0}function Jt(t){return t.tools}function Wt(t){return t.capabilities}const at={anthropic:"Anthropic",openrouter:"OpenRouter"},es={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ts(t,e){const l=t.indexOf("/"),n=l>0?t.slice(0,l):e;return n.startsWith("~")?n.slice(1):n}function ss(t){return es[t]??at[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ns(t){const e=q.c(44),{connectionId:l,subProviderId:n,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:g,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:x,readOnly:i,defaultExpanded:c}=t,[E,b]=B.useState(c),I=c||E,j=b,[S,R]=B.useState(ct);let _;e[0]!==h||e[1]!==g||e[2]!==m?(_=v=>g||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=g,e[2]=m,e[3]=_):_=e[3];const A=_;let f;if(e[4]!==A||e[5]!==d){let v;e[7]!==A?(v=u=>A(u.id),e[7]=A,e[8]=v):v=e[8],f=d.filter(v),e[4]=A,e[5]=d,e[6]=f}else f=e[6];const N=f.length;let w;if(e[9]!==p||e[10]!==g||e[11]!==l||e[12]!==N||e[13]!==I||e[14]!==a||e[15]!==A||e[16]!==d||e[17]!==x||e[18]!==r||e[19]!==i||e[20]!==n||e[21]!==o||e[22]!==S){const v=d.slice(0,S),u=d.length>S;let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=()=>j(as),e[24]=y):y=e[24];const C=a??tt[n]??st;let D;e[25]!==o||e[26]!==C?(D=s.jsx(ve,{icon:C,name:o,size:"sm"}),e[25]=o,e[26]=C,e[27]=D):D=e[27];let G;e[28]!==o?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=G):G=e[29];let $;e[30]!==D||e[31]!==G?($=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[D,G]}),e[30]=D,e[31]=G,e[32]=$):$=e[32];let L;e[33]!==N||e[34]!==d.length?(L=s.jsxs(fe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[N,"/",d.length," enabled"]}),e[33]=N,e[34]=d.length,e[35]=L):L=e[35];let V;e[36]!==I?(V=I?s.jsx(Dt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Gt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=I,e[37]=V):V=e[37];let z;e[38]!==V||e[39]!==L?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[L,V]}),e[38]=V,e[39]=L,e[40]=z):z=e[40];let O;e[41]!==z||e[42]!==$?(O=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:y,children:[$,z]}),e[41]=z,e[42]=$,e[43]=O):O=e[43],w=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[O,I&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[v.map(M=>{const Y=A(M.id),K=()=>{if(!i){if(g){x(l,p,M.id);return}r(l,M.id)}};return s.jsxs("div",{className:Q("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:K,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:rs,children:i?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:Y,disabled:!0,onCheckedChange:is})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:Y,onCheckedChange:K})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>R(os),children:["Show more (",d.length-S," remaining)"]})]})]}),e[9]=p,e[10]=g,e[11]=l,e[12]=N,e[13]=I,e[14]=a,e[15]=A,e[16]=d,e[17]=x,e[18]=r,e[19]=i,e[20]=n,e[21]=o,e[22]=S,e[23]=w}else w=e[23];return w}function os(t){return t+ct}function is(){}function rs(t){return t.stopPropagation()}function as(t){return!t}function cs(t){const e=q.c(33),{connection:l,selectedModels:n,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:g}=t,h=kt(l.id);let r,x,i,c,E;if(e[0]!==p||e[1]!==o||e[2]!==l.id||e[3]!==l.label||e[4]!==l.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==n){E=Symbol.for("react.early_return_sentinel");e:{let j;e[16]!==l.label?(j=C=>({...C,id:C.modelId,provider:l.label}),e[16]=l.label,e[17]=j):j=e[17];const S=h.filter(fs).map(j),R=m.trim().toLowerCase(),_=R?S.filter(C=>C.title.toLowerCase().includes(R)||C.id.toLowerCase().includes(R)||C.provider?.toLowerCase().includes(R)):S;if(_.length===0){E=null;break e}const A=new Map;for(const C of _){const D=ts(C.id,l.providerId),G=A.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ls(C.title),logo:C.logo}),!G.logo&&C.logo&&(G.logo=C.logo),A.set(D,G)}const f=Array.from(A.entries()).map(us).sort(ms),N=f.length===1||R.length>0;i="flex flex-col gap-3";const w=tt[l.providerId]??st;let v;e[18]!==l.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:l.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=l.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[l.providerId]??l.providerId;let y;e[21]!==u?(y=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=y):y=e[22],e[23]!==y||e[24]!==v?(c=s.jsxs("div",{className:"flex items-center gap-2",children:[v,y]}),e[23]=y,e[24]=v,e[25]=c):c=e[25],r="flex flex-col gap-3",x=f.map(C=>s.jsx(ns,{connectionId:l.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:S.map(ds),selectedModels:n,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:g,defaultExpanded:N},C.id))}e[0]=p,e[1]=o,e[2]=l.id,e[3]=l.label,e[4]=l.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=g,e[9]=m,e[10]=n,e[11]=r,e[12]=x,e[13]=i,e[14]=c,e[15]=E}else r=e[11],x=e[12],i=e[13],c=e[14],E=e[15];if(E!==Symbol.for("react.early_return_sentinel"))return E;let b;e[26]!==r||e[27]!==x?(b=s.jsx("div",{className:r,children:x}),e[26]=r,e[27]=x,e[28]=b):b=e[28];let I;return e[29]!==i||e[30]!==c||e[31]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[29]=i,e[30]=c,e[31]=b,e[32]=I):I=e[32],I}function ds(t){return t.id}function ms(t,e){return t.name.localeCompare(e.name)}function us(t){const[e,l]=t;return{id:e,name:ss(e),logo:l.logo,models:l.models}}function fs(t,e,l){return l.findIndex(n=>n.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:l,modelSet:n,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,g=B.useDeferredValue(p),h=Lt();let r;e[0]!==n||e[1]!==a?(r=(f,N)=>{const w=n[f]??[],v={...n};if(w.includes(N)){const u=w.filter(y=>y!==N);u.length===0?delete v[f]:v[f]=u}else v[f]=[...w,N];a(v)},e[0]=n,e[1]=a,e[2]=r):r=e[2];const x=r;let i;e[3]!==n||e[4]!==o||e[5]!==a?(i=(f,N,w)=>{o(!1),a({...n,[f]:N.filter(v=>v!==w)})},e[3]=n,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,E=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==E?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",E),e[7]=E,e[8]=b):b=e[8];let I;e[9]!==l||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!l;o(f),f&&a({})},e[9]=l,e[10]=o,e[11]=a,e[12]=m,e[13]=I):I=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=j):j=e[14];let S;e[15]!==l||e[16]!==o||e[17]!==a||e[18]!==m?(S=s.jsx("div",{onClick:gs,children:m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:l,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:l,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=l,e[16]=o,e[17]=a,e[18]=m,e[19]=S):S=e[19];let R;e[20]!==b||e[21]!==I||e[22]!==S?(R=s.jsxs("div",{className:b,onClick:I,children:[j,S]}),e[20]=b,e[21]=I,e[22]=S,e[23]=R):R=e[23];let _;e[24]!==h||e[25]!==l||e[26]!==g||e[27]!==c||e[28]!==n||e[29]!==m||e[30]!==x?(_=h.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):h.map(f=>s.jsx(B.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(xe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:n[f.id]??[],allowAllModels:l,onToggleModel:x,onExitAllowAll:c,allConnectionModelsSelected:(n[f.id]??[]).includes("*"),searchQuery:g,readOnly:m})},f.id)),e[24]=h,e[25]=l,e[26]=g,e[27]=c,e[28]=n,e[29]=m,e[30]=x,e[31]=_):_=e[31];let A;return e[32]!==_||e[33]!==R?(A=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[R,_]}),e[32]=_,e[33]=R,e[34]=A):A=e[34],A}function xs(){}function gs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:l,onOpenChange:n,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[h,r]=B.useState(g),{data:x}=lt();let i,c,E,b,I,j,S,R,_,A,f;if(e[1]!==x?.data?.members||e[2]!==m||e[3]!==a||e[4]!==n||e[5]!==l||e[6]!==h||e[7]!==d||e[8]!==o){const $=x?.data?.members??[];let L;e[20]!==m?(L=O=>{const M=m.toLowerCase();return O.user?.name?.toLowerCase().includes(M)||O.user?.email?.toLowerCase().includes(M)},e[20]=m,e[21]=L):L=e[21];const V=$.filter(L);let z;e[22]!==a||e[23]!==n||e[24]!==h?(z=()=>{a(h),r([]),n(!1)},e[22]=a,e[23]=n,e[24]=h,e[25]=z):z=e[25],E=z,c=Qe,A=l,f=n,i=Ke,R="sm:max-w-md p-0 overflow-hidden",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(He,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],j="flex flex-col h-80",e[27]!==d?(S=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:p,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=S):S=e[28],b="flex-1 overflow-auto",I=V.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:V.map(O=>{const M=O.role!=="owner",Y=o.includes(O.id),K=h.includes(O.id);return s.jsxs("label",{className:Q("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:K||Y,onCheckedChange:()=>{!M||Y||r(J=>J.includes(O.id)?J.filter(W=>W!==O.id):[...J,O.id])},disabled:!M||Y}),s.jsx(nt,{url:O.user?.image??void 0,fallback:rt(O.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:O.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:O.user?.email})]}),!M&&s.jsx(fe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(fe,{variant:"outline",className:"shrink-0",children:"Added"})]},O.id)})}),e[1]=x?.data?.members,e[2]=m,e[3]=a,e[4]=n,e[5]=l,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=E,e[12]=b,e[13]=I,e[14]=j,e[15]=S,e[16]=R,e[17]=_,e[18]=A,e[19]=f}else i=e[9],c=e[10],E=e[11],b=e[12],I=e[13],j=e[14],S=e[15],R=e[16],_=e[17],A=e[18],f=e[19];let N;e[29]!==b||e[30]!==I?(N=s.jsx("div",{className:b,children:I}),e[29]=b,e[30]=I,e[31]=N):N=e[31];let w;e[32]!==N||e[33]!==j||e[34]!==S?(w=s.jsxs("div",{className:j,children:[S,N]}),e[32]=N,e[33]=j,e[34]=S,e[35]=w):w=e[35];let v;e[36]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Xe,{children:"Cancel"}),e[36]=v):v=e[36];const u=h.length===0,y=h.length>0&&`(${h.length})`;let C;e[37]!==E||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:E,disabled:u,children:["Add ",y]})]}),e[37]=E,e[38]=u,e[39]=y,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==w||e[43]!==C||e[44]!==R||e[45]!==_?(D=s.jsxs(i,{className:R,children:[_,w,C]}),e[41]=i,e[42]=w,e[43]=C,e[44]=R,e[45]=_,e[46]=D):D=e[46];let G;return e[47]!==c||e[48]!==D||e[49]!==A||e[50]!==f?(G=s.jsx(c,{open:A,onOpenChange:f,children:D}),e[47]=c,e[48]=D,e[49]=A,e[50]=f,e[51]=G):G=e[51],G}function bs(t){const e=q.c(28),{memberIds:l,onMemberIdsChange:n,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,g=B.useDeferredValue(a),{data:h}=lt();let r,x,i;if(e[0]!==h?.data?.members||e[1]!==g||e[2]!==l||e[3]!==n||e[4]!==m||e[5]!==a){const j=h?.data?.members??[];let S;e[9]!==l?(S=f=>l.includes(f.id),e[9]=l,e[10]=S):S=e[10];const R=j.filter(S);let _;e[11]!==g?(_=f=>{const N=g.toLowerCase();return f.user?.name?.toLowerCase().includes(N)||f.user?.email?.toLowerCase().includes(N)},e[11]=g,e[12]=_):_=e[12];const A=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",x=R.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-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):A.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 "',a,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:A.map(f=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(nt,{url:f.user?.image??void 0,fallback:rt(f.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:f.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.user?.email})]}),m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(le,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n(l.filter(N=>N!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=g,e[2]=l,e[3]=n,e[4]=m,e[5]=a,e[6]=r,e[7]=x,e[8]=i}else r=e[6],x=e[7],i=e[8];let c;e[13]!==r||e[14]!==x?(c=s.jsx("div",{className:r,children:x}),e[13]=r,e[14]=x,e[15]=c):c=e[15];let E;e[16]!==l||e[17]!==n?(E=j=>n([...l,...j]),e[16]=l,e[17]=n,e[18]=E):E=e[18];let b;e[19]!==d||e[20]!==l||e[21]!==p||e[22]!==E?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:l,onAddMembers:E}),e[19]=d,e[20]=l,e[21]=p,e[22]=E,e[23]=b):b=e[23];let I;return e[24]!==i||e[25]!==c||e[26]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[24]=i,e[25]=c,e[26]=b,e[27]=I):I=e[27],I}function Ts(t){const e=q.c(3);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=l):l=e[0];let n;return e[1]!==t?(n=s.jsx(B.Suspense,{fallback:l,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=n):n=e[2],n}const Es={owner:[],admin:[],user:[]};function Is(t,e,l,n){if(l?.permission!=null&&n)return dt({id:l.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:l.permission},e,n);const o=t==="owner"||t==="admin";return{role:{id:l?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Es[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,l){const n=t.permission||{},o=n.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,x]of Object.entries(n))if(!(r==="self"||r==="models"))if(r==="*")for(const i of l)p[i.id]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x;else{const i=l.find(c=>c.id===r);i&&(p[r]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x)}const m=n.models||[],g=m.length===0||m.includes("*:*"),h={};if(!g)for(const r of m){const x=r.indexOf(":");if(x===-1)continue;const i=r.slice(0,x),c=r.slice(x+1);h[i]||(h[i]=[]),h[i].push(c)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:a,staticPermissions:d,toolSet:p,allowAllModels:g,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const l={};if(t.allowAllStaticPermissions)l.self=["*"];else{const n=new Set(t.staticPermissions);for(const o of Ut)n.add(o);n.size>0&&(l.self=Array.from(n))}for(const[n,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===n)?.tools?.map(p=>p.name)??[];l[n]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)l.models=["*:*"];else{const n=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)n.push(`${o}:${d}`);n.length>0&&(l.models=n)}return l}function Ss(t,e,l){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,l):t.kind==="custom"?dt(t.role,e,l):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ns(t){const e=q.c(5),{readOnly:l,onOpen:n}=t;if(l){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(le,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=d):d=e[0];let p;return e[1]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ge,{children:s.jsxs(pe,{children:[d,s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}),e[1]=p):p=e[1],p}let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Ae,{size:16}),e[2]=o):o=e[2];let a;return e[3]!==n?(a=s.jsxs(le,{variant:"outline",size:"sm",onClick:n,children:[o,"Add Member"]}),e[3]=n,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:l}=Se(),n=Re(),o=Pt();let a;e[0]!==l?(a=re.members(l),e[0]=l,e[1]=a):a=e[1];let d;e[2]!==n?(d=()=>n.organization.listMembers(),e[2]=n,e[3]=d):d=e[3];let p;e[4]!==a||e[5]!==d?(p={queryKey:a,queryFn:d},e[4]=a,e[5]=d,e[6]=p):p=e[6];const{data:m,isPending:g}=Ye(p);if(g||!o){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=i):i=e[7],i}let h;e[8]!==m?.data?.members?(h=m?.data?.members??[],e[8]=m?.data?.members,e[9]=h):h=e[9];const r=h;let x;return e[10]!==o||e[11]!==r||e[12]!==t?(x=s.jsx(As,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=x):x=e[13],x}function As({target:t,onBack:e,onSaved:l,members:n,connections:o}){const{locator:a}=Se(),d=Re(),p=$e(),m=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,x]=B.useState(m?"org":"mcp"),i=ht({resolver:xt(Ht),defaultValues:Ss(t,n,o)}),c=i.formState.isValid,E=i.formState.isDirty,b=Fe({mutationFn:async u=>{const y=_s(u,o),C=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),D=u.role.slug==="owner"&&!u.role.id,G=(u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,$=async L=>{const V=n.filter(M=>M.role===L).map(M=>M.id),z=u.memberIds.filter(M=>!V.includes(M)),O=V.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[L]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of O){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(D)return await $("owner"),u;if(u.role.id){const L=await d.organization.updateRole({roleId:u.role.id,data:{permission:y}});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),u}else if(G){const L=await d.organization.createRole({role:u.role.slug,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),{...u,role:{...u.role,id:L.data?.roleData?.id}}}else{const L=await d.organization.createRole({role:C,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");for(const V of u.memberIds){const z=await d.organization.updateMemberRole({memberId:V,role:[C]});if(z?.error)throw new Error(z.error.message)}return{...u,role:{...u.role,id:L.data?.roleData?.id,slug:C}}}},onSuccess:(u,y)=>{p.invalidateQueries({queryKey:re.members(a)}),p.invalidateQueries({queryKey:re.organizationRoles(a)});const C=!y.role.id&&!y.role.slug,D=y.role.slug==="owner"&&!y.role.id;je(D?"role_members_updated":C?"role_created":"role_updated",{role_slug:y.role.slug??null}),ue.success(D?"Members updated successfully!":C?"Role created successfully!":"Role updated successfully!"),i.reset(u),l(u.role.id)},onError:u=>{ue.error(u instanceof Error?u.message:"Failed to save role")}}),I=i.handleSubmit(u=>{if(!u.role.label.trim()){ue.error("Role name is required"),i.setFocus("role.label");return}b.mutate(u)}),j=!g,S=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,A]=B.useState(""),[f,N]=B.useState(!1),w=u=>{x(u),A("")},v={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:Q("flex flex-col",r!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:j&&s.jsxs(s.Fragment,{children:[s.jsx(le,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(le,{size:"sm",onClick:I,disabled:b.isPending||!c||!E,children:b.isPending?"Saving...":h?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ve(t.role,!0):t.kind==="custom"?Ve(t.role.role,!1):it(i.watch("role.label")))}),g&&s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),h?s.jsx("input",{...i.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:!0}):s.jsx("span",{className:"truncate",children:S})]})}),s.jsx("div",{className:"flex items-center gap-2",children:R.map(u=>s.jsx("button",{type:"button",onClick:()=>w(u.id),className:Q("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",r===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Oe,{value:_,onChange:A,placeholder:v[r]??"Search...",className:"w-full md:w-[375px]"}),r==="members"&&s.jsx(Ns,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>N(!0)})]})]})}),s.jsx("div",{className:Q("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",r!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:Q(r!=="org"&&"h-full overflow-hidden",r!=="models"&&r!=="org"&&"border border-border rounded-xl bg-card"),children:[r==="mcp"&&!g&&s.jsx(Ft,{toolSet:i.watch("toolSet"),onToolSetChange:u=>i.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),r==="org"&&s.jsx(Zt,{allowAllStaticPermissions:i.watch("allowAllStaticPermissions"),staticPermissions:i.watch("staticPermissions"),onAllowAllChange:u=>i.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>i.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="models"&&s.jsx(hs,{allowAllModels:i.watch("allowAllModels"),modelSet:i.watch("modelSet"),onAllowAllChange:u=>i.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>i.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="members"&&s.jsx(Ts,{memberIds:i.watch("memberIds"),onMemberIdsChange:u=>i.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&t.role==="owner",searchQuery:_,addMemberDialogOpen:f,onAddMemberDialogOpenChange:N})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}const Rs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["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 Os(t){if(!t)return"bg-neutral-400";let e=0;for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);e=(e<<5)-e+o,e=e&e}const l=Math.abs(e)%Ce.length;return Ce[l]??Ce[0]}const vs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ws(t,e){return e?vs[t]??"bg-neutral-400":Os(t)}function ys(){const t=q.c(77),[e,l]=B.useState(""),[n,o]=B.useState(null),a=bt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:p}=Tt(d),{locator:m}=Se(),g=Re(),h=$e(),{customRoles:r,refetch:x}=Et();let i;t[1]!==a?(i=P=>a({to:".",search:U=>({...U,role:P})}),t[1]=a,t[2]=i):i=t[2];const c=i;let E;e:{if(!p){E=null;break e}if(p==="new"){E={kind:"new"};break e}if(p.startsWith("builtin-")){E={kind:"builtin",role:p.slice(8)};break e}let P;t[3]!==p?(P=oe=>oe.id===p,t[3]=p,t[4]=P):P=t[4];const U=r.find(P);E=U?{kind:"custom",role:U}:null}const b=E;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let j;t[7]!==g?(j=()=>g.organization.listMembers(),t[7]=g,t[8]=j):j=t[8];let S;t[9]!==I||t[10]!==j?(S={queryKey:I,queryFn:j},t[9]=I,t[10]=j,t[11]=S):S=t[11];const{data:R}=Ye(S);let _;t[12]!==R?.data?.members?(_=R?.data?.members??[],t[12]=R?.data?.members,t[13]=_):_=t[13];const A=_;let f;t[14]!==A?(f=P=>A.filter(U=>U.role===P).length,t[14]=A,t[15]=f):f=t[15];const N=f;let w;if(t[16]!==r||t[17]!==N||t[18]!==e){let P;t[20]!==N?(P=ie=>({kind:"builtin",role:{...ie,memberCount:N(ie.role)}}),t[20]=N,t[21]=P):P=t[21];const U=Rs.map(P);let oe;t[22]!==N?(oe=ie=>({kind:"custom",role:{...ie,memberCount:N(ie.role)}}),t[22]=N,t[23]=oe):oe=t[23];const mt=r.map(oe);if(w=[...U,...mt],e){const ie=e.toLowerCase();w=w.filter(ut=>ut.role.label.toLowerCase().includes(ie))}t[16]=r,t[17]=N,t[18]=e,t[19]=w}else w=t[19];let v;t[24]!==g?(v=async P=>{const U=await g.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=g,t[25]=v):v=t[25];const u=Fe({mutationFn:v,onSuccess:(P,U)=>{je("role_deleted",{role_id:U}),h.invalidateQueries({queryKey:re.members(m)}),h.invalidateQueries({queryKey:re.organizationRoles(m)}),ue.success("Role deleted successfully!"),x(),b?.kind==="custom"&&b.role.id===U&&c(void 0)},onError:Us});let y,C,D,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Gs,cellClassName:"flex-1 min-w-0",sortable:!0},y={id:"type",header:"Type",render:Ds,cellClassName:"w-28 shrink-0"},C={id:"permissions",header:"Permissions",render:ks,cellClassName:"flex-1 min-w-0"},D={id:"members",header:"Members",render:Ls,cellClassName:"w-24 shrink-0"},t[26]=y,t[27]=C,t[28]=D,t[29]=G):(y=t[26],C=t[27],D=t[28],G=t[29]);let $;t[30]===Symbol.for("react.memo_cache_sentinel")?($=[G,y,C,D,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(It,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ps,children:s.jsx(Ct,{size:16})})}),s.jsx(St,{align:"end",onClick:Ms,children:s.jsxs(Nt,{variant:"destructive",onClick:()=>{const U=P.role;U.id&&o({id:U.id,label:U.label})},children:[s.jsx(At,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=$):$=t[30];const L=$;let V;t[31]!==c?(V=P=>{if(P.kind==="builtin")c(`builtin-${P.role.role}`);else{const U=P.role;c(U.id)}},t[31]=c,t[32]=V):V=t[32];const z=V;if(b){let P;t[33]!==c?(P=()=>c(void 0),t[33]=c,t[34]=P):P=t[34];let U;return t[35]!==x||t[36]!==c?(U=()=>{x(),c(void 0)},t[35]=x,t[36]=c,t[37]=U):U=t[37],s.jsx(Cs,{target:b,onBack:P,onSaved:U},js(b))}let O;t[38]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(te.Title,{children:"Roles"}),t[38]=O):O=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(l(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:l,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let K;t[42]!==c?(K=()=>c("new"),t[42]=c,t[43]=K):K=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Ae,{size:16}),t[44]=J):J=t[44];let W;t[45]!==K?(W=s.jsxs(le,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let ne;t[47]!==Y||t[48]!==W?(ne=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=ne):ne=t[49];let T;t[50]!==e?(T=e?s.jsx(ke,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(ke,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=T):T=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==T?(k=s.jsx(jt,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:T}),t[52]=w,t[53]=L,t[54]=z,t[55]=T,t[56]=k):k=t[56];let F;t[57]!==ne||t[58]!==k?(F=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[O,ne,k]})})}),t[57]=ne,t[58]=k,t[59]=F):F=t[59];const ee=n!==null;let H;t[60]===Symbol.for("react.memo_cache_sentinel")?(H=P=>!P&&o(null),t[60]=H):H=t[60];let Z;t[61]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(He,{children:"Delete Role"}),t[61]=Z):Z=t[61];const X=n?.label;let ae;t[62]!==X?(ae=s.jsxs(qe,{children:[Z,s.jsxs(Ze,{children:['Are you sure you want to delete the "',X,'" role? This action cannot be undone.']})]}),t[62]=X,t[63]=ae):ae=t[63];let Ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Xe,{children:"Cancel"}),t[64]=Ee):Ee=t[64];let ce;t[65]!==u||t[66]!==n?(ce=s.jsxs(Je,{children:[Ee,s.jsx(We,{onClick:()=>{n?.id&&u.mutate(n.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=n,t[67]=ce):ce=t[67];let de;t[68]!==ae||t[69]!==ce?(de=s.jsxs(Ke,{children:[ae,ce]}),t[68]=ae,t[69]=ce,t[70]=de):de=t[70];let me;t[71]!==ee||t[72]!==de?(me=s.jsx(Qe,{open:ee,onOpenChange:H,children:de}),t[71]=ee,t[72]=de,t[73]=me):me=t[73];let Ie;return t[74]!==F||t[75]!==me?(Ie=s.jsxs(te,{children:[F,me]}),t[74]=F,t[75]=me,t[76]=Ie):Ie=t[76],Ie}function Ms(t){return t.stopPropagation()}function Ps(t){return t.stopPropagation()}function Ls(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ks(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,l=[];return e.allowsAllStaticPermissions?l.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&l.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?l.push("All connections"):e.connectionCount&&e.connectionCount>0&&l.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:l.length>0?l.join(", "):"No permissions"})}function Ds(t){return t.kind==="builtin"?s.jsx(fe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(fe,{variant:"outline",className:"text-xs",children:"Custom"})}function Gs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",ws(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(et,{size:12,className:"text-muted-foreground shrink-0"})]})}function Us(t,e){je("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),ue.error(t instanceof Error?t.message:"Failed to delete role")}function Fl(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{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 roles"})})}),t[0]=e):e=t[0];let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(pt,{fallback:e,children:s.jsx(B.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=l):l=t[1],l}export{Fl as default};
@@ -1 +1 @@
1
- import{r as i,b6 as T,aS as ce,j as b,a7 as _,ae,aW as O,a8 as C,a4 as P,cE as ie,e as F,c as $}from"./index-Dcg8Qevd.js";import{e as de}from"./select-DkBE5ypj.js";function ue(r,e){return i.useReducer((o,l)=>e[o][l]??o,r)}var U="ScrollArea",[q]=ae(U),[fe,m]=q(U),G=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,type:l="hover",dir:t,scrollHideDelay:n=600,...s}=r,[c,a]=i.useState(null),[u,d]=i.useState(null),[h,f]=i.useState(null),[S,w]=i.useState(null),[A,Y]=i.useState(null),[x,L]=i.useState(0),[M,j]=i.useState(0),[D,y]=i.useState(!1),[N,W]=i.useState(!1),v=T(e,E=>a(E)),p=ce(t);return b.jsx(fe,{scope:o,type:l,dir:p,scrollHideDelay:n,scrollArea:c,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:D,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:L,onCornerHeightChange:j,children:b.jsx(_.div,{dir:p,...s,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...r.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,children:l,nonce:t,...n}=r,s=m(J,o),c=i.useRef(null),a=T(e,c,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),b.jsx(_.div,{"data-radix-scroll-area-viewport":"",...n,ref:a,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...r.style},children:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});K.displayName=J;var g="ScrollAreaScrollbar",Q=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:s}=t,c=r.orientation==="horizontal";return i.useEffect(()=>(c?n(!0):s(!0),()=>{c?n(!1):s(!1)}),[c,n,s]),t.type==="hover"?b.jsx(he,{...l,ref:e,forceMount:o}):t.type==="scroll"?b.jsx(be,{...l,ref:e,forceMount:o}):t.type==="auto"?b.jsx(Z,{...l,ref:e,forceMount:o}):t.type==="always"?b.jsx(V,{...l,ref:e}):null});Q.displayName=g;var he=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),[n,s]=i.useState(!1);return i.useEffect(()=>{const c=t.scrollArea;let a=0;if(c){const u=()=>{window.clearTimeout(a),s(!0)},d=()=>{a=window.setTimeout(()=>s(!1),t.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",d),()=>{window.clearTimeout(a),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",d)}}},[t.scrollArea,t.scrollHideDelay]),b.jsx(O,{present:o||n,children:b.jsx(Z,{"data-state":n?"visible":"hidden",...l,ref:e})})}),be=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),n=r.orientation==="horizontal",s=X(()=>a("SCROLL_END"),100),[c,a]=ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return i.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>a("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,t.scrollHideDelay,a]),i.useEffect(()=>{const u=t.viewport,d=n?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=()=>{const S=u[d];h!==S&&(a("SCROLL"),s()),h=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,n,a,s]),b.jsx(O,{present:o||c!=="hidden",children:b.jsx(V,{"data-state":c==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:C(r.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:C(r.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),Z=i.forwardRef((r,e)=>{const o=m(g,r.__scopeScrollArea),{forceMount:l,...t}=r,[n,s]=i.useState(!1),c=r.orientation==="horizontal",a=X(()=>{if(o.viewport){const u=o.viewport.offsetWidth<o.viewport.scrollWidth,d=o.viewport.offsetHeight<o.viewport.scrollHeight;s(c?u:d)}},10);return R(o.viewport,a),R(o.content,a),b.jsx(O,{present:l||n,children:b.jsx(V,{"data-state":n?"visible":"hidden",...t,ref:e})})}),V=i.forwardRef((r,e)=>{const{orientation:o="vertical",...l}=r,t=m(g,r.__scopeScrollArea),n=i.useRef(null),s=i.useRef(0),[c,a]=i.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ne(c.viewport,c.content),d={...l,sizes:c,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:f=>n.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function h(f,S){return ge(f,s.current,c,S)}return o==="horizontal"?b.jsx(Se,{...d,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollLeft,S=k(f,c,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=h(f,t.dir))}}):o==="vertical"?b.jsx(ve,{...d,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollTop,S=k(f,c);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=h(f))}}):null}),Se=i.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,c]=i.useState(),a=i.useRef(null),u=T(e,a,n.onScrollbarXChange);return i.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),b.jsx(re,{"data-orientation":"horizontal",...t,ref:u,sizes:o,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(o)+"px",...r.style},onThumbPointerDown:d=>r.onThumbPointerDown(d.x),onDragScroll:d=>r.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(n.viewport){const f=n.viewport.scrollLeft+d.deltaX;r.onWheelScroll(f),se(f,h)&&d.preventDefault()}},onResize:()=>{a.current&&n.viewport&&s&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:z(s.paddingLeft),paddingEnd:z(s.paddingRight)}})}})}),ve=i.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,c]=i.useState(),a=i.useRef(null),u=T(e,a,n.onScrollbarYChange);return i.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),b.jsx(re,{"data-orientation":"vertical",...t,ref:u,sizes:o,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(o)+"px",...r.style},onThumbPointerDown:d=>r.onThumbPointerDown(d.y),onDragScroll:d=>r.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(n.viewport){const f=n.viewport.scrollTop+d.deltaY;r.onWheelScroll(f),se(f,h)&&d.preventDefault()}},onResize:()=>{a.current&&n.viewport&&s&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:z(s.paddingTop),paddingEnd:z(s.paddingBottom)}})}})}),[me,ee]=q(g),re=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=r,S=m(g,o),[w,A]=i.useState(null),Y=T(e,v=>A(v)),x=i.useRef(null),L=i.useRef(""),M=S.viewport,j=l.content-l.viewport,D=P(d),y=P(a),N=X(h,10);function W(v){if(x.current){const p=v.clientX-x.current.left,E=v.clientY-x.current.top;u({x:p,y:E})}}return i.useEffect(()=>{const v=p=>{const E=p.target;w?.contains(E)&&D(p,j)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,j,D]),i.useEffect(y,[l,y]),R(w,N),R(S.content,N),b.jsx(me,{scope:o,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(s),onThumbPositionChange:y,onThumbPointerDown:P(c),children:b.jsx(_.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(r.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),L.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(r.onPointerMove,W),onPointerUp:C(r.onPointerUp,v=>{const p=v.target;p.hasPointerCapture(v.pointerId)&&p.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=L.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",oe=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=ee(H,r.__scopeScrollArea);return b.jsx(O,{present:o||t.hasThumb,children:b.jsx(pe,{ref:e,...l})})}),pe=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,style:l,...t}=r,n=m(H,o),s=ee(H,o),{onThumbPositionChange:c}=s,a=T(e,h=>s.onThumbChange(h)),u=i.useRef(void 0),d=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return i.useEffect(()=>{const h=n.viewport;if(h){const f=()=>{if(d(),!u.current){const S=xe(h,c);u.current=S,c()}};return c(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,d,c]),b.jsx(_.div,{"data-state":s.hasThumb?"visible":"hidden",...t,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(r.onPointerDownCapture,h=>{const S=h.target.getBoundingClientRect(),w=h.clientX-S.left,A=h.clientY-S.top;s.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(r.onPointerUp,s.onThumbPointerUp)})});oe.displayName=H;var B="ScrollAreaCorner",te=i.forwardRef((r,e)=>{const o=m(B,r.__scopeScrollArea),l=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&l?b.jsx(we,{...r,ref:e}):null});te.displayName=B;var we=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,...l}=r,t=m(B,o),[n,s]=i.useState(0),[c,a]=i.useState(0),u=!!(n&&c);return R(t.scrollbarX,()=>{const d=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(d),a(d)}),R(t.scrollbarY,()=>{const d=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(d),s(d)}),u?b.jsx(_.div,{...l,ref:e,style:{width:n,height:c,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...r.style}}):null});function z(r){return r?parseInt(r,10):0}function ne(r,e){const o=r/e;return isNaN(o)?0:o}function I(r){const e=ne(r.viewport,r.content),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,l=(r.scrollbar.size-o)*e;return Math.max(l,18)}function ge(r,e,o,l="ltr"){const t=I(o),n=t/2,s=e||n,c=t-s,a=o.scrollbar.paddingStart+s,u=o.scrollbar.size-o.scrollbar.paddingEnd-c,d=o.content-o.viewport,h=l==="ltr"?[0,d]:[d*-1,0];return le([a,u],h)(r)}function k(r,e,o="ltr"){const l=I(e),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=e.scrollbar.size-t,s=e.content-e.viewport,c=n-l,a=o==="ltr"?[0,s]:[s*-1,0],u=de(r,a);return le([0,s],[0,c])(u)}function le(r,e){return o=>{if(r[0]===r[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(r[1]-r[0]);return e[0]+l*(o-r[0])}}function se(r,e){return r>0&&r<e}var xe=(r,e=()=>{})=>{let o={left:r.scrollLeft,top:r.scrollTop},l=0;return(function t(){const n={left:r.scrollLeft,top:r.scrollTop},s=o.left!==n.left,c=o.top!==n.top;(s||c)&&e(),o=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(r,e){const o=P(r),l=i.useRef(0);return i.useEffect(()=>()=>window.clearTimeout(l.current),[]),i.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(o,e)},[o,e])}function R(r,e){const o=P(e);ie(()=>{let l=0;if(r){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(o)});return t.observe(r),()=>{window.cancelAnimationFrame(l),t.unobserve(r)}}},[r,o])}var Pe=G,Ce=K,Ee=te;function _e(r){const e=F.c(17);let o,l,t,n;e[0]!==r?({className:l,children:o,hideScrollbar:n,...t}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=n===void 0?!1:n;let c;e[5]!==l?(c=$("relative h-full w-full",l),e[5]=l,e[6]=c):c=e[6];let a;e[7]!==o?(a=b.jsx(Ce,{"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:b.jsx("div",{className:"flex min-w-0 flex-col",children:o})}),e[7]=o,e[8]=a):a=e[8];let u;e[9]!==s?(u=b.jsx(Re,{hideScrollbar:s}),e[9]=s,e[10]=u):u=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=b.jsx(Ee,{}),e[11]=d):d=e[11];let h;return e[12]!==t||e[13]!==c||e[14]!==a||e[15]!==u?(h=b.jsxs(Pe,{"data-slot":"scroll-area",className:c,...t,children:[a,u,d]}),e[12]=t,e[13]=c,e[14]=a,e[15]=u,e[16]=h):h=e[16],h}function Re(r){const e=F.c(15);let o,l,t,n;e[0]!==r?({className:o,orientation:t,hideScrollbar:n,...l}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=t===void 0?"vertical":t,c=n===void 0?!1:n,a=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",d=c&&"hidden";let h;e[5]!==o||e[6]!==a||e[7]!==u||e[8]!==d?(h=$("select-none touch-none p-px transition-colors",a,u,d,o),e[5]=o,e[6]=a,e[7]=u,e[8]=d,e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(oe,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let S;return e[11]!==s||e[12]!==l||e[13]!==h?(S=b.jsx(Q,{"data-slot":"scroll-area-scrollbar",orientation:s,className:h,...l,children:f}),e[11]=s,e[12]=l,e[13]=h,e[14]=S):S=e[14],S}export{_e as S,Re as a};
1
+ import{r as i,b6 as T,aS as ce,j as b,a7 as _,ae,aW as O,a8 as C,a4 as P,cE as ie,e as F,c as $}from"./index-CHrUmZgp.js";import{e as de}from"./select-CQme0ALA.js";function ue(r,e){return i.useReducer((o,l)=>e[o][l]??o,r)}var U="ScrollArea",[q]=ae(U),[fe,m]=q(U),G=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,type:l="hover",dir:t,scrollHideDelay:n=600,...s}=r,[c,a]=i.useState(null),[u,d]=i.useState(null),[h,f]=i.useState(null),[S,w]=i.useState(null),[A,Y]=i.useState(null),[x,L]=i.useState(0),[M,j]=i.useState(0),[D,y]=i.useState(!1),[N,W]=i.useState(!1),v=T(e,E=>a(E)),p=ce(t);return b.jsx(fe,{scope:o,type:l,dir:p,scrollHideDelay:n,scrollArea:c,viewport:u,onViewportChange:d,content:h,onContentChange:f,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:D,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:L,onCornerHeightChange:j,children:b.jsx(_.div,{dir:p,...s,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...r.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,children:l,nonce:t,...n}=r,s=m(J,o),c=i.useRef(null),a=T(e,c,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),b.jsx(_.div,{"data-radix-scroll-area-viewport":"",...n,ref:a,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...r.style},children:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});K.displayName=J;var g="ScrollAreaScrollbar",Q=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:s}=t,c=r.orientation==="horizontal";return i.useEffect(()=>(c?n(!0):s(!0),()=>{c?n(!1):s(!1)}),[c,n,s]),t.type==="hover"?b.jsx(he,{...l,ref:e,forceMount:o}):t.type==="scroll"?b.jsx(be,{...l,ref:e,forceMount:o}):t.type==="auto"?b.jsx(Z,{...l,ref:e,forceMount:o}):t.type==="always"?b.jsx(V,{...l,ref:e}):null});Q.displayName=g;var he=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),[n,s]=i.useState(!1);return i.useEffect(()=>{const c=t.scrollArea;let a=0;if(c){const u=()=>{window.clearTimeout(a),s(!0)},d=()=>{a=window.setTimeout(()=>s(!1),t.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",d),()=>{window.clearTimeout(a),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",d)}}},[t.scrollArea,t.scrollHideDelay]),b.jsx(O,{present:o||n,children:b.jsx(Z,{"data-state":n?"visible":"hidden",...l,ref:e})})}),be=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=m(g,r.__scopeScrollArea),n=r.orientation==="horizontal",s=X(()=>a("SCROLL_END"),100),[c,a]=ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return i.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>a("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,t.scrollHideDelay,a]),i.useEffect(()=>{const u=t.viewport,d=n?"scrollLeft":"scrollTop";if(u){let h=u[d];const f=()=>{const S=u[d];h!==S&&(a("SCROLL"),s()),h=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,n,a,s]),b.jsx(O,{present:o||c!=="hidden",children:b.jsx(V,{"data-state":c==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:C(r.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:C(r.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),Z=i.forwardRef((r,e)=>{const o=m(g,r.__scopeScrollArea),{forceMount:l,...t}=r,[n,s]=i.useState(!1),c=r.orientation==="horizontal",a=X(()=>{if(o.viewport){const u=o.viewport.offsetWidth<o.viewport.scrollWidth,d=o.viewport.offsetHeight<o.viewport.scrollHeight;s(c?u:d)}},10);return R(o.viewport,a),R(o.content,a),b.jsx(O,{present:l||n,children:b.jsx(V,{"data-state":n?"visible":"hidden",...t,ref:e})})}),V=i.forwardRef((r,e)=>{const{orientation:o="vertical",...l}=r,t=m(g,r.__scopeScrollArea),n=i.useRef(null),s=i.useRef(0),[c,a]=i.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ne(c.viewport,c.content),d={...l,sizes:c,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:f=>n.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function h(f,S){return ge(f,s.current,c,S)}return o==="horizontal"?b.jsx(Se,{...d,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollLeft,S=k(f,c,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=h(f,t.dir))}}):o==="vertical"?b.jsx(ve,{...d,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollTop,S=k(f,c);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=h(f))}}):null}),Se=i.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,c]=i.useState(),a=i.useRef(null),u=T(e,a,n.onScrollbarXChange);return i.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),b.jsx(re,{"data-orientation":"horizontal",...t,ref:u,sizes:o,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(o)+"px",...r.style},onThumbPointerDown:d=>r.onThumbPointerDown(d.x),onDragScroll:d=>r.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(n.viewport){const f=n.viewport.scrollLeft+d.deltaX;r.onWheelScroll(f),se(f,h)&&d.preventDefault()}},onResize:()=>{a.current&&n.viewport&&s&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:z(s.paddingLeft),paddingEnd:z(s.paddingRight)}})}})}),ve=i.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=m(g,r.__scopeScrollArea),[s,c]=i.useState(),a=i.useRef(null),u=T(e,a,n.onScrollbarYChange);return i.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),b.jsx(re,{"data-orientation":"vertical",...t,ref:u,sizes:o,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(o)+"px",...r.style},onThumbPointerDown:d=>r.onThumbPointerDown(d.y),onDragScroll:d=>r.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(n.viewport){const f=n.viewport.scrollTop+d.deltaY;r.onWheelScroll(f),se(f,h)&&d.preventDefault()}},onResize:()=>{a.current&&n.viewport&&s&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:z(s.paddingTop),paddingEnd:z(s.paddingBottom)}})}})}),[me,ee]=q(g),re=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:d,onResize:h,...f}=r,S=m(g,o),[w,A]=i.useState(null),Y=T(e,v=>A(v)),x=i.useRef(null),L=i.useRef(""),M=S.viewport,j=l.content-l.viewport,D=P(d),y=P(a),N=X(h,10);function W(v){if(x.current){const p=v.clientX-x.current.left,E=v.clientY-x.current.top;u({x:p,y:E})}}return i.useEffect(()=>{const v=p=>{const E=p.target;w?.contains(E)&&D(p,j)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,j,D]),i.useEffect(y,[l,y]),R(w,N),R(S.content,N),b.jsx(me,{scope:o,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(s),onThumbPositionChange:y,onThumbPointerDown:P(c),children:b.jsx(_.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(r.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),L.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(r.onPointerMove,W),onPointerUp:C(r.onPointerUp,v=>{const p=v.target;p.hasPointerCapture(v.pointerId)&&p.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=L.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",oe=i.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=ee(H,r.__scopeScrollArea);return b.jsx(O,{present:o||t.hasThumb,children:b.jsx(pe,{ref:e,...l})})}),pe=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,style:l,...t}=r,n=m(H,o),s=ee(H,o),{onThumbPositionChange:c}=s,a=T(e,h=>s.onThumbChange(h)),u=i.useRef(void 0),d=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return i.useEffect(()=>{const h=n.viewport;if(h){const f=()=>{if(d(),!u.current){const S=xe(h,c);u.current=S,c()}};return c(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,d,c]),b.jsx(_.div,{"data-state":s.hasThumb?"visible":"hidden",...t,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(r.onPointerDownCapture,h=>{const S=h.target.getBoundingClientRect(),w=h.clientX-S.left,A=h.clientY-S.top;s.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(r.onPointerUp,s.onThumbPointerUp)})});oe.displayName=H;var B="ScrollAreaCorner",te=i.forwardRef((r,e)=>{const o=m(B,r.__scopeScrollArea),l=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&l?b.jsx(we,{...r,ref:e}):null});te.displayName=B;var we=i.forwardRef((r,e)=>{const{__scopeScrollArea:o,...l}=r,t=m(B,o),[n,s]=i.useState(0),[c,a]=i.useState(0),u=!!(n&&c);return R(t.scrollbarX,()=>{const d=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(d),a(d)}),R(t.scrollbarY,()=>{const d=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(d),s(d)}),u?b.jsx(_.div,{...l,ref:e,style:{width:n,height:c,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...r.style}}):null});function z(r){return r?parseInt(r,10):0}function ne(r,e){const o=r/e;return isNaN(o)?0:o}function I(r){const e=ne(r.viewport,r.content),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,l=(r.scrollbar.size-o)*e;return Math.max(l,18)}function ge(r,e,o,l="ltr"){const t=I(o),n=t/2,s=e||n,c=t-s,a=o.scrollbar.paddingStart+s,u=o.scrollbar.size-o.scrollbar.paddingEnd-c,d=o.content-o.viewport,h=l==="ltr"?[0,d]:[d*-1,0];return le([a,u],h)(r)}function k(r,e,o="ltr"){const l=I(e),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=e.scrollbar.size-t,s=e.content-e.viewport,c=n-l,a=o==="ltr"?[0,s]:[s*-1,0],u=de(r,a);return le([0,s],[0,c])(u)}function le(r,e){return o=>{if(r[0]===r[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(r[1]-r[0]);return e[0]+l*(o-r[0])}}function se(r,e){return r>0&&r<e}var xe=(r,e=()=>{})=>{let o={left:r.scrollLeft,top:r.scrollTop},l=0;return(function t(){const n={left:r.scrollLeft,top:r.scrollTop},s=o.left!==n.left,c=o.top!==n.top;(s||c)&&e(),o=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(r,e){const o=P(r),l=i.useRef(0);return i.useEffect(()=>()=>window.clearTimeout(l.current),[]),i.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(o,e)},[o,e])}function R(r,e){const o=P(e);ie(()=>{let l=0;if(r){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(o)});return t.observe(r),()=>{window.cancelAnimationFrame(l),t.unobserve(r)}}},[r,o])}var Pe=G,Ce=K,Ee=te;function _e(r){const e=F.c(17);let o,l,t,n;e[0]!==r?({className:l,children:o,hideScrollbar:n,...t}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=n===void 0?!1:n;let c;e[5]!==l?(c=$("relative h-full w-full",l),e[5]=l,e[6]=c):c=e[6];let a;e[7]!==o?(a=b.jsx(Ce,{"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:b.jsx("div",{className:"flex min-w-0 flex-col",children:o})}),e[7]=o,e[8]=a):a=e[8];let u;e[9]!==s?(u=b.jsx(Re,{hideScrollbar:s}),e[9]=s,e[10]=u):u=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=b.jsx(Ee,{}),e[11]=d):d=e[11];let h;return e[12]!==t||e[13]!==c||e[14]!==a||e[15]!==u?(h=b.jsxs(Pe,{"data-slot":"scroll-area",className:c,...t,children:[a,u,d]}),e[12]=t,e[13]=c,e[14]=a,e[15]=u,e[16]=h):h=e[16],h}function Re(r){const e=F.c(15);let o,l,t,n;e[0]!==r?({className:o,orientation:t,hideScrollbar:n,...l}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=t===void 0?"vertical":t,c=n===void 0?!1:n,a=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",d=c&&"hidden";let h;e[5]!==o||e[6]!==a||e[7]!==u||e[8]!==d?(h=$("select-none touch-none p-px transition-colors",a,u,d,o),e[5]=o,e[6]=a,e[7]=u,e[8]=d,e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(oe,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let S;return e[11]!==s||e[12]!==l||e[13]!==h?(S=b.jsx(Q,{"data-slot":"scroll-area-scrollbar",orientation:s,className:h,...l,children:f}),e[11]=s,e[12]=l,e[13]=h,e[14]=S):S=e[14],S}export{_e as S,Re as a};
@@ -1 +1 @@
1
- import{e as b,c as w,j as a,l as j}from"./index-Dcg8Qevd.js";import{i as N}from"./SearchMd-B780aQOS.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
1
+ import{e as b,c as w,j as a,l as j}from"./index-CHrUmZgp.js";import{i as N}from"./SearchMd-BL69FKVv.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};