decocms 2.366.7 → 2.366.8

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 (249) hide show
  1. package/dist/client/assets/{AlertCircle-DFcOa31f.js → AlertCircle-Dyh2dUBt.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-CbOlEr1w.js → ArrowNarrowLeft-DOeeOVat.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-C6axmKPR.js → ArrowUpRight-C5h8eEJl.js} +1 -1
  4. package/dist/client/assets/{Check-JQri_6PS.js → Check-BBN8jtrj.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-B6HzfzYv.js → CheckCircle-BodpoDGR.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-CNNU2L0m.js → ChevronDown-BHt79TDc.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BuVcgGSu.js → ChevronRight-CgiGzJK2.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-DyIOyS2u.js → ChevronUp-Hv5s5GCl.js} +1 -1
  9. package/dist/client/assets/{Container-Cy3AGglh.js → Container-CmZ_UAMx.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DIehc2A5.js → DotsVertical-BFb-15-m.js} +1 -1
  11. package/dist/client/assets/{FilterLines-DHlq5ZtE.js → FilterLines-BNco6Knh.js} +1 -1
  12. package/dist/client/assets/{HardDrive-CAAHpLeS.js → HardDrive-Bs4cIN_I.js} +1 -1
  13. package/dist/client/assets/{Key01-C29UL5qH.js → Key01-BOHiIHj-.js} +1 -1
  14. package/dist/client/assets/{LayoutLeft-5sSkIfFI.js → LayoutLeft-NsiLg-Hz.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-QpHHOJbZ.js → LinkExternal01-DXkr_udM.js} +1 -1
  16. package/dist/client/assets/{Lock01-Ju5ifHNn.js → Lock01-BheAsQQx.js} +1 -1
  17. package/dist/client/assets/{Monitor01-DHHvwXbl.js → Monitor01-BkzEm6bw.js} +1 -1
  18. package/dist/client/assets/{Palette-CJqBw6AH.js → Palette-DPP_bV0e.js} +1 -1
  19. package/dist/client/assets/{Play-DPs1Pbq2.js → Play-BqGgMbL5.js} +1 -1
  20. package/dist/client/assets/{Plus-DgrNRFK5.js → Plus-C5l4faC1.js} +1 -1
  21. package/dist/client/assets/{RefreshCcw01-Bf15qfNS.js → RefreshCcw01-Cr7WlxPS.js} +1 -1
  22. package/dist/client/assets/{SearchMd-CuY4_41I.js → SearchMd-rTsELW21.js} +1 -1
  23. package/dist/client/assets/{Settings02-Cjzbasby.js → Settings02-BSu9v11-.js} +1 -1
  24. package/dist/client/assets/{Shield01-rI42zX_N.js → Shield01-BzHuCaEB.js} +1 -1
  25. package/dist/client/assets/{Star01-CiaU9xFe.js → Star01-HKceyVo1.js} +1 -1
  26. package/dist/client/assets/{Stars02-BHNtUcIC.js → Stars02-LrVE5fus.js} +1 -1
  27. package/dist/client/assets/{Sun-DA9iSyj3.js → Sun-D9eEy7za.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-B0nDhziZ.js → SwitchHorizontal01-C1fzb4rn.js} +1 -1
  29. package/dist/client/assets/{Tool01-BpLh90bx.js → Tool01-DHXrZh_c.js} +1 -1
  30. package/dist/client/assets/{Trash01-BU1vvG1i.js → Trash01-v5Dy47Wj.js} +1 -1
  31. package/dist/client/assets/{Upload01-D2aoviL7.js → Upload01-p8VtXdXS.js} +1 -1
  32. package/dist/client/assets/{User01-BUxAdPGO.js → User01-CtanRIko.js} +1 -1
  33. package/dist/client/assets/{Users01-X9W80ATA.js → Users01-BbxKMG6t.js} +1 -1
  34. package/dist/client/assets/{Users03-DERc_3KT.js → Users03-Bq46oqMB.js} +1 -1
  35. package/dist/client/assets/{X-CpxCwBcO.js → X-DkujvqvQ.js} +1 -1
  36. package/dist/client/assets/{XCircle-BlhQtOFW.js → XCircle-BkF11s9b.js} +1 -1
  37. package/dist/client/assets/{XClose-6T_HfnSF.js → XClose-DgRHRNhM.js} +1 -1
  38. package/dist/client/assets/{Zap-C_gPmGTu.js → Zap-XzlBn_sj.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-D-9nYZGQ.js → ZapSquare-sMv-roxP.js} +1 -1
  40. package/dist/client/assets/{accordion-CBF1VPy1.js → accordion-dqQUHOnH.js} +1 -1
  41. package/dist/client/assets/{add-connection-dialog-WM_qTQCr.js → add-connection-dialog-Doxko4pY.js} +1 -1
  42. package/dist/client/assets/{agent-icon-BZLvaskO.js → agent-icon-q6iHyexc.js} +1 -1
  43. package/dist/client/assets/{agent-icons-ZEbpuDyp.js → agent-icons-A7w_l1KK.js} +1 -1
  44. package/dist/client/assets/{agents-list-BD4seTwq.js → agents-list-_CO5Xl7p.js} +1 -1
  45. package/dist/client/assets/{ai-providers-Dps_1J2i.js → ai-providers-B1ZbPwoq.js} +1 -1
  46. package/dist/client/assets/{alert-CmozMRgO.js → alert-DL1cbRoM.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-Bzj7Dj8A.js → alert-dialog-B_i_ps7f.js} +1 -1
  48. package/dist/client/assets/{auth-catchall-Ck-h53ka.js → auth-catchall-AHvA5vWD.js} +1 -1
  49. package/dist/client/assets/{auth-split-layout-COCXQjkb.js → auth-split-layout-CT4AkDzg.js} +1 -1
  50. package/dist/client/assets/{automation-list-row-BK4XzBrA.js → automation-list-row-DxuoSGb8.js} +1 -1
  51. package/dist/client/assets/{automations-BIQRZeWE.js → automations-CmZJlJt9.js} +1 -1
  52. package/dist/client/assets/{avatar-DCmff7mq.js → avatar-BRyrVRDm.js} +1 -1
  53. package/dist/client/assets/{badge-ONnaTLOr.js → badge-BTq6_dwU.js} +1 -1
  54. package/dist/client/assets/{brand-context-DWdSQDXw.js → brand-context-D5z_TG2J.js} +1 -1
  55. package/dist/client/assets/{card-BsL17xby.js → card-CSM7jg8b.js} +1 -1
  56. package/dist/client/assets/{chat-context-4LDn0s0C.js → chat-context-CICjyzMY.js} +1 -1
  57. package/dist/client/assets/{checkbox-CupWiQrC.js → checkbox-Dz5JG34i.js} +1 -1
  58. package/dist/client/assets/{cli-auth-success-C_FSoZy8.js → cli-auth-success-CvhsqEgg.js} +1 -1
  59. package/dist/client/assets/{collection-detail-rvEMorEg.js → collection-detail-CzazaoJP.js} +1 -1
  60. package/dist/client/assets/{collection-display-button-BMPAqbiG.js → collection-display-button-mD3oc4np.js} +1 -1
  61. package/dist/client/assets/{collection-search-DBZ50buZ.js → collection-search-BRyI5tKN.js} +1 -1
  62. package/dist/client/assets/{collection-search-Um_OB9Yj.js → collection-search-CXtVb7nz.js} +1 -1
  63. package/dist/client/assets/{collection-table-wrapper-Dtog_f2p.js → collection-table-wrapper-C7oTCBDJ.js} +1 -1
  64. package/dist/client/assets/{collection-tabs-DBGScRHK.js → collection-tabs-BzSk0IWN.js} +1 -1
  65. package/dist/client/assets/{collections-B7Zm82Yd.js → collections-BvhsS_z2.js} +1 -1
  66. package/dist/client/assets/{command-BbOyBJF2.js → command-CE-N-Fow.js} +1 -1
  67. package/dist/client/assets/{connect-desktop-dialog-BB6OqliN.js → connect-desktop-dialog-C-R7zEUP.js} +1 -1
  68. package/dist/client/assets/{connection-card-CfeWMSHF.js → connection-card-PlQwrunz.js} +1 -1
  69. package/dist/client/assets/{connection-detail-pLHIqTQT.js → connection-detail-B7sBzrsj.js} +1 -1
  70. package/dist/client/assets/{connection-form-helpers-CU39ex55.js → connection-form-helpers-BPskqY8x.js} +1 -1
  71. package/dist/client/assets/{connections-Dcfpl5Vt.js → connections-BO5GNb9A.js} +1 -1
  72. package/dist/client/assets/{constants-z8N0NNar.js → constants-B8os5nMI.js} +1 -1
  73. package/dist/client/assets/{decopilot-sse-pool-BmH40IlP.js → decopilot-sse-pool-CibYuCaE.js} +1 -1
  74. package/dist/client/assets/{dialog-1TuinsgZ.js → dialog-C40tWbjB.js} +1 -1
  75. package/dist/client/assets/{domain-settings-CK5mrQIi.js → domain-settings-CzQQxHOD.js} +1 -1
  76. package/dist/client/assets/{drawer-DQoKQZB2.js → drawer-im0a0-JE.js} +1 -1
  77. package/dist/client/assets/{dropdown-menu-Dzjyztci.js → dropdown-menu-nlgjcLMp.js} +1 -1
  78. package/dist/client/assets/{dynamic-plugin-layout-VBJnbblQ.js → dynamic-plugin-layout-DlWKLIeK.js} +1 -1
  79. package/dist/client/assets/{empty-state-oNm48kH8.js → empty-state-Cw3XK_Gs.js} +1 -1
  80. package/dist/client/assets/{empty-state-DoRCByZ3.js → empty-state-Rnc2dhkR.js} +1 -1
  81. package/dist/client/assets/{extract-connection-data-DhUh4JIU.js → extract-connection-data-D00SSnkh.js} +1 -1
  82. package/dist/client/assets/{features-BLue5eI4.js → features-DZ0ghQyn.js} +1 -1
  83. package/dist/client/assets/{file-explorer-CEsWFSVG.js → file-explorer-DMwROQk0.js} +1 -1
  84. package/dist/client/assets/{files-DnOIW6UR.js → files-mqgIbtsb.js} +1 -1
  85. package/dist/client/assets/{form-BACtGvj-.js → form-C2fWcpmD.js} +1 -1
  86. package/dist/client/assets/{general-D8M9QTub.js → general-BGSI6aBj.js} +1 -1
  87. package/dist/client/assets/{generate-id-D8MMm0i_.js → generate-id-DzmzOPfM.js} +1 -1
  88. package/dist/client/assets/{github-repo-picker-rt9Vt0dE.js → github-repo-picker-C0GpV9eM.js} +1 -1
  89. package/dist/client/assets/{hooks-BsbVht9n.js → hooks-NevP65mb.js} +1 -1
  90. package/dist/client/assets/{hover-card-CxINYsQV.js → hover-card-RfUTMsZA.js} +1 -1
  91. package/dist/client/assets/{import-from-deco-dialog-C0AXmTvu.js → import-from-deco-dialog-B0MmDUtr.js} +1 -1
  92. package/dist/client/assets/{index-raVE4iMU.js → index-Bf7aO1A-.js} +2 -2
  93. package/dist/client/assets/{index-CZPd3hrs.js → index-Bj3Gsvmx.js} +4 -4
  94. package/dist/client/assets/{index-BuEd39Tz.js → index-BlXuTZUL.js} +1 -1
  95. package/dist/client/assets/{index-D2D8zFsJ.js → index-CP1SUcsr.js} +1 -1
  96. package/dist/client/assets/{index-CdAXbXCD.js → index-CPUASH8Y.js} +1 -1
  97. package/dist/client/assets/{index-B7X0Dr5K.js → index-CbpIdzH6.js} +1 -1
  98. package/dist/client/assets/{index-DRu0KGyt.js → index-Ce5SKvT1.js} +1 -1
  99. package/dist/client/assets/{index-Bid6pGzX.js → index-D1V7gFaI.js} +1 -1
  100. package/dist/client/assets/{index-DsfxL555.js → index-D3AvleZU.js} +1 -1
  101. package/dist/client/assets/{index-zqEjYnv0.js → index-D3GzwlSX.js} +1 -1
  102. package/dist/client/assets/{index-CSjyCM-u.js → index-DBGGjq4P.js} +1 -1
  103. package/dist/client/assets/{index-DktH-nwk.js → index-DBIBJV0k.js} +1 -1
  104. package/dist/client/assets/{index-5btRi0pB.js → index-DGa9X7kA.js} +1 -1
  105. package/dist/client/assets/{index-oYU8P956.js → index-DPqqDw7W.js} +1 -1
  106. package/dist/client/assets/{index-DOyZEChd.js → index-DokSGh4p.js} +1 -1
  107. package/dist/client/assets/{index-Btb-lxzO.js → index-DsxbUaF_.js} +1 -1
  108. package/dist/client/assets/{infiniteQueryObserver-ZgItTY4U.js → infiniteQueryObserver-Cv7QlLOi.js} +1 -1
  109. package/dist/client/assets/{input-CcEL_8zI.js → input-Fpo5hVEP.js} +1 -1
  110. package/dist/client/assets/{integration-icon-C6CHfqhT.js → integration-icon-DX7WoZFw.js} +1 -1
  111. package/dist/client/assets/{label-P_F_-Q8z.js → label-FRw7B4TG.js} +1 -1
  112. package/dist/client/assets/{layout-Cy8BIgv4.js → layout-DRV6GiLr.js} +1 -1
  113. package/dist/client/assets/{login-C0__NyWq.js → login-CfCMY-Xx.js} +1 -1
  114. package/dist/client/assets/{members-CvLryIsr.js → members-xAPoZeMG.js} +1 -1
  115. package/dist/client/assets/{monaco-editor-BeYwPRx7.js → monaco-editor-BqbZT3K3.js} +1 -1
  116. package/dist/client/assets/{monitoring-stats-row-oa232c6w.js → monitoring-stats-row-BFEaeHW_.js} +1 -1
  117. package/dist/client/assets/{oauth-callback-nhW5Hk7K.js → oauth-callback-ZvrYBv1e.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-ai-provider-CBGn5V2N.js → oauth-callback-ai-provider-BUr_Gk3g.js} +1 -1
  119. package/dist/client/assets/{onboarding-CJebl9bX.js → onboarding-DAlRszwq.js} +1 -1
  120. package/dist/client/assets/{org-layout-C77vl6Iy.js → org-layout-CG7hQKSm.js} +1 -1
  121. package/dist/client/assets/{org-plugin-layout-iBgNZvjR.js → org-plugin-layout-B2xqOhgA.js} +1 -1
  122. package/dist/client/assets/{pair-D5k2ePIl.js → pair-D1bgeRCX.js} +1 -1
  123. package/dist/client/assets/{plugin-empty-state-C6vbSsTR.js → plugin-empty-state-CuVTFSVp.js} +1 -1
  124. package/dist/client/assets/{plugin-header-CERNSvWs.js → plugin-header-CLNGHNmz.js} +1 -1
  125. package/dist/client/assets/{plugin-layout-Dqtz19-C.js → plugin-layout-DD5D4ZYp.js} +1 -1
  126. package/dist/client/assets/{popover-Biu5bUpE.js → popover-BkyXjLv-.js} +1 -1
  127. package/dist/client/assets/{profile-CiZbXHxj.js → profile-DJyl7mco.js} +1 -1
  128. package/dist/client/assets/{project-app-view-C5c0g4mg.js → project-app-view-BBzvPrjP.js} +1 -1
  129. package/dist/client/assets/registry-CZacfzmC.js +2 -0
  130. package/dist/client/assets/{registry-layout-BV5ALzTv.js → registry-layout-DmSpIEFO.js} +1 -1
  131. package/dist/client/assets/{required-auth-layout-6caiGmq6.js → required-auth-layout-CawOOa2O.js} +1 -1
  132. package/dist/client/assets/{reset-password-D0Ak5nrj.js → reset-password-rYx9wxY5.js} +1 -1
  133. package/dist/client/assets/{roles-DaLbowGy.js → roles-DRxguWZW.js} +1 -1
  134. package/dist/client/assets/{search-input-DN3bxChj.js → search-input-DglPcAnH.js} +1 -1
  135. package/dist/client/assets/{secrets-B6jYZgCT.js → secrets-DmZX9LsT.js} +1 -1
  136. package/dist/client/assets/{sections-editor-2l7dT3ea.js → sections-editor-BMpgMeff.js} +1 -1
  137. package/dist/client/assets/{select-BI295XE-.js → select-ufdAhrF_.js} +1 -1
  138. package/dist/client/assets/{settings-layout-0UTQAxIu.js → settings-layout-BBUh6Vlw.js} +1 -1
  139. package/dist/client/assets/{settings-section-DCgrgvZN.js → settings-section-DbssupiX.js} +1 -1
  140. package/dist/client/assets/{shell-controls-B5In6zvk.js → shell-controls-wYSme1hd.js} +1 -1
  141. package/dist/client/assets/{shell-layout-B4sASmIz.js → shell-layout-iPI2JI8_.js} +1 -1
  142. package/dist/client/assets/{sidebar-BQJxM_Xs.js → sidebar-CkEPveNS.js} +1 -1
  143. package/dist/client/assets/{skeleton-Cz-aBL4t.js → skeleton-DYoQoQqq.js} +1 -1
  144. package/dist/client/assets/{sortable.esm-CVet_wfm.js → sortable.esm-DUaPlB_W.js} +1 -1
  145. package/dist/client/assets/{spinner-CW1wo-Y2.js → spinner-CvW_7LWr.js} +1 -1
  146. package/dist/client/assets/{sso-DLX1tDyb.js → sso-BQiNOjXF.js} +1 -1
  147. package/dist/client/assets/{store-yTIcf52L.js → store-DkONcJaZ.js} +1 -1
  148. package/dist/client/assets/store-registry-DdExMpCJ.js +2 -0
  149. package/dist/client/assets/{switch-Cgc8prv4.js → switch-C_oh8iVS.js} +1 -1
  150. package/dist/client/assets/{table-Guyc6r0i.js → table-Dy93uecr.js} +1 -1
  151. package/dist/client/assets/{tabs-CbnJ7Xfx.js → tabs-Bnmd0UmR.js} +1 -1
  152. package/dist/client/assets/{task-status-D5nCekWh.js → task-status-Bn2_Ktxd.js} +1 -1
  153. package/dist/client/assets/{textarea-CUr0kaZB.js → textarea-Cna17PTh.js} +1 -1
  154. package/dist/client/assets/{toggle-group-D-Azql3v.js → toggle-group-Cwno-ULj.js} +1 -1
  155. package/dist/client/assets/{toolbar-DWP3DcTB.js → toolbar-BBemLolp.js} +1 -1
  156. package/dist/client/assets/{tools-list-Yx20h0-O.js → tools-list-DF6pe9Ta.js} +1 -1
  157. package/dist/client/assets/{tooltip-BrUaJepM.js → tooltip-Kfr4gA8D.js} +1 -1
  158. package/dist/client/assets/{types-C22VRq2r.js → types-DLDiONif.js} +1 -1
  159. package/dist/client/assets/{use-ai-providers-DWeBiBfE.js → use-ai-providers-CewbWKWW.js} +1 -1
  160. package/dist/client/assets/{use-collections-DBbGR_3H.js → use-collections-JGA7MsfD.js} +1 -1
  161. package/dist/client/assets/{use-connection-3197jn_F.js → use-connection-IocO3s2Q.js} +1 -1
  162. package/dist/client/assets/{use-copy-DeOqBGNE.js → use-copy-DQ7SkKXE.js} +1 -1
  163. package/dist/client/assets/{use-create-virtual-mcp-CDYPVS3p.js → use-create-virtual-mcp-BSfa--sD.js} +1 -1
  164. package/dist/client/assets/{use-debounced-autosave-Blm-Cns4.js → use-debounced-autosave-DWrKZmHW.js} +1 -1
  165. package/dist/client/assets/{use-delete-connection-CgDNCbAv.js → use-delete-connection-Bg4nH-Nd.js} +1 -1
  166. package/dist/client/assets/{use-file-configs-CkITamMd.js → use-file-configs-DDjVwmYE.js} +1 -1
  167. package/dist/client/assets/{use-infinite-scroll-C3Cp1KLu.js → use-infinite-scroll-jDpA-_cW.js} +1 -1
  168. package/dist/client/assets/{use-list-state-D2ojxj9D.js → use-list-state--Z7pVdDS.js} +1 -1
  169. package/dist/client/assets/{use-mcp-prompts-DgIPs9M6.js → use-mcp-prompts-CvpPBs_y.js} +1 -1
  170. package/dist/client/assets/{use-mcp-tools-DycYaXyV.js → use-mcp-tools-POhiNXdT.js} +1 -1
  171. package/dist/client/assets/{use-members-XY8cJPkc.js → use-members-cPnrxPK_.js} +1 -1
  172. package/dist/client/assets/{use-navigate-to-agent-VrXIL0dL.js → use-navigate-to-agent-DIIPigDX.js} +1 -1
  173. package/dist/client/assets/{use-org-auth-client--KUUMHp0.js → use-org-auth-client-DOzELmrd.js} +1 -1
  174. package/dist/client/assets/{use-org-sso-mHvkRXYR.js → use-org-sso-CyDwJDEM.js} +1 -1
  175. package/dist/client/assets/{use-organization-roles-DvMKsAzI.js → use-organization-roles-CZP0dNKh.js} +1 -1
  176. package/dist/client/assets/{use-organization-settings-yjaKZxoH.js → use-organization-settings-DJc_W4n4.js} +1 -1
  177. package/dist/client/assets/{use-registry-connections-CPtKKagv.js → use-registry-connections-SwizXZVX.js} +1 -1
  178. package/dist/client/assets/{use-secrets-DaKsY9Qa.js → use-secrets-BAD7O6nA.js} +1 -1
  179. package/dist/client/assets/{use-status-sounds-piyGyRnD.js → use-status-sounds-RHGSJdHR.js} +1 -1
  180. package/dist/client/assets/{use-view-mode-FiZLQ7H4.js → use-view-mode-isYjr9TL.js} +1 -1
  181. package/dist/client/assets/{use-virtual-mcp-wzufKfmA.js → use-virtual-mcp-D3NBTQSJ.js} +1 -1
  182. package/dist/client/assets/useInfiniteQuery-CedWd5FM.js +1 -0
  183. package/dist/client/assets/{useRouterState-C5I8d05V.js → useRouterState-CD2kdIEW.js} +1 -1
  184. package/dist/client/assets/useSuspenseInfiniteQuery-Cu6z25rm.js +1 -0
  185. package/dist/client/assets/{user-CGJGTWyL.js → user-Csugwi5K.js} +1 -1
  186. package/dist/client/assets/{view-mode-toggle-BV9N1_6z.js → view-mode-toggle-DXRcEzPg.js} +1 -1
  187. package/dist/client/assets/{workflow-BhGQkDG3.js → workflow-DvcXfyy4.js} +1 -1
  188. package/dist/client/assets/workflow-detail-BrOvUZpc.js +1 -0
  189. package/dist/client/index.html +1 -1
  190. package/dist/server/cli.js +1 -1
  191. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/generated/root.js +6 -36
  192. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/generated/root.js.map +1 -1
  193. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js +0 -15
  194. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js.map +1 -1
  195. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/generated/root.js +6 -36
  196. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/generated/root.js.map +1 -1
  197. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js +0 -15
  198. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/esnext/trace/internal.js.map +1 -1
  199. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js +6 -36
  200. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js.map +1 -1
  201. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js +0 -15
  202. package/dist/server/node_modules/@opentelemetry/otlp-transformer/build/src/trace/internal.js.map +1 -1
  203. package/dist/server/node_modules/@opentelemetry/otlp-transformer/package.json +14 -12
  204. package/dist/server/node_modules/{pg → pg-connection-string}/LICENSE +3 -3
  205. package/dist/server/node_modules/pg-connection-string/README.md +105 -0
  206. package/dist/server/node_modules/pg-connection-string/esm/index.mjs +8 -0
  207. package/dist/server/node_modules/pg-connection-string/index.d.ts +36 -0
  208. package/dist/server/node_modules/pg-connection-string/index.js +231 -0
  209. package/dist/server/node_modules/pg-connection-string/package.json +52 -0
  210. package/dist/server/node_modules/protobufjs/dist/light/protobuf.js +10 -13
  211. package/dist/server/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  212. package/dist/server/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  213. package/dist/server/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  214. package/dist/server/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  215. package/dist/server/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  216. package/dist/server/node_modules/protobufjs/dist/protobuf.js +55 -14
  217. package/dist/server/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  218. package/dist/server/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  219. package/dist/server/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  220. package/dist/server/node_modules/protobufjs/package.json +1 -1
  221. package/dist/server/node_modules/protobufjs/src/message.js +3 -7
  222. package/dist/server/node_modules/protobufjs/src/object.js +6 -3
  223. package/dist/server/node_modules/protobufjs/src/parse.js +45 -1
  224. package/dist/server/node_modules/protobufjs/src/type.js +0 -1
  225. package/package.json +1 -1
  226. package/dist/client/assets/registry-a_Y0eqBG.js +0 -2
  227. package/dist/client/assets/store-registry-ClO-HCd4.js +0 -2
  228. package/dist/client/assets/useInfiniteQuery-Dn69KZzX.js +0 -1
  229. package/dist/client/assets/useSuspenseInfiniteQuery-CFbzjyFd.js +0 -1
  230. package/dist/client/assets/workflow-detail-CgGFXY1-.js +0 -1
  231. package/dist/server/node_modules/pg/README.md +0 -89
  232. package/dist/server/node_modules/pg/lib/client.js +0 -631
  233. package/dist/server/node_modules/pg/lib/connection-parameters.js +0 -167
  234. package/dist/server/node_modules/pg/lib/connection.js +0 -223
  235. package/dist/server/node_modules/pg/lib/crypto/sasl.js +0 -186
  236. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +0 -37
  237. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +0 -83
  238. package/dist/server/node_modules/pg/lib/crypto/utils.js +0 -9
  239. package/dist/server/node_modules/pg/lib/defaults.js +0 -84
  240. package/dist/server/node_modules/pg/lib/index.js +0 -58
  241. package/dist/server/node_modules/pg/lib/native/client.js +0 -307
  242. package/dist/server/node_modules/pg/lib/native/index.js +0 -2
  243. package/dist/server/node_modules/pg/lib/native/query.js +0 -165
  244. package/dist/server/node_modules/pg/lib/query.js +0 -241
  245. package/dist/server/node_modules/pg/lib/result.js +0 -107
  246. package/dist/server/node_modules/pg/lib/stream.js +0 -28
  247. package/dist/server/node_modules/pg/lib/type-overrides.js +0 -35
  248. package/dist/server/node_modules/pg/lib/utils.js +0 -204
  249. package/dist/server/node_modules/pg/package.json +0 -64
