decocms 2.304.15 → 2.304.16

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 (236) hide show
  1. package/dist/client/assets/{AlertCircle-CbUYZGF-.js → AlertCircle-YdvcZKe8.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-DHj5-FLY.js → ArrowNarrowLeft-spQjUruy.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-BK_iYZ-J.js → ArrowUpRight-B1ajIZNC.js} +1 -1
  4. package/dist/client/assets/Check-D7cmovlU.js +1 -0
  5. package/dist/client/assets/{CheckCircle-D9qlmIve.js → CheckCircle-BQ3_L_yP.js} +1 -1
  6. package/dist/client/assets/ChevronDown-BfDxcbjR.js +1 -0
  7. package/dist/client/assets/{ChevronRight-BIm0-OSp.js → ChevronRight-BoDMW1uU.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-ClqSoLtD.js → ChevronUp-CRQBEG-R.js} +1 -1
  9. package/dist/client/assets/{Container-BCDxdJoG.js → Container-B6Z-4M-T.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DEE8M0V4.js → DotsVertical-BxlMGXPv.js} +1 -1
  11. package/dist/client/assets/{LinkExternal01-DM7IwrPj.js → LinkExternal01-Dmf65eFo.js} +1 -1
  12. package/dist/client/assets/{Lock01-BmjkKSvK.js → Lock01-CHWOYjbh.js} +1 -1
  13. package/dist/client/assets/{Palette-BrJL0UcN.js → Palette-96pDg1d-.js} +1 -1
  14. package/dist/client/assets/{Play-DSYx2GJ2.js → Play-ChzLrbkr.js} +1 -1
  15. package/dist/client/assets/{Plus-BrBimbff.js → Plus-Cd4I0_d-.js} +1 -1
  16. package/dist/client/assets/{RefreshCcw01-Cr84gVY8.js → RefreshCcw01-BBhbyLOk.js} +1 -1
  17. package/dist/client/assets/{SearchMd-IP-R-mtT.js → SearchMd-cj9P259i.js} +1 -1
  18. package/dist/client/assets/{Settings02-BOckjEVU.js → Settings02-Cx39xFqG.js} +1 -1
  19. package/dist/client/assets/{Shield01-CJggUHAQ.js → Shield01-DDhNoo0b.js} +1 -1
  20. package/dist/client/assets/Star01-UQZ7hTDj.js +1 -0
  21. package/dist/client/assets/{Sun-B7BWJEHb.js → Sun-Cr3NKiIh.js} +1 -1
  22. package/dist/client/assets/{Tool01-D1Rvo01i.js → Tool01-DXbOwd1n.js} +1 -1
  23. package/dist/client/assets/{Trash01-DaGrAtTq.js → Trash01-DqDMVyTa.js} +1 -1
  24. package/dist/client/assets/{User01-DmtseI1g.js → User01-C7C_-f57.js} +1 -1
  25. package/dist/client/assets/{Users03-DH9QAbco.js → Users03-DGRxeg5O.js} +1 -1
  26. package/dist/client/assets/{X-viKat0oa.js → X-8IHaEYtM.js} +1 -1
  27. package/dist/client/assets/{XCircle-DZEMwZj2.js → XCircle-kdEx_GGF.js} +1 -1
  28. package/dist/client/assets/{XClose-DY7O9VST.js → XClose-D8EpU_uy.js} +1 -1
  29. package/dist/client/assets/{Zap-BMzMPNv3.js → Zap-DdUb_mPC.js} +1 -1
  30. package/dist/client/assets/{ZapSquare-BDbWe-zU.js → ZapSquare-Biix1-55.js} +1 -1
  31. package/dist/client/assets/{accordion-YgNI8iqn.js → accordion-MNTOVO1w.js} +1 -1
  32. package/dist/client/assets/agent-icon-BBG09Kki.js +1 -0
  33. package/dist/client/assets/agents-list-Cd2ZNqCV.js +1 -0
  34. package/dist/client/assets/ai-providers-BM3nrPzC.js +1 -0
  35. package/dist/client/assets/{alert-dialog-BvuFarFf.js → alert-dialog-ChbEbjde.js} +1 -1
  36. package/dist/client/assets/{auth-catchall-DQeYnh5P.js → auth-catchall-CBAL823O.js} +1 -1
  37. package/dist/client/assets/automation-list-row-ZDJkdIwJ.js +1 -0
  38. package/dist/client/assets/automations-_nxja9xP.js +1 -0
  39. package/dist/client/assets/{avatar-C4FRugJb.js → avatar-97M2j8Mc.js} +1 -1
  40. package/dist/client/assets/{badge-_ZGDO29b.js → badge-CGsQT5nT.js} +1 -1
  41. package/dist/client/assets/brand-context-D6w2oIn3.js +1 -0
  42. package/dist/client/assets/{card-oSxwoJvZ.js → card-DfJe5L79.js} +1 -1
  43. package/dist/client/assets/{chat-context-C4Hx_rZK.js → chat-context-Cmy5JYgW.js} +1 -1
  44. package/dist/client/assets/checkbox-C1M4-v1p.js +1 -0
  45. package/dist/client/assets/collection-detail-Bwwayl0Z.js +1 -0
  46. package/dist/client/assets/collection-display-button-C5vtHGnK.js +1 -0
  47. package/dist/client/assets/{collection-search-u94VKjvs.js → collection-search-CzQYdsP4.js} +1 -1
  48. package/dist/client/assets/{collection-search-D_DqZCmL.js → collection-search-DT89ZZmI.js} +1 -1
  49. package/dist/client/assets/{collection-table-wrapper-LzV9CSI7.js → collection-table-wrapper-Bna3sxAQ.js} +1 -1
  50. package/dist/client/assets/{collection-tabs-DW1xYGdq.js → collection-tabs-ComzcUW9.js} +1 -1
  51. package/dist/client/assets/{collections-Cn7VbUFT.js → collections-CTGZthcG.js} +1 -1
  52. package/dist/client/assets/{command-CgMn1LbK.js → command-DjJw7GWb.js} +1 -1
  53. package/dist/client/assets/{connection-card-BPUe3B60.js → connection-card-DQlGg9mJ.js} +1 -1
  54. package/dist/client/assets/connection-detail-Z4nXqSbX.js +1 -0
  55. package/dist/client/assets/{connection-form-helpers-CUlzSClK.js → connection-form-helpers-DiGKAKlz.js} +1 -1
  56. package/dist/client/assets/connections-DAoFEFST.js +1 -0
  57. package/dist/client/assets/{constants-CfwGLQ49.js → constants-B9wErdMg.js} +1 -1
  58. package/dist/client/assets/{constants-CVDNjJTw.js → constants-XC36TPvL.js} +1 -1
  59. package/dist/client/assets/{dialog-CoECADf1.js → dialog-B9n71g4e.js} +1 -1
  60. package/dist/client/assets/{domain-settings-D6RV8b16.js → domain-settings-DAaCjfZg.js} +1 -1
  61. package/dist/client/assets/{drawer-DTk8g2vK.js → drawer-Dy5NJxEk.js} +1 -1
  62. package/dist/client/assets/dropdown-menu-bofOMeLm.js +1 -0
  63. package/dist/client/assets/{dynamic-plugin-layout-DCoYGhHP.js → dynamic-plugin-layout-DdC9w75r.js} +1 -1
  64. package/dist/client/assets/{empty-state-Be0X9mox.js → empty-state-Bl1VCnIe.js} +1 -1
  65. package/dist/client/assets/{empty-state-DoKR-jUX.js → empty-state-iSyeAylK.js} +1 -1
  66. package/dist/client/assets/{extract-connection-data-CuIeY90s.js → extract-connection-data-BmWiFxHJ.js} +1 -1
  67. package/dist/client/assets/{features-38ZozsmE.js → features-BKkpnrxu.js} +1 -1
  68. package/dist/client/assets/{form-BC40Nvzi.js → form-DABXYYeF.js} +1 -1
  69. package/dist/client/assets/general-DukQ3tYy.js +1 -0
  70. package/dist/client/assets/{index-CvarGBFr.js → index-B40-ao-L.js} +1 -1
  71. package/dist/client/assets/{index-Bcf94soS.js → index-BBoaHd8c.js} +1 -1
  72. package/dist/client/assets/{index-CbBINyFK.js → index-BOl2sMex.js} +1 -1
  73. package/dist/client/assets/{index-DXHNyf1g.css → index-B_4-KoG_.css} +1 -1
  74. package/dist/client/assets/{index-B0TkoX1b.js → index-BscyP7Up.js} +1 -1
  75. package/dist/client/assets/{index-DjgN9qrV.js → index-C77ixooi.js} +1 -1
  76. package/dist/client/assets/index-C7yEMUwG.js +1 -0
  77. package/dist/client/assets/{index-nmtbWm5V.js → index-CA228xnt.js} +2 -2
  78. package/dist/client/assets/{index-M_qlHNIS.js → index-CeXie2Ys.js} +1 -1
  79. package/dist/client/assets/{index-Dl2t23Jt.js → index-CzhKzgtD.js} +2 -2
  80. package/dist/client/assets/index-D3A4ePI7.js +1 -0
  81. package/dist/client/assets/index-DI9Yp0oo.js +1 -0
  82. package/dist/client/assets/{index-CwBiuTbX.js → index-DT7Nf9M6.js} +25 -25
  83. package/dist/client/assets/{index-BBrIielu.js → index-DTr35K1t.js} +1 -1
  84. package/dist/client/assets/{index-_TsJo9Ju.js → index-DtIEOBO6.js} +5 -5
  85. package/dist/client/assets/{index-CFyIm5CH.js → index-abagjRmB.js} +1 -1
  86. package/dist/client/assets/index-iDFI-Ppt.js +1 -0
  87. package/dist/client/assets/{infiniteQueryObserver-cqTNhL_G.js → infiniteQueryObserver-d4mpZ_Ot.js} +1 -1
  88. package/dist/client/assets/{input-CluxDyoT.js → input-CNEsKnKX.js} +1 -1
  89. package/dist/client/assets/{integration-icon-BipCD_m-.js → integration-icon-CSgHR76X.js} +1 -1
  90. package/dist/client/assets/{label-CHKFYnQo.js → label-9fjD1g94.js} +1 -1
  91. package/dist/client/assets/{layout-CV5Wi0Ex.js → layout-DEdN-ZCr.js} +1 -1
  92. package/dist/client/assets/{lean-canvas-recruit-modal-CnBIlbd0.js → lean-canvas-recruit-modal-CEK7JzdS.js} +1 -1
  93. package/dist/client/assets/{login-DdkQloeb.js → login-C6yxrHRy.js} +1 -1
  94. package/dist/client/assets/{members-BgSG3QM0.js → members-D68Ow5uj.js} +2 -2
  95. package/dist/client/assets/{monaco-editor-BfaMmupR.js → monaco-editor-Dndvvjot.js} +1 -1
  96. package/dist/client/assets/{monitoring-stats-row-C8V4hqSK.js → monitoring-stats-row-CKay1MEI.js} +1 -1
  97. package/dist/client/assets/{oauth-callback-BaZqye0L.js → oauth-callback-CaaulaeP.js} +1 -1
  98. package/dist/client/assets/{oauth-callback-ai-provider-oz8YNRBq.js → oauth-callback-ai-provider-ChlN62-d.js} +1 -1
  99. package/dist/client/assets/{onboarding-WJDxBlF8.js → onboarding-Dx3oU4tF.js} +1 -1
  100. package/dist/client/assets/{org-layout-Ax0KGzlT.js → org-layout-UCoBgLht.js} +1 -1
  101. package/dist/client/assets/{org-plugin-layout-C5mxyCcm.js → org-plugin-layout-CqAgklZh.js} +1 -1
  102. package/dist/client/assets/{pair-JxQa_xAh.js → pair-D1mFwARy.js} +1 -1
  103. package/dist/client/assets/{plugin-empty-state-C_q24wh6.js → plugin-empty-state-B0cmsL9S.js} +1 -1
  104. package/dist/client/assets/plugin-header-BI8T-ddq.js +1 -0
  105. package/dist/client/assets/{plugin-layout-NPftDH-k.js → plugin-layout-B1I7qSQF.js} +1 -1
  106. package/dist/client/assets/{popover-vU5pf5HQ.js → popover-DJiufSUD.js} +1 -1
  107. package/dist/client/assets/profile-CGXuDNln.js +1 -0
  108. package/dist/client/assets/project-app-view-DP_-ui4r.js +1 -0
  109. package/dist/client/assets/registry-CFvs_APs.js +2 -0
  110. package/dist/client/assets/{registry-layout-D-sbU1qd.js → registry-layout-DIzJFcIj.js} +2 -2
  111. package/dist/client/assets/{required-auth-layout-BYto5m3H.js → required-auth-layout-sXjdshcq.js} +1 -1
  112. package/dist/client/assets/{reset-password-DL944kGr.js → reset-password-cZPjvgcJ.js} +1 -1
  113. package/dist/client/assets/roles-CkThyhxD.js +1 -0
  114. package/dist/client/assets/{scroll-area-D4F3EM5Z.js → scroll-area-DM7jZQf0.js} +1 -1
  115. package/dist/client/assets/{search-input-CslwpPEh.js → search-input-BfUlR4kV.js} +1 -1
  116. package/dist/client/assets/select-WtZOfOpo.js +1 -0
  117. package/dist/client/assets/select-model-Cy_Vxqx-.js +4 -0
  118. package/dist/client/assets/{settings-layout-CFCdg7G4.js → settings-layout-CbLLwkfV.js} +1 -1
  119. package/dist/client/assets/{settings-section-qcMAXuoQ.js → settings-section-R1g2TNeE.js} +1 -1
  120. package/dist/client/assets/{shell-layout-CzPr_0c2.js → shell-layout-I_eJIv1K.js} +1 -1
  121. package/dist/client/assets/{skeleton-eOgaLAHa.js → skeleton-DLLoz0n0.js} +1 -1
  122. package/dist/client/assets/{sso-Dozga0JK.js → sso-CzSINRFs.js} +1 -1
  123. package/dist/client/assets/{store-BA7fLJKJ.js → store-BCviRvz9.js} +1 -1
  124. package/dist/client/assets/store-registry-C9ivXmwu.js +2 -0
  125. package/dist/client/assets/{switch-W_Nrj6rK.js → switch-BH6A3p0g.js} +1 -1
  126. package/dist/client/assets/{table-rVVQNhet.js → table-qL_Cu6WT.js} +1 -1
  127. package/dist/client/assets/{tabs-6T1N4Szc.js → tabs-DIK24gms.js} +1 -1
  128. package/dist/client/assets/{task-status-DsmpMdW6.js → task-status-Bjp5sDvq.js} +1 -1
  129. package/dist/client/assets/{textarea-Cld3tG5R.js → textarea-DVl7iYt4.js} +1 -1
  130. package/dist/client/assets/{toggle-group-COcCk4lG.js → toggle-group-WOk-6cmR.js} +1 -1
  131. package/dist/client/assets/{tools-list-COvHAWAZ.js → tools-list-BAADgwcR.js} +1 -1
  132. package/dist/client/assets/{tooltip-CxizQODk.js → tooltip-DSuAs--v.js} +1 -1
  133. package/dist/client/assets/{types-CvYZZZog.js → types-bCWMch03.js} +1 -1
  134. package/dist/client/assets/{use-ai-providers-Bt2yRX0n.js → use-ai-providers-B7R2KmGt.js} +1 -1
  135. package/dist/client/assets/{use-collections-CwD8DZNY.js → use-collections-DFXlD5a6.js} +1 -1
  136. package/dist/client/assets/{use-connection-pSv7eY2y.js → use-connection-mkdAsO3d.js} +1 -1
  137. package/dist/client/assets/{use-copy-CHAuyAMC.js → use-copy-C4DghPLz.js} +1 -1
  138. package/dist/client/assets/{use-create-virtual-mcp-1DfbQRRy.js → use-create-virtual-mcp-ksck6WCZ.js} +1 -1
  139. package/dist/client/assets/use-debounced-autosave-CLtNf_EP.js +1 -0
  140. package/dist/client/assets/{use-decopilot-events-CXVUS53e.js → use-decopilot-events-BqnGpCsr.js} +1 -1
  141. package/dist/client/assets/{use-delete-connection-BNRuOYcY.js → use-delete-connection-CJCTY6PR.js} +1 -1
  142. package/dist/client/assets/{use-infinite-scroll-Ca5zEcXn.js → use-infinite-scroll-DyWtuvVN.js} +1 -1
  143. package/dist/client/assets/{use-list-state-Jttwyvy3.js → use-list-state-DJhZm6uG.js} +1 -1
  144. package/dist/client/assets/{use-mcp-tools-BdYIFx9S.js → use-mcp-tools-CZiN_apo.js} +1 -1
  145. package/dist/client/assets/{use-members-s6X83kyp.js → use-members-XoLKujIR.js} +1 -1
  146. package/dist/client/assets/{use-navigate-to-agent-Tn-rhKXX.js → use-navigate-to-agent-BJZA0vn3.js} +1 -1
  147. package/dist/client/assets/{use-org-auth-client-CS0Acn4M.js → use-org-auth-client-DFDdOgNz.js} +1 -1
  148. package/dist/client/assets/{use-org-sso-CPzDtjox.js → use-org-sso-ntNZ64id.js} +1 -1
  149. package/dist/client/assets/{use-organization-roles-TW9At1F2.js → use-organization-roles-DvvUCO6J.js} +1 -1
  150. package/dist/client/assets/{use-organization-settings-Dak2xww8.js → use-organization-settings-BcP9GxNe.js} +1 -1
  151. package/dist/client/assets/{use-registry-connections-CMFnR2M3.js → use-registry-connections-C3Shxtge.js} +1 -1
  152. package/dist/client/assets/{use-status-sounds-D0-nlwJm.js → use-status-sounds-BhmdTf72.js} +1 -1
  153. package/dist/client/assets/{use-tasks-yxuEm5KK.js → use-tasks-CFKcirif.js} +1 -1
  154. package/dist/client/assets/{use-view-mode-w75x4zz0.js → use-view-mode-DPFNPRhw.js} +1 -1
  155. package/dist/client/assets/{use-virtual-mcp-BHEEZv3B.js → use-virtual-mcp-D6IJdvj4.js} +1 -1
  156. package/dist/client/assets/useInfiniteQuery-nrn6q72G.js +1 -0
  157. package/dist/client/assets/useSuspenseInfiniteQuery-BQugVIVu.js +1 -0
  158. package/dist/client/assets/{user-QrqGbmQG.js → user-s33U8vUh.js} +1 -1
  159. package/dist/client/assets/{view-mode-toggle-C9HAxT_f.js → view-mode-toggle-DTQbwKIC.js} +1 -1
  160. package/dist/client/assets/workflow-BNc2v09H.js +1 -0
  161. package/dist/client/assets/workflow-detail-Dh3EHXZU.js +1 -0
  162. package/dist/client/index.html +2 -2
  163. package/dist/server/cli.js +1 -1
  164. package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
  165. package/dist/server/node_modules/ansi-styles/index.js +223 -0
  166. package/dist/server/node_modules/ansi-styles/package.json +54 -0
  167. package/dist/server/node_modules/ansi-styles/readme.md +173 -0
  168. package/dist/server/node_modules/environment/index.d.ts +74 -0
  169. package/dist/server/node_modules/environment/index.js +47 -0
  170. package/dist/server/node_modules/environment/package.json +74 -0
  171. package/dist/server/node_modules/environment/readme.md +94 -0
  172. package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
  173. package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
  174. package/dist/server/node_modules/escape-string-regexp/license +9 -0
  175. package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
  176. package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
  177. package/dist/server/node_modules/is-unicode-supported/index.d.ts +12 -0
  178. package/dist/server/node_modules/is-unicode-supported/index.js +21 -0
  179. package/dist/server/node_modules/is-unicode-supported/license +9 -0
  180. package/dist/server/node_modules/is-unicode-supported/package.json +47 -0
  181. package/dist/server/node_modules/is-unicode-supported/readme.md +35 -0
  182. package/dist/server/node_modules/restore-cursor/index.d.ts +11 -0
  183. package/dist/server/node_modules/restore-cursor/index.js +11 -0
  184. package/dist/server/node_modules/restore-cursor/license +9 -0
  185. package/dist/server/node_modules/restore-cursor/package.json +55 -0
  186. package/dist/server/node_modules/restore-cursor/readme.md +31 -0
  187. package/dist/server/node_modules/string-width/index.d.ts +39 -0
  188. package/dist/server/node_modules/string-width/index.js +82 -0
  189. package/dist/server/node_modules/string-width/license +9 -0
  190. package/dist/server/node_modules/string-width/package.json +64 -0
  191. package/dist/server/node_modules/string-width/readme.md +66 -0
  192. package/package.json +1 -1
  193. package/dist/client/assets/ChevronDown-tb8ftSUO.js +0 -1
  194. package/dist/client/assets/Star01-PFA-ZRDO.js +0 -1
  195. package/dist/client/assets/agent-icon-BXkkrCT3.js +0 -1
  196. package/dist/client/assets/agents-list-pk00bfJc.js +0 -1
  197. package/dist/client/assets/ai-providers-Dveb48ZT.js +0 -1
  198. package/dist/client/assets/automation-list-row-Uxaz0oZ0.js +0 -1
  199. package/dist/client/assets/automations-D7r6frZo.js +0 -1
  200. package/dist/client/assets/brand-context-5BxhNz9E.js +0 -1
  201. package/dist/client/assets/checkbox-CzxaEVzA.js +0 -1
  202. package/dist/client/assets/collection-detail-Be4vkD6s.js +0 -1
  203. package/dist/client/assets/collection-display-button-CPI0oCFf.js +0 -1
  204. package/dist/client/assets/connection-detail-CPlnEGaw.js +0 -1
  205. package/dist/client/assets/connections-BhKrBMUX.js +0 -1
  206. package/dist/client/assets/dropdown-menu-C6XDnng5.js +0 -1
  207. package/dist/client/assets/general-CvDecDeA.js +0 -1
  208. package/dist/client/assets/index-B1-8qqRf.js +0 -1
  209. package/dist/client/assets/index-BycfnvwM.js +0 -1
  210. package/dist/client/assets/index-DHF2V7ZS.js +0 -1
  211. package/dist/client/assets/index-DQfkXdA9.js +0 -1
  212. package/dist/client/assets/plugin-header-CBh0Saol.js +0 -1
  213. package/dist/client/assets/profile-CW9gorWX.js +0 -1
  214. package/dist/client/assets/project-app-view-DZI64J4I.js +0 -1
  215. package/dist/client/assets/registry-Q3WKF7CA.js +0 -2
  216. package/dist/client/assets/roles-CJua0nhs.js +0 -1
  217. package/dist/client/assets/select-C0JTp_6a.js +0 -1
  218. package/dist/client/assets/select-model-D0i0wiFX.js +0 -4
  219. package/dist/client/assets/store-registry-D0a7tFCj.js +0 -2
  220. package/dist/client/assets/useInfiniteQuery-3jN4yA7O.js +0 -1
  221. package/dist/client/assets/useSuspenseInfiniteQuery-CEYJOeyf.js +0 -1
  222. package/dist/client/assets/workflow-D70YjEfw.js +0 -1
  223. package/dist/client/assets/workflow-detail-1NvP9qC0.js +0 -1
  224. package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
  225. package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
  226. package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
  227. package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
  228. package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
  229. package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
  230. package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
  231. package/dist/server/node_modules/onetime/index.d.ts +0 -64
  232. package/dist/server/node_modules/onetime/index.js +0 -44
  233. package/dist/server/node_modules/onetime/package.json +0 -43
  234. package/dist/server/node_modules/onetime/readme.md +0 -94
  235. /package/dist/server/node_modules/{get-east-asian-width → ansi-styles}/license +0 -0
  236. /package/dist/server/node_modules/{onetime → environment}/license +0 -0
