@xopcai/xopc 0.0.476 → 0.0.477

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 (288) hide show
  1. package/dist/browser-ext/dist/assets/{auth-CKIyOA1a.js → auth-B658Oa_i.js} +2 -1
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/dingtalk/xopc.extension.json +10 -4
  7. package/dist/extensions/discord/xopc.extension.json +9 -3
  8. package/dist/extensions/slack/xopc.extension.json +10 -4
  9. package/dist/extensions/telegram/xopc.extension.json +1 -1
  10. package/dist/extensions/wecom/xopc.extension.json +10 -4
  11. package/dist/gateway/server/chunks.bin +739 -686
  12. package/dist/gateway/server/chunks.json +1 -1
  13. package/dist/gateway/static/root/assets/af-CYmDZ4fF-CZxsvT2y.js +1 -0
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Bicuh10_.js → agent-defaults-settings-panel-rc9N1-Xr.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-hRZYhcLp.js → agent-plugin-dialog-D8zi6y5l.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-C2DH8M4z.js → agents-D3Kx5DCA.js} +3 -3
  17. package/dist/gateway/static/root/assets/{app-management-settings-panel-BrO0gY6b.js → app-management-settings-panel-CGIFJmRj.js} +1 -1
  18. package/dist/gateway/static/root/assets/{appearance-settings-h82Or0g-.js → appearance-settings-CNy2QkvT.js} +1 -1
  19. package/dist/gateway/static/root/assets/{apps-page-B9Ho8S53.js → apps-page-BWSZCO1g.js} +1 -1
  20. package/dist/gateway/static/root/assets/as-Hwl1DGzz-F6qyW8uH.js +1 -0
  21. package/dist/gateway/static/root/assets/{automation-run-list-CLjSIujK.js → automation-run-list-BzKslhcr.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automation-task-card-BS-RT312.js → automation-task-card-f5_tNbzB.js} +2 -2
  23. package/dist/gateway/static/root/assets/{automations-page-BL6ASYrU.js → automations-page-DT6lvXDX.js} +1 -1
  24. package/dist/gateway/static/root/assets/{automations-workspace-BFk-AF43.js → automations-workspace-uq7eZeoX.js} +4 -4
  25. package/dist/gateway/static/root/assets/be-BgqsjH7X-BYVdQd18.js +1 -0
  26. package/dist/gateway/static/root/assets/bg-Dr9AqrKw-B5xv6TfF.js +1 -0
  27. package/dist/gateway/static/root/assets/{block-editor-Dtz8JtrO.js → block-editor-BIAtRF39.js} +1 -1
  28. package/dist/gateway/static/root/assets/bn-CSXZX5iN-BGS6_hxH.js +1 -0
  29. package/dist/gateway/static/root/assets/{browser-settings-page-CDUHHu0n.js → browser-settings-page-C2Jx09LX.js} +3 -3
  30. package/dist/gateway/static/root/assets/{button-ChmVQg9O.js → button-C5tRaJxt.js} +1 -1
  31. package/dist/gateway/static/root/assets/ca-IXHA7IHe-DrduLk3W.js +1 -0
  32. package/dist/gateway/static/root/assets/capabilities-page-DgQ9OosE.js +2 -0
  33. package/dist/gateway/static/root/assets/{capabilities-settings-panel-ComYXaP1.js → capabilities-settings-panel-BjiHKpmd.js} +2 -2
  34. package/dist/gateway/static/root/assets/{capability-header-actions-BfLcB3Kh.js → capability-header-actions-Ck3ILShB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{channels-Aa2Iun4r.js → channels-C9AQ0m77.js} +1 -1
  36. package/dist/gateway/static/root/assets/{chat-chart-block-DA2S21y2.js → chat-chart-block-BNmGrz2N.js} +1 -1
  37. package/dist/gateway/static/root/assets/chat-page-CJiXMjMM.js +72 -0
  38. package/dist/gateway/static/root/assets/{chat-terminal-dock-BALrP7_l.js → chat-terminal-dock-Bndihzyb.js} +1 -1
  39. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BPb7KheU.js → chunk-KS7C4IRE-DbzE-1bp.js} +1 -1
  40. package/dist/gateway/static/root/assets/composer-attachment-handoff-LTJZHQTE.js +1 -0
  41. package/dist/gateway/static/root/assets/{composer-model-config-control-BFC8jNyK.js → composer-model-config-control-Bnx68cDQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/{computer-settings-page-CVWaJ3L8.js → computer-settings-page-MMiCgCEw.js} +1 -1
  43. package/dist/gateway/static/root/assets/{confirm-dialog-DkviAS5j.js → confirm-dialog-MHCmEEUZ.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connected-providers-grid-NZP4qb6S.js → connected-providers-grid-BPydj2zS.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connection-usage-guide-BNoFtMol.js → connection-usage-guide-CHGPjgHg.js} +1 -1
  46. package/dist/gateway/static/root/assets/{connector-service-page-CzrdJ4JY.js → connector-service-page-CjH7WEIw.js} +1 -1
  47. package/dist/gateway/static/root/assets/{connectors-page-BUqNvStL.js → connectors-page-aIaFZHw3.js} +1 -1
  48. package/dist/gateway/static/root/assets/cop-B5tK6J-Z-Dw82IjCr.js +1 -0
  49. package/dist/gateway/static/root/assets/{copy-text-row-BnSoJ0FX.js → copy-text-row-gqdh0Bg1.js} +1 -1
  50. package/dist/gateway/static/root/assets/cs-5GDhZ_Ce-BI5q4aVA.js +1 -0
  51. package/dist/gateway/static/root/assets/cu-BSm1hoGS-BRCy0UAr.js +1 -0
  52. package/dist/gateway/static/root/assets/cy-C9DIxPZF-Cag4snSk.js +1 -0
  53. package/dist/gateway/static/root/assets/da-BsG0TGcE-BWliw5hZ.js +1 -0
  54. package/dist/gateway/static/root/assets/{date-picker-DgTDENzF.js → date-picker-BWrSxZf1.js} +1 -1
  55. package/dist/gateway/static/root/assets/{date-time-picker-Gw4oSOk9.js → date-time-picker-Zhl9Yyzk.js} +1 -1
  56. package/dist/gateway/static/root/assets/de-1901-qqf2iWLB-BlgpCKr2.js +1 -0
  57. package/dist/gateway/static/root/assets/de-1996-LtGglqob-BjfWxQKM.js +1 -0
  58. package/dist/gateway/static/root/assets/de-ch-1901-COn1CKDv-_Xg3_np3.js +1 -0
  59. package/dist/gateway/static/root/assets/{dependency-picker-BJDpQtKY.js → dependency-picker-clYjcOx9.js} +1 -1
  60. package/dist/gateway/static/root/assets/{desktop-pet-BbIPYbvc.js → desktop-pet-CGRfEFeD.js} +1 -1
  61. package/dist/gateway/static/root/assets/{desktop-pet-settings-Cqzplufb.js → desktop-pet-settings-CUVZPqVA.js} +1 -1
  62. package/dist/gateway/static/root/assets/{device-pairing-wizard-DXFZiWMi.js → device-pairing-wizard-C62Ooz-T.js} +1 -1
  63. package/dist/gateway/static/root/assets/{directory-picker-path-field-DVFEzTAJ.js → directory-picker-path-field-3z5dHj8K.js} +1 -1
  64. package/dist/gateway/static/root/assets/{dist-GJ8-1PAx.js → dist-BSVQC3i_.js} +1 -1
  65. package/dist/gateway/static/root/assets/{dist-CxGUk8J-.js → dist-CDSvxjOh.js} +1 -1
  66. package/dist/gateway/static/root/assets/dist-DSRLZhL9.js +1 -0
  67. package/dist/gateway/static/root/assets/dist-DaFr5KMw.js +1 -0
  68. package/dist/gateway/static/root/assets/{dist-CY7CS_D3.js → dist-DlirbHVs.js} +1 -1
  69. package/dist/gateway/static/root/assets/el-monoton-pORtlC9P-CuqNQIvE.js +1 -0
  70. package/dist/gateway/static/root/assets/el-polyton-CDXn9JCY-B5J5pGHR.js +1 -0
  71. package/dist/gateway/static/root/assets/en-gb-BGHhUzDC-COWGBqwJ.js +1 -0
  72. package/dist/gateway/static/root/assets/es-PSvYPNjB-CnHE1eri.js +1 -0
  73. package/dist/gateway/static/root/assets/es2015-CFqg57eW.js +41 -0
  74. package/dist/gateway/static/root/assets/et-CYUTaVWy-H7jVbiHv.js +1 -0
  75. package/dist/gateway/static/root/assets/eu-CRNA9JLT-D1jw9zt8.js +1 -0
  76. package/dist/gateway/static/root/assets/{extension-authoritative-grants-DAfeCx4B.js → extension-authoritative-grants-DIZxVVMM.js} +1 -1
  77. package/dist/gateway/static/root/assets/{extension-debug-page-gW4GEEcj.js → extension-debug-page-D_-TPLjn.js} +1 -1
  78. package/dist/gateway/static/root/assets/{extension-iframe-host-DOPywUKI.js → extension-iframe-host-DQOKplxT.js} +1 -1
  79. package/dist/gateway/static/root/assets/{extension-message-router-TTAx3dPv.js → extension-message-router-Ccwjadyk.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-page-Iq7vFC-g.js → extension-page-CmntX-Iw.js} +1 -1
  81. package/dist/gateway/static/root/assets/{extension-provider-BNnLkq95.js → extension-provider-niliLEmM.js} +1 -1
  82. package/dist/gateway/static/root/assets/{extension-settings-page-C0oLjaz6.js → extension-settings-page-Doi9Trxg.js} +1 -1
  83. package/dist/gateway/static/root/assets/fi-DNiE_U0X-mParSSSy.js +1 -0
  84. package/dist/gateway/static/root/assets/{floating-ui.dom-seOukHzT.js → floating-ui.dom-CiMnRY5O.js} +1 -1
  85. package/dist/gateway/static/root/assets/floating-ui.react-dom-Gx6CM22l.js +1 -0
  86. package/dist/gateway/static/root/assets/fr-BIgh4Hkw-Dc1KqFHa.js +1 -0
  87. package/dist/gateway/static/root/assets/fur-CoXvgQfx-tJv2icDr.js +1 -0
  88. package/dist/gateway/static/root/assets/ga-D54K6YtG-CDuqe3gr.js +1 -0
  89. package/dist/gateway/static/root/assets/{gateway-realtime-CfceJ5WX.js → gateway-realtime-BoJ3r2zr.js} +1 -1
  90. package/dist/gateway/static/root/assets/{gateway-restart-Dsg95Dwt.js → gateway-restart-L0ri15AO.js} +1 -1
  91. package/dist/gateway/static/root/assets/{gateway-settings-CMgry8RK.js → gateway-settings--jcl4PYh.js} +1 -1
  92. package/dist/gateway/static/root/assets/gl-Cx_3wrqA-D9_oxkqv.js +1 -0
  93. package/dist/gateway/static/root/assets/grc-gFF6GbE6-DANBReIg.js +1 -0
  94. package/dist/gateway/static/root/assets/gu-9bPoO3RA-COW9d1dt.js +1 -0
  95. package/dist/gateway/static/root/assets/hi-GilZHMjg-CiihDo6Q.js +1 -0
  96. package/dist/gateway/static/root/assets/{home-page-pT-lEQsu.js → home-page-DbLvAmzw.js} +4 -4
  97. package/dist/gateway/static/root/assets/hr-DowcKODH-D_vEJhf2.js +1 -0
  98. package/dist/gateway/static/root/assets/hsb-D_AuBPC_-kb5QeNH1.js +1 -0
  99. package/dist/gateway/static/root/assets/hu-DghCDVxq-Ct1fysVO.js +1 -0
  100. package/dist/gateway/static/root/assets/hy-UUaeTG5g-Cjfrs2ZM.js +1 -0
  101. package/dist/gateway/static/root/assets/ia-CvHYTdA2-B1i9kDPT.js +1 -0
  102. package/dist/gateway/static/root/assets/id-Dpxs7amD-C3Hzl2m4.js +1 -0
  103. package/dist/gateway/static/root/assets/{image-generation-api-DDHOD0Nx.js → image-generation-api-D63Vak-S.js} +1 -1
  104. package/dist/gateway/static/root/assets/{imports-page-BxRXNvQx.js → imports-page-CWr0KA9K.js} +1 -1
  105. package/dist/gateway/static/root/assets/index-CEXEV_TY.css +1 -0
  106. package/dist/gateway/static/root/assets/{index-DdEh8KeB.js → index-DynjhZRv.js} +7 -7
  107. package/dist/gateway/static/root/assets/{install-connector-dialog-Rox2_5eU.js → install-connector-dialog-DyscHGNB.js} +1 -1
  108. package/dist/gateway/static/root/assets/is-CJ1vxS9j-DWEBuJpb.js +1 -0
  109. package/dist/gateway/static/root/assets/it-CpWMQzhA-HiFRunf5.js +1 -0
  110. package/dist/gateway/static/root/assets/ka-CCxCVfU6-BU45urC7.js +1 -0
  111. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D7xlV7xT.js → keyboard-shortcuts-settings-BNxKXzTr.js} +1 -1
  112. package/dist/gateway/static/root/assets/kmr-dEjewOAw-DfPyPgkK.js +1 -0
  113. package/dist/gateway/static/root/assets/kn-Bjy8QS2v-BuXzi7S-.js +1 -0
  114. package/dist/gateway/static/root/assets/la-AGdXyFmb-Bwiuou7l.js +1 -0
  115. package/dist/gateway/static/root/assets/la-x-classic-DcM9aTVI-aO_2QO0y.js +1 -0
  116. package/dist/gateway/static/root/assets/la-x-liturgic-DZCmbwFj-BpDOy20C.js +1 -0
  117. package/dist/gateway/static/root/assets/{local-app-workbench-page-ReBczGac.js → local-app-workbench-page-BB-y__CE.js} +1 -1
  118. package/dist/gateway/static/root/assets/{local-apps-page-Ct07GT0V.js → local-apps-page-kllqJoU6.js} +1 -1
  119. package/dist/gateway/static/root/assets/{logs-page-CtEv5J4C.js → logs-page-DALkj_7O.js} +1 -1
  120. package/dist/gateway/static/root/assets/lt-CN8ITi7t-B3cgXplB.js +1 -0
  121. package/dist/gateway/static/root/assets/lv-C-JuXj31-CLjYDJHB.js +1 -0
  122. package/dist/gateway/static/root/assets/{management-settings-BjvQ4WiZ.js → management-settings-DVjgxWhD.js} +1 -1
  123. package/dist/gateway/static/root/assets/{markdown-view-C7kqotD-.js → markdown-view-BpBBv9Gr.js} +2 -2
  124. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DfbMmlmC.js → mcp-conversation-setup-page-Cr7uXvcG.js} +1 -1
  125. package/dist/gateway/static/root/assets/ml-BM2UBzMU-Ct0js8Am.js +1 -0
  126. package/dist/gateway/static/root/assets/mn-cyrl-CyRDZzA3-DN6sz9R4.js +1 -0
  127. package/dist/gateway/static/root/assets/mn-cyrl-x-lmc-DbCWj2Po-BJqn49ay.js +1 -0
  128. package/dist/gateway/static/root/assets/{model-selector-BP-t33vd.js → model-selector-RNPw-Mz4.js} +1 -1
  129. package/dist/gateway/static/root/assets/mr-BrkCTYf9-DGtESPcG.js +1 -0
  130. package/dist/gateway/static/root/assets/mul-ethi-D9YZ9OXl-D6ioGuYP.js +1 -0
  131. package/dist/gateway/static/root/assets/nb-DgKeJnSd-BfDSp4tN.js +1 -0
  132. package/dist/gateway/static/root/assets/{new-chat-navigation-BA1IB3hy.js → new-chat-navigation-DM_HUSZ1.js} +1 -1
  133. package/dist/gateway/static/root/assets/nl-BIDJBXRA-8_OIBsy0.js +1 -0
  134. package/dist/gateway/static/root/assets/nn-C4Gas4NI-BWT83oy8.js +1 -0
  135. package/dist/gateway/static/root/assets/no-CSP8-4c2-Cjg1mxae.js +1 -0
  136. package/dist/gateway/static/root/assets/{note-detail-panel-DAhIT6xP.js → note-detail-panel-DQOIB0cU.js} +3 -3
  137. package/dist/gateway/static/root/assets/note-image-lightbox-BQyXXJCE.js +1 -0
  138. package/dist/gateway/static/root/assets/{notes-api-B3Kc4909.js → notes-api-ChV_6O5I.js} +1 -1
  139. package/dist/gateway/static/root/assets/notes-page-BBUD12wy.js +8 -0
  140. package/dist/gateway/static/root/assets/{oauth-provider-connect-3QGibJMl.js → oauth-provider-connect-BgWyUbhu.js} +1 -1
  141. package/dist/gateway/static/root/assets/oc-CyJ2Q9k9-W5_I63nO.js +1 -0
  142. package/dist/gateway/static/root/assets/or-DUhKxVse-Cf5-bcl5.js +1 -0
  143. package/dist/gateway/static/root/assets/pa-NDvVySYt-Bj-XExX_.js +1 -0
  144. package/dist/gateway/static/root/assets/{page-context-capture-button-Bd__UBi9.js → page-context-capture-button-CNyjLpFG.js} +1 -1
  145. package/dist/gateway/static/root/assets/{personal-page-DHik8uj6.js → personal-page-dGPy_J7M.js} +1 -1
  146. package/dist/gateway/static/root/assets/{personal-profile-settings-Cd2xUVbw.js → personal-profile-settings-BlsS-2z3.js} +1 -1
  147. package/dist/gateway/static/root/assets/{personal-settings-panel-CHRra9hc.js → personal-settings-panel-D1W09VMR.js} +1 -1
  148. package/dist/gateway/static/root/assets/{phone-dependencies-card-CREmmRxI.js → phone-dependencies-card-CRABVjt1.js} +1 -1
  149. package/dist/gateway/static/root/assets/{phone-model-connection-BDzr9jXL.js → phone-model-connection-DtBRZXUN.js} +1 -1
  150. package/dist/gateway/static/root/assets/{phone-model-picker-DSQF-RxW.js → phone-model-picker-D3U9iAQo.js} +1 -1
  151. package/dist/gateway/static/root/assets/{phone-settings-page-gP5kr3VO.js → phone-settings-page-ClS7YSnU.js} +1 -1
  152. package/dist/gateway/static/root/assets/pi-znB0BT6g-o9084kBf.js +1 -0
  153. package/dist/gateway/static/root/assets/pl-CaFvP4tu-Bv_p-a9x.js +1 -0
  154. package/dist/gateway/static/root/assets/{plugin-details-dialog-43jCnG5n.js → plugin-details-dialog-DGW2QQJC.js} +1 -1
  155. package/dist/gateway/static/root/assets/pms-92V70vZ4-DfOt2RSi.js +1 -0
  156. package/dist/gateway/static/root/assets/{popover-select-CLsphyzA.js → popover-select-hRG1EzAY.js} +1 -1
  157. package/dist/gateway/static/root/assets/{preference-select-fields-VqtR_pOy.js → preference-select-fields-PZsYT8Db.js} +1 -1
  158. package/dist/gateway/static/root/assets/{preview-runtime-MJUo7XlD.js → preview-runtime-D9y0frrZ.js} +2 -2
  159. package/dist/gateway/static/root/assets/{product-automation-feedback-D43XiQq6.js → product-automation-feedback-W6rFx449.js} +1 -1
  160. package/dist/gateway/static/root/assets/product-open-page-CcJ0dC84.js +1 -0
  161. package/dist/gateway/static/root/assets/{product-preview-content-CkQebfi-.js → product-preview-content-CsdXwIxP.js} +1 -1
  162. package/dist/gateway/static/root/assets/product-preview-modal-CIe5WW9E.js +2 -0
  163. package/dist/gateway/static/root/assets/{project-detail-page-BBF8eVJa.js → project-detail-page-b6pU7eLQ.js} +2 -2
  164. package/dist/gateway/static/root/assets/{project-understanding-BScfv1pD.js → project-understanding-ClhKlj0g.js} +1 -1
  165. package/dist/gateway/static/root/assets/{projects-page-BCMWrLGf.js → projects-page-Bi9Ke76p.js} +1 -1
  166. package/dist/gateway/static/root/assets/pt-BKB_-X0N-CrkeeQaZ.js +1 -0
  167. package/dist/gateway/static/root/assets/{recording-upload-Yy9r6kHe.js → recording-upload-BjZ5SwXZ.js} +1 -1
  168. package/dist/gateway/static/root/assets/{refresh-button-D6ihZgH3.js → refresh-button-DX7bULU5.js} +1 -1
  169. package/dist/gateway/static/root/assets/{remote-access-hub-BeG8Bgy0.js → remote-access-hub-aSIeyTxn.js} +1 -1
  170. package/dist/gateway/static/root/assets/{resource-unavailable-Dccp_uis.js → resource-unavailable-BZVJxGR8.js} +1 -1
  171. package/dist/gateway/static/root/assets/rm-C1letx81-CNhvXnnG.js +1 -0
  172. package/dist/gateway/static/root/assets/ro-BUzliR9z-Bov_DAVD.js +1 -0
  173. package/dist/gateway/static/root/assets/route-preload-D36bLXpD.js +2 -0
  174. package/dist/gateway/static/root/assets/routine-panel-lfYWKBuW.js +2 -0
  175. package/dist/gateway/static/root/assets/ru-B591x1qT-DLdM0nWP.js +1 -0
  176. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C7sHr-Lm.js → runtime-tools-settings-panel-DxYZLgVT.js} +1 -1
  177. package/dist/gateway/static/root/assets/sa-JnsT9B1R-CvBCyoRG.js +1 -0
  178. package/dist/gateway/static/root/assets/{schema-form-DXHzZPMr.js → schema-form-DkuIsCBU.js} +1 -1
  179. package/dist/gateway/static/root/assets/{service-recommendation-list-Bz9QWUZc.js → service-recommendation-list-BjuL2TaI.js} +1 -1
  180. package/dist/gateway/static/root/assets/{session-manager-fvJusKsK.js → session-manager-1UFhZMpv.js} +1 -1
  181. package/dist/gateway/static/root/assets/{sessions-page-DS-OExY1.js → sessions-page-CeCaW2FJ.js} +1 -1
  182. package/dist/gateway/static/root/assets/{settings-advanced-section-BsqgVQL3.js → settings-advanced-section-YRzA9yeq.js} +1 -1
  183. package/dist/gateway/static/root/assets/{settings-page-header-DKgbD0Bc.js → settings-page-header-C9xiCwzq.js} +1 -1
  184. package/dist/gateway/static/root/assets/{settings-page-layout-BE3vLWp_.js → settings-page-layout-DTOBegnh.js} +1 -1
  185. package/dist/gateway/static/root/assets/{settings-page-B_8kxJQW.js → settings-page-ngcjiqfd.js} +1 -1
  186. package/dist/gateway/static/root/assets/{setup-interaction-page-DLpGv0yp.js → setup-interaction-page-CnC-hC-A.js} +1 -1
  187. package/dist/gateway/static/root/assets/{setup-status-panel-BMaFUPnt.js → setup-status-panel-lAyDbUa1.js} +1 -1
  188. package/dist/gateway/static/root/assets/sh-cyrl-CLuomLGP-UY09gie6.js +1 -0
  189. package/dist/gateway/static/root/assets/sh-latn-DdZKFFaE-De-tA-2J.js +1 -0
  190. package/dist/gateway/static/root/assets/{share-link-dialog-3RNzFIH3.js → share-link-dialog-QvDZwWwI.js} +1 -1
  191. package/dist/gateway/static/root/assets/share-preview-page-7PohUauw.js +2 -0
  192. package/dist/gateway/static/root/assets/{shares-settings-C_ITdQqP.js → shares-settings-DpIh1naz.js} +1 -1
  193. package/dist/gateway/static/root/assets/sk-A3STIA2C-DC8Al4lF.js +1 -0
  194. package/dist/gateway/static/root/assets/{skills-page-B30SsJL6.js → skills-page-CRrTQOth.js} +1 -1
  195. package/dist/gateway/static/root/assets/sl-DjmW7S7C-B8FnrXi1.js +1 -0
  196. package/dist/gateway/static/root/assets/space-BPnfqDsQ.js +1 -0
  197. package/dist/gateway/static/root/assets/space-api-D4zPeS-a.js +1 -0
  198. package/dist/gateway/static/root/assets/space-page-DV-4mGaH.js +2 -0
  199. package/dist/gateway/static/root/assets/space-workbook-CtUQSd5l.js +291 -0
  200. package/dist/gateway/static/root/assets/space-workbook-CvOADsEJ.css +1 -0
  201. package/dist/gateway/static/root/assets/space-workbook-format-D1PqIvbd.js +1 -0
  202. package/dist/gateway/static/root/assets/space-workbook-import.worker-Bw2gfMG9.js +68 -0
  203. package/dist/gateway/static/root/assets/sr-cyrl-DzA2myNl-yGc0Jz1j.js +1 -0
  204. package/dist/gateway/static/root/assets/sv-B01JFt6B-DeQDoAsB.js +1 -0
  205. package/dist/gateway/static/root/assets/{system-settings-panel-KXLPpyOW.js → system-settings-panel-jgzBYOji.js} +1 -1
  206. package/dist/gateway/static/root/assets/ta-biPP5NX3-B5_ztYXp.js +1 -0
  207. package/dist/gateway/static/root/assets/{task-detail-page-DHYm_bsg.js → task-detail-page-qTnkErT0.js} +3 -3
  208. package/dist/gateway/static/root/assets/{task-header-title-Buwr7WTV.js → task-header-title-CRfK-rhR.js} +1 -1
  209. package/dist/gateway/static/root/assets/{task-result-evidence-DpV1mZJA.js → task-result-evidence-C2gEC9Hr.js} +1 -1
  210. package/dist/gateway/static/root/assets/te-DdPqCRaf-BjTOzs5s.js +1 -0
  211. package/dist/gateway/static/root/assets/th-C4s1cxFT-CFfNau1h.js +1 -0
  212. package/dist/gateway/static/root/assets/{time-picker-C1PXAXZF.js → time-picker-otHjbob1.js} +1 -1
  213. package/dist/gateway/static/root/assets/tk-BfqDjfTh-UHPz-lif.js +1 -0
  214. package/dist/gateway/static/root/assets/tr-C2sIij-w-DvQDK0dA.js +1 -0
  215. package/dist/gateway/static/root/assets/{tracing-settings-page-CcyPoojp.js → tracing-settings-page-7DxhxIp3.js} +1 -1
  216. package/dist/gateway/static/root/assets/{tunnel-api-D713CJ9R.js → tunnel-api-CZJEfJym.js} +1 -1
  217. package/dist/gateway/static/root/assets/uk-DBx0redY-DGVpthWV.js +1 -0
  218. package/dist/gateway/static/root/assets/{usage-page-DN1TcxWS.js → usage-page-CVJBXy2I.js} +1 -1
  219. package/dist/gateway/static/root/assets/{use-composer-attachments-4FKbf6PB.js → use-composer-attachments-Cs9sRfEz.js} +1 -1
  220. package/dist/gateway/static/root/assets/use-file-preview-expanded-B7Kp4Y1f.js +1 -0
  221. package/dist/gateway/static/root/assets/use-generated-media-UvehLoUl.js +1 -0
  222. package/dist/gateway/static/root/assets/{use-personal-work-srLCZOam.js → use-personal-work-eUnPoS9h.js} +1 -1
  223. package/dist/gateway/static/root/assets/{use-realtime-voice-tyo85cre.js → use-realtime-voice-CJD_ABL6.js} +1 -1
  224. package/dist/gateway/static/root/assets/{use-workspace-tree-VwHdfiR8.js → use-workspace-tree-BYrp8lL7.js} +1 -1
  225. package/dist/gateway/static/root/assets/{user-model-page-D-F5GO3T.js → user-model-page-s8sYPQwS.js} +2 -2
  226. package/dist/gateway/static/root/assets/{voice-player-store-DyuAAbk0.js → voice-player-store-DwAnvFVJ.js} +1 -1
  227. package/dist/gateway/static/root/assets/{voice-settings-DOajN2ay.js → voice-settings-WIooh0DA.js} +1 -1
  228. package/dist/gateway/static/root/assets/{work-discovery-overlay-CTLp1-tu.js → work-discovery-overlay-WGm3tfRV.js} +1 -1
  229. package/dist/gateway/static/root/assets/{work-discovery-page-B-UzFKIr.js → work-discovery-page-DLXUm21d.js} +1 -1
  230. package/dist/gateway/static/root/assets/{working-directory-picker-modal-DvVtUxHW.js → working-directory-picker-modal-BwmhPsrY.js} +1 -1
  231. package/dist/gateway/static/root/assets/{workspace-api-CIfedJeG.js → workspace-api-DEPruUJB.js} +2 -2
  232. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-iAz_WyiN.js +1 -0
  233. package/dist/gateway/static/root/assets/{workspace-open-location-menu-sbOva_RI.js → workspace-open-location-menu-CbQ5vUV7.js} +1 -1
  234. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BYuMOGaK.js → xopc-cloud-account-card-ClAhPUT1.js} +1 -1
  235. package/dist/gateway/static/root/assets/zh-latn-pinyin-CIit9tZA-CW52gdb_.js +1 -0
  236. package/dist/gateway/static/root/dependency-records.json +1251 -205
  237. package/dist/gateway/static/root/index.html +65 -62
  238. package/dist/package.js +1 -1
  239. package/dist/packages/gateway-contract/src/space.js +5 -2
  240. package/dist/packages/gateway-contract/src/user-message-display.js +6 -1
  241. package/dist/packages/realtime-protocol/src/index.js +4 -2
  242. package/dist/src/agent/inbound/attachment-pipeline.js +15 -6
  243. package/dist/src/agent/mcp/conversation-setup.js +9 -6
  244. package/dist/src/agent/skills/marketplace/search.d.ts +1 -0
  245. package/dist/src/agent/skills/marketplace/search.js +1 -0
  246. package/dist/src/agent/tools/capability-catalog-tool.js +1 -1
  247. package/dist/src/agent/tools/factory.js +3 -3
  248. package/dist/src/capabilities/capability-catalog.d.ts +4 -0
  249. package/dist/src/capabilities/capability-catalog.js +46 -15
  250. package/dist/src/channels/catalog/channel-catalog-service.js +2 -3
  251. package/dist/src/endpoint-tools/registry.d.ts +2 -1
  252. package/dist/src/endpoint-tools/registry.js +5 -3
  253. package/dist/src/endpoint-tools/runtime.d.ts +1 -1
  254. package/dist/src/endpoint-tools/runtime.js +2 -2
  255. package/dist/src/extensions/agent-plugins/mcp-adapter.js +15 -2
  256. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  257. package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +1 -1
  258. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +20 -10
  259. package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +20 -0
  260. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +1523 -0
  261. package/dist/src/gateway/hono/routes/space.js +18 -0
  262. package/dist/src/gateway/security/gateway-scopes.js +5 -1
  263. package/dist/src/realtime/runtime.js +1 -1
  264. package/dist/src/session/session-title.js +4 -5
  265. package/dist/src/space/budget-workbook.d.ts +47 -0
  266. package/dist/src/space/budget-workbook.js +210 -0
  267. package/dist/src/space/repository.d.ts +1 -1
  268. package/dist/src/space/repository.js +24 -5
  269. package/dist/src/tunnel/tunnel-service.d.ts +5 -0
  270. package/dist/src/tunnel/tunnel-service.js +131 -30
  271. package/package.json +1 -1
  272. package/dist/gateway/static/root/assets/capabilities-page-D9EpUcuB.js +0 -2
  273. package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +0 -72
  274. package/dist/gateway/static/root/assets/dist-BuHnPloF.js +0 -1
  275. package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +0 -1
  276. package/dist/gateway/static/root/assets/es2015-DBLcMg5B.js +0 -41
  277. package/dist/gateway/static/root/assets/index-BtHMU5k4.css +0 -1
  278. package/dist/gateway/static/root/assets/note-image-lightbox-DrVGs1eQ.js +0 -1
  279. package/dist/gateway/static/root/assets/notes-page-zAJJ2OiQ.js +0 -8
  280. package/dist/gateway/static/root/assets/product-open-page-CQMoDCO1.js +0 -1
  281. package/dist/gateway/static/root/assets/product-preview-modal-DToUA1EF.js +0 -2
  282. package/dist/gateway/static/root/assets/route-preload-Bl10PwKS.js +0 -2
  283. package/dist/gateway/static/root/assets/routine-panel-BjqenuXU.js +0 -2
  284. package/dist/gateway/static/root/assets/share-preview-page-C49EIXte.js +0 -2
  285. package/dist/gateway/static/root/assets/space-page-DmvjU1jc.js +0 -2
  286. package/dist/gateway/static/root/assets/use-file-preview-expanded-CRBn6UTd.js +0 -1
  287. package/dist/gateway/static/root/assets/use-generated-media-CEJ5BBxX.js +0 -1
  288. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-Xi5feqPq.js +0 -1
