decocms 2.286.1 → 2.288.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/client/assets/{AlertCircle-Bgzr6uRA.js → AlertCircle--Y_xi7pz.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-ByrdB8Dd.js → ArrowNarrowLeft-adl7K_Ob.js} +1 -1
  3. package/dist/client/assets/ArrowUpRight-DrcSZgbj.js +1 -0
  4. package/dist/client/assets/{CheckCircle-88bls7UK.js → CheckCircle-DeN4Arf9.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-Jd-cYHC-.js → ChevronDown-aTqoLskN.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-71i8ke8L.js → ChevronRight-D_eqesT2.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-D_szSdLd.js → ChevronUp-BJsJc2K_.js} +1 -1
  8. package/dist/client/assets/{Container-DWaKXfYv.js → Container-RTpXHcc_.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-CjXyjLNU.js → DotsVertical-DU62Ovco.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-DB08YntP.js → LinkExternal01-CZ54w6Ys.js} +1 -1
  11. package/dist/client/assets/{Lock01-dBhVogWg.js → Lock01-C1fACGdb.js} +1 -1
  12. package/dist/client/assets/{Palette-DuWQiO51.js → Palette-CSi1xvBX.js} +1 -1
  13. package/dist/client/assets/{Play-D7pqvkYq.js → Play-ZwqBA0Gj.js} +1 -1
  14. package/dist/client/assets/{Plus-BzxOIhxj.js → Plus-DgDw4N5v.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-BxULs6ec.js → RefreshCcw01-BQD-u-1H.js} +1 -1
  16. package/dist/client/assets/{SearchMd-D6tCV38D.js → SearchMd-DIPAhwlI.js} +1 -1
  17. package/dist/client/assets/{Settings02-MyfUtBA4.js → Settings02-NWpe6nkq.js} +1 -1
  18. package/dist/client/assets/{Shield01-CMw4M4Ml.js → Shield01-yW6P30XX.js} +1 -1
  19. package/dist/client/assets/{Star01-DZHrISf9.js → Star01-BNCw32N6.js} +1 -1
  20. package/dist/client/assets/{Sun-C8X8gjZW.js → Sun-BIhz6_CP.js} +1 -1
  21. package/dist/client/assets/{Tool01-BscqkhhO.js → Tool01-DK8Fhe6_.js} +1 -1
  22. package/dist/client/assets/{Trash01-DZpzvWVW.js → Trash01-CLPACLPe.js} +1 -1
  23. package/dist/client/assets/{User01-VHn0SqBP.js → User01-C_p7EKq6.js} +1 -1
  24. package/dist/client/assets/{Users03-DwNyb_q2.js → Users03-C5Wav_Yh.js} +1 -1
  25. package/dist/client/assets/{X-BuUY-erD.js → X-BI3qXgCM.js} +1 -1
  26. package/dist/client/assets/{XCircle-BFZeumzD.js → XCircle-C15LvzjS.js} +1 -1
  27. package/dist/client/assets/{XClose-ANREDbeo.js → XClose-xaUxE8BL.js} +1 -1
  28. package/dist/client/assets/{Zap-BxJkZzJb.js → Zap-DUrCsyVy.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-Bz3HDhTc.js → ZapSquare-CzhlLfPR.js} +1 -1
  30. package/dist/client/assets/{accordion-DK_chPAh.js → accordion-PgILOgmD.js} +1 -1
  31. package/dist/client/assets/agent-icon-Dwc2UhoB.js +1 -0
  32. package/dist/client/assets/agents-list-DtDkfiBL.js +1 -0
  33. package/dist/client/assets/ai-providers-dl8LgpRM.js +1 -0
  34. package/dist/client/assets/{alert-dialog-CtGXaT-Y.js → alert-dialog-P1MELuo2.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-B4ADnlpm.js → auth-catchall-DXBvhnpI.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-B_yW9vLo.js → automation-list-row-ZhJERDs5.js} +1 -1
  37. package/dist/client/assets/automations-BKo3NXeb.js +1 -0
  38. package/dist/client/assets/{avatar-DcLXZkYK.js → avatar-C4Xk2I9Z.js} +1 -1
  39. package/dist/client/assets/{badge-BJBM0LXp.js → badge-LkPgBUqp.js} +1 -1
  40. package/dist/client/assets/{brand-context-BahSISOs.js → brand-context-B0xNT0Kl.js} +1 -1
  41. package/dist/client/assets/card-oTGN-YLV.js +1 -0
  42. package/dist/client/assets/{chat-context-DfEaB6Uj.js → chat-context-yRGYHam2.js} +1 -1
  43. package/dist/client/assets/{checkbox-Dplb_VaM.js → checkbox-COiFtX5D.js} +1 -1
  44. package/dist/client/assets/collection-detail-D7_Iw3uk.js +1 -0
  45. package/dist/client/assets/{collection-display-button-DecHBxzk.js → collection-display-button-cYrSfrMz.js} +1 -1
  46. package/dist/client/assets/{collection-search-DF-hPm66.js → collection-search-Biy5fWyC.js} +1 -1
  47. package/dist/client/assets/{collection-search-B_zW9IS4.js → collection-search-D8Ek-RA1.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-DG-B8ykv.js → collection-table-wrapper-D7Avuad7.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-tHg8euhu.js → collection-tabs-Ez6xggyp.js} +1 -1
  50. package/dist/client/assets/{collections-KKlyNHih.js → collections-h5KZ86rd.js} +1 -1
  51. package/dist/client/assets/{command-Cpu7RbMv.js → command-BcjbHr_r.js} +1 -1
  52. package/dist/client/assets/{connection-card-CD0fnfut.js → connection-card-Tvf09fuE.js} +1 -1
  53. package/dist/client/assets/connection-detail-BOee_bXK.js +1 -0
  54. package/dist/client/assets/{connection-form-helpers-DVewXDLo.js → connection-form-helpers-BML8fV-T.js} +1 -1
  55. package/dist/client/assets/connections-BE48nDv7.js +1 -0
  56. package/dist/client/assets/{constants-aD7HJ6sY.js → constants-Dsh71ijv.js} +1 -1
  57. package/dist/client/assets/{constants-D7DNenhk.js → constants-n9yTcILK.js} +1 -1
  58. package/dist/client/assets/{dialog-nGTWjCEa.js → dialog-Dv_lEigV.js} +1 -1
  59. package/dist/client/assets/domain-settings-BcSGKzwX.js +1 -0
  60. package/dist/client/assets/{drawer-DyPUsgdj.js → drawer-WXY2u6pv.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-Cc_jn9Z7.js → dropdown-menu-B9QIvjxH.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-Bun8S8Gm.js → dynamic-plugin-layout-CjDWcYO9.js} +1 -1
  63. package/dist/client/assets/{empty-state-CqQa90x5.js → empty-state-DIMeCEjD.js} +1 -1
  64. package/dist/client/assets/{empty-state-DgThOXBB.js → empty-state-JxMlNoaR.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-Bx0uarS8.js → extract-connection-data-Cvlutde4.js} +1 -1
  66. package/dist/client/assets/features-YbryDu0n.js +1 -0
  67. package/dist/client/assets/{form-DB-TdsHz.js → form-BNoUlod_.js} +1 -1
  68. package/dist/client/assets/general-b6CUcDdB.js +1 -0
  69. package/dist/client/assets/{github-repo-picker-CwCtQ7G3.js → github-repo-picker-CP7-EChX.js} +1 -1
  70. package/dist/client/assets/{index-DtMbbDUN.js → index-B0_K5fYx.js} +1 -1
  71. package/dist/client/assets/index-BHUL0rr0.css +1 -0
  72. package/dist/client/assets/{index-CwstDhH7.js → index-BVkdH26T.js} +1 -1
  73. package/dist/client/assets/{index-Amg25tew.js → index-BZtydI_4.js} +1 -1
  74. package/dist/client/assets/{index-BfYZ2YG_.js → index-C-fdRcaZ.js} +4 -4
  75. package/dist/client/assets/{index-DhJrYN5i.js → index-CVUETRIB.js} +2 -2
  76. package/dist/client/assets/{index-pD6VF9-w.js → index-CdjpBOmP.js} +2 -2
  77. package/dist/client/assets/{index-CT9V-xpg.js → index-CjZGXiUn.js} +1 -1
  78. package/dist/client/assets/{index-BZopUfMN.js → index-Cw8cSB3k.js} +1 -1
  79. package/dist/client/assets/{index-DvgxnJsz.js → index-Dig_TVyF.js} +1 -1
  80. package/dist/client/assets/{index-DtdOoKdU.js → index-FXohrF1g.js} +1 -1
  81. package/dist/client/assets/{infiniteQueryObserver-B_9sKQsI.js → infiniteQueryObserver-BYD3scla.js} +1 -1
  82. package/dist/client/assets/{input-COFLoOjb.js → input-CL-LUIlC.js} +1 -1
  83. package/dist/client/assets/{integration-icon-DKrcAAs9.js → integration-icon-BXMU-Z0-.js} +1 -1
  84. package/dist/client/assets/{label-BZVcstmy.js → label-Do_qw_q4.js} +1 -1
  85. package/dist/client/assets/{layout-Dp5y9gtR.js → layout-DrFXNrUJ.js} +1 -1
  86. package/dist/client/assets/{login-ComGApTe.js → login-B6O4fD8Q.js} +1 -1
  87. package/dist/client/assets/{members-CHnKVrrd.js → members-L61ME1MY.js} +1 -1
  88. package/dist/client/assets/{monaco-editor-EL8K9shU.js → monaco-editor-BRexmFrU.js} +1 -1
  89. package/dist/client/assets/{monitoring-stats-row-D9crys0K.js → monitoring-stats-row-DpDZn9jY.js} +1 -1
  90. package/dist/client/assets/{oauth-callback-B0mEhNIK.js → oauth-callback-_ywR3sFa.js} +1 -1
  91. package/dist/client/assets/{oauth-callback-ai-provider-Dj0EctfO.js → oauth-callback-ai-provider-CpjecUsU.js} +1 -1
  92. package/dist/client/assets/{onboarding-czNV0UuI.js → onboarding-BHrMLfDa.js} +1 -1
  93. package/dist/client/assets/{org-layout-CGtnLM_Q.js → org-layout-BkXZ1gvy.js} +1 -1
  94. package/dist/client/assets/{org-plugin-layout-Ba2ZEzcE.js → org-plugin-layout-DQZ2g3kO.js} +1 -1
  95. package/dist/client/assets/{plugin-empty-state-fmAUJ6xt.js → plugin-empty-state-vwtahL68.js} +1 -1
  96. package/dist/client/assets/{plugin-header-3c9kItnR.js → plugin-header-BsB_du51.js} +1 -1
  97. package/dist/client/assets/{plugin-layout-CUFHRJeM.js → plugin-layout-Buej05e7.js} +1 -1
  98. package/dist/client/assets/{popover-Bo1-wNsY.js → popover-C4684neQ.js} +1 -1
  99. package/dist/client/assets/profile-DDmHWY6_.js +1 -0
  100. package/dist/client/assets/project-app-view-BNwkzuii.js +1 -0
  101. package/dist/client/assets/registry-B2nAdztj.js +2 -0
  102. package/dist/client/assets/{registry-layout-q6bMBk9s.js → registry-layout-CZd2B4C7.js} +1 -1
  103. package/dist/client/assets/{required-auth-layout-CP-yDaO3.js → required-auth-layout-SaQW2h7l.js} +1 -1
  104. package/dist/client/assets/{reset-password-CpFcPkI4.js → reset-password-DDLCghhj.js} +1 -1
  105. package/dist/client/assets/roles-DmqW3xZU.js +1 -0
  106. package/dist/client/assets/{scroll-area-CXUp8wR9.js → scroll-area-BmiP98pu.js} +1 -1
  107. package/dist/client/assets/{search-input-ClG6niuo.js → search-input-DQ1Xzm_b.js} +1 -1
  108. package/dist/client/assets/{select-Cn3ZnqjJ.js → select-DaM3TY5t.js} +1 -1
  109. package/dist/client/assets/select-model-CX8VF4-p.js +4 -0
  110. package/dist/client/assets/settings-layout-DNFV8Oix.js +1 -0
  111. package/dist/client/assets/settings-section-BS3Z4RWi.js +1 -0
  112. package/dist/client/assets/{shell-layout-BsqL_vND.js → shell-layout-DifA2CaM.js} +1 -1
  113. package/dist/client/assets/{skeleton-DOcx8lZU.js → skeleton-C8RqYCI9.js} +1 -1
  114. package/dist/client/assets/sso-CZDbiXIw.js +1 -0
  115. package/dist/client/assets/store-CeeuB26r.js +1 -0
  116. package/dist/client/assets/store-registry-Db_sa3Jy.js +2 -0
  117. package/dist/client/assets/{switch-ihM2hYRH.js → switch-DGYFt_K8.js} +1 -1
  118. package/dist/client/assets/table-BJ_I6wc6.js +1 -0
  119. package/dist/client/assets/{tabs-DcOxSeRf.js → tabs-O35WvzjF.js} +1 -1
  120. package/dist/client/assets/{task-status-CHfFeACA.js → task-status-BKkJIb6H.js} +1 -1
  121. package/dist/client/assets/{textarea-CsnX9Ktr.js → textarea-CjtgfBdH.js} +1 -1
  122. package/dist/client/assets/{toggle-group-_HWF3GFc.js → toggle-group-ComSgZAp.js} +1 -1
  123. package/dist/client/assets/{tools-list-A0gJUqTb.js → tools-list-CurMUG9t.js} +1 -1
  124. package/dist/client/assets/{types-BGXCye_w.js → types-DlC_80GR.js} +1 -1
  125. package/dist/client/assets/{use-ai-providers-DSLKay0D.js → use-ai-providers-C3mVVuRV.js} +1 -1
  126. package/dist/client/assets/{use-collections-DvPoAlor.js → use-collections-DcKD6Qxv.js} +1 -1
  127. package/dist/client/assets/{use-connection-MU3rXx28.js → use-connection-PZAuCSXO.js} +1 -1
  128. package/dist/client/assets/{use-copy-tC0v6ypy.js → use-copy-Bj-MTwaa.js} +1 -1
  129. package/dist/client/assets/{use-create-virtual-mcp-C-LLRhrB.js → use-create-virtual-mcp-B_irsl9D.js} +1 -1
  130. package/dist/client/assets/{use-decopilot-events-fHBaJaln.js → use-decopilot-events-CDeh99iZ.js} +1 -1
  131. package/dist/client/assets/{use-delete-connection-CowwQ4CA.js → use-delete-connection-BR9ISSGY.js} +1 -1
  132. package/dist/client/assets/{use-infinite-scroll-BUM8dH47.js → use-infinite-scroll-D-2l__Cz.js} +1 -1
  133. package/dist/client/assets/{use-list-state-Ba4O0IuX.js → use-list-state-BV21WFDK.js} +1 -1
  134. package/dist/client/assets/{use-mcp-tools-B5zpuics.js → use-mcp-tools-Bv5yUcCZ.js} +1 -1
  135. package/dist/client/assets/{use-members-Bhu2ZnQb.js → use-members-BAhIl5n0.js} +1 -1
  136. package/dist/client/assets/{use-mobile-C4Yo3nsX.js → use-mobile-BpBXbl16.js} +1 -1
  137. package/dist/client/assets/{use-navigate-to-agent-Bx0DB5DW.js → use-navigate-to-agent-CG7-kp4S.js} +1 -1
  138. package/dist/client/assets/{use-org-sso-BK-ft_ER.js → use-org-sso-4JoNv6HV.js} +1 -1
  139. package/dist/client/assets/{use-organization-roles-uEcrMWhG.js → use-organization-roles-Bpj16cC4.js} +1 -1
  140. package/dist/client/assets/{use-organization-settings-CMC2yyUM.js → use-organization-settings-axiNM6Y6.js} +1 -1
  141. package/dist/client/assets/{use-registry-connections-Biq_9qgb.js → use-registry-connections-fdW_5JrJ.js} +1 -1
  142. package/dist/client/assets/{use-status-sounds-DfhTS64d.js → use-status-sounds-BYcGwXOW.js} +1 -1
  143. package/dist/client/assets/{use-tasks-DofxyZR4.js → use-tasks-CEbKlK-w.js} +1 -1
  144. package/dist/client/assets/{use-view-mode-DSeYcON6.js → use-view-mode-DXGS7T6x.js} +1 -1
  145. package/dist/client/assets/{use-virtual-mcp-WT1ZdgMM.js → use-virtual-mcp-C8FeHhCA.js} +1 -1
  146. package/dist/client/assets/useInfiniteQuery-D8Ti3aNB.js +1 -0
  147. package/dist/client/assets/useSuspenseInfiniteQuery-BOcz1SDi.js +1 -0
  148. package/dist/client/assets/{user-5oBDTi_W.js → user-1OxcID9o.js} +1 -1
  149. package/dist/client/assets/{view-mode-toggle-BvyYLass.js → view-mode-toggle-BiIaP24A.js} +1 -1
  150. package/dist/client/assets/workflow-Dx23L5rN.js +1 -0
  151. package/dist/client/assets/workflow-detail-BMaclVeL.js +1 -0
  152. package/dist/client/index.html +2 -2
  153. package/dist/server/cli.js +89 -89
  154. package/dist/server/node_modules/ansi-regex/index.d.ts +33 -0
  155. package/dist/server/node_modules/ansi-regex/index.js +14 -0
  156. package/dist/server/node_modules/ansi-regex/package.json +61 -0
  157. package/dist/server/node_modules/ansi-regex/readme.md +66 -0
  158. package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
  159. package/dist/server/node_modules/ansi-styles/index.js +223 -0
  160. package/dist/server/node_modules/{slice-ansi → ansi-styles}/license +0 -1
  161. package/dist/server/node_modules/ansi-styles/package.json +54 -0
  162. package/dist/server/node_modules/ansi-styles/readme.md +173 -0
  163. package/dist/server/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  164. package/dist/server/node_modules/emoji-regex/README.md +107 -0
  165. package/dist/server/node_modules/emoji-regex/index.d.ts +3 -0
  166. package/dist/server/node_modules/emoji-regex/index.js +4 -0
  167. package/dist/server/node_modules/emoji-regex/index.mjs +4 -0
  168. package/dist/server/node_modules/emoji-regex/package.json +45 -0
  169. package/dist/server/node_modules/environment/index.d.ts +74 -0
  170. package/dist/server/node_modules/environment/index.js +47 -0
  171. package/dist/server/node_modules/environment/license +9 -0
  172. package/dist/server/node_modules/environment/package.json +74 -0
  173. package/dist/server/node_modules/environment/readme.md +94 -0
  174. package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
  175. package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
  176. package/dist/server/node_modules/escape-string-regexp/license +9 -0
  177. package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
  178. package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
  179. package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  180. package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
  181. package/dist/server/node_modules/is-fullwidth-code-point/license +9 -0
  182. package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
  183. package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
  184. package/dist/server/node_modules/is-unicode-supported/index.d.ts +12 -0
  185. package/dist/server/node_modules/is-unicode-supported/index.js +21 -0
  186. package/dist/server/node_modules/is-unicode-supported/license +9 -0
  187. package/dist/server/node_modules/is-unicode-supported/package.json +47 -0
  188. package/dist/server/node_modules/is-unicode-supported/readme.md +35 -0
  189. package/dist/server/node_modules/mimic-fn/index.d.ts +54 -0
  190. package/dist/server/node_modules/mimic-fn/index.js +13 -0
  191. package/dist/server/node_modules/mimic-fn/license +9 -0
  192. package/dist/server/node_modules/mimic-fn/package.json +42 -0
  193. package/dist/server/node_modules/mimic-fn/readme.md +69 -0
  194. package/dist/server/node_modules/onetime/index.d.ts +64 -0
  195. package/dist/server/node_modules/onetime/index.js +44 -0
  196. package/dist/server/node_modules/onetime/license +9 -0
  197. package/dist/server/node_modules/onetime/package.json +43 -0
  198. package/dist/server/node_modules/onetime/readme.md +94 -0
  199. package/dist/server/node_modules/pg-int8/LICENSE +13 -0
  200. package/dist/server/node_modules/pg-int8/README.md +16 -0
  201. package/dist/server/node_modules/pg-int8/index.js +100 -0
  202. package/dist/server/node_modules/pg-int8/package.json +24 -0
  203. package/dist/server/node_modules/postgres-array/index.d.ts +4 -0
  204. package/dist/server/node_modules/postgres-array/index.js +97 -0
  205. package/dist/server/node_modules/postgres-array/license +21 -0
  206. package/dist/server/node_modules/postgres-array/package.json +35 -0
  207. package/dist/server/node_modules/postgres-array/readme.md +43 -0
  208. package/dist/server/node_modules/postgres-bytea/index.js +33 -0
  209. package/dist/server/node_modules/postgres-bytea/license +21 -0
  210. package/dist/server/node_modules/postgres-bytea/package.json +34 -0
  211. package/dist/server/node_modules/postgres-bytea/readme.md +34 -0
  212. package/dist/server/node_modules/postgres-date/index.js +116 -0
  213. package/dist/server/node_modules/postgres-date/license +21 -0
  214. package/dist/server/node_modules/postgres-date/package.json +33 -0
  215. package/dist/server/node_modules/postgres-date/readme.md +49 -0
  216. package/dist/server/node_modules/postgres-interval/index.d.ts +20 -0
  217. package/dist/server/node_modules/postgres-interval/index.js +125 -0
  218. package/dist/server/node_modules/postgres-interval/license +21 -0
  219. package/dist/server/node_modules/postgres-interval/package.json +36 -0
  220. package/dist/server/node_modules/postgres-interval/readme.md +48 -0
  221. package/dist/server/node_modules/restore-cursor/index.d.ts +11 -0
  222. package/dist/server/node_modules/restore-cursor/index.js +11 -0
  223. package/dist/server/node_modules/restore-cursor/license +9 -0
  224. package/dist/server/node_modules/restore-cursor/package.json +55 -0
  225. package/dist/server/node_modules/restore-cursor/readme.md +31 -0
  226. package/dist/server/node_modules/split2/LICENSE +13 -0
  227. package/dist/server/node_modules/split2/README.md +85 -0
  228. package/dist/server/node_modules/split2/bench.js +27 -0
  229. package/dist/server/node_modules/split2/index.js +141 -0
  230. package/dist/server/node_modules/split2/package.json +39 -0
  231. package/dist/server/node_modules/split2/test.js +409 -0
  232. package/dist/server/node_modules/string-width/index.d.ts +39 -0
  233. package/dist/server/node_modules/string-width/index.js +82 -0
  234. package/dist/server/node_modules/string-width/license +9 -0
  235. package/dist/server/node_modules/string-width/package.json +64 -0
  236. package/dist/server/node_modules/string-width/readme.md +66 -0
  237. package/dist/server/node_modules/xtend/.jshintrc +30 -0
  238. package/dist/server/node_modules/{pg → xtend}/LICENSE +6 -7
  239. package/dist/server/node_modules/xtend/README.md +32 -0
  240. package/dist/server/node_modules/xtend/immutable.js +19 -0
  241. package/dist/server/node_modules/xtend/mutable.js +17 -0
  242. package/dist/server/node_modules/xtend/package.json +55 -0
  243. package/dist/server/node_modules/xtend/test.js +103 -0
  244. package/dist/server/server.js +86 -86
  245. package/package.json +1 -1
  246. package/dist/client/assets/agent-icon-DKQKq---.js +0 -1
  247. package/dist/client/assets/agents-list-DBdCJGrz.js +0 -1
  248. package/dist/client/assets/ai-providers-BhNFwI7O.js +0 -1
  249. package/dist/client/assets/automations-B3iEjSty.js +0 -1
  250. package/dist/client/assets/card-DqrPrhd5.js +0 -1
  251. package/dist/client/assets/collection-detail-KgUZfuij.js +0 -1
  252. package/dist/client/assets/connection-detail-CFY9ol5g.js +0 -1
  253. package/dist/client/assets/connections-B-Liq5Ll.js +0 -1
  254. package/dist/client/assets/features-ekquKatz.js +0 -1
  255. package/dist/client/assets/general-BrK_oI6y.js +0 -1
  256. package/dist/client/assets/index-BCwsJqWc.css +0 -1
  257. package/dist/client/assets/profile-C4ZfFzUo.js +0 -1
  258. package/dist/client/assets/project-app-view-DbITEuQv.js +0 -1
  259. package/dist/client/assets/registry-CrUw5Sj_.js +0 -2
  260. package/dist/client/assets/roles-CSJcHSQ8.js +0 -1
  261. package/dist/client/assets/select-model-BwE-9vfJ.js +0 -4
  262. package/dist/client/assets/settings-layout-dHGH4vpw.js +0 -1
  263. package/dist/client/assets/sso-37Vu3qt9.js +0 -1
  264. package/dist/client/assets/store-D1kidhJ8.js +0 -1
  265. package/dist/client/assets/store-registry-qx_8ffch.js +0 -2
  266. package/dist/client/assets/table-CAUXYO7-.js +0 -1
  267. package/dist/client/assets/useInfiniteQuery-Gkc0b2zi.js +0 -1
  268. package/dist/client/assets/useSuspenseInfiniteQuery-YePUpUV3.js +0 -1
  269. package/dist/client/assets/workflow-DoVF6xyx.js +0 -1
  270. package/dist/client/assets/workflow-detail-XUi-wHY3.js +0 -1
  271. package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
  272. package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
  273. package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
  274. package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
  275. package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
  276. package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
  277. package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
  278. package/dist/server/node_modules/pg/README.md +0 -95
  279. package/dist/server/node_modules/pg/esm/index.mjs +0 -20
  280. package/dist/server/node_modules/pg/lib/client.js +0 -743
  281. package/dist/server/node_modules/pg/lib/connection-parameters.js +0 -171
  282. package/dist/server/node_modules/pg/lib/connection.js +0 -221
  283. package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +0 -122
  284. package/dist/server/node_modules/pg/lib/crypto/sasl.js +0 -212
  285. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +0 -43
  286. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +0 -89
  287. package/dist/server/node_modules/pg/lib/crypto/utils.js +0 -9
  288. package/dist/server/node_modules/pg/lib/defaults.js +0 -91
  289. package/dist/server/node_modules/pg/lib/index.js +0 -73
  290. package/dist/server/node_modules/pg/lib/native/client.js +0 -323
  291. package/dist/server/node_modules/pg/lib/native/index.js +0 -2
  292. package/dist/server/node_modules/pg/lib/native/query.js +0 -165
  293. package/dist/server/node_modules/pg/lib/query.js +0 -252
  294. package/dist/server/node_modules/pg/lib/result.js +0 -109
  295. package/dist/server/node_modules/pg/lib/stream.js +0 -83
  296. package/dist/server/node_modules/pg/lib/type-overrides.js +0 -35
  297. package/dist/server/node_modules/pg/lib/utils.js +0 -217
  298. package/dist/server/node_modules/pg/package.json +0 -76
  299. package/dist/server/node_modules/slice-ansi/index.d.ts +0 -19
  300. package/dist/server/node_modules/slice-ansi/index.js +0 -260
  301. package/dist/server/node_modules/slice-ansi/package.json +0 -59
  302. package/dist/server/node_modules/slice-ansi/readme.md +0 -54
  303. package/dist/server/node_modules/slice-ansi/tokenize-ansi.js +0 -752
  304. /package/dist/server/node_modules/{get-east-asian-width → ansi-regex}/license +0 -0
