@xopcai/xopc 0.0.482 → 0.0.484

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 (292) hide show
  1. package/dist/browser-ext/dist/assets/{auth-B658Oa_i.js → auth-8EjgHa-n.js} +48 -17
  2. package/dist/browser-ext/dist/background.js +7 -3
  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/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/server/chunks.bin +1628 -1598
  8. package/dist/gateway/server/chunks.json +1 -1
  9. package/dist/gateway/static/root/assets/{activity-store-BCPCuT-6.js → activity-store-hSe5Nbgk.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Di9jxcH9.js → agent-avatar-dicebear-BY2wRiwY.js} +1 -1
  11. package/dist/gateway/static/root/assets/{agent-avatar-display-KbzBlJ8W.js → agent-avatar-display-D_UDgOr9.js} +2 -2
  12. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CYZzdU6C.js → agent-defaults-settings-panel-BrcyLG9M.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-plugin-dialog-Bhkawcil.js → agent-plugin-dialog-CSJC1yud.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agents-B2RXJeIo.js → agents-DX-t3X7K.js} +3 -3
  15. package/dist/gateway/static/root/assets/{agents-admin-api-DpfkHNbc.js → agents-admin-api-DSr-PWuW.js} +1 -1
  16. package/dist/gateway/static/root/assets/{api-BtngCZrB.js → api-B3T06TLl.js} +1 -1
  17. package/dist/gateway/static/root/assets/{api-CnOSHyKU.js → api-CGs641OT.js} +1 -1
  18. package/dist/gateway/static/root/assets/{app-management-settings-panel-Dyc3I-ng.js → app-management-settings-panel-D6ZoYKaA.js} +1 -1
  19. package/dist/gateway/static/root/assets/{appearance-settings-CmdhL-0n.js → appearance-settings-BRb6kZT8.js} +1 -1
  20. package/dist/gateway/static/root/assets/{apps-page-BFqC9Knk.js → apps-page-CH9wENBj.js} +1 -1
  21. package/dist/gateway/static/root/assets/{archive-plugin-DFP0MajV.js → archive-plugin-CQ5UXgZk.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automation-api-Cc5X3Q1t.js → automation-api-D-gn6x5E.js} +1 -1
  23. package/dist/gateway/static/root/assets/{automation-result-state-B7fHzLLf.js → automation-result-state-B7hq0XOL.js} +1 -1
  24. package/dist/gateway/static/root/assets/{automation-run-list-DPTby29p.js → automation-run-list-CM59-qm5.js} +1 -1
  25. package/dist/gateway/static/root/assets/{automation-task-card-CjzArAJi.js → automation-task-card-C453Q-Wa.js} +1 -1
  26. package/dist/gateway/static/root/assets/{automations-page-BKbElVfF.js → automations-page-B1Ri4sh8.js} +1 -1
  27. package/dist/gateway/static/root/assets/{automations-workspace-_18qOoLm.js → automations-workspace-CNSza6ir.js} +2 -2
  28. package/dist/gateway/static/root/assets/bell-BlYch9Vg.js +1 -0
  29. package/dist/gateway/static/root/assets/{binary-plugins-DnE-iqaV.js → binary-plugins-D_zw0TgG.js} +1 -1
  30. package/dist/gateway/static/root/assets/{block-editor-CYobheuw.js → block-editor-Cesz2DqP.js} +1 -1
  31. package/dist/gateway/static/root/assets/browser-notification-delivery-DjK3F0oR.js +1 -0
  32. package/dist/gateway/static/root/assets/{browser-settings-page-BLniK98R.js → browser-settings-page-BHElJSFt.js} +1 -1
  33. package/dist/gateway/static/root/assets/{capabilities-BfTF_flC.js → capabilities-BaKHutgZ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{capabilities-oihQXc5J.js → capabilities-abgigXV1.js} +1 -1
  35. package/dist/gateway/static/root/assets/capabilities-page-EENl65YY.js +2 -0
  36. package/dist/gateway/static/root/assets/capabilities-settings-panel-BOwbZn9X.js +8 -0
  37. package/dist/gateway/static/root/assets/{channels-DEIqjf9M.js → channels-DlnXbcOj.js} +1 -1
  38. package/dist/gateway/static/root/assets/{chat-agents-api-BzuJyysa.js → chat-agents-api-CyvBfBbp.js} +1 -1
  39. package/dist/gateway/static/root/assets/{chat-chart-block-DurSfGy2.js → chat-chart-block-B83s8HE9.js} +1 -1
  40. package/dist/gateway/static/root/assets/{chat-page-CK4aWVbI.js → chat-page-LOR5JxDh.js} +15 -15
  41. package/dist/gateway/static/root/assets/{chat-terminal-dock-UBaRUsXJ.js → chat-terminal-dock-DE8j-K9d.js} +1 -1
  42. package/dist/gateway/static/root/assets/{command-palette-api-3kNqE3U7.js → command-palette-api-YP0zV_Ol.js} +1 -1
  43. package/dist/gateway/static/root/assets/{composer-model-config-control-CrI-u8F_.js → composer-model-config-control-C2Bku39S.js} +1 -1
  44. package/dist/gateway/static/root/assets/{composer-notifications-L6u0F2_8.js → composer-notifications-MGKffwC7.js} +1 -1
  45. package/dist/gateway/static/root/assets/{composer-payload-handoff-DdHGkHOq.js → composer-payload-handoff-ClWsunJ2.js} +1 -1
  46. package/dist/gateway/static/root/assets/{computer-settings-page-BwvCOkbI.js → computer-settings-page-DUzQe6Bz.js} +1 -1
  47. package/dist/gateway/static/root/assets/{connected-providers-grid-B8eiZl6Z.js → connected-providers-grid-BgW-ioIt.js} +1 -1
  48. package/dist/gateway/static/root/assets/{connection-usage-guide-CydSRk3h.js → connection-usage-guide-B9hoSOnN.js} +1 -1
  49. package/dist/gateway/static/root/assets/{connector-service-page-CLBi6R-Z.js → connector-service-page-e67KylnM.js} +1 -1
  50. package/dist/gateway/static/root/assets/{connectors-api-Bn2IbtcF.js → connectors-api-CRGq-TSw.js} +1 -1
  51. package/dist/gateway/static/root/assets/connectors-page-BJm1jjct.js +1 -0
  52. package/dist/gateway/static/root/assets/{date-picker-DsD7NIm2.js → date-picker-DwITf4I2.js} +1 -1
  53. package/dist/gateway/static/root/assets/{date-time-picker-BhnBpBpj.js → date-time-picker-ChG1CqR1.js} +1 -1
  54. package/dist/gateway/static/root/assets/{desktop-pet-eFR-zmP2.js → desktop-pet-BHoFymL4.js} +1 -1
  55. package/dist/gateway/static/root/assets/{desktop-pet-settings-CfFTYstQ.js → desktop-pet-settings-BYeBN4jj.js} +1 -1
  56. package/dist/gateway/static/root/assets/{dev-view-store-D_uPX9_R.js → dev-view-store-DsjH8x76.js} +1 -1
  57. package/dist/gateway/static/root/assets/device-connections-panel-DE01vyK_.js +1 -0
  58. package/dist/gateway/static/root/assets/device-pairing-action-w1enAo76.js +1 -0
  59. package/dist/gateway/static/root/assets/{device-pairing-wizard-BeLkoDUp.js → device-pairing-wizard-Dt737tSq.js} +1 -1
  60. package/dist/gateway/static/root/assets/{directory-picker-path-field-5wZa0JF3.js → directory-picker-path-field-B-eUnbng.js} +1 -1
  61. package/dist/gateway/static/root/assets/{extension-authoritative-grants-DaA0KXyO.js → extension-authoritative-grants-DYp2nNol.js} +1 -1
  62. package/dist/gateway/static/root/assets/{extension-debug-page-CXe8jimk.js → extension-debug-page-D3X7SlzG.js} +1 -1
  63. package/dist/gateway/static/root/assets/{extension-iframe-host-BwMISzWU.js → extension-iframe-host-CIAq7PSn.js} +1 -1
  64. package/dist/gateway/static/root/assets/{extension-marketplace-api-DuWuae8G.js → extension-marketplace-api-DGV5FC-v.js} +1 -1
  65. package/dist/gateway/static/root/assets/{extension-message-router-DzBfVl6h.js → extension-message-router-B2wbucV7.js} +1 -1
  66. package/dist/gateway/static/root/assets/{extension-page-DW18FOb8.js → extension-page-qwY7r1_p.js} +1 -1
  67. package/dist/gateway/static/root/assets/{extension-provider-CyYrgUw-.js → extension-provider-DFcRbTHI.js} +1 -1
  68. package/dist/gateway/static/root/assets/{extension-settings-page-ByGVQYDw.js → extension-settings-page-Cpnh9lcZ.js} +1 -1
  69. package/dist/gateway/static/root/assets/file-preview-surface-Da1xZiG6.js +1 -0
  70. package/dist/gateway/static/root/assets/{gateway-config-swr-BYoBGl6i.js → gateway-config-swr-BD-ams0X.js} +1 -1
  71. package/dist/gateway/static/root/assets/gateway-realtime-CoIFB3im.js +1 -0
  72. package/dist/gateway/static/root/assets/gateway-realtime-store-CTWm23Qi.js +1 -0
  73. package/dist/gateway/static/root/assets/{gateway-restart-CtqJpyNu.js → gateway-restart-Dos1Pp84.js} +1 -1
  74. package/dist/gateway/static/root/assets/{gateway-settings-xzO7KDsu.js → gateway-settings-DUC1iOVK.js} +1 -1
  75. package/dist/gateway/static/root/assets/{gateway-startup-retry-DCDOl6Oo.js → gateway-startup-retry-DgmvR-hb.js} +1 -1
  76. package/dist/gateway/static/root/assets/{global-defaults-api-DXFSI87T.js → global-defaults-api-B7suATYU.js} +1 -1
  77. package/dist/gateway/static/root/assets/{home-page-CztF0goW.js → home-page-BusNFHe-.js} +3 -3
  78. package/dist/gateway/static/root/assets/{home-task-actions-DTXb7Gc7.js → home-task-actions-C8Fi6GBq.js} +1 -1
  79. package/dist/gateway/static/root/assets/{image-generation-api-Ck0rMJy3.js → image-generation-api-Baz4xdZ4.js} +1 -1
  80. package/dist/gateway/static/root/assets/{imports-page-egn9yYfF.js → imports-page-DR0eLPgB.js} +1 -1
  81. package/dist/gateway/static/root/assets/index-B_TGvH_k.css +1 -0
  82. package/dist/gateway/static/root/assets/index-DE6GguFZ.js +11 -0
  83. package/dist/gateway/static/root/assets/{install-connector-dialog-CMh8jhn1.js → install-connector-dialog-CntHi8Rh.js} +1 -1
  84. package/dist/gateway/static/root/assets/installed-connector-row-skeleton-BAe_utvG.js +1 -0
  85. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BOiKmOwN.js → keyboard-shortcuts-settings-DlGDLJI2.js} +1 -1
  86. package/dist/gateway/static/root/assets/{local-app-workbench-page-ev6VTDX2.js → local-app-workbench-page-B9uSL1Mi.js} +1 -1
  87. package/dist/gateway/static/root/assets/{local-apps-page-CQBSa3cR.js → local-apps-page-BoCtITdL.js} +1 -1
  88. package/dist/gateway/static/root/assets/{local-session-drafts-pAAFf-Ad.js → local-session-drafts-CGSV1RQg.js} +1 -1
  89. package/dist/gateway/static/root/assets/{locale-store-BYdvIuPj.js → locale-store-CHjsq5NR.js} +1 -1
  90. package/dist/gateway/static/root/assets/{logs-page-Z-4VNgnq.js → logs-page-0hkRbcUR.js} +1 -1
  91. package/dist/gateway/static/root/assets/{management-api-D739TCBl.js → management-api-FVu7eYXD.js} +1 -1
  92. package/dist/gateway/static/root/assets/management-settings-QQB1r71U.js +1 -0
  93. package/dist/gateway/static/root/assets/map-pin-BFRLhzQ9.js +1 -0
  94. package/dist/gateway/static/root/assets/{markdown-view-BOJVaGPC.js → markdown-view-ihzUc4ud.js} +1 -1
  95. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-NcRvP7cK.js → mcp-conversation-setup-page-DffQKrjd.js} +1 -1
  96. package/dist/gateway/static/root/assets/{media-plugins-B9bQ3e1j.js → media-plugins-C78NkHfB.js} +1 -1
  97. package/dist/gateway/static/root/assets/{messages-lc5BjBtX.js → messages-C7QSnTdg.js} +2 -2
  98. package/dist/gateway/static/root/assets/{model-selector-DugdMlvi.js → model-selector-QFZY5XNN.js} +1 -1
  99. package/dist/gateway/static/root/assets/{models-hub-cache-DvDksW4g.js → models-hub-cache-BrD6r5Qs.js} +1 -1
  100. package/dist/gateway/static/root/assets/note-detail-panel-DXzfoiyk.js +7 -0
  101. package/dist/gateway/static/root/assets/note-image-lightbox-Bvjumefe.js +1 -0
  102. package/dist/gateway/static/root/assets/{notes-api-auhtw3zM.js → notes-api-D5SvfybU.js} +1 -1
  103. package/dist/gateway/static/root/assets/{notes-page-DnI1iJ3g.js → notes-page-BNTgiHSk.js} +1 -1
  104. package/dist/gateway/static/root/assets/{oauth-api-BXKG29Kg.js → oauth-api-DnMpUoyx.js} +1 -1
  105. package/dist/gateway/static/root/assets/{oauth-provider-connect-y6-vDWb-.js → oauth-provider-connect-DGYky6ut.js} +1 -1
  106. package/dist/gateway/static/root/assets/{page-context-capture-button-BBVJZgU0.js → page-context-capture-button-BXSBeGms.js} +1 -1
  107. package/dist/gateway/static/root/assets/{page-context-draft-B30xEPDh.js → page-context-draft-Bk7jVvAG.js} +1 -1
  108. package/dist/gateway/static/root/assets/{page-header-store-BGCCXOOf.js → page-header-store-NP7MCIaP.js} +1 -1
  109. package/dist/gateway/static/root/assets/{personal-avatar-w5Sekj02.js → personal-avatar-1TVnHakL.js} +1 -1
  110. package/dist/gateway/static/root/assets/{personal-page-BWzfp81f.js → personal-page-D7zTHQ0K.js} +1 -1
  111. package/dist/gateway/static/root/assets/{personal-profile-settings-BYmKk14v.js → personal-profile-settings-TcI0Zfwr.js} +1 -1
  112. package/dist/gateway/static/root/assets/{personal-settings-panel-DYnTT7aB.js → personal-settings-panel-BJ46T7ZO.js} +1 -1
  113. package/dist/gateway/static/root/assets/{phone-dependencies-card-DJciwZ-7.js → phone-dependencies-card-B4QsgIEF.js} +1 -1
  114. package/dist/gateway/static/root/assets/{phone-model-connection-C3jmc4ma.js → phone-model-connection-Dk5kE1Ll.js} +1 -1
  115. package/dist/gateway/static/root/assets/{phone-model-picker-MWC_Zh2a.js → phone-model-picker-CFoxQiws.js} +1 -1
  116. package/dist/gateway/static/root/assets/{phone-settings-page-C1Yc6tP7.js → phone-settings-page-Bv1xm8sh.js} +1 -1
  117. package/dist/gateway/static/root/assets/{phone-workspace-store-Cxk2PJZe.js → phone-workspace-store-DGaibcsi.js} +1 -1
  118. package/dist/gateway/static/root/assets/{plugin-details-dialog-CpKZE_nx.js → plugin-details-dialog-FcOJaeP0.js} +1 -1
  119. package/dist/gateway/static/root/assets/{preference-select-fields-ByihE_wl.js → preference-select-fields-B-yK91If.js} +1 -1
  120. package/dist/gateway/static/root/assets/{preview-runtime-iJuVSugF.js → preview-runtime-C1U57WSM.js} +3 -3
  121. package/dist/gateway/static/root/assets/product-automation-feedback-GA_YPLkr.js +1 -0
  122. package/dist/gateway/static/root/assets/product-navigation-wFfnI3uw.js +1 -0
  123. package/dist/gateway/static/root/assets/{product-open-page-B7kAAD7Q.js → product-open-page-C09VEZjY.js} +1 -1
  124. package/dist/gateway/static/root/assets/{product-preview-content-CzNWh2h2.js → product-preview-content-BOq3gtSJ.js} +1 -1
  125. package/dist/gateway/static/root/assets/{product-preview-modal-B1RKw3Z-.js → product-preview-modal-DIh_CsXp.js} +2 -2
  126. package/dist/gateway/static/root/assets/{project-detail-page-Zr1I56NG.js → project-detail-page-Dgs8ImMC.js} +1 -1
  127. package/dist/gateway/static/root/assets/{project-understanding-D0S9pFg7.js → project-understanding-4IyHVmus.js} +1 -1
  128. package/dist/gateway/static/root/assets/{projects-page-DlwRbxAj.js → projects-page-BHQxQGTd.js} +1 -1
  129. package/dist/gateway/static/root/assets/{providers-api-D_v_CJ3l.js → providers-api-D9NuB7w3.js} +1 -1
  130. package/dist/gateway/static/root/assets/{recording-upload-BSyxK34y.js → recording-upload-plrQDkLa.js} +1 -1
  131. package/dist/gateway/static/root/assets/{registry-api-DGi-X6j7.js → registry-api-CDpUAb2R.js} +1 -1
  132. package/dist/gateway/static/root/assets/{remote-access-hub-D3EYRXQC.js → remote-access-hub-DVTs8pwO.js} +1 -1
  133. package/dist/gateway/static/root/assets/{resource-unavailable-52Jvhy-I.js → resource-unavailable-CZlqZYk-.js} +1 -1
  134. package/dist/gateway/static/root/assets/{right-workspace-store-DsGslCi-.js → right-workspace-store-Cehybf-G.js} +1 -1
  135. package/dist/gateway/static/root/assets/route-preload-7WVrzJca.js +2 -0
  136. package/dist/gateway/static/root/assets/routine-panel-Bfbiz0IN.js +2 -0
  137. package/dist/gateway/static/root/assets/{runtime-tools-api-D8Xtty0g.js → runtime-tools-api-BhS0RWf2.js} +1 -1
  138. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-r28zxrgP.js → runtime-tools-settings-panel-jTbGPGeA.js} +1 -1
  139. package/dist/gateway/static/root/assets/{service-recommendation-list-Kw6pwI8U.js → service-recommendation-list-wfd0Mjtu.js} +1 -1
  140. package/dist/gateway/static/root/assets/{session-api-eApyRHbI.js → session-api-CR3NLqvs.js} +1 -1
  141. package/dist/gateway/static/root/assets/{session-manager-C-oe-9_N.js → session-manager-DUWeBdeG.js} +1 -1
  142. package/dist/gateway/static/root/assets/{sessions-page-BkNfjgXC.js → sessions-page-9ibCNP9o.js} +1 -1
  143. package/dist/gateway/static/root/assets/settings-advanced-gate-Cq4HDQu2.js +1 -0
  144. package/dist/gateway/static/root/assets/{settings-advanced-section-Dc9aztiW.js → settings-advanced-section-CTLdGPvx.js} +1 -1
  145. package/dist/gateway/static/root/assets/{settings-mode-store-DcE2iR7e.js → settings-mode-store-CCQVvItG.js} +1 -1
  146. package/dist/gateway/static/root/assets/{settings-page-CXRPZxuB.js → settings-page-BOzzOS6k.js} +1 -1
  147. package/dist/gateway/static/root/assets/{settings-page-header-CQueaD1Z.js → settings-page-header-C21Iw2rD.js} +1 -1
  148. package/dist/gateway/static/root/assets/{settings-page-layout-BlwyxcEq.js → settings-page-layout-BXcLlp6p.js} +1 -1
  149. package/dist/gateway/static/root/assets/{setup-interaction-page-BvL6C5ja.js → setup-interaction-page-W2F5ZaR_.js} +1 -1
  150. package/dist/gateway/static/root/assets/{setup-status-panel-Dp5cY2P9.js → setup-status-panel-BFNwZuhp.js} +1 -1
  151. package/dist/gateway/static/root/assets/share-2-CnIB9PsV.js +1 -0
  152. package/dist/gateway/static/root/assets/share-link-dialog-2JjvWs0q.js +1 -0
  153. package/dist/gateway/static/root/assets/{share-preview-page-IG0fTWJO.js → share-preview-page-Di5_ukH8.js} +1 -1
  154. package/dist/gateway/static/root/assets/{shares-api-DgYOJV0T.js → shares-api-BhWvN3LS.js} +1 -1
  155. package/dist/gateway/static/root/assets/{shares-settings-YeLkRDki.js → shares-settings-CirGM67m.js} +1 -1
  156. package/dist/gateway/static/root/assets/{skill-api-DRCHLW2T.js → skill-api-BG9A1WF0.js} +1 -1
  157. package/dist/gateway/static/root/assets/{skill-list-api-CQUhEUOF.js → skill-list-api-B26hHnXq.js} +1 -1
  158. package/dist/gateway/static/root/assets/{skill-reload-api-BoEna1cx.js → skill-reload-api-B9Eu5Yk_.js} +1 -1
  159. package/dist/gateway/static/root/assets/{skills-page-CBAL83FE.js → skills-page-gGU0LZ5e.js} +1 -1
  160. package/dist/gateway/static/root/assets/{space-api-d4Q4hkEY.js → space-api-_uKFiASp.js} +1 -1
  161. package/dist/gateway/static/root/assets/space-page-CKVuhV2i.js +2 -0
  162. package/dist/gateway/static/root/assets/{space-workbook-BDjeiRtr.js → space-workbook-BAwHwK6O.js} +1 -1
  163. package/dist/gateway/static/root/assets/system-settings-panel-0e2zfQLt.js +1 -0
  164. package/dist/gateway/static/root/assets/{task-detail-page-DFeKIcxT.js → task-detail-page-DEpYIaok.js} +1 -1
  165. package/dist/gateway/static/root/assets/{task-header-title-ClyuCAFb.js → task-header-title-Cdgp2rCs.js} +1 -1
  166. package/dist/gateway/static/root/assets/{task-run-issue-notice-XWlgvgEo.js → task-run-issue-notice-CGrUMy0s.js} +1 -1
  167. package/dist/gateway/static/root/assets/{terminal-panel-store-CNkRP4kf.js → terminal-panel-store-Cy90Ix5U.js} +1 -1
  168. package/dist/gateway/static/root/assets/{theme-store-nXIuAiQZ.js → theme-store-CvG266p8.js} +1 -1
  169. package/dist/gateway/static/root/assets/{tracing-settings-page-CoWcr2c0.js → tracing-settings-page-Cx_fOH70.js} +1 -1
  170. package/dist/gateway/static/root/assets/{tunnel-api-DgsELO9g.js → tunnel-api-Cph-ZBBy.js} +1 -1
  171. package/dist/gateway/static/root/assets/{understanding-activity-store-BI_PbKCi.js → understanding-activity-store-CN4JzOIO.js} +1 -1
  172. package/dist/gateway/static/root/assets/{understanding-refresh-store-DPHzCi1Q.js → understanding-refresh-store-BuZZ1_VH.js} +1 -1
  173. package/dist/gateway/static/root/assets/{usage-page-BVNBJa59.js → usage-page-Du42x0ej.js} +1 -1
  174. package/dist/gateway/static/root/assets/{use-autosave-BPDFVsgM.js → use-autosave-B_WH_LBE.js} +1 -1
  175. package/dist/gateway/static/root/assets/use-composer-attachments-DJsIzJ1c.js +2 -0
  176. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BhmEiOkv.js → use-file-preview-expanded-BFF2vXm5.js} +1 -1
  177. package/dist/gateway/static/root/assets/{use-generated-media-CLEV4wYC.js → use-generated-media-CzRbgtcv.js} +1 -1
  178. package/dist/gateway/static/root/assets/{use-personal-profile-CFaihmiJ.js → use-personal-profile-D4gLM6Wi.js} +1 -1
  179. package/dist/gateway/static/root/assets/{use-personal-work-CIZMwOlm.js → use-personal-work-Dd2jRUpz.js} +1 -1
  180. package/dist/gateway/static/root/assets/{use-realtime-voice-CvtX2HcA.js → use-realtime-voice-9OvLwHzk.js} +1 -1
  181. package/dist/gateway/static/root/assets/use-section-navigation-yC9HkVpd.js +1 -0
  182. package/dist/gateway/static/root/assets/use-share-link-WKZLlEqr.js +1 -0
  183. package/dist/gateway/static/root/assets/{use-workspace-tree-BnvuxYD4.js → use-workspace-tree-LCIT1H-D.js} +1 -1
  184. package/dist/gateway/static/root/assets/{user-model-page-D4yNFvW1.js → user-model-page-AK2U8vGc.js} +1 -1
  185. package/dist/gateway/static/root/assets/{voice-api-key-field-NINoxB5r.js → voice-api-key-field-BqXQj51r.js} +1 -1
  186. package/dist/gateway/static/root/assets/{voice-config-api-7cvKLNoE.js → voice-config-api-sXEIG6lz.js} +1 -1
  187. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DaCuiqoi.js → voice-input-shortcut-events-DN-_rY5a.js} +1 -1
  188. package/dist/gateway/static/root/assets/{voice-player-store-DipmM7w1.js → voice-player-store-CTbnOdeM.js} +1 -1
  189. package/dist/gateway/static/root/assets/{voice-settings-BTvMqF_9.js → voice-settings-j8o-hGTm.js} +1 -1
  190. package/dist/gateway/static/root/assets/wifi-off-C35sMFUl.js +1 -0
  191. package/dist/gateway/static/root/assets/{work-discovery-overlay-BKdumzyK.js → work-discovery-overlay-BjfTRFX8.js} +1 -1
  192. package/dist/gateway/static/root/assets/{work-discovery-page-uX1VIzJY.js → work-discovery-page-CSRkFiXc.js} +1 -1
  193. package/dist/gateway/static/root/assets/{working-directory-picker-modal-C9hWAPvW.js → working-directory-picker-modal-DgM21YVT.js} +1 -1
  194. package/dist/gateway/static/root/assets/{workspace-api-_mQWmOZm.js → workspace-api-BuNWyNvA.js} +2 -2
  195. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CX8zX9eZ.js +1 -0
  196. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DwVWTehC.js +1 -0
  197. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BZSS94es.js → workspace-open-location-menu-BAbIGS01.js} +1 -1
  198. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-xJr48TmR.js → xopc-cloud-account-card-e8HJFnTs.js} +1 -1
  199. package/dist/gateway/static/root/index.html +100 -95
  200. package/dist/package.js +1 -1
  201. package/dist/packages/endpoint-tools-client/src/index.js +8 -4
  202. package/dist/packages/endpoint-tools-protocol/src/canonical-json.js +20 -0
  203. package/dist/packages/endpoint-tools-protocol/src/folders.js +170 -0
  204. package/dist/packages/endpoint-tools-protocol/src/index.js +55 -17
  205. package/dist/packages/endpoint-tools-protocol/src/location.js +22 -1
  206. package/dist/packages/endpoint-tools-protocol/src/personal.js +151 -8
  207. package/dist/src/agent/external-tools/endpoint-provider.js +54 -10
  208. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  209. package/dist/src/agent/tool-manuals/computer.js +2 -2
  210. package/dist/src/browser/remote/endpoint-transport.js +2 -1
  211. package/dist/src/computer/endpoint-transport.d.ts +1 -1
  212. package/dist/src/computer/endpoint-transport.js +4 -2
  213. package/dist/src/computer/errors.js +2 -1
  214. package/dist/src/computer/model-adapter.js +1 -0
  215. package/dist/src/computer/runtime.d.ts +1 -0
  216. package/dist/src/computer/runtime.js +14 -2
  217. package/dist/src/endpoint-tools/context-store.js +2 -1
  218. package/dist/src/endpoint-tools/delegation.js +2 -1
  219. package/dist/src/endpoint-tools/desktop-authority-response.js +2 -1
  220. package/dist/src/endpoint-tools/device-capability-grants.d.ts +13 -0
  221. package/dist/src/endpoint-tools/device-capability-grants.js +71 -0
  222. package/dist/src/endpoint-tools/folder-connections.d.ts +19 -0
  223. package/dist/src/endpoint-tools/folder-connections.js +48 -0
  224. package/dist/src/endpoint-tools/grant-service.js +2 -1
  225. package/dist/src/endpoint-tools/invocation-service.d.ts +3 -0
  226. package/dist/src/endpoint-tools/invocation-service.js +10 -2
  227. package/dist/src/endpoint-tools/policy.js +16 -5
  228. package/dist/src/endpoint-tools/provider-catalog.js +2 -1
  229. package/dist/src/endpoint-tools/provider-operation-journal.js +2 -1
  230. package/dist/src/endpoint-tools/registry.js +2 -1
  231. package/dist/src/endpoint-tools/target-resolver.d.ts +1 -1
  232. package/dist/src/endpoint-tools/target-resolver.js +25 -5
  233. package/dist/src/endpoint-tools/task-targets.d.ts +4 -1
  234. package/dist/src/endpoint-tools/task-targets.js +10 -4
  235. package/dist/src/endpoint-tools/terminal-broker.js +2 -1
  236. package/dist/src/gateway/hono/middleware/auth.js +10 -0
  237. package/dist/src/gateway/hono/routes/device-connections.d.ts +3 -0
  238. package/dist/src/gateway/hono/routes/device-connections.js +289 -0
  239. package/dist/src/gateway/hono/routes/device-targets.js +32 -5
  240. package/dist/src/gateway/hono/routes/endpoint-compatibility.js +8 -0
  241. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  242. package/dist/src/gateway/hono/routes/media.js +18 -32
  243. package/dist/src/gateway/hono/routes/music-generation.js +1 -1
  244. package/dist/src/gateway/hono/routes/shares.js +96 -12
  245. package/dist/src/gateway/hono/routes/space.js +6 -3
  246. package/dist/src/gateway/hono/routes/video-generation.js +1 -1
  247. package/dist/src/gateway/security/gateway-scopes.d.ts +1 -0
  248. package/dist/src/gateway/security/gateway-scopes.js +9 -1
  249. package/dist/src/gateway/security/media-playback-ticket.d.ts +3 -0
  250. package/dist/src/gateway/security/media-playback-ticket.js +41 -0
  251. package/dist/src/media-shared/http/file-response.d.ts +3 -0
  252. package/dist/src/media-shared/http/file-response.js +31 -0
  253. package/dist/src/music-generation/artifact.d.ts +1 -1
  254. package/dist/src/music-generation/artifact.js +4 -18
  255. package/dist/src/realtime/compact-run-event.js +5 -1
  256. package/dist/src/session/compact-history.js +6 -3
  257. package/dist/src/share/share-landing.d.ts +2 -0
  258. package/dist/src/share/share-landing.js +4 -0
  259. package/dist/src/share/share-store.js +3 -2
  260. package/dist/src/share/share-types.d.ts +4 -0
  261. package/dist/src/space/repository.d.ts +9 -1
  262. package/dist/src/space/repository.js +75 -30
  263. package/dist/src/storage/sqlite/desktop-execution-repository.js +2 -1
  264. package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +2 -1
  265. package/dist/src/storage/sqlite/desktop-operation-repository.js +2 -1
  266. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -0
  267. package/dist/src/video-generation/artifact.d.ts +1 -1
  268. package/dist/src/video-generation/artifact.js +4 -28
  269. package/package.json +2 -2
  270. package/dist/gateway/static/root/assets/browser-notification-delivery-DmE2FgGc.js +0 -1
  271. package/dist/gateway/static/root/assets/capabilities-page-B32XFJ59.js +0 -2
  272. package/dist/gateway/static/root/assets/capabilities-settings-panel-CWnHPY8j.js +0 -8
  273. package/dist/gateway/static/root/assets/connectors-page-ywk7W0s6.js +0 -1
  274. package/dist/gateway/static/root/assets/file-preview-surface-Cw70pwph.js +0 -1
  275. package/dist/gateway/static/root/assets/gateway-realtime-Dzq6_piH.js +0 -1
  276. package/dist/gateway/static/root/assets/gateway-realtime-store-B9CDQ8NO.js +0 -1
  277. package/dist/gateway/static/root/assets/index-dqkMYWTd.js +0 -11
  278. package/dist/gateway/static/root/assets/index-q78xsKF3.css +0 -1
  279. package/dist/gateway/static/root/assets/management-settings-CZDWUPmg.js +0 -1
  280. package/dist/gateway/static/root/assets/note-detail-panel-CEi6GNEA.js +0 -7
  281. package/dist/gateway/static/root/assets/note-image-lightbox-DftbeSZR.js +0 -1
  282. package/dist/gateway/static/root/assets/product-automation-feedback-ref9gqOW.js +0 -1
  283. package/dist/gateway/static/root/assets/product-navigation-Dp-adLY_.js +0 -1
  284. package/dist/gateway/static/root/assets/route-preload-D00yB6hp.js +0 -2
  285. package/dist/gateway/static/root/assets/routine-panel-sCpXMbMl.js +0 -2
  286. package/dist/gateway/static/root/assets/settings-advanced-gate-B82UPSQS.js +0 -1
  287. package/dist/gateway/static/root/assets/share-link-dialog-CB3LkWw8.js +0 -1
  288. package/dist/gateway/static/root/assets/space-page-8BMb_g2p.js +0 -2
  289. package/dist/gateway/static/root/assets/system-settings-panel-dt8k0K4V.js +0 -1
  290. package/dist/gateway/static/root/assets/use-composer-attachments-9nVD0sQ1.js +0 -2
  291. package/dist/gateway/static/root/assets/workspace-editor-agent-store-BzuNTkZu.js +0 -1
  292. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-D4Nc7XkR.js +0 -1
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-BYdvIuPj.js";import{v as t}from"./local-session-drafts-pAAFf-Ad.js";function n(){let n=crypto.randomUUID(),r=crypto.randomUUID(),i=0,a=e(()=>({drafts:{}}));return{store:a,capture(e){return{envelope:t({version:1,clientInstanceId:n,tabId:r,sequence:++i,surface:`web`,capturedAt:Date.now(),resourceRefs:e.resourceRefs,selection:e.selection}),title:e.title,preview:e.text.slice(0,16e3),truncated:e.text.length>16e3}},put(e,t){let n=a.getState().drafts;return n[e]||Object.keys(n).length>=20?!1:(a.setState({drafts:{...n,[e]:structuredClone(t)}}),!0)},remove(e,t){let n=a.getState().drafts;if(n[e]!==t)return;let r={...n};delete r[e],a.setState({drafts:r})}}}var r=n();function i(e,t,n){return JSON.stringify([e,t??null,n])}export{r as n,i as t};
1
+ import{p as e}from"./locale-store-CHjsq5NR.js";import{v as t}from"./local-session-drafts-CGSV1RQg.js";function n(){let n=crypto.randomUUID(),r=crypto.randomUUID(),i=0,a=e(()=>({drafts:{}}));return{store:a,capture(e){return{envelope:t({version:1,clientInstanceId:n,tabId:r,sequence:++i,surface:`web`,capturedAt:Date.now(),resourceRefs:e.resourceRefs,selection:e.selection}),title:e.title,preview:e.text.slice(0,16e3),truncated:e.text.length>16e3}},put(e,t){let n=a.getState().drafts;return n[e]||Object.keys(n).length>=20?!1:(a.setState({drafts:{...n,[e]:structuredClone(t)}}),!0)},remove(e,t){let n=a.getState().drafts;if(n[e]!==t)return;let r={...n};delete r[e],a.setState({drafts:r})}}}var r=n();function i(e,t,n){return JSON.stringify([e,t??null,n])}export{r as n,i as t};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-BYdvIuPj.js";var t={startExtra:null,main:null,end:null,className:void 0,personalChat:void 0},n=e(e=>({...t,setPageHeader:n=>e({...t,...n}),clearPageHeader:()=>e(t)}));export{n as t};
1
+ import{p as e}from"./locale-store-CHjsq5NR.js";var t={startExtra:null,main:null,end:null,className:void 0,personalChat:void 0},n=e(e=>({...t,setPageHeader:n=>e({...t,...n}),clearPageHeader:()=>e(t)}));export{n as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./loopi-CNtmi9FU.js";import{t as r}from"./agent-avatar-display-KbzBlJ8W.js";var i=e(),a=t(),o={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`},s={working:`work`,waiting:`decision`,delivered:`done`};function c(e){let t=(0,i.c)(9),{appearance:c,agentId:l,activity:u,className:d}=e,f=u===void 0?`idle`:u,p=d===void 0?``:d;if(c===`custom`&&l){let e;return t[0]!==l||t[1]!==p?(e=(0,a.jsx)(r,{agentId:l,avatar:`xopc:custom`,className:p}),t[0]=l,t[1]=p,t[2]=e):e=t[2],e}let m=s[f]??(c===`custom`?`idle`:o[c]),h=`personal-avatar-motion inline-flex items-center justify-center ${p}`,g;t[3]===m?g=t[4]:(g=(0,a.jsx)(n,{variant:`avatar`,mood:m,className:`size-full`}),t[3]=m,t[4]=g);let _;return t[5]!==f||t[6]!==h||t[7]!==g?(_=(0,a.jsx)(`span`,{"data-activity":f,className:h,"aria-hidden":`true`,children:g}),t[5]=f,t[6]=h,t[7]=g,t[8]=_):_=t[8],_}export{c as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./loopi-CNtmi9FU.js";import{t as r}from"./agent-avatar-display-D_UDgOr9.js";var i=e(),a=t(),o={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`},s={working:`work`,waiting:`decision`,delivered:`done`};function c(e){let t=(0,i.c)(9),{appearance:c,agentId:l,activity:u,className:d}=e,f=u===void 0?`idle`:u,p=d===void 0?``:d;if(c===`custom`&&l){let e;return t[0]!==l||t[1]!==p?(e=(0,a.jsx)(r,{agentId:l,avatar:`xopc:custom`,className:p}),t[0]=l,t[1]=p,t[2]=e):e=t[2],e}let m=s[f]??(c===`custom`?`idle`:o[c]),h=`personal-avatar-motion inline-flex items-center justify-center ${p}`,g;t[3]===m?g=t[4]:(g=(0,a.jsx)(n,{variant:`avatar`,mood:m,className:`size-full`}),t[3]=m,t[4]=g);let _;return t[5]!==f||t[6]!==h||t[7]!==g?(_=(0,a.jsx)(`span`,{"data-activity":f,className:h,"aria-hidden":`true`,children:g}),t[5]=f,t[6]=h,t[7]=g,t[8]=_):_=t[8],_}export{c 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{d as r,f as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as o,n as s,o as c}from"./locale-store-BYdvIuPj.js";import{t as l}from"./messages-lc5BjBtX.js";import{t as u}from"./chat-page-CK4aWVbI.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-CMh8jhn1.js";import{c as h,o as g,s as _}from"./use-personal-work-CIZMwOlm.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-DsGslCi-.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-Bn2IbtcF.js";import{u as ae}from"./use-realtime-voice-CvtX2HcA.js";import{n as O}from"./voice-call-context-BM2A4bLz.js";import{t as k}from"./page-header-store-BGCCXOOf.js";import{s as A}from"./agent-avatar-display-KbzBlJ8W.js";import{t as j}from"./personal-avatar-w5Sekj02.js";import{d as M,i as N,r as P}from"./voice-config-api-7cvKLNoE.js";import{t as oe}from"./personal-profile-settings-BYmKk14v.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),[i,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:i,draft:h})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[h,_,i]),(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(i!==`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}},[i]),(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(i)+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(i),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?`}[i];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)(a,{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}),i===`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.`})]}),i===`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.`})]})]}),i===`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)(a,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),i===`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)(a,{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})]},i)}),(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:[i===`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`}),i===`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||i===`connections`&&!e,onClick:()=>i===`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…`:i===`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=i(),t=r(),n=O(),a=(0,F.useRef)(n);a.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,a.current.setMiniAnchor(e)},[]),Y=(0,F.useCallback)(()=>{H&&U&&x.getState().closePersonalTasks(H)},[H,U]),X=(0,F.useCallback)(()=>{a.current.minimize(),N(e=>!e)},[]),Z=(0,F.useCallback)(()=>{H&&(a.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`,i=()=>{if(N(!1),!e)return;if(a.current.expanded){a.current.minimize();return}let t=L.current;a.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:i,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,f as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as o,n as s,o as c}from"./locale-store-CHjsq5NR.js";import{t as l}from"./messages-C7QSnTdg.js";import{t as u}from"./chat-page-LOR5JxDh.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-CntHi8Rh.js";import{c as h,o as g,s as _}from"./use-personal-work-Dd2jRUpz.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-Cehybf-G.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-CRGq-TSw.js";import{u as ae}from"./use-realtime-voice-9OvLwHzk.js";import{n as O}from"./voice-call-context-BM2A4bLz.js";import{t as k}from"./page-header-store-NP7MCIaP.js";import{s as A}from"./agent-avatar-display-D_UDgOr9.js";import{t as j}from"./personal-avatar-1TVnHakL.js";import{d as M,i as N,r as P}from"./voice-config-api-sXEIG6lz.js";import{t as oe}from"./personal-profile-settings-TcI0Zfwr.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),[i,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:i,draft:h})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[h,_,i]),(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(i!==`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}},[i]),(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(i)+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(i),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?`}[i];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)(a,{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}),i===`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.`})]}),i===`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.`})]})]}),i===`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)(a,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),i===`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)(a,{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})]},i)}),(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:[i===`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`}),i===`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||i===`connections`&&!e,onClick:()=>i===`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…`:i===`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=i(),t=r(),n=O(),a=(0,F.useRef)(n);a.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,a.current.setMiniAnchor(e)},[]),Y=(0,F.useCallback)(()=>{H&&U&&x.getState().closePersonalTasks(H)},[H,U]),X=(0,F.useCallback)(()=>{a.current.minimize(),N(e=>!e)},[]),Z=(0,F.useCallback)(()=>{H&&(a.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`,i=()=>{if(N(!1),!e)return;if(a.current.expanded){a.current.minimize();return}let t=L.current;a.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:i,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-DIIvxCDx.js";import{i,o as a}from"./locale-store-BYdvIuPj.js";import{t as o}from"./messages-lc5BjBtX.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-CUfqdnlR.js";import{N as g,t as _,v}from"./session-manager-C-oe-9_N.js";import{t as y}from"./composer-model-config-control-CrI-u8F_.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-CvtX2HcA.js";import{s as C}from"./agent-avatar-display-KbzBlJ8W.js";import{t as w}from"./personal-avatar-w5Sekj02.js";import{d as T,i as E,n as D,r as O,t as k}from"./voice-config-api-7cvKLNoE.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 _;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&&v(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{v(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&&v(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,showMessageReactions:n=!1}){let[o,s]=(0,A.useState)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(Promise.resolve()),[u,d]=(0,A.useState)(!0),[m,h]=(0,A.useState)(0),[g,_]=(0,A.useState)(null),[v,y]=(0,A.useState)(`loopi`),[x,S]=(0,A.useState)(!1),T=(0,A.useRef)(null),[E,O]=(0,A.useState)(``),[N,L]=(0,A.useState)(!1),R=(0,A.useCallback)(async()=>{_(null);try{let e=await a(i(`/api/personal-agent`)),t=c.current;c.current=e.payload,s(e.payload),e.payload&&(e.payload.displayName!==t?.displayName&&O(e.payload.displayName),e.payload.appearance!==t?.appearance&&y(e.payload.appearance))}catch(e){_(e instanceof Error?e.message:String(e))}finally{d(!1)}},[]);(0,A.useEffect)(()=>{R()},[R]),(0,A.useEffect)(()=>{let e=e=>{let t=e.detail;t&&(t.displayName!==c.current?.displayName&&O(t.displayName),t.appearance!==c.current?.appearance&&y(t.appearance),c.current=t,s(t))};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]),(0,A.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.detail;!t||t.conversationId!==c.current?.conversationId||(l.current=l.current.then(()=>{if(t.enabled!==c.current?.messageReactionsEnabled)return R()}))};return window.addEventListener(`session-agent-reaction-preference`,e),()=>window.removeEventListener(`session-agent-reaction-preference`,e)},[R,n]);let{data:z,error:B}=b(o?.state===`ready`?i(k):null,D),V=(0,A.useCallback)((e,t=!0)=>{t&&h(e=>e+1),_(null);let n=l.current.then(async()=>{let t=c.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,o=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(o)===JSON.stringify(t.voicePreference)&&(e.messageReactionsEnabled===void 0||e.messageReactionsEnabled===t.messageReactionsEnabled)&&!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:o},...e.messageReactionsEnabled===void 0?{}:{messageReactionsEnabled:e.messageReactionsEnabled},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return c.current=l.payload,s(l.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:l.payload})),!0}catch(e){return e instanceof Error&&`status`in e&&e.status===409&&await R(),_(e instanceof Error?e.message:String(e)),!1}}).finally(()=>{t&&h(e=>e-1)});return l.current=n,n},[R]),H=async t=>{if(!o||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){_(e?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(t.size===0||t.size>512*1024){_(e?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}S(!0),_(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(o.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:e.slice(e.indexOf(`,`)+1),mimeType:t.type})}),C(o.agentId),y(`custom`),L(!1),await V({appearance:`custom`})}catch(e){_(e instanceof Error?e.message:String(e))}finally{S(!1)}};if(u)return(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`})]});if(o?.state!==`ready`)return(0,j.jsxs)(`div`,{className:`space-y-3 text-sm text-fg-muted`,children:[g?(0,j.jsx)(`p`,{role:`alert`,children:g}):null,(0,j.jsx)(r,{to:`/personal`,className:`text-accent hover:underline`,children:e?`前往 Ada 完成设置`:`Finish setting up Ada`}),g?(0,j.jsx)(`button`,{type:`button`,onClick:()=>void R(),className:`ml-3 text-accent hover:underline`,children:e?`重试`:`Retry`}):null]});let U=e?`消息表情`:`Message reactions`,W=o.messageReactionsEnabled===!0;return(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":e?`Ada 助手设置`:`Ada assistant settings`,children:[(0,j.jsxs)(`div`,{className:`relative flex flex-col items-center text-center`,children:[(0,j.jsx)(`button`,{type:`button`,disabled:x,onClick:()=>L(e=>!e),"aria-expanded":N,"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:v,agentId:o.agentId,className:`size-16`})}),(0,j.jsx)(`input`,{id:`personal-name`,"aria-label":e?`助手名称`:`Assistant name`,value:E,onChange:e=>O(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(O(t),V({displayName:t})):O(c.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c.current?.displayName??``,O(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:[g&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:g}),N&&(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:()=>{y(t.id),L(!1),V({appearance:t.id})},"aria-pressed":v===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 ${v===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:T,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&&H(t),e.currentTarget.value=``}}),(0,j.jsxs)(`button`,{type:`button`,disabled:x,onClick:()=>T.current?.click(),"aria-pressed":v===`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 ${v===`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:v===`custom`?(0,j.jsx)(w,{appearance:`custom`,agentId:o.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:x?e?`上传中…`:`Uploading…`:e?`上传`:`Upload`})]})]})]}),(0,j.jsx)(P,{conversationId:o.conversationId,zh:e,onSaved:async()=>{let e=await a(i(`/api/personal-agent`));e.ok&&e.payload&&(c.current=e.payload,s(e.payload))}}),n&&(0,j.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 rounded-xl border border-edge px-4`,children:[(0,j.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:U}),(0,j.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":U,"aria-checked":W,disabled:m>0,onClick:()=>void V({messageReactionsEnabled:!W}),className:`group touch-target flex shrink-0 items-center rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-60`,children:(0,j.jsx)(`span`,{"aria-hidden":!0,className:`flex h-6 w-11 items-center rounded-full bg-fg-muted/30 p-0.5 transition-colors group-aria-checked:bg-accent motion-reduce:transition-none`,children:(0,j.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform group-aria-checked:translate-x-5 motion-reduce:transition-none`})})})]}),(0,j.jsx)(M,{preferences:o.voiceCallPreferences,settings:z,failed:!!B,disabled:m>0,zh:e,onOpenServices:t,onChange:e=>V({voiceCallPreferences:e},e.enginePreference===void 0),children:n=>(0,j.jsx)(F,{active:n,onOpenServices:t,onGreetingChange:e=>V({voiceCallPreferences:{openingGreetingEnabled:e}},!1),record:o,zh:e,onSelectVoice:e=>V({voicePreference:e})})})]})]})}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-DIIvxCDx.js";import{i,o as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./messages-C7QSnTdg.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-CUfqdnlR.js";import{N as g,t as _,v}from"./session-manager-DUWeBdeG.js";import{t as y}from"./composer-model-config-control-C2Bku39S.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-9OvLwHzk.js";import{s as C}from"./agent-avatar-display-D_UDgOr9.js";import{t as w}from"./personal-avatar-1TVnHakL.js";import{d as T,i as E,n as D,r as O,t as k}from"./voice-config-api-sXEIG6lz.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 _;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&&v(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{v(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&&v(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,showMessageReactions:n=!1}){let[o,s]=(0,A.useState)(null),c=(0,A.useRef)(null),l=(0,A.useRef)(Promise.resolve()),[u,d]=(0,A.useState)(!0),[m,h]=(0,A.useState)(0),[g,_]=(0,A.useState)(null),[v,y]=(0,A.useState)(`loopi`),[x,S]=(0,A.useState)(!1),T=(0,A.useRef)(null),[E,O]=(0,A.useState)(``),[N,L]=(0,A.useState)(!1),R=(0,A.useCallback)(async()=>{_(null);try{let e=await a(i(`/api/personal-agent`)),t=c.current;c.current=e.payload,s(e.payload),e.payload&&(e.payload.displayName!==t?.displayName&&O(e.payload.displayName),e.payload.appearance!==t?.appearance&&y(e.payload.appearance))}catch(e){_(e instanceof Error?e.message:String(e))}finally{d(!1)}},[]);(0,A.useEffect)(()=>{R()},[R]),(0,A.useEffect)(()=>{let e=e=>{let t=e.detail;t&&(t.displayName!==c.current?.displayName&&O(t.displayName),t.appearance!==c.current?.appearance&&y(t.appearance),c.current=t,s(t))};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]),(0,A.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.detail;!t||t.conversationId!==c.current?.conversationId||(l.current=l.current.then(()=>{if(t.enabled!==c.current?.messageReactionsEnabled)return R()}))};return window.addEventListener(`session-agent-reaction-preference`,e),()=>window.removeEventListener(`session-agent-reaction-preference`,e)},[R,n]);let{data:z,error:B}=b(o?.state===`ready`?i(k):null,D),V=(0,A.useCallback)((e,t=!0)=>{t&&h(e=>e+1),_(null);let n=l.current.then(async()=>{let t=c.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,o=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(o)===JSON.stringify(t.voicePreference)&&(e.messageReactionsEnabled===void 0||e.messageReactionsEnabled===t.messageReactionsEnabled)&&!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:o},...e.messageReactionsEnabled===void 0?{}:{messageReactionsEnabled:e.messageReactionsEnabled},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return c.current=l.payload,s(l.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:l.payload})),!0}catch(e){return e instanceof Error&&`status`in e&&e.status===409&&await R(),_(e instanceof Error?e.message:String(e)),!1}}).finally(()=>{t&&h(e=>e-1)});return l.current=n,n},[R]),H=async t=>{if(!o||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){_(e?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(t.size===0||t.size>512*1024){_(e?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}S(!0),_(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(o.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:e.slice(e.indexOf(`,`)+1),mimeType:t.type})}),C(o.agentId),y(`custom`),L(!1),await V({appearance:`custom`})}catch(e){_(e instanceof Error?e.message:String(e))}finally{S(!1)}};if(u)return(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`})]});if(o?.state!==`ready`)return(0,j.jsxs)(`div`,{className:`space-y-3 text-sm text-fg-muted`,children:[g?(0,j.jsx)(`p`,{role:`alert`,children:g}):null,(0,j.jsx)(r,{to:`/personal`,className:`text-accent hover:underline`,children:e?`前往 Ada 完成设置`:`Finish setting up Ada`}),g?(0,j.jsx)(`button`,{type:`button`,onClick:()=>void R(),className:`ml-3 text-accent hover:underline`,children:e?`重试`:`Retry`}):null]});let U=e?`消息表情`:`Message reactions`,W=o.messageReactionsEnabled===!0;return(0,j.jsxs)(`section`,{className:`space-y-5`,"aria-label":e?`Ada 助手设置`:`Ada assistant settings`,children:[(0,j.jsxs)(`div`,{className:`relative flex flex-col items-center text-center`,children:[(0,j.jsx)(`button`,{type:`button`,disabled:x,onClick:()=>L(e=>!e),"aria-expanded":N,"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:v,agentId:o.agentId,className:`size-16`})}),(0,j.jsx)(`input`,{id:`personal-name`,"aria-label":e?`助手名称`:`Assistant name`,value:E,onChange:e=>O(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(O(t),V({displayName:t})):O(c.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c.current?.displayName??``,O(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:[g&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:g}),N&&(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:()=>{y(t.id),L(!1),V({appearance:t.id})},"aria-pressed":v===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 ${v===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:T,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&&H(t),e.currentTarget.value=``}}),(0,j.jsxs)(`button`,{type:`button`,disabled:x,onClick:()=>T.current?.click(),"aria-pressed":v===`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 ${v===`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:v===`custom`?(0,j.jsx)(w,{appearance:`custom`,agentId:o.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:x?e?`上传中…`:`Uploading…`:e?`上传`:`Upload`})]})]})]}),(0,j.jsx)(P,{conversationId:o.conversationId,zh:e,onSaved:async()=>{let e=await a(i(`/api/personal-agent`));e.ok&&e.payload&&(c.current=e.payload,s(e.payload))}}),n&&(0,j.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 rounded-xl border border-edge px-4`,children:[(0,j.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:U}),(0,j.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":U,"aria-checked":W,disabled:m>0,onClick:()=>void V({messageReactionsEnabled:!W}),className:`group touch-target flex shrink-0 items-center rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-60`,children:(0,j.jsx)(`span`,{"aria-hidden":!0,className:`flex h-6 w-11 items-center rounded-full bg-fg-muted/30 p-0.5 transition-colors group-aria-checked:bg-accent motion-reduce:transition-none`,children:(0,j.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform group-aria-checked:translate-x-5 motion-reduce:transition-none`})})})]}),(0,j.jsx)(M,{preferences:o.voiceCallPreferences,settings:z,failed:!!B,disabled:m>0,zh:e,onOpenServices:t,onChange:e=>V({voiceCallPreferences:e},e.enginePreference===void 0),children:n=>(0,j.jsx)(F,{active:n,onOpenServices:t,onGreetingChange:e=>V({voiceCallPreferences:{openingGreetingEnabled:e}},!1),record:o,zh:e,onSelectVoice:e=>V({voicePreference:e})})})]})]})}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-BYdvIuPj.js";import{t as s}from"./popover-select-hRG1EzAY.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{St as l}from"./session-manager-C-oe-9_N.js";import{t as u}from"./voice-settings-BTvMqF_9.js";import{t as d}from"./use-personal-profile-CFaihmiJ.js";import{n as f,t as p}from"./settings-page-header-CQueaD1Z.js";import"./settings-page-layout-BlwyxcEq.js";import{t as m}from"./personal-profile-settings-BYmKk14v.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,showMessageReactions:!0}),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-CHjsq5NR.js";import{t as s}from"./popover-select-hRG1EzAY.js";import{t as c}from"./skeleton-DzdOeGYz.js";import{St as l}from"./session-manager-DUWeBdeG.js";import{t as u}from"./voice-settings-j8o-hGTm.js";import{t as d}from"./use-personal-profile-D4gLM6Wi.js";import{n as f,t as p}from"./settings-page-header-C21Iw2rD.js";import"./settings-page-layout-BXcLlp6p.js";import{t as m}from"./personal-profile-settings-TcI0Zfwr.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,showMessageReactions:!0}),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-BYdvIuPj.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-D8Xtty0g.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-CHjsq5NR.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-BhS0RWf2.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 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-DlirbHVs.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./refresh-cw-BRlGaq2w.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./skeleton-DzdOeGYz.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-C5tRaJxt.js";import{n as v}from"./open-capability-settings-DQsmJxI7.js";import{n as y}from"./providers-api-D_v_CJ3l.js";import{t as b}from"./mobile-pair-qr-CuIbmw5x.js";import{a as x,c as S,n as C,o as w,s as T}from"./phone-model-picker-MWC_Zh2a.js";import{t as ee}from"./phone-dependencies-card-DJciwZ-7.js";var E=n(),D=e(t(),1),O=r();function k({zh:e,onAdded:t}){let[n,r]=(0,D.useState)(e?`阿里云手机`:`Alibaba Cloud Phone`),[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(),[c,l]=(0,D.useState)(),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)(``),g=(0,D.useRef)(void 0),v=(0,D.useRef)(!0),y=()=>{let e=g.current;g.current=void 0,l(void 0),e&&S(`/cloud/aliyun/tests/${e}`,void 0,`DELETE`).catch(()=>{})};(0,D.useEffect)(()=>(v.current=!0,()=>{v.current=!1,g.current&&S(`/cloud/aliyun/tests/${g.current}`,void 0,`DELETE`).catch(()=>{})}),[]);let b=async()=>{if(o){y(),p(!0),h(``);try{if(o.size>16384)throw Error(e?`私钥文件不能超过 16 KB`:`Private key must be at most 16 KB`);let t=await S(`/cloud/aliyun/test`,{endpoint:i.trim(),privateKey:await o.text()});if(!v.current){S(`/cloud/aliyun/tests/${t.token}`,void 0,`DELETE`).catch(()=>{});return}g.current=t.token,l(t)}catch(e){v.current&&h(String(e instanceof Error?e.message:e))}finally{v.current&&p(!1)}}},x=async()=>{if(c){p(!0),h(``);try{await S(`/cloud/aliyun/add`,{token:c.token,name:n.trim(),makeDefault:u}),g.current=void 0,t()}catch(e){v.current&&h(String(e instanceof Error?e.message:e))}finally{v.current&&p(!1)}}},C=`mt-2 w-full rounded-xl border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`在阿里云控制台绑定密钥对并创建 ADB 连接,复制公网或 Gateway 可访问的内网地址。无需云账号 AccessKey。`:`Bind a key pair and create an ADB connection in the Alibaba console. Use an address reachable from the Gateway. No cloud account AccessKey is needed.`}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[e?`手机名称`:`Phone name`,(0,O.jsx)(`input`,{className:C,value:n,maxLength:100,disabled:f,onChange:e=>r(e.target.value)})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[e?`ADB 地址`:`ADB address`,(0,O.jsx)(`input`,{className:C,placeholder:`203.0.113.10:10001`,value:i,disabled:f,autoComplete:`off`,onChange:e=>{y(),a(e.target.value)}})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[e?`私钥文件(adbkey)`:`Private key file (adbkey)`,(0,O.jsx)(`input`,{className:C,type:`file`,disabled:f,onChange:e=>{y(),s(e.target.files?.[0])}})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`私钥仅提交到当前 Gateway,添加后保存在 Gateway 凭据目录,不会替换电脑现有 ADB 密钥。`:`The key is sent only to this Gateway and saved in its credentials directory after adding. Existing host ADB keys stay unchanged.`}),(0,O.jsx)(_,{disabled:f||!i.trim()||!o,onClick:()=>void b(),children:f?e?`处理中…`:`Working…`:e?`测试连接`:`Test connection`}),m&&(0,O.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:m}),c&&(0,O.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,O.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[e?`连接成功`:`Connected`,` · `,c.model,` · Android `,c.androidVersion]}),(0,O.jsx)(`img`,{src:c.screenshot,alt:e?`云手机当前画面`:`Current cloud phone screen`,className:`mx-auto max-h-64 rounded-lg object-contain`}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`添加后可在聊天中使用实时视频、接管操作和交还 Agent;视频不可用时使用截图。测试结果有效期为 10 分钟。默认只允许系统设置,添加后可在「管理」中调整。`:`After adding, use live video, takeover and Agent handback in chat, with snapshots when video is unavailable. Test expires after 10 minutes. Settings is the initial allowed app; adjust it in Manage.`}),(0,O.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f,onChange:e=>d(e.target.checked)}),e?`设为默认手机`:`Set as default phone`]}),(0,O.jsx)(_,{variant:`primary`,disabled:f||!n.trim()||c.expiresAt<=Date.now(),onClick:()=>void x(),children:e?`添加手机`:`Add phone`})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`移除连接只删除 xopc 的连接与私钥,不会销毁云手机,也不会关闭阿里云侧的 ADB 端口。`:`Removing a connection deletes its xopc credentials. It does not destroy the cloud phone or close its cloud ADB endpoint.`})]})}var A=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm`,j=new Set([`connected`,`timeout`,`error`,`cancelled`]);function M({zh:e,onSelect:t}){let[n,r]=(0,D.useState)(`qr`),[i,a]=(0,D.useState)(),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(``),[m,v]=(0,D.useState)(``),[y,x]=(0,D.useState)(!1),[C,w]=(0,D.useState)(``),[T,ee]=(0,D.useState)(Date.now()),E=(0,D.useRef)(void 0),k=(0,D.useRef)(0),M=(0,D.useRef)(t);M.current=t;let N=g(`phone-wireless-discovery`,()=>S(`/wireless/discovery`),{refreshInterval:4e3}),P=()=>{k.current++;let e=E.current;E.current=void 0,e&&S(`/wireless/pairings/${e}`,void 0,`DELETE`).catch(()=>{})},F=async e=>{P();let t=k.current;x(!0),w(``),a(void 0),s(``);try{if(e===`connect`){let e=await S(`/wireless/connect`,{host:c,port:Number(f)});k.current===t&&M.current(e)}else{let n=await S(`/wireless/pairings`,e===`qr`?{method:`qr`}:{method:`code`,host:c,pairingPort:Number(u),code:m,...f?{connectPort:Number(f)}:{}});if(k.current!==t){S(`/wireless/pairings/${n.id}`,void 0,`DELETE`).catch(()=>{});return}E.current=n.id,a(n),v(``)}}catch(e){k.current===t&&w(e instanceof Error?e.message:String(e))}finally{k.current===t&&x(!1)}};(0,D.useEffect)(()=>(n===`qr`&&F(`qr`),P),[n]),(0,D.useEffect)(()=>{let t=!0;return s(``),i?.qrPayload&&b(i.qrPayload).then(e=>{t&&s(e)}).catch(()=>{t&&w(e?`二维码生成失败,请重试`:`Unable to render QR code`)}),()=>{t=!1}},[i?.qrPayload,e]),(0,D.useEffect)(()=>{if(!i||j.has(i.status))return;let e=!0,t,n=async()=>{try{let r=await S(`/wireless/pairings/${i.id}`);if(!e)return;if(a(r),ee(Date.now()),r.status===`connected`&&r.device){M.current(r.device);return}j.has(r.status)||(t=setTimeout(()=>{n()},1e3))}catch(r){if(!e)return;w(r instanceof Error?r.message:String(r)),Date.now()<i.expiresAt+5e3?t=setTimeout(()=>{n()},2e3):a(e=>e&&{...e,status:`timeout`,qrPayload:void 0})}};return t=setTimeout(()=>{n()},1e3),()=>{e=!1,clearTimeout(t)}},[i?.id,i?.status]);let I=e?{waiting:`等待扫码`,pairing:`正在配对`,paired:`已配对,正在查找连接地址`,connecting:`正在连接`,connected:`已连接`,timeout:`操作超时`,error:`配对失败`,cancelled:`已取消`}:{waiting:`Waiting for scan`,pairing:`Pairing`,paired:`Paired · Finding connection address`,connecting:`Connecting`,connected:`Connected`,timeout:`Timed out`,error:`Pairing failed`,cancelled:`Cancelled`},L=y||!!(i&&!j.has(i.status));return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:e?`手机须与 Gateway 所在电脑处于同一局域网。仅浏览器与手机同网还不够。支持 Android 11 及以上。`:`Android 11+. The phone and Gateway host must share a local network.`}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":e?`无线连接方式`:`Wireless connection method`,children:[[`qr`,e?`扫码配对`:`QR pairing`],[`code`,e?`配对码`:`Pairing code`],[`connect`,e?`连接已配对设备`:`Already paired`]].map(([e,t])=>(0,O.jsx)(_,{"aria-pressed":n===e,onClick:()=>{P(),x(!1),a(void 0),w(``),s(``),r(e)},children:t},e))}),(0,O.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5 text-sm text-fg-muted`,children:[(0,O.jsx)(`li`,{children:e?`打开手机「设置 → 开发者选项 → 无线调试」。`:`Open Settings → Developer options → Wireless debugging.`}),(0,O.jsx)(`li`,{children:n===`qr`?e?`选择「使用二维码配对设备」,扫描下方二维码。`:`Choose Pair device with QR code and scan below.`:n===`code`?e?`选择「使用配对码配对设备」,填写显示的地址和六位配对码。`:`Choose Pair device with pairing code and enter its address and six-digit code.`:e?`填写无线调试首页显示的 IP 地址与连接端口。`:`Enter the IP and port shown on the main Wireless debugging screen.`})]}),N.isLoading&&(0,O.jsx)(h,{className:`h-12 w-full`}),(N.error||N.data?.mdns===!1)&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:e?`自动发现不可用。可使用配对码并手动填写连接端口。请检查 Gateway 的 ADB、网络及防火墙。`:`Discovery unavailable. Use a pairing code and enter the connection port manually. Check Gateway ADB, network and firewall.`}),n===`qr`?(0,O.jsxs)(`div`,{className:`space-y-3 text-center`,children:[o?(0,O.jsx)(`img`,{src:o,alt:e?`无线调试配对二维码`:`Wireless debugging pairing QR code`,className:`mx-auto size-60 rounded-lg bg-white`}):i&&!j.has(i.status)?(0,O.jsx)(h,{className:`mx-auto size-60`}):null,i&&(0,O.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[I[i.status],j.has(i.status)?``:` · ${Math.max(0,Math.ceil((i.expiresAt-T)/1e3))}s`]}),(0,O.jsx)(_,{disabled:y,onClick:()=>{F(`qr`)},children:e?`重新生成`:`Regenerate`})]}):(0,O.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),F(n)},children:[N.data?.services.filter(e=>e.kind===(n===`code`?`pairing`:`connect`)).map(e=>(0,O.jsxs)(_,{type:`button`,disabled:L,onClick:()=>{if(l(e.host),n===`code`){d(String(e.port));let t=N.data?.services.find(t=>t.kind===`connect`&&t.host===e.host);p(t?String(t.port):``)}else p(String(e.port))},children:[e.host,`:`,e.port]},`${e.name}:${e.port}`)),(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`手机 IP 地址`:`Phone IP address`,(0,O.jsx)(`input`,{className:A,value:c,onChange:e=>l(e.target.value.trim()),required:!0,disabled:L,placeholder:`192.168.1.10`})]}),n===`code`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`配对端口`:`Pairing port`,(0,O.jsx)(`input`,{className:A,type:`number`,min:1,max:65535,value:u,onChange:e=>d(e.target.value),required:!0,disabled:L})]}),(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`六位配对码`:`Six-digit pairing code`,(0,O.jsx)(`input`,{className:A,inputMode:`numeric`,autoComplete:`off`,pattern:`[0-9]{6}`,maxLength:6,value:m,onChange:e=>v(e.target.value),required:!0,disabled:L})]})]}),(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`连接端口`:`Connection port`,(0,O.jsx)(`input`,{className:A,type:`number`,min:1,max:65535,value:f,onChange:e=>p(e.target.value),required:n===`connect`,disabled:L,placeholder:e?`留空自动发现`:`Auto-discover if empty`})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`连接端口在无线调试首页显示,与配对端口不同,会随设备状态变化。`:`The connection port is on the main Wireless debugging screen. It differs from the pairing port and can change.`}),i&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm`,children:I[i.status]}),(0,O.jsx)(_,{type:`submit`,disabled:L,children:e?n===`code`?`配对并连接`:`连接`:n===`code`?`Pair and connect`:`Connect`})]}),i?.errorCode&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i.errorCode===`PHONE_CONNECT_TIMEOUT`?e?`已配对,但未能连接。切换「连接已配对设备」并填写当前连接端口,无需重新配对。`:`Paired but not connected. Use Already paired with the current connection port.`:e?`未完成配对。请检查手机配对页面、网络和配对码后重试。`:`Pairing incomplete. Check the phone pairing screen, network and code, then retry.`}),L&&(0,O.jsx)(_,{onClick:()=>{P(),x(!1),a(void 0),s(``)},children:e?`取消配对`:`Cancel pairing`}),C&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:C})]})}function N({zh:e,onSaved:t}){let n=g(`phone-settings`,T),[r,i]=(0,D.useState)(``),[a,o]=(0,D.useState)(``),[s,c]=(0,D.useState)(``),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``);(0,D.useEffect)(()=>{u(n.data?.config.hdcPath??``)},[n.data?.config.hdcPath]),(0,D.useEffect)(()=>{i(n.data?.config.hdcVideo?.sdkJar??``),o(n.data?.config.hdcVideo?.devecoPath??``),c(n.data?.config.hdcVideo?.javaHome??``)},[n.data?.config.hdcVideo?.sdkJar,n.data?.config.hdcVideo?.devecoPath,n.data?.config.hdcVideo?.javaHome]);async function v(){f(!0),m(``);try{await S(`/settings`,{...(await T()).config,hdcPath:l.trim()||void 0,hdcVideo:{sdkJar:r.trim()||void 0,devecoPath:a.trim()||void 0,javaHome:s.trim()||void 0}},`PATCH`),await n.mutate(),t()}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,O.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge p-3`,children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`可一键安装独立连接组件,也可复用已有 HDC、JDK 和投屏库。以下路径仅供手动配置。`:`Install standalone components above, or reuse an existing HDC, JDK and video library. These optional paths are for manual setup.`}),!n.data&&!n.error?(0,O.jsx)(h,{className:`h-10 w-full`}):(0,O.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[e?`HDC 路径(可选)`:`HDC path (optional)`,(0,O.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:e?`自动查找`:`Auto detect`,disabled:d,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 text-sm focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.data?.hdcVideo?.available?e?`已找到投屏工具,连接时会验证设备兼容性。`:`Video tools found; device compatibility is checked on connection.`:e?`实时投屏需要兼容的 HOScrcpy 和 JDK 17+;依赖未就绪时使用截图。`:`Live video requires compatible HOScrcpy and JDK 17+. Snapshots are used when unavailable.`}),(0,O.jsxs)(`details`,{className:`text-sm`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:e?`投屏工具路径(可选)`:`Video tool paths (optional)`}),(0,O.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,O.jsxs)(`label`,{className:`block space-y-1.5`,children:[e?`DevEco Studio 安装目录`:`DevEco Studio installation`,(0,O.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),disabled:d,placeholder:e?`自动查找`:`Auto detect`,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,O.jsxs)(`label`,{className:`block space-y-1.5`,children:[e?`HOScrcpy JAR(可选)`:`HOScrcpy JAR (optional)`,(0,O.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),disabled:d,placeholder:e?`自动查找托管或已有库`:`Detect managed or existing library`,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,O.jsxs)(`label`,{className:`block space-y-1.5`,children:[e?`JDK 根目录`:`JDK home`,(0,O.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),disabled:d,placeholder:e?`自动查找托管或已有 JDK`:`Detect managed or existing JDK`,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 focus-visible:outline-2 focus-visible:outline-accent`})]})]})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`修改工具路径会关闭当前手机连接,请保存后重新连接。`:`Changing tool paths closes current phone connections. Reconnect after saving.`}),(0,O.jsx)(_,{disabled:d||!n.data,onClick:()=>void v(),children:d?e?`保存中…`:`Saving…`:e?`保存连接工具路径`:`Save connection tool path`}),(p||n.error)&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p||String(n.error)})]})}var P=[{id:`wireless`,available:!0,name:[`无线连接 Android 手机`,`Wireless Android phone`],description:[`Android 11+,扫码或输入配对码,无需数据线。`,`Android 11+ · Pair with a QR code or pairing code.`]},{id:`local-hdc`,available:!0,name:[`USB 连接鸿蒙手机`,`USB HarmonyOS phone`],description:[`原生鸿蒙 · HDC 连接 · 实时投屏与基础操作。`,`Native HarmonyOS · HDC · Live video and basic actions.`]},{id:`local-adb`,available:!0,name:[`Gateway 电脑上的手机 / 模拟器`,`Phone or emulator on the Gateway host`],description:[`通过 USB 或已配对的无线 ADB 连接。`,`Connect over USB or previously paired wireless ADB.`]},{id:`remote-connector`,available:!1,name:[`通过本地连接器连接`,`Local connector`],description:[`Gateway 在服务器上,手机连接在你的电脑上。`,`Connect a phone on your computer to a remote Gateway.`]},{id:`aliyun`,available:!0,name:[`阿里云手机`,`Alibaba Cloud Phone`],description:[`填写 ADB 地址并上传私钥,连接已有云手机。`,`Connect an existing cloud phone with its ADB address and private key.`]},{id:`tencent`,available:!1,name:[`腾讯云手机`,`Tencent Cloud Phone`],description:[`连接云账号,选择地域和已有实例。`,`Connect an account, then choose a region and existing instance.`]}];function F(e){let t=(0,E.c)(69),{zh:n,onClose:r,onSelect:i,onAdded:v,initialMethod:y}=e,[b,C]=(0,D.useState)(y),w=b===`local-hdc`,T;t[0]===w?T=t[1]:(T=()=>w?S(`/devices?platform=harmonyos`):x(),t[0]=w,t[1]=T);let A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A={refreshInterval:3e3},t[2]=A):A=t[2];let j=g(b===`local-adb`?`phone-devices`:w?`phone-devices-harmonyos`:null,T,A),F;t[3]===b?F=t[4]:(F=P.find(e=>e.id===b),t[3]=b,t[4]=F);let I=F,L=+!n,R;t[5]===n?R=t[6]:(R=n?{device:`已连接,可添加`,unauthorized:`等待手机授权:解锁手机,点击「允许 USB 调试」`,offline:`设备离线:重新连接数据线或无线调试`,recovery:`恢复模式:请先启动 Android 系统`,sideload:`请退出刷机模式并启动 Android 系统`}:{device:`Connected · Ready to add`,unauthorized:`Unlock the phone and allow USB debugging`,offline:`Offline · Reconnect USB or wireless debugging`,recovery:`Boot Android before connecting`,sideload:`Exit sideload mode and boot Android`},t[5]=n,t[6]=R);let te=R,z,B,V,H,U,W,G,K,q,J;if(t[7]!==j||t[8]!==w||t[9]!==L||t[10]!==b||t[11]!==v||t[12]!==r||t[13]!==i||t[14]!==I||t[15]!==te||t[16]!==n){let e;t[27]===w?e=t[28]:(e=e=>e.platform===`harmonyos`===w,t[27]=w,t[28]=e);let g=(j.data?.discovery??[]).filter(e);V=d,H=!0,t[29]===r?U=t[30]:(U=e=>{e||r()},t[29]=r,t[30]=U),B=c,t[31]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,O.jsx)(a,{className:`fixed inset-0 z-[80] bg-black/40`}),t[31]=J):J=t[31],z=l,K=`fixed left-1/2 top-1/2 z-[81] flex h-[min(42rem,90dvh)] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay text-fg`;let y;t[32]!==b||t[33]!==n?(y=b&&(0,O.jsx)(_,{variant:`ghost`,"aria-label":n?`返回连接方式`:`Back to connection methods`,onClick:()=>C(void 0),children:(0,O.jsx)(f,{className:`size-4`})}),t[32]=b,t[33]=n,t[34]=y):y=t[34];let x=n?`添加手机`:`Add phone`,S;t[35]===x?S=t[36]:(S=(0,O.jsx)(u,{className:`text-base font-semibold`,children:x}),t[35]=x,t[36]=S);let T=I?I.name[L]:n?`选择手机连接在哪里。手机模型在添加设备后独立配置。`:`Choose where the phone connects. Phone models are configured separately.`,E;t[37]===T?E=t[38]:(E=(0,O.jsx)(o,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[37]=T,t[38]=E);let D;t[39]!==S||t[40]!==E?(D=(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,E]}),t[39]=S,t[40]=E,t[41]=D):D=t[41];let A=n?`关闭添加手机`:`Close add phone`,F;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,O.jsx)(m,{className:`size-4`}),t[42]=F):F=t[42];let R;t[43]===A?R=t[44]:(R=(0,O.jsx)(s,{asChild:!0,children:(0,O.jsx)(_,{variant:`ghost`,"aria-label":A,children:F})}),t[43]=A,t[44]=R),t[45]!==y||t[46]!==D||t[47]!==R?(q=(0,O.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 border-b border-edge p-5`,children:[y,D,R]}),t[45]=y,t[46]=D,t[47]=R,t[48]=q):q=t[48],W=`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,G=b?b===`aliyun`?(0,O.jsx)(k,{zh:n,onAdded:()=>{v?.(),r()}}):b===`wireless`?(0,O.jsx)(M,{zh:n,onSelect:i}):b!==`local-adb`&&!w?(0,O.jsxs)(`div`,{className:`space-y-4 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`此接入方式暂未支持`:`This connection method is not available yet`}),(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b===`remote-connector`?n?`后续可通过本地连接器将电脑上的手机接入远程 Gateway。当前请将手机连接到 Gateway 所在电脑。`:`A future local connector will connect your phone to a remote Gateway. For now, connect it to the Gateway host.`:n?`云手机适配器接入后,可配置云账号、选择地域和已有实例,再验证连接并添加。当前尚不能连接云实例,不会要求填写云密钥。`:`Once the cloud adapter is available, connect an account, select a region and existing instance, then verify and add it. Cloud connections are not supported yet.`}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`添加已有实例与购买、创建、销毁实例分开处理。`:`Adding existing instances is separate from purchasing, creating or destroying them.`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:n?`连接位置:Gateway 所在电脑。若 Gateway 在服务器上,浏览器无法访问你电脑的 USB 手机。`:`Connection location: the Gateway host. A remote Gateway cannot access your browser computer’s USB phone.`}),w&&(0,O.jsx)(ee,{initialPlatform:`harmonyos`,onChanged:()=>{j.mutate()}}),w&&(0,O.jsx)(N,{zh:n,onSaved:()=>{j.mutate()}}),w&&(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`通过 USB 连接,自动使用实时投屏,失败时回退到截图。手势释放后执行,文字请在手机上输入。`:`USB connection with live video and snapshot fallback. Gestures execute on release; enter text on the phone.`}),(0,O.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-sm text-fg-muted`,children:[(0,O.jsx)(`li`,{children:n?w?`鸿蒙手机开启开发者模式和 USB 调试。`:`手机开启开发者选项和 USB 调试;模拟器直接启动即可。`:w?`Enable developer mode and USB debugging on your HarmonyOS phone.`:`Enable developer options and USB debugging, or start an emulator.`}),(0,O.jsx)(`li`,{children:n?`用数据线连接 Gateway 电脑,在手机上允许 USB 调试。`:`Connect to the Gateway host with a data cable, then allow USB debugging on the phone.`}),(0,O.jsx)(`li`,{children:n?`等待下方显示设备,选择后确认名称和应用范围。`:`Select a discovered device below, then confirm its name and app access.`})]}),!w&&(0,O.jsxs)(`details`,{className:`text-sm`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:n?`使用无线连接或安装连接工具`:`Wireless connection or connection tools`}),(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:n?`可返回连接方式,选择「无线连接 Android 手机」进行扫码或配对码配对。ADB 可在手机控制页的「手机依赖状态」中手动安装,或使用 Gateway 电脑上已有的 Platform Tools;无需安装完整 Android Studio。`:`Choose Wireless Android phone to pair with a QR code or pairing code. Install ADB from Phone dependencies or use existing Platform Tools on the Gateway host.`}),(0,O.jsx)(`a`,{href:`https://developer.android.com/tools/adb`,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,children:n?`查看 Android 官方连接指引`:`Android connection guide`})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`发现的设备`:`Discovered devices`}),(0,O.jsxs)(_,{disabled:j.isValidating,onClick:()=>{j.mutate()},children:[(0,O.jsx)(p,{className:`size-4`}),n?`刷新`:`Refresh`]})]}),!j.data&&!j.error?(0,O.jsx)(h,{className:`h-24 w-full rounded-xl`}):null,(j.error||j.data?.diagnostic)&&(0,O.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[n?w?`无法检测设备,请检查 Gateway 电脑的 HDC 路径、USB 连接和手机授权。`:`无法检测设备,请检查 Gateway 电脑的 ADB 安装与连接。`:w?`Unable to detect devices. Check HDC, USB and phone authorization on the Gateway host.`:`Unable to detect devices. Check ADB on the Gateway host.`,(0,O.jsx)(`span`,{className:`mt-1 block break-all text-xs`,children:j.data?.diagnostic??String(j.error)})]}),g.map(e=>{let t=j.data?.devices.some(t=>t.serial===e.serial&&(t.platform??`android`)===(e.platform??`android`));return(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge p-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:e.serial}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:te[e.state]??e.state})]}),(0,O.jsx)(_,{disabled:t||e.state!==`device`,onClick:()=>i(e),children:t?n?`已添加`:`Added`:n?`选择设备`:`Choose device`})]},`${e.platform??`android`}:${e.serial}`)}),j.data&&!g.length&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:n?`尚未发现设备。请检查数据线、手机调试授权,或启动模拟器。`:`No devices found. Check the cable and debugging authorization, or start an emulator.`})]}):P.map(e=>(0,O.jsxs)(`button`,{className:`block min-h-20 w-full rounded-xl border border-edge bg-surface-base p-4 text-left hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>C(e.id),children:[(0,O.jsxs)(`span`,{className:`flex flex-wrap items-center justify-between gap-2 text-sm font-medium`,children:[e.name[L],!e.available&&(0,O.jsx)(`span`,{className:`text-xs font-normal text-fg-muted`,children:n?`暂未支持`:`Not available yet`})]}),(0,O.jsx)(`span`,{className:`mt-2 block text-xs text-fg-muted`,children:e.description[L]})]},e.id)),t[7]=j,t[8]=w,t[9]=L,t[10]=b,t[11]=v,t[12]=r,t[13]=i,t[14]=I,t[15]=te,t[16]=n,t[17]=z,t[18]=B,t[19]=V,t[20]=H,t[21]=U,t[22]=W,t[23]=G,t[24]=K,t[25]=q,t[26]=J}else z=t[17],B=t[18],V=t[19],H=t[20],U=t[21],W=t[22],G=t[23],K=t[24],q=t[25],J=t[26];let Y;t[49]!==W||t[50]!==G?(Y=(0,O.jsx)(`div`,{className:W,children:G}),t[49]=W,t[50]=G,t[51]=Y):Y=t[51];let ne=n?`取消`:`Cancel`,X;t[52]===ne?X=t[53]:(X=(0,O.jsx)(`footer`,{className:`flex shrink-0 justify-end border-t border-edge p-4`,children:(0,O.jsx)(s,{asChild:!0,children:(0,O.jsx)(_,{children:ne})})}),t[52]=ne,t[53]=X);let Z;t[54]!==z||t[55]!==Y||t[56]!==X||t[57]!==K||t[58]!==q?(Z=(0,O.jsxs)(z,{className:K,children:[q,Y,X]}),t[54]=z,t[55]=Y,t[56]=X,t[57]=K,t[58]=q,t[59]=Z):Z=t[59];let Q;t[60]!==B||t[61]!==Z||t[62]!==J?(Q=(0,O.jsxs)(B,{children:[J,Z]}),t[60]=B,t[61]=Z,t[62]=J,t[63]=Q):Q=t[63];let $;return t[64]!==V||t[65]!==H||t[66]!==U||t[67]!==Q?($=(0,O.jsx)(V,{open:H,onOpenChange:U,children:Q}),t[64]=V,t[65]=H,t[66]=U,t[67]=Q,t[68]=$):$=t[68],$}function I({value:e,zh:t,disabled:n,onSave:r,onSelect:a}){let o=g(`phone-models`,w),s=g(`phone-provider-meta`,y),[c,l]=(0,D.useState)(e),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(``),[m,h]=(0,D.useState)(!1);(0,D.useEffect)(()=>{l(e)},[e]);let b=o.data?.models.find(e=>e.id===c),x=c.split(`/`)[0],S=s.data?.find(e=>e.id===x)?.name??x,T=!c||!!b?.configured,ee=async()=>{if(!(u||!T)){d(!0),p(``),h(!1);try{await r(c),h(!0)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,O.jsx)(C,{value:c,onChange:e=>{l(e),a?.(e),h(!1),p(``)},zh:t,disabled:n||u})}),(0,O.jsx)(_,{variant:c===e?`secondary`:`primary`,disabled:n||u||!o.data||!T||c===e,onClick:()=>{ee()},children:u?t?`保存中…`:`Saving…`:t?`保存`:`Save`})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[c&&o.data?(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b?`${S} · ${b.configured?t?`凭据就绪`:`Credentials ready`:t?`请先配置凭据`:`Configure credentials first`}`:t?`当前模型不可用,请重新选择。`:`This model is unavailable. Choose another model.`}):null,(0,O.jsx)(i,{to:`/settings/capabilities/models?returnTo=%2Fsettings%2Fphone-use&purpose=phone`,onClick:e=>{!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&(e.preventDefault(),v(`chat`,`services`,`phone`))},className:`inline-flex min-h-8 items-center text-xs text-accent-fg hover:underline`,children:t?`管理模型`:`Manage models`})]}),f&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}),m&&(0,O.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:t?`手机模型已保存,请返回手机连接测试实际操作。`:`Phone model saved. Test it from the phone connection.`})]})}export{F as n,I as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-DlirbHVs.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./refresh-cw-BRlGaq2w.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./skeleton-DzdOeGYz.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-C5tRaJxt.js";import{n as v}from"./open-capability-settings-DQsmJxI7.js";import{n as y}from"./providers-api-D9NuB7w3.js";import{t as b}from"./mobile-pair-qr-CuIbmw5x.js";import{a as x,c as S,n as C,o as w,s as T}from"./phone-model-picker-CFoxQiws.js";import{t as ee}from"./phone-dependencies-card-B4QsgIEF.js";var E=n(),D=e(t(),1),O=r();function k({zh:e,onAdded:t}){let[n,r]=(0,D.useState)(e?`阿里云手机`:`Alibaba Cloud Phone`),[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(),[c,l]=(0,D.useState)(),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)(``),g=(0,D.useRef)(void 0),v=(0,D.useRef)(!0),y=()=>{let e=g.current;g.current=void 0,l(void 0),e&&S(`/cloud/aliyun/tests/${e}`,void 0,`DELETE`).catch(()=>{})};(0,D.useEffect)(()=>(v.current=!0,()=>{v.current=!1,g.current&&S(`/cloud/aliyun/tests/${g.current}`,void 0,`DELETE`).catch(()=>{})}),[]);let b=async()=>{if(o){y(),p(!0),h(``);try{if(o.size>16384)throw Error(e?`私钥文件不能超过 16 KB`:`Private key must be at most 16 KB`);let t=await S(`/cloud/aliyun/test`,{endpoint:i.trim(),privateKey:await o.text()});if(!v.current){S(`/cloud/aliyun/tests/${t.token}`,void 0,`DELETE`).catch(()=>{});return}g.current=t.token,l(t)}catch(e){v.current&&h(String(e instanceof Error?e.message:e))}finally{v.current&&p(!1)}}},x=async()=>{if(c){p(!0),h(``);try{await S(`/cloud/aliyun/add`,{token:c.token,name:n.trim(),makeDefault:u}),g.current=void 0,t()}catch(e){v.current&&h(String(e instanceof Error?e.message:e))}finally{v.current&&p(!1)}}},C=`mt-2 w-full rounded-xl border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`在阿里云控制台绑定密钥对并创建 ADB 连接,复制公网或 Gateway 可访问的内网地址。无需云账号 AccessKey。`:`Bind a key pair and create an ADB connection in the Alibaba console. Use an address reachable from the Gateway. No cloud account AccessKey is needed.`}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[e?`手机名称`:`Phone name`,(0,O.jsx)(`input`,{className:C,value:n,maxLength:100,disabled:f,onChange:e=>r(e.target.value)})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[e?`ADB 地址`:`ADB address`,(0,O.jsx)(`input`,{className:C,placeholder:`203.0.113.10:10001`,value:i,disabled:f,autoComplete:`off`,onChange:e=>{y(),a(e.target.value)}})]}),(0,O.jsxs)(`label`,{className:`block text-sm`,children:[e?`私钥文件(adbkey)`:`Private key file (adbkey)`,(0,O.jsx)(`input`,{className:C,type:`file`,disabled:f,onChange:e=>{y(),s(e.target.files?.[0])}})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`私钥仅提交到当前 Gateway,添加后保存在 Gateway 凭据目录,不会替换电脑现有 ADB 密钥。`:`The key is sent only to this Gateway and saved in its credentials directory after adding. Existing host ADB keys stay unchanged.`}),(0,O.jsx)(_,{disabled:f||!i.trim()||!o,onClick:()=>void b(),children:f?e?`处理中…`:`Working…`:e?`测试连接`:`Test connection`}),m&&(0,O.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:m}),c&&(0,O.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,O.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[e?`连接成功`:`Connected`,` · `,c.model,` · Android `,c.androidVersion]}),(0,O.jsx)(`img`,{src:c.screenshot,alt:e?`云手机当前画面`:`Current cloud phone screen`,className:`mx-auto max-h-64 rounded-lg object-contain`}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`添加后可在聊天中使用实时视频、接管操作和交还 Agent;视频不可用时使用截图。测试结果有效期为 10 分钟。默认只允许系统设置,添加后可在「管理」中调整。`:`After adding, use live video, takeover and Agent handback in chat, with snapshots when video is unavailable. Test expires after 10 minutes. Settings is the initial allowed app; adjust it in Manage.`}),(0,O.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f,onChange:e=>d(e.target.checked)}),e?`设为默认手机`:`Set as default phone`]}),(0,O.jsx)(_,{variant:`primary`,disabled:f||!n.trim()||c.expiresAt<=Date.now(),onClick:()=>void x(),children:e?`添加手机`:`Add phone`})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`移除连接只删除 xopc 的连接与私钥,不会销毁云手机,也不会关闭阿里云侧的 ADB 端口。`:`Removing a connection deletes its xopc credentials. It does not destroy the cloud phone or close its cloud ADB endpoint.`})]})}var A=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm`,j=new Set([`connected`,`timeout`,`error`,`cancelled`]);function M({zh:e,onSelect:t}){let[n,r]=(0,D.useState)(`qr`),[i,a]=(0,D.useState)(),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(``),[m,v]=(0,D.useState)(``),[y,x]=(0,D.useState)(!1),[C,w]=(0,D.useState)(``),[T,ee]=(0,D.useState)(Date.now()),E=(0,D.useRef)(void 0),k=(0,D.useRef)(0),M=(0,D.useRef)(t);M.current=t;let N=g(`phone-wireless-discovery`,()=>S(`/wireless/discovery`),{refreshInterval:4e3}),P=()=>{k.current++;let e=E.current;E.current=void 0,e&&S(`/wireless/pairings/${e}`,void 0,`DELETE`).catch(()=>{})},F=async e=>{P();let t=k.current;x(!0),w(``),a(void 0),s(``);try{if(e===`connect`){let e=await S(`/wireless/connect`,{host:c,port:Number(f)});k.current===t&&M.current(e)}else{let n=await S(`/wireless/pairings`,e===`qr`?{method:`qr`}:{method:`code`,host:c,pairingPort:Number(u),code:m,...f?{connectPort:Number(f)}:{}});if(k.current!==t){S(`/wireless/pairings/${n.id}`,void 0,`DELETE`).catch(()=>{});return}E.current=n.id,a(n),v(``)}}catch(e){k.current===t&&w(e instanceof Error?e.message:String(e))}finally{k.current===t&&x(!1)}};(0,D.useEffect)(()=>(n===`qr`&&F(`qr`),P),[n]),(0,D.useEffect)(()=>{let t=!0;return s(``),i?.qrPayload&&b(i.qrPayload).then(e=>{t&&s(e)}).catch(()=>{t&&w(e?`二维码生成失败,请重试`:`Unable to render QR code`)}),()=>{t=!1}},[i?.qrPayload,e]),(0,D.useEffect)(()=>{if(!i||j.has(i.status))return;let e=!0,t,n=async()=>{try{let r=await S(`/wireless/pairings/${i.id}`);if(!e)return;if(a(r),ee(Date.now()),r.status===`connected`&&r.device){M.current(r.device);return}j.has(r.status)||(t=setTimeout(()=>{n()},1e3))}catch(r){if(!e)return;w(r instanceof Error?r.message:String(r)),Date.now()<i.expiresAt+5e3?t=setTimeout(()=>{n()},2e3):a(e=>e&&{...e,status:`timeout`,qrPayload:void 0})}};return t=setTimeout(()=>{n()},1e3),()=>{e=!1,clearTimeout(t)}},[i?.id,i?.status]);let I=e?{waiting:`等待扫码`,pairing:`正在配对`,paired:`已配对,正在查找连接地址`,connecting:`正在连接`,connected:`已连接`,timeout:`操作超时`,error:`配对失败`,cancelled:`已取消`}:{waiting:`Waiting for scan`,pairing:`Pairing`,paired:`Paired · Finding connection address`,connecting:`Connecting`,connected:`Connected`,timeout:`Timed out`,error:`Pairing failed`,cancelled:`Cancelled`},L=y||!!(i&&!j.has(i.status));return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:e?`手机须与 Gateway 所在电脑处于同一局域网。仅浏览器与手机同网还不够。支持 Android 11 及以上。`:`Android 11+. The phone and Gateway host must share a local network.`}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":e?`无线连接方式`:`Wireless connection method`,children:[[`qr`,e?`扫码配对`:`QR pairing`],[`code`,e?`配对码`:`Pairing code`],[`connect`,e?`连接已配对设备`:`Already paired`]].map(([e,t])=>(0,O.jsx)(_,{"aria-pressed":n===e,onClick:()=>{P(),x(!1),a(void 0),w(``),s(``),r(e)},children:t},e))}),(0,O.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5 text-sm text-fg-muted`,children:[(0,O.jsx)(`li`,{children:e?`打开手机「设置 → 开发者选项 → 无线调试」。`:`Open Settings → Developer options → Wireless debugging.`}),(0,O.jsx)(`li`,{children:n===`qr`?e?`选择「使用二维码配对设备」,扫描下方二维码。`:`Choose Pair device with QR code and scan below.`:n===`code`?e?`选择「使用配对码配对设备」,填写显示的地址和六位配对码。`:`Choose Pair device with pairing code and enter its address and six-digit code.`:e?`填写无线调试首页显示的 IP 地址与连接端口。`:`Enter the IP and port shown on the main Wireless debugging screen.`})]}),N.isLoading&&(0,O.jsx)(h,{className:`h-12 w-full`}),(N.error||N.data?.mdns===!1)&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:e?`自动发现不可用。可使用配对码并手动填写连接端口。请检查 Gateway 的 ADB、网络及防火墙。`:`Discovery unavailable. Use a pairing code and enter the connection port manually. Check Gateway ADB, network and firewall.`}),n===`qr`?(0,O.jsxs)(`div`,{className:`space-y-3 text-center`,children:[o?(0,O.jsx)(`img`,{src:o,alt:e?`无线调试配对二维码`:`Wireless debugging pairing QR code`,className:`mx-auto size-60 rounded-lg bg-white`}):i&&!j.has(i.status)?(0,O.jsx)(h,{className:`mx-auto size-60`}):null,i&&(0,O.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[I[i.status],j.has(i.status)?``:` · ${Math.max(0,Math.ceil((i.expiresAt-T)/1e3))}s`]}),(0,O.jsx)(_,{disabled:y,onClick:()=>{F(`qr`)},children:e?`重新生成`:`Regenerate`})]}):(0,O.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),F(n)},children:[N.data?.services.filter(e=>e.kind===(n===`code`?`pairing`:`connect`)).map(e=>(0,O.jsxs)(_,{type:`button`,disabled:L,onClick:()=>{if(l(e.host),n===`code`){d(String(e.port));let t=N.data?.services.find(t=>t.kind===`connect`&&t.host===e.host);p(t?String(t.port):``)}else p(String(e.port))},children:[e.host,`:`,e.port]},`${e.name}:${e.port}`)),(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`手机 IP 地址`:`Phone IP address`,(0,O.jsx)(`input`,{className:A,value:c,onChange:e=>l(e.target.value.trim()),required:!0,disabled:L,placeholder:`192.168.1.10`})]}),n===`code`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`配对端口`:`Pairing port`,(0,O.jsx)(`input`,{className:A,type:`number`,min:1,max:65535,value:u,onChange:e=>d(e.target.value),required:!0,disabled:L})]}),(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`六位配对码`:`Six-digit pairing code`,(0,O.jsx)(`input`,{className:A,inputMode:`numeric`,autoComplete:`off`,pattern:`[0-9]{6}`,maxLength:6,value:m,onChange:e=>v(e.target.value),required:!0,disabled:L})]})]}),(0,O.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[e?`连接端口`:`Connection port`,(0,O.jsx)(`input`,{className:A,type:`number`,min:1,max:65535,value:f,onChange:e=>p(e.target.value),required:n===`connect`,disabled:L,placeholder:e?`留空自动发现`:`Auto-discover if empty`})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`连接端口在无线调试首页显示,与配对端口不同,会随设备状态变化。`:`The connection port is on the main Wireless debugging screen. It differs from the pairing port and can change.`}),i&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm`,children:I[i.status]}),(0,O.jsx)(_,{type:`submit`,disabled:L,children:e?n===`code`?`配对并连接`:`连接`:n===`code`?`Pair and connect`:`Connect`})]}),i?.errorCode&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:i.errorCode===`PHONE_CONNECT_TIMEOUT`?e?`已配对,但未能连接。切换「连接已配对设备」并填写当前连接端口,无需重新配对。`:`Paired but not connected. Use Already paired with the current connection port.`:e?`未完成配对。请检查手机配对页面、网络和配对码后重试。`:`Pairing incomplete. Check the phone pairing screen, network and code, then retry.`}),L&&(0,O.jsx)(_,{onClick:()=>{P(),x(!1),a(void 0),s(``)},children:e?`取消配对`:`Cancel pairing`}),C&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:C})]})}function N({zh:e,onSaved:t}){let n=g(`phone-settings`,T),[r,i]=(0,D.useState)(``),[a,o]=(0,D.useState)(``),[s,c]=(0,D.useState)(``),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``);(0,D.useEffect)(()=>{u(n.data?.config.hdcPath??``)},[n.data?.config.hdcPath]),(0,D.useEffect)(()=>{i(n.data?.config.hdcVideo?.sdkJar??``),o(n.data?.config.hdcVideo?.devecoPath??``),c(n.data?.config.hdcVideo?.javaHome??``)},[n.data?.config.hdcVideo?.sdkJar,n.data?.config.hdcVideo?.devecoPath,n.data?.config.hdcVideo?.javaHome]);async function v(){f(!0),m(``);try{await S(`/settings`,{...(await T()).config,hdcPath:l.trim()||void 0,hdcVideo:{sdkJar:r.trim()||void 0,devecoPath:a.trim()||void 0,javaHome:s.trim()||void 0}},`PATCH`),await n.mutate(),t()}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,O.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge p-3`,children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`可一键安装独立连接组件,也可复用已有 HDC、JDK 和投屏库。以下路径仅供手动配置。`:`Install standalone components above, or reuse an existing HDC, JDK and video library. These optional paths are for manual setup.`}),!n.data&&!n.error?(0,O.jsx)(h,{className:`h-10 w-full`}):(0,O.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[e?`HDC 路径(可选)`:`HDC path (optional)`,(0,O.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:e?`自动查找`:`Auto detect`,disabled:d,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 text-sm focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.data?.hdcVideo?.available?e?`已找到投屏工具,连接时会验证设备兼容性。`:`Video tools found; device compatibility is checked on connection.`:e?`实时投屏需要兼容的 HOScrcpy 和 JDK 17+;依赖未就绪时使用截图。`:`Live video requires compatible HOScrcpy and JDK 17+. Snapshots are used when unavailable.`}),(0,O.jsxs)(`details`,{className:`text-sm`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:e?`投屏工具路径(可选)`:`Video tool paths (optional)`}),(0,O.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,O.jsxs)(`label`,{className:`block space-y-1.5`,children:[e?`DevEco Studio 安装目录`:`DevEco Studio installation`,(0,O.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),disabled:d,placeholder:e?`自动查找`:`Auto detect`,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,O.jsxs)(`label`,{className:`block space-y-1.5`,children:[e?`HOScrcpy JAR(可选)`:`HOScrcpy JAR (optional)`,(0,O.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),disabled:d,placeholder:e?`自动查找托管或已有库`:`Detect managed or existing library`,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,O.jsxs)(`label`,{className:`block space-y-1.5`,children:[e?`JDK 根目录`:`JDK home`,(0,O.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),disabled:d,placeholder:e?`自动查找托管或已有 JDK`:`Detect managed or existing JDK`,className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base px-3 focus-visible:outline-2 focus-visible:outline-accent`})]})]})]}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`修改工具路径会关闭当前手机连接,请保存后重新连接。`:`Changing tool paths closes current phone connections. Reconnect after saving.`}),(0,O.jsx)(_,{disabled:d||!n.data,onClick:()=>void v(),children:d?e?`保存中…`:`Saving…`:e?`保存连接工具路径`:`Save connection tool path`}),(p||n.error)&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p||String(n.error)})]})}var P=[{id:`wireless`,available:!0,name:[`无线连接 Android 手机`,`Wireless Android phone`],description:[`Android 11+,扫码或输入配对码,无需数据线。`,`Android 11+ · Pair with a QR code or pairing code.`]},{id:`local-hdc`,available:!0,name:[`USB 连接鸿蒙手机`,`USB HarmonyOS phone`],description:[`原生鸿蒙 · HDC 连接 · 实时投屏与基础操作。`,`Native HarmonyOS · HDC · Live video and basic actions.`]},{id:`local-adb`,available:!0,name:[`Gateway 电脑上的手机 / 模拟器`,`Phone or emulator on the Gateway host`],description:[`通过 USB 或已配对的无线 ADB 连接。`,`Connect over USB or previously paired wireless ADB.`]},{id:`remote-connector`,available:!1,name:[`通过本地连接器连接`,`Local connector`],description:[`Gateway 在服务器上,手机连接在你的电脑上。`,`Connect a phone on your computer to a remote Gateway.`]},{id:`aliyun`,available:!0,name:[`阿里云手机`,`Alibaba Cloud Phone`],description:[`填写 ADB 地址并上传私钥,连接已有云手机。`,`Connect an existing cloud phone with its ADB address and private key.`]},{id:`tencent`,available:!1,name:[`腾讯云手机`,`Tencent Cloud Phone`],description:[`连接云账号,选择地域和已有实例。`,`Connect an account, then choose a region and existing instance.`]}];function F(e){let t=(0,E.c)(69),{zh:n,onClose:r,onSelect:i,onAdded:v,initialMethod:y}=e,[b,C]=(0,D.useState)(y),w=b===`local-hdc`,T;t[0]===w?T=t[1]:(T=()=>w?S(`/devices?platform=harmonyos`):x(),t[0]=w,t[1]=T);let A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A={refreshInterval:3e3},t[2]=A):A=t[2];let j=g(b===`local-adb`?`phone-devices`:w?`phone-devices-harmonyos`:null,T,A),F;t[3]===b?F=t[4]:(F=P.find(e=>e.id===b),t[3]=b,t[4]=F);let I=F,L=+!n,R;t[5]===n?R=t[6]:(R=n?{device:`已连接,可添加`,unauthorized:`等待手机授权:解锁手机,点击「允许 USB 调试」`,offline:`设备离线:重新连接数据线或无线调试`,recovery:`恢复模式:请先启动 Android 系统`,sideload:`请退出刷机模式并启动 Android 系统`}:{device:`Connected · Ready to add`,unauthorized:`Unlock the phone and allow USB debugging`,offline:`Offline · Reconnect USB or wireless debugging`,recovery:`Boot Android before connecting`,sideload:`Exit sideload mode and boot Android`},t[5]=n,t[6]=R);let te=R,z,B,V,H,U,W,G,K,q,J;if(t[7]!==j||t[8]!==w||t[9]!==L||t[10]!==b||t[11]!==v||t[12]!==r||t[13]!==i||t[14]!==I||t[15]!==te||t[16]!==n){let e;t[27]===w?e=t[28]:(e=e=>e.platform===`harmonyos`===w,t[27]=w,t[28]=e);let g=(j.data?.discovery??[]).filter(e);V=d,H=!0,t[29]===r?U=t[30]:(U=e=>{e||r()},t[29]=r,t[30]=U),B=c,t[31]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,O.jsx)(a,{className:`fixed inset-0 z-[80] bg-black/40`}),t[31]=J):J=t[31],z=l,K=`fixed left-1/2 top-1/2 z-[81] flex h-[min(42rem,90dvh)] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay text-fg`;let y;t[32]!==b||t[33]!==n?(y=b&&(0,O.jsx)(_,{variant:`ghost`,"aria-label":n?`返回连接方式`:`Back to connection methods`,onClick:()=>C(void 0),children:(0,O.jsx)(f,{className:`size-4`})}),t[32]=b,t[33]=n,t[34]=y):y=t[34];let x=n?`添加手机`:`Add phone`,S;t[35]===x?S=t[36]:(S=(0,O.jsx)(u,{className:`text-base font-semibold`,children:x}),t[35]=x,t[36]=S);let T=I?I.name[L]:n?`选择手机连接在哪里。手机模型在添加设备后独立配置。`:`Choose where the phone connects. Phone models are configured separately.`,E;t[37]===T?E=t[38]:(E=(0,O.jsx)(o,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[37]=T,t[38]=E);let D;t[39]!==S||t[40]!==E?(D=(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,E]}),t[39]=S,t[40]=E,t[41]=D):D=t[41];let A=n?`关闭添加手机`:`Close add phone`,F;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,O.jsx)(m,{className:`size-4`}),t[42]=F):F=t[42];let R;t[43]===A?R=t[44]:(R=(0,O.jsx)(s,{asChild:!0,children:(0,O.jsx)(_,{variant:`ghost`,"aria-label":A,children:F})}),t[43]=A,t[44]=R),t[45]!==y||t[46]!==D||t[47]!==R?(q=(0,O.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 border-b border-edge p-5`,children:[y,D,R]}),t[45]=y,t[46]=D,t[47]=R,t[48]=q):q=t[48],W=`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,G=b?b===`aliyun`?(0,O.jsx)(k,{zh:n,onAdded:()=>{v?.(),r()}}):b===`wireless`?(0,O.jsx)(M,{zh:n,onSelect:i}):b!==`local-adb`&&!w?(0,O.jsxs)(`div`,{className:`space-y-4 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`此接入方式暂未支持`:`This connection method is not available yet`}),(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b===`remote-connector`?n?`后续可通过本地连接器将电脑上的手机接入远程 Gateway。当前请将手机连接到 Gateway 所在电脑。`:`A future local connector will connect your phone to a remote Gateway. For now, connect it to the Gateway host.`:n?`云手机适配器接入后,可配置云账号、选择地域和已有实例,再验证连接并添加。当前尚不能连接云实例,不会要求填写云密钥。`:`Once the cloud adapter is available, connect an account, select a region and existing instance, then verify and add it. Cloud connections are not supported yet.`}),(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`添加已有实例与购买、创建、销毁实例分开处理。`:`Adding existing instances is separate from purchasing, creating or destroying them.`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:n?`连接位置:Gateway 所在电脑。若 Gateway 在服务器上,浏览器无法访问你电脑的 USB 手机。`:`Connection location: the Gateway host. A remote Gateway cannot access your browser computer’s USB phone.`}),w&&(0,O.jsx)(ee,{initialPlatform:`harmonyos`,onChanged:()=>{j.mutate()}}),w&&(0,O.jsx)(N,{zh:n,onSaved:()=>{j.mutate()}}),w&&(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`通过 USB 连接,自动使用实时投屏,失败时回退到截图。手势释放后执行,文字请在手机上输入。`:`USB connection with live video and snapshot fallback. Gestures execute on release; enter text on the phone.`}),(0,O.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-sm text-fg-muted`,children:[(0,O.jsx)(`li`,{children:n?w?`鸿蒙手机开启开发者模式和 USB 调试。`:`手机开启开发者选项和 USB 调试;模拟器直接启动即可。`:w?`Enable developer mode and USB debugging on your HarmonyOS phone.`:`Enable developer options and USB debugging, or start an emulator.`}),(0,O.jsx)(`li`,{children:n?`用数据线连接 Gateway 电脑,在手机上允许 USB 调试。`:`Connect to the Gateway host with a data cable, then allow USB debugging on the phone.`}),(0,O.jsx)(`li`,{children:n?`等待下方显示设备,选择后确认名称和应用范围。`:`Select a discovered device below, then confirm its name and app access.`})]}),!w&&(0,O.jsxs)(`details`,{className:`text-sm`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:n?`使用无线连接或安装连接工具`:`Wireless connection or connection tools`}),(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:n?`可返回连接方式,选择「无线连接 Android 手机」进行扫码或配对码配对。ADB 可在手机控制页的「手机依赖状态」中手动安装,或使用 Gateway 电脑上已有的 Platform Tools;无需安装完整 Android Studio。`:`Choose Wireless Android phone to pair with a QR code or pairing code. Install ADB from Phone dependencies or use existing Platform Tools on the Gateway host.`}),(0,O.jsx)(`a`,{href:`https://developer.android.com/tools/adb`,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,children:n?`查看 Android 官方连接指引`:`Android connection guide`})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`发现的设备`:`Discovered devices`}),(0,O.jsxs)(_,{disabled:j.isValidating,onClick:()=>{j.mutate()},children:[(0,O.jsx)(p,{className:`size-4`}),n?`刷新`:`Refresh`]})]}),!j.data&&!j.error?(0,O.jsx)(h,{className:`h-24 w-full rounded-xl`}):null,(j.error||j.data?.diagnostic)&&(0,O.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[n?w?`无法检测设备,请检查 Gateway 电脑的 HDC 路径、USB 连接和手机授权。`:`无法检测设备,请检查 Gateway 电脑的 ADB 安装与连接。`:w?`Unable to detect devices. Check HDC, USB and phone authorization on the Gateway host.`:`Unable to detect devices. Check ADB on the Gateway host.`,(0,O.jsx)(`span`,{className:`mt-1 block break-all text-xs`,children:j.data?.diagnostic??String(j.error)})]}),g.map(e=>{let t=j.data?.devices.some(t=>t.serial===e.serial&&(t.platform??`android`)===(e.platform??`android`));return(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge p-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:e.serial}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:te[e.state]??e.state})]}),(0,O.jsx)(_,{disabled:t||e.state!==`device`,onClick:()=>i(e),children:t?n?`已添加`:`Added`:n?`选择设备`:`Choose device`})]},`${e.platform??`android`}:${e.serial}`)}),j.data&&!g.length&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:n?`尚未发现设备。请检查数据线、手机调试授权,或启动模拟器。`:`No devices found. Check the cable and debugging authorization, or start an emulator.`})]}):P.map(e=>(0,O.jsxs)(`button`,{className:`block min-h-20 w-full rounded-xl border border-edge bg-surface-base p-4 text-left hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>C(e.id),children:[(0,O.jsxs)(`span`,{className:`flex flex-wrap items-center justify-between gap-2 text-sm font-medium`,children:[e.name[L],!e.available&&(0,O.jsx)(`span`,{className:`text-xs font-normal text-fg-muted`,children:n?`暂未支持`:`Not available yet`})]}),(0,O.jsx)(`span`,{className:`mt-2 block text-xs text-fg-muted`,children:e.description[L]})]},e.id)),t[7]=j,t[8]=w,t[9]=L,t[10]=b,t[11]=v,t[12]=r,t[13]=i,t[14]=I,t[15]=te,t[16]=n,t[17]=z,t[18]=B,t[19]=V,t[20]=H,t[21]=U,t[22]=W,t[23]=G,t[24]=K,t[25]=q,t[26]=J}else z=t[17],B=t[18],V=t[19],H=t[20],U=t[21],W=t[22],G=t[23],K=t[24],q=t[25],J=t[26];let Y;t[49]!==W||t[50]!==G?(Y=(0,O.jsx)(`div`,{className:W,children:G}),t[49]=W,t[50]=G,t[51]=Y):Y=t[51];let ne=n?`取消`:`Cancel`,X;t[52]===ne?X=t[53]:(X=(0,O.jsx)(`footer`,{className:`flex shrink-0 justify-end border-t border-edge p-4`,children:(0,O.jsx)(s,{asChild:!0,children:(0,O.jsx)(_,{children:ne})})}),t[52]=ne,t[53]=X);let Z;t[54]!==z||t[55]!==Y||t[56]!==X||t[57]!==K||t[58]!==q?(Z=(0,O.jsxs)(z,{className:K,children:[q,Y,X]}),t[54]=z,t[55]=Y,t[56]=X,t[57]=K,t[58]=q,t[59]=Z):Z=t[59];let Q;t[60]!==B||t[61]!==Z||t[62]!==J?(Q=(0,O.jsxs)(B,{children:[J,Z]}),t[60]=B,t[61]=Z,t[62]=J,t[63]=Q):Q=t[63];let $;return t[64]!==V||t[65]!==H||t[66]!==U||t[67]!==Q?($=(0,O.jsx)(V,{open:H,onOpenChange:U,children:Q}),t[64]=V,t[65]=H,t[66]=U,t[67]=Q,t[68]=$):$=t[68],$}function I({value:e,zh:t,disabled:n,onSave:r,onSelect:a}){let o=g(`phone-models`,w),s=g(`phone-provider-meta`,y),[c,l]=(0,D.useState)(e),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(``),[m,h]=(0,D.useState)(!1);(0,D.useEffect)(()=>{l(e)},[e]);let b=o.data?.models.find(e=>e.id===c),x=c.split(`/`)[0],S=s.data?.find(e=>e.id===x)?.name??x,T=!c||!!b?.configured,ee=async()=>{if(!(u||!T)){d(!0),p(``),h(!1);try{await r(c),h(!0)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,O.jsx)(C,{value:c,onChange:e=>{l(e),a?.(e),h(!1),p(``)},zh:t,disabled:n||u})}),(0,O.jsx)(_,{variant:c===e?`secondary`:`primary`,disabled:n||u||!o.data||!T||c===e,onClick:()=>{ee()},children:u?t?`保存中…`:`Saving…`:t?`保存`:`Save`})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[c&&o.data?(0,O.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b?`${S} · ${b.configured?t?`凭据就绪`:`Credentials ready`:t?`请先配置凭据`:`Configure credentials first`}`:t?`当前模型不可用,请重新选择。`:`This model is unavailable. Choose another model.`}):null,(0,O.jsx)(i,{to:`/settings/capabilities/models?returnTo=%2Fsettings%2Fphone-use&purpose=phone`,onClick:e=>{!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&(e.preventDefault(),v(`chat`,`services`,`phone`))},className:`inline-flex min-h-8 items-center text-xs text-accent-fg hover:underline`,children:t?`管理模型`:`Manage models`})]}),f&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}),m&&(0,O.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:t?`手机模型已保存,请返回手机连接测试实际操作。`:`Phone model saved. Test it from the phone connection.`})]})}export{F as n,I as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-BYdvIuPj.js";import{n as i,r as a}from"./popover-select-hRG1EzAY.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{i as s}from"./vendor-swr-CdRzEUwF.js";import{n as c}from"./model-sort-_Tz8s_4N.js";var l=e(),u=`phone-mock/settings-about`;async function d(e,t,i=t===void 0?`GET`:`POST`){let a=await r(n(`/api/phone${e}`),{method:i,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!a.ok)throw Error(a.error?.message??`Phone operation failed`);return a.payload}var f=()=>d(`/settings`),p=()=>d(`/devices`),m=()=>d(`/models`);async function h(e,t,n){return(await d(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}${n?`&platform=${n}`:``}`)).applications}var g=t();function _(e){let t=(0,l.c)(36),{value:n,onChange:r,zh:u,disabled:d}=e,f=d!==void 0&&d,p=s(`phone-models`,m),h,_,b,x,S,C,w,T,E,D;if(t[0]!==f||t[1]!==p.data||t[2]!==p.error||t[3]!==r||t[4]!==n||t[5]!==u){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=p.data?.models.filter(y).sort(c)??[];if(!p.data&&!p.error){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,g.jsx)(o,{className:`h-11 w-full rounded-lg`}),t[16]=e):e=t[16],_=e;break bb0}D=`space-y-2`,h=i,b=u?`手机模型`:`Phone model`,x=n,S=f||!!p.error,t[17]===r?C=t[18]:(C=e=>r(e.target.value),t[17]=r,t[18]=C);let s=u?`未配置`:`Not configured`;t[19]===s?w=t[20]:(w=(0,g.jsx)(a,{value:``,children:s}),t[19]=s,t[20]=w),T=n&&!e.some(e=>e.id===n)&&(0,g.jsx)(a,{value:n,disabled:!0,children:u?`当前模型不可用,请重新选择`:`Current model unavailable; choose another`}),E=e.map(v)}t[0]=f,t[1]=p.data,t[2]=p.error,t[3]=r,t[4]=n,t[5]=u,t[6]=h,t[7]=_,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w,t[13]=T,t[14]=E,t[15]=D}else h=t[6],_=t[7],b=t[8],x=t[9],S=t[10],C=t[11],w=t[12],T=t[13],E=t[14],D=t[15];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let O;t[21]!==h||t[22]!==b||t[23]!==x||t[24]!==S||t[25]!==C||t[26]!==w||t[27]!==T||t[28]!==E?(O=(0,g.jsxs)(h,{"aria-label":b,value:x,disabled:S,onChange:C,children:[w,T,E]}),t[21]=h,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=O):O=t[29];let k;t[30]===p.error?k=t[31]:(k=p.error&&(0,g.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(p.error)}),t[30]=p.error,t[31]=k);let A;return t[32]!==O||t[33]!==k||t[34]!==D?(A=(0,g.jsxs)(`div`,{className:D,children:[O,k]}),t[32]=O,t[33]=k,t[34]=D,t[35]=A):A=t[35],A}function v(e){return(0,g.jsx)(a,{value:e.id,children:`${e.name} · ${e.id.split(`/`)[0]}`},e.id)}function y(e){return e.configured}function b(e){let t=(0,l.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,g.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let c=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===c?u=t[3]:(u=(0,g.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:c}),t[2]=c,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,g.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,g.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]!==d||t[15]!==m?(h=(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=h):h=t[16];let v;t[17]!==i||t[18]!==n||t[19]!==a?(v=n&&(0,g.jsx)(_,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==h?(y=(0,g.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[h,v]}),t[21]=v,t[22]=h,t[23]=y):y=t[23],y}export{p as a,d as c,h as i,_ as n,m as o,u as r,f as s,b as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{i as n,o as r}from"./locale-store-CHjsq5NR.js";import{n as i,r as a}from"./popover-select-hRG1EzAY.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{i as s}from"./vendor-swr-CdRzEUwF.js";import{n as c}from"./model-sort-_Tz8s_4N.js";var l=e(),u=`phone-mock/settings-about`;async function d(e,t,i=t===void 0?`GET`:`POST`){let a=await r(n(`/api/phone${e}`),{method:i,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!a.ok)throw Error(a.error?.message??`Phone operation failed`);return a.payload}var f=()=>d(`/settings`),p=()=>d(`/devices`),m=()=>d(`/models`);async function h(e,t,n){return(await d(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}${n?`&platform=${n}`:``}`)).applications}var g=t();function _(e){let t=(0,l.c)(36),{value:n,onChange:r,zh:u,disabled:d}=e,f=d!==void 0&&d,p=s(`phone-models`,m),h,_,b,x,S,C,w,T,E,D;if(t[0]!==f||t[1]!==p.data||t[2]!==p.error||t[3]!==r||t[4]!==n||t[5]!==u){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=p.data?.models.filter(y).sort(c)??[];if(!p.data&&!p.error){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,g.jsx)(o,{className:`h-11 w-full rounded-lg`}),t[16]=e):e=t[16],_=e;break bb0}D=`space-y-2`,h=i,b=u?`手机模型`:`Phone model`,x=n,S=f||!!p.error,t[17]===r?C=t[18]:(C=e=>r(e.target.value),t[17]=r,t[18]=C);let s=u?`未配置`:`Not configured`;t[19]===s?w=t[20]:(w=(0,g.jsx)(a,{value:``,children:s}),t[19]=s,t[20]=w),T=n&&!e.some(e=>e.id===n)&&(0,g.jsx)(a,{value:n,disabled:!0,children:u?`当前模型不可用,请重新选择`:`Current model unavailable; choose another`}),E=e.map(v)}t[0]=f,t[1]=p.data,t[2]=p.error,t[3]=r,t[4]=n,t[5]=u,t[6]=h,t[7]=_,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w,t[13]=T,t[14]=E,t[15]=D}else h=t[6],_=t[7],b=t[8],x=t[9],S=t[10],C=t[11],w=t[12],T=t[13],E=t[14],D=t[15];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let O;t[21]!==h||t[22]!==b||t[23]!==x||t[24]!==S||t[25]!==C||t[26]!==w||t[27]!==T||t[28]!==E?(O=(0,g.jsxs)(h,{"aria-label":b,value:x,disabled:S,onChange:C,children:[w,T,E]}),t[21]=h,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=O):O=t[29];let k;t[30]===p.error?k=t[31]:(k=p.error&&(0,g.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(p.error)}),t[30]=p.error,t[31]=k);let A;return t[32]!==O||t[33]!==k||t[34]!==D?(A=(0,g.jsxs)(`div`,{className:D,children:[O,k]}),t[32]=O,t[33]=k,t[34]=D,t[35]=A):A=t[35],A}function v(e){return(0,g.jsx)(a,{value:e.id,children:`${e.name} · ${e.id.split(`/`)[0]}`},e.id)}function y(e){return e.configured}function b(e){let t=(0,l.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,g.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let c=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===c?u=t[3]:(u=(0,g.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:c}),t[2]=c,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,g.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,g.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]!==d||t[15]!==m?(h=(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=h):h=t[16];let v;t[17]!==i||t[18]!==n||t[19]!==a?(v=n&&(0,g.jsx)(_,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==h?(y=(0,g.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[h,v]}),t[21]=v,t[22]=h,t[23]=y):y=t[23],y}export{p as a,d as c,h as i,_ as n,m as o,u as r,f as s,b as t};