@@ -1 +1 @@
1
- import{r as B,q as Se,K as re,aN as ft,j as s,c as Q,l as ge,B as ne,e as q,n as Ye,D as $e,F as ht,G as gt,a as Fe,o as ue,t as je,J as Me,an as _e,P as se,ap as Pe,aq as Le,v as xt,E as pt,f as bt,d as Et}from"./index-raVE4iMU.js";import{u as Tt}from"./use-organization-roles-DvMKsAzI.js";import{u as Re}from"./use-org-auth-client--KUUMHp0.js";import{B as fe}from"./badge-ONnaTLOr.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-Bzj7Dj8A.js";import{D as It,a as _t,b as St,c as Nt}from"./dropdown-menu-Dzjyztci.js";import{i as Ct}from"./DotsVertical-DIehc2A5.js";import{i as et}from"./Lock01-Ju5ifHNn.js";import{s as Ae}from"./Plus-DgrNRFK5.js";import{s as At}from"./Trash01-BU1vvG1i.js";import{C as jt}from"./collection-table-wrapper-Dtog_f2p.js";import{P as te}from"./index-oYU8P956.js";import{E as ke}from"./empty-state-DoRCByZ3.js";import{S as Oe}from"./search-input-DN3bxChj.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ve}from"./integration-icon-C6CHfqhT.js";import{u as Rt}from"./use-infinite-scroll-C3Cp1KLu.js";import{C as we}from"./checkbox-CupWiQrC.js";import{i as Ot}from"./RefreshCcw01-Bf15qfNS.js";import{u as vt}from"./useSuspenseInfiniteQuery-CFbzjyFd.js";import{u as wt,S as yt}from"./constants-z8N0NNar.js";import{C as Mt}from"./collection-search-Um_OB9Yj.js";import{u as nt}from"./use-members-XY8cJPkc.js";import{u as Pt}from"./use-connection-3197jn_F.js";import{u as Lt,c as kt}from"./use-ai-providers-DWeBiBfE.js";import{A as lt}from"./avatar-DCmff7mq.js";import{S as he}from"./switch-Cgc8prv4.js";import{c as xe,b as pe,T as be,a as Ee}from"./tooltip-BrUaJepM.js";import{S as De,a as Ge,b as Ue}from"./settings-section-DCgrgvZN.js";import{t as Dt}from"./ChevronDown-CNNU2L0m.js";import{i as Gt}from"./ChevronRight-BuVcgGSu.js";import{i as Be}from"./X-CpxCwBcO.js";import"./Check-JQri_6PS.js";import"./table-Guyc6r0i.js";import"./SwitchHorizontal01-B0nDhziZ.js";import"./sidebar-BQJxM_Xs.js";import"./LayoutLeft-5sSkIfFI.js";import"./SearchMd-CuY4_41I.js";import"./Container-Cy3AGglh.js";import"./agent-icon-BZLvaskO.js";import"./AlertCircle-DFcOa31f.js";import"./Tool01-BpLh90bx.js";import"./Stars02-BHNtUcIC.js";import"./ArrowNarrowLeft-CbOlEr1w.js";import"./XCircle-BlhQtOFW.js";import"./ArrowUpRight-C6axmKPR.js";import"./ZapSquare-D-9nYZGQ.js";import"./Users03-DERc_3KT.js";import"./CheckCircle-B6HzfzYv.js";import"./ChevronUp-DyIOyS2u.js";import"./FilterLines-DHlq5ZtE.js";import"./Star01-CiaU9xFe.js";import"./Palette-CJqBw6AH.js";import"./HardDrive-CAAHpLeS.js";import"./Key01-C29UL5qH.js";import"./LinkExternal01-QpHHOJbZ.js";import"./Monitor01-DHHvwXbl.js";import"./Sun-DA9iSyj3.js";import"./Play-DPs1Pbq2.js";import"./Settings02-Cjzbasby.js";import"./Shield01-rI42zX_N.js";import"./Upload01-D2aoviL7.js";import"./User01-BUxAdPGO.js";import"./Users01-X9W80ATA.js";import"./XClose-6T_HfnSF.js";import"./Zap-C_gPmGTu.js";import"./infiniteQueryObserver-ZgItTY4U.js";import"./use-collections-DBbGR_3H.js";import"./card-BsL17xby.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","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH"]},{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_TRIGGER_ROTATE_TOKEN","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:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{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"]},{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 n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Vt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function zt(t,e,n){if(n){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const l=new Set(e);for(const o of t.tools)l.delete(o);return Array.from(l)}const Yt=B.memo(function(e){const n=q.c(21),{connection:l,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:x}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;n[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=r):r=n[1];let g;n[2]!==l.icon||n[3]!==l.title?(g=s.jsx(ve,{icon:l.icon,name:l.title,size:"xs"}),n[2]=l.icon,n[3]=l.title,n[4]=g):g=n[4];let i;n[5]!==l.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),n[5]=l.title,n[6]=i):i=n[6];let c;n[7]!==m||n[8]!==g||n[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[g,i]}),n[7]=m,n[8]=g,n[9]=i,n[10]=c):c=n[10];let T;n[11]!==d||n[12]!==l.tools||n[13]!==a||n[14]!==x||n[15]!==p?(T=l.tools&&l.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:x,onClick:Qt})]}),n[11]=d,n[12]=l.tools,n[13]=a,n[14]=x,n[15]=p,n[16]=T):T=n[16];let b;return n[17]!==r||n[18]!==c||n[19]!==T?(b=s.jsxs("div",{className:r,children:[c,T]}),n[17]=r,n[18]=c,n[19]=T,n[20]=b):b=n[20],b}),$t=B.memo(function(e){const n=q.c(18),{connectionId:l,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${l}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let x;n[0]!==m?(x=Q("text-sm font-medium",m),n[0]=m,n[1]=x):x=n[1];let h;n[2]!==x||n[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:o.name})}),n[2]=x,n[3]=o.name,n[4]=h):h=n[4];let r;n[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),n[5]=o.description,n[6]=r):r=n[6];let g;n[7]!==h||n[8]!==r?(g=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),n[7]=h,n[8]=r,n[9]=g):g=n[9];const i=`tool-${l}-${o.name}`;let c;n[10]!==a||n[11]!==d||n[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),n[10]=a,n[11]=d,n[12]=i,n[13]=c):c=n[13];let T;return n[14]!==p||n[15]!==g||n[16]!==c?(T=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:[g,c]}),n[14]=p,n[15]=g,n[16]=c,n[17]=T):T=n[17],T});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[o,a]=B.useState(""),d=l!==void 0?l:o,p=B.useDeferredValue(d),[m,x]=B.useState("all"),[h,r]=B.useState(!1),g=B.useRef(new Set(Object.keys(t))),{org:i}=Se(),c=wt({connectionId:yt,orgId:i.id,orgSlug:i.slug}),T=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,j=!!n,S={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:T,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:E=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:T,offset:E,...j&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(E,k)=>{if(E?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(E=>E?.items??[])??[],v=Rt(A,f??!1,N),u=n?w.filter(E=>E.connection_type!=="VIRTUAL"?!0:ft(E.connection_url)!==n):w,y=g.current,C=[...y.values()].map(E=>u.find(k=>k.id===E)).filter(E=>E!==void 0),D=u.filter(E=>!y.has(E.id)),G=[...C,...D],$=E=>{const k=t[E];return k!==void 0&&k.length>0},L=G.filter(E=>{if(m==="all")return!0;const k=$(E.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(E=>E.id===V)??null:null,M=O?.tools??[],Y=(E,k)=>t[E]?.includes(k)??!1,K=(E,k)=>{const F=t[E]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[E]:H[E]=Z}else H[E]=[...F,k];e(H)},J=E=>{const k=G.find(X=>X.id===E);if(!k?.tools)return;const F=t[E]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[E]:(Z[E]=ee,z(E)),e(Z)},W=E=>{z(E),r(!0)},le=()=>{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:[l===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:()=>x("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:()=>x("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:()=>x("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(E=>{const k=E.tools?.length??0,F=t[E.id]?.length??0;return s.jsx(Yt,{connection:E,isSelected:V===E.id,hasToolsEnabled:$(E.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(E.id),onToggle:()=>J(E.id)},E.id)}),s.jsx("div",{ref:v,className:"h-4"}),N&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(ge,{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(ne,{variant:"ghost",size:"sm",onClick:le,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(E=>s.jsx($t,{connectionId:O.id,tool:E,isSelected:Y(O.id,E.name),onToggle:()=>K(O.id,E.name)},E.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 l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??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,n){const l=s.jsx(he,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(xe,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let x;e[0]!==p?(x=p.trim().toLowerCase(),e[0]=p,e[1]=x):x=e[1];const h=B.useDeferredValue(x);let r;if(e[2]!==n||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==l){const g=Bt(),i=(R,_)=>{if(!m){if(n&&_){const A=g.flatMap(Wt).flatMap(Jt);o(!1),a(A.filter(f=>!R.tools.includes(f)));return}n||a(zt(R,l,!_))}};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 T=g.map(c).filter(Xt);let b;e[12]!==n||e[13]!==o||e[14]!==a?(b=()=>{o(!n),a([])},e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==n||e[17]!==m||e[18]!==b?(I=ze(n,m,b),e[16]=n,e[17]=m,e[18]=b,e[19]=I):I=e[19];let j;e[20]!==n||e[21]!==o||e[22]!==a||e[23]!==m?(j=m?void 0:()=>{o(!n),a([])},e[20]=n,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,T.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):T.map(R=>{const{section:_,capabilities:A}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:A.map(f=>{const N=Vt(f,l,n);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(xt,{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]=n,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=l,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 n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ss(t){return es[t]??at[t]??t}function ns(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ls(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:x,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:g,readOnly:i,defaultExpanded:c}=t,[T,b]=B.useState(c),I=c||T,j=b,[S,R]=B.useState(ct);let _;e[0]!==h||e[1]!==x||e[2]!==m?(_=v=>x||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=x,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]!==x||e[11]!==n||e[12]!==N||e[13]!==I||e[14]!==a||e[15]!==A||e[16]!==d||e[17]!==g||e[18]!==r||e[19]!==i||e[20]!==l||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[l]??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(x){g(n,p,M.id);return}r(n,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(xe,{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(Ee,{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]=x,e[11]=n,e[12]=N,e[13]=I,e[14]=a,e[15]=A,e[16]=d,e[17]=g,e[18]=r,e[19]=i,e[20]=l,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:n,selectedModels:l,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:x}=t,h=kt(n.id);let r,g,i,c,T;if(e[0]!==p||e[1]!==o||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==x||e[9]!==m||e[10]!==l){T=Symbol.for("react.early_return_sentinel");e:{let j;e[16]!==n.label?(j=C=>({...C,id:C.modelId,provider:n.label}),e[16]=n.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){T=null;break e}const A=new Map;for(const C of _){const D=ts(C.id,n.providerId),G=A.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ns(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[n.providerId]??st;let v;e[18]!==n.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[n.providerId]??n.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",g=f.map(C=>s.jsx(ls,{connectionId:n.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:S.map(ds),selectedModels:l,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:x,defaultExpanded:N},C.id))}e[0]=p,e[1]=o,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=x,e[9]=m,e[10]=l,e[11]=r,e[12]=g,e[13]=i,e[14]=c,e[15]=T}else r=e[11],g=e[12],i=e[13],c=e[14],T=e[15];if(T!==Symbol.for("react.early_return_sentinel"))return T;let b;e[26]!==r||e[27]!==g?(b=s.jsx("div",{className:r,children:g}),e[26]=r,e[27]=g,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,n]=t;return{id:e,name:ss(e),logo:n.logo,models:n.models}}function fs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,x=B.useDeferredValue(p),h=Lt();let r;e[0]!==l||e[1]!==a?(r=(f,N)=>{const w=l[f]??[],v={...l};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]=l,e[1]=a,e[2]=r):r=e[2];const g=r;let i;e[3]!==l||e[4]!==o||e[5]!==a?(i=(f,N,w)=>{o(!1),a({...l,[f]:N.filter(v=>v!==w)})},e[3]=l,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,T=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==T?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",T),e[7]=T,e[8]=b):b=e[8];let I;e[9]!==n||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!n;o(f),f&&a({})},e[9]=n,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]!==n||e[16]!==o||e[17]!==a||e[18]!==m?(S=s.jsx("div",{onClick:xs,children:m?s.jsx(xe,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:n,disabled:!0,onCheckedChange:gs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:n,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=n,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]!==n||e[26]!==x||e[27]!==c||e[28]!==l||e[29]!==m||e[30]!==g?(_=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(ge,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:l[f.id]??[],allowAllModels:n,onToggleModel:g,onExitAllowAll:c,allConnectionModelsSelected:(l[f.id]??[]).includes("*"),searchQuery:x,readOnly:m})},f.id)),e[24]=h,e[25]=n,e[26]=x,e[27]=c,e[28]=l,e[29]=m,e[30]=g,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 gs(){}function xs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[h,r]=B.useState(x),{data:g}=nt();let i,c,T,b,I,j,S,R,_,A,f;if(e[1]!==g?.data?.members||e[2]!==m||e[3]!==a||e[4]!==l||e[5]!==n||e[6]!==h||e[7]!==d||e[8]!==o){const $=g?.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]!==l||e[24]!==h?(z=()=>{a(h),r([]),l(!1)},e[22]=a,e[23]=l,e[24]=h,e[25]=z):z=e[25],T=z,c=Qe,A=n,f=l,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(lt,{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]=g?.data?.members,e[2]=m,e[3]=a,e[4]=l,e[5]=n,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=T,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],T=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]!==T||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:T,disabled:u,children:["Add ",y]})]}),e[37]=T,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:n,onMemberIdsChange:l,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,x=B.useDeferredValue(a),{data:h}=nt();let r,g,i;if(e[0]!==h?.data?.members||e[1]!==x||e[2]!==n||e[3]!==l||e[4]!==m||e[5]!==a){const j=h?.data?.members??[];let S;e[9]!==n?(S=f=>n.includes(f.id),e[9]=n,e[10]=S):S=e[10];const R=j.filter(S);let _;e[11]!==x?(_=f=>{const N=x.toLowerCase();return f.user?.name?.toLowerCase().includes(N)||f.user?.email?.toLowerCase().includes(N)},e[11]=x,e[12]=_):_=e[12];const A=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",g=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(lt,{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(xe,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(N=>N!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=x,e[2]=n,e[3]=l,e[4]=m,e[5]=a,e[6]=r,e[7]=g,e[8]=i}else r=e[6],g=e[7],i=e[8];let c;e[13]!==r||e[14]!==g?(c=s.jsx("div",{className:r,children:g}),e[13]=r,e[14]=g,e[15]=c):c=e[15];let T;e[16]!==n||e[17]!==l?(T=j=>l([...n,...j]),e[16]=n,e[17]=l,e[18]=T):T=e[18];let b;e[19]!==d||e[20]!==n||e[21]!==p||e[22]!==T?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:n,onAddMembers:T}),e[19]=d,e[20]=n,e[21]=p,e[22]=T,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 Es(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(ge,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx(B.Suspense,{fallback:n,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const Ts={owner:[],admin:[],user:[]};function Is(t,e,n,l){if(n?.permission!=null&&l)return dt({id:n.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:n.permission},e,l);const o=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Ts[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,n){const l=t.permission||{},o=l.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,g]of Object.entries(l))if(!(r==="self"||r==="models"))if(r==="*")for(const i of n)p[i.id]=g.includes("*")?i.tools?.map(c=>c.name)??[]:g;else{const i=n.find(c=>c.id===r);i&&(p[r]=g.includes("*")?i.tools?.map(c=>c.name)??[]:g)}const m=l.models||[],x=m.length===0||m.includes("*:*"),h={};if(!x)for(const r of m){const g=r.indexOf(":");if(g===-1)continue;const i=r.slice(0,g),c=r.slice(g+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:x,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const n={};if(t.allowAllStaticPermissions)n.self=["*"];else{const l=new Set(t.staticPermissions);for(const o of Ut)l.add(o);l.size>0&&(n.self=Array.from(l))}for(const[l,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===l)?.tools?.map(p=>p.name)??[];n[l]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)l.push(`${o}:${d}`);l.length>0&&(n.models=l)}return n}function Ss(t,e,n){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,n):t.kind==="custom"?dt(t.role,e,n):{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:n,onOpen:l}=t;if(n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{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(xe,{children:s.jsxs(pe,{children:[d,s.jsx(Ee,{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]!==l?(a=s.jsxs(ne,{variant:"outline",size:"sm",onClick:l,children:[o,"Add Member"]}),e[3]=l,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:n}=Se(),l=Re(),o=Pt();let a;e[0]!==n?(a=re.members(n),e[0]=n,e[1]=a):a=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,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:x}=Ye(p);if(x||!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(ge,{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 g;return e[10]!==o||e[11]!==r||e[12]!==t?(g=s.jsx(As,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=g):g=e[13],g}function As({target:t,onBack:e,onSaved:n,members:l,connections:o}){const{locator:a}=Se(),d=Re(),p=$e(),m=t.kind==="builtin",x=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,g]=B.useState(m?"org":"mcp"),i=ht({resolver:gt(Ht),defaultValues:Ss(t,l,o)}),c=i.formState.isValid,T=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=l.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),n(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=!x,S=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...x?[]:[{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=>{g(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(ne,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:I,disabled:b.isPending||!c||!T,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")))}),x&&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"&&!x&&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:x,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:x,searchQuery:_}),r==="members"&&s.jsx(Es,{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 l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??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,n]=B.useState(""),[l,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}=Et(d),{locator:m}=Se(),x=Re(),h=$e(),{customRoles:r,refetch:g}=Tt();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 T;e:{if(!p){T=null;break e}if(p==="new"){T={kind:"new"};break e}if(p.startsWith("builtin-")){T={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);T=U?{kind:"custom",role:U}:null}const b=T;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let j;t[7]!==x?(j=()=>x.organization.listMembers(),t[7]=x,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]!==x?(v=async P=>{const U=await x.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=x,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!"),g(),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(ne,{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]!==g||t[36]!==c?(U=()=>{g(),c(void 0)},t[35]=g,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"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:n,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(ne,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let le;t[47]!==Y||t[48]!==W?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=le):le=t[49];let E;t[50]!==e?(E=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]=E):E=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==E?(k=s.jsx(jt,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:E}),t[52]=w,t[53]=L,t[54]=z,t[55]=E,t[56]=k):k=t[56];let F;t[57]!==le||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,le,k]})})}),t[57]=le,t[58]=k,t[59]=F):F=t[59];const ee=l!==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=l?.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 Te;t[64]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(Xe,{children:"Cancel"}),t[64]=Te):Te=t[64];let ce;t[65]!==u||t[66]!==l?(ce=s.jsxs(Je,{children:[Te,s.jsx(We,{onClick:()=>{l?.id&&u.mutate(l.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,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,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.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 sl(){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 n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=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(ge,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=n):n=t[1],n}export{sl as default};
1
+ import{r as B,q as Se,K as re,aN as ft,j as s,c as Q,l as ge,B as ne,e as q,n as Ye,D as $e,F as ht,G as gt,a as Fe,o as ue,t as je,J as Me,an as _e,P as se,ap as Pe,aq as Le,v as xt,E as pt,f as bt,d as Et}from"./index-Bf7aO1A-.js";import{u as Tt}from"./use-organization-roles-CZP0dNKh.js";import{u as Re}from"./use-org-auth-client-DOzELmrd.js";import{B as fe}from"./badge-BTq6_dwU.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-B_i_ps7f.js";import{D as It,a as _t,b as St,c as Nt}from"./dropdown-menu-nlgjcLMp.js";import{i as Ct}from"./DotsVertical-BFb-15-m.js";import{i as et}from"./Lock01-BheAsQQx.js";import{s as Ae}from"./Plus-C5l4faC1.js";import{s as At}from"./Trash01-v5Dy47Wj.js";import{C as jt}from"./collection-table-wrapper-C7oTCBDJ.js";import{P as te}from"./index-DPqqDw7W.js";import{E as ke}from"./empty-state-Rnc2dhkR.js";import{S as Oe}from"./search-input-DglPcAnH.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ve}from"./integration-icon-DX7WoZFw.js";import{u as Rt}from"./use-infinite-scroll-jDpA-_cW.js";import{C as we}from"./checkbox-Dz5JG34i.js";import{i as Ot}from"./RefreshCcw01-Cr7WlxPS.js";import{u as vt}from"./useSuspenseInfiniteQuery-Cu6z25rm.js";import{u as wt,S as yt}from"./constants-B8os5nMI.js";import{C as Mt}from"./collection-search-CXtVb7nz.js";import{u as nt}from"./use-members-cPnrxPK_.js";import{u as Pt}from"./use-connection-IocO3s2Q.js";import{u as Lt,c as kt}from"./use-ai-providers-CewbWKWW.js";import{A as lt}from"./avatar-BRyrVRDm.js";import{S as he}from"./switch-C_oh8iVS.js";import{c as xe,b as pe,T as be,a as Ee}from"./tooltip-Kfr4gA8D.js";import{S as De,a as Ge,b as Ue}from"./settings-section-DbssupiX.js";import{t as Dt}from"./ChevronDown-BHt79TDc.js";import{i as Gt}from"./ChevronRight-CgiGzJK2.js";import{i as Be}from"./X-DkujvqvQ.js";import"./Check-BBN8jtrj.js";import"./table-Dy93uecr.js";import"./SwitchHorizontal01-C1fzb4rn.js";import"./sidebar-CkEPveNS.js";import"./LayoutLeft-NsiLg-Hz.js";import"./SearchMd-rTsELW21.js";import"./Container-CmZ_UAMx.js";import"./agent-icon-q6iHyexc.js";import"./AlertCircle-Dyh2dUBt.js";import"./Tool01-DHXrZh_c.js";import"./Stars02-LrVE5fus.js";import"./ArrowNarrowLeft-DOeeOVat.js";import"./XCircle-BkF11s9b.js";import"./ArrowUpRight-C5h8eEJl.js";import"./ZapSquare-sMv-roxP.js";import"./Users03-Bq46oqMB.js";import"./CheckCircle-BodpoDGR.js";import"./ChevronUp-Hv5s5GCl.js";import"./FilterLines-BNco6Knh.js";import"./Star01-HKceyVo1.js";import"./Palette-DPP_bV0e.js";import"./HardDrive-Bs4cIN_I.js";import"./Key01-BOHiIHj-.js";import"./LinkExternal01-DXkr_udM.js";import"./Monitor01-BkzEm6bw.js";import"./Sun-D9eEy7za.js";import"./Play-BqGgMbL5.js";import"./Settings02-BSu9v11-.js";import"./Shield01-BzHuCaEB.js";import"./Upload01-p8VtXdXS.js";import"./User01-CtanRIko.js";import"./Users01-BbxKMG6t.js";import"./XClose-DgRHRNhM.js";import"./Zap-XzlBn_sj.js";import"./infiniteQueryObserver-Cv7QlLOi.js";import"./use-collections-JGA7MsfD.js";import"./card-CSM7jg8b.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","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH"]},{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_TRIGGER_ROTATE_TOKEN","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:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{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"]},{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 n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Vt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function zt(t,e,n){if(n){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const l=new Set(e);for(const o of t.tools)l.delete(o);return Array.from(l)}const Yt=B.memo(function(e){const n=q.c(21),{connection:l,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:x}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;n[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),n[0]=h,n[1]=r):r=n[1];let g;n[2]!==l.icon||n[3]!==l.title?(g=s.jsx(ve,{icon:l.icon,name:l.title,size:"xs"}),n[2]=l.icon,n[3]=l.title,n[4]=g):g=n[4];let i;n[5]!==l.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),n[5]=l.title,n[6]=i):i=n[6];let c;n[7]!==m||n[8]!==g||n[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[g,i]}),n[7]=m,n[8]=g,n[9]=i,n[10]=c):c=n[10];let T;n[11]!==d||n[12]!==l.tools||n[13]!==a||n[14]!==x||n[15]!==p?(T=l.tools&&l.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:x,onClick:Qt})]}),n[11]=d,n[12]=l.tools,n[13]=a,n[14]=x,n[15]=p,n[16]=T):T=n[16];let b;return n[17]!==r||n[18]!==c||n[19]!==T?(b=s.jsxs("div",{className:r,children:[c,T]}),n[17]=r,n[18]=c,n[19]=T,n[20]=b):b=n[20],b}),$t=B.memo(function(e){const n=q.c(18),{connectionId:l,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${l}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let x;n[0]!==m?(x=Q("text-sm font-medium",m),n[0]=m,n[1]=x):x=n[1];let h;n[2]!==x||n[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:o.name})}),n[2]=x,n[3]=o.name,n[4]=h):h=n[4];let r;n[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),n[5]=o.description,n[6]=r):r=n[6];let g;n[7]!==h||n[8]!==r?(g=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),n[7]=h,n[8]=r,n[9]=g):g=n[9];const i=`tool-${l}-${o.name}`;let c;n[10]!==a||n[11]!==d||n[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),n[10]=a,n[11]=d,n[12]=i,n[13]=c):c=n[13];let T;return n[14]!==p||n[15]!==g||n[16]!==c?(T=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:[g,c]}),n[14]=p,n[15]=g,n[16]=c,n[17]=T):T=n[17],T});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[o,a]=B.useState(""),d=l!==void 0?l:o,p=B.useDeferredValue(d),[m,x]=B.useState("all"),[h,r]=B.useState(!1),g=B.useRef(new Set(Object.keys(t))),{org:i}=Se(),c=wt({connectionId:yt,orgId:i.id,orgSlug:i.slug}),T=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,j=!!n,S={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:T,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:E=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:T,offset:E,...j&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(E,k)=>{if(E?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(E=>E?.items??[])??[],v=Rt(A,f??!1,N),u=n?w.filter(E=>E.connection_type!=="VIRTUAL"?!0:ft(E.connection_url)!==n):w,y=g.current,C=[...y.values()].map(E=>u.find(k=>k.id===E)).filter(E=>E!==void 0),D=u.filter(E=>!y.has(E.id)),G=[...C,...D],$=E=>{const k=t[E];return k!==void 0&&k.length>0},L=G.filter(E=>{if(m==="all")return!0;const k=$(E.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(E=>E.id===V)??null:null,M=O?.tools??[],Y=(E,k)=>t[E]?.includes(k)??!1,K=(E,k)=>{const F=t[E]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[E]:H[E]=Z}else H[E]=[...F,k];e(H)},J=E=>{const k=G.find(X=>X.id===E);if(!k?.tools)return;const F=t[E]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[E]:(Z[E]=ee,z(E)),e(Z)},W=E=>{z(E),r(!0)},le=()=>{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:[l===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:()=>x("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:()=>x("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:()=>x("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(E=>{const k=E.tools?.length??0,F=t[E.id]?.length??0;return s.jsx(Yt,{connection:E,isSelected:V===E.id,hasToolsEnabled:$(E.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(E.id),onToggle:()=>J(E.id)},E.id)}),s.jsx("div",{ref:v,className:"h-4"}),N&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(ge,{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(ne,{variant:"ghost",size:"sm",onClick:le,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(E=>s.jsx($t,{connectionId:O.id,tool:E,isSelected:Y(O.id,E.name),onToggle:()=>K(O.id,E.name)},E.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 l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??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,n){const l=s.jsx(he,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(xe,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let x;e[0]!==p?(x=p.trim().toLowerCase(),e[0]=p,e[1]=x):x=e[1];const h=B.useDeferredValue(x);let r;if(e[2]!==n||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==l){const g=Bt(),i=(R,_)=>{if(!m){if(n&&_){const A=g.flatMap(Wt).flatMap(Jt);o(!1),a(A.filter(f=>!R.tools.includes(f)));return}n||a(zt(R,l,!_))}};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 T=g.map(c).filter(Xt);let b;e[12]!==n||e[13]!==o||e[14]!==a?(b=()=>{o(!n),a([])},e[12]=n,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==n||e[17]!==m||e[18]!==b?(I=ze(n,m,b),e[16]=n,e[17]=m,e[18]=b,e[19]=I):I=e[19];let j;e[20]!==n||e[21]!==o||e[22]!==a||e[23]!==m?(j=m?void 0:()=>{o(!n),a([])},e[20]=n,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,T.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):T.map(R=>{const{section:_,capabilities:A}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:A.map(f=>{const N=Vt(f,l,n);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(xt,{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]=n,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=l,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 n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ss(t){return es[t]??at[t]??t}function ns(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ls(t){const e=q.c(44),{connectionId:n,subProviderId:l,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:x,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:g,readOnly:i,defaultExpanded:c}=t,[T,b]=B.useState(c),I=c||T,j=b,[S,R]=B.useState(ct);let _;e[0]!==h||e[1]!==x||e[2]!==m?(_=v=>x||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=x,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]!==x||e[11]!==n||e[12]!==N||e[13]!==I||e[14]!==a||e[15]!==A||e[16]!==d||e[17]!==g||e[18]!==r||e[19]!==i||e[20]!==l||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[l]??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(x){g(n,p,M.id);return}r(n,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(xe,{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(Ee,{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]=x,e[11]=n,e[12]=N,e[13]=I,e[14]=a,e[15]=A,e[16]=d,e[17]=g,e[18]=r,e[19]=i,e[20]=l,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:n,selectedModels:l,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:x}=t,h=kt(n.id);let r,g,i,c,T;if(e[0]!==p||e[1]!==o||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==x||e[9]!==m||e[10]!==l){T=Symbol.for("react.early_return_sentinel");e:{let j;e[16]!==n.label?(j=C=>({...C,id:C.modelId,provider:n.label}),e[16]=n.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){T=null;break e}const A=new Map;for(const C of _){const D=ts(C.id,n.providerId),G=A.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ns(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[n.providerId]??st;let v;e[18]!==n.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[n.providerId]??n.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",g=f.map(C=>s.jsx(ls,{connectionId:n.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:S.map(ds),selectedModels:l,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:x,defaultExpanded:N},C.id))}e[0]=p,e[1]=o,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=x,e[9]=m,e[10]=l,e[11]=r,e[12]=g,e[13]=i,e[14]=c,e[15]=T}else r=e[11],g=e[12],i=e[13],c=e[14],T=e[15];if(T!==Symbol.for("react.early_return_sentinel"))return T;let b;e[26]!==r||e[27]!==g?(b=s.jsx("div",{className:r,children:g}),e[26]=r,e[27]=g,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,n]=t;return{id:e,name:ss(e),logo:n.logo,models:n.models}}function fs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,x=B.useDeferredValue(p),h=Lt();let r;e[0]!==l||e[1]!==a?(r=(f,N)=>{const w=l[f]??[],v={...l};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]=l,e[1]=a,e[2]=r):r=e[2];const g=r;let i;e[3]!==l||e[4]!==o||e[5]!==a?(i=(f,N,w)=>{o(!1),a({...l,[f]:N.filter(v=>v!==w)})},e[3]=l,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,T=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==T?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",T),e[7]=T,e[8]=b):b=e[8];let I;e[9]!==n||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!n;o(f),f&&a({})},e[9]=n,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]!==n||e[16]!==o||e[17]!==a||e[18]!==m?(S=s.jsx("div",{onClick:xs,children:m?s.jsx(xe,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:n,disabled:!0,onCheckedChange:gs})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:n,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=n,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]!==n||e[26]!==x||e[27]!==c||e[28]!==l||e[29]!==m||e[30]!==g?(_=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(ge,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:l[f.id]??[],allowAllModels:n,onToggleModel:g,onExitAllowAll:c,allConnectionModelsSelected:(l[f.id]??[]).includes("*"),searchQuery:x,readOnly:m})},f.id)),e[24]=h,e[25]=n,e[26]=x,e[27]=c,e[28]=l,e[29]=m,e[30]=g,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 gs(){}function xs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:n,onOpenChange:l,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[h,r]=B.useState(x),{data:g}=nt();let i,c,T,b,I,j,S,R,_,A,f;if(e[1]!==g?.data?.members||e[2]!==m||e[3]!==a||e[4]!==l||e[5]!==n||e[6]!==h||e[7]!==d||e[8]!==o){const $=g?.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]!==l||e[24]!==h?(z=()=>{a(h),r([]),l(!1)},e[22]=a,e[23]=l,e[24]=h,e[25]=z):z=e[25],T=z,c=Qe,A=n,f=l,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(lt,{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]=g?.data?.members,e[2]=m,e[3]=a,e[4]=l,e[5]=n,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=T,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],T=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]!==T||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:T,disabled:u,children:["Add ",y]})]}),e[37]=T,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:n,onMemberIdsChange:l,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,x=B.useDeferredValue(a),{data:h}=nt();let r,g,i;if(e[0]!==h?.data?.members||e[1]!==x||e[2]!==n||e[3]!==l||e[4]!==m||e[5]!==a){const j=h?.data?.members??[];let S;e[9]!==n?(S=f=>n.includes(f.id),e[9]=n,e[10]=S):S=e[10];const R=j.filter(S);let _;e[11]!==x?(_=f=>{const N=x.toLowerCase();return f.user?.name?.toLowerCase().includes(N)||f.user?.email?.toLowerCase().includes(N)},e[11]=x,e[12]=_):_=e[12];const A=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",g=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(lt,{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(xe,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Ee,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(N=>N!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=x,e[2]=n,e[3]=l,e[4]=m,e[5]=a,e[6]=r,e[7]=g,e[8]=i}else r=e[6],g=e[7],i=e[8];let c;e[13]!==r||e[14]!==g?(c=s.jsx("div",{className:r,children:g}),e[13]=r,e[14]=g,e[15]=c):c=e[15];let T;e[16]!==n||e[17]!==l?(T=j=>l([...n,...j]),e[16]=n,e[17]=l,e[18]=T):T=e[18];let b;e[19]!==d||e[20]!==n||e[21]!==p||e[22]!==T?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:n,onAddMembers:T}),e[19]=d,e[20]=n,e[21]=p,e[22]=T,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 Es(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(ge,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx(B.Suspense,{fallback:n,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const Ts={owner:[],admin:[],user:[]};function Is(t,e,n,l){if(n?.permission!=null&&l)return dt({id:n.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:n.permission},e,l);const o=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Ts[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,n){const l=t.permission||{},o=l.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,g]of Object.entries(l))if(!(r==="self"||r==="models"))if(r==="*")for(const i of n)p[i.id]=g.includes("*")?i.tools?.map(c=>c.name)??[]:g;else{const i=n.find(c=>c.id===r);i&&(p[r]=g.includes("*")?i.tools?.map(c=>c.name)??[]:g)}const m=l.models||[],x=m.length===0||m.includes("*:*"),h={};if(!x)for(const r of m){const g=r.indexOf(":");if(g===-1)continue;const i=r.slice(0,g),c=r.slice(g+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:x,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const n={};if(t.allowAllStaticPermissions)n.self=["*"];else{const l=new Set(t.staticPermissions);for(const o of Ut)l.add(o);l.size>0&&(n.self=Array.from(l))}for(const[l,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===l)?.tools?.map(p=>p.name)??[];n[l]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)l.push(`${o}:${d}`);l.length>0&&(n.models=l)}return n}function Ss(t,e,n){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,n):t.kind==="custom"?dt(t.role,e,n):{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:n,onOpen:l}=t;if(n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{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(xe,{children:s.jsxs(pe,{children:[d,s.jsx(Ee,{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]!==l?(a=s.jsxs(ne,{variant:"outline",size:"sm",onClick:l,children:[o,"Add Member"]}),e[3]=l,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:n}=Se(),l=Re(),o=Pt();let a;e[0]!==n?(a=re.members(n),e[0]=n,e[1]=a):a=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,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:x}=Ye(p);if(x||!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(ge,{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 g;return e[10]!==o||e[11]!==r||e[12]!==t?(g=s.jsx(As,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=g):g=e[13],g}function As({target:t,onBack:e,onSaved:n,members:l,connections:o}){const{locator:a}=Se(),d=Re(),p=$e(),m=t.kind==="builtin",x=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,g]=B.useState(m?"org":"mcp"),i=ht({resolver:gt(Ht),defaultValues:Ss(t,l,o)}),c=i.formState.isValid,T=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=l.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),n(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=!x,S=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...x?[]:[{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=>{g(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(ne,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:I,disabled:b.isPending||!c||!T,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")))}),x&&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"&&!x&&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:x,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:x,searchQuery:_}),r==="members"&&s.jsx(Es,{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 l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??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,n]=B.useState(""),[l,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}=Et(d),{locator:m}=Se(),x=Re(),h=$e(),{customRoles:r,refetch:g}=Tt();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 T;e:{if(!p){T=null;break e}if(p==="new"){T={kind:"new"};break e}if(p.startsWith("builtin-")){T={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);T=U?{kind:"custom",role:U}:null}const b=T;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let j;t[7]!==x?(j=()=>x.organization.listMembers(),t[7]=x,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]!==x?(v=async P=>{const U=await x.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=x,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!"),g(),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(ne,{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]!==g||t[36]!==c?(U=()=>{g(),c(void 0)},t[35]=g,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"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:n,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(ne,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let le;t[47]!==Y||t[48]!==W?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=le):le=t[49];let E;t[50]!==e?(E=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]=E):E=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==E?(k=s.jsx(jt,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:E}),t[52]=w,t[53]=L,t[54]=z,t[55]=E,t[56]=k):k=t[56];let F;t[57]!==le||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,le,k]})})}),t[57]=le,t[58]=k,t[59]=F):F=t[59];const ee=l!==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=l?.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 Te;t[64]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(Xe,{children:"Cancel"}),t[64]=Te):Te=t[64];let ce;t[65]!==u||t[66]!==l?(ce=s.jsxs(Je,{children:[Te,s.jsx(We,{onClick:()=>{l?.id&&u.mutate(l.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,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,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.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 sl(){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 n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=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(ge,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=n):n=t[1],n}export{sl as default};
@@ -1 +1 @@
1
- import{e as b,c as w,j as a,l as j}from"./index-raVE4iMU.js";import{i as N}from"./SearchMd-CuY4_41I.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-Bf7aO1A-.js";import{i as N}from"./SearchMd-rTsELW21.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 +1 @@
1
- import{e as p,j as t,E as P,r as j,B as S,o as N}from"./index-raVE4iMU.js";import{i as k}from"./AlertCircle-DFcOa31f.js";import{i as w}from"./Lock01-Ju5ifHNn.js";import{s as z}from"./Plus-DgrNRFK5.js";import{s as E}from"./User01-BUxAdPGO.js";import{t as F}from"./Users01-X9W80ATA.js";import{b as $,a as I,c as O,d as A,e as T,D as B}from"./dialog-1TuinsgZ.js";import{I as y}from"./input-CcEL_8zI.js";import{L as g}from"./label-P_F_-Q8z.js";import{S as R,a as V,b as L,c as q,d as C}from"./select-BI295XE-.js";import{S as H}from"./skeleton-Cz-aBL4t.js";import{T as K}from"./textarea-CUr0kaZB.js";import{P as b}from"./index-oYU8P956.js";import{d as W}from"./settings-section-DCgrgvZN.js";import{u as Y,a as G}from"./use-secrets-DaKsY9Qa.js";import"./X-CpxCwBcO.js";import"./tooltip-BrUaJepM.js";import"./Check-JQri_6PS.js";import"./ChevronDown-CNNU2L0m.js";import"./ChevronUp-DyIOyS2u.js";import"./sidebar-BQJxM_Xs.js";import"./LayoutLeft-5sSkIfFI.js";import"./card-BsL17xby.js";import"./ArrowUpRight-C6axmKPR.js";import"./constants-z8N0NNar.js";import"./unwrap-tool-result-BYXdCQMg.js";function J(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function M(s){const e=p.c(5),{scope:r}=s,c=r==="user"?E:F,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(M,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let o;e[5]!==n||e[6]!==i?(o=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=o):o=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==o||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[o,d]})]}),e[10]=o,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let a;e[15]!==l?(a=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=a):a=e[16];let x;return e[17]!==u||e[18]!==a?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,a]}),e[17]=u,e[18]=a,e[19]=x):x=e[19],x}function Q(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let o;return e[3]!==r?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=o):o=e[4],o}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[o,d]=j.useState(""),[u,l]=j.useState(""),a=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!o))try{await a.mutateAsync({scope:r,name:n.trim(),value:o,description:u.trim()||void 0}),N.success(`Secret "${n.trim()}" created`),f()}catch(v){N.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(T,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(R,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(y,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(y,{id:"secret-value",type:"password",value:o,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(B,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:a.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:a.isPending||!n.trim()||!o,children:a.isPending?"Creating…":"Create secret"})]})]})]})})}function U(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Q,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let a;return s[1]!==r?(a=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=a):a=s[2],a}let n,i,o;if(s[3]!==e){const l=e.filter(te),a=e.filter(ee),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(Z)})]}):null,o=a.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:a.map(X)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=o}else n=s[4],i=s[5],o=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==o||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,o,d]}),s[16]=n,s[17]=i,s[18]=o,s[19]=d,s[20]=u):u=s[20],u}function X(s){return t.jsx(D,{secret:s},s.id)}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return s.scope==="user"}function te(s){return s.scope==="organization"}function se(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:re,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(U,{})})})]})})})}),s[1]=r):r=s[1],r}function re(s){const{error:e}=s;return t.jsx(J,{error:e??new Error("Failed to load secrets")})}function ke(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(se,{}),s[0]=e):e=s[0],e}export{ke as default};
1
+ import{e as p,j as t,E as P,r as j,B as S,o as N}from"./index-Bf7aO1A-.js";import{i as k}from"./AlertCircle-Dyh2dUBt.js";import{i as w}from"./Lock01-BheAsQQx.js";import{s as z}from"./Plus-C5l4faC1.js";import{s as E}from"./User01-CtanRIko.js";import{t as F}from"./Users01-BbxKMG6t.js";import{b as $,a as I,c as O,d as A,e as T,D as B}from"./dialog-C40tWbjB.js";import{I as y}from"./input-Fpo5hVEP.js";import{L as g}from"./label-FRw7B4TG.js";import{S as R,a as V,b as L,c as q,d as C}from"./select-ufdAhrF_.js";import{S as H}from"./skeleton-DYoQoQqq.js";import{T as K}from"./textarea-Cna17PTh.js";import{P as b}from"./index-DPqqDw7W.js";import{d as W}from"./settings-section-DbssupiX.js";import{u as Y,a as G}from"./use-secrets-BAD7O6nA.js";import"./X-DkujvqvQ.js";import"./tooltip-Kfr4gA8D.js";import"./Check-BBN8jtrj.js";import"./ChevronDown-BHt79TDc.js";import"./ChevronUp-Hv5s5GCl.js";import"./sidebar-CkEPveNS.js";import"./LayoutLeft-NsiLg-Hz.js";import"./card-CSM7jg8b.js";import"./ArrowUpRight-C5h8eEJl.js";import"./constants-B8os5nMI.js";import"./unwrap-tool-result-BYXdCQMg.js";function J(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function M(s){const e=p.c(5),{scope:r}=s,c=r==="user"?E:F,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(M,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let o;e[5]!==n||e[6]!==i?(o=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=o):o=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==o||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[o,d]})]}),e[10]=o,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let a;e[15]!==l?(a=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=a):a=e[16];let x;return e[17]!==u||e[18]!==a?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,a]}),e[17]=u,e[18]=a,e[19]=x):x=e[19],x}function Q(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let o;return e[3]!==r?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=o):o=e[4],o}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[o,d]=j.useState(""),[u,l]=j.useState(""),a=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!o))try{await a.mutateAsync({scope:r,name:n.trim(),value:o,description:u.trim()||void 0}),N.success(`Secret "${n.trim()}" created`),f()}catch(v){N.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(T,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(R,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(y,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(y,{id:"secret-value",type:"password",value:o,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(B,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:a.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:a.isPending||!n.trim()||!o,children:a.isPending?"Creating…":"Create secret"})]})]})]})})}function U(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Q,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let a;return s[1]!==r?(a=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=a):a=s[2],a}let n,i,o;if(s[3]!==e){const l=e.filter(te),a=e.filter(ee),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(Z)})]}):null,o=a.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:a.map(X)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=o}else n=s[4],i=s[5],o=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==o||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,o,d]}),s[16]=n,s[17]=i,s[18]=o,s[19]=d,s[20]=u):u=s[20],u}function X(s){return t.jsx(D,{secret:s},s.id)}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return s.scope==="user"}function te(s){return s.scope==="organization"}function se(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:re,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(U,{})})})]})})})}),s[1]=r):r=s[1],r}function re(s){const{error:e}=s;return t.jsx(J,{error:e??new Error("Failed to load secrets")})}function ke(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(se,{}),s[0]=e):e=s[0],e}export{ke as default};