@@ -0,0 +1 @@
1
+ import"./notes-api-ChV_6O5I.js";
@@ -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{a as i,i as a,l as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{t as _}from"./download-Dk-ZjtO6.js";import{K as v,t as y}from"./markdown-view-C7kqotD-.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{r as C,t as w}from"./chat-chart-block-DA2S21y2.js";var T=g(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),E=g(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),D=n(),O=e(t(),1),k=r(),A=(0,O.createContext)(null);function j(){let e=(0,D.c)(1),t=(0,O.useContext)(A);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:M},e[0]=t):t=e[0],t}return t}function M(){}function N({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=l(s(e=>e.language)).chat,[i,a]=(0,O.useState)(1),[o,c]=(0,O.useState)({x:0,y:0}),[g,y]=(0,O.useState)(!1),[C,w]=(0,O.useState)(!1),T=(0,O.useRef)(null),D=(0,O.useRef)(0),j=(0,O.useRef)(null),[M,N]=(0,O.useState)(null),P=(0,O.useCallback)((e,t)=>{j.current=document.activeElement instanceof HTMLElement?document.activeElement:null,D.current++,T.current=null,a(1),c({x:0,y:0}),y(!1),w(!1),N({src:e,alt:t})},[]),F=(0,O.useMemo)(()=>({openImage:P}),[P]);return(0,k.jsxs)(A.Provider,{value:F,children:[e,(0,k.jsx)(h,{open:M!==null,onOpenChange:e=>{e||(D.current++,N(null))},children:(0,k.jsxs)(f,{children:[(0,k.jsx)(u,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,k.jsxs)(p,{className:S(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),j.current?.isConnected&&j.current.focus({preventScroll:!0}))},children:[(0,k.jsx)(m,{className:`sr-only`,children:M?.alt||r.attachmentPreviewImage}),(0,k.jsx)(d,{asChild:!0,children:(0,k.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,k.jsx)(x,{className:`size-5`,"aria-hidden":!0})})}),M&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,k.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,k.jsx)(v,{className:`size-5`})}),(0,k.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,k.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,k.jsx)(b,{className:`size-5`})}),(0,k.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,k.jsx)(E,{className:`size-5`})}),(0,k.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:C,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=D.current;w(!0),y(!1);try{let t=await fetch(M.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==D.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===D.current&&y(!0)}finally{e===D.current&&w(!1)}},children:(0,k.jsx)(_,{className:`size-5`})})]}),g&&(0,k.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,M?(0,k.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(T.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=T.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{T.current=null},onPointerCancel:()=>{T.current=null},children:(0,k.jsx)(`img`,{src:M.src,alt:M.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var P=`xopc-attachment`,F=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,I=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function L(e,t){return`${P}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function R(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(F),a=r.match(I),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function ee(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}function z(e,t){return L(e,t)}function te(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function ne(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function B(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&o.getState().onUnauthorized(),!i.ok)throw Error(await ne(i));return i.json()}var V=new Map,H=``;function U(e,t,n){return`${n}:${e}:${t}`}function W(){let e=o.getState().conversationId??``;if(e!==H){for(let e of V.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);V.clear(),H=e}}async function re(e,t){W();let n=U(e,t,o.getState().conversationId??``),r=V.get(n);return r||(r={blob:(async()=>{let n=await i(a(ee(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},V.set(n,r)),r.blob}async function G(e,t){W();let n=U(e,t,o.getState().conversationId??``),r=V.get(n);if(r||(r={blob:re(e,t),objectUrl:null,refCount:0},V.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl??=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function K(e,t){W();let n=U(e,t,o.getState().conversationId??``),r=V.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,V.delete(n)))}function q(e){let t=(0,D.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=R(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,O.useState)(d?null:s),[m,h]=(0,O.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),G(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,K(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,O.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=S(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,k.jsx)(T,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,k.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=S(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,k.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,k.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function J(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function Y(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=R(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;G(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,K(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=R(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;G(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,K(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function X(e){let t=(0,D.c)(21),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,O.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,k.jsx)(w,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return Y(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,O.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=J(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,k.jsx)(`div`,{ref:a,children:(0,k.jsx)(C,{children:(0,k.jsx)(y,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function ie(){return c(a(`/api/notes/project-summaries`))}async function ae(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return c(a(`/api/notes${n?`?${n}`:``}`))}async function oe(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function se(e,t){return(await c(a(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function ce(e){let t=await i(a(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function Z(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,...n===void 0?{}:{expectedRevision:n}})})).note}async function le(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ue(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function de(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function fe(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function pe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function me(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function he(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function ge(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function _e(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function ve(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function ye(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function be(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function xe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Q(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Se(e,t={}){return(await c(a(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Ce(e,t,n){let r=new FormData;return r.append(`file`,t),(await B(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await B(a(`/api/notes`),n)).note}async function we(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${z(n.id,r.id)})`;return n.markdown!==i&&(n=await Z(n.id,{markdown:i})),n}async function Te(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${te(t)}](${z(r.id,i.id)})`;return r.markdown!==a&&(r=await Z(r.id,{markdown:a,kind:`voice`})),r}async function Ee(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function De(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Oe(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{G as A,he as C,Ce as D,Z as E,N as F,j as I,E as L,z as M,L as N,X as O,R as P,T as R,_e as S,Oe as T,ve as _,de as a,Te as b,ce as c,pe as d,Ee as f,ae as g,ye as h,se as i,K as j,q as k,be as l,ue as m,ge as n,Se as o,ie as p,me as r,le as s,Q as t,De as u,oe as v,fe as w,xe as x,we as y};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-DlirbHVs.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{t as _}from"./download-Dk-ZjtO6.js";import{K as v,t as y}from"./markdown-view-BpBBv9Gr.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{r as C,t as w}from"./chat-chart-block-BNmGrz2N.js";var T=g(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),E=g(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),D=n(),O=e(t(),1),k=r(),A=(0,O.createContext)(null);function j(){let e=(0,D.c)(1),t=(0,O.useContext)(A);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:M},e[0]=t):t=e[0],t}return t}function M(){}function N({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=l(s(e=>e.language)).chat,[i,a]=(0,O.useState)(1),[o,c]=(0,O.useState)({x:0,y:0}),[g,y]=(0,O.useState)(!1),[C,w]=(0,O.useState)(!1),T=(0,O.useRef)(null),D=(0,O.useRef)(0),j=(0,O.useRef)(null),[M,N]=(0,O.useState)(null),P=(0,O.useCallback)((e,t)=>{j.current=document.activeElement instanceof HTMLElement?document.activeElement:null,D.current++,T.current=null,a(1),c({x:0,y:0}),y(!1),w(!1),N({src:e,alt:t})},[]),F=(0,O.useMemo)(()=>({openImage:P}),[P]);return(0,k.jsxs)(A.Provider,{value:F,children:[e,(0,k.jsx)(h,{open:M!==null,onOpenChange:e=>{e||(D.current++,N(null))},children:(0,k.jsxs)(f,{children:[(0,k.jsx)(u,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,k.jsxs)(p,{className:S(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),j.current?.isConnected&&j.current.focus({preventScroll:!0}))},children:[(0,k.jsx)(m,{className:`sr-only`,children:M?.alt||r.attachmentPreviewImage}),(0,k.jsx)(d,{asChild:!0,children:(0,k.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,k.jsx)(x,{className:`size-5`,"aria-hidden":!0})})}),M&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,k.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,k.jsx)(v,{className:`size-5`})}),(0,k.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,k.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,k.jsx)(b,{className:`size-5`})}),(0,k.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,k.jsx)(E,{className:`size-5`})}),(0,k.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:C,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=D.current;w(!0),y(!1);try{let t=await fetch(M.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==D.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===D.current&&y(!0)}finally{e===D.current&&w(!1)}},children:(0,k.jsx)(_,{className:`size-5`})})]}),g&&(0,k.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,M?(0,k.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(T.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=T.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{T.current=null},onPointerCancel:()=>{T.current=null},children:(0,k.jsx)(`img`,{src:M.src,alt:M.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var P=`xopc-attachment`,F=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,I=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function L(e,t){return`${P}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function R(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(F),a=r.match(I),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function ee(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}function z(e,t){return L(e,t)}function te(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function ne(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function B(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&o.getState().onUnauthorized(),!i.ok)throw Error(await ne(i));return i.json()}var V=new Map,H=``;function U(e,t,n){return`${n}:${e}:${t}`}function W(){let e=o.getState().conversationId??``;if(e!==H){for(let e of V.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);V.clear(),H=e}}async function re(e,t){W();let n=U(e,t,o.getState().conversationId??``),r=V.get(n);return r||(r={blob:(async()=>{let n=await i(a(ee(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},V.set(n,r)),r.blob}async function G(e,t){W();let n=U(e,t,o.getState().conversationId??``),r=V.get(n);if(r||(r={blob:re(e,t),objectUrl:null,refCount:0},V.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl??=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function K(e,t){W();let n=U(e,t,o.getState().conversationId??``),r=V.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,V.delete(n)))}function q(e){let t=(0,D.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=R(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,O.useState)(d?null:s),[m,h]=(0,O.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),G(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,K(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,O.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=S(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,k.jsx)(T,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,k.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=S(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,k.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,k.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function J(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function Y(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=R(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;G(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,K(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=R(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;G(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,K(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function X(e){let t=(0,D.c)(21),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,O.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,k.jsx)(w,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return Y(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,O.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=J(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,k.jsx)(`div`,{ref:a,children:(0,k.jsx)(C,{children:(0,k.jsx)(y,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function ie(){return c(a(`/api/notes/project-summaries`))}async function ae(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return c(a(`/api/notes${n?`?${n}`:``}`))}async function oe(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function se(e,t){return(await c(a(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function ce(e){let t=await i(a(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function Z(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,...n===void 0?{}:{expectedRevision:n}})})).note}async function le(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ue(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function de(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function fe(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function pe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function me(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function he(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function ge(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function _e(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function ve(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function ye(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function be(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function xe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Q(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Se(e,t={}){return(await c(a(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Ce(e,t,n){let r=new FormData;return r.append(`file`,t),(await B(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await B(a(`/api/notes`),n)).note}async function we(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${z(n.id,r.id)})`;return n.markdown!==i&&(n=await Z(n.id,{markdown:i})),n}async function Te(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${te(t)}](${z(r.id,i.id)})`;return r.markdown!==a&&(r=await Z(r.id,{markdown:a,kind:`voice`})),r}async function Ee(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function De(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Oe(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{G as A,he as C,Ce as D,Z as E,N as F,j as I,E as L,z as M,L as N,X as O,R as P,T as R,_e as S,Oe as T,ve as _,de as a,Te as b,ce as c,pe as d,Ee as f,ae as g,ye as h,se as i,K as j,q as k,be as l,ue as m,ge as n,Se as o,ie as p,me as r,le as s,Q as t,De as u,oe as v,fe as w,xe as x,we as y};
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,g as a,m as o,u as s}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{f as c,l,n as u}from"./locale-store-B4o4aDCg.js";import{t as d}from"./messages-hlOsXkQ7.js";import{t as f}from"./archive-Dz0hferG.js";import{t as p}from"./arrow-left-D880xG-P.js";import{t as m}from"./arrow-right-DSSvoX71.js";import{t as h}from"./arrow-up-D5ZtR1QT.js";import{f as g}from"./product-automation-feedback-W6rFx449.js";import{N as _,R as v}from"./recording-upload-BjZ5SwXZ.js";import{t as y}from"./calendar-days-hw_Y-g-s.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{t as te}from"./popover-select-hRG1EzAY.js";import{t as ne}from"./ellipsis-0k4rZLoy.js";import{t as b}from"./file-text-D12HbeVy.js";import{t as re}from"./folder-CN-pC3XL.js";import{D as x,E as S,M as C,_ as w,g as T,i as E,p as D,s as O}from"./notes-api-ChV_6O5I.js";import{n as k,t as A}from"./star-BuMAkjC9.js";import{t as ie}from"./loader-circle-CifKLtgG.js";import{B as j}from"./markdown-view-BpBBv9Gr.js";import{t as ae}from"./mic-CuUb7zc-.js";import{n as oe,t as M}from"./scan-search-CSIGkseh.js";import{t as N}from"./paperclip-f1HujQY1.js";import{t as se}from"./plus-Q2yW6OE7.js";import{t as ce}from"./search-DA7gz22f.js";import{t as le}from"./sparkles-DHlfQFAF.js";import{t as ue}from"./trash-2-DusmjVPV.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./cn-0WouolD0.js";import{t as I}from"./skeleton-DzdOeGYz.js";import{i as de}from"./vendor-swr-CdRzEUwF.js";import{r as fe}from"./app-chrome-BeB4KgOf.js";import{t as pe}from"./page-header-store-D_2QZ6Ps.js";import{t as me}from"./sliding-tab-list-CmcrqRzN.js";import{t as he}from"./confirm-dialog-MHCmEEUZ.js";import{n as ge}from"./index.module-Cd9ENXfk.js";import{l as _e,m as ve,o as ye,r as be,t as xe}from"./dist-DaFr5KMw.js";import{a as Se,i as Ce,t as L}from"./note-detail-panel-DQOIB0cU.js";var R=e(t(),1),z=n();async function we(e){e.note??=await E({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await x(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${C(t,e.id)})`);e.note=await S(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
+
3
+ `)}`})}return{noteId:t,conversationId:(await w(t,{projectId:e.projectId})).conversationId}}function B(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var V=r(),H={meeting:g,requirements:b,research:M,weekly:y};function Te({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:a,projectsLoading:o,projectsError:s}){let c=a.home,l=i(),[u,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(null),[m,g]=(0,R.useState)(!1),[_,v]=(0,R.useState)([]),[y,ne]=(0,R.useState)(!1),[b,x]=(0,R.useState)(null),[S,C]=(0,R.useState)(``),w=(0,R.useRef)(null),T=(0,R.useRef)(!1),E=(0,R.useRef)(null),D=(0,R.useRef)(null),O=y||!!w.current,k=f?c.templateOptions[f]:null,A=!!(u.trim()||_.length);async function j(){if(!(T.current||!A&&!w.current)){T.current=!0,ne(!0),x(null),w.current??={requestId:crypto.randomUUID(),title:u.trim().split(`
4
+ `)[0]?.slice(0,80)||k?.label||a.titlePlaceholder,markdown:`## ${c.requestHeading}\n\n${k?`${k.prompt}\n`:``}${u.trim()}`,projectId:t||void 0,files:[..._],attachments:[],materialHeading:c.materialsHeading};try{let e=await we(w.current);r(),l(B(e.conversationId,e.noteId,c.agentPrompt))}catch(e){w.current.note&&r(),x(e instanceof Error?e.message:a.quickCaptureFailedHint)}finally{T.current=!1,ne(!1)}}}function ae(){w.current=null,x(null),d(``),v([]),p(null),g(!1),D.current?.focus()}return(0,V.jsxs)(`section`,{"aria-label":c.askLabel,children:[(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),j()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,V.jsxs)(`fieldset`,{disabled:O,className:`min-w-0`,children:[(0,V.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,V.jsx)(le,{className:`size-4`,"aria-hidden":!0}),c.askLabel]}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.agentResultHint}),k?(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,V.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`span`,{className:`font-medium`,children:[k.label,` · `]}),k.prompt.split(`
5
+
6
+ `)[0]]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>p(null),"aria-label":a.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,V.jsx)(P,{className:`size-3.5`})})]}):null,(0,V.jsx)(`textarea`,{ref:D,id:`notes-home-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:k?k.prompt.split(`
7
+
8
+ `).at(-1):c.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),j())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),_.length?(0,V.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:_.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,V.jsx)(N,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`truncate`,children:e.name}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`${c.removeMaterial}: ${e.name}`,onClick:()=>v(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,V.jsx)(P,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,V.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,V.jsx)(te,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(S.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:c.unassigned,placeholder:c.unassigned,emptyLabel:c.unassigned,ariaLabel:c.assignProject,triggerIcon:(0,V.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:O,loading:o,statusMessage:s?c.projectsLoadFailed:void 0,searchPlaceholder:c.projectSearch,searchValue:S,onSearchChange:C})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>E.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,V.jsx)(N,{className:`size-4`,"aria-hidden":!0}),c.addMaterials]}),(0,V.jsx)(`input`,{ref:E,type:`file`,multiple:!0,className:`hidden`,"aria-label":c.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);v(e=>[...e,...t]),e.target.value=``}})]})]}),(0,V.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,V.jsxs)(`button`,{type:`submit`,disabled:y||!w.current&&!A,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[y?(0,V.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,V.jsx)(h,{className:`size-4`,"aria-hidden":!0}),y?c.creating:b?c.retry:c.agentCreate]})})]}),b?(0,V.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,V.jsx)(`p`,{children:b}),w.current?.note?(0,V.jsx)(`p`,{className:`mt-1`,children:c.partialFailure}):null,(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[w.current?.note?(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(`/notes/${encodeURIComponent(w.current.note.id)}?edit=1`),className:`underline`,children:c.openSavedDraft}):null,(0,V.jsx)(`button`,{type:`button`,onClick:ae,className:`underline`,children:c.newRequest})]})]}):null,(0,V.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,V.jsxs)(`button`,{type:`button`,disabled:O,"aria-expanded":m,"aria-controls":`notes-home-templates`,onClick:()=>g(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[c.templates,(0,V.jsx)(ee,{className:F(`size-3.5 transition-transform`,m&&`rotate-180`),"aria-hidden":!0})]})}),(0,V.jsxs)(me,{id:`notes-home-templates`,hidden:!m,className:F(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,m?`flex`:`hidden`),role:`group`,"aria-label":c.templates,indicatorClassName:`rounded-md bg-accent-soft`,children:[Object.keys(H).map(e=>{let t=H[e];return(0,V.jsxs)(`button`,{type:`button`,disabled:O,"aria-pressed":f===e,onClick:()=>{p(f===e?null:e),D.current?.focus()},className:F(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,f===e&&`bg-accent-soft text-accent-fg`),children:[(0,V.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),c.templateOptions[e].label]},e)}),(0,V.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:a.discussionCapture.recoveredTitle})]})]})}function Ee(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`||void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function De(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function Oe(e,t,n){return e.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(e.title??``)?n:e.title?.trim()||De(e).slice(0,48)||t}var U=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`;function ke(){let e=u(e=>e.language),t=d(e).notes,n=t.home,r=l(e=>e.conversationId),o=pe(e=>e.setPageHeader),h=pe(e=>e.clearPageHeader),y=i(),{pathname:x,search:C}=s(),[w,j]=a(),M=w.get(`projectId`)||``,N=w.get(`view`)||`all`,P=w.get(`unassigned`)===`true`||N===`unassigned`,L=w.get(`search`)||``,[z]=ge(L,250),[we,B]=(0,R.useState)(M),[H,ke]=(0,R.useState)(``),[Ae,W]=(0,R.useState)(null),[je,Me]=(0,R.useState)(!1),[G,Ne]=(0,R.useState)(!1),[Pe,Fe]=(0,R.useState)(new Set),[Ie,Le]=(0,R.useState)(null),[Re,ze]=(0,R.useState)(null),K=(0,R.useRef)(new Set),q=(0,R.useRef)(null),Be=(0,R.useRef)(!1),Ve=(0,R.useRef)(null),He=Ee(w,z),J=(He.offset??0)/12,{data:Ue,error:We,isLoading:Ge,mutate:Ke}=de(r?[`notes-home`,r,He]:null,()=>T(He)),{data:qe,error:Je,isLoading:Y,mutate:Ye}=de(r?[`notes-home-projects`,r]:null,D),X=qe?.items??[],Xe=X.filter(e=>e.noteCount>0).slice(0,2),Ze=X.find(e=>e.id===M)?.name??n.projectNotes,Qe=Ue?.items??[],Z=Ue?.total??0,$e=Ge||L!==z,et=(0,R.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:c(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[tt,nt]=(0,R.useState)(()=>Date.now());(0,R.useEffect)(()=>{B(M)},[M]),(0,R.useEffect)(()=>{let e=window.setInterval(()=>nt(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Q=(0,R.useCallback)(()=>{Ke().catch(()=>void 0),Ye().catch(()=>void 0)},[Ke,Ye]);(0,R.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,Q)),()=>e.forEach(e=>window.removeEventListener(e,Q))},[Q]);let rt=(0,R.useCallback)((e,t=!1)=>{let n=`${x}${C}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),y(`/notes/${encodeURIComponent(e)}?${r}`)},[x,C,y]),$=(0,R.useCallback)(async()=>{if(!(Be.current||!r)){Be.current=!0,Me(!0),W(null),q.current??={key:crypto.randomUUID(),projectId:M||void 0};try{let e=await E({markdown:``,kind:`thought`,projectId:q.current.projectId},q.current.key);q.current=null,Q(),rt(e.id,!0)}catch(e){W(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Be.current=!1,Me(!1)}}},[M,t.createBlankFailed,t.createBlankFailedHint,rt,Q,r]),it=(0,R.useCallback)(e=>{j(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[j]);function at(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),B(e),j(n)}function ot(e){j(t=>{let n=new URLSearchParams(t);return P&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function st(e,n){if(!K.current.has(e)){K.current.add(e),Fe(new Set(K.current)),W(null);try{await S(e,{pinned:n}),Q()}catch(e){W(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{K.current.delete(e),Fe(new Set(K.current))}}}async function ct(){let e=Ie;if(!(!e||Re)){Le(null),ze(e.id),W(null);try{await O(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Q()}catch(e){W(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{ze(null)}}}if((0,R.useLayoutEffect)(()=>{if(!r){h();return}return o({startExtra:null,main:(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,V.jsx)(`div`,{className:F(`flex min-w-0 items-center gap-2`,fe),children:(0,V.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,V.jsx)(ce,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,V.jsx)(`input`,{ref:Ve,type:`search`,value:L,onChange:e=>it(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>h()},[h,$,je,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,L,o,it,r]),(0,R.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),$()),e.key.toLowerCase()===`f`&&(e.preventDefault(),Ve.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$]),!r)return(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let lt=[{id:`all`,label:n.homeNav,Icon:oe},{id:`favorites`,label:n.favorites,Icon:A},{id:`unassigned`,label:n.unassigned,Icon:k},{id:`archived`,label:t.filterArchived,Icon:f}],ut=M?`project:${M}`:P?`unassigned`:`all`,dt=!$e&&!We&&Z===0&&!M&&!P&&!L&&N===`all`;return(0,V.jsxs)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-7xl flex-1 overflow-hidden bg-surface-panel px-4 sm:px-6 lg:px-8`,children:[(0,V.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto py-6 xl:flex`,"aria-label":n.homeNav,children:[lt.map(({id:e,label:t,Icon:n})=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>at(``,e),"aria-current":!M&&(e===`unassigned`?P:!P&&N===e)?`page`:void 0,className:F(U,`justify-start px-2 text-left text-xs`,!M&&(e===`unassigned`?P:!P&&N===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,V.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,V.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),Y?[0,1,2].map(e=>(0,V.jsx)(I,{className:`mb-2 h-8 w-full`},e)):X.slice(0,8).map(e=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>at(e.id),"aria-current":M===e.id?`page`:void 0,className:F(U,`justify-start px-2 text-left text-xs`,M===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,V.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>y(`/projects`),className:F(U,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,V.jsx)(m,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,V.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,V.jsxs)(`div`,{className:`flex w-full flex-col pb-4 pt-3 sm:pb-7 lg:pb-9 lg:pt-4 xl:pl-8`,children:[(0,V.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:M?Ze:P?n.unassigned:dt?n.firstNoteTitle:n.continueTitle}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:M?n.projectDescription:dt?n.firstNoteDescription:n.continueDescription})]}),M?(0,V.jsxs)(`button`,{type:`button`,onClick:()=>y(`/projects/${encodeURIComponent(M)}`),className:F(U,`text-xs`),children:[n.openProject,(0,V.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),Ae?(0,V.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:Ae}):null,(0,V.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>void $(),disabled:je,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[je?(0,V.jsx)(ie,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,V.jsx)(se,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,V.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,V.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>_(M||void 0),className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,V.jsx)(ae,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,V.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]}),(0,V.jsx)(Se,{projectId:M||void 0})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{Ne(e=>!e),G||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":G,"aria-controls":`notes-home-agent-composer`,title:n.agentActionHint,className:`touch-target mt-2 inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,V.jsx)(le,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,V.jsx)(ee,{className:F(`size-4 transition-transform`,G&&`rotate-180`),"aria-hidden":!0})]}),(0,V.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!G,className:F(`mt-3`,!G&&`hidden`),children:(0,V.jsx)(Te,{projects:X,projectId:we,onProjectChange:B,onCreated:Q,labels:t,projectsLoading:Y,projectsError:!!Je})})]}),Je?(0,V.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,V.jsx)(`span`,{children:n.projectsLoadFailed}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void Ye().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,dt?null:(0,V.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:N===`favorites`?n.favorites:N===`archived`?t.filterArchived:M?n.projectNotes:n.recentNotes}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":N===`agent`,onClick:()=>ot(N===`agent`?`all`:`agent`),className:F(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,N===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,V.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,V.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,V.jsx)(te,{value:ut,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...X.filter(e=>e.name.toLowerCase().includes(H.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:M?Ze:P?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:Y,searchPlaceholder:n.projectSearch,searchValue:H,onSearchChange:ke,onChange:e=>at(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,V.jsxs)(me,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,role:`group`,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,V.jsx)(`button`,{type:`button`,"aria-pressed":N===e||e===`all`&&N===`unassigned`,onClick:()=>ot(e),className:F(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(N===e||e===`all`&&N===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,V.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),We?(0,V.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,V.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void Ke().catch(()=>void 0),className:F(U,`mt-2`),children:n.retry})]}):$e?(0,V.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,V.jsx)(I,{className:`h-10 w-8 shrink-0`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,V.jsx)(I,{className:`h-4 w-2/3`}),(0,V.jsx)(I,{className:`h-3 w-1/2`})]})]},e))}):Qe.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,V.jsx)(oe,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,V.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:L||N!==`all`&&N!==`unassigned`?n.noMatches:M?n.projectEmpty:n.emptyTitle}),(0,V.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:L||N!==`all`&&N!==`unassigned`?n.noMatchesHint:M?n.projectEmptyHint:n.emptyDescription})]}):(0,V.jsx)(`ul`,{className:`divide-y divide-edge`,children:Qe.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?g:e.kind===`bookmark`?v:b,i=Oe(e,t.titlePlaceholder,n.voiceNote),a=De(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,V.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>rt(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,V.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,V.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,V.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,V.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,V.jsx)(le,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,V.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,V.jsx)(`span`,{className:`truncate`,children:a})]}),(0,V.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:Ce(e.updatedAt,tt,et)})]})]}),(0,V.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,V.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:Ce(e.updatedAt,tt,et)}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void st(e.id,!e.pinned),disabled:Pe.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${i}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,V.jsx)(A,{className:F(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,V.jsxs)(_e,{children:[(0,V.jsx)(ve,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,disabled:Re===e.id,"aria-label":`${t.noteActions}: ${i}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:Re===e.id?(0,V.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,V.jsx)(ne,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(ye,{children:(0,V.jsx)(xe,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,V.jsxs)(be,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>Le(e),children:[(0,V.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!$e&&!We&&Z>0?(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,V.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Z))}),Z>12||J>0?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:J===0,className:U,onClick:()=>j(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(J-1)),t}),children:(0,V.jsx)(p,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsxs)(`span`,{children:[J+1,` / `,Math.max(1,Math.ceil(Z/12))]}),(0,V.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(J+1)*12>=Z,className:U,onClick:()=>j(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(J+1)),t}),children:(0,V.jsx)(m,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!M&&!P&&(Y||Xe.length>0)?(0,V.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>y(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,V.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:Y?[0,1].map(e=>(0,V.jsx)(I,{className:`h-28 w-full`},e)):Xe.map(e=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>at(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,V.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,V.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,V.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,V.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,V.jsx)(`span`,{children:e.updatedAt?Ce(e.updatedAt,tt,et):n.emptyProject})]})]},e.id))})]}):null]})}),(0,V.jsx)(he,{open:Ie!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,Ie?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void ct(),onCancel:()=>Le(null)})]})}function Ae(){let e=(0,z.c)(12),{noteId:t}=o(),n=i(),[r]=a(),s;e[0]===r?s=e[1]:(s=j(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=s);let c=s,l;e[2]!==n||e[3]!==c?(l=()=>{n(c)},e[2]=n,e[3]=c,e[4]=l):l=e[4];let u=l;if(!t)return null;let d=r.get(`edit`)===`1`?`wysiwyg`:`preview`,f;e[5]===r?f=e[6]:(f=r.get(`edit`),e[5]=r,e[6]=f);let p=f===`1`,m;return e[7]!==u||e[8]!==t||e[9]!==d||e[10]!==p?(m=(0,V.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-1 flex-col`,children:(0,V.jsx)(L,{noteId:t,onBack:u,showBackButton:!1,initialMode:d,autoFocus:p},t)}),e[7]=u,e[8]=t,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function W(){let e=(0,z.c)(2),{noteId:t}=o(),n;return e[0]===t?n=e[1]:(n=t?(0,V.jsx)(Ae,{}):(0,V.jsx)(ke,{}),e[0]=t,e[1]=n),n}export{W as NotesPage};
@@ -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{n as r}from"./locale-store-B4o4aDCg.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./cloud-C4-yfnnk.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{a as s}from"./vendor-swr-CdRzEUwF.js";import{t as c}from"./button-ChmVQg9O.js";import{n as l}from"./electron-env-DHOGevH3.js";import{i as u}from"./models-hub-cache-B0z5Ptmt.js";import{a as d,n as f,r as p}from"./oauth-api-CW1XhW42.js";var m=e(t(),1),h=`xopc-onboarding-model-setup-dismissed`,g=`/api/models/cloud-onboarding`,_=n();function v({providerId:e,displayName:t,connected:n,onConnected:h,onPendingChange:v}){let y=r(e=>e.language),{mutate:b}=s(),x=y===`zh`,[S,C]=(0,m.useState)(`idle`),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(null),O=(0,m.useRef)(!1),k=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{O.current=!0,k.current?.close(),k.current=null},[]),(0,m.useEffect)(()=>(v?.(S===`waiting`),()=>v?.(!1)),[S,v]);let A=async()=>{O.current=!1,T(null),D(null),C(`waiting`);let t=l();t||(k.current?.close(),k.current=window.open(`about:blank`,`xopc-oauth`),k.current&&(k.current.opener=null));let n=null,r=null;try{for(n=(await d(e)).sessionId;!O.current;){if(await new Promise(e=>window.setTimeout(e,1e3)),O.current)return;let i=await p(n);if(i.authUrl&&i.authUrl!==r)if(r=i.authUrl,D(i.authUrl),t){let e=await window.electronAPI?.shell?.openExternalUrl(i.authUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else k.current&&!k.current.closed&&k.current.location.replace(i.authUrl);if(i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){e===`xopc-cloud`&&await b(g),await u(),k.current?.close(),k.current=null,C(`connected`),h?.();return}}}catch(e){k.current?.close(),k.current=null,O.current||(C(`idle`),T(e instanceof Error?e.message:x?`连接失败`:`Connection failed`))}finally{n&&f(n).catch(()=>{})}},j=n||S===`connected`;return(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-inset p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,_.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-surface-active text-fg-muted`,children:(0,_.jsx)(a,{className:`size-5`,"aria-hidden":!0})}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),j?(0,_.jsx)(i,{className:`size-4 text-emerald-500`,"aria-label":x?`已连接`:`Connected`}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S===`waiting`?x?`请在浏览器中完成 OAuth 授权。`:`Complete OAuth authorization in your browser.`:j?x?`已通过 OAuth 连接。`:`Connected with OAuth.`:x?`使用 OAuth 连接,无需 API Key。`:`Connect with OAuth. No API key is required.`}),S===`waiting`&&E?(0,_.jsx)(`a`,{className:`mt-1 inline-flex text-sm text-accent hover:underline`,href:E,target:`_blank`,rel:`noreferrer`,children:x?`打开授权页面`:`Open authorization page`}):null,w?(0,_.jsx)(`p`,{className:`mt-1 text-sm text-danger`,children:w}):null]})]}),(0,_.jsxs)(c,{type:`button`,variant:j?`secondary`:`primary`,disabled:S===`waiting`,onClick:()=>void A(),children:[S===`waiting`?(0,_.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,S===`waiting`?x?`等待授权…`:`Waiting…`:j?x?`重新授权`:`Reauthorize`:x?`授权`:`Authorize`]})]})}export{g as n,h 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{n as r}from"./locale-store-B4o4aDCg.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./cloud-C4-yfnnk.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{a as s}from"./vendor-swr-CdRzEUwF.js";import{t as c}from"./button-C5tRaJxt.js";import{n as l}from"./electron-env-DHOGevH3.js";import{i as u}from"./models-hub-cache-B0z5Ptmt.js";import{a as d,n as f,r as p}from"./oauth-api-CW1XhW42.js";var m=e(t(),1),h=`xopc-onboarding-model-setup-dismissed`,g=`/api/models/cloud-onboarding`,_=n();function v({providerId:e,displayName:t,connected:n,onConnected:h,onPendingChange:v}){let y=r(e=>e.language),{mutate:b}=s(),x=y===`zh`,[S,C]=(0,m.useState)(`idle`),[w,T]=(0,m.useState)(null),[E,D]=(0,m.useState)(null),O=(0,m.useRef)(!1),k=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{O.current=!0,k.current?.close(),k.current=null},[]),(0,m.useEffect)(()=>(v?.(S===`waiting`),()=>v?.(!1)),[S,v]);let A=async()=>{O.current=!1,T(null),D(null),C(`waiting`);let t=l();t||(k.current?.close(),k.current=window.open(`about:blank`,`xopc-oauth`),k.current&&(k.current.opener=null));let n=null,r=null;try{for(n=(await d(e)).sessionId;!O.current;){if(await new Promise(e=>window.setTimeout(e,1e3)),O.current)return;let i=await p(n);if(i.authUrl&&i.authUrl!==r)if(r=i.authUrl,D(i.authUrl),t){let e=await window.electronAPI?.shell?.openExternalUrl(i.authUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else k.current&&!k.current.closed&&k.current.location.replace(i.authUrl);if(i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){e===`xopc-cloud`&&await b(g),await u(),k.current?.close(),k.current=null,C(`connected`),h?.();return}}}catch(e){k.current?.close(),k.current=null,O.current||(C(`idle`),T(e instanceof Error?e.message:x?`连接失败`:`Connection failed`))}finally{n&&f(n).catch(()=>{})}},j=n||S===`connected`;return(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-inset p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,_.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-surface-active text-fg-muted`,children:(0,_.jsx)(a,{className:`size-5`,"aria-hidden":!0})}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),j?(0,_.jsx)(i,{className:`size-4 text-emerald-500`,"aria-label":x?`已连接`:`Connected`}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S===`waiting`?x?`请在浏览器中完成 OAuth 授权。`:`Complete OAuth authorization in your browser.`:j?x?`已通过 OAuth 连接。`:`Connected with OAuth.`:x?`使用 OAuth 连接,无需 API Key。`:`Connect with OAuth. No API key is required.`}),S===`waiting`&&E?(0,_.jsx)(`a`,{className:`mt-1 inline-flex text-sm text-accent hover:underline`,href:E,target:`_blank`,rel:`noreferrer`,children:x?`打开授权页面`:`Open authorization page`}):null,w?(0,_.jsx)(`p`,{className:`mt-1 text-sm text-danger`,children:w}):null]})]}),(0,_.jsxs)(c,{type:`button`,variant:j?`secondary`:`primary`,disabled:S===`waiting`,onClick:()=>void A(),children:[S===`waiting`?(0,_.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,S===`waiting`?x?`等待授权…`:`Waiting…`:j?x?`重新授权`:`Reauthorize`:x?`授权`:`Authorize`]})]})}export{g as n,h as r,v as t};
@@ -0,0 +1 @@
1
+ var e=[`00001,000032,0000021,021,000001,0023,32,1,01,001,2,02,022,032,023,102,23,22,223,4`,`{".":[{"a":[{"n":[{"t":[{"i":[{"m":[{"n":1}]},0]}]}]}],"c":[{"i":[{"r":[{"c":[{"u":[{"m":2}]}]}]}]}],"e":[{"x":3}],"p":[{"a":[{"r":[{"a":[{"i":0,"u":0}]}]}],"r":[{"o":[{"t":[{"o":[{"a":4,"e":4,"i":4,"u":4}]}]}]}]}],"s":[{"u":[{"b":[{"l":[{"u":5}],"r":5}]}]},11]}],"p":[{"s":[{"i":[{"c":6}]},10],"n":[{"e":[{"u":6}]},10],"h":[{"p":10,"t":10},11],"l":11,"p":10,"r":11,"t":10,"z":10,".":10,"'":10},7],"ï":7,"ü":7,"a":[{"i":[{"a":8,"e":8,"o":8,"u":8}],"o":[{"r":[{".":8}],"i":[{"r":[{"a":[{".":8}]}]}]}]}],"i":[{"o":[{"r":[{".":8}],"i":[{"r":[{"a":[{".":8}]}]},9]}],"i":[{".":7}]}],"e":[{"i":[{"u":8}]}],"o":[{"i":[{"a":8,"e":8,"o":8,"u":8}]}],"b":[{"b":10,"d":10,"l":11,"m":10,"n":10,"r":11,"t":10,"s":10,".":10,"'":10},7],"c":[{"c":10,"h":[{".":10,"'":[{".":10,"'":[{".":10}]}]},12],"l":11,"m":10,"n":10,"q":10,"r":11,"s":10,"t":10,"z":10,".":10,"'":10},7],"ç":[{".":10},7],"d":[{"d":10,"g":10,"m":10,"r":11,"s":10,"v":10,".":10,"'":10},7],"f":[{"f":10,"l":11,"n":10,"r":11,"t":10,".":10,"'":10},7],"g":[{"g":10,"d":10,"f":10,"l":11,"m":10,"n":10,"r":11,"s":10,"ü":12,"v":10,".":10,"'":10},7],"h":[{"p":10,"t":10,".":10,"'":10},7],"j":[{"'":10},7],"k":[{"k":10,"h":12,"'":10},7],"l":[{"b":10,"c":10,"d":10,"f":[{"t":13},10],"g":10,"h":[{".":10},11],"k":10,"l":10,"m":10,"n":10,"p":10,"q":10,"r":10,"s":10,"t":10,"v":10,".":10,"'":[{".":10,"'":10}]},7],"m":[{"m":10,"b":10,"p":10,"l":10,"n":10,"q":10,"r":10,"v":10,".":10,"'":10},7],"n":[{"b":10,"c":10,"ç":10,"d":10,"f":10,"h":[{".":10},11],"g":10,"j":10,"l":10,"m":10,"n":10,"p":10,"q":10,"r":10,"s":[{"m":14,"f":14,".":10},10],"t":10,"v":10,"x":10,".":10,"'":10},7],"q":[{"u":15,"ü":12,"'":10},7],"r":[{"b":10,"c":10,"ç":10,"d":10,"f":10,"g":10,"h":11,"l":10,"m":10,"n":10,"p":10,"q":10,"r":10,"s":10,"t":[{".":10},10],"ü":11,"v":10,"z":10,".":10,"'":10},7],"s":[{"p":[{"h":16},10],"s":10,"t":[{"b":17,"c":17,"d":17,"f":17,"g":17,"l":18,"m":17,"n":17,"p":17,"q":17,"s":17,"t":17,"v":17,".":10},10],".":10,"c":[{".":10},10],"b":10,"d":10,"f":10,"g":10,"h":[{".":10,"'":10},11],"j":10,"k":10,"l":10,"m":10,"n":10,"r":10,"v":10,"z":10,"'":[{".":19,"'":19}]},7],"t":[{"b":10,"c":10,"d":10,"f":10,"g":[{".":10},11],"h":11,"j":11,"l":11,"r":11,"m":10,"n":10,"p":10,"q":10,"t":10,"v":10,"z":[{".":10},11],".":10,"'":[{".":10,"'":10}]},7],"v":[{"l":11,"r":11,"v":10,"'":[{".":10,"'":10}]},7],"x":[{"t":10,"x":10,".":10,"'":10},7],"z":[{".":10,"'":[{".":10,"'":10}]},7],"'":17,"w":[{"'":10}]}`,[]];export{e as Oc};
@@ -0,0 +1 @@
1
+ var e=[`22,11,01,1,21`,`{"‍":0,"‌":1,"ଅ":2,"ଆ":2,"ଇ":2,"ଈ":2,"ଉ":2,"ଊ":2,"ଋ":2,"ୠ":2,"ଌ":2,"ୡ":2,"ଏ":2,"ଐ":2,"ଓ":2,"ଔ":2,"ା":2,"ି":2,"ୀ":2,"ୁ":2,"ୂ":2,"ୃ":2,"େ":2,"ୈ":2,"ୋ":2,"ୌ":2,"କ":3,"ଖ":3,"ଗ":3,"ଘ":3,"ଙ":3,"ଚ":3,"ଛ":3,"ଜ":3,"ଝ":3,"ଞ":3,"ଟ":3,"ଠ":3,"ଡ":3,"ଢ":3,"ଣ":3,"ତ":3,"ଥ":3,"ଦ":3,"ଧ":3,"ନ":3,"ପ":3,"ଫ":3,"ବ":3,"ଭ":3,"ମ":3,"ଯ":3,"ର":3,"ଲ":3,"ଳ":3,"ଵ":3,"ଶ":3,"ଷ":3,"ସ":3,"ହ":3,"ଂ":4,"ଃ":4,"ୗ":4,"ଁ":4,"୍":0}`,[]];export{e as Or};
@@ -0,0 +1 @@
1
+ var e=[`22,11,01,1,21`,`{"‍":0,"‌":1,"ਅ":2,"ਆ":2,"ਇ":2,"ਈ":2,"ਉ":2,"ਊ":2,"ਏ":2,"ਐ":2,"ਓ":2,"ਔ":2,"ਾ":2,"ਿ":2,"ੀ":2,"ੁ":2,"ੂ":2,"ੇ":2,"ੈ":2,"ੋ":2,"ੌ":2,"ਕ":3,"ਖ":3,"ਗ":3,"ਘ":3,"ਙ":3,"ਚ":3,"ਛ":3,"ਜ":3,"ਝ":3,"ਞ":3,"ਟ":3,"ਠ":3,"ਡ":3,"ਢ":3,"ਣ":3,"ਤ":3,"ਥ":3,"ਦ":3,"ਧ":3,"ਨ":3,"ਪ":3,"ਫ":3,"ਬ":3,"ਭ":3,"ਮ":3,"ਯ":3,"ਰ":3,"ਲ":3,"ਲ਼":3,"ਵ":3,"ਸ਼":3,"ਸ":3,"ਹ":3,"ਁ":4,"ਂ":4,"ਃ":4,"੍":0,"ੰ":0,"ੱ":0}`,[]];export{e as Pa};
@@ -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{l as r,u as i}from"./chunk-KS7C4IRE-BPb7KheU.js";import{l as a,n as o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{t as c}from"./file-text-D12HbeVy.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./session-manager-fvJusKsK.js";import{t as d}from"./capabilities-DFRrPT_I.js";import{r as f}from"./dist-ZrL34Ps4.js";import{n as p,t as m}from"./page-context-draft-DpDsGHtl.js";var h=e(t(),1),g=n();function _({resource:e,selection:t,label:n,disabled:_=!1,presentation:v=`button`}){let y=s(o(e=>e.language)).chat.pageContext,b=i(),x=r().key,[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(!1),E=(0,h.useRef)(!1),D=(0,h.useRef)(0),O=a(e=>e.baseUrl),k=a(e=>e.conversationId);(0,h.useEffect)(()=>(E.current=!1,C(!1),T(!1),()=>{D.current+=1}),[x,e.kind,e.id,e.revision,t?.text,t?.draft,_,O,k]);async function A(){if(_||E.current)return;E.current=!0,C(!0),T(!1);let n=D.current,r=()=>D.current===n&&a.getState().baseUrl===O&&a.getState().conversationId===k;try{let n=p.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await d(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new u().createSession();if(!r())return;if(!p.put(m(O,k,o.key),n))throw Error(`Context draft limit reached`);b(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&T(!0)}finally{D.current===n&&(E.current=!1,C(!1))}}let j=(0,g.jsxs)(`button`,{type:`button`,disabled:_||S,onClick:()=>void A(),"aria-busy":S,title:_?y.unavailable:n??y.capture,className:v===`menu`?`flex min-h-11 w-full items-center gap-2 rounded-md px-3 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover disabled:opacity-40`:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[S?(0,g.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n??y.capture]});return(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[v===`menu`?(0,g.jsx)(f,{asChild:!0,disabled:_||S,onSelect:e=>e.preventDefault(),children:j}):j,w?(0,g.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:y.unavailable}):null]})}export{_ 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{d as r,u as i}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{l as a,n as o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{t as c}from"./file-text-D12HbeVy.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./session-manager-1UFhZMpv.js";import{t as d}from"./capabilities-DFRrPT_I.js";import{r as f}from"./dist-DaFr5KMw.js";import{n as p,t as m}from"./page-context-draft-DpDsGHtl.js";var h=e(t(),1),g=n();function _({resource:e,selection:t,label:n,disabled:_=!1,presentation:v=`button`}){let y=s(o(e=>e.language)).chat.pageContext,b=r(),x=i().key,[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(!1),E=(0,h.useRef)(!1),D=(0,h.useRef)(0),O=a(e=>e.baseUrl),k=a(e=>e.conversationId);(0,h.useEffect)(()=>(E.current=!1,C(!1),T(!1),()=>{D.current+=1}),[x,e.kind,e.id,e.revision,t?.text,t?.draft,_,O,k]);async function A(){if(_||E.current)return;E.current=!0,C(!0),T(!1);let n=D.current,r=()=>D.current===n&&a.getState().baseUrl===O&&a.getState().conversationId===k;try{let n=p.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await d(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new u().createSession();if(!r())return;if(!p.put(m(O,k,o.key),n))throw Error(`Context draft limit reached`);b(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&T(!0)}finally{D.current===n&&(E.current=!1,C(!1))}}let j=(0,g.jsxs)(`button`,{type:`button`,disabled:_||S,onClick:()=>void A(),"aria-busy":S,title:_?y.unavailable:n??y.capture,className:v===`menu`?`flex min-h-11 w-full items-center gap-2 rounded-md px-3 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover disabled:opacity-40`:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[S?(0,g.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n??y.capture]});return(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[v===`menu`?(0,g.jsx)(f,{asChild:!0,disabled:_||S,onSelect:e=>e.preventDefault(),children:j}):j,w?(0,g.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:y.unavailable}):null]})}export{_ 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{l as r,t as i,u as a}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{t as u}from"./chat-page-BbahuZ59.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,s as ee,t as te}from"./install-connector-dialog-Rox2_5eU.js";import{c as h,o as g,s as _}from"./use-personal-work-srLCZOam.js";import{t as ne}from"./play-kxZvpBg8.js";import{t as v}from"./settings-2-D-csvaET.js";import{t as re}from"./upload-rrb46c3c.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./skeleton-DzdOeGYz.js";import{r as x}from"./right-workspace-store-CFf15f36.js";import{a as S,i as C,o as w,r as T,t as E}from"./dist-GJ8-1PAx.js";import{a as D,r as ie}from"./connectors-api-KA6rkOJX.js";import{u as ae}from"./use-realtime-voice-tyo85cre.js";import{n as O}from"./voice-call-context-BM2A4bLz.js";import{t as k}from"./page-header-store-D_2QZ6Ps.js";import{s as A}from"./agent-avatar-display-BDHjRaTK.js";import{t as j}from"./personal-avatar-D5VUVQGE.js";import{d as M,i as N,r as P}from"./voice-config-api-B1RtxiRq.js";import{t as oe}from"./personal-profile-settings-Cd2xUVbw.js";var F=e(t(),1),I=n(),L=[`intro`,`identity`,`voice`,`connections`],se=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function ce(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function R(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await c(o(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),A(e)}function z({modelsAvailable:e,onCreated:t}){let n=s(e=>e.language)===`zh`,r=s(e=>e.language),[a,u]=(0,F.useState)(`intro`),[h,g]=(0,F.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[_,v]=(0,F.useState)(!1),[y,x]=(0,F.useState)(!1),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,O]=(0,F.useState)(null),[k,A]=(0,F.useState)(null),[oe,z]=(0,F.useState)(!0),[B,V]=(0,F.useState)([]),[H,U]=(0,F.useState)(null),W=(0,F.useRef)(null),G=(0,F.useRef)(null),[K,le]=(0,F.useState)([]),[q,J]=(0,F.useState)(!0),[Y,X]=(0,F.useState)([]),[Z,Q]=(0,F.useState)(null);(0,F.useEffect)(()=>{let e=!1;return c(o(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),g(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||v(!0)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>{c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:a,draft:h})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[h,_,a]),(0,F.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?A({provider:t.tts.provider,model:t.tts.model,enabled:!0}):z(!1))}).catch(()=>{e||z(!1)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!k?.enabled)return;let e=!1;return N(k.provider,k.model,`realtime`).then(t=>{e||V(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||z(!1)}),()=>{e=!0}},[k]),(0,F.useEffect)(()=>{if(a!==`connections`)return;let e=!1;return J(!0),Promise.allSettled([ie({page:1,pageSize:24,verification:`verified`}),D()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];le(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&X(n.value),J(!1)}}),()=>{e=!0}},[a]),(0,F.useEffect)(()=>()=>{G.current?.abort(),W.current?.close()},[]),(0,F.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let ue=async(e,t=h)=>{await c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},de=async e=>{C(null);let t=L[Math.max(0,Math.min(L.length-1,L.indexOf(a)+e))];try{await ue(t)}catch(e){C(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||y)){x(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:h,r=e.voice&&k?.enabled&&B.some(t=>t.id===e.voice)?{provider:k.provider,model:k.model,voice:e.voice}:void 0,i=(await c(o(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&w)try{await R(i.agentId,w),i=(await c(o(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}}},pe=(0,F.useCallback)(async e=>{G.current?.abort(),W.current?.close();let t=new AbortController;G.current=t,U(e),C(null);try{let n=new ae;W.current=n,await n.start();let r=await M(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>U(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),U(null)}},[]);if(!_)return(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,I.jsx)(b,{className:`h-10 w-2/3`}),(0,I.jsx)(b,{className:`h-64 w-full rounded-2xl`}),(0,I.jsx)(b,{className:`h-12 w-full rounded-xl`})]});let $=L.indexOf(a),me={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[a];return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,I.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,I.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>void de(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,I.jsx)(d,{className:`size-4`}),n?`上一步`:`Back`]}):(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,I.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,I.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":$+1,"aria-valuemin":1,"aria-valuemax":L.length,children:L.map((e,t)=>(0,I.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,I.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,I.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,I.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,I.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,I.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,I.jsx)(j,{appearance:h.appearance,className:`size-14`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,I.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:h.displayName||`Ada`})]})]}),(0,I.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${L.length} 步`:`Step ${$+1} of ${L.length}`}),(0,I.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),a===`intro`&&(0,I.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,I.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,I.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),a===`identity`&&(0,I.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,I.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,I.jsx)(`input`,{value:h.displayName,maxLength:60,onChange:e=>g(t=>({...t,displayName:e.target.value})),onBlur:()=>g(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[se.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":!w&&h.appearance===e.id,onClick:()=>{T(null),O(null),g(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!w&&h.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(j,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,I.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${w?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(re,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,I.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){C(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}T(t),O(URL.createObjectURL(t))}}})]})]}),(0,I.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),a===`voice`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),oe?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(b,{className:`h-20 rounded-xl`}),(0,I.jsx)(b,{className:`h-20 rounded-xl`})]}):k?.enabled&&B.length>0?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-pressed":!h.voice,onClick:()=>g(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${h.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),B.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${h.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":h.voice===e.id,onClick:()=>g(t=>({...t,voice:e.id})),children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,I.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void pe(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,I.jsx)(ne,{className:`size-4 ${H===e.id?`text-accent`:``}`})})]},e.id))]}):(0,I.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,I.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),a===`connections`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),q?(0,I.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,I.jsx)(b,{className:`h-18 rounded-xl`}),(0,I.jsx)(b,{className:`h-18 rounded-xl`})]}):(0,I.jsx)(`div`,{className:`mt-5 space-y-2`,children:K.length?K.map(e=>{let t=ce(Y.find(t=>t.connectorId===e.id));return(0,I.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,I.jsx)(m,{connector:e,size:`sm`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,I.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,I.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,I.jsx)(p,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,I.jsx)(`button`,{type:`button`,onClick:()=>Q(ee(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,I.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,I.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,I.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},a)}),(0,I.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,I.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[a===`intro`&&(0,I.jsx)(`button`,{type:`button`,disabled:!e||y,onClick:()=>void fe(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),a===`voice`&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let e={...h,voice:null};g(e),C(null),ue(`connections`,e).catch(e=>C(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,I.jsxs)(`button`,{type:`button`,disabled:y||a===`connections`&&!e,onClick:()=>a===`connections`?void fe():void de(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[y?n?`正在创建…`:`Creating…`:a===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!y&&(0,I.jsx)(f,{className:`size-4`})]})]})]})}),Z&&(0,I.jsx)(te,{draft:Z,onChange:Q,onClose:()=>Q(null),t:l(r).connectorsSettings,onInstalled:async()=>{X(await D()),Q(null)}})]})}function B(){let e=a(),t=r(),n=O(),i=(0,F.useRef)(n);i.current=n;let l=s(e=>e.language)===`zh`,d=k(e=>e.setPageHeader),f=k(e=>e.clearPageHeader),[p,m]=(0,F.useState)(null),[ee,te]=(0,F.useState)([]),[ne,re]=(0,F.useState)(!0),[D,ie]=(0,F.useState)(null),[ae,A]=(0,F.useState)(!1),[M,N]=(0,F.useState)(!1),P=(0,F.useRef)(null),L=(0,F.useRef)(null),[se,ce]=(0,F.useState)(null),R=(0,F.useCallback)(e=>{L.current=e,ce(e?.closest(`[data-app-chat-shell]`)??null)},[]),B=(0,F.useRef)(null),V=(0,F.useRef)(null),H=p?.state===`ready`?p.conversationId:void 0,U=x(e=>{let t=H?e.panes[H]:void 0,n=t?.tabs.find(e=>e.id===t.activeId);return t?.open===!0&&(t.activeId===`personal-tasks`||t.personalDetailsOpen===!0&&(n?.kind===`file`||n?.kind===`browser`))}),{avatarState:W,summary:G,refreshWork:K,refreshPrompt:le}=g(H,l);_(H,K,le);let q=(0,F.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),J=(0,F.useCallback)(e=>{V.current=e,i.current.setMiniAnchor(e)},[]),Y=(0,F.useCallback)(()=>{H&&U&&x.getState().closePersonalTasks(H)},[H,U]),X=(0,F.useCallback)(()=>{i.current.minimize(),N(e=>!e)},[]),Z=(0,F.useCallback)(()=>{H&&(i.current.minimize(),N(!1),U?Y():x.getState().openPersonalTasks(H))},[Y,H,U]);(0,F.useEffect)(()=>{n.expanded&&N(!1)},[n.expanded]),(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;t&&m(t)};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let Q=(0,F.useCallback)(async()=>{try{let[e,t]=await Promise.all([c(o(`/api/personal-agent`)),c(o(`/api/personal-agent/models`))]);m(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),te(t.payload)}catch(e){ie(e instanceof Error?e.message:String(e))}finally{re(!1)}},[]);return(0,F.useEffect)(()=>{Q()},[Q]),(0,F.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=l?`语音通话`:`Voice call`,r=`touch-target inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full bg-surface-hover/90 px-3.5 text-sm font-medium text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent aria-expanded:bg-surface-active`,a=()=>{if(N(!1),!e)return;if(i.current.expanded){i.current.minimize();return}let t=L.current;i.current.open({conversationId:p.conversationId,name:p.displayName},t?{anchor:t,avatar:(0,I.jsx)(j,{appearance:p.appearance,agentId:p.agentId,className:`size-full`})}:void 0)},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return d({startExtra:null,personalChat:e?U?`controls`:`identity`:void 0,main:(0,I.jsxs)(`div`,{className:`flex min-w-0 justify-center`,children:[(0,I.jsx)(`h1`,{className:`sr-only`,children:s}),U?null:e?(0,I.jsxs)(`button`,{ref:B,type:`button`,"data-personal-tasks-trigger":!0,"aria-controls":`app-workspace-panel`,"aria-expanded":U,"aria-describedby":G?`personal-work-status`:void 0,"aria-label":l?`${s} 的任务`:`${s}'s tasks`,title:G||s,onClick:Z,className:`group/identity flex min-w-0 max-w-full flex-col items-center gap-1 rounded-2xl px-1.5 pb-0.5 text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:gap-1.5`,children:[(0,I.jsx)(`span`,{className:`relative grid size-16 shrink-0 place-items-center rounded-full border border-edge-subtle bg-surface-base transition-colors group-hover/identity:border-edge sm:size-20 @max-[26rem]/personal-chat:size-14`,children:(0,I.jsx)(j,{appearance:o,agentId:p.agentId,activity:W,className:`size-full`})}),(0,I.jsxs)(`span`,{className:`personal-identity-label max-w-full min-w-0 rounded-2xl px-3 py-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-[0.9375rem] leading-5 font-semibold text-fg sm:text-base`,children:s}),G?(0,I.jsxs)(`span`,{id:`personal-work-status`,role:`status`,className:`flex min-w-0 items-center justify-center gap-1.5 text-xs leading-4 text-fg-muted`,children:[W===`idle`?null:(0,I.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${W===`waiting`?`bg-warning`:`bg-accent`}`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`truncate`,children:G})]}):null]})]}):(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(j,{appearance:o,className:`size-8`}),(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:s})]})]}),end:e?(0,I.jsxs)(`div`,{ref:R,className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":n.expanded,onClick:a,className:r,"aria-label":t,title:t,children:[(0,I.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`通话`:`Call`})]}),(0,I.jsxs)(`button`,{ref:P,type:`button`,onClick:X,"aria-haspopup":`dialog`,"aria-expanded":M,className:r,"aria-label":l?`${s} 设置`:`${s} settings`,children:[(0,I.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`设置`:`Settings`})]})]}):null}),()=>f()},[W,f,p,R,d,M,G,U,X,Z,n.expanded,l]),ne?(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,I.jsx)(b,{className:`h-20 w-20 rounded-full`}),(0,I.jsx)(b,{className:`h-9 w-72`}),(0,I.jsx)(b,{className:`h-44 w-full rounded-2xl`})]}):D&&!p?(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,I.jsx)(`p`,{children:D}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Q(),className:`text-accent hover:underline`,children:l?`重试`:`Retry`})]}):p?.state===`ready`?(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ae&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,I.jsx)(`span`,{children:l?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{A(!1),q()},className:`shrink-0 text-accent hover:underline`,children:l?`打开设置`:`Open settings`})]}),(0,I.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(u,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,opening:l?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,I.jsxs)(w,{open:M,onOpenChange:N,children:[(0,I.jsx)(E,{virtualRef:L}),(0,I.jsx)(S,{children:(0,I.jsxs)(C,{ref:J,side:`bottom`,align:`end`,sideOffset:12,collisionPadding:12,collisionBoundary:se??void 0,"aria-label":l?`${p.displayName} 快捷设置`:`${p.displayName} quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(P.current?.contains(e.target)||B.current?.contains(e.target)||V.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} min-h-0 w-[min(27rem,calc(100vw-1.5rem))] max-w-[var(--radix-popover-content-available-width)] flex-col overflow-hidden rounded-[1.75rem] border border-edge-subtle bg-surface-overlay shadow-float outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 px-5 pb-2 pt-4`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:l?`快捷设置`:`Quick settings`}),(0,I.jsx)(T,{className:`touch-target -mr-2 rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l?`关闭设置`:`Close settings`,children:(0,I.jsx)(y,{className:`size-4`})})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pb-4 pt-2`,children:(0,I.jsx)(oe,{zh:l,onOpenVoiceServices:q})}),(0,I.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,I.jsx)(`button`,{type:`button`,onClick:q,className:`w-full rounded-full bg-surface-hover px-4 py-2.5 text-center text-sm font-medium text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:l?`更多设置`:`More settings`})})]})})]})]}):(0,I.jsx)(z,{modelsAvailable:ee.length>0,onCreated:(e,t)=>{m(e),A(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{B as PersonalPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{d as r,t as i,u as a}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{i as o,n as s,o as c}from"./locale-store-B4o4aDCg.js";import{t as l}from"./messages-hlOsXkQ7.js";import{t as u}from"./chat-page-CJiXMjMM.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,s as ee,t as te}from"./install-connector-dialog-DyscHGNB.js";import{c as h,o as g,s as _}from"./use-personal-work-eUnPoS9h.js";import{t as ne}from"./play-kxZvpBg8.js";import{t as v}from"./settings-2-D-csvaET.js";import{t as re}from"./upload-rrb46c3c.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./skeleton-DzdOeGYz.js";import{r as x}from"./right-workspace-store-CFf15f36.js";import{a as S,i as C,o as w,r as T,t as E}from"./dist-BSVQC3i_.js";import{a as D,r as ie}from"./connectors-api-KA6rkOJX.js";import{u as ae}from"./use-realtime-voice-CJD_ABL6.js";import{n as O}from"./voice-call-context-BM2A4bLz.js";import{t as k}from"./page-header-store-D_2QZ6Ps.js";import{s as A}from"./agent-avatar-display-BDHjRaTK.js";import{t as j}from"./personal-avatar-D5VUVQGE.js";import{d as M,i as N,r as P}from"./voice-config-api-B1RtxiRq.js";import{t as oe}from"./personal-profile-settings-BlsS-2z3.js";var F=e(t(),1),I=n(),L=[`intro`,`identity`,`voice`,`connections`],se=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function ce(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function R(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await c(o(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),A(e)}function z({modelsAvailable:e,onCreated:t}){let n=s(e=>e.language)===`zh`,r=s(e=>e.language),[a,u]=(0,F.useState)(`intro`),[h,g]=(0,F.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[_,v]=(0,F.useState)(!1),[y,x]=(0,F.useState)(!1),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,O]=(0,F.useState)(null),[k,A]=(0,F.useState)(null),[oe,z]=(0,F.useState)(!0),[B,V]=(0,F.useState)([]),[H,U]=(0,F.useState)(null),W=(0,F.useRef)(null),G=(0,F.useRef)(null),[K,le]=(0,F.useState)([]),[q,J]=(0,F.useState)(!0),[Y,X]=(0,F.useState)([]),[Z,Q]=(0,F.useState)(null);(0,F.useEffect)(()=>{let e=!1;return c(o(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),g(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||v(!0)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>{c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:a,draft:h})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[h,_,a]),(0,F.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?A({provider:t.tts.provider,model:t.tts.model,enabled:!0}):z(!1))}).catch(()=>{e||z(!1)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!k?.enabled)return;let e=!1;return N(k.provider,k.model,`realtime`).then(t=>{e||V(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||z(!1)}),()=>{e=!0}},[k]),(0,F.useEffect)(()=>{if(a!==`connections`)return;let e=!1;return J(!0),Promise.allSettled([ie({page:1,pageSize:24,verification:`verified`}),D()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];le(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&X(n.value),J(!1)}}),()=>{e=!0}},[a]),(0,F.useEffect)(()=>()=>{G.current?.abort(),W.current?.close()},[]),(0,F.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let ue=async(e,t=h)=>{await c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},de=async e=>{C(null);let t=L[Math.max(0,Math.min(L.length-1,L.indexOf(a)+e))];try{await ue(t)}catch(e){C(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||y)){x(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:h,r=e.voice&&k?.enabled&&B.some(t=>t.id===e.voice)?{provider:k.provider,model:k.model,voice:e.voice}:void 0,i=(await c(o(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&w)try{await R(i.agentId,w),i=(await c(o(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}}},pe=(0,F.useCallback)(async e=>{G.current?.abort(),W.current?.close();let t=new AbortController;G.current=t,U(e),C(null);try{let n=new ae;W.current=n,await n.start();let r=await M(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>U(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),U(null)}},[]);if(!_)return(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,I.jsx)(b,{className:`h-10 w-2/3`}),(0,I.jsx)(b,{className:`h-64 w-full rounded-2xl`}),(0,I.jsx)(b,{className:`h-12 w-full rounded-xl`})]});let $=L.indexOf(a),me={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[a];return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,I.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,I.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>void de(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,I.jsx)(d,{className:`size-4`}),n?`上一步`:`Back`]}):(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,I.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,I.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":$+1,"aria-valuemin":1,"aria-valuemax":L.length,children:L.map((e,t)=>(0,I.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,I.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,I.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,I.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,I.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,I.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,I.jsx)(j,{appearance:h.appearance,className:`size-14`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,I.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:h.displayName||`Ada`})]})]}),(0,I.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${L.length} 步`:`Step ${$+1} of ${L.length}`}),(0,I.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),a===`intro`&&(0,I.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,I.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,I.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),a===`identity`&&(0,I.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,I.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,I.jsx)(`input`,{value:h.displayName,maxLength:60,onChange:e=>g(t=>({...t,displayName:e.target.value})),onBlur:()=>g(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[se.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":!w&&h.appearance===e.id,onClick:()=>{T(null),O(null),g(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!w&&h.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(j,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,I.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${w?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(re,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,I.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){C(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}T(t),O(URL.createObjectURL(t))}}})]})]}),(0,I.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),a===`voice`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),oe?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(b,{className:`h-20 rounded-xl`}),(0,I.jsx)(b,{className:`h-20 rounded-xl`})]}):k?.enabled&&B.length>0?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-pressed":!h.voice,onClick:()=>g(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${h.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),B.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${h.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":h.voice===e.id,onClick:()=>g(t=>({...t,voice:e.id})),children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,I.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void pe(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,I.jsx)(ne,{className:`size-4 ${H===e.id?`text-accent`:``}`})})]},e.id))]}):(0,I.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,I.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),a===`connections`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),q?(0,I.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,I.jsx)(b,{className:`h-18 rounded-xl`}),(0,I.jsx)(b,{className:`h-18 rounded-xl`})]}):(0,I.jsx)(`div`,{className:`mt-5 space-y-2`,children:K.length?K.map(e=>{let t=ce(Y.find(t=>t.connectorId===e.id));return(0,I.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,I.jsx)(m,{connector:e,size:`sm`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,I.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,I.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,I.jsx)(p,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,I.jsx)(`button`,{type:`button`,onClick:()=>Q(ee(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,I.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,I.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,I.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},a)}),(0,I.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,I.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[a===`intro`&&(0,I.jsx)(`button`,{type:`button`,disabled:!e||y,onClick:()=>void fe(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),a===`voice`&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let e={...h,voice:null};g(e),C(null),ue(`connections`,e).catch(e=>C(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,I.jsxs)(`button`,{type:`button`,disabled:y||a===`connections`&&!e,onClick:()=>a===`connections`?void fe():void de(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[y?n?`正在创建…`:`Creating…`:a===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!y&&(0,I.jsx)(f,{className:`size-4`})]})]})]})}),Z&&(0,I.jsx)(te,{draft:Z,onChange:Q,onClose:()=>Q(null),t:l(r).connectorsSettings,onInstalled:async()=>{X(await D()),Q(null)}})]})}function B(){let e=r(),t=a(),n=O(),i=(0,F.useRef)(n);i.current=n;let l=s(e=>e.language)===`zh`,d=k(e=>e.setPageHeader),f=k(e=>e.clearPageHeader),[p,m]=(0,F.useState)(null),[ee,te]=(0,F.useState)([]),[ne,re]=(0,F.useState)(!0),[D,ie]=(0,F.useState)(null),[ae,A]=(0,F.useState)(!1),[M,N]=(0,F.useState)(!1),P=(0,F.useRef)(null),L=(0,F.useRef)(null),[se,ce]=(0,F.useState)(null),R=(0,F.useCallback)(e=>{L.current=e,ce(e?.closest(`[data-app-chat-shell]`)??null)},[]),B=(0,F.useRef)(null),V=(0,F.useRef)(null),H=p?.state===`ready`?p.conversationId:void 0,U=x(e=>{let t=H?e.panes[H]:void 0,n=t?.tabs.find(e=>e.id===t.activeId);return t?.open===!0&&(t.activeId===`personal-tasks`||t.personalDetailsOpen===!0&&(n?.kind===`file`||n?.kind===`browser`))}),{avatarState:W,summary:G,refreshWork:K,refreshPrompt:le}=g(H,l);_(H,K,le);let q=(0,F.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),J=(0,F.useCallback)(e=>{V.current=e,i.current.setMiniAnchor(e)},[]),Y=(0,F.useCallback)(()=>{H&&U&&x.getState().closePersonalTasks(H)},[H,U]),X=(0,F.useCallback)(()=>{i.current.minimize(),N(e=>!e)},[]),Z=(0,F.useCallback)(()=>{H&&(i.current.minimize(),N(!1),U?Y():x.getState().openPersonalTasks(H))},[Y,H,U]);(0,F.useEffect)(()=>{n.expanded&&N(!1)},[n.expanded]),(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;t&&m(t)};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let Q=(0,F.useCallback)(async()=>{try{let[e,t]=await Promise.all([c(o(`/api/personal-agent`)),c(o(`/api/personal-agent/models`))]);m(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),te(t.payload)}catch(e){ie(e instanceof Error?e.message:String(e))}finally{re(!1)}},[]);return(0,F.useEffect)(()=>{Q()},[Q]),(0,F.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=l?`语音通话`:`Voice call`,r=`touch-target inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full bg-surface-hover/90 px-3.5 text-sm font-medium text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent aria-expanded:bg-surface-active`,a=()=>{if(N(!1),!e)return;if(i.current.expanded){i.current.minimize();return}let t=L.current;i.current.open({conversationId:p.conversationId,name:p.displayName},t?{anchor:t,avatar:(0,I.jsx)(j,{appearance:p.appearance,agentId:p.agentId,className:`size-full`})}:void 0)},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return d({startExtra:null,personalChat:e?U?`controls`:`identity`:void 0,main:(0,I.jsxs)(`div`,{className:`flex min-w-0 justify-center`,children:[(0,I.jsx)(`h1`,{className:`sr-only`,children:s}),U?null:e?(0,I.jsxs)(`button`,{ref:B,type:`button`,"data-personal-tasks-trigger":!0,"aria-controls":`app-workspace-panel`,"aria-expanded":U,"aria-describedby":G?`personal-work-status`:void 0,"aria-label":l?`${s} 的任务`:`${s}'s tasks`,title:G||s,onClick:Z,className:`group/identity flex min-w-0 max-w-full flex-col items-center gap-1 rounded-2xl px-1.5 pb-0.5 text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:gap-1.5`,children:[(0,I.jsx)(`span`,{className:`relative grid size-16 shrink-0 place-items-center rounded-full border border-edge-subtle bg-surface-base transition-colors group-hover/identity:border-edge sm:size-20 @max-[26rem]/personal-chat:size-14`,children:(0,I.jsx)(j,{appearance:o,agentId:p.agentId,activity:W,className:`size-full`})}),(0,I.jsxs)(`span`,{className:`personal-identity-label max-w-full min-w-0 rounded-2xl px-3 py-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-[0.9375rem] leading-5 font-semibold text-fg sm:text-base`,children:s}),G?(0,I.jsxs)(`span`,{id:`personal-work-status`,role:`status`,className:`flex min-w-0 items-center justify-center gap-1.5 text-xs leading-4 text-fg-muted`,children:[W===`idle`?null:(0,I.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${W===`waiting`?`bg-warning`:`bg-accent`}`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`truncate`,children:G})]}):null]})]}):(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(j,{appearance:o,className:`size-8`}),(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:s})]})]}),end:e?(0,I.jsxs)(`div`,{ref:R,className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":n.expanded,onClick:a,className:r,"aria-label":t,title:t,children:[(0,I.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`通话`:`Call`})]}),(0,I.jsxs)(`button`,{ref:P,type:`button`,onClick:X,"aria-haspopup":`dialog`,"aria-expanded":M,className:r,"aria-label":l?`${s} 设置`:`${s} settings`,children:[(0,I.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`设置`:`Settings`})]})]}):null}),()=>f()},[W,f,p,R,d,M,G,U,X,Z,n.expanded,l]),ne?(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,I.jsx)(b,{className:`h-20 w-20 rounded-full`}),(0,I.jsx)(b,{className:`h-9 w-72`}),(0,I.jsx)(b,{className:`h-44 w-full rounded-2xl`})]}):D&&!p?(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,I.jsx)(`p`,{children:D}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Q(),className:`text-accent hover:underline`,children:l?`重试`:`Retry`})]}):p?.state===`ready`?(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ae&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,I.jsx)(`span`,{children:l?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{A(!1),q()},className:`shrink-0 text-accent hover:underline`,children:l?`打开设置`:`Open settings`})]}),(0,I.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(u,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,opening:l?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,I.jsxs)(w,{open:M,onOpenChange:N,children:[(0,I.jsx)(E,{virtualRef:L}),(0,I.jsx)(S,{children:(0,I.jsxs)(C,{ref:J,side:`bottom`,align:`end`,sideOffset:12,collisionPadding:12,collisionBoundary:se??void 0,"aria-label":l?`${p.displayName} 快捷设置`:`${p.displayName} quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(P.current?.contains(e.target)||B.current?.contains(e.target)||V.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} min-h-0 w-[min(27rem,calc(100vw-1.5rem))] max-w-[var(--radix-popover-content-available-width)] flex-col overflow-hidden rounded-[1.75rem] border border-edge-subtle bg-surface-overlay shadow-float outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 px-5 pb-2 pt-4`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:l?`快捷设置`:`Quick settings`}),(0,I.jsx)(T,{className:`touch-target -mr-2 rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l?`关闭设置`:`Close settings`,children:(0,I.jsx)(y,{className:`size-4`})})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pb-4 pt-2`,children:(0,I.jsx)(oe,{zh:l,onOpenVoiceServices:q})}),(0,I.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,I.jsx)(`button`,{type:`button`,onClick:q,className:`w-full rounded-full bg-surface-hover px-4 py-2.5 text-center text-sm font-medium text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:l?`更多设置`:`More settings`})})]})})]})]}):(0,I.jsx)(z,{modelsAvailable:ee.length>0,onCreated:(e,t)=>{m(e),A(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{B as PersonalPage};
@@ -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{t as r}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i,o as a}from"./locale-store-B4o4aDCg.js";import{t as o}from"./messages-hlOsXkQ7.js";import{n as s,r as c,t as l}from"./popover-select-CLsphyzA.js";import{t as u}from"./play-kxZvpBg8.js";import{t as d}from"./square-DMK_fB-3.js";import{t as f}from"./upload-rrb46c3c.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{n as m,t as h}from"./voice-CDlC6XMH.js";import{D as g,p as _,t as v}from"./session-manager-fvJusKsK.js";import{t as y}from"./composer-model-config-control-BFC8jNyK.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-ChmVQg9O.js";import{u as S}from"./use-realtime-voice-tyo85cre.js";import{s as C}from"./agent-avatar-display-BDHjRaTK.js";import{t as w}from"./personal-avatar-D5VUVQGE.js";import{d as T,i as E,n as D,r as O,t as k}from"./voice-config-api-B1RtxiRq.js";var A=e(t(),1),j=n();function M({preferences:e,settings:t,failed:n,disabled:r,zh:i,onChange:a,onOpenServices:o,children:l}){let[u,d]=(0,A.useState)(null),f=(0,A.useRef)(0),g=u??e?.enginePreference??`auto`;async function _(e){if(e===g)return;let t=++f.current;d(e);try{await a({enginePreference:e})}finally{t===f.current&&d(null)}}let v=t?.defaultForNatural?h:t?.legacyModel,y=e?.naturalModel,b=y??v,S=b===h,C=t?.naturalModels??(t?.legacyModel?[{id:t.legacyModel,name:t.legacyModelLabel??t.legacyModel,tools:void 0}]:[]),w=C.find(e=>e.id===b),T=y&&y!==`boson/higgs-realtime`&&!C.some(e=>e.id===y);return(0,j.jsx)(`section`,{className:`space-y-3`,"aria-label":i?`语音通话设置`:`Voice call settings`,children:(0,j.jsxs)(`fieldset`,{disabled:r,className:`space-y-3`,children:[(0,j.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{children:i?`通话引擎`:`Call engine`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`通话引擎`:`Call engine`,value:g,onChange:e=>{_(e.target.value)},children:[(0,j.jsx)(c,{value:`auto`,children:i?`自动选择`:`Automatic`}),(0,j.jsx)(c,{value:`natural`,children:i?`实时语音`:`Realtime voice`}),(0,j.jsx)(c,{value:`assistant`,children:i?`助手语音`:`Assistant voice`})]})]}),(0,j.jsx)(`div`,{inert:g===`natural`,"aria-hidden":g===`natural`,className:g===`natural`?`hidden`:``,children:l(g!==`natural`)}),(0,j.jsxs)(`div`,{inert:g===`assistant`,"aria-hidden":g===`assistant`,className:`space-y-3 ${g===`assistant`?`hidden`:``}`,children:[!t&&!n&&(0,j.jsx)(p,{className:`h-10 w-full`}),n&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i?`无法读取自然语音模型。`:`Could not load natural voice models.`}),t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`通话模型`:`Call model`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音模型`:`Natural voice model`,value:y??`inherit`,onChange:e=>a({naturalModel:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统`:`Follow system`,v?` · ${v===`boson/higgs-realtime`?`Higgs Realtime`:t.legacyModelLabel??v}`:``]}),C.map(e=>(0,j.jsxs)(c,{value:e.id,children:[e.name,e.tools===!1?i?` · 仅对话`:` · Conversation only`:``]},e.id)),(t.credentialSource||y===`boson/higgs-realtime`)&&(0,j.jsx)(c,{value:`boson/higgs-realtime`,children:`Higgs Realtime`}),T&&(0,j.jsxs)(c,{value:y,children:[y,` · `,i?`不可用`:`Unavailable`]})]}),w?.tools===!1&&(0,j.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`此模型仅支持语音交流,不能交办任务。自动选择时会使用具备行动能力的备用引擎。`:`This model supports conversation only. Automatic selection uses the fallback Agent engine to retain actions.`})]}),S&&(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`声音`:`Voice`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音音色`:`Natural voice`,value:e?.higgsVoice??`inherit`,onChange:e=>a({higgsVoice:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统音色`:`Follow system voice`,` · `,t.voice==="default"?i?`模型默认`:`Model default`:t.voice]}),m.map(e=>(0,j.jsx)(c,{value:e,children:e==="default"?i?`模型默认`:`Model default`:e},e))]})]}),o&&(!b||T||S&&!t.credentialSource)&&(0,j.jsx)(x,{type:`button`,variant:`ghost`,onClick:o,children:i?`设置自然语音服务`:`Set up natural voice`})]})]})]})})}var N=new v;function P({conversationId:e,zh:t,onSaved:n}){let r=g(t=>t.sessions[e]),[i,a]=(0,A.useState)(!0),[s,c]=(0,A.useState)(``);(0,A.useEffect)(()=>{let t=!0;return N.loadSessionAgentConfig(e).then(n=>{t&&_(e,n)}).catch(e=>{t&&c(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){g.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{_(e,await N.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await N.loadSessionAgentConfig(e).catch(()=>null);throw n&&_(e,n),t}finally{g.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型`:`Chat model`}),i?(0,j.jsx)(p,{className:`h-9 w-full`}):(0,j.jsx)(y,{chat:o(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),s&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:s})]})}function F({record:e,zh:t,onSelectVoice:n,onGreetingChange:i,onOpenServices:a,active:o=!0}){let[s,c]=(0,A.useState)(!1),[f,m]=(0,A.useState)(!0),[h,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)([]),[x,C]=(0,A.useState)(e.voicePreference?.voice??``),[w,D]=(0,A.useState)(!1),[k,M]=(0,A.useState)(null),[N,P]=(0,A.useState)(null),[F,I]=(0,A.useState)(null),L=(0,A.useRef)(null),R=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await O();if(e||(c(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};v(n);let r=await E(n.provider,n.model,`realtime`);e||b(r)}catch(t){e||P(t instanceof Error?t.message:String(t))}finally{e||m(!1)}})(),()=>{e=!0}},[]),(0,A.useEffect)(()=>()=>{R.current?.abort(),L.current?.close()},[]);let z=(0,A.useCallback)(()=>{R.current?.abort(),R.current=null,L.current?.close(),L.current=null,I(null)},[]);(0,A.useEffect)(()=>{o||z()},[o,z]);let B=async e=>{if(F!==null){z();return}z(),P(null);let n=new AbortController;R.current=n,I(e);try{let t=new S;L.current=t,await t.start();let r=await T(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{R.current===n&&(I(null),R.current=null,L.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;P(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}R.current===n&&z()}},V=async e=>{if(w||e===x)return;z();let t=x;C(e),g(``),D(!0),P(null);try{await n(e&&_?{provider:_.provider,model:_.model,voice:e}:null)||C(t)}catch(e){C(t),P(e instanceof Error?e.message:String(e))}finally{D(!1)}},H=y.find(e=>e.id===x),U=t?`默认声音`:`Default voice`,W=H?.name||(x?t?`当前音色不可用`:`Current voice unavailable`:U),G=h.trim().toLocaleLowerCase(),K=y.filter(e=>!G||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(G)).map(e=>({value:e.id,label:e.name}));return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h4`,{className:`text-sm text-fg`,children:t?`声音`:`Voice`}),f?(0,j.jsx)(`div`,{className:`mt-1`,"aria-busy":`true`,children:(0,j.jsx)(p,{className:`h-10 w-full`})}):_&&y.length?(0,j.jsxs)(`div`,{className:`mt-1 space-y-2`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(l,{value:x,selectedLabel:W,options:K,side:`top`,placeholder:U,emptyLabel:U,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:w,onChange:e=>void V(e),searchPlaceholder:y.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:h,onSearchChange:g,statusMessage:G&&!K.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,j.jsxs)(`button`,{type:`button`,disabled:w||!!(x&&!H),onClick:()=>void B(x),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,"aria-label":F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,children:[F===null?(0,j.jsx)(u,{className:`size-4`,"aria-hidden":!0}):(0,j.jsx)(d,{className:`size-4 text-accent`,"aria-hidden":!0}),F===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(H?.description||H?.style||!x)&&(0,j.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:H?.description||H?.style||(t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,j.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,a?(0,j.jsx)(`button`,{type:`button`,onClick:a,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`}):(0,j.jsx)(r,{to:`/settings/personal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),i&&s&&(0,j.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`接通时问候`:`Greet me when connected`,(0,j.jsx)(`input`,{type:`checkbox`,checked:k??e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:w||k!==null,onChange:e=>{let t=e.target.checked;M(t),i(t).catch(e=>P(String(e))).finally(()=>M(null))}})]}),N&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:N})]})}var I=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function L({zh:e,onOpenVoiceServices:t}){let[n,o]=(0,A.useState)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(Promise.resolve()),[l,u]=(0,A.useState)(!0),[d,m]=(0,A.useState)(0),[h,g]=(0,A.useState)(null),[_,v]=(0,A.useState)(`loopi`),[y,x]=(0,A.useState)(!1),S=(0,A.useRef)(null),[T,E]=(0,A.useState)(``),[O,N]=(0,A.useState)(!1),L=(0,A.useCallback)(async()=>{g(null);try{let e=await a(i(`/api/personal-agent`));s.current=e.payload,o(e.payload),e.payload&&(E(e.payload.displayName),v(e.payload.appearance))}catch(e){g(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]);(0,A.useEffect)(()=>{L()},[L]),(0,A.useEffect)(()=>{let e=e=>{let t=e.detail;t&&(t.displayName!==s.current?.displayName&&E(t.displayName),t.appearance!==s.current?.appearance&&v(t.appearance),s.current=t,o(t))};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let{data:R,error:z}=b(n?.state===`ready`?i(k):null,D),B=(0,A.useCallback)((e,t=!0)=>{t&&m(e=>e+1),g(null);let n=c.current.then(async()=>{let t=s.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,c=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(c)===JSON.stringify(t.voicePreference)&&!e.voiceCallPreferences)return!0;try{let l=await a(i(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:c},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return s.current=l.payload,o(l.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:l.payload})),!0}catch(e){return g(e instanceof Error?e.message:String(e)),!1}}).finally(()=>{t&&m(e=>e-1)});return c.current=n,n},[]),V=async t=>{if(!n||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){g(e?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(t.size===0||t.size>512*1024){g(e?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}x(!0),g(null);try{let e=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await a(i(`/api/agents/${encodeURIComponent(n.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:e.slice(e.indexOf(`,`)+1),mimeType:t.type})}),C(n.agentId),v(`custom`),N(!1),await B({appearance:`custom`})}catch(e){g(e instanceof Error?e.message:String(e))}finally{x(!1)}};return l?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(p,{className:`h-20 w-full`}),(0,j.jsx)(p,{className:`h-48 w-full`})]}):n?.state===`ready`?(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":e?`Ada 资料与通话设置`:`Ada profile and call settings`,children:[(0,j.jsxs)(`div`,{className:`relative flex flex-col items-center text-center`,children:[(0,j.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>N(e=>!e),"aria-expanded":O,"aria-controls":`personal-appearance-options`,"aria-label":e?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,j.jsx)(w,{appearance:_,agentId:n.agentId,className:`size-16`})}),(0,j.jsx)(`input`,{id:`personal-name`,"aria-label":e?`助手名称`:`Assistant name`,value:T,onChange:e=>E(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(E(t),B({displayName:t})):E(s.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=s.current?.displayName??``,E(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,j.jsxs)(`div`,{className:`space-y-5`,children:[h&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),O&&(0,j.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:e?`形象`:`Appearance`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[I.map(t=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{v(t.id),N(!1),B({appearance:t.id})},"aria-pressed":_===t.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_===t.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${t.color}`,children:(0,j.jsx)(w,{appearance:t.id,className:`size-8`})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e?t.zh:t.en})]},t.id)),(0,j.jsx)(`input`,{ref:S,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":e?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&V(t),e.currentTarget.value=``}}),(0,j.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>S.current?.click(),"aria-pressed":_===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${_===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:_===`custom`?(0,j.jsx)(w,{appearance:`custom`,agentId:n.agentId,className:`size-8`}):(0,j.jsx)(f,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:y?e?`上传中…`:`Uploading…`:e?`上传`:`Upload`})]})]})]}),(0,j.jsx)(P,{conversationId:n.conversationId,zh:e,onSaved:async()=>{let e=await a(i(`/api/personal-agent`));e.ok&&e.payload&&(s.current=e.payload,o(e.payload))}}),(0,j.jsx)(M,{preferences:n.voiceCallPreferences,settings:R,failed:!!z,disabled:d>0,zh:e,onOpenServices:t,onChange:e=>B({voiceCallPreferences:e},e.enginePreference===void 0),children:r=>(0,j.jsx)(F,{active:r,onOpenServices:t,onGreetingChange:e=>B({voiceCallPreferences:{openingGreetingEnabled:e}},!1),record:n,zh:e,onSelectVoice:e=>B({voicePreference:e})})})]})]}):(0,j.jsxs)(`div`,{className:`space-y-3 text-sm text-fg-muted`,children:[h?(0,j.jsx)(`p`,{role:`alert`,children:h}):null,(0,j.jsx)(r,{to:`/personal`,className:`text-accent hover:underline`,children:e?`前往 Ada 完成设置`:`Finish setting up Ada`}),h?(0,j.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`ml-3 text-accent hover:underline`,children:e?`重试`:`Retry`}):null]})}export{L 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{t as r}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{i,o as a}from"./locale-store-B4o4aDCg.js";import{t as o}from"./messages-hlOsXkQ7.js";import{n as s,r as c,t as l}from"./popover-select-hRG1EzAY.js";import{t as u}from"./play-kxZvpBg8.js";import{t as d}from"./square-DMK_fB-3.js";import{t as f}from"./upload-rrb46c3c.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{n as m,t as h}from"./voice-CDlC6XMH.js";import{D as g,p as _,t as v}from"./session-manager-1UFhZMpv.js";import{t as y}from"./composer-model-config-control-Bnx68cDQ.js";import{i as b}from"./vendor-swr-CdRzEUwF.js";import{t as x}from"./button-C5tRaJxt.js";import{u as S}from"./use-realtime-voice-CJD_ABL6.js";import{s as C}from"./agent-avatar-display-BDHjRaTK.js";import{t as w}from"./personal-avatar-D5VUVQGE.js";import{d as T,i as E,n as D,r as O,t as k}from"./voice-config-api-B1RtxiRq.js";var A=e(t(),1),j=n();function M({preferences:e,settings:t,failed:n,disabled:r,zh:i,onChange:a,onOpenServices:o,children:l}){let[u,d]=(0,A.useState)(null),f=(0,A.useRef)(0),g=u??e?.enginePreference??`auto`;async function _(e){if(e===g)return;let t=++f.current;d(e);try{await a({enginePreference:e})}finally{t===f.current&&d(null)}}let v=t?.defaultForNatural?h:t?.legacyModel,y=e?.naturalModel,b=y??v,S=b===h,C=t?.naturalModels??(t?.legacyModel?[{id:t.legacyModel,name:t.legacyModelLabel??t.legacyModel,tools:void 0}]:[]),w=C.find(e=>e.id===b),T=y&&y!==`boson/higgs-realtime`&&!C.some(e=>e.id===y);return(0,j.jsx)(`section`,{className:`space-y-3`,"aria-label":i?`语音通话设置`:`Voice call settings`,children:(0,j.jsxs)(`fieldset`,{disabled:r,className:`space-y-3`,children:[(0,j.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{children:i?`通话引擎`:`Call engine`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`通话引擎`:`Call engine`,value:g,onChange:e=>{_(e.target.value)},children:[(0,j.jsx)(c,{value:`auto`,children:i?`自动选择`:`Automatic`}),(0,j.jsx)(c,{value:`natural`,children:i?`实时语音`:`Realtime voice`}),(0,j.jsx)(c,{value:`assistant`,children:i?`助手语音`:`Assistant voice`})]})]}),(0,j.jsx)(`div`,{inert:g===`natural`,"aria-hidden":g===`natural`,className:g===`natural`?`hidden`:``,children:l(g!==`natural`)}),(0,j.jsxs)(`div`,{inert:g===`assistant`,"aria-hidden":g===`assistant`,className:`space-y-3 ${g===`assistant`?`hidden`:``}`,children:[!t&&!n&&(0,j.jsx)(p,{className:`h-10 w-full`}),n&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i?`无法读取自然语音模型。`:`Could not load natural voice models.`}),t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`通话模型`:`Call model`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音模型`:`Natural voice model`,value:y??`inherit`,onChange:e=>a({naturalModel:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统`:`Follow system`,v?` · ${v===`boson/higgs-realtime`?`Higgs Realtime`:t.legacyModelLabel??v}`:``]}),C.map(e=>(0,j.jsxs)(c,{value:e.id,children:[e.name,e.tools===!1?i?` · 仅对话`:` · Conversation only`:``]},e.id)),(t.credentialSource||y===`boson/higgs-realtime`)&&(0,j.jsx)(c,{value:`boson/higgs-realtime`,children:`Higgs Realtime`}),T&&(0,j.jsxs)(c,{value:y,children:[y,` · `,i?`不可用`:`Unavailable`]})]}),w?.tools===!1&&(0,j.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`此模型仅支持语音交流,不能交办任务。自动选择时会使用具备行动能力的备用引擎。`:`This model supports conversation only. Automatic selection uses the fallback Agent engine to retain actions.`})]}),S&&(0,j.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,j.jsx)(`span`,{className:`block`,children:i?`声音`:`Voice`}),(0,j.jsxs)(s,{side:`top`,"aria-label":i?`自然语音音色`:`Natural voice`,value:e?.higgsVoice??`inherit`,onChange:e=>a({higgsVoice:e.target.value===`inherit`?null:e.target.value}),children:[(0,j.jsxs)(c,{value:`inherit`,children:[i?`跟随系统音色`:`Follow system voice`,` · `,t.voice==="default"?i?`模型默认`:`Model default`:t.voice]}),m.map(e=>(0,j.jsx)(c,{value:e,children:e==="default"?i?`模型默认`:`Model default`:e},e))]})]}),o&&(!b||T||S&&!t.credentialSource)&&(0,j.jsx)(x,{type:`button`,variant:`ghost`,onClick:o,children:i?`设置自然语音服务`:`Set up natural voice`})]})]})]})})}var N=new v;function P({conversationId:e,zh:t,onSaved:n}){let r=g(t=>t.sessions[e]),[i,a]=(0,A.useState)(!0),[s,c]=(0,A.useState)(``);(0,A.useEffect)(()=>{let t=!0;return N.loadSessionAgentConfig(e).then(n=>{t&&_(e,n)}).catch(e=>{t&&c(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){g.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{_(e,await N.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await N.loadSessionAgentConfig(e).catch(()=>null);throw n&&_(e,n),t}finally{g.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型`:`Chat model`}),i?(0,j.jsx)(p,{className:`h-9 w-full`}):(0,j.jsx)(y,{chat:o(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),s&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:s})]})}function F({record:e,zh:t,onSelectVoice:n,onGreetingChange:i,onOpenServices:a,active:o=!0}){let[s,c]=(0,A.useState)(!1),[f,m]=(0,A.useState)(!0),[h,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(null),[y,b]=(0,A.useState)([]),[x,C]=(0,A.useState)(e.voicePreference?.voice??``),[w,D]=(0,A.useState)(!1),[k,M]=(0,A.useState)(null),[N,P]=(0,A.useState)(null),[F,I]=(0,A.useState)(null),L=(0,A.useRef)(null),R=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await O();if(e||(c(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};v(n);let r=await E(n.provider,n.model,`realtime`);e||b(r)}catch(t){e||P(t instanceof Error?t.message:String(t))}finally{e||m(!1)}})(),()=>{e=!0}},[]),(0,A.useEffect)(()=>()=>{R.current?.abort(),L.current?.close()},[]);let z=(0,A.useCallback)(()=>{R.current?.abort(),R.current=null,L.current?.close(),L.current=null,I(null)},[]);(0,A.useEffect)(()=>{o||z()},[o,z]);let B=async e=>{if(F!==null){z();return}z(),P(null);let n=new AbortController;R.current=n,I(e);try{let t=new S;L.current=t,await t.start();let r=await T(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{R.current===n&&(I(null),R.current=null,L.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;P(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}R.current===n&&z()}},V=async e=>{if(w||e===x)return;z();let t=x;C(e),g(``),D(!0),P(null);try{await n(e&&_?{provider:_.provider,model:_.model,voice:e}:null)||C(t)}catch(e){C(t),P(e instanceof Error?e.message:String(e))}finally{D(!1)}},H=y.find(e=>e.id===x),U=t?`默认声音`:`Default voice`,W=H?.name||(x?t?`当前音色不可用`:`Current voice unavailable`:U),G=h.trim().toLocaleLowerCase(),K=y.filter(e=>!G||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(G)).map(e=>({value:e.id,label:e.name}));return(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h4`,{className:`text-sm text-fg`,children:t?`声音`:`Voice`}),f?(0,j.jsx)(`div`,{className:`mt-1`,"aria-busy":`true`,children:(0,j.jsx)(p,{className:`h-10 w-full`})}):_&&y.length?(0,j.jsxs)(`div`,{className:`mt-1 space-y-2`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(l,{value:x,selectedLabel:W,options:K,side:`top`,placeholder:U,emptyLabel:U,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:w,onChange:e=>void V(e),searchPlaceholder:y.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:h,onSearchChange:g,statusMessage:G&&!K.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,j.jsxs)(`button`,{type:`button`,disabled:w||!!(x&&!H),onClick:()=>void B(x),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,"aria-label":F===null?t?`试听${W}`:`Preview ${W}`:t?`停止试听`:`Stop preview`,children:[F===null?(0,j.jsx)(u,{className:`size-4`,"aria-hidden":!0}):(0,j.jsx)(d,{className:`size-4 text-accent`,"aria-hidden":!0}),F===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(H?.description||H?.style||!x)&&(0,j.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:H?.description||H?.style||(t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,j.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,a?(0,j.jsx)(`button`,{type:`button`,onClick:a,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`}):(0,j.jsx)(r,{to:`/settings/personal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),i&&s&&(0,j.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`接通时问候`:`Greet me when connected`,(0,j.jsx)(`input`,{type:`checkbox`,checked:k??e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:w||k!==null,onChange:e=>{let t=e.target.checked;M(t),i(t).catch(e=>P(String(e))).finally(()=>M(null))}})]}),N&&(0,j.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:N})]})}var I=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function L({zh:e,onOpenVoiceServices:t}){let[n,o]=(0,A.useState)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(Promise.resolve()),[l,u]=(0,A.useState)(!0),[d,m]=(0,A.useState)(0),[h,g]=(0,A.useState)(null),[_,v]=(0,A.useState)(`loopi`),[y,x]=(0,A.useState)(!1),S=(0,A.useRef)(null),[T,E]=(0,A.useState)(``),[O,N]=(0,A.useState)(!1),L=(0,A.useCallback)(async()=>{g(null);try{let e=await a(i(`/api/personal-agent`));s.current=e.payload,o(e.payload),e.payload&&(E(e.payload.displayName),v(e.payload.appearance))}catch(e){g(e instanceof Error?e.message:String(e))}finally{u(!1)}},[]);(0,A.useEffect)(()=>{L()},[L]),(0,A.useEffect)(()=>{let e=e=>{let t=e.detail;t&&(t.displayName!==s.current?.displayName&&E(t.displayName),t.appearance!==s.current?.appearance&&v(t.appearance),s.current=t,o(t))};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let{data:R,error:z}=b(n?.state===`ready`?i(k):null,D),B=(0,A.useCallback)((e,t=!0)=>{t&&m(e=>e+1),g(null);let n=c.current.then(async()=>{let t=s.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,c=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(c)===JSON.stringify(t.voicePreference)&&!e.voiceCallPreferences)return!0;try{let l=await a(i(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:c},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return s.current=l.payload,o(l.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:l.payload})),!0}catch(e){return g(e instanceof Error?e.message:String(e)),!1}}).finally(()=>{t&&m(e=>e-1)});return c.current=n,n},[]),V=async t=>{if(!n||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){g(e?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(t.size===0||t.size>512*1024){g(e?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}x(!0),g(null);try{let e=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await a(i(`/api/agents/${encodeURIComponent(n.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:e.slice(e.indexOf(`,`)+1),mimeType:t.type})}),C(n.agentId),v(`custom`),N(!1),await B({appearance:`custom`})}catch(e){g(e instanceof Error?e.message:String(e))}finally{x(!1)}};return l?(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(p,{className:`h-20 w-full`}),(0,j.jsx)(p,{className:`h-48 w-full`})]}):n?.state===`ready`?(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":e?`Ada 资料与通话设置`:`Ada profile and call settings`,children:[(0,j.jsxs)(`div`,{className:`relative flex flex-col items-center text-center`,children:[(0,j.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>N(e=>!e),"aria-expanded":O,"aria-controls":`personal-appearance-options`,"aria-label":e?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,j.jsx)(w,{appearance:_,agentId:n.agentId,className:`size-16`})}),(0,j.jsx)(`input`,{id:`personal-name`,"aria-label":e?`助手名称`:`Assistant name`,value:T,onChange:e=>E(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(E(t),B({displayName:t})):E(s.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=s.current?.displayName??``,E(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,j.jsxs)(`div`,{className:`space-y-5`,children:[h&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),O&&(0,j.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,j.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:e?`形象`:`Appearance`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[I.map(t=>(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{v(t.id),N(!1),B({appearance:t.id})},"aria-pressed":_===t.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_===t.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${t.color}`,children:(0,j.jsx)(w,{appearance:t.id,className:`size-8`})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e?t.zh:t.en})]},t.id)),(0,j.jsx)(`input`,{ref:S,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":e?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&V(t),e.currentTarget.value=``}}),(0,j.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>S.current?.click(),"aria-pressed":_===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${_===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,j.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:_===`custom`?(0,j.jsx)(w,{appearance:`custom`,agentId:n.agentId,className:`size-8`}):(0,j.jsx)(f,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,j.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:y?e?`上传中…`:`Uploading…`:e?`上传`:`Upload`})]})]})]}),(0,j.jsx)(P,{conversationId:n.conversationId,zh:e,onSaved:async()=>{let e=await a(i(`/api/personal-agent`));e.ok&&e.payload&&(s.current=e.payload,o(e.payload))}}),(0,j.jsx)(M,{preferences:n.voiceCallPreferences,settings:R,failed:!!z,disabled:d>0,zh:e,onOpenServices:t,onChange:e=>B({voiceCallPreferences:e},e.enginePreference===void 0),children:r=>(0,j.jsx)(F,{active:r,onOpenServices:t,onGreetingChange:e=>B({voiceCallPreferences:{openingGreetingEnabled:e}},!1),record:n,zh:e,onSelectVoice:e=>B({voicePreference:e})})})]})]}):(0,j.jsxs)(`div`,{className:`space-y-3 text-sm text-fg-muted`,children:[h?(0,j.jsx)(`p`,{role:`alert`,children:h}):null,(0,j.jsx)(r,{to:`/personal`,className:`text-accent hover:underline`,children:e?`前往 Ada 完成设置`:`Finish setting up Ada`}),h?(0,j.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`ml-3 text-accent hover:underline`,children:e?`重试`:`Retry`}):null]})}export{L 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{i,n as a,o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./popover-select-CLsphyzA.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{gt as l}from"./session-manager-fvJusKsK.js";import{t as u}from"./voice-settings-DOajN2ay.js";import{t as d}from"./use-personal-profile-DdjQjf9I.js";import{n as f,t as p}from"./settings-page-header-DKgbD0Bc.js";import"./settings-page-layout-BE3vLWp_.js";import{t as m}from"./personal-profile-settings-Cd2xUVbw.js";var h=n(),g=e(t(),1),_=r();function v(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var y=v();function b({zh:e}){let[t,n]=(0,g.useState)(),[r,a]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(``),m=f.trim().toLowerCase().replaceAll(`_`,` `),h=[...new Set([...y,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(m)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,g.useEffect)(()=>{let e=!0;return o(i(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(l.parse(t.payload))}).catch(t=>{e&&a(String(t))}),()=>{e=!1}},[]);async function v(e){if(!(!t||u)){d(!0),a(``);try{let r=await o(i(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(l.parse(r.payload))}catch(e){a(String(e));let t=await o(i(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(l.parse(t.payload))}finally{d(!1)}}}return(0,_.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,_.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,_.jsx)(c,{className:`h-9 w-full`}):t&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void v({mode:e})}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,_.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,_.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void v({quietStart:Number(e)})})]}),(0,_.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,_.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void v({quietEnd:Number(e)})})]})]}),(0,_.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,_.jsx)(s,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:h,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:h.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&v({timezone:e})}})]}),(0,_.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,_.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function x(){let e=(0,h.c)(22),{displayName:t}=d(),n=a(S)===`zh`,[r,i]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{i(!0),s(!0)},e[0]=c):c=e[0];let l=c,v;e[1]===t?v=e[2]:(v=(0,_.jsx)(p,{title:t}),e[1]=t,e[2]=v);let y,x;e[3]===n?(y=e[4],x=e[5]):(y=(0,_.jsx)(m,{zh:n,onOpenVoiceServices:l}),x=(0,_.jsx)(b,{zh:n}),e[3]=n,e[4]=y,e[5]=x);let C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{i(e.currentTarget.open),e.currentTarget.open&&s(!0)},e[6]=C):C=e[6];let w=n?`语音服务设置`:`Voice service settings`,T;e[7]===w?T=e[8]:(T=(0,_.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:w}),e[7]=w,e[8]=T);let E;e[9]===o?E=e[10]:(E=o&&(0,_.jsx)(u,{capability:`conversation`}),e[9]=o,e[10]=E);let D;e[11]===E?D=e[12]:(D=(0,_.jsx)(`div`,{className:`mt-4`,children:E}),e[11]=E,e[12]=D);let O;e[13]!==r||e[14]!==T||e[15]!==D?(O=(0,_.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,open:r,onToggle:C,children:[T,D]}),e[13]=r,e[14]=T,e[15]=D,e[16]=O):O=e[16];let k;return e[17]!==v||e[18]!==y||e[19]!==x||e[20]!==O?(k=(0,_.jsxs)(f,{children:[v,y,x,O]}),e[17]=v,e[18]=y,e[19]=x,e[20]=O,e[21]=k):k=e[21],k}function S(e){return e.language}export{x as PersonalSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./popover-select-hRG1EzAY.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{gt as l}from"./session-manager-1UFhZMpv.js";import{t as u}from"./voice-settings-WIooh0DA.js";import{t as d}from"./use-personal-profile-DdjQjf9I.js";import{n as f,t as p}from"./settings-page-header-C9xiCwzq.js";import"./settings-page-layout-DTOBegnh.js";import{t as m}from"./personal-profile-settings-BlsS-2z3.js";var h=n(),g=e(t(),1),_=r();function v(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var y=v();function b({zh:e}){let[t,n]=(0,g.useState)(),[r,a]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(``),m=f.trim().toLowerCase().replaceAll(`_`,` `),h=[...new Set([...y,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(m)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,g.useEffect)(()=>{let e=!0;return o(i(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(l.parse(t.payload))}).catch(t=>{e&&a(String(t))}),()=>{e=!1}},[]);async function v(e){if(!(!t||u)){d(!0),a(``);try{let r=await o(i(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(l.parse(r.payload))}catch(e){a(String(e));let t=await o(i(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(l.parse(t.payload))}finally{d(!1)}}}return(0,_.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,_.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,_.jsx)(c,{className:`h-9 w-full`}):t&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void v({mode:e})}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,_.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,_.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void v({quietStart:Number(e)})})]}),(0,_.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,_.jsx)(s,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void v({quietEnd:Number(e)})})]})]}),(0,_.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,_.jsx)(s,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:h,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:h.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&v({timezone:e})}})]}),(0,_.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,_.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function x(){let e=(0,h.c)(22),{displayName:t}=d(),n=a(S)===`zh`,[r,i]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{i(!0),s(!0)},e[0]=c):c=e[0];let l=c,v;e[1]===t?v=e[2]:(v=(0,_.jsx)(p,{title:t}),e[1]=t,e[2]=v);let y,x;e[3]===n?(y=e[4],x=e[5]):(y=(0,_.jsx)(m,{zh:n,onOpenVoiceServices:l}),x=(0,_.jsx)(b,{zh:n}),e[3]=n,e[4]=y,e[5]=x);let C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{i(e.currentTarget.open),e.currentTarget.open&&s(!0)},e[6]=C):C=e[6];let w=n?`语音服务设置`:`Voice service settings`,T;e[7]===w?T=e[8]:(T=(0,_.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:w}),e[7]=w,e[8]=T);let E;e[9]===o?E=e[10]:(E=o&&(0,_.jsx)(u,{capability:`conversation`}),e[9]=o,e[10]=E);let D;e[11]===E?D=e[12]:(D=(0,_.jsx)(`div`,{className:`mt-4`,children:E}),e[11]=E,e[12]=D);let O;e[13]!==r||e[14]!==T||e[15]!==D?(O=(0,_.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,open:r,onToggle:C,children:[T,D]}),e[13]=r,e[14]=T,e[15]=D,e[16]=O):O=e[16];let k;return e[17]!==v||e[18]!==y||e[19]!==x||e[20]!==O?(k=(0,_.jsxs)(f,{children:[v,y,x,O]}),e[17]=v,e[18]=y,e[19]=x,e[20]=O,e[21]=k):k=e[21],k}function S(e){return e.language}export{x as PersonalSettingsPanel};
@@ -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,o as a}from"./locale-store-B4o4aDCg.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./refresh-cw-BRlGaq2w.js";import{t as u}from"./wrench-DFb4r8bH.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-ChmVQg9O.js";import{a as m}from"./runtime-tools-api-CFvov9Uy.js";var h=e(t(),1),g=()=>r(`/api/runtime-tools/phone-dependencies`);async function _(){return(await a(g())).payload}async function v(e){await a(r(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function y(e,t,n,r){return m({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var b=n();function x({cloudOnly:e=!1,onChanged:t,expanded:n=!0,onExpandedChange:r,initialPlatform:a=`android`}){let m=i(e=>e.language)===`zh`,[x,S]=(0,h.useState)(a),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)({adb:``,scrcpy:``,hdc:``,hoscrcpy:``,java:``}),[j,M]=(0,h.useState)(),[N,P]=(0,h.useState)(``),[F,I]=(0,h.useState)(!1),{data:L,error:R,mutate:z}=f(g(),_,{refreshInterval:T?2500:0}),B=m?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},V=m?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function H(e,n){E(e),I(!1),P(``),M(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(k.adb.trim()):await y(e,n===`existing`?`import`:n,M,n===`existing`?k.scrcpy.trim():void 0),await z(),t?.(),P(m?`依赖已就绪。`:`Dependency is ready.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0)}}let U=t=>x===`harmonyos`?[`hdc`,`hoscrcpy`,`java`].includes(t):t===`scrcpy`||t===`adb`&&(!e||D),W=L?.statuses.filter(e=>U(e.kind));async function G(){w(!0),I(!1),P(``);try{for(let e of[`hdc`,`java`,`hoscrcpy`])if((await _()).statuses.find(t=>t.kind===e)?.state!==`ready`&&(E(e),await y(e,`install`,M),!(await _()).statuses.some(t=>t.kind===e&&t.state===`ready`)))throw Error(m?`${e} 安装后验证未通过。`:`${e} failed validation after installation.`);P(m?`鸿蒙连接组件已就绪,可以连接手机。`:`HarmonyOS components are ready. Connect your phone.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0),w(!1),await z(),t?.()}}let K=!!(W?.length&&W.every(e=>e.state===`ready`));return(0,b.jsxs)(`details`,{open:n,onToggle:e=>{e.currentTarget.open!==n&&r?.(e.currentTarget.open)},className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":m?`手机依赖状态`:`Phone dependencies`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,b.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:m?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${R?`text-danger`:`text-fg-muted`}`,children:[K&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),R?m?`检测失败`:`Check failed`:L?K?m?`已就绪`:`Ready`:m?`需要配置`:`Setup needed`:m?`检测中`:`Checking`]}),(0,b.jsx)(o,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-4 sm:p-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(p,{variant:`ghost`,"aria-label":m?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!T,onClick:()=>void z(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),L?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,(0,b.jsx)(`div`,{className:`flex gap-2`,role:`group`,"aria-label":m?`手机系统`:`Phone platform`,children:[`android`,`harmonyos`].map(e=>(0,b.jsx)(p,{variant:x===e?`secondary`:`ghost`,disabled:!!T||C,"aria-pressed":x===e,onClick:()=>S(e),children:e===`android`?`Android`:m?`鸿蒙`:`HarmonyOS`},e))}),x===`harmonyos`?(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`无需安装 DevEco Studio。HDC 只下载当前电脑的可执行文件和 USB 库,约 6 MB;Java 和投屏库独立安装。`:`No DevEco Studio required. HDC downloads only the executable and USB library for this computer, about 6 MB. Java and the video library are installed separately.`}),(0,b.jsxs)(p,{disabled:!!T||C||!W?.some(e=>e.state!==`ready`&&e.canInstall),onClick:()=>void G(),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),C?m?`正在安装鸿蒙组件…`:`Installing HarmonyOS components…`:m?`一键安装缺失组件`:`Install missing components`]})]}):null,e&&x===`android`?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:m?`阿里云连接无需本机 ADB;实时视频、持续触控和中文输入需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video, continuous touch and Unicode input require scrcpy server.`}),(0,b.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":D,onClick:()=>O(e=>!e),children:D?m?`收起本机连接依赖`:`Hide local connection dependencies`:m?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,R?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):L?L.statuses.filter(e=>U(e.kind)).map(e=>{let t={adb:`ADB · Android Platform Tools`,scrcpy:`scrcpy server`,hdc:`HDC · OpenHarmony`,hoscrcpy:`HOScrcpy · 1.0.18-beta`,java:`Java · Amazon Corretto JDK`}[e.kind];return(0,b.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:t}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[B[e.state],e.version?` · ${e.version}`:` · ${m?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?m?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?m?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(p,{disabled:!!T||C||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void H(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),T===e.kind||e.state===`installing`?m?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?m?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?m?`修复托管安装`:`Repair managed copy`:m?`安装`:`Install`]})]}),e.distribution?(0,b.jsx)(`p`,{className:`break-words text-xs text-fg-muted`,children:e.distribution}):null,(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x===`harmonyos`?e.kind===`hdc`?m?`用于 USB 连接、截图和基础操作。`:`USB connection, screenshots and basic actions.`:m?`用于实时投屏;缺失时仍可使用截图。`:`Required for live video; snapshots remain available without it.`:e.kind===`adb`?m?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:m?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),x===`android`?(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?m?`使用已有 ADB`:`Use existing ADB`:m?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[m?`当前文件:`:`Current file: `,e.path]}):null,(0,b.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,b.jsx)(`span`,{children:e.kind===`adb`?m?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:m?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?m?`已有 ADB 路径`:`Existing ADB path`:m?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:k[e.kind],disabled:!!T,onChange:t=>A(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,b.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?m?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:m?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(p,{className:`mt-3`,disabled:!!T||!k[e.kind].trim(),onClick:()=>void H(e.kind,`existing`),children:m?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(p,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!T,onClick:()=>void H(`adb`,`detect`),children:m?`恢复自动检测`:`Use automatic detection`}):null]}):null]},e.kind)}):(0,b.jsx)(d,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:j?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[V[j.phase]??j.phase,j.downloadedBytes&&j.totalBytes?` · ${Math.min(100,Math.round(j.downloadedBytes/j.totalBytes*100))}%`:``]}):N?(0,b.jsx)(`p`,{role:F?`alert`:`status`,className:F?`text-danger`:`text-fg-muted`,children:N}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:m?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x 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{i as r,n as i,o as a}from"./locale-store-B4o4aDCg.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./refresh-cw-BRlGaq2w.js";import{t as u}from"./wrench-DFb4r8bH.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{i as f}from"./vendor-swr-CdRzEUwF.js";import{t as p}from"./button-C5tRaJxt.js";import{a as m}from"./runtime-tools-api-CFvov9Uy.js";var h=e(t(),1),g=()=>r(`/api/runtime-tools/phone-dependencies`);async function _(){return(await a(g())).payload}async function v(e){await a(r(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function y(e,t,n,r){return m({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var b=n();function x({cloudOnly:e=!1,onChanged:t,expanded:n=!0,onExpandedChange:r,initialPlatform:a=`android`}){let m=i(e=>e.language)===`zh`,[x,S]=(0,h.useState)(a),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)({adb:``,scrcpy:``,hdc:``,hoscrcpy:``,java:``}),[j,M]=(0,h.useState)(),[N,P]=(0,h.useState)(``),[F,I]=(0,h.useState)(!1),{data:L,error:R,mutate:z}=f(g(),_,{refreshInterval:T?2500:0}),B=m?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},V=m?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function H(e,n){E(e),I(!1),P(``),M(void 0);try{n===`detect`?await v(``):n===`existing`&&e===`adb`?await v(k.adb.trim()):await y(e,n===`existing`?`import`:n,M,n===`existing`?k.scrcpy.trim():void 0),await z(),t?.(),P(m?`依赖已就绪。`:`Dependency is ready.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0)}}let U=t=>x===`harmonyos`?[`hdc`,`hoscrcpy`,`java`].includes(t):t===`scrcpy`||t===`adb`&&(!e||D),W=L?.statuses.filter(e=>U(e.kind));async function G(){w(!0),I(!1),P(``);try{for(let e of[`hdc`,`java`,`hoscrcpy`])if((await _()).statuses.find(t=>t.kind===e)?.state!==`ready`&&(E(e),await y(e,`install`,M),!(await _()).statuses.some(t=>t.kind===e&&t.state===`ready`)))throw Error(m?`${e} 安装后验证未通过。`:`${e} failed validation after installation.`);P(m?`鸿蒙连接组件已就绪,可以连接手机。`:`HarmonyOS components are ready. Connect your phone.`)}catch(e){I(!0),P(e instanceof Error?e.message:String(e))}finally{E(void 0),M(void 0),w(!1),await z(),t?.()}}let K=!!(W?.length&&W.every(e=>e.state===`ready`));return(0,b.jsxs)(`details`,{open:n,onToggle:e=>{e.currentTarget.open!==n&&r?.(e.currentTarget.open)},className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":m?`手机依赖状态`:`Phone dependencies`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,b.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:m?`连接组件`:`Connection components`}),(0,b.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs ${R?`text-danger`:`text-fg-muted`}`,children:[K&&(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),R?m?`检测失败`:`Check failed`:L?K?m?`已就绪`:`Ready`:m?`需要配置`:`Setup needed`:m?`检测中`:`Checking`]}),(0,b.jsx)(o,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-4 sm:p-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`安装在 Gateway 电脑上,无需全局安装。`:`Installed on your Gateway computer. No global installation needed.`}),(0,b.jsx)(p,{variant:`ghost`,"aria-label":m?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!T,onClick:()=>void z(),children:(0,b.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}),L?.installationEnabled===!1?(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,(0,b.jsx)(`div`,{className:`flex gap-2`,role:`group`,"aria-label":m?`手机系统`:`Phone platform`,children:[`android`,`harmonyos`].map(e=>(0,b.jsx)(p,{variant:x===e?`secondary`:`ghost`,disabled:!!T||C,"aria-pressed":x===e,onClick:()=>S(e),children:e===`android`?`Android`:m?`鸿蒙`:`HarmonyOS`},e))}),x===`harmonyos`?(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m?`无需安装 DevEco Studio。HDC 只下载当前电脑的可执行文件和 USB 库,约 6 MB;Java 和投屏库独立安装。`:`No DevEco Studio required. HDC downloads only the executable and USB library for this computer, about 6 MB. Java and the video library are installed separately.`}),(0,b.jsxs)(p,{disabled:!!T||C||!W?.some(e=>e.state!==`ready`&&e.canInstall),onClick:()=>void G(),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),C?m?`正在安装鸿蒙组件…`:`Installing HarmonyOS components…`:m?`一键安装缺失组件`:`Install missing components`]})]}):null,e&&x===`android`?(0,b.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`p`,{children:m?`阿里云连接无需本机 ADB;实时视频、持续触控和中文输入需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video, continuous touch and Unicode input require scrcpy server.`}),(0,b.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":D,onClick:()=>O(e=>!e),children:D?m?`收起本机连接依赖`:`Hide local connection dependencies`:m?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,R?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):L?L.statuses.filter(e=>U(e.kind)).map(e=>{let t={adb:`ADB · Android Platform Tools`,scrcpy:`scrcpy server`,hdc:`HDC · OpenHarmony`,hoscrcpy:`HOScrcpy · 1.0.18-beta`,java:`Java · Amazon Corretto JDK`}[e.kind];return(0,b.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:t}),(0,b.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[B[e.state],e.version?` · ${e.version}`:` · ${m?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?m?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?m?` · 自定义路径`:` · Custom path`:``]})]}),(0,b.jsxs)(p,{disabled:!!T||C||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void H(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,b.jsx)(c,{className:`size-4`,"aria-hidden":!0}),T===e.kind||e.state===`installing`?m?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?m?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?m?`修复托管安装`:`Repair managed copy`:m?`安装`:`Install`]})]}),e.distribution?(0,b.jsx)(`p`,{className:`break-words text-xs text-fg-muted`,children:e.distribution}):null,(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x===`harmonyos`?e.kind===`hdc`?m?`用于 USB 连接、截图和基础操作。`:`USB connection, screenshots and basic actions.`:m?`用于实时投屏;缺失时仍可使用截图。`:`Required for live video; snapshots remain available without it.`:e.kind===`adb`?m?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:m?`用于实时画面、跟手操作和中文输入;缺失时仍可查看截图并手动输入。`:`Required for live video, continuous touch and Unicode input. Snapshots and manual typing remain available without it.`}),x===`android`?(0,b.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?m?`使用已有 ADB`:`Use existing ADB`:m?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,b.jsxs)(`p`,{className:`mt-2 break-all`,children:[m?`当前文件:`:`Current file: `,e.path]}):null,(0,b.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,b.jsx)(`span`,{children:e.kind===`adb`?m?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:m?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,b.jsx)(`input`,{"aria-label":e.kind===`adb`?m?`已有 ADB 路径`:`Existing ADB path`:m?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:k[e.kind],disabled:!!T,onChange:t=>A(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,b.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?m?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:m?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,b.jsx)(p,{className:`mt-3`,disabled:!!T||!k[e.kind].trim(),onClick:()=>void H(e.kind,`existing`),children:m?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,b.jsx)(p,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!T,onClick:()=>void H(`adb`,`detect`),children:m?`恢复自动检测`:`Use automatic detection`}):null]}):null]},e.kind)}):(0,b.jsx)(d,{className:`h-28 rounded-xl`}),(0,b.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:j?(0,b.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[V[j.phase]??j.phase,j.downloadedBytes&&j.totalBytes?` · ${Math.min(100,Math.round(j.downloadedBytes/j.totalBytes*100))}%`:``]}):N?(0,b.jsx)(`p`,{role:F?`alert`:`status`,className:F?`text-danger`:`text-fg-muted`,children:N}):null}),(0,b.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:m?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})]})}export{x as t};