@@ -1 +0,0 @@
1
- import{r as B,s as Se,K as re,aM as ft,j as s,c as Q,l as xe,B as le,e as q,n as Ye,o as $e,z as ht,C as xt,a as Fe,x as ue,t as Ae,H as Me,aK as _e,J as se,aI as Pe,a_ as Le,y as gt,E as pt,f as bt,d as Tt}from"./index-Dl2t23Jt.js";import{u as Et}from"./use-organization-roles-TW9At1F2.js";import{u as Re}from"./use-org-auth-client-CS0Acn4M.js";import{B as fe}from"./badge-_ZGDO29b.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-BvuFarFf.js";import{D as It,a as _t,b as St,c as Nt}from"./dropdown-menu-C6XDnng5.js";import{i as Ct}from"./DotsVertical-DEE8M0V4.js";import{i as et}from"./Lock01-BmjkKSvK.js";import{s as je}from"./Plus-BrBimbff.js";import{s as jt}from"./Trash01-DaGrAtTq.js";import{C as At}from"./collection-table-wrapper-LzV9CSI7.js";import{P as te}from"./index-Bcf94soS.js";import{E as ke}from"./empty-state-Be0X9mox.js";import{S as Oe}from"./search-input-CslwpPEh.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ve}from"./integration-icon-BipCD_m-.js";import{u as Rt}from"./use-infinite-scroll-Ca5zEcXn.js";import{C as we}from"./checkbox-CzxaEVzA.js";import{i as Ot}from"./RefreshCcw01-Cr84gVY8.js";import{u as vt}from"./useSuspenseInfiniteQuery-CEYJOeyf.js";import{u as wt,S as yt}from"./constants-CfwGLQ49.js";import{C as Mt}from"./collection-search-u94VKjvs.js";import{u as lt}from"./use-members-s6X83kyp.js";import{u as Pt}from"./use-connection-pSv7eY2y.js";import{u as Lt,c as kt}from"./use-ai-providers-Bt2yRX0n.js";import{A as nt}from"./avatar-C4FRugJb.js";import{S as he}from"./switch-W_Nrj6rK.js";import{c as ge,T as pe,a as be,b as Te}from"./tooltip-CxizQODk.js";import{S as De,a as Ge,b as Ue}from"./settings-section-qcMAXuoQ.js";import{t as Dt}from"./ChevronDown-tb8ftSUO.js";import{i as Gt}from"./ChevronRight-BIm0-OSp.js";import{i as Be}from"./X-viKat0oa.js";import"./table-rVVQNhet.js";import"./XClose-DY7O9VST.js";import"./SearchMd-IP-R-mtT.js";import"./Container-BCDxdJoG.js";import"./agent-icon-BXkkrCT3.js";import"./AlertCircle-CbUYZGF-.js";import"./Tool01-D1Rvo01i.js";import"./ArrowNarrowLeft-DHj5-FLY.js";import"./XCircle-DZEMwZj2.js";import"./ArrowUpRight-BK_iYZ-J.js";import"./ZapSquare-BDbWe-zU.js";import"./Users03-DH9QAbco.js";import"./CheckCircle-D9qlmIve.js";import"./ChevronUp-ClqSoLtD.js";import"./Star01-PFA-ZRDO.js";import"./Palette-BrJL0UcN.js";import"./LinkExternal01-DM7IwrPj.js";import"./Sun-B7BWJEHb.js";import"./Play-DSYx2GJ2.js";import"./Settings02-BOckjEVU.js";import"./Shield01-CJggUHAQ.js";import"./User01-DmtseI1g.js";import"./Zap-BMzMPNv3.js";import"./infiniteQueryObserver-cqTNhL_G.js";import"./use-collections-CwD8DZNY.js";import"./card-oSxwoJvZ.js";const ye="basic-usage",ot=[{id:ye,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","AUTOMATION_GET","AUTOMATION_LIST","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","VM_START","VM_DELETE"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS","AI_PROVIDER_CLI_ACTIVATE"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}],Ut=new Set(ot.find(t=>t.id===ye)?.tools??[]);function Bt(){const t=new Map;for(const e of ot){if(e.id===ye)continue;const l=t.get(e.section)??[];l.push(e),t.set(e.section,l)}return Array.from(t.entries()).map(([e,l])=>({section:e,capabilities:l}))}function Vt(t,e,l){return l?!0:t.tools.every(n=>e.includes(n))}function zt(t,e,l){if(l){const o=new Set(e);for(const a of t.tools)o.add(a);return Array.from(o)}const n=new Set(e);for(const o of t.tools)n.delete(o);return Array.from(n)}const Yt=B.memo(function(e){const l=q.c(21),{connection:n,isSelected:o,hasToolsEnabled:a,activeToolsCount:d,totalToolsCount:p,onSelect:m,onToggle:g}=e,h=o?"bg-accent/50":"hover:bg-muted/50";let r;l[0]!==h?(r=Q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",h),l[0]=h,l[1]=r):r=l[1];let x;l[2]!==n.icon||l[3]!==n.title?(x=s.jsx(ve,{icon:n.icon,name:n.title,size:"xs"}),l[2]=n.icon,l[3]=n.title,l[4]=x):x=l[4];let i;l[5]!==n.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),l[5]=n.title,l[6]=i):i=l[6];let c;l[7]!==m||l[8]!==x||l[9]!==i?(c=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:m,children:[x,i]}),l[7]=m,l[8]=x,l[9]=i,l[10]=c):c=l[10];let E;l[11]!==d||l[12]!==n.tools||l[13]!==a||l[14]!==g||l[15]!==p?(E=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",p]}),s.jsx(we,{checked:a,onCheckedChange:g,onClick:Qt})]}),l[11]=d,l[12]=n.tools,l[13]=a,l[14]=g,l[15]=p,l[16]=E):E=l[16];let b;return l[17]!==r||l[18]!==c||l[19]!==E?(b=s.jsxs("div",{className:r,children:[c,E]}),l[17]=r,l[18]=c,l[19]=E,l[20]=b):b=l[20],b}),$t=B.memo(function(e){const l=q.c(18),{connectionId:n,tool:o,isSelected:a,onToggle:d}=e,p=`tool-${n}-${o.name}`,m=a?"text-foreground":"text-muted-foreground";let g;l[0]!==m?(g=Q("text-sm font-medium",m),l[0]=m,l[1]=g):g=l[1];let h;l[2]!==g||l[3]!==o.name?(h=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:g,children:o.name})}),l[2]=g,l[3]=o.name,l[4]=h):h=l[4];let r;l[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),l[5]=o.description,l[6]=r):r=l[6];let x;l[7]!==h||l[8]!==r?(x=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,r]}),l[7]=h,l[8]=r,l[9]=x):x=l[9];const i=`tool-${n}-${o.name}`;let c;l[10]!==a||l[11]!==d||l[12]!==i?(c=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:a,onCheckedChange:d,onClick:Kt})}),l[10]=a,l[11]=d,l[12]=i,l[13]=c):c=l[13];let E;return l[14]!==p||l[15]!==x||l[16]!==c?(E=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[x,c]}),l[14]=p,l[15]=x,l[16]=c,l[17]=E):E=l[17],E});function Ft({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:l,searchQuery:n}){const[o,a]=B.useState(""),d=n!==void 0?n:o,p=B.useDeferredValue(d),[m,g]=B.useState("all"),[h,r]=B.useState(!1),x=B.useRef(new Set(Object.keys(t))),{org:i}=Se(),c=wt({connectionId:yt,orgId:i.id,orgSlug:i.slug}),E=100,b=p.trim(),I=b?{operator:"or",conditions:[{field:["title"],operator:"contains",value:b},{field:["description"],operator:"contains",value:b}]}:void 0,A=!!l,S={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:0,...A&&{include_virtual:!0}},R=JSON.stringify(S),{data:_,fetchNextPage:j,hasNextPage:f,isFetchingNextPage:N}=vt({queryKey:re.collectionListInfinite(c,i.id,"","CONNECTIONS",R),queryFn:async({pageParam:T=0})=>(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:E,offset:T,...A&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(T,k)=>{if(T?.hasMore)return k.reduce((F,ee)=>F+(ee?.items?.length??0),0)},staleTime:3e4}),w=_?.pages.flatMap(T=>T?.items??[])??[],v=Rt(j,f??!1,N),u=l?w.filter(T=>T.connection_type!=="VIRTUAL"?!0:ft(T.connection_url)!==l):w,y=x.current,C=[...y.values()].map(T=>u.find(k=>k.id===T)).filter(T=>T!==void 0),D=u.filter(T=>!y.has(T.id)),G=[...C,...D],$=T=>{const k=t[T];return k!==void 0&&k.length>0},L=G.filter(T=>{if(m==="all")return!0;const k=$(T.id);return m==="selected"?k:m==="unselected"?!k:!0}),[V,z]=B.useState(G[0]?.id??null),O=V?G.find(T=>T.id===V)??null:null,M=O?.tools??[],Y=(T,k)=>t[T]?.includes(k)??!1,K=(T,k)=>{const F=t[T]??[],ee=F.includes(k),H={...t};if(ee){const Z=F.filter(X=>X!==k);Z.length===0?delete H[T]:H[T]=Z}else H[T]=[...F,k];e(H)},J=T=>{const k=G.find(X=>X.id===T);if(!k?.tools)return;const F=t[T]??[],ee=k.tools.map(X=>X.name),H=F.length>0&&ee.every(X=>F.includes(X)),Z={...t};H?delete Z[T]:(Z[T]=ee,z(T)),e(Z)},W=T=>{z(T),r(!0)},ne=()=>{r(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:Q("w-full md:w-80 border-r border-border flex flex-col",h&&"hidden md:flex"),children:[n===void 0&&s.jsx(Mt,{value:o,onChange:a,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:Q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",m==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:L.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":m==="selected"?"No servers selected":m==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[L.map(T=>{const k=T.tools?.length??0,F=t[T.id]?.length??0;return s.jsx(Yt,{connection:T,isSelected:V===T.id,hasToolsEnabled:$(T.id),activeToolsCount:F,totalToolsCount:k,onSelect:()=>W(T.id),onToggle:()=>J(T.id)},T.id)}),s.jsx("div",{ref:v,className:"h-4"}),N&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(xe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:Q("flex-1 flex-col",h?"flex":"hidden md:flex"),children:O?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(le,{variant:"ghost",size:"sm",onClick:ne,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(Ot,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ve,{icon:O.icon,name:O.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:O.title}),O.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:O.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:M.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:M.map(T=>s.jsx($t,{connectionId:O.id,tool:T,isSelected:Y(O.id,T.name),onToggle:()=>K(O.id,T.name)},T.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Qt(t){return t.stopPropagation()}function Kt(t){return t.stopPropagation()}const Ne=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function it(t){if(!t)return"bg-neutral-400";let e=0;for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);e=(e<<5)-e+o,e=e&e}const l=Math.abs(e)%Ne.length;return Ne[l]??Ne[0]}function Ve(t,e){return e?qt[t]??"bg-neutral-400":it(t)}const Ht=Me({role:Me({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:Le(),staticPermissions:_e(se()),toolSet:Pe(se(),_e(se())),allowAllModels:Le(),modelSet:Pe(se(),_e(se())),memberIds:_e(se())});function rt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ze(t,e,l){const n=s.jsx(he,{checked:t,disabled:e,onCheckedChange:l});return e?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:n})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):n}function Zt(t){const e=q.c(28),{allowAllStaticPermissions:l,staticPermissions:n,onAllowAllChange:o,onPermissionsChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d;let g;e[0]!==p?(g=p.trim().toLowerCase(),e[0]=p,e[1]=g):g=e[1];const h=B.useDeferredValue(g);let r;if(e[2]!==l||e[3]!==h||e[4]!==o||e[5]!==a||e[6]!==m||e[7]!==p||e[8]!==n){const x=Bt(),i=(R,_)=>{if(!m){if(l&&_){const j=x.flatMap(Wt).flatMap(Jt);o(!1),a(j.filter(f=>!R.tools.includes(f)));return}l||a(zt(R,n,!_))}};let c;e[10]!==h?(c=R=>{const{section:_,capabilities:j}=R;return{section:_,capabilities:j.filter(f=>!h||f.label.toLowerCase().includes(h)||f.description.toLowerCase().includes(h))}},e[10]=h,e[11]=c):c=e[11];const E=x.map(c).filter(Xt);let b;e[12]!==l||e[13]!==o||e[14]!==a?(b=()=>{o(!l),a([])},e[12]=l,e[13]=o,e[14]=a,e[15]=b):b=e[15];let I;e[16]!==l||e[17]!==m||e[18]!==b?(I=ze(l,m,b),e[16]=l,e[17]=m,e[18]=b,e[19]=I):I=e[19];let A;e[20]!==l||e[21]!==o||e[22]!==a||e[23]!==m?(A=m?void 0:()=>{o(!l),a([])},e[20]=l,e[21]=o,e[22]=a,e[23]=m,e[24]=A):A=e[24];let S;e[25]!==I||e[26]!==A?(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:A})})}),e[25]=I,e[26]=A,e[27]=S):S=e[27],r=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[S,E.length===0&&h?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",p,"”"]}):E.map(R=>{const{section:_,capabilities:j}=R;return s.jsx(De,{title:_,children:s.jsx(Ge,{children:j.map(f=>{const N=Vt(f,n,l);return s.jsx(Ue,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[f.label,f.dangerous&&s.jsx(gt,{size:12,className:"text-amber-500 shrink-0"})]}),description:f.description,action:ze(N,m,()=>i(f,N)),onClick:m?void 0:()=>i(f,N)},f.id)})})},_)})]})}),e[2]=l,e[3]=h,e[4]=o,e[5]=a,e[6]=m,e[7]=p,e[8]=n,e[9]=r}else r=e[9];return r}function Xt(t){return t.capabilities.length>0}function Jt(t){return t.tools}function Wt(t){return t.capabilities}const at={anthropic:"Anthropic",openrouter:"OpenRouter"},es={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ts(t,e){const l=t.indexOf("/"),n=l>0?t.slice(0,l):e;return n.startsWith("~")?n.slice(1):n}function ss(t){return es[t]??at[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const ct=30;function ns(t){const e=q.c(44),{connectionId:l,subProviderId:n,subProviderName:o,groupLogo:a,models:d,allConnectionModelIds:p,selectedModels:m,allowAllModels:g,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:x,readOnly:i,defaultExpanded:c}=t,[E,b]=B.useState(c),I=c||E,A=b,[S,R]=B.useState(ct);let _;e[0]!==h||e[1]!==g||e[2]!==m?(_=v=>g||h||m.includes("*")||m.includes(v),e[0]=h,e[1]=g,e[2]=m,e[3]=_):_=e[3];const j=_;let f;if(e[4]!==j||e[5]!==d){let v;e[7]!==j?(v=u=>j(u.id),e[7]=j,e[8]=v):v=e[8],f=d.filter(v),e[4]=j,e[5]=d,e[6]=f}else f=e[6];const N=f.length;let w;if(e[9]!==p||e[10]!==g||e[11]!==l||e[12]!==N||e[13]!==I||e[14]!==a||e[15]!==j||e[16]!==d||e[17]!==x||e[18]!==r||e[19]!==i||e[20]!==n||e[21]!==o||e[22]!==S){const v=d.slice(0,S),u=d.length>S;let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=()=>A(as),e[24]=y):y=e[24];const C=a??tt[n]??st;let D;e[25]!==o||e[26]!==C?(D=s.jsx(ve,{icon:C,name:o,size:"sm"}),e[25]=o,e[26]=C,e[27]=D):D=e[27];let G;e[28]!==o?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=G):G=e[29];let $;e[30]!==D||e[31]!==G?($=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[D,G]}),e[30]=D,e[31]=G,e[32]=$):$=e[32];let L;e[33]!==N||e[34]!==d.length?(L=s.jsxs(fe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[N,"/",d.length," enabled"]}),e[33]=N,e[34]=d.length,e[35]=L):L=e[35];let V;e[36]!==I?(V=I?s.jsx(Dt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Gt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=I,e[37]=V):V=e[37];let z;e[38]!==V||e[39]!==L?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[L,V]}),e[38]=V,e[39]=L,e[40]=z):z=e[40];let O;e[41]!==z||e[42]!==$?(O=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:y,children:[$,z]}),e[41]=z,e[42]=$,e[43]=O):O=e[43],w=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[O,I&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[v.map(M=>{const Y=j(M.id),K=()=>{if(!i){if(g){x(l,p,M.id);return}r(l,M.id)}};return s.jsxs("div",{className:Q("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:K,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:rs,children:i?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:Y,disabled:!0,onCheckedChange:is})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:Y,onCheckedChange:K})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>R(os),children:["Show more (",d.length-S," remaining)"]})]})]}),e[9]=p,e[10]=g,e[11]=l,e[12]=N,e[13]=I,e[14]=a,e[15]=j,e[16]=d,e[17]=x,e[18]=r,e[19]=i,e[20]=n,e[21]=o,e[22]=S,e[23]=w}else w=e[23];return w}function os(t){return t+ct}function is(){}function rs(t){return t.stopPropagation()}function as(t){return!t}function cs(t){const e=q.c(33),{connection:l,selectedModels:n,allowAllModels:o,onToggleModel:a,onExitAllowAll:d,allConnectionModelsSelected:p,searchQuery:m,readOnly:g}=t,h=kt(l.id);let r,x,i,c,E;if(e[0]!==p||e[1]!==o||e[2]!==l.id||e[3]!==l.label||e[4]!==l.providerId||e[5]!==d||e[6]!==a||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==n){E=Symbol.for("react.early_return_sentinel");e:{let A;e[16]!==l.label?(A=C=>({...C,id:C.modelId,provider:l.label}),e[16]=l.label,e[17]=A):A=e[17];const S=h.filter(fs).map(A),R=m.trim().toLowerCase(),_=R?S.filter(C=>C.title.toLowerCase().includes(R)||C.id.toLowerCase().includes(R)||C.provider?.toLowerCase().includes(R)):S;if(_.length===0){E=null;break e}const j=new Map;for(const C of _){const D=ts(C.id,l.providerId),G=j.get(D)??{models:[],logo:null};G.models.push({id:C.id,title:ls(C.title),logo:C.logo}),!G.logo&&C.logo&&(G.logo=C.logo),j.set(D,G)}const f=Array.from(j.entries()).map(us).sort(ms),N=f.length===1||R.length>0;i="flex flex-col gap-3";const w=tt[l.providerId]??st;let v;e[18]!==l.providerId||e[19]!==w?(v=s.jsx("img",{src:w,alt:l.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=l.providerId,e[19]=w,e[20]=v):v=e[20];const u=at[l.providerId]??l.providerId;let y;e[21]!==u?(y=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=y):y=e[22],e[23]!==y||e[24]!==v?(c=s.jsxs("div",{className:"flex items-center gap-2",children:[v,y]}),e[23]=y,e[24]=v,e[25]=c):c=e[25],r="flex flex-col gap-3",x=f.map(C=>s.jsx(ns,{connectionId:l.id,subProviderId:C.id,subProviderName:C.name,groupLogo:C.logo,models:C.models,allConnectionModelIds:S.map(ds),selectedModels:n,allowAllModels:o,allConnectionModelsSelected:p,onToggleModel:a,onExitAllowAll:d,readOnly:g,defaultExpanded:N},C.id))}e[0]=p,e[1]=o,e[2]=l.id,e[3]=l.label,e[4]=l.providerId,e[5]=d,e[6]=a,e[7]=h,e[8]=g,e[9]=m,e[10]=n,e[11]=r,e[12]=x,e[13]=i,e[14]=c,e[15]=E}else r=e[11],x=e[12],i=e[13],c=e[14],E=e[15];if(E!==Symbol.for("react.early_return_sentinel"))return E;let b;e[26]!==r||e[27]!==x?(b=s.jsx("div",{className:r,children:x}),e[26]=r,e[27]=x,e[28]=b):b=e[28];let I;return e[29]!==i||e[30]!==c||e[31]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[29]=i,e[30]=c,e[31]=b,e[32]=I):I=e[32],I}function ds(t){return t.id}function ms(t,e){return t.name.localeCompare(e.name)}function us(t){const[e,l]=t;return{id:e,name:ss(e),logo:l.logo,models:l.models}}function fs(t,e,l){return l.findIndex(n=>n.modelId===t.modelId)===e}function hs(t){const e=q.c(35),{allowAllModels:l,modelSet:n,onAllowAllChange:o,onModelSetChange:a,readOnly:d,searchQuery:p}=t,m=d===void 0?!1:d,g=B.useDeferredValue(p),h=Lt();let r;e[0]!==n||e[1]!==a?(r=(f,N)=>{const w=n[f]??[],v={...n};if(w.includes(N)){const u=w.filter(y=>y!==N);u.length===0?delete v[f]:v[f]=u}else v[f]=[...w,N];a(v)},e[0]=n,e[1]=a,e[2]=r):r=e[2];const x=r;let i;e[3]!==n||e[4]!==o||e[5]!==a?(i=(f,N,w)=>{o(!1),a({...n,[f]:N.filter(v=>v!==w)})},e[3]=n,e[4]=o,e[5]=a,e[6]=i):i=e[6];const c=i,E=!m&&"hover:bg-muted/50 cursor-pointer";let b;e[7]!==E?(b=Q("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",E),e[7]=E,e[8]=b):b=e[8];let I;e[9]!==l||e[10]!==o||e[11]!==a||e[12]!==m?(I=()=>{if(m)return;const f=!l;o(f),f&&a({})},e[9]=l,e[10]=o,e[11]=a,e[12]=m,e[13]=I):I=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=A):A=e[14];let S;e[15]!==l||e[16]!==o||e[17]!==a||e[18]!==m?(S=s.jsx("div",{onClick:gs,children:m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(he,{checked:l,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(he,{checked:l,onCheckedChange:f=>{o(f),f&&a({})}})}),e[15]=l,e[16]=o,e[17]=a,e[18]=m,e[19]=S):S=e[19];let R;e[20]!==b||e[21]!==I||e[22]!==S?(R=s.jsxs("div",{className:b,onClick:I,children:[A,S]}),e[20]=b,e[21]=I,e[22]=S,e[23]=R):R=e[23];let _;e[24]!==h||e[25]!==l||e[26]!==g||e[27]!==c||e[28]!==n||e[29]!==m||e[30]!==x?(_=h.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):h.map(f=>s.jsx(B.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(xe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(cs,{connection:f,selectedModels:n[f.id]??[],allowAllModels:l,onToggleModel:x,onExitAllowAll:c,allConnectionModelsSelected:(n[f.id]??[]).includes("*"),searchQuery:g,readOnly:m})},f.id)),e[24]=h,e[25]=l,e[26]=g,e[27]=c,e[28]=n,e[29]=m,e[30]=x,e[31]=_):_=e[31];let j;return e[32]!==_||e[33]!==R?(j=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[R,_]}),e[32]=_,e[33]=R,e[34]=j):j=e[34],j}function xs(){}function gs(t){return t.stopPropagation()}function ps(t){const e=q.c(52),{open:l,onOpenChange:n,selectedMemberIds:o,onAddMembers:a}=t,[d,p]=B.useState(""),m=B.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[h,r]=B.useState(g),{data:x}=lt();let i,c,E,b,I,A,S,R,_,j,f;if(e[1]!==x?.data?.members||e[2]!==m||e[3]!==a||e[4]!==n||e[5]!==l||e[6]!==h||e[7]!==d||e[8]!==o){const $=x?.data?.members??[];let L;e[20]!==m?(L=O=>{const M=m.toLowerCase();return O.user?.name?.toLowerCase().includes(M)||O.user?.email?.toLowerCase().includes(M)},e[20]=m,e[21]=L):L=e[21];const V=$.filter(L);let z;e[22]!==a||e[23]!==n||e[24]!==h?(z=()=>{a(h),r([]),n(!1)},e[22]=a,e[23]=n,e[24]=h,e[25]=z):z=e[25],E=z,c=Qe,j=l,f=n,i=Ke,R="sm:max-w-md p-0 overflow-hidden",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(He,{children:"Add Members to Role"}),s.jsx(Ze,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],A="flex flex-col h-80",e[27]!==d?(S=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Oe,{value:d,onChange:p,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=S):S=e[28],b="flex-1 overflow-auto",I=V.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:V.map(O=>{const M=O.role!=="owner",Y=o.includes(O.id),K=h.includes(O.id);return s.jsxs("label",{className:Q("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:K||Y,onCheckedChange:()=>{!M||Y||r(J=>J.includes(O.id)?J.filter(W=>W!==O.id):[...J,O.id])},disabled:!M||Y}),s.jsx(nt,{url:O.user?.image??void 0,fallback:rt(O.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:O.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:O.user?.email})]}),!M&&s.jsx(fe,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(fe,{variant:"outline",className:"shrink-0",children:"Added"})]},O.id)})}),e[1]=x?.data?.members,e[2]=m,e[3]=a,e[4]=n,e[5]=l,e[6]=h,e[7]=d,e[8]=o,e[9]=i,e[10]=c,e[11]=E,e[12]=b,e[13]=I,e[14]=A,e[15]=S,e[16]=R,e[17]=_,e[18]=j,e[19]=f}else i=e[9],c=e[10],E=e[11],b=e[12],I=e[13],A=e[14],S=e[15],R=e[16],_=e[17],j=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]!==A||e[34]!==S?(w=s.jsxs("div",{className:A,children:[S,N]}),e[32]=N,e[33]=A,e[34]=S,e[35]=w):w=e[35];let v;e[36]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Xe,{children:"Cancel"}),e[36]=v):v=e[36];const u=h.length===0,y=h.length>0&&`(${h.length})`;let C;e[37]!==E||e[38]!==u||e[39]!==y?(C=s.jsxs(Je,{className:"px-6 pb-6",children:[v,s.jsxs(We,{onClick:E,disabled:u,children:["Add ",y]})]}),e[37]=E,e[38]=u,e[39]=y,e[40]=C):C=e[40];let D;e[41]!==i||e[42]!==w||e[43]!==C||e[44]!==R||e[45]!==_?(D=s.jsxs(i,{className:R,children:[_,w,C]}),e[41]=i,e[42]=w,e[43]=C,e[44]=R,e[45]=_,e[46]=D):D=e[46];let G;return e[47]!==c||e[48]!==D||e[49]!==j||e[50]!==f?(G=s.jsx(c,{open:j,onOpenChange:f,children:D}),e[47]=c,e[48]=D,e[49]=j,e[50]=f,e[51]=G):G=e[51],G}function bs(t){const e=q.c(28),{memberIds:l,onMemberIdsChange:n,readOnly:o,searchQuery:a,addMemberDialogOpen:d,onAddMemberDialogOpenChange:p}=t,m=o===void 0?!1:o,g=B.useDeferredValue(a),{data:h}=lt();let r,x,i;if(e[0]!==h?.data?.members||e[1]!==g||e[2]!==l||e[3]!==n||e[4]!==m||e[5]!==a){const A=h?.data?.members??[];let S;e[9]!==l?(S=f=>l.includes(f.id),e[9]=l,e[10]=S):S=e[10];const R=A.filter(S);let _;e[11]!==g?(_=f=>{const N=g.toLowerCase();return f.user?.name?.toLowerCase().includes(N)||f.user?.email?.toLowerCase().includes(N)},e[11]=g,e[12]=_):_=e[12];const j=R.filter(_);i="flex flex-col h-full",r="flex-1 overflow-auto",x=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):j.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:j.map(f=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(nt,{url:f.user?.image??void 0,fallback:rt(f.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:f.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.user?.email})]}),m?s.jsx(ge,{children:s.jsxs(pe,{children:[s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsx(le,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Be,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n(l.filter(N=>N!==f.id)),children:s.jsx(Be,{size:16})})]},f.id))}),e[0]=h?.data?.members,e[1]=g,e[2]=l,e[3]=n,e[4]=m,e[5]=a,e[6]=r,e[7]=x,e[8]=i}else r=e[6],x=e[7],i=e[8];let c;e[13]!==r||e[14]!==x?(c=s.jsx("div",{className:r,children:x}),e[13]=r,e[14]=x,e[15]=c):c=e[15];let E;e[16]!==l||e[17]!==n?(E=A=>n([...l,...A]),e[16]=l,e[17]=n,e[18]=E):E=e[18];let b;e[19]!==d||e[20]!==l||e[21]!==p||e[22]!==E?(b=s.jsx(ps,{open:d,onOpenChange:p,selectedMemberIds:l,onAddMembers:E}),e[19]=d,e[20]=l,e[21]=p,e[22]=E,e[23]=b):b=e[23];let I;return e[24]!==i||e[25]!==c||e[26]!==b?(I=s.jsxs("div",{className:i,children:[c,b]}),e[24]=i,e[25]=c,e[26]=b,e[27]=I):I=e[27],I}function Ts(t){const e=q.c(3);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=l):l=e[0];let n;return e[1]!==t?(n=s.jsx(B.Suspense,{fallback:l,children:s.jsx(bs,{...t})}),e[1]=t,e[2]=n):n=e[2],n}const Es={owner:[],admin:[],user:[]};function Is(t,e,l,n){if(l?.permission!=null&&n)return dt({id:l.id,role:t,label:t.charAt(0).toUpperCase()+t.slice(1),permission:l.permission},e,n);const o=t==="owner"||t==="admin";return{role:{id:l?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:Es[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(a=>a.role===t).map(a=>a.id)}}function dt(t,e,l){const n=t.permission||{},o=n.self||[],a=o.includes("*"),d=a?[]:o.filter(r=>r!=="*"),p={};for(const[r,x]of Object.entries(n))if(!(r==="self"||r==="models"))if(r==="*")for(const i of l)p[i.id]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x;else{const i=l.find(c=>c.id===r);i&&(p[r]=x.includes("*")?i.tools?.map(c=>c.name)??[]:x)}const m=n.models||[],g=m.length===0||m.includes("*:*"),h={};if(!g)for(const r of m){const x=r.indexOf(":");if(x===-1)continue;const i=r.slice(0,x),c=r.slice(x+1);h[i]||(h[i]=[]),h[i].push(c)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:a,staticPermissions:d,toolSet:p,allowAllModels:g,modelSet:h,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function _s(t,e){const l={};if(t.allowAllStaticPermissions)l.self=["*"];else{const n=new Set(t.staticPermissions);for(const o of Ut)n.add(o);n.size>0&&(l.self=Array.from(n))}for(const[n,o]of Object.entries(t.toolSet))if(o.length>0){const d=e.find(p=>p.id===n)?.tools?.map(p=>p.name)??[];l[n]=d.length>0&&d.every(p=>o.includes(p))?["*"]:o}if(t.allowAllModels)l.models=["*:*"];else{const n=[];for(const[o,a]of Object.entries(t.modelSet))for(const d of a)n.push(`${o}:${d}`);n.length>0&&(l.models=n)}return l}function Ss(t,e,l){return t.kind==="builtin"?Is(t.role,e,t.storedId!=null?{id:t.storedId,permission:t.storedPermission}:void 0,l):t.kind==="custom"?dt(t.role,e,l):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ns(t){const e=q.c(5),{readOnly:l,onOpen:n}=t;if(l){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(be,{asChild:!0,children:s.jsx("div",{children:s.jsxs(le,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(je,{size:16}),"Add Member"]})})}),e[0]=d):d=e[0];let p;return e[1]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ge,{children:s.jsxs(pe,{children:[d,s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}),e[1]=p):p=e[1],p}let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(je,{size:16}),e[2]=o):o=e[2];let a;return e[3]!==n?(a=s.jsxs(le,{variant:"outline",size:"sm",onClick:n,children:[o,"Add Member"]}),e[3]=n,e[4]=a):a=e[4],a}function Cs(t){const e=q.c(14),{locator:l}=Se(),n=Re(),o=Pt();let a;e[0]!==l?(a=re.members(l),e[0]=l,e[1]=a):a=e[1];let d;e[2]!==n?(d=()=>n.organization.listMembers(),e[2]=n,e[3]=d):d=e[3];let p;e[4]!==a||e[5]!==d?(p={queryKey:a,queryFn:d},e[4]=a,e[5]=d,e[6]=p):p=e[6];const{data:m,isPending:g}=Ye(p);if(g||!o){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=i):i=e[7],i}let h;e[8]!==m?.data?.members?(h=m?.data?.members??[],e[8]=m?.data?.members,e[9]=h):h=e[9];const r=h;let x;return e[10]!==o||e[11]!==r||e[12]!==t?(x=s.jsx(js,{...t,members:r,connections:o}),e[10]=o,e[11]=r,e[12]=t,e[13]=x):x=e[13],x}function js({target:t,onBack:e,onSaved:l,members:n,connections:o}){const{locator:a}=Se(),d=Re(),p=$e(),m=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",h=t.kind==="new",[r,x]=B.useState(m?"org":"mcp"),i=ht({resolver:xt(Ht),defaultValues:Ss(t,n,o)}),c=i.formState.isValid,E=i.formState.isDirty,b=Fe({mutationFn:async u=>{const y=_s(u,o),C=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),D=u.role.slug==="owner"&&!u.role.id,G=(u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,$=async L=>{const V=n.filter(M=>M.role===L).map(M=>M.id),z=u.memberIds.filter(M=>!V.includes(M)),O=V.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[L]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of O){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(D)return await $("owner"),u;if(u.role.id){const L=await d.organization.updateRole({roleId:u.role.id,data:{permission:y}});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),u}else if(G){const L=await d.organization.createRole({role:u.role.slug,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");return await $(u.role.slug),{...u,role:{...u.role,id:L.data?.roleData?.id}}}else{const L=await d.organization.createRole({role:C,permission:y});if(L?.error)throw new Error(L.error.message??"Something went wrong");for(const V of u.memberIds){const z=await d.organization.updateMemberRole({memberId:V,role:[C]});if(z?.error)throw new Error(z.error.message)}return{...u,role:{...u.role,id:L.data?.roleData?.id,slug:C}}}},onSuccess:(u,y)=>{p.invalidateQueries({queryKey:re.members(a)}),p.invalidateQueries({queryKey:re.organizationRoles(a)});const C=!y.role.id&&!y.role.slug,D=y.role.slug==="owner"&&!y.role.id;Ae(D?"role_members_updated":C?"role_created":"role_updated",{role_slug:y.role.slug??null}),ue.success(D?"Members updated successfully!":C?"Role created successfully!":"Role updated successfully!"),i.reset(u),l(u.role.id)},onError:u=>{ue.error(u instanceof Error?u.message:"Failed to save role")}}),I=i.handleSubmit(u=>{if(!u.role.label.trim()){ue.error("Role name is required"),i.setFocus("role.label");return}b.mutate(u)}),A=!g,S=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",R=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,j]=B.useState(""),[f,N]=B.useState(!1),w=u=>{x(u),j("")},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:A&&s.jsxs(s.Fragment,{children:[s.jsx(le,{variant:"outline",size:"sm",onClick:e,disabled:b.isPending,children:"Cancel"}),s.jsx(le,{size:"sm",onClick:I,disabled:b.isPending||!c||!E,children:b.isPending?"Saving...":h?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Ve(t.role,!0):t.kind==="custom"?Ve(t.role.role,!1):it(i.watch("role.label")))}),g&&s.jsx(et,{size:16,className:"text-muted-foreground shrink-0"}),h?s.jsx("input",{...i.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:!0}):s.jsx("span",{className:"truncate",children:S})]})}),s.jsx("div",{className:"flex items-center gap-2",children:R.map(u=>s.jsx("button",{type:"button",onClick:()=>w(u.id),className:Q("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",r===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Oe,{value:_,onChange:j,placeholder:v[r]??"Search...",className:"w-full md:w-[375px]"}),r==="members"&&s.jsx(Ns,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>N(!0)})]})]})}),s.jsx("div",{className:Q("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",r!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:Q(r!=="org"&&"h-full overflow-hidden",r!=="models"&&r!=="org"&&"border border-border rounded-xl bg-card"),children:[r==="mcp"&&!g&&s.jsx(Ft,{toolSet:i.watch("toolSet"),onToolSetChange:u=>i.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),r==="org"&&s.jsx(Zt,{allowAllStaticPermissions:i.watch("allowAllStaticPermissions"),staticPermissions:i.watch("staticPermissions"),onAllowAllChange:u=>i.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>i.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="models"&&s.jsx(hs,{allowAllModels:i.watch("allowAllModels"),modelSet:i.watch("modelSet"),onAllowAllChange:u=>i.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>i.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),r==="members"&&s.jsx(Ts,{memberIds:i.watch("memberIds"),onMemberIdsChange:u=>i.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&t.role==="owner",searchQuery:_,addMemberDialogOpen:f,onAddMemberDialogOpenChange:N})]})})]})})}function As(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}const Rs=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Os(t){if(!t)return"bg-neutral-400";let e=0;for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);e=(e<<5)-e+o,e=e&e}const l=Math.abs(e)%Ce.length;return Ce[l]??Ce[0]}const vs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ws(t,e){return e?vs[t]??"bg-neutral-400":Os(t)}function ys(){const t=q.c(77),[e,l]=B.useState(""),[n,o]=B.useState(null),a=bt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:p}=Tt(d),{locator:m}=Se(),g=Re(),h=$e(),{customRoles:r,refetch:x}=Et();let i;t[1]!==a?(i=P=>a({to:".",search:U=>({...U,role:P})}),t[1]=a,t[2]=i):i=t[2];const c=i;let E;e:{if(!p){E=null;break e}if(p==="new"){E={kind:"new"};break e}if(p.startsWith("builtin-")){E={kind:"builtin",role:p.slice(8)};break e}let P;t[3]!==p?(P=oe=>oe.id===p,t[3]=p,t[4]=P):P=t[4];const U=r.find(P);E=U?{kind:"custom",role:U}:null}const b=E;let I;t[5]!==m?(I=re.members(m),t[5]=m,t[6]=I):I=t[6];let A;t[7]!==g?(A=()=>g.organization.listMembers(),t[7]=g,t[8]=A):A=t[8];let S;t[9]!==I||t[10]!==A?(S={queryKey:I,queryFn:A},t[9]=I,t[10]=A,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 j=_;let f;t[14]!==j?(f=P=>j.filter(U=>U.role===P).length,t[14]=j,t[15]=f):f=t[15];const N=f;let w;if(t[16]!==r||t[17]!==N||t[18]!==e){let P;t[20]!==N?(P=ie=>({kind:"builtin",role:{...ie,memberCount:N(ie.role)}}),t[20]=N,t[21]=P):P=t[21];const U=Rs.map(P);let oe;t[22]!==N?(oe=ie=>({kind:"custom",role:{...ie,memberCount:N(ie.role)}}),t[22]=N,t[23]=oe):oe=t[23];const mt=r.map(oe);if(w=[...U,...mt],e){const ie=e.toLowerCase();w=w.filter(ut=>ut.role.label.toLowerCase().includes(ie))}t[16]=r,t[17]=N,t[18]=e,t[19]=w}else w=t[19];let v;t[24]!==g?(v=async P=>{const U=await g.organization.deleteRole({roleId:P});if(U?.error)throw new Error(U.error.message);return U?.data},t[24]=g,t[25]=v):v=t[25];const u=Fe({mutationFn:v,onSuccess:(P,U)=>{Ae("role_deleted",{role_id:U}),h.invalidateQueries({queryKey:re.members(m)}),h.invalidateQueries({queryKey:re.organizationRoles(m)}),ue.success("Role deleted successfully!"),x(),b?.kind==="custom"&&b.role.id===U&&c(void 0)},onError:Us});let y,C,D,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Gs,cellClassName:"flex-1 min-w-0",sortable:!0},y={id:"type",header:"Type",render:Ds,cellClassName:"w-28 shrink-0"},C={id:"permissions",header:"Permissions",render:ks,cellClassName:"flex-1 min-w-0"},D={id:"members",header:"Members",render:Ls,cellClassName:"w-24 shrink-0"},t[26]=y,t[27]=C,t[28]=D,t[29]=G):(y=t[26],C=t[27],D=t[28],G=t[29]);let $;t[30]===Symbol.for("react.memo_cache_sentinel")?($=[G,y,C,D,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(It,{children:[s.jsx(_t,{asChild:!0,children:s.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ps,children:s.jsx(Ct,{size:16})})}),s.jsx(St,{align:"end",onClick:Ms,children:s.jsxs(Nt,{variant:"destructive",onClick:()=>{const U=P.role;U.id&&o({id:U.id,label:U.label})},children:[s.jsx(jt,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=$):$=t[30];const L=$;let V;t[31]!==c?(V=P=>{if(P.kind==="builtin")c(`builtin-${P.role.role}`);else{const U=P.role;c(U.id)}},t[31]=c,t[32]=V):V=t[32];const z=V;if(b){let P;t[33]!==c?(P=()=>c(void 0),t[33]=c,t[34]=P):P=t[34];let U;return t[35]!==x||t[36]!==c?(U=()=>{x(),c(void 0)},t[35]=x,t[36]=c,t[37]=U):U=t[37],s.jsx(Cs,{target:b,onBack:P,onSaved:U},As(b))}let O;t[38]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(te.Title,{children:"Roles"}),t[38]=O):O=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(l(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(Oe,{value:e,onChange:l,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let K;t[42]!==c?(K=()=>c("new"),t[42]=c,t[43]=K):K=t[43];let J;t[44]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(je,{size:16}),t[44]=J):J=t[44];let W;t[45]!==K?(W=s.jsxs(le,{onClick:K,children:[J,"Create Role"]}),t[45]=K,t[46]=W):W=t[46];let ne;t[47]!==Y||t[48]!==W?(ne=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,W]}),t[47]=Y,t[48]=W,t[49]=ne):ne=t[49];let T;t[50]!==e?(T=e?s.jsx(ke,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(ke,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=T):T=t[51];let k;t[52]!==w||t[53]!==L||t[54]!==z||t[55]!==T?(k=s.jsx(At,{columns:L,data:w,isLoading:!1,onRowClick:z,emptyState:T}),t[52]=w,t[53]=L,t[54]=z,t[55]=T,t[56]=k):k=t[56];let F;t[57]!==ne||t[58]!==k?(F=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[O,ne,k]})})}),t[57]=ne,t[58]=k,t[59]=F):F=t[59];const ee=n!==null;let H;t[60]===Symbol.for("react.memo_cache_sentinel")?(H=P=>!P&&o(null),t[60]=H):H=t[60];let Z;t[61]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(He,{children:"Delete Role"}),t[61]=Z):Z=t[61];const X=n?.label;let ae;t[62]!==X?(ae=s.jsxs(qe,{children:[Z,s.jsxs(Ze,{children:['Are you sure you want to delete the "',X,'" role? This action cannot be undone.']})]}),t[62]=X,t[63]=ae):ae=t[63];let Ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Xe,{children:"Cancel"}),t[64]=Ee):Ee=t[64];let ce;t[65]!==u||t[66]!==n?(ce=s.jsxs(Je,{children:[Ee,s.jsx(We,{onClick:()=>{n?.id&&u.mutate(n.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=n,t[67]=ce):ce=t[67];let de;t[68]!==ae||t[69]!==ce?(de=s.jsxs(Ke,{children:[ae,ce]}),t[68]=ae,t[69]=ce,t[70]=de):de=t[70];let me;t[71]!==ee||t[72]!==de?(me=s.jsx(Qe,{open:ee,onOpenChange:H,children:de}),t[71]=ee,t[72]=de,t[73]=me):me=t[73];let Ie;return t[74]!==F||t[75]!==me?(Ie=s.jsxs(te,{children:[F,me]}),t[74]=F,t[75]=me,t[76]=Ie):Ie=t[76],Ie}function Ms(t){return t.stopPropagation()}function Ps(t){return t.stopPropagation()}function Ls(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function ks(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,l=[];return e.allowsAllStaticPermissions?l.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&l.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?l.push("All connections"):e.connectionCount&&e.connectionCount>0&&l.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:l.length>0?l.join(", "):"No permissions"})}function Ds(t){return t.kind==="builtin"?s.jsx(fe,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(fe,{variant:"outline",className:"text-xs",children:"Custom"})}function Gs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:Q("size-2.5 rounded-full shrink-0",ws(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(et,{size:12,className:"text-muted-foreground shrink-0"})]})}function Us(t,e){Ae("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 $l(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(pt,{fallback:e,children:s.jsx(B.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(ys,{})})}),t[1]=l):l=t[1],l}export{$l as default};
@@ -1 +0,0 @@
1
- import{r as i,aS as nt,aT as Pe,j as d,c4 as rt,aU as be,b6 as k,c5 as st,a7 as j,a8 as N,cE as $,c6 as lt,ao as _e,c7 as Ee,b9 as at,b7 as ct,a4 as it,c8 as dt,cb as ut,c9 as pt,cc as ft,cd as mt,ae as ht,ca as vt,ce as gt,cf as xt,e as ee,c as oe}from"./index-Dl2t23Jt.js";import{V as St}from"./tooltip-CxizQODk.js";import{t as Re,i as wt}from"./ChevronDown-tb8ftSUO.js";import{n as Ct}from"./ChevronUp-ClqSoLtD.js";function Ne(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=ht(J,[bt,Ee]),pe=Ee(),[Tt,G]=ne(J),[Pt,Nt]=ne(J),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[U,M]=i.useState(!1),re=nt(u),[_,O]=Pe({prop:o,defaultProp:n??!1,onChange:c,caller:J}),[F,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:J}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=i.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:b,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:N(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:N(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:N(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var Q="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(Q,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(Q,t),[x,U]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>U(f)),[O,F]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[W,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(F(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:N(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:N(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(Q,t),s=Y(Q,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,P=F.left-I,X=_.left-P,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-F.right-I,X=window.innerWidth-_.right-P,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,se+(I?he:0)+P+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[U,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Ue=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:N(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=Fe;var We="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(We,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=We;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:N(s.onFocus,()=>w(!0)),onBlur:N(s.onBlur,()=>w(!1)),onClick:N(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:N(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:N(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Nt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Xe=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Je,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Je=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:N(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:N(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:N(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Qe=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Qe.displayName=Ft;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Wt(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Wt(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Jt=$e,Qt=Ge,eo=qe,to=Xe,oo=Ze;function io(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function fo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Zt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function mo(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{io as S,po as a,uo as b,fo as c,mo as d,Ne as e};
@@ -1,4 +0,0 @@
1
- import{r as R,ao as At,H as se,J as D,aK as Ce,aI as we,a_ as Ie,aJ as Le,e as B,j as l,E as Xe,s as ie,o as be,a as le,K as G,n as Je,c as oe,z as ke,C as Ee,x as Y,D as _e,t as J,B as te,M as Ze,u as Ot,f as Tt,y as Pt}from"./index-Dl2t23Jt.js";import{C as Rt}from"./checkbox-CzxaEVzA.js";import{I as ne}from"./input-CluxDyoT.js";import{b as Me,a as Ae,c as et,d as Oe,e as tt,D as st,h as Lt}from"./dialog-CoECADf1.js";import{g as zt,D as Ft,a as Dt,b as Kt}from"./drawer-DTk8g2vK.js";import{u as $t}from"./tooltip-CxizQODk.js";import{S as Ut,a as Bt,b as Vt,c as Wt,d as qt}from"./select-C0JTp_6a.js";import{S as Q}from"./skeleton-eOgaLAHa.js";import{i as Ht,t as Qt,b as Yt,a as Gt,c as Xt}from"./Tool01-D1Rvo01i.js";import{b as lt,s as it,c as Jt,a as Zt,i as es}from"./RefreshCcw01-Cr84gVY8.js";import{t as ze}from"./ChevronDown-tb8ftSUO.js";import{a as nt,i as ot}from"./SearchMd-IP-R-mtT.js";import{a as ts}from"./Settings02-BOckjEVU.js";import{u as he,b as rt,a as ge}from"./use-ai-providers-Bt2yRX0n.js";import{p as Fe,b as at}from"./chat-context-C4Hx_rZK.js";import{g as Te}from"./ai-providers-logos-DD3qZ33J.js";import{i as ss}from"./Zap-BMzMPNv3.js";import{i as ls}from"./AlertCircle-CbUYZGF-.js";import{i as is}from"./CheckCircle-D9qlmIve.js";import{s as ns}from"./Trash01-DaGrAtTq.js";import{P as ye}from"./index-Bcf94soS.js";import{d as os,S as je,a as Se,b as fe}from"./settings-section-qcMAXuoQ.js";import{S as rs}from"./switch-W_Nrj6rK.js";import{a as De,T as as}from"./toggle-group-COcCk4lG.js";import{A as ct}from"./avatar-C4FRugJb.js";import{c as dt,b as mt,d as ut,f as ft,e as ht,g as pt,a as xt,A as gt}from"./alert-dialog-BvuFarFf.js";import{S as re,u as ae}from"./constants-CfwGLQ49.js";import{e as cs,f as ds}from"./use-organization-settings-Dak2xww8.js";import{f as ms}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as us}from"./unwrap-tool-result-BYXdCQMg.js";function ue(t,e,s){let i=s.initialDeps??[],n,o=!0;function r(){var a,u,d;let m;s.key&&((a=s.debug)!=null&&a.call(s))&&(m=Date.now());const f=t();if(!(f.length!==i.length||f.some((S,b)=>i[b]!==S)))return n;i=f;let h;if(s.key&&((u=s.debug)!=null&&u.call(s))&&(h=Date.now()),n=e(...f),s.key&&((d=s.debug)!=null&&d.call(s))){const S=Math.round((Date.now()-m)*100)/100,b=Math.round((Date.now()-h)*100)/100,C=b/16,_=(p,j)=>{for(p=String(p);p.length<j;)p=" "+p;return p};console.info(`%c⏱ ${_(b,5)} /${_(S,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*C,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(n),o=!1,n}return r.updateDeps=a=>{i=a},r}function Ke(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const fs=(t,e)=>Math.abs(t-e)<1.01,hs=(t,e,s)=>{let i;return function(...n){t.clearTimeout(i),i=t.setTimeout(()=>e.apply(this,n),s)}},$e=t=>{const{offsetWidth:e,offsetHeight:s}=t;return{width:e,height:s}},ps=t=>t,xs=t=>{const e=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),i=[];for(let n=e;n<=s;n++)i.push(n);return i},gs=(t,e)=>{const s=t.scrollElement;if(!s)return;const i=t.targetWindow;if(!i)return;const n=r=>{const{width:a,height:u}=r;e({width:Math.round(a),height:Math.round(u)})};if(n($e(s)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(r=>{const a=()=>{const u=r[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){n({width:d.inlineSize,height:d.blockSize});return}}n($e(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},Ue={passive:!0},Be=typeof window>"u"?!0:"onscrollend"in window,bs=(t,e)=>{const s=t.scrollElement;if(!s)return;const i=t.targetWindow;if(!i)return;let n=0;const o=t.options.useScrollendEvent&&Be?()=>{}:hs(i,()=>{e(n,!1)},t.options.isScrollingResetDelay),r=m=>()=>{const{horizontal:f,isRtl:c}=t.options;n=f?s.scrollLeft*(c&&-1||1):s.scrollTop,o(),e(n,m)},a=r(!0),u=r(!1);s.addEventListener("scroll",a,Ue);const d=t.options.useScrollendEvent&&Be;return d&&s.addEventListener("scrollend",u,Ue),()=>{s.removeEventListener("scroll",a),d&&s.removeEventListener("scrollend",u)}},vs=(t,e,s)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},ys=(t,{adjustments:e=0,behavior:s},i)=>{var n,o;const r=t+e;(o=(n=i.scrollElement)==null?void 0:n.scrollTo)==null||o.call(n,{[i.options.horizontal?"left":"top"]:r,behavior:s})};class js{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var s,i,n;return((n=(i=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:i.now)==null?void 0:n.call(i))??Date.now()},this.observer=(()=>{let s=null;const i=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(n=>{n.forEach(o=>{const r=()=>{const a=o.target,u=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var n;(n=i())==null||n.disconnect(),s=null},observe:n=>{var o;return(o=i())==null?void 0:o.observe(n,{box:"border-box"})},unobserve:n=>{var o;return(o=i())==null?void 0:o.unobserve(n)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([i,n])=>{typeof n>"u"&&delete s[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ps,rangeExtractor:xs,onChange:()=>{},measureElement:vs,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...s}},this.notify=s=>{var i,n;(n=(i=this.options).onChange)==null||n.call(i,this,s)},this.maybeNotify=ue(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(s,i)=>{const n=new Map,o=new Map;for(let r=i-1;r>=0;r--){const a=s[r];if(n.has(a.lane))continue;const u=o.get(a.lane);if(u==null||a.end>u.end?o.set(a.lane,a):a.end<u.end&&n.set(a.lane,!0),n.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=ue(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,i,n,o,r,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:i,scrollMargin:n,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=ue(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:i,scrollMargin:n,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:u},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const h of this.laneAssignments.keys())h>=s&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const m=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,m),c=new Array(a).fill(void 0);for(let h=0;h<m;h++){const S=f[h];S&&(c[S.lane]=h)}for(let h=m;h<s;h++){const S=o(h),b=this.laneAssignments.get(h);let C,_;const p=u==="estimate"||d.has(S);if(b!==void 0&&this.options.lanes>1){C=b;const g=c[C],v=g!==void 0?f[g]:void 0;_=v?v.end+this.options.gap:i+n}else{const g=this.options.lanes===1?f[h-1]:this.getFurthestMeasurement(f,h);_=g?g.end+this.options.gap:i+n,C=g?g.lane:h%this.options.lanes,this.options.lanes>1&&p&&this.laneAssignments.set(h,C)}const j=d.get(S),x=typeof j=="number"?j:this.options.estimateSize(h),N=_+x;f[h]={index:h,start:_,size:x,end:N,key:S,lane:C},c[C]=h}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ue(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,i,n,o)=>this.range=s.length>0&&i>0?Ss({measurements:s,outerSize:i,scrollOffset:n,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ue(()=>{let s=null,i=null;const n=this.calculateRange();return n&&(s=n.startIndex,i=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,i]},(s,i,n,o,r)=>o===null||r===null?[]:s({startIndex:o,endIndex:r,overscan:i,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const i=this.options.indexAttribute,n=s.getAttribute(i);return n?parseInt(n,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(n!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-o),a=Math.min(this.options.count-1,n+o);return s>=r&&s<=a}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}const i=this.indexFromElement(s),n=this.options.getItemKey(i),o=this.elementsCache.get(n);o!==s&&(o&&this.observer.unobserve(o),this.observer.observe(s),this.elementsCache.set(n,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,i)=>{var n;const o=this.measurementsCache[s];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=i-r;a!==0&&(((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,i)),this.notify(!1))},this.getVirtualItems=ue(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,i)=>{const n=[];for(let o=0,r=s.length;o<r;o++){const a=s[o],u=i[a];n.push(u)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const i=this.getMeasurements();if(i.length!==0)return Ke(i[bt(0,i.length-1,n=>Ke(i[n]).start,s)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,i,n=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();i==="auto"&&(i=s>=r+o?"end":"start"),i==="center"?s+=(n-o)/2:i==="end"&&(s-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,s),0)},this.getOffsetForIndex=(s,i="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const n=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[s];if(!r)return;if(i==="auto")if(r.end>=o+n-this.options.scrollPaddingEnd)i="end";else if(r.start<=o+this.options.scrollPaddingStart)i="start";else return[o,i];if(i==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),i];const a=i==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,i,r.size),i]},this.scrollToOffset=(s,{align:i="start",behavior:n="auto"}={})=>{const o=this.getOffsetForAlignment(s,i),r=this.now();this.scrollState={index:null,align:i,behavior:n,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:i="auto",behavior:n="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,i);if(!o)return;const[r,a]=o,u=this.now();this.scrollState={index:s,align:a,behavior:n,startedAt:u,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:i="auto"}={})=>{const n=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const i=this.getMeasurements();let n;if(i.length===0)n=this.options.paddingStart;else if(this.options.lanes===1)n=((s=i[i.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=i.length-1;for(;r>=0&&o.some(a=>a===null);){const a=i[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}n=Math.max(...o.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:i,behavior:n})=>{this.options.scrollToFn(s,{behavior:n,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=i?i[0]:this.scrollState.lastTargetOffset,o=1,r=n!==this.scrollState.lastTargetOffset;if(!r&&fs(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=n,this.scrollState.behavior="auto",this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const bt=(t,e,s,i)=>{for(;t<=e;){const n=(t+e)/2|0,o=s(n);if(o<i)t=n+1;else if(o>i)e=n-1;else return n}return t>0?t-1:0};function Ss({measurements:t,outerSize:e,scrollOffset:s,lanes:i}){const n=t.length-1,o=u=>t[u].start;if(t.length<=i)return{startIndex:0,endIndex:n};let r=bt(0,n,o,s),a=r;if(i===1)for(;a<n&&t[a].end<s+e;)a++;else if(i>1){const u=Array(i).fill(0);for(;a<n&&u.some(m=>m<s+e);){const m=t[a];u[m.lane]=m.end,a++}const d=Array(i).fill(s+e);for(;r>=0&&d.some(m=>m>=s);){const m=t[r];d[m.lane]=m.start,r--}r=Math.max(0,r-r%i),a=Math.min(n,a+(i-1-a%i))}return{startIndex:r,endIndex:a}}const Ve=typeof document<"u"?R.useLayoutEffect:R.useEffect;function _s({useFlushSync:t=!0,...e}){const s=R.useReducer(()=>({}),{})[1],i={...e,onChange:(o,r)=>{var a;t&&r?At.flushSync(s):s(),(a=e.onChange)==null||a.call(e,o,r)}},[n]=R.useState(()=>new js(i));return n.setOptions(i),Ve(()=>n._didMount(),[]),Ve(()=>n._willUpdate()),n}function Ns(t){return _s({observeElementRect:gs,observeElementOffset:bs,scrollToFn:ys,...t})}const vt=[{id:"litellm",name:"LiteLLM",description:"Connect a LiteLLM proxy as an OpenAI-compatible endpoint",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run local models via Ollama's OpenAI-compatible API",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Local models served by LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"High-throughput inference server with OpenAI-compatible API",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function We(t){if(t)return vt.find(e=>e.id===t)}se({title:D(),url:D(),icon:D()});se({registries:we(D(),se({enabled:Ie()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Ce(D()).describe("List of MCP app_name or app_id values to hide from the store.")});const xe=se({keyId:D(),modelId:D(),title:D().optional()}).nullable(),ws=se({enabled:Ie(),chat:se({fast:xe,smart:xe,thinking:xe}),image:xe,webResearch:xe});se({ids:Ce(D()).describe("Ordered list of agent ids to show on the home view. Mix of well-known template ids and custom virtual MCP ids.")});se({id:D().describe("Brand context ID"),name:D().describe("Company name"),domain:D().describe("Company domain (e.g. example.com)"),overview:D().describe("Company overview / description"),logo:D().nullable().optional().describe("Logo URL"),favicon:D().nullable().optional().describe("Favicon URL"),ogImage:D().nullable().optional().describe("OG image URL"),fonts:se({heading:D().optional().describe("Font family for headings"),body:D().optional().describe("Font family for body text"),code:D().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:D().optional().describe("Primary brand color (hex)"),secondary:D().optional().describe("Secondary brand color (hex)"),accent:D().optional().describe("Accent / highlight color (hex)"),background:D().optional().describe("Background color (hex)"),foreground:D().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Ce(we(D(),Le())).nullable().optional().describe("Brand images"),metadata:we(D(),Le()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:D().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:Ie().optional().describe("Whether this is the default brand for the organization")});function Cs(t){const e=B.c(3),{error:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx(ls,{size:16}),e[0]=i):i=e[0];let n;return e[1]!==s.message?(n=l.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[i,l.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",s.message]})]}),e[1]=s.message,e[2]=n):n=e[2],n}function yt(t){const e=B.c(27),{keys:s,onDelete:i,isDeleting:n}=t,[o,r]=R.useState(null);let a;if(e[0]!==o||e[1]!==s){let x;e[3]!==o?(x=N=>N.id===o,e[3]=o,e[4]=x):x=e[4],a=s.find(x),e[0]=o,e[1]=s,e[2]=a}else a=e[2];const u=a;let d;if(e[5]!==n||e[6]!==s){let x;e[8]!==n?(x=N=>l.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[l.jsx(nt,{size:14,className:"text-muted-foreground shrink-0"}),l.jsx("span",{className:"font-medium truncate",children:N.label}),l.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["added ",ms(new Date(N.createdAt))," ago"]})]}),l.jsx("div",{onClick:ks,children:l.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",disabled:n,onClick:()=>r(N.id),children:l.jsx(ns,{size:14})})})]},N.id),e[8]=n,e[9]=x):x=e[9],d=s.map(x),e[5]=n,e[6]=s,e[7]=d}else d=e[7];const m=!!o;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=x=>!x&&r(null),e[10]=f):f=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=l.jsx(dt,{children:"Delete API Key"}),e[11]=c):c=e[11];const h=u?.label;let S;e[12]!==h?(S=l.jsxs(mt,{children:[c,l.jsxs(ut,{children:["This action cannot be undone. This will permanently delete"," ",l.jsx("span",{className:"font-medium text-foreground",children:h}),"."]})]}),e[12]=h,e[13]=S):S=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx(ft,{children:"Cancel"}),e[14]=b):b=e[14];let C;e[15]!==o||e[16]!==i?(C=l.jsxs(ht,{children:[b,l.jsx(pt,{onClick:()=>{o&&(i(o),r(null))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[15]=o,e[16]=i,e[17]=C):C=e[17];let _;e[18]!==S||e[19]!==C?(_=l.jsxs(xt,{onClick:Is,children:[S,C]}),e[18]=S,e[19]=C,e[20]=_):_=e[20];let p;e[21]!==_||e[22]!==m?(p=l.jsx(gt,{open:m,onOpenChange:f,children:_}),e[21]=_,e[22]=m,e[23]=p):p=e[23];let j;return e[24]!==p||e[25]!==d?(j=l.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[d,p]}),e[24]=p,e[25]=d,e[26]=j):j=e[26],j}function Is(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}const Es=se({label:D().optional(),apiKey:D().min(1,"API key is required")});function Ms(t){const e=B.c(62),{providerId:s,onCancel:i,onSuccess:n}=t,{org:o}=ie();let r;e[0]!==o.id||e[1]!==o.slug?(r={connectionId:re,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=r):r=e[2];const a=ae(r),u=be(),[d,m]=R.useState(!1);let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f={resolver:Ee(Es),defaultValues:{label:"",apiKey:""}},e[3]=f):f=e[3];const{register:c,handleSubmit:h,formState:S}=ke(f),{errors:b}=S;let C;e[4]!==a||e[5]!==s?(C=async H=>{await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:s,label:H.label||"Personal key",apiKey:H.apiKey}})},e[4]=a,e[5]=s,e[6]=C):C=e[6];let _;e[7]!==n||e[8]!==o.id||e[9]!==u?(_=()=>{u.invalidateQueries({queryKey:G.aiProviderKeys(o.id)}),u.invalidateQueries({queryKey:G.aiProviders(o.id)}),Y.success("Key saved successfully"),n()},e[7]=n,e[8]=o.id,e[9]=u,e[10]=_):_=e[10];let p;e[11]!==C||e[12]!==_?(p={mutationFn:C,onSuccess:_,onError:As},e[11]=C,e[12]=_,e[13]=p):p=e[13];const{mutate:j,isPending:x,error:N}=le(p);let g;e[14]!==j?(g=H=>j(H),e[14]=j,e[15]=g):g=e[15];let v;e[16]!==h||e[17]!==g?(v=h(g),e[16]=h,e[17]=g,e[18]=v):v=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[19]=w):w=e[19];let I;e[20]!==c?(I=c("label"),e[20]=c,e[21]=I):I=e[21];let k;e[22]!==I?(k=l.jsxs("div",{className:"space-y-1",children:[w,l.jsx(ne,{placeholder:"e.g. Personal key",...I,className:"h-8 text-sm"})]}),e[22]=I,e[23]=k):k=e[23];let y;e[24]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[24]=y):y=e[24];const E=d?"text":"password";let P;e[25]!==c?(P=c("apiKey"),e[25]=c,e[26]=P):P=e[26];let M;e[27]!==E||e[28]!==P?(M=l.jsx(ne,{type:E,placeholder:"sk-...",...P,className:"ph-no-capture h-8 text-sm pr-8"}),e[27]=E,e[28]=P,e[29]=M):M=e[29];let A;e[30]!==d?(A=()=>m(!d),e[30]=d,e[31]=A):A=e[31];let O;e[32]!==d?(O=d?l.jsx(lt,{size:14}):l.jsx(it,{size:14}),e[32]=d,e[33]=O):O=e[33];let L;e[34]!==A||e[35]!==O?(L=l.jsx("button",{type:"button",onClick:A,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:O}),e[34]=A,e[35]=O,e[36]=L):L=e[36];let V;e[37]!==M||e[38]!==L?(V=l.jsxs("div",{className:"relative",children:[M,L]}),e[37]=M,e[38]=L,e[39]=V):V=e[39];let K;e[40]!==b.apiKey?(K=b.apiKey&&l.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[40]=b.apiKey,e[41]=K):K=e[41];let $;e[42]!==V||e[43]!==K?($=l.jsxs("div",{className:"space-y-1",children:[y,V,K]}),e[42]=V,e[43]=K,e[44]=$):$=e[44];let z;e[45]!==N?(z=N&&l.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[45]=N,e[46]=z):z=e[46];let F;e[47]!==x||e[48]!==i?(F=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:"Cancel"}),e[47]=x,e[48]=i,e[49]=F):F=e[49];const U=x?"Saving...":"Save Key";let W;e[50]!==x||e[51]!==U?(W=l.jsx(te,{type:"submit",size:"sm",disabled:x,children:U}),e[50]=x,e[51]=U,e[52]=W):W=e[52];let q;e[53]!==F||e[54]!==W?(q=l.jsxs(st,{children:[F,W]}),e[53]=F,e[54]=W,e[55]=q):q=e[55];let T;return e[56]!==k||e[57]!==$||e[58]!==z||e[59]!==q||e[60]!==v?(T=l.jsxs("form",{onSubmit:v,className:"space-y-3",children:[k,$,z,q]}),e[56]=k,e[57]=$,e[58]=z,e[59]=q,e[60]=v,e[61]=T):T=e[61],T}function As(t){Y.error(`Failed to save key: ${t.message}`)}const Os=se({label:D().optional(),baseUrl:D().min(1,"Base URL is required"),apiKey:D().optional()});function jt(t){const e=B.c(77),{preset:s,onCancel:i,onSuccess:n}=t,{org:o}=ie();let r;e[0]!==o.id||e[1]!==o.slug?(r={connectionId:re,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=r):r=e[2];const a=ae(r),u=be(),[d,m]=R.useState(!1);let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f={resolver:Ee(Os),defaultValues:{label:"",baseUrl:"",apiKey:""}},e[3]=f):f=e[3];const{register:c,handleSubmit:h,formState:S}=ke(f),{errors:b}=S;let C;e[4]!==a||e[5]!==s?(C=async me=>{const Mt=JSON.stringify({baseUrl:me.baseUrl,apiKey:me.apiKey||""});await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:"openai-compatible",label:me.label||s?.name||me.baseUrl,apiKey:Mt,...s?{presetId:s.id}:{}}})},e[4]=a,e[5]=s,e[6]=C):C=e[6];let _;e[7]!==n||e[8]!==o.id||e[9]!==u?(_=()=>{u.invalidateQueries({queryKey:G.aiProviderKeys(o.id)}),u.invalidateQueries({queryKey:G.aiProviders(o.id)}),Y.success("Connection saved successfully"),n()},e[7]=n,e[8]=o.id,e[9]=u,e[10]=_):_=e[10];let p;e[11]!==C||e[12]!==_?(p={mutationFn:C,onSuccess:_,onError:Ts},e[11]=C,e[12]=_,e[13]=p):p=e[13];const{mutate:j,isPending:x,error:N}=le(p),g=s?`e.g. ${s.name} prod, ${s.name} dev`:"e.g. My OpenAI-compatible server",v=s?.baseUrlPlaceholder??"http://localhost:4000/v1";let w;e[14]!==j?(w=me=>j(me),e[14]=j,e[15]=w):w=e[15];let I;e[16]!==h||e[17]!==w?(I=h(w),e[16]=h,e[17]=w,e[18]=I):I=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[19]=k):k=e[19];let y;e[20]!==c?(y=c("label"),e[20]=c,e[21]=y):y=e[21];let E;e[22]!==g||e[23]!==y?(E=l.jsxs("div",{className:"space-y-1",children:[k,l.jsx(ne,{placeholder:g,...y,className:"h-8 text-sm"})]}),e[22]=g,e[23]=y,e[24]=E):E=e[24];let P;e[25]===Symbol.for("react.memo_cache_sentinel")?(P=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),e[25]=P):P=e[25];let M;e[26]!==c?(M=c("baseUrl"),e[26]=c,e[27]=M):M=e[27];let A;e[28]!==v||e[29]!==M?(A=l.jsx(ne,{type:"url",placeholder:v,...M,className:"h-8 text-sm"}),e[28]=v,e[29]=M,e[30]=A):A=e[30];let O;e[31]!==b.baseUrl?(O=b.baseUrl&&l.jsx("p",{className:"text-xs text-destructive",children:b.baseUrl.message}),e[31]=b.baseUrl,e[32]=O):O=e[32];let L;e[33]!==A||e[34]!==O?(L=l.jsxs("div",{className:"space-y-1",children:[P,A,O]}),e[33]=A,e[34]=O,e[35]=L):L=e[35];const V=s?.apiKeyRecommended?"recommended":"optional";let K;e[36]!==V?(K=l.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key"," ",l.jsxs("span",{className:"text-muted-foreground/60",children:["(",V,")"]})]}),e[36]=V,e[37]=K):K=e[37];const $=d?"text":"password";let z;e[38]!==c?(z=c("apiKey"),e[38]=c,e[39]=z):z=e[39];let F;e[40]!==$||e[41]!==z?(F=l.jsx(ne,{type:$,placeholder:"sk-...",...z,className:"ph-no-capture h-8 text-sm pr-8"}),e[40]=$,e[41]=z,e[42]=F):F=e[42];let U;e[43]!==d?(U=()=>m(!d),e[43]=d,e[44]=U):U=e[44];let W;e[45]!==d?(W=d?l.jsx(lt,{size:14}):l.jsx(it,{size:14}),e[45]=d,e[46]=W):W=e[46];let q;e[47]!==U||e[48]!==W?(q=l.jsx("button",{type:"button",onClick:U,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:W}),e[47]=U,e[48]=W,e[49]=q):q=e[49];let T;e[50]!==F||e[51]!==q?(T=l.jsxs("div",{className:"relative",children:[F,q]}),e[50]=F,e[51]=q,e[52]=T):T=e[52];let H;e[53]!==K||e[54]!==T?(H=l.jsxs("div",{className:"space-y-1",children:[K,T]}),e[53]=K,e[54]=T,e[55]=H):H=e[55];let X;e[56]!==s?(X=s?.helpText&&l.jsx("p",{className:"text-xs text-muted-foreground",children:s.helpText}),e[56]=s,e[57]=X):X=e[57];let ee;e[58]!==N?(ee=N&&l.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[58]=N,e[59]=ee):ee=e[59];let Z;e[60]!==x||e[61]!==i?(Z=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:"Cancel"}),e[60]=x,e[61]=i,e[62]=Z):Z=e[62];const pe=x?"Saving...":"Save Connection";let ce;e[63]!==x||e[64]!==pe?(ce=l.jsx(te,{type:"submit",size:"sm",disabled:x,children:pe}),e[63]=x,e[64]=pe,e[65]=ce):ce=e[65];let de;e[66]!==Z||e[67]!==ce?(de=l.jsxs(st,{children:[Z,ce]}),e[66]=Z,e[67]=ce,e[68]=de):de=e[68];let ve;return e[69]!==E||e[70]!==L||e[71]!==H||e[72]!==X||e[73]!==ee||e[74]!==de||e[75]!==I?(ve=l.jsxs("form",{onSubmit:I,className:"space-y-3",children:[E,L,H,X,ee,de]}),e[69]=E,e[70]=L,e[71]=H,e[72]=X,e[73]=ee,e[74]=de,e[75]=I,e[76]=ve):ve=e[76],ve}function Ts(t){Y.error(`Failed to save connection: ${t.message}`)}function qe({provider:t,keys:e}){const{org:s}=ie(),i=ae({connectionId:re,orgId:s.id,orgSlug:s.slug}),n=be(),[o,r]=R.useState(!1),[a,u]=R.useState(!1),[d,m]=R.useState(null),f=t.supportedMethods.includes("cli-activate"),c=e.length>0,{mutate:h,isPending:S}=le({mutationFn:async y=>(await i.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:y}}),y),onSuccess:y=>{n.invalidateQueries({queryKey:G.aiProviderKeys(s.id)}),n.invalidateQueries({queryKey:G.aiProviders(s.id)}),n.invalidateQueries({queryKey:G.aiProviderModels(s.id,y)}),Y.success("Key deleted")},onError:y=>{Y.error(`Failed to delete key: ${y.message}`)}}),{mutate:b}=le({mutationFn:async({code:y,stateToken:E})=>{const P=await i.callTool({name:"AI_PROVIDER_OAUTH_EXCHANGE",arguments:{providerId:t.id,code:y,stateToken:E,label:"Connected via OAuth"}});if(P?.isError){const M=P.content?.[0]?.text??"OAuth exchange failed";throw new Error(M)}},onSuccess:()=>{J("ai_provider_oauth_succeeded",{provider_id:t.id}),n.invalidateQueries({queryKey:G.aiProviderKeys(s.id)}),n.invalidateQueries({queryKey:G.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`),u(!1),m(null)},onError:y=>{J("ai_provider_oauth_failed",{provider_id:t.id,error:y.message}),Y.error(`OAuth connection failed: ${y.message}`),u(!1),m(null)}}),{mutate:C,isPending:_}=le({mutationFn:async()=>{const y=await i.callTool({name:"AI_PROVIDER_CLI_ACTIVATE",arguments:{providerId:t.id}});if(y?.isError)throw new Error(y.content?.[0]?.text??"CLI activation failed");return y.structuredContent},onSuccess:y=>{if(!y?.activated){J("ai_provider_cli_activate_failed",{provider_id:t.id,error:y?.error??"unknown"}),Y.error(y?.error??"CLI activation failed");return}J("ai_provider_cli_activated",{provider_id:t.id}),n.invalidateQueries({queryKey:G.aiProviderKeys(s.id)}),n.invalidateQueries({queryKey:G.aiProviders(s.id)}),Y.success(`${t.name} activated`)},onError:y=>{J("ai_provider_cli_activate_failed",{provider_id:t.id,error:y.message}),Y.error(y.message)}}),{mutate:p,isPending:j}=le({mutationFn:async()=>{const y=await i.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:t.id}});if(y?.isError){const E=y.content?.[0]?.text??"Key provisioning failed";throw new Error(E)}},onSuccess:()=>{J("ai_provider_provision_succeeded",{provider_id:t.id}),n.invalidateQueries({queryKey:G.aiProviderKeys(s.id)}),n.invalidateQueries({queryKey:G.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`)},onError:y=>{J("ai_provider_provision_failed",{provider_id:t.id,error:y.message}),Y.error(`Failed to connect ${t.name}: ${y.message}`)}});R.useEffect(()=>{if(!a||!d)return;let y=!1;const E=M=>{if(M.origin===window.location.origin&&M.data?.type==="AI_PROVIDER_OAUTH_CALLBACK"){const{code:A,stateToken:O}=M.data;O===d?(y=!0,b({code:A,stateToken:O})):(console.error("State token mismatch"),Y.error("Security check failed: State token mismatch"),u(!1),m(null))}};window.addEventListener("message",E);const P=setTimeout(()=>{y||(J("ai_provider_oauth_timeout",{provider_id:t.id}),u(!1),m(null),Y.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",E),clearTimeout(P)}},[a,d,b,t.id]);const x=!!t.supportsProvision,N=t.supportedMethods.includes("oauth-pkce"),g=t.supportedMethods.includes("api-key"),v=()=>{if(!(o||a||_||j)){if(f){c||(J("ai_provider_connect_clicked",{provider_id:t.id,method:"cli-activate"}),C());return}x?(J("ai_provider_connect_clicked",{provider_id:t.id,method:"provision"}),p()):N?(J("ai_provider_connect_clicked",{provider_id:t.id,method:"oauth-pkce"}),w()):g&&(J("ai_provider_connect_clicked",{provider_id:t.id,method:"api-key"}),r(!0))}},w=async()=>{try{u(!0);const y=await i.callTool({name:"AI_PROVIDER_OAUTH_URL",arguments:{providerId:t.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`}});if(y.structuredContent)m(y.structuredContent.stateToken),window.open(y.structuredContent.url,"AiProviderOAuth","width=600,height=700");else throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL")}catch(y){u(!1),Y.error(`Failed to start OAuth: ${y instanceof Error?y.message:String(y)}`)}},I=_?"Checking CLI...":j?"Connecting...":a?"Authorizing...":null,k=I??(c&&f?`Authenticated via ${t.name} CLI`:t.description);return l.jsxs(l.Fragment,{children:[l.jsx(fe,{icon:t.logo?l.jsx("img",{src:t.logo,alt:t.name,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):l.jsx(ct,{fallback:t.name.charAt(0),className:"size-8 bg-primary/10 text-primary"}),title:l.jsxs("span",{className:"flex items-center gap-2",children:[t.name,c&&!f&&!I&&l.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured",t.supportsCredits?" · Managed above":""]})]}),description:k,onClick:!a&&!_&&!j?v:void 0,className:oe((a||_||j)&&"cursor-wait"),action:l.jsx("div",{className:"flex items-center gap-2",children:c&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0"})}),children:c&&!f&&l.jsx(yt,{keys:e,onDelete:h,isDeleting:S})}),l.jsx(Me,{open:o,onOpenChange:y=>{y||r(!1)},children:l.jsxs(Ae,{children:[l.jsxs(et,{children:[l.jsxs(Oe,{children:["Connect ",t.name]}),l.jsx(tt,{children:t.id==="openai-compatible"?"Enter the base URL and optional API key for your OpenAI-compatible endpoint.":`Add an API key to connect your ${t.name} account.`})]}),t.id==="openai-compatible"?l.jsx(jt,{onCancel:()=>r(!1),onSuccess:()=>r(!1)}):l.jsx(Ms,{providerId:t.id,onCancel:()=>r(!1),onSuccess:()=>r(!1)})]})})]})}function He(t){const e=B.c(58),{preset:s,keys:i,fallbackLogo:n}=t,{org:o}=ie();let r;e[0]!==o.id||e[1]!==o.slug?(r={connectionId:re,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=r):r=e[2];const a=ae(r),u=be(),[d,m]=R.useState(!1),f=i.length>0,c=s?.name??"Custom OpenAI Compatible",h=s?.description??"Connect any OpenAI-compatible endpoint by URL",S=s?.logo??n;let b;e[3]!==a?(b=async U=>(await a.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:U}}),U),e[3]=a,e[4]=b):b=e[4];let C;e[5]!==o.id||e[6]!==u?(C=U=>{u.invalidateQueries({queryKey:G.aiProviderKeys(o.id)}),u.invalidateQueries({queryKey:G.aiProviders(o.id)}),u.invalidateQueries({queryKey:G.aiProviderModels(o.id,U)}),Y.success("Connection deleted")},e[5]=o.id,e[6]=u,e[7]=C):C=e[7];let _;e[8]!==b||e[9]!==C?(_={mutationFn:b,onSuccess:C,onError:Ps},e[8]=b,e[9]=C,e[10]=_):_=e[10];const{mutate:p,isPending:j}=le(_);let x;e[11]!==c||e[12]!==S?(x=S?l.jsx("img",{src:S,alt:c,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):l.jsx(ct,{fallback:c.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[11]=c,e[12]=S,e[13]=x):x=e[13];let N;e[14]!==f||e[15]!==i.length?(N=f&&l.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:[i.length," connection",i.length!==1?"s":""," ","configured"]}),e[14]=f,e[15]=i.length,e[16]=N):N=e[16];let g;e[17]!==c||e[18]!==N?(g=l.jsxs("span",{className:"flex items-center gap-2",children:[c,N]}),e[17]=c,e[18]=N,e[19]=g):g=e[19];let v;e[20]!==d||e[21]!==s?.id?(v=()=>{d||(J("ai_provider_connect_clicked",{provider_id:"openai-compatible",preset_id:s?.id??null,method:"api-key"}),m(!0))},e[20]=d,e[21]=s?.id,e[22]=v):v=e[22];let w;e[23]!==f?(w=f?l.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0"}):void 0,e[23]=f,e[24]=w):w=e[24];let I;e[25]!==p||e[26]!==f||e[27]!==j||e[28]!==i?(I=f&&l.jsx(yt,{keys:i,onDelete:p,isDeleting:j}),e[25]=p,e[26]=f,e[27]=j,e[28]=i,e[29]=I):I=e[29];let k;e[30]!==h||e[31]!==I||e[32]!==x||e[33]!==g||e[34]!==v||e[35]!==w?(k=l.jsx(fe,{icon:x,title:g,description:h,onClick:v,action:w,children:I}),e[30]=h,e[31]=I,e[32]=x,e[33]=g,e[34]=v,e[35]=w,e[36]=k):k=e[36];let y;e[37]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{U||m(!1)},e[37]=y):y=e[37];let E;e[38]!==c?(E=l.jsxs(Oe,{children:["Connect ",c]}),e[38]=c,e[39]=E):E=e[39];const P=s?`Add a ${s.name} connection. Multiple connections of the same kind are supported.`:"Enter the base URL and optional API key for any OpenAI-compatible endpoint.";let M;e[40]!==P?(M=l.jsx(tt,{children:P}),e[40]=P,e[41]=M):M=e[41];let A;e[42]!==E||e[43]!==M?(A=l.jsxs(et,{children:[E,M]}),e[42]=E,e[43]=M,e[44]=A):A=e[44];const O=s??void 0;let L,V;e[45]===Symbol.for("react.memo_cache_sentinel")?(L=()=>m(!1),V=()=>m(!1),e[45]=L,e[46]=V):(L=e[45],V=e[46]);let K;e[47]!==O?(K=l.jsx(jt,{preset:O,onCancel:L,onSuccess:V}),e[47]=O,e[48]=K):K=e[48];let $;e[49]!==A||e[50]!==K?($=l.jsxs(Ae,{children:[A,K]}),e[49]=A,e[50]=K,e[51]=$):$=e[51];let z;e[52]!==d||e[53]!==$?(z=l.jsx(Me,{open:d,onOpenChange:y,children:$}),e[52]=d,e[53]=$,e[54]=z):z=e[54];let F;return e[55]!==k||e[56]!==z?(F=l.jsxs(l.Fragment,{children:[k,z]}),e[55]=k,e[56]=z,e[57]=F):F=e[57],F}function Ps(t){Y.error(`Failed to delete connection: ${t.message}`)}function St(t){const e=B.c(28);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{hideProviderId:i}=s,n=rt(),o=he();let r,a,u,d,m;if(e[2]!==n?.providers||e[3]!==o||e[4]!==i){let S;e[10]!==i?(S=w=>w.id!==i,e[10]=i,e[11]=S):S=e[11];const b=(n?.providers??[]).filter(S),C=b.filter(Ds),_=b.filter(Fs),p=o.filter(zs),j=i!=="openai-compatible";let x;e[12]!==n?.providers?(x=n?.providers??[],e[12]=n?.providers,e[13]=x):x=e[13];let N;e[14]!==x?(N=x.find(Ls),e[14]=x,e[15]=N):N=e[15];const g=N;d="flex flex-col gap-6 w-full",m=C.length>0&&l.jsx(je,{children:l.jsxs("div",{className:"relative rounded-xl border border-lime-400/30 bg-gradient-to-br from-lime-50/50 via-transparent to-yellow-50/30 dark:from-lime-950/20 dark:to-yellow-950/10 p-4",children:[l.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-lime-400/5 to-yellow-400/5 pointer-events-none"}),l.jsx("p",{className:"text-xs font-medium text-lime-700 dark:text-lime-400 mb-3 relative",children:"Local models — use your existing AI provider"}),l.jsx(Se,{className:"relative",children:C.map(w=>l.jsx(qe,{provider:w,keys:o.filter(I=>I.providerId===w.id)},w.id))})]})}),a=je,r=Se;let v;e[16]!==o?(v=w=>l.jsx(qe,{provider:w,keys:o.filter(I=>I.providerId===w.id)},w.id),e[16]=o,e[17]=v):v=e[17],u=[..._.map(v),...j?[...vt.map(w=>l.jsx(He,{preset:w,keys:p.filter(I=>I.presetId===w.id)},w.id)),l.jsx(He,{preset:null,keys:p.filter(Rs),fallbackLogo:g?.logo},"custom")]:[]],e[2]=n?.providers,e[3]=o,e[4]=i,e[5]=r,e[6]=a,e[7]=u,e[8]=d,e[9]=m}else r=e[5],a=e[6],u=e[7],d=e[8],m=e[9];let f;e[18]!==r||e[19]!==u?(f=l.jsx(r,{children:u}),e[18]=r,e[19]=u,e[20]=f):f=e[20];let c;e[21]!==a||e[22]!==f?(c=l.jsx(a,{children:f}),e[21]=a,e[22]=f,e[23]=c):c=e[23];let h;return e[24]!==d||e[25]!==m||e[26]!==c?(h=l.jsxs("div",{className:d,children:[m,c]}),e[24]=d,e[25]=m,e[26]=c,e[27]=h):h=e[27],h}function Rs(t){return!t.presetId}function Ls(t){return t.id==="openai-compatible"}function zs(t){return t.providerId==="openai-compatible"}function Fs(t){return!t.supportedMethods.includes("cli-activate")&&t.id!=="openai-compatible"}function Ds(t){return t.supportedMethods.includes("cli-activate")}const Ks={usd:[10,20,100],brl:[50,100,500]};function $s(){const t=B.c(29),{org:e}=ie();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:re,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const i=ae(s),[n,o]=R.useState(!1),{mutate:r,isPending:a}=le({mutationFn:async v=>{const w=await i.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:v,currency:c}});if(w?.isError)throw new Error(w.content?.[0]?.text??"Failed to get top-up URL");return w.structuredContent?.url},onSuccess:Bs,onError:Us}),[u,d]=R.useState(""),[m,f]=R.useState("usd"),c=m,h=parseFloat(u),S=!isNaN(h)&&h>=1,b=c==="brl"?"R$":"$";let C;t[3]!==f?(C=v=>{v&&f(v)},t[3]=f,t[4]=C):C=t[4];let _,p;t[5]===Symbol.for("react.memo_cache_sentinel")?(_=l.jsx(De,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),p=l.jsx(De,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),t[5]=_,t[6]=p):(_=t[5],p=t[6]);let j;t[7]!==c||t[8]!==C?(j=l.jsxs(as,{type:"single",variant:"outline",size:"default",value:c,onValueChange:C,children:[_,p]}),t[7]=c,t[8]=C,t[9]=j):j=t[9];let x;t[10]!==c||t[11]!==b||t[12]!==n||t[13]!==a||t[14]!==r?(x=!n&&l.jsxs(l.Fragment,{children:[Ks[c].map(v=>l.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:a,onClick:()=>r(v*100),children:[b,v]},v)),l.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>o(!0),disabled:a,children:"Custom"})]}),t[10]=c,t[11]=b,t[12]=n,t[13]=a,t[14]=r,t[15]=x):x=t[15];let N;t[16]!==b||t[17]!==u||t[18]!==h||t[19]!==n||t[20]!==S||t[21]!==a||t[22]!==d||t[23]!==r?(N=n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative max-w-[140px]",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:b}),l.jsx(ne,{type:"number",min:"1",step:"1",placeholder:"50",value:u,onChange:v=>d(v.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),l.jsx(te,{className:"h-10",disabled:!S||a,onClick:()=>r(Math.round(h*100)),children:a?"...":"Add"}),l.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{o(!1),d("")},children:"Cancel"})]}),t[16]=b,t[17]=u,t[18]=h,t[19]=n,t[20]=S,t[21]=a,t[22]=d,t[23]=r,t[24]=N):N=t[24];let g;return t[25]!==j||t[26]!==x||t[27]!==N?(g=l.jsx("div",{className:"flex flex-col gap-2.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,x,N]})}),t[25]=j,t[26]=x,t[27]=N,t[28]=g):g=t[28],g}function Us(t){Y.error(`Top-up failed: ${t.message}`)}function Bs(t){t&&window.open(t,"_blank","noopener,noreferrer")}function Vs(t){return t<=0?"text-destructive":t<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function Ws(){const t=B.c(61),{org:e}=ie();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:re,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const i=ae(s),n=be(),o=he();let r;t[3]!==o?(r=o.find(Hs),t[3]=o,t[4]=r):r=t[4];const a=r,[u,d]=R.useState(!1);let m;t[5]!==i||t[6]!==a?(m=async()=>{a&&await i.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:a.id}})},t[5]=i,t[6]=a,t[7]=m):m=t[7];let f;t[8]!==e.id||t[9]!==n?(f=()=>{n.invalidateQueries({queryKey:G.aiProviderKeys(e.id)}),n.invalidateQueries({queryKey:G.aiProviders(e.id)}),Y.success("Deco AI Gateway disconnected"),d(!1)},t[8]=e.id,t[9]=n,t[10]=f):f=t[10];let c;t[11]!==m||t[12]!==f?(c={mutationFn:m,onSuccess:f,onError:qs},t[11]=m,t[12]=f,t[13]=c):c=t[13];const{mutate:h,isPending:S}=le(c);let b;t[14]!==e.id?(b=G.aiProviderCredits(e.id,"deco"),t[14]=e.id,t[15]=b):b=t[15];const C=!!a;let _;t[16]!==i?(_=async()=>{const X=await i.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return X?.isError?null:X.structuredContent??null},t[16]=i,t[17]=_):_=t[17];let p;t[18]!==b||t[19]!==C||t[20]!==_?(p={queryKey:b,enabled:C,staleTime:6e4,queryFn:_},t[18]=b,t[19]=C,t[20]=_,t[21]=p):p=t[21];const{data:j,isLoading:x,refetch:N,isFetching:g}=Je(p);if(!a)return null;const v=j?.balanceCents!=null?j.balanceCents/100:null;let w;t[22]!==v?(w=v!=null?`$${v.toFixed(2)}`:"—",t[22]=v,t[23]=w):w=t[23];const I=w;let k;t[24]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),l.jsx("div",{children:l.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),t[24]=k):k=t[24];let y;t[25]===Symbol.for("react.memo_cache_sentinel")?(y=()=>d(!0),t[25]=y):y=t[25];let E;t[26]!==S?(E=l.jsxs("div",{className:"flex items-center justify-between",children:[k,l.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:y,disabled:S,children:"Disconnect"})]}),t[26]=S,t[27]=E):E=t[27];let P;t[28]===Symbol.for("react.memo_cache_sentinel")?(P=l.jsxs(mt,{children:[l.jsx(dt,{children:"Disconnect Deco AI Gateway"}),l.jsx(ut,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),t[28]=P):P=t[28];let M;t[29]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(ft,{children:"Cancel"}),t[29]=M):M=t[29];let A;t[30]!==h?(A=l.jsxs(xt,{children:[P,l.jsxs(ht,{children:[M,l.jsx(pt,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),t[30]=h,t[31]=A):A=t[31];let O;t[32]!==u||t[33]!==A?(O=l.jsx(gt,{open:u,onOpenChange:d,children:A}),t[32]=u,t[33]=A,t[34]=O):O=t[34];let L;t[35]!==v||t[36]!==I||t[37]!==g||t[38]!==x?(L=x||g?l.jsx(Q,{className:"h-9 w-24"}):l.jsx("span",{className:oe("text-3xl font-semibold tabular-nums tracking-tight",v!=null&&Vs(v)),children:I}),t[35]=v,t[36]=I,t[37]=g,t[38]=x,t[39]=L):L=t[39];let V;t[40]!==N?(V=()=>N(),t[40]=N,t[41]=V):V=t[41];const K=g&&"animate-spin";let $;t[42]!==K?($=oe(K),t[42]=K,t[43]=$):$=t[43];let z;t[44]!==$?(z=l.jsx(Ze,{size:14,className:$}),t[44]=$,t[45]=z):z=t[45];let F;t[46]!==g||t[47]!==V||t[48]!==z?(F=l.jsx("button",{type:"button",onClick:V,disabled:g,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:z}),t[46]=g,t[47]=V,t[48]=z,t[49]=F):F=t[49];let U;t[50]!==L||t[51]!==F?(U=l.jsxs("div",{className:"flex items-baseline gap-2",children:[L,F]}),t[50]=L,t[51]=F,t[52]=U):U=t[52];let W;t[53]===Symbol.for("react.memo_cache_sentinel")?(W=l.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),t[53]=W):W=t[53];let q;t[54]!==U?(q=l.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[U,W]}),t[54]=U,t[55]=q):q=t[55];let T;t[56]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsxs("div",{className:"pt-4 border-t border-border/60",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),l.jsx($s,{})]}),t[56]=T):T=t[56];let H;return t[57]!==E||t[58]!==O||t[59]!==q?(H=l.jsx(je,{title:"Deco AI Gateway",children:l.jsx(Se,{children:l.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[E,O,q,T]})})}),t[57]=E,t[58]=O,t[59]=q,t[60]=H):H=t[60],H}function qs(t){Y.error(`Failed to disconnect: ${t.message}`)}function Hs(t){return t.providerId==="deco"}const Qs=t=>t.capabilities?.includes("image")===!0,Ys=t=>{if(t.asyncResearch===!0)return!0;const e=t.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("sonar")||e.includes("deepresearch")},Gs={fast:"Fast",smart:"Smart",thinking:"Thinking"},Xs={fast:"Fastest responses, best for quick tasks",smart:"Balanced speed and capability",thinking:"Most capable, best for complex tasks"};function Ne(t){const e=B.c(20),{slot:s,onSlotChange:i,filterModels:n,defaultKeyId:o}=t,r=he(),[a,u]=R.useState(s?.keyId??o);let d;e[0]!==s?(d=()=>{s?.keyId&&u(s.keyId)},e[0]=s,e[1]=d):d=e[1];const m=s?.keyId;let f;e[2]!==m?(f=[m],e[2]=m,e[3]=f):f=e[3],R.useEffect(d,f);const c=a??o;let h;e[4]!==c||e[5]!==r?(h=c?r.find(v=>v.id===c):null,e[4]=c,e[5]=r,e[6]=h):h=e[6];const S=h,{models:b,isLoading:C}=ge(n?c??void 0:void 0),_=n?C||b.some(n):!0;let p;e[7]!==s||e[8]!==S?.providerId?(p=s?{modelId:s.modelId,title:s.title??s.modelId,keyId:s.keyId,providerId:S?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[7]=s,e[8]=S?.providerId,e[9]=p):p=e[9];const j=p;if(n&&!_){let v;return e[10]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),e[10]=v):v=e[10],v}let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=v=>u(v),e[11]=x):x=e[11];let N;e[12]!==c||e[13]!==i?(N=v=>{const w=v.keyId??c??"";u(w),i({keyId:w,modelId:v.modelId,title:v.title})},e[12]=c,e[13]=i,e[14]=N):N=e[14];let g;return e[15]!==c||e[16]!==n||e[17]!==j||e[18]!==N?(g=l.jsx(Kl,{variant:"bordered",placeholder:"Pick model",model:j,credentialId:c,filterModels:n,onCredentialChange:x,onModelChange:N}),e[15]=c,e[16]=n,e[17]=j,e[18]=N,e[19]=g):g=e[19],g}function Js(t){const e=B.c(2),{isPending:s,showSaved:i}=t;if(s){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Ze,{size:12,className:"animate-spin"}),"Saving…"]}),e[0]=n):n=e[0],n}if(i){let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(is,{size:12}),"Saved"]}),e[1]=n):n=e[1],n}return null}function Zs(){const t=he(),e=cs(),s=t.length>0,i=ke({resolver:Ee(ws),values:e,mode:"onChange"}),{mutate:n,isPending:o,isSuccess:r}=ds(),a=i.watch(),u=i.formState.isDirty;R.useEffect(()=>{if(!u)return;const p=setTimeout(()=>{n(a,{onSuccess:()=>i.reset(a,{keepValues:!0}),onError:j=>{i.reset(e),Y.error(`Failed to save: ${j.message}`)}})},250);return()=>clearTimeout(p)},[a,u,n,i,e]);const d=t[0],m=t[1],f=t[2],{models:c}=ge(d?.id),{models:h}=ge(m?.id),{models:S}=ge(f?.id),b=p=>{const j=i.getValues("chat");if(p&&!j.fast&&!j.smart&&!j.thinking){const x={};d?.id&&(x[d.id]=c),m?.id&&(x[m.id]=h),f?.id&&(x[f.id]=S);const N=Fe(t,x);i.reset({enabled:!0,chat:N.chat,image:N.image,webResearch:N.webResearch},{keepDirty:!0})}else i.setValue("enabled",p,{shouldDirty:!0})};R.useEffect(()=>{s||i.reset({enabled:!1,chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null})},[s,i]),R.useEffect(()=>{const p=i.getValues();if(!p.enabled)return;const j=new Set(t.map(E=>E.id)),x={};d?.id&&(x[d.id]=c),m?.id&&(x[m.id]=h),f?.id&&(x[f.id]=S);const N=E=>E!=null&&!j.has(E.keyId),g={fast:N(p.chat.fast)?null:p.chat.fast,smart:N(p.chat.smart)?null:p.chat.smart,thinking:N(p.chat.thinking)?null:p.chat.thinking},v=N(p.image)?null:p.image,w=N(p.webResearch)?null:p.webResearch,I=!g.fast||!g.smart||!g.thinking||!v||!w,k=g.fast===p.chat.fast&&g.smart===p.chat.smart&&g.thinking===p.chat.thinking;if(!I&&k)return;const y=Fe(t,x);i.reset({...p,chat:{fast:g.fast??y.chat.fast,smart:g.smart??y.chat.smart,thinking:g.thinking??y.chat.thinking},image:v??y.image,webResearch:w??y.webResearch},{keepDirty:!0})},[i,t,c,h,S,d?.id,m?.id,f?.id]);const _=i.watch("enabled")&&s;return l.jsx(je,{title:"Simple model mode",children:l.jsxs(Se,{children:[l.jsx(fe,{title:"Enable simple model mode",description:s?"Replace the model picker with a Fast / Smart / Thinking toggle for all members of this org.":"Connect an AI provider above to enable this feature.",action:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Js,{isPending:o,showSaved:r&&!u}),l.jsx(rs,{checked:_,onCheckedChange:b,disabled:o||!s})]})}),_&&l.jsxs(l.Fragment,{children:[["fast","smart","thinking"].map(p=>l.jsx(_e,{control:i.control,name:`chat.${p}`,render:({field:j})=>l.jsx(fe,{title:Gs[p],description:Xs[p],action:l.jsx(Ne,{slot:j.value,defaultKeyId:t[0]?.id??null,onSlotChange:x=>j.onChange(x)})})},p)),l.jsx("div",{className:"h-px bg-border mx-5"}),l.jsx(_e,{control:i.control,name:"image",render:({field:p})=>l.jsx(fe,{title:"Image",action:l.jsx(Ne,{slot:p.value,defaultKeyId:t[0]?.id??null,filterModels:Qs,onSlotChange:j=>p.onChange(j)})})}),l.jsx(_e,{control:i.control,name:"webResearch",render:({field:p})=>l.jsx(fe,{title:"Web research",action:l.jsx(Ne,{slot:p.value,defaultKeyId:t[0]?.id??null,filterModels:Ys,onSlotChange:j=>p.onChange(j)})})})]})]})})}function el(){const t=B.c(6),s=he().some(tl);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx(Ws,{}),t[0]=i):i=t[0];const n=s?"deco":void 0;let o;t[1]!==n?(o=l.jsx(St,{hideProviderId:n}),t[1]=n,t[2]=o):o=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx(R.Suspense,{fallback:l.jsx(Q,{className:"h-16 w-full"}),children:l.jsx(Zs,{})}),t[3]=r):r=t[3];let a;return t[4]!==o?(a=l.jsxs(l.Fragment,{children:[i,o,r]}),t[4]=o,t[5]=a):a=t[5],a}function tl(t){return t.providerId==="deco"}function vi(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(ye.Title,{children:"AI Providers"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(ye,{children:l.jsx(ye.Content,{children:l.jsx(ye.Body,{children:l.jsxs(os,{children:[e,l.jsx(Xe,{fallback:sl,children:l.jsx(R.Suspense,{fallback:l.jsx(Q,{className:"h-64 w-full"}),children:l.jsx(el,{})})})]})})})}),t[1]=s):s=t[1],s}function sl(t){const{error:e}=t;return l.jsx(Cs,{error:e??new Error("Failed to load AI providers")})}function ll(){const t=B.c(10),{org:e}=ie();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:re,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const i=ae(s);let n;t[3]!==e.id?(n=G.defaultBrand(e.id),t[3]=e.id,t[4]=n):n=t[4];let o;t[5]!==i?(o=async()=>{const u=await i.callTool({name:"BRAND_CONTEXT_LIST",arguments:{}}),d=us(u);return(Array.isArray(d?.items)?d.items:[]).find(il)??null},t[5]=i,t[6]=o):o=t[6];let r;t[7]!==n||t[8]!==o?(r={queryKey:n,queryFn:o},t[7]=n,t[8]=o,t[9]=r):r=t[9];const{data:a}=Je(r);return a??null}function il(t){return t.isDefault&&!t.archivedAt}function nl(t){const e=t.colors;if(!e)return null;if(Array.isArray(e)){const s=e.find(n=>typeof n=="object"&&n!==null&&"label"in n&&/primary|brand|main/i.test(n.label)),i=s?s.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const s=e;return s.primary??Object.values(s)[0]??null}return null}function ol(t){const e=B.c(31);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{title:i,description:n}=s,{org:o}=ie(),{localMode:r}=Ot(),a=ll(),u=o.name;let d;e[2]!==a?(d=a?nl(a):null,e[2]=a,e[3]=d):d=e[3];const m=d,f=a?.favicon??a?.logo??null,c=i??(u?`${u} is ready for agents`:"Your agents are almost ready"),h=n??"Choose how to power your AI team.",S=!!(f||m);let b;e[4]!==m?(b=m?{backgroundColor:`${m}18`,borderColor:`${m}30`}:void 0,e[4]=m,e[5]=b):b=e[5];const C=b,_=S?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-gradient-to-br from-lime-100 to-yellow-50 dark:from-lime-900/30 dark:to-yellow-900/20 border border-lime-300/40 dark:border-lime-700/30";let p;e[6]!==f||e[7]!==m?(p=f?l.jsx("img",{src:f,alt:"",className:"size-7 rounded object-contain"}):l.jsx(ss,{size:24,style:m?{color:m}:void 0,className:oe(!m&&"text-lime-600 dark:text-lime-400")}),e[6]=f,e[7]=m,e[8]=p):p=e[8];let j;e[9]!==_||e[10]!==C||e[11]!==p?(j=l.jsx("div",{className:_,style:C,children:p}),e[9]=_,e[10]=C,e[11]=p,e[12]=j):j=e[12];let x;e[13]!==c?(x=l.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:c}),e[13]=c,e[14]=x):x=e[14];let N;e[15]!==h?(N=l.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:h}),e[15]=h,e[16]=N):N=e[16];let g;e[17]!==x||e[18]!==N?(g=l.jsxs("div",{className:"space-y-2",children:[x,N]}),e[17]=x,e[18]=N,e[19]=g):g=e[19];let v;e[20]!==j||e[21]!==g?(v=l.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[j,g]}),e[20]=j,e[21]=g,e[22]=v):v=e[22];let w;e[23]!==r?(w=r&&l.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Local models + use your existing AI provider"}),e[23]=r,e[24]=w):w=e[24];let I;e[25]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx(R.Suspense,{fallback:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full",children:[l.jsx(Q,{className:"h-32 w-full rounded-lg"}),l.jsx(Q,{className:"h-32 w-full rounded-lg"})]}),children:l.jsx(St,{})}),e[25]=I):I=e[25];let k;e[26]!==w?(k=l.jsxs("div",{className:"w-full space-y-3",children:[w,I]}),e[26]=w,e[27]=k):k=e[27];let y;return e[28]!==k||e[29]!==v?(y=l.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-2xl px-4",children:[v,k]}),e[28]=k,e[29]=v,e[30]=y):y=e[30],y}function Pe(t){const e=t.title.includes(": ");return{provider:e?t.title.split(": ")[0]??"":t.modelId.split("/")[0]??"",displayName:e?t.title.split(": ").slice(1).join(": "):t.title}}const _t=["smarter","faster","cheaper"],Nt={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},rl=[{tier:"smarter",prefixes:["claude-code:opus","anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","codex:gpt-5.4","codex:gpt-5.4-mini","codex:gpt-5.3-codex","codex:gpt-5.2-codex","codex:gpt-5.1-codex-max","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["claude-code:sonnet","anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","codex:gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["claude-code:haiku","google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],al=rl.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),cl=new Set(["google/gemini-2.5-pro"]),Qe=new Map;function dl(t){const e=Qe.get(t);if(e!==void 0)return e;let s=null;if(t.endsWith(":free"))s="cheaper";else e:for(const{tier:i,prefix:n}of al)if(t.startsWith(n)){if(cl.has(n)&&t.length>n.length&&t[n.length]==="-"){const r=t[n.length+1];if(!r||!/\d/.test(r))continue e}s=i;break}return Qe.set(t,s),s}function Ye(t){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const s of t){const i=dl(s.modelId);e[i??"other"].push(s)}for(const s of Object.keys(e))e[s].sort((i,n)=>i.title.localeCompare(n.title));return e}const wt="mesh:model-shortlist:",ml=new Set(["anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function ul(t){try{const e=localStorage.getItem(wt+t);return e?new Set(JSON.parse(e)):null}catch{return null}}function fl(t,e){localStorage.setItem(wt+t,JSON.stringify([...e]))}function hl(t){return t<32e3?{level:1,label:"Small",description:"Short conversations"}:t<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:t<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const pl=["bg-destructive","bg-warning","bg-success","bg-success"],xl=["text-success","text-warning","text-warning","text-destructive"];function gl(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function bl(t){return t<1?{level:1,label:"Cheap"}:t<5?{level:2,label:"Moderate"}:t<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const vl={text:{icon:l.jsx(Xt,{className:"size-3.5"}),label:"Text"},vision:{icon:l.jsx(Gt,{className:"size-3.5"}),label:"Vision"},image:{icon:l.jsx(Jt,{className:"size-3.5"}),label:"Image"},tools:{icon:l.jsx(Yt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:l.jsx(Qt,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:l.jsx(ot,{className:"size-3.5"}),label:"Web search"}};function yl(t){const e=B.c(5),{capability:s}=t;let i;e[0]!==s?(i=vl[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=i):i=e[1];const n=i;let o;return e[2]!==n.icon||e[3]!==n.label?(o=l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[n.icon,n.label]}),e[2]=n.icon,e[3]=n.label,e[4]=o):o=e[4],o}function jl(t){const e=B.c(49),{model:s,compact:i}=t,n=i===void 0?!1:i;if(!s){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=s.costs?.input!=null?s.costs.input*1e6:null,r=s.costs?.output!=null?s.costs.output*1e6:null;let a;e[1]!==s?(a=Pe(s),e[1]=s,e[2]=a):a=e[2];const{provider:u,displayName:d}=a;if(n){let g;e[3]!==s.limits?(g=s.limits?.contextWindow&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Context"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=s.limits,e[4]=g):g=e[4];let v;e[5]!==o?(v=o!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=v):v=e[6];let w;e[7]!==r?(w=r!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[7]=r,e[8]=w):w=e[8];let I;e[9]!==s.limits?(I=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=s.limits,e[10]=I):I=e[10];let k;return e[11]!==g||e[12]!==v||e[13]!==w||e[14]!==I?(k=l.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,v,w,I]}),e[11]=g,e[12]=v,e[13]=w,e[14]=I,e[15]=k):k=e[15],k}let m;e[16]!==u?(m=l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:u}),e[16]=u,e[17]=m):m=e[17];let f;e[18]!==s.logo||e[19]!==s.title?(f=s.logo&&l.jsx("img",{src:s.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[18]=s.logo,e[19]=s.title,e[20]=f):f=e[20];let c;e[21]!==d?(c=l.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:d}),e[21]=d,e[22]=c):c=e[22];let h;e[23]!==f||e[24]!==c?(h=l.jsxs("div",{className:"flex items-center gap-2.5",children:[f,c]}),e[23]=f,e[24]=c,e[25]=h):h=e[25];let S;e[26]!==s.modelId?(S=l.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.modelId}),e[26]=s.modelId,e[27]=S):S=e[27];let b;e[28]!==m||e[29]!==h||e[30]!==S?(b=l.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[m,h,S]}),e[28]=m,e[29]=h,e[30]=S,e[31]=b):b=e[31];let C;e[32]!==s.capabilities?(C=s.capabilities&&s.capabilities.length>0&&l.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(s.capabilities)].map(Sl)}),e[32]=s.capabilities,e[33]=C):C=e[33];let _;e[34]!==s.limits?(_=s.limits?.contextWindow&&(()=>{const{level:g,label:v,description:w}=hl(s.limits.contextWindow);return l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(I=>l.jsx("div",{className:oe("w-2 h-2 rounded-full",I<=g?pl[g-1]:"bg-muted")},I))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:v}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",w]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=s.limits,e[35]=_):_=e[35];let p;e[36]!==s.limits?(p=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsxs("span",{className:"text-sm text-foreground",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]}),l.jsx("span",{className:"text-sm text-muted-foreground",children:gl(s.limits.maxOutputTokens)})]})]}),e[36]=s.limits,e[37]=p):p=e[37];let j;e[38]!==o||e[39]!==r?(j=(o!=null||r!=null)&&(()=>{const{level:g,label:v}=o!=null?bl(o):{level:0,label:""};return l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(w=>l.jsx("span",{className:oe("text-sm font-bold leading-none",w<=g?xl[g-1]:"text-muted-foreground/20"),children:"$"},w))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:v})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),r!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=r,e[40]=j):j=e[40];let x;e[41]!==_||e[42]!==p||e[43]!==j?(x=l.jsxs("div",{className:"flex flex-col gap-6",children:[_,p,j]}),e[41]=_,e[42]=p,e[43]=j,e[44]=x):x=e[44];let N;return e[45]!==x||e[46]!==b||e[47]!==C?(N=l.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[b,C,x]}),e[45]=x,e[46]=b,e[47]=C,e[48]=N):N=e[48],N}function Sl(t){return l.jsx(yl,{capability:t},t)}function _l(t){const e=B.c(21),{model:s,onHover:i}=t;let n;e[0]!==s?(n=Pe(s),e[0]=s,e[1]=n):n=e[1];const{displayName:o,provider:r}=n;let a;e[2]!==s?(a=Te(s),e[2]=s,e[3]=a):a=e[3];const u=a;let d;e[4]!==s||e[5]!==i?(d=()=>i(s),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;e[7]!==s.title||e[8]!==u?(m=l.jsx("img",{src:u,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[7]=s.title,e[8]=u,e[9]=m):m=e[9];let f;e[10]!==o?(f=l.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=f):f=e[11];let c;e[12]!==r?(c=l.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=c):c=e[13];let h;e[14]!==f||e[15]!==c?(h=l.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[f,c]}),e[14]=f,e[15]=c,e[16]=h):h=e[16];let S;return e[17]!==d||e[18]!==m||e[19]!==h?(S=l.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[m,h]}),e[17]=d,e[18]=m,e[19]=h,e[20]=S):S=e[20],S}function Nl(t){const e=B.c(10),{error:s,onRetry:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:l.jsx(Pt,{className:"size-5 text-destructive"})}),e[0]=n):n=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const r=s?.message||"Could not fetch models from this provider.";let a;e[2]!==r?(a=l.jsxs("div",{className:"flex flex-col gap-1",children:[o,l.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[r," Try another provider or retry."]})]}),e[2]=r,e[3]=a):a=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsx(Zt,{className:"size-3.5"}),e[4]=u):u=e[4];let d;e[5]!==i?(d=l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs(te,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[u,"Retry"]})}),e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==a||e[8]!==d?(m=l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[n,a,d]}),e[7]=a,e[8]=d,e[9]=m):m=e[9],m}function wl(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Cl)}),t[0]=e):e=t[0],e}function Cl(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(Q,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(Q,{className:"flex-1 h-4"}),l.jsx(Q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ge(t){const e=B.c(12),{label:s,models:i,onSelect:n,onHover:o}=t;if(i.length===0)return null;let r;e[0]!==s?(r=l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:s}),e[0]=s,e[1]=r):r=e[1];let a;if(e[2]!==i||e[3]!==o||e[4]!==n){let d;e[6]!==o||e[7]!==n?(d=m=>l.jsx("div",{onClick:()=>n(m),className:"cursor-pointer",children:l.jsx(_l,{model:m,onHover:o})},m.modelId),e[6]=o,e[7]=n,e[8]=d):d=e[8],a=i.map(d),e[2]=i,e[3]=o,e[4]=n,e[5]=a}else a=e[5];let u;return e[9]!==r||e[10]!==a?(u=l.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=u):u=e[11],u}function Il(t){const e=B.c(21),{model:s,isChecked:i,onToggle:n,onHover:o}=t,[r,a]=R.useState(i);r!==i&&a(i);let u;e[0]!==s?(u=Te(s),e[0]=s,e[1]=u):u=e[1];const d=u;let m;e[2]!==s||e[3]!==o?(m=()=>o(s),e[2]=s,e[3]=o,e[4]=m):m=e[4];let f;e[5]!==s.modelId||e[6]!==n?(f=()=>{a(kl),n(s.modelId)},e[5]=s.modelId,e[6]=n,e[7]=f):f=e[7];let c;e[8]!==r||e[9]!==f?(c=l.jsx(Rt,{checked:r,onCheckedChange:f}),e[8]=r,e[9]=f,e[10]=c):c=e[10];let h;e[11]!==d||e[12]!==s.title?(h=l.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[11]=d,e[12]=s.title,e[13]=h):h=e[13];let S;e[14]!==s.title?(S=l.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:s.title}),e[14]=s.title,e[15]=S):S=e[15];let b;return e[16]!==m||e[17]!==c||e[18]!==h||e[19]!==S?(b=l.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:m,children:[c,h,S]}),e[16]=m,e[17]=c,e[18]=h,e[19]=S,e[20]=b):b=e[20],b}function kl(t){return!t}function El(t){const e=[];for(const s of _t)if(t[s].length>0){e.push({type:"header",label:Nt[s]});for(const i of t[s])e.push({type:"model",model:i})}if(t.other.length>0){e.push({type:"header",label:"Other"});for(const s of t.other)e.push({type:"model",model:s})}return e}function Ml({items:t,shortlistSet:e,onToggle:s,onHover:i}){const n=R.useRef(null),o=Ns({count:t.length,getScrollElement:()=>n.current,estimateSize:r=>t[r]?.type==="header"?36:44,overscan:6});return l.jsx("div",{ref:n,className:"flex-1 overflow-y-auto",children:l.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const a=t[r.index];return a?l.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:a.type==="header"?l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:a.label}):l.jsx(Il,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:s,onHover:i})},r.key):null})})})}function Al(t){const e=B.c(23),{keyId:s,searchTerm:i,onHover:n,onModelSelect:o,managing:r,onToggleManage:a,filterModels:u}=t,{models:d}=ge(s),m=u?d.filter(u):d.filter(Ol);let f;e[0]!==s?(f=()=>(s?ul(s):null)??ml,e[0]=s,e[1]=f):f=e[1];const[c,h]=R.useState(f),[,S]=R.useTransition();let b;e[2]!==s||e[3]!==S?(b=k=>{s&&S(()=>{h(y=>{const E=new Set(y);return E.has(k)?E.delete(k):E.add(k),fl(s,E),E})})},e[2]=s,e[3]=S,e[4]=b):b=e[4];const C=b,_=i.toLowerCase().trim(),p=k=>_?k.filter(y=>y.title.toLowerCase().includes(_)||y.modelId.toLowerCase().includes(_)):k;if(r){const k=Ye(p(m)),y=El(k);let E;e[5]!==c?(E=O=>c.has(O.modelId),e[5]=c,e[6]=E):E=e[6];const P=m.filter(E).length;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(es,{size:14}),e[7]=M):M=e[7];let A;return e[8]!==a?(A=l.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[M,"Back"]}),e[8]=a,e[9]=A):A=e[9],l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[A,l.jsxs("span",{className:"text-xs text-muted-foreground",children:[P," selected"]})]}),l.jsx(Ml,{items:y,shortlistSet:c,onToggle:C,onHover:n})]})}let j;e[10]!==c?(j=k=>c.has(k.modelId),e[10]=c,e[11]=j):j=e[11];const x=m.filter(j),N=x.length>0?x:m,g=Ye(p(N));let v;e[12]!==g||e[13]!==n||e[14]!==o?(v=_t.map(k=>l.jsx(Ge,{label:Nt[k],models:g[k],onSelect:o,onHover:n},k)),e[12]=g,e[13]=n,e[14]=o,e[15]=v):v=e[15];let w;e[16]!==g.other||e[17]!==n||e[18]!==o?(w=l.jsx(Ge,{label:"Other",models:g.other,onSelect:o,onHover:n}),e[16]=g.other,e[17]=n,e[18]=o,e[19]=w):w=e[19];let I;return e[20]!==v||e[21]!==w?(I=l.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[v,w]}),e[20]=v,e[21]=w,e[22]=I):I=e[22],I}function Ol(t){return t.asyncResearch!==!0}function Ct(t){const e=B.c(19),{model:s,placeholder:i,isLoading:n}=t,o=i===void 0?"Select model":i;if(n===void 0?!1:n){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Q,{className:"w-5 h-5 rounded-sm shrink-0"}),l.jsx(Q,{className:"w-16 h-3 hidden md:block"})]}),e[0]=b):b=e[0],b}if(!s){let b;e[1]!==o?(b=l.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=b):b=e[2];let C;e[3]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=C):C=e[3];let _;return e[4]!==b?(_=l.jsxs("div",{className:"flex items-center gap-1.5",children:[b,C]}),e[4]=b,e[5]=_):_=e[5],_}let a;e[6]!==s?(a=Pe(s),e[6]=s,e[7]=a):a=e[7];const{displayName:u}=a;let d;e[8]!==s?(d=Te(s),e[8]=s,e[9]=d):d=e[9];const m=d;let f;e[10]!==s.title||e[11]!==m?(f=l.jsx("img",{src:m,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[10]=s.title,e[11]=m,e[12]=f):f=e[12];let c;e[13]!==u?(c=l.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:u}),e[13]=u,e[14]=c):c=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=h):h=e[15];let S;return e[16]!==f||e[17]!==c?(S=l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[f,c,h]}),e[16]=f,e[17]=c,e[18]=S):S=e[18],S}const Tl=["vision","image","file","audio","video"],It=["image/png","image/jpeg","image/gif","image/webp"],kt=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Re(t){const e=t?.capabilities;return e?Tl.some(s=>e.includes(s)):!1}function yi(t,e){if(!t)return!1;if(t.startsWith("text/"))return!0;const s=e?.capabilities??[],i=s.includes("vision")||s.includes("image"),n=s.includes("file"),o=s.includes("audio"),r=s.includes("video");return!!(i&&It.includes(t)||n&&t==="application/pdf"||o&&t.startsWith("audio/")||r&&t.startsWith("video/")||Re(e)&&kt.includes(t))}function ji(t){const e=t?.capabilities??[],s=["text/*"];return(e.includes("vision")||e.includes("image"))&&s.push(...It),e.includes("file")&&s.push("application/pdf"),e.includes("audio")&&s.push("audio/*"),e.includes("video")&&s.push("video/*"),Re(t)&&s.push(...kt),s.join(",")}function Si(t){const e=t?.capabilities??[],s=[];return(e.includes("vision")||e.includes("image"))&&s.push("images"),e.includes("file")&&s.push("PDFs"),e.includes("audio")&&s.push("audio"),e.includes("video")&&s.push("video"),Re(t)&&s.push("Office files"),s.length===0?"text only":s.length===1?s[0]:s.length===2?`${s[0]} and ${s[1]}`:`${s.slice(0,-1).join(", ")}, and ${s.at(-1)}`}function Pl(){const t=B.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:l.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[l.jsx(Q,{className:"size-4 shrink-0"}),l.jsx(Q,{className:"flex-1 h-6"}),l.jsx(Q,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(Rl)})]}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx(Q,{className:"size-6 shrink-0"}),l.jsx(Q,{className:"h-6 w-32"})]}),t[2]=i):i=t[2];let n;t[3]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Q,{className:"h-6 w-20 rounded-md"}),l.jsx(Q,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=n):n=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(Q,{className:"h-4 w-24"}),l.jsx(Q,{className:"h-4 w-32"})]}),t[4]=o):o=t[4];let r;return t[5]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[s,l.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:l.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[n,l.jsxs("div",{className:"flex flex-col gap-4",children:[o,l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(Q,{className:"h-4 w-16"}),l.jsx(Q,{className:"h-4 w-40"})]})]})]})})]}),t[5]=r):r=t[5],r}function Rl(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(Q,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(Q,{className:"flex-1 h-4"}),l.jsx(Q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Et(t){const e=B.c(49),{onClose:s,credentialId:i,onCredentialChange:n,selectedModel:o,onModelChange:r,filterModels:a}=t,[u,d]=R.useState(null),[m,f]=R.useState(""),[c,h]=R.useState(!1),S=R.useRef(null),b=rt(),C=he();let _;e[0]!==b?.providers?(_=Object.fromEntries((b?.providers??[]).map(Fl)),e[0]=b?.providers,e[1]=_):_=e[1];const p=_,j=Tt(),{org:x}=ie();let N;e[2]!==n?(N=T=>{n(T),d(null)},e[2]=n,e[3]=N):N=e[3];const g=N;let v;e[4]!==i||e[5]!==s||e[6]!==r?(v=T=>{i&&(r(T),f(""),s())},e[4]=i,e[5]=s,e[6]=r,e[7]=v):v=e[7];const w=v;if(C.length===0){let T;return e[8]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:l.jsx(ol,{})}),e[8]=T):T=e[8],T}let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx(ot,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=I):I=e[9];const k=c?"Search all models...":"Search for a model...";let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=T=>f(T.target.value),e[10]=y):y=e[10];let E;e[11]!==m||e[12]!==k?(E=l.jsx(ne,{ref:S,type:"text",placeholder:k,value:m,onChange:y,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[11]=m,e[12]=k,e[13]=E):E=e[13];let P;e[14]!==i||e[15]!==g||e[16]!==C||e[17]!==p?(P=C.length>0&&l.jsxs(Ut,{value:i??"",onValueChange:g,children:[l.jsxs(Bt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:zl,children:[l.jsx(Vt,{placeholder:"Key",children:(()=>{const T=C.find(pe=>pe.id===i),H=T?p[T.providerId]:void 0,X=We(T?.presetId),ee=X?.logo??H?.logo,Z=X?.name??H?.name??T?.providerId??"Key";return l.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[ee?l.jsx("img",{src:ee,alt:Z,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:Z.slice(0,1).toUpperCase()}),l.jsx("span",{className:"text-xs truncate",children:Z})]})})()}),l.jsx(Ht,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),l.jsx(Wt,{children:C.map(T=>{const H=p[T.providerId],X=We(T.presetId),ee=X?.logo??H?.logo,Z=X?.name??H?.name??T.providerId;return l.jsx(qt,{value:T.id,children:l.jsxs("div",{className:"flex items-center gap-2",children:[ee?l.jsx("img",{src:ee,alt:Z,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:Z.slice(0,1).toUpperCase()}),l.jsxs("span",{children:[Z," — ",T.label]})]})},T.id)})})]}),e[14]=i,e[15]=g,e[16]=C,e[17]=p,e[18]=P):P=e[18];let M;e[19]!==E||e[20]!==P?(M=l.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:l.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[I,E,P]})}),e[19]=E,e[20]=P,e[21]=M):M=e[21];let A;e[22]!==i?(A=T=>{const{error:H,resetError:X}=T;return l.jsx(Nl,{error:H,onRetry:X,credentialId:i??void 0})},e[22]=i,e[23]=A):A=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=l.jsx(wl,{}),e[24]=O):O=e[24];const L=i??void 0;let V;e[25]===Symbol.for("react.memo_cache_sentinel")?(V=()=>h(Ll),e[25]=V):V=e[25];let K;e[26]!==a||e[27]!==w||e[28]!==c||e[29]!==m||e[30]!==L?(K=l.jsx(R.Suspense,{fallback:O,children:l.jsx(Al,{keyId:L,searchTerm:m,onHover:d,onModelSelect:w,managing:c,onToggleManage:V,filterModels:a})}),e[26]=a,e[27]=w,e[28]=c,e[29]=m,e[30]=L,e[31]=K):K=e[31];let $;e[32]!==i||e[33]!==A||e[34]!==K?($=l.jsx(Xe,{fallback:A,children:K},i),e[32]=i,e[33]=A,e[34]=K,e[35]=$):$=e[35];let z;e[36]!==c||e[37]!==j||e[38]!==x?(z=!c&&l.jsxs("div",{className:"border-t border-border flex",children:[l.jsxs("button",{type:"button",onClick:()=>R.startTransition(()=>h(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx(ts,{className:"size-3.5 shrink-0"}),"Manage models"]}),l.jsx("div",{className:"w-px bg-border shrink-0"}),l.jsxs("button",{type:"button",onClick:()=>j({to:"/$org/settings/ai-providers",params:{org:x.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx(nt,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[36]=c,e[37]=j,e[38]=x,e[39]=z):z=e[39];let F;e[40]!==$||e[41]!==z||e[42]!==M?(F=l.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[M,$,z]}),e[40]=$,e[41]=z,e[42]=M,e[43]=F):F=e[43];const U=u??o??null;let W;e[44]!==U?(W=l.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:l.jsx(jl,{model:U})}),e[44]=U,e[45]=W):W=e[45];let q;return e[46]!==F||e[47]!==W?(q=l.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[F,W]}),e[46]=F,e[47]=W,e[48]=q):q=e[48],q}function Ll(t){return!t}function zl(t){return t.stopPropagation()}function Fl(t){return[t.id,t]}function Dl(t){const e=B.c(12),{onClose:s}=t,{credentialId:i,setCredentialId:n,selectedModel:o,setModel:r}=at();let a;e[0]!==n?(a=m=>{J("chat_credential_changed",{credential_id:m}),n(m)},e[0]=n,e[1]=a):a=e[1];let u;e[2]!==i||e[3]!==o?.modelId||e[4]!==r?(u=m=>{i&&(J("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:m.modelId,to_model_provider:m.providerId??null,credential_id:i}),r({...m,keyId:i}))},e[2]=i,e[3]=o?.modelId,e[4]=r,e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==s||e[8]!==o||e[9]!==a||e[10]!==u?(d=l.jsx(Et,{onClose:s,credentialId:i,onCredentialChange:a,selectedModel:o,onModelChange:u}),e[6]=i,e[7]=s,e[8]=o,e[9]=a,e[10]=u,e[11]=d):d=e[11],d}function Kl(t){const e=B.c(38),{variant:s,className:i,placeholder:n,model:o,isLoading:r,credentialId:a,onCredentialChange:u,onModelChange:d,filterModels:m}=t,f=s===void 0?"borderless":s,c=n===void 0?"Select model":n,[h,S]=R.useState(!1),b=d!==void 0,C=$t(),_=f==="borderless"?"ghost":"outline",p=f==="borderless"&&"md:border-none";let j;e[0]!==i||e[1]!==p?(j=oe("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",p,i),e[0]=i,e[1]=p,e[2]=j):j=e[2];let x;e[3]!==r||e[4]!==o||e[5]!==c||e[6]!==b?(x=b?l.jsx(Ct,{model:o??null,placeholder:c,isLoading:r}):l.jsx(Ul,{placeholder:c}),e[3]=r,e[4]=o,e[5]=c,e[6]=b,e[7]=x):x=e[7];let N;e[8]!==_||e[9]!==j||e[10]!==x?(N=l.jsx(te,{variant:_,size:"sm",className:j,children:x}),e[8]=_,e[9]=j,e[10]=x,e[11]=N):N=e[11];const g=N;let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=l.jsx(Pl,{}),e[12]=v):v=e[12];let w;e[13]!==a||e[14]!==m||e[15]!==o||e[16]!==u||e[17]!==d||e[18]!==b?(w=l.jsx(R.Suspense,{fallback:v,children:b?l.jsx(Et,{onClose:()=>S(!1),credentialId:a??null,onCredentialChange:u??$l,selectedModel:o??null,onModelChange:d,filterModels:m}):l.jsx(Dl,{onClose:()=>S(!1)})}),e[13]=a,e[14]=m,e[15]=o,e[16]=u,e[17]=d,e[18]=b,e[19]=w):w=e[19];const I=w;if(C){let M;e[20]!==g?(M=l.jsx(zt,{asChild:!0,children:g}),e[20]=g,e[21]=M):M=e[21];let A;e[22]===Symbol.for("react.memo_cache_sentinel")?(A=l.jsx(Ft,{className:"sr-only",children:"Select model"}),e[22]=A):A=e[22];let O;e[23]!==I?(O=l.jsxs(Dt,{className:"p-0 flex flex-col max-h-[95vh]",children:[A,l.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:I})]}),e[23]=I,e[24]=O):O=e[24];let L;return e[25]!==h||e[26]!==M||e[27]!==O?(L=l.jsxs(Kt,{open:h,onOpenChange:S,children:[M,O]}),e[25]=h,e[26]=M,e[27]=O,e[28]=L):L=e[28],L}let k;e[29]!==g?(k=l.jsx(Lt,{asChild:!0,children:g}),e[29]=g,e[30]=k):k=e[30];let y;e[31]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(Oe,{className:"sr-only",children:"Select model"}),e[31]=y):y=e[31];let E;e[32]!==I?(E=l.jsxs(Ae,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[y,I]}),e[32]=I,e[33]=E):E=e[33];let P;return e[34]!==h||e[35]!==k||e[36]!==E?(P=l.jsxs(Me,{open:h,onOpenChange:S,children:[k,E]}),e[34]=h,e[35]=k,e[36]=E,e[37]=P):P=e[37],P}function $l(){}function Ul(t){const e=B.c(4),{placeholder:s}=t,{selectedModel:i,isModelsLoading:n}=at();let o;return e[0]!==n||e[1]!==i||e[2]!==s?(o=l.jsx(Ct,{model:i,placeholder:s,isLoading:n}),e[0]=n,e[1]=i,e[2]=s,e[3]=o):o=e[3],o}export{Kl as M,ol as N,vi as O,Si as a,ji as g,yi as i,Re as m};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/registry-layout-D-sbU1qd.js","assets/index-Dl2t23Jt.js","assets/index-DXHNyf1g.css","assets/ArrowNarrowLeft-DHj5-FLY.js","assets/CheckCircle-D9qlmIve.js","assets/Container-BCDxdJoG.js","assets/Settings02-BOckjEVU.js","assets/XCircle-DZEMwZj2.js","assets/constants-CfwGLQ49.js","assets/useInfiniteQuery-3jN4yA7O.js","assets/infiniteQueryObserver-cqTNhL_G.js","assets/badge-_ZGDO29b.js","assets/input-CluxDyoT.js","assets/dropdown-menu-C6XDnng5.js","assets/ChevronDown-tb8ftSUO.js","assets/ChevronRight-BIm0-OSp.js","assets/DotsVertical-DEE8M0V4.js","assets/table-rVVQNhet.js","assets/toggle-group-COcCk4lG.js","assets/use-view-mode-w75x4zz0.js","assets/tooltip-CxizQODk.js","assets/SearchMd-IP-R-mtT.js","assets/dialog-CoECADf1.js","assets/X-viKat0oa.js","assets/AlertCircle-CbUYZGF-.js","assets/alert-dialog-BvuFarFf.js","assets/card-oSxwoJvZ.js","assets/Trash01-DaGrAtTq.js","assets/label-CHKFYnQo.js","assets/select-C0JTp_6a.js","assets/ChevronUp-ClqSoLtD.js","assets/switch-W_Nrj6rK.js","assets/textarea-Cld3tG5R.js","assets/RefreshCcw01-Cr84gVY8.js","assets/checkbox-CzxaEVzA.js","assets/LinkExternal01-DM7IwrPj.js","assets/use-copy-CHAuyAMC.js","assets/Plus-BrBimbff.js","assets/Play-DSYx2GJ2.js"])))=>i.map(i=>d[i]);
2
- import{e as n,f as c,g as m,j as r,l as f,r as l,_ as u}from"./index-Dl2t23Jt.js";const _=l.lazy(()=>u(()=>import("./registry-layout-D-sbU1qd.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38])));function x(){const e=n.c(5),o=c();let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={from:"/shell/$org"},e[0]=t):t=e[0];const{org:i}=m(t);let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(f,{size:20,className:"animate-spin text-muted-foreground"})}),e[1]=s):s=e[1];let a;return e[2]!==o||e[3]!==i?(a=r.jsx(l.Suspense,{fallback:s,children:r.jsx(_,{onBack:()=>o({to:"/$org/settings/store",params:{org:i}})})}),e[2]=o,e[3]=i,e[4]=a):a=e[4],a}export{x as default};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-cqTNhL_G.js";import{c2 as i}from"./index-Dl2t23Jt.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{I as s}from"./infiniteQueryObserver-cqTNhL_G.js";import{c2 as u,c3 as n}from"./index-Dl2t23Jt.js";function a(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:n},s,e)}export{a as u};
@@ -1 +0,0 @@
1
- import{e as oe,j as t,B as Ce,f as Be,b as ct,s as ze,r as dt,x as Le,o as ut,a as mt,K as Fe,Y as Ke,Z as pt}from"./index-Dl2t23Jt.js";import{u as Ve,S as qe}from"./constants-CfwGLQ49.js";import{B as ft,g as Me}from"./constants-CVDNjJTw.js";import{C as Qe}from"./collection-display-button-CPI0oCFf.js";import{C as ht}from"./collection-search-u94VKjvs.js";import{C as gt}from"./card-oSxwoJvZ.js";import{I as Ge}from"./integration-icon-BipCD_m-.js";import{D as He,a as Ye,b as Je,c as O}from"./dropdown-menu-C6XDnng5.js";import{c as Ze}from"./XCircle-DZEMwZj2.js";import{i as Xe}from"./DotsVertical-DEE8M0V4.js";import{y as et,H as Ue}from"./agent-icon-BXkkrCT3.js";import{s as tt}from"./RefreshCcw01-Cr84gVY8.js";import{s as st}from"./Trash01-DaGrAtTq.js";import{C as xt}from"./collection-table-wrapper-LzV9CSI7.js";import{E as We}from"./empty-state-DoKR-jUX.js";import{U as jt}from"./user-QrqGbmQG.js";import{E as it}from"./empty-state-Be0X9mox.js";import{u as Ct}from"./use-list-state-Jttwyvy3.js";import{g as bt}from"./connection-slug-eyAPH6o3.js";import{f as vt,g as yt,c as Nt,b as wt,d as St,e as Pt,a as _t,A as Dt}from"./alert-dialog-BvuFarFf.js";import{a as It,c as At}from"./use-collections-CwD8DZNY.js";import{a as Tt}from"./use-connection-pSv7eY2y.js";import{s as Et}from"./Plus-BrBimbff.js";import{a as Ot}from"./layout-CV5Wi0Ex.js";import{P as je}from"./index-Bcf94soS.js";import"./collections-Cn7VbUFT.js";import"./XClose-DY7O9VST.js";import"./ChevronDown-tb8ftSUO.js";import"./tooltip-CxizQODk.js";import"./view-mode-toggle-C9HAxT_f.js";import"./badge-_ZGDO29b.js";import"./SearchMd-IP-R-mtT.js";import"./Container-BCDxdJoG.js";import"./ChevronRight-BIm0-OSp.js";import"./AlertCircle-CbUYZGF-.js";import"./Tool01-D1Rvo01i.js";import"./ArrowNarrowLeft-DHj5-FLY.js";import"./ArrowUpRight-BK_iYZ-J.js";import"./ZapSquare-BDbWe-zU.js";import"./Users03-DH9QAbco.js";import"./CheckCircle-D9qlmIve.js";import"./ChevronUp-ClqSoLtD.js";import"./Star01-PFA-ZRDO.js";import"./Palette-BrJL0UcN.js";import"./LinkExternal01-DM7IwrPj.js";import"./Lock01-BmjkKSvK.js";import"./Sun-B7BWJEHb.js";import"./Play-DSYx2GJ2.js";import"./Settings02-BOckjEVU.js";import"./Shield01-CJggUHAQ.js";import"./User01-DmtseI1g.js";import"./X-viKat0oa.js";import"./Zap-BMzMPNv3.js";import"./table-rVVQNhet.js";import"./avatar-C4FRugJb.js";import"./use-view-mode-w75x4zz0.js";function $t(i,e){const s=i.properties||{};for(const n in s){const c=s[n];if(c&&c.type==="string"&&(c.format==="url"||c.format==="uri")&&e&&typeof e=="object"&&n in e&&e[n])return e[n]}const r=["image","img","avatar","icon","logo","thumbnail","cover"];for(const n of r)if(e&&typeof e=="object"&&n in e&&typeof e[n]=="string")return e[n]}function kt(i){const e=oe.c(25),{item:s,schema:r,actions:n}=i;let c;e[0]!==s||e[1]!==r?(c=$t(r,s),e[0]=s,e[1]=r,e[2]=c):c=e[2];const l=c,p=s&&typeof s=="object"&&"description"in s&&typeof s.description=="string"?s.description:void 0;let d;e[3]!==n?(d=n&&Object.keys(n).length>0,e[3]=n,e[4]=d):d=e[4];const o=d;let m;e[5]!==l||e[6]!==s.title?(m=t.jsx(Ge,{icon:l,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=l,e[6]=s.title,e[7]=m):m=e[7];let u;e[8]!==s.title?(u=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:s.title}),e[8]=s.title,e[9]=u):u=e[9];const f=p||"No description";let a;e[10]!==f?(a=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:f}),e[10]=f,e[11]=a):a=e[11];let v;e[12]!==u||e[13]!==a?(v=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[u,a]}),e[12]=u,e[13]=a,e[14]=v):v=e[14];let y;e[15]!==m||e[16]!==v?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,v]}),e[15]=m,e[16]=v,e[17]=y):y=e[17];let b;e[18]!==n||e[19]!==o||e[20]!==s?(b=o&&t.jsx("div",{className:"absolute top-6 right-6 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",onClick:Kt,onMouseDown:Ft,children:t.jsxs(He,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(Ce,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Lt,children:t.jsx(Xe,{size:20})})}),t.jsxs(Je,{align:"end",onClick:zt,children:[n.open&&t.jsxs(O,{onClick:g=>{g.stopPropagation(),n.open?.(s)},children:[t.jsx(tt,{size:16}),"Open"]}),n.edit&&t.jsxs(O,{onClick:g=>{g.stopPropagation(),n.edit?.(s)},children:[t.jsx(et,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(O,{onClick:g=>{g.stopPropagation(),n.duplicate?.(s)},children:[t.jsx(Ze,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(O,{variant:"destructive",onClick:g=>{g.stopPropagation(),n.delete?.(s)},children:[t.jsx(st,{size:16}),"Delete"]})]})]})}),e[18]=n,e[19]=o,e[20]=s,e[21]=b):b=e[21];let x;return e[22]!==y||e[23]!==b?(x=t.jsxs(gt,{className:"cursor-pointer transition-colors hover:bg-accent/50 h-full flex flex-col group relative",children:[y,b]}),e[22]=y,e[23]=b,e[24]=x):x=e[24],x}function zt(i){return i.stopPropagation()}function Lt(i){return i.stopPropagation()}function Ft(i){return i.stopPropagation()}function Kt(i){return i.stopPropagation()}const Mt=["icon","avatar","logo"],Re=["created_at","created_by","id"];function Ut(i){return Object.keys(i).find(e=>Mt.includes(e.toLowerCase()))}function ot(i,e){return Object.keys(i.properties||{}).filter(s=>["id","created_at","updated_at","created_by","updated_by"].includes(s)?!1:e?e.includes(s):!0).map(s=>({id:s,label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ")}))}function Wt(i){const e=oe.c(30),{data:s,schema:r,viewMode:n,search:c,sortKey:l,sortDirection:p,onSort:d,actions:o,onItemClick:m,headerActions:u,emptyState:f,readOnly:a,columns:v,hideToolbar:y,sortableFields:b}=i,x=p===void 0?"asc":p,g=d===void 0?qt:d;let $;e[0]!==o?($=o===void 0?{}:o,e[0]=o,e[1]=$):$=e[1];const h=$,T=m===void 0?Vt:m,E=u===void 0?null:u,N=f===void 0?null:f,k=a===void 0?!1:a,j=v===void 0?void 0:v,z=y===void 0?!1:y,P=b===void 0?void 0:b;let D;e[2]!==j||e[3]!==r||e[4]!==P?(D=j?j.filter(Bt).filter(A=>!P||P.includes(A.id)).map(Rt):ot(r,P),e[2]=j,e[3]=r,e[4]=P,e[5]=D):D=e[5];const w=D;let S;e[6]!==E||e[7]!==z||e[8]!==g||e[9]!==x||e[10]!==l||e[11]!==w?(S=!z&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:E}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Qe,{sortKey:l,sortDirection:x,onSort:g,sortOptions:w})})]})}),e[6]=E,e[7]=z,e[8]=g,e[9]=x,e[10]=l,e[11]=w,e[12]=S):S=e[12];let _;e[13]!==h||e[14]!==j||e[15]!==s||e[16]!==N||e[17]!==T||e[18]!==g||e[19]!==k||e[20]!==r||e[21]!==c||e[22]!==x||e[23]!==l||e[24]!==P||e[25]!==n?(_=n==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:s.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:N||t.jsx(We,{icon:t.jsx(Ue,{size:36,className:"text-muted-foreground"}),title:"No items found",description:c?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:s.map(A=>t.jsx("div",{onClick:()=>T?.(A),className:"cursor-pointer h-full",children:t.jsx(kt,{item:A,schema:r,readOnly:k,actions:h})},A.id))})}):t.jsx(xt,{columns:Ht(j,r,P,h),data:s,sortKey:l,sortDirection:x,onSort:g,onRowClick:T,emptyState:N||t.jsx(We,{icon:t.jsx(Ue,{size:36,className:"text-muted-foreground"}),title:"No items found",description:c?"Try adjusting your search":"No items to display"})}),e[13]=h,e[14]=j,e[15]=s,e[16]=N,e[17]=T,e[18]=g,e[19]=k,e[20]=r,e[21]=c,e[22]=x,e[23]=l,e[24]=P,e[25]=n,e[26]=_):_=e[26];let I;return e[27]!==S||e[28]!==_?(I=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[S,_]}),e[27]=S,e[28]=_,e[29]=I):I=e[29],I}function Rt(i){return{id:i.id,label:typeof i.header=="string"?i.header:i.id}}function Bt(i){return i.sortable!==!1}function Vt(){}function qt(){}function Qt(i){return{id:"actions",header:"",render:e=>t.jsxs(He,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(Ce,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Xe,{size:20})})}),t.jsxs(Je,{align:"end",onClick:s=>s.stopPropagation(),children:[i.open&&t.jsxs(O,{onClick:s=>{s.stopPropagation(),i.open?.(e)},children:[t.jsx(tt,{size:16}),"Open"]}),i.edit&&t.jsxs(O,{onClick:s=>{s.stopPropagation(),i.edit?.(e)},children:[t.jsx(et,{size:16}),"Edit"]}),i.duplicate&&t.jsxs(O,{onClick:s=>{s.stopPropagation(),i.duplicate?.(e)},children:[t.jsx(Ze,{size:16}),"Duplicate"]}),i.delete&&t.jsxs(O,{variant:"destructive",onClick:s=>{s.stopPropagation(),i.delete?.(e)},children:[t.jsx(st,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function nt(i){const e=i.type;return Array.isArray(e)?e.every(s=>nt({type:s})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function Gt(i,e){const s=i.properties||{},r=Object.keys(s).filter(o=>{const m=s[o];return m&&nt(m)}),n=Ut(s),c=[],l=new Set;n&&r.includes(n)&&(c.push(n),l.add(n));const p=["title","description","updated_at","updated_by"];for(const o of p)r.includes(o)&&!l.has(o)&&(c.push(o),l.add(o));const d=r.filter(o=>!l.has(o)&&!Re.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of d)c.push(o),l.add(o);for(const o of Re)r.includes(o)&&!l.has(o)&&(c.push(o),l.add(o));return c.map(o=>{const m=s[o],u=e?e.includes(o):!["id"].includes(o);return o===n?{id:o,header:"",render:f=>{const a=f[o];return t.jsx(Ge,{icon:a,name:f.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:o==="description"?{id:o,header:"Description",render:f=>{const a=f[o];return a==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(a)})},sortable:u,cellClassName:"max-w-[50ch]"}:o==="created_by"||o==="updated_by"?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:f=>{const a=f[o];return a?t.jsx(jt,{id:String(a),size:"xs"}):"—"},sortable:u,cellClassName:"max-w-[250px]"}:m?.format==="date-time"||o.endsWith("_at")?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:f=>{const a=f[o];return a?t.jsx("span",{className:"block truncate max-w-full",children:new Date(a).toLocaleDateString()}):"—"},sortable:u,cellClassName:"max-w-[200px]"}:{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:f=>{const a=f[o];return a==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(a)})},sortable:u,cellClassName:"max-w-[200px]"}})}function Ht(i,e,s,r){const n=i||Gt(e,s);return n.some(p=>p.id==="actions")?n:Object.keys(r).length>0?[...n,Qt(r)]:n}function Yt(i){const e=oe.c(119),{connectionId:s,org:r,activeCollection:n,onItemClick:c}=i,l=n.name,p=n.schema??ft,d=n.hasCreateTool,o=n.hasUpdateTool,m=n.hasDeleteTool,u=Be(),{data:f}=ct.useSession(),a=f?.user?.id||"unknown",v=Tt(s);let y;e[0]!==v||e[1]!==s?(y=v?bt(v):s,e[0]=v,e[1]=s,e[2]=y):y=e[2];const b=y,{org:x}=ze();let g;e[3]!==s||e[4]!==x.id||e[5]!==x.slug?(g={connectionId:s,orgId:x.id,orgSlug:x.slug},e[3]=s,e[4]=x.id,e[5]=x.slug,e[6]=g):g=e[6];const $=Ve(g),h=It(s,l,$),T=`${s}-${l}`;let E;e[7]!==r||e[8]!==T?(E={namespace:r,resource:T,defaultSortKey:"updated_at"},e[7]=r,e[8]=T,e[9]=E):E=e[9];const{search:N,searchTerm:k,setSearch:j,viewMode:z,setViewMode:P,sortKey:D,sortDirection:w,handleSort:S}=Ct(E);let _;e[10]!==k||e[11]!==w||e[12]!==D?(_={searchTerm:k,sortKey:D,sortDirection:w},e[10]=k,e[11]=w,e[12]=D,e[13]=_):_=e[13];const I=At(s,l,$,_),A=!d&&!o&&!m;let ne;e[14]!==b||e[15]!==l||e[16]!==u||e[17]!==c||e[18]!==r?(ne=C=>{if(c){c(C);return}u({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:b,collectionName:l,itemId:C.id}})},e[14]=b,e[15]=l,e[16]=u,e[17]=c,e[18]=r,e[19]=ne):ne=e[19];const L=ne;let le;e[20]!==h.create||e[21]!==a?(le=async C=>{const xe=new Date().toISOString();await h.create.mutateAsync({...C,id:Me("conn"),title:`${C.title} (Copy)`,created_at:xe,updated_at:xe,created_by:a,updated_by:a})},e[20]=h.create,e[21]=a,e[22]=le):le=e[22];const be=le,[F,ve]=dt.useState(null);let re;e[23]===Symbol.for("react.memo_cache_sentinel")?(re=C=>{ve(C)},e[23]=re):re=e[23];const lt=re;let K;e[24]!==L||e[25]!==o?(K=o&&{edit:L},e[24]=L,e[25]=o,e[26]=K):K=e[26];let M;e[27]!==be||e[28]!==d?(M=d&&{duplicate:be},e[27]=be,e[28]=d,e[29]=M):M=e[29];let U;e[30]!==m?(U=m&&{delete:lt},e[30]=m,e[31]=U):U=e[31];let ae;e[32]!==M||e[33]!==U||e[34]!==K?(ae={...K,...M,...U},e[32]=M,e[33]=U,e[34]=K,e[35]=ae):ae=e[35];const ye=ae;let ce;e[36]!==h.delete||e[37]!==F?(ce=async()=>{F&&(await h.delete.mutateAsync(F.id),ve(null))},e[36]=h.delete,e[37]=F,e[38]=ce):ce=e[38];const Ne=ce;let de;e[39]!==h.create||e[40]!==b||e[41]!==l||e[42]!==d||e[43]!==u||e[44]!==r||e[45]!==a?(de=async()=>{if(!d){Le.error("Create operation is not available for this collection");return}const C=new Date().toISOString(),xe={id:Me("conn"),title:"New Item",description:"A brief description of the item",created_at:C,updated_at:C,created_by:a,updated_by:a};try{const ke=await h.create.mutateAsync(xe);u({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:b,collectionName:l,itemId:ke.id}})}catch(ke){console.error("Failed to create item:",ke)}},e[39]=h.create,e[40]=b,e[41]=l,e[42]=d,e[43]=u,e[44]=r,e[45]=a,e[46]=de):de=e[46];const we=de;let ue;e[47]!==p?(ue=ot(p),e[47]=p,e[48]=ue):ue=e[48];const Se=ue,rt=(I?.length??0)>0,at=d&&!rt&&!N;let me;e[49]!==h.create||e[50]!==we||e[51]!==d?(me=d?t.jsxs(Ce,{onClick:we,size:"sm",disabled:h.create.isPending,className:"h-7",children:[t.jsx(Et,{className:"mr-2 h-4 w-4"}),h.create.isPending?"Creating...":"Create"]}):null,e[49]=h.create,e[50]=we,e[51]=d,e[52]=me):me=e[52];const pe=me,Pe=D;let W;e[53]!==S||e[54]!==w||e[55]!==Se||e[56]!==Pe?(W=t.jsx(Ot,{children:t.jsx(Qe,{sortKey:Pe,sortDirection:w,onSort:S,sortOptions:Se})}),e[53]=S,e[54]=w,e[55]=Se,e[56]=Pe,e[57]=W):W=e[57];const _e=`Search ${l}...`;let R;e[58]!==j?(R=C=>{C.key==="Escape"&&(j(""),C.target.blur())},e[58]=j,e[59]=R):R=e[59];let B;e[60]!==N||e[61]!==j||e[62]!==_e||e[63]!==R?(B=t.jsx("div",{className:"flex-1",children:t.jsx(ht,{value:N,onChange:j,placeholder:_e,onKeyDown:R})}),e[60]=N,e[61]=j,e[62]=_e,e[63]=R,e[64]=B):B=e[64];let V;e[65]!==pe||e[66]!==d?(V=d&&t.jsx("div",{className:"pr-3",children:pe}),e[65]=pe,e[66]=d,e[67]=V):V=e[67];let q;e[68]!==B||e[69]!==V?(q=t.jsxs("div",{className:"flex items-center gap-2",children:[B,V]}),e[68]=B,e[69]=V,e[70]=q):q=e[70];let Q;e[71]!==I?(Q=I??[],e[71]=I,e[72]=Q):Q=e[72];const De=D;let G;e[73]!==L?(G=C=>L(C),e[73]=L,e[74]=G):G=e[74];const Ie="No items found",Ae=N?"Try adjusting your search terms":"This collection doesn't have any items yet.",Te=at?pe:void 0;let H;e[75]!==Ie||e[76]!==Ae||e[77]!==Te?(H=t.jsx(it,{image:null,title:Ie,description:Ae,actions:Te}),e[75]=Ie,e[76]=Ae,e[77]=Te,e[78]=H):H=e[78];let Y;e[79]!==S||e[80]!==A||e[81]!==ye||e[82]!==p||e[83]!==N||e[84]!==j||e[85]!==P||e[86]!==w||e[87]!==Q||e[88]!==De||e[89]!==G||e[90]!==H||e[91]!==z?(Y=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Wt,{hideToolbar:!0,data:Q,schema:p,viewMode:z,onViewModeChange:P,search:N,onSearchChange:j,sortKey:De,sortDirection:w,onSort:S,actions:ye,onItemClick:G,readOnly:A,emptyState:H})}),e[79]=S,e[80]=A,e[81]=ye,e[82]=p,e[83]=N,e[84]=j,e[85]=P,e[86]=w,e[87]=Q,e[88]=De,e[89]=G,e[90]=H,e[91]=z,e[92]=Y):Y=e[92];let J;e[93]!==q||e[94]!==Y?(J=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[q,Y]}),e[93]=q,e[94]=Y,e[95]=J):J=e[95];const Ee=!!F;let fe;e[96]===Symbol.for("react.memo_cache_sentinel")?(fe=C=>{C||ve(null)},e[96]=fe):fe=e[96];let he;e[97]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Nt,{children:"Delete item?"}),e[97]=he):he=e[97];const Oe=F?.title;let Z;e[98]!==Oe?(Z=t.jsxs(wt,{children:[he,t.jsxs(St,{children:['Are you sure you want to delete "',Oe,'"? This action cannot be undone.']})]}),e[98]=Oe,e[99]=Z):Z=e[99];let X;e[100]!==h.delete.isPending?(X=t.jsx(vt,{disabled:h.delete.isPending,children:"Cancel"}),e[100]=h.delete.isPending,e[101]=X):X=e[101];const $e=h.delete.isPending?"Deleting...":"Delete";let ee;e[102]!==h.delete.isPending||e[103]!==Ne||e[104]!==$e?(ee=t.jsx(yt,{onClick:Ne,disabled:h.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:$e}),e[102]=h.delete.isPending,e[103]=Ne,e[104]=$e,e[105]=ee):ee=e[105];let te;e[106]!==X||e[107]!==ee?(te=t.jsxs(Pt,{children:[X,ee]}),e[106]=X,e[107]=ee,e[108]=te):te=e[108];let se;e[109]!==Z||e[110]!==te?(se=t.jsxs(_t,{children:[Z,te]}),e[109]=Z,e[110]=te,e[111]=se):se=e[111];let ie;e[112]!==Ee||e[113]!==se?(ie=t.jsx(Dt,{open:Ee,onOpenChange:fe,children:se}),e[112]=Ee,e[113]=se,e[114]=ie):ie=e[114];let ge;return e[115]!==W||e[116]!==J||e[117]!==ie?(ge=t.jsxs(t.Fragment,{children:[W,J,ie]}),e[115]=W,e[116]=J,e[117]=ie,e[118]=ge):ge=e[118],ge}function Jt(){const i=oe.c(13),{org:e,project:s}=ze(),r=ut();let n;i[0]!==e.id||i[1]!==e.slug?(n={connectionId:qe,orgId:e.id,orgSlug:e.slug},i[0]=e.id,i[1]=e.slug,i[2]=n):n=i[2];const c=Ve(n);let l;i[3]!==c||i[4]!==s?(l=async m=>{const u=s.enabledPlugins??[];if(u.includes(m))return;const f=[...u,m],a=await c.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:s.id,data:{metadata:{enabled_plugins:f}}}});return a.structuredContent??a},i[3]=c,i[4]=s,i[5]=l):l=i[5];let p;i[6]!==e.id||i[7]!==s||i[8]!==r?(p=()=>{r.invalidateQueries({queryKey:Fe.project(e.id,s.slug)}),r.invalidateQueries({queryKey:Fe.projects(e.id)})},i[6]=e.id,i[7]=s,i[8]=r,i[9]=p):p=i[9];let d;return i[10]!==l||i[11]!==p?(d={mutationFn:l,onSuccess:p,onError:Zt},i[10]=l,i[11]=p,i[12]=d):d=i[12],mt(d)}function Zt(i){Le.error("Failed to enable plugin: "+(i instanceof Error?i.message:"Unknown error"))}function Xt(i){const e=oe.c(12),{pluginId:s,title:r,description:n,icon:c}=i,l=Jt();let p;e[0]!==l||e[1]!==s?(p=async()=>{try{await l.mutateAsync(s),Le.success("Plugin enabled!")}catch{}},e[0]=l,e[1]=s,e[2]=p):p=e[2];const d=p,o=c??null,m=l.isPending?"Enabling…":"Enable plugin";let u;e[3]!==l.isPending||e[4]!==d||e[5]!==m?(u=t.jsx(Ce,{onClick:d,disabled:l.isPending,children:m}),e[3]=l.isPending,e[4]=d,e[5]=m,e[6]=u):u=e[6];let f;return e[7]!==n||e[8]!==o||e[9]!==u||e[10]!==r?(f=t.jsx(it,{image:o,title:r,description:n,actions:u}),e[7]=n,e[8]=o,e[9]=u,e[10]=r,e[11]=f):f=e[11],f}const es={name:"WORKFLOW",displayName:"Workflow",hasCreateTool:!0,hasUpdateTool:!0,hasDeleteTool:!0};function oi(){const{project:i,org:e}=ze();if(!(i.enabledPlugins??[]).includes(Ke))return t.jsx(je,{children:t.jsx(je.Content,{children:t.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:t.jsx(Xt,{pluginId:Ke,title:"Enable Workflows",description:"Automate multi-step processes by enabling the Workflows plugin. Once enabled you can create, run, and monitor workflows.",icon:t.jsx("div",{className:"bg-muted p-4 rounded-full",children:t.jsx(pt,{className:"size-8 text-muted-foreground"})})})})})});const n=Be();return t.jsx(je,{children:t.jsx(je.Content,{children:t.jsx(Yt,{connectionId:qe,org:e.slug,activeCollection:es,onItemClick:c=>n({to:"/$org/settings/workflows/$itemId",params:{org:e.slug,itemId:c.id}})})})})}export{oi as default};
@@ -1 +0,0 @@
1
- import{e as s,g as l,j as o,l as a,E as n,r as c}from"./index-Dl2t23Jt.js";import{a as f}from"./index-CbBINyFK.js";import"./index-M_qlHNIS.js";import"./constants-CfwGLQ49.js";import"./collections-Cn7VbUFT.js";import"./index-CFyIm5CH.js";import"./use-virtual-mcp-BHEEZv3B.js";import"./use-collections-CwD8DZNY.js";import"./monaco-editor-BfaMmupR.js";import"./index-BBrIielu.js";import"./accordion-YgNI8iqn.js";import"./agent-icon-BXkkrCT3.js";import"./AlertCircle-CbUYZGF-.js";import"./Tool01-D1Rvo01i.js";import"./XClose-DY7O9VST.js";import"./RefreshCcw01-Cr84gVY8.js";import"./ArrowNarrowLeft-DHj5-FLY.js";import"./XCircle-DZEMwZj2.js";import"./ArrowUpRight-BK_iYZ-J.js";import"./ZapSquare-BDbWe-zU.js";import"./Users03-DH9QAbco.js";import"./CheckCircle-D9qlmIve.js";import"./ChevronDown-tb8ftSUO.js";import"./ChevronRight-BIm0-OSp.js";import"./ChevronUp-ClqSoLtD.js";import"./DotsVertical-DEE8M0V4.js";import"./Container-BCDxdJoG.js";import"./Star01-PFA-ZRDO.js";import"./Palette-BrJL0UcN.js";import"./SearchMd-IP-R-mtT.js";import"./index-Bcf94soS.js";import"./tooltip-CxizQODk.js";import"./X-viKat0oa.js";import"./LinkExternal01-DM7IwrPj.js";import"./Lock01-BmjkKSvK.js";import"./Sun-B7BWJEHb.js";import"./Play-DSYx2GJ2.js";import"./Plus-BrBimbff.js";import"./Settings02-BOckjEVU.js";import"./Shield01-CJggUHAQ.js";import"./Trash01-DaGrAtTq.js";import"./User01-DmtseI1g.js";import"./Zap-BMzMPNv3.js";import"./badge-_ZGDO29b.js";import"./select-C0JTp_6a.js";import"./view-mode-toggle-C9HAxT_f.js";import"./layout-CV5Wi0Ex.js";import"./use-connection-pSv7eY2y.js";import"./use-mcp-tools-BdYIFx9S.js";import"./dialog-CoECADf1.js";import"./index-CvarGBFr.js";import"./dropdown-menu-C6XDnng5.js";import"./integration-icon-BipCD_m-.js";import"./scroll-area-D4F3EM5Z.js";import"./index-DjgN9qrV.js";import"./empty-state-DoKR-jUX.js";import"./create-sse-subscription-CxkOgzKf.js";import"./input-CluxDyoT.js";function ht(){const t=s.c(4);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/settings/workflows/$itemId"},t[0]=r):r=t[0];const{itemId:e}=l(r);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(a,{size:32,className:"animate-spin text-muted-foreground"})}),t[1]=i):i=t[1];const p=decodeURIComponent(e);let m;return t[2]!==p?(m=o.jsx(n,{children:o.jsx(c.Suspense,{fallback:i,children:o.jsx(f,{itemId:p})})}),t[2]=p,t[3]=m):m=t[3],m}export{ht as default};
@@ -1,60 +0,0 @@
1
- export type WidthType = 'fullwidth' | 'halfwidth' | 'wide' | 'narrow' | 'neutral' | 'ambiguous';
2
-
3
- export type Options = {
4
- /**
5
- Whether to treat an `'ambiguous'` character as wide.
6
-
7
- @default true
8
-
9
- @example
10
- ```
11
- import {eastAsianWidth} from 'get-east-asian-width';
12
-
13
- const codePoint = '⛣'.codePointAt(0);
14
-
15
- console.log(eastAsianWidth(codePoint));
16
- //=> 1
17
-
18
- console.log(eastAsianWidth(codePoint, {ambiguousAsWide: true}));
19
- //=> 2
20
- ```
21
-
22
- > Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). __If the context cannot be established reliably, they should be treated as narrow characters by default.__
23
- > - http://www.unicode.org/reports/tr11/
24
- */
25
- readonly ambiguousAsWide?: boolean;
26
- };
27
-
28
- /**
29
- Returns the width as a number for the given code point.
30
-
31
- @param codePoint - A Unicode code point.
32
-
33
- @example
34
- ```
35
- import {eastAsianWidth} from 'get-east-asian-width';
36
-
37
- const codePoint = '字'.codePointAt(0);
38
-
39
- console.log(eastAsianWidth(codePoint));
40
- //=> 2
41
- ```
42
- */
43
- export function eastAsianWidth(codePoint: number, options?: Options): 1 | 2;
44
-
45
- /**
46
- Returns the type of “East Asian Width” for the given code point.
47
-
48
- @param codePoint - A Unicode code point.
49
-
50
- @example
51
- ```
52
- import {eastAsianWidthType} from 'get-east-asian-width';
53
-
54
- const codePoint = '字'.codePointAt(0);
55
-
56
- console.log(eastAsianWidthType(codePoint));
57
- //=> 'wide'
58
- ```
59
- */
60
- export function eastAsianWidthType(codePoint: number): WidthType;