@@ -1 +0,0 @@
1
- import{r as k,s as Re,K as ce,aM as it,j as s,c as H,l as _e,B as ne,e as q,n as Ge,o as De,x as rt,w as ot,a as we,z as pe,t as Ae,b as re,v as ye,aK as he,y as se,aI as Le,a_ as ve,E as lt,f as at,d as ct}from"./index-DhJrYN5i.js";import{u as dt}from"./use-organization-roles-uEcrMWhG.js";import{B as fe}from"./badge-BJBM0LXp.js";import{f as Ue,a as ke,b as Ve,c as Be,d as ze,A as Ye,e as $e,g as He}from"./alert-dialog-CtGXaT-Y.js";import{c as mt,d as ut,e as gt,D as Et}from"./dropdown-menu-Cc_jn9Z7.js";import{i as Tt}from"./DotsVertical-CjXyjLNU.js";import{i as Ke}from"./Lock01-dBhVogWg.js";import{s as Ce}from"./Plus-BzxOIhxj.js";import{s as pt}from"./Trash01-DZpzvWVW.js";import{C as ft}from"./collection-table-wrapper-DG-B8ykv.js";import{P as te}from"./index-DvgxnJsz.js";import{E as je}from"./empty-state-DgThOXBB.js";import{S as Se}from"./search-input-ClG6niuo.js";import{P as Fe,D as Qe}from"./ai-providers-logos-CS4PCiqI.js";import{I as be}from"./integration-icon-DKrcAAs9.js";import{u as _t}from"./use-infinite-scroll-BUM8dH47.js";import{C as Oe}from"./checkbox-Dplb_VaM.js";import{i as It}from"./RefreshCcw01-BxULs6ec.js";import{u as ht}from"./useSuspenseInfiniteQuery-YePUpUV3.js";import{u as Rt,S as xt}from"./constants-aD7HJ6sY.js";import{C as Nt}from"./collection-search-B_zW9IS4.js";import{u as Ze}from"./use-members-Bhu2ZnQb.js";import{u as Ct}from"./use-connection-MU3rXx28.js";import{u as At,c as St}from"./use-ai-providers-DSLKay0D.js";import{A as qe}from"./avatar-DcLXZkYK.js";import{S as oe}from"./switch-ihM2hYRH.js";import{T as ue,c as ge,a as Ee,b as Te}from"./use-mobile-C4Yo3nsX.js";import{t as bt}from"./ChevronDown-Jd-cYHC-.js";import{i as Ot}from"./ChevronRight-71i8ke8L.js";import{a as yt}from"./SearchMd-D6tCV38D.js";import{i as Pe}from"./X-BuUY-erD.js";import"./table-CAUXYO7-.js";import"./XClose-ANREDbeo.js";import"./Container-DWaKXfYv.js";import"./agent-icon-DKQKq---.js";import"./AlertCircle-Bgzr6uRA.js";import"./Tool01-BscqkhhO.js";import"./ArrowNarrowLeft-ByrdB8Dd.js";import"./XCircle-BFZeumzD.js";import"./ZapSquare-Bz3HDhTc.js";import"./Users03-DwNyb_q2.js";import"./CheckCircle-88bls7UK.js";import"./ChevronUp-D_szSdLd.js";import"./Star01-DZHrISf9.js";import"./Palette-DuWQiO51.js";import"./LinkExternal01-DB08YntP.js";import"./Sun-C8X8gjZW.js";import"./Play-D7pqvkYq.js";import"./Settings02-MyfUtBA4.js";import"./Shield01-CMw4M4Ml.js";import"./User01-VHn0SqBP.js";import"./Zap-BxJkZzJb.js";import"./infiniteQueryObserver-B_9sKQsI.js";import"./use-collections-DvPoAlor.js";const Xe=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"BRAND_CONTEXT_LIST",description:"List brand contexts",category:"Organizations"},{name:"BRAND_CONTEXT_GET",description:"View brand context",category:"Organizations"},{name:"BRAND_CONTEXT_CREATE",description:"Create brand context",category:"Organizations"},{name:"BRAND_CONTEXT_UPDATE",description:"Update brand context",category:"Organizations"},{name:"BRAND_CONTEXT_DELETE",description:"Delete brand context",category:"Organizations",dangerous:!0},{name:"BRAND_CONTEXT_EXTRACT",description:"Extract brand context from website",category:"Organizations"},{name:"BRAND_GET",description:"Get brand (binding)",category:"Organizations"},{name:"BRAND_LIST",description:"List brands (binding)",category:"Organizations"},{name:"ORGANIZATION_DOMAIN_GET",description:"Get organization domain claim",category:"Organizations"},{name:"ORGANIZATION_DOMAIN_SET",description:"Set organization domain claim",category:"Organizations"},{name:"ORGANIZATION_DOMAIN_UPDATE",description:"Update organization domain settings",category:"Organizations"},{name:"ORGANIZATION_DOMAIN_CLEAR",description:"Clear organization domain claim",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"MONITORING_LOG_GET",description:"View monitoring log details",category:"Monitoring"},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"},{name:"AUTOMATION_CREATE",description:"Create automation",category:"Automations"},{name:"AUTOMATION_GET",description:"View automation details",category:"Automations"},{name:"AUTOMATION_LIST",description:"List automations",category:"Automations"},{name:"AUTOMATION_UPDATE",description:"Update automation",category:"Automations"},{name:"AUTOMATION_DELETE",description:"Delete automation",category:"Automations",dangerous:!0},{name:"AUTOMATION_TRIGGER_ADD",description:"Add trigger to automation",category:"Automations"},{name:"AUTOMATION_TRIGGER_REMOVE",description:"Remove trigger from automation",category:"Automations"},{name:"AUTOMATION_RUN",description:"Manually trigger an automation run",category:"Automations"},{name:"VIRTUAL_MCP_PLUGIN_CONFIG_GET",description:"View virtual MCP plugin configuration",category:"Virtual MCPs"},{name:"VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE",description:"Update virtual MCP plugin configuration",category:"Virtual MCPs"},{name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",description:"Update virtual MCP pinned sidebar views",category:"Virtual MCPs"},{name:"AI_PROVIDERS_LIST",description:"List available AI providers",category:"AI Providers"},{name:"AI_PROVIDERS_LIST_MODELS",description:"List AI provider models",category:"AI Providers"},{name:"AI_PROVIDERS_ACTIVE",description:"List active AI providers",category:"AI Providers"},{name:"AI_PROVIDER_KEY_CREATE",description:"Store AI provider API key",category:"AI Providers"},{name:"AI_PROVIDER_KEY_LIST",description:"List AI provider API keys",category:"AI Providers"},{name:"AI_PROVIDER_KEY_DELETE",description:"Delete AI provider API key",category:"AI Providers",dangerous:!0},{name:"AI_PROVIDER_OAUTH_URL",description:"Get OAuth URL for provider",category:"AI Providers"},{name:"AI_PROVIDER_OAUTH_EXCHANGE",description:"Exchange OAuth code for API key",category:"AI Providers"},{name:"AI_PROVIDER_PROVISION_KEY",description:"Auto-provision API key for a provider",category:"AI Providers"},{name:"AI_PROVIDER_TOPUP_URL",description:"Get checkout URL to top up provider credits",category:"AI Providers"},{name:"AI_PROVIDER_CREDITS",description:"Get current credit balance for a provider",category:"AI Providers"},{name:"AI_PROVIDER_CLI_ACTIVATE",description:"Activate Claude Code via local CLI",category:"AI Providers"},{name:"LIST_OBJECTS",description:"List objects in storage",category:"Object Storage"},{name:"GET_OBJECT_METADATA",description:"Get object metadata",category:"Object Storage"},{name:"GET_PRESIGNED_URL",description:"Generate download URL",category:"Object Storage"},{name:"PUT_PRESIGNED_URL",description:"Generate upload URL",category:"Object Storage"},{name:"DELETE_OBJECT",description:"Delete object",category:"Object Storage",dangerous:!0},{name:"DELETE_OBJECTS",description:"Delete multiple objects",category:"Object Storage",dangerous:!0},{name:"COLLECTION_REGISTRY_APP_LIST",description:"List registry apps",category:"Registry"},{name:"COLLECTION_REGISTRY_APP_GET",description:"Get registry app details",category:"Registry"},{name:"COLLECTION_REGISTRY_APP_VERSIONS",description:"List registry app versions",category:"Registry"},{name:"COLLECTION_REGISTRY_APP_FILTERS",description:"Get registry app filters",category:"Registry"},{name:"REGISTRY_ITEM_LIST",description:"List private registry items",category:"Registry"},{name:"REGISTRY_ITEM_SEARCH",description:"Search registry items",category:"Registry"},{name:"REGISTRY_ITEM_GET",description:"Get registry item details",category:"Registry"},{name:"REGISTRY_ITEM_VERSIONS",description:"List registry item versions",category:"Registry"},{name:"REGISTRY_ITEM_CREATE",description:"Create registry item",category:"Registry"},{name:"REGISTRY_ITEM_BULK_CREATE",description:"Bulk create registry items",category:"Registry"},{name:"REGISTRY_ITEM_UPDATE",description:"Update registry item",category:"Registry"},{name:"REGISTRY_ITEM_DELETE",description:"Delete registry item",category:"Registry",dangerous:!0},{name:"REGISTRY_ITEM_FILTERS",description:"Get registry item filters",category:"Registry"},{name:"REGISTRY_DISCOVER_TOOLS",description:"Discover tools from MCP server",category:"Registry"},{name:"REGISTRY_AI_GENERATE",description:"AI-generate registry content",category:"Registry"},{name:"REGISTRY_PUBLISH_REQUEST_LIST",description:"List publish requests",category:"Registry"},{name:"REGISTRY_PUBLISH_REQUEST_REVIEW",description:"Review publish request",category:"Registry"},{name:"REGISTRY_PUBLISH_REQUEST_COUNT",description:"Count pending publish requests",category:"Registry"},{name:"REGISTRY_PUBLISH_REQUEST_DELETE",description:"Delete publish request",category:"Registry",dangerous:!0},{name:"REGISTRY_PUBLISH_API_KEY_GENERATE",description:"Generate publish API key",category:"Registry"},{name:"REGISTRY_PUBLISH_API_KEY_LIST",description:"List publish API keys",category:"Registry"},{name:"REGISTRY_PUBLISH_API_KEY_REVOKE",description:"Revoke publish API key",category:"Registry",dangerous:!0},{name:"REGISTRY_MONITOR_RUN_START",description:"Start monitor run",category:"Registry"},{name:"REGISTRY_MONITOR_RUN_LIST",description:"List monitor runs",category:"Registry"},{name:"REGISTRY_MONITOR_RUN_GET",description:"Get monitor run details",category:"Registry"},{name:"REGISTRY_MONITOR_RUN_CANCEL",description:"Cancel monitor run",category:"Registry"},{name:"REGISTRY_MONITOR_RESULT_LIST",description:"List monitor results",category:"Registry"},{name:"REGISTRY_MONITOR_CONNECTION_LIST",description:"List monitor connections",category:"Registry"},{name:"REGISTRY_MONITOR_CONNECTION_SYNC",description:"Sync monitor connections",category:"Registry"},{name:"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",description:"Update monitor connection auth",category:"Registry"},{name:"REGISTRY_MONITOR_SCHEDULE_SET",description:"Set monitor schedule",category:"Registry"},{name:"REGISTRY_MONITOR_SCHEDULE_CANCEL",description:"Cancel monitor schedule",category:"Registry"},{name:"VM_START",description:"Start a Freestyle VM with dev server preview",category:"VM"},{name:"VM_DELETE",description:"Stop and delete a Freestyle VM",category:"VM"},{name:"GITHUB_LIST_USER_ORGS",description:"List GitHub user's personal account and organizations",category:"GitHub"}],Lt={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",BRAND_CONTEXT_LIST:"List brand contexts",BRAND_CONTEXT_GET:"View brand context",BRAND_CONTEXT_CREATE:"Create brand context",BRAND_CONTEXT_UPDATE:"Update brand context",BRAND_CONTEXT_DELETE:"Delete brand context",BRAND_CONTEXT_EXTRACT:"Extract brand from website",BRAND_GET:"Get brand",BRAND_LIST:"List brands",ORGANIZATION_DOMAIN_GET:"Get domain claim",ORGANIZATION_DOMAIN_SET:"Set domain claim",ORGANIZATION_DOMAIN_UPDATE:"Update domain settings",ORGANIZATION_DOMAIN_CLEAR:"Clear domain claim",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",MONITORING_LOG_GET:"View monitoring log details",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags",VIRTUAL_MCP_PLUGIN_CONFIG_GET:"View plugin config",VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE:"Update plugin config",VIRTUAL_MCP_PINNED_VIEWS_UPDATE:"Update pinned views",AUTOMATION_CREATE:"Create automation",AUTOMATION_GET:"View automation details",AUTOMATION_LIST:"List automations",AUTOMATION_UPDATE:"Update automation",AUTOMATION_DELETE:"Delete automation",AUTOMATION_TRIGGER_ADD:"Add trigger",AUTOMATION_TRIGGER_REMOVE:"Remove trigger",AUTOMATION_RUN:"Run automation",AI_PROVIDERS_LIST:"List AI providers",AI_PROVIDERS_LIST_MODELS:"List AI models",AI_PROVIDERS_ACTIVE:"List active providers",AI_PROVIDER_KEY_CREATE:"Create provider key",AI_PROVIDER_KEY_LIST:"List provider keys",AI_PROVIDER_KEY_DELETE:"Delete provider key",AI_PROVIDER_OAUTH_URL:"Get OAuth URL",AI_PROVIDER_OAUTH_EXCHANGE:"Connect via OAuth",AI_PROVIDER_PROVISION_KEY:"Auto-provision key",AI_PROVIDER_TOPUP_URL:"Get top-up checkout URL",AI_PROVIDER_CREDITS:"Get credit balance",AI_PROVIDER_CLI_ACTIVATE:"Activate Claude Code CLI",LIST_OBJECTS:"List objects",GET_OBJECT_METADATA:"Get object metadata",GET_PRESIGNED_URL:"Generate download URL",PUT_PRESIGNED_URL:"Generate upload URL",DELETE_OBJECT:"Delete object",DELETE_OBJECTS:"Delete multiple objects",COLLECTION_REGISTRY_APP_LIST:"List registry apps",COLLECTION_REGISTRY_APP_GET:"Get registry app",COLLECTION_REGISTRY_APP_VERSIONS:"List registry app versions",COLLECTION_REGISTRY_APP_FILTERS:"Get registry filters",REGISTRY_ITEM_LIST:"List registry items",REGISTRY_ITEM_SEARCH:"Search registry",REGISTRY_ITEM_GET:"Get registry item",REGISTRY_ITEM_VERSIONS:"List item versions",REGISTRY_ITEM_CREATE:"Create registry item",REGISTRY_ITEM_BULK_CREATE:"Bulk create items",REGISTRY_ITEM_UPDATE:"Update registry item",REGISTRY_ITEM_DELETE:"Delete registry item",REGISTRY_ITEM_FILTERS:"Get item filters",REGISTRY_DISCOVER_TOOLS:"Discover tools",REGISTRY_AI_GENERATE:"AI generate content",REGISTRY_PUBLISH_REQUEST_LIST:"List publish requests",REGISTRY_PUBLISH_REQUEST_REVIEW:"Review publish request",REGISTRY_PUBLISH_REQUEST_COUNT:"Count publish requests",REGISTRY_PUBLISH_REQUEST_DELETE:"Delete publish request",REGISTRY_PUBLISH_API_KEY_GENERATE:"Generate API key",REGISTRY_PUBLISH_API_KEY_LIST:"List API keys",REGISTRY_PUBLISH_API_KEY_REVOKE:"Revoke API key",REGISTRY_MONITOR_RUN_START:"Start monitor run",REGISTRY_MONITOR_RUN_LIST:"List monitor runs",REGISTRY_MONITOR_RUN_GET:"Get monitor run",REGISTRY_MONITOR_RUN_CANCEL:"Cancel monitor run",REGISTRY_MONITOR_RESULT_LIST:"List monitor results",REGISTRY_MONITOR_CONNECTION_LIST:"List monitor connections",REGISTRY_MONITOR_CONNECTION_SYNC:"Sync monitor connections",REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH:"Update connection auth",REGISTRY_MONITOR_SCHEDULE_SET:"Set monitor schedule",REGISTRY_MONITOR_SCHEDULE_CANCEL:"Cancel monitor schedule",VM_START:"Start VM preview",VM_DELETE:"Delete VM preview",GITHUB_LIST_USER_ORGS:"List GitHub user orgs"};function vt(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],Tags:[],"AI Providers":[],Automations:[],"Object Storage":[],Registry:[],GitHub:[],VM:[]};for(const e of Xe)t[e.category]?.push(e);return t}function jt(){return Xe.map(t=>({value:t.name,label:Lt[t.name],dangerous:t.dangerous}))}const Pt=k.memo(function(e){const n=q.c(21),{connection:i,isSelected:o,hasToolsEnabled:c,activeToolsCount:u,totalToolsCount:f,onSelect:d,onToggle:T}=e,g=o?"bg-accent/50":"hover:bg-muted/50";let r;n[0]!==g?(r=H("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),n[0]=g,n[1]=r):r=n[1];let E;n[2]!==i.icon||n[3]!==i.title?(E=s.jsx(be,{icon:i.icon,name:i.title,size:"xs"}),n[2]=i.icon,n[3]=i.title,n[4]=E):E=n[4];let a;n[5]!==i.title?(a=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:i.title})}),n[5]=i.title,n[6]=a):a=n[6];let m;n[7]!==d||n[8]!==E||n[9]!==a?(m=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:d,children:[E,a]}),n[7]=d,n[8]=E,n[9]=a,n[10]=m):m=n[10];let _;n[11]!==u||n[12]!==i.tools||n[13]!==c||n[14]!==T||n[15]!==f?(_=i.tools&&i.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[u,"/",f]}),s.jsx(Oe,{checked:c,onCheckedChange:T,onClick:Dt})]}),n[11]=u,n[12]=i.tools,n[13]=c,n[14]=T,n[15]=f,n[16]=_):_=n[16];let x;return n[17]!==r||n[18]!==m||n[19]!==_?(x=s.jsxs("div",{className:r,children:[m,_]}),n[17]=r,n[18]=m,n[19]=_,n[20]=x):x=n[20],x}),Mt=k.memo(function(e){const n=q.c(18),{connectionId:i,tool:o,isSelected:c,onToggle:u}=e,f=`tool-${i}-${o.name}`,d=c?"text-foreground":"text-muted-foreground";let T;n[0]!==d?(T=H("text-sm font-medium",d),n[0]=d,n[1]=T):T=n[1];let g;n[2]!==T||n[3]!==o.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:T,children:o.name})}),n[2]=T,n[3]=o.name,n[4]=g):g=n[4];let r;n[5]!==o.description?(r=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),n[5]=o.description,n[6]=r):r=n[6];let E;n[7]!==g||n[8]!==r?(E=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,r]}),n[7]=g,n[8]=r,n[9]=E):E=n[9];const a=`tool-${i}-${o.name}`;let m;n[10]!==c||n[11]!==u||n[12]!==a?(m=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(Oe,{id:a,checked:c,onCheckedChange:u,onClick:wt})}),n[10]=c,n[11]=u,n[12]=a,n[13]=m):m=n[13];let _;return n[14]!==f||n[15]!==E||n[16]!==m?(_=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:f,children:[E,m]}),n[14]=f,n[15]=E,n[16]=m,n[17]=_):_=n[17],_});function Gt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:i}){const[o,c]=k.useState(""),u=i!==void 0?i:o,f=k.useDeferredValue(u),[d,T]=k.useState("all"),[g,r]=k.useState(!1),E=k.useRef(new Set(Object.keys(t))),{org:a}=Re(),m=Rt({connectionId:xt,orgId:a.id}),_=100,x=f.trim(),C=x?{operator:"or",conditions:[{field:["title"],operator:"contains",value:x},{field:["description"],operator:"contains",value:x}]}:void 0,v=!!n,A={...C&&{where:C},orderBy:[{field:["updated_at"],direction:"asc"}],limit:_,offset:0,...v&&{include_virtual:!0}},y=JSON.stringify(A),{data:S,fetchNextPage:N,hasNextPage:p,isFetchingNextPage:b}=ht({queryKey:ce.collectionListInfinite(m,a.id,"","CONNECTIONS",y),queryFn:async({pageParam:I=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...C&&{where:C},orderBy:[{field:["updated_at"],direction:"asc"}],limit:_,offset:I,...v&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(I,U)=>{if(I?.hasMore)return U.reduce((K,ee)=>K+(ee?.items?.length??0),0)},staleTime:3e4}),l=S?.pages.flatMap(I=>I?.items??[])??[],h=_t(N,p??!1,b),P=n?l.filter(I=>I.connection_type!=="VIRTUAL"?!0:it(I.connection_url)!==n):l,j=E.current,R=[...j.values()].map(I=>P.find(U=>U.id===I)).filter(I=>I!==void 0),O=P.filter(I=>!j.has(I.id)),M=[...R,...O],Y=I=>{const U=t[I];return U!==void 0&&U.length>0},z=M.filter(I=>{if(d==="all")return!0;const U=Y(I.id);return d==="selected"?U:d==="unselected"?!U:!0}),[D,w]=k.useState(M[0]?.id??null),L=D?M.find(I=>I.id===D)??null:null,V=L?.tools??[],$=(I,U)=>t[I]?.includes(U)??!1,Q=(I,U)=>{const K=t[I]??[],ee=K.includes(U),Z={...t};if(ee){const J=K.filter(F=>F!==U);J.length===0?delete Z[I]:Z[I]=J}else Z[I]=[...K,U];e(Z)},X=I=>{const U=M.find(F=>F.id===I);if(!U?.tools)return;const K=t[I]??[],ee=U.tools.map(F=>F.name),Z=K.length>0&&ee.every(F=>K.includes(F)),J={...t};Z?delete J[I]:(J[I]=ee,w(I)),e(J)},W=I=>{w(I),r(!0)},ie=()=>{r(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:H("w-full md:w-80 border-r border-border flex flex-col",g&&"hidden md:flex"),children:[i===void 0&&s.jsx(Nt,{value:o,onChange:c,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>T("all"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>T("selected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>T("unselected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:z.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:u?"No connections found":d==="selected"?"No servers selected":d==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[z.map(I=>{const U=I.tools?.length??0,K=t[I.id]?.length??0;return s.jsx(Pt,{connection:I,isSelected:D===I.id,hasToolsEnabled:Y(I.id),activeToolsCount:K,totalToolsCount:U,onSelect:()=>W(I.id),onToggle:()=>X(I.id)},I.id)}),s.jsx("div",{ref:h,className:"h-4"}),b&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(_e,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:H("flex-1 flex-col",g?"flex":"hidden md:flex"),children:L?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(It,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(be,{icon:L.icon,name:L.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:L.title}),L.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:L.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:V.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:V.map(I=>s.jsx(Mt,{connectionId:L.id,tool:I,isSelected:$(L.id,I.name),onToggle:()=>Q(L.id,I.name)},I.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 Dt(t){return t.stopPropagation()}function wt(t){return t.stopPropagation()}const xe=["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"],Ut={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Je(t){if(!t)return"bg-neutral-400";let e=0;for(let i=0;i<t.length;i++){const o=t.charCodeAt(i);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%xe.length;return xe[n]??xe[0]}function Me(t,e){return e?Ut[t]??"bg-neutral-400":Je(t)}const kt=ye({role:ye({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ve(),staticPermissions:he(se()),toolSet:Le(se(),he(se())),allowAllModels:ve(),modelSet:Le(se(),he(se())),memberIds:he(se())});function We(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Vt(t){const e=q.c(34),{allowAllStaticPermissions:n,staticPermissions:i,onAllowAllChange:o,onPermissionsChange:c,readOnly:u,searchQuery:f}=t,d=u===void 0?!1:u,T=k.useDeferredValue(f);let g,r,E,a;if(e[0]!==n||e[1]!==T||e[2]!==o||e[3]!==c||e[4]!==d||e[5]!==i){const x=vt(),C=jt(),v=C.filter(l=>l.label.toLowerCase().includes(T.toLowerCase())),A=l=>{if(i.includes(l))c(i.filter(h=>h!==l));else{const h=[...i,l];h.length===C.length?(o(!0),c([])):c(h)}};E="flex flex-col h-full";const y=!d&&"hover:bg-muted/50 cursor-pointer";let S;e[10]!==y?(S=H("flex items-center justify-between px-4 py-3",y),e[10]=y,e[11]=S):S=e[11];let N;e[12]!==n||e[13]!==o||e[14]!==c||e[15]!==d?(N=()=>{d||(o(!n),c([]))},e[12]=n,e[13]=o,e[14]=c,e[15]=d,e[16]=N):N=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[17]=p):p=e[17];let b;e[18]!==n||e[19]!==o||e[20]!==c||e[21]!==d?(b=s.jsx("div",{onClick:Kt,children:d?s.jsx(ue,{children:s.jsxs(ge,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(oe,{checked:n,disabled:!0,onCheckedChange:Ht})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(oe,{checked:n,onCheckedChange:l=>{o(l),c([])}})}),e[18]=n,e[19]=o,e[20]=c,e[21]=d,e[22]=b):b=e[22],e[23]!==b||e[24]!==S||e[25]!==N?(a=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:S,onClick:N,children:[p,b]})}),e[23]=b,e[24]=S,e[25]=N,e[26]=a):a=e[26],g="flex-1 overflow-auto",r=Object.entries(x).map(l=>{const[h,P]=l,j=v.filter(R=>P.some(O=>O.name===R.value));return j.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:h}),s.jsx("div",{className:"space-y-1",children:j.map(R=>s.jsxs("div",{className:H("flex items-center justify-between gap-3 px-4 py-3",!d&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{d||(n?(o(!1),c(C.map($t).filter(O=>O!==R.value))):A(R.value))},children:[s.jsx("span",{className:"text-sm flex-1 min-w-0",children:R.label}),s.jsx("div",{onClick:Yt,children:d?s.jsx(ue,{children:s.jsxs(ge,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(oe,{checked:n||i.includes(R.value),disabled:!0,onCheckedChange:zt})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(oe,{checked:n||i.includes(R.value),onCheckedChange:()=>{n?(o(!1),c(C.map(Bt).filter(O=>O!==R.value))):A(R.value)}})})]},R.value))})]},h)}),e[0]=n,e[1]=T,e[2]=o,e[3]=c,e[4]=d,e[5]=i,e[6]=g,e[7]=r,e[8]=E,e[9]=a}else g=e[6],r=e[7],E=e[8],a=e[9];let m;e[27]!==g||e[28]!==r?(m=s.jsx("div",{className:g,children:r}),e[27]=g,e[28]=r,e[29]=m):m=e[29];let _;return e[30]!==E||e[31]!==a||e[32]!==m?(_=s.jsxs("div",{className:E,children:[a,m]}),e[30]=E,e[31]=a,e[32]=m,e[33]=_):_=e[33],_}function Bt(t){return t.value}function zt(){}function Yt(t){return t.stopPropagation()}function $t(t){return t.value}function Ht(){}function Kt(t){return t.stopPropagation()}const et={anthropic:"Anthropic",openrouter:"OpenRouter"},Ft={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 Qt(t,e){const n=t.indexOf("/"),i=n>0?t.slice(0,n):e;return i.startsWith("~")?i.slice(1):i}function Zt(t){return Ft[t]??et[t]??t}function qt(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const tt=30;function Xt(t){const e=q.c(44),{connectionId:n,subProviderId:i,subProviderName:o,groupLogo:c,models:u,allConnectionModelIds:f,selectedModels:d,allowAllModels:T,allConnectionModelsSelected:g,onToggleModel:r,onExitAllowAll:E,readOnly:a,defaultExpanded:m}=t,[_,x]=k.useState(m),C=m||_,v=x,[A,y]=k.useState(tt);let S;e[0]!==g||e[1]!==T||e[2]!==d?(S=h=>T||g||d.includes("*")||d.includes(h),e[0]=g,e[1]=T,e[2]=d,e[3]=S):S=e[3];const N=S;let p;if(e[4]!==N||e[5]!==u){let h;e[7]!==N?(h=P=>N(P.id),e[7]=N,e[8]=h):h=e[8],p=u.filter(h),e[4]=N,e[5]=u,e[6]=p}else p=e[6];const b=p.length;let l;if(e[9]!==f||e[10]!==T||e[11]!==n||e[12]!==b||e[13]!==C||e[14]!==c||e[15]!==N||e[16]!==u||e[17]!==E||e[18]!==r||e[19]!==a||e[20]!==i||e[21]!==o||e[22]!==A){const h=u.slice(0,A),P=u.length>A;let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=()=>v(ts),e[24]=j):j=e[24];const R=c??Fe[i]??Qe;let O;e[25]!==o||e[26]!==R?(O=s.jsx(be,{icon:R,name:o,size:"sm"}),e[25]=o,e[26]=R,e[27]=O):O=e[27];let M;e[28]!==o?(M=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=M):M=e[29];let Y;e[30]!==O||e[31]!==M?(Y=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[O,M]}),e[30]=O,e[31]=M,e[32]=Y):Y=e[32];let z;e[33]!==b||e[34]!==u.length?(z=s.jsxs(fe,{variant:"secondary",className:"text-xs text-muted-foreground",children:[b,"/",u.length," enabled"]}),e[33]=b,e[34]=u.length,e[35]=z):z=e[35];let D;e[36]!==C?(D=C?s.jsx(bt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Ot,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=C,e[37]=D):D=e[37];let w;e[38]!==D||e[39]!==z?(w=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[z,D]}),e[38]=D,e[39]=z,e[40]=w):w=e[40];let L;e[41]!==w||e[42]!==Y?(L=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:j,children:[Y,w]}),e[41]=w,e[42]=Y,e[43]=L):L=e[43],l=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[L,C&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[h.map(V=>{const $=N(V.id),Q=()=>{if(!a){if(T){E(n,f,V.id);return}r(n,V.id)}};return s.jsxs("div",{className:H("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!a&&"hover:bg-muted/50 cursor-pointer"),onClick:Q,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:V.title})}),s.jsx("div",{onClick:es,children:a?s.jsx(ue,{children:s.jsxs(ge,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(oe,{checked:$,disabled:!0,onCheckedChange:Wt})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(oe,{checked:$,onCheckedChange:Q})})]},V.id)}),P&&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:()=>y(Jt),children:["Show more (",u.length-A," remaining)"]})]})]}),e[9]=f,e[10]=T,e[11]=n,e[12]=b,e[13]=C,e[14]=c,e[15]=N,e[16]=u,e[17]=E,e[18]=r,e[19]=a,e[20]=i,e[21]=o,e[22]=A,e[23]=l}else l=e[23];return l}function Jt(t){return t+tt}function Wt(){}function es(t){return t.stopPropagation()}function ts(t){return!t}function ss(t){const e=q.c(33),{connection:n,selectedModels:i,allowAllModels:o,onToggleModel:c,onExitAllowAll:u,allConnectionModelsSelected:f,searchQuery:d,readOnly:T}=t,g=St(n.id);let r,E,a,m,_;if(e[0]!==f||e[1]!==o||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==u||e[6]!==c||e[7]!==g||e[8]!==T||e[9]!==d||e[10]!==i){_=Symbol.for("react.early_return_sentinel");e:{let v;e[16]!==n.label?(v=R=>({...R,id:R.modelId,provider:n.label}),e[16]=n.label,e[17]=v):v=e[17];const A=g.filter(os).map(v),y=d.trim().toLowerCase(),S=y?A.filter(R=>R.title.toLowerCase().includes(y)||R.id.toLowerCase().includes(y)||R.provider?.toLowerCase().includes(y)):A;if(S.length===0){_=null;break e}const N=new Map;for(const R of S){const O=Qt(R.id,n.providerId),M=N.get(O)??{models:[],logo:null};M.models.push({id:R.id,title:qt(R.title),logo:R.logo}),!M.logo&&R.logo&&(M.logo=R.logo),N.set(O,M)}const p=Array.from(N.entries()).map(rs).sort(is),b=p.length===1||y.length>0;a="flex flex-col gap-3";const l=Fe[n.providerId]??Qe;let h;e[18]!==n.providerId||e[19]!==l?(h=s.jsx("img",{src:l,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=l,e[20]=h):h=e[20];const P=et[n.providerId]??n.providerId;let j;e[21]!==P?(j=s.jsx("h4",{className:"text-sm font-medium",children:P}),e[21]=P,e[22]=j):j=e[22],e[23]!==j||e[24]!==h?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[h,j]}),e[23]=j,e[24]=h,e[25]=m):m=e[25],r="flex flex-col gap-3",E=p.map(R=>s.jsx(Xt,{connectionId:n.id,subProviderId:R.id,subProviderName:R.name,groupLogo:R.logo,models:R.models,allConnectionModelIds:A.map(ns),selectedModels:i,allowAllModels:o,allConnectionModelsSelected:f,onToggleModel:c,onExitAllowAll:u,readOnly:T,defaultExpanded:b},R.id))}e[0]=f,e[1]=o,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=u,e[6]=c,e[7]=g,e[8]=T,e[9]=d,e[10]=i,e[11]=r,e[12]=E,e[13]=a,e[14]=m,e[15]=_}else r=e[11],E=e[12],a=e[13],m=e[14],_=e[15];if(_!==Symbol.for("react.early_return_sentinel"))return _;let x;e[26]!==r||e[27]!==E?(x=s.jsx("div",{className:r,children:E}),e[26]=r,e[27]=E,e[28]=x):x=e[28];let C;return e[29]!==a||e[30]!==m||e[31]!==x?(C=s.jsxs("div",{className:a,children:[m,x]}),e[29]=a,e[30]=m,e[31]=x,e[32]=C):C=e[32],C}function ns(t){return t.id}function is(t,e){return t.name.localeCompare(e.name)}function rs(t){const[e,n]=t;return{id:e,name:Zt(e),logo:n.logo,models:n.models}}function os(t,e,n){return n.findIndex(i=>i.modelId===t.modelId)===e}function ls(t){const e=q.c(35),{allowAllModels:n,modelSet:i,onAllowAllChange:o,onModelSetChange:c,readOnly:u,searchQuery:f}=t,d=u===void 0?!1:u,T=k.useDeferredValue(f),g=At();let r;e[0]!==i||e[1]!==c?(r=(p,b)=>{const l=i[p]??[],h={...i};if(l.includes(b)){const P=l.filter(j=>j!==b);P.length===0?delete h[p]:h[p]=P}else h[p]=[...l,b];c(h)},e[0]=i,e[1]=c,e[2]=r):r=e[2];const E=r;let a;e[3]!==i||e[4]!==o||e[5]!==c?(a=(p,b,l)=>{o(!1),c({...i,[p]:b.filter(h=>h!==l)})},e[3]=i,e[4]=o,e[5]=c,e[6]=a):a=e[6];const m=a,_=!d&&"hover:bg-muted/50 cursor-pointer";let x;e[7]!==_?(x=H("flex items-center justify-between px-4 py-3 rounded-lg border border-border",_),e[7]=_,e[8]=x):x=e[8];let C;e[9]!==n||e[10]!==o||e[11]!==c||e[12]!==d?(C=()=>{if(d)return;const p=!n;o(p),p&&c({})},e[9]=n,e[10]=o,e[11]=c,e[12]=d,e[13]=C):C=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=v):v=e[14];let A;e[15]!==n||e[16]!==o||e[17]!==c||e[18]!==d?(A=s.jsx("div",{onClick:cs,children:d?s.jsx(ue,{children:s.jsxs(ge,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(oe,{checked:n,disabled:!0,onCheckedChange:as})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(oe,{checked:n,onCheckedChange:p=>{o(p),p&&c({})}})}),e[15]=n,e[16]=o,e[17]=c,e[18]=d,e[19]=A):A=e[19];let y;e[20]!==x||e[21]!==C||e[22]!==A?(y=s.jsxs("div",{className:x,onClick:C,children:[v,A]}),e[20]=x,e[21]=C,e[22]=A,e[23]=y):y=e[23];let S;e[24]!==g||e[25]!==n||e[26]!==T||e[27]!==m||e[28]!==i||e[29]!==d||e[30]!==E?(S=g.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):g.map(p=>s.jsx(k.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(_e,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ss,{connection:p,selectedModels:i[p.id]??[],allowAllModels:n,onToggleModel:E,onExitAllowAll:m,allConnectionModelsSelected:(i[p.id]??[]).includes("*"),searchQuery:T,readOnly:d})},p.id)),e[24]=g,e[25]=n,e[26]=T,e[27]=m,e[28]=i,e[29]=d,e[30]=E,e[31]=S):S=e[31];let N;return e[32]!==S||e[33]!==y?(N=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[y,S]}),e[32]=S,e[33]=y,e[34]=N):N=e[34],N}function as(){}function cs(t){return t.stopPropagation()}function ds(t){const e=q.c(52),{open:n,onOpenChange:i,selectedMemberIds:o,onAddMembers:c}=t,[u,f]=k.useState(""),d=k.useDeferredValue(u);let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=[],e[0]=T):T=e[0];const[g,r]=k.useState(T),{data:E}=Ze();let a,m,_,x,C,v,A,y,S,N,p;if(e[1]!==E?.data?.members||e[2]!==d||e[3]!==c||e[4]!==i||e[5]!==n||e[6]!==g||e[7]!==u||e[8]!==o){const Y=E?.data?.members??[];let z;e[20]!==d?(z=L=>{const V=d.toLowerCase();return L.user?.name?.toLowerCase().includes(V)||L.user?.email?.toLowerCase().includes(V)},e[20]=d,e[21]=z):z=e[21];const D=Y.filter(z);let w;e[22]!==c||e[23]!==i||e[24]!==g?(w=()=>{c(g),r([]),i(!1)},e[22]=c,e[23]=i,e[24]=g,e[25]=w):w=e[25],_=w,m=Ue,N=n,p=i,a=ke,y="sm:max-w-md p-0 overflow-hidden",e[26]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs(Ve,{className:"px-6 pt-6",children:[s.jsx(Be,{children:"Add Members to Role"}),s.jsx(ze,{children:"Select members to add to this role."})]}),e[26]=S):S=e[26],v="flex flex-col h-80",e[27]!==u?(A=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(Se,{value:u,onChange:f,placeholder:"Search members...",className:"w-full"})}),e[27]=u,e[28]=A):A=e[28],x="flex-1 overflow-auto",C=D.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:u?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:D.map(L=>{const V=L.role!=="owner",$=o.includes(L.id),Q=g.includes(L.id);return s.jsxs("label",{className:H("flex items-center gap-3 p-2 rounded-lg",!V||$?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(Oe,{checked:Q||$,onCheckedChange:()=>{!V||$||r(X=>X.includes(L.id)?X.filter(W=>W!==L.id):[...X,L.id])},disabled:!V||$}),s.jsx(qe,{url:L.user?.image??void 0,fallback:We(L.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:L.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:L.user?.email})]}),!V&&s.jsx(fe,{variant:"secondary",className:"shrink-0",children:"Owner"}),$&&V&&s.jsx(fe,{variant:"outline",className:"shrink-0",children:"Added"})]},L.id)})}),e[1]=E?.data?.members,e[2]=d,e[3]=c,e[4]=i,e[5]=n,e[6]=g,e[7]=u,e[8]=o,e[9]=a,e[10]=m,e[11]=_,e[12]=x,e[13]=C,e[14]=v,e[15]=A,e[16]=y,e[17]=S,e[18]=N,e[19]=p}else a=e[9],m=e[10],_=e[11],x=e[12],C=e[13],v=e[14],A=e[15],y=e[16],S=e[17],N=e[18],p=e[19];let b;e[29]!==x||e[30]!==C?(b=s.jsx("div",{className:x,children:C}),e[29]=x,e[30]=C,e[31]=b):b=e[31];let l;e[32]!==b||e[33]!==v||e[34]!==A?(l=s.jsxs("div",{className:v,children:[A,b]}),e[32]=b,e[33]=v,e[34]=A,e[35]=l):l=e[35];let h;e[36]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ye,{children:"Cancel"}),e[36]=h):h=e[36];const P=g.length===0,j=g.length>0&&`(${g.length})`;let R;e[37]!==_||e[38]!==P||e[39]!==j?(R=s.jsxs($e,{className:"px-6 pb-6",children:[h,s.jsxs(He,{onClick:_,disabled:P,children:["Add ",j]})]}),e[37]=_,e[38]=P,e[39]=j,e[40]=R):R=e[40];let O;e[41]!==a||e[42]!==l||e[43]!==R||e[44]!==y||e[45]!==S?(O=s.jsxs(a,{className:y,children:[S,l,R]}),e[41]=a,e[42]=l,e[43]=R,e[44]=y,e[45]=S,e[46]=O):O=e[46];let M;return e[47]!==m||e[48]!==O||e[49]!==N||e[50]!==p?(M=s.jsx(m,{open:N,onOpenChange:p,children:O}),e[47]=m,e[48]=O,e[49]=N,e[50]=p,e[51]=M):M=e[51],M}function ms(t){const e=q.c(28),{memberIds:n,onMemberIdsChange:i,readOnly:o,searchQuery:c,addMemberDialogOpen:u,onAddMemberDialogOpenChange:f}=t,d=o===void 0?!1:o,T=k.useDeferredValue(c),{data:g}=Ze();let r,E,a;if(e[0]!==g?.data?.members||e[1]!==T||e[2]!==n||e[3]!==i||e[4]!==d||e[5]!==c){const v=g?.data?.members??[];let A;e[9]!==n?(A=p=>n.includes(p.id),e[9]=n,e[10]=A):A=e[10];const y=v.filter(A);let S;e[11]!==T?(S=p=>{const b=T.toLowerCase();return p.user?.name?.toLowerCase().includes(b)||p.user?.email?.toLowerCase().includes(b)},e[11]=T,e[12]=S):S=e[12];const N=y.filter(S);a="flex flex-col h-full",r="flex-1 overflow-auto",E=y.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."})]})}):N.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:N.map(p=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(qe,{url:p.user?.image??void 0,fallback:We(p.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:p.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p.user?.email})]}),d?s.jsx(ue,{children:s.jsxs(ge,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Pe,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>i(n.filter(b=>b!==p.id)),children:s.jsx(Pe,{size:16})})]},p.id))}),e[0]=g?.data?.members,e[1]=T,e[2]=n,e[3]=i,e[4]=d,e[5]=c,e[6]=r,e[7]=E,e[8]=a}else r=e[6],E=e[7],a=e[8];let m;e[13]!==r||e[14]!==E?(m=s.jsx("div",{className:r,children:E}),e[13]=r,e[14]=E,e[15]=m):m=e[15];let _;e[16]!==n||e[17]!==i?(_=v=>i([...n,...v]),e[16]=n,e[17]=i,e[18]=_):_=e[18];let x;e[19]!==u||e[20]!==n||e[21]!==f||e[22]!==_?(x=s.jsx(ds,{open:u,onOpenChange:f,selectedMemberIds:n,onAddMembers:_}),e[19]=u,e[20]=n,e[21]=f,e[22]=_,e[23]=x):x=e[23];let C;return e[24]!==a||e[25]!==m||e[26]!==x?(C=s.jsxs("div",{className:a,children:[m,x]}),e[24]=a,e[25]=m,e[26]=x,e[27]=C):C=e[27],C}function us(t){const e=q.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(_e,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let i;return e[1]!==t?(i=s.jsx(k.Suspense,{fallback:n,children:s.jsx(ms,{...t})}),e[1]=t,e[2]=i):i=e[2],i}const gs={owner:[],admin:[],user:[]};function Es(t,e){const n=t==="owner"||t==="admin";return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:gs[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(i=>i.role===t).map(i=>i.id)}}function Ts(t,e,n){const i=t.permission||{},o=i.self||[],c=o.includes("*"),u=c?[]:o.filter(r=>r!=="*"),f={};for(const[r,E]of Object.entries(i))if(!(r==="self"||r==="models"))if(r==="*")for(const a of n)f[a.id]=E.includes("*")?a.tools?.map(m=>m.name)??[]:E;else{const a=n.find(m=>m.id===r);a&&(f[r]=E.includes("*")?a.tools?.map(m=>m.name)??[]:E)}const d=i.models||[],T=d.length===0||d.includes("*:*"),g={};if(!T)for(const r of d){const E=r.indexOf(":");if(E===-1)continue;const a=r.slice(0,E),m=r.slice(E+1);g[a]||(g[a]=[]),g[a].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:c,staticPermissions:u,toolSet:f,allowAllModels:T,modelSet:g,memberIds:e.filter(r=>r.role===t.role).map(r=>r.id)}}function ps(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[i,o]of Object.entries(t.toolSet))if(o.length>0){const u=e.find(f=>f.id===i)?.tools?.map(f=>f.name)??[];n[i]=u.length>0&&u.every(f=>o.includes(f))?["*"]:o}if(t.allowAllModels)n.models=["*:*"];else{const i=[];for(const[o,c]of Object.entries(t.modelSet))for(const u of c)i.push(`${o}:${u}`);i.length>0&&(n.models=i)}return n}function fs(t,e,n){return t.kind==="builtin"?Es(t.role,e):t.kind==="custom"?Ts(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function _s(t){const e=q.c(5),{readOnly:n,onOpen:i}=t;if(n){let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ce,{size:16}),"Add Member"]})})}),e[0]=u):u=e[0];let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ue,{children:s.jsxs(ge,{children:[u,s.jsx(Te,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}),e[1]=f):f=e[1],f}let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Ce,{size:16}),e[2]=o):o=e[2];let c;return e[3]!==i?(c=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[o,"Add Member"]}),e[3]=i,e[4]=c):c=e[4],c}function Is(t){const e=q.c(11),{locator:n}=Re(),i=Ct();let o;e[0]!==n?(o=ce.members(n),e[0]=n,e[1]=o):o=e[1];let c;e[2]!==o?(c={queryKey:o,queryFn:hs},e[2]=o,e[3]=c):c=e[3];const{data:u,isPending:f}=Ge(c);if(f||!i){let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(_e,{size:32,className:"animate-spin text-muted-foreground"})})}),e[4]=r):r=e[4],r}let d;e[5]!==u?.data?.members?(d=u?.data?.members??[],e[5]=u?.data?.members,e[6]=d):d=e[6];const T=d;let g;return e[7]!==i||e[8]!==T||e[9]!==t?(g=s.jsx(Rs,{...t,members:T,connections:i}),e[7]=i,e[8]=T,e[9]=t,e[10]=g):g=e[10],g}function hs(){return re.organization.listMembers()}function Rs({target:t,onBack:e,onSaved:n,members:i,connections:o}){const{locator:c}=Re(),u=De(),f=t.kind==="builtin",d=t.kind==="new",[T,g]=k.useState(f?"org":"mcp"),r=rt({resolver:ot(kt),defaultValues:fs(t,i,o)}),E=r.formState.isValid,a=r.formState.isDirty,m=we({mutationFn:async l=>{const h=ps(l,o),P=l.role.slug||l.role.label.toLowerCase().replace(/\s+/g,"-"),j=l.role.slug&&!l.role.id,R=async O=>{const M=i.filter(D=>D.role===O).map(D=>D.id),Y=l.memberIds.filter(D=>!M.includes(D)),z=M.filter(D=>!l.memberIds.includes(D));for(const D of Y){const w=await re.organization.updateMemberRole({memberId:D,role:[O]});if(w?.error)throw new Error(w.error.message??"Something went wrong")}for(const D of z){const w=await re.organization.updateMemberRole({memberId:D,role:["user"]});if(w?.error)throw new Error(w.error.message??"Something went wrong")}};if(j)return await R(l.role.slug),l;if(l.role.id){const O=await re.organization.updateRole({roleId:l.role.id,data:{permission:h}});if(O?.error)throw new Error(O.error.message??"Something went wrong");return await R(l.role.slug),l}else{const O=await re.organization.createRole({role:P,permission:h});if(O?.error)throw new Error(O.error.message??"Something went wrong");for(const M of l.memberIds){const Y=await re.organization.updateMemberRole({memberId:M,role:[P]});if(Y?.error)throw new Error(Y.error.message)}return{...l,role:{...l.role,id:O.data?.roleData?.id,slug:P}}}},onSuccess:(l,h)=>{u.invalidateQueries({queryKey:ce.members(c)}),u.invalidateQueries({queryKey:ce.organizationRoles(c)});const P=!h.role.id&&!h.role.slug,j=h.role.slug&&!h.role.id;Ae(j?"role_members_updated":P?"role_created":"role_updated",{role_slug:h.role.slug??null}),pe.success(j?"Members updated successfully!":P?"Role created successfully!":"Role updated successfully!"),r.reset(l),n(l.role.id)},onError:l=>{pe.error(l instanceof Error?l.message:"Failed to save role")}}),_=r.handleSubmit(l=>{if(!l.role.label.trim()){pe.error("Role name is required"),r.setFocus("role.label");return}m.mutate(l)}),x=!f||t.kind==="builtin"&&t.role!=="owner",C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...f?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[A,y]=k.useState(""),[S,N]=k.useState(!1),p=l=>{g(l),y("")},b={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:"flex flex-col 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:x&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:m.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:_,disabled:m.isPending||!E||!a,children:m.isPending?"Saving...":d?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:H("size-2.5 rounded-full shrink-0",t.kind==="builtin"?Me(t.role,!0):t.kind==="custom"?Me(t.role.role,!1):Je(r.watch("role.label")))}),f?s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(yt,{size:16,className:"text-muted-foreground shrink-0"}),d?s.jsx("input",{...r.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:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(l=>s.jsx("button",{type:"button",onClick:()=>p(l.id),className:H("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",T===l.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:l.label},l.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Se,{value:A,onChange:y,placeholder:b[T]??"Search...",className:"w-full md:w-[375px]"}),T==="members"&&s.jsx(_s,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>N(!0)})]})]})}),s.jsx("div",{className:"flex-1 min-h-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",children:s.jsxs("div",{className:H("h-full overflow-hidden",T!=="models"&&"border border-border rounded-xl"),children:[T==="mcp"&&!f&&s.jsx(Gt,{toolSet:r.watch("toolSet"),onToolSetChange:l=>r.setValue("toolSet",l,{shouldDirty:!0}),searchQuery:A}),T==="org"&&s.jsx(Vt,{allowAllStaticPermissions:r.watch("allowAllStaticPermissions"),staticPermissions:r.watch("staticPermissions"),onAllowAllChange:l=>r.setValue("allowAllStaticPermissions",l,{shouldDirty:!0}),onPermissionsChange:l=>r.setValue("staticPermissions",l,{shouldDirty:!0}),readOnly:f,searchQuery:A}),T==="models"&&s.jsx(ls,{allowAllModels:r.watch("allowAllModels"),modelSet:r.watch("modelSet"),onAllowAllChange:l=>r.setValue("allowAllModels",l,{shouldDirty:!0}),onModelSetChange:l=>r.setValue("modelSet",l,{shouldDirty:!0}),readOnly:f,searchQuery:A}),T==="members"&&s.jsx(us,{memberIds:r.watch("memberIds"),onMemberIdsChange:l=>r.setValue("memberIds",l,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&t.role==="owner",searchQuery:A,addMemberDialogOpen:S,onAddMemberDialogOpenChange:N})]})})]})})}function xs(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}const Ns=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],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"];function Cs(t){if(!t)return"bg-neutral-400";let e=0;for(let i=0;i<t.length;i++){const o=t.charCodeAt(i);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??Ne[0]}const As={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ss(t,e){return e?As[t]??"bg-neutral-400":Cs(t)}function bs(){const t=q.c(72),[e,n]=k.useState(""),[i,o]=k.useState(null),c=at();let u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u={strict:!1},t[0]=u):u=t[0];const{role:f}=ct(u),{locator:d}=Re(),T=De(),{customRoles:g,refetch:r}=dt();let E;t[1]!==c?(E=G=>c({to:".",search:B=>({...B,role:G})}),t[1]=c,t[2]=E):E=t[2];const a=E;let m;e:{if(!f){m=null;break e}if(f==="new"){m={kind:"new"};break e}if(f.startsWith("builtin-")){m={kind:"builtin",role:f.slice(8)};break e}let G;t[3]!==f?(G=le=>le.id===f,t[3]=f,t[4]=G):G=t[4];const B=g.find(G);m=B?{kind:"custom",role:B}:null}const _=m;let x;t[5]!==d?(x=ce.members(d),t[5]=d,t[6]=x):x=t[6];let C;t[7]!==x?(C={queryKey:x,queryFn:Ds},t[7]=x,t[8]=C):C=t[8];const{data:v}=Ge(C);let A;t[9]!==v?.data?.members?(A=v?.data?.members??[],t[9]=v?.data?.members,t[10]=A):A=t[10];const y=A;let S;t[11]!==y?(S=G=>y.filter(B=>B.role===G).length,t[11]=y,t[12]=S):S=t[12];const N=S;let p;if(t[13]!==g||t[14]!==N||t[15]!==e){let G;t[17]!==N?(G=ae=>({kind:"builtin",role:{...ae,memberCount:N(ae.role)}}),t[17]=N,t[18]=G):G=t[18];const B=Ns.map(G);let le;t[19]!==N?(le=ae=>({kind:"custom",role:{...ae,memberCount:N(ae.role)}}),t[19]=N,t[20]=le):le=t[20];const st=g.map(le);if(p=[...B,...st],e){const ae=e.toLowerCase();p=p.filter(nt=>nt.role.label.toLowerCase().includes(ae))}t[13]=g,t[14]=N,t[15]=e,t[16]=p}else p=t[16];const b=we({mutationFn:Gs,onSuccess:(G,B)=>{Ae("role_deleted",{role_id:B}),T.invalidateQueries({queryKey:ce.members(d)}),T.invalidateQueries({queryKey:ce.organizationRoles(d)}),pe.success("Role deleted successfully!"),r(),_?.kind==="custom"&&_.role.id===B&&a(void 0)},onError:Ms});let l,h,P,j;t[21]===Symbol.for("react.memo_cache_sentinel")?(h={id:"role",header:"Role",render:Ps,cellClassName:"flex-1 min-w-0",sortable:!0},P={id:"type",header:"Type",render:js,cellClassName:"w-28 shrink-0"},j={id:"permissions",header:"Permissions",render:vs,cellClassName:"flex-1 min-w-0"},l={id:"members",header:"Members",render:Ls,cellClassName:"w-24 shrink-0"},t[21]=l,t[22]=h,t[23]=P,t[24]=j):(l=t[21],h=t[22],P=t[23],j=t[24]);let R;t[25]===Symbol.for("react.memo_cache_sentinel")?(R=[h,P,j,l,{id:"actions",header:"",render:G=>G.kind==="builtin"?null:s.jsxs(mt,{children:[s.jsx(ut,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ys,children:s.jsx(Tt,{size:16})})}),s.jsx(gt,{align:"end",onClick:Os,children:s.jsxs(Et,{variant:"destructive",onClick:()=>{const B=G.role;B.id&&o({id:B.id,label:B.label})},children:[s.jsx(pt,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[25]=R):R=t[25];const O=R;let M;t[26]!==a?(M=G=>{if(G.kind==="builtin")a(`builtin-${G.role.role}`);else{const B=G.role;a(B.id)}},t[26]=a,t[27]=M):M=t[27];const Y=M;if(_){let G;t[28]!==a?(G=()=>a(void 0),t[28]=a,t[29]=G):G=t[29];let B;return t[30]!==r||t[31]!==a?(B=()=>{r(),a(void 0)},t[30]=r,t[31]=a,t[32]=B):B=t[32],s.jsx(Is,{target:_,onBack:G,onSaved:B},xs(_))}let z;t[33]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(te.Title,{children:"Roles"}),t[33]=z):z=t[33];let D;t[34]===Symbol.for("react.memo_cache_sentinel")?(D=G=>{G.key==="Escape"&&(n(""),G.target.blur())},t[34]=D):D=t[34];let w;t[35]!==e?(w=s.jsx(Se,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:D}),t[35]=e,t[36]=w):w=t[36];let L;t[37]!==a?(L=()=>a("new"),t[37]=a,t[38]=L):L=t[38];let V;t[39]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(Ce,{size:16}),t[39]=V):V=t[39];let $;t[40]!==L?($=s.jsxs(ne,{onClick:L,children:[V,"Create Role"]}),t[40]=L,t[41]=$):$=t[41];let Q;t[42]!==w||t[43]!==$?(Q=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[w,$]}),t[42]=w,t[43]=$,t[44]=Q):Q=t[44];let X;t[45]!==e?(X=e?s.jsx(je,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(je,{title:"No roles",description:"Create a role to get started."}),t[45]=e,t[46]=X):X=t[46];let W;t[47]!==p||t[48]!==O||t[49]!==Y||t[50]!==X?(W=s.jsx(ft,{columns:O,data:p,isLoading:!1,onRowClick:Y,emptyState:X}),t[47]=p,t[48]=O,t[49]=Y,t[50]=X,t[51]=W):W=t[51];let ie;t[52]!==Q||t[53]!==W?(ie=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[z,Q,W]})})}),t[52]=Q,t[53]=W,t[54]=ie):ie=t[54];const I=i!==null;let U;t[55]===Symbol.for("react.memo_cache_sentinel")?(U=G=>!G&&o(null),t[55]=U):U=t[55];let K;t[56]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Be,{children:"Delete Role"}),t[56]=K):K=t[56];const ee=i?.label;let Z;t[57]!==ee?(Z=s.jsxs(Ve,{children:[K,s.jsxs(ze,{children:['Are you sure you want to delete the "',ee,'" role? This action cannot be undone.']})]}),t[57]=ee,t[58]=Z):Z=t[58];let J;t[59]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Ye,{children:"Cancel"}),t[59]=J):J=t[59];let F;t[60]!==b||t[61]!==i?(F=s.jsxs($e,{children:[J,s.jsx(He,{onClick:()=>{i?.id&&b.mutate(i.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[60]=b,t[61]=i,t[62]=F):F=t[62];let de;t[63]!==Z||t[64]!==F?(de=s.jsxs(ke,{children:[Z,F]}),t[63]=Z,t[64]=F,t[65]=de):de=t[65];let me;t[66]!==I||t[67]!==de?(me=s.jsx(Ue,{open:I,onOpenChange:U,children:de}),t[66]=I,t[67]=de,t[68]=me):me=t[68];let Ie;return t[69]!==ie||t[70]!==me?(Ie=s.jsxs(te,{children:[ie,me]}),t[69]=ie,t[70]=me,t[71]=Ie):Ie=t[71],Ie}function Os(t){return t.stopPropagation()}function ys(t){return t.stopPropagation()}function Ls(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function vs(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function js(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 Ps(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:H("size-2.5 rounded-full shrink-0",Ss(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(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function Ms(t,e){Ae("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),pe.error(t instanceof Error?t.message:"Failed to delete role")}async function Gs(t){const e=await re.organization.deleteRole({roleId:t});if(e?.error)throw new Error(e.error.message);return e?.data}function Ds(){return re.organization.listMembers()}function Un(){const t=q.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(lt,{fallback:e,children:s.jsx(k.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(_e,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(bs,{})})}),t[1]=n):n=t[1],n}export{Un as default};
@@ -1,4 +0,0 @@
1
- import{r as O,J as xt,v as se,y as P,aK as ve,aI as be,a_ as je,aJ as _e,e as $,j as l,E as Le,s as ne,o as fe,a as le,K as X,n as Ke,c as ie,x as ye,w as Se,z as Y,aB as pe,t as Z,B as te,aD as $e,u as pt,f as gt,D as bt}from"./index-DhJrYN5i.js";import{C as vt}from"./checkbox-Dplb_VaM.js";import{I as oe}from"./input-COFLoOjb.js";import{d as Be,c as Ue,a as jt,D as Ve,e as yt,b as We,h as St}from"./dialog-nGTWjCEa.js";import{g as Nt,a as wt,b as _t,c as Ct}from"./drawer-DyPUsgdj.js";import{u as It}from"./use-mobile-C4Yo3nsX.js";import{a as kt,c as Et,d as Mt,S as At,b as Ot}from"./select-Cn3ZnqjJ.js";import{S as W}from"./skeleton-DOcx8lZU.js";import{i as Tt,t as Rt,b as Pt,a as zt,c as Ft}from"./Tool01-BscqkhhO.js";import{b as qe,s as He,c as Dt,a as Lt,i as Kt}from"./RefreshCcw01-BxULs6ec.js";import{t as Ce}from"./ChevronDown-Jd-cYHC-.js";import{a as Qe,i as Ge}from"./SearchMd-D6tCV38D.js";import{a as $t}from"./Settings02-MyfUtBA4.js";import{u as ae,b as Ye,a as ue}from"./use-ai-providers-DSLKay0D.js";import{p as Ie,u as Xe}from"./chat-context-DfEaB6Uj.js";import{g as Ne}from"./ai-providers-logos-CS4PCiqI.js";import{i as Bt}from"./Zap-BxJkZzJb.js";import{i as Ut}from"./AlertCircle-Bgzr6uRA.js";import{i as Vt}from"./CheckCircle-88bls7UK.js";import{s as Wt}from"./Trash01-DZpzvWVW.js";import{P as he}from"./index-DvgxnJsz.js";import{C as Je,b as qt,c as Ht,a as Qt}from"./card-DqrPrhd5.js";import{S as Gt}from"./switch-ihM2hYRH.js";import{a as ke,T as Yt}from"./toggle-group-_HWF3GFc.js";import{A as Xt}from"./avatar-DcLXZkYK.js";import{c as Ze,b as et,d as tt,A as st,e as lt,g as it,a as nt,f as ot}from"./alert-dialog-CtGXaT-Y.js";import{S as ce,u as de}from"./constants-aD7HJ6sY.js";import{e as Jt,f as Zt}from"./use-organization-settings-CMC2yyUM.js";import{f as es}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as ts}from"./unwrap-tool-result-BYXdCQMg.js";function re(t,e,s){let n=s.initialDeps??[],i,o=!0;function r(){var a,d,m;let c;s.key&&((a=s.debug)!=null&&a.call(s))&&(c=Date.now());const u=t();if(!(u.length!==n.length||u.some((v,b)=>n[b]!==v)))return i;n=u;let f;if(s.key&&((d=s.debug)!=null&&d.call(s))&&(f=Date.now()),i=e(...u),s.key&&((m=s.debug)!=null&&m.call(s))){const v=Math.round((Date.now()-c)*100)/100,b=Math.round((Date.now()-f)*100)/100,w=b/16,j=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${j(b,5)} /${j(v,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(i),o=!1,i}return r.updateDeps=a=>{n=a},r}function Ee(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const ss=(t,e)=>Math.abs(t-e)<1.01,ls=(t,e,s)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),s)}},Me=t=>{const{offsetWidth:e,offsetHeight:s}=t;return{width:e,height:s}},is=t=>t,ns=t=>{const e=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let i=e;i<=s;i++)n.push(i);return n},os=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const i=r=>{const{width:a,height:d}=r;e({width:Math.round(a),height:Math.round(d)})};if(i(Me(s)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(r=>{const a=()=>{const d=r[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(Me(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},Ae={passive:!0},Oe=typeof window>"u"?!0:"onscrollend"in window,rs=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;let i=0;const o=t.options.useScrollendEvent&&Oe?()=>{}:ls(n,()=>{e(i,!1)},t.options.isScrollingResetDelay),r=c=>()=>{const{horizontal:u,isRtl:h}=t.options;i=u?s.scrollLeft*(h&&-1||1):s.scrollTop,o(),e(i,c)},a=r(!0),d=r(!1);s.addEventListener("scroll",a,Ae);const m=t.options.useScrollendEvent&&Oe;return m&&s.addEventListener("scrollend",d,Ae),()=>{s.removeEventListener("scroll",a),m&&s.removeEventListener("scrollend",d)}},as=(t,e,s)=>{if(e?.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},cs=(t,{adjustments:e=0,behavior:s},n)=>{var i,o;const r=t+e;(o=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[n.options.horizontal?"left":"top"]:r,behavior:s})};class ds{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,n,i;return((i=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const r=()=>{const a=o.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),s=null},observe:i=>{var o;return(o=n())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=n())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,i])=>{typeof i>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:is,rangeExtractor:ns,onChange:()=>{},measureElement:as,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 n,i;(i=(n=this.options).onChange)==null||i.call(n,this,s)},this.maybeNotify=re(()=>(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 n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,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(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,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,n)=>{const i=new Map,o=new Map;for(let r=n-1;r>=0;r--){const a=s[r];if(i.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&i.set(a.lane,!0),i.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=re(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,n,i,o,r,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d}),{key:!1}),this.getMeasurements=re(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d},m)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const f of this.laneAssignments.keys())f>=s&&this.laneAssignments.delete(f);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(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,c),h=new Array(a).fill(void 0);for(let f=0;f<c;f++){const v=u[f];v&&(h[v.lane]=f)}for(let f=c;f<s;f++){const v=o(f),b=this.laneAssignments.get(f);let w,j;const x=d==="estimate"||m.has(v);if(b!==void 0&&this.options.lanes>1){w=b;const g=h[w],N=g!==void 0?u[g]:void 0;j=N?N.end+this.options.gap:n+i}else{const g=this.options.lanes===1?u[f-1]:this.getFurthestMeasurement(u,f);j=g?g.end+this.options.gap:n+i,w=g?g.lane:f%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(f,w)}const y=m.get(v),S=typeof y=="number"?y:this.options.estimateSize(f),_=j+S;u[f]={index:f,start:j,size:S,end:_,key:v,lane:w},h[w]=f}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=re(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,i,o)=>this.range=s.length>0&&n>0?ms({measurements:s,outerSize:n,scrollOffset:i,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=re(()=>{let s=null,n=null;const i=this.calculateRange();return i&&(s=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,i,o,r)=>o===null||r===null?[]:s({startIndex:o,endIndex:r,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,i=s.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,i-o),a=Math.min(this.options.count-1,i+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 n=this.indexFromElement(s),i=this.options.getItemKey(n),o=this.elementsCache.get(i);o!==s&&(o&&this.observer.unobserve(o),this.observer.observe(s),this.elementsCache.set(i,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,n)=>{var i;const o=this.measurementsCache[s];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=n-r;a!==0&&(((i=this.scrollState)==null?void 0:i.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,n)),this.notify(!1))},this.getVirtualItems=re(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const i=[];for(let o=0,r=s.length;o<r;o++){const a=s[o],d=n[a];i.push(d)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return Ee(n[rt(0,n.length-1,i=>Ee(n[i]).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,n,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=s>=r+o?"end":"start"),n==="center"?s+=(i-o)/2:n==="end"&&(s-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const i=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[s];if(!r)return;if(n==="auto")if(r.end>=o+i-this.options.scrollPaddingEnd)n="end";else if(r.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,r.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:i="auto"}={})=>{const o=this.getOffsetForAlignment(s,n),r=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:i="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,n);if(!o)return;const[r,a]=o,d=this.now();this.scrollState={index:s,align:a,behavior:i,startedAt:d,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((s=n[n.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&o.some(a=>a===null);){const a=n[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}i=Math.max(...o.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:i})=>{this.options.scrollToFn(s,{behavior:i,adjustments:n},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 n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,o=1,r=i!==this.scrollState.lastTargetOffset;if(!r&&ss(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const rt=(t,e,s,n)=>{for(;t<=e;){const i=(t+e)/2|0,o=s(i);if(o<n)t=i+1;else if(o>n)e=i-1;else return i}return t>0?t-1:0};function ms({measurements:t,outerSize:e,scrollOffset:s,lanes:n}){const i=t.length-1,o=d=>t[d].start;if(t.length<=n)return{startIndex:0,endIndex:i};let r=rt(0,i,o,s),a=r;if(n===1)for(;a<i&&t[a].end<s+e;)a++;else if(n>1){const d=Array(n).fill(0);for(;a<i&&d.some(c=>c<s+e);){const c=t[a];d[c.lane]=c.end,a++}const m=Array(n).fill(s+e);for(;r>=0&&m.some(c=>c>=s);){const c=t[r];m[c.lane]=c.start,r--}r=Math.max(0,r-r%n),a=Math.min(i,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Te=typeof document<"u"?O.useLayoutEffect:O.useEffect;function us({useFlushSync:t=!0,...e}){const s=O.useReducer(()=>({}),{})[1],n={...e,onChange:(o,r)=>{var a;t&&r?xt.flushSync(s):s(),(a=e.onChange)==null||a.call(e,o,r)}},[i]=O.useState(()=>new ds(n));return i.setOptions(n),Te(()=>i._didMount(),[]),Te(()=>i._willUpdate()),i}function hs(t){return us({observeElementRect:os,observeElementOffset:rs,scrollToFn:cs,...t})}se({title:P(),url:P(),icon:P()});se({registries:be(P(),se({enabled:je()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ve(P()).describe("List of MCP app_name or app_id values to hide from the store.")});const me=se({keyId:P(),modelId:P(),title:P().optional()}).nullable(),fs=se({enabled:je(),chat:se({fast:me,smart:me,thinking:me}),image:me,webResearch:me});se({ids:ve(P()).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:P().describe("Brand context ID"),name:P().describe("Company name"),domain:P().describe("Company domain (e.g. example.com)"),overview:P().describe("Company overview / description"),logo:P().nullable().optional().describe("Logo URL"),favicon:P().nullable().optional().describe("Favicon URL"),ogImage:P().nullable().optional().describe("OG image URL"),fonts:se({heading:P().optional().describe("Font family for headings"),body:P().optional().describe("Font family for body text"),code:P().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:P().optional().describe("Primary brand color (hex)"),secondary:P().optional().describe("Secondary brand color (hex)"),accent:P().optional().describe("Accent / highlight color (hex)"),background:P().optional().describe("Background color (hex)"),foreground:P().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ve(be(P(),_e())).nullable().optional().describe("Brand images"),metadata:be(P(),_e()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:P().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:je().optional().describe("Whether this is the default brand for the organization")});function xs(t){const e=$.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(Ut,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=l.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,l.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",s.message]})]}),e[1]=s.message,e[2]=i):i=e[2],i}function Re(t){const e=$.c(27),{keys:s,onDelete:n,isDeleting:i}=t,[o,r]=O.useState(null);let a;if(e[0]!==o||e[1]!==s){let S;e[3]!==o?(S=_=>_.id===o,e[3]=o,e[4]=S):S=e[4],a=s.find(S),e[0]=o,e[1]=s,e[2]=a}else a=e[2];const d=a;let m;if(e[5]!==i||e[6]!==s){let S;e[8]!==i?(S=_=>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(Qe,{size:14,className:"text-muted-foreground shrink-0"}),l.jsx("span",{className:"font-medium truncate",children:_.label}),l.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["added ",es(new Date(_.createdAt))," ago"]})]}),l.jsx("div",{onClick:gs,children:l.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",disabled:i,onClick:()=>r(_.id),children:l.jsx(Wt,{size:14})})})]},_.id),e[8]=i,e[9]=S):S=e[9],m=s.map(S),e[5]=i,e[6]=s,e[7]=m}else m=e[7];const c=!!o;let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=S=>!S&&r(null),e[10]=u):u=e[10];let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(Ze,{children:"Delete API Key"}),e[11]=h):h=e[11];const f=d?.label;let v;e[12]!==f?(v=l.jsxs(et,{children:[h,l.jsxs(tt,{children:["This action cannot be undone. This will permanently delete"," ",l.jsx("span",{className:"font-medium text-foreground",children:f}),"."]})]}),e[12]=f,e[13]=v):v=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx(st,{children:"Cancel"}),e[14]=b):b=e[14];let w;e[15]!==o||e[16]!==n?(w=l.jsxs(lt,{children:[b,l.jsx(it,{onClick:()=>{o&&(n(o),r(null))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[15]=o,e[16]=n,e[17]=w):w=e[17];let j;e[18]!==v||e[19]!==w?(j=l.jsxs(nt,{onClick:ps,children:[v,w]}),e[18]=v,e[19]=w,e[20]=j):j=e[20];let x;e[21]!==j||e[22]!==c?(x=l.jsx(ot,{open:c,onOpenChange:u,children:j}),e[21]=j,e[22]=c,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==m?(y=l.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[m,x]}),e[24]=x,e[25]=m,e[26]=y):y=e[26],y}function ps(t){return t.stopPropagation()}function gs(t){return t.stopPropagation()}const bs=se({label:P().optional(),apiKey:P().min(1,"API key is required")});function vs(t){const e=$.c(61),{providerId:s,onCancel:n,onSuccess:i}=t,{org:o}=ne();let r;e[0]!==o.id?(r={connectionId:ce,orgId:o.id},e[0]=o.id,e[1]=r):r=e[1];const a=de(r),d=fe(),[m,c]=O.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u={resolver:Se(bs),defaultValues:{label:"",apiKey:""}},e[2]=u):u=e[2];const{register:h,handleSubmit:f,formState:v}=ye(u),{errors:b}=v;let w;e[3]!==a||e[4]!==s?(w=async q=>{await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:s,label:q.label||"Personal key",apiKey:q.apiKey}})},e[3]=a,e[4]=s,e[5]=w):w=e[5];let j;e[6]!==i||e[7]!==o.id||e[8]!==d?(j=()=>{d.invalidateQueries({queryKey:X.aiProviderKeys(o.id)}),d.invalidateQueries({queryKey:X.aiProviders(o.id)}),Y.success("Key saved successfully"),i()},e[6]=i,e[7]=o.id,e[8]=d,e[9]=j):j=e[9];let x;e[10]!==w||e[11]!==j?(x={mutationFn:w,onSuccess:j,onError:js},e[10]=w,e[11]=j,e[12]=x):x=e[12];const{mutate:y,isPending:S,error:_}=le(x);let g;e[13]!==y?(g=q=>y(q),e[13]=y,e[14]=g):g=e[14];let N;e[15]!==f||e[16]!==g?(N=f(g),e[15]=f,e[16]=g,e[17]=N):N=e[17];let I;e[18]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[18]=I):I=e[18];let p;e[19]!==h?(p=h("label"),e[19]=h,e[20]=p):p=e[20];let C;e[21]!==p?(C=l.jsxs("div",{className:"space-y-1",children:[I,l.jsx(oe,{placeholder:"e.g. Personal key",...p,className:"h-8 text-sm"})]}),e[21]=p,e[22]=C):C=e[22];let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[23]=E):E=e[23];const k=m?"text":"password";let A;e[24]!==h?(A=h("apiKey"),e[24]=h,e[25]=A):A=e[25];let M;e[26]!==k||e[27]!==A?(M=l.jsx(oe,{type:k,placeholder:"sk-...",...A,className:"ph-no-capture h-8 text-sm pr-8"}),e[26]=k,e[27]=A,e[28]=M):M=e[28];let T;e[29]!==m?(T=()=>c(!m),e[29]=m,e[30]=T):T=e[30];let F;e[31]!==m?(F=m?l.jsx(qe,{size:14}):l.jsx(He,{size:14}),e[31]=m,e[32]=F):F=e[32];let R;e[33]!==T||e[34]!==F?(R=l.jsx("button",{type:"button",onClick:T,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:F}),e[33]=T,e[34]=F,e[35]=R):R=e[35];let D;e[36]!==M||e[37]!==R?(D=l.jsxs("div",{className:"relative",children:[M,R]}),e[36]=M,e[37]=R,e[38]=D):D=e[38];let B;e[39]!==b.apiKey?(B=b.apiKey&&l.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[39]=b.apiKey,e[40]=B):B=e[40];let Q;e[41]!==D||e[42]!==B?(Q=l.jsxs("div",{className:"space-y-1",children:[E,D,B]}),e[41]=D,e[42]=B,e[43]=Q):Q=e[43];let U;e[44]!==_?(U=_&&l.jsx("p",{className:"text-xs text-destructive",children:_.message}),e[44]=_,e[45]=U):U=e[45];let L;e[46]!==S||e[47]!==n?(L=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:S,children:"Cancel"}),e[46]=S,e[47]=n,e[48]=L):L=e[48];const V=S?"Saving...":"Save Key";let K;e[49]!==S||e[50]!==V?(K=l.jsx(te,{type:"submit",size:"sm",disabled:S,children:V}),e[49]=S,e[50]=V,e[51]=K):K=e[51];let H;e[52]!==L||e[53]!==K?(H=l.jsxs(We,{children:[L,K]}),e[52]=L,e[53]=K,e[54]=H):H=e[54];let G;return e[55]!==C||e[56]!==Q||e[57]!==U||e[58]!==H||e[59]!==N?(G=l.jsxs("form",{onSubmit:N,className:"space-y-3",children:[C,Q,U,H]}),e[55]=C,e[56]=Q,e[57]=U,e[58]=H,e[59]=N,e[60]=G):G=e[60],G}function js(t){Y.error(`Failed to save key: ${t.message}`)}const ys=se({label:P().optional(),baseUrl:P().min(1,"Base URL is required"),apiKey:P().optional()});function Ss(t){const e=$.c(66),{onCancel:s,onSuccess:n}=t,{org:i}=ne();let o;e[0]!==i.id?(o={connectionId:ce,orgId:i.id},e[0]=i.id,e[1]=o):o=e[1];const r=de(o),a=fe(),[d,m]=O.useState(!1);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={resolver:Se(ys),defaultValues:{label:"",baseUrl:"",apiKey:""}},e[2]=c):c=e[2];const{register:u,handleSubmit:h,formState:f}=ye(c),{errors:v}=f;let b;e[3]!==r?(b=async z=>{const J=JSON.stringify({baseUrl:z.baseUrl,apiKey:z.apiKey||""});await r.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:"openai-compatible",label:z.label||z.baseUrl,apiKey:J}})},e[3]=r,e[4]=b):b=e[4];let w;e[5]!==n||e[6]!==i.id||e[7]!==a?(w=()=>{a.invalidateQueries({queryKey:X.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:X.aiProviders(i.id)}),Y.success("Connection saved successfully"),n()},e[5]=n,e[6]=i.id,e[7]=a,e[8]=w):w=e[8];let j;e[9]!==b||e[10]!==w?(j={mutationFn:b,onSuccess:w,onError:Ns},e[9]=b,e[10]=w,e[11]=j):j=e[11];const{mutate:x,isPending:y,error:S}=le(j);let _;e[12]!==x?(_=z=>x(z),e[12]=x,e[13]=_):_=e[13];let g;e[14]!==h||e[15]!==_?(g=h(_),e[14]=h,e[15]=_,e[16]=g):g=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[17]=N):N=e[17];let I;e[18]!==u?(I=u("label"),e[18]=u,e[19]=I):I=e[19];let p;e[20]!==I?(p=l.jsxs("div",{className:"space-y-1",children:[N,l.jsx(oe,{placeholder:"e.g. LiteLLM, Ollama",...I,className:"h-8 text-sm"})]}),e[20]=I,e[21]=p):p=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),e[22]=C):C=e[22];let E;e[23]!==u?(E=u("baseUrl"),e[23]=u,e[24]=E):E=e[24];let k;e[25]!==E?(k=l.jsx(oe,{type:"url",placeholder:"http://localhost:4000/v1",...E,className:"h-8 text-sm"}),e[25]=E,e[26]=k):k=e[26];let A;e[27]!==v.baseUrl?(A=v.baseUrl&&l.jsx("p",{className:"text-xs text-destructive",children:v.baseUrl.message}),e[27]=v.baseUrl,e[28]=A):A=e[28];let M;e[29]!==k||e[30]!==A?(M=l.jsxs("div",{className:"space-y-1",children:[C,k,A]}),e[29]=k,e[30]=A,e[31]=M):M=e[31];let T;e[32]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key ",l.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),e[32]=T):T=e[32];const F=d?"text":"password";let R;e[33]!==u?(R=u("apiKey"),e[33]=u,e[34]=R):R=e[34];let D;e[35]!==F||e[36]!==R?(D=l.jsx(oe,{type:F,placeholder:"sk-...",...R,className:"ph-no-capture h-8 text-sm pr-8"}),e[35]=F,e[36]=R,e[37]=D):D=e[37];let B;e[38]!==d?(B=()=>m(!d),e[38]=d,e[39]=B):B=e[39];let Q;e[40]!==d?(Q=d?l.jsx(qe,{size:14}):l.jsx(He,{size:14}),e[40]=d,e[41]=Q):Q=e[41];let U;e[42]!==B||e[43]!==Q?(U=l.jsx("button",{type:"button",onClick:B,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Q}),e[42]=B,e[43]=Q,e[44]=U):U=e[44];let L;e[45]!==D||e[46]!==U?(L=l.jsxs("div",{className:"space-y-1",children:[T,l.jsxs("div",{className:"relative",children:[D,U]})]}),e[45]=D,e[46]=U,e[47]=L):L=e[47];let V;e[48]!==S?(V=S&&l.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[48]=S,e[49]=V):V=e[49];let K;e[50]!==y||e[51]!==s?(K=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:y,children:"Cancel"}),e[50]=y,e[51]=s,e[52]=K):K=e[52];const H=y?"Saving...":"Save Connection";let G;e[53]!==y||e[54]!==H?(G=l.jsx(te,{type:"submit",size:"sm",disabled:y,children:H}),e[53]=y,e[54]=H,e[55]=G):G=e[55];let q;e[56]!==K||e[57]!==G?(q=l.jsxs(We,{children:[K,G]}),e[56]=K,e[57]=G,e[58]=q):q=e[58];let ee;return e[59]!==p||e[60]!==M||e[61]!==L||e[62]!==V||e[63]!==q||e[64]!==g?(ee=l.jsxs("form",{onSubmit:g,className:"space-y-3",children:[p,M,L,V,q]}),e[59]=p,e[60]=M,e[61]=L,e[62]=V,e[63]=q,e[64]=g,e[65]=ee):ee=e[65],ee}function Ns(t){Y.error(`Failed to save connection: ${t.message}`)}function Pe({provider:t,keys:e}){const{org:s}=ne(),n=de({connectionId:ce,orgId:s.id}),i=fe(),[o,r]=O.useState(!1),[a,d]=O.useState(!1),[m,c]=O.useState(null),u=t.supportedMethods.includes("cli-activate"),h=e.length>0,{mutate:f,isPending:v}=le({mutationFn:async p=>(await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:p}}),p),onSuccess:p=>{i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),i.invalidateQueries({queryKey:X.aiProviderModels(s.id,p)}),Y.success("Key deleted")},onError:p=>{Y.error(`Failed to delete key: ${p.message}`)}}),{mutate:b}=le({mutationFn:async({code:p,stateToken:C})=>{const E=await n.callTool({name:"AI_PROVIDER_OAUTH_EXCHANGE",arguments:{providerId:t.id,code:p,stateToken:C,label:"Connected via OAuth"}});if(E?.isError){const k=E.content?.[0]?.text??"OAuth exchange failed";throw new Error(k)}},onSuccess:()=>{Z("ai_provider_oauth_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`),d(!1),c(null)},onError:p=>{Z("ai_provider_oauth_failed",{provider_id:t.id,error:p.message}),Y.error(`OAuth connection failed: ${p.message}`),d(!1),c(null)}}),{mutate:w,isPending:j}=le({mutationFn:async()=>{const p=await n.callTool({name:"AI_PROVIDER_CLI_ACTIVATE",arguments:{providerId:t.id}});if(p?.isError)throw new Error(p.content?.[0]?.text??"CLI activation failed");return p.structuredContent},onSuccess:p=>{if(!p?.activated){Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:p?.error??"unknown"}),Y.error(p?.error??"CLI activation failed");return}Z("ai_provider_cli_activated",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} activated`)},onError:p=>{Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:p.message}),Y.error(p.message)}}),{mutate:x,isPending:y}=le({mutationFn:async()=>{const p=await n.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:t.id}});if(p?.isError){const C=p.content?.[0]?.text??"Key provisioning failed";throw new Error(C)}},onSuccess:()=>{Z("ai_provider_provision_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`)},onError:p=>{Z("ai_provider_provision_failed",{provider_id:t.id,error:p.message}),Y.error(`Failed to connect ${t.name}: ${p.message}`)}});O.useEffect(()=>{if(!a||!m)return;let p=!1;const C=k=>{if(k.origin===window.location.origin&&k.data?.type==="AI_PROVIDER_OAUTH_CALLBACK"){const{code:A,stateToken:M}=k.data;M===m?(p=!0,b({code:A,stateToken:M})):(console.error("State token mismatch"),Y.error("Security check failed: State token mismatch"),d(!1),c(null))}};window.addEventListener("message",C);const E=setTimeout(()=>{p||(Z("ai_provider_oauth_timeout",{provider_id:t.id}),d(!1),c(null),Y.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",C),clearTimeout(E)}},[a,m,b,t.id]);const S=!!t.supportsProvision,_=t.supportedMethods.includes("oauth-pkce"),g=t.supportedMethods.includes("api-key"),N=()=>{if(!(o||a||j||y)){if(u){h||(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"cli-activate"}),w());return}S?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"provision"}),x()):_?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"oauth-pkce"}),I()):g&&(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"api-key"}),r(!0))}},I=async()=>{try{d(!0);const p=await n.callTool({name:"AI_PROVIDER_OAUTH_URL",arguments:{providerId:t.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`}});if(p.structuredContent)c(p.structuredContent.stateToken),window.open(p.structuredContent.url,"AiProviderOAuth","width=600,height=700");else throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL")}catch(p){d(!1),Y.error(`Failed to start OAuth: ${p instanceof Error?p.message:String(p)}`)}};return l.jsxs(l.Fragment,{children:[l.jsxs(Je,{className:ie("p-4 flex flex-col gap-3 transition-colors relative",h&&"border-primary/20",!a&&!j&&!y&&"cursor-pointer hover:bg-muted/30",(a||j||y)&&"cursor-wait"),onClick:N,children:[h&&l.jsx("div",{className:"absolute top-4 right-4 w-2 h-2 rounded-full bg-green-500"}),l.jsx("div",{className:"flex items-start justify-between",children:l.jsxs("div",{className:"flex items-center gap-3",children:[t.logo?l.jsx("img",{src:t.logo,alt:t.name,className:"size-8 rounded-md object-contain dark:bg-white dark:rounded-md dark:p-0.5"}):l.jsx(Xt,{fallback:t.name.charAt(0),className:"size-8 bg-primary/10 text-primary"}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-medium text-base",children:t.name}),l.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:j?"Checking CLI...":y?"Connecting...":a?"Authorizing...":t.description})]})]})}),h&&l.jsx("div",{className:"mt-1",children:u?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Authenticated via ",t.name," CLI"]}),l.jsx(Re,{keys:e,onDelete:f,isDeleting:v})]}):l.jsxs(l.Fragment,{children:[!t.supportsCredits&&l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured"]})}),t.supportsCredits&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured · Managed above"]}),l.jsx(Re,{keys:e,onDelete:f,isDeleting:v})]})})]}),l.jsx(Be,{open:o,onOpenChange:p=>{p||r(!1)},children:l.jsxs(Ue,{children:[l.jsxs(jt,{children:[l.jsxs(Ve,{children:["Connect ",t.name]}),l.jsx(yt,{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(Ss,{onCancel:()=>r(!1),onSuccess:()=>r(!1)}):l.jsx(vs,{providerId:t.id,onCancel:()=>r(!1),onSuccess:()=>r(!1)})]})})]})}function at(t){const e=$.c(20);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{hideProviderId:n}=s,i=Ye(),o=ae();let r,a,d,m;if(e[2]!==i?.providers||e[3]!==o||e[4]!==n){let h;e[9]!==n?(h=j=>j.id!==n,e[9]=n,e[10]=h):h=e[10];const f=(i?.providers??[]).filter(h),v=f.filter(_s),b=f.filter(ws);d="flex flex-col gap-5 w-full",m=v.length>0&&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("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3 relative",children:v.map(j=>l.jsx(Pe,{provider:j,keys:o.filter(x=>x.providerId===j.id)},j.id))})]}),r="grid grid-cols-1 lg:grid-cols-2 gap-4";let w;e[11]!==o?(w=j=>l.jsx(Pe,{provider:j,keys:o.filter(x=>x.providerId===j.id)},j.id),e[11]=o,e[12]=w):w=e[12],a=b.map(w),e[2]=i?.providers,e[3]=o,e[4]=n,e[5]=r,e[6]=a,e[7]=d,e[8]=m}else r=e[5],a=e[6],d=e[7],m=e[8];let c;e[13]!==r||e[14]!==a?(c=l.jsx("div",{className:r,children:a}),e[13]=r,e[14]=a,e[15]=c):c=e[15];let u;return e[16]!==d||e[17]!==m||e[18]!==c?(u=l.jsxs("div",{className:d,children:[m,c]}),e[16]=d,e[17]=m,e[18]=c,e[19]=u):u=e[19],u}function ws(t){return!t.supportedMethods.includes("cli-activate")}function _s(t){return t.supportedMethods.includes("cli-activate")}const Cs={usd:[10,20,100],brl:[50,100,500]};function Is(){const t=$.c(28),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),[i,o]=O.useState(!1),{mutate:r,isPending:a}=le({mutationFn:async N=>{const I=await n.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:N,currency:h}});if(I?.isError)throw new Error(I.content?.[0]?.text??"Failed to get top-up URL");return I.structuredContent?.url},onSuccess:Es,onError:ks}),[d,m]=O.useState(""),[c,u]=O.useState("usd"),h=c,f=parseFloat(d),v=!isNaN(f)&&f>=1,b=h==="brl"?"R$":"$";let w;t[2]!==u?(w=N=>{N&&u(N)},t[2]=u,t[3]=w):w=t[3];let j,x;t[4]===Symbol.for("react.memo_cache_sentinel")?(j=l.jsx(ke,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),x=l.jsx(ke,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),t[4]=j,t[5]=x):(j=t[4],x=t[5]);let y;t[6]!==h||t[7]!==w?(y=l.jsxs(Yt,{type:"single",variant:"outline",size:"default",value:h,onValueChange:w,children:[j,x]}),t[6]=h,t[7]=w,t[8]=y):y=t[8];let S;t[9]!==h||t[10]!==b||t[11]!==i||t[12]!==a||t[13]!==r?(S=!i&&l.jsxs(l.Fragment,{children:[Cs[h].map(N=>l.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:a,onClick:()=>r(N*100),children:[b,N]},N)),l.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>o(!0),disabled:a,children:"Custom"})]}),t[9]=h,t[10]=b,t[11]=i,t[12]=a,t[13]=r,t[14]=S):S=t[14];let _;t[15]!==b||t[16]!==d||t[17]!==f||t[18]!==i||t[19]!==v||t[20]!==a||t[21]!==m||t[22]!==r?(_=i&&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(oe,{type:"number",min:"1",step:"1",placeholder:"50",value:d,onChange:N=>m(N.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),l.jsx(te,{className:"h-10",disabled:!v||a,onClick:()=>r(Math.round(f*100)),children:a?"...":"Add"}),l.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{o(!1),m("")},children:"Cancel"})]}),t[15]=b,t[16]=d,t[17]=f,t[18]=i,t[19]=v,t[20]=a,t[21]=m,t[22]=r,t[23]=_):_=t[23];let g;return t[24]!==y||t[25]!==S||t[26]!==_?(g=l.jsx("div",{className:"flex flex-col gap-2.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y,S,_]})}),t[24]=y,t[25]=S,t[26]=_,t[27]=g):g=t[27],g}function ks(t){Y.error(`Top-up failed: ${t.message}`)}function Es(t){t&&window.open(t,"_blank","noopener,noreferrer")}function Ms(t){return t<=0?"text-destructive":t<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function As(){const t=$.c(59),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),i=fe(),o=ae();let r;t[2]!==o?(r=o.find(Ts),t[2]=o,t[3]=r):r=t[3];const a=r,[d,m]=O.useState(!1);let c;t[4]!==n||t[5]!==a?(c=async()=>{a&&await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:a.id}})},t[4]=n,t[5]=a,t[6]=c):c=t[6];let u;t[7]!==e.id||t[8]!==i?(u=()=>{i.invalidateQueries({queryKey:X.aiProviderKeys(e.id)}),i.invalidateQueries({queryKey:X.aiProviders(e.id)}),Y.success("Deco AI Gateway disconnected"),m(!1)},t[7]=e.id,t[8]=i,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h={mutationFn:c,onSuccess:u,onError:Os},t[10]=c,t[11]=u,t[12]=h):h=t[12];const{mutate:f,isPending:v}=le(h);let b;t[13]!==e.id?(b=X.aiProviderCredits(e.id,"deco"),t[13]=e.id,t[14]=b):b=t[14];const w=!!a;let j;t[15]!==n?(j=async()=>{const ee=await n.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return ee?.isError?null:ee.structuredContent??null},t[15]=n,t[16]=j):j=t[16];let x;t[17]!==b||t[18]!==w||t[19]!==j?(x={queryKey:b,enabled:w,staleTime:6e4,queryFn:j},t[17]=b,t[18]=w,t[19]=j,t[20]=x):x=t[20];const{data:y,isLoading:S,refetch:_,isFetching:g}=Ke(x);if(!a)return null;const N=y?.balanceCents!=null?y.balanceCents/100:null;let I;t[21]!==N?(I=N!=null?`$${N.toFixed(2)}`:"—",t[21]=N,t[22]=I):I=t[22];const p=I;let C;t[23]===Symbol.for("react.memo_cache_sentinel")?(C=ie("relative rounded-xl overflow-hidden","border border-border","bg-gradient-to-br from-background via-muted/30 to-background"),t[23]=C):C=t[23];let E;t[24]===Symbol.for("react.memo_cache_sentinel")?(E=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.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Deco AI Gateway"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})]})]}),t[24]=E):E=t[24];let k;t[25]===Symbol.for("react.memo_cache_sentinel")?(k=()=>m(!0),t[25]=k):k=t[25];let A;t[26]!==v?(A=l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[E,l.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:k,disabled:v,children:"Disconnect"})]}),t[26]=v,t[27]=A):A=t[27];let M;t[28]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsxs(et,{children:[l.jsx(Ze,{children:"Disconnect Deco AI Gateway"}),l.jsx(tt,{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]=M):M=t[28];let T;t[29]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx(st,{children:"Cancel"}),t[29]=T):T=t[29];let F;t[30]!==f?(F=l.jsxs(nt,{children:[M,l.jsxs(lt,{children:[T,l.jsx(it,{onClick:()=>f(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),t[30]=f,t[31]=F):F=t[31];let R;t[32]!==d||t[33]!==F?(R=l.jsx(ot,{open:d,onOpenChange:m,children:F}),t[32]=d,t[33]=F,t[34]=R):R=t[34];let D;t[35]!==N||t[36]!==p||t[37]!==g||t[38]!==S?(D=S||g?l.jsx(W,{className:"h-9 w-24"}):l.jsx("span",{className:ie("text-3xl font-semibold tabular-nums tracking-tight",N!=null&&Ms(N)),children:p}),t[35]=N,t[36]=p,t[37]=g,t[38]=S,t[39]=D):D=t[39];let B;t[40]!==_?(B=()=>_(),t[40]=_,t[41]=B):B=t[41];const Q=g&&"animate-spin";let U;t[42]!==Q?(U=ie(Q),t[42]=Q,t[43]=U):U=t[43];let L;t[44]!==U?(L=l.jsx($e,{size:14,className:U}),t[44]=U,t[45]=L):L=t[45];let V;t[46]!==g||t[47]!==B||t[48]!==L?(V=l.jsx("button",{type:"button",onClick:B,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:L}),t[46]=g,t[47]=B,t[48]=L,t[49]=V):V=t[49];let K;t[50]!==D||t[51]!==V?(K=l.jsxs("div",{className:"flex items-baseline gap-2",children:[D,V]}),t[50]=D,t[51]=V,t[52]=K):K=t[52];let H;t[53]===Symbol.for("react.memo_cache_sentinel")?(H=l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Available credit balance"}),t[53]=H):H=t[53];let G;t[54]===Symbol.for("react.memo_cache_sentinel")?(G=l.jsxs("div",{className:"mt-5 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(Is,{})]}),t[54]=G):G=t[54];let q;return t[55]!==A||t[56]!==R||t[57]!==K?(q=l.jsx("div",{className:C,children:l.jsxs("div",{className:"relative p-6",children:[A,R,K,H,G]})}),t[55]=A,t[56]=R,t[57]=K,t[58]=q):q=t[58],q}function Os(t){Y.error(`Failed to disconnect: ${t.message}`)}function Ts(t){return t.providerId==="deco"}const Rs=t=>t.capabilities?.includes("image")===!0,Ps=t=>{const e=t.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("sonar")||e.includes("deepresearch")},zs={fast:"Fast",smart:"Smart",thinking:"Thinking"},Fs={fast:"Fastest responses, best for quick tasks",smart:"Balanced speed and capability",thinking:"Most capable, best for complex tasks"};function ge(t){const e=$.c(30),{label:s,description:n,slot:i,onSlotChange:o,filterModels:r,defaultKeyId:a}=t,d=ae(),[m,c]=O.useState(i?.keyId??a);let u;e[0]!==i?(u=()=>{i?.keyId&&c(i.keyId)},e[0]=i,e[1]=u):u=e[1];const h=i?.keyId;let f;e[2]!==h?(f=[h],e[2]=h,e[3]=f):f=e[3],O.useEffect(u,f);const v=m??a;let b;e[4]!==v||e[5]!==d?(b=v?d.find(k=>k.id===v):null,e[4]=v,e[5]=d,e[6]=b):b=e[6];const w=b,{models:j,isLoading:x}=ue(r?v??void 0:void 0);let y;e[7]!==j||e[8]!==r||e[9]!==x?(y=r?x||j.some(r):!0,e[7]=j,e[8]=r,e[9]=x,e[10]=y):y=e[10];const S=y;let _;e[11]!==i||e[12]!==w?.providerId?(_=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:w?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[11]=i,e[12]=w?.providerId,e[13]=_):_=e[13];const g=_;let N;e[14]!==s?(N=l.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[14]=s,e[15]=N):N=e[15];let I;e[16]!==n?(I=n&&l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:n}),e[16]=n,e[17]=I):I=e[17];let p;e[18]!==N||e[19]!==I?(p=l.jsxs("div",{className:"min-w-0 flex-1",children:[N,I]}),e[18]=N,e[19]=I,e[20]=p):p=e[20];let C;e[21]!==v||e[22]!==r||e[23]!==S||e[24]!==o||e[25]!==g?(C=l.jsx("div",{className:"shrink-0",children:r&&!S?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}):l.jsx(_l,{variant:"bordered",placeholder:"Pick model",model:g,credentialId:v,filterModels:r,onCredentialChange:k=>c(k),onModelChange:k=>{const A=k.keyId??v??"";c(A),o({keyId:A,modelId:k.modelId,title:k.title})}})}),e[21]=v,e[22]=r,e[23]=S,e[24]=o,e[25]=g,e[26]=C):C=e[26];let E;return e[27]!==C||e[28]!==p?(E=l.jsxs("div",{className:"flex items-center justify-between gap-4 py-2",children:[p,C]}),e[27]=C,e[28]=p,e[29]=E):E=e[29],E}function Ds(t){const e=$.c(2),{isPending:s,showSaved:n}=t;if(s){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx($e,{size:12,className:"animate-spin"}),"Saving…"]}),e[0]=i):i=e[0],i}if(n){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Vt,{size:12}),"Saved"]}),e[1]=i):i=e[1],i}return null}function Ls(){const t=ae(),e=Jt(),s=t.length>0,n=ye({resolver:Se(fs),values:e,mode:"onChange"}),{mutate:i,isPending:o,isSuccess:r}=Zt(),a=n.watch(),d=n.formState.isDirty;O.useEffect(()=>{if(!d)return;const x=setTimeout(()=>{i(a,{onSuccess:()=>n.reset(a,{keepValues:!0}),onError:y=>{n.reset(e),Y.error(`Failed to save: ${y.message}`)}})},250);return()=>clearTimeout(x)},[a,d,i,n,e]);const m=t[0],c=t[1],u=t[2],{models:h}=ue(m?.id),{models:f}=ue(c?.id),{models:v}=ue(u?.id),b=x=>{const y=n.getValues("chat");if(x&&!y.fast&&!y.smart&&!y.thinking){const S={};m?.id&&(S[m.id]=h),c?.id&&(S[c.id]=f),u?.id&&(S[u.id]=v);const _=Ie(t,S);n.reset({enabled:!0,chat:_.chat,image:_.image,webResearch:_.webResearch},{keepDirty:!0})}else n.setValue("enabled",x,{shouldDirty:!0})};O.useEffect(()=>{s||n.reset({enabled:!1,chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null})},[s,n]),O.useEffect(()=>{const x=n.getValues();if(!x.enabled)return;const y=new Set(t.map(k=>k.id)),S={};m?.id&&(S[m.id]=h),c?.id&&(S[c.id]=f),u?.id&&(S[u.id]=v);const _=k=>k!=null&&!y.has(k.keyId),g={fast:_(x.chat.fast)?null:x.chat.fast,smart:_(x.chat.smart)?null:x.chat.smart,thinking:_(x.chat.thinking)?null:x.chat.thinking},N=_(x.image)?null:x.image,I=_(x.webResearch)?null:x.webResearch,p=!g.fast||!g.smart||!g.thinking||!N||!I,C=g.fast===x.chat.fast&&g.smart===x.chat.smart&&g.thinking===x.chat.thinking;if(!p&&C)return;const E=Ie(t,S);n.reset({...x,chat:{fast:g.fast??E.chat.fast,smart:g.smart??E.chat.smart,thinking:g.thinking??E.chat.thinking},image:N??E.image,webResearch:I??E.webResearch},{keepDirty:!0})},[n,t,h,f,v,m?.id,c?.id,u?.id]);const j=n.watch("enabled")&&s;return l.jsxs(Je,{className:"p-6",children:[l.jsx(qt,{className:"p-0",children:l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ht,{className:"text-sm",children:"Simple model mode"}),l.jsx(Ds,{isPending:o,showSaved:r&&!d})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children: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."})]}),l.jsx(Gt,{checked:j,onCheckedChange:b,disabled:o||!s})]})}),j&&l.jsxs(Qt,{className:"flex flex-col p-0 mt-6",children:[l.jsxs("div",{className:"flex flex-col gap-1 pb-6",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Chat models"}),["fast","smart","thinking"].map(x=>l.jsx(pe,{control:n.control,name:`chat.${x}`,render:({field:y})=>l.jsx(ge,{label:zs[x],description:Fs[x],slot:y.value,defaultKeyId:t[0]?.id??null,onSlotChange:S=>y.onChange(S)})},x))]}),l.jsxs("div",{className:"flex flex-col gap-1 pt-6 border-t border-border/50",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Other models"}),l.jsx(pe,{control:n.control,name:"image",render:({field:x})=>l.jsx(ge,{label:"Image",slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Rs,onSlotChange:y=>x.onChange(y)})}),l.jsx(pe,{control:n.control,name:"webResearch",render:({field:x})=>l.jsx(ge,{label:"Web research",slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Ps,onSlotChange:y=>x.onChange(y)})})]})]})]})}function Ks(){const t=$.c(6),s=ae().some($s);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(As,{}),t[0]=n):n=t[0];const i=s?"deco":void 0;let o;t[1]!==i?(o=l.jsx(at,{hideProviderId:i}),t[1]=i,t[2]=o):o=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx(O.Suspense,{fallback:l.jsx(W,{className:"h-16 w-full"}),children:l.jsx(Ls,{})}),t[3]=r):r=t[3];let a;return t[4]!==o?(a=l.jsxs("div",{className:"flex flex-col gap-6",children:[n,o,r]}),t[4]=o,t[5]=a):a=t[5],a}function $s(t){return t.providerId==="deco"}function ii(){const t=$.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(he.Title,{children:"AI Providers"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(he,{children:l.jsx(he.Content,{children:l.jsx(he.Body,{children:l.jsxs("div",{className:"flex flex-col gap-6",children:[e,l.jsx(Le,{fallback:Bs,children:l.jsx(O.Suspense,{fallback:l.jsx(W,{className:"h-64 w-full"}),children:l.jsx(Ks,{})})})]})})})}),t[1]=s):s=t[1],s}function Bs(t){const{error:e}=t;return l.jsx(xs,{error:e??new Error("Failed to load AI providers")})}function Us(){const t=$.c(9),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s);let i;t[2]!==e.id?(i=X.defaultBrand(e.id),t[2]=e.id,t[3]=i):i=t[3];let o;t[4]!==n?(o=async()=>{const d=await n.callTool({name:"BRAND_CONTEXT_LIST",arguments:{}}),m=ts(d);return(Array.isArray(m?.items)?m.items:[]).find(Vs)??null},t[4]=n,t[5]=o):o=t[5];let r;t[6]!==i||t[7]!==o?(r={queryKey:i,queryFn:o},t[6]=i,t[7]=o,t[8]=r):r=t[8];const{data:a}=Ke(r);return a??null}function Vs(t){return t.isDefault&&!t.archivedAt}function Ws(t){const e=t.colors;if(!e)return null;if(Array.isArray(e)){const s=e.find(i=>typeof i=="object"&&i!==null&&"label"in i&&/primary|brand|main/i.test(i.label)),n=s?s.value:e[0]?.value;return typeof n=="string"?n:null}if(typeof e=="object"){const s=e;return s.primary??Object.values(s)[0]??null}return null}function qs(t){const e=$.c(31);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{title:n,description:i}=s,{org:o}=ne(),{localMode:r}=pt(),a=Us(),d=o.name;let m;e[2]!==a?(m=a?Ws(a):null,e[2]=a,e[3]=m):m=e[3];const c=m,u=a?.favicon??a?.logo??null,h=n??(d?`${d} is ready for agents`:"Your agents are almost ready"),f=i??"Choose how to power your AI team.",v=!!(u||c);let b;e[4]!==c?(b=c?{backgroundColor:`${c}18`,borderColor:`${c}30`}:void 0,e[4]=c,e[5]=b):b=e[5];const w=b,j=v?"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 x;e[6]!==u||e[7]!==c?(x=u?l.jsx("img",{src:u,alt:"",className:"size-7 rounded object-contain"}):l.jsx(Bt,{size:24,style:c?{color:c}:void 0,className:ie(!c&&"text-lime-600 dark:text-lime-400")}),e[6]=u,e[7]=c,e[8]=x):x=e[8];let y;e[9]!==j||e[10]!==w||e[11]!==x?(y=l.jsx("div",{className:j,style:w,children:x}),e[9]=j,e[10]=w,e[11]=x,e[12]=y):y=e[12];let S;e[13]!==h?(S=l.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:h}),e[13]=h,e[14]=S):S=e[14];let _;e[15]!==f?(_=l.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:f}),e[15]=f,e[16]=_):_=e[16];let g;e[17]!==S||e[18]!==_?(g=l.jsxs("div",{className:"space-y-2",children:[S,_]}),e[17]=S,e[18]=_,e[19]=g):g=e[19];let N;e[20]!==y||e[21]!==g?(N=l.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[y,g]}),e[20]=y,e[21]=g,e[22]=N):N=e[22];let I;e[23]!==r?(I=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]=I):I=e[24];let p;e[25]===Symbol.for("react.memo_cache_sentinel")?(p=l.jsx(O.Suspense,{fallback:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full",children:[l.jsx(W,{className:"h-32 w-full rounded-lg"}),l.jsx(W,{className:"h-32 w-full rounded-lg"})]}),children:l.jsx(at,{})}),e[25]=p):p=e[25];let C;e[26]!==I?(C=l.jsxs("div",{className:"w-full space-y-3",children:[I,p]}),e[26]=I,e[27]=C):C=e[27];let E;return e[28]!==C||e[29]!==N?(E=l.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-2xl px-4",children:[N,C]}),e[28]=C,e[29]=N,e[30]=E):E=e[30],E}function we(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 ct=["smarter","faster","cheaper"],dt={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Hs=[{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"]}],Qs=Hs.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),Gs=new Set(["google/gemini-2.5-pro"]),ze=new Map;function Ys(t){const e=ze.get(t);if(e!==void 0)return e;let s=null;if(t.endsWith(":free"))s="cheaper";else e:for(const{tier:n,prefix:i}of Qs)if(t.startsWith(i)){if(Gs.has(i)&&t.length>i.length&&t[i.length]==="-"){const r=t[i.length+1];if(!r||!/\d/.test(r))continue e}s=n;break}return ze.set(t,s),s}function Fe(t){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const s of t){const n=Ys(s.modelId);e[n??"other"].push(s)}for(const s of Object.keys(e))e[s].sort((n,i)=>n.title.localeCompare(i.title));return e}const mt="mesh:model-shortlist:",Xs=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 Js(t){try{const e=localStorage.getItem(mt+t);return e?new Set(JSON.parse(e)):null}catch{return null}}function Zs(t,e){localStorage.setItem(mt+t,JSON.stringify([...e]))}function el(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 tl=["bg-destructive","bg-warning","bg-success","bg-success"],sl=["text-success","text-warning","text-warning","text-destructive"];function ll(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function il(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 nl={text:{icon:l.jsx(Ft,{className:"size-3.5"}),label:"Text"},vision:{icon:l.jsx(zt,{className:"size-3.5"}),label:"Vision"},image:{icon:l.jsx(Dt,{className:"size-3.5"}),label:"Image"},tools:{icon:l.jsx(Pt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:l.jsx(Rt,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:l.jsx(Ge,{className:"size-3.5"}),label:"Web search"}};function ol(t){const e=$.c(5),{capability:s}=t;let n;e[0]!==s?(n=nl[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=n):n=e[1];const i=n;let o;return e[2]!==i.icon||e[3]!==i.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:[i.icon,i.label]}),e[2]=i.icon,e[3]=i.label,e[4]=o):o=e[4],o}function rl(t){const e=$.c(49),{model:s,compact:n}=t,i=n===void 0?!1:n;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=we(s),e[1]=s,e[2]=a):a=e[2];const{provider:d,displayName:m}=a;if(i){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 N;e[5]!==o?(N=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]=N):N=e[6];let I;e[7]!==r?(I=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]=I):I=e[8];let p;e[9]!==s.limits?(p=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]=p):p=e[10];let C;return e[11]!==g||e[12]!==N||e[13]!==I||e[14]!==p?(C=l.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,N,I,p]}),e[11]=g,e[12]=N,e[13]=I,e[14]=p,e[15]=C):C=e[15],C}let c;e[16]!==d?(c=l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[16]=d,e[17]=c):c=e[17];let u;e[18]!==s.logo||e[19]!==s.title?(u=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]=u):u=e[20];let h;e[21]!==m?(h=l.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:m}),e[21]=m,e[22]=h):h=e[22];let f;e[23]!==u||e[24]!==h?(f=l.jsxs("div",{className:"flex items-center gap-2.5",children:[u,h]}),e[23]=u,e[24]=h,e[25]=f):f=e[25];let v;e[26]!==s.modelId?(v=l.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.modelId}),e[26]=s.modelId,e[27]=v):v=e[27];let b;e[28]!==c||e[29]!==f||e[30]!==v?(b=l.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[c,f,v]}),e[28]=c,e[29]=f,e[30]=v,e[31]=b):b=e[31];let w;e[32]!==s.capabilities?(w=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(al)}),e[32]=s.capabilities,e[33]=w):w=e[33];let j;e[34]!==s.limits?(j=s.limits?.contextWindow&&(()=>{const{level:g,label:N,description:I}=el(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(p=>l.jsx("div",{className:ie("w-2 h-2 rounded-full",p<=g?tl[g-1]:"bg-muted")},p))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",I]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=s.limits,e[35]=j):j=e[35];let x;e[36]!==s.limits?(x=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:ll(s.limits.maxOutputTokens)})]})]}),e[36]=s.limits,e[37]=x):x=e[37];let y;e[38]!==o||e[39]!==r?(y=(o!=null||r!=null)&&(()=>{const{level:g,label:N}=o!=null?il(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(I=>l.jsx("span",{className:ie("text-sm font-bold leading-none",I<=g?sl[g-1]:"text-muted-foreground/20"),children:"$"},I))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N})]}),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]=y):y=e[40];let S;e[41]!==j||e[42]!==x||e[43]!==y?(S=l.jsxs("div",{className:"flex flex-col gap-6",children:[j,x,y]}),e[41]=j,e[42]=x,e[43]=y,e[44]=S):S=e[44];let _;return e[45]!==S||e[46]!==b||e[47]!==w?(_=l.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[b,w,S]}),e[45]=S,e[46]=b,e[47]=w,e[48]=_):_=e[48],_}function al(t){return l.jsx(ol,{capability:t},t)}function cl(t){const e=$.c(21),{model:s,onHover:n}=t;let i;e[0]!==s?(i=we(s),e[0]=s,e[1]=i):i=e[1];const{displayName:o,provider:r}=i;let a;e[2]!==s?(a=Ne(s),e[2]=s,e[3]=a):a=e[3];const d=a;let m;e[4]!==s||e[5]!==n?(m=()=>n(s),e[4]=s,e[5]=n,e[6]=m):m=e[6];let c;e[7]!==s.title||e[8]!==d?(c=l.jsx("img",{src:d,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]=d,e[9]=c):c=e[9];let u;e[10]!==o?(u=l.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=u):u=e[11];let h;e[12]!==r?(h=l.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=h):h=e[13];let f;e[14]!==u||e[15]!==h?(f=l.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[u,h]}),e[14]=u,e[15]=h,e[16]=f):f=e[16];let v;return e[17]!==m||e[18]!==c||e[19]!==f?(v=l.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:m,children:[c,f]}),e[17]=m,e[18]=c,e[19]=f,e[20]=v):v=e[20],v}function dl(t){const e=$.c(10),{error:s,onRetry:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:l.jsx(bt,{className:"size-5 text-destructive"})}),e[0]=i):i=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 d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx(Lt,{className:"size-3.5"}),e[4]=d):d=e[4];let m;e[5]!==n?(m=l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs(te,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[d,"Retry"]})}),e[5]=n,e[6]=m):m=e[6];let c;return e[7]!==a||e[8]!==m?(c=l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[i,a,m]}),e[7]=a,e[8]=m,e[9]=c):c=e[9],c}function ml(){const t=$.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(ul)}),t[0]=e):e=t[0],e}function ul(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(W,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(W,{className:"flex-1 h-4"}),l.jsx(W,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function De(t){const e=$.c(12),{label:s,models:n,onSelect:i,onHover:o}=t;if(n.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]!==n||e[3]!==o||e[4]!==i){let m;e[6]!==o||e[7]!==i?(m=c=>l.jsx("div",{onClick:()=>i(c),className:"cursor-pointer",children:l.jsx(cl,{model:c,onHover:o})},c.modelId),e[6]=o,e[7]=i,e[8]=m):m=e[8],a=n.map(m),e[2]=n,e[3]=o,e[4]=i,e[5]=a}else a=e[5];let d;return e[9]!==r||e[10]!==a?(d=l.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=d):d=e[11],d}function hl(t){const e=$.c(21),{model:s,isChecked:n,onToggle:i,onHover:o}=t,[r,a]=O.useState(n);r!==n&&a(n);let d;e[0]!==s?(d=Ne(s),e[0]=s,e[1]=d):d=e[1];const m=d;let c;e[2]!==s||e[3]!==o?(c=()=>o(s),e[2]=s,e[3]=o,e[4]=c):c=e[4];let u;e[5]!==s.modelId||e[6]!==i?(u=()=>{a(fl),i(s.modelId)},e[5]=s.modelId,e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r||e[9]!==u?(h=l.jsx(vt,{checked:r,onCheckedChange:u}),e[8]=r,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==m||e[12]!==s.title?(f=l.jsx("img",{src:m,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[11]=m,e[12]=s.title,e[13]=f):f=e[13];let v;e[14]!==s.title?(v=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]=v):v=e[15];let b;return e[16]!==c||e[17]!==h||e[18]!==f||e[19]!==v?(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:c,children:[h,f,v]}),e[16]=c,e[17]=h,e[18]=f,e[19]=v,e[20]=b):b=e[20],b}function fl(t){return!t}function xl(t){const e=[];for(const s of ct)if(t[s].length>0){e.push({type:"header",label:dt[s]});for(const n of t[s])e.push({type:"model",model:n})}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 pl({items:t,shortlistSet:e,onToggle:s,onHover:n}){const i=O.useRef(null),o=hs({count:t.length,getScrollElement:()=>i.current,estimateSize:r=>t[r]?.type==="header"?36:44,overscan:6});return l.jsx("div",{ref:i,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(hl,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:s,onHover:n})},r.key):null})})})}function gl(t){const e=$.c(23),{keyId:s,searchTerm:n,onHover:i,onModelSelect:o,managing:r,onToggleManage:a,filterModels:d}=t,{models:m}=ue(s),c=d?m.filter(d):m;let u;e[0]!==s?(u=()=>(s?Js(s):null)??Xs,e[0]=s,e[1]=u):u=e[1];const[h,f]=O.useState(u),[,v]=O.useTransition();let b;e[2]!==s||e[3]!==v?(b=C=>{s&&v(()=>{f(E=>{const k=new Set(E);return k.has(C)?k.delete(C):k.add(C),Zs(s,k),k})})},e[2]=s,e[3]=v,e[4]=b):b=e[4];const w=b,j=n.toLowerCase().trim(),x=C=>j?C.filter(E=>E.title.toLowerCase().includes(j)||E.modelId.toLowerCase().includes(j)):C;if(r){const C=Fe(x(c)),E=xl(C);let k;e[5]!==h?(k=F=>h.has(F.modelId),e[5]=h,e[6]=k):k=e[6];const A=c.filter(k).length;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(Kt,{size:14}),e[7]=M):M=e[7];let T;return e[8]!==a?(T=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]=T):T=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:[T,l.jsxs("span",{className:"text-xs text-muted-foreground",children:[A," selected"]})]}),l.jsx(pl,{items:E,shortlistSet:h,onToggle:w,onHover:i})]})}let y;e[10]!==h?(y=C=>h.has(C.modelId),e[10]=h,e[11]=y):y=e[11];const S=c.filter(y),_=S.length>0?S:c,g=Fe(x(_));let N;e[12]!==g||e[13]!==i||e[14]!==o?(N=ct.map(C=>l.jsx(De,{label:dt[C],models:g[C],onSelect:o,onHover:i},C)),e[12]=g,e[13]=i,e[14]=o,e[15]=N):N=e[15];let I;e[16]!==g.other||e[17]!==i||e[18]!==o?(I=l.jsx(De,{label:"Other",models:g.other,onSelect:o,onHover:i}),e[16]=g.other,e[17]=i,e[18]=o,e[19]=I):I=e[19];let p;return e[20]!==N||e[21]!==I?(p=l.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,I]}),e[20]=N,e[21]=I,e[22]=p):p=e[22],p}function ut(t){const e=$.c(19),{model:s,placeholder:n,isLoading:i}=t,o=n===void 0?"Select model":n;if(i===void 0?!1:i){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(W,{className:"w-5 h-5 rounded-sm shrink-0"}),l.jsx(W,{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 w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx(Ce,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=w):w=e[3];let j;return e[4]!==b?(j=l.jsxs("div",{className:"flex items-center gap-1.5",children:[b,w]}),e[4]=b,e[5]=j):j=e[5],j}let a;e[6]!==s?(a=we(s),e[6]=s,e[7]=a):a=e[7];const{displayName:d}=a;let m;e[8]!==s?(m=Ne(s),e[8]=s,e[9]=m):m=e[9];const c=m;let u;e[10]!==s.title||e[11]!==c?(u=l.jsx("img",{src:c,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]=c,e[12]=u):u=e[12];let h;e[13]!==d?(h=l.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:d}),e[13]=d,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(Ce,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=f):f=e[15];let v;return e[16]!==u||e[17]!==h?(v=l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,h,f]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],v}const bl=["vision","image","file","audio","video"],ht=["image/png","image/jpeg","image/gif","image/webp"];function ni(t){const e=t?.capabilities;return e?bl.some(s=>e.includes(s)):!1}function oi(t,e){if(!t)return!1;if(t.startsWith("text/"))return!0;const s=e?.capabilities??[],n=s.includes("vision")||s.includes("image"),i=s.includes("file"),o=s.includes("audio"),r=s.includes("video");return!!(n&&ht.includes(t)||i&&t==="application/pdf"||o&&t.startsWith("audio/")||r&&t.startsWith("video/"))}function ri(t){const e=t?.capabilities??[],s=["text/*"];return(e.includes("vision")||e.includes("image"))&&s.push(...ht),e.includes("file")&&s.push("application/pdf"),e.includes("audio")&&s.push("audio/*"),e.includes("video")&&s.push("video/*"),s.join(",")}function ai(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"),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 vl(){const t=$.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(W,{className:"size-4 shrink-0"}),l.jsx(W,{className:"flex-1 h-6"}),l.jsx(W,{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(jl)})]}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx(W,{className:"size-6 shrink-0"}),l.jsx(W,{className:"h-6 w-32"})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[n,l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(W,{className:"h-6 w-20 rounded-md"}),l.jsx(W,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=i):i=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(W,{className:"h-4 w-24"}),l.jsx(W,{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:[i,l.jsxs("div",{className:"flex flex-col gap-4",children:[o,l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(W,{className:"h-4 w-16"}),l.jsx(W,{className:"h-4 w-40"})]})]})]})})]}),t[5]=r):r=t[5],r}function jl(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(W,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(W,{className:"flex-1 h-4"}),l.jsx(W,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ft(t){const e=$.c(43),{onClose:s,credentialId:n,onCredentialChange:i,selectedModel:o,onModelChange:r,filterModels:a}=t,[d,m]=O.useState(null),[c,u]=O.useState(""),[h,f]=O.useState(!1),v=O.useRef(null),b=Ye(),w=ae(),j=Object.fromEntries((b?.providers??[]).map(Nl)),x=gt(),{org:y}=ne();let S;e[0]!==i?(S=z=>{i(z),m(null)},e[0]=i,e[1]=S):S=e[1];const _=S;let g;e[2]!==n||e[3]!==s||e[4]!==r?(g=z=>{n&&(r(z),u(""),s())},e[2]=n,e[3]=s,e[4]=r,e[5]=g):g=e[5];const N=g;if(w.length===0){let z;return e[6]===Symbol.for("react.memo_cache_sentinel")?(z=l.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:l.jsx(qs,{})}),e[6]=z):z=e[6],z}const I="flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",p="flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",C="border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",E="flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text";let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(Ge,{size:16,className:"text-muted-foreground shrink-0"}),e[7]=k):k=e[7];const A=h?"Search all models...":"Search for a model...";let M;e[8]===Symbol.for("react.memo_cache_sentinel")?(M=z=>u(z.target.value),e[8]=M):M=e[8];let T;e[9]!==c||e[10]!==A?(T=l.jsx(oe,{ref:v,type:"text",placeholder:A,value:c,onChange:M,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[9]=c,e[10]=A,e[11]=T):T=e[11];const F=w.length>0&&l.jsxs(kt,{value:n??"",onValueChange:_,children:[l.jsxs(Et,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Sl,children:[l.jsx(Mt,{placeholder:"Key",children:(()=>{const z=w.find(xe=>xe.id===n),J=z?j[z.providerId]:void 0;return l.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,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:(J?.name??z?.providerId??"?").slice(0,1).toUpperCase()}),l.jsx("span",{className:"text-xs truncate",children:J?.name??z?.providerId??"Key"})]})})()}),l.jsx(Tt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),l.jsx(At,{children:w.map(z=>{const J=j[z.providerId];return l.jsx(Ot,{value:z.id,children:l.jsxs("div",{className:"flex items-center gap-2",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,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:(J?.name??z.providerId).slice(0,1).toUpperCase()}),l.jsxs("span",{children:[J?.name??z.providerId," — ",z.label]})]})},z.id)})})]});let R;e[12]!==T||e[13]!==F||e[14]!==k?(R=l.jsx("div",{className:C,children:l.jsxs("label",{className:E,children:[k,T,F]})}),e[12]=T,e[13]=F,e[14]=k,e[15]=R):R=e[15];let D;e[16]!==n?(D=z=>{const{error:J,resetError:xe}=z;return l.jsx(dl,{error:J,onRetry:xe,credentialId:n??void 0})},e[16]=n,e[17]=D):D=e[17];let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=l.jsx(ml,{}),e[18]=B):B=e[18];const Q=n??void 0;let U;e[19]===Symbol.for("react.memo_cache_sentinel")?(U=()=>f(yl),e[19]=U):U=e[19];let L;e[20]!==a||e[21]!==N||e[22]!==h||e[23]!==c||e[24]!==Q?(L=l.jsx(O.Suspense,{fallback:B,children:l.jsx(gl,{keyId:Q,searchTerm:c,onHover:m,onModelSelect:N,managing:h,onToggleManage:U,filterModels:a})}),e[20]=a,e[21]=N,e[22]=h,e[23]=c,e[24]=Q,e[25]=L):L=e[25];let V;e[26]!==n||e[27]!==D||e[28]!==L?(V=l.jsx(Le,{fallback:D,children:L},n),e[26]=n,e[27]=D,e[28]=L,e[29]=V):V=e[29];let K;e[30]!==h||e[31]!==x||e[32]!==y?(K=!h&&l.jsxs("div",{className:"border-t border-border flex",children:[l.jsxs("button",{type:"button",onClick:()=>O.startTransition(()=>f(!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($t,{className:"size-3.5 shrink-0"}),"Manage models"]}),l.jsx("div",{className:"w-px bg-border shrink-0"}),l.jsxs("button",{type:"button",onClick:()=>x({to:"/$org/settings/ai-providers",params:{org:y.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(Qe,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[30]=h,e[31]=x,e[32]=y,e[33]=K):K=e[33];let H;e[34]!==R||e[35]!==V||e[36]!==K?(H=l.jsxs("div",{className:p,children:[R,V,K]}),e[34]=R,e[35]=V,e[36]=K,e[37]=H):H=e[37];const G=d??o??null;let q;e[38]!==G?(q=l.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:l.jsx(rl,{model:G})}),e[38]=G,e[39]=q):q=e[39];let ee;return e[40]!==H||e[41]!==q?(ee=l.jsxs("div",{className:I,children:[H,q]}),e[40]=H,e[41]=q,e[42]=ee):ee=e[42],ee}function yl(t){return!t}function Sl(t){return t.stopPropagation()}function Nl(t){return[t.id,t]}function wl(t){const e=$.c(12),{onClose:s}=t,{credentialId:n,setCredentialId:i,selectedModel:o,setModel:r}=Xe();let a;e[0]!==i?(a=c=>{Z("chat_credential_changed",{credential_id:c}),i(c)},e[0]=i,e[1]=a):a=e[1];let d;e[2]!==n||e[3]!==o?.modelId||e[4]!==r?(d=c=>{n&&(Z("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:c.modelId,to_model_provider:c.providerId??null,credential_id:n}),r({...c,keyId:n}))},e[2]=n,e[3]=o?.modelId,e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==n||e[7]!==s||e[8]!==o||e[9]!==a||e[10]!==d?(m=l.jsx(ft,{onClose:s,credentialId:n,onCredentialChange:a,selectedModel:o,onModelChange:d}),e[6]=n,e[7]=s,e[8]=o,e[9]=a,e[10]=d,e[11]=m):m=e[11],m}function _l(t){const e=$.c(38),{variant:s,className:n,placeholder:i,model:o,isLoading:r,credentialId:a,onCredentialChange:d,onModelChange:m,filterModels:c}=t,u=s===void 0?"borderless":s,h=i===void 0?"Select model":i,[f,v]=O.useState(!1),b=m!==void 0,w=It(),j=u==="borderless"?"ghost":"outline",x=u==="borderless"&&"md:border-none";let y;e[0]!==n||e[1]!==x?(y=ie("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",x,n),e[0]=n,e[1]=x,e[2]=y):y=e[2];let S;e[3]!==r||e[4]!==o||e[5]!==h||e[6]!==b?(S=b?l.jsx(ut,{model:o??null,placeholder:h,isLoading:r}):l.jsx(Il,{placeholder:h}),e[3]=r,e[4]=o,e[5]=h,e[6]=b,e[7]=S):S=e[7];let _;e[8]!==j||e[9]!==y||e[10]!==S?(_=l.jsx(te,{variant:j,size:"sm",className:y,children:S}),e[8]=j,e[9]=y,e[10]=S,e[11]=_):_=e[11];const g=_;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx(vl,{}),e[12]=N):N=e[12];let I;e[13]!==a||e[14]!==c||e[15]!==o||e[16]!==d||e[17]!==m||e[18]!==b?(I=l.jsx(O.Suspense,{fallback:N,children:b?l.jsx(ft,{onClose:()=>v(!1),credentialId:a??null,onCredentialChange:d??Cl,selectedModel:o??null,onModelChange:m,filterModels:c}):l.jsx(wl,{onClose:()=>v(!1)})}),e[13]=a,e[14]=c,e[15]=o,e[16]=d,e[17]=m,e[18]=b,e[19]=I):I=e[19];const p=I;if(w){let M;e[20]!==g?(M=l.jsx(Nt,{asChild:!0,children:g}),e[20]=g,e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx(wt,{className:"sr-only",children:"Select model"}),e[22]=T):T=e[22];let F;e[23]!==p?(F=l.jsxs(_t,{className:"p-0 flex flex-col max-h-[95vh]",children:[T,l.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:p})]}),e[23]=p,e[24]=F):F=e[24];let R;return e[25]!==f||e[26]!==M||e[27]!==F?(R=l.jsxs(Ct,{open:f,onOpenChange:v,children:[M,F]}),e[25]=f,e[26]=M,e[27]=F,e[28]=R):R=e[28],R}let C;e[29]!==g?(C=l.jsx(St,{asChild:!0,children:g}),e[29]=g,e[30]=C):C=e[30];let E;e[31]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx(Ve,{className:"sr-only",children:"Select model"}),e[31]=E):E=e[31];let k;e[32]!==p?(k=l.jsxs(Ue,{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:[E,p]}),e[32]=p,e[33]=k):k=e[33];let A;return e[34]!==f||e[35]!==C||e[36]!==k?(A=l.jsxs(Be,{open:f,onOpenChange:v,children:[C,k]}),e[34]=f,e[35]=C,e[36]=k,e[37]=A):A=e[37],A}function Cl(){}function Il(t){const e=$.c(4),{placeholder:s}=t,{selectedModel:n,isModelsLoading:i}=Xe();let o;return e[0]!==i||e[1]!==n||e[2]!==s?(o=l.jsx(ut,{model:n,placeholder:s,isLoading:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3],o}export{_l as M,qs as N,ii as O,ai as a,ri as g,oi as i,ni as m};
@@ -1 +0,0 @@
1
- import{e as k,g as E,a4 as R,j as s,s as T,aG as H,c as $,ay as z,t as L,b as W,O as I,l as J,r as K}from"./index-DhJrYN5i.js";import{k as Q,l as U,m as V,u as X,S as w,a as C,b as O,d as P,c as M,f as Y,g as Z,q as A,n as ee,o as se,p as te}from"./index-DvgxnJsz.js";import{i as q}from"./ArrowNarrowLeft-ByrdB8Dd.js";import{n as le,d as ne,b as re,e as ie,f as oe,i as F,a as ae,c as ce}from"./ZapSquare-Bz3HDhTc.js";import{t as me,a as G}from"./Users03-DwNyb_q2.js";import{i as de}from"./ChevronRight-71i8ke8L.js";import{i as fe}from"./Lock01-dBhVogWg.js";import{i as xe}from"./Shield01-CMw4M4Ml.js";import{s as be}from"./User01-VHn0SqBP.js";import{i as B}from"./Zap-BxJkZzJb.js";import{u as he}from"./use-mobile-C4Yo3nsX.js";import{u as ue}from"./use-status-sounds-DfhTS64d.js";import"./X-BuUY-erD.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-fHBaJaln.js";import"./create-sse-subscription-CxkOgzKf.js";function D(){const e=k.c(29),t=T().project;let n;e[0]!==t.enabledPlugins?(n=t.enabledPlugins??[],e[0]=t.enabledPlugins,e[1]=n):n=e[1];const l=n;let r,i,c,m,o;if(e[2]!==l){const b=H.filter(N=>l.includes(N.pluginId)).map(pe);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={key:"general",label:"General",icon:s.jsx(me,{size:14}),to:"/$org/settings/general"},e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g={key:"brand-context",label:"Brand Context",icon:s.jsx(le,{size:14}),to:"/$org/settings/brand-context"},e[9]=g):g=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(c={label:"Organization",items:[x,g,{key:"ai-providers",label:"AI Providers",icon:s.jsx(ne,{size:14}),to:"/$org/settings/ai-providers"}]},e[10]=c):c=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y={key:"connections",label:"Connections",icon:s.jsx(re,{size:14}),to:"/$org/settings/connections"},e[11]=y):y=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j={key:"agents",label:"Agents",icon:s.jsx(G,{size:14}),to:"/$org/settings/agents"},e[12]=j):j=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_={key:"automations",label:"Automations",icon:s.jsx(B,{size:14}),to:"/$org/settings/automations"},e[13]=_):_=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(m={label:"Build",items:[y,j,_,{key:"store",label:"Store",icon:s.jsx(ie,{size:14}),to:"/$org/settings/store"}]},e[14]=m):m=e[14];let p;e[15]===Symbol.for("react.memo_cache_sentinel")?(p={key:"monitor",label:"Monitor",icon:s.jsx(oe,{size:14}),to:"/$org/settings/monitor"},e[15]=p):p=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S={key:"members",label:"Members",icon:s.jsx(G,{size:14}),to:"/$org/settings/members"},e[16]=S):S=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u={key:"roles",label:"Roles",icon:s.jsx(xe,{size:14}),to:"/$org/settings/roles"},e[17]=u):u=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(o={label:"Manage",items:[p,S,u,{key:"sso",label:"SSO",icon:s.jsx(fe,{size:14}),to:"/$org/settings/sso"}]},e[18]=o):o=e[18],r="Extensions";let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v={key:"features",label:"Plugins",icon:s.jsx(B,{size:14}),to:"/$org/settings/features"},e[19]=v):v=e[19],i=[v,...b],e[2]=l,e[3]=r,e[4]=i,e[5]=c,e[6]=m,e[7]=o}else r=e[3],i=e[4],c=e[5],m=e[6],o=e[7];let a;e[20]!==r||e[21]!==i?(a={label:r,items:i},e[20]=r,e[21]=i,e[22]=a):a=e[22];let d;e[23]===Symbol.for("react.memo_cache_sentinel")?(d={label:"Account",items:[{key:"profile",label:"Profile & Preferences",icon:s.jsx(be,{size:14}),to:"/$org/settings/profile"}]},e[23]=d):d=e[23];let f;return e[24]!==c||e[25]!==m||e[26]!==o||e[27]!==a?(f=[c,m,o,a,d],e[24]=c,e[25]=m,e[26]=o,e[27]=a,e[28]=f):f=e[28],f}function pe(e){const{key:t,label:n,icon:l,to:r}=e;return{key:t,label:n,icon:l,to:r}}function ge(){const e=k.c(26),t=D();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org"},e[0]=n):n=e[0];const{org:l}=E(n);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={select:_e},e[1]=r):r=e[1];const i=R(r);let c;e[2]!==l||e[3]!==i?(c=_=>{const p=_.replace("$org",l);return i.startsWith(p)},e[2]=l,e[3]=i,e[4]=c):c=e[4];const m=c;let o;e[5]!==l?(o={org:l},e[5]=l,e[6]=o):o=e[6];let a,d;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(q,{size:14}),d=s.jsx("span",{children:"Settings"}),e[7]=a,e[8]=d):(a=e[7],d=e[8]);let f;e[9]!==o?(f=s.jsx(w,{className:"pt-0 pr-0 pb-3 md:pb-3 pl-0",children:s.jsx(C,{children:s.jsx(O,{className:"gap-1.5",children:s.jsx(P,{children:s.jsx(M,{asChild:!0,children:s.jsxs(z,{to:"/$org",params:o,className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a,d]})})})})})}),e[9]=o,e[10]=f):f=e[10];let h;if(e[11]!==t||e[12]!==m||e[13]!==l){let _;e[15]!==m||e[16]!==l?(_=(p,S)=>s.jsxs(w,{className:"pt-0 pr-0 pb-0 pl-0",children:[p.label&&s.jsx("p",{className:$("px-2 pt-1.5 pb-0.5 text-xs font-medium text-muted-foreground/60",S>0&&"mt-3"),children:p.label}),s.jsx(C,{children:s.jsx(O,{className:"gap-0.5",children:p.items.map(u=>s.jsx(P,{children:s.jsx(M,{asChild:!0,isActive:m(u.to),children:s.jsxs(z,{to:u.to,params:{org:l},onClick:()=>L("settings_nav_clicked",{section_key:u.key,section_label:u.label,group_label:p.label||"main"}),className:"flex items-center gap-2.5 text-sm",children:[s.jsx("span",{className:"shrink-0",children:u.icon}),s.jsx("span",{className:"truncate",children:u.label})]})})},u.key))})})]},`${p.label}-${S}`),e[15]=m,e[16]=l,e[17]=_):_=e[17],h=t.map(_),e[11]=t,e[12]=m,e[13]=l,e[14]=h}else h=e[14];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("div",{className:"mx-2 my-2 border-t border-border/50"}),e[18]=b):b=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsxs(w,{className:"pt-0 pr-0 pb-0 pl-0",children:[b,s.jsx(C,{children:s.jsx(O,{className:"gap-0.5",children:s.jsx(P,{children:s.jsxs(M,{onClick:je,className:"flex items-center gap-2.5 text-sm",children:[s.jsx("span",{className:"shrink-0",children:s.jsx(F,{size:14})}),s.jsx("span",{className:"truncate",children:"Sign Out"})]})})})})]}),e[19]=x):x=e[19];let g;e[20]!==f||e[21]!==h?(g=s.jsxs(Y,{className:"flex flex-col flex-1 mt-2 px-2 pb-2 gap-0",children:[f,h,x]}),e[20]=f,e[21]=h,e[22]=g):g=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.286.1"]})}),e[23]=y):y=e[23];let j;return e[24]!==g?(j=s.jsxs(Z,{variant:"sidebar",children:[g,y]}),e[24]=g,e[25]=j):j=e[25],j}function je(){L("signed_out",{source:"settings_sidebar"}),W.signOut()}function _e(e){return e.location.pathname}function ye(e){const t=k.c(29),{onClose:n}=e,l=D();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org"},t[0]=r):r=t[0];const{org:i}=E(r);let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={select:ve},t[1]=c):c=t[1];const m=R(c);let o;t[2]!==i||t[3]!==m?(o=S=>{const u=S.replace("$org",i);return m.startsWith(u)},t[2]=i,t[3]=m,t[4]=o):o=t[4];const a=o;let d;t[5]!==i?(d={org:i},t[5]=i,t[6]=d):d=t[6];let f,h;t[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(q,{size:16,className:"shrink-0"}),h=s.jsx("span",{children:"Settings"}),t[7]=f,t[8]=h):(f=t[7],h=t[8]);let b;t[9]!==n||t[10]!==d?(b=s.jsx("div",{className:"flex items-center h-14 px-4 shrink-0 border-b border-border/50",children:s.jsxs(z,{to:"/$org",params:d,onClick:n,className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[f,h]})}),t[9]=n,t[10]=d,t[11]=b):b=t[11];let x;if(t[12]!==l||t[13]!==a||t[14]!==n||t[15]!==i){let S;t[17]!==a||t[18]!==n||t[19]!==i?(S=(u,v)=>s.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.label&&s.jsx("p",{className:$("px-3 pt-1.5 pb-0.5 text-xs font-medium text-muted-foreground/60",v>0&&"mt-3"),children:u.label}),u.items.map(N=>s.jsxs(z,{to:N.to,params:{org:i},onClick:n,className:$("flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm",a(N.to)?"bg-sidebar-accent text-sidebar-accent-foreground font-medium":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"),children:[s.jsx("span",{className:"shrink-0",children:N.icon}),s.jsx("span",{className:"truncate",children:N.label})]},N.key))]},`${u.label}-${v}`),t[17]=a,t[18]=n,t[19]=i,t[20]=S):S=t[20],x=l.map(S),t[12]=l,t[13]=a,t[14]=n,t[15]=i,t[16]=x}else x=t[16];let g;t[21]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("div",{className:"h-px bg-border/50 my-2"}),t[21]=g):g=t[21];let y;t[22]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[g,s.jsxs("button",{type:"button",onClick:Se,className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx("span",{className:"shrink-0",children:s.jsx(F,{size:14})}),s.jsx("span",{className:"truncate",children:"Sign Out"})]})]}),t[22]=y):y=t[22];let j;t[23]!==x?(j=s.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto px-2 py-2 gap-0.5",children:[x,y]}),t[23]=x,t[24]=j):j=t[24];let _;t[25]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-border/50",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.286.1"]})}),t[25]=_):_=t[25];let p;return t[26]!==j||t[27]!==b?(p=s.jsxs("div",{className:"flex flex-col h-full bg-sidebar",children:[b,j,_]}),t[26]=j,t[27]=b,t[28]=p):p=t[28],p}function Se(){return W.signOut()}function ve(e){return e.location.pathname}function Ne(){const e=k.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("button",{type:"button",onClick:$e,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go back",children:s.jsx(ae,{size:16})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"shrink-0 flex items-center justify-between pl-1 pr-2 h-10",children:s.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[t,s.jsx("button",{type:"button",onClick:ke,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go forward",children:s.jsx(de,{size:16})})]})}),e[1]=n):n=e[1],n}function ke(){return window.history.forward()}function $e(){return window.history.back()}function ze(e){const t=k.c(3),{onOpenSidebar:n}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ce,{size:20}),t[0]=l):l=t[0];let r;return t[1]!==n?(r=s.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:s.jsx("button",{type:"button",onClick:n,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:l})}),t[1]=n,t[2]=r):r=t[2],r}function we(){const e=k.c(17),t=he(),{org:n}=T();ue(n.id);const{setOpenMobile:l,openMobile:r}=X();if(t){let a;e[0]!==l?(a=s.jsx(ze,{onOpenSidebar:()=>l(!0)}),e[0]=l,e[1]=a):a=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(A,{value:"p-0",children:s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden h-full",children:s.jsx(I,{})})})}),e[2]=d):d=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ee,{className:"sr-only",children:"Navigation"}),e[3]=f):f=e[3];let h;e[4]!==l?(h=s.jsxs(se,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[f,s.jsx(ye,{onClose:()=>l(!1)})]}),e[4]=l,e[5]=h):h=e[5];let b;e[6]!==r||e[7]!==l||e[8]!==h?(b=s.jsx(te,{open:r,onOpenChange:l,children:h}),e[6]=r,e[7]=l,e[8]=h,e[9]=b):b=e[9];let x;return e[10]!==a||e[11]!==b?(x=s.jsxs("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:[a,d,b]}),e[10]=a,e[11]=b,e[12]=x):x=e[12],x}let i;e[13]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ne,{}),e[13]=i):i=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=$("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","rounded-[0.75rem]"),e[14]=c):c=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(J,{size:20,className:"animate-spin text-muted-foreground"})}),e[15]=m):m=e[15];let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(s.Fragment,{children:[i,s.jsx("div",{className:"flex-1 min-h-0 p-1",children:s.jsx("div",{className:c,children:s.jsx(K.Suspense,{fallback:m,children:s.jsx("div",{className:"flex flex-1 items-center overflow-hidden rounded-[inherit]",children:s.jsx(A,{value:"p-0",children:s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden h-full",children:s.jsx(I,{})})})})})})})]}),e[16]=o):o=e[16],o}function He(){const e=k.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={"--sidebar-width-icon":"3.5rem"},e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ge,{}),e[1]=n):n=e[1];let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Q,{defaultOpen:!0,children:s.jsx("div",{className:"flex flex-col h-dvh overflow-hidden",children:s.jsxs(U,{className:"flex-1 bg-sidebar",style:t,children:[n,s.jsx(V,{className:"flex flex-col",style:{background:"transparent",containerType:"inline-size"},children:s.jsx(we,{})})]})})}),e[2]=l):l=e[2],l}export{ge as SettingsSidebar,ye as SettingsSidebarMobile,He as default};
@@ -1 +0,0 @@
1
- import{s as E,r as S,j as e,B as u,t as h,z as a,e as I}from"./index-DhJrYN5i.js";import{P as g}from"./index-DvgxnJsz.js";import{I as d}from"./input-COFLoOjb.js";import{L as m}from"./label-BZVcstmy.js";import{S as _}from"./switch-ihM2hYRH.js";import{a as w,b as z,c as D,d as k}from"./use-org-sso-BK-ft_ER.js";import{i as F}from"./AlertCircle-Bgzr6uRA.js";import{i as P}from"./CheckCircle-88bls7UK.js";import{s as R}from"./Trash01-DZpzvWVW.js";import"./use-mobile-C4Yo3nsX.js";import"./X-BuUY-erD.js";function L(){const{org:n}=E(),{data:r,isLoading:N}=w(n.id),p=z(n.id),j=D(n.id),v=k(n.id),[i,c]=S.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[x,f]=S.useState(!1),l=r?.configured&&r.config,t=r?.config,y=()=>{t&&c({issuer:t.issuer,clientId:t.clientId,clientSecret:"",discoveryEndpoint:t.discoveryEndpoint??"",domain:t.domain,scopes:t.scopes.join(" ")}),f(!0)},C=async()=>{if(!i.issuer||!i.clientId||!i.domain){a.error("Issuer, Client ID, and Domain are required");return}if(!l&&!i.clientSecret){a.error("Client Secret is required for initial setup");return}try{await p.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:t?.enforced??!1}),h(l?"sso_config_updated":"sso_configured",{organization_id:n.id,email_domain:i.domain}),a.success("SSO configuration saved"),f(!1)}catch(s){a.error(s instanceof Error?s.message:"Failed to save SSO config")}},O=async()=>{if(confirm("Are you sure you want to remove SSO configuration?"))try{await j.mutateAsync(),h("sso_config_removed",{organization_id:n.id}),a.success("SSO configuration removed"),f(!1)}catch{a.error("Failed to remove SSO config")}},b=async s=>{try{await v.mutateAsync(s),h("sso_enforcement_toggled",{organization_id:n.id,enforced:s}),a.success(s?"SSO enforcement enabled":"SSO enforcement disabled")}catch{a.error("Failed to toggle SSO enforcement")}};return e.jsx(g,{children:e.jsx(g.Content,{children:e.jsx(g.Body,{children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(g.Title,{children:"Single Sign-On"}),N?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."}):e.jsxs("div",{className:"flex flex-col gap-6",children:[l&&!x&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-md bg-muted/50",children:[e.jsx(P,{size:16,className:"text-green-600"}),e.jsx("span",{className:"text-sm font-medium",children:"SSO Configured"}),e.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:t.issuer})]}),e.jsxs("div",{className:"flex flex-col gap-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-medium",children:t.issuer})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Client ID"}),e.jsx("span",{className:"font-mono text-xs",children:t.clientId})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Domain"}),e.jsx("span",{className:"font-medium",children:t.domain})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Scopes"}),e.jsx("span",{className:"font-mono text-xs",children:t.scopes.join(" ")})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md border border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Enforce SSO"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Require all members to authenticate via SSO"})]}),e.jsx(_,{checked:t.enforced,onCheckedChange:b,disabled:v.isPending})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u,{variant:"outline",size:"sm",onClick:y,children:"Edit configuration"}),e.jsx(u,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/org-sso/authorize?orgId=${n.id}`,"_blank")},children:"Test SSO"}),e.jsxs(u,{variant:"ghost",size:"sm",onClick:O,disabled:j.isPending,className:"text-destructive hover:text-destructive ml-auto",children:[e.jsx(R,{size:14}),"Remove"]})]})]}),(!l||x)&&e.jsxs("div",{className:"flex flex-col gap-4",children:[!l&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-md bg-muted/50",children:[e.jsx(F,{size:16,className:"text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"SSO is not configured for this organization."})]}),e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"sso-issuer",children:"Issuer URL"}),e.jsx(d,{id:"sso-issuer",placeholder:"https://login.microsoftonline.com/{tenant}/v2.0",value:i.issuer,onChange:s=>c(o=>({...o,issuer:s.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The OIDC issuer URL of your identity provider."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"sso-client-id",children:"Client ID"}),e.jsx(d,{id:"sso-client-id",placeholder:"your-client-id",value:i.clientId,onChange:s=>c(o=>({...o,clientId:s.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(m,{htmlFor:"sso-client-secret",children:["Client Secret",x&&l&&e.jsx("span",{className:"text-muted-foreground font-normal ml-1",children:"(leave empty to keep current)"})]}),e.jsx(d,{id:"sso-client-secret",type:"password",placeholder:"your-client-secret",value:i.clientSecret,onChange:s=>c(o=>({...o,clientSecret:s.target.value}))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"sso-domain",children:"Email Domain"}),e.jsx(d,{id:"sso-domain",placeholder:"company.com",value:i.domain,onChange:s=>c(o=>({...o,domain:s.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The email domain that this SSO provider covers."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(m,{htmlFor:"sso-scopes",children:"Scopes"}),e.jsx(d,{id:"sso-scopes",placeholder:"openid email profile",value:i.scopes,onChange:s=>c(o=>({...o,scopes:s.target.value}))})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(m,{htmlFor:"sso-discovery",children:["Discovery Endpoint"," ",e.jsx("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),e.jsx(d,{id:"sso-discovery",placeholder:"Auto-detected from issuer",value:i.discoveryEndpoint,onChange:s=>c(o=>({...o,discoveryEndpoint:s.target.value}))})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(u,{onClick:C,disabled:p.isPending,children:p.isPending?"Saving...":x?"Update":"Configure SSO"}),x&&e.jsx(u,{variant:"ghost",onClick:()=>f(!1),children:"Cancel"})]})]})]})]})})})})}function Q(){const n=I.c(1);let r;return n[0]===Symbol.for("react.memo_cache_sentinel")?(r=e.jsx(L,{}),n[0]=r):r=n[0],r}export{Q as default};
@@ -1 +0,0 @@
1
- import{e as B,j as s,E as ie,r as O,s as ne,o as re,f as oe,g as le,B as Y,t as V,K as ae,a as ce,z as Z}from"./index-DhJrYN5i.js";import{i as me}from"./AlertCircle-Bgzr6uRA.js";import{i as de}from"./ChevronRight-71i8ke8L.js";import{s as fe}from"./Plus-BzxOIhxj.js";import{s as ue}from"./Trash01-DZpzvWVW.js";import{C as ge}from"./card-DqrPrhd5.js";import{I as W}from"./input-COFLoOjb.js";import{S as ee}from"./switch-ihM2hYRH.js";import{S as xe}from"./skeleton-DOcx8lZU.js";import{A as te}from"./avatar-DcLXZkYK.js";import{b as he,P as pe,a as ye}from"./popover-Bo1-wNsY.js";import{a as se}from"./use-connection-MU3rXx28.js";import{d as J}from"./constants-aD7HJ6sY.js";import{P as G}from"./index-DvgxnJsz.js";import{u as je}from"./use-registry-connections-Biq_9qgb.js";import{g as ve,h as Ce}from"./use-organization-settings-CMC2yyUM.js";import"./User01-VHn0SqBP.js";import"./use-collections-DvPoAlor.js";import"./use-mobile-C4Yo3nsX.js";import"./X-BuUY-erD.js";function _e(t){const e=B.c(3),{error:n}=t;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(me,{size:16}),e[0]=m):m=e[0];let r;return e[1]!==n.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[m,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load store settings: ",n.message]})]}),e[1]=n.message,e[2]=r):r=e[2],r}function be(t){const e=B.c(39),{onCancel:n,onSuccess:m}=t,r=se(),[o,b]=O.useState(""),[d,P]=O.useState(""),[g,v]=O.useState("");let x;e[0]!==r||e[1]!==o||e[2]!==g||e[3]!==d?(x=async()=>(await r.create.mutateAsync({title:o||"Private Registry",description:"Private MCP registry",connection_type:"HTTP",connection_url:d,connection_token:g||null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{type:"registry"},app_name:null,app_id:null,icon:null})).id,e[0]=r,e[1]=o,e[2]=g,e[3]=d,e[4]=x):x=e[4];let f;e[5]!==m?(f=k=>{V("store_private_registry_added",{connection_id:k}),Z.success("Private registry added"),m(k)},e[5]=m,e[6]=f):f=e[6];let c;e[7]!==x||e[8]!==f?(c={mutationFn:x,onSuccess:f,onError:Ne},e[7]=x,e[8]=f,e[9]=c):c=e[9];const{mutate:h,isPending:y}=ce(c);let j;e[10]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=j):j=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=k=>b(k.target.value),e[11]=u):u=e[11];let l;e[12]!==o?(l=s.jsxs("div",{className:"space-y-1",children:[j,s.jsx(W,{placeholder:"e.g. Acme Corp Registry",value:o,onChange:u,className:"h-8 text-sm"})]}),e[12]=o,e[13]=l):l=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Registry URL"}),e[14]=C):C=e[14];let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=k=>P(k.target.value),e[15]=N):N=e[15];let p;e[16]!==d?(p=s.jsxs("div",{className:"space-y-1",children:[C,s.jsx(W,{placeholder:"https://registry.example.com/mcp",value:d,onChange:N,className:"h-8 text-sm"})]}),e[16]=d,e[17]=p):p=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Auth Token (optional)"}),e[18]=S):S=e[18];let R;e[19]===Symbol.for("react.memo_cache_sentinel")?(R=k=>v(k.target.value),e[19]=R):R=e[19];let _;e[20]!==g?(_=s.jsxs("div",{className:"space-y-1",children:[S,s.jsx(W,{type:"password",placeholder:"Bearer token...",value:g,onChange:R,className:"h-8 text-sm"})]}),e[20]=g,e[21]=_):_=e[21];let w;e[22]!==y||e[23]!==n?(w=s.jsx(Y,{variant:"ghost",size:"sm",onClick:n,disabled:y,children:"Cancel"}),e[22]=y,e[23]=n,e[24]=w):w=e[24];let a;e[25]!==h?(a=()=>h(),e[25]=h,e[26]=a):a=e[26];const A=!d||y,E=y?"Adding...":"Add Registry";let T;e[27]!==a||e[28]!==A||e[29]!==E?(T=s.jsx(Y,{size:"sm",onClick:a,disabled:A,children:E}),e[27]=a,e[28]=A,e[29]=E,e[30]=T):T=e[30];let M;e[31]!==w||e[32]!==T?(M=s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[w,T]}),e[31]=w,e[32]=T,e[33]=M):M=e[33];let $;return e[34]!==_||e[35]!==M||e[36]!==l||e[37]!==p?($=s.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[l,p,_,M]}),e[34]=_,e[35]=M,e[36]=l,e[37]=p,e[38]=$):$=e[38],$}function Ne(t){Z.error(`Failed to add registry: ${t.message}`)}function L(t){const e=B.c(38),{name:n,description:m,icon:r,enabled:o,onToggle:b,onDelete:d,href:P}=t,g=oe();let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={from:"/shell/$org"},e[0]=v):v=e[0];const{org:x}=le(v);let f;e[1]!==o||e[2]!==P||e[3]!==g||e[4]!==b||e[5]!==x?(f=()=>{P?g({to:P,params:{org:x}}):b(!o)},e[1]=o,e[2]=P,e[3]=g,e[4]=b,e[5]=x,e[6]=f):f=e[6];const c=f;let h;e[7]!==c?(h=a=>{a.currentTarget===a.target&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),c())},e[7]=c,e[8]=h):h=e[8];const y=h;let j;e[9]!==r||e[10]!==n?(j=r?s.jsx("img",{src:r,alt:n,className:"size-8 rounded-md object-contain shrink-0"}):s.jsx(te,{fallback:n.charAt(0),className:"size-8 bg-primary/10 text-primary shrink-0"}),e[9]=r,e[10]=n,e[11]=j):j=e[11];let u;e[12]!==n?(u=s.jsx("h3",{className:"font-medium text-sm truncate",children:n}),e[12]=n,e[13]=u):u=e[13];let l;e[14]!==m?(l=s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:m}),e[14]=m,e[15]=l):l=e[15];let C;e[16]!==u||e[17]!==l?(C=s.jsxs("div",{className:"min-w-0 flex-1",children:[u,l]}),e[16]=u,e[17]=l,e[18]=C):C=e[18];let N;e[19]!==d?(N=d&&s.jsxs(he,{children:[s.jsx(pe,{asChild:!0,children:s.jsx(Y,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",onClick:ke,children:s.jsx(ue,{size:14})})}),s.jsx(ye,{className:"w-auto p-2",align:"end",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-xs font-medium",children:"Remove this registry?"}),s.jsx(Y,{variant:"destructive",size:"xs",onClick:a=>{a.stopPropagation(),d()},children:"Remove"})]})})]}),e[19]=d,e[20]=N):N=e[20];let p;e[21]!==b?(p=a=>b(a),e[21]=b,e[22]=p):p=e[22];let S;e[23]!==o||e[24]!==p?(S=s.jsx(ee,{checked:o,onClick:Se,onCheckedChange:p}),e[23]=o,e[24]=p,e[25]=S):S=e[25];let R;e[26]!==P?(R=P&&s.jsx(de,{size:14,className:"text-muted-foreground"}),e[26]=P,e[27]=R):R=e[27];let _;e[28]!==S||e[29]!==R||e[30]!==N?(_=s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[N,S,R]}),e[28]=S,e[29]=R,e[30]=N,e[31]=_):_=e[31];let w;return e[32]!==c||e[33]!==y||e[34]!==_||e[35]!==j||e[36]!==C?(w=s.jsxs("div",{role:"button",tabIndex:0,className:"flex items-center gap-3 p-3 border rounded-lg cursor-pointer hover:bg-muted/30 transition-colors",onClick:c,onKeyDown:y,children:[j,C,_]}),e[32]=c,e[33]=y,e[34]=_,e[35]=j,e[36]=C,e[37]=w):w=e[37],w}function Se(t){return t.stopPropagation()}function ke(t){return t.stopPropagation()}function Pe(){const t=B.c(55),{org:e}=ne(),n=je(),m=se(),r=ve(),{mutateAsync:o}=Ce(),b=re(),[d,P]=O.useState(!1);let g,v,x,f,c,h;if(t[0]!==m||t[1]!==e.id||t[2]!==b||t[3]!==r||t[4]!==n||t[5]!==d||t[6]!==o){const u=J.REGISTRY(e.id),l=i=>{if(!r)return i===u;const z=r.registries[i];return z?z.enabled:i===u},C=J.COMMUNITY_REGISTRY(e.id),N=n.find(i=>i.id===u),p=n.find(i=>i.id===C||i.id==="community-registry"),S=p?.id??C,R=J.SELF(e.id),_=new Set([u,C,"community-registry",R]),w=n.filter(i=>!_.has(i.id));let a;t[13]!==r||t[14]!==o?(a=async(i,z)=>{V("store_registry_toggled",{connection_id:i,enabled:z});const X=r??{registries:{},blockedMcps:[]};await o({...X,registries:{...X.registries,[i]:{enabled:z}}})},t[13]=r,t[14]=o,t[15]=a):a=t[15];const A=a;let E;t[16]!==m||t[17]!==e.id||t[18]!==b?(E=async i=>{V("store_private_registry_removed",{connection_id:i}),await m.delete.mutateAsync(i),b.invalidateQueries({queryKey:ae.organizationSettings(e.id)})},t[16]=m,t[17]=e.id,t[18]=b,t[19]=E):E=t[19];const T=E;let M;t[20]!==r||t[21]!==o?(M=async i=>{P(!1);const z=r??{registries:{},blockedMcps:[]};await o({...z,registries:{...z.registries,[i]:{enabled:!0}}})},t[20]=r,t[21]=o,t[22]=M):M=t[22];const $=M;f="space-y-6";let k;t[23]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Deco Store"}),t[23]=k):k=t[23];const Q=N?s.jsx(L,{name:"Deco Store",description:"Official deco MCP registry with curated integrations",icon:N.icon,enabled:l(u),onToggle:i=>A(u,i)}):s.jsx(ge,{className:"p-4",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Deco Store connection not found. It will be created automatically."})});t[24]!==Q?(c=s.jsxs("div",{className:"space-y-3",children:[k,Q]}),t[24]=Q,t[25]=c):c=t[25];let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Private Registries"}),t[26]=U):U=t[26];let D;t[27]!==l?(D=l("self"),t[27]=l,t[28]=D):D=t[28];let F;t[29]!==A?(F=i=>A("self",i),t[29]=A,t[30]=F):F=t[30];let I;t[31]!==D||t[32]!==F?(I=s.jsx(L,{name:"Private Registry",description:"Your organization's private MCP registry",enabled:D,onToggle:F,href:"/$org/settings/store/registry"}),t[31]=D,t[32]=F,t[33]=I):I=t[33];let q;t[34]!==T||t[35]!==A||t[36]!==l?(q=i=>s.jsx(L,{name:i.title,description:i.description??"Private MCP registry",icon:i.icon,enabled:l(i.id),onToggle:z=>A(i.id,z),onDelete:()=>T(i.id)},i.id),t[34]=T,t[35]=A,t[36]=l,t[37]=q):q=t[37];const H=w.map(q);let K;t[38]!==$||t[39]!==d?(K=d?s.jsx(be,{onCancel:()=>P(!1),onSuccess:$}):s.jsxs(Y,{variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>P(!0),children:[s.jsx(fe,{size:14}),"Add Private Registry"]}),t[38]=$,t[39]=d,t[40]=K):K=t[40],t[41]!==I||t[42]!==H||t[43]!==K?(h=s.jsxs("div",{className:"space-y-3",children:[U,I,H,K]}),t[41]=I,t[42]=H,t[43]=K,t[44]=h):h=t[44],g="space-y-3",t[45]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Community"}),t[45]=v):v=t[45],x=p?s.jsx(L,{name:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",icon:p.icon,enabled:l(S),onToggle:i=>A(S,i)}):s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-md bg-muted/30",children:[s.jsx(te,{fallback:"M",className:"size-8 bg-primary/10 text-primary shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-sm font-medium",children:"MCP Registry"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Community MCP registry — not yet added"})]}),s.jsx(ee,{checked:!1,disabled:!0,onCheckedChange:Re})]}),t[0]=m,t[1]=e.id,t[2]=b,t[3]=r,t[4]=n,t[5]=d,t[6]=o,t[7]=g,t[8]=v,t[9]=x,t[10]=f,t[11]=c,t[12]=h}else g=t[7],v=t[8],x=t[9],f=t[10],c=t[11],h=t[12];let y;t[46]!==g||t[47]!==v||t[48]!==x?(y=s.jsxs("div",{className:g,children:[v,x]}),t[46]=g,t[47]=v,t[48]=x,t[49]=y):y=t[49];let j;return t[50]!==f||t[51]!==c||t[52]!==h||t[53]!==y?(j=s.jsxs("div",{className:f,children:[c,h,y]}),t[50]=f,t[51]=c,t[52]=h,t[53]=y,t[54]=j):j=t[54],j}function Re(){}function we(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(xe,{className:"h-64 w-full"}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ie,{fallback:Ae,children:s.jsx(O.Suspense,{fallback:e,children:s.jsx(G,{children:s.jsx(G.Content,{children:s.jsx(G.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx(G.Title,{children:"Store"})}),s.jsx(Pe,{})]})})})})})}),t[1]=n):n=t[1],n}function Ae(t){const{error:e}=t;return s.jsx(_e,{error:e??new Error("Failed to load store settings")})}function Ve(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(we,{}),t[0]=e):e=t[0],e}export{Ve as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/registry-layout-q6bMBk9s.js","assets/index-DhJrYN5i.js","assets/index-BCwsJqWc.css","assets/ArrowNarrowLeft-ByrdB8Dd.js","assets/CheckCircle-88bls7UK.js","assets/Container-DWaKXfYv.js","assets/Settings02-MyfUtBA4.js","assets/XCircle-BFZeumzD.js","assets/constants-aD7HJ6sY.js","assets/useInfiniteQuery-Gkc0b2zi.js","assets/infiniteQueryObserver-B_9sKQsI.js","assets/badge-BJBM0LXp.js","assets/input-COFLoOjb.js","assets/dropdown-menu-Cc_jn9Z7.js","assets/ChevronDown-Jd-cYHC-.js","assets/ChevronRight-71i8ke8L.js","assets/DotsVertical-CjXyjLNU.js","assets/table-CAUXYO7-.js","assets/toggle-group-_HWF3GFc.js","assets/use-view-mode-DSeYcON6.js","assets/use-mobile-C4Yo3nsX.js","assets/SearchMd-D6tCV38D.js","assets/dialog-nGTWjCEa.js","assets/X-BuUY-erD.js","assets/AlertCircle-Bgzr6uRA.js","assets/alert-dialog-CtGXaT-Y.js","assets/card-DqrPrhd5.js","assets/Trash01-DZpzvWVW.js","assets/label-BZVcstmy.js","assets/select-Cn3ZnqjJ.js","assets/ChevronUp-D_szSdLd.js","assets/switch-ihM2hYRH.js","assets/textarea-CsnX9Ktr.js","assets/RefreshCcw01-BxULs6ec.js","assets/checkbox-Dplb_VaM.js","assets/LinkExternal01-DB08YntP.js","assets/use-copy-tC0v6ypy.js","assets/Plus-BzxOIhxj.js","assets/Play-D7pqvkYq.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,aE as u}from"./index-DhJrYN5i.js";const g=l.lazy(()=>u(()=>import("./registry-layout-q6bMBk9s.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 _(){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(g,{onBack:()=>o({to:"/$org/settings/store",params:{org:i}})})}),e[2]=o,e[3]=i,e[4]=a):a=e[4],a}export{_ as default};
@@ -1 +0,0 @@
1
- import{e as c,c as n,j as r}from"./index-DhJrYN5i.js";function d(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=n("w-full caption-bottom text-sm min-w-0",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("div",{"data-slot":"table-container",className:"w-full min-w-0 bg-background dark:bg-input/30 rounded-xl card-shadow overflow-hidden",children:r.jsx("table",{"data-slot":"table",className:s,...l})}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function b(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=n("[&_tr]:border-b sticky top-0 z-10 bg-background",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("thead",{"data-slot":"table-header",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function f(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=n("[&_tr:last-child]:border-0",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("tbody",{"data-slot":"table-body",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function p(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=n("data-[state=selected]:bg-muted border-b transition-colors",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("tr",{"data-slot":"table-row",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function m(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=n("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("th",{"data-slot":"table-head",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function u(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=n("p-2 align-middle whitespace-nowrap text-sm [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("td",{"data-slot":"table-cell",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}export{u as T,p as a,f as b,d as c,b as d,m as e};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-B_9sKQsI.js";import{c1 as i}from"./index-DhJrYN5i.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{I as s}from"./infiniteQueryObserver-B_9sKQsI.js";import{c1 as u,c2 as n}from"./index-DhJrYN5i.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,z as Le,o as ut,a as mt,K as Fe,a7 as Ke,a8 as pt}from"./index-DhJrYN5i.js";import{u as Ve,S as qe}from"./constants-aD7HJ6sY.js";import{B as ft,g as Me}from"./constants-D7DNenhk.js";import{C as Qe}from"./collection-display-button-DecHBxzk.js";import{C as ht}from"./collection-search-B_zW9IS4.js";import{C as gt}from"./card-DqrPrhd5.js";import{I as Ge}from"./integration-icon-DKrcAAs9.js";import{c as He,d as Je,e as Ye,D as O}from"./dropdown-menu-Cc_jn9Z7.js";import{f as Xe}from"./XCircle-BFZeumzD.js";import{i as Ze}from"./DotsVertical-CjXyjLNU.js";import{O as et,v as Ue}from"./agent-icon-DKQKq---.js";import{s as tt}from"./RefreshCcw01-BxULs6ec.js";import{s as st}from"./Trash01-DZpzvWVW.js";import{C as xt}from"./collection-table-wrapper-DG-B8ykv.js";import{E as We}from"./empty-state-CqQa90x5.js";import{U as jt}from"./user-5oBDTi_W.js";import{E as it}from"./empty-state-DgThOXBB.js";import{u as Ct}from"./use-list-state-Ba4O0IuX.js";import{g as bt}from"./connection-slug-eyAPH6o3.js";import{A as vt,g as yt,c as Nt,b as wt,d as St,e as Pt,a as _t,f as Dt}from"./alert-dialog-CtGXaT-Y.js";import{a as It,c as At}from"./use-collections-DvPoAlor.js";import{b as Tt}from"./use-connection-MU3rXx28.js";import{s as Et}from"./Plus-BzxOIhxj.js";import{a as Ot}from"./layout-Dp5y9gtR.js";import{P as je}from"./index-DvgxnJsz.js";import"./collections-KKlyNHih.js";import"./XClose-ANREDbeo.js";import"./ChevronDown-Jd-cYHC-.js";import"./use-mobile-C4Yo3nsX.js";import"./view-mode-toggle-BvyYLass.js";import"./badge-BJBM0LXp.js";import"./SearchMd-D6tCV38D.js";import"./Container-DWaKXfYv.js";import"./ChevronRight-71i8ke8L.js";import"./AlertCircle-Bgzr6uRA.js";import"./Tool01-BscqkhhO.js";import"./ArrowNarrowLeft-ByrdB8Dd.js";import"./ZapSquare-Bz3HDhTc.js";import"./Users03-DwNyb_q2.js";import"./CheckCircle-88bls7UK.js";import"./ChevronUp-D_szSdLd.js";import"./Star01-DZHrISf9.js";import"./Palette-DuWQiO51.js";import"./LinkExternal01-DB08YntP.js";import"./Lock01-dBhVogWg.js";import"./Sun-C8X8gjZW.js";import"./Play-D7pqvkYq.js";import"./Settings02-MyfUtBA4.js";import"./Shield01-CMw4M4Ml.js";import"./User01-VHn0SqBP.js";import"./X-BuUY-erD.js";import"./Zap-BxJkZzJb.js";import"./table-CAUXYO7-.js";import"./avatar-DcLXZkYK.js";import"./use-view-mode-DSeYcON6.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 l=["image","img","avatar","icon","logo","thumbnail","cover"];for(const n of l)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:l,actions:n}=i;let c;e[0]!==s||e[1]!==l?(c=$t(l,s),e[0]=s,e[1]=l,e[2]=c):c=e[2];const r=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]!==r||e[6]!==s.title?(m=t.jsx(Ge,{icon:r,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=r,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 b;e[12]!==u||e[13]!==a?(b=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[u,a]}),e[12]=u,e[13]=a,e[14]=b):b=e[14];let y;e[15]!==m||e[16]!==b?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,b]}),e[15]=m,e[16]=b,e[17]=y):y=e[17];let C;e[18]!==n||e[19]!==o||e[20]!==s?(C=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(Je,{asChild:!0,children:t.jsx(Ce,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Lt,children:t.jsx(Ze,{size:20})})}),t.jsxs(Ye,{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(Xe,{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]=C):C=e[21];let v;return e[22]!==y||e[23]!==C?(v=t.jsxs(gt,{className:"cursor-pointer transition-colors hover:bg-accent/50 h-full flex flex-col group relative",children:[y,C]}),e[22]=y,e[23]=C,e[24]=v):v=e[24],v}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:l,viewMode:n,search:c,sortKey:r,sortDirection:p,onSort:d,actions:o,onItemClick:m,headerActions:u,emptyState:f,readOnly:a,columns:b,hideToolbar:y,sortableFields:C}=i,v=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,x=b===void 0?void 0:b,z=y===void 0?!1:y,P=C===void 0?void 0:C;let D;e[2]!==x||e[3]!==l||e[4]!==P?(D=x?x.filter(Bt).filter(A=>!P||P.includes(A.id)).map(Rt):ot(l,P),e[2]=x,e[3]=l,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]!==v||e[10]!==r||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:r,sortDirection:v,onSort:g,sortOptions:w})})]})}),e[6]=E,e[7]=z,e[8]=g,e[9]=v,e[10]=r,e[11]=w,e[12]=S):S=e[12];let _;e[13]!==h||e[14]!==x||e[15]!==s||e[16]!==N||e[17]!==T||e[18]!==g||e[19]!==k||e[20]!==l||e[21]!==c||e[22]!==v||e[23]!==r||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:l,readOnly:k,actions:h})},A.id))})}):t.jsx(xt,{columns:Ht(x,l,P,h),data:s,sortKey:r,sortDirection:v,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]=x,e[15]=s,e[16]=N,e[17]=T,e[18]=g,e[19]=k,e[20]=l,e[21]=c,e[22]=v,e[23]=r,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(Je,{asChild:!0,children:t.jsx(Ce,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Ze,{size:20})})}),t.jsxs(Ye,{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(Xe,{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||{},l=Object.keys(s).filter(o=>{const m=s[o];return m&&nt(m)}),n=Ut(s),c=[],r=new Set;n&&l.includes(n)&&(c.push(n),r.add(n));const p=["title","description","updated_at","updated_by"];for(const o of p)l.includes(o)&&!r.has(o)&&(c.push(o),r.add(o));const d=l.filter(o=>!r.has(o)&&!Re.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of d)c.push(o),r.add(o);for(const o of Re)l.includes(o)&&!r.has(o)&&(c.push(o),r.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,l){const n=i||Gt(e,s);return n.some(p=>p.id==="actions")?n:Object.keys(l).length>0?[...n,Qt(l)]:n}function Jt(i){const e=oe.c(118),{connectionId:s,org:l,activeCollection:n,onItemClick:c}=i,r=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",b=Tt(s);let y;e[0]!==b||e[1]!==s?(y=b?bt(b):s,e[0]=b,e[1]=s,e[2]=y):y=e[2];const C=y,{org:v}=ze();let g;e[3]!==s||e[4]!==v.id?(g={connectionId:s,orgId:v.id},e[3]=s,e[4]=v.id,e[5]=g):g=e[5];const $=Ve(g),h=It(s,r,$),T=`${s}-${r}`;let E;e[6]!==l||e[7]!==T?(E={namespace:l,resource:T,defaultSortKey:"updated_at"},e[6]=l,e[7]=T,e[8]=E):E=e[8];const{search:N,searchTerm:k,setSearch:x,viewMode:z,setViewMode:P,sortKey:D,sortDirection:w,handleSort:S}=Ct(E);let _;e[9]!==k||e[10]!==w||e[11]!==D?(_={searchTerm:k,sortKey:D,sortDirection:w},e[9]=k,e[10]=w,e[11]=D,e[12]=_):_=e[12];const I=At(s,r,$,_),A=!d&&!o&&!m;let ne;e[13]!==C||e[14]!==r||e[15]!==u||e[16]!==c||e[17]!==l?(ne=j=>{if(c){c(j);return}u({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:l,appSlug:C,collectionName:r,itemId:j.id}})},e[13]=C,e[14]=r,e[15]=u,e[16]=c,e[17]=l,e[18]=ne):ne=e[18];const L=ne;let re;e[19]!==h.create||e[20]!==a?(re=async j=>{const xe=new Date().toISOString();await h.create.mutateAsync({...j,id:Me("conn"),title:`${j.title} (Copy)`,created_at:xe,updated_at:xe,created_by:a,updated_by:a})},e[19]=h.create,e[20]=a,e[21]=re):re=e[21];const be=re,[F,ve]=dt.useState(null);let le;e[22]===Symbol.for("react.memo_cache_sentinel")?(le=j=>{ve(j)},e[22]=le):le=e[22];const rt=le;let K;e[23]!==L||e[24]!==o?(K=o&&{edit:L},e[23]=L,e[24]=o,e[25]=K):K=e[25];let M;e[26]!==be||e[27]!==d?(M=d&&{duplicate:be},e[26]=be,e[27]=d,e[28]=M):M=e[28];let U;e[29]!==m?(U=m&&{delete:rt},e[29]=m,e[30]=U):U=e[30];let ae;e[31]!==M||e[32]!==U||e[33]!==K?(ae={...K,...M,...U},e[31]=M,e[32]=U,e[33]=K,e[34]=ae):ae=e[34];const ye=ae;let ce;e[35]!==h.delete||e[36]!==F?(ce=async()=>{F&&(await h.delete.mutateAsync(F.id),ve(null))},e[35]=h.delete,e[36]=F,e[37]=ce):ce=e[37];const Ne=ce;let de;e[38]!==h.create||e[39]!==C||e[40]!==r||e[41]!==d||e[42]!==u||e[43]!==l||e[44]!==a?(de=async()=>{if(!d){Le.error("Create operation is not available for this collection");return}const j=new Date().toISOString(),xe={id:Me("conn"),title:"New Item",description:"A brief description of the item",created_at:j,updated_at:j,created_by:a,updated_by:a};try{const ke=await h.create.mutateAsync(xe);u({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:l,appSlug:C,collectionName:r,itemId:ke.id}})}catch(ke){console.error("Failed to create item:",ke)}},e[38]=h.create,e[39]=C,e[40]=r,e[41]=d,e[42]=u,e[43]=l,e[44]=a,e[45]=de):de=e[45];const we=de;let ue;e[46]!==p?(ue=ot(p),e[46]=p,e[47]=ue):ue=e[47];const Se=ue,lt=(I?.length??0)>0,at=d&&!lt&&!N;let me;e[48]!==h.create||e[49]!==we||e[50]!==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[48]=h.create,e[49]=we,e[50]=d,e[51]=me):me=e[51];const pe=me,Pe=D;let W;e[52]!==S||e[53]!==w||e[54]!==Se||e[55]!==Pe?(W=t.jsx(Ot,{children:t.jsx(Qe,{sortKey:Pe,sortDirection:w,onSort:S,sortOptions:Se})}),e[52]=S,e[53]=w,e[54]=Se,e[55]=Pe,e[56]=W):W=e[56];const _e=`Search ${r}...`;let R;e[57]!==x?(R=j=>{j.key==="Escape"&&(x(""),j.target.blur())},e[57]=x,e[58]=R):R=e[58];let B;e[59]!==N||e[60]!==x||e[61]!==_e||e[62]!==R?(B=t.jsx("div",{className:"flex-1",children:t.jsx(ht,{value:N,onChange:x,placeholder:_e,onKeyDown:R})}),e[59]=N,e[60]=x,e[61]=_e,e[62]=R,e[63]=B):B=e[63];let V;e[64]!==pe||e[65]!==d?(V=d&&t.jsx("div",{className:"pr-3",children:pe}),e[64]=pe,e[65]=d,e[66]=V):V=e[66];let q;e[67]!==B||e[68]!==V?(q=t.jsxs("div",{className:"flex items-center gap-2",children:[B,V]}),e[67]=B,e[68]=V,e[69]=q):q=e[69];let Q;e[70]!==I?(Q=I??[],e[70]=I,e[71]=Q):Q=e[71];const De=D;let G;e[72]!==L?(G=j=>L(j),e[72]=L,e[73]=G):G=e[73];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[74]!==Ie||e[75]!==Ae||e[76]!==Te?(H=t.jsx(it,{image:null,title:Ie,description:Ae,actions:Te}),e[74]=Ie,e[75]=Ae,e[76]=Te,e[77]=H):H=e[77];let J;e[78]!==S||e[79]!==A||e[80]!==ye||e[81]!==p||e[82]!==N||e[83]!==x||e[84]!==P||e[85]!==w||e[86]!==Q||e[87]!==De||e[88]!==G||e[89]!==H||e[90]!==z?(J=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:x,sortKey:De,sortDirection:w,onSort:S,actions:ye,onItemClick:G,readOnly:A,emptyState:H})}),e[78]=S,e[79]=A,e[80]=ye,e[81]=p,e[82]=N,e[83]=x,e[84]=P,e[85]=w,e[86]=Q,e[87]=De,e[88]=G,e[89]=H,e[90]=z,e[91]=J):J=e[91];let Y;e[92]!==q||e[93]!==J?(Y=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[q,J]}),e[92]=q,e[93]=J,e[94]=Y):Y=e[94];const Ee=!!F;let fe;e[95]===Symbol.for("react.memo_cache_sentinel")?(fe=j=>{j||ve(null)},e[95]=fe):fe=e[95];let he;e[96]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Nt,{children:"Delete item?"}),e[96]=he):he=e[96];const Oe=F?.title;let X;e[97]!==Oe?(X=t.jsxs(wt,{children:[he,t.jsxs(St,{children:['Are you sure you want to delete "',Oe,'"? This action cannot be undone.']})]}),e[97]=Oe,e[98]=X):X=e[98];let Z;e[99]!==h.delete.isPending?(Z=t.jsx(vt,{disabled:h.delete.isPending,children:"Cancel"}),e[99]=h.delete.isPending,e[100]=Z):Z=e[100];const $e=h.delete.isPending?"Deleting...":"Delete";let ee;e[101]!==h.delete.isPending||e[102]!==Ne||e[103]!==$e?(ee=t.jsx(yt,{onClick:Ne,disabled:h.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:$e}),e[101]=h.delete.isPending,e[102]=Ne,e[103]=$e,e[104]=ee):ee=e[104];let te;e[105]!==Z||e[106]!==ee?(te=t.jsxs(Pt,{children:[Z,ee]}),e[105]=Z,e[106]=ee,e[107]=te):te=e[107];let se;e[108]!==X||e[109]!==te?(se=t.jsxs(_t,{children:[X,te]}),e[108]=X,e[109]=te,e[110]=se):se=e[110];let ie;e[111]!==Ee||e[112]!==se?(ie=t.jsx(Dt,{open:Ee,onOpenChange:fe,children:se}),e[111]=Ee,e[112]=se,e[113]=ie):ie=e[113];let ge;return e[114]!==W||e[115]!==Y||e[116]!==ie?(ge=t.jsxs(t.Fragment,{children:[W,Y,ie]}),e[114]=W,e[115]=Y,e[116]=ie,e[117]=ge):ge=e[117],ge}function Yt(){const i=oe.c(12),{org:e,project:s}=ze(),l=ut();let n;i[0]!==e.id?(n={connectionId:qe,orgId:e.id},i[0]=e.id,i[1]=n):n=i[1];const c=Ve(n);let r;i[2]!==c||i[3]!==s?(r=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[2]=c,i[3]=s,i[4]=r):r=i[4];let p;i[5]!==e.id||i[6]!==s||i[7]!==l?(p=()=>{l.invalidateQueries({queryKey:Fe.project(e.id,s.slug)}),l.invalidateQueries({queryKey:Fe.projects(e.id)})},i[5]=e.id,i[6]=s,i[7]=l,i[8]=p):p=i[8];let d;return i[9]!==r||i[10]!==p?(d={mutationFn:r,onSuccess:p,onError:Xt},i[9]=r,i[10]=p,i[11]=d):d=i[11],mt(d)}function Xt(i){Le.error("Failed to enable plugin: "+(i instanceof Error?i.message:"Unknown error"))}function Zt(i){const e=oe.c(12),{pluginId:s,title:l,description:n,icon:c}=i,r=Yt();let p;e[0]!==r||e[1]!==s?(p=async()=>{try{await r.mutateAsync(s),Le.success("Plugin enabled!")}catch{}},e[0]=r,e[1]=s,e[2]=p):p=e[2];const d=p,o=c??null,m=r.isPending?"Enabling…":"Enable plugin";let u;e[3]!==r.isPending||e[4]!==d||e[5]!==m?(u=t.jsx(Ce,{onClick:d,disabled:r.isPending,children:m}),e[3]=r.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]!==l?(f=t.jsx(it,{image:o,title:l,description:n,actions:u}),e[7]=n,e[8]=o,e[9]=u,e[10]=l,e[11]=f):f=e[11],f}const es={name:"WORKFLOW",displayName:"Workflow",hasCreateTool:!0,hasUpdateTool:!0,hasDeleteTool:!0};function ii(){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(Zt,{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(Jt,{connectionId:qe,org:e.slug,activeCollection:es,onItemClick:c=>n({to:"/$org/settings/workflows/$itemId",params:{org:e.slug,itemId:c.id}})})})})}export{ii as default};