@xopcai/xopc 0.0.450 → 0.0.451

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 (231) 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/{activity-store-Tn5McYcg.js → activity-store-OMq1GnqB.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BX5HhrTI.js → agent-avatar-dicebear-CIoE-FJR.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-display-C7Dx9nt1.js → agent-avatar-display-kPb6idGG.js} +2 -2
  6. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-AAJsxEjB.js → agent-defaults-settings-panel-vKUDGEU6.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BhtzU8qr.js → agent-plugin-dialog-x7guoCvz.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agents-CbGYb9WI.js → agents-BbwFcl87.js} +3 -3
  9. package/dist/gateway/static/root/assets/{agents-admin-api-CShyoj9I.js → agents-admin-api-tXB8Aj5K.js} +1 -1
  10. package/dist/gateway/static/root/assets/{api-B3M6ifoo.js → api-DIKAjDAK.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-BET9vZ1l.js → api-ixudT_21.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-BxOShFPO.js → app-management-settings-panel-nuDfyfZ5.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-L450QlMW.js → appearance-settings-D4oON26V.js} +1 -1
  14. package/dist/gateway/static/root/assets/{apps-page-Bz6_fyMs.js → apps-page-BM1BfXzo.js} +1 -1
  15. package/dist/gateway/static/root/assets/{archive-plugin-BCXEOal7.js → archive-plugin-mKjfC6Sk.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automation-api-B3Jnoa2G.js → automation-api-C9pjryrT.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automation-result-state-BHAKc5QI.js → automation-result-state-uvg7Bi2x.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automation-run-list-De7gini_.js → automation-run-list-J-R4-hVm.js} +1 -1
  19. package/dist/gateway/static/root/assets/{automation-task-card-Clf0fe_n.js → automation-task-card-CXGC8afU.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-BEG5xLew.js → automations-page-CwQg9dfM.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-workspace-Cfq1C6XB.js → automations-workspace-DhLgFY2T.js} +2 -2
  22. package/dist/gateway/static/root/assets/{binary-plugins-B7tuUWzS.js → binary-plugins-BNPDM14i.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-D-YHASZr.js → block-editor-De9UqmMT.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-settings-page-DdMMia7Y.js → browser-settings-page-B0VB5umC.js} +1 -1
  25. package/dist/gateway/static/root/assets/{capabilities-Cxh3nYa6.js → capabilities-BtJB4u5C.js} +1 -1
  26. package/dist/gateway/static/root/assets/{capabilities-YfkMBZCb.js → capabilities-Cp-rmFMM.js} +1 -1
  27. package/dist/gateway/static/root/assets/{capabilities-page-CSBeVda0.js → capabilities-page-KRaK8LKT.js} +2 -2
  28. package/dist/gateway/static/root/assets/capabilities-settings-panel-aJy-1o5H.js +8 -0
  29. package/dist/gateway/static/root/assets/{channels-DdSEH-R2.js → channels-ZJORx-he.js} +1 -1
  30. package/dist/gateway/static/root/assets/{chat-agents-api-CgasFAm4.js → chat-agents-api-CtuEaDG8.js} +1 -1
  31. package/dist/gateway/static/root/assets/{chat-chart-block-Cgks7rH3.js → chat-chart-block-ShPQBlNE.js} +1 -1
  32. package/dist/gateway/static/root/assets/{chat-page-BKLyj4IP.js → chat-page-QmBfel_Z.js} +22 -22
  33. package/dist/gateway/static/root/assets/{chat-terminal-dock-aCu4X5Jo.js → chat-terminal-dock-CvDRfHAZ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{command-palette-api-Bku_h283.js → command-palette-api-NJTvEF2b.js} +1 -1
  35. package/dist/gateway/static/root/assets/composer-notifications-BkezOy9Q.js +1 -0
  36. package/dist/gateway/static/root/assets/composer-payload-handoff-CEjJusbJ.js +1 -0
  37. package/dist/gateway/static/root/assets/{computer-settings-page-zvWUPPAr.js → computer-settings-page-DG8bcw_s.js} +1 -1
  38. package/dist/gateway/static/root/assets/{connected-providers-grid-w3htbAyh.js → connected-providers-grid-BWVieU6P.js} +1 -1
  39. package/dist/gateway/static/root/assets/{connection-usage-guide-DL2T6cSN.js → connection-usage-guide-f55PDAbb.js} +1 -1
  40. package/dist/gateway/static/root/assets/{connector-service-page-a0gQC-nc.js → connector-service-page-Ca09FIBW.js} +1 -1
  41. package/dist/gateway/static/root/assets/{connectors-api-DNVUmf9M.js → connectors-api-dai-YAdK.js} +1 -1
  42. package/dist/gateway/static/root/assets/{connectors-page-D1VzTxON.js → connectors-page-C8M01Zxs.js} +1 -1
  43. package/dist/gateway/static/root/assets/{date-picker-E0cqnNlR.js → date-picker-C70ICT7u.js} +1 -1
  44. package/dist/gateway/static/root/assets/{date-time-picker-CrC_VKpw.js → date-time-picker-Czj5fnsJ.js} +1 -1
  45. package/dist/gateway/static/root/assets/{desktop-pet-D1MkNl5F.js → desktop-pet-Dq3OLpPg.js} +1 -1
  46. package/dist/gateway/static/root/assets/{desktop-pet-settings-BA6u5Md-.js → desktop-pet-settings-q4mec6zt.js} +1 -1
  47. package/dist/gateway/static/root/assets/{dev-view-store-DnqJb6NS.js → dev-view-store-lXnKsRew.js} +1 -1
  48. package/dist/gateway/static/root/assets/{device-pairing-wizard-Ba3d606o.js → device-pairing-wizard-CbUX0iit.js} +1 -1
  49. package/dist/gateway/static/root/assets/{directory-picker-path-field-lcps-hsZ.js → directory-picker-path-field-BRnwhemd.js} +1 -1
  50. package/dist/gateway/static/root/assets/{discussion-annotation-sync-BmvCn1Xn.js → discussion-annotation-sync-BnK6Ua7v.js} +1 -1
  51. package/dist/gateway/static/root/assets/{extension-debug-page-BOJbNj9D.js → extension-debug-page-Bp2BrJbB.js} +1 -1
  52. package/dist/gateway/static/root/assets/{extension-iframe-host-pbU7DAfE.js → extension-iframe-host-DjXDDmUd.js} +1 -1
  53. package/dist/gateway/static/root/assets/{extension-marketplace-api-BrLsjJLA.js → extension-marketplace-api-tk93vJL_.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-page-BrX4Hy9P.js → extension-page-CGgneUDY.js} +1 -1
  55. package/dist/gateway/static/root/assets/{extension-provider-DUzhV5_a.js → extension-provider-BktGTwH_.js} +1 -1
  56. package/dist/gateway/static/root/assets/{extension-settings-page-BuV-Vuvb.js → extension-settings-page-BGcZIeHP.js} +1 -1
  57. package/dist/gateway/static/root/assets/{file-preview-surface-B3nLuoQO.js → file-preview-surface-BK2_4mWy.js} +1 -1
  58. package/dist/gateway/static/root/assets/{gateway-config-swr-CtZy1Qw0.js → gateway-config-swr-DsXilOaJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/{gateway-realtime-CG65gHUY.js → gateway-realtime-DopPmAMl.js} +1 -1
  60. package/dist/gateway/static/root/assets/gateway-realtime-store-ZxMFPH4n.js +1 -0
  61. package/dist/gateway/static/root/assets/{gateway-restart-Cr5xtfZU.js → gateway-restart-eozrXTm7.js} +1 -1
  62. package/dist/gateway/static/root/assets/{gateway-settings-BwMwdwXh.js → gateway-settings-DddUli-p.js} +1 -1
  63. package/dist/gateway/static/root/assets/{gateway-startup-retry-DztAHGru.js → gateway-startup-retry-DMQI0ATo.js} +1 -1
  64. package/dist/gateway/static/root/assets/{global-defaults-api-yHc-ZfjU.js → global-defaults-api-D7hk1zTj.js} +1 -1
  65. package/dist/gateway/static/root/assets/home-page-C8oVgxQg.js +3 -0
  66. package/dist/gateway/static/root/assets/{image-generation-api-D5eo_stq.js → image-generation-api-BCbvDDH_.js} +1 -1
  67. package/dist/gateway/static/root/assets/imports-page-B9LF_2fO.js +1 -0
  68. package/dist/gateway/static/root/assets/index-CPXKrqLj.js +11 -0
  69. package/dist/gateway/static/root/assets/index-Dc-3QQaz.css +1 -0
  70. package/dist/gateway/static/root/assets/{install-connector-dialog-B-v1FT3P.js → install-connector-dialog-DT32t-66.js} +1 -1
  71. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BLBASsCP.js → keyboard-shortcuts-settings-DDwoBK8g.js} +1 -1
  72. package/dist/gateway/static/root/assets/{local-app-workbench-page-3J9ABnCu.js → local-app-workbench-page-CnckB-RA.js} +1 -1
  73. package/dist/gateway/static/root/assets/{local-apps-page-Db93n4Zy.js → local-apps-page-qzxr3c8Y.js} +1 -1
  74. package/dist/gateway/static/root/assets/{local-session-drafts-C6oPrCYY.js → local-session-drafts-BU3FXj_X.js} +1 -1
  75. package/dist/gateway/static/root/assets/{locale-store-CQcW9_qA.js → locale-store-DTUQ0JiK.js} +1 -1
  76. package/dist/gateway/static/root/assets/logs-page-_nIEwZn4.js +2 -0
  77. package/dist/gateway/static/root/assets/{management-api-Dh2r5GrQ.js → management-api-C6mCD0mZ.js} +1 -1
  78. package/dist/gateway/static/root/assets/{management-settings-Fj25fafb.js → management-settings-C4BKD-_b.js} +1 -1
  79. package/dist/gateway/static/root/assets/{markdown-view-CkihBz06.js → markdown-view-DHjn1-ML.js} +1 -1
  80. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-jh3dwNfg.js → mcp-conversation-setup-page-ClgMvru5.js} +1 -1
  81. package/dist/gateway/static/root/assets/{media-plugins-BUapXtQZ.js → media-plugins-8E2KZQym.js} +1 -1
  82. package/dist/gateway/static/root/assets/{messages-orB1BMgI.js → messages-C7ruaWtK.js} +3 -3
  83. package/dist/gateway/static/root/assets/{model-selector-DYxgKUju.js → model-selector-CJY9LRsl.js} +1 -1
  84. package/dist/gateway/static/root/assets/{models-hub-cache-D2cdb8nZ.js → models-hub-cache-BTs8jhgq.js} +1 -1
  85. package/dist/gateway/static/root/assets/{note-detail-panel-BMtKrv-J.js → note-detail-panel-DiCfpcZd.js} +3 -3
  86. package/dist/gateway/static/root/assets/note-image-lightbox-kccIXJo_.js +1 -0
  87. package/dist/gateway/static/root/assets/{notes-api-BhRyWe3S.js → notes-api-BnaeXy22.js} +1 -1
  88. package/dist/gateway/static/root/assets/{notes-page-DcmRJJbt.js → notes-page-B_vTBmyx.js} +2 -2
  89. package/dist/gateway/static/root/assets/{oauth-api-D5iBtOid.js → oauth-api-BZ67vxsq.js} +1 -1
  90. package/dist/gateway/static/root/assets/{oauth-provider-connect-CmHsHynu.js → oauth-provider-connect-CZP15znW.js} +1 -1
  91. package/dist/gateway/static/root/assets/{open-capability-settings-Cvb65hQB.js → open-capability-settings-DQsmJxI7.js} +1 -1
  92. package/dist/gateway/static/root/assets/{page-context-capture-button-CTHQWfG6.js → page-context-capture-button-TpjRHhUt.js} +1 -1
  93. package/dist/gateway/static/root/assets/{page-context-draft-aApa5ApP.js → page-context-draft-BbUpxlgV.js} +1 -1
  94. package/dist/gateway/static/root/assets/page-header-store-CFntbsPj.js +1 -0
  95. package/dist/gateway/static/root/assets/{personal-avatar-Dp5LHjk3.js → personal-avatar-CVocefDp.js} +1 -1
  96. package/dist/gateway/static/root/assets/personal-page-BjnSgU89.js +1 -0
  97. package/dist/gateway/static/root/assets/{personal-settings-panel-CtJL6qIN.js → personal-settings-panel-CdMHSPCH.js} +1 -1
  98. package/dist/gateway/static/root/assets/{phone-dependencies-card-BBk6k0t0.js → phone-dependencies-card-ChRrViSc.js} +1 -1
  99. package/dist/gateway/static/root/assets/{phone-model-connection-QJt8SAb7.js → phone-model-connection-DmswEWqx.js} +1 -1
  100. package/dist/gateway/static/root/assets/{phone-model-picker-CRxUxJNZ.js → phone-model-picker-CvuOhQpk.js} +1 -1
  101. package/dist/gateway/static/root/assets/{phone-settings-page-Df64khPY.js → phone-settings-page-2hZ68I47.js} +1 -1
  102. package/dist/gateway/static/root/assets/{phone-workspace-store-DAuPd2ie.js → phone-workspace-store-BMvxfZ3g.js} +1 -1
  103. package/dist/gateway/static/root/assets/{plugin-details-dialog-Bcer4RC3.js → plugin-details-dialog-qvdi41L2.js} +1 -1
  104. package/dist/gateway/static/root/assets/{preference-select-fields-DdV7q9Bd.js → preference-select-fields-RDatqlhG.js} +1 -1
  105. package/dist/gateway/static/root/assets/{product-automation-feedback-uKndNxpU.js → product-automation-feedback-Bj9ZsasT.js} +1 -1
  106. package/dist/gateway/static/root/assets/{product-open-page-A7lyoXVv.js → product-open-page-CzXmn2MX.js} +1 -1
  107. package/dist/gateway/static/root/assets/{product-preview-content-BrdvkWOg.js → product-preview-content-Beg0t4GW.js} +1 -1
  108. package/dist/gateway/static/root/assets/{product-preview-modal-BxHKejcX.js → product-preview-modal-5ulFfVzf.js} +2 -2
  109. package/dist/gateway/static/root/assets/project-detail-page-8bnYqXLJ.js +7 -0
  110. package/dist/gateway/static/root/assets/{project-understanding-BVhSoQHu.js → project-understanding-CXf7wjwt.js} +1 -1
  111. package/dist/gateway/static/root/assets/{projects-page-DSPoyFda.js → projects-page-CyA6fCPg.js} +1 -1
  112. package/dist/gateway/static/root/assets/{providers-api-B47s6_9Q.js → providers-api-DE7kdeXc.js} +1 -1
  113. package/dist/gateway/static/root/assets/{recording-upload-B-IHTsVC.js → recording-upload-BZvpuPZT.js} +1 -1
  114. package/dist/gateway/static/root/assets/{registry-api-Bo8YiUE0.js → registry-api-C_8-f85U.js} +1 -1
  115. package/dist/gateway/static/root/assets/{remote-access-hub-BRf9znLV.js → remote-access-hub-Daxdjqs9.js} +1 -1
  116. package/dist/gateway/static/root/assets/{resource-unavailable-CAljzZx8.js → resource-unavailable-khPb8zb8.js} +1 -1
  117. package/dist/gateway/static/root/assets/route-preload-DGMUu3pm.js +2 -0
  118. package/dist/gateway/static/root/assets/{runtime-tools-api-C28pB9__.js → runtime-tools-api-2YumRxOJ.js} +1 -1
  119. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-XYeadnhL.js → runtime-tools-settings-panel-DH00p-rI.js} +1 -1
  120. package/dist/gateway/static/root/assets/{schema-form-CtRM41Re.js → schema-form-C9TYGa0_.js} +1 -1
  121. package/dist/gateway/static/root/assets/secret-input-DsjfQmDn.js +1 -0
  122. package/dist/gateway/static/root/assets/{service-recommendation-list-C6ydoBSU.js → service-recommendation-list-wXf_ZlHq.js} +1 -1
  123. package/dist/gateway/static/root/assets/{session-api-D7FWdG43.js → session-api-Dt7vRa-E.js} +1 -1
  124. package/dist/gateway/static/root/assets/session-channel-icon-BzkFo-Ci.js +1 -0
  125. package/dist/gateway/static/root/assets/{session-identity-label-BP7OIYth.js → session-identity-label-D5SAi0Uh.js} +1 -1
  126. package/dist/gateway/static/root/assets/{session-manager-C1T7WiP7.js → session-manager-5qokJQ6W.js} +1 -1
  127. package/dist/gateway/static/root/assets/{sessions-page-CyYkCsfy.js → sessions-page-CCcpMHIH.js} +1 -1
  128. package/dist/gateway/static/root/assets/settings-advanced-gate-B7-XQiJh.js +1 -0
  129. package/dist/gateway/static/root/assets/{settings-advanced-section-3HwfHbqz.js → settings-advanced-section-DRlQdj_w.js} +1 -1
  130. package/dist/gateway/static/root/assets/{settings-mode-store-BVvIXZlg.js → settings-mode-store-BE6t--iO.js} +1 -1
  131. package/dist/gateway/static/root/assets/{settings-page-C6ypo-jn.js → settings-page-_F2d9-GZ.js} +1 -1
  132. package/dist/gateway/static/root/assets/{settings-page-header-CheboxIM.js → settings-page-header-DG3MQwSF.js} +1 -1
  133. package/dist/gateway/static/root/assets/{settings-page-layout-CPFMZaLF.js → settings-page-layout-SuMAUhMb.js} +1 -1
  134. package/dist/gateway/static/root/assets/{setup-interaction-page-BbCzYq9S.js → setup-interaction-page-DyDiHKjZ.js} +1 -1
  135. package/dist/gateway/static/root/assets/{setup-status-panel-DUNgVqtz.js → setup-status-panel-CPNFWhrr.js} +1 -1
  136. package/dist/gateway/static/root/assets/{share-link-dialog-0P9ghttc.js → share-link-dialog-wu-minYF.js} +1 -1
  137. package/dist/gateway/static/root/assets/share-preview-page-BqbfuQBU.js +2 -0
  138. package/dist/gateway/static/root/assets/{shares-api-iiw4F-ra.js → shares-api-DwsEzRc6.js} +1 -1
  139. package/dist/gateway/static/root/assets/{shares-settings-BQ1qXAJn.js → shares-settings-BxutiB6Y.js} +1 -1
  140. package/dist/gateway/static/root/assets/{skill-api-CLtIjE8K.js → skill-api-C7wPB73H.js} +1 -1
  141. package/dist/gateway/static/root/assets/{skill-list-api-DY0rRlUk.js → skill-list-api-C4AjzhlY.js} +1 -1
  142. package/dist/gateway/static/root/assets/{skill-reload-api-DJC8uWLu.js → skill-reload-api-CqfS9zlG.js} +1 -1
  143. package/dist/gateway/static/root/assets/{skills-page-CQYf7s9f.js → skills-page-8VYadExR.js} +1 -1
  144. package/dist/gateway/static/root/assets/sliding-segmented-D346J92k.js +1 -0
  145. package/dist/gateway/static/root/assets/{system-settings-panel-DdBmyc93.js → system-settings-panel-BV4GHnns.js} +1 -1
  146. package/dist/gateway/static/root/assets/{task-detail-page-Bb1R4QsJ.js → task-detail-page-C9IyuxdS.js} +3 -3
  147. package/dist/gateway/static/root/assets/{task-input-card-Xl4xFjCn.js → task-input-card-NtzzVc0e.js} +1 -1
  148. package/dist/gateway/static/root/assets/{terminal-panel-store-B1EVdx4L.js → terminal-panel-store-DWdJOGMn.js} +1 -1
  149. package/dist/gateway/static/root/assets/{theme-store-BTkYFJOE.js → theme-store-FNf-kdMR.js} +1 -1
  150. package/dist/gateway/static/root/assets/{tracing-settings-page-h-gbBAtl.js → tracing-settings-page-BRPJuRpc.js} +1 -1
  151. package/dist/gateway/static/root/assets/{tunnel-api-BDoegsWD.js → tunnel-api-B7NHNrQJ.js} +1 -1
  152. package/dist/gateway/static/root/assets/{understanding-activity-store-DyFJDqHy.js → understanding-activity-store-bgCeO8bb.js} +1 -1
  153. package/dist/gateway/static/root/assets/{understanding-refresh-store-C0SRcgyd.js → understanding-refresh-store-CEhWIvsQ.js} +1 -1
  154. package/dist/gateway/static/root/assets/{usage-page-CbJsT3zT.js → usage-page-35YfpfVW.js} +1 -1
  155. package/dist/gateway/static/root/assets/{use-autosave-CB2B4NMO.js → use-autosave-D8Qtt_Tn.js} +1 -1
  156. package/dist/gateway/static/root/assets/use-composer-attachments-H-tD4Db6.js +2 -0
  157. package/dist/gateway/static/root/assets/use-file-preview-expanded-P-0xmST2.js +15 -0
  158. package/dist/gateway/static/root/assets/{use-personal-profile-r0OuOlBJ.js → use-personal-profile-Bk2rGWSy.js} +1 -1
  159. package/dist/gateway/static/root/assets/use-realtime-voice-BcokfdI0.js +1 -0
  160. package/dist/gateway/static/root/assets/{use-workspace-tree-B9Bmg8LV.js → use-workspace-tree-D0_812KH.js} +1 -1
  161. package/dist/gateway/static/root/assets/{user-model-page-BudrJ73l.js → user-model-page-BxHnOljT.js} +1 -1
  162. package/dist/gateway/static/root/assets/voice-C607F0pB.js +1 -0
  163. package/dist/gateway/static/root/assets/{voice-api-key-field-C8wd8ijq.js → voice-api-key-field-BL56KGeq.js} +1 -1
  164. package/dist/gateway/static/root/assets/voice-config-api-DVFTuHwH.js +1 -0
  165. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-TAmJNcsN.js → voice-input-shortcut-events-BK-IvchL.js} +1 -1
  166. package/dist/gateway/static/root/assets/{work-discovery-overlay-DsyYo1p0.js → work-discovery-overlay-DDXae8Yc.js} +1 -1
  167. package/dist/gateway/static/root/assets/{work-discovery-page-BJ9VN5Zd.js → work-discovery-page-CxN0abrd.js} +1 -1
  168. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CFj-ZOJE.js → working-directory-picker-modal-D3BUBFa0.js} +1 -1
  169. package/dist/gateway/static/root/assets/{workspace-api-DYFy9__S.js → workspace-api-ymncGc6j.js} +2 -2
  170. package/dist/gateway/static/root/assets/workspace-editor-agent-store-BQrMvAkL.js +1 -0
  171. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BKmtih6_.js +1 -0
  172. package/dist/gateway/static/root/assets/workspace-open-location-menu-BdfKT4O4.js +1 -0
  173. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DN4DdOWZ.js → xopc-cloud-account-card-BS_lsURY.js} +1 -1
  174. package/dist/gateway/static/root/index.html +91 -88
  175. package/dist/package.js +1 -1
  176. package/dist/packages/realtime-protocol/src/voice.js +32 -3
  177. package/dist/src/agent-config/schema.d.ts +30 -0
  178. package/dist/src/agent-config/schema.js +3 -1
  179. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  180. package/dist/src/config/schema.d.ts +16 -0
  181. package/dist/src/config/schema.js +6 -0
  182. package/dist/src/gateway/hono/lib/safe-voice-config.d.ts +1 -0
  183. package/dist/src/gateway/hono/lib/safe-voice-config.js +7 -2
  184. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  185. package/dist/src/gateway/hono/routes/models.js +4 -0
  186. package/dist/src/gateway/hono/routes/personal-agent.js +9 -1
  187. package/dist/src/gateway/hono/routes/voice.js +105 -12
  188. package/dist/src/gateway/security/gateway-scopes.js +1 -1
  189. package/dist/src/gateway/service/config-coordinator.d.ts +4 -0
  190. package/dist/src/gateway/service.js +4 -4
  191. package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
  192. package/dist/src/imports/inventory.js +11 -3
  193. package/dist/src/infra/update-restart.js +1 -1
  194. package/dist/src/personal-agent/repository.d.ts +2 -3
  195. package/dist/src/personal-agent/service.d.ts +3 -6
  196. package/dist/src/personal-agent/service.js +11 -1
  197. package/dist/src/providers/model-catalog-persistence.js +2 -2
  198. package/dist/src/providers/setup/voice.js +9 -4
  199. package/dist/src/providers/xopc-cloud-model-source.js +2 -2
  200. package/dist/src/voice/platform-settings.js +1 -1
  201. package/dist/src/voice/realtime/omniEngine.d.ts +1 -0
  202. package/dist/src/voice/realtime/omniEngine.js +188 -43
  203. package/dist/src/voice/realtime/omniRoute.d.ts +5 -2
  204. package/dist/src/voice/realtime/omniRoute.js +29 -3
  205. package/dist/src/voice/realtime/runtime.js +46 -35
  206. package/dist/src/voice/realtime/runtime.types.d.ts +1 -1
  207. package/package.json +1 -1
  208. package/dist/gateway/static/root/assets/capabilities-settings-panel-C56aelvp.js +0 -8
  209. package/dist/gateway/static/root/assets/composer-payload-handoff-D1xUYD5M.js +0 -1
  210. package/dist/gateway/static/root/assets/gateway-realtime-store-Vl3uKAHV.js +0 -1
  211. package/dist/gateway/static/root/assets/home-page-DYkEc3Qb.js +0 -3
  212. package/dist/gateway/static/root/assets/imports-page-CLbpRE5i.js +0 -1
  213. package/dist/gateway/static/root/assets/index-CIeY0yyg.js +0 -11
  214. package/dist/gateway/static/root/assets/index-D1EDrkUo.css +0 -1
  215. package/dist/gateway/static/root/assets/logs-page-Dtoheh2t.js +0 -2
  216. package/dist/gateway/static/root/assets/note-image-lightbox-C6aTUp-c.js +0 -1
  217. package/dist/gateway/static/root/assets/page-header-store-B2Ahfm0W.js +0 -1
  218. package/dist/gateway/static/root/assets/personal-page-CpKBzGIk.js +0 -1
  219. package/dist/gateway/static/root/assets/project-detail-page-CobfHZo0.js +0 -7
  220. package/dist/gateway/static/root/assets/route-preload-C0oV8og1.js +0 -2
  221. package/dist/gateway/static/root/assets/secret-input-Dryrns2s.js +0 -1
  222. package/dist/gateway/static/root/assets/session-channel-icon-D1ktvt1P.js +0 -1
  223. package/dist/gateway/static/root/assets/settings-advanced-gate-B3rOBkm_.js +0 -1
  224. package/dist/gateway/static/root/assets/share-preview-page-BoLq3kSO.js +0 -2
  225. package/dist/gateway/static/root/assets/use-composer-attachments-BPMn8eY_.js +0 -2
  226. package/dist/gateway/static/root/assets/use-file-preview-expanded-4SKLb9Fh.js +0 -15
  227. package/dist/gateway/static/root/assets/voice-config-api-yBcUSvvn.js +0 -1
  228. package/dist/gateway/static/root/assets/voice-transcribe-api-D4eyeSdG.js +0 -1
  229. package/dist/gateway/static/root/assets/workspace-editor-agent-store-2Lt7rQfw.js +0 -1
  230. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DhqlVzSI.js +0 -1
  231. package/dist/gateway/static/root/assets/workspace-open-location-menu-C-ItyXwL.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,n as i}from"./locale-store-CQcW9_qA.js";import{t as a}from"./messages-orB1BMgI.js";import{n as o,r as s}from"./popover-select-CLsphyzA.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./download-Dk-ZjtO6.js";import{t as d}from"./rotate-ccw-JM1TBLpp.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-Cc4hUNTt.js";import{t as m}from"./refresh-button-DiWdGAaX.js";import{n as h}from"./settings-loading-skeleton-CAoOV17i.js";import{n as g,t as _}from"./settings-page-header-CheboxIM.js";import"./settings-page-layout-CPFMZaLF.js";import{t as v}from"./settings-advanced-gate-B3rOBkm_.js";import{i as y,n as b,r as x}from"./runtime-tools-api-C28pB9__.js";import{t as S}from"./phone-dependencies-card-BBk6k0t0.js";var C=e(t(),1);function w(e){return e?.trim()||void 0}function T(e,t,n){return e?.state!==`ready`||w(t)!==w(n)}var E=n(),D=[`node`,`python`,`uv`];function O(){let e=a(i(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:w,mutate:O}=f(r(`/api/runtime-tools`)),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)({}),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(null),V=Object.values(F).some(Boolean);if((0,C.useEffect)(()=>{t?.payload.config&&A(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,E.jsxs)(g,{children:[(0,E.jsx)(_,{title:e.title,subtitle:e.loadError}),(0,E.jsx)(p,{onClick:()=>void O(),children:e.refresh})]});if(w||!k)return(0,E.jsx)(g,{children:(0,E.jsx)(h,{sections:3})});let H=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),U=(e,t)=>A(n=>n&&{...n,[e]:{...n[e],...t}}),W=async()=>{M(!0),B(null);try{await y(k),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}},G=async(e,t)=>{I(t=>({...t,[e]:!0})),B(null);try{await y(k),await x({runtime:e,action:t,version:e===`uv`?k.uv.version:k[e].version,onProgress:t=>R(n=>({...n,[e]:t}))}),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{I(t=>({...t,[e]:!1}))}},K=async()=>{P(!0),B(null);try{await b(),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{P(!1)}};return(0,E.jsxs)(g,{gap:`gap-6`,children:[(0,E.jsx)(_,{title:e.title,actions:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(m,{className:`size-9 shrink-0 p-0`,disabled:V,label:e.refresh,onClick:async()=>{await O()}}),(0,E.jsx)(p,{onClick:()=>void K(),disabled:N||V,children:N?e.pruning:e.prune}),(0,E.jsx)(p,{variant:`primary`,onClick:()=>void W(),disabled:j||V,children:j?e.saving:e.save})]})}),z?(0,E.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:z}):null,(0,E.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,E.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,E.jsx)(`input`,{type:`checkbox`,checked:k.enabled,onChange:e=>A({...k,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,E.jsx)(v,{children:(0,E.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,E.jsxs)(o,{value:k.download.source,onChange:e=>A({...k,download:{...k.download,source:e.target.value}}),children:[(0,E.jsx)(s,{value:`auto`,children:e.downloadSources.auto}),(0,E.jsx)(s,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,E.jsx)(s,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,E.jsx)(`input`,{value:k.download.gatewayBaseUrl,disabled:k.download.source===`direct-only`,onChange:e=>A({...k,download:{...k.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,E.jsx)(`input`,{value:k.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>A({...k,download:{...k.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,E.jsx)(`input`,{value:k.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>A({...k,download:{...k.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,E.jsx)(S,{}),(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:D.map(n=>{let r=H.get(n),i=r?.state===`ready`,a=L[n],f=n===`uv`?k.uv:k[n],m=n===`uv`?t?.payload.config.uv:t?.payload.config[n],h=F[n]===!0,g=T(r,f.version,m?.version);return(0,E.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,E.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:r?.message??e.unknown})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?(0,E.jsx)(l,{className:`size-5 shrink-0 text-success`}):(0,E.jsx)(c,{className:`size-5 shrink-0 text-warning`}),(0,E.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:f.enabled,onChange:e=>{n===`uv`?A({...k,uv:{...k.uv,enabled:e.target.checked}}):U(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,E.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,E.jsx)(`input`,{value:f.version??``,placeholder:r?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?A({...k,uv:{...k.uv,version:t}}):U(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,E.jsxs)(o,{value:k[n].preference,onChange:e=>U(n,{preference:e.target.value}),children:[(0,E.jsx)(s,{value:`managed-first`,children:e.preferences.managedFirst}),(0,E.jsx)(s,{value:`system-first`,children:e.preferences.systemFirst}),(0,E.jsx)(s,{value:`managed-only`,children:e.preferences.managedOnly}),(0,E.jsx)(s,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,E.jsxs)(o,{value:k[n].provision,onChange:e=>U(n,{provision:e.target.value}),children:[(0,E.jsx)(s,{value:`eager`,children:e.provisions.eager}),(0,E.jsx)(s,{value:`on-demand`,children:e.provisions.onDemand}),(0,E.jsx)(s,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),a&&h?(0,E.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[a.message,a.totalBytes&&a.downloadedBytes?` · ${Math.round(a.downloadedBytes/a.totalBytes*100)}%`:``]}):null,(0,E.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,E.jsxs)(p,{variant:`primary`,disabled:!k.enabled||!f.enabled||h,onClick:()=>void G(n,`install`),children:[(0,E.jsx)(u,{className:`size-4`}),h?e.working:e.install]}):(0,E.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,E.jsx)(l,{className:`size-4`}),e.installed]}),r?.repairable?(0,E.jsxs)(p,{disabled:!k.enabled||!f.enabled||h,onClick:()=>void G(n,`repair`),children:[(0,E.jsx)(d,{className:`size-4`}),e.repair]}):null]}),(0,E.jsx)(v,{children:r?.resolved?.executable?(0,E.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:r.resolved.executable}):null})]})]},n)})})]})}export{O as RuntimeToolsSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,n as i}from"./locale-store-DTUQ0JiK.js";import{t as a}from"./messages-C7ruaWtK.js";import{n as o,r as s}from"./popover-select-CLsphyzA.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./download-Dk-ZjtO6.js";import{t as d}from"./rotate-ccw-JM1TBLpp.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-Cc4hUNTt.js";import{t as m}from"./refresh-button-DiWdGAaX.js";import{n as h}from"./settings-loading-skeleton-CAoOV17i.js";import{n as g,t as _}from"./settings-page-header-DG3MQwSF.js";import"./settings-page-layout-SuMAUhMb.js";import{t as v}from"./settings-advanced-gate-B7-XQiJh.js";import{i as y,n as b,r as x}from"./runtime-tools-api-2YumRxOJ.js";import{t as S}from"./phone-dependencies-card-ChRrViSc.js";var C=e(t(),1);function w(e){return e?.trim()||void 0}function T(e,t,n){return e?.state!==`ready`||w(t)!==w(n)}var E=n(),D=[`node`,`python`,`uv`];function O(){let e=a(i(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:w,mutate:O}=f(r(`/api/runtime-tools`)),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)({}),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(null),V=Object.values(F).some(Boolean);if((0,C.useEffect)(()=>{t?.payload.config&&A(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,E.jsxs)(g,{children:[(0,E.jsx)(_,{title:e.title,subtitle:e.loadError}),(0,E.jsx)(p,{onClick:()=>void O(),children:e.refresh})]});if(w||!k)return(0,E.jsx)(g,{children:(0,E.jsx)(h,{sections:3})});let H=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),U=(e,t)=>A(n=>n&&{...n,[e]:{...n[e],...t}}),W=async()=>{M(!0),B(null);try{await y(k),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}},G=async(e,t)=>{I(t=>({...t,[e]:!0})),B(null);try{await y(k),await x({runtime:e,action:t,version:e===`uv`?k.uv.version:k[e].version,onProgress:t=>R(n=>({...n,[e]:t}))}),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{I(t=>({...t,[e]:!1}))}},K=async()=>{P(!0),B(null);try{await b(),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{P(!1)}};return(0,E.jsxs)(g,{gap:`gap-6`,children:[(0,E.jsx)(_,{title:e.title,actions:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(m,{className:`size-9 shrink-0 p-0`,disabled:V,label:e.refresh,onClick:async()=>{await O()}}),(0,E.jsx)(p,{onClick:()=>void K(),disabled:N||V,children:N?e.pruning:e.prune}),(0,E.jsx)(p,{variant:`primary`,onClick:()=>void W(),disabled:j||V,children:j?e.saving:e.save})]})}),z?(0,E.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:z}):null,(0,E.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,E.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,E.jsx)(`input`,{type:`checkbox`,checked:k.enabled,onChange:e=>A({...k,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,E.jsx)(v,{children:(0,E.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,E.jsxs)(o,{value:k.download.source,onChange:e=>A({...k,download:{...k.download,source:e.target.value}}),children:[(0,E.jsx)(s,{value:`auto`,children:e.downloadSources.auto}),(0,E.jsx)(s,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,E.jsx)(s,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,E.jsx)(`input`,{value:k.download.gatewayBaseUrl,disabled:k.download.source===`direct-only`,onChange:e=>A({...k,download:{...k.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,E.jsx)(`input`,{value:k.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>A({...k,download:{...k.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,E.jsx)(`input`,{value:k.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>A({...k,download:{...k.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,E.jsx)(S,{}),(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:D.map(n=>{let r=H.get(n),i=r?.state===`ready`,a=L[n],f=n===`uv`?k.uv:k[n],m=n===`uv`?t?.payload.config.uv:t?.payload.config[n],h=F[n]===!0,g=T(r,f.version,m?.version);return(0,E.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,E.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:r?.message??e.unknown})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?(0,E.jsx)(l,{className:`size-5 shrink-0 text-success`}):(0,E.jsx)(c,{className:`size-5 shrink-0 text-warning`}),(0,E.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:f.enabled,onChange:e=>{n===`uv`?A({...k,uv:{...k.uv,enabled:e.target.checked}}):U(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,E.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,E.jsx)(`input`,{value:f.version??``,placeholder:r?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?A({...k,uv:{...k.uv,version:t}}):U(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,E.jsxs)(o,{value:k[n].preference,onChange:e=>U(n,{preference:e.target.value}),children:[(0,E.jsx)(s,{value:`managed-first`,children:e.preferences.managedFirst}),(0,E.jsx)(s,{value:`system-first`,children:e.preferences.systemFirst}),(0,E.jsx)(s,{value:`managed-only`,children:e.preferences.managedOnly}),(0,E.jsx)(s,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,E.jsxs)(o,{value:k[n].provision,onChange:e=>U(n,{provision:e.target.value}),children:[(0,E.jsx)(s,{value:`eager`,children:e.provisions.eager}),(0,E.jsx)(s,{value:`on-demand`,children:e.provisions.onDemand}),(0,E.jsx)(s,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),a&&h?(0,E.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[a.message,a.totalBytes&&a.downloadedBytes?` · ${Math.round(a.downloadedBytes/a.totalBytes*100)}%`:``]}):null,(0,E.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,E.jsxs)(p,{variant:`primary`,disabled:!k.enabled||!f.enabled||h,onClick:()=>void G(n,`install`),children:[(0,E.jsx)(u,{className:`size-4`}),h?e.working:e.install]}):(0,E.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,E.jsx)(l,{className:`size-4`}),e.installed]}),r?.repairable?(0,E.jsxs)(p,{disabled:!k.enabled||!f.enabled||h,onClick:()=>void G(n,`repair`),children:[(0,E.jsx)(d,{className:`size-4`}),e.repair]}):null]}),(0,E.jsx)(v,{children:r?.resolved?.executable?(0,E.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:r.resolved.executable}):null})]})]},n)})})]})}export{O as RuntimeToolsSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-CLsphyzA.js";import{t as o}from"./secret-input-Dryrns2s.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./secret-input-labels-B5Jl5HqK.js";import{t as l}from"./number-input-El7Szeln.js";var u=n(),d=e(t(),1),f=r();function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function h(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function g(e){return e[`x-hidden`]===!0}function _(e){let t=e.properties;if(!p(t))return[];let n=[];for(let[e,r]of Object.entries(t))p(r)&&(g(r)||n.push({key:e,sub:r,order:m(r),group:h(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function v(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function y(e){let t=(0,u.c)(48),{labels:n,id:r,name:a,s,value:l,onChange:d,disabled:p}=e,m=typeof s.description==`string`?s.description:void 0,h=(typeof s[`x-placeholder`]==`string`?s[`x-placeholder`]:null)||m,g=s.format;if(Array.isArray(s.enum)&&s.enum.every(x)){let e;t[0]!==m||t[1]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[0]=m,t[1]=r,t[2]=e):e=t[2];let n=m?`${r}-help`:void 0,o;t[3]===d?o=t[4]:(o=e=>d(e.target.value),t[3]=d,t[4]=o);let c;t[5]===s.enum?c=t[6]:(c=s.enum.map(b),t[5]=s.enum,t[6]=c);let u;t[7]!==p||t[8]!==r||t[9]!==a||t[10]!==n||t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,f.jsx)(i,{id:r,"aria-describedby":n,name:a,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:l,disabled:p,onChange:o,children:c}),t[7]=p,t[8]=r,t[9]=a,t[10]=n,t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14];let h;return t[15]!==e||t[16]!==u?(h=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,u]}),t[15]=e,t[16]=u,t[17]=h):h=t[17],h}if(g===`password`){let e;t[18]!==m||t[19]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[18]=m,t[19]=r,t[20]=e):e=t[20];let i=m?`${r}-help`:void 0,a=n?.secretInputLabels??c,s;t[21]!==p||t[22]!==r||t[23]!==d||t[24]!==h||t[25]!==i||t[26]!==a||t[27]!==l?(s=(0,f.jsx)(o,{id:r,ariaDescribedBy:i,value:l,onChange:d,placeholder:h,labels:a,disabled:p,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[21]=p,t[22]=r,t[23]=d,t[24]=h,t[25]=i,t[26]=a,t[27]=l,t[28]=s):s=t[28];let u;return t[29]!==e||t[30]!==s?(u=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,s]}),t[29]=e,t[30]=s,t[31]=u):u=t[31],u}let _;t[32]!==m||t[33]!==r?(_=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[32]=m,t[33]=r,t[34]=_):_=t[34];let v=m?`${r}-help`:void 0,y;t[35]===d?y=t[36]:(y=e=>d(e.target.value),t[35]=d,t[36]=y);let S;t[37]!==p||t[38]!==r||t[39]!==a||t[40]!==h||t[41]!==v||t[42]!==y||t[43]!==l?(S=(0,f.jsx)(`input`,{id:r,"aria-describedby":v,name:a,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:l,placeholder:h,disabled:p,onChange:y}),t[37]=p,t[38]=r,t[39]=a,t[40]=h,t[41]=v,t[42]=y,t[43]=l,t[44]=S):S=t[44];let C;return t[45]!==_||t[46]!==S?(C=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[_,S]}),t[45]=_,t[46]=S,t[47]=C):C=t[47],C}function b(e){return(0,f.jsx)(a,{value:e,children:e},e)}function x(e){return typeof e==`string`}function S(e){let t=(0,u.c)(14),{id:n,s:r,value:i,onChange:a,disabled:o}=e,s=typeof r.description==`string`?r.description:void 0,c;t[0]!==s||t[1]!==n?(c=s?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:s}):null,t[0]=s,t[1]=n,t[2]=c):c=t[2];let d=s?`${n}-help`:void 0,p=Number.isFinite(i)?i:0,m;t[3]===a?m=t[4]:(m=e=>a(Number(e.target.value)),t[3]=a,t[4]=m);let h;t[5]!==o||t[6]!==n||t[7]!==d||t[8]!==p||t[9]!==m?(h=(0,f.jsx)(l,{id:n,"aria-describedby":d,type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:p,disabled:o,onChange:m}),t[5]=o,t[6]=n,t[7]=d,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;return t[11]!==c||t[12]!==h?(g=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c,h]}),t[11]=c,t[12]=h,t[13]=g):g=t[13],g}function C(e){let t=(0,u.c)(13),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=(typeof r.description==`string`?r.description:void 0)??(typeof r.title==`string`&&r.title.length>0?r.title:s?.defaultBooleanLabel??`Enable`),l=`${n}-label`,d;t[0]===a?d=t[1]:(d=e=>a(e.target.checked),t[0]=a,t[1]=d);let p;t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==d||t[6]!==i?(p=(0,f.jsx)(`input`,{id:n,"aria-labelledby":l,type:`checkbox`,className:`size-4 rounded border border-edge`,checked:i,disabled:o,onChange:d}),t[2]=o,t[3]=n,t[4]=l,t[5]=d,t[6]=i,t[7]=p):p=t[7];let m;t[8]===c?m=t[9]:(m=(0,f.jsx)(`span`,{children:c}),t[8]=c,t[9]=m);let h;return t[10]!==p||t[11]!==m?(h=(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12],h}function w(e){let t=(0,u.c)(31),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=typeof r.description==`string`?r.description:void 0,l=r.items,d=p(l)?l.type:void 0;if(!(d===`string`||Array.isArray(d)&&d.includes(`string`))){let e=s?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let m,h,g,_,v;if(t[2]!==c||t[3]!==o||t[4]!==n||t[5]!==a||t[6]!==i){let e=i.map(String);m=t=>{let n=t.trim();!n||e.includes(n)||a([...e,n])},_=`flex flex-col gap-1.5`,t[12]!==c||t[13]!==n?(v=c?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:c}):null,t[12]=c,t[13]=n,t[14]=v):v=t[14],h=`flex flex-wrap gap-1`,g=e.map(t=>(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,f.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:o,onClick:()=>a(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=c,t[3]=o,t[4]=n,t[5]=a,t[6]=i,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11];let y;t[15]!==h||t[16]!==g?(y=(0,f.jsx)(`div`,{className:h,children:g}),t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=c?`${n}-help`:void 0,x=s?.arrayAddPlaceholder??`Add and press Enter`,S;t[18]===m?S=t[19]:(S=e=>{e.key===`Enter`&&(e.preventDefault(),m(e.target.value),e.target.value=``)},t[18]=m,t[19]=S);let C;t[20]!==o||t[21]!==n||t[22]!==b||t[23]!==x||t[24]!==S?(C=(0,f.jsx)(`input`,{id:n,"aria-describedby":b,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:o,placeholder:x,onKeyDown:S}),t[20]=o,t[21]=n,t[22]=b,t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==C?(w=(0,f.jsxs)(`div`,{className:_,children:[v,y,C]}),t[26]=_,t[27]=v,t[28]=y,t[29]=C,t[30]=w):w=t[30],w}function T(e){let t=(0,u.c)(76),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=(0,d.useId)(),l=r.type,m=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(l===`boolean`){let e=`${c}-label`,n;t[0]!==c||t[1]!==e||t[2]!==m?(n=(0,f.jsx)(`label`,{id:e,htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[0]=c,t[1]=e,t[2]=m,t[3]=n):n=t[3];let l=i===!0,u;t[4]===a?u=t[5]:(u=e=>a(e),t[4]=a,t[5]=u);let d;t[6]!==o||t[7]!==c||t[8]!==s||t[9]!==r||t[10]!==l||t[11]!==u?(d=(0,f.jsx)(C,{id:c,s:r,value:l,disabled:o,onChange:u,labels:s}),t[6]=o,t[7]=c,t[8]=s,t[9]=r,t[10]=l,t[11]=u,t[12]=d):d=t[12];let p;return t[13]!==n||t[14]!==d?(p=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[n,d]}),t[13]=n,t[14]=d,t[15]=p):p=t[15],p}if(l===`number`||l===`integer`){let e;t[16]!==c||t[17]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[16]=c,t[17]=m,t[18]=e):e=t[18];let n=typeof i==`number`?i:0,s;t[19]!==o||t[20]!==c||t[21]!==a||t[22]!==r||t[23]!==n?(s=(0,f.jsx)(S,{id:c,s:r,value:n,disabled:o,onChange:a}),t[19]=o,t[20]=c,t[21]=a,t[22]=r,t[23]=n,t[24]=s):s=t[24];let l;return t[25]!==e||t[26]!==s?(l=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[25]=e,t[26]=s,t[27]=l):l=t[27],l}if(l===`string`){let e;t[28]!==c||t[29]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[28]=c,t[29]=m,t[30]=e):e=t[30];let l=typeof i==`string`?i:``,u;t[31]!==o||t[32]!==c||t[33]!==n||t[34]!==s||t[35]!==a||t[36]!==r||t[37]!==l?(u=(0,f.jsx)(y,{labels:s,id:c,name:n,s:r,value:l,disabled:o,onChange:a}),t[31]=o,t[32]=c,t[33]=n,t[34]=s,t[35]=a,t[36]=r,t[37]=l,t[38]=u):u=t[38];let d;return t[39]!==e||t[40]!==u?(d=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[39]=e,t[40]=u,t[41]=d):d=t[41],d}if(l===`array`){let e=r.items,n=p(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[42]!==c||t[43]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[42]=c,t[43]=m,t[44]=e):e=t[44];let n;t[45]===i?n=t[46]:(n=Array.isArray(i)&&i.every(E)?i.map(String):[],t[45]=i,t[46]=n);let l;t[47]!==o||t[48]!==c||t[49]!==s||t[50]!==a||t[51]!==r||t[52]!==n?(l=(0,f.jsx)(w,{id:c,s:r,value:n,disabled:o,onChange:a,labels:s}),t[47]=o,t[48]=c,t[49]=s,t[50]=a,t[51]=r,t[52]=n,t[53]=l):l=t[53];let u;return t[54]!==e||t[55]!==l?(u=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[54]=e,t[55]=l,t[56]=u):u=t[56],u}}if(l===`object`){let e;t[57]===i?e=t[58]:(e=p(i)?i:{},t[57]=i,t[58]=e);let n=e,c;t[59]===m?c=t[60]:(c=(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:m}),t[59]=m,t[60]=c);let l;t[61]!==o||t[62]!==s||t[63]!==n||t[64]!==a||t[65]!==r?(l=(0,f.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,f.jsx)(D,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[61]=o,t[62]=s,t[63]=n,t[64]=a,t[65]=r,t[66]=l):l=t[66];let u;return t[67]!==c||t[68]!==l?(u=(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[67]=c,t[68]=l,t[69]=u):u=t[69],u}let h;t[70]!==s||t[71]!==l||t[72]!==m?(h=s?.unsupportedFieldType?.(m,typeof l==`string`?l:void 0)??`${m}: unsupported field type${typeof l==`string`?` (${l})`:``}`,t[70]=s,t[71]=l,t[72]=m,t[73]=h):h=t[73];let g;return t[74]===h?g=t[75]:(g=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h}),t[74]=h,t[75]=g),g}function E(e){return typeof e==`string`||typeof e==`number`}function D(e){let t=(0,u.c)(28),{schema:n,values:r,onChange:i,disabled:a,className:o,labels:c}=e,l=a!==void 0&&a,d;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],d=e;break bb0}let e;t[1]===n?e=t[2]:(e=_(n),t[1]=n,t[2]=e),d=e}let m=d,h;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],h=e;break bb1}let e;t[4]===m?e=t[5]:(e=v(m),t[4]=m,t[5]=e),h=e}let g=h,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!p(n.properties)||m.length===0)return null;let x,S;if(t[9]!==o||t[10]!==l||t[11]!==g||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(g.keys()).sort(O);t[17]===o?x=t[18]:(x=s(`flex flex-col gap-4`,o),t[17]=o,t[18]=x);let n;t[19]!==l||t[20]!==g||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(g.get(e)??[]).map(e=>(0,f.jsx)(T,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:l,labels:c},e.key));return e===``?(0,f.jsx)(`div`,{children:t},`default`):(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,f.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=l,t[20]=g,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=o,t[10]=l,t[11]=g,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let C;return t[25]!==x||t[26]!==S?(C=(0,f.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function O(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{D as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-CLsphyzA.js";import{t as o}from"./secret-input-DsjfQmDn.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./secret-input-labels-B5Jl5HqK.js";import{t as l}from"./number-input-El7Szeln.js";var u=n(),d=e(t(),1),f=r();function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function h(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function g(e){return e[`x-hidden`]===!0}function _(e){let t=e.properties;if(!p(t))return[];let n=[];for(let[e,r]of Object.entries(t))p(r)&&(g(r)||n.push({key:e,sub:r,order:m(r),group:h(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function v(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function y(e){let t=(0,u.c)(48),{labels:n,id:r,name:a,s,value:l,onChange:d,disabled:p}=e,m=typeof s.description==`string`?s.description:void 0,h=(typeof s[`x-placeholder`]==`string`?s[`x-placeholder`]:null)||m,g=s.format;if(Array.isArray(s.enum)&&s.enum.every(x)){let e;t[0]!==m||t[1]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[0]=m,t[1]=r,t[2]=e):e=t[2];let n=m?`${r}-help`:void 0,o;t[3]===d?o=t[4]:(o=e=>d(e.target.value),t[3]=d,t[4]=o);let c;t[5]===s.enum?c=t[6]:(c=s.enum.map(b),t[5]=s.enum,t[6]=c);let u;t[7]!==p||t[8]!==r||t[9]!==a||t[10]!==n||t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,f.jsx)(i,{id:r,"aria-describedby":n,name:a,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:l,disabled:p,onChange:o,children:c}),t[7]=p,t[8]=r,t[9]=a,t[10]=n,t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14];let h;return t[15]!==e||t[16]!==u?(h=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,u]}),t[15]=e,t[16]=u,t[17]=h):h=t[17],h}if(g===`password`){let e;t[18]!==m||t[19]!==r?(e=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[18]=m,t[19]=r,t[20]=e):e=t[20];let i=m?`${r}-help`:void 0,a=n?.secretInputLabels??c,s;t[21]!==p||t[22]!==r||t[23]!==d||t[24]!==h||t[25]!==i||t[26]!==a||t[27]!==l?(s=(0,f.jsx)(o,{id:r,ariaDescribedBy:i,value:l,onChange:d,placeholder:h,labels:a,disabled:p,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[21]=p,t[22]=r,t[23]=d,t[24]=h,t[25]=i,t[26]=a,t[27]=l,t[28]=s):s=t[28];let u;return t[29]!==e||t[30]!==s?(u=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,s]}),t[29]=e,t[30]=s,t[31]=u):u=t[31],u}let _;t[32]!==m||t[33]!==r?(_=m?(0,f.jsx)(`p`,{id:`${r}-help`,className:`text-xs text-fg-muted`,children:m}):null,t[32]=m,t[33]=r,t[34]=_):_=t[34];let v=m?`${r}-help`:void 0,y;t[35]===d?y=t[36]:(y=e=>d(e.target.value),t[35]=d,t[36]=y);let S;t[37]!==p||t[38]!==r||t[39]!==a||t[40]!==h||t[41]!==v||t[42]!==y||t[43]!==l?(S=(0,f.jsx)(`input`,{id:r,"aria-describedby":v,name:a,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:l,placeholder:h,disabled:p,onChange:y}),t[37]=p,t[38]=r,t[39]=a,t[40]=h,t[41]=v,t[42]=y,t[43]=l,t[44]=S):S=t[44];let C;return t[45]!==_||t[46]!==S?(C=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[_,S]}),t[45]=_,t[46]=S,t[47]=C):C=t[47],C}function b(e){return(0,f.jsx)(a,{value:e,children:e},e)}function x(e){return typeof e==`string`}function S(e){let t=(0,u.c)(14),{id:n,s:r,value:i,onChange:a,disabled:o}=e,s=typeof r.description==`string`?r.description:void 0,c;t[0]!==s||t[1]!==n?(c=s?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:s}):null,t[0]=s,t[1]=n,t[2]=c):c=t[2];let d=s?`${n}-help`:void 0,p=Number.isFinite(i)?i:0,m;t[3]===a?m=t[4]:(m=e=>a(Number(e.target.value)),t[3]=a,t[4]=m);let h;t[5]!==o||t[6]!==n||t[7]!==d||t[8]!==p||t[9]!==m?(h=(0,f.jsx)(l,{id:n,"aria-describedby":d,type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:p,disabled:o,onChange:m}),t[5]=o,t[6]=n,t[7]=d,t[8]=p,t[9]=m,t[10]=h):h=t[10];let g;return t[11]!==c||t[12]!==h?(g=(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c,h]}),t[11]=c,t[12]=h,t[13]=g):g=t[13],g}function C(e){let t=(0,u.c)(13),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=(typeof r.description==`string`?r.description:void 0)??(typeof r.title==`string`&&r.title.length>0?r.title:s?.defaultBooleanLabel??`Enable`),l=`${n}-label`,d;t[0]===a?d=t[1]:(d=e=>a(e.target.checked),t[0]=a,t[1]=d);let p;t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==d||t[6]!==i?(p=(0,f.jsx)(`input`,{id:n,"aria-labelledby":l,type:`checkbox`,className:`size-4 rounded border border-edge`,checked:i,disabled:o,onChange:d}),t[2]=o,t[3]=n,t[4]=l,t[5]=d,t[6]=i,t[7]=p):p=t[7];let m;t[8]===c?m=t[9]:(m=(0,f.jsx)(`span`,{children:c}),t[8]=c,t[9]=m);let h;return t[10]!==p||t[11]!==m?(h=(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12],h}function w(e){let t=(0,u.c)(31),{id:n,s:r,value:i,onChange:a,disabled:o,labels:s}=e,c=typeof r.description==`string`?r.description:void 0,l=r.items,d=p(l)?l.type:void 0;if(!(d===`string`||Array.isArray(d)&&d.includes(`string`))){let e=s?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let m,h,g,_,v;if(t[2]!==c||t[3]!==o||t[4]!==n||t[5]!==a||t[6]!==i){let e=i.map(String);m=t=>{let n=t.trim();!n||e.includes(n)||a([...e,n])},_=`flex flex-col gap-1.5`,t[12]!==c||t[13]!==n?(v=c?(0,f.jsx)(`p`,{id:`${n}-help`,className:`text-xs text-fg-muted`,children:c}):null,t[12]=c,t[13]=n,t[14]=v):v=t[14],h=`flex flex-wrap gap-1`,g=e.map(t=>(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,f.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:o,onClick:()=>a(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=c,t[3]=o,t[4]=n,t[5]=a,t[6]=i,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11];let y;t[15]!==h||t[16]!==g?(y=(0,f.jsx)(`div`,{className:h,children:g}),t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=c?`${n}-help`:void 0,x=s?.arrayAddPlaceholder??`Add and press Enter`,S;t[18]===m?S=t[19]:(S=e=>{e.key===`Enter`&&(e.preventDefault(),m(e.target.value),e.target.value=``)},t[18]=m,t[19]=S);let C;t[20]!==o||t[21]!==n||t[22]!==b||t[23]!==x||t[24]!==S?(C=(0,f.jsx)(`input`,{id:n,"aria-describedby":b,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:o,placeholder:x,onKeyDown:S}),t[20]=o,t[21]=n,t[22]=b,t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==C?(w=(0,f.jsxs)(`div`,{className:_,children:[v,y,C]}),t[26]=_,t[27]=v,t[28]=y,t[29]=C,t[30]=w):w=t[30],w}function T(e){let t=(0,u.c)(76),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=(0,d.useId)(),l=r.type,m=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(l===`boolean`){let e=`${c}-label`,n;t[0]!==c||t[1]!==e||t[2]!==m?(n=(0,f.jsx)(`label`,{id:e,htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[0]=c,t[1]=e,t[2]=m,t[3]=n):n=t[3];let l=i===!0,u;t[4]===a?u=t[5]:(u=e=>a(e),t[4]=a,t[5]=u);let d;t[6]!==o||t[7]!==c||t[8]!==s||t[9]!==r||t[10]!==l||t[11]!==u?(d=(0,f.jsx)(C,{id:c,s:r,value:l,disabled:o,onChange:u,labels:s}),t[6]=o,t[7]=c,t[8]=s,t[9]=r,t[10]=l,t[11]=u,t[12]=d):d=t[12];let p;return t[13]!==n||t[14]!==d?(p=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[n,d]}),t[13]=n,t[14]=d,t[15]=p):p=t[15],p}if(l===`number`||l===`integer`){let e;t[16]!==c||t[17]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[16]=c,t[17]=m,t[18]=e):e=t[18];let n=typeof i==`number`?i:0,s;t[19]!==o||t[20]!==c||t[21]!==a||t[22]!==r||t[23]!==n?(s=(0,f.jsx)(S,{id:c,s:r,value:n,disabled:o,onChange:a}),t[19]=o,t[20]=c,t[21]=a,t[22]=r,t[23]=n,t[24]=s):s=t[24];let l;return t[25]!==e||t[26]!==s?(l=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[25]=e,t[26]=s,t[27]=l):l=t[27],l}if(l===`string`){let e;t[28]!==c||t[29]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[28]=c,t[29]=m,t[30]=e):e=t[30];let l=typeof i==`string`?i:``,u;t[31]!==o||t[32]!==c||t[33]!==n||t[34]!==s||t[35]!==a||t[36]!==r||t[37]!==l?(u=(0,f.jsx)(y,{labels:s,id:c,name:n,s:r,value:l,disabled:o,onChange:a}),t[31]=o,t[32]=c,t[33]=n,t[34]=s,t[35]=a,t[36]=r,t[37]=l,t[38]=u):u=t[38];let d;return t[39]!==e||t[40]!==u?(d=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[39]=e,t[40]=u,t[41]=d):d=t[41],d}if(l===`array`){let e=r.items,n=p(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[42]!==c||t[43]!==m?(e=(0,f.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium text-fg`,children:m}),t[42]=c,t[43]=m,t[44]=e):e=t[44];let n;t[45]===i?n=t[46]:(n=Array.isArray(i)&&i.every(E)?i.map(String):[],t[45]=i,t[46]=n);let l;t[47]!==o||t[48]!==c||t[49]!==s||t[50]!==a||t[51]!==r||t[52]!==n?(l=(0,f.jsx)(w,{id:c,s:r,value:n,disabled:o,onChange:a,labels:s}),t[47]=o,t[48]=c,t[49]=s,t[50]=a,t[51]=r,t[52]=n,t[53]=l):l=t[53];let u;return t[54]!==e||t[55]!==l?(u=(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[54]=e,t[55]=l,t[56]=u):u=t[56],u}}if(l===`object`){let e;t[57]===i?e=t[58]:(e=p(i)?i:{},t[57]=i,t[58]=e);let n=e,c;t[59]===m?c=t[60]:(c=(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:m}),t[59]=m,t[60]=c);let l;t[61]!==o||t[62]!==s||t[63]!==n||t[64]!==a||t[65]!==r?(l=(0,f.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,f.jsx)(D,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[61]=o,t[62]=s,t[63]=n,t[64]=a,t[65]=r,t[66]=l):l=t[66];let u;return t[67]!==c||t[68]!==l?(u=(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[67]=c,t[68]=l,t[69]=u):u=t[69],u}let h;t[70]!==s||t[71]!==l||t[72]!==m?(h=s?.unsupportedFieldType?.(m,typeof l==`string`?l:void 0)??`${m}: unsupported field type${typeof l==`string`?` (${l})`:``}`,t[70]=s,t[71]=l,t[72]=m,t[73]=h):h=t[73];let g;return t[74]===h?g=t[75]:(g=(0,f.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h}),t[74]=h,t[75]=g),g}function E(e){return typeof e==`string`||typeof e==`number`}function D(e){let t=(0,u.c)(28),{schema:n,values:r,onChange:i,disabled:a,className:o,labels:c}=e,l=a!==void 0&&a,d;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],d=e;break bb0}let e;t[1]===n?e=t[2]:(e=_(n),t[1]=n,t[2]=e),d=e}let m=d,h;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],h=e;break bb1}let e;t[4]===m?e=t[5]:(e=v(m),t[4]=m,t[5]=e),h=e}let g=h,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!p(n.properties)||m.length===0)return null;let x,S;if(t[9]!==o||t[10]!==l||t[11]!==g||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(g.keys()).sort(O);t[17]===o?x=t[18]:(x=s(`flex flex-col gap-4`,o),t[17]=o,t[18]=x);let n;t[19]!==l||t[20]!==g||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(g.get(e)??[]).map(e=>(0,f.jsx)(T,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:l,labels:c},e.key));return e===``?(0,f.jsx)(`div`,{children:t},`default`):(0,f.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,f.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=l,t[20]=g,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=o,t[10]=l,t[11]=g,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let C;return t[25]!==x||t[26]!==S?(C=(0,f.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function O(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{D as t};
@@ -0,0 +1 @@
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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./copy-Dv6d4Dvw.js";import{t as s}from"./eye-CABVeTq0.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-0WouolD0.js";import{t as ee}from"./copy-to-clipboard-HOJ79TWv.js";import{n as u}from"./interaction-BdhHBbYa.js";import{s as d}from"./form-field-width-DJw_jULe.js";import{n as f,t as te}from"./is-masked-secret-DOkL5b_X.js";var ne=i(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),re=n(),p=e(t(),1),ie={showKey:!1,revealed:void 0,revealLoading:!1,revealErr:null,copied:!1};function m(e,t){switch(t.type){case`reset-reveal`:return{...e,showKey:!1,revealed:void 0,revealErr:null};case`toggle-show`:return{...e,showKey:!e.showKey};case`reveal-start`:return{...e,revealLoading:!0,revealErr:null};case`reveal-success`:return{...e,revealed:t.value,revealLoading:!1,showKey:t.show??!0,revealErr:null};case`reveal-error`:return{...e,revealed:null,revealLoading:!1,revealErr:t.message};case`copied`:return{...e,copied:!0};case`clear-copied`:return{...e,copied:!1};case`invalidate-reveal`:return{...e,revealed:void 0,showKey:!1}}}function h(e){let{value:t,reveal:n,loadFailedLabel:r=`Failed to load secret`,baselineValue:i,allowUnrevealedCopy:a=!1}=e,[o,s]=(0,p.useReducer)(m,ie),c=f(t),l=!!(i?.trim()&&t===i&&!c),u=(0,p.useRef)(n);u.current=n;let d=(0,p.useRef)({masked:c,value:t,unchangedConcealed:l});(!c&&!l&&(d.current.masked||d.current.unchangedConcealed)||d.current.value!==t&&!l)&&s({type:`reset-reveal`}),d.current={masked:c,value:t,unchangedConcealed:l};let ne=l&&!o.showKey?te(t.length):c&&o.showKey&&typeof o.revealed==`string`?o.revealed:t,re=l&&!o.showKey?`password`:l&&o.showKey?`text`:c?o.showKey&&typeof o.revealed==`string`?`text`:`password`:o.showKey?`text`:`password`,h=l&&!o.showKey,g=l&&t.trim()||!c&&t.trim()&&!f(t)?t.trim():typeof o.revealed==`string`&&o.revealed.length>0?o.revealed:``,ae=g.length>0||a&&c&&!!n,_=(0,p.useCallback)(async()=>{let e=g;if(!e&&a&&c&&u.current){s({type:`reveal-start`});try{let t=await u.current();s({type:`reveal-success`,value:t,show:!1}),e=t??``}catch(e){s({type:`reveal-error`,message:e instanceof Error?e.message:r});return}}e&&await ee(e)&&(s({type:`copied`}),window.setTimeout(()=>s({type:`clear-copied`}),2e3))},[a,g,r,c]),v=(0,p.useCallback)(async()=>{if(l||!c){s({type:`toggle-show`});return}if(o.revealed!==void 0){s({type:`toggle-show`});return}if(!u.current){s({type:`toggle-show`});return}s({type:`reveal-start`});try{let e=await u.current();s({type:`reveal-success`,value:e})}catch(e){s({type:`reveal-error`,message:e instanceof Error?e.message:r})}},[r,c,l,o.revealed]),y=(0,p.useCallback)((e,t)=>{h||(c&&typeof o.revealed==`string`&&o.showKey&&e!==o.revealed&&s({type:`invalidate-reveal`}),t(e))},[c,h,o.revealed,o.showKey]),b=o.revealLoading||!c&&!l&&!t.trim()||c&&!n&&o.revealed===void 0;return{masked:c,unchangedConcealed:l,showKey:o.showKey,revealed:o.revealed,revealLoading:o.revealLoading,revealErr:o.revealErr,copied:o.copied,inputValue:ne,inputType:re,readOnly:h,copyEnabled:ae,copySecret:_,toggleEye:v,onInputChange:y,eyeDisabled:b}}var g=r(),ae=l(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-3 pr-20 font-mono text-sm text-fg`,`placeholder:text-fg-subtle`,d,`dark:border-edge`);function _(e){let t=(0,re.c)(76),{id:n,name:r,ariaDescribedBy:i,ariaInvalid:ee,value:d,onChange:f,placeholder:te,disabled:ie,readOnly:m,className:_,inputClassName:v,labels:y,reveal:b,allowUnrevealedCopy:oe,hideCopy:se,loadFailedLabel:ce,maskedHelp:x,notInConfigFile:S,baselineValue:le,autoComplete:ue,onKeyDown:de,inputRef:fe}=e,C=ie!==void 0&&ie,pe=m!==void 0&&m,w=se!==void 0&&se,me=ue===void 0?`off`:ue,T;t[0]!==oe||t[1]!==le||t[2]!==ce||t[3]!==b||t[4]!==d?(T={value:d,reveal:b,loadFailedLabel:ce,baselineValue:le,allowUnrevealedCopy:oe},t[0]=oe,t[1]=le,t[2]=ce,t[3]=b,t[4]=d,t[5]=T):T=t[5];let{masked:E,showKey:D,revealed:he,revealLoading:O,revealErr:k,copied:A,inputValue:ge,inputType:j,readOnly:_e,copyEnabled:M,copySecret:N,toggleEye:P,onInputChange:F,eyeDisabled:ve}=h(T),I=pe||_e,L=(0,p.useId)(),ye=k?L:void 0,R;t[6]!==i||t[7]!==ye?(R=[i,ye].filter(Boolean),t[6]=i,t[7]=ye,t[8]=R):R=t[8];let be=R.join(` `),z;t[9]===_?z=t[10]:(z=l(`flex flex-col gap-1.5`,_),t[9]=_,t[10]=z);let B;t[11]!==E||t[12]!==x?(B=E&&x?(0,g.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:x}):null,t[11]=E,t[12]=x,t[13]=B):B=t[13];let xe=be||void 0,Se=ee||void 0,Ce=E?void 0:te,V;t[14]!==f||t[15]!==F?(V=f?e=>F(e.target.value,f):void 0,t[14]=f,t[15]=F,t[16]=V):V=t[16];let H;t[17]===v?H=t[18]:(H=l(ae,v),t[17]=v,t[18]=H);let U;t[19]!==me||t[20]!==C||t[21]!==n||t[22]!==fe||t[23]!==j||t[24]!==ge||t[25]!==r||t[26]!==de||t[27]!==I||t[28]!==xe||t[29]!==Se||t[30]!==Ce||t[31]!==V||t[32]!==H?(U=(0,g.jsx)(`input`,{ref:fe,id:n,name:r,"aria-describedby":xe,"aria-invalid":Se,type:j,autoComplete:me,spellCheck:!1,disabled:C,readOnly:I,value:ge,placeholder:Ce,onChange:V,onKeyDown:de,className:H}),t[19]=me,t[20]=C,t[21]=n,t[22]=fe,t[23]=j,t[24]=ge,t[25]=r,t[26]=de,t[27]=I,t[28]=xe,t[29]=Se,t[30]=Ce,t[31]=V,t[32]=H,t[33]=U):U=t[33];let W;t[34]!==A||t[35]!==M||t[36]!==N||t[37]!==C||t[38]!==w||t[39]!==y.copied||t[40]!==y.copy||t[41]!==O?(W=M&&!w?(0,g.jsx)(`button`,{type:`button`,className:l(`rounded p-1.5 text-fg-subtle hover:bg-surface-hover hover:text-fg`,u.transition,u.press,u.focusRingPanel),title:A?y.copied:y.copy,"aria-label":A?y.copied:y.copy,disabled:C||O,onClick:()=>void N(),children:A?(0,g.jsx)(a,{className:`size-3.5`}):(0,g.jsx)(o,{className:`size-3.5`})}):null,t[34]=A,t[35]=M,t[36]=N,t[37]=C,t[38]=w,t[39]=y.copied,t[40]=y.copy,t[41]=O,t[42]=W):W=t[42];let G;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(G=l(`rounded p-1.5 text-fg-subtle hover:bg-surface-hover hover:text-fg disabled:opacity-40`,u.transition,u.press,u.focusRingPanel),t[43]=G):G=t[43];let we=D?y.hide:y.show,Te=D?y.hide:y.show,Ee=C||ve,K;t[44]===P?K=t[45]:(K=()=>void P(),t[44]=P,t[45]=K);let q;t[46]!==O||t[47]!==D?(q=O?(0,g.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):D?(0,g.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}):(0,g.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t[46]=O,t[47]=D,t[48]=q):q=t[48];let J;t[49]!==we||t[50]!==Te||t[51]!==Ee||t[52]!==K||t[53]!==q?(J=(0,g.jsx)(`button`,{type:`button`,className:G,title:we,"aria-label":Te,disabled:Ee,onClick:K,children:q}),t[49]=we,t[50]=Te,t[51]=Ee,t[52]=K,t[53]=q,t[54]=J):J=t[54];let Y;t[55]!==W||t[56]!==J?(Y=(0,g.jsxs)(`div`,{className:`absolute right-1 top-1/2 flex -translate-y-1/2 gap-0.5`,children:[W,J]}),t[55]=W,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==U||t[59]!==Y?(X=(0,g.jsxs)(`div`,{className:`relative min-w-0`,children:[U,Y]}),t[58]=U,t[59]=Y,t[60]=X):X=t[60];let Z;t[61]!==E||t[62]!==S||t[63]!==k||t[64]!==he||t[65]!==D?(Z=E&&D&&he===null&&!k&&S?(0,g.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400/90`,children:S}):null,t[61]=E,t[62]=S,t[63]=k,t[64]=he,t[65]=D,t[66]=Z):Z=t[66];let Q;t[67]!==L||t[68]!==k?(Q=k?(0,g.jsx)(`p`,{id:L,role:`alert`,className:`break-words text-xs text-danger`,children:k}):null,t[67]=L,t[68]=k,t[69]=Q):Q=t[69];let $;return t[70]!==X||t[71]!==Z||t[72]!==Q||t[73]!==z||t[74]!==B?($=(0,g.jsxs)(`div`,{className:z,children:[B,X,Z,Q]}),t[70]=X,t[71]=Z,t[72]=Q,t[73]=z,t[74]=B,t[75]=$):$=t[75],$}export{ne as n,_ as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{u as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,n as a,o}from"./locale-store-CQcW9_qA.js";import{t as s}from"./messages-orB1BMgI.js";import{t as c}from"./createLucideIcon-DPHK1VkS.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{i as l}from"./working-directory-picker-modal-CFj-ZOJE.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{s as d,t as f}from"./install-connector-dialog-B-v1FT3P.js";import{t as p}from"./package-wATCyihJ.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as te}from"./button-Cc4hUNTt.js";import{a as v,i as y,o as b,s as x}from"./connectors-api-DNVUmf9M.js";import{t as S}from"./agent-plugin-dialog-BhtzU8qr.js";import{t as C}from"./capability-icon-CmvCZOJX.js";import{t as w}from"./extension-marketplace-api-BrLsjJLA.js";var T=c(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),E=e(t(),1),D={"notion-office":`notion`,"todoist-mcp":`todoist`,"amap-maps":`amap`,"feishu-workspace":`feishu`,"wecom-workspace":`wecom`,"dingtalk-workspace":`dingtalk`,"wps365-workspace":`wps365`},O=[`feishu`,`wecom`,`dingtalk`,`tencent-docs`,`wps365`,`yuque`,`dida365`,`flomo`,`tencent-meeting`,`amap`,`bailian-web-search`,`railway-12306`,`antv-chart`],k={"store-plugin":0,"builtin-connector":1,"store-connector":2,"registry-connector":3};function A(e){let t=e.toLowerCase().replace(/^composio-/,``);return D[t]??t}function j(e){if(!e)return 2**53-1;let t=O.indexOf(A(e.id));return t>=0?t:e.regions?.includes(`china`)?O.length:2**53-1}function M(e,t){let n=new Map;for(let t of e){if(!t.service)continue;let e=A(t.service.id),r=n.get(e);(!r?.service||k[t.service.source]<k[r.service.source])&&n.set(e,t)}let r=e.filter(e=>!e.service||n.get(A(e.service.id))===e);return t.startsWith(`zh`)?r.toSorted((e,t)=>j(e.service)-j(t.service)):r}function N(e,t){let n=t.trim().toLocaleLowerCase();return!n||[e.name,e.description,e.source,...e.tags].some(e=>e.toLocaleLowerCase().includes(n))}function P(e){return e?[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)?`attention`:`installed`:`available`}function F(e,t,n,r=`en`){return M(e,r).filter(e=>(t===`all`||e.kind===t)&&N(e,n))}function I(e,t,n,r=`en`){let i=new Map(n.map(e=>[e.connectorId,e])),a=new Map;for(let t of e){let e=i.get(t.id);a.set(t.id,{id:t.id,service:{id:t.id,source:t.source===`builtin`?`builtin-connector`:t.source===`store`?`store-connector`:`registry-connector`},kind:`connector`,name:t.displayName,description:t.description,source:t.source,status:P(e),tags:[t.category,t.kind,...t.tags??[]],href:`/capabilities/connectors?tab=${e?`connected`:`discover`}&${e?`instance`:`connector`}=${encodeURIComponent(e?.instanceId??t.id)}`,iconUrl:t.branding?.logoUrl})}for(let e of t){let t=e.name,n=e.localizations?.[r.startsWith(`zh`)?`zh-CN`:`en`],o=i.get(t);a.set(`store:${t}`,{id:t,service:{id:t,source:`store-connector`,regions:e.regions},kind:`connector`,name:n?.displayName??e.name,description:n?.description??e.description,source:e.author.username||`XOPC Store`,status:P(o),tags:[e.name,e.category,...e.tags??[]].filter(e=>!!e),href:o?`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(o.instanceId)}`:`/capabilities/connectors?tab=discover&storeConnector=${encodeURIComponent(t)}`,iconUrl:e.branding?.iconUrl})}return M([...a.values()],r)}function L(e,t,n=`en`){return e.map(e=>({id:e.id,kind:`extension`,...e.packageType===`plugin`?{service:{id:e.id,source:`store-plugin`}}:{},name:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.displayName??e.name,description:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.description??e.description??``,source:e.author||e.npmPackage,status:t.has(e.id)?`installed`:`available`,tags:[e.id,...e.categories??[],...e.tags??[]],href:`/capabilities/extensions?tab=marketplace&q=${encodeURIComponent(e.name)}`,iconUrl:e.branding?.iconUrl}))}async function R(e=``){let t=await b({q:e,page:1,pageSize:50,sort:`downloads`}),n=await Promise.all(Array.from({length:Math.max(0,t.meta.totalPages-1)},(t,n)=>b({q:e,page:n+2,pageSize:50,sort:`downloads`})));return[...t.items,...n.flatMap(e=>e.items)]}async function z(e){let[t,n,r]=await Promise.allSettled([w(),y(),R()]),i=[t,n,r].filter(e=>e.status===`rejected`).length;if(i===3)throw Error(`Service recommendations unavailable`);let a=n.status===`fulfilled`?n.value:[];return{items:M([...L(t.status===`fulfilled`?t.value.filter(e=>e.packageType===`plugin`):[],new Set,e),...I(a,r.status===`fulfilled`?r.value:[],[],e)],e),definitions:a,failedSources:i}}var B=n();function V({initialCount:e=3,query:t=``,layout:n=`list`,onChanged:c}){let y=r(),b=a(e=>e.language),w=b.startsWith(`zh`),D=s(b).onboarding.workDiscovery,O=s(b).connectorsSettings,{data:k,error:A,isLoading:j,mutate:M}=_([`service-recommendations`,b],()=>z(b),{revalidateOnFocus:!1}),{data:N,error:P,mutate:I}=_(`recommended-connector-instances`,v),{data:L,error:R,mutate:V}=_(`gateway-extensions-list`,()=>o(i(`/api/extensions`))),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(null),[K,q]=(0,E.useState)(null),[J,Y]=(0,E.useState)(null),[X,Z]=(0,E.useState)(``),Q=F(k?.items??[],`all`,t,b);async function $(){let e=(await Promise.allSettled([I(),V(),Promise.resolve().then(()=>c?.())])).find(e=>e.status===`rejected`);e?.status===`rejected`&&Z(String(e.reason))}async function ne(e,t){if(Z(``),e.service?.source===`store-plugin`){q({id:e.id,extension:t});return}let n=N?.find(t=>t.connectorId===e.id);if(n){y(`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(n.instanceId)}`);return}Y(e.id);try{if(e.service?.source===`store-connector`){let t=await x(e.id);G(d(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}else{let t=k?.definitions.find(t=>t.id===e.id);t&&G(d(t))}}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(null)}}return(0,B.jsxs)(`div`,{children:[j?(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`space-y-2`,"aria-busy":`true`,children:Array.from({length:e},(e,t)=>(0,B.jsx)(g,{className:n===`cards`?`h-[8.75rem] rounded-xl`:`h-20 rounded-xl`},t))}):null,A||k?.failedSources||P||R?(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-fg-muted`,role:`status`,children:[D.connectorLoadFailed,` `,(0,B.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>{M(),I(),V()},children:w?`重试`:`Retry`})]}):null,!j&&!A&&Q.length===0?(0,B.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:D.noWorkServices}):null,(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-base/55`,children:(H?Q:Q.slice(0,e)).map(e=>{let t=L?.extensions.find(t=>t.format===`agent-plugin`&&t.provenance?.packageName===e.id),r=N?.find(t=>t.connectorId===e.id),i=e.service?.source===`store-plugin`,a=i?!!(t?.active&&t.readiness===`ready`&&[`connected`,`not_required`].includes(t.authorizationStatus??``)):!!(r?.enabled&&r.status===`connected`),o=i?!!t:!!r,s=(i?!L&&!R:!N&&!P)?(0,B.jsx)(g,{className:`h-8 w-16 shrink-0 rounded-lg`}):(0,B.jsxs)(te,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-3 text-xs`,disabled:J!==null,onClick:()=>void ne(e,t),children:[J===e.id?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):o?null:(0,B.jsx)(m,{className:`size-3.5`}),a?w?`管理`:`Manage`:o?w?`继续设置`:`Set up`:O.connect]});return(0,B.jsx)(`article`,{className:h(n===`cards`?`group flex min-h-[8.75rem] min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`:`flex min-h-20 items-center gap-3 px-3 py-3 sm:px-4`),children:n===`cards`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),s]}),(0,B.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:e.description,children:e.description})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),s]})},`${e.kind}:${e.id}`)})}),Q.length>e?(0,B.jsxs)(`button`,{type:`button`,className:`mx-auto mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>U(e=>!e),children:[H?(0,B.jsx)(l,{className:`size-3.5`}):(0,B.jsx)(ee,{className:`size-3.5`}),H?D.showFewerServices:D.showMoreServices]}):null,X?(0,B.jsx)(`p`,{className:`mt-3 text-xs text-danger`,role:`alert`,children:X}):null,W?(0,B.jsx)(f,{draft:W,onChange:G,onClose:()=>G(null),t:O,onInstalled:async()=>{await $(),G(null)}}):null,K?(0,B.jsx)(S,{initialSource:`store:${K.id}`,extension:K.extension,onClose:()=>{q(null),$()}}):null]})}export{T as a,M as i,z as n,A as r,V as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{u as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,n as a,o}from"./locale-store-DTUQ0JiK.js";import{t as s}from"./messages-C7ruaWtK.js";import{t as c}from"./createLucideIcon-DPHK1VkS.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{i as l}from"./working-directory-picker-modal-D3BUBFa0.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{s as d,t as f}from"./install-connector-dialog-DT32t-66.js";import{t as p}from"./package-wATCyihJ.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{i as _}from"./vendor-swr-CdRzEUwF.js";import{t as te}from"./button-Cc4hUNTt.js";import{a as v,i as y,o as b,s as x}from"./connectors-api-dai-YAdK.js";import{t as S}from"./agent-plugin-dialog-x7guoCvz.js";import{t as C}from"./capability-icon-CmvCZOJX.js";import{t as w}from"./extension-marketplace-api-tk93vJL_.js";var T=c(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),E=e(t(),1),D={"notion-office":`notion`,"todoist-mcp":`todoist`,"amap-maps":`amap`,"feishu-workspace":`feishu`,"wecom-workspace":`wecom`,"dingtalk-workspace":`dingtalk`,"wps365-workspace":`wps365`},O=[`feishu`,`wecom`,`dingtalk`,`tencent-docs`,`wps365`,`yuque`,`dida365`,`flomo`,`tencent-meeting`,`amap`,`bailian-web-search`,`railway-12306`,`antv-chart`],k={"store-plugin":0,"builtin-connector":1,"store-connector":2,"registry-connector":3};function A(e){let t=e.toLowerCase().replace(/^composio-/,``);return D[t]??t}function j(e){if(!e)return 2**53-1;let t=O.indexOf(A(e.id));return t>=0?t:e.regions?.includes(`china`)?O.length:2**53-1}function M(e,t){let n=new Map;for(let t of e){if(!t.service)continue;let e=A(t.service.id),r=n.get(e);(!r?.service||k[t.service.source]<k[r.service.source])&&n.set(e,t)}let r=e.filter(e=>!e.service||n.get(A(e.service.id))===e);return t.startsWith(`zh`)?r.toSorted((e,t)=>j(e.service)-j(t.service)):r}function N(e,t){let n=t.trim().toLocaleLowerCase();return!n||[e.name,e.description,e.source,...e.tags].some(e=>e.toLocaleLowerCase().includes(n))}function P(e){return e?[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)?`attention`:`installed`:`available`}function F(e,t,n,r=`en`){return M(e,r).filter(e=>(t===`all`||e.kind===t)&&N(e,n))}function I(e,t,n,r=`en`){let i=new Map(n.map(e=>[e.connectorId,e])),a=new Map;for(let t of e){let e=i.get(t.id);a.set(t.id,{id:t.id,service:{id:t.id,source:t.source===`builtin`?`builtin-connector`:t.source===`store`?`store-connector`:`registry-connector`},kind:`connector`,name:t.displayName,description:t.description,source:t.source,status:P(e),tags:[t.category,t.kind,...t.tags??[]],href:`/capabilities/connectors?tab=${e?`connected`:`discover`}&${e?`instance`:`connector`}=${encodeURIComponent(e?.instanceId??t.id)}`,iconUrl:t.branding?.logoUrl})}for(let e of t){let t=e.name,n=e.localizations?.[r.startsWith(`zh`)?`zh-CN`:`en`],o=i.get(t);a.set(`store:${t}`,{id:t,service:{id:t,source:`store-connector`,regions:e.regions},kind:`connector`,name:n?.displayName??e.name,description:n?.description??e.description,source:e.author.username||`XOPC Store`,status:P(o),tags:[e.name,e.category,...e.tags??[]].filter(e=>!!e),href:o?`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(o.instanceId)}`:`/capabilities/connectors?tab=discover&storeConnector=${encodeURIComponent(t)}`,iconUrl:e.branding?.iconUrl})}return M([...a.values()],r)}function L(e,t,n=`en`){return e.map(e=>({id:e.id,kind:`extension`,...e.packageType===`plugin`?{service:{id:e.id,source:`store-plugin`}}:{},name:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.displayName??e.name,description:e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`]?.description??e.description??``,source:e.author||e.npmPackage,status:t.has(e.id)?`installed`:`available`,tags:[e.id,...e.categories??[],...e.tags??[]],href:`/capabilities/extensions?tab=marketplace&q=${encodeURIComponent(e.name)}`,iconUrl:e.branding?.iconUrl}))}async function R(e=``){let t=await b({q:e,page:1,pageSize:50,sort:`downloads`}),n=await Promise.all(Array.from({length:Math.max(0,t.meta.totalPages-1)},(t,n)=>b({q:e,page:n+2,pageSize:50,sort:`downloads`})));return[...t.items,...n.flatMap(e=>e.items)]}async function z(e){let[t,n,r]=await Promise.allSettled([w(),y(),R()]),i=[t,n,r].filter(e=>e.status===`rejected`).length;if(i===3)throw Error(`Service recommendations unavailable`);let a=n.status===`fulfilled`?n.value:[];return{items:M([...L(t.status===`fulfilled`?t.value.filter(e=>e.packageType===`plugin`):[],new Set,e),...I(a,r.status===`fulfilled`?r.value:[],[],e)],e),definitions:a,failedSources:i}}var B=n();function V({initialCount:e=3,query:t=``,layout:n=`list`,onChanged:c}){let y=r(),b=a(e=>e.language),w=b.startsWith(`zh`),D=s(b).onboarding.workDiscovery,O=s(b).connectorsSettings,{data:k,error:A,isLoading:j,mutate:M}=_([`service-recommendations`,b],()=>z(b),{revalidateOnFocus:!1}),{data:N,error:P,mutate:I}=_(`recommended-connector-instances`,v),{data:L,error:R,mutate:V}=_(`gateway-extensions-list`,()=>o(i(`/api/extensions`))),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(null),[K,q]=(0,E.useState)(null),[J,Y]=(0,E.useState)(null),[X,Z]=(0,E.useState)(``),Q=F(k?.items??[],`all`,t,b);async function $(){let e=(await Promise.allSettled([I(),V(),Promise.resolve().then(()=>c?.())])).find(e=>e.status===`rejected`);e?.status===`rejected`&&Z(String(e.reason))}async function ne(e,t){if(Z(``),e.service?.source===`store-plugin`){q({id:e.id,extension:t});return}let n=N?.find(t=>t.connectorId===e.id);if(n){y(`/capabilities/connectors?tab=connected&instance=${encodeURIComponent(n.instanceId)}`);return}Y(e.id);try{if(e.service?.source===`store-connector`){let t=await x(e.id);G(d(t.definition,{packageName:t.packageName,version:t.version,reviewHash:t.reviewHash,permissions:t.permissions}))}else{let t=k?.definitions.find(t=>t.id===e.id);t&&G(d(t))}}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Y(null)}}return(0,B.jsxs)(`div`,{children:[j?(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`space-y-2`,"aria-busy":`true`,children:Array.from({length:e},(e,t)=>(0,B.jsx)(g,{className:n===`cards`?`h-[8.75rem] rounded-xl`:`h-20 rounded-xl`},t))}):null,A||k?.failedSources||P||R?(0,B.jsxs)(`p`,{className:`mb-3 text-sm text-fg-muted`,role:`status`,children:[D.connectorLoadFailed,` `,(0,B.jsx)(`button`,{type:`button`,className:`text-accent-fg hover:underline`,onClick:()=>{M(),I(),V()},children:w?`重试`:`Retry`})]}):null,!j&&!A&&Q.length===0?(0,B.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:D.noWorkServices}):null,(0,B.jsx)(`div`,{className:n===`cards`?`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`:`divide-y divide-edge-subtle rounded-xl border border-edge-subtle bg-surface-base/55`,children:(H?Q:Q.slice(0,e)).map(e=>{let t=L?.extensions.find(t=>t.format===`agent-plugin`&&t.provenance?.packageName===e.id),r=N?.find(t=>t.connectorId===e.id),i=e.service?.source===`store-plugin`,a=i?!!(t?.active&&t.readiness===`ready`&&[`connected`,`not_required`].includes(t.authorizationStatus??``)):!!(r?.enabled&&r.status===`connected`),o=i?!!t:!!r,s=(i?!L&&!R:!N&&!P)?(0,B.jsx)(g,{className:`h-8 w-16 shrink-0 rounded-lg`}):(0,B.jsxs)(te,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-3 text-xs`,disabled:J!==null,onClick:()=>void ne(e,t),children:[J===e.id?(0,B.jsx)(u,{className:`size-3.5 animate-spin`}):o?null:(0,B.jsx)(m,{className:`size-3.5`}),a?w?`管理`:`Manage`:o?w?`继续设置`:`Set up`:O.connect]});return(0,B.jsx)(`article`,{className:h(n===`cards`?`group flex min-h-[8.75rem] min-w-0 flex-col rounded-xl border border-edge bg-surface-panel p-4 transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`:`flex min-h-20 items-center gap-3 px-3 py-3 sm:px-4`),children:n===`cards`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),s]}),(0,B.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-6 text-fg-muted`,title:e.description,children:e.description})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(C,{iconUrl:e.iconUrl,fallback:i?p:T}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,B.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),s]})},`${e.kind}:${e.id}`)})}),Q.length>e?(0,B.jsxs)(`button`,{type:`button`,className:`mx-auto mt-3 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>U(e=>!e),children:[H?(0,B.jsx)(l,{className:`size-3.5`}):(0,B.jsx)(ee,{className:`size-3.5`}),H?D.showFewerServices:D.showMoreServices]}):null,X?(0,B.jsx)(`p`,{className:`mt-3 text-xs text-danger`,role:`alert`,children:X}):null,W?(0,B.jsx)(f,{draft:W,onChange:G,onClose:()=>G(null),t:O,onInstalled:async()=>{await $(),G(null)}}):null,K?(0,B.jsx)(S,{initialSource:`store:${K.id}`,extension:K.extension,onClose:()=>{q(null),$()}}):null]})}export{T as a,M as i,z as n,A as r,V as t};
@@ -1 +1 @@
1
- import{i as e,o as t}from"./locale-store-CQcW9_qA.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,i as c,m as l,n as u,u as d,y as f}from"./schemas-CCWMleym.js";import{t as p}from"./gateway-startup-retry-DztAHGru.js";f().transform(e=>e.toLowerCase()).brand();var m=l().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),h=u([`active`,`idle`,`archived`,`pinned`]),g=a({agentId:l().optional(),source:l().optional(),accountId:l().optional(),peerKind:l().optional(),peerId:l().optional(),threadId:l().optional(),scopeId:l().optional()}).passthrough();a({agentId:l().optional(),projectId:l().optional(),key:l(),transcriptId:m.optional(),name:l().optional(),title:l().optional(),displayName:l().optional(),messageCount:d(),updatedAt:l(),sourceChannel:l().optional(),status:h.optional(),usage:a({calls:d().int().nonnegative(),unknownCostCalls:d().int().nonnegative(),totalTokens:d().int().nonnegative(),knownCostUsd:l(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:g.optional()}).passthrough();var _=a({items:c(n()),total:d(),limit:d(),offset:d(),hasMore:r()}),v=a({role:l(),content:n(),timestamp:s([l(),d()]).optional()}).passthrough(),y=a({key:l(),messages:c(v)}).passthrough(),b=a({session:y}),ee=a({session:a({key:l(),transcriptId:m.optional(),messages:c(v),name:l().optional(),status:h.optional(),sourceChannel:l().optional(),sourceChatId:l().optional(),projectId:l().optional(),customData:o(l(),n()).optional(),routing:g.optional()}).passthrough(),pagination:a({total:d(),limit:d(),offset:d(),hasMore:r(),before:l().optional(),nextBeforeCursor:l().optional(),revision:d().int().nonnegative().optional()}).passthrough()}).passthrough(),x=a({ok:i(!0),conversationId:f(),rowCount:d().int().nonnegative(),lastTurnId:l().min(1),session:y}).passthrough(),S=a({ok:r().optional(),payload:a({active:r(),runId:l().optional()}).passthrough().optional()}).passthrough(),C=a({ok:r().optional(),error:l().optional()}).passthrough(),w=C.extend({renamed:r().optional()}),T=C.extend({reset:r().optional(),transcriptId:m.optional(),previousTranscriptId:l().optional(),session:n().optional()}),E=a({totalSessions:d(),activeSessions:d(),archivedSessions:d(),pinnedSessions:d(),totalMessages:d(),totalTokens:d(),oldestSession:l().optional(),newestSession:l().optional(),byChannel:o(l(),d())}).passthrough();a({ok:r(),payload:a({conversationId:f(),transcriptId:m,session:n()}).passthrough().optional(),error:l().optional()}).passthrough();var D=a({ok:i(!0),projects:a({items:c(a({project:n(),sessions:c(n()),sessionTotal:d(),sessionHasMore:r()}).passthrough()),total:d(),limit:d(),offset:d(),hasMore:r()}),inbox:_,pinned:c(n()).default([]),layouts:o(l(),a({itemIds:c(l()),revision:d().int().nonnegative()})).default({}),childrenByConversationId:o(l(),a({total:d(),activeCount:d(),items:c(a({taskId:l(),title:l(),phase:l(),runStatus:l().optional(),activeConversationId:l().optional()}))})).default({})}).passthrough();function O(e){return b.parse(e)}function k(e){return ee.parse(e)}function A(e){return x.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){let t=j(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function R(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.excludeAutomationRuns&&t.set(`excludeAutomationRuns`,`true`),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function z(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function B(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function H(){return`/api/sessions/stats`}function U(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function W(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function G(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function K(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,excludeAutomationRuns:e.excludeAutomationRuns,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var q=new Map;async function J(t){let n=K(t),r=q.get(n);if(r)return r;let i=e(`/api/sessions${R(t)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{q.delete(n)});return q.set(n,a),a}async function Y(n){return I(await t(e(U(n))))}async function X(n){let r=await t(e(W(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Z(){return F(await t(e(H())))}async function Q(n,r){let i=O(await t(e(z(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function ne(n){let r=await t(e(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function $(n){M(await t(e(G(n,`delete`)),{method:`DELETE`}))}async function re(n,r){return{renamed:N(await t(e(G(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function ie(n){M(await t(e(G(n,`archive`)),{method:`POST`}))}async function ae(n){M(await t(e(G(n,`unarchive`)),{method:`POST`}))}async function oe(n){M(await t(e(G(n,`pin`)),{method:`POST`}))}async function se(n){M(await t(e(G(n,`unpin`)),{method:`POST`}))}async function ce(n){return(await t(e(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{L as _,Q as a,P as b,oe as c,X as d,ae as f,V as g,te as h,Y as i,re as l,B as m,$ as n,Z as o,se as p,ce as r,J as s,ie as t,ne as u,A as v,k as y};
1
+ import{i as e,o as t}from"./locale-store-DTUQ0JiK.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,i as c,m as l,n as u,u as d,y as f}from"./schemas-CCWMleym.js";import{t as p}from"./gateway-startup-retry-DMQI0ATo.js";f().transform(e=>e.toLowerCase()).brand();var m=l().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),h=u([`active`,`idle`,`archived`,`pinned`]),g=a({agentId:l().optional(),source:l().optional(),accountId:l().optional(),peerKind:l().optional(),peerId:l().optional(),threadId:l().optional(),scopeId:l().optional()}).passthrough();a({agentId:l().optional(),projectId:l().optional(),key:l(),transcriptId:m.optional(),name:l().optional(),title:l().optional(),displayName:l().optional(),messageCount:d(),updatedAt:l(),sourceChannel:l().optional(),status:h.optional(),usage:a({calls:d().int().nonnegative(),unknownCostCalls:d().int().nonnegative(),totalTokens:d().int().nonnegative(),knownCostUsd:l(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:g.optional()}).passthrough();var _=a({items:c(n()),total:d(),limit:d(),offset:d(),hasMore:r()}),v=a({role:l(),content:n(),timestamp:s([l(),d()]).optional()}).passthrough(),y=a({key:l(),messages:c(v)}).passthrough(),b=a({session:y}),ee=a({session:a({key:l(),transcriptId:m.optional(),messages:c(v),name:l().optional(),status:h.optional(),sourceChannel:l().optional(),sourceChatId:l().optional(),projectId:l().optional(),customData:o(l(),n()).optional(),routing:g.optional()}).passthrough(),pagination:a({total:d(),limit:d(),offset:d(),hasMore:r(),before:l().optional(),nextBeforeCursor:l().optional(),revision:d().int().nonnegative().optional()}).passthrough()}).passthrough(),x=a({ok:i(!0),conversationId:f(),rowCount:d().int().nonnegative(),lastTurnId:l().min(1),session:y}).passthrough(),S=a({ok:r().optional(),payload:a({active:r(),runId:l().optional()}).passthrough().optional()}).passthrough(),C=a({ok:r().optional(),error:l().optional()}).passthrough(),w=C.extend({renamed:r().optional()}),T=C.extend({reset:r().optional(),transcriptId:m.optional(),previousTranscriptId:l().optional(),session:n().optional()}),E=a({totalSessions:d(),activeSessions:d(),archivedSessions:d(),pinnedSessions:d(),totalMessages:d(),totalTokens:d(),oldestSession:l().optional(),newestSession:l().optional(),byChannel:o(l(),d())}).passthrough();a({ok:r(),payload:a({conversationId:f(),transcriptId:m,session:n()}).passthrough().optional(),error:l().optional()}).passthrough();var D=a({ok:i(!0),projects:a({items:c(a({project:n(),sessions:c(n()),sessionTotal:d(),sessionHasMore:r()}).passthrough()),total:d(),limit:d(),offset:d(),hasMore:r()}),inbox:_,pinned:c(n()).default([]),layouts:o(l(),a({itemIds:c(l()),revision:d().int().nonnegative()})).default({}),childrenByConversationId:o(l(),a({total:d(),activeCount:d(),items:c(a({taskId:l(),title:l(),phase:l(),runStatus:l().optional(),activeConversationId:l().optional()}))})).default({})}).passthrough();function O(e){return b.parse(e)}function k(e){return ee.parse(e)}function A(e){return x.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){let t=j(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function R(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.excludeAutomationRuns&&t.set(`excludeAutomationRuns`,`true`),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function z(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function B(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function H(){return`/api/sessions/stats`}function U(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function W(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function G(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function K(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,excludeAutomationRuns:e.excludeAutomationRuns,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var q=new Map;async function J(t){let n=K(t),r=q.get(n);if(r)return r;let i=e(`/api/sessions${R(t)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{q.delete(n)});return q.set(n,a),a}async function Y(n){return I(await t(e(U(n))))}async function X(n){let r=await t(e(W(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Z(){return F(await t(e(H())))}async function Q(n,r){let i=O(await t(e(z(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function ne(n){let r=await t(e(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function $(n){M(await t(e(G(n,`delete`)),{method:`DELETE`}))}async function re(n,r){return{renamed:N(await t(e(G(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function ie(n){M(await t(e(G(n,`archive`)),{method:`POST`}))}async function ae(n){M(await t(e(G(n,`unarchive`)),{method:`POST`}))}async function oe(n){M(await t(e(G(n,`pin`)),{method:`POST`}))}async function se(n){M(await t(e(G(n,`unpin`)),{method:`POST`}))}async function ce(n){return(await t(e(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{L as _,Q as a,P as b,oe as c,X as d,ae as f,V as g,te as h,Y as i,re as l,B as m,$ as n,Z as o,se as p,ce as r,J as s,ie as t,ne as u,A as v,k as y};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./createLucideIcon-DPHK1VkS.js";import{t as r}from"./clock-3-DnrAnuyZ.js";import{t as i}from"./git-branch-Dh9uxTot.js";import{t as a}from"./message-circle-Badhj-4D.js";import{t as o}from"./message-square-fVE7Ghj1.js";import{t as s}from"./plug-DKYPEgkR.js";import{t as c}from"./settings-2-D-csvaET.js";import{t as l}from"./terminal-oKqqZdiG.js";import{t as u}from"./zap-dximCGjy.js";import{t as d}from"./cn-0WouolD0.js";import{a as f,d as p,i as m,m as h,n as g}from"./schemas-CCWMleym.js";var _=n(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),v={workbench:[`webchat`,`web`,`ui`,`webui`,`gateway`],browser:[`browser_extension`],terminal:[`cli`,`tui`],telegram:[`telegram`],wechat:[`wechat`,`weixin`],feishu:[`feishu`,`lark`],api:[`api`,`mcp`],automation:[`automation`,`cron`],system:[`heartbeat`,`system`]},y=[...Object.keys(v),`other`],b=[`chat`,`automation`,`subagent`,`system`];p({sources:m(g(y)).max(y.length).optional(),purposes:m(g(b)).max(b.length).optional(),activity:g([`manual`,`automatic`]).optional(),agentId:h().trim().min(1).max(128).optional(),excludeArchived:f().optional(),excludeAutomationRuns:f().optional()});function x(e){let t=e.customData?.automationSetup;return typeof t==`object`&&!!t&&!Array.isArray(t)}function S(e){let t=e.sourceChannel.trim().toLowerCase(),n=e.customData??{},r=`other`;for(let[e,n]of Object.entries(v))n.includes(t)&&(r=e);n.createdSurface===`browser_extension`&&(r=`browser`),(n.origin===`automation`||n.triggerSource===`automation`||e.sessionType===`cron`)&&(r=`automation`),e.sessionType===`heartbeat`&&(r=`system`);let i=r===`system`?`system`:e.sessionType===`subagent`?`subagent`:r===`automation`?`automation`:`chat`;return{source:r,purpose:i,automatic:r===`automation`||r===`system`}}var C=e(),w=t(),T={feishu:`/channel-icons/feishu.svg`,lark:`/channel-icons/lark.svg`,telegram:`/channel-icons/telegram.svg`,wechat:`/channel-icons/wechat.svg`,weixin:`/channel-icons/weixin.svg`};function E(e){let t=(0,C.c)(20),{sourceChannel:n,className:f,session:p}=e;if(p&&x(p)){let e;t[0]===f?e=t[1]:(e=d(`shrink-0`,f),t[0]=f,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,w.jsx)(u,{className:e,strokeWidth:1.75,"aria-hidden":!0}),t[2]=e,t[3]=n),n}let m=S(p??{sourceChannel:n}),h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h={automation:r,subagent:i,system:c},t[4]=h):h=t[4];let g=h,v=m.purpose===`chat`?void 0:g[m.purpose];if(v){let e;t[5]===f?e=t[6]:(e=d(`shrink-0`,f),t[5]=f,t[6]=e);let n;return t[7]!==v||t[8]!==e?(n=(0,w.jsx)(v,{className:e,strokeWidth:1.75,"aria-hidden":!0}),t[7]=v,t[8]=e,t[9]=n):n=t[9],n}let y=T[n.trim().toLowerCase()];if(y&&[`telegram`,`wechat`,`feishu`].includes(m.source)){let e;t[10]===f?e=t[11]:(e=d(`shrink-0`,f),t[10]=f,t[11]=e);let n;return t[12]!==y||t[13]!==e?(n=(0,w.jsx)(`img`,{src:y,alt:``,draggable:!1,className:e,"aria-hidden":!0}),t[12]=y,t[13]=e,t[14]=n):n=t[14],n}let b=m.source===`workbench`?o:m.source===`browser`?_:m.source===`terminal`?l:m.source===`api`?s:a,E;t[15]===f?E=t[16]:(E=d(`shrink-0`,f),t[15]=f,t[16]=E);let D;return t[17]!==b||t[18]!==E?(D=(0,w.jsx)(b,{className:E,strokeWidth:1.75,"aria-hidden":!0}),t[17]=b,t[18]=E,t[19]=D):D=t[19],D}export{_ as i,x as n,S as r,E as t};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";import{a as t,o as n}from"./session-channel-icon-D1ktvt1P.js";var r=e(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),i=e(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]);function a(e,r){if(t(e))return r.automationConfiguration;let{source:i,purpose:a}=n(e),o=a===`chat`?[r.sources[i]]:[r.purposes[a]];return a!==`chat`&&i!==`other`&&!(a===`automation`&&i===`automation`)&&!(a===`system`&&i===`system`)&&o.push(r.sources[i]),a===`chat`&&i===`other`&&e.sourceChannel&&o.push(e.sourceChannel),[...new Set(o)].join(` · `)}export{i as n,r,a as t};
1
+ import{t as e}from"./createLucideIcon-DPHK1VkS.js";import{n as t,r as n}from"./session-channel-icon-BzkFo-Ci.js";var r=e(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),i=e(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]);function a(e,r){if(t(e))return r.automationConfiguration;let{source:i,purpose:a}=n(e),o=a===`chat`?[r.sources[i]]:[r.purposes[a]];return a!==`chat`&&i!==`other`&&!(a===`automation`&&i===`automation`)&&!(a===`system`&&i===`system`)&&o.push(r.sources[i]),a===`chat`&&i===`other`&&e.sourceChannel&&o.push(e.sourceChannel),[...new Set(o)].join(` · `)}export{i as n,r,a as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,l as r,n as i,p as a,u as o}from"./locale-store-CQcW9_qA.js";import{t as s}from"./messages-orB1BMgI.js";import{_ as c,c as l,d as u,f as d,g as f,i as ee,m as p,n as m,u as h}from"./schemas-CCWMleym.js";import{i as g,n as _}from"./constants-DpkUgykJ.js";import{_ as te,b as ne,g as v,h as y,m as b,s as x,v as S,y as C}from"./session-api-D7FWdG43.js";import{_ as w,a as T,b as E,c as re,d as ie,f as ae,i as oe,l as D,o as se,p as ce,r as le,s as ue,t as de,u as fe,v as pe,y as me}from"./local-session-drafts-C6oPrCYY.js";import{t as O}from"./tool-activity-BtJkgjFf.js";import{r as he}from"./personal-proactivity-DaRnbB1f.js";import{t as ge}from"./gateway-startup-retry-DztAHGru.js";import{a as _e}from"./attachment-utils-core-BIOUBrpT.js";import{a as ve}from"./gateway-realtime-CG65gHUY.js";import{n as ye}from"./registry-api-Bo8YiUE0.js";import{a as be}from"./agents-admin-api-CShyoj9I.js";var xe=[0,500,1500],Se=1e4;function Ce(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function we(e){return e===408||e===429||e>=500}var Te=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ee=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function De(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Oe(e){return Te.test(e)||e.startsWith(`<source_contexts>`)||Ee.some(t=>e.startsWith(`<${t}>`))}function ke(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Ae(e){let t=e,n=De(t.trimStart(),`xopc_task_execution`);n!==null&&Oe(n)&&(t=n),t=ke(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ee.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=De(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Te.test(t)&&(t=r),t.replace(Te,``)}function je(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,l as r,n as i,p as a,u as o}from"./locale-store-DTUQ0JiK.js";import{t as s}from"./messages-C7ruaWtK.js";import{_ as c,c as l,d as u,f as d,g as f,i as ee,m as p,n as m,u as h}from"./schemas-CCWMleym.js";import{i as g,n as _}from"./constants-DpkUgykJ.js";import{_ as te,b as ne,g as v,h as y,m as b,s as x,v as S,y as C}from"./session-api-Dt7vRa-E.js";import{_ as w,a as T,b as E,c as re,d as ie,f as ae,i as oe,l as D,o as se,p as ce,r as le,s as ue,t as de,u as fe,v as pe,y as me}from"./local-session-drafts-BU3FXj_X.js";import{t as O}from"./tool-activity-BtJkgjFf.js";import{r as he}from"./personal-proactivity-DaRnbB1f.js";import{t as ge}from"./gateway-startup-retry-DMQI0ATo.js";import{a as _e}from"./attachment-utils-core-BIOUBrpT.js";import{a as ve}from"./gateway-realtime-DopPmAMl.js";import{n as ye}from"./registry-api-C_8-f85U.js";import{a as be}from"./agents-admin-api-tXB8Aj5K.js";var xe=[0,500,1500],Se=1e4;function Ce(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function we(e){return e===408||e===429||e>=500}var Te=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,Ee=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function De(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function Oe(e){return Te.test(e)||e.startsWith(`<source_contexts>`)||Ee.some(t=>e.startsWith(`<${t}>`))}function ke(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function Ae(e){let t=e,n=De(t.trimStart(),`xopc_task_execution`);n!==null&&Oe(n)&&(t=n),t=ke(t);let r=t,i=!1;for(t=t.trimStart();;){let e=Ee.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=De(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!Te.test(t)&&(t=r),t.replace(Te,``)}function je(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
2
2
 
3
3
  `).trim()}var Me=`@xopc-ref:`,Ne=`[A-Za-z0-9_-]{1,64}`,Pe=RegExp(`${Me}(${Ne})`,`g`);function Fe(e){if(!RegExp(`^${Ne}$`).test(e))throw Error(`Invalid context reference id`);return`${Me}${e}`}function Ie(){return new RegExp(Pe.source,`g`)}function Le(e){let t=[],n=Ie(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function Re(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function ze(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Be(e){return e.parts.map(e=>e.type===`text`?e.text:Fe(e.refId)).join(``)}function Ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${Ne}$`).test(t.refId)})}var He=8e3,Ue=u({schemaVersion:f([l(1),l(2)]).optional(),questions:me.optional(),interactionMode:m([`quick`,`compose`]).optional(),choiceDetails:ee(u({id:p().min(1).max(160),label:p().trim().min(1).max(1e3),description:p().max(2e3).optional()}).strict()).min(1).max(10).optional(),recommendedChoiceId:p().min(1).max(160).optional(),approval:u({operation:p().min(1).max(1e3),target:p().max(2e3).optional(),impact:p().max(4e3).optional(),argumentsPreview:d(p(),c()).optional()}).strict().optional()}),We=u({schemaVersion:f([l(1),l(2)]).optional(),answers:pe.optional(),response:u({choiceId:p().min(1).max(160).optional(),text:p().trim().max(He).optional()}).strict().optional(),decision:m([`approve`,`deny`]).optional()}).strict();We.extend({action:m([`answer`,`agent_decide`,`cancel`]),expectedVersion:h().int().positive(),idempotencyKey:p().trim().min(1).max(256)}).strict();function Ge(e){let t=Ue.safeParse(e);return t.success?t.data:{}}function Ke(e,t){let n=We.parse(t);if(e.schemaVersion===2){if(e.kind===`approval`||n.schemaVersion!==2||n.response||n.decision||!e.questions)throw Error(`Multi-question response requires schemaVersion 2`);return{schemaVersion:2,...E(e.questions,n.answers)}}if(n.schemaVersion===2||n.answers!==void 0)throw Error(`Unexpected multi-question response`);if(e.kind===`approval`){if(n.response||!n.decision)throw Error(`An explicit approval decision is required`);return{answer:n.decision,decision:n.decision}}if(n.decision||!n.response)throw Error(`A structured response is required`);let r=n.response.choiceId?e.choiceDetails?.find(e=>e.id===n.response.choiceId):void 0;if(n.response.choiceId&&!r)throw Error(`Unknown clarification choice`);let i=n.response.text?.trim()??``;if(!r&&!i)throw Error(`Answer is required`);return{answer:r&&i?`Choice: ${r.label}\nAdditional information: ${i}`:r?.label??i,response:{...r?{choiceId:r.id}:{},...i?{text:i}:{}}}}var qe=u({version:l(1),deliveryId:p().min(1),taskId:p().min(1),taskRunId:p().min(1),taskTitle:p().min(1).max(500),conversationId:p().min(1),originTranscriptId:p().min(1),requestInputId:p().optional(),assignmentEpoch:h().int().nonnegative(),resultRevision:h().int().positive().optional(),previousResultId:p().optional(),contractVersion:h().int().positive().optional(),instructionSequence:h().int().nonnegative().optional(),adoption:ee(u({entryId:p(),sequence:h().int(),status:m([`applied`,`partially_applied`,`not_applied`,`superseded`]),verification:m([`passed`,`failed`,`unverified`]),claimIds:ee(p()),note:p()})).optional(),outcome:_,text:p().optional(),createdAt:h()});function Je(e){let t=qe.safeParse(e);return t.success?t.data:void 0}var Ye=[`## Result for the originating conversation`,`For ordinary Tasks when publish_task_result is available, use it before completion to review the actual result. Connected Requests use their own structured result tool instead. When files were published, finalArtifactIds must select the exact final artifact IDs from publication receipts, including [] for a text-only result. Exclude intermediate, obsolete and failed files; publication history is not the final delivery manifest.`,`Provide a complete, evidence-grounded result for the originating conversation. The personal assistant may synthesize its final reply from your report. Match the user’s language and requested depth; preserve requested content, relevant sources, verified data cutoffs, uncertainty, and partial failures. Distinguish reported findings from verified facts. Do not invent a friendly opening or assume a new user request.`,`Keep internal planning, Agent names, tool logs, and task progress links out of the result unless the user specifically requested them or they are necessary to explain a blocker. Never substitute a progress page, a plan, or a promise for the requested result. Publish required files through the available artifact tools; do not repeat the same attachments or send the user to a Task page to collect them.`].join(`
4
4
  `),Xe=`Before finishing, call personal_request_result with the verified summary and, for mail, message items and coverage. The host composes the final explanation and preserves structured items in the main chat.`;function Ze(e){let t=e.replace(/\r\n/g,`
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-CQcW9_qA.js";import{t as l}from"./messages-orB1BMgI.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{n as g,r as _,t as v}from"./session-identity-label-BP7OIYth.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-CLsphyzA.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as ee}from"./database-CjjeZfRG.js";import{t as w}from"./download-Dk-ZjtO6.js";import{t as T}from"./folder-open-CyzJ19I9.js";import{t as E}from"./layers-mJW7JJKm.js";import{t as D}from"./layout-grid-CEVZdVFU.js";import{t as O}from"./message-square-fVE7Ghj1.js";import{t as k}from"./minimize-2-DtOGrlpo.js";import{t as A}from"./session-channel-icon-D1ktvt1P.js";import{n as j,t as M}from"./pin-off-BMRv-Kxr.js";import{t as N}from"./plus-Q2yW6OE7.js";import{t as P}from"./search-DA7gz22f.js";import{t as F}from"./settings-uiTATseT.js";import{t as I}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as L}from"./cn-0WouolD0.js";import{t as R}from"./skeleton-DzdOeGYz.js";import{a as z,c as B,f as V,n as ne,o as re,p as ie,r as ae,s as oe,t as se}from"./session-api-D7FWdG43.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-CtZy1Qw0.js";import{t as ue}from"./chat-agents-api-CgasFAm4.js";import{n as de,t as U}from"./registry-api-Bo8YiUE0.js";import{t as W}from"./button-Cc4hUNTt.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-oeTY7z3_.js";import{t as ge}from"./agent-avatar-display-C7Dx9nt1.js";import{t as _e}from"./sliding-tab-list-CmcrqRzN.js";import{n as ve,r as ye,t as q}from"./settings-form-draft-Dy10ldo8.js";import{n as be}from"./model-selector-DYxgKUju.js";import{n as xe,r as Se}from"./segmented-styles-Cqb91xsn.js";import{t as J}from"./settings-advanced-section-3HwfHbqz.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-CheboxIM.js";import"./settings-page-layout-CPFMZaLF.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-CB2B4NMO.js";import{t as Oe}from"./settings-advanced-gate-B3rOBkm_.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,T=n.usage,E;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==T?(E=T?.calls?T.costCompleteness===`unknown`?i.costUnknown:`${T.costCompleteness===`partial`?`≥ `:`≈ `}${Me(T.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=T,t[11]=E):E=t[11];let D=E,k=T?.calls?T.costCompleteness===`partial`?i.costPartial:T.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,N=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,P;t[12]===N?P=t[13]:(P=L(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,N),t[12]=N,t[13]=P);let F;t[14]===c?F=t[15]:(F=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=F);let te=r===`list`&&`sm:py-3`,R;t[16]===te?R=t[17]:(R=L(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=R);let z;t[18]===n?z=t[19]:(z=(0,Q.jsx)(A,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=z);let B;t[20]===h?B=t[21]:(B=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=B);let V;t[22]!==z||t[23]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[z,B]}),t[22]=z,t[23]=B,t[24]=V):V=t[24];let ne;t[25]===S?ne=t[26]:(ne=S?(0,Q.jsx)(j,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=ne);let re;t[27]===n.updatedAt?re=t[28]:(re=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=re);let ie;t[29]===re?ie=t[30]:(ie=(0,Q.jsx)(`span`,{children:re}),t[29]=re,t[30]=ie);let ae;t[31]!==ne||t[32]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[ne,ie]}),t[31]=ne,t[32]=ie,t[33]=ae):ae=t[33];let oe;t[34]!==V||t[35]!==ae||t[36]!==R?(oe=(0,Q.jsxs)(`div`,{className:R,children:[V,ae]}),t[34]=V,t[35]=ae,t[36]=R,t[37]=oe):oe=t[37];let se=r===`list`&&`sm:py-3`,ce;t[38]===se?ce=t[39]:(ce=L(`min-w-0 flex-1 px-3 py-2`,se),t[38]=se,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=L(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(ee,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=T?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let q;t[68]!==D||t[69]!==k?(q=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:k,children:[ye,D]}),t[68]=D,t[69]=k,t[70]=q):q=t[70];let be;t[71]!==G||t[72]!==ve||t[73]!==q?(be=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,q]}),t[71]=G,t[72]=ve,t[73]=q,t[74]=be):be=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==be||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,be,xe]}),t[77]=ce,t[78]=fe,t[79]=be,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(M,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(w,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=L(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(I,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==oe||t[119]!==Se||t[120]!==ze||t[121]!==P||t[122]!==F?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:P,onClick:c,onKeyDown:F,children:[oe,Se,ze]}),t[117]=c,t[118]=oe,t[119]=Se,t[120]=ze,t[121]=P,t[122]=F,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=L(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ve({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-48`}),(0,Q.jsx)(R,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(R,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),ee=Math.min(Math.floor(Je*g.triggerThreshold),C),w=Math.min(100,ee/Je*100),T=Math.min(100,C/Je*100),E=g.model?i.find(e=>e.id===g.model):void 0,D=E?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>E.contextWindow,O=g.keepRecentTokens+g.reserveTokens>ee,A=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},M={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:k,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:L(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:M[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:M[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(ee)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${w}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${T}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(be,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(A)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),D?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:L(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ve({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-40`}),(0,Q.jsx)(R,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:ee,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=ee):ee=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=L(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==o||t[6]!==a?(T=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=T):T=t[7];let E;t[8]!==s.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let I;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(I=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=I):I=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,I,R]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[ee,(0,Q.jsxs)(p,{className:w,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?E:F})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[ee,w]=(0,Z.useReducer)(ye,v,Ct),{searchInput:O,debouncedSearch:k,statusFilter:A,viewMode:M,channelFilter:N,sessions:F,loading:I,error:te,hasMore:R,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=ee;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=O.trim();k!==e&&w({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[O,k]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();w({type:`patch`,patch:{...O===e?{}:{searchInput:e},...k===o?{}:{debouncedSearch:o},...A===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...N===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=k.trim();t?e.set(`q`,t):e.delete(`q`),A===`all`?e.delete(`status`):e.set(`status`,A),M===`grid`?e.delete(`view`):e.set(`view`,M),N?e.set(`channel`,N):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[k,v,b,A,M,N]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{w({type:`patch`,patch:{loading:!0,error:null}});try{let t=await oe({limit:pt,offset:0,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});if(e)return;w({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||w({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||w({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,k,A,N,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||w({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ve=(0,Z.useCallback)(async()=>{if(!(!r||I||!R)){w({type:`patch`,patch:{loading:!0,error:null}});try{let e=await oe({limit:pt,offset:F.length,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});w({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){w({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{w({type:`patch`,patch:{loading:!1}})}}},[r,I,R,F.length,k,A,N,t.loadError]),q=(0,Z.useCallback)((e,t)=>{w({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),be=(0,Z.useCallback)(async e=>{w({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await z(e);w({type:`patch`,patch:{detailSession:t}})}catch{w({type:`patch`,patch:{detailOpen:!1}})}finally{w({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{be(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){w({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await se(e),q(e,`archived`);break;case`unarchive`:await V(e),q(e,`active`);break;case`pin`:await B(e),q(e,`pinned`);break;case`unpin`:await ie(e),q(e,`active`);break;case`export`:{let t=await ae(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await ne(e),w({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:E},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:j},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(_e,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,onClick:()=>w({type:`patch`,patch:{statusFilter:e}}),className:L(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,A===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:O,onChange:e=>w({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":k||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(_e,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!N,onClick:()=>w({type:`patch`,patch:{channelFilter:``}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,onClick:()=>w({type:`patch`,patch:{channelFilter:e}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,te?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:te}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(_e,{className:Se,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>w({type:`patch`,patch:{viewMode:`grid`}}),className:L(xe,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(D,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>w({type:`patch`,patch:{viewMode:`list`}}),className:L(xe,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),I&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(T,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:L(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":k||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),R?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:I,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{w({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&w({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>w({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:L(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>w({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),w({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-DTUQ0JiK.js";import{t as l}from"./messages-C7ruaWtK.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{n as g,r as _,t as v}from"./session-identity-label-D5SAi0Uh.js";import{t as y}from"./archive-Dz0hferG.js";import{n as b,r as x}from"./popover-select-CLsphyzA.js";import{t as S}from"./circle-BoO4YvTx.js";import{t as C}from"./coins-DjP27vUx.js";import{t as ee}from"./database-CjjeZfRG.js";import{t as w}from"./download-Dk-ZjtO6.js";import{t as T}from"./folder-open-CyzJ19I9.js";import{t as E}from"./layers-mJW7JJKm.js";import{t as D}from"./layout-grid-CEVZdVFU.js";import{t as O}from"./message-square-fVE7Ghj1.js";import{t as k}from"./minimize-2-DtOGrlpo.js";import{t as A}from"./session-channel-icon-BzkFo-Ci.js";import{n as j,t as M}from"./pin-off-BMRv-Kxr.js";import{t as N}from"./plus-Q2yW6OE7.js";import{t as P}from"./search-DA7gz22f.js";import{t as F}from"./settings-uiTATseT.js";import{t as I}from"./trash-2-DusmjVPV.js";import{t as te}from"./x-B_N4OPjy.js";import{t as L}from"./cn-0WouolD0.js";import{t as R}from"./skeleton-DzdOeGYz.js";import{a as z,c as B,f as V,n as ne,o as re,p as ie,r as ae,s as oe,t as se}from"./session-api-Dt7vRa-E.js";import{i as ce}from"./vendor-swr-CdRzEUwF.js";import{n as H,r as le}from"./gateway-config-swr-DsXilOaJ.js";import{t as ue}from"./chat-agents-api-CtuEaDG8.js";import{n as de,t as U}from"./registry-api-C_8-f85U.js";import{t as W}from"./button-Cc4hUNTt.js";import{i as fe,o as pe}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as G,t as me}from"./interaction-BdhHBbYa.js";import{s as K}from"./form-field-width-DJw_jULe.js";import{t as he}from"./page-tabs-oeTY7z3_.js";import{t as ge}from"./agent-avatar-display-kPb6idGG.js";import{n as _e,r as ve}from"./segmented-styles-Cqb91xsn.js";import{n as ye,r as be,t as q}from"./settings-form-draft-Dy10ldo8.js";import{t as xe}from"./sliding-tab-list-CmcrqRzN.js";import{n as Se}from"./model-selector-CJY9LRsl.js";import{t as J}from"./settings-advanced-section-DRlQdj_w.js";import{t as Y}from"./number-input-El7Szeln.js";import{n as Ce,t as we}from"./settings-page-header-DG3MQwSF.js";import"./settings-page-layout-SuMAUhMb.js";import{n as Te,t as X}from"./settings-form-section-num14vSv.js";import{n as Ee,t as De}from"./use-autosave-D8Qtt_Tn.js";import{t as Oe}from"./settings-advanced-gate-B7-XQiJh.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:u}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,p=s(Le),m;t[3]!==p||t[4]!==n?(m=v(n,l(p).sidebar.sessionFilters),t[3]=p,t[4]=n,t[5]=m):m=t[5];let h=m,g;t[6]===n.name?g=t[7]:(g=n.name?.trim(),t[6]=n.name,t[7]=g);let b=!!g,x=n.status===`archived`,S=n.status===`pinned`,T=n.usage,E;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==T?(E=T?.calls?T.costCompleteness===`unknown`?i.costUnknown:`${T.costCompleteness===`partial`?`≥ `:`≈ `}${Me(T.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=T,t[11]=E):E=t[11];let D=E,k=T?.calls?T.costCompleteness===`partial`?i.costPartial:T.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,N=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,P;t[12]===N?P=t[13]:(P=L(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,N),t[12]=N,t[13]=P);let F;t[14]===c?F=t[15]:(F=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=F);let te=r===`list`&&`sm:py-3`,R;t[16]===te?R=t[17]:(R=L(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,te),t[16]=te,t[17]=R);let z;t[18]===n?z=t[19]:(z=(0,Q.jsx)(A,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=z);let B;t[20]===h?B=t[21]:(B=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:h}),t[20]=h,t[21]=B);let V;t[22]!==z||t[23]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[z,B]}),t[22]=z,t[23]=B,t[24]=V):V=t[24];let ne;t[25]===S?ne=t[26]:(ne=S?(0,Q.jsx)(j,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=S,t[26]=ne);let re;t[27]===n.updatedAt?re=t[28]:(re=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=re);let ie;t[29]===re?ie=t[30]:(ie=(0,Q.jsx)(`span`,{children:re}),t[29]=re,t[30]=ie);let ae;t[31]!==ne||t[32]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[ne,ie]}),t[31]=ne,t[32]=ie,t[33]=ae):ae=t[33];let oe;t[34]!==V||t[35]!==ae||t[36]!==R?(oe=(0,Q.jsxs)(`div`,{className:R,children:[V,ae]}),t[34]=V,t[35]=ae,t[36]=R,t[37]=oe):oe=t[37];let se=r===`list`&&`sm:py-3`,ce;t[38]===se?ce=t[39]:(ce=L(`min-w-0 flex-1 px-3 py-2`,se),t[38]=se,t[39]=ce);let H=r===`list`&&`sm:items-start`,le;t[40]===H?le=t[41]:(le=L(`flex gap-3`,H),t[40]=H,t[41]=le);let ue;t[42]!==o||t[43]!==a?(ue=(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ue):ue=t[44];let de;t[45]===f?de=t[46]:(de=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[45]=f,t[46]=de);let U;t[47]!==n.key||t[48]!==b?(U=b?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=b,t[49]=U):U=t[49];let W;t[50]!==de||t[51]!==U?(W=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[de,U]}),t[50]=de,t[51]=U,t[52]=W):W=t[52];let fe;t[53]!==le||t[54]!==ue||t[55]!==W?(fe=(0,Q.jsxs)(`div`,{className:le,children:[ue,W]}),t[53]=le,t[54]=ue,t[55]=W,t[56]=fe):fe=t[56];let pe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=pe):pe=t[57];let G;t[58]===n.messageCount?G=t[59]:(G=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[pe,n.messageCount]}),t[58]=n.messageCount,t[59]=G);let K;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(ee,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=K):K=t[60];let he=T?.totalTokens??0,_e;t[61]!==p||t[62]!==he?(_e=je(he,p),t[61]=p,t[62]=he,t[63]=_e):_e=t[63];let ve;t[64]!==i.tokens||t[65]!==_e?(ve=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[K,_e,` `,i.tokens]}),t[64]=i.tokens,t[65]=_e,t[66]=ve):ve=t[66];let ye;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=ye):ye=t[67];let be;t[68]!==D||t[69]!==k?(be=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:k,children:[ye,D]}),t[68]=D,t[69]=k,t[70]=be):be=t[70];let q;t[71]!==G||t[72]!==ve||t[73]!==be?(q=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[G,ve,be]}),t[71]=G,t[72]=ve,t[73]=be,t[74]=q):q=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==ce||t[78]!==fe||t[79]!==q||t[80]!==xe?(Se=(0,Q.jsxs)(`div`,{className:ce,children:[fe,q,xe]}),t[77]=ce,t[78]=fe,t[79]=q,t[80]=xe,t[81]=Se):Se=t[81];let J;t[82]===u?J=t[83]:(J=()=>u(`continue`),t[82]=u,t[83]=J);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==J?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.continueChat,"aria-label":i.continueChat,onClick:J,children:Y}),t[85]=i.continueChat,t[86]=J,t[87]=Ce):Ce=t[87];let we;t[88]!==x||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==u?(we=x?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>u(`unarchive`),children:(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.archive,"aria-label":i.archive,onClick:()=>u(`archive`),children:(0,Q.jsx)(y,{className:`size-4`,strokeWidth:1.75})}),t[88]=x,t[89]=i.archive,t[90]=i.unarchive,t[91]=u,t[92]=we):we=t[92];let Te;t[93]!==S||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==u?(Te=S?(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.unpin,"aria-label":i.unpin,onClick:()=>u(`unpin`),children:(0,Q.jsx)(M,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.pin,"aria-label":i.pin,onClick:()=>u(`pin`),children:(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75})}),t[93]=S,t[94]=i.pin,t[95]=i.unpin,t[96]=u,t[97]=Te):Te=t[97];let X;t[98]===u?X=t[99]:(X=()=>u(`export`),t[98]=u,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(w,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:me,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=L(me,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===u?Z=t[106]:(Z=()=>u(`delete`),t[105]=u,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(I,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==oe||t[119]!==Se||t[120]!==ze||t[121]!==P||t[122]!==F?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:P,onClick:c,onKeyDown:F,children:[oe,Se,ze]}),t[117]=c,t[118]=oe,t[119]=Se,t[120]=ze,t[121]=P,t[122]=F,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await H()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=q();function Ze(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,K,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,ke.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Q.jsx)(Y,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,ke.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=L(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=d);let f;t[10]===r?f=t[11]:(f=(0,Q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`span`,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==c||t[16]!==u||t[17]!==p?(m=(0,Q.jsxs)(`label`,{className:c,children:[u,p]}),t[15]=c,t[16]=u,t[17]=p,t[18]=m):m=t[18],m}function nt({hasToken:e}){let t=l(s(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=le(e),{data:i=[],isLoading:a}=ce(e?U:null,de,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[c,u]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),p=(0,Z.useRef)(!1),m=(0,Z.useRef)(c.form);m.current=c.form;let h=(0,Z.useRef)(null);ye({enabled:e,parsed:o,dirty:p.current,trackedParsedRef:h,dispatch:u,onResetDirty:()=>{p.current=!1}});let g=c.form,_=c.baseline,v=!!(g&&_&&JSON.stringify(g)!==JSON.stringify(_)),y=(0,Z.useCallback)(e=>{p.current=!0,u({type:`patch`,patch:e})},[]),b=(0,Z.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=De({value:g,dirty:v,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!g)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-48`}),(0,Q.jsx)(R,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(R,{className:`h-36 w-full rounded-xl`})]})}):null;let S=$e(g),C=Math.max(0,Je-g.reserveTokens),ee=Math.min(Math.floor(Je*g.triggerThreshold),C),w=Math.min(100,ee/Je*100),T=Math.min(100,C/Je*100),E=g.model?i.find(e=>e.id===g.model):void 0,D=E?.contextWindow&&g.summaryChunkTokens+g.summaryMaxTokens+4096>E.contextWindow,O=g.keepRecentTokens+g.reserveTokens>ee,A=Math.round(g.summaryTimeoutMs*(g.summaryRetries+1)/1e3),j=e=>{let t=Ye[e];y({...t,...g.model?{model:g.model}:{model:void 0},postCompactionSections:g.postCompactionSections})},M={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},P=()=>{let e=d.trim();!e||g.postCompactionSections.includes(e)||g.postCompactionSections.length>=12||(y({postCompactionSections:[...g.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:x.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:k,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:x.status,error:x.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:g.enabled,onChange:e=>y({enabled:e.target.checked})}),g.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,g.enabled?null:(0,Q.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Q.jsxs)(`fieldset`,{disabled:!g.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),S===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,className:L(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,G.transition,G.focusRingPanel,S===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>j(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:M[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:M[e].hint})]},e))})]}),(0,Q.jsxs)(J,{title:t.advancedTitle,summary:S===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(ee)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${w}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(C)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${T}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((g.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(g.reserveTokens)),value:g.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:g.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(g.keepRecentTokens)),value:g.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),O?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(Se,{value:g.model??``,disabled:!g.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),g.model?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:g.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:g.gapAudit,onChange:e=>y({gapAudit:e})})]}),g.qualityGuard?null:(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:g.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((g.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:g.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:g.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(A)),value:g.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:g.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:g.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),D?(0,Q.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),g.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:g.postCompactionSections.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Q.jsx)(`button`,{type:`button`,className:L(`text-fg-muted hover:text-fg`,G.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:g.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:g.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),P())}}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:!d.trim()||g.postCompactionSections.length>=12,onClick:P,children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),H()}function st(){return L(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=q();function lt({hasToken:e}){let t=l(s(e=>e.language)).sessions.config,{data:n,isLoading:r}=le(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[a,o]=(0,Z.useReducer)(ct,{form:null,baseline:null}),c=a.form,u=a.baseline,d=(0,Z.useRef)(!1),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(null);ye({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:o,onResetDirty:()=>{d.current=!1}});let m=!!(c&&u&&JSON.stringify(c)!==JSON.stringify(u)),h=(0,Z.useCallback)(e=>{d.current=!0,o({type:`patch`,patch:e})},[]),g=De({value:c,dirty:m,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),o({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!c?r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(R,{className:`h-5 w-40`}),(0,Q.jsx)(R,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:g.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:ee,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:g.status,error:g.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(J,{title:t.dmScope,summary:c.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(b,{className:st(),value:c.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Q.jsx)(x,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(x,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(x,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(x,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:0,className:st(),value:c.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsx)(J,{title:t.maxEntries,summary:c.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{allowEmpty:!0,type:`number`,min:1,className:st(),value:c.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:g,onPin:_,onUnpin:v,onExport:y,onDelete:b}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),t[2]=ee):ee=t[2];let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=L(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,fe,`dark:border-edge`),t[3]=w):w=t[3];let T;t[4]!==i||t[5]!==o||t[6]!==a?(T=i&&a?(0,Q.jsx)(ge,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=T):T=t[7];let E;t[8]!==s.unnamedSession||t[9]!==i?.name?(E=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=E):E=t[10];let D;t[11]===E?D=t[12]:(D=(0,Q.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:E}),t[11]=E,t[12]=D);let O;t[13]!==T||t[14]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[T,D]}),t[13]=T,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(te,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==y?(P=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:y,children:s.detailExport}),t[29]=s.detailExport,t[30]=y,t[31]=P):P=t[31];let F;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==g?(F=x?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.unarchive}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=g,t[37]=F):F=t[37];let I;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==_||t[42]!==v?(I=S?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:v,children:s.unpin}):(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:_,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=_,t[42]=v,t[43]=I):I=t[43];let R;t[44]!==s.delete||t[45]!==b?(R=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:b,children:s.delete}),t[44]=s.delete,t[45]=b,t[46]=R):R=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==R?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,I,R]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(f,{children:[ee,(0,Q.jsxs)(p,{className:w,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==C||t[58]!==B?(V=(0,Q.jsx)(h,{open:n,onOpenChange:C,children:B}),t[56]=n,t[57]=C,t[58]=B,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,ke.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?E:F})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Q.jsx)(he,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,ke.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a!==void 0&&a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=l(s(e=>e.language)),t=e.sessions,n=o(e=>e.conversationId),r=!!n,{data:a,mutate:c}=ce(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),d=a?.defaultId??`main`,_=a?.items??[],[v,b]=i(),x=vt(v.get(`tab`)),C=(0,Z.useCallback)(e=>{let t=new URLSearchParams(v);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),b(t,{replace:!0})},[v,b]),[ee,w]=(0,Z.useReducer)(be,v,Ct),{searchInput:O,debouncedSearch:k,statusFilter:A,viewMode:M,channelFilter:N,sessions:F,loading:I,error:te,hasMore:R,stats:H,detailOpen:le,detailLoading:de,detailSession:U,confirmOpen:me,confirmKey:K}=ee;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=O.trim();k!==e&&w({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[O,k]);let he=v.toString(),ge=(0,Z.useRef)(he);if(ge.current!==he){ge.current=he;let e=v.get(`q`)??``,t=v.get(`status`),n=v.get(`view`),r=(v.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();w({type:`patch`,patch:{...O===e?{}:{searchInput:e},...k===o?{}:{debouncedSearch:o},...A===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...N===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(v),t=k.trim();t?e.set(`q`,t):e.delete(`q`),A===`all`?e.delete(`status`):e.set(`status`,A),M===`grid`?e.delete(`view`):e.set(`view`,M),N?e.set(`channel`,N):e.delete(`channel`),e.toString()!==v.toString()&&b(e,{replace:!0})},[k,v,b,A,M,N]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=!1;return(async()=>{w({type:`patch`,patch:{loading:!0,error:null}});try{let t=await oe({limit:pt,offset:0,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});if(e)return;w({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||w({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||w({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,x,k,A,N,t.loadError]),(0,Z.useEffect)(()=>{!r||x!==`sessions`||re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,x]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=()=>void c();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,x,c]),(0,Z.useEffect)(()=>{if(!r||x!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||w({type:`patch`,patch:{sessions:F.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:U&&U.key===t.key?{...U,name:t.name}:U}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,x,F,U]);let ye=(0,Z.useCallback)(async()=>{if(!(!r||I||!R)){w({type:`patch`,patch:{loading:!0,error:null}});try{let e=await oe({limit:pt,offset:F.length,...k?{search:k}:{},...A===`all`?{}:{status:A},...N?{channel:N}:{}});w({type:`patch`,patch:{sessions:[...F,...e.items],hasMore:e.hasMore}})}catch(e){w({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{w({type:`patch`,patch:{loading:!1}})}}},[r,I,R,F.length,k,A,N,t.loadError]),q=(0,Z.useCallback)((e,t)=>{w({type:`patch`,patch:{sessions:F.map(n=>n.key===e?{...n,status:t}:n),detailSession:U&&U.key===e?{...U,status:t}:U}})},[F,U]),Se=(0,Z.useCallback)(async e=>{w({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{let t=await z(e);w({type:`patch`,patch:{detailSession:t}})}catch{w({type:`patch`,patch:{detailOpen:!1}})}finally{w({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{Se(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){w({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await se(e),q(e,`archived`);break;case`unarchive`:await V(e),q(e,`active`);break;case`pin`:await B(e),q(e,`pinned`);break;case`unpin`:await ie(e),q(e,`active`);break;case`export`:{let t=await ae(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await ne(e),w({type:`patch`,patch:{sessions:F.filter(t=>t.key!==e),detailSession:U?.key===e?null:U,...U?.key===e?{detailOpen:!1}:{}}}),re().then(e=>w({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:E},{key:`active`,label:t.filterActive,icon:S},{key:`pinned`,label:t.filterPinned,icon:j},{key:`archived`,label:t.filterArchived,icon:y}],Oe=(()=>{let e=Object.entries(H?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:x,onChange:C}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:x,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:x,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(xe,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":A===e,onClick:()=>w({type:`patch`,patch:{statusFilter:e}}),className:L(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,A===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:O,onChange:e=>w({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":k||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(xe,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!N,onClick:()=>w({type:`patch`,patch:{channelFilter:``}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,onClick:()=>w({type:`patch`,patch:{channelFilter:e}}),className:L(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,G.transition,G.focusRingPanel,N===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,H?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:H.byChannel[e]})]},e))]}),H?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[H.totalSessions,t.totalSessions],[H.activeSessions,t.activeSessions],[H.pinnedSessions,t.pinnedSessions],[H.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,te?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:te}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:F.length})}),(0,Q.jsxs)(xe,{className:ve,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>w({type:`patch`,patch:{viewMode:`grid`}}),className:L(_e,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(D,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(W,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>w({type:`patch`,patch:{viewMode:`list`}}),className:L(_e,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Q.jsx)(g,{className:`size-3.5`,strokeWidth:1.5})})]})]}),I&&F.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):F.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(T,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(W,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:L(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":k||void 0,children:F.map(e=>{let t=Re(e,d);return(0,Q.jsx)(Ne,{session:e,variant:M,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,_),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),R?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:I,onClick:()=>void ye(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:de,session:U,sessionAgentId:U?Re(U,d):void 0,sessionAgentAvatar:U?ze(Re(U,d),_):void 0,labels:Ee,onClose:()=>{w({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>U&&void Y(U.key,`archive`),onUnarchive:()=>U&&void Y(U.key,`unarchive`),onPin:()=>U&&void Y(U.key,`pin`),onUnpin:()=>U&&void Y(U.key,`unpin`),onExport:()=>U&&void Y(U.key,`export`),onDelete:()=>U&&w({type:`patch`,patch:{confirmKey:U.key,confirmOpen:!0}})}),(0,Q.jsx)(h,{open:me,onOpenChange:e=>w({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(u,{className:L(`xopc-dialog-overlay fixed inset-0 bg-scrim`,pe)}),(0,Q.jsxs)(p,{className:L(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,fe),children:[(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?mt(t.deleteSessionMessage,{name:F.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,onClick:()=>w({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&Te(K),w({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
@@ -0,0 +1 @@
1
+ import{n as e}from"./settings-mode-store-BE6t--iO.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n}from"./locale-store-CQcW9_qA.js";import{t as r}from"./button-Cc4hUNTt.js";import{t as i}from"./settings-mode-store-BVvIXZlg.js";var a=e(),o=t();function s(e){let t=(0,a.c)(15),{title:s,summary:d,children:f}=e,p=i(u),m=i(l),h=n(c)===`zh`;if(p)return f;let g;t[0]===s?g=t[1]:(g=(0,o.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:s}),t[0]=s,t[1]=g);let _;t[2]===d?_=t[3]:(_=(0,o.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d}),t[2]=d,t[3]=_);let v;t[4]!==g||t[5]!==_?(v=(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,_]}),t[4]=g,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=()=>m(`advanced`),t[7]=m,t[8]=y);let b=h?`查看高级设置`:`Show advanced settings`,x;t[9]!==y||t[10]!==b?(x=(0,o.jsx)(r,{type:`button`,variant:`ghost`,onClick:y,children:b}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;return t[12]!==v||t[13]!==x?(S=(0,o.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-surface-hover/20 p-4`,children:[v,x]}),t[12]=v,t[13]=x,t[14]=S):S=t[14],S}function c(e){return e.language}function l(e){return e.setMode}function u(e){return e.mode===`advanced`}export{s as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n}from"./locale-store-DTUQ0JiK.js";import{t as r}from"./button-Cc4hUNTt.js";import{t as i}from"./settings-mode-store-BE6t--iO.js";var a=e(),o=t();function s(e){let t=(0,a.c)(15),{title:s,summary:d,children:f}=e,p=i(u),m=i(l),h=n(c)===`zh`;if(p)return f;let g;t[0]===s?g=t[1]:(g=(0,o.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:s}),t[0]=s,t[1]=g);let _;t[2]===d?_=t[3]:(_=(0,o.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d}),t[2]=d,t[3]=_);let v;t[4]!==g||t[5]!==_?(v=(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,_]}),t[4]=g,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=()=>m(`advanced`),t[7]=m,t[8]=y);let b=h?`查看高级设置`:`Show advanced settings`,x;t[9]!==y||t[10]!==b?(x=(0,o.jsx)(r,{type:`button`,variant:`ghost`,onClick:y,children:b}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;return t[12]!==v||t[13]!==x?(S=(0,o.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-surface-hover/20 p-4`,children:[v,x]}),t[12]=v,t[13]=x,t[14]=S):S=t[14],S}function c(e){return e.language}function l(e){return e.setMode}function u(e){return e.mode===`advanced`}export{s as t};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-CQcW9_qA.js";import{t}from"./middleware-Pd0e8Igk.js";var n=e(t(e=>({mode:`simple`,setMode:t=>e({mode:t}),setShowAdvanced:t=>e({mode:t?`advanced`:`simple`})}),{name:`xopc-web-settings-mode`}));function r(){return n(i)}function i(e){return e.mode===`advanced`}export{r as n,n as t};
1
+ import{p as e}from"./locale-store-DTUQ0JiK.js";import{t}from"./middleware-Pd0e8Igk.js";var n=e(t(e=>({mode:`simple`,setMode:t=>e({mode:t}),setShowAdvanced:t=>e({mode:t?`advanced`:`simple`})}),{name:`xopc-web-settings-mode`}));function r(){return n(i)}function i(e){return e.mode===`advanced`}export{r as n,n as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-CQcW9_qA.js";import{t as s}from"./messages-orB1BMgI.js";import{E as c,M as l,T as u,b as d,c as f,h as p,i as m,j as h,k as g,l as _,n as v,p as y,r as b}from"./route-preload-C0oV8og1.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>g().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>d().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>l().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>f().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>b().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>y().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>c().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>v().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>_().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(o===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(o===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(o===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-DTUQ0JiK.js";import{t as s}from"./messages-C7ruaWtK.js";import{E as c,M as l,T as u,b as d,c as f,h as p,i as m,j as h,k as g,l as _,n as v,p as y,r as b}from"./route-preload-DGMUu3pm.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>g().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>p().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>d().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>l().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>f().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>b().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>y().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>c().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>u().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>h().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>v().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>_().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(o===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(o===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(o===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};