@xopcai/xopc 0.0.143 → 0.0.145

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 (259) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/Combination-DolwnuKi.js +41 -0
  4. package/dist/gateway/static/root/assets/{activity-center-store-jITiX2vJ.js → activity-center-store-3l9ahUqb.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DiME9u_P.js → agent-avatar-dicebear-BEUxdhZx.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-1bpT0xRO.js +2 -0
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-CRHSZJWi.js +1 -0
  8. package/dist/gateway/static/root/assets/{appearance-settings-DUfdNQqk.js → appearance-settings-BunADYJb.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-Cc4JgVUQ.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-B-Qk6cGr.js → archive-plugin-B6vTkH2A.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-Di6EEbQX.js → attachment-load-BjZXzaNv.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-DGxvRxtO.js → automation-suggestion-card-ZDA-Stg1.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-page-mb0fdVpq.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-ZaOZDH2I.js → binary-plugins-DYZfLvPz.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-BTFhjWfg.js → block-editor-C3MUlYC9.js} +46 -46
  16. package/dist/gateway/static/root/assets/browser-settings-page-Bb0xhaMN.js +8 -0
  17. package/dist/gateway/static/root/assets/capability-presets-api-BV76yN9a.js +1 -0
  18. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CUcGKZqC.js +2 -0
  19. package/dist/gateway/static/root/assets/channel-recipient-api-fTlTnWB4.js +1 -0
  20. package/dist/gateway/static/root/assets/channels-settings-BlSDMGdy.js +1 -0
  21. package/dist/gateway/static/root/assets/channels-status-swr-CJauF1CW.js +1 -0
  22. package/dist/gateway/static/root/assets/{code-editor--tMO38Tr.js → code-editor-D4_k-6QN.js} +1 -1
  23. package/dist/gateway/static/root/assets/connector-logo-BVFNT2zW.js +1 -0
  24. package/dist/gateway/static/root/assets/connectors-page-CMgAFGvb.js +2 -0
  25. package/dist/gateway/static/root/assets/copy-to-clipboard-HOJ79TWv.js +1 -0
  26. package/dist/gateway/static/root/assets/{desktop-pet---yzVxVR.js → desktop-pet-_jUmoXd3.js} +1 -1
  27. package/dist/gateway/static/root/assets/{desktop-pet-settings-Dc3gqBJE.js → desktop-pet-settings-DwGOy4AQ.js} +1 -1
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-DCmOGLtK.js → directory-picker-path-field-akvF0F-u.js} +1 -1
  29. package/dist/gateway/static/root/assets/dist-C99RGfAH.js +1 -0
  30. package/dist/gateway/static/root/assets/dreaming-settings-BLetQiYY.js +3 -0
  31. package/dist/gateway/static/root/assets/{extension-debug-page-ByaKTTq4.js → extension-debug-page-Cof2ncxE.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-BmRzHAZr.js → extension-page-CwWktRNz.js} +1 -1
  33. package/dist/gateway/static/root/assets/extension-settings-page-CuggWOIl.js +1 -0
  34. package/dist/gateway/static/root/assets/gateway-config-api-B7sxIbza.js +1 -0
  35. package/dist/gateway/static/root/assets/gateway-settings-DIv0eKMf.js +1 -0
  36. package/dist/gateway/static/root/assets/gateway-startup-retry-DtoLihQE.js +1 -0
  37. package/dist/gateway/static/root/assets/goal-create-dialog-C4Kw0mfS.js +1 -0
  38. package/dist/gateway/static/root/assets/goal-detail-page-BMmzYpZL.js +4 -0
  39. package/dist/gateway/static/root/assets/goals-config-api-B0jm5JaA.js +1 -0
  40. package/dist/gateway/static/root/assets/goals-page-CGeT77PC.js +2 -0
  41. package/dist/gateway/static/root/assets/goals-settings-N5_iL7es.js +1 -0
  42. package/dist/gateway/static/root/assets/heartbeat-settings-XzH3lbRR.js +1 -0
  43. package/dist/gateway/static/root/assets/{html-workspace-editor-COqmtESs.js → html-workspace-editor-C3DKAkMc.js} +1 -1
  44. package/dist/gateway/static/root/assets/index-CSLF84-Q.css +1 -0
  45. package/dist/gateway/static/root/assets/index-I-ZCenVw.js +259 -0
  46. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-x_v0nrIi.js +1 -0
  47. package/dist/gateway/static/root/assets/locale-store-CiM-D9jA.js +1 -0
  48. package/dist/gateway/static/root/assets/logs-page-BSh1t8cD.js +7 -0
  49. package/dist/gateway/static/root/assets/markdown-editor-BvUebh3C.js +2 -0
  50. package/dist/gateway/static/root/assets/{markdown-split-Dw-yE2-y.js → markdown-split-5rJx5flj.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-D9NNNUgE.js → media-plugins-DYXccwAd.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-Cb1VMeqP.js +5 -0
  53. package/dist/gateway/static/root/assets/models-hub-panel-BNpTenAI.js +2 -0
  54. package/dist/gateway/static/root/assets/{notes-page-CRgbJGgk.js → notes-page-BgLyndCO.js} +1 -1
  55. package/dist/gateway/static/root/assets/notes-workbench-teklkhcE.js +4 -0
  56. package/dist/gateway/static/root/assets/{page-tabs-D4hkWVt_.js → page-tabs-6Al9_sGz.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-CIckv0uy.js → preview-open-alternatives-Cm3G72Hv.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-CCB_dKoh.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-VOAFAHYj.js +1 -0
  60. package/dist/gateway/static/root/assets/remote-access-hub-USYu64Ru.js +1 -0
  61. package/dist/gateway/static/root/assets/{save-bar-controls-B0b42kB2.js → save-bar-controls-BYtfzu_F.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schedule-field-BtjEkczK.js → schedule-field-CvIRc6yK.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schema-form-Bf0bk3i6.js → schema-form-CQuKx0n7.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-oGC8O5h_.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-D4rP66R1.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-collapsible-section-BTKTdTNX.js → settings-collapsible-section-CF3HHM-t.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-form-section-DL4P0sAj.js → settings-form-section-CwWjoRN6.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BV6KFNj4.js → settings-loading-skeleton-aUFmJa13.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-B_4DsX5W.js → settings-page-B2UUU9TF.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-layout-CyGlrInB.js → settings-page-layout-DqpbTWqI.js} +1 -1
  71. package/dist/gateway/static/root/assets/setup-status-panel-Ck9keROI.js +1 -0
  72. package/dist/gateway/static/root/assets/share-preview-page-BOhlPsS1.js +2 -0
  73. package/dist/gateway/static/root/assets/shares-settings-BYLsCuqj.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-BNHUyVML.js +1 -0
  75. package/dist/gateway/static/root/assets/skills-page-CpXbQH4n.js +2 -0
  76. package/dist/gateway/static/root/assets/{system-settings-panel-D85fBBuI.js → system-settings-panel-CWxSvuwD.js} +1 -1
  77. package/dist/gateway/static/root/assets/{theme-store-Bt6vAkSB.js → theme-store-C9Dxcppm.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib-CwEuYrHX.js → typed-models-lib-qROAvqTw.js} +1 -1
  79. package/dist/gateway/static/root/assets/use-channel-catalog-DE9cpn4G.js +1 -0
  80. package/dist/gateway/static/root/assets/user-context-page-DbNEK4Yp.js +1 -0
  81. package/dist/gateway/static/root/assets/user-profile-fields-editor-CWxc0ghP.js +1 -0
  82. package/dist/gateway/static/root/assets/{user-profile-settings-panel-CWM0fEpb.js → user-profile-settings-panel-DW-Up6vt.js} +1 -1
  83. package/dist/gateway/static/root/assets/{utils--BO6xT3u.js → utils-D53uRXVr.js} +1 -1
  84. package/dist/gateway/static/root/assets/{vendor-codemirror-C1WKjCk5.js → vendor-codemirror--gTq3YAI.js} +17 -17
  85. package/dist/gateway/static/root/assets/voice-api-key-field-Cs7MOrg0.js +1 -0
  86. package/dist/gateway/static/root/assets/work-item-detail-page-D1ziG1Pp.js +1 -0
  87. package/dist/gateway/static/root/assets/workflow-run-setup-panel-D_x9ELJp.js +3 -0
  88. package/dist/gateway/static/root/assets/workflows-page-DHGV_n6i.js +11 -0
  89. package/dist/gateway/static/root/index.html +10 -10
  90. package/dist/package.js +1 -1
  91. package/dist/src/agent/embedded/session-runner.js +3 -3
  92. package/dist/src/agent/embedded/session-runner.js.map +1 -1
  93. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +3 -1
  94. package/dist/src/agent/embedded/xopc-auth-storage.js +11 -1
  95. package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
  96. package/dist/src/agent/memory/dreaming/config.js +1 -1
  97. package/dist/src/agent-runtime/index.js +1 -1
  98. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  99. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  100. package/dist/src/config/agent-profile.js +1 -1
  101. package/dist/src/config/index.js +2 -2
  102. package/dist/src/config/schema.d.ts +60 -5
  103. package/dist/src/config/schema.js +30 -9
  104. package/dist/src/config/schema.js.map +1 -1
  105. package/dist/src/connectors/composio-catalog.js +11 -2
  106. package/dist/src/connectors/composio-catalog.js.map +1 -1
  107. package/dist/src/connectors/connector-memory-sync.js +135 -26
  108. package/dist/src/connectors/connector-memory-sync.js.map +1 -1
  109. package/dist/src/gateway/agents-admin.js +1 -1
  110. package/dist/src/gateway/heartbeat/service.js +1 -1
  111. package/dist/src/gateway/hono/app.js +1 -1
  112. package/dist/src/gateway/hono/app.js.map +1 -1
  113. package/dist/src/gateway/hono/lib/config-payload.d.ts +11 -0
  114. package/dist/src/gateway/hono/lib/config-payload.js +1 -0
  115. package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
  116. package/dist/src/gateway/hono/routes/config-patch/misc.js +6 -1
  117. package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
  118. package/dist/src/gateway/hono/routes/memory.js +11 -1
  119. package/dist/src/gateway/hono/routes/memory.js.map +1 -1
  120. package/dist/src/gateway/hono/routes/status.js +3 -0
  121. package/dist/src/gateway/hono/routes/status.js.map +1 -1
  122. package/dist/src/gateway/hono/routes/voice.d.ts +5 -5
  123. package/dist/src/gateway/hono/routes/voice.js +288 -62
  124. package/dist/src/gateway/hono/routes/voice.js.map +1 -1
  125. package/dist/src/gateway/hono/routes/you.js +5 -1
  126. package/dist/src/gateway/hono/routes/you.js.map +1 -1
  127. package/dist/src/gateway/service.d.ts +8 -0
  128. package/dist/src/gateway/service.js +41 -11
  129. package/dist/src/gateway/service.js.map +1 -1
  130. package/dist/src/heartbeat/index.js +1 -1
  131. package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +21 -0
  132. package/dist/src/knowledge/connected-knowledge-pipeline.js +267 -0
  133. package/dist/src/knowledge/connected-knowledge-pipeline.js.map +1 -0
  134. package/dist/src/knowledge/coordinator.d.ts +10 -0
  135. package/dist/src/knowledge/coordinator.js +52 -0
  136. package/dist/src/knowledge/coordinator.js.map +1 -0
  137. package/dist/src/knowledge/index.d.ts +2 -0
  138. package/dist/src/knowledge/index.js +3 -1
  139. package/dist/src/knowledge/ingestion-service.d.ts +7 -1
  140. package/dist/src/knowledge/ingestion-service.js +28 -0
  141. package/dist/src/knowledge/ingestion-service.js.map +1 -1
  142. package/dist/src/knowledge/types.d.ts +18 -0
  143. package/dist/src/media-understanding/audio-transcription-runner.js +5 -3
  144. package/dist/src/media-understanding/audio-transcription-runner.js.map +1 -1
  145. package/dist/src/media-understanding/runner.js +8 -3
  146. package/dist/src/media-understanding/runner.js.map +1 -1
  147. package/dist/src/media-understanding/types.d.ts +7 -0
  148. package/dist/src/storage/sqlite/index.d.ts +1 -1
  149. package/dist/src/storage/sqlite/index.js +2 -2
  150. package/dist/src/storage/sqlite/knowledge-repository.d.ts +26 -1
  151. package/dist/src/storage/sqlite/knowledge-repository.js +120 -6
  152. package/dist/src/storage/sqlite/knowledge-repository.js.map +1 -1
  153. package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +47 -0
  154. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  155. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  156. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  157. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  158. package/dist/src/storage/sqlite/schema.js +1 -1
  159. package/dist/src/user-context/projection.d.ts +13 -4
  160. package/dist/src/user-context/projection.js +19 -7
  161. package/dist/src/user-context/projection.js.map +1 -1
  162. package/dist/src/voice/language-profile.d.ts +20 -0
  163. package/dist/src/voice/language-profile.js +156 -0
  164. package/dist/src/voice/language-profile.js.map +1 -0
  165. package/dist/src/voice/local/model-files.d.ts +14 -0
  166. package/dist/src/voice/local/model-files.js +94 -0
  167. package/dist/src/voice/local/model-files.js.map +1 -0
  168. package/dist/src/voice/local/model-manager.d.ts +18 -0
  169. package/dist/src/voice/local/model-manager.js +135 -0
  170. package/dist/src/voice/local/model-manager.js.map +1 -0
  171. package/dist/src/voice/local/models.d.ts +28 -0
  172. package/dist/src/voice/local/models.js +101 -0
  173. package/dist/src/voice/local/models.js.map +1 -0
  174. package/dist/src/voice/local/runtime-client.d.ts +26 -0
  175. package/dist/src/voice/local/runtime-client.js +166 -0
  176. package/dist/src/voice/local/runtime-client.js.map +1 -0
  177. package/dist/src/voice/local/runtime-dispatcher.d.ts +9 -0
  178. package/dist/src/voice/local/runtime-dispatcher.js +22 -0
  179. package/dist/src/voice/local/runtime-dispatcher.js.map +1 -0
  180. package/dist/src/voice/local/runtime-worker.d.ts +1 -0
  181. package/dist/src/voice/local/runtime-worker.js +249 -0
  182. package/dist/src/voice/local/runtime-worker.js.map +1 -0
  183. package/dist/src/voice/local/wav.d.ts +6 -0
  184. package/dist/src/voice/local/wav.js +69 -0
  185. package/dist/src/voice/local/wav.js.map +1 -0
  186. package/dist/src/voice/metadata/builtin.js +46 -0
  187. package/dist/src/voice/metadata/builtin.js.map +1 -1
  188. package/dist/src/voice/stt/factory.js +8 -2
  189. package/dist/src/voice/stt/factory.js.map +1 -1
  190. package/dist/src/voice/stt/providers/alibaba-transcription.js +14 -8
  191. package/dist/src/voice/stt/providers/alibaba-transcription.js.map +1 -1
  192. package/dist/src/voice/stt/providers/index.d.ts +1 -0
  193. package/dist/src/voice/stt/providers/index.js +2 -1
  194. package/dist/src/voice/stt/providers/local-transcription.d.ts +2 -0
  195. package/dist/src/voice/stt/providers/local-transcription.js +51 -0
  196. package/dist/src/voice/stt/providers/local-transcription.js.map +1 -0
  197. package/dist/src/voice/stt/providers/openai-transcription.js +5 -3
  198. package/dist/src/voice/stt/providers/openai-transcription.js.map +1 -1
  199. package/dist/src/voice/stt/transcribe-core.js +5 -4
  200. package/dist/src/voice/stt/transcribe-core.js.map +1 -1
  201. package/dist/src/voice/stt/types.d.ts +4 -0
  202. package/dist/src/voice/stt/types.js +5 -4
  203. package/dist/src/voice/stt/types.js.map +1 -1
  204. package/dist/src/voice/tts/providers/edge-speech.js +2 -2
  205. package/dist/src/voice/tts/providers/edge-speech.js.map +1 -1
  206. package/dist/src/voice/tts/types.js +3 -3
  207. package/dist/src/voice/tts/types.js.map +1 -1
  208. package/package.json +4 -2
  209. package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +0 -41
  210. package/dist/gateway/static/root/assets/agents-DzBXhZXO.js +0 -2
  211. package/dist/gateway/static/root/assets/app-management-settings-panel-Cuo7SbUP.js +0 -1
  212. package/dist/gateway/static/root/assets/apps-page-CKuKK5AU.js +0 -1
  213. package/dist/gateway/static/root/assets/automations-page-D-FF_WKV.js +0 -4
  214. package/dist/gateway/static/root/assets/browser-settings-page-BvKLdEQt.js +0 -8
  215. package/dist/gateway/static/root/assets/capability-presets-api-BU-pVZiZ.js +0 -1
  216. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DgyeEwzh.js +0 -2
  217. package/dist/gateway/static/root/assets/channel-recipient-api-DuulnhIj.js +0 -1
  218. package/dist/gateway/static/root/assets/channels-settings-BbVsdD_I.js +0 -1
  219. package/dist/gateway/static/root/assets/channels-status-swr-B5lVrUsN.js +0 -1
  220. package/dist/gateway/static/root/assets/connectors-page-B8QqVy3I.js +0 -2
  221. package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +0 -1
  222. package/dist/gateway/static/root/assets/dreaming-settings-BgT5KZVe.js +0 -3
  223. package/dist/gateway/static/root/assets/extension-settings-page-JUtwIhbF.js +0 -1
  224. package/dist/gateway/static/root/assets/fetch-8QNN25Sh.js +0 -1
  225. package/dist/gateway/static/root/assets/gateway-config-api-CxicF50_.js +0 -1
  226. package/dist/gateway/static/root/assets/gateway-settings-Bz2I_EO5.js +0 -1
  227. package/dist/gateway/static/root/assets/gateway-startup-retry-5YBnS9Fj.js +0 -1
  228. package/dist/gateway/static/root/assets/goal-create-dialog-VcoyuZGN.js +0 -1
  229. package/dist/gateway/static/root/assets/goal-detail-page-Cilkap2G.js +0 -4
  230. package/dist/gateway/static/root/assets/goals-config-api-CwcHRdC0.js +0 -1
  231. package/dist/gateway/static/root/assets/goals-page-C6eoni4z.js +0 -2
  232. package/dist/gateway/static/root/assets/goals-settings-o4i-qAOS.js +0 -1
  233. package/dist/gateway/static/root/assets/heartbeat-settings-DQQkETX8.js +0 -1
  234. package/dist/gateway/static/root/assets/index-BKRqeRHm.js +0 -257
  235. package/dist/gateway/static/root/assets/index-CphxClbs.css +0 -1
  236. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-LT6qB-ua.js +0 -1
  237. package/dist/gateway/static/root/assets/locale-store-Ba72bFmP.js +0 -1
  238. package/dist/gateway/static/root/assets/logs-page-Dli2e3fS.js +0 -7
  239. package/dist/gateway/static/root/assets/markdown-editor-jD1LPiP-.js +0 -2
  240. package/dist/gateway/static/root/assets/messages-CzKxM6I4.js +0 -5
  241. package/dist/gateway/static/root/assets/models-hub-panel-DVn2Q1Ik.js +0 -2
  242. package/dist/gateway/static/root/assets/notes-workbench-BxZRHLWx.js +0 -2
  243. package/dist/gateway/static/root/assets/project-detail-page-Doz53xLn.js +0 -1
  244. package/dist/gateway/static/root/assets/projects-page-DoMtcRLg.js +0 -1
  245. package/dist/gateway/static/root/assets/remote-access-hub-BeHVEgrm.js +0 -1
  246. package/dist/gateway/static/root/assets/sessions-page-Bk4bQsBe.js +0 -1
  247. package/dist/gateway/static/root/assets/settings-advanced-gate-DdFyaRMm.js +0 -1
  248. package/dist/gateway/static/root/assets/setup-status-panel-DJ1_MLgX.js +0 -1
  249. package/dist/gateway/static/root/assets/share-preview-page-BQBV7YrV.js +0 -2
  250. package/dist/gateway/static/root/assets/shares-settings-0VuFLBeU.js +0 -1
  251. package/dist/gateway/static/root/assets/skill-reload-api-DO87Ckeo.js +0 -1
  252. package/dist/gateway/static/root/assets/skills-page-D3VdtxAn.js +0 -2
  253. package/dist/gateway/static/root/assets/use-channel-catalog-COXIfXcl.js +0 -1
  254. package/dist/gateway/static/root/assets/user-context-page-m9JVQ73F.js +0 -1
  255. package/dist/gateway/static/root/assets/user-profile-fields-editor-DtQiuY7E.js +0 -1
  256. package/dist/gateway/static/root/assets/voice-api-key-field-LoT3wgZ9.js +0 -1
  257. package/dist/gateway/static/root/assets/work-item-detail-page-DSTMz_mO.js +0 -1
  258. package/dist/gateway/static/root/assets/workflow-run-setup-panel-B35lJzvm.js +0 -3
  259. package/dist/gateway/static/root/assets/workflows-page-BfSm9oR8.js +0 -11
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-CzKxM6I4.js";import{a as s}from"./fetch-8QNN25Sh.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Bs as u,Co as d,Hs as f,Jo as p,Lo as m,Ml as h,Ms as g,So as _,Wo as v,Yc as y,ao as b,as as x,bo as S,co as C,io as w,lo as T,nl as E,oo as D,qo as O,so as k,uo as A,vo as j,wc as M,xo as N,xs as ee,yr as te}from"./index-BKRqeRHm.js";import{n as P,t as ne}from"./settings-page-layout-CyGlrInB.js";import{n as re,t as F}from"./settings-loading-skeleton-BV6KFNj4.js";import{n as I,t as L}from"./settings-form-section-DL4P0sAj.js";import{a as ie,i as ae,o as R,t as z}from"./typed-models-lib-CwEuYrHX.js";import{a as oe,i as se,n as ce,o as le,r as ue,s as de,t as fe}from"./capability-presets-api-BU-pVZiZ.js";var B=e(t(),1),V=n(),H=r();function pe(e){let t=(0,V.c)(34),{extendsIds:n,onExtendsChange:r,presetOptions:i,jsonFields:a,onJsonFieldsChange:o,disabled:s,labels:c}=e,l;t[0]===a?l=t[1]:(l=Object.keys(a),t[0]=a,t[1]=l);let u=l,d;t[2]===c.inheritanceTitle?d=t[3]:(d=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.inheritanceTitle}),t[2]=c.inheritanceTitle,t[3]=d);let f;t[4]===c.inheritanceHint?f=t[5]:(f=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.inheritanceHint}),t[4]=c.inheritanceHint,t[5]=f);let p;t[6]!==s||t[7]!==n||t[8]!==c.inheritanceEmpty||t[9]!==r||t[10]!==i?(p=i.length>0?(0,H.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=n.includes(e.id);return(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:s,onChange:()=>r(t?n.filter(t=>t!==e.id):[...n,e.id])}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,H.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-fg-subtle`,children:e.id})]})]},e.id)})}):(0,H.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:c.inheritanceEmpty}),t[6]=s,t[7]=n,t[8]=c.inheritanceEmpty,t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`section`,{children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c.jsonTitle?h=t[17]:(h=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:c.jsonTitle}),t[16]=c.jsonTitle,t[17]=h);let g;t[18]===c.jsonHint?g=t[19]:(g=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c.jsonHint}),t[18]=c.jsonHint,t[19]=g);let _;t[20]!==s||t[21]!==u||t[22]!==a||t[23]!==c.fieldHints||t[24]!==c.fieldLabels||t[25]!==o?(_=(0,H.jsx)(`div`,{className:`mt-3 grid gap-4 lg:grid-cols-2`,children:u.map(e=>(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:c.fieldLabels[e]}),(0,H.jsx)(`span`,{className:`min-h-8 text-xs leading-relaxed text-fg-muted`,children:c.fieldHints[e]}),(0,H.jsx)(`textarea`,{className:`min-h-36 resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 font-mono text-xs leading-relaxed text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:a[e],disabled:s,spellCheck:!1,placeholder:`{}`,onChange:t=>o({...a,[e]:t.target.value})})]},e))}),t[20]=s,t[21]=u,t[22]=a,t[23]=c.fieldHints,t[24]=c.fieldLabels,t[25]=o,t[26]=_):_=t[26];let v;t[27]!==h||t[28]!==g||t[29]!==_?(v=(0,H.jsxs)(`section`,{children:[h,g,_]}),t[27]=h,t[28]=g,t[29]=_,t[30]=v):v=t[30];let y;return t[31]!==m||t[32]!==v?(y=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,v]}),t[31]=m,t[32]=v,t[33]=y):y=t[33],y}function U(e){return e.name||e.directoryId}function me(e){let t=(0,V.c)(56),{mode:n,selected:r,catalog:i,loading:o,disabled:s,onModeChange:c,onSelectedChange:l,labels:u}=e,d=n===`allowlist`||n===`denylist`,f;t[0]===i?f=t[1]:(f=i.map(U).filter(Boolean),t[0]=i,t[1]=f);let p=f,m;bb0:{if(n===`inherit`){m=u.inheritSummary;break bb0}if(n===`all`){m=u.allSummary;break bb0}if(n===`off`){m=u.offSummary;break bb0}let e=n===`allowlist`?u.allowSummary:u.denySummary,i;t[2]!==r.size||t[3]!==e?(i=e.replace(`{{count}}`,String(r.size)),t[2]=r.size,t[3]=e,t[4]=i):i=t[4],m=i}let g=m,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,H.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[5]=_):_=t[5];let y;t[6]===u.overrideSummaryTitle?y=t[7]:(y=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[_,u.overrideSummaryTitle]}),t[6]=u.overrideSummaryTitle,t[7]=y);let b;t[8]===g?b=t[9]:(b=(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:g}),t[8]=g,t[9]=b);let x;t[10]!==y||t[11]!==b?(x=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[y,b]}),t[10]=y,t[11]=b,t[12]=x):x=t[12];let S;t[13]===u.modeLabel?S=t[14]:(S=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.modeLabel}),t[13]=u.modeLabel,t[14]=S);let C;t[15]===u.modeInherit?C=t[16]:(C=[`inherit`,u.modeInherit],t[15]=u.modeInherit,t[16]=C);let w;t[17]===u.modeAll?w=t[18]:(w=[`all`,u.modeAll],t[17]=u.modeAll,t[18]=w);let T;t[19]===u.modeAllowlist?T=t[20]:(T=[`allowlist`,u.modeAllowlist],t[19]=u.modeAllowlist,t[20]=T);let E;t[21]===u.modeDenylist?E=t[22]:(E=[`denylist`,u.modeDenylist],t[21]=u.modeDenylist,t[22]=E);let D;t[23]===u.modeOff?D=t[24]:(D=[`off`,u.modeOff],t[23]=u.modeOff,t[24]=D);let O;t[25]!==E||t[26]!==D||t[27]!==C||t[28]!==w||t[29]!==T?(O=[C,w,T,E,D],t[25]=E,t[26]=D,t[27]=C,t[28]=w,t[29]=T,t[30]=O):O=t[30];let k=O,A;t[31]!==s||t[32]!==n||t[33]!==c||t[34]!==k?(A=(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.map(e=>{let[t,r]=e;return(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,n===t?`bg-accent-soft text-accent-fg`:`bg-surface-panel text-fg hover:bg-surface-hover/55`),disabled:s,onClick:()=>c(t),children:r},t)})}),t[31]=s,t[32]=n,t[33]=c,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==A||t[37]!==S?(j=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,A]}),t[36]=A,t[37]=S,t[38]=j):j=t[38];let M;t[39]!==i||t[40]!==p||t[41]!==s||t[42]!==u.emptyCatalog||t[43]!==u.noDescription||t[44]!==u.quickActionsLabel||t[45]!==u.quickClear||t[46]!==u.quickSelectAll||t[47]!==o||t[48]!==l||t[49]!==d||t[50]!==r?(M=d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:u.quickActionsLabel}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:s||o||p.length===0,onClick:()=>l(new Set(p)),children:u.quickSelectAll}),(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:s||o||r.size===0,onClick:()=>l(new Set),children:u.quickClear})]})]}),o?(0,H.jsx)(F,{rows:3}):i.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.emptyCatalog}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:i.map(e=>{let t=U(e),n=r.has(t),i=typeof e.description==`string`?e.description.trim():``,o=i||u.noDescription;return(0,H.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,H.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:n,disabled:s,onChange:()=>{let e=new Set(r);n?e.delete(t):e.add(t),l(e)},"aria-label":t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,H.jsx)(`p`,{className:a(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!i&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})]}):null,t[39]=i,t[40]=p,t[41]=s,t[42]=u.emptyCatalog,t[43]=u.noDescription,t[44]=u.quickActionsLabel,t[45]=u.quickClear,t[46]=u.quickSelectAll,t[47]=o,t[48]=l,t[49]=d,t[50]=r,t[51]=M):M=t[51];let N;return t[52]!==j||t[53]!==M||t[54]!==x?(N=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[x,j,M]}),t[52]=j,t[53]=M,t[54]=x,t[55]=N):N=t[55],N}var W=[`write_file`,`apply_patch`,`exec_command`,`execute_code`],G=[`exec_command`,`execute_code`,`automation`,`extensions`,`bundle-mcp`,`skill_manage`],K=[`send_message`,`send_media`,`text_to_speech`,`create_share`],he=[`read_file`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`,`web_extract`],ge=[...W,...K],q=[`read_file`,`write_file`,`apply_patch`,`list_dir`,`grep`,`find`,`web_search`,`web_fetch`],_e=[`send_message`,`send_media`];function ve(e,t){let n={};for(let[r,i]of t)for(let t of r)e.has(t)&&(n[t]={mode:i});return n}function ye(e){let t=(0,V.c)(105),{builtinToolIds:n,toolPolicies:r,onChange:i,disabled:o,getToolDescription:s,getGroupTitle:c,labels:l}=e,u;t[0]===n?u=t[1]:(u=new Set(n),t[0]=n,t[1]=u);let d=u,f;t[2]!==d||t[3]!==r?(f=Object.entries(r).filter(e=>{let[t]=e;return d.has(t)}).toSorted(be),t[2]=d,t[3]=r,t[4]=f):f=t[4];let p=f,m;if(t[5]!==d||t[6]!==n){m=[];for(let e of oe){let t=e.toolIds.filter(e=>d.has(e));t.length>0&&m.push({key:e.key,ids:[...t]})}let e;t[8]===n?e=t[9]:(e=le(n),t[8]=n,t[9]=e);let r=e;if(r.length>0){let e;t[10]===r?e=t[11]:(e={key:`misc`,ids:r},t[10]=r,t[11]=e),m.push(e)}t[5]=d,t[6]=n,t[7]=m}else m=t[7];let h=m,g;t[12]!==i||t[13]!==r?(g=(e,t)=>{let n={...r};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},i(n)},t[12]=i,t[13]=r,t[14]=g):g=t[14];let _=g,y;t[15]!==i||t[16]!==r?(y=(e,t)=>{let n=r[e];n&&i({...r,[e]:t(n)})},t[15]=i,t[16]=r,t[17]=y):y=t[17];let b=y,x;t[18]!==d||t[19]!==i?(x=e=>{i(ve(d,e))},t[18]=d,t[19]=i,t[20]=x):x=t[20];let C=x;if(n.length===0){let e;return t[21]===l.emptyBuiltin?e=t[22]:(e=(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l.emptyBuiltin}),t[21]=l.emptyBuiltin,t[22]=e),e}let w;t[23]===l.quickActionsLabel?w=t[24]:(w=(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:l.quickActionsLabel}),t[23]=l.quickActionsLabel,t[24]=w);let T;t[25]===i?T=t[26]:(T=()=>i({}),t[25]=i,t[26]=T);let E;t[27]!==o||t[28]!==l.quickClearOverrides||t[29]!==T?(E=(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:T,children:l.quickClearOverrides}),t[27]=o,t[28]=l.quickClearOverrides,t[29]=T,t[30]=E):E=t[30];let D;t[31]===C?D=t[32]:(D=()=>C([[W,`deny`]]),t[31]=C,t[32]=D);let O;t[33]!==o||t[34]!==l.quickReadOnlyWorkspace||t[35]!==D?(O=(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:D,children:l.quickReadOnlyWorkspace}),t[33]=o,t[34]=l.quickReadOnlyWorkspace,t[35]=D,t[36]=O):O=t[36];let k;t[37]===C?k=t[38]:(k=()=>C([[G,`deny`]]),t[37]=C,t[38]=k);let A;t[39]!==o||t[40]!==l.quickHighRiskOff||t[41]!==k?(A=(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:k,children:l.quickHighRiskOff}),t[39]=o,t[40]=l.quickHighRiskOff,t[41]=k,t[42]=A):A=t[42];let M;t[43]===C?M=t[44]:(M=()=>C([[K,`deny`]]),t[43]=C,t[44]=M);let N;t[45]!==o||t[46]!==l.quickNoOutbound||t[47]!==M?(N=(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:M,children:l.quickNoOutbound}),t[45]=o,t[46]=l.quickNoOutbound,t[47]=M,t[48]=N):N=t[48];let ee;t[49]===C?ee=t[50]:(ee=()=>C([[he,`allow`],[ge,`deny`]]),t[49]=C,t[50]=ee);let te;t[51]!==o||t[52]!==l.quickResearchMode||t[53]!==ee?(te=(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:ee,children:l.quickResearchMode}),t[51]=o,t[52]=l.quickResearchMode,t[53]=ee,t[54]=te):te=t[54];let P;t[55]===C?P=t[56]:(P=()=>C([[q,`allow`],[_e,`deny`]]),t[55]=C,t[56]=P);let ne;t[57]!==o||t[58]!==l.quickCodingMode||t[59]!==P?(ne=(0,H.jsx)(v,{type:`button`,variant:`secondary`,className:R,disabled:o,onClick:P,children:l.quickCodingMode}),t[57]=o,t[58]=l.quickCodingMode,t[59]=P,t[60]=ne):ne=t[60];let re;t[61]!==A||t[62]!==N||t[63]!==te||t[64]!==ne||t[65]!==E||t[66]!==O?(re=(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E,O,A,N,te,ne]}),t[61]=A,t[62]=N,t[63]=te,t[64]=ne,t[65]=E,t[66]=O,t[67]=re):re=t[67];let F;t[68]!==re||t[69]!==w?(F=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[w,re]}),t[68]=re,t[69]=w,t[70]=F):F=t[70];let I;t[71]===l.overrideSummaryTitle?I=t[72]:(I=(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:l.overrideSummaryTitle}),t[71]=l.overrideSummaryTitle,t[72]=I);let L;t[73]!==l.modeAllow||t[74]!==l.modeConfirm||t[75]!==l.modeDeny||t[76]!==l.noOverrides||t[77]!==p?(L=p.length>0?(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:p.map(e=>{let[t,n]=e;return(0,H.jsxs)(`span`,{className:a(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[11px]`,n.mode===`deny`&&`border-red-500/25 bg-red-500/10 text-red-700 dark:text-red-300`,n.mode===`confirm`&&`border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300`,n.mode===`allow`&&`border-accent/25 bg-accent/10 text-accent`),children:[t,(0,H.jsx)(`span`,{className:`font-sans opacity-80`,children:n.mode===`allow`?l.modeAllow:n.mode===`confirm`?l.modeConfirm:l.modeDeny})]},t)})}):(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.noOverrides}),t[73]=l.modeAllow,t[74]=l.modeConfirm,t[75]=l.modeDeny,t[76]=l.noOverrides,t[77]=p,t[78]=L):L=t[78];let ie;t[79]!==I||t[80]!==L?(ie=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[I,L]}),t[79]=I,t[80]=L,t[81]=ie):ie=t[81];let ae;t[82]!==o||t[83]!==c||t[84]!==s||t[85]!==h||t[86]!==l.inheritedMode||t[87]!==l.maxCallsLabel||t[88]!==l.modeAllow||t[89]!==l.modeConfirm||t[90]!==l.modeDeny||t[91]!==l.scopeInherit||t[92]!==l.scopeLabel||t[93]!==l.scopeReadonly||t[94]!==l.scopeUnrestricted||t[95]!==l.scopeWorkspace||t[96]!==l.timeoutLabel||t[97]!==_||t[98]!==r||t[99]!==b?(ae=(0,H.jsx)(`div`,{className:`flex flex-col gap-5`,children:h.map(e=>{let{key:t,ids:n}=e;return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:c(t)}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:n.map(e=>{let t=s(e),n=r[e],i=n?n.mode:`inherit`;return(0,H.jsxs)(`li`,{className:a(`rounded-xl px-3 py-2.5 shadow-surface transition-colors`,i===`inherit`?`bg-surface-panel/50`:`bg-surface-panel`),children:[(0,H.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium text-fg`,children:e}),t?(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:t}):null]}),(0,H.jsx)(`div`,{className:`inline-flex w-fit rounded-lg border border-edge-subtle bg-surface-base p-0.5`,children:[`inherit`,`allow`,`confirm`,`deny`].map(t=>(0,H.jsx)(`button`,{type:`button`,className:a(`rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,i===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),disabled:o,onClick:()=>_(e,t),children:t===`inherit`?l.inheritedMode:t===`allow`?l.modeAllow:t===`confirm`?l.modeConfirm:l.modeDeny},t))})]}),n?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 sm:grid-cols-3 dark:border-edge`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l.scopeLabel,(0,H.jsxs)(j,{value:n.scope??``,disabled:o,onChange:t=>b(e,e=>{let n=t.target.value;if(!n){let{scope:t,...n}=e;return n}return{...e,scope:n}}),children:[(0,H.jsx)(S,{value:``,children:l.scopeInherit}),(0,H.jsx)(S,{value:`readonly`,children:l.scopeReadonly}),(0,H.jsx)(S,{value:`workspace`,children:l.scopeWorkspace}),(0,H.jsx)(S,{value:`unrestricted`,children:l.scopeUnrestricted})]})]}),(0,H.jsx)(J,{label:l.maxCallsLabel,value:n.limits?.maxCallsPerTurn,disabled:o,onChange:t=>b(e,e=>xe(e,`maxCallsPerTurn`,t))}),(0,H.jsx)(J,{label:l.timeoutLabel,value:n.limits?.timeoutMs,disabled:o,onChange:t=>b(e,e=>xe(e,`timeoutMs`,t))})]}):null]},e)})})]},t)})}),t[82]=o,t[83]=c,t[84]=s,t[85]=h,t[86]=l.inheritedMode,t[87]=l.maxCallsLabel,t[88]=l.modeAllow,t[89]=l.modeConfirm,t[90]=l.modeDeny,t[91]=l.scopeInherit,t[92]=l.scopeLabel,t[93]=l.scopeReadonly,t[94]=l.scopeUnrestricted,t[95]=l.scopeWorkspace,t[96]=l.timeoutLabel,t[97]=_,t[98]=r,t[99]=b,t[100]=ae):ae=t[100];let z;return t[101]!==F||t[102]!==ie||t[103]!==ae?(z=(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[F,ie,ae]}),t[101]=F,t[102]=ie,t[103]=ae,t[104]=z):z=t[104],z}function be(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function xe(e,t,n){let r={...e.limits};if(n===void 0?delete r[t]:r[t]=n,Object.keys(r).length===0){let{limits:t,...n}=e;return n}return{...e,limits:r}}function J(e){let t=(0,V.c)(9),n=e.value??``,r;t[0]===e?r=t[1]:(r=t=>{let n=t.target.value.trim();e.onChange(n?Number(n):void 0)},t[0]=e,t[1]=r);let i;t[2]!==e.disabled||t[3]!==n||t[4]!==r?(i=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,value:n,disabled:e.disabled,onChange:r}),t[2]=e.disabled,t[3]=n,t[4]=r,t[5]=i):i=t[5];let a;return t[6]!==e.label||t[7]!==i?(a=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[e.label,i]}),t[6]=e.label,t[7]=i,t[8]=a):a=t[8],a}var Se=[{id:`overview`,icon:E},{id:`models`,icon:M},{id:`tools`,icon:p},{id:`skills`,icon:u},{id:`advanced`,icon:ee},{id:`impact`,icon:y}];function Ce(e){return ae(Object.entries(e?.models?.roles??{}).map(([e,t])=>({id:e,model:t.model,fallbacks:t.fallbacks??[],description:t.description})))}function Y(e){return structuredClone(e?.tools?.builtin??{})}function we(e){let t=e?.skills;if(!t)return new Set;let n=t.mode===`denylist`?t.deny:t.allow;return new Set(n??[])}function Te(){return{primary:``,fallbacks:``,timeoutMs:``,autoProviderFallback:``}}function Ee(e){return{primary:e?.primary??``,fallbacks:e?.fallbacks?.join(`
2
- `)??``,timeoutMs:e?.timeoutMs?String(e.timeoutMs):``,autoProviderFallback:e?.autoProviderFallback===void 0?``:e.autoProviderFallback?`true`:`false`}}function X(){return{imageModel:Te(),imageGenerationModel:Te(),allowFallbacks:``,maxCostTier:``}}function Z(e){return{imageModel:Ee(e?.models?.imageModel),imageGenerationModel:Ee(e?.models?.imageGenerationModel),allowFallbacks:e?.models?.policy?.allowFallbacks===void 0?``:e.models.policy.allowFallbacks?`true`:`false`,maxCostTier:e?.models?.policy?.maxCostTier??``}}function Q(e){return e===void 0?``:JSON.stringify(e,null,2)}function De(){return{mcp:``,memory:``,workflows:``,boundaries:``,runtime:``,locks:``}}function Oe(e){return{mcp:Q(e?.tools?.mcp),memory:Q(e?.memory),workflows:Q(e?.workflows),boundaries:Q(e?.boundaries),runtime:Q(e?.runtime),locks:Q(e?.locks)}}function ke(e){return{id:e?.id??``,name:e?.name??``,description:e?.description??``,modelRows:Ce(e),modelAdvanced:Z(e),toolPolicies:Y(e),skillMode:e?.skills?.mode??`inherit`,skillPick:we(e),extendsIds:[...e?.extends??[]],jsonFields:Oe(e)}}function Ae(e){let t=e.primary.trim();if(!t)return;let n=e.fallbacks.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean),r=e.timeoutMs.trim()?Number(e.timeoutMs):void 0,i=e.autoProviderFallback===``?void 0:e.autoProviderFallback===`true`;return{primary:t,...n.length>0?{fallbacks:n}:{},...r?{timeoutMs:r}:{},...i===void 0?{}:{autoProviderFallback:i}}}function je(e,t){let n=z(e.modelRows),r=Ae(e.modelAdvanced.imageModel),i=Ae(e.modelAdvanced.imageGenerationModel),a=e.modelAdvanced.allowFallbacks||e.modelAdvanced.maxCostTier?{...e.modelAdvanced.allowFallbacks?{allowFallbacks:e.modelAdvanced.allowFallbacks===`true`}:{},...e.modelAdvanced.maxCostTier?{maxCostTier:e.modelAdvanced.maxCostTier}:{}}:void 0,o={...t?.models?.defaultRole?{defaultRole:t.models.defaultRole}:{},...n?.roles?{roles:n.roles}:{},...r?{imageModel:r}:{},...i?{imageGenerationModel:i}:{},...a?{policy:a}:{}};return Object.keys(o).length>0?o:null}function Me(e){return e.trim()?JSON.parse(e):void 0}function $(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e))}catch{return`!invalid:${e}`}}function Ne(e){let t=Object.fromEntries(Object.entries(e.toolPolicies).toSorted(([e],[t])=>e.localeCompare(t))),n=Me(e.jsonFields.mcp);return Object.keys(t).length>0||n?{builtin:t,...n?{mcp:n}:{}}:null}function Pe(e){return Object.fromEntries(Object.entries(e??{}).toSorted(([e],[t])=>e.localeCompare(t)))}function Fe(e){if(e.skillMode===`inherit`)return null;let t=[...e.skillPick].toSorted((e,t)=>e.localeCompare(t));return e.skillMode===`allowlist`?{mode:`allowlist`,allow:t}:e.skillMode===`denylist`?{mode:`denylist`,deny:t}:{mode:e.skillMode}}function Ie(e,t){return{id:e.id.trim(),name:e.name.trim(),description:e.description.trim(),models:je(e,t),tools:{builtin:Pe(e.toolPolicies),mcp:$(e.jsonFields.mcp)},skills:Fe(e),extends:[...e.extendsIds].toSorted(),memory:$(e.jsonFields.memory),workflows:$(e.jsonFields.workflows),boundaries:$(e.jsonFields.boundaries),runtime:$(e.jsonFields.runtime),locks:$(e.jsonFields.locks)}}function Le(e){return e?{id:e.id,name:e.name,description:e.description??``,models:e.models??null,tools:{builtin:Pe(e.tools?.builtin),mcp:$(Q(e.tools?.mcp))},skills:e.skills??null,extends:[...e.extends??[]].toSorted(),memory:$(Q(e.memory)),workflows:$(Q(e.workflows)),boundaries:$(Q(e.boundaries)),runtime:$(Q(e.runtime)),locks:$(Q(e.locks))}:null}function Re(e,t){return[e.models?.roles?t.summaryModels.replace(`{{count}}`,String(Object.keys(e.models.roles).length)):``,e.tools?.builtin?t.summaryTools.replace(`{{count}}`,String(Object.keys(e.tools.builtin).length)):``,e.skills?t.summarySkills.replace(`{{mode}}`,t.skillModeLabels[e.skills.mode]):``].filter(Boolean).join(` · `)||t.summaryEmpty}function ze(){return{modelAdvanced:X(),extendsIds:[],jsonFields:De()}}function Be(e,t){return{extends:[...e.extendsIds],models:je(e,t)??void 0,tools:Ne(e)??void 0,skills:Fe(e)??void 0,memory:Me(e.jsonFields.memory),workflows:Me(e.jsonFields.workflows),boundaries:Me(e.jsonFields.boundaries),runtime:Me(e.jsonFields.runtime),locks:Me(e.jsonFields.locks)}}function Ve(e,t){return e===`safe-coder`?{id:`safe-coder`,name:t.starters[`safe-coder`].title,description:t.starters[`safe-coder`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`code`,model:``,fallbacks:[],description:t.modelRoleDescriptions.code},{id:`review`,model:``,fallbacks:[],description:t.modelRoleDescriptions.review}],toolPolicies:{exec_command:{mode:`deny`},send_message:{mode:`deny`},send_media:{mode:`deny`}},skillMode:`allowlist`,skillPick:new Set([`diagnose`,`tdd`]),...ze()}:e===`read-only`?{id:`read-only-research`,name:t.starters[`read-only`].title,description:t.starters[`read-only`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`fast`,model:``,fallbacks:[],description:t.modelRoleDescriptions.fast}],toolPolicies:{write_file:{mode:`deny`},apply_patch:{mode:`deny`},exec_command:{mode:`deny`},send_message:{mode:`deny`},send_media:{mode:`deny`}},skillMode:`all`,skillPick:new Set,...ze()}:e===`low-cost`?{id:`low-cost-assistant`,name:t.starters[`low-cost`].title,description:t.starters[`low-cost`].description,modelRows:[{id:`deep`,model:``,fallbacks:[],description:t.modelRoleDescriptions.deep},{id:`fast`,model:``,fallbacks:[],description:t.modelRoleDescriptions.fast},{id:`cheap`,model:``,fallbacks:[],description:t.modelRoleDescriptions.cheap}],toolPolicies:{},skillMode:`inherit`,skillPick:new Set,...ze()}:{id:``,name:``,description:``,modelRows:[],toolPolicies:{},skillMode:`inherit`,skillPick:new Set,...ze()}}function He(){let e=o(c(e=>e.language)),t=e.capabilityPresetsSettings,n=!!s(e=>e.token),{data:r,error:h,isLoading:S,mutate:j}=l(n?`settings-capability-presets`:null,ue,{revalidateOnFocus:!1}),{data:F=[],isLoading:ae}=l(n?`settings-capability-presets-skills-catalog`:null,te,{revalidateOnFocus:!1}),[R,z]=i(),[oe,le]=(0,B.useState)(``),[V,U]=(0,B.useState)(`overview`),[W,G]=(0,B.useState)(()=>Ve(`blank`,t)),[K,he]=(0,B.useState)(!1),[ge,q]=(0,B.useState)(null),[_e,ve]=(0,B.useState)(null),be=r?.presets??[],xe=r?.defaultPresetId??`default`,J=be.find(e=>e.id===xe)??null,Ce=be.filter(e=>e.id!==xe),Y=(0,B.useMemo)(()=>be.find(e=>e.id===oe)??be[0]??null,[be,oe]),we=!Y||W.id.trim()!==Y.id,Te=!!(Y&&Y.id===xe),Ee=JSON.stringify(Ie(W,Y))!==JSON.stringify(Le(Y)),X=Ie(W,Y),Z=Le(Y),Q=[X.id!==Z?.id||X.name!==Z?.name||X.description!==Z?.description?t.tabs.overview:``,JSON.stringify(X.models)===JSON.stringify(Z?.models)?``:t.tabs.models,JSON.stringify(X.tools)===JSON.stringify(Z?.tools)?``:t.tabs.tools,JSON.stringify(X.skills)===JSON.stringify(Z?.skills)?``:t.tabs.skills,JSON.stringify({extends:X.extends,memory:X.memory,workflows:X.workflows,boundaries:X.boundaries,runtime:X.runtime,locks:X.locks})===JSON.stringify({extends:Z?.extends,memory:Z?.memory,workflows:Z?.workflows,boundaries:Z?.boundaries,runtime:Z?.runtime,locks:Z?.locks})?``:t.tabs.advanced].filter(Boolean),De=ge??(h instanceof Error?h.message:null),Oe=R.get(`action`)===`new`||!!R.get(`preset`),Ae=we?t.newPreset:Y?.name??t.editorTitle,je=t=>e.agentsSettings.toolsDisableGroups[t],$=t=>t in e.agentsSettings.toolDescriptions?e.agentsSettings.toolDescriptions[t]:``;(0,B.useEffect)(()=>{if(!r||K)return;if(R.get(`action`)===`new`){let e=R.get(`starter`);le(``),G(Ve(e===`safe-coder`||e===`read-only`||e===`low-cost`?e:`blank`,t)),U(`overview`);return}let e=R.get(`preset`)?.trim(),n=e?r.presets.find(t=>t.id===e):null;if(n){le(n.id),G(ke(n)),U(R.get(`tab`)??`overview`);return}Y&&(le(Y.id),G(e=>e.id===Y.id?e:ke(Y)))},[K,r,R,Y]);function Ne(e){le(e.id),G(ke(e)),z({preset:e.id},{replace:!0}),U(`overview`)}function Pe(e){let n=Ve(e,t);le(``),G(n),q(null),z(e===`blank`?{action:`new`}:{action:`new`,starter:e},{replace:!0}),U(`overview`)}function Fe(){Ee&&!window.confirm(t.discardConfirm)||(z({},{replace:!0}),q(null),G(ke(Y)),U(`overview`))}async function ze(){let e=ie(W.modelRows,{invalidId:t.invalidModelRoleId,duplicateId:t.duplicateModelRoleId,invalidModel:t.invalidModelRef});if(e){q(e),U(`models`);return}for(let e of[W.modelAdvanced.imageModel,W.modelAdvanced.imageGenerationModel]){if([e.primary,...e.fallbacks.split(/\r?\n|,/)].map(e=>e.trim()).filter(Boolean).some(e=>!/^[^/\s]+\/.+/.test(e))){q(t.invalidModelRef),U(`models`);return}if(e.timeoutMs.trim()&&(!Number.isInteger(Number(e.timeoutMs))||Number(e.timeoutMs)<=0)){q(t.advancedPositiveIntegerError),U(`models`);return}}for(let e of Object.values(W.toolPolicies))if([e.limits?.maxCallsPerTurn,e.limits?.timeoutMs].filter(e=>e!==void 0).some(e=>!Number.isInteger(e)||e<=0)){q(t.advancedPositiveIntegerError),U(`tools`);return}for(let e of Object.keys(W.jsonFields))try{Me(W.jsonFields[e])}catch{q(t.advancedJsonError.replace(`{{field}}`,t.advancedFieldLabels[e])),U(`advanced`);return}he(!0),q(null);try{let e=Be(W,Y);if(we){let t=await fe({id:W.id.trim(),name:W.name.trim(),...W.description.trim()?{description:W.description.trim()}:{},...e});await j(t.presets,{revalidate:!1}),le(t.presetId),z({preset:t.presetId},{replace:!0})}else Y&&await j(await se(Y.id,{name:W.name.trim(),description:W.description.trim()||null,extends:e.extends??null,models:e.models??null,tools:e.tools??null,skills:e.skills??null,memory:e.memory??null,workflows:e.workflows??null,boundaries:e.boundaries??null,runtime:e.runtime??null,locks:e.locks??null}),{revalidate:!1})}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{he(!1)}}async function He(){if(Y&&window.confirm(t.deleteConfirm.replace(`{{name}}`,Y.name))){he(!0),q(null);try{let e=await ce(Y.id);await j(e,{revalidate:!1});let t=e.presets[0]??null;le(t?.id??``),G(ke(t)),z(t?{preset:t.id}:{},{replace:!0})}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{he(!1)}}}return n?(0,H.jsxs)(ne,{gap:`gap-5`,className:`pb-24`,children:[(0,H.jsx)(P,{title:t.title,subtitle:t.subtitle,actions:(0,H.jsxs)(v,{type:`button`,onClick:()=>Pe(`blank`),disabled:K,children:[(0,H.jsx)(f,{className:`size-4`,"aria-hidden":!0}),t.newPreset]})}),De?(0,H.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:De}):null,S?(0,H.jsx)(re,{sections:2}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:f,title:t.newPreset,subtitle:t.editorHint}),(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[`blank`,`safe-coder`,`read-only`,`low-cost`].map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`min-h-28 rounded-lg bg-surface-panel/80 px-4 py-3 text-left text-sm text-fg shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Pe(e),children:[(0,H.jsx)(`span`,{className:`font-medium`,children:t.starters[e].title}),(0,H.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-fg-muted`,children:t.starters[e].description})]},e))})]}),J?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:M,title:t.globalDefaultsTitle,subtitle:t.globalDefaultsHint}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Ne(J),className:`group rounded-lg bg-accent/5 px-4 py-3 text-left text-fg shadow-surface transition-colors hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:J.name}),(0,H.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-accent`,children:t.globalDefaultsBadge})]}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-subtle`,children:J.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.globalDefaultsInherited})]}),J.description?(0,H.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:J.description}):null,(0,H.jsx)(`div`,{className:`mt-3 text-xs text-fg-subtle`,children:Re(J,t)})]})]}):null,(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:M,title:t.listTitle,subtitle:t.listHint}),Ce.length===0?(0,H.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-4 text-sm text-fg-muted shadow-surface`,children:t.empty}):(0,H.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Ce.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>Ne(e),className:`group min-h-36 rounded-lg bg-surface-panel/80 px-4 py-3 text-left text-fg shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-fg-subtle`,children:e.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.usage.length})]}),e.description?(0,H.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:e.description}):null,(0,H.jsx)(`div`,{className:`mt-3 truncate text-xs text-fg-subtle`,children:Re(e,t)})]},e.id))})]})]}),(0,H.jsx)(T,{open:Oe,onOpenChange:e=>{e||Fe()},children:(0,H.jsxs)(C,{children:[(0,H.jsx)(k,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim`,d)}),(0,H.jsx)(b,{ref:ve,className:a(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,760px)] w-[min(100%-2rem,64rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,_),onOpenAutoFocus:e=>e.preventDefault(),children:(0,H.jsxs)(N,{layer:`modal`,portalContainer:_e,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3 dark:border-edge`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(A,{className:`truncate text-base font-semibold text-fg`,children:Ae}),(0,H.jsx)(D,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:we?t.editorHint:W.id})]}),(0,H.jsx)(w,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:a(m,`shrink-0 p-1.5 hover:bg-surface-base`),"aria-label":t.closeDialog,children:(0,H.jsx)(O,{className:`size-4`,"aria-hidden":!0})})})]}),De?(0,H.jsx)(`div`,{className:`mx-4 mt-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:De}):null,(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 border-b border-edge-subtle bg-surface-base px-4 py-2 dark:border-edge`,children:Se.map(({id:e,icon:n})=>(0,H.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>U(e),children:[(0,H.jsx)(n,{className:`size-4`,"aria-hidden":!0}),t.tabs[e]]},e))}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl`,children:[V===`overview`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:E,title:t.overviewTitle,subtitle:t.overviewHint}),(0,H.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.idLabel}),(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.id,disabled:K||!we,onChange:e=>G(t=>({...t,id:e.target.value.toLowerCase()})),placeholder:`safe-coder`})]}),!we&&Y?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.versionLabel}),(0,H.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg-muted`,children:t.versionAutomatic.replace(`{{version}}`,String(Y.version))})]}):null,(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.nameLabel}),(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.name,disabled:K,onChange:e=>G(t=>({...t,name:e.target.value})),placeholder:t.namePlaceholder})]}),(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:t.descriptionLabel}),(0,H.jsx)(`textarea`,{className:`min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:W.description,disabled:K,onChange:e=>G(t=>({...t,description:e.target.value})),placeholder:t.descriptionPlaceholder})]})]}),(0,H.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,H.jsx)(Ue,{icon:M,label:t.modelsTitle,value:String(W.modelRows.length)}),(0,H.jsx)(Ue,{icon:p,label:t.toolsTitle,value:String(Object.keys(W.toolPolicies).length)}),(0,H.jsx)(Ue,{icon:u,label:t.skillsTitle,value:t.skillModeLabels[W.skillMode]})]})]}):null,V===`models`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:M,title:t.modelsTitle,subtitle:t.modelsHint}),(0,H.jsx)(de,{rows:W.modelRows,onChange:e=>G(t=>({...t,modelRows:e})),disabled:K,defaultRole:Y?.models?.defaultRole,chat:e.chat,labels:{id:t.modelRoleIdLabel,description:t.modelRoleDescriptionLabel,primaryModel:t.modelPrimaryModelLabel,fallbackModels:t.modelFallbackModelsLabel,addFallback:t.modelAddFallback,removeFallback:t.modelRemoveFallback,fallbackPlaceholder:t.modelFallbackPlaceholder,fallbackEmptyHint:t.modelFallbackEmptyHint,add:t.addModelRole,remove:t.removeModelRole,recommendedTitle:t.modelRecommendedTitle,customTitle:t.modelCustomTitle,defaultBadge:t.modelDefaultBadge,visionBadge:t.modelVisionBadge,visionAutoHint:t.modelVisionAutoHint,addPurpose:t.addModelPurpose,noCustomRoles:t.noCustomModelRoles,idPlaceholder:`deep`,descriptionPlaceholder:t.modelRoleDescriptionPlaceholder,roleNames:t.modelRoleNames,roleDescriptions:t.modelRoleDescriptions}}),(0,H.jsx)(We,{value:W.modelAdvanced,onChange:e=>G(t=>({...t,modelAdvanced:e})),disabled:K,cp:t})]}):null,V===`tools`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:p,title:t.toolsTitle,subtitle:t.toolsHint}),(0,H.jsx)(ye,{builtinToolIds:r?.builtinToolIds??[],toolPolicies:W.toolPolicies,onChange:e=>G(t=>({...t,toolPolicies:e})),disabled:K,getToolDescription:$,getGroupTitle:je,labels:{quickActionsLabel:t.toolsQuickActionsLabel,quickClearOverrides:t.toolsQuickClearOverrides,quickReadOnlyWorkspace:t.toolsQuickReadOnlyWorkspace,quickHighRiskOff:t.toolsQuickHighRiskOff,quickNoOutbound:t.toolsQuickNoOutbound,quickResearchMode:t.toolsQuickResearchMode,quickCodingMode:t.toolsQuickCodingMode,emptyBuiltin:t.toolsEmptyBuiltin,overrideSummaryTitle:t.toolsOverrideSummaryTitle,noOverrides:t.toolsNoOverrides,inheritedMode:t.toolModes.inherit,modeAllow:t.toolModes.allow,modeConfirm:t.toolModes.confirm,modeDeny:t.toolModes.deny,scopeLabel:t.toolScopeLabel,scopeInherit:t.toolScopeInherit,scopeReadonly:t.toolScopeReadonly,scopeWorkspace:t.toolScopeWorkspace,scopeUnrestricted:t.toolScopeUnrestricted,maxCallsLabel:t.toolMaxCallsLabel,timeoutLabel:t.toolTimeoutLabel}})]}):null,V===`skills`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:u,title:t.skillsTitle,subtitle:t.skillsHint}),(0,H.jsx)(me,{mode:W.skillMode,selected:W.skillPick,catalog:F,loading:ae,disabled:K,onModeChange:e=>G(t=>({...t,skillMode:e})),onSelectedChange:e=>G(t=>({...t,skillPick:e})),labels:{modeLabel:t.skillsModeLabel,modeInherit:t.skillsModeInherit,modeAll:t.skillsModeAll,modeAllowlist:t.skillsModeAllowlist,modeDenylist:t.skillsModeDenylist,modeOff:t.skillsModeOff,quickActionsLabel:t.skillsQuickActionsLabel,quickSelectAll:t.skillsQuickSelectAll,quickClear:t.skillsQuickClear,catalogLoading:t.skillsCatalogLoading,emptyCatalog:t.skillsEmptyCatalog,noDescription:t.skillsNoDescription,overrideSummaryTitle:t.skillsOverrideSummaryTitle,inheritSummary:t.skillsInheritSummary,allSummary:t.skillsAllSummary,offSummary:t.skillsOffSummary,allowSummary:t.skillsAllowSummary,denySummary:t.skillsDenySummary}})]}):null,V===`advanced`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:ee,title:t.advancedTitle,subtitle:t.advancedHint}),(0,H.jsx)(pe,{extendsIds:W.extendsIds,onExtendsChange:e=>G(t=>({...t,extendsIds:e})),presetOptions:be.filter(e=>e.id!==Y?.id&&e.id!==xe),jsonFields:W.jsonFields,onJsonFieldsChange:e=>G(t=>({...t,jsonFields:e})),disabled:K,labels:{inheritanceTitle:t.advancedInheritanceTitle,inheritanceHint:t.advancedInheritanceHint,inheritanceEmpty:t.advancedInheritanceEmpty,jsonTitle:t.advancedJsonTitle,jsonHint:t.advancedJsonHint,fieldLabels:t.advancedFieldLabels,fieldHints:t.advancedFieldHints}})]}):null,V===`impact`?(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:y,title:t.usageTitle,subtitle:t.usageHint}),(0,H.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface-panel/70 px-3 py-2 shadow-surface`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:t.changePreviewTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Q.length>0?t.changePreviewSections.replace(`{{sections}}`,Q.join(`、`)):t.changePreviewEmpty})]}),Y?.usage.length?(0,H.jsx)(`div`,{className:`grid gap-2`,children:Y.usage.map(e=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.agentName||e.agentId}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-muted`,children:e.agentId}),(0,H.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-subtle`,children:e.direct?t.usageDirect:t.usageIndirect})]},e.agentId))}):(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUsage})]}):null]})}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,H.jsx)(`div`,{className:`font-medium text-fg`,children:Ee?t.unsavedTitle:t.noUnsavedTitle}),(0,H.jsx)(`div`,{className:`text-xs text-fg-muted`,children:Ee?(Y?.usage.length??0)>0?t.unsavedImpact.replace(`{{count}}`,String(Y?.usage.length??0)):t.unsavedNoImpact:t.noUnsavedHint})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ee?(0,H.jsx)(v,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>G(ke(Y)),children:t.discard}):null,Y&&!Te?(0,H.jsxs)(v,{type:`button`,variant:`secondary`,disabled:K,onClick:()=>void He(),children:[(0,H.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.delete]}):null,(0,H.jsxs)(v,{type:`button`,disabled:K||!W.id.trim()||!W.name.trim()||!Ee,onClick:()=>void ze(),children:[(0,H.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t.savePreset]})]})]})]})})]})})]}):(0,H.jsxs)(ne,{gap:`gap-3`,children:[(0,H.jsx)(P,{title:t.title}),(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]})}function Ue(e){let t=(0,V.c)(10),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,H.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),t[0]=n,t[1]=a);let o;t[2]!==r||t[3]!==a?(o=(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[a,r]}),t[2]=r,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,H.jsx)(`div`,{className:`mt-1 text-sm font-medium text-fg`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function We(e){let t=(0,V.c)(77),{value:n,onChange:r,disabled:i,cp:a}=e,o;t[0]!==r||t[1]!==n?(o=(e,t)=>{r({...n,[e]:t})},t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;t[3]===a.modelAdvancedTitle?c=t[4]:(c=(0,H.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:a.modelAdvancedTitle}),t[3]=a.modelAdvancedTitle,t[4]=c);let l;t[5]===a.modelAdvancedHint?l=t[6]:(l=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:a.modelAdvancedHint}),t[5]=a.modelAdvancedHint,t[6]=l);let u;t[7]===s?u=t[8]:(u=e=>s(`imageModel`,e),t[7]=s,t[8]=u);let d;t[9]!==a||t[10]!==i||t[11]!==u||t[12]!==n.imageModel?(d=(0,H.jsx)(Ge,{title:a.imageUnderstandingTitle,value:n.imageModel,onChange:u,disabled:i,cp:a}),t[9]=a,t[10]=i,t[11]=u,t[12]=n.imageModel,t[13]=d):d=t[13];let f;t[14]===s?f=t[15]:(f=e=>s(`imageGenerationModel`,e),t[14]=s,t[15]=f);let p;t[16]!==a||t[17]!==i||t[18]!==f||t[19]!==n.imageGenerationModel?(p=(0,H.jsx)(Ge,{title:a.imageGenerationTitle,value:n.imageGenerationModel,onChange:f,disabled:i,cp:a}),t[16]=a,t[17]=i,t[18]=f,t[19]=n.imageGenerationModel,t[20]=p):p=t[20];let m;t[21]!==d||t[22]!==p?(m=(0,H.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[d,p]}),t[21]=d,t[22]=p,t[23]=m):m=t[23];let h;t[24]===a.modelAllowFallbacksLabel?h=t[25]:(h=(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:a.modelAllowFallbacksLabel}),t[24]=a.modelAllowFallbacksLabel,t[25]=h);let g;t[26]!==r||t[27]!==n?(g=e=>r({...n,allowFallbacks:e.target.value}),t[26]=r,t[27]=n,t[28]=g):g=t[28];let _;t[29]===a.policyInherit?_=t[30]:(_=(0,H.jsx)(S,{value:``,children:a.policyInherit}),t[29]=a.policyInherit,t[30]=_);let v;t[31]===a.policyEnabled?v=t[32]:(v=(0,H.jsx)(S,{value:`true`,children:a.policyEnabled}),t[31]=a.policyEnabled,t[32]=v);let y;t[33]===a.policyDisabled?y=t[34]:(y=(0,H.jsx)(S,{value:`false`,children:a.policyDisabled}),t[33]=a.policyDisabled,t[34]=y);let b;t[35]!==i||t[36]!==_||t[37]!==v||t[38]!==y||t[39]!==g||t[40]!==n.allowFallbacks?(b=(0,H.jsxs)(j,{value:n.allowFallbacks,disabled:i,onChange:g,children:[_,v,y]}),t[35]=i,t[36]=_,t[37]=v,t[38]=y,t[39]=g,t[40]=n.allowFallbacks,t[41]=b):b=t[41];let x;t[42]!==b||t[43]!==h?(x=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[h,b]}),t[42]=b,t[43]=h,t[44]=x):x=t[44];let C;t[45]===a.modelMaxCostTierLabel?C=t[46]:(C=(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:a.modelMaxCostTierLabel}),t[45]=a.modelMaxCostTierLabel,t[46]=C);let w;t[47]!==r||t[48]!==n?(w=e=>r({...n,maxCostTier:e.target.value}),t[47]=r,t[48]=n,t[49]=w):w=t[49];let T;t[50]===a.policyInherit?T=t[51]:(T=(0,H.jsx)(S,{value:``,children:a.policyInherit}),t[50]=a.policyInherit,t[51]=T);let E;t[52]===a.costTierLow?E=t[53]:(E=(0,H.jsx)(S,{value:`low`,children:a.costTierLow}),t[52]=a.costTierLow,t[53]=E);let D;t[54]===a.costTierMedium?D=t[55]:(D=(0,H.jsx)(S,{value:`medium`,children:a.costTierMedium}),t[54]=a.costTierMedium,t[55]=D);let O;t[56]===a.costTierHigh?O=t[57]:(O=(0,H.jsx)(S,{value:`high`,children:a.costTierHigh}),t[56]=a.costTierHigh,t[57]=O);let k;t[58]!==i||t[59]!==w||t[60]!==T||t[61]!==E||t[62]!==D||t[63]!==O||t[64]!==n.maxCostTier?(k=(0,H.jsxs)(j,{value:n.maxCostTier,disabled:i,onChange:w,children:[T,E,D,O]}),t[58]=i,t[59]=w,t[60]=T,t[61]=E,t[62]=D,t[63]=O,t[64]=n.maxCostTier,t[65]=k):k=t[65];let A;t[66]!==C||t[67]!==k?(A=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,k]}),t[66]=C,t[67]=k,t[68]=A):A=t[68];let M;t[69]!==x||t[70]!==A?(M=(0,H.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-panel/70 p-3 shadow-surface sm:grid-cols-2`,children:[x,A]}),t[69]=x,t[70]=A,t[71]=M):M=t[71];let N;return t[72]!==c||t[73]!==l||t[74]!==M||t[75]!==m?(N=(0,H.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-5 dark:border-edge`,children:[c,l,m,M]}),t[72]=c,t[73]=l,t[74]=M,t[75]=m,t[76]=N):N=t[76],N}function Ge(e){let t=(0,V.c)(64),{title:n,value:r,onChange:i,disabled:o,cp:s}=e,c;t[0]===n?c=t[1]:(c=(0,H.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=c);let l=s.modelToolPrimaryLabel,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,`font-mono text-xs`),t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==r?(d=e=>i({...r,primary:e.target.value}),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f;t[6]!==o||t[7]!==d||t[8]!==r.primary?(f=(0,H.jsx)(`input`,{className:u,value:r.primary,disabled:o,placeholder:`provider/model`,onChange:d}),t[6]=o,t[7]=d,t[8]=r.primary,t[9]=f):f=t[9];let p;t[10]!==s.modelToolPrimaryLabel||t[11]!==f?(p=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[l,f]}),t[10]=s.modelToolPrimaryLabel,t[11]=f,t[12]=p):p=t[12];let m=s.modelToolFallbacksLabel,h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=a(`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,`min-h-20 resize-y font-mono text-xs`),t[13]=h):h=t[13];let g;t[14]!==i||t[15]!==r?(g=e=>i({...r,fallbacks:e.target.value}),t[14]=i,t[15]=r,t[16]=g):g=t[16];let _;t[17]!==s.modelToolFallbacksPlaceholder||t[18]!==o||t[19]!==g||t[20]!==r.fallbacks?(_=(0,H.jsx)(`textarea`,{className:h,value:r.fallbacks,disabled:o,placeholder:s.modelToolFallbacksPlaceholder,onChange:g}),t[17]=s.modelToolFallbacksPlaceholder,t[18]=o,t[19]=g,t[20]=r.fallbacks,t[21]=_):_=t[21];let v;t[22]!==s.modelToolFallbacksLabel||t[23]!==_?(v=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[m,_]}),t[22]=s.modelToolFallbacksLabel,t[23]=_,t[24]=v):v=t[24];let y;t[25]!==i||t[26]!==r?(y=e=>i({...r,timeoutMs:e.target.value}),t[25]=i,t[26]=r,t[27]=y):y=t[27];let b;t[28]!==o||t[29]!==y||t[30]!==r.timeoutMs?(b=(0,H.jsx)(`input`,{type:`number`,min:1,step:1,className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:border-edge-strong focus:outline-none`,value:r.timeoutMs,disabled:o,onChange:y}),t[28]=o,t[29]=y,t[30]=r.timeoutMs,t[31]=b):b=t[31];let x;t[32]!==s.toolTimeoutLabel||t[33]!==b?(x=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[s.toolTimeoutLabel,b]}),t[32]=s.toolTimeoutLabel,t[33]=b,t[34]=x):x=t[34];let C;t[35]!==i||t[36]!==r?(C=e=>i({...r,autoProviderFallback:e.target.value}),t[35]=i,t[36]=r,t[37]=C):C=t[37];let w;t[38]===s.policyInherit?w=t[39]:(w=(0,H.jsx)(S,{value:``,children:s.policyInherit}),t[38]=s.policyInherit,t[39]=w);let T;t[40]===s.policyEnabled?T=t[41]:(T=(0,H.jsx)(S,{value:`true`,children:s.policyEnabled}),t[40]=s.policyEnabled,t[41]=T);let E;t[42]===s.policyDisabled?E=t[43]:(E=(0,H.jsx)(S,{value:`false`,children:s.policyDisabled}),t[42]=s.policyDisabled,t[43]=E);let D;t[44]!==o||t[45]!==C||t[46]!==w||t[47]!==T||t[48]!==E||t[49]!==r.autoProviderFallback?(D=(0,H.jsxs)(j,{value:r.autoProviderFallback,disabled:o,onChange:C,children:[w,T,E]}),t[44]=o,t[45]=C,t[46]=w,t[47]=T,t[48]=E,t[49]=r.autoProviderFallback,t[50]=D):D=t[50];let O;t[51]!==s.modelAutoProviderFallbackLabel||t[52]!==D?(O=(0,H.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-fg-muted`,children:[s.modelAutoProviderFallbackLabel,D]}),t[51]=s.modelAutoProviderFallbackLabel,t[52]=D,t[53]=O):O=t[53];let k;t[54]!==x||t[55]!==O?(k=(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[x,O]}),t[54]=x,t[55]=O,t[56]=k):k=t[56];let A;t[57]!==v||t[58]!==k||t[59]!==p?(A=(0,H.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[p,v,k]}),t[57]=v,t[58]=k,t[59]=p,t[60]=A):A=t[60];let M;return t[61]!==c||t[62]!==A?(M=(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/70 p-3 shadow-surface`,children:[c,A]}),t[61]=c,t[62]=A,t[63]=M):M=t[63],M}export{He as CapabilityPresetsSettingsPanel};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./fetch-8QNN25Sh.js";function n(e,t){let n=Date.now()-new Date(e).getTime();return n<6e4?t.justNow:n<36e5?t.minutesAgo.replace(`{{count}}`,String(Math.floor(n/6e4))):n<864e5?t.hoursAgo.replace(`{{count}}`,String(Math.floor(n/36e5))):n<6048e5?t.daysAgo.replace(`{{count}}`,String(Math.floor(n/864e5))):new Date(e).toLocaleDateString()}function r(e,t){let r=n(e.lastActive,t);return e.channel===`telegram`&&e.peerId?`${e.accountId??`default`} · ${e.peerKind??``} · ${e.peerId} · ${r}`:`${e.channel}: ${e.chatId} · ${r}`}async function i(){return(await e(t(`/api/channels/status`))).payload?.channels||[]}async function a(n){return(await e(t(`/api/sessions/chat-ids${n?`?channel=${encodeURIComponent(n)}`:``}`))).payload?.chatIds||[]}export{i as n,a as r,r as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,u as a}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./circle-alert-RzVebuX2.js";import{t as c}from"./messages-CzKxM6I4.js";import{a as l,n as u,o as d,t as f}from"./fetch-8QNN25Sh.js";import{n as p}from"./locale-store-Ba72bFmP.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{Co as h,Es as g,Fi as _,Lo as v,Mr as y,Na as b,Nr as x,Pa as S,Pr as C,Ps as w,So as T,Wo as E,Xc as D,_o as O,ao as k,bl as A,co as j,dc as M,dr as N,io as P,is as F,ka as I,lo as L,ms as R,no as ee,oo as z,qo as B,so as te,tt as ne,uo as re,xo as ie,zs as ae}from"./index-BKRqeRHm.js";import{n as oe,t as se}from"./settings-page-layout-CyGlrInB.js";import{n as ce}from"./settings-loading-skeleton-BV6KFNj4.js";import{t as le}from"./schema-form-Bf0bk3i6.js";import{t as ue}from"./browser-BLJWD7WI.js";import{n as de,t as fe}from"./channels-status-swr-B5lVrUsN.js";import{t as pe}from"./use-channel-catalog-COXIfXcl.js";var V=n(),me=e(ue(),1),H=e(t(),1),U=r();function he(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}async function ge(e){let t=await f(d(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function W(e){return e?.type===`poll`&&e.phase===`done`}function G(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function K(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function q(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function _e({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,H.useMemo)(()=>he(e),[e]),s=(0,H.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[c,l]=(0,H.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,H.useEffect)(()=>{l({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let u=(0,H.useCallback)(async(n,i)=>{l(e=>({...e,busy:!0,error:null}));try{let a=await ge({channelId:e.id,actionId:n,locale:t,input:i});l(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){l(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,H.useEffect)(()=>{let t=K(c.payload,e.id);if(!t){l(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return l(e=>e.generatedQr?{...e,generatedQr:null}:e),me.toDataURL(t,{width:220,margin:1}).then(e=>{n||l(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,c.payload]),(0,H.useEffect)(()=>{let n=c.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||ge({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(l(t=>({...t,payload:e,poll:W(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),W(e)&&window.clearInterval(a))}).catch(e=>{i||l(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,c.poll]);let d=a?.[1].label??(e.configured?n.reconnect:n.connect),f=e.actions?.[`doctor.run`]?.label??n.diagnose,p=G(c.payload),m=K(c.payload,e.id),h=m?c.generatedQr:q(c.payload),g=a?.[1].result===`qr`&&(c.busy||c.payload?.type===`qr`||c.payload?.type===`poll`),_=c.payload?.type===`form`?c.payload:null,v=c.payload?.type===`diagnostics`?c.payload.checks:null;return(0,U.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:o(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,U.jsxs)(E,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(a[0]),children:[c.busy?(0,U.jsx)(M,{className:`size-4 animate-spin`}):(0,U.jsx)(ae,{className:`size-4`}),d]}):null,e.actions?.[`doctor.run`]?(0,U.jsxs)(E,{type:`button`,variant:`secondary`,disabled:c.busy,onClick:()=>void u(`doctor.run`),children:[(0,U.jsx)(R,{className:`size-4`}),f]}):null]})]}),p?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:p}):null,c.error?(0,U.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:c.error}):null,g?(0,U.jsxs)(`div`,{className:o(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base px-3 py-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,U.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:h?(0,U.jsx)(`img`,{src:h,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,U.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,U.jsx)(b,{className:`size-48 rounded-md`})})}),(0,U.jsxs)(`div`,{className:o(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[h?(0,U.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,U.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,U.jsx)(b,{className:`h-4 w-48 max-w-full`}),(0,U.jsx)(b,{className:`h-4 w-36 max-w-full`})]}),m?(0,U.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:m,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,U.jsx)(D,{className:`size-3.5`})]}):null]})]}):null,c.payload?.type===`poll`&&c.payload.phase===`done`?(0,U.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,U.jsx)(A,{className:c.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,U.jsx)(`span`,{className:c.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:c.payload.message??(c.payload.ok?n.complete:n.failed)})]}):null,_?(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)(le,{schema:_.schema,values:c.formDraft,onChange:e=>l(t=>({...t,formDraft:e})),disabled:c.busy,labels:s}),(0,U.jsx)(E,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(_.submitAction,c.formDraft),children:n.saveSetup})]}):null,v?(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:v.map((e,t)=>(0,U.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var ve=40;function J(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ye(e,t){return e.find(e=>e.id===J(t))?.agentId?.trim().toLowerCase()??``}function be(e,t,n){let r=J(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:ve,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function xe(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Se(e,t,n){let r=xe(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function Ce(e,t=!1){return e===`drawer`?o(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,T):o(`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,T,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function we(e){let t=(0,V.c)(33),{presentation:n,open:r,onOpenChange:i,title:a,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:p,headerExtra:m}=e,g=p===void 0?!1:p,_=n===`drawer`,[y,b]=(0,H.useState)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,U.jsx)(te,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,h)}),t[0]=x):x=t[0];let S;t[1]!==n||t[2]!==g?(S=Ce(n,g),t[1]=n,t[2]=g,t[3]=S):S=t[3];let C;t[4]===c?C=t[5]:(C=c?(0,U.jsx)(re,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=C);let w;t[6]===l?w=t[7]:(w=l?(0,U.jsx)(z,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=w);let T;t[8]!==u||t[9]!==s||t[10]!==m||t[11]!==_||t[12]!==a?(T=_?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,U.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,s?(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,U.jsx)(P,{asChild:!0,children:(0,U.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,U.jsx)(B,{className:`size-5`,strokeWidth:1.75})})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:o(v,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,U.jsx)(B,{className:`size-4`})})}),m]}),t[8]=u,t[9]=s,t[10]=m,t[11]=_,t[12]=a,t[13]=T):T=t[13];let D=_?`px-4 py-4`:`p-6`,O;t[14]===D?O=t[15]:(O=o(`min-h-0 flex-1 overflow-y-auto`,D),t[14]=D,t[15]=O);let A;t[16]!==d||t[17]!==O?(A=(0,U.jsx)(`div`,{className:O,children:d}),t[16]=d,t[17]=O,t[18]=A):A=t[18];let M;t[19]!==f||t[20]!==y||t[21]!==C||t[22]!==w||t[23]!==T||t[24]!==A?(M=(0,U.jsxs)(ie,{layer:`modal`,portalContainer:y,children:[C,w,T,A,f]}),t[19]=f,t[20]=y,t[21]=C,t[22]=w,t[23]=T,t[24]=A,t[25]=M):M=t[25];let N;t[26]!==M||t[27]!==S?(N=(0,U.jsxs)(j,{children:[x,(0,U.jsx)(k,{ref:b,className:S,onOpenAutoFocus:Te,children:M})]}),t[26]=M,t[27]=S,t[28]=N):N=t[28];let F;return t[29]!==i||t[30]!==r||t[31]!==N?(F=(0,U.jsx)(L,{open:r,onOpenChange:i,children:N}),t[29]=i,t[30]=r,t[31]=N,t[32]=F):F=t[32],F}function Te(e){return e.preventDefault()}var Ee=(0,H.memo)(function(e){let t=(0,V.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,U.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,U.jsx)(_,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function De(e){let t=(0,V.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,U.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,U.jsx)(E,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,U.jsx)(E,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,U.jsx)(E,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,U.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,U.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}var Oe=`channels-status`;function ke(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function Ae(e){let t=t=>e(t.detail);return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)}function je(e,t){let n=(0,V.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return Ae(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,H.useEffect)(i,a)}function Me(e){return e?d(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Ne(e){return(await u(d(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Pe=[`enabled`];async function Fe(){let e=await u(d(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Ie(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function Le(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function Y(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Re(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function ze(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function Be(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Ve(e){if(!e)return[];let t=e.uiHints??{},n=X(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=Y(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=Object.entries(t).filter(([,e])=>!X(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Pe.includes(e));return Array.from(new Set([...i,...n,...r])).filter(e=>!Pe.includes(e))}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function He(e,t){let n={...Z(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!X(r)||!X(r[n]))break;let o=X(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...Z(r[n]),properties:{}}),e===t.length-1){o[n]=Z(r[n]);break}i=r[n],a=o[n]}}return n}function Ue(e){let t=e.properties;if(!X(t))return!1;for(let[e,n]of Object.entries(t))X(n)&&n.type===`object`&&Ue(n)&&delete t[e];return Object.keys(t).length===0}function We(e,t){let n=Z(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!X(i))break;if(e===t.length-1){delete i[n];break}if(!X(i[n]))break;r=i[n]}}return Ue(n),n}function Ge(e){return e.type===`object`&&X(e.properties)&&Object.keys(e.properties).length>0}function Ke(e,t){let n=e;for(let e of t.split(`.`)){if(!X(n))return;n=n[e]}return n}function qe(e){let t=e.accounts;return X(t)?Object.values(t).filter(e=>X(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Je(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ye(e,t,n){let r=[],i=Y(e);if(i.issues.length>0&&r.push(Qe(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Je(e,Ke(t,e),n);i&&r.push(i)}let a=qe(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Q(e,t){let n=Y(e),r=he(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function Xe(e,t){let n=he(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function Ze(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function Qe(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function $e({entry:e}){let t=l(e=>e.token),[n,r]=(0,H.useState)(!1),i=(0,H.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(d(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Ie(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,U.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,U.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,U.jsx)(S,{sourceChannel:e.id,className:`size-7`})})}function et(e){let t=(0,V.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,s;t[0]===i?s=t[1]:(s=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=s);let c=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,l=r&&`cursor-not-allowed opacity-60`,u;t[2]!==c||t[3]!==l?(u=o(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d=n?`translate-x-5`:`translate-x-0.5`,f;t[5]===d?f=t[6]:(f=o(`size-5 rounded-full bg-white shadow-surface transition-transform`,d),t[5]=d,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,U.jsx)(`span`,{className:f}),t[7]=f,t[8]=p);let m;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==u||t[14]!==p?(m=(0,U.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:s,className:u,children:p}),t[9]=n,t[10]=r,t[11]=a,t[12]=s,t[13]=u,t[14]=p,t[15]=m):m=t[15],m}function tt(e){let t=(0,V.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:s,ch:c,onOpen:l,onToggle:u,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=Y(n),t[0]=n,t[1]=f);let p=f,m,h,g,_,v,y,b;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==l||t[7]!==d||t[8]!==u||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ye(n,r,c),s=Ze(n,c);m=!p.enabled&&p.ready?u:i===`stopped`?d:l,y=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let f;t[19]===n?f=t[20]:(f=(0,U.jsx)($e,{entry:n}),t[19]=n,t[20]=f);let x;t[21]===n.label?x=t[22]:(x=(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=x);let S;t[23]===i?S=t[24]:(S=o(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,Be(i)),t[23]=i,t[24]=S);let C;t[25]!==c||t[26]!==i?(C=Re(i,c),t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,U.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==x?(T=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[x,w]}),t[31]=w,t[32]=x,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==f?(E=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[f,T]}),t[34]=T,t[35]=f,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==c.toggleChannel||t[38]!==n.label?(O=c.toggleChannel.replace(`{{channel}}`,n.label),t[37]=c.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==u||t[42]!==p.enabled||t[43]!==O?(k=(0,U.jsx)(et,{checked:D,disabled:a,label:O,onToggle:u}),t[40]=a,t[41]=u,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(b=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=b):b=t[47],h=`button`,g=l,_=`mt-5 min-h-[6.25rem] text-left`,v=p.ready?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,U.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(rt)}):null]}):(0,U.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:c.cardSetupTitle}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??Xe(n,c)}),s.length>0?(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:s.map(nt)}):null]}),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=l,t[7]=d,t[8]=u,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b}else m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18];let x;t[48]!==h||t[49]!==g||t[50]!==_||t[51]!==v?(x=(0,U.jsx)(`button`,{type:h,onClick:g,className:_,children:v}),t[48]=h,t[49]=g,t[50]=_,t[51]=v,t[52]=x):x=t[52];let S=a||s,C;t[53]!==a||t[54]!==s?(C=a||s?(0,U.jsx)(M,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=s,t[55]=C):C=t[55];let w;t[56]!==c||t[57]!==n||t[58]!==s||t[59]!==i?(w=s?c.restartingChannel:i===`stopped`?c.restartChannel:Q(n,c),t[56]=c,t[57]=n,t[58]=s,t[59]=i,t[60]=w):w=t[60];let T;t[61]!==m||t[62]!==C||t[63]!==w||t[64]!==S?(T=(0,U.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,U.jsxs)(E,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:S,children:[C,w]})}),t[61]=m,t[62]=C,t[63]=w,t[64]=S,t[65]=T):T=t[65];let D;return t[66]!==T||t[67]!==y||t[68]!==b||t[69]!==x?(D=(0,U.jsxs)(`article`,{className:y,children:[b,x,T]}),t[66]=T,t[67]=y,t[68]=b,t[69]=x,t[70]=D):D=t[70],D}function nt(e){return(0,U.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function rt(e){return(0,U.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function it(e){let t=(0,V.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:c,ch:l,onRestart:u,onCheck:d,onManageConnection:f}=e,p=n===`running`?A:n===`stopped`||n===`needs_setup`?s:M,m=n===`running`&&`text-emerald-600 dark:text-emerald-400`,h=n===`stopped`&&`text-red-600 dark:text-red-400`,g=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,_=n===`disabled`&&`text-fg-muted`,v=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,y;t[0]!==m||t[1]!==h||t[2]!==g||t[3]!==_||t[4]!==v?(y=o(`mt-0.5 size-5 shrink-0`,m,h,g,_,v),t[0]=m,t[1]=h,t[2]=g,t[3]=_,t[4]=v,t[5]=y):y=t[5];let b;t[6]!==p||t[7]!==y?(b=(0,U.jsx)(p,{className:y}),t[6]=p,t[7]=y,t[8]=b):b=t[8];let x;t[9]===l.connectionStatus?x=t[10]:(x=(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=x);let S;t[11]!==l||t[12]!==n?(S=ze(n,l),t[11]=l,t[12]=n,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S}),t[14]=S,t[15]=C);let T;t[16]!==C||t[17]!==x?(T=(0,U.jsxs)(`div`,{children:[x,C]}),t[16]=C,t[17]=x,t[18]=T):T=t[18];let D;t[19]!==T||t[20]!==b?(D=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[b,T]}),t[19]=T,t[20]=b,t[21]=D):D=t[21];let O=i||r,k;t[22]===i?k=t[23]:(k=i?(0,U.jsx)(M,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=k);let j=i?l.checkingConnection:l.checkConnection,N;t[24]!==d||t[25]!==O||t[26]!==k||t[27]!==j?(N=(0,U.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:O,onClick:d,children:[k,j]}),t[24]=d,t[25]=O,t[26]=k,t[27]=j,t[28]=N):N=t[28];let P;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==u||t[33]!==r||t[34]!==n?(P=n===`stopped`?(0,U.jsxs)(E,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:u,children:[r?(0,U.jsx)(M,{className:`size-4 animate-spin`}):(0,U.jsx)(w,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=u,t[33]=r,t[34]=n,t[35]=P):P=t[35];let F;t[36]!==c||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==f||t[41]!==r||t[42]!==a?(F=c?(0,U.jsx)(E,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:f,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=c,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=f,t[41]=r,t[42]=a,t[43]=F):F=t[43];let I;t[44]!==N||t[45]!==P||t[46]!==F?(I=(0,U.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[N,P,F]}),t[44]=N,t[45]=P,t[46]=F,t[47]=I):I=t[47];let L;return t[48]!==D||t[49]!==I?(L=(0,U.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[D,I]})}),t[48]=D,t[49]=I,t[50]=L):L=t[50],L}function at(e){let t=(0,V.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Y(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,U.jsx)(F,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,U.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,U.jsx)(`li`,{children:Qe(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,U.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,U.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,U.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let g;return t[30]!==h||t[31]!==d?(g=(0,U.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=g):g=t[32],g}function ot(){let e=p(e=>e.language),t=c(e),n=l(e=>!!e.token),r=i(),{channelId:s}=a(),u=C(s),h=pe(n,e),_=h.entries,{data:v,mutate:b,isValidating:S}=m(n?fe():null,de,{revalidateOnFocus:!0}),{data:w,mutate:T}=m(n?`channels-config-map`:null,Fe,{revalidateOnFocus:!1}),E=w?.channels??{},k=w?.bindings??[],{data:A}=m(n?`channel-routing-agents`:null,I,{revalidateOnFocus:!1}),j=ee(e=>e.setPageHeader),M=ee(e=>e.clearPageHeader),P=(0,H.useMemo)(()=>_.find(e=>e.id===u),[u,_]),F=P?Le(P):null,{data:L,mutate:R}=m(n&&F?Me(F):null,()=>Ne(F)),[z,B]=(0,H.useState)(null),[te,re]=(0,H.useState)(!1),[ie,ae]=(0,H.useState)(null),[ue,V]=(0,H.useState)(null),[me,ge]=(0,H.useState)(!1),[W,G]=(0,H.useState)(null),[K,q]=(0,H.useState)(null),ve=z??L??{},J=t.channelsSettings,xe=(0,H.useMemo)(()=>P?.configSchema??{type:`object`,properties:{}},[P?.configSchema]),Ce=(0,H.useMemo)(()=>We(xe,Pe),[xe]),Te=(0,H.useMemo)(()=>Ve(P),[P]),Oe=(0,H.useMemo)(()=>He(Ce,Te),[Te,Ce]),Ae=(0,H.useMemo)(()=>We(Ce,Te),[Te,Ce]),Ie=(0,H.useMemo)(()=>Ge(Oe),[Oe]),ze=P?K??ye(k,P.id):``,X=(0,H.useMemo)(()=>(A?.items??[]).map(e=>{let n=N(e,t.agentsSettings);return{value:e.id,label:n===e.id?n:`${n} · ${e.id}`}}),[A?.items,t.agentsSettings]),Z=A?.items.find(e=>e.id===A.defaultId),Ue=Z?N(Z,t.agentsSettings):A?.defaultId??``,Ke=(0,H.useMemo)(()=>({defaultBooleanLabel:J.schemaBooleanDefault,unsupportedArrayType:J.schemaUnsupportedArrayType,arrayAddPlaceholder:J.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>J.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[J]),qe=(0,H.useMemo)(()=>new Map((v??[]).map(e=>[e.name,e])),[v]),Je=v!==void 0,Ye=(0,H.useCallback)(e=>Se(e,qe.get(e.id),Je),[qe,Je]),Q=(0,H.useCallback)(async()=>{await Promise.all([h.mutate(),b()])},[h,b]);je((0,H.useCallback)(e=>{let t=ke(e);t&&b(t,!1)},[b]),n);let Xe=(0,H.useMemo)(()=>n?(0,U.jsx)(Ee,{ch:J,refreshing:h.isValidating||S,saveOk:!1,onRefresh:()=>void Q()}):null,[h.isValidating,J,n,S,Q]);(0,H.useLayoutEffect)(()=>(j({startExtra:null,main:(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Xe}),()=>M()),[M,Xe,t.settingsSections.channels,j]);let Ze=(0,H.useCallback)(e=>{r(x(e)),B(null),q(null),G(null)},[r]),Qe=(0,H.useCallback)(()=>{r(y),B(null),q(null),G(null)},[r]),nt=(0,H.useCallback)(async e=>{V(e.id),G(null);try{let t=await f(d(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){G(e instanceof Error?e.message:String(e))}finally{V(null)}},[Q]);(0,H.useEffect)(()=>{q(null),ge(!1)},[P?.id]);let rt=(0,H.useCallback)(async()=>{if(!P||!z&&K===null)return!1;let e=Le(P);re(!0),G(null);try{let t=await f(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({...z?{channels:{[e]:z}}:{},...K===null?{}:{bindings:be(k,P.id,K)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return z&&await R(z,!1),await T(),await h.mutate(),B(null),q(null),!0}catch(e){return G(e instanceof Error?e.message:String(e)),!1}finally{re(!1)}},[P,K,k,h,z,T,R]),ot=(0,H.useCallback)(async e=>{let t=Y(e),n=Le(e),r=P?.id===e.id?z:null;if(!t.enabled&&!t.ready&&!r){Ze(e.id);return}ae(e.id),G(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await f(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await h.mutate(),await T(),await b(),P?.id===e.id&&(await R(),B(null))}catch(e){G(e instanceof Error?e.message:String(e))}finally{ae(null)}},[P?.id,h,z,T,R,b,Ze]),$=P?.ui?.modal,st=$?.placement!==`replace-config`,ct=P?Ye(P):`checking`,lt=P?!Y(P).ready||me:!1;return n?(0,U.jsxs)(se,{gap:`gap-4`,children:[h.isLoading?(0,U.jsx)(ce,{sections:2}):h.error?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(h.error)}):(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:_.map(e=>(0,U.jsx)(tt,{entry:e,config:E[Le(e)]?.config,runtime:Ye(e),busy:ie===e.id,restarting:ue===e.id,ch:J,onOpen:()=>Ze(e.id),onToggle:()=>void ot(e),onRestart:()=>void nt(e)},e.id))}),W?(0,U.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:W}):null,(0,U.jsx)(we,{presentation:`modal`,open:!!P,onOpenChange:e=>{e||Qe()},closeAriaLabel:J.close,srTitle:P?.label??J.selectChannel,srDescription:P?.description,wide:!0,footer:P?(0,U.jsx)(De,{ch:J,dirty:!!z||K!==null,saving:te,onCancel:Qe,onDiscard:()=>{B(null),q(null)},onSave:rt}):null,children:P?(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 px-3 py-3 shadow-surface`,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)($e,{entry:P}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:P.label}),(0,U.jsx)(`span`,{className:o(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Be(ct)),children:Re(ct,J)})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:!Y(P).ready&&he(P)?.[1].result===`qr`?J.scanLoginHint.replace(`{{channel}}`,P.label):P.description}),P.docsPath?(0,U.jsxs)(`a`,{href:P.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[J.docs,(0,U.jsx)(D,{className:`size-3.5`})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,U.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:Y(P).enabled?J.enabledLabel:J.disabledLabel}),(0,U.jsx)(et,{checked:Y(P).enabled,disabled:ie===P.id,label:J.toggleChannel.replace(`{{channel}}`,P.label),onToggle:()=>void ot(P)})]})]})}),(0,U.jsx)(it,{runtime:ct,restarting:ue===P.id,checking:S,showConnectionOptions:me,canManageConnection:Y(P).ready&&$?.placement!==`replace-config`,ch:J,onRestart:()=>void nt(P),onCheck:()=>void Q(),onManageConnection:()=>ge(e=>!e)}),(0,U.jsx)(at,{entry:P,ch:J}),lt&&$?.placement!==`replace-config`?(0,U.jsx)(_e,{entry:P,locale:e,messages:J,compact:!0,onChanged:async()=>{await R(),await Q(),await T()}},P.id):null,$?.entrypoint&&$.placement===`before-config`?(0,U.jsx)(ne,{extensionId:P.extensionId,extensionName:P.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:P.id,entry:P,config:ve}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,U.jsx)(ne,{extensionId:P.extensionId,extensionName:P.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:P.id,entry:P,config:ve}}):null,st&&Ie?(0,U.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.basicConfiguration}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.basicConfigurationHint})]}),(0,U.jsx)(le,{schema:Oe,values:ve,onChange:e=>B(e),disabled:te,labels:Ke})]}):null,(0,U.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(g,{className:`size-4 text-fg-muted`}),J.messageHandling]}),(0,U.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.agentRouting}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.messageHandlingHint})]}),(0,U.jsx)(O,{value:ze,options:X,placeholder:J.agentRoutingSelect,emptyLabel:J.agentRoutingDefault.replace(`{{agent}}`,Ue||J.agentRoutingSelect),ariaLabel:J.agentRouting,disabled:te||!A,onChange:e=>q(e)})]})]}),st&&Ge(Ae)?(0,U.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(g,{className:`size-4 text-fg-muted`}),J.advancedConfiguration]}),(0,U.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,U.jsx)(le,{schema:Ae,values:ve,onChange:e=>B(e),disabled:te,labels:Ke})})]}):null,W?(0,U.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:W}):null]}):null})]}):(0,U.jsxs)(se,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,U.jsx)(oe,{title:t.settingsSections.channels}),(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.tokenRequired})]})}export{ot as ChannelsSettingsPanel};
@@ -1 +0,0 @@
1
- import{o as e}from"./fetch-8QNN25Sh.js";import{n as t}from"./channel-recipient-api-DuulnhIj.js";function n(){return e(`/api/channels/status`)}var r=t;export{r as n,n as t};
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./check-BODqo66o.js";import{t as o}from"./messages-CzKxM6I4.js";import{a as s,n as c,o as l}from"./fetch-8QNN25Sh.js";import{n as u}from"./locale-store-Ba72bFmP.js";import{$r as d,Co as f,Cs as p,Ds as m,Es as h,Fi as g,Fo as _,Gs as v,Hs as y,Is as b,Jo as x,Kc as S,Ma as C,Ms as w,No as T,Qr as E,Ro as D,So as O,Tc as k,Uo as A,Us as j,Wo as M,Xr as N,Zr as P,_i as F,_o as I,ao as L,as as R,bl as z,bo as B,co as ee,dc as V,ec as H,el as te,fs as ne,gi as re,hi as ie,hs as ae,io as U,ja as oe,ks as se,lo as ce,no as le,oo as ue,qo as de,so as fe,ti as pe,ul as W,uo as G,vi as K,vo as me,wl as q,yi as he}from"./index-BKRqeRHm.js";import{t as ge}from"./page-tabs-D4hkWVt_.js";var J=n(),Y=e(t(),1),X=r(),_e={sm:{frame:`size-9 rounded-lg`,image:`size-6`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-7`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-8`,fallback:`size-5`}};function ve(e){let t=(0,J.c)(18),{connector:n,size:r,className:a}=e,o=r===void 0?`md`:r,s=n?.branding?.logoUrl,[c,l]=(0,Y.useState)(!1),u=_e[o],d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{l(!1)},t[0]=d):d=t[0];let f;t[1]===s?f=t[2]:(f=[s],t[1]=s,t[2]=f),(0,Y.useEffect)(d,f);let p;t[3]!==a||t[4]!==u.frame?(p=i(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-surface-base`,u.frame,a),t[3]=a,t[4]=u.frame,t[5]=p):p=t[5];let m;t[6]===n?m=t[7]:(m=n?.branding?.backgroundColor?{backgroundColor:n.branding.backgroundColor}:void 0,t[6]=n,t[7]=m);let h=n?.displayName,g;t[8]!==u.fallback||t[9]!==u.image||t[10]!==c||t[11]!==s?(g=s&&!c?(0,X.jsx)(`img`,{src:s,alt:``,loading:`lazy`,draggable:!1,className:i(`object-contain`,u.image),onError:()=>l(!0)}):(0,X.jsx)(H,{className:i(`text-fg-muted`,u.fallback),"aria-hidden":!0}),t[8]=u.fallback,t[9]=u.image,t[10]=c,t[11]=s,t[12]=g):g=t[12];let _;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==g?(_=(0,X.jsx)(`span`,{className:p,style:m,title:h,children:g}),t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=_):_=t[17],_}var Z=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`,ye=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function be(e,t){return t.some(t=>t.connectorId===e.id)}function xe(){let e=(0,J.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:i(`size-10 shrink-0 rounded-xl`,Z)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,X.jsx)(`div`,{className:i(`h-4 min-w-0 flex-1`,Z)}),(0,X.jsx)(`div`,{className:i(`h-8 w-[4.5rem] shrink-0 rounded-lg`,Z)})]}),(0,X.jsx)(`div`,{className:i(`h-3 w-full`,Z)}),(0,X.jsx)(`div`,{className:i(`h-3 w-[88%]`,Z)})]})]})}),e[1]=n):n=e[1],n}function Se(){let e=(0,J.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:i(`size-10 shrink-0 rounded-xl`,Z)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,X.jsx)(`div`,{className:i(`h-4 w-48 max-w-full`,Z)}),(0,X.jsx)(`div`,{className:i(`h-3 w-72 max-w-full`,Z)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(`div`,{className:i(`h-9 w-20 rounded-lg`,Z)}),(0,X.jsx)(`div`,{className:i(`h-9 w-20 rounded-lg`,Z)})]})]})]}),e[2]=r):r=e[2];let a;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,X.jsx)(`div`,{className:i(`h-8 w-20 rounded-md`,Z)}),(0,X.jsx)(`div`,{className:i(`h-8 w-24 rounded-md`,Z)}),(0,X.jsx)(`div`,{className:i(`h-8 w-28 rounded-md`,Z)})]}),(0,X.jsx)(`div`,{className:i(`mt-3 h-20 rounded-xl`,Z)})]}),e[3]=a):a=e[3],a}function Ce(e){let t=(0,J.c)(80),{connector:n,installed:r,onInstall:a,onOpenDetails:o,t:s}=e,c,l,u,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==r||t[2]!==a||t[3]!==o||t[4]!==s.connect||t[5]!==s.connectedBadge||t[6]!==s.connectorBeta||t[7]!==s.connectorCapabilityLabels||t[8]!==s.connectorExperimental||t[9]!==s.connectorVerified||t[10]!==s.integrationStrategyComposio||t[11]!==s.integrationStrategyMcp||t[12]!==s.integrationStrategyNative){let e=n.capabilities.filter(we),v=e.slice(0,3),y=Math.max(0,e.length-v.length),b=s.connect,x=n.verificationLevel===`verified`?s.connectorVerified:n.verificationLevel===`beta`?s.connectorBeta:n.verificationLevel===`experimental`?s.connectorExperimental:null,S=n.integrationStrategy?.lane===`native`?s.integrationStrategyNative:n.integrationStrategy?.lane===`mcp`?s.integrationStrategyMcp:n.integrationStrategy?.lane===`composio`?s.integrationStrategyComposio:null,C;t[23]!==b||t[24]!==n||t[25]!==a?(C=e=>(0,X.jsxs)(M,{type:`button`,variant:`primary`,className:i(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:e=>{e.stopPropagation(),a(n)},children:[(0,X.jsx)(H,{className:`size-4`}),b]}),t[23]=b,t[24]=n,t[25]=a,t[26]=C):C=t[26],c=C;let w;t[27]!==n||t[28]!==o?(w=e=>{!o||e.currentTarget!==e.target||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),o(n))},t[27]=n,t[28]=o,t[29]=w):w=t[29];let T=w,E=o?`cursor-pointer`:null;t[30]===E?p=t[31]:(p=i(`group flex min-h-[9.5rem] flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,E),t[30]=E,t[31]=p),m=o?`button`:void 0,h=o?0:void 0,t[32]!==n||t[33]!==o?(g=()=>o?.(n),t[32]=n,t[33]=o,t[34]=g):g=t[34],_=T,l=`flex min-w-0 flex-1 flex-col`;let D;t[35]===n?D=t[36]:(D=(0,X.jsx)(ve,{connector:n}),t[35]=n,t[36]=D);let O;t[37]===n.displayName?O=t[38]:(O=(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[37]=n.displayName,t[38]=O);let k;t[39]===x?k=t[40]:(k=x?(0,X.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:x}):null,t[39]=x,t[40]=k);let A;t[41]===S?A=t[42]:(A=S?(0,X.jsx)(`span`,{className:`ml-1 mt-1 inline-flex rounded-full border border-accent/20 bg-accent-soft px-1.5 py-0.5 text-[10px] font-medium text-accent-fg`,children:S}):null,t[41]=S,t[42]=A);let j;t[43]!==O||t[44]!==k||t[45]!==A?(j=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[O,k,A]}),t[43]=O,t[44]=k,t[45]=A,t[46]=j):j=t[46];let N;t[47]!==D||t[48]!==j?(N=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[D,j]}),t[47]=D,t[48]=j,t[49]=N):N=t[49];let P;t[50]!==r||t[51]!==c?(P=r?null:(0,X.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 transition-opacity sm:pointer-events-none sm:flex sm:opacity-0 sm:group-hover:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:pointer-events-auto sm:group-focus-within:opacity-100`,children:c()}),t[50]=r,t[51]=c,t[52]=P):P=t[52];let F;t[53]!==r||t[54]!==s.connectedBadge?(F=r?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,X.jsx)(z,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[53]=r,t[54]=s.connectedBadge,t[55]=F):F=t[55];let I;t[56]!==P||t[57]!==F?(I=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[P,F]}),t[56]=P,t[57]=F,t[58]=I):I=t[58],t[59]!==N||t[60]!==I?(u=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[N,I]}),t[59]=N,t[60]=I,t[61]=u):u=t[61],t[62]===n.description?d=t[63]:(d=(0,X.jsx)(`p`,{className:`mt-4 line-clamp-2 text-sm leading-6 text-fg-muted`,title:n.description,children:n.description}),t[62]=n.description,t[63]=d),f=v.length>0?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[v.map(e=>(0,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:s.connectorCapabilityLabels[e]??e},e)),y>0?(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,y]}):null]}):null,t[0]=n,t[1]=r,t[2]=a,t[3]=o,t[4]=s.connect,t[5]=s.connectedBadge,t[6]=s.connectorBeta,t[7]=s.connectorCapabilityLabels,t[8]=s.connectorExperimental,t[9]=s.connectorVerified,t[10]=s.integrationStrategyComposio,t[11]=s.integrationStrategyMcp,t[12]=s.integrationStrategyNative,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_}else c=t[13],l=t[14],u=t[15],d=t[16],f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22];let v;t[64]!==l||t[65]!==u||t[66]!==d||t[67]!==f?(v=(0,X.jsxs)(`div`,{className:l,children:[u,d,f]}),t[64]=l,t[65]=u,t[66]=d,t[67]=f,t[68]=v):v=t[68];let y;t[69]!==r||t[70]!==c?(y=r?null:(0,X.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:c(`w-full`)}),t[69]=r,t[70]=c,t[71]=y):y=t[71];let b;return t[72]!==v||t[73]!==y||t[74]!==p||t[75]!==m||t[76]!==h||t[77]!==g||t[78]!==_?(b=(0,X.jsxs)(`div`,{className:p,role:m,tabIndex:h,onClick:g,onKeyDown:_,children:[v,y]}),t[72]=v,t[73]=y,t[74]=p,t[75]=m,t[76]=h,t[77]=g,t[78]=_,t[79]=b):b=t[79],b}function we(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function Q(e,t){if(!e.payload)throw Error(e.error??t);return e.payload}async function Te(){let[e,t]=await Promise.all([c(l(`/api/connectors/catalog`)),Ee().catch(()=>[])]),n=Q(e,`Could not load connector catalog.`).connectors;return[...new Map([...t,...n].map(e=>[e.id,e])).values()]}async function Ee(e=!1){return Q(await c(l(`/api/connectors/composio/catalog${e?`?refresh=1`:``}`)),`Could not load Composio catalog.`).connectors}async function De(e){let t=new URLSearchParams;return e?.q?.trim()&&t.set(`q`,e.q.trim()),e?.page&&t.set(`page`,String(e.page)),e?.pageSize&&t.set(`pageSize`,String(e.pageSize)),e?.category?.trim()&&t.set(`category`,e.category.trim()),e?.sort&&t.set(`sort`,e.sort),Q(await c(l(`/api/capabilities/connectors${t.size?`?${t.toString()}`:``}`)),`Could not load Store connector capabilities.`)}async function Oe(e,t){return Q(await c(l(`/api/capabilities/connectors/${encodeURIComponent(e)}/install-plan`),{method:`POST`,body:JSON.stringify({version:t})}),`Could not prepare connector installation.`).plan}async function ke(e,t,n){let r=await c(l(`/api/capabilities/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify({...t,version:n})});return oe(),Q(r,`Could not install Store connector.`).instance}async function Ae(){return Q(await c(l(`/api/connectors/catalog`)),`Could not load connector registries.`).registries??[]}async function je(){return Q(await c(l(`/api/connectors/installed`)),`Could not load installed connectors.`).instances}var Me=new Map,Ne=300*1e3;async function Pe(e,t=`all`,n){let r=e.trim(),i=t.trim()||`all`,a=n?.browse??!1,o=Math.max(n?.page??1,1),s=Math.max(n?.pageSize??24,1),u=`${i}:${r}:${a?`browse`:`search`}:${o}:${s}`,d=Date.now(),f=Me.get(u);if(f&&f.expiresAt>d)return f.promise;let p=new URLSearchParams;r&&p.set(`q`,r),i!==`all`&&p.set(`source`,i),a&&p.set(`browse`,`1`),p.set(`page`,String(o)),p.set(`pageSize`,String(s));let m=c(l(`/api/connectors/registry/search?${p.toString()}`)).then(e=>{let t=Q(e,`Could not search connector registries.`),n=Math.max(0,...(t.results??[]).map(e=>e.totalPages??0))||void 0;return{connectors:t.connectors,totalPages:n}});Me.set(u,{expiresAt:d+Ne,promise:m});try{return await m}catch(e){throw Me.delete(u),e}}async function Fe(e){return Q(await c(l(`/api/connectors/${encodeURIComponent(e)}/auth/start`),{method:`POST`}),`Could not start connector authorization.`).authorization}async function Ie(e,t){let n=await c(l(`/api/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify(t)});return oe(),Q(n,`Could not install connector.`).instance}async function Le(e,t={}){return Q(await c(l(`/api/connectors/preview`),{method:`POST`,body:JSON.stringify({...t,definition:e})}),`Could not preview connector capabilities.`).preview}async function Re(e,t){return Q(await c(l(`/api/connectors/${encodeURIComponent(e)}/config`),{method:`POST`,body:JSON.stringify(t)}),`Could not update connector config.`).instance}async function ze(e){await c(l(`/api/connectors/${encodeURIComponent(e)}`),{method:`DELETE`}),oe()}async function Be(e){return Q(await c(l(`/api/connectors/${encodeURIComponent(e)}/test`),{method:`POST`}),`Connector test failed.`)}async function Ve(){return Q(await c(l(`/api/connectors/composio/connections`)),`Could not load Composio connections.`).connections}async function He(e,t){return Q(await c(l(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio connection.`).connection}async function Ue(e){return Q(await c(l(`/api/connectors/composio/${encodeURIComponent(e)}/health`)),`Could not check Composio connector health.`).health}async function We(e){await c(l(`/api/connectors/composio/connections/${encodeURIComponent(e)}/refresh`),{method:`POST`})}async function Ge(e){await c(l(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Ke(e){return Q(await c(l(`/api/connectors/composio/${encodeURIComponent(e)}/scope`)),`Could not load Composio scope.`).scope}async function qe(e,t){let n=await c(l(`/api/connectors/composio/${encodeURIComponent(e)}/scope`),{method:`POST`,body:JSON.stringify({scope:t})});return oe(),Q(n,`Could not update Composio scope.`).scope}async function Je(e){return Q(await c(l(`/api/connectors/composio/${encodeURIComponent(e)}/policy`)),`Could not load Composio policy.`)}async function Ye(e,t){return Q(await c(l(`/api/connectors/composio/${encodeURIComponent(e)}/policy`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio policy.`).policy}async function Xe(e){return Q(await c(l(`/api/connectors/composio/${encodeURIComponent(e)}/tools`)),`Could not load Composio tools.`).tools}async function Ze(e=50){return Q(await c(l(`/api/connectors/composio/triggers?limit=${encodeURIComponent(String(e))}`)),`Could not load Composio trigger events.`).events}async function Qe(e){return Q(await c(l(`/api/connectors/${encodeURIComponent(e.connectorId)}/memory-sync`),{method:`POST`,body:JSON.stringify(e)}),`Could not sync connector data to memory.`)}async function $e(e=`pending`){return Q(await c(l(`/api/connectors/approvals?status=${encodeURIComponent(e)}`)),`Could not load connector approvals.`).approvals}async function et(e,t){return Q(await c(l(`/api/connectors/approvals/respond`),{method:`POST`,body:JSON.stringify({id:e,decision:t})}),`Could not update connector approval.`).approval}function tt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function nt(e,t){return t.connectorCapabilityLabels[e]??e}function rt(e,t){if(e.runtime.type===`mcp`)return tt(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`channel`?e.runtime.channelId:e.runtime.type===`nativeTool`?e.runtime.toolsetId:e.runtime.sourceKind;return tt(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function it(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function at(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function ot(e){let t=(0,J.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,16).map(st),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,X.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-16]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,X.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function st(e){return(0,X.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,X.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function ct({connector:e,installed:t,onClose:n,onInstall:r,t:a}){let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),f=at(e),p=e.capabilities.slice(0,8),h=Math.max(0,e.capabilities.length-p.length),g=[...(e.setup.secrets??[]).map(e=>({key:`secret:${e.key}`,label:e.label,description:e.description,required:e.required,kind:a.connectorSetupSecret})),...(e.setup.config??[]).map(e=>({key:`config:${e.key}`,label:e.label,description:e.description,required:!!e.required,kind:a.connectorSetupConfig}))],_=async()=>{s(!0),d(null);try{l(await Le(e))}catch(e){l(null),d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,X.jsx)(ce,{open:!0,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(ee,{children:[(0,X.jsx)(fe,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(L,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,52rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ve,{connector:e,size:`lg`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.source}),(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.kind}),t?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,X.jsx)(z,{className:`size-3`,"aria-hidden":!0}),a.connectedBadge]}):null]}),(0,X.jsx)(G,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,X.jsx)(ue,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,D.focusRingPanel),"aria-label":a.modalClose,children:[(0,X.jsx)(de,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,X.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),a.detailTools]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:c?tt(a.connectorPreviewToolsCount,{count:c.toolCount}):a.connectorPreviewUnknown})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),a.detailPermissions]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:it(e,a)})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,X.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.connectorRequiredInputs]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:tt(a.connectorRequiredInputsCount,{count:f})})]})]}),(0,X.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.connectorCapabilitiesTitle}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:nt(e,a)},e)),h>0?(0,X.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,h]}):null]}),(0,X.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.connectorCapabilitiesHint})]}),u?(0,X.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u}):null,c?(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.connectorPreviewTitle}),(0,X.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs font-medium`,c.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:c.ok?a.healthStatusHealthy:a.healthStatusLabels[c.status]??c.status})]}),(0,X.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:c.toolCount}),(0,X.jsx)(`div`,{className:`text-fg-muted`,children:a.toolsMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:c.resourceCount}),(0,X.jsx)(`div`,{className:`text-fg-muted`,children:a.resourcesMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:c.promptCount}),(0,X.jsx)(`div`,{className:`text-fg-muted`,children:a.promptsMetric})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[(0,X.jsx)(ot,{title:a.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,X.jsx)(ot,{title:a.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,X.jsx)(ot,{title:a.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??tt(a.promptArgumentCount,{count:e.argumentCount})}))})]}),c.error?(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:c.error}):null,c.action?(0,X.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:c.action}):null]}):null]}),(0,X.jsxs)(`aside`,{className:`space-y-3`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(k,{className:`size-4 text-accent`,"aria-hidden":!0}),a.detailPermissions]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:it(e,a)})]}),(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),a.connectorSetupTitle]}),g.length>0?(0,X.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:g.map(e=>(0,X.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e.kind}),e.required?(0,X.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-1.5 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:a.connectorSetupRequired}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,X.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:a.connectorSetupNone})]}),(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(m,{className:`size-4 text-accent`,"aria-hidden":!0}),a.connectorRuntimeTitle]}),(0,X.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:rt(e,a)})]})]})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(M,{variant:`secondary`,children:a.modalClose})}),(0,X.jsxs)(M,{variant:`secondary`,disabled:o,onClick:()=>void _(),children:[o?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(x,{className:`size-4`}),a.connectorPreviewButton]}),t?(0,X.jsxs)(M,{variant:`secondary`,disabled:!0,children:[(0,X.jsx)(v,{className:`size-4`}),a.connectedBadge]}):(0,X.jsxs)(M,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,X.jsx)(H,{className:`size-4`}),a.connect]})]})]})]})})}var lt=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A);function ut(e){let t=(0,J.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:a,onChange:o,onSave:s,onClose:c,t:l,mcp:u}=e,d;t[0]===c?d=t[1]:(d=e=>{e||c()},t[0]=c,t[1]=d);let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(fe,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(32rem,calc(100vh-2rem))] w-[min(100%-2rem,38rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,X.jsx)(j,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=m):m=t[4];let h;t[5]===l.runtimeSettingsTitle?h=t[6]:(h=(0,X.jsx)(G,{className:`text-base font-semibold text-fg`,children:l.runtimeSettingsTitle}),t[5]=l.runtimeSettingsTitle,t[6]=h);let g;t[7]===l.runtimeSettingsHint?g=t[8]:(g=(0,X.jsx)(ue,{className:`mt-1 text-sm text-fg-muted`,children:l.runtimeSettingsHint}),t[7]=l.runtimeSettingsHint,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[m,(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,g]})]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,D.focusRingPanel),t[12]=v):v=t[12];let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(de,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=y):y=t[13];let b;t[14]===l.modalClose?b=t[15]:(b=(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:v,"aria-label":l.modalClose,children:y})}),t[14]=l.modalClose,t[15]=b);let x;t[16]!==b||t[17]!==_?(x=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[_,b]}),t[16]=b,t[17]=_,t[18]=x):x=t[18];let S;t[19]===u.idleTtlLabel?S=t[20]:(S=(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:u.idleTtlLabel}),t[19]=u.idleTtlLabel,t[20]=S);let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=i(lt,`w-40 flex-none`),t[21]=C):C=t[21];let w=r??``,T;t[22]===o?T=t[23]:(T=e=>{let t=e.currentTarget.value.trim();o(t===``?void 0:Number.parseInt(t,10))},t[22]=o,t[23]=T);let E;t[24]!==u.idleTtlPlaceholder||t[25]!==w||t[26]!==T?(E=(0,X.jsx)(`input`,{type:`number`,min:0,className:C,value:w,placeholder:u.idleTtlPlaceholder,onChange:T}),t[24]=u.idleTtlPlaceholder,t[25]=w,t[26]=T,t[27]=E):E=t[27];let O;t[28]===u.idleTtlHint?O=t[29]:(O=(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:u.idleTtlHint}),t[28]=u.idleTtlHint,t[29]=O);let k;t[30]!==S||t[31]!==E||t[32]!==O?(k=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,X.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[S,E,O]})}),t[30]=S,t[31]=E,t[32]=O,t[33]=k):k=t[33];let A;t[34]!==c||t[35]!==a||t[36]!==l.modalCancel?(A=(0,X.jsx)(M,{type:`button`,variant:`secondary`,disabled:a,onClick:c,children:l.modalCancel}),t[34]=c,t[35]=a,t[36]=l.modalCancel,t[37]=A):A=t[37];let N;t[38]===s?N=t[39]:(N=()=>void s(),t[38]=s,t[39]=N);let P;t[40]===a?P=t[41]:(P=a?(0,X.jsx)(V,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=a,t[41]=P);let F;t[42]!==u.save||t[43]!==a||t[44]!==N||t[45]!==P?(F=(0,X.jsxs)(M,{type:`button`,variant:`primary`,disabled:a,onClick:N,children:[P,u.save]}),t[42]=u.save,t[43]=a,t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;t[47]!==A||t[48]!==F?(I=(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[A,F]}),t[47]=A,t[48]=F,t[49]=I):I=t[49];let R;t[50]!==x||t[51]!==k||t[52]!==I?(R=(0,X.jsxs)(ee,{children:[f,(0,X.jsxs)(L,{className:p,children:[x,k,I]})]}),t[50]=x,t[51]=k,t[52]=I,t[53]=R):R=t[53];let z;return t[54]!==n||t[55]!==d||t[56]!==R?(z=(0,X.jsx)(ce,{open:n,onOpenChange:d,children:R}),t[54]=n,t[55]=d,t[56]=R,t[57]=z):z=t[57],z}var dt=(0,Y.memo)(function(e){let t=(0,J.c)(12),{value:n,onChange:r,placeholder:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`relative flex min-h-9 min-w-0 flex-1 cursor-text items-center rounded-pill border border-edge bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface`,o),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(se,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=c):c=t[2];let l;t[3]===r?l=t[4]:(l=e=>r(e.currentTarget.value),t[3]=r,t[4]=l);let u;t[5]!==a||t[6]!==l||t[7]!==n?(u=(0,X.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:n,onChange:l,placeholder:a,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),t[5]=a,t[6]=l,t[7]=n,t[8]=u):u=t[8];let d;return t[9]!==s||t[10]!==u?(d=(0,X.jsxs)(`label`,{className:s,children:[c,u]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}),ft=(0,Y.memo)(function(e){let t=(0,J.c)(30),{onBrowseCatalog:n,onAddCustomServer:r,onOpenRuntimeSettings:a,addLabel:o,browseLabel:s,customLabel:c,settingsLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=u):u=t[0];let f;t[1]===l?f=t[2]:(f=(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:l}),t[1]=l,t[2]=f);let p;t[3]!==a||t[4]!==l||t[5]!==f?(p=(0,X.jsxs)(M,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":l,title:l,onClick:a,children:[u,f]}),t[3]=a,t[4]=l,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(y,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=m):m=t[7];let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(q,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=g):g=t[8];let _;t[9]===o?_=t[10]:(_=(0,X.jsx)(pe,{asChild:!0,children:(0,X.jsxs)(M,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[m,o,g]})}),t[9]=o,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=i(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,D.transition),t[11]=v):v=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(ne,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=b):b=t[12];let S;t[13]!==s||t[14]!==n?(S=(0,X.jsxs)(P,{className:v,onSelect:n,children:[b,s]}),t[13]=s,t[14]=n,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=i(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,D.transition),t[16]=C):C=t[16];let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(x,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=w):w=t[17];let T;t[18]!==c||t[19]!==r?(T=(0,X.jsxs)(P,{className:C,onSelect:r,children:[w,c]}),t[18]=c,t[19]=r,t[20]=T):T=t[20];let O;t[21]!==T||t[22]!==S?(O=(0,X.jsx)(E,{children:(0,X.jsxs)(N,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[S,T]})}),t[21]=T,t[22]=S,t[23]=O):O=t[23];let k;t[24]!==O||t[25]!==_?(k=(0,X.jsxs)(d,{children:[_,O]}),t[24]=O,t[25]=_,t[26]=k):k=t[26];let A;return t[27]!==k||t[28]!==p?(A=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[p,k]}),t[27]=k,t[28]=p,t[29]=A):A=t[29],A}),pt=/^([^:=]+)[:=](.*)$/;function mt(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=pt.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function ht(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function gt(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function _t(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function vt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||_t(t)&&(r[e]=t);return r}function yt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function bt(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function xt(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=yt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=bt(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=ht(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}function St(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:gt(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0}}function Ct(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0}}function wt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||_t(t)?[]:[St(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function Tt(e){return xt(e)}async function Et(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=xt(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await c(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),oe()}function Dt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n==`string`){let e=n.trim();e&&t.push({name:e});continue}if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function Ot(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function kt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function At(e,t){let n=await c(l(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=Dt(n.payload.tools),i=Ot(n.payload.resources),a=kt(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function jt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Mt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function Nt(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function $(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function Pt({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=Nt(e),m=(0,Y.useCallback)(async()=>{o(!0),f(null);try{let t=await At(e.id.trim());u({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),h=(0,Y.useCallback)(async()=>{c(!0),f(null);try{await i()}catch(e){f(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,X.jsxs)(`div`,{className:`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,onClick:r,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]})]}),p?(0,X.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-subtle`,title:p,children:p}):null,d?(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null,l?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:$(n.customCapabilitySummary,{tools:String(l.toolCount),resources:String(l.resourceCount),prompts:String(l.promptCount)})}):null]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(M,{variant:`secondary`,disabled:a,onClick:()=>void m(),children:[a?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(v,{className:`size-4`}),t.testConnection]}),(0,X.jsxs)(M,{variant:`ghost`,disabled:s,onClick:()=>void h(),children:[s?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(R,{className:`size-4`}),t.removeServer]})]})]})]})}function Ft(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function It(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||Ft(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
2
- `).toLowerCase().includes(r)}function Lt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Rt(e){let t=(0,J.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:a,searchEmptyLabel:o}=e,[s,c]=(0,Y.useState)(``),l;if(t[0]!==s||t[1]!==r||t[2]!==n){let e;t[4]!==s||t[5]!==r?(e=e=>It(e,s,r),t[4]=s,t[5]=r,t[6]=e):e=t[6],l=n.filter(e),t[0]=s,t[1]=r,t[2]=n,t[3]=l}else l=t[3];let u=l,d;t[7]===s?d=t[8]:(d=s.trim(),t[7]=s,t[8]=d);let f=d.length>0,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(se,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=p):p=t[9];let m,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,A),h=e=>c(e.target.value),t[10]=m,t[11]=h):(m=t[10],h=t[11]);let g;t[12]!==s||t[13]!==a?(g=(0,X.jsxs)(`div`,{className:`relative`,children:[p,(0,X.jsx)(`input`,{type:`search`,value:s,placeholder:a,"aria-label":a,className:m,onChange:h})]}),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==u.length||t[16]!==f||t[17]!==n.length?(_=f?(0,X.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[u.length,` / `,n.length]}):null,t[15]=u.length,t[16]=f,t[17]=n.length,t[18]=_):_=t[18];let v;t[19]!==g||t[20]!==_?(v=(0,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[g,_]}),t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;t[22]!==u||t[23]!==o||t[24]!==r?(y=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:u.length===0?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>{let n=e.shortName||Lt(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,X.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=u,t[23]=o,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function zt(e){let t=(0,J.c)(38),{open:n,onOpenChange:r,serverId:a,title:o,subtitle:s,searchPlaceholder:c,searchEmptyLabel:l,emptyLabel:u,closeLabel:d,tools:p,stripPrefix:m}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(fe,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,f)}),t[0]=h):h=t[0];let g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=i(`fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,O,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=g):g=t[1];let _;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(x,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=_):_=t[2];let v;t[3]===o?v=t[4]:(v=(0,X.jsxs)(G,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[_,o]}),t[3]=o,t[4]=v);let y;t[5]!==a||t[6]!==s||t[7]!==p.length?(y=s.replace(`{{serverId}}`,a).replace(`{{count}}`,String(p.length)),t[5]=a,t[6]=s,t[7]=p.length,t[8]=y):y=t[8];let b;t[9]===y?b=t[10]:(b=(0,X.jsx)(ue,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let S;t[11]!==v||t[12]!==b?(S=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[v,b]}),t[11]=v,t[12]=b,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(de,{className:`size-4`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===d?w=t[16]:(w=(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(M,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":d,children:C})}),t[15]=d,t[16]=w);let T;t[17]!==S||t[18]!==w?(T=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[S,w]}),t[17]=S,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==u||t[21]!==n||t[22]!==l||t[23]!==c||t[24]!==a||t[25]!==m||t[26]!==p?(E=p.length>0?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Rt,{tools:p,stripPrefix:m,searchPlaceholder:c,searchEmptyLabel:l},`${a}-${n?`open`:`closed`}`)}):(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u})}),t[20]=u,t[21]=n,t[22]=l,t[23]=c,t[24]=a,t[25]=m,t[26]=p,t[27]=E):E=t[27];let D;t[28]===d?D=t[29]:(D=(0,X.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(M,{type:`button`,variant:`secondary`,children:d})})}),t[28]=d,t[29]=D);let k;t[30]!==T||t[31]!==E||t[32]!==D?(k=(0,X.jsxs)(ee,{children:[h,(0,X.jsxs)(L,{className:g,children:[T,E,D]})]}),t[30]=T,t[31]=E,t[32]=D,t[33]=k):k=t[33];let A;return t[34]!==r||t[35]!==n||t[36]!==k?(A=(0,X.jsx)(ce,{open:n,onOpenChange:r,children:k}),t[34]=r,t[35]=n,t[36]=k,t[37]=A):A=t[37],A}var Bt=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A);function Vt(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function Ht(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function Ut(e,t){return e.errorCode===`missing_credential`?t.composioHealthMissingCredential:e.errorCode===`unauthorized`?t.composioHealthUnauthorized:e.errorCode===`forbidden`?t.composioHealthForbidden:e.errorCode===`network`?t.composioHealthNetwork:e.errorCode===`timeout`?t.composioHealthTimeout:t.composioHealthDegraded}function Wt({instance:e,t}){let n=Vt(e),[r,o]=(0,Y.useState)([]),[s,c]=(0,Y.useState)([]),[l,u]=(0,Y.useState)([]),[d,f]=(0,Y.useState)([]),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(``),[y,x]=(0,Y.useState)(`{}`),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(`read`),[O,A]=(0,Y.useState)(!1),[j,N]=(0,Y.useState)(null),P=(0,Y.useCallback)(async()=>{if(!(!n||e.materialized.type!==`composio`||e.materialized.role===`credential`)){A(!0),N(null);try{let[t,r,i,a,s,l,d]=await Promise.all([Ve().catch(()=>[]),Xe(n).catch(()=>[]),Ze(20).catch(()=>[]),Ke(n).catch(()=>`read`),$e().catch(()=>[]),Je(n).catch(()=>null),Ue(n).catch(()=>null)]);o(t.filter(e=>e.toolkit.toLowerCase()===n.toLowerCase())),c(r),u(i.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===n.toLowerCase())),D(a),f(s.filter(t=>t.connectorId===e.connectorId)),m(l?.policy??null),g(l?.agents??[]),v(e=>e||r.find(e=>e.scope===`read`&&e.curated)?.slug||``),T(d)}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[e.connectorId,e.materialized,n]);(0,Y.useEffect)(()=>{P()},[P]);let F=(0,Y.useCallback)(async()=>{if(n){A(!0),N(null);try{let t=await Fe(e.connectorId);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`)}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[e.connectorId,n]),I=(0,Y.useCallback)(async e=>{if(n){D(e);try{await qe(n,e),await P()}catch(e){N(e instanceof Error?e.message:String(e))}}},[P,n]),L=(0,Y.useCallback)(async(e,t)=>{A(!0),N(null);try{await et(e,t),await P()}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}},[P]),z=(0,Y.useCallback)(async e=>{if(n){N(null);try{m(await Ye(n,e))}catch(e){N(e instanceof Error?e.message:String(e))}}},[e.connectorId,n]),ee=(0,Y.useCallback)(e=>{p&&z({allowedAgentIds:p.allowedAgentIds.includes(e)?p.allowedAgentIds.filter(t=>t!==e):[...p.allowedAgentIds,e]})},[z,p]),H=(0,Y.useCallback)(async e=>{A(!0),N(null);try{await e(),await P()}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}},[P]),ne=(0,Y.useCallback)(async()=>{if(!(!n||!_)){A(!0),N(null),C(null);try{let n=JSON.parse(y);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(t.composioMemoryArgumentsObject);let i=p?.allowedAgentIds[0]??h[0]?.id;if(!i)throw Error(t.composioMemoryAgentMissing);C((await Qe({connectorId:e.connectorId,actionId:_,agentId:i,connectionId:r.find(e=>e.isDefault)?.id,arguments:n})).recordId)}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[h,r,e.connectorId,_,y,p,t,n]);return n?e.materialized.type===`composio`&&e.materialized.role===`credential`?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:t.composioApiKeyStored}):(0,X.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:$(t.composioToolkitTitle,{toolkit:n})}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioScopeHint})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(me,{className:i(Bt,`h-9 w-28 py-1`),value:E,onChange:e=>void I(e.currentTarget.value),children:[(0,X.jsx)(B,{value:`read`,children:t.composioScopeRead}),(0,X.jsx)(B,{value:`write`,children:t.composioScopeWrite}),(0,X.jsx)(B,{value:`admin`,children:t.composioScopeAdmin})]}),(0,X.jsxs)(M,{variant:`secondary`,disabled:O,onClick:()=>void F(),children:[O?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(k,{className:`size-4`}),t.connectOAuth]}),(0,X.jsx)(M,{variant:`ghost`,disabled:O,onClick:()=>void P(),children:t.refresh})]})]}),j?(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:j}):null,w?(0,X.jsxs)(`div`,{className:i(`mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border px-3 py-2 text-xs`,w.status===`connected`?`border-emerald-500/30 bg-emerald-500/5 text-emerald-700`:`border-amber-500/30 bg-amber-500/5 text-amber-700`),children:[(0,X.jsx)(`span`,{children:w.status===`connected`?$(t.composioHealthConnected,{count:String(w.activeConnections)}):w.status===`reauthorization_required`?t.composioHealthReconnect:w.status===`degraded`?Ut(w,t):t.composioHealthDisconnected}),w.recovery===`none`?null:(0,X.jsx)(M,{variant:`ghost`,disabled:O,onClick:()=>void(w.recovery===`retry`?P():F()),children:w.recovery===`retry`?t.composioRetry:t.connectOAuth}),w.status===`degraded`&&w.message?(0,X.jsx)(`p`,{className:`basis-full break-words text-[11px] opacity-80`,children:w.message}):null]}):null,p?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-panel p-3 md:grid-cols-[minmax(0,180px)_1fr]`,children:[(0,X.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioConfirmationPolicy,(0,X.jsxs)(me,{className:i(Bt,`mt-1 h-9 py-1`),value:p.confirmationPolicy,onChange:e=>void z({confirmationPolicy:e.currentTarget.value}),children:[(0,X.jsx)(B,{value:`writes`,children:t.composioConfirmWrites}),(0,X.jsx)(B,{value:`always`,children:t.composioConfirmAlways}),(0,X.jsx)(B,{value:`never`,children:t.composioConfirmNever})]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.composioAllowedAgents}),(0,X.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:h.map(e=>(0,X.jsx)(`button`,{type:`button`,className:i(`rounded-full border px-2.5 py-1 text-xs transition-colors`,p.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge text-fg-muted hover:text-fg`),onClick:()=>ee(e.id),children:e.name},e.id))})]})]}):null,[`gmail`,`googledrive`,`notion`,`slack`].includes(n)&&s.some(e=>e.scope===`read`&&e.curated)?(0,X.jsxs)(`div`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(te,{className:`mt-0.5 size-4 text-accent`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioMemorySync}),(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioMemorySyncHint})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-[minmax(0,240px)_1fr_auto] md:items-end`,children:[(0,X.jsxs)(`label`,{className:`text-xs text-fg-subtle`,children:[t.composioMemoryReadAction,(0,X.jsx)(me,{className:i(Bt,`mt-1 h-9 py-1`),value:_,onChange:e=>v(e.currentTarget.value),children:s.filter(e=>e.scope===`read`&&e.curated).map(e=>(0,X.jsx)(B,{value:e.slug,children:e.name??e.slug},e.slug))})]}),(0,X.jsxs)(`label`,{className:`text-xs text-fg-subtle`,children:[t.composioMemoryArguments,(0,X.jsx)(`input`,{className:i(Bt,`mt-1 h-9 py-1 font-mono text-xs`),value:y,onChange:e=>x(e.currentTarget.value)})]}),(0,X.jsxs)(M,{disabled:O||!_,onClick:()=>void ne(),children:[O?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(te,{className:`size-4`}),t.composioSyncNow]})]}),S?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-emerald-600`,children:$(t.composioMemorySynced,{id:S})}):null]}):null,d.length?(0,X.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioPendingApprovals}),d.map(e=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-fg`,children:e.actionId}),(0,X.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-subtle`,children:JSON.stringify(e.argumentsPreview)}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:$(t.composioApprovalExpires,{time:new Date(e.expiresAt).toLocaleTimeString()})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsxs)(M,{variant:`secondary`,disabled:O,onClick:()=>void L(e.id,`denied`),children:[(0,X.jsx)(de,{className:`size-4`}),t.composioDeny]}),(0,X.jsxs)(M,{disabled:O,onClick:()=>void L(e.id,`approved`),children:[(0,X.jsx)(a,{className:`size-4`}),t.approve]})]})]},e.id))]}):null,(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioConnections}),r.length?r.map(e=>(0,X.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.accountEmail??e.username??e.workspace??e.providerConnectionId}),(0,X.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[e.status,e.isDefault?` · ${t.composioDefaultAccount}`:``]})]}),(0,X.jsx)(`input`,{className:i(Bt,`h-8 py-1 text-xs`),defaultValue:e.alias??``,placeholder:t.composioAccountAlias,onBlur:t=>{t.currentTarget.value!==(e.alias??``)&&H(()=>He(e.id,{alias:t.currentTarget.value}))}}),(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[(0,X.jsx)(M,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:O||e.isDefault,onClick:()=>void H(async()=>{await He(e.id,{isDefault:!0}),n&&await Ye(n,{selectedConnectionIds:[e.id]})}),children:(0,X.jsx)(ae,{className:i(`size-4`,e.isDefault&&`fill-current`)})}),(0,X.jsx)(M,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:O,onClick:()=>void H(()=>We(e.id)),children:(0,X.jsx)(b,{className:`size-4`})}),(0,X.jsx)(M,{variant:`ghost`,className:`size-8 p-0`,title:t.composioRevoke,disabled:O,onClick:()=>{window.confirm(t.composioRevokeConfirm)&&H(()=>Ge(e.id))},children:(0,X.jsx)(R,{className:`size-4 text-red-500`})})]})]},e.id)):(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioConnectionsEmpty})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),s.length?s.slice(0,8).map(e=>(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,X.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[Ht(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),l.length?l.slice(0,5).map(e=>(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,X.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})]})]})]}):null}var Gt=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A);function Kt(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function qt(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function Jt(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function Yt(e){let t=(0,J.c)(12),{title:n,description:r,meta:a}=e,o;t[0]===r?o=t[1]:(o=r?(0,X.jsx)(F,{delayDuration:300,skipDelayDuration:100,children:(0,X.jsxs)(K,{children:[(0,X.jsx)(he,{asChild:!0,children:(0,X.jsx)(`p`,{tabIndex:0,title:r,className:i(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:r})}),(0,X.jsx)(re,{children:(0,X.jsx)(ie,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,X.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=(0,X.jsx)(`p`,{className:`min-w-0 break-all font-mono text-xs font-medium leading-5 text-fg`,children:n}),t[2]=n,t[3]=c);let l;t[4]===a?l=t[5]:(l=a?(0,X.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] leading-4 text-fg-subtle`,children:a}):null,t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==s||t[10]!==u?(d=(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,s]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}function Xt({instance:e,definition:t,onClose:n,onChanged:r,t:a,mcp:o}){let[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(`health`),[y,b]=(0,Y.useState)(!1),[C,T]=(0,Y.useState)(()=>qt(t,e)),[E,O]=(0,Y.useState)(null),A=t?.setup.config??[],j=e.materialized.type===`mcp`&&A.length>0&&(t?.setup.secrets??[]).length===0,N=m?m.toolCount:e.usage.lastToolCount,P=(0,Y.useMemo)(()=>{let t=[[`health`,p,a.detailHealth],[`tools`,x,`${a.detailTools} ${m?m.toolCount:e.usage.lastToolCount??``}`],[`resources`,te,`${a.detailResources} ${m?m.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,S,`${a.detailPrompts} ${m?m.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,k,a.detailPermissions]];return j?[...t,[`config`,te,a.connectorConfigLabel]]:t},[m,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,j,a]),F=(0,Y.useCallback)(async()=>{c(!0),O(null);try{let t=await Be(e.instanceId);h(t),t.toolCount>0&&_(`tools`),r()}catch(e){O(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,r]),I=(0,Y.useCallback)(async()=>{u(!0),O(null);try{await ze(e.instanceId),await r(),n()}catch(e){O(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,r,n]),z=(0,Y.useCallback)(async()=>{if(!(!t||!j)){f(!0),O(null);try{let n={};for(let e of t.setup.config??[]){let t=Jt(e.type,C[e.key]??``);t!==void 0&&(n[e.key]=t)}await Re(e.instanceId,{config:n}),await r(),_(`health`)}catch(e){O(e instanceof Error?e.message:String(e))}finally{f(!1)}}},[C,t,e.instanceId,r,j]);return(0,X.jsxs)(ce,{open:!0,onOpenChange:e=>{e||n()},children:[(0,X.jsxs)(ee,{children:[(0,X.jsx)(fe,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(L,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ve,{connector:t,size:`lg`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(G,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,X.jsx)(ue,{className:`mt-1 text-sm text-fg-muted`,children:e.materialized.type===`mcp`?$(a.mcpServerRuntime,{serverId:e.materialized.serverId}):$(a.runtimeLabel,{runtime:e.materialized.type})})]})]}),(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,D.focusRingPanel),"aria-label":a.modalClose,children:[(0,X.jsx)(de,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[E?(0,X.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:E}):null,(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:P.map(([e,t,n])=>(0,X.jsxs)(`button`,{type:`button`,className:i(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,g===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>_(e),children:[(0,X.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,X.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[g===`health`?(0,X.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,X.jsxs)(`p`,{children:[a.statusLabel,` `,(0,X.jsx)(`span`,{className:m?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:Kt(m?.status??e.usage.lastHealthStatus,a)})]}),(0,X.jsxs)(`p`,{children:[a.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():a.never]}),m?.action?(0,X.jsx)(`p`,{children:m.action}):null]}):null,g===`tools`?m?.tools.length?(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:$(a.toolsAvailable,{count:String(m.tools.length)})}),(0,X.jsx)(M,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>b(!0),children:o.viewAllTools})]}),(0,X.jsx)(`div`,{className:`grid gap-2`,children:m.tools.slice(0,8).map(e=>(0,X.jsx)(Yt,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`text-fg-muted`,children:N?$(a.toolsLastCheckSummary,{count:String(N)}):a.toolsRunTestHint}),(0,X.jsxs)(M,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void F(),children:[s?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(v,{className:`size-4`}),a.test]})]}):null,g===`resources`?m?.resources.length?(0,X.jsx)(`div`,{className:`grid gap-2`,children:m.resources.slice(0,8).map(e=>(0,X.jsx)(Yt,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,X.jsx)(`p`,{className:`text-fg-muted`,children:a.resourcesRunTestHint}):null,g===`prompts`?m?.prompts.length?(0,X.jsx)(`div`,{className:`grid gap-2`,children:m.prompts.slice(0,8).map(e=>(0,X.jsx)(Yt,{title:e.title??e.name,description:e.description,meta:e.argumentCount?$(a.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,X.jsx)(`p`,{className:`text-fg-muted`,children:a.promptsRunTestHint}):null,g===`permissions`?(0,X.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,X.jsx)(`p`,{children:$(a.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,X.jsx)(`p`,{children:e.materialized.type===`mcp`?$(a.runtimeServerLabel,{runtime:e.materialized.type.toUpperCase(),serverId:e.materialized.serverId}):$(a.runtimeLabel,{runtime:e.materialized.type.toUpperCase()})}),(0,X.jsx)(`p`,{children:e.materialized.type===`mcp`?a.mcpPolicyHint:a.connectorPolicyHint})]}):null,g===`config`&&j?(0,X.jsx)(`div`,{className:`grid gap-3`,children:A.map(e=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,X.jsx)(`input`,{className:Gt,value:C[e.key]??``,placeholder:e.placeholder,onChange:t=>T(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}),e.materialized.type===`composio`?(0,X.jsx)(Wt,{instance:e,t:a}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,X.jsx)(M,{variant:`secondary`,onClick:n,children:a.modalClose}),g===`config`&&j?(0,X.jsxs)(M,{variant:`primary`,disabled:d,onClick:()=>void z(),children:[d?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(w,{className:`size-4`}),a.modalSave]}):null,e.materialized.type===`mcp`?(0,X.jsxs)(M,{variant:`secondary`,disabled:s,onClick:()=>void F(),children:[s?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(v,{className:`size-4`}),a.test]}):null,(0,X.jsxs)(M,{variant:`ghost`,disabled:l,onClick:()=>void I(),children:[l?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(R,{className:`size-4`}),a.remove]})]})]})]}),e.materialized.type===`mcp`?(0,X.jsx)(zt,{open:y,onOpenChange:b,serverId:e.materialized.serverId,title:$(a.installedToolsDialogTitle,{name:e.displayName}),subtitle:a.installedToolsDialogSubtitle,searchPlaceholder:o.toolsDialogSearchPlaceholder,searchEmptyLabel:o.toolsDialogSearchEmpty,emptyLabel:a.toolsRunTestHint,closeLabel:o.toolsDialogClose,tools:m?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}function Zt({instance:e,definition:t,highlighted:n=!1,onOpenDetails:r,onChanged:a,t:o}){let[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),p=(0,Y.useCallback)(async()=>{c(!0),f(null);try{await Be(e.instanceId),await a()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,a]),m=(0,Y.useCallback)(async()=>{u(!0),f(null);try{await ze(e.instanceId),await a()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,a]),h=e.usage.lastHealthStatus?o.healthStatusLabels[e.usage.lastHealthStatus]??e.usage.lastHealthStatus:o.healthNotTested,g=e.usage.lastToolCount??0,_=!!(t?.setup.config?.length&&!t.setup.secrets?.length&&e.materialized.type===`mcp`);return(0,X.jsxs)(`div`,{className:i(`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,n&&`ring-2 ring-accent/45 ring-offset-2 ring-offset-surface-panel`),onClick:()=>r(e),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,X.jsx)(ve,{connector:t}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,X.jsx)(z,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}),_?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorConfigLabel}):null]}),(0,X.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all text-sm leading-5 text-fg-muted`,children:e.materialized.type===`mcp`?$(o.mcpServerRuntime,{serverId:e.materialized.serverId}):$(o.runtimeLabel,{runtime:e.materialized.type})}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[o.statusLabel,` `,h]}),(0,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:$(o.toolsAvailable,{count:String(g)})})]}),d?(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null]})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.connectorDetails}),(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[e.materialized.type===`mcp`?(0,X.jsxs)(M,{variant:`secondary`,disabled:s,onClick:()=>void p(),children:[s?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(v,{className:`size-4`}),o.test]}):null,(0,X.jsxs)(M,{variant:`ghost`,disabled:l,onClick:()=>void m(),children:[l?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(R,{className:`size-4`}),o.remove]})]})]})]})}var Qt=i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A),$t=i(Qt,`min-h-28 font-mono`);function en(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function tn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function nn(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}function rn(e){let t=(0,J.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,12).map(an),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>12?(0,X.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-12]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,X.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function an(e){return(0,X.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,X.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,X.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function on({draft:e,onChange:t,onClose:n,onInstalled:r,t:a}){let{connector:o}=e,s=e.result?`complete`:e.installing?`health`:`configure`,c=[{id:`configure`,label:a.connectStepConfigure},{id:`health`,label:a.connectStepVerify},{id:`complete`,label:a.connectStepReady}],l=(0,Y.useCallback)(async()=>{t({...e,installing:!0,error:null,result:null,health:null});try{let n={};for(let t of o.setup.config??[]){let r=tn(t.type,e.config[t.key]??``);r!==void 0&&(n[t.key]=r)}let i=e.store?await ke(e.store.packageName,{secrets:e.secrets,config:n},e.store.version):await Ie(o.id,{secrets:e.secrets,config:n,definition:o.source===`registry`?o:void 0}),a=null;try{a=await Be(i.instanceId)}catch{a=null}t({...e,installing:!1,result:i,health:a}),await r(i)}catch(n){t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[o,e,t,r]);return(0,X.jsx)(ce,{open:!0,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(ee,{children:[(0,X.jsx)(fe,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(L,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ve,{connector:o,size:`lg`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(G,{className:`text-base font-semibold text-fg`,children:$(a.connectDialogTitle,{name:o.displayName})}),(0,X.jsx)(ue,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:o.description})]})]}),(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,D.focusRingPanel),"aria-label":a.modalClose,children:[(0,X.jsx)(de,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 overflow-y-auto px-6 py-5`,children:[(0,X.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-2`,"aria-label":a.connectProgressAria,children:c.map((e,t)=>{let n=c.findIndex(e=>e.id===s);return(0,X.jsxs)(`div`,{className:i(`rounded-xl border px-3 py-2 text-xs font-medium`,t===n?`border-accent bg-accent-soft text-accent-fg`:t<n?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsxs)(`span`,{className:`mr-1 tabular-nums`,children:[t+1,`.`]}),e.label]},e.id)})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.integrationStrategy?(0,X.jsx)(`div`,{className:`rounded-xl border border-accent/20 bg-accent-soft/60 px-4 py-3 text-sm text-accent-fg`,children:o.integrationStrategy.lane===`mcp`?a.integrationStrategyMcpHint:o.integrationStrategy.lane===`native`?a.integrationStrategyNativeHint:a.integrationStrategyComposioHint}):null,e.store?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailPermissions}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,X.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:a.storeLocalExecDenied})]})]}):null,(o.setup.secrets??[]).map(n=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,X.jsx)(T,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:a.secretInputLabels,placeholder:n.required?a.requiredPlaceholder:a.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,X.jsx)(`textarea`,{className:$t,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,X.jsx)(`input`,{className:Qt,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,X.jsx)(V,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),a.connectingTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.connectingHint})]}):null,e.error?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:e.error}):null,e.result?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:$(a.connectedAs,{target:e.result.materialized.type===`mcp`?e.result.materialized.serverId:e.result.instanceId})}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:$(a.runtimeLabel,{runtime:e.result.materialized.type.toUpperCase()})})]}),(0,X.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?a.healthStatusHealthy:en(e.health?.status,a)})]}),e.health?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.toolCount}),(0,X.jsx)(`div`,{children:a.toolsMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.resourceCount}),(0,X.jsx)(`div`,{children:a.resourcesMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.promptCount}),(0,X.jsx)(`div`,{children:a.promptsMetric})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,X.jsx)(rn,{title:a.detailTools,items:e.health.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,X.jsx)(rn,{title:a.detailResources,items:e.health.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,X.jsx)(rn,{title:a.detailPrompts,items:e.health.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??$(a.promptArgumentCount,{count:String(e.argumentCount)})}))})]})]}):(0,X.jsx)(`p`,{className:`mt-3`,children:a.installedWithoutHealth}),e.health?.action?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,X.jsxs)(M,{variant:`primary`,disabled:!!e.result||e.installing,onClick:()=>void l(),children:[e.installing?(0,X.jsx)(V,{className:`size-4 animate-spin`}):e.result?(0,X.jsx)(z,{className:`size-4`}):(0,X.jsx)(H,{className:`size-4`}),e.result?a.connectedBadge:a.connect]})})]})]})})}function sn(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Ct(r)}function cn(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function ln(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A)}function un({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:a,pasteFailed:o,keyPlaceholder:s,valuePlaceholder:c,headers:l,onChange:u}){let d=(e,t)=>{u(l.map((n,r)=>r===e?{...n,...t}:n))},f=()=>{u([...l,{key:``,value:``}])},p=e=>{let t=l.filter((t,n)=>n!==e);u(t.length>0?t:[{key:``,value:``}])},m=async()=>{try{let e=await _();if(!e){window.alert(o);return}let t=mt(e);if(!t?.length){window.alert(o);return}u(t)}catch{window.alert(o)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,X.jsx)(`span`,{children:e}),t?(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,X.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void m(),children:[(0,X.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),a]})]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{className:i(ln(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:s,onChange:e=>d(t,{key:e.target.value})}),(0,X.jsx)(`input`,{className:i(ln(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:c,onChange:e=>d(t,{value:e.target.value})}),(0,X.jsx)(M,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:l.length<=1&&!e.key&&!e.value,onClick:()=>p(t),"aria-label":r,children:(0,X.jsx)(R,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},cn(e,t,l)))}),(0,X.jsxs)(`button`,{type:`button`,className:i(`self-start text-sm text-accent hover:underline`,D.press),onClick:f,children:[`+ `,n]})]})}var dn=[`stdio`,`sse`,`streamable-http`];function fn(e){let t=(0,J.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,X.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,X.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,X.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function pn(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A)}function mn(e){let t=(0,J.c)(29),{row:n,t:r,onUpdate:a,idConflictMessage:o,variant:s}=e,c=s===void 0?`all`:s,l=c===`all`||c===`basic`,u=c===`all`||c===`advanced`,d;t[0]!==o||t[1]!==a||t[2]!==n.id||t[3]!==n.transport||t[4]!==l||t[5]!==r?(d=l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fn,{label:r.transportLabel,required:!0,children:(0,X.jsx)(me,{className:pn(),value:n.transport,onChange:e=>a({transport:e.target.value}),children:dn.map(e=>(0,X.jsx)(B,{value:e,children:r.transportLabels[e]},e))})}),(0,X.jsxs)(fn,{label:r.serverIdLabel,required:!0,children:[(0,X.jsx)(`input`,{className:pn(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>a({id:e.target.value})}),o?(0,X.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:o}):null]})]}):null,t[0]=o,t[1]=a,t[2]=n.id,t[3]=n.transport,t[4]=l,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==a||t[8]!==n.argsText||t[9]!==n.command||t[10]!==n.cwd||t[11]!==n.envJson||t[12]!==n.headers||t[13]!==n.transport||t[14]!==n.url||t[15]!==u||t[16]!==l||t[17]!==r||t[18]!==c?(f=n.transport===`stdio`?(0,X.jsxs)(X.Fragment,{children:[l?(0,X.jsx)(`div`,{className:c===`basic`?`md:col-span-2`:void 0,children:(0,X.jsx)(fn,{label:r.commandLabel,required:!0,children:(0,X.jsx)(`input`,{className:pn(),value:n.command,onChange:e=>a({command:e.target.value})})})}):null,u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fn,{label:r.argsLabel,description:r.argsHint,children:(0,X.jsx)(`input`,{className:pn(),value:n.argsText,onChange:e=>a({argsText:e.target.value})})}),(0,X.jsx)(fn,{label:r.cwdLabel,children:(0,X.jsx)(`input`,{className:pn(),value:n.cwd,onChange:e=>a({cwd:e.target.value})})}),(0,X.jsx)(fn,{label:r.envLabel,description:r.envHint,children:(0,X.jsx)(`textarea`,{className:i(pn(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>a({envJson:e.target.value})})})]}):null]}):(0,X.jsxs)(X.Fragment,{children:[l?(0,X.jsx)(`div`,{className:`md:col-span-2`,children:(0,X.jsx)(fn,{label:r.urlLabel,required:!0,children:(0,X.jsx)(`input`,{className:i(pn(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>a({url:e.target.value})})})}):null,u?(0,X.jsx)(un,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>a({headers:e})}):null]}),t[7]=a,t[8]=n.argsText,t[9]=n.command,t[10]=n.cwd,t[11]=n.envJson,t[12]=n.headers,t[13]=n.transport,t[14]=n.url,t[15]=u,t[16]=l,t[17]=r,t[18]=c,t[19]=f):f=t[19];let p;t[20]!==a||t[21]!==n||t[22]!==u||t[23]!==r?(p=u?(0,X.jsx)(fn,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,X.jsx)(`input`,{type:`number`,min:1,max:600,className:pn(),value:jt(n),placeholder:r.timeoutPlaceholder,onChange:e=>a({connectionTimeoutMs:Mt(e.target.value)})})}):null,t[20]=a,t[21]=n,t[22]=u,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==d||t[26]!==f||t[27]!==p?(m=(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[d,f,p]}),t[25]=d,t[26]=f,t[27]=p,t[28]=m):m=t[28],m}function hn(e,t){if(e.shortName)return e.shortName;let n=`${t.trim()}__`;return n&&e.name.startsWith(n)?e.name.slice(n.length):e.name}function gn(e){let t=(0,J.c)(13),{tool:n,serverId:r}=e,a;t[0]!==r||t[1]!==n?(a=hn(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s=n.name===o?o:n.name,c;t[3]===n.description?c=t[4]:(c=n.description?.trim(),t[3]=n.description,t[4]=c);let l=c,u;t[5]!==o||t[6]!==s?(u=(0,X.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:s,children:o}),t[5]=o,t[6]=s,t[7]=u):u=t[7];let d;t[8]===l?d=t[9]:(d=l?(0,X.jsx)(F,{delayDuration:300,skipDelayDuration:100,children:(0,X.jsxs)(K,{children:[(0,X.jsx)(he,{asChild:!0,children:(0,X.jsx)(`p`,{tabIndex:0,title:l,className:i(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:l})}),(0,X.jsx)(re,{children:(0,X.jsx)(ie,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,X.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:l})})})]})}):null,t[8]=l,t[9]=d);let f;return t[10]!==u||t[11]!==d?(f=(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,d]}),t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function _n({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:a,config:o,managedServerIds:s,t:c,cs:l,onClose:u,onSaved:d}){let[f,p]=(0,Y.useState)(n),[h,g]=(0,Y.useState)(!1),[_,y]=(0,Y.useState)(!1),[b,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)({status:`idle`}),[O,k]=(0,Y.useState)(null),A=n.id.trim(),j=f.id.trim()!==A&&s.has(f.id.trim())||s.has(f.id.trim())&&t===`add`?c.reservedServerId:void 0,N=f.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===f.id.trim())?l.duplicateServerId:void 0,P=f.id.trim().length>0&&!j&&!N&&(f.transport===`stdio`?f.command.trim().length>0:f.url.trim().length>0),F=Nt(f),I=(0,Y.useCallback)(async()=>{if(f.id.trim()){y(!0),S(null),E({status:`loading`});try{E({status:`ok`,tools:(await At(f.id.trim(),Tt(f))).tools})}catch(e){E({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{y(!1)}}},[f]),R=(0,Y.useCallback)(async()=>{if(!(!P||h)){g(!0),S(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(f),await Et({sessionIdleTtlMinutes:a,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},vt(o)),await d(),u()}catch(e){S(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[P,o,r,n.clientKey,t,u,d,A,f,h,a]);return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ce,{open:e,onOpenChange:e=>{e||u()},children:(0,X.jsxs)(ee,{children:[(0,X.jsx)(fe,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(L,{className:i(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(G,{className:`text-base font-semibold text-fg`,children:t===`add`?l.addCustomServerTitle:l.editCustomServerTitle}),(0,X.jsx)(ue,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?l.addCustomServerHint:l.editCustomServerHint})]}),(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:i(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,D.focusRingPanel),"aria-label":l.modalClose,children:[(0,X.jsx)(de,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:l.modalClose})]})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(m,{className:`size-4 text-accent`,"aria-hidden":!0}),f.id.trim()||c.cardUntitled]}),(0,X.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:F||(f.transport===`stdio`?c.commandLabel:c.urlLabel)})]}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:c.transportLabels[f.transport]})]})}),(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`div`,{className:`mb-3`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectorBasicConfigTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.connectorBasicConfigHint})]}),(0,X.jsx)(mn,{row:f,t:c,variant:`basic`,onUpdate:e=>{p(t=>({...t,...e})),S(null)},idConflictMessage:j??N})]}),T.status===`ok`?(0,X.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(x,{className:`size-4 text-accent`,"aria-hidden":!0}),T.tools.length===0?c.toolsEmpty:c.toolsTitle.replace(`{{count}}`,String(T.tools.length))]}),T.tools.length>0?(0,X.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>k(T.tools),children:c.viewAllTools}):null]}),T.tools.length>0?(0,X.jsx)(`div`,{className:`mt-3 grid gap-2`,children:T.tools.slice(0,6).map((e,t)=>(0,X.jsx)(gn,{tool:e,serverId:f.id},e.name||`tool-${t}`))}):null]}):null,T.status===`error`?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:T.message}):null,b?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:b}):null,(0,X.jsxs)(`details`,{open:C,onToggle:e=>w(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(q,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`group-open:hidden`,children:l.connectorShowAdvancedConfig}),(0,X.jsx)(`span`,{className:`hidden group-open:inline`,children:l.connectorHideAdvancedConfig})]}),(0,X.jsx)(`div`,{className:`border-t border-edge px-4 py-4`,children:(0,X.jsx)(mn,{row:f,t:c,variant:`advanced`,onUpdate:e=>{p(t=>({...t,...e})),S(null)}})})]})]})}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,X.jsxs)(M,{variant:`secondary`,disabled:!f.id.trim()||_,onClick:()=>void I(),children:[_?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(v,{className:`size-4`}),c.testConnection]}),(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(M,{variant:`secondary`,children:l.modalCancel})}),(0,X.jsxs)(M,{variant:`primary`,disabled:!P||h,onClick:()=>void R(),children:[h?(0,X.jsx)(V,{className:`size-4 animate-spin`}):(0,X.jsx)(z,{className:`size-4`}),h?c.saving:l.modalSave]})]})]})]})}),O?(0,X.jsx)(zt,{open:!0,onOpenChange:e=>{e||k(null)},serverId:f.id,title:c.toolsDialogTitle,subtitle:c.toolsDialogSubtitle,searchPlaceholder:c.toolsDialogSearchPlaceholder,searchEmptyLabel:c.toolsDialogSearchEmpty,emptyLabel:c.toolsEmpty,closeLabel:c.toolsDialogClose,tools:O,stripPrefix:`${f.id.trim()}__`}):null]}):null}var vn=[`understand`,`act`,`reach`];function yn(e){let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase();return t.has(`channel`)||t.has(`events`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n)?`reach`:t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n)?`understand`:`act`}function bn(e,t){let n=t?yn(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function xn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.description,e.category,e.kind,e.source,...e.tags??[]].some(e=>e.toLowerCase().includes(n)):!0}function Sn(e,t,n){return e.filter(e=>xn(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function Cn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.connectorId,e.instanceId,e.status,e.connectionStatus??``,e.materialized.type,e.materialized.type===`mcp`?e.materialized.serverId:e.materialized.id].some(e=>e.toLowerCase().includes(n)):!0}function wn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}var Tn=`all`,En=`builtin`,Dn=`xopc-store`;function On(e){let t=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(e.category??``)?e.category:`custom`;return{id:e.name,version:e.latestVersion??`store`,displayName:e.name,description:e.description,category:t,kind:`mcp`,source:`store`,capabilities:[`tools`,`runtime.mcp.streamableHttp`],tags:[`store`],auth:{mode:`none`},setup:{},runtime:{type:`mcp`,serverId:`store-${e.name}`.slice(0,64)}}}function kn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function An(){let e=o(u(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=s(e=>e.token),a=!!r,[c,l]=(0,Y.useState)(`discover`),d=(0,Y.useRef)(!1),[f,p]=(0,Y.useState)({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!0,error:null}),[m,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(1),[x,S]=(0,Y.useState)(void 0),[w,T]=(0,Y.useState)(``),[E,D]=(0,Y.useState)(``),[O,k]=(0,Y.useState)(En),[A,j]=(0,Y.useState)(`name`),[N,P]=(0,Y.useState)(`all`),[F,L]=(0,Y.useState)(null),[R,z]=(0,Y.useState)(null),[B,ee]=(0,Y.useState)(null),[H,te]=(0,Y.useState)(null),[ne,re]=(0,Y.useState)(null),[ie,ae]=(0,Y.useState)(null),[U,oe]=(0,Y.useState)(!1),[se,ce]=(0,Y.useState)(void 0),[ue,de]=(0,Y.useState)(!1),{data:fe,mutate:pe}=C(a),W=fe?.payload?.config,G=(0,Y.useMemo)(()=>W===void 0?null:wt(W),[W]),K=G?.servers??[],me=f.instances.length+K.length;(0,Y.useEffect)(()=>{G&&ce(G.sessionIdleTtlMinutes)},[G]);let q=(0,Y.useCallback)(async()=>{if(!r){p({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:null});return}p(e=>({...e,loading:!0,error:null}));try{let[e,t,n]=await Promise.all([Te(),je(),Ae()]);p(r=>({catalog:e,registryCatalog:r.registryCatalog,instances:t,registries:n,loading:!1,error:null}))}catch(e){p({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[r]);(0,Y.useEffect)(()=>{q()},[q]),(0,Y.useEffect)(()=>{d.current||f.loading||a&&!G||(l(me>0?`connected`:`discover`),d.current=!0)},[a,me,G,f.loading]);let he=(0,Y.useCallback)(e=>{d.current=!0,l(e)},[]),J=(0,Y.useMemo)(()=>[{id:Dn,displayName:t.storeSourceName},...f.registries],[t.storeSourceName,f.registries]),_e=(0,Y.useCallback)(async e=>{if(!a||O===En){p(e=>({...e,registryCatalog:[]})),b(1),S(void 0);return}let t=E.trim(),n=e?.browse??!1,r=Math.max(e?.page??1,1),i=e?.append??!1,o=O===Tn?J:J.filter(e=>e.id===O);if(o.length!==0){h(!0),i?p(e=>({...e,error:null})):(b(1),S(void 0),p(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(o.map(async e=>{if(e.id===Dn){let e=await De({q:t||void 0,page:r,pageSize:24,sort:A===`source`?`newest`:`downloads`});return{connectors:e.items.map(On),totalPages:e.meta.totalPages}}return Pe(t,e.id,{browse:n,page:r})})),a=kn(e.flatMap(e=>e.connectors)),s=Math.max(1,...e.map(e=>e.totalPages??1));b(r),S(s),p(e=>({...e,registryCatalog:i?kn([...e.registryCatalog,...a]):a}))}catch(e){p(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{h(!1)}}},[A,E,O,a,J]);(0,Y.useEffect)(()=>{if(c!==`discover`||f.loading)return;if(O===En){p(e=>({...e,registryCatalog:[]})),b(1),S(void 0);return}let e=window.setTimeout(()=>{_e({browse:!E.trim()})},E.trim()?350:0);return()=>window.clearTimeout(e)},[E,O,_e,f.loading,c]);let ve=(0,Y.useMemo)(()=>new Set(f.instances.map(e=>e.connectorId)),[f.instances]),Z=(0,Y.useMemo)(()=>new Map([...f.catalog,...f.registryCatalog].map(e=>[e.id,e])),[f.catalog,f.registryCatalog]),we=(0,Y.useCallback)(async e=>{v(!0),p(e=>({...e,error:null}));try{let t=await Oe(e);L(nn(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){p(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{v(!1)}},[]),Q=(0,Y.useMemo)(()=>new Set(f.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[f.instances]),Ee=(0,Y.useCallback)(async e=>{if(!G||W===void 0)return;let t=K.filter(t=>t.clientKey!==e.clientKey);await Et({sessionIdleTtlMinutes:G.sessionIdleTtlMinutes,servers:t},vt(W)),await pe(),await q()},[W,K,q,G,pe]),ke=(0,Y.useCallback)(()=>{ae({mode:`add`,row:sn(K,Q)})},[K,Q]),Me=(0,Y.useCallback)(async()=>{if(!(!G||W===void 0||ue)){de(!0);try{await Et({sessionIdleTtlMinutes:se,servers:K},vt(W)),await pe(),oe(!1)}finally{de(!1)}}},[W,K,n.saved,G,pe,se,ue]),Ne=le(e=>e.setPageHeader),Fe=le(e=>e.clearPageHeader),Ie=(0,Y.useMemo)(()=>(0,X.jsx)(ft,{onBrowseCatalog:()=>he(`discover`),onAddCustomServer:ke,onOpenRuntimeSettings:()=>oe(!0),addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced,settingsLabel:t.runtimeSettings}),[t,ke,he]);(0,Y.useLayoutEffect)(()=>(Ne({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:Ie}),()=>Fe()),[Fe,t.title,Ie,Ne]);let Le=(0,Y.useMemo)(()=>f.instances.map(e=>({instance:e,value:bn(e,Z.get(e.connectorId))})),[Z,f.instances]),Re=(0,Y.useMemo)(()=>new Map(Le.map(({instance:e,value:t})=>[e.instanceId,t])),[Le]),ze=(0,Y.useMemo)(()=>({ready:Le.filter(({value:e})=>e.state===`ready`).length,needsSetup:Le.filter(({value:e})=>e.state===`needs_setup`).length,checking:Le.filter(({value:e})=>e.state===`checking`).length}),[Le]),Be=(0,Y.useMemo)(()=>f.instances.filter(e=>Cn(e,w)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Re.get(e.instanceId)?.state??`checking`,i=Re.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[w,Re,f.instances]),Ve=(0,Y.useMemo)(()=>K.filter(e=>wn(e,w)),[w,K]),He=Be.length+Ve.length,Ue=(0,Y.useMemo)(()=>f.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1),[f.catalog]),We=(0,Y.useMemo)(()=>{let e=O===En?Ue:O===Tn?kn([...Ue,...f.registryCatalog]):f.registryCatalog;return Sn(N===`all`?e:e.filter(e=>yn(e)===N),E,A)},[Ue,A,E,O,N,f.registryCatalog]),Ge=c===`discover`&&O!==En&&!!(x&&y<x),Ke=(0,Y.useMemo)(()=>f.instances.find(e=>e.instanceId===B)??H,[B,H,f.instances]),qe=(0,Y.useMemo)(()=>[{value:Tn,label:t.discoverSourceAll},{value:En,label:t.discoverSourceBuiltin},...J.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,J]),Je=[{id:`connected`,label:t.tabConnected,count:me},{id:`discover`,label:t.tabDiscover}];return(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[a?null:(0,X.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),(0,X.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,X.jsx)(ge,{items:Je,activeTab:c,onChange:he,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),f.error?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:f.error}):null,c===`connected`&&a?(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,X.jsx)(dt,{value:w,onChange:T,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}),(0,X.jsx)(g,{className:`size-9 shrink-0 p-0`,loading:f.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:q})]}),Le.length>0?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionSummaryTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionSummaryHint}),(0,X.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,X.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:ze.ready}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionReady})]}),(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,X.jsx)(`div`,{className:i(`text-xl font-semibold tabular-nums`,ze.needsSetup>0?`text-warning`:`text-fg`),children:ze.needsSetup}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionNeedsSetup})]}),(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,X.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:ze.checking}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionChecking})]})]})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectionsHint})]}),f.loading?(0,X.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:ye.slice(0,3).map(e=>(0,X.jsx)(Se,{},e))}):me===0?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,X.jsx)(M,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>he(`discover`),children:t.addFromCatalog})]}):He===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[Be.map(e=>(0,X.jsx)(Zt,{instance:e,definition:Z.get(e.connectorId),highlighted:e.instanceId===ne,onOpenDetails:e=>{re(null),ee(e.instanceId),te(e)},onChanged:q,t},e.instanceId)),Ve.map(e=>(0,X.jsx)(Pt,{row:e,t:n,cs:t,onEdit:()=>ae({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Ee(e)},e.clientKey))]}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.disableHint})]}):null,c===`discover`&&a?(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.discoverTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.discoverHint})]}),(0,X.jsx)(`div`,{className:`rounded-xl border border-accent/20 bg-accent-soft/60 px-4 py-3 text-sm text-accent-fg`,children:t.integrationStrategyHint}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.outcomeFilterAria,children:[`all`,...vn].map(e=>(0,X.jsx)(`button`,{type:`button`,className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,N===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":N===e,onClick:()=>P(e),children:e===`all`?t.outcomeAll:t.connectorBenefitHeadings[e]},e))}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,X.jsx)(dt,{value:E,onChange:D,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2 sm:grid-cols-2 lg:ml-auto lg:w-[26rem]`,children:[(0,X.jsx)(I,{value:O,options:qe,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:k}),(0,X.jsx)(I,{value:A,options:[{value:`name`,label:t.sortName},{value:`source`,label:t.sortSource}],placeholder:t.sortName,allowEmpty:!1,ariaLabel:t.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>j(e)})]})]}),(f.loading||m)&&We.length===0?(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:ye.map(e=>(0,X.jsx)(xe,{},e))}):We.length===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,X.jsxs)(`div`,{className:`relative`,children:[m?(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":t.loading,children:(0,X.jsx)(V,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:We.map(e=>(0,X.jsx)(Ce,{connector:e,installed:ve.has(e.id)||be(e,f.instances),onInstall:e=>{if(e.source===`store`){we(e.id);return}L(nn(e))},onOpenDetails:e.source===`store`?void 0:z,t},e.id))}),Ge?(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsxs)(M,{type:`button`,variant:`secondary`,disabled:m||_,onClick:()=>void _e({browse:!E.trim(),page:y+1,append:!0}),children:[m?(0,X.jsx)(V,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),F?(0,X.jsx)(on,{draft:F,onChange:L,onClose:()=>L(null),t,onInstalled:async e=>{await q(),await pe(),re(e.instanceId),he(`connected`)}}):null,R?(0,X.jsx)(ct,{connector:R,installed:ve.has(R.id)||be(R,f.instances),onClose:()=>z(null),onInstall:e=>L(nn(e)),t}):null,Ke?(0,X.jsx)(Xt,{instance:Ke,definition:Z.get(Ke.connectorId),onClose:()=>{ee(null),te(null)},onChanged:q,t,mcp:n}):null,ie?(0,X.jsx)(_n,{open:!0,mode:ie.mode,initialRow:ie.row,existingCustomServers:K,sessionIdleTtlMinutes:se,config:W,managedServerIds:Q,t:n,cs:t,onClose:()=>ae(null),onSaved:async()=>{await pe(),await q(),he(`connected`)}},`${ie.mode}-${ie.row.clientKey}`):null,(0,X.jsx)(ut,{open:U,sessionIdleTtlMinutes:se,saving:ue,onChange:ce,onSave:Me,onClose:()=>oe(!1),t,mcp:n})]})})}export{An as ConnectorsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,b as a,d as o,f as s,s as c}from"./Combination-HAlzriaz.js";var l=e(t(),1),u=[`top`,`right`,`bottom`,`left`],d=Math.min,f=Math.max,p=Math.round,m=Math.floor,h=e=>({x:e,y:e}),g={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function _(e,t,n){return f(e,d(t,n))}function v(e,t){return typeof e==`function`?e(t):e}function y(e){return e.split(`-`)[0]}function b(e){return e.split(`-`)[1]}function x(e){return e===`x`?`y`:`x`}function S(e){return e===`y`?`height`:`width`}function C(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function w(e){return x(C(e))}function T(e,t,n){n===void 0&&(n=!1);let r=b(e),i=w(e),a=S(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=P(o)),[o,P(o)]}function E(e){let t=P(e);return[D(e),t,D(t)]}function D(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var O=[`left`,`right`],k=[`right`,`left`],A=[`top`,`bottom`],j=[`bottom`,`top`];function M(e,t,n){switch(e){case`top`:case`bottom`:return n?t?k:O:t?O:k;case`left`:case`right`:return t?A:j;default:return[]}}function N(e,t,n,r){let i=b(e),a=M(y(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(D)))),a}function P(e){let t=y(e);return g[t]+e.slice(t.length)}function ee(e){return{top:0,right:0,bottom:0,left:0,...e}}function te(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ee(e)}function F(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function I(e,t,n){let{reference:r,floating:i}=e,a=C(t),o=w(t),s=S(o),c=y(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(b(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function L(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=v(t,e),p=te(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=F(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},b=F(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-b.top+p.top)/y.y,bottom:(b.bottom-h.bottom+p.bottom)/y.y,left:(h.left-b.left+p.left)/y.x,right:(b.right-h.right+p.right)/y.x}}var R=50,ne=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:L},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=I(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<R&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=I(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},re=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=v(e,t)||{};if(l==null)return{};let f=te(u),p={x:n,y:r},m=w(i),h=S(m),g=await o.getDimensions(l),y=m===`y`,x=y?`top`:`left`,C=y?`bottom`:`right`,T=y?`clientHeight`:`clientWidth`,E=a.reference[h]+a.reference[m]-p[m]-a.floating[h],D=p[m]-a.reference[m],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=O?O[T]:0;(!k||!await(o.isElement==null?void 0:o.isElement(O)))&&(k=s.floating[T]||a.floating[h]);let A=E/2-D/2,j=k/2-g[h]/2-1,M=d(f[x],j),N=d(f[C],j),P=M,ee=k-g[h]-N,F=k/2-g[h]/2+A,I=_(P,F,ee),L=!c.arrow&&b(i)!=null&&F!==I&&a.reference[h]/2-(F<P?M:N)-g[h]/2<0,R=L?F<P?F-P:F-ee:0;return{[m]:p[m]+R,data:{[m]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ie=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=v(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=y(r),_=C(o),b=y(o)===o,x=await(s.isRTL==null?void 0:s.isRTL(c.floating)),S=d||(b||!m?[P(o)]:E(o)),w=p!==`none`;!d&&w&&S.push(...N(o,m,p,x));let D=[o,...S],O=await s.detectOverflow(t,h),k=[],A=i.flip?.overflows||[];if(l&&k.push(O[g]),u){let e=T(r,a,x);k.push(O[e[0]],O[e[1]])}if(A=[...A,{placement:r,overflows:k}],!k.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=D[e];if(t&&(!(u===`alignment`&&_!==C(t))||A.every(e=>C(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:A},reset:{placement:t}};let n=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=A.filter(e=>{if(w){let t=C(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ae(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function oe(e){return u.some(t=>e[t]>=0)}var se=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=v(e,t);switch(i){case`referenceHidden`:{let e=ae(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:oe(e)}}}case`escaped`:{let e=ae(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:oe(e)}}}default:return{}}}}},ce=new Set([`left`,`top`]);async function le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=y(n),s=b(n),c=C(n)===`y`,l=ce.has(o)?-1:1,u=a&&c?-1:1,d=v(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ue=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},de=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=v(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=C(y(i)),p=x(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=_(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=_(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},fe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=v(e,t),u={x:n,y:r},d=C(i),f=x(d),p=u[f],m=u[d],h=v(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ce.has(y(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},pe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=v(e,t),u=await o.detectOverflow(t,l),p=y(i),m=b(i),h=C(i)===`y`,{width:g,height:_}=a.floating,x,S;p===`top`||p===`bottom`?(x=p,S=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(S=p,x=m===`end`?`top`:`bottom`);let w=_-u.top-u.bottom,T=g-u.left-u.right,E=d(_-u[x],w),D=d(g-u[S],T),O=!t.middlewareData.shift,k=E,A=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=w),O&&!m){let e=f(u.left,0),t=f(u.right,0),n=f(u.top,0),r=f(u.bottom,0);h?A=g-2*(e!==0||t!==0?e+t:f(u.left,u.right)):k=_-2*(n!==0||r!==0?n+r:f(u.top,u.bottom))}await c({...t,availableWidth:A,availableHeight:k});let j=await o.getDimensions(s.floating);return g!==j.width||_!==j.height?{reset:{rects:!0}}:{}}}};function z(){return typeof window<`u`}function B(e){return me(e)?(e.nodeName||``).toLowerCase():`#document`}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function H(e){return((me(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function me(e){return z()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return z()?e instanceof Element||e instanceof V(e).Element:!1}function W(e){return z()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function he(e){return!z()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function G(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ge(e){return/^(table|td|th)$/.test(B(e))}function _e(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ve=/transform|translate|scale|rotate|perspective|filter/,ye=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,be;function xe(e){let t=U(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Ce()&&(K(t.backdropFilter)||K(t.filter))||ve.test(t.willChange||``)||ye.test(t.contain||``)}function Se(e){let t=Y(e);for(;W(t)&&!q(t);){if(xe(t))return t;if(_e(t))return null;t=Y(t)}return null}function Ce(){return be??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),be}function q(e){return/^(html|body|#document)$/.test(B(e))}function J(e){return V(e).getComputedStyle(e)}function we(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(B(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||he(e)&&e.host||H(e);return he(t)?t.host:t}function Te(e){let t=Y(e);return q(t)?e.ownerDocument?e.ownerDocument.body:e.body:W(t)&&G(t)?t:Te(t)}function X(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Te(e),i=r===e.ownerDocument?.body,a=V(r);if(i){let e=Ee(a);return t.concat(a,a.visualViewport||[],G(r)?r:[],e&&n?X(e):[])}else return t.concat(r,X(r,[],n))}function Ee(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function De(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=W(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=p(n)!==a||p(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Oe(e){return U(e)?e:e.contextElement}function Z(e){let t=Oe(e);if(!W(t))return h(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=De(t),o=(a?p(n.width):n.width)/r,s=(a?p(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ke=h(0);function Ae(e){let t=V(e);return!Ce()||!t.visualViewport?ke:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function je(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==V(e)?!1:t}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Oe(e),o=h(1);t&&(r?U(r)&&(o=Z(r)):o=Z(e));let s=je(a,n,r)?Ae(a):h(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=V(a),t=r&&U(r)?V(r):r,n=e,i=Ee(n);for(;i&&r&&t!==n;){let e=Z(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=V(i),i=Ee(n)}}return F({width:u,height:d,x:c,y:l})}function Me(e,t){let n=we(e).scrollLeft;return t?t.left+n:Q(H(e)).left+n}function Ne(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Me(e,n),y:n.top+t.scrollTop}}function Pe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=H(r),s=t?_e(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=h(1),u=h(0),d=W(r);if((d||!d&&!a)&&((B(r)!==`body`||G(o))&&(c=we(r)),d)){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ne(o,c):h(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Fe(e){return Array.from(e.getClientRects())}function Ie(e){let t=H(e),n=we(e),r=e.ownerDocument.body,i=f(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=f(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Me(e),s=-n.scrollTop;return J(r).direction===`rtl`&&(o+=f(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Le=25;function Re(e,t){let n=V(e),r=H(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ce();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Me(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Le&&(a-=o)}else l<=Le&&(a+=l);return{width:a,height:o,x:s,y:c}}function ze(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=W(e)?Z(e):h(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Be(e,t,n){let r;if(t===`viewport`)r=Re(e,n);else if(t===`document`)r=Ie(H(e));else if(U(t))r=ze(t,n);else{let n=Ae(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return F(r)}function Ve(e,t){let n=Y(e);return n===t||!U(n)||q(n)?!1:J(n).position===`fixed`||Ve(n,t)}function He(e,t){let n=t.get(e);if(n)return n;let r=X(e,[],!1).filter(e=>U(e)&&B(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;U(o)&&!q(o);){let t=J(o),n=xe(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||G(o)&&!n&&Ve(e,o))?r=r.filter(e=>e!==o):i=t,o=Y(o)}return t.set(e,r),r}function Ue(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?_e(t)?[]:He(t,this._c):[].concat(n),r],o=Be(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Be(t,a[e],i);s=f(n.top,s),c=d(n.right,c),l=d(n.bottom,l),u=f(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function We(e){let{width:t,height:n}=De(e);return{width:t,height:n}}function Ge(e,t,n){let r=W(t),i=H(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=h(0);function l(){c.x=Me(i)}if(r||!r&&!a)if((B(t)!==`body`||G(i))&&(s=we(t)),r){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ne(i,s):h(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Ke(e){return J(e).position===`static`}function qe(e,t){if(!W(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return H(e)===n&&(n=n.ownerDocument.body),n}function Je(e,t){let n=V(e);if(_e(e))return n;if(!W(e)){let t=Y(e);for(;t&&!q(t);){if(U(t)&&!Ke(t))return t;t=Y(t)}return n}let r=qe(e,t);for(;r&&ge(r)&&Ke(r);)r=qe(r,t);return r&&q(r)&&Ke(r)&&!xe(r)?n:r||Se(e)||n}var Ye=async function(e){let t=this.getOffsetParent||Je,n=this.getDimensions,r=await n(e.floating);return{reference:Ge(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Xe(e){return J(e).direction===`rtl`}var Ze={convertOffsetParentRelativeRectToViewportRelativeRect:Pe,getDocumentElement:H,getClippingRect:Ue,getOffsetParent:Je,getElementRects:Ye,getClientRects:Fe,getDimensions:We,getScale:Z,isElement:U,isRTL:Xe};function Qe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $e(e,t){let n=null,r,i=H(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:p,width:h,height:g}=l;if(s||t(),!h||!g)return;let _=m(p),v=m(i.clientWidth-(u+h)),y=m(i.clientHeight-(p+g)),b=m(u),x={rootMargin:-_+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:f(0,d(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(n!==c){if(!S)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Qe(l,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),a}function et(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Oe(e),u=i||a?[...l?X(l):[],...t?X(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?$e(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!Qe(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var tt=ue,nt=de,rt=ie,it=pe,at=se,ot=re,st=fe,ct=(e,t,n)=>{let r=new Map,i={platform:Ze,...n},a={...i.platform,_c:r};return ne(e,t,{...i,platform:a})},lt=e(n(),1),ut=typeof document<`u`?l.useLayoutEffect:function(){};function dt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!dt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ft(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pt(e,t){let n=ft(e);return Math.round(t*n)/n}function mt(e){let t=l.useRef(e);return ut(()=>{t.current=e}),t}function ht(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[d,f]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=l.useState(r);dt(p,r)||m(r);let[h,g]=l.useState(null),[_,v]=l.useState(null),y=l.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=l.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=l.useRef(null),w=l.useRef(null),T=l.useRef(d),E=c!=null,D=mt(c),O=mt(i),k=mt(u),A=l.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),ct(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!dt(T.current,t)&&(T.current=t,lt.flushSync(()=>{f(t)}))})},[p,t,n,O,k]);ut(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let j=l.useRef(!1);ut(()=>(j.current=!0,()=>{j.current=!1}),[]),ut(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=l.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=l.useMemo(()=>({reference:x,floating:S}),[x,S]),P=l.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=pt(N.floating,d.x),r=pt(N.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ft(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,d.x,d.y]);return l.useMemo(()=>({...d,update:A,refs:M,elements:N,floatingStyles:P}),[d,A,M,N,P])}var gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ot({element:r.current,padding:i}).fn(n):r?ot({element:r,padding:i}).fn(n):{}}}},_t=(e,t)=>{let n=tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},vt=(e,t)=>{let n=nt(e);return{name:n.name,fn:n.fn,options:[e,t]}},yt=(e,t)=>({fn:st(e).fn,options:[e,t]}),bt=(e,t)=>{let n=rt(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ct=(e,t)=>{let n=gt(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=r(),wt=`Arrow`,Tt=l.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,$.jsx)(s.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,$.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Tt.displayName=wt;var Et=Tt;function Dt(e){let[t,n]=l.useState(void 0);return c(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Ot=`Popper`,[kt,At]=i(Ot),[jt,Mt]=kt(Ot),Nt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=l.useState(null);return(0,$.jsx)(jt,{scope:t,anchor:r,onAnchorChange:i,children:n})};Nt.displayName=Ot;var Pt=`PopperAnchor`,Ft=l.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=Mt(Pt,n),c=l.useRef(null),u=a(t,c),d=l.useRef(null);return l.useEffect(()=>{let e=d.current;d.current=r?.current||c.current,e!==d.current&&o.onAnchorChange(d.current)}),r?null:(0,$.jsx)(s.div,{...i,ref:u})});Ft.displayName=Pt;var It=`PopperContent`,[Lt,Rt]=kt(It),zt=l.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:u=`center`,alignOffset:d=0,arrowPadding:f=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g=`partial`,hideWhenDetached:_=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=Mt(It,n),[S,C]=l.useState(null),w=a(t,e=>C(e)),[T,E]=l.useState(null),D=Dt(T),O=D?.width??0,k=D?.height??0,A=r+(u===`center`?``:`-`+u),j=typeof h==`number`?h:{top:0,right:0,bottom:0,left:0,...h},M=Array.isArray(m)?m:[m],N=M.length>0,P={padding:j,boundary:M.filter(Ut),altBoundary:N},{refs:ee,floatingStyles:te,placement:F,isPositioned:I,middlewareData:L}=ht({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>et(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[_t({mainAxis:i+k,alignmentAxis:d}),p&&vt({mainAxis:!0,crossAxis:!1,limiter:g===`partial`?yt():void 0,...P}),p&&bt({...P}),xt({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Ct({element:T,padding:f}),Wt({arrowWidth:O,arrowHeight:k}),_&&St({strategy:`referenceHidden`,...P})]}),[R,ne]=Gt(F),re=o(y);c(()=>{I&&re?.()},[I,re]);let ie=L.arrow?.x,ae=L.arrow?.y,oe=L.arrow?.centerOffset!==0,[se,ce]=l.useState();return c(()=>{S&&ce(window.getComputedStyle(S).zIndex)},[S]),(0,$.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:I?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(` `),...L.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,$.jsx)(Lt,{scope:n,placedSide:R,onArrowChange:E,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,$.jsx)(s.div,{"data-side":R,"data-align":ne,...b,ref:w,style:{...b.style,animation:I?void 0:`none`}})})})});zt.displayName=It;var Bt=`PopperArrow`,Vt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Ht=l.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Rt(Bt,n),a=Vt[i.placedSide];return(0,$.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,$.jsx)(Et,{...r,ref:t,style:{...r.style,display:`block`}})})});Ht.displayName=Bt;function Ut(e){return e!==null}var Wt=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Gt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Gt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Kt=Nt,qt=Ft,Jt=zt,Yt=Ht;export{At as a,Kt as i,Yt as n,Jt as r,qt as t};