@xopcai/xopc 0.0.467 → 0.0.469
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.
- package/dist/browser-ext/dist/sidepanel.js +5 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CdEua6PR.js → activity-store-DKP2sWTJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-l8GQ4I9J.js → agent-avatar-dicebear-BR85bT1W.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BO1bqKlR.js → agent-avatar-display-CIsejg_E.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Dj_H2kDD.js → agent-defaults-settings-panel-CxLUEl0V.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BQA2brAU.js → agent-plugin-dialog-Cvj04Ckm.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C5C5l13A.js → agents-DZftplJc.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DZ1lLnrj.js → agents-admin-api-BL8lN8gP.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DDWYNF7I.js → api-BnS9d0p6.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DVXcGKP-.js → api-V4P8zfkJ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BkEO3eBe.js → app-link-CauYDM-y.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B5-7E03Z.js → app-management-settings-panel-CAEry5Vu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-E_BcjEDM.js → appearance-settings-CphsmJgM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BjB_mjXu.js → apps-page-CXKTWj1s.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-MvSiDvxK.js → archive-plugin-DS6JWBPZ.js} +1 -1
- package/dist/gateway/static/root/assets/arrow-down-to-line-C5D8Vt-L.js +1 -0
- package/dist/gateway/static/root/assets/{attachment-load-DrVGNxJm.js → attachment-load-C9iZLUHv.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-_6GhoCYk.js +12 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BPYdUI6y.js +1 -0
- package/dist/gateway/static/root/assets/{automation-api-24NjW7qG.js → automation-api-GcRQ9wM4.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-C94Q3OEL.js → automation-result-state-Dcp0JX0w.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-BShRirWV.js → automation-run-list-BLejrWpG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-Bgq5Plux.js → automation-task-card-BNT3n0qu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-3WGWLdiW.js → automations-page-DqrAOReO.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BYmFhO8E.js +9 -0
- package/dist/gateway/static/root/assets/binary-plugins-CnFVuJtL.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-DAWXPErA.js → block-editor-jy5CCmhH.js} +9 -9
- package/dist/gateway/static/root/assets/{browser-settings-page-DI2PYAPC.js → browser-settings-page-Dd2eTtvL.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Dyw8xW90.js → capabilities-CaJjMTli.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-YmBD7oK8.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-XgIRdqCb.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DfyND0IO.js +8 -0
- package/dist/gateway/static/root/assets/channels-DwUmMnA1.js +1 -0
- package/dist/gateway/static/root/assets/{chat-agents-api-BksS0CNy.js → chat-agents-api-Bim8--J9.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-aZIklMNN.js → chat-chart-block-B_c5sy7q.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-DfFXhDRv.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B4HoRIzf.js → chat-terminal-dock-Dn7Cm1O4.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-VhBEUFmw.js → command-palette-api-DPtCt8Je.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-BhRAbdPW.js → composer-model-config-control-BF9PPSiu.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-nT-U6jcc.js → composer-notifications-B0IZsy8x.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-xEFHDnLo.js → composer-payload-handoff-CRCz17sd.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DXlH96m6.js → computer-settings-page-CtfitoMZ.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-D8vBFsbY.js → connected-providers-grid-DUHMZjyV.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-C8jPm7QO.js → connection-usage-guide-CM5qgMcK.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-B42yWHxS.js → connector-service-page-DLbBblN2.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-so2a7xrD.js → connectors-api-BUdH4tZQ.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-yhOZIiUZ.js → connectors-page-HHGB3r3Q.js} +1 -1
- package/dist/gateway/static/root/assets/constants-D5Z-mUto.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-UEh3JM7r.js → date-picker-DRSq2kDz.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-Dci0LfAU.js → date-time-picker--LGC1D3b.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BAU_GuBe.js → desktop-pet-1oXlQvjH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CYE2eTTf.js → desktop-pet-settings-GdOjz7W9.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-C7v4CIlF.js → dev-view-store-DnQ2nBtV.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-7NDkYmiZ.js → device-pairing-wizard-eWeHH6Ru.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DmRZY8kg.js → directory-picker-path-field-DBe_paLy.js} +1 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-BqtUnmq-.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D8TAJgZ_.js → extension-debug-page-DIAyDA-a.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CjfRKtQ4.js → extension-iframe-host-CCe4R7L7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-V1oFBxVi.js → extension-marketplace-api-baFXdV56.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-DZahH1Hd.js → extension-message-router-BD0ZamBV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMuHBIHa.js → extension-page-C09dlV3J.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-lqJ1zIkA.js → extension-provider-BhluafoX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D5IfKVff.js → extension-settings-page-CB8KLYoG.js} +1 -1
- package/dist/gateway/static/root/assets/file-CStvVK2S.js +1 -0
- package/dist/gateway/static/root/assets/{file-BqMS_3DT.js → file-code-corner-byQA1VfD.js} +1 -1
- package/dist/gateway/static/root/assets/file-icon-N6WjUhq_.js +1 -0
- package/dist/gateway/static/root/assets/{file-preview-surface-B7B9qXm9.js → file-preview-surface-CeFFZo3a.js} +1 -1
- package/dist/gateway/static/root/assets/file-tree-CYUkQR1t.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Dk3FtNv1.js → gateway-config-swr-DVXDJNCI.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DMvo4pAc.js → gateway-realtime-BnwNxbyc.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BpnGXAhi.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-C2h5R1eP.js → gateway-restart-Bws2Shaz.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DGPaikv5.js → gateway-settings-BU5Cp4Bw.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-yZn7ShiP.js → gateway-startup-retry-2jU7zCyx.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-gsAa0Kj9.js → global-defaults-api-CNyJ0dGb.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BBTtXpDD.js → home-page-8KwhWlYt.js} +3 -3
- package/dist/gateway/static/root/assets/{image-generation-api-DPn1SBMH.js → image-generation-api-CiqQSx5j.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Cc48Uq20.js → imports-page-B9JMNXwt.js} +1 -1
- package/dist/gateway/static/root/assets/index-CZUfwwLp.css +1 -0
- package/dist/gateway/static/root/assets/index-D5hovYIw.js +11 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-QkJMw_uW.js → install-connector-dialog-BZjodnUC.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BZXqXuI4.js → keyboard-shortcuts-settings-A37hYJtR.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DmzgjJNj.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-D-bRvlZY.js → local-apps-page-Ct8z2B7R.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CZ19DRRK.js → local-session-drafts-CgAuYyKi.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DIBIYLnI.js → locale-store-Cit_aHqC.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CH9amuGc.js +2 -0
- package/dist/gateway/static/root/assets/{management-api-EG5duPec.js → management-api-DG-yZnHK.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-B7RWHrwo.js → management-settings-CUQd0FJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-C30KvTaE.js → markdown-view-Dm01GIXv.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BZ1PDTYY.js → mcp-conversation-setup-page-YvPXchDz.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CW5UoTx6.js → media-plugins-jsWNdARw.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DQveK9sk.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-COGICRIG.js → model-selector-Cg2kTsE7.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-B2QcrY4n.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DeFb2HEC.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-DUzoWZEe.js +1 -0
- package/dist/gateway/static/root/assets/notes-api-BMSPkAm8.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-nvqpOeHp.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-enDU_32p.js → oauth-api-Bz_PU9R_.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-C2pfvPOI.js → oauth-provider-connect-BexlZuZ4.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BaSooYGv.js → page-context-capture-button-Cn4zi3Mt.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-4-3RtO0q.js → page-context-draft-BjbX5zd7.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-1-lflHAx.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-CM3vUGhL.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-DsEp8QJ7.css +1 -0
- package/dist/gateway/static/root/assets/personal-page-HFjWZacf.js +1 -0
- package/dist/gateway/static/root/assets/{personal-profile-settings-DwMdjQ6H.js → personal-profile-settings-CNI5Eor6.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-DiNpP_g3.js → personal-settings-panel-BcrpYRn9.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DUT-qRLZ.js → phone-dependencies-card-CJ3ovsW1.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-pvOciDNo.js → phone-model-connection-DKvOEjWH.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CD97E6C5.js → phone-model-picker-CNTcpY1A.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-BUZ1dh7s.js → phone-settings-page-DvX6okzz.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BwilERgv.js → phone-workspace-store-CKOW55gy.js} +1 -1
- package/dist/gateway/static/root/assets/playback-coordinator-CWHIf0wr.js +1 -0
- package/dist/gateway/static/root/assets/{plugin-details-dialog-C_uOVmJv.js → plugin-details-dialog-BDoSffLO.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BSUgcO7-.js → preference-select-fields-BKmzpfHq.js} +1 -1
- package/dist/gateway/static/root/assets/presentation-D-Ui_vVA.js +1 -0
- package/dist/gateway/static/root/assets/preview-runtime-RnBDP-Lq.js +15 -0
- package/dist/gateway/static/root/assets/product-automation-feedback-xAcXeJM2.js +7 -0
- package/dist/gateway/static/root/assets/product-delivery-4gEqUIsK.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dy6D5exJ.js → product-open-page-DXwOPgRP.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DEUPAilo.js → product-preview-content-DiQbeaCK.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-C4TV9RUd.js → product-preview-modal-BU7Qojpq.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dr5_WPRB.js +7 -0
- package/dist/gateway/static/root/assets/{project-understanding-lOJ5Tz2V.js → project-understanding-Dv26vu9S.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-B3aGdPHy.js → projects-page-DGATZB23.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-C26HgxZY.js → providers-api-BXa2Aheb.js} +1 -1
- package/dist/gateway/static/root/assets/recording-upload-CQdhrRq3.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-pQ0eInzG.js → registry-api-BEnvt9-6.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CjWrYzjf.js → remote-access-hub-_7tmWand.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-Y9WRHOnz.js → resource-unavailable-fk26VrOL.js} +1 -1
- package/dist/gateway/static/root/assets/right-workspace-store-NXMrEuwH.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-D-pdVwIK.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-rjq-8nZ8.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-BoJQ3u5o.js → runtime-tools-api-CL6CG-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DB7cfLrX.js → runtime-tools-settings-panel-CdvQRxCR.js} +1 -1
- package/dist/gateway/static/root/assets/scan-search-CSIGkseh.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-_rFmwIwY.js → service-recommendation-list-2UOjV0Mx.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-a6wb0_Gf.js → session-api-CkOliupg.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +22 -0
- package/dist/gateway/static/root/assets/{sessions-page-dEupc-3A.js → sessions-page-CN9ESZdY.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BYrXsPjK.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CnGJr2xp.js → settings-advanced-section-Zex2dJo7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-DWRhupcY.js → settings-mode-store-Dk0bZQgo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-D9A2DdJ_.js → settings-page-bCW4rave.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-wL2jvs-y.js → settings-page-header-B9Y_eGcH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BkUQVmyY.js → settings-page-layout-D1MgJ5zP.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-D238tuw-.js → setup-interaction-page-BYXDX0F2.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DXvYjIu3.js → setup-status-panel-Bhda3jS2.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-DFDJyl3N.js → share-link-dialog-BxFk4-4u.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-nzWjWhqF.js +2 -0
- package/dist/gateway/static/root/assets/{shares-api-CfFiW03g.js → shares-api-ChBHTPKN.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-LB3SYKFS.js +1 -0
- package/dist/gateway/static/root/assets/sheet-C2H8iR8Y.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CWRhFSkA.js → skill-api-TQAyWHGS.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-CmPp2czp.js → skill-list-api-D4eokPXx.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BGsSq3dj.js → skill-reload-api-Bm-8vhsQ.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DqD0FPeH.js → skills-page-CfhEcU8L.js} +1 -1
- package/dist/gateway/static/root/assets/space-api-DaKpHc_7.js +1 -0
- package/dist/gateway/static/root/assets/space-page-BXyQdUvp.js +2 -0
- package/dist/gateway/static/root/assets/star-BuMAkjC9.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-aw9C86I8.js → system-settings-panel-CvL5G2w1.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-gffrDRvW.js +3 -0
- package/dist/gateway/static/root/assets/task-header-title-DwtjUOBg.js +1 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-C-zIBpzi.js → task-result-evidence-Bmgta9z9.js} +1 -1
- package/dist/gateway/static/root/assets/tasks-BIehlq7k.js +1 -0
- package/dist/gateway/static/root/assets/{terminal-panel-store-CgPqgrm7.js → terminal-panel-store-B1bAD5Xf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DxF7S6I2.js → theme-store-C1MxmBg7.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-Dvlunx28.js → tracing-settings-page-CvXDgIJQ.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CIte6n0U.js → tunnel-api-BkhCBt38.js} +1 -1
- package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +1 -0
- package/dist/gateway/static/root/assets/{understanding-activity-store-C2RHmRo8.js → understanding-activity-store-BYGCmCVb.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CPeQIXS_.js → understanding-refresh-store-DaLVsdYS.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DPUjEj39.js → usage-page-C-NM6vtY.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-xX2KrbXw.js → use-autosave-CvjQMyY8.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-sszsCdh5.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-D4b4fDeu.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-profile-CNPszzzT.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-work-C-rw8XVO.js +1 -0
- package/dist/gateway/static/root/assets/{use-realtime-voice-RQW5KnIN.js → use-realtime-voice-cugjs8cK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-B6QFV5gR.js → use-workspace-tree-Crfx5ctU.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-hKnsTcMk.js → user-model-page-BvnLbTYx.js} +1 -1
- package/dist/gateway/static/root/assets/video-generation-Cec49Jwg.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BeEF7Thh.js → voice-api-key-field-M7KB_Gl1.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-vbBoKnqd.js → voice-config-api-BLGbUq3v.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CKn6X3qL.js → voice-input-shortcut-events-CxH3RDXi.js} +1 -1
- package/dist/gateway/static/root/assets/voice-player-store-DZGlzjva.js +1 -0
- package/dist/gateway/static/root/assets/voice-settings-BzfNK5Jm.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Ddvqu02U.js → work-discovery-overlay-DpEYgcG2.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BdBpri6P.js → work-discovery-page-DappIHQq.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DStgfCzQ.js → working-directory-picker-modal-W2QiUVjN.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-g-wCKoQU.js +2 -0
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DwpWKogz.js +1 -0
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DxaxVC3q.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CBHFZ2iQ.js → workspace-open-location-menu-Dh0TvTkH.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-DoIjn_2j.js +1 -0
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Cm0Saa8B.js → xopc-cloud-account-card-DGAGXbGI.js} +1 -1
- package/dist/gateway/static/root/index.html +136 -123
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +7 -0
- package/dist/packages/gateway-contract/src/capabilities.js +1 -1
- package/dist/packages/gateway-contract/src/clarifications.js +20 -2
- package/dist/packages/gateway-contract/src/index.js +6 -4
- package/dist/packages/gateway-contract/src/music-generation.js +5 -2
- package/dist/packages/gateway-contract/src/space.js +23 -0
- package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/task-runs.js +1 -0
- package/dist/packages/gateway-contract/src/tasks.js +118 -6
- package/dist/packages/gateway-contract/src/turn-outcome.js +16 -2
- package/dist/packages/gateway-contract/src/video-generation.js +29 -4
- package/dist/src/agent/agent-manager.js +2 -2
- package/dist/src/agent/background-review/prompts.js +5 -1
- package/dist/src/agent/embedded/agent-profile-context.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/orchestration/delegation-budget.d.ts +2 -2
- package/dist/src/agent/orchestration/turn-recovery.d.ts +12 -3
- package/dist/src/agent/orchestration/turn-recovery.js +25 -6
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service/webchat-tts.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/apply-patch.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -0
- package/dist/src/agent/tools/language-diagnostics.js +1 -1
- package/dist/src/agent/tools/personal-memory-tool.js +12 -10
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
- package/dist/src/agent/tools/personal-task-tool.js +12 -7
- package/dist/src/agent/tools/publish-artifacts.js +2 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -0
- package/dist/src/agent/tools/tool-media.d.ts +3 -1
- package/dist/src/agent/tools/tool-media.js +2 -0
- package/dist/src/agent/tools/video-draft-tool.d.ts +1 -0
- package/dist/src/agent/tools/video-draft-tool.js +5 -1
- package/dist/src/agent/tools/xopc-use-tool.js +21 -4
- package/dist/src/agent-catalog/test-support.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +30 -6
- package/dist/src/automations/capabilities/write.js +2 -2
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/domain/types.d.ts +6 -0
- package/dist/src/automations/domain/validation.d.ts +60 -12
- package/dist/src/automations/domain/validation.js +7 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +12 -3
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.js +14 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +9 -9
- package/dist/src/computer/errors.d.ts +2 -2
- package/dist/src/computer/evaluation.d.ts +7 -7
- package/dist/src/computer/runtime.d.ts +4 -4
- package/dist/src/config/schema.d.ts +2 -2
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/setup.d.ts +3 -3
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +2 -2
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/memory-learning.js +19 -3
- package/dist/src/gateway/hono/routes/models.js +7 -0
- package/dist/src/gateway/hono/routes/music-generation.js +26 -3
- package/dist/src/gateway/hono/routes/personal-agent.js +214 -5
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/space.d.ts +3 -0
- package/dist/src/gateway/hono/routes/space.js +105 -0
- package/dist/src/gateway/hono/routes/tasks.js +27 -28
- package/dist/src/gateway/hono/routes/video-generation.js +9 -6
- package/dist/src/gateway/html-preview-shell.d.ts +1 -1
- package/dist/src/gateway/html-preview-shell.js +3 -0
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +10 -3
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +18 -1
- package/dist/src/home-intelligence/follow-ups.js +2 -1
- package/dist/src/home-intelligence/routines.js +1 -1
- package/dist/src/local-apps/automation-proposals.d.ts +54 -12
- package/dist/src/local-apps/capabilities/projections.d.ts +7 -7
- package/dist/src/local-apps/preview-fixtures.d.ts +1 -1
- package/dist/src/media/session-references.d.ts +4 -1
- package/dist/src/media/session-references.js +40 -8
- package/dist/src/memory-learning/work-capture.js +2 -1
- package/dist/src/memory-learning/work-review.d.ts +2 -0
- package/dist/src/memory-learning/work-review.js +25 -2
- package/dist/src/music-generation/artifact.js +3 -1
- package/dist/src/music-generation/mureka.js +1 -1
- package/dist/src/music-generation/provider.d.ts +4 -1
- package/dist/src/music-generation/provider.js +6 -1
- package/dist/src/music-generation/providers.d.ts +3 -1
- package/dist/src/music-generation/providers.js +39 -16
- package/dist/src/music-generation/repository.d.ts +3 -1
- package/dist/src/music-generation/repository.js +12 -3
- package/dist/src/music-generation/tencent-mps.d.ts +11 -0
- package/dist/src/music-generation/tencent-mps.js +151 -0
- package/dist/src/music-generation/worker.js +16 -5
- package/dist/src/music-generation/xopc-cloud.d.ts +2 -0
- package/dist/src/music-generation/xopc-cloud.js +38 -0
- package/dist/src/personal-agent/capability-service.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompt-context.js +1 -1
- package/dist/src/personal-agent/prompts.js +2 -2
- package/dist/src/personal-agent/reply-composer.js +16 -7
- package/dist/src/personal-agent/repository.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +17 -7
- package/dist/src/personal-agent/request-service.js +6 -10
- package/dist/src/personal-agent/result-extraction.js +13 -13
- package/dist/src/personal-agent/schedules.d.ts +9 -0
- package/dist/src/personal-agent/schedules.js +44 -0
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +6 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +2 -0
- package/dist/src/providers/xopc-cloud-media-manifest.d.ts +24 -0
- package/dist/src/providers/xopc-cloud-media-manifest.js +28 -0
- package/dist/src/providers/xopc-cloud-media.d.ts +28 -0
- package/dist/src/providers/xopc-cloud-media.js +67 -0
- package/dist/src/providers/xopc-cloud-model-source.js +4 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +1 -1
- package/dist/src/session/client-history.d.ts +4 -1
- package/dist/src/session/client-history.js +18 -0
- package/dist/src/session/compact-history.js +30 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/space/ingest.d.ts +36 -0
- package/dist/src/space/ingest.js +149 -0
- package/dist/src/space/repository.d.ts +39 -0
- package/dist/src/space/repository.js +325 -0
- package/dist/src/space/worker.d.ts +14 -0
- package/dist/src/space/worker.js +199 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +7 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
- package/dist/src/storage/sqlite/row-mappers.js +9 -2
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +8 -7
- package/dist/src/storage/sqlite/schema.sql +104 -0
- package/dist/src/storage/sqlite/transcript-repository.js +8 -0
- package/dist/src/storage/sqlite/upgrades/278_music_job_error_code.sql +6 -0
- package/dist/src/storage/sqlite/upgrades/279_task_model_cutover.sql +288 -0
- package/dist/src/storage/sqlite/upgrades/280_space.sql +61 -0
- package/dist/src/tasks/capabilities/management.d.ts +15 -2
- package/dist/src/tasks/capabilities/management.js +8 -2
- package/dist/src/tasks/capabilities/read.js +14 -2
- package/dist/src/tasks/capabilities/relations.d.ts +13 -7
- package/dist/src/tasks/capabilities/write.d.ts +118 -2
- package/dist/src/tasks/capabilities/write.js +2 -0
- package/dist/src/tasks/home-query-service.js +7 -9
- package/dist/src/tasks/task-allocation-service.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +8 -2
- package/dist/src/tasks/task-application-service.js +94 -27
- package/dist/src/tasks/task-collaboration-repository.js +12 -1
- package/dist/src/tasks/task-context-assembler.js +9 -3
- package/dist/src/tasks/task-contract-planner.js +1 -3
- package/dist/src/tasks/task-conversation-summary.d.ts +33 -2
- package/dist/src/tasks/task-conversation-summary.js +3 -1
- package/dist/src/tasks/task-criterion-review-repository.d.ts +31 -2
- package/dist/src/tasks/task-criterion-review-repository.js +70 -23
- package/dist/src/tasks/task-deliverables.d.ts +7 -0
- package/dist/src/tasks/task-deliverables.js +112 -0
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-instruction-sequence.js +10 -3
- package/dist/src/tasks/task-json-acceptance.js +3 -5
- package/dist/src/tasks/task-origin-repository.d.ts +99 -1
- package/dist/src/tasks/task-origin-repository.js +67 -5
- package/dist/src/tasks/task-read-model-projector.d.ts +4 -1
- package/dist/src/tasks/task-read-model-projector.js +123 -9
- package/dist/src/tasks/task-repository.d.ts +4 -1
- package/dist/src/tasks/task-repository.js +34 -11
- package/dist/src/tasks/task-research-repair.d.ts +2 -2
- package/dist/src/tasks/task-research-result.d.ts +1 -0
- package/dist/src/tasks/task-research-result.js +13 -3
- package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -3
- package/dist/src/tasks/task-result-delivery-repository.js +35 -17
- package/dist/src/tasks/task-result-delivery-service.js +22 -7
- package/dist/src/tasks/task-result-versions.d.ts +11 -0
- package/dist/src/tasks/task-result-versions.js +34 -0
- package/dist/src/tasks/task-run-coordinator.js +28 -15
- package/dist/src/tasks/task-run-dispatcher.js +29 -4
- package/dist/src/tasks/task-run-repository.d.ts +2 -0
- package/dist/src/tasks/task-run-repository.js +62 -19
- package/dist/src/tasks/task-workspace-verification.d.ts +16 -0
- package/dist/src/tasks/task-workspace-verification.js +95 -0
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/user-model/action-rule-suggestions.js +4 -3
- package/dist/src/user-model/capture/evidence-policy.d.ts +7 -1
- package/dist/src/user-model/capture/evidence-policy.js +68 -2
- package/dist/src/user-model/capture/executor.js +62 -14
- package/dist/src/video-generation/artifact.js +3 -1
- package/dist/src/video-generation/drafts.d.ts +1 -0
- package/dist/src/video-generation/drafts.js +6 -0
- package/dist/src/video-generation/providers.d.ts +1 -0
- package/dist/src/video-generation/providers.js +37 -5
- package/dist/src/video-generation/repository.d.ts +5 -3
- package/dist/src/video-generation/repository.js +30 -8
- package/dist/src/video-generation/settings.d.ts +1 -0
- package/dist/src/video-generation/settings.js +10 -4
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-DdOEgexg.js +0 -12
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CH9gYqIK.js +0 -9
- package/dist/gateway/static/root/assets/binary-plugins-MFVtTdvy.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-CFWTer_v.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-C2RB9fzC.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BjaLTd6i.js +0 -8
- package/dist/gateway/static/root/assets/channels-DiDfjON8.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-BtMkdtxJ.js +0 -71
- package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +0 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-DIeg1mg8.js +0 -1
- package/dist/gateway/static/root/assets/file-tree-CFlZnV3Y.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CJf-qaHZ.js +0 -1
- package/dist/gateway/static/root/assets/index-BJj-uZNl.js +0 -11
- package/dist/gateway/static/root/assets/index-DiWUK4sJ.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-wekatwet.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CukseY3k.js +0 -2
- package/dist/gateway/static/root/assets/messages-BDBGlBKh.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-aRYHi2dh.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-D5BtgBxy.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-CxXu_Tkh.js +0 -1
- package/dist/gateway/static/root/assets/notes-api-BXevQivV.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DyM-3O_9.js +0 -8
- package/dist/gateway/static/root/assets/page-header-store-C2ydtnXa.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-BPQpvC34.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-BUCb7OiW.css +0 -1
- package/dist/gateway/static/root/assets/personal-page-BB4Sv68K.js +0 -1
- package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-BlwtlUY7.js +0 -7
- package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BG2nDt98.js +0 -7
- package/dist/gateway/static/root/assets/recording-upload-BJkXktA-.js +0 -1
- package/dist/gateway/static/root/assets/right-workspace-store-DHHyicqQ.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-BYqg1BYz.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-Coh2B0j7.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-D5g6LOU-.js +0 -25
- package/dist/gateway/static/root/assets/settings-advanced-gate-DjyibJZ1.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-CyCv69rh.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-B85XIDFv.js +0 -1
- package/dist/gateway/static/root/assets/star-CnYNmpLd.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DgsLOz6h.js +0 -3
- package/dist/gateway/static/root/assets/tasks-BTLabOMp.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-C9GpCJQR.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Daf-LmiF.js +0 -15
- package/dist/gateway/static/root/assets/use-personal-profile-BJgaheR4.js +0 -1
- package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +0 -1
- package/dist/gateway/static/root/assets/voice-settings-BUrk4mwV.js +0 -1
- package/dist/gateway/static/root/assets/with-selector-xonYxPoM.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-CscTRODe.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-CyPjTDSx.js +0 -1
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-JSGIA79T.js +0 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-DNLnuHlf.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./locale-store-DIBIYLnI.js";import{o as t}from"./vendor-swr-CdRzEUwF.js";import{n}from"./gateway-config-swr-Dk3FtNv1.js";import{r}from"./registry-api-pQ0eInzG.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),t(`settings-agent-defaults`),t(`model-capability-media-sources`),t(`native-voice-connections`),t(`voice-dictation-route`),t(e=>Array.isArray(e)&&[`model-use-choices`,`native-voice-connections`,`capability-service-connections`].includes(e[0])),r()])}export{s as i,i as n,a as r,o as t};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-DAWXPErA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-DIBIYLnI.js","assets/messages-BDBGlBKh.js","assets/unlink-NsCMuCT1.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-BXevQivV.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-C30KvTaE.js","assets/diagnostics-Bo0Z42P_.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-BkEO3eBe.js","assets/product-delivery-CnvCn9L-.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-aZIklMNN.js","assets/skeleton-DzdOeGYz.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/undo-2-6IMTwK4M.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/linkify-it-BkqEorO0.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-CxXu_Tkh.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js","assets/chat-page-BtMkdtxJ.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-D08uZbsu.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-BlwtlUY7.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/message-square-fVE7Ghj1.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/button-Cc4hUNTt.js","assets/automation-api-24NjW7qG.js","assets/earth-C9Z4bTTG.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-DStgfCzQ.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/database-CjjeZfRG.js","assets/ellipsis-0k4rZLoy.js","assets/file-BqMS_3DT.js","assets/file-text-D12HbeVy.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/use-file-preview-expanded-Daf-LmiF.js","assets/eye-CABVeTq0.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/constants-Bg1wM2nv.js","assets/session-api-a6wb0_Gf.js","assets/gateway-startup-retry-yZn7ShiP.js","assets/attachment-utils-core-BIOUBrpT.js","assets/composer-notifications-nT-U6jcc.js","assets/activity-store-CdEua6PR.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/workspace-api-CscTRODe.js","assets/files-BNL4kkSB.js","assets/index.module-Cd9ENXfk.js","assets/dist-ZrL34Ps4.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/list-checks-BbsExAoq.js","assets/messages-square-BckAJrEW.js","assets/monitor-Af5eAvF7.js","assets/install-connector-dialog-QkJMw_uW.js","assets/secret-input-DsjfQmDn.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-so2a7xrD.js","assets/gateway-config-swr-Dk3FtNv1.js","assets/oauth-provider-connect-C2pfvPOI.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-aRYHi2dh.js","assets/registry-api-pQ0eInzG.js","assets/oauth-api-enDU_32p.js","assets/connection-usage-guide-C8jPm7QO.js","assets/connection-usage-BhdQRWgQ.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/share-link-dialog-DFDJyl3N.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/api-DDWYNF7I.js","assets/session-manager-D5g6LOU-.js","assets/local-session-drafts-CZ19DRRK.js","assets/tool-activity-BtJkgjFf.js","assets/gateway-realtime-DMvo4pAc.js","assets/gateway-realtime-store-CJf-qaHZ.js","assets/agents-admin-api-DZ1lLnrj.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-BhRAbdPW.js","assets/model-selector-COGICRIG.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/workspace-preview-store-DNLnuHlf.js","assets/capabilities-CFWTer_v.js","assets/capabilities-Dyw8xW90.js","assets/right-workspace-store-DHHyicqQ.js","assets/phone-workspace-store-BwilERgv.js","assets/workspace-editor-agent-store-CyPjTDSx.js","assets/chat-agents-api-BksS0CNy.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-xEFHDnLo.js","assets/voice-input-shortcut-events-CKn6X3qL.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/tool-friendly-title-CP35P4VA.js","assets/use-realtime-voice-RQW5KnIN.js","assets/voice-CDlC6XMH.js","assets/voice-call-context-BM2A4bLz.js","assets/page-header-store-C2ydtnXa.js","assets/new-chat-navigation-DXYDldT_.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-lqJ1zIkA.js","assets/theme-store-DxF7S6I2.js","assets/extension-message-router-DZahH1Hd.js","assets/agent-avatar-display-BO1bqKlR.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-DrA5mTQp.js","assets/shares-api-CfFiW03g.js","assets/use-composer-attachments-C9GpCJQR.js","assets/chevron-left-DqFhpbvK.js","assets/file-preview-surface-B7B9qXm9.js","assets/command-palette-api-VhBEUFmw.js","assets/skill-list-api-CmPp2czp.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-Bgq5Plux.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-UEh3JM7r.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-C1PXAXZF.js","assets/dev-view-store-C7v4CIlF.js","assets/extension-iframe-host-CjfRKtQ4.js","assets/extension-authoritative-grants-DIeg1mg8.js","assets/runtime-health-zDkHcOZO.js","assets/api-DVXcGKP-.js","assets/terminal-panel-store-CgPqgrm7.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-4-3RtO0q.js","assets/management-api-EG5duPec.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{l as o,t as s,u as c}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as l,i as u,l as d,n as f,o as p,p as m}from"./locale-store-DIBIYLnI.js";import{t as h}from"./messages-BDBGlBKh.js";import{a as g,c as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-CY7CS_D3.js";import{A as w,D as T,L as E,R as D,S as O,T as k,a as A,c as j,h as M,i as N,j as P,l as F,n as I,o as L,r as R,t as ee,w as te,x as ne,z as re}from"./recording-upload-BJkXktA-.js";import{t as ie}from"./arrow-left-D880xG-P.js";import{a as z,c as ae,d as B,i as V,l as H,n as oe,o as se,r as ce,s as le,t as ue,u as de}from"./product-automation-feedback-BlwtlUY7.js";import{t as fe}from"./check-DUBLcKHA.js";import{t as pe}from"./chevron-down-ccbiQQz_.js";import{n as me,r as U}from"./popover-select-CLsphyzA.js";import{t as he}from"./circle-check-C23XjkUj.js";import{t as ge}from"./code-xml-DJtYhZUF.js";import{t as _e}from"./copy-Dv6d4Dvw.js";import{t as ve}from"./download-Dk-ZjtO6.js";import{t as ye}from"./ellipsis-0k4rZLoy.js";import{t as be}from"./external-link-DjqjBmc3.js";import{t as W}from"./eye-CABVeTq0.js";import{t as xe}from"./file-text-D12HbeVy.js";import{t as Se}from"./history-DXH_9jsE.js";import{C as Ce,E as we,F as Te,O as Ee,P as De,S as Oe,T as ke,_ as Ae,a as je,c as Me,d as Ne,f as Pe,h as Fe,l as Ie,m as Le,n as Re,r as ze,s as Be,u as Ve,w as He,x as G}from"./notes-api-BXevQivV.js";import{t as K}from"./loader-circle-CifKLtgG.js";import{F as Ue}from"./markdown-view-C30KvTaE.js";import{t as We}from"./message-circle-Badhj-4D.js";import{t as Ge}from"./pencil-DmIY3Oa-.js";import{t as Ke}from"./play-kxZvpBg8.js";import{t as qe}from"./refresh-cw-BRlGaq2w.js";import{t as Je}from"./search-DA7gz22f.js";import{t as Ye}from"./sliders-horizontal-DqsYor6I.js";import{t as Xe}from"./sparkles-DHlfQFAF.js";import{t as Ze}from"./square-pen-B8FsvqNu.js";import{t as Qe}from"./square-DMK_fB-3.js";import{t as $e}from"./trash-2-DusmjVPV.js";import{t as et}from"./upload-rrb46c3c.js";import{t as tt}from"./x-B_N4OPjy.js";import{t as q}from"./cn-0WouolD0.js";import{t as J}from"./skeleton-DzdOeGYz.js";import{t as nt}from"./session-manager-D5g6LOU-.js";import{i as rt}from"./vendor-swr-CdRzEUwF.js";import{t as Y}from"./button-Cc4hUNTt.js";import{t as X}from"./copy-to-clipboard-HOJ79TWv.js";import{r as it}from"./app-chrome-BeB4KgOf.js";import{i as at}from"./theme-store-DxF7S6I2.js";import{t as Z}from"./page-header-store-C2ydtnXa.js";import{t as ot}from"./automation-api-24NjW7qG.js";import{t as st}from"./confirm-dialog-DrA5mTQp.js";import{b as ct,d as lt,o as ut,s as dt,v as ft}from"./shares-api-CfFiW03g.js";import{l as pt,m as mt,o as ht,r as gt,t as _t,u as vt}from"./dist-ZrL34Ps4.js";import{t as yt}from"./oauth-provider-connect-C2pfvPOI.js";import{n as bt,t as xt}from"./page-context-draft-4-3RtO0q.js";import"./note-image-lightbox-CxXu_Tkh.js";import{t as St}from"./page-context-capture-button-BaSooYGv.js";var Q=e(t(),1),$=i();function Ct({projectId:e,compact:t=!1}){let n=f(e=>e.language)===`zh`,r=c(),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[_,w]=(0,Q.useState)(null);async function T(e){let t=o.current;if(!(!t||s.current)){s.current=!0,u(0),p(!1),h(null);try{e!==void 0&&await ne(e);let n=await te();if(n.consentAcknowledgedAt==null){w(n.consentPolicyVersion);return}w(null),t.draft??=await ee(t.file,t.requestId);let i=await O({clientRequestId:t.requestId,contextProjectId:t.projectId,source:`web`,consentPolicyVersion:n.consentPolicyVersion,recordedAt:t.draft.startedAt}),a={...t.draft,serverDiscussionId:i.discussion.id,projectId:t.projectId};await M(a),await I(a,i.discussion.id,u,!0,e=>p(e===`verifying`)),await F(t.requestId),o.current=null,r(`/notes/${encodeURIComponent(i.note.id)}`)}catch(e){h(e instanceof Error&&e.message===`Unsupported audio format`?n?`请选择 MP3、M4A、WAV、OGG 或 WebM 音频。`:`Choose an MP3, M4A, WAV, OGG, or WebM file.`:n?`上传未完成,请重试。`:`Upload incomplete. Try again.`)}finally{s.current=!1,u(null),p(!1)}}}let E=n?`上传音频`:`Upload audio`,D=d?n?`正在确认音频`:`Verifying audio`:l===null?E:n?`上传中 ${l}%`:`Uploading ${l}%`;return(0,$.jsxs)(`div`,{className:t?`relative inline-flex`:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`input`,{ref:i,hidden:!0,type:`file`,accept:`audio/mpeg,audio/mp4,audio/wav,audio/x-wav,audio/ogg,audio/webm,.mp3,.m4a,.wav,.ogg,.webm`,onChange:t=>{let r=t.target.files?.[0];if(t.target.value=``,r){if(!r.size||r.size>1073741824){o.current=null,h(n?`请选择小于或等于 1 GiB 的非空音频。`:`Choose a non-empty audio file up to 1 GiB.`);return}o.current={file:r,requestId:crypto.randomUUID(),projectId:e},T()}}}),(0,$.jsxs)(`button`,{ref:a,type:`button`,"aria-label":D,title:E,disabled:l!==null,className:`inline-flex items-center gap-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-60 ${t?`size-11 shrink-0 justify-center rounded-lg text-fg-muted`:`min-h-20 flex-1 rounded-xl border border-edge bg-surface-panel p-4 text-sm font-semibold text-fg`}`,onClick:()=>i.current?.click(),children:[l===null?(0,$.jsx)(et,{className:t?`size-4`:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(K,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}),t?(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:D}):(0,$.jsx)(`span`,{role:`status`,children:D})]}),m?(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2 text-xs text-danger ${t?`absolute right-0 top-full z-20 w-56 shadow-popover`:`mt-2`}`,children:[(0,$.jsx)(`span`,{role:`alert`,children:m}),o.current?(0,$.jsx)(Y,{variant:`ghost`,onClick:()=>void T(),children:n?`重试`:`Retry`}):null]}):null,(0,$.jsx)(C,{open:_!==null,onOpenChange:e=>{!e&&!s.current&&w(null)},children:(0,$.jsxs)(b,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-scrim`}),(0,$.jsxs)(x,{onCloseAutoFocus:e=>{e.preventDefault(),a.current?.focus()},className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] w-[min(24rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 text-fg shadow-popover`,children:[(0,$.jsx)(S,{className:`font-semibold`,children:E}),(0,$.jsx)(v,{className:`mt-2 text-sm text-fg-muted`,children:n?`请确认你有权上传此录音,并允许语音服务转写。`:`Confirm you have permission to upload and transcribe this recording.`}),m?(0,$.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:m}):null,(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(Y,{disabled:l!==null,children:n?`取消`:`Cancel`})}),(0,$.jsx)(Y,{variant:`primary`,disabled:l!==null,onClick:()=>{_!==null&&T(_)},children:n?`确认上传`:`Confirm upload`})]})]})]})})]})}var wt=r(),Tt=6e4,Et=36e5,Dt=864e5;function Ot(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function kt(e,t,n){let r=t-e;if(r<Tt)return n.justNow;if(r<Et){let e=Math.floor(r/Tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ot(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Dt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*Dt){let e=Math.floor(r/Dt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function At(e,t,n){let r=Ot(t);if(e>=r)return n.today;if(e>=r-Dt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function jt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Mt(e){let t=(0,wt.c)(45),{title:n,description:r,prompt:i,coverage:a,className:o,variant:s}=e,l=s===void 0?`card`:s,u=f(Ft),d=h(u).automations.suggestions,p=h(u).automations,m=c(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=g):g=t[0];let{data:_}=rt(a?`automation-suggestion-coverage`:null,Pt,g),v=a?_?.automations.find(e=>V(e,a)):void 0,y=v?oe(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===o?e=t[2]:(e=q(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,o),t[1]=o,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(he,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,$.jsx)(Y,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===o?e=t[7]:(e=q(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,o),t[6]=o,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(E,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});m(`/automations?${e.toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(Y,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(v){let e;t[16]===o?e=t[17]:(e=q(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,o),t[16]=o,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(he,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(Y,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:ce(d.coveredDescription,{name:v.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.map(Nt)})]}),i]})}let b;t[24]===o?b=t[25]:(b=q(`rounded-lg bg-surface-panel p-3 shadow-surface`,o),t[24]=o,t[25]=b);let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(E,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=x):x=t[26];let S;t[27]===n?S=t[28]:(S=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=S);let C;t[29]===r?C=t[30]:(C=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let w;t[31]!==S||t[32]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})]}),t[31]=S,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==m||t[35]!==i?(T=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});m(`/automations?${e.toString()}`)},t[34]=m,t[35]=i,t[36]=T):T=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}),t[37]=D):D=t[37];let O;t[38]!==d.create||t[39]!==T?(O=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:T,children:[D,d.create]})}),t[38]=d.create,t[39]=T,t[40]=O):O=t[40];let k;return t[41]!==O||t[42]!==b||t[43]!==w?(k=(0,$.jsxs)(`section`,{className:b,children:[w,O]}),t[41]=O,t[42]=b,t[43]=w,t[44]=k):k=t[44],k}function Nt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Pt(){return ot.list()}function Ft(e){return e.language}var It=`z-[140] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 text-sm text-fg shadow-popover`,Lt=`flex min-h-11 cursor-pointer items-center gap-2 rounded-md px-3 outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-40`;function Rt(e){let t=(0,wt.c)(54),{detail:n,zh:r,busy:i,processing:a,pageText:o,editing:s,noteActions:c}=e,l=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,d=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,f;t[0]!==n.note.id||t[1]!==c||t[2]!==r?(f=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent aria-expanded:bg-accent-soft aria-expanded:text-accent-fg aria-expanded:hover:bg-accent-soft`,"aria-expanded":c.chatOpen??!1,"aria-controls":`note-assistant-${n.note.id}`,disabled:c.busy,onClick:c.onChat,children:[(0,$.jsx)(We,{className:`size-4`,"aria-hidden":!0}),r?`问这段录音`:`Ask recording`]}),(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r?`分享笔记`:`Share note`,disabled:c.busy,onClick:c.onShare,children:[(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r?`分享`:`Share`})]})]}):null,t[0]=n.note.id,t[1]=c,t[2]=r,t[3]=f):f=t[3];let p=r?`导出笔记`:`Export note`,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),t[4]=m):m=t[4];let h=r?`导出`:`Export`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:h}),t[5]=h,t[6]=g);let _;t[7]!==p||t[8]!==g?(_=(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p,children:[m,g]})}),t[7]=p,t[8]=g,t[9]=_):_=t[9];let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`md`,`txt`,`srt`],t[10]=v):v=t[10];let y;t[11]!==l||t[12]!==r?(y=v.map(e=>(0,$.jsx)(gt,{asChild:!0,children:(0,$.jsx)(`a`,{className:Lt,href:u(`${l}/export?format=${e}`),download:!0,children:e===`srt`?r?`字幕 · SRT`:`Subtitles · SRT`:e===`md`?`Markdown · MD`:r?`纯文本 · TXT`:`Plain text · TXT`})},e)),t[11]=l,t[12]=r,t[13]=y):y=t[13];let b;t[14]!==d||t[15]!==l||t[16]!==r?(b=d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(vt,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsx)(gt,{asChild:!0,children:(0,$.jsxs)(`a`,{className:Lt,href:u(`${l}/audio`),download:!0,children:[(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),r?`下载录音`:`Download recording`]})})]}):null,t[14]=d,t[15]=l,t[16]=r,t[17]=b):b=t[17];let x;t[18]!==y||t[19]!==b?(x=(0,$.jsx)(ht,{children:(0,$.jsxs)(_t,{align:`end`,sideOffset:6,collisionPadding:12,className:It,children:[y,b]})}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==_?(S=(0,$.jsxs)(pt,{children:[_,x]}),t[21]=x,t[22]=_,t[23]=S):S=t[23];let C=r?`更多笔记操作`:`More note actions`,w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ye,{className:`size-5`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":C,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:w})}),t[25]=C,t[26]=T);let E;t[27]!==c||t[28]!==r?(E=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(gt,{className:Lt,disabled:c.busy,onSelect:c.onAnalyze,children:[(0,$.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}),r?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(gt,{className:Lt,onSelect:c.onHistory,children:[(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),r?`版本历史`:`Version history`]})]}):null,t[27]=c,t[28]=r,t[29]=E):E=t[29];let D=n.note.id,O=String(n.note.remoteVersion??1),k;t[30]!==n.note.id||t[31]!==O?(k={kind:`note`,id:D,revision:O},t[30]=n.note.id,t[31]=O,t[32]=k):k=t[32];let A;t[33]===o?A=t[34]:(A={text:o,draft:!1},t[33]=o,t[34]=A);let j=r?`带到新对话`:`Use in a new chat`,M=i||a||s||!o||o.length>16e3,N;t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M?(N=(0,$.jsx)(`div`,{children:(0,$.jsx)(St,{presentation:`menu`,resource:k,selection:A,label:j,disabled:M})}),t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N):N=t[39];let P;t[40]!==c||t[41]!==r?(P=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(vt,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(gt,{className:`${Lt} text-danger`,disabled:c.busy,onSelect:c.onDelete,children:[(0,$.jsx)($e,{className:`size-4`,"aria-hidden":!0}),r?`删除笔记`:`Delete note`]})]}):null,t[40]=c,t[41]=r,t[42]=P):P=t[42];let F;t[43]!==E||t[44]!==N||t[45]!==P?(F=(0,$.jsx)(ht,{children:(0,$.jsxs)(_t,{align:`end`,sideOffset:6,collisionPadding:12,className:It,children:[E,N,P]})}),t[43]=E,t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;t[47]!==T||t[48]!==F?(I=(0,$.jsxs)(pt,{children:[T,F]}),t[47]=T,t[48]=F,t[49]=I):I=t[49];let L;return t[50]!==f||t[51]!==S||t[52]!==I?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[f,S,I]}),t[50]=f,t[51]=S,t[52]=I,t[53]=L):L=t[53],L}function zt(e){let t=(0,wt.c)(68),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,onOrganize:c,onRegenerate:l}=e,[u,d]=(0,Q.useState)(!1),f=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0}),t[0]=p):p=t[0];let m=a?`整理方式`:`Summary settings`,h;t[1]===m?h=t[2]:(h=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[p,m]})}),t[1]=m,t[2]=h);let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(g,{className:`fixed inset-0 z-[150] bg-scrim`}),t[3]=w):w=t[3];let T=a?`整理方式`:`Summary settings`,E;t[4]===T?E=t[5]:(E=(0,$.jsx)(S,{className:`font-medium`,children:T}),t[4]=T,t[5]=E);let D=a?`关闭整理设置`:`Close summary settings`,O;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(tt,{className:`size-4`}),t[6]=O):O=t[6];let k;t[7]===D?k=t[8]:(k=(0,$.jsx)(y,{className:`inline-flex size-11 items-center justify-center rounded-lg hover:bg-surface-hover`,"aria-label":D,children:O}),t[7]=D,t[8]=k);let A;t[9]!==E||t[10]!==k?(A=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-5 py-3`,children:[E,k]}),t[9]=E,t[10]=k,t[11]=A):A=t[11];let j=a?`根据已有原文重新整理纪要。你已手动编辑的内容会保留。`:`Reorganize the existing transcript. Your manual edits are preserved.`,M;t[12]===j?M=t[13]:(M=(0,$.jsx)(v,{className:`text-sm leading-6 text-fg-muted`,children:j}),t[12]=j,t[13]=M);let N=a?`纪要模板`:`Summary template`,P;t[14]===N?P=t[15]:(P=(0,$.jsx)(`span`,{children:N}),t[14]=N,t[15]=P);let F=a?`纪要模板`:`Summary template`,I;t[16]===i?I=t[17]:(I=e=>i(e.target.value),t[16]=i,t[17]=I);let L=a?`通用会议`:`General`,R;t[18]===L?R=t[19]:(R=(0,$.jsx)(U,{value:`general`,children:L}),t[18]=L,t[19]=R);let ee=a?`项目例会`:`Project`,te;t[20]===ee?te=t[21]:(te=(0,$.jsx)(U,{value:`project`,children:ee}),t[20]=ee,t[21]=te);let ne=a?`需求评审`:`Review`,re;t[22]===ne?re=t[23]:(re=(0,$.jsx)(U,{value:`review`,children:ne}),t[22]=ne,t[23]=re);let ie=a?`客户访谈`:`Interview`,z;t[24]===ie?z=t[25]:(z=(0,$.jsx)(U,{value:`interview`,children:ie}),t[24]=ie,t[25]=z);let ae;t[26]!==F||t[27]!==I||t[28]!==R||t[29]!==te||t[30]!==re||t[31]!==z||t[32]!==r?(ae=(0,$.jsxs)(me,{value:r,"aria-label":F,onChange:I,children:[R,te,re,z]}),t[26]=F,t[27]=I,t[28]=R,t[29]=te,t[30]=re,t[31]=z,t[32]=r,t[33]=ae):ae=t[33];let B;t[34]!==P||t[35]!==ae?(B=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[P,ae]}),t[34]=P,t[35]=ae,t[36]=B):B=t[36];let V;t[37]!==f||t[38]!==o||t[39]!==n.discussion.status||t[40]!==l||t[41]!==s||t[42]!==a?(V=f&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer text-sm text-fg-muted`,children:a?`高级选项:重新识别录音`:`Advanced: transcribe again`}),(0,$.jsx)(`p`,{className:`mb-3 text-xs leading-5 text-fg-muted`,children:a?`重新处理原音,可能耗时较长。适用于原文缺失或识别不完整。`:`Process the original recording again when text is missing or incomplete. This may take longer.`}),(0,$.jsx)(Y,{disabled:o||s,onClick:()=>{d(!1),l()},children:a?`从原音重新生成`:`Regenerate from audio`})]}):null,t[37]=f,t[38]=o,t[39]=n.discussion.status,t[40]=l,t[41]=s,t[42]=a,t[43]=V):V=t[43];let H;t[44]!==M||t[45]!==B||t[46]!==V?(H=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M,B,V]}),t[44]=M,t[45]=B,t[46]=V,t[47]=H):H=t[47];let oe=a?`取消`:`Cancel`,se;t[48]===oe?se=t[49]:(se=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(Y,{children:oe})}),t[48]=oe,t[49]=se);let ce=o||s||!n.discussion.canonicalTranscript,le;t[50]===c?le=t[51]:(le=()=>{d(!1),c()},t[50]=c,t[51]=le);let ue;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),t[52]=ue):ue=t[52];let de=a?`重新整理纪要`:`Regenerate summary`,fe;t[53]!==ce||t[54]!==le||t[55]!==de?(fe=(0,$.jsxs)(Y,{variant:`primary`,disabled:ce,onClick:le,children:[ue,de]}),t[53]=ce,t[54]=le,t[55]=de,t[56]=fe):fe=t[56];let pe;t[57]!==se||t[58]!==fe?(pe=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[se,fe]}),t[57]=se,t[58]=fe,t[59]=pe):pe=t[59];let he;t[60]!==A||t[61]!==H||t[62]!==pe?(he=(0,$.jsxs)(b,{children:[w,(0,$.jsxs)(x,{className:`fixed left-1/2 top-1/2 z-[151] flex h-[min(28rem,90dvh)] w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[A,H,pe]})]}),t[60]=A,t[61]=H,t[62]=pe,t[63]=he):he=t[63];let ge;return t[64]!==u||t[65]!==h||t[66]!==he?(ge=(0,$.jsxs)(C,{open:u,onOpenChange:d,children:[h,he]}),t[64]=u,t[65]=h,t[66]=he,t[67]=ge):ge=t[67],ge}function Bt(e){return JSON.stringify([e.transcript.revision,e.transcript.segments.map(e=>[e.sequence,e.revision,e.status]),e.organization?.revision])}function Vt(e,t,n,r){let i=(0,wt.c)(27),a=r!==void 0&&r,[o,s]=(0,Q.useState)(),c;i[0]!==n||i[1]!==a||i[2]!==t||i[3]!==e||i[4]!==o?(c=()=>{!a&&t&&(o?.noteId!==e||o.version!==Bt(t))&&(o?.noteId===e&&n(),s({noteId:e,version:Bt(t),value:t}))},i[0]=n,i[1]=a,i[2]=t,i[3]=e,i[4]=o,i[5]=c):c=i[5];let l=o?.noteId,u=o?.version,d;i[6]!==n||i[7]!==a||i[8]!==t||i[9]!==e||i[10]!==l||i[11]!==u?(d=[e,t,l,u,n,a],i[6]=n,i[7]=a,i[8]=t,i[9]=e,i[10]=l,i[11]=u,i[12]=d):d=i[12],(0,Q.useLayoutEffect)(c,d);let f;i[13]!==n||i[14]!==t||i[15]!==e?(f=r=>{let i=r===void 0?t:r;i&&(n(),s({noteId:e,version:Bt(i),value:i}))},i[13]=n,i[14]=t,i[15]=e,i[16]=f):f=i[16];let p=f,m=o?.noteId===e?o:void 0,h;i[17]!==m||i[18]!==t?(h=!!t&&!!m&&m.version!==Bt(t),i[17]=m,i[18]=t,i[19]=h):h=i[19];let g=h,_;i[20]!==m||i[21]!==t?(_=t&&m?{...t,transcript:m.value.transcript,organization:m.value.organization}:t,i[20]=m,i[21]=t,i[22]=_):_=i[22];let v=_,y;return i[23]!==v||i[24]!==g||i[25]!==p?(y={detail:v,hasUpdates:g,publish:p},i[23]=v,i[24]=g,i[25]=p,i[26]=y):y=i[26],y}function Ht(e){let t=(0,Q.useRef)(null),n=(0,Q.useCallback)(()=>{let n=e.current;if(!n||t.current)return;let r=n.getBoundingClientRect().top;t.current={scrollTop:n.scrollTop,anchors:n.scrollTop<=0?[]:Array.from(n.querySelectorAll(`[data-reading-anchor]`)).filter(e=>e.getBoundingClientRect().bottom>r).map(e=>({key:e.dataset.readingAnchor,top:e.getBoundingClientRect().top-r}))}},[e]);return(0,Q.useLayoutEffect)(()=>{let n=t.current,r=e.current;if(t.current=null,!n||!r)return;let i=new Map(Array.from(r.querySelectorAll(`[data-reading-anchor]`)).map(e=>[e.dataset.readingAnchor,e])),a=n.anchors.find(e=>i.has(e.key));r.scrollTop=a?r.scrollTop+i.get(a.key).getBoundingClientRect().top-r.getBoundingClientRect().top-a.top:n.scrollTop}),n}var Ut=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Wt({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[l,d]=(0,Q.useState)(),f=(0,Q.useRef)(null),m=Ht(f),h=(0,Q.useRef)(null),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!0),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(0),[w,T]=(0,Q.useState)(),[E,D]=(0,Q.useState)(),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(0),M=JSON.stringify([e,i,t]),N=t?``:r;(0,Q.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>j(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Q.useEffect)(()=>{D(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++C.current,r=new AbortController;v(!0),S(!1),b(``);let i=g.current;g.current=!1;let a=window.setTimeout(()=>{p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(async a=>{if(C.current!==n)return;let o=h.current;if(!i&&o?.key===M){if(o.value.version===a.version)return;let i=o.value.hits.length;for(;a.hasMore&&a.hits.length<i;){let i=await p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${a.hits.length}&version=${encodeURIComponent(a.version)}`),{signal:r.signal});if(C.current!==n)return;if(i.version!==a.version||!i.hits.length)throw Error(`Review changed during refresh`);a={...i,offset:0,hits:[...a.hits,...i.hits]}}m()}h.current={key:M,value:a},d(a),T(M),k(t)}).catch(e=>{C.current===n&&!r.signal.aborted&&b(String(e))}).finally(()=>{C.current===n&&v(!1)})},t?200:0);return()=>{C.current++,r.abort(),window.clearTimeout(a)}},[e,t,N,i,M,A,m]);function P(){g.current=!0,j(e=>e+1)}async function F(){if(!l||x)return;let r=C.current;S(!0);try{let n=await p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${l.hits.length}&version=${l.version}`));if(r===C.current){let e={...n,hits:[...l.hits,...n.hits]};h.current={key:M,value:e},d(e)}}catch(e){r===C.current&&b(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{r===C.current&&S(!1)}}function I(e){D(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:l?.coverage.audioAvailable??!1,timingVerified:e.segments.some(e=>e.playback.length>0),segments:e.segments})}let L=e=>e.kind===`chapter`?n?`章节`:`Chapter`:e.kind===`annotation`?n?`我的标记`:`My mark`:e.kind===`analysis`?n?`分析`:`Analysis`:n?`原文`:`Transcript`,R=e=>(0,$.jsxs)(`article`,{"data-reading-anchor":`review:${e.id}`,className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,$.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>I(e),children:[e.startedAtMs===void 0?``:`${Ut(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${Ut(e.endedAtMs)}`} · `,e.title||L(e)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:e.kind===`chapter`&&!t&&e.text.length>300?`${e.text.slice(0,300)}…`:e.text}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[L(e),e.provisional?n?` · 阶段性结果`:` · Partial result`:``,e.stale?n?` · 原文已更新,保留旧版依据`:` · Earlier transcript revision`:``,e.kind===`chapter`?` · ${e.highlightCount??0} ${n?`个重点`:`marks`} · ${e.actionCount??0} ${n?`个候选行动`:`candidate actions`}`:``]}),e.kind!==`chapter`||t||E?.id===e.id?e.segments.map(e=>(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Ut(e.startedAtMs),` · `,e.text.length>500?`${e.text.slice(0,500)}…`:e.text]},`${e.sequence}:${e.startedAtMs}`)):null,e.playback.slice(0,3).map((e,t)=>(0,$.jsxs)(Y,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,Ut(e.startedAtMs),`–`,Ut(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(Y,{onClick:()=>I(e),children:n?`查看对应原文`:`View transcript`}):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,$.jsxs)(`section`,{ref:e=>{f.current=e?.closest(`main`)??e},"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y}),(0,$.jsx)(Y,{onClick:P,children:n?`刷新结果`:`Refresh results`})]}):null,_&&(!l||w!==M||O!==t)?(0,$.jsx)(J,{className:`h-20 w-full`}):null,l&&w===M&&(!t||O===t)?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${l.total}`:`Search results · ${l.total}`}),(0,$.jsx)(Y,{onClick:P,children:n?`刷新结果`:`Refresh results`}),(0,$.jsx)(`div`,{"aria-label":n?`命中位置`:`Match positions`,className:`relative my-3 h-5 rounded bg-surface-inset`,children:l.hits.filter(e=>e.startedAtMs!==void 0).map(e=>(0,$.jsx)(`button`,{className:`absolute top-0 h-5 w-1.5 rounded bg-accent`,style:{left:`${Math.min(99,100*e.startedAtMs/Math.max(1,l.coverage.durationMs))}%`},"aria-label":`${Ut(e.startedAtMs)} ${e.title||L(e)}`,onClick:()=>I(e)},e.id))}),l.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),l.hits.map(R)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&l.chapters.length?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,$.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-sm font-medium focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`章节目录`:`Chapters`,` · `,l.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:l.chapters.map(R)})]}):null,l.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),l.hits.map(R)]}):null]}),l.hasMore?(0,$.jsx)(Y,{disabled:x,onClick:()=>void F(),children:n?`加载更多结果`:`More results`}):null,(0,$.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,$.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,$.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,l.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,Ut(l.coverage.processedMs),` / `,Ut(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,Ut(l.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${Ut(e.startedAtMs)}–${Ut(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,l.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,l.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),E?.provisional?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function Gt({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=rt(`/api/discussions/${t}/annotations`,e=>p(u(e))),[s,c]=(0,Q.useState)([]),[l,d]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=(0,Q.useCallback)(async()=>{c(await A(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await R(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Q.useEffect)(()=>{_().catch(e=>g(String(e))),v();let e=()=>{_().catch(e=>g(String(e)))};window.addEventListener(`discussion-annotations-changed`,e),window.addEventListener(`online`,v);let t=window.setInterval(()=>{navigator.onLine&&v()},15e3);return()=>{window.removeEventListener(`discussion-annotations-changed`,e),window.removeEventListener(`online`,v),window.clearInterval(t)}},[_,v]);let y=new Map(a.map(e=>[e.annotation.id,{...e,localState:`synced`}]));for(let e of s)if(e.state!==`synced`||!y.has(e.annotation.id)){let t=y.get(e.annotation.id);y.set(e.annotation.id,{annotation:e.annotation,state:t?.state??`pending`,playback:t?.playback??[],evidence:t?.evidence,localState:e.state})}let b=async(t,n=s.find(e=>e.annotation.id===t.id)?.nonce??null)=>{try{await j(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,$.jsx)(Y,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂无标记`:`No highlights yet`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.annotation.kind===`highlight`?n?`重点`:`Highlight`:e.annotation.kind===`question`?n?`问题`:`Question`:n?`我的补充`:`My note`,` · `,new Date(e.annotation.anchor.capturedAt).toLocaleString(),` · `,e.localState===`synced`?n?`已同步`:`Synced`:e.localState===`conflict`?n?`同步冲突,保留了本机修改`:`Conflict; local edits retained`:n?`本机已保存,待同步`:`Saved locally; sync pending`]}),e.evidence?.segments.map(e=>(0,$.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n?`标记位置`:`Marked position`,` · `,Math.floor(e.positionMs/6e4),`:`,String(Math.floor(e.positionMs/1e3)%60).padStart(2,`0`)]}),e.annotation.text?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(Y,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(Y,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(Y,{onClick:()=>{d(s.find(t=>t.annotation.id===e.annotation.id)?.nonce??null),m({...e.annotation,revision:a.find(t=>t.annotation.id===e.annotation.id)?.annotation.revision??e.annotation.revision})},children:e.localState===`conflict`?n?`合并修改`:`Merge changes`:n?`添加说明/类型`:`Edit context/type`}),(0,$.jsx)(Y,{onClick:()=>void b({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原音未保存、已删除或时间尚无法核实;保留原始标记,不自动移动。`:`Audio at this position is missing, deleted or unverified. The original anchor has been retained.`}):e.state===`pending`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,$.jsx)(Y,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&N(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),f?(0,$.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(me,{value:f.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...f,kind:e.target.value}),children:[(0,$.jsx)(U,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(U,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(U,{value:`note`,children:n?`补充`:`Context`})]}),(0,$.jsx)(`textarea`,{"aria-label":n?`我的说明`:`My context`,maxLength:4e3,value:f.text,onChange:e=>m({...f,text:e.target.value}),className:`my-2 min-h-24 w-full rounded border border-edge bg-surface-inset p-2`}),(0,$.jsx)(Y,{onClick:()=>void b(f,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(Y,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Kt={tab:`summary`,query:``,page:1,positionMs:0},qt=m((e,t)=>({notes:{},update:(n,r)=>{let i={...Yt(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Jt=new Map;function Yt(e,t){if(t)return t;if(Jt.has(e))return Jt.get(e);let n=Kt;try{let t=JSON.parse(localStorage.getItem(`discussion-review:${e}`)??`null`);t&&[`summary`,`transcript`,`marks`].includes(t.tab)&&typeof t.query==`string`&&Number.isSafeInteger(t.page)&&t.page>0&&t.page<=1e4&&Number.isFinite(t.positionMs)&&t.positionMs>=0&&(n={...Kt,...t})}catch{}return Jt.set(e,n),n}function Xt(e){let t=(0,wt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Q.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,$.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,$.jsx)(S,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,_;t[8]===s?_=t[9]:(_=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=_);let v;t[10]!==s.text||t[11]!==_?(v=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:_}),t[10]=s.text,t[11]=_,t[12]=v):v=t[12];let y;t[13]!==h||t[14]!==v?(y=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[h,v]}),t[13]=h,t[14]=v,t[15]=y):y=t[15];let w;t[16]!==s||t[17]!==r?(w=s.kind===`actionItems`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=w):w=t[18];let T;t[19]!==s||t[20]!==r?(T=s.kind===`summary`?null:(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=T):T=t[21];let E;t[22]!==y||t[23]!==w||t[24]!==T||t[25]!==m?(E=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,y,w,T]}),t[22]=y,t[23]=w,t[24]=T,t[25]=m,t[26]=E):E=t[26];let D=r?`取消`:`Cancel`,O;t[27]!==i||t[28]!==a||t[29]!==D?(O=(0,$.jsx)(Y,{disabled:i,onClick:a,children:D}),t[27]=i,t[28]=a,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==i||t[32]!==s.text?(k=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=k):k=t[33];let A;t[34]!==s||t[35]!==o?(A=()=>void o(s),t[34]=s,t[35]=o,t[36]=A):A=t[36];let j=r?`保存修改`:`Save changes`,M;t[37]!==k||t[38]!==A||t[39]!==j?(M=(0,$.jsx)(Y,{variant:`primary`,disabled:k,onClick:A,children:j}),t[37]=k,t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;t[41]!==O||t[42]!==M?(N=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[O,M]}),t[41]=O,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==E||t[45]!==N||t[46]!==f?(P=(0,$.jsxs)(b,{children:[u,(0,$.jsxs)(x,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[f,E,N]})]}),t[44]=E,t[45]=N,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,$.jsx)(C,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function Zt(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var Qt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function $t(e,t){e.currentTime=Number.isFinite(e.duration)?Math.min(t,e.duration):t}function en({noteId:e,onPersonalNotes:t,onMeetingContent:n,personalNotes:r,personalNotesActive:i=!1,noteTitle:a,noteActions:c}){let l=o(),d=(0,Q.useId)(),m=(0,Q.useRef)(null),h=f(e=>e.language)===`zh`,{data:_,mutate:v,isLoading:y}=rt([`note-discussion-document`,e],()=>k(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),[E,O]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(null),N=(0,Q.useRef)(null),{detail:F,hasUpdates:I,publish:ee}=Vt(e,_,Ht(N),!!E||!!A),te=F?.discussion.id,ne=`/api/discussions/${encodeURIComponent(te??``)}`,{data:re=[],mutate:ie}=rt(te?`${ne}/actions`:null,e=>p(u(e)),{refreshInterval:1e4}),z=qt(t=>Yt(e,t.notes[e])),ae=qt(e=>e.update),B=z.tab,V=t=>ae(e,{tab:t}),H=z.query,oe=t=>ae(e,{query:t}),[se,ce]=(0,Q.useState)(!1),le=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{se&&le.current?.focus()},[se]);let[ue,de]=(0,Q.useState)(`general`),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),[U,he]=(0,Q.useState)(!1),[ge,_e]=(0,Q.useState)(!1),ve=(0,Q.useRef)(!1),ye=(0,Q.useRef)(null),be=(0,Q.useRef)(null),[W,xe]=(0,Q.useState)(null),[Se,Ce]=(0,Q.useState)(!1),[we,Te]=(0,Q.useState)([]),[Ee,De]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(!1),Ae=z.page,je=t=>ae(e,{page:t}),Me=(0,Q.useRef)(null),[Ne,Pe]=(0,Q.useState)([]),Fe=(0,Q.useRef)(0),Ie=(0,Q.useRef)(0),Le=(0,Q.useRef)(_?.transcript.revision);Le.current=_?.transcript.revision;let Re=(0,Q.useRef)(null),ze=(0,Q.useRef)(_?.discussion.audioDeletedAt);ze.current=_?.discussion.audioDeletedAt;let Be=(0,Q.useRef)(null),[Ve,He]=(0,Q.useState)();(0,Q.useEffect)(()=>{let t=()=>{v(),ie()},n=n=>{n.detail?.noteId===e&&t()};return window.addEventListener(`note-updated`,n),window.addEventListener(`discussion-updated`,t),window.addEventListener(`discussion-segment-updated`,t),()=>{window.removeEventListener(`note-updated`,n),window.removeEventListener(`discussion-updated`,t),window.removeEventListener(`discussion-segment-updated`,t)}},[v,ie,e]),(0,Q.useEffect)(()=>{F?.discussion.template&&de(F.discussion.template)},[F?.discussion.template]);async function G(e){if(!Oe){ke(!0),De(null);try{await e();let t=await v();ee(t),await ie()}catch(e){De(e instanceof Error?e.message:String(e))}finally{ke(!1)}}}function K(e,t){if(!Re.current)return;let n=Re.current,r=e/1e3;Me.current=t??null,Be.current=n.readyState===0?r:null,$t(n,r),n.play().catch(()=>void 0)}function We(){if(me.current)return;let e=be.current??(document.activeElement instanceof HTMLElement?document.activeElement:null);me.current={element:e,triggerIndex:Array.from(N.current?.querySelectorAll(`button`)??[]).findIndex(t=>t===e),scrollTop:N.current?.scrollTop??0,review:z}}function Ge(){Ie.current++,he(!1),xe(null),_e(!1),Pe([]),me.current=null,ye.current=null}function qe(){Ie.current++,he(!1),xe(null),ye.current=me.current?.element??null,ge||(me.current=null)}function Ye(){let t=me.current;if(!t)return;let{tab:n,query:r,page:i,anchor:a,anchorRevision:o}=t.review;ae(e,{tab:n,query:r,page:i,anchor:a,anchorRevision:o}),Pe([]),xe(null),_e(!1),ve.current=!0}(0,Q.useLayoutEffect)(()=>{if(!W&&!U&&ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null),!ve.current)return;ve.current=!1;let e=me.current;e&&N.current&&(N.current.scrollTop=e.scrollTop),(e?.element?.isConnected?e.element:e&&e.triggerIndex>=0?N.current?.querySelectorAll(`button`)[e.triggerIndex]:null)?.focus({preventScroll:!0}),me.current=null}),(0,Q.useEffect)(()=>{(W||U)&&pe.current?.focus({preventScroll:!0})},[W,U]);function Xe(e){i&&n?.(),We();let t=e.stale||e.transcriptRevision!==Le.current,r=ze.current?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:e;xe({...r,stale:t}),t||Pe(e.segments.map(e=>e.sequence))}async function Qe(e,t){if(!F)return;let r=Fe.current,a=++Ie.current;i&&n?.(),We(),he(!0),xe(null),De(null);try{let n=await p(u(`${ne}/evidence?revision=${t??F.organization?.transcriptRevision??F.transcript.revision}&segments=${e.join(`,`)}`));if(r!==Fe.current||a!==Ie.current)return;Xe(n)}catch(e){r===Fe.current&&a===Ie.current&&(De(e instanceof Error?e.message:String(e)),qe())}finally{a===Ie.current&&he(!1)}}async function $e(e){if(!F||ze.current||!Re.current)return;(W||U||ge)&&Ge();let t=Fe.current,n=++Ie.current;if(De(null),F.discussion.mimeType?.split(`;`)[0]===`audio/wav`&&e.endedAtMs>e.startedAtMs){K(e.startedAtMs,e.endedAtMs);return}try{let r=await p(u(`${ne}/evidence?revision=${F.transcript.revision}&segments=${e.sequence}`));if(t!==Fe.current||n!==Ie.current||ze.current)return;let i=r.segments.find(t=>t.sequence===e.sequence)?.playback[0];if(!i){De(h?`这段录音暂无法定位`:`This segment cannot be located yet`);return}Pe([]),K(i.startedAtMs,i.endedAtMs)}catch(e){t===Fe.current&&n===Ie.current&&De(e instanceof Error?e.message:String(e))}}async function et(e){F&&await G(async()=>{await j(F.discussion.clientRequestId,L({type:`transcript`,capturedAt:Date.now(),transcriptRevision:F.transcript.revision,segmentIds:[e.sequence]})),V(`marks`),R(F.discussion.clientRequestId,F.discussion.id).catch(e=>De(String(e)))})}(0,Q.useEffect)(()=>(Fe.current++,Ie.current++,me.current=null,_e(!1),he(!1),xe(null),Pe([]),O(null),M(null),Te([]),De(null),Me.current=null,()=>{Fe.current++}),[e]),(0,Q.useEffect)(()=>{let t=F?.discussion.audioSha256??F?.discussion.audioAttachmentId;if(!t)return;let n=Yt(e,qt.getState().notes[e]);n.source&&n.source!==t?(Fe.current++,Ie.current++,he(!1),xe(null),Pe([]),Re.current?.pause(),ae(e,{positionMs:0,source:t}),Be.current=0,Me.current=null):ae(e,{source:t})},[e,F?.discussion.audioSha256,F?.discussion.audioAttachmentId,ae]),(0,Q.useEffect)(()=>{F?.discussion.audioDeletedAt&&(Re.current?.pause(),Be.current=null,Me.current=null,xe(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[F?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{z.tab===`transcript`&&z.anchor!==void 0&&z.anchorRevision===F?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${z.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[z.tab,z.anchor,z.anchorRevision,F?.transcript.revision]),(0,Q.useEffect)(()=>{Pe([]),xe(e=>e&&e.transcriptRevision!==_?.transcript.revision?{...e,stale:!0}:e)},[_?.transcript.revision]);function q(e,t,n=h?`原话`:`Source`){let r=F&&(t??F.organization?.transcriptRevision??F.transcript.revision)===F.transcript.revision?F.transcript.segments.find(t=>t.sequence===e[0]):void 0;return(0,$.jsx)(`button`,{type:`button`,className:`inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r?`${n} · ${Qt(r.startedAtMs)}`:void 0,onClick:()=>void Qe(e,t),children:r?(0,$.jsx)(`span`,{className:`tabular-nums`,children:Qt(r.startedAtMs)}):n})}let nt=(e,t,n)=>t.some(e=>Se||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>Se||!e.ignored).map(e=>(0,$.jsxs)(`div`,{"data-reading-anchor":`fact:${e.id}`,className:`flex items-start gap-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:Oe||I,onClick:()=>M({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:h?`编辑`:`Edit`}),e.evidenceSegmentIds.length?q(e.evidenceSegmentIds,e.evidenceRevision):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h?`暂无定位`:`No source timing`})]},e.id))]}):null;if(y)return(0,$.jsx)(J,{className:`h-48 w-full`});if(!F)return null;let{discussion:X,transcript:it,organization:at}=F,Z=at?.organization,ot=!F.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(F.note.title)?h?`语音笔记`:`Voice note`:F.note.title,st=X.recordingStartedAt??F.note.createdAt,ct=st?new Date(st).toLocaleDateString(h?`zh-CN`:`en`,{month:`short`,day:`numeric`}):null,lt=X.audioSha256??X.audioAttachmentId??``,ut=Ve?.source===lt?Ve.ms:X.durationMs??0,dt=!!X.audioAttachmentId&&!X.audioDeletedAt,ft=[`stopping`,`sealing`,`organizing`].includes(X.status),pt=!I&&[`recording`,`completed`,`needs_attention`].includes(X.status),mt=i||!!W||U,ht=it.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(H.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(H.toLocaleLowerCase())),gt=i?F.note.markdown:B===`marks`||H.trim()?``:Zt(F,B,{query:H,page:Ae,showIgnored:Se});return(0,$.jsxs)(`section`,{className:`@container/discussion relative flex h-full min-h-0 min-w-0 w-full flex-col text-fg`,onClickCapture:e=>{be.current=e.target instanceof Element?e.target.closest(`button`):null},onKeyDown:e=>{!e.defaultPrevented&&(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),i&&N.current&&getComputedStyle(N.current).visibility===`hidden`&&n?.(),se?window.requestAnimationFrame(()=>le.current?.focus()):ce(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-start gap-x-4 gap-y-1 px-5 pb-3 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-40 flex-1`,children:[a??(0,$.jsx)(`h2`,{className:`break-words text-2xl font-semibold leading-snug tracking-tight`,children:ot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs tabular-nums text-fg-muted`,children:[ct,Qt(ut)].filter(Boolean).join(` · `)})]}),(0,$.jsx)(Rt,{noteActions:c,detail:F,zh:h,busy:Oe,processing:ft,pageText:gt,editing:!!A||!!E})]}),(0,$.jsxs)(`div`,{className:`mx-5 mb-2 flex shrink-0 flex-wrap items-center justify-between gap-x-2 border-b border-edge-subtle pb-2 sm:mx-7`,children:[(0,$.jsx)(`nav`,{"aria-label":h?`录音内容`:`Recording content`,className:`inline-flex items-center rounded-xl bg-surface-inset px-1`,children:[`summary`,`transcript`].map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":B===e||e===`transcript`&&B===`marks`,className:`group relative isolate min-h-11 rounded-lg px-3.5 text-sm text-fg-muted aria-pressed:font-medium aria-pressed:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>{i&&N.current&&getComputedStyle(N.current).visibility===`hidden`&&n?.(),Ge(),V(e)},children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 inset-y-1.5 -z-10 rounded-lg group-aria-pressed:bg-surface-panel group-aria-pressed:shadow-sm`}),e===`summary`?h?`纪要`:`Summary`:h?`转写`:`Transcript`]},e))}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":h?`搜索`:`Search`,"aria-expanded":se||!!H,onClick:()=>{i&&n?.(),ce(e=>!e),se&&oe(``)},className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Je,{className:`size-4`,"aria-hidden":!0})}),r?(0,$.jsxs)(`button`,{ref:m,type:`button`,"aria-expanded":i,"aria-controls":d,className:`inline-flex min-h-11 items-center gap-1.5 rounded-lg px-2 text-sm font-medium text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>{i?n?.():(Ge(),t?.())},children:[i?(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Ze,{className:`size-4`,"aria-hidden":!0}),i?h?`完成`:`Done`:h?`写笔记`:`Write notes`]}):null]})]}),Ee?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:h?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:Ee})]}):null,se||H?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7 ${i?`hidden @min-[58rem]/discussion:flex`:`flex`}`,children:[(0,$.jsx)(Je,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:le,"aria-label":h?`搜索录音内容`:`Search recording`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:h?`搜索录音内容`:`Search recording`,value:H,onChange:e=>{oe(e.target.value),je(1)}}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":h?`关闭搜索`:`Close search`,onClick:()=>{oe(``),ce(!1)},children:(0,$.jsx)(tt,{className:`size-4`})})]}):null,ge?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center px-5 pb-2 text-xs text-fg-muted sm:px-7`,children:(0,$.jsx)(Y,{variant:`ghost`,onClick:Ye,children:me.current?.review.tab===`summary`?h?`返回结论`:`Back to conclusion`:h?`返回阅读位置`:`Back to reading`})}):null,(0,$.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,$.jsxs)(`main`,{ref:N,className:`min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-3 sm:px-7 ${mt?`invisible @min-[58rem]/discussion:visible`:``} flex`,children:[B!==`summary`&&!H.trim()?(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-[46rem] justify-end`,children:(0,$.jsxs)(Y,{variant:`ghost`,"aria-pressed":B===`marks`,onClick:()=>V(B===`marks`?`transcript`:`marks`),className:`min-h-11 gap-1.5 aria-pressed:bg-surface-inset`,children:[(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),h?`我的标记`:`My highlights`]})}):null,(X.status!==`completed`||!Z||at?.transcriptRevision!==it.revision)&&(X.status!==`recording`||F.recordingJob)?(0,$.jsx)(w,{context:`note`,nextAttemptAt:F.processing?.nextAttemptAt,input:P(F),zh:h,busy:Oe,onRetry:e=>void G(()=>e===`analyze`?p(u(`${ne}/organize`),{method:`POST`,body:JSON.stringify({template:ue})}):T(X.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,hidden:!!H.trim(),children:B===`marks`?(0,$.jsx)(Gt,{recordingId:X.clientRequestId,discussionId:X.id,zh:h,onEvidence:Xe,onPlay:e=>K(e.startedAtMs,e.endedAtMs)},X.id):B===`summary`?Z?(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:h?`摘要`:`Summary`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(zt,{detail:F,template:ue,onTemplate:de,zh:h,busy:Oe,processing:ft,onOrganize:()=>void G(()=>p(u(`${ne}/organize`),{method:`POST`,body:JSON.stringify({template:ue})})),onRegenerate:()=>void G(()=>T(X.id,`from_audio`))}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":h?`编辑概要`:`Edit overview`,title:h?`编辑概要`:`Edit overview`,disabled:Oe||ft||I,onClick:()=>M({kind:`summary`,itemId:`summary`,text:Z.summary}),children:(0,$.jsx)(Ze,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,$.jsx)(`p`,{"data-reading-anchor":`summary`,className:`whitespace-pre-wrap text-[15px] leading-7`,children:Z.summary}),Z.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`已由你编辑`:`Edited by you`}):null,Z.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(Z.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(Y,{onClick:()=>void Qe(Z.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[h?`查看原话`:`View source`,Z.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,Z.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:h?`重点结论`:`Key points`}),Z.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),q(e.evidenceSegmentIds,e.evidenceRevision)]},e.id))]}):Z.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:h?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:Z.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...Z.decisions,...Z.actionItems,...Z.risks,...Z.openQuestions].some(e=>e.ignored)?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:Se,onChange:e=>Ce(e.target.checked)}),h?`显示已忽略项`:`Show ignored items`]}):null,we.length?(0,$.jsx)(Y,{disabled:Oe||I,onClick:()=>void G(async()=>{for(let e of we)await p(u(`${ne}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:at.revision})});Te([])}),children:h?`加入所选 ${we.length} 项任务`:`Add ${we.length} selected tasks`}):null,nt(h?`已决定事项`:`Decisions`,Z.decisions,`decisions`),Z.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:h?`下一步行动`:`Next actions`}),Z.actionItems.filter(e=>Se||!e.ignored).map(e=>{let t=re.find(t=>t.actionId===e.id);return(0,$.jsxs)(`article`,{"data-reading-anchor":`action:${e.id}`,className:`rounded-lg border border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${h?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:we.includes(e.id),onChange:t=>Te(t.target.checked?[...we,e.id]:we.filter(t=>t!==e.id))}):null,(0,$.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:Oe||ft||I,onClick:()=>M({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:h?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(h?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(h?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?q(e.evidenceSegmentIds,e.evidenceRevision,h?`查看原话`:`Source`):null,t?t.deleted?(0,$.jsx)(`span`,{children:h?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(s,{className:`text-accent-fg`,to:Ue(`${l.pathname}${l.search}`,t.taskId),children:t.resolution===`done`?h?`已完成 · 查看任务`:`Done · View task`:h?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(Y,{disabled:Oe||I||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void G(()=>p(u(`${ne}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:at.revision})})),children:h?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,nt(h?`风险`:`Risks`,Z.risks,`risks`),nt(h?`尚未确定`:`Open questions`,Z.openQuestions,`openQuestions`),Z.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:h?`前后变更`:`Changes during the meeting`}),Z.changes.map(e=>{let t=[...Z.decisions,...Z.actionItems,...Z.risks,...Z.openQuestions],n=t.find(t=>t.id===e.fromId),r=t.find(t=>t.id===e.toId);return!n||!r?null:(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?h?`后续撤销或替代`:`Later superseded`:h?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void Qe(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,$.jsx)(`span`,{children:`↓`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void Qe(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-4 py-3`,children:[(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 text-fg-muted`,children:it.text?it.text.slice(0,400)+(it.text.length>400?`…`:``):null}),it.text?(0,$.jsx)(Y,{className:`min-h-11`,onClick:()=>V(`transcript`),children:h?`查看转写`:`View transcript`}):null]}):(0,$.jsxs)(`div`,{className:`divide-y divide-edge-subtle`,children:[ht.slice(0,Ae*50).map(e=>(0,$.jsxs)(`article`,{"data-reading-anchor":`segment:${e.sequence}`,id:`discussion-segment-${e.sequence}`,className:`px-3 py-2 ${Ne.includes(e.sequence)||z.anchor===e.sequence&&z.anchorRevision===it.revision?`rounded-lg bg-accent-soft`:z.positionMs>0&&z.positionMs>=e.startedAtMs&&z.positionMs<e.endedAtMs?`rounded-lg bg-surface-inset`:``}`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:e.speakerLabel??(h?`未区分说话人`:`Speaker unknown`)}),e.status===`confirmed`&&!I?(0,$.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex min-h-11 items-center gap-1.5 rounded-lg px-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void et(e),children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),h?`标记此段`:`Highlight segment`]}):null,pt&&e.status===`confirmed`?(0,$.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>O({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:h?`校对`:`Edit`}):null]}),dt&&e.status===`confirmed`?(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-start gap-3 rounded-lg px-2 py-2 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void $e(e),children:[(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 pt-1 text-xs tabular-nums text-accent-fg`,children:[(0,$.jsx)(Ke,{className:`size-3`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`sr-only`,children:[h?`回听`:`Play`,` `]}),Qt(e.startedAtMs)]}),(0,$.jsx)(`span`,{className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e.displayText??e.rawText})]}):(0,$.jsxs)(`p`,{className:`flex gap-3 px-2 py-2 text-sm leading-6`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-muted`,children:Qt(e.startedAtMs)}),(0,$.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.displayText??e.rawText??(h?`等待转写`:`Awaiting transcription`)})]})]},e.sequence)),ht.length>Ae*50?(0,$.jsx)(Y,{onClick:()=>je(Ae+1),children:h?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,children:(0,$.jsx)(Wt,{id:X.id,query:H.trim(),zh:h,sourceKey:`${X.audioSha256}:${X.audioDeletedAt}`,active:ft||X.status===`recording`,tab:B,refreshKey:`${X.updatedAt}:${it.revision}:${at?.revision}`,onEvidence:Xe,onPlay:K},X.id)})]}),r?(0,$.jsx)(`aside`,{id:d,"aria-label":h?`我的笔记`:`My notes`,hidden:!i,className:`absolute inset-0 z-10 min-h-0 min-w-0 overflow-hidden bg-surface-panel @min-[58rem]/discussion:static @min-[58rem]/discussion:w-[24rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l @min-[58rem]/discussion:border-edge-subtle`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||(n?.(),m.current?.focus())},children:r}):null,W||U?(0,$.jsxs)(`aside`,{ref:pe,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),qe())},"aria-label":h?`原话证据`:`Source evidence`,className:`absolute inset-0 z-20 flex min-h-0 w-full min-w-0 flex-col border-edge bg-surface-panel outline-none @min-[58rem]/discussion:static @min-[58rem]/discussion:w-[22rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,$.jsxs)(`h3`,{children:[h?`原话证据`:`Source evidence`,` `,W?`· v${W.transcriptRevision}`:``]}),(0,$.jsx)(`button`,{"aria-label":h?`关闭`:`Close`,className:`inline-flex size-11 items-center justify-center rounded-lg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:qe,children:(0,$.jsx)(tt,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[U?(0,$.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,$.jsx)(J,{className:`h-4 w-1/3`}),(0,$.jsx)(J,{className:`h-24 w-full`})]}):null,W?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),W.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!W.audioAvailable||!W.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,W.segments.map(t=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Qt(t.startedAtMs),`–`,Qt(t.endedAtMs),` · `,t.speakerLabel??(h?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(Y,{onClick:()=>K(e.startedAtMs,e.endedAtMs),children:[h?`播放原话`:`Play source`,` `,Qt(e.startedAtMs),`–`,Qt(e.endedAtMs)]},t)),!W.stale&&W.transcriptRevision===_?.transcript.revision&&W.transcriptRevision!==it.revision?(0,$.jsx)(Y,{onClick:()=>ee(),children:h?`查看最新原文`:`View latest transcript`}):null,!W.stale&&W.transcriptRevision===_?.transcript.revision&&W.transcriptRevision===it.revision?(0,$.jsx)(Y,{onClick:()=>{oe(``),je(Math.max(Ae,Math.ceil((it.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),V(`transcript`),Pe([t.sequence]),xe(null),_e(!0),ae(e,{anchor:t.sequence,anchorRevision:it.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:h?`定位原文`:`Locate transcript`}):null]},t.sequence))]}):null]})]}):null]}),dt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2`,children:(0,$.jsx)(`audio`,{ref:Re,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:u(`${ne}/audio`),"aria-label":h?`录音播放器`:`Recording player`,onDurationChange:e=>{let t=e.currentTarget.duration;He(Number.isFinite(t)&&t>0?{source:lt,ms:Math.floor(t*1e3)}:void 0)},onTimeUpdate:t=>{let n=t.currentTarget.currentTime*1e3;ae(e,{positionMs:n}),Me.current!==null&&n>=Me.current&&(t.currentTarget.pause(),Me.current=null)},onLoadedMetadata:e=>{let t=e.currentTarget;Be.current===null?$t(t,z.source===lt?z.positionMs/1e3:0):($t(t,Be.current),Be.current=null,t.play().catch(()=>void 0))},onError:()=>De(h?`录音暂不可播放`:`Recording unavailable`)},lt)}):null,A&&at?(0,$.jsx)(Xt,{initial:A,zh:h,busy:Oe,onClose:()=>M(null),onSave:e=>G(async()=>{await p(u(`${ne}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:at.revision})}),M(null)})},`${A.kind}:${A.itemId}:${at.revision}`):null,E?(0,$.jsx)(C,{open:!0,onOpenChange:e=>{e||O(null)},children:(0,$.jsxs)(b,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(x,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,$.jsx)(S,{children:h?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":h?`关闭校对`:`Close editor`,onClick:()=>O(null),children:(0,$.jsx)(tt,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs`,children:[h?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:E.speaker,onChange:e=>O({...E,speaker:e.target.value})})]}),E.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!E.applyToSpeakerGroup,onChange:e=>O({...E,applyToSpeakerGroup:e.target.checked})}),h?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,$.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:E.text,onChange:e=>O({...E,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(Y,{variant:`primary`,disabled:Oe||!E.text.trim(),onClick:()=>void G(async()=>{await p(u(`${ne}/segments/${E.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:E.text,speakerLabel:E.speaker,expectedRevision:E.segment.revision,applyToSpeakerGroup:E.applyToSpeakerGroup,expectedTranscriptRevision:it.revision})}),O(null)}),children:[(0,$.jsx)(fe,{className:`size-4`}),h?`保存修订`:`Save revision`]})})]})]})}):null]})}var tn={edit:Ge,ai_edit:Xe,sync:qe,restore:re};function nn(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function rn({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=f(e=>e.language),o=h(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:l(a)},{data:c}=rt(e?[`note-history`,e]:null,()=>Pe(e)),[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{d(!0),_(null);try{await ke(e,t),m(null),i()}catch{_(o.restoreFailed)}finally{d(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(tt,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=tn[e.trigger]??Ge,i=t===e.timestamp,a=p===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:q(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:nn(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:kt(e.timestamp,y,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:u,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:u?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function an({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:s,onOpenNewChat:l}){let u=h(f(e=>e.language)).notes,d=c(),p=t?.aiDeep?.catalysis,m=p?.report??null,[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),{data:b,mutate:x,isLoading:S}=rt(e?[`note-agent-context-status`,e]:null,()=>Ie(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>G(e),{revalidate:!1})}catch(e){_(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[v,x,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Q.useCallback)(async t=>{try{await Oe(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Xe,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(ie,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||v,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:v?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:q(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),g?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:g}):null,b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:m?u.recatalyze:u.catalyzeAction}),m?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:m.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:m.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(m.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:q(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(H,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:q(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(de,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(We,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:s,disabled:o,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:o?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:o,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),a.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var on=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function sn({open:e,onOpenChange:t,note:n}){let r=f(e=>e.language)===`zh`,i=r?dn:fn,{data:a,mutate:o}=rt(e?[`note-shares`,n.id]:null,()=>Le(n.id)),s=rt(e?`hosted-share-auth-status`:null,lt),c=s.data===!0,l=rt(e&&c?`hosted-publication-capabilities`:null,dt),u=l.data?.publishing.allowed===!0,d=rt(e&&c?[`hosted-note-publications`,n.id]:null,()=>Ne(n.id)),[p,m]=(0,Q.useState)(new Set),[h,_]=(0,Q.useState)(`86400000`),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(`hosted`),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,ee]=(0,Q.useState)(null),te=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(m(new Set(te.map(e=>e.id))),F(null),L(!1),ee(null))},[e,te]);let ne=async()=>{j(!0),ee(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...p],ttlMs:Number(h),maxViews:w.trim()?Number(w):null,description:E.trim()||void 0};if(O===`hosted`){let t=await ze(n.id,e);F(t.shareUrl),await d.mutate()}else{let t=await je(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){ee(e instanceof Error?e.message:String(e))}finally{j(!1)}},re=async(e,t)=>{N(e.id),ee(null);try{t===`refresh`?await Ce(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await ft(e.id),await d.mutate()}catch(e){ee(e instanceof Error?e.message:String(e))}finally{N(null)}},ie=async(e,t)=>{N(e.id),ee(null);try{t===`refresh`?await He(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await ut(e.id,864e5):await ct(e.id),await o()}catch(e){ee(e instanceof Error?e.message:String(e))}finally{N(null)}},z=async e=>{ee(null);try{if(!await X(e)){L(!1),ee(i.copyFailed);return}L(!0),window.setTimeout(()=>L(!1),1500)}catch{L(!1),ee(i.copyFailed)}};return(0,$.jsx)(C,{open:e,onOpenChange:t,children:(0,$.jsxs)(b,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(x,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(S,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(B,{className:`size-4`}),i.title]}),(0,$.jsx)(v,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(tt,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),te.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:te.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:()=>m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:un(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,$.jsxs)(me,{value:O,onChange:e=>k(e.target.value),children:[(0,$.jsx)(U,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(U,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(yt,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&c&&l.data&&!u?(0,$.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(me,{value:h,onChange:e=>_(e.target.value),children:on.map(e=>(0,$.jsx)(U,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:w,onChange:e=>T(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),P?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:P,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(Y,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void z(P),children:[I?(0,$.jsx)(fe,{className:`size-4`}):(0,$.jsx)(_e,{className:`size-4`}),I?i.copied:i.copy]}),(0,$.jsxs)(Y,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(be,{className:`size-4`}),i.open]})]})}):null,R?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:R}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(ln,{share:e,busy:M===e.id,t:i,onCopy:z,onAction:ie},e.id))})]}):null,(d.data?.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:d.data.map(e=>(0,$.jsx)(cn,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:z,onAction:re},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(Y,{type:`button`,onClick:()=>void ne(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,$.jsx)(K,{className:`size-4 animate-spin`}):(0,$.jsx)(B,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function cn(e){let t=(0,wt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=q(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=v):v=t[12];let y;t[13]!==p||t[14]!==g||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,v]}),t[13]=p,t[14]=g,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.shareUrl?b=t[18]:(b=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]===i?S=t[23]:(S=i?(0,$.jsx)(K,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=S);let C;t[24]!==x||t[25]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26];let w=!a,T;t[27]!==s||t[28]!==n.shareUrl?(T=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=T):T=t[29];let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(_e,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:w,onClick:T,children:[E,o.copy]}),t[31]=o.copy,t[32]=w,t[33]=T,t[34]=D):D=t[34];let O=!a,k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(be,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.open]}),t[38]=o.open,t[39]=O,t[40]=k,t[41]=j):j=t[41];let M;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(M=r&&!l?(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(qe,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=M):M=t[49];let N;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(N=n.revoked?null:(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)($e,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=N):N=t[54];let P;t[55]!==D||t[56]!==j||t[57]!==M||t[58]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,j,M,N]}),t[55]=D,t[56]=j,t[57]=M,t[58]=N,t[59]=P):P=t[59];let F;return t[60]!==C||t[61]!==d||t[62]!==P?(F=(0,$.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function ln(e){let t=(0,wt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=q(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,_]}),t[14]=_,t[15]=d,t[16]=m,t[17]=v):v=t[17];let y;t[18]===n.shareUrl?y=t[19]:(y=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=y);let b;t[20]!==v||t[21]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===r?x=t[24]:(x=r?(0,$.jsx)(K,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=x);let S;t[25]!==b||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==a||t[29]!==n.shareUrl?(C=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=C):C=t[30];let w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(_e,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:C,children:[w,i.copy]}),t[32]=i.copy,t[33]=C,t[34]=T):T=t[34];let E;t[35]===n.shareUrl?E=t[36]:(E=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=E);let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(be,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.open]}),t[38]=i.open,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(k=n.stale&&!s?(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(qe,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=k):k=t[46];let A;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(A=s?null:(0,$.jsx)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=A):A=t[52];let j;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(j=n.revoked?null:(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)($e,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=j):j=t[57];let M;t[58]!==T||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[T,O,k,A,j]}),t[58]=T,t[59]=O,t[60]=k,t[61]=A,t[62]=j,t[63]=M):M=t[63];let N;return t[64]!==S||t[65]!==l||t[66]!==M?(N=(0,$.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function un(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var dn={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},fn={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`},pn=e(n(),1);function mn({noteId:e,selection:t,zh:n,onDismiss:r,onAsk:i}){let[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,d]=(0,Q.useState)(``),[f,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,v]=(0,Q.useState)({left:8,top:8}),y=s||a!==null||!!l,b=t.text.length>16e3;function x(){h.current?.abort(),r(),t.restore()}(0,Q.useEffect)(()=>{o(null),c(!1),d(``),m(!1);let e=e=>{g.current?.contains(e.target)||r()},n=e=>{e.key===`Escape`&&(e.preventDefault(),r(),t.restore())},i=e=>{!g.current?.contains(e.target)&&!h.current&&!g.current?.contains(document.activeElement)&&r()};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,n),window.addEventListener(`resize`,r),window.addEventListener(`scroll`,i,!0),()=>{h.current?.abort(),h.current=null,document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,n),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,i,!0)}},[t,r]),(0,Q.useLayoutEffect)(()=>{let e=g.current?.getBoundingClientRect();if(!e)return;let n=Math.max(8,Math.min(t.rect.left,window.innerWidth-e.width-8)),r=t.rect.bottom+8,i=r+e.height<=window.innerHeight-8?r:Math.max(8,t.rect.top-e.height-8);v({left:n,top:i})},[t,y,a,l]);async function S(r){h.current?.abort();let i=new AbortController;h.current=i,c(!0),d(``),o(null),m(!1);try{let a=await p(u(`/api/notes/${encodeURIComponent(e)}/ai/edit`),{method:`POST`,signal:i.signal,body:JSON.stringify({instruction:r,markdown:t.text})});if(i.signal.aborted)return;let s=a.patch.operations.filter(e=>e.type===`replaceRange`).map(e=>e.markdown??``).join(`
|
|
3
|
-
|
|
4
|
-
`);if(!s.trim())throw Error(n?`没有可用结果,请重试。`:`No result available. Try again.`);o(s)}catch(e){i.signal.aborted||d(e instanceof Error?e.message:String(e))}finally{i.signal.aborted||(c(!1),h.current=null)}}return(0,pn.createPortal)((0,$.jsxs)(`div`,{ref:g,role:`region`,"data-note-selection-actions":!0,"aria-keyshortcuts":`Alt+Enter`,"aria-label":n?`笔记选段操作`:`Note selection actions`,className:`fixed z-[80] flex max-h-[calc(100dvh-1rem)] max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg shadow-popover ${y?`w-96`:``}`,style:_,onPointerDown:e=>{e.target.closest(`button`)&&e.preventDefault()},children:[(0,$.jsxs)(`div`,{role:`group`,"aria-label":n?`选段操作`:`Selection actions`,className:`flex shrink-0 flex-wrap items-center gap-1 p-1`,children:[(0,$.jsx)(Y,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`summary`),children:n?`摘要预览`:`Summary`}),(0,$.jsx)(Y,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`todo`),children:n?`提取待办`:`Extract to-dos`}),(0,$.jsx)(Y,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>i(t.text),children:n?`引用提问`:`Ask about selection`}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-9 items-center justify-center rounded-lg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭选段操作`:`Close selection actions`,onClick:x,children:(0,$.jsx)(tt,{className:`size-4`})})]}),b?(0,$.jsx)(`p`,{className:`px-3 pb-3 text-xs text-fg-muted`,children:n?`请选择不超过 16000 字的片段。`:`Select up to 16,000 characters.`}):null,y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-edge-subtle p-3`,children:[(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`按选段生成的本地整理预览,尚未写入笔记。`:`Local preview of the selection. Your note is unchanged.`}),s?(0,$.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,$.jsx)(J,{className:`h-4 w-full`}),(0,$.jsx)(J,{className:`h-4 w-2/3`})]}):null,a===null?null:(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-sm leading-6`,children:a}),l?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:l}):null]}),a===null?null:(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-2`,children:[(0,$.jsx)(Y,{variant:`ghost`,onClick:()=>void X(a).then(e=>{m(e),e||d(n?`复制失败,请重试。`:`Copy failed. Try again.`)}),children:f?n?`已复制`:`Copied`:n?`复制结果`:`Copy`}),(0,$.jsx)(Y,{variant:`primary`,onClick:()=>{t.insertAfter(a)?r():d(n?`正文已变化,请重新选择片段后再整理。`:`The note changed. Select the passage again.`)},children:n?`插入选段后`:`Insert after selection`})]})]}):null]}),document.body)}function hn(e){let t=(0,wt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0||i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=se(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=se(u),f=se(gn),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(z,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,$.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Qe,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function gn(e){return e.stop}function _n(e,t){let n=le(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=le(e);return!r||n.split(`
|
|
5
|
-
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
6
|
-
|
|
7
|
-
`)}var vn=()=>a(()=>import(`./block-editor-DAWXPErA.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])),yn=()=>a(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([48,1,2,44,49,18])),bn=(0,Q.lazy)(()=>a(()=>import(`./chat-page-BtMkdtxJ.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([50,1,16,2,18,17,3,4,11,12,13,6,51,52,53,54,55,56,57,58,59,60,61,9,10,14,15,19,20,21,22,23,24,25,26,27,28,29,30,31,32,7,8,33,35,62,37,39,63,64,65,66,67,68,41,69,70,71,72,73,74,75,76,77,78,79,80,81,42,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,38,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,34,125,36,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,43,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216]))),xn=(0,Q.lazy)(()=>vn().then(e=>({default:e.BlockEditor}))),Sn=(0,Q.lazy)(()=>yn().then(e=>({default:e.MarkdownEditor})));function Cn(){let e=(0,wt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function wn(e){let t=(0,wt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:xe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ge},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:W},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,p=Tn,m;t[13]===f?m=t[14]:(m=(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=m);let h;t[15]===d.label?h=t[16]:(h=(0,$.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(pe,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=g):g=t[17];let _;t[18]!==d.label||t[19]!==m||t[20]!==h?(_=(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":d.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium 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:[m,h,g]})}),t[18]=d.label,t[19]=m,t[20]=h,t[21]=_):_=t[21];let v;t[22]!==n||t[23]!==l||t[24]!==r?(v=(0,$.jsx)(ht,{children:(0,$.jsx)(_t,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(gt,{onSelect:()=>r(t),onPointerMove:()=>p(t),onFocus:()=>p(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,$.jsx)(fe,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=v):v=t[25];let y;return t[26]!==v||t[27]!==_?(y=(0,$.jsxs)(pt,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function Tn(e){e===`wysiwyg`&&vn(),e===`source`&&yn()}function En(e){let t=(0,wt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,p=a===void 0||a,m=s===void 0||s,g=l!==void 0&&l,_=f(Dn),v;t[0]===_?v=t[1]:(v=h(_),t[0]=_,t[1]=v);let y=v.notes.lightboxClose,b;t[2]!==g||t[3]!==o||t[4]!==m||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==p?(b=(0,$.jsx)(On,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:d}),t[2]=g,t[3]=o,t[4]=m,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=p,t[12]=b):b=t[12];let x;return t[13]!==y||t[14]!==b?(x=(0,$.jsx)(De,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function Dn(e){return e.language}function On({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:s=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let p=f(e=>e.language),m=h(p).notes,g=h(p).chat.pageContext,_=h(p).automations.suggestions,{data:v}=rt([`note-discussion-document`,e],()=>k(e)),[y,b]=(0,Q.useState)(!0),[x,S]=(0,Q.useState)(null),C=(0,Q.useCallback)(()=>S(null),[]);(0,Q.useEffect)(()=>{S(null)},[e]);let w=c(),T=at(e=>e.resolved)===`dark`,{openImage:E}=Te(),[D,O]=(0,Q.useState)(l);(0,Q.useEffect)(()=>{S(null)},[D,y]);let[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(``),[R,ee]=(0,Q.useState)(360),[te,ne]=(0,Q.useState)(!1),[re,z]=(0,Q.useState)(!1),[V,H]=(0,Q.useState)(!1),[oe,ce]=(0,Q.useState)(!1),[le,de]=(0,Q.useState)(null),pe=(0,Q.useRef)(0),[me,U]=(0,Q.useState)(null),he=d(e=>e.baseUrl),ge=d(e=>e.conversationId),_e=le?.noteId===e&&le.gatewayUrl===he&&le.gatewayToken===ge?le.conversationId:null;(0,Q.useEffect)(()=>(pe.current++,ce(!1),de(null),H(!1),U(null),b(!0),()=>{pe.current++}),[e,he,ge]);let ve=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{ve.current+=1},[e]);let[be,W]=(0,Q.useState)(null),[Ce,De]=(0,Q.useState)(!1),[Oe,ke]=(0,Q.useState)(null),[je,Ne]=(0,Q.useState)(!1),[Pe,Ie]=(0,Q.useState)(!1),Le=(0,Q.useRef)(!1),ze=(0,Q.useRef)(null),He=(0,Q.useRef)(null),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),Ue=(0,Q.useRef)(void 0),Ge=(0,Q.useRef)(null),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Ye=(0,Q.useRef)(null),Ze=(0,Q.useRef)(null),Qe=Z(e=>e.setPageHeader),et=Z(e=>e.clearPageHeader),{data:J,mutate:Y,error:X}=rt(e?[`note-detail`,e]:null,()=>Me(e)),{data:ot=[],mutate:ct}=rt(e?[`note-threads`,e]:null,()=>Fe(e),{revalidateOnFocus:!1}),lt=M!==null,ut=(0,Q.useCallback)(e=>{W(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y().catch(ut)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e,ut]),(0,Q.useEffect)(()=>{L(``),N(null),j(null),Le.current=!1,Ze.current=null},[e]),(0,Q.useEffect)(()=>{!J||P||K.current!==null||Le.current||L(J.title??``)},[J,P]),(0,Q.useEffect)(()=>{if(!s||!J||lt||Ze.current===e)return;let t=window.requestAnimationFrame(()=>{Ye.current?.focus(),u?.()});return Ze.current=e,()=>window.cancelAnimationFrame(t)},[s,lt,J,e,u]);let dt=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,ft=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:q(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,it,i),children:(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),yt=(0,Q.useCallback)(()=>{let t=se.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),St=(0,Q.useCallback)(e=>{e!==`preview`&&yt(),O(e)},[yt]);(0,Q.useEffect)(()=>{!P&&G.current===null&&K.current===null&&(Ue.current=J?.remoteVersion??1)},[e,J?.remoteVersion,P]);let Ct=(0,Q.useCallback)(async t=>{let n=Ue.current??J?.remoteVersion??1,r=await we(e,t,n);return Ue.current===n&&(Ue.current=r.remoteVersion??n+1),r},[e,J?.remoteVersion]),wt=(0,Q.useCallback)(t=>{yt(),L(t),e&&(K.current=t,He.current&&clearTimeout(He.current),He.current=setTimeout(async()=>{let e=K.current;if(K.current=null,e!==null){F(!0);try{await Ct({title:e}),await Y(),n?.()}catch(t){K.current===null&&(K.current=e),W(`${m.saveFailed}: ${t instanceof Error?t.message:m.saveFailedHint}`)}finally{F(!1)}}},600))},[yt,e,Y,n,Ct,m.saveFailed,m.saveFailedHint]),Tt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:q(`flex min-w-0 items-center gap-2`,it),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:I||dt||void 0,children:I||dt}),P?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:m.saving}):null]}),[m.saving,P,dt,I]),Et=(0,Q.useCallback)(async()=>{z(!0),W(null);try{await Re(e),await Y()}catch(e){W(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{z(!1)}},[Y,e]),Dt=(0,Q.useCallback)(()=>{ce(!1),j(A===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!re&&Et()},[A,re,Et,J?.aiDeep?.catalysis?.report]),Ot=(0,Q.useCallback)(()=>{let t=M?M.markdown??``:G.current??J?.markdown??``,n=M?M.title??``:I,r=_n(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:ae(r,p)}},[p,m.titlePlaceholder,J?.markdown,e,M,I]),kt=(0,Q.useCallback)(async()=>{ze.current&&clearTimeout(ze.current),He.current&&clearTimeout(He.current),ze.current=null,He.current=null;let e=G.current,t=K.current;G.current=null,K.current=null;let r={};if(e!==null&&(r.markdown=e),t!==null&&(r.title=t),Object.keys(r).length===0)return J??null;F(!0);try{let e=await Ct(r);return await Y(e,{revalidate:!1}),n?.(),e}catch(n){return G.current===null&&(G.current=e),K.current===null&&(K.current=t),W(`${m.saveFailed}: ${n instanceof Error?n.message:m.saveFailedHint}`),null}finally{F(!1)}},[Y,m.saveFailed,m.saveFailedHint,J,n,Ct]),At=(0,Q.useCallback)(async()=>P?(W(p===`zh`?`笔记正在保存,请稍后发送。`:`The note is saving. Please send again shortly.`),!1):!!await kt()&&G.current===null&&K.current===null,[P,p,kt]),jt=(0,Q.useCallback)(async(t=!1)=>{if(j(null),ce(!0),V||!t&&_e)return;let n=++pe.current;H(!0),W(null);try{if(!await At())return;let r=await Ae(e,{forceNew:t});if(n!==pe.current)return;de({noteId:e,gatewayUrl:he,gatewayToken:ge,conversationId:r.conversationId}),await Y(),await ct()}catch(e){n===pe.current&&W(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{n===pe.current&&H(!1)}},[V,_e,At,Y,ct,e,he,ge,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),Nt=(0,Q.useCallback)(async e=>{if(!J||V||P)return;H(!0),W(null);let t=d.getState(),n=++ve.current,r=()=>ve.current===n&&d.getState().baseUrl===t.baseUrl&&d.getState().conversationId===t.conversationId;try{let n=window.getSelection(),i=e??(n?.anchorNode&&n.focusNode&&Ge.current?.contains(n.anchorNode)&&Ge.current.contains(n.focusNode)?n.toString():``),a=await kt();if(!a||!r())return;if(G.current!==null||K.current!==null)throw Error(g.unavailable);let o=bt.capture({title:a.title||a.id,text:a.markdown,resourceRefs:[{kind:`note`,id:a.id,revision:String(a.remoteVersion??1)}],selection:i?{text:i,draft:!1}:void 0}),s=await new nt().createSession();if(!r())return;if(G.current!==null||K.current!==null)throw Error(g.unavailable);let c=xt(t.baseUrl,t.conversationId,s.key);if(!bt.put(c,o))throw Error(g.unavailable);w(`/chat/${encodeURIComponent(s.key)}`)}catch{r()&&W(g.unavailable)}finally{ve.current===n&&H(!1)}},[J,V,P,kt,w,g.unavailable]),Pt=(0,Q.useCallback)(async()=>{W(null);let e=await kt();e&&(ke(e),De(!0))},[kt]),Ft=(0,Q.useCallback)(async()=>{if(!(Pe||P)){Ne(!1),Ie(!0),W(null),yt(),ze.current&&clearTimeout(ze.current),He.current&&clearTimeout(He.current),ze.current=null,He.current=null,G.current=null,K.current=null;try{await Be(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){W(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{Ie(!1)}}},[Pe,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,P,yt]),It=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:q(`flex min-w-0 items-center gap-1 sm:gap-2`,it),children:[o?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":m.searchDialogTitle,className:`rounded-lg p-1.5 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:(0,$.jsx)(Je,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(hn,{input:Ot,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:Dt,disabled:re,"aria-label":m.catalysisSectionTitle,className:q(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,A===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:re?m.catalyzing:m.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>jt(!1),"aria-label":m.openChatButton,disabled:V,className:q(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:V?m.openingChat:m.openChatButton})]}),(0,$.jsx)(wn,{mode:D,onModeChange:St,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Nt(),disabled:V||P||!J||!!M,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),g.capture]}),(0,$.jsxs)(pt,{modal:!1,children:[(0,$.jsx)(mt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":m.noteActions,title:m.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg 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:(0,$.jsx)(ye,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ht,{children:(0,$.jsxs)(_t,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(gt,{onSelect:()=>void Pt(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(B,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(gt,{onSelect:()=>{ce(!1),j(A===`history`?null:`history`)},className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(Se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,$.jsx)(fe,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(vt,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(gt,{disabled:Pe||P,onSelect:()=>Ne(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)($e,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[re,Dt,jt,Nt,g.capture,J,M,D,m.history,m.modeEdit,m.modePreview,m.modeSource,V,A,o,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,St,Ot,Pt,Pe,P,p,m.delete,Ne]);(0,Q.useLayoutEffect)(()=>(Qe({startExtra:ft,main:J&&!v?Tt:null,end:J&&!v?It:null}),()=>{a&&et()}),[a,et,It,Tt,ft,v,y,J,Qe]);let Lt=(0,Q.useCallback)(t=>{e&&(yt(),G.current=t,ze.current&&clearTimeout(ze.current),ze.current=setTimeout(async()=>{let e=G.current;if(G.current=null,e!==null){F(!0),W(null);try{await Ct({markdown:e}),await Y(),n?.()}catch(t){G.current===null&&(G.current=e),W(`${m.saveFailed}: ${t instanceof Error?t.message:m.saveFailedHint}`)}finally{F(!1)}}},600))},[yt,e,Y,m.saveFailed,m.saveFailedHint,n,Ct]),Rt=(0,Q.useCallback)(t=>{Ve(e,t.timestamp).then(e=>{e&&(yt(),N(e),v&&b(!1))})},[v,e,yt]),zt=(0,Q.useCallback)(()=>{yt(),j(null),N(null)},[yt]),Bt=(0,Q.useCallback)(()=>{yt(),j(null),N(null),Y().catch(ut),n?.()},[Y,n,ut,yt]);if((0,Q.useEffect)(()=>()=>{ze.current&&clearTimeout(ze.current),He.current&&clearTimeout(He.current);let t=G.current,n=K.current;G.current=null,K.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&we(e,r,Ue.current).catch(()=>void 0)},[e]),J===void 0)return X?(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void Y().catch(ut),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,$.jsx)(Cn,{});if(J===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let Vt=lt?M.title??``:I,Ht=lt?M.markdown??``:G.current??J.markdown??``,Ut=new Date(J.createdAt).getTime(),Wt=Number.isFinite(Ut)&&Date.now()-Ut<3600*1e3?(0,$.jsx)(Mt,{title:_.noteCreatedTitle,description:_.noteCreatedDescription,prompt:_.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null,Gt=/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(I)?``:I,Kt=p===`zh`?`语音笔记`:`Voice note`,qt=!y&&!lt?(0,$.jsx)(`input`,{ref:Ye,"aria-label":m.titlePlaceholder,value:Gt,placeholder:Kt,onChange:e=>wt(e.target.value),onCompositionStart:()=>{Le.current=!0},onCompositionEnd:()=>{Le.current=!1},className:`w-full rounded-md bg-transparent text-2xl font-semibold leading-snug tracking-tight placeholder:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,Jt=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[v?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-x-2 border-b border-edge-subtle px-4 py-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:p===`zh`?`我的笔记`:`My notes`}),(0,$.jsx)(wn,{mode:D,onModeChange:St,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}})]}):null,(0,$.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:lt?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[Vt&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Vt}),Ht?(0,$.jsx)(Ee,{noteId:e,content:Ht,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[D===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[v?null:(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Ye,type:`text`,value:I,onChange:e=>wt(e.target.value),onCompositionStart:()=>{Le.current=!0},onCompositionEnd:()=>{Le.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Le.current&&!t.isComposing&&(e.preventDefault(),(Ge.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Wt]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Cn,{}),children:(0,$.jsx)(xn,{autoFocus:!!v&&!y,placeholder:v?p===`zh`?`写点什么…`:`Write a note…`:void 0,initialContent:J.markdown??``,onChange:Lt,noteId:e,onTextSelection:S},`wysiwyg-${e}`)})})]}),D===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[v?null:(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Ye,type:`text`,value:I,onChange:e=>wt(e.target.value),placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Wt]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Cn,{}),children:(0,$.jsx)(Sn,{initialContent:J.markdown??``,onChange:Lt,isDark:T,onTextSelection:S},`source-${e}`)})})]}),D===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&E(t.currentSrc||t.src,t.alt)},children:[!v&&I&&!J.markdown.trimStart().startsWith(`# ${I.trim()}\n`)&&J.markdown.trim()!==`# ${I.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:I}),J.markdown?(0,$.jsx)(Ee,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):v?(0,$.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>St(`wysiwyg`),children:p===`zh`?`写笔记`:`Write notes`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]});return(0,$.jsxs)($.Fragment,{children:[x&&!lt&&!(v&&y)&&D!==`preview`?(0,$.jsx)(mn,{noteId:e,selection:x,zh:p===`zh`,onDismiss:C,onAsk:e=>{U({id:Date.now(),text:p===`zh`?`请帮我分析或改写下面这段笔记:\n\n${e}`:`Help me analyze or rewrite this note selection:\n\n${e}`}),C(),jt()}},`${e}:${D}`):null,(0,$.jsxs)(`div`,{className:`@container/note flex h-full min-h-0 min-w-0 gap-3 p-3 sm:p-4`,children:[(0,$.jsxs)(`div`,{className:q(`mx-auto min-h-0 min-w-0 w-full flex-1 flex-col`,oe||A?`hidden @min-[56rem]/note:flex`:`flex`,!v&&`max-w-[60rem]`),children:[be?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:be}):null,(0,$.jsx)(ue,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ue,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:Ge,onKeyDown:e=>{x&&e.altKey&&e.key===`Enter`&&(e.preventDefault(),document.querySelector(`[data-note-selection-actions] button:not(:disabled)`)?.focus())},className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[v?(0,$.jsx)(en,{noteId:e,noteTitle:qt,personalNotes:Jt,personalNotesActive:!y,onMeetingContent:()=>{lt&&zt(),b(!0)},onPersonalNotes:()=>{zt(),St(`wysiwyg`),b(!1)},noteActions:{onAnalyze:Dt,chatOpen:oe,onChat:()=>{oe?ce(!1):jt(!1)},onShare:()=>{Pt()},onHistory:()=>{ce(!1),A===`history`?zt():j(`history`)},onDelete:()=>Ne(!0),busy:Pe||P||re||V}}):null,v?null:Jt]})]}),oe||_e?(0,$.jsxs)(`aside`,{id:`note-assistant-${e}`,"aria-label":p===`zh`?`笔记 AI 对话`:`Note AI chat`,className:q(`min-h-0 min-w-0 shrink-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,oe?`flex w-full @min-[56rem]/note:w-[22rem] @min-[76rem]/note:w-[24rem]`:`hidden`),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,$.jsx)(We,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children:v?p===`zh`?`问这段录音`:`Ask about this recording`:p===`zh`?`AI 对话`:`AI chat`}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p===`zh`?`收起 AI 对话`:`Close AI chat`,onClick:()=>{ce(!1),window.requestAnimationFrame(()=>document.querySelector(`[aria-controls="note-assistant-${e}"]`)?.focus({preventScroll:!0}))},children:(0,$.jsx)(tt,{className:`size-4`})})]}),v&&oe&&_e&&v.transcript?.text?.trim()?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1 border-b border-edge-subtle px-4 py-1`,children:(p===`zh`?[`最后决定了什么?`,`有哪些待跟进事项?`]:[`What was decided?`,`What needs follow-up?`]).map(e=>(0,$.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>U({id:Date.now(),text:e}),children:e},e))}):null,be&&_e?(0,$.jsx)(`p`,{role:`alert`,className:`shrink-0 px-4 py-2 text-xs text-danger`,children:be}):null,(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:_e?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Cn,{}),children:(0,$.jsx)(bn,{embedded:!0,sourceNoteInView:!0,conversationId:_e,draftSeed:me,beforeSend:At},`${e}:${_e}`)}):V?(0,$.jsx)(Cn,{}):(0,$.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:be||(p===`zh`?`对话尚未打开,请重试。`:`Chat could not be opened. Try again.`)}),(0,$.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-3 text-accent-fg hover:bg-surface-hover`,onClick:()=>void jt(),children:p===`zh`?`重新打开`:`Try again`})]})})]}):null,(0,$.jsx)(`div`,{ref:Ke,className:q(`relative min-h-0 max-w-full shrink-0 flex-col overflow-hidden`,A?`flex`:`hidden`,!te&&`transition-[width] duration-300 ease-in-out`),style:{width:A?R:0},children:(0,$.jsxs)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,style:{width:R},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ne(!0);let n=e.clientX,r=R,i=e.pointerId,a=0,o=R,s=R,c=()=>{a=0,s=o,A&&Ke.current?.style.setProperty(`width`,`${s}px`),qe.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}ne(!1),ee(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:q(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,te&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,$.jsx)(rn,{noteId:e,activeTimestamp:M?.timestamp??null,onSelect:Rt,onClose:zt,onRestored:Bt}):A===`breakdown`?(0,$.jsx)(an,{noteId:e,note:J??null,catalyzing:re,onCatalyze:Et,onClose:()=>j(null),noteThreads:ot,openingChat:V,onOpenChat:()=>jt(!1),onOpenNewChat:()=>jt(!0)}):null})]})})]}),Oe?(0,$.jsx)(sn,{open:Ce,onOpenChange:De,note:Oe}):null,(0,$.jsx)(st,{open:je,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,J.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void Ft(),onCancel:()=>Ne(!1)})]})}export{Ct as a,kt as i,jt as n,At as r,En as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./notes-api-BXevQivV.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,n as s,o as c,p as l}from"./locale-store-DIBIYLnI.js";import{t as u}from"./messages-BDBGlBKh.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-CY7CS_D3.js";import{t as _}from"./createLucideIcon-DPHK1VkS.js";import{t as v}from"./download-Dk-ZjtO6.js";import{K as y,t as b}from"./markdown-view-C30KvTaE.js";import{t as ee}from"./plus-Q2yW6OE7.js";import{t as te}from"./x-B_N4OPjy.js";import{t as x}from"./cn-0WouolD0.js";import{r as S,t as C}from"./chat-chart-block-aZIklMNN.js";var w=_(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),T=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),E=n(),D=e(t(),1),O=r(),k=(0,D.createContext)(null);function A(){let e=(0,E.c)(1),t=(0,D.useContext)(k);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:j},e[0]=t):t=e[0],t}return t}function j(){}function M({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=u(s(e=>e.language)).chat,[i,a]=(0,D.useState)(1),[o,c]=(0,D.useState)({x:0,y:0}),[l,_]=(0,D.useState)(!1),[b,S]=(0,D.useState)(!1),C=(0,D.useRef)(null),w=(0,D.useRef)(0),E=(0,D.useRef)(null),[A,j]=(0,D.useState)(null),M=(0,D.useCallback)((e,t)=>{E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w.current++,C.current=null,a(1),c({x:0,y:0}),_(!1),S(!1),j({src:e,alt:t})},[]),N=(0,D.useMemo)(()=>({openImage:M}),[M]);return(0,O.jsxs)(k.Provider,{value:N,children:[e,(0,O.jsx)(g,{open:A!==null,onOpenChange:e=>{e||(w.current++,j(null))},children:(0,O.jsxs)(p,{children:[(0,O.jsx)(d,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,O.jsxs)(m,{className:x(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),E.current?.isConnected&&E.current.focus({preventScroll:!0}))},children:[(0,O.jsx)(h,{className:`sr-only`,children:A?.alt||r.attachmentPreviewImage}),(0,O.jsx)(f,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,O.jsx)(te,{className:`size-5`,"aria-hidden":!0})})}),A&&n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,O.jsx)(y,{className:`size-5`})}),(0,O.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,O.jsx)(ee,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,O.jsx)(T,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:b,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=w.current;S(!0),_(!1);try{let t=await fetch(A.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==w.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===w.current&&_(!0)}finally{e===w.current&&S(!1)}},children:(0,O.jsx)(v,{className:`size-5`})})]}),l&&(0,O.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,A?(0,O.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(C.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=C.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{C.current=null},onPointerCancel:()=>{C.current=null},children:(0,O.jsx)(`img`,{src:A.src,alt:A.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var N=`xopc-attachment`,ne=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,re=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function P(e,t){return`${N}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function F(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(ne),a=r.match(re),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function ie(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var I=new Map,L=``;function R(e,t,n){return`${n}:${e}:${t}`}function z(){let e=o.getState().conversationId??``;if(e!==L){for(let e of I.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);I.clear(),L=e}}async function ae(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);return r||(r={blob:(async()=>{let n=await i(a(ie(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},I.set(n,r)),r.blob}async function B(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);if(r||(r={blob:ae(e,t),objectUrl:null,refCount:0},I.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function V(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,I.delete(n)))}var H={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},U=null,W=null,G=null,K=null;function q(){return U||(U=new Audio,U.addEventListener(`timeupdate`,()=>{Y.setState({currentTime:U.currentTime})}),U.addEventListener(`loadedmetadata`,()=>{let e=U.duration;Number.isFinite(e)&&Y.setState({duration:e})}),U.addEventListener(`ended`,()=>{Y.setState({playing:!1,currentTime:0}),U.currentTime=0}),U.addEventListener(`pause`,()=>{Y.setState({playing:!1})}),U.addEventListener(`play`,()=>{Y.setState({playing:!0})})),U}function J(){G&&K&&V(G,K),W=null,G=null,K=null}var Y=l()((e,t)=>({...H,play:async(n,r,i)=>{let a=q(),o=t();if(o.noteId===n&&o.attachmentId===r&&W){a.play();return}a.pause(),J(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await B(n,r);W=t,G=n,K=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),J()}},pause:()=>{q().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=q();n.currentTime=t,e({currentTime:t})},reset:()=>{q().pause(),q().src=``,J(),e(H)}}));function X(e,t){return P(e,t)}function oe(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function se(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function Z(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&o.getState().onUnauthorized(),!i.ok)throw Error(await se(i));return i.json()}function ce(e){let t=(0,E.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=F(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,D.useState)(d?null:s),[m,h]=(0,D.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),B(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,V(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,D.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=x(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsx)(w,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,O.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=x(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,O.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,O.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function le(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ue(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=F(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;B(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,V(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=F(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;B(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,V(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function de(e){let t=(0,E.c)(21),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,D.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,O.jsx)(C,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return ue(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,D.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=le(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,O.jsx)(`div`,{ref:a,children:(0,O.jsx)(S,{children:(0,O.jsx)(b,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function fe(){return c(a(`/api/notes/project-summaries`))}async function pe(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return c(a(`/api/notes${n?`?${n}`:``}`))}async function me(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function he(e,t){return(await c(a(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function ge(e){let t=await i(a(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function Q(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,...n===void 0?{}:{expectedRevision:n}})})).note}async function _e(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ve(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function ye(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function be(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function xe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function Se(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function Ce(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function we(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function Te(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Ee(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function De(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Oe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ke(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Ae(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function je(e,t={}){return(await c(a(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Me(e,t,n){let r=new FormData;return r.append(`file`,t),(await Z(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await Z(a(`/api/notes`),n)).note}async function Ne(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await Q(n.id,{markdown:i})),n}async function Pe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${oe(t)}](${X(r.id,i.id)})`;return r.markdown!==a&&(r=await Q(r.id,{markdown:a,kind:`voice`})),r}async function Fe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ie(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Le(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{X as A,Ce as C,Me as D,Q as E,A as F,T as I,w as L,P as M,F as N,de as O,M as P,Te as S,Le as T,Ee as _,ye as a,Pe as b,ge as c,xe as d,Fe as f,pe as g,De as h,he as i,Y as j,ce as k,Oe as l,ve as m,we as n,je as o,fe as p,Se as r,_e as s,Ae as t,Ie as u,me as v,be as w,ke as x,Ne as y};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a,m as ee,u as te}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as o,l as s,n as c}from"./locale-store-DIBIYLnI.js";import{t as l}from"./messages-BDBGlBKh.js";import{t as u}from"./archive-Dz0hferG.js";import{N as d,R as f}from"./recording-upload-BJkXktA-.js";import{t as p}from"./arrow-left-D880xG-P.js";import{t as m}from"./arrow-right-DSSvoX71.js";import{t as h}from"./arrow-up-D5ZtR1QT.js";import{f as g}from"./product-automation-feedback-BlwtlUY7.js";import{t as _}from"./calendar-days-hw_Y-g-s.js";import{t as ne}from"./chevron-down-ccbiQQz_.js";import{t as re}from"./popover-select-CLsphyzA.js";import{t as ie}from"./ellipsis-0k4rZLoy.js";import{t as v}from"./file-text-D12HbeVy.js";import{t as ae}from"./folder-CN-pC3XL.js";import{A as y,D as b,E as oe,_ as x,g as S,i as C,p as w,s as T}from"./notes-api-BXevQivV.js";import{i as E,n as D,r as O,t as se}from"./star-CnYNmpLd.js";import{t as ce}from"./loader-circle-CifKLtgG.js";import{B as k}from"./markdown-view-C30KvTaE.js";import{t as le}from"./mic-CuUb7zc-.js";import{t as A}from"./paperclip-f1HujQY1.js";import{t as ue}from"./plus-Q2yW6OE7.js";import{t as de}from"./search-DA7gz22f.js";import{t as fe}from"./sparkles-DHlfQFAF.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as j}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{t as N}from"./skeleton-DzdOeGYz.js";import{i as me}from"./vendor-swr-CdRzEUwF.js";import{r as he}from"./app-chrome-BeB4KgOf.js";import{t as ge}from"./page-header-store-C2ydtnXa.js";import{t as _e}from"./sliding-tab-list-CmcrqRzN.js";import{t as ve}from"./confirm-dialog-DrA5mTQp.js";import{n as ye}from"./index.module-Cd9ENXfk.js";import{l as be,m as xe,o as Se,r as Ce,t as we}from"./dist-ZrL34Ps4.js";import{a as Te,i as P,t as F}from"./note-detail-panel-D5BtgBxy.js";var I=e(t(),1),L=n();async function Ee(e){e.note??=await C({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await b(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${y(t,e.id)})`);e.note=await oe(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
|
-
|
|
3
|
-
`)}`})}return{noteId:t,conversationId:(await x(t,{projectId:e.projectId})).conversationId}}function R(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var z=r(),B={meeting:g,requirements:v,research:D,weekly:_};function De({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:ee}){let o=i.home,s=te(),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(!1),[m,g]=(0,I.useState)([]),[_,ie]=(0,I.useState)(!1),[v,y]=(0,I.useState)(null),[b,oe]=(0,I.useState)(``),x=(0,I.useRef)(null),S=(0,I.useRef)(!1),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=_||!!x.current,E=u?o.templateOptions[u]:null,D=!!(c.trim()||m.length);async function O(){if(!(S.current||!D&&!x.current)){S.current=!0,ie(!0),y(null),x.current??={requestId:crypto.randomUUID(),title:c.trim().split(`
|
|
4
|
-
`)[0]?.slice(0,80)||E?.label||i.titlePlaceholder,markdown:`## ${o.requestHeading}\n\n${E?`${E.prompt}\n`:``}${c.trim()}`,projectId:t||void 0,files:[...m],attachments:[],materialHeading:o.materialsHeading};try{let e=await Ee(x.current);r(),s(R(e.conversationId,e.noteId,o.agentPrompt))}catch(e){x.current.note&&r(),y(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{S.current=!1,ie(!1)}}}function se(){x.current=null,y(null),l(``),g([]),d(null),p(!1),w.current?.focus()}return(0,z.jsxs)(`section`,{"aria-label":o.askLabel,children:[(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),O()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,z.jsxs)(`fieldset`,{disabled:T,className:`min-w-0`,children:[(0,z.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,z.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),o.askLabel]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.agentResultHint}),E?(0,z.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,z.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`font-medium`,children:[E.label,` · `]}),E.prompt.split(`
|
|
5
|
-
|
|
6
|
-
`)[0]]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,z.jsx)(j,{className:`size-3.5`})})]}):null,(0,z.jsx)(`textarea`,{ref:w,id:`notes-home-prompt`,value:c,onChange:e=>l(e.target.value),placeholder:E?E.prompt.split(`
|
|
7
|
-
|
|
8
|
-
`).at(-1):o.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),O())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),m.length?(0,z.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:m.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,z.jsx)(A,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,z.jsx)(`button`,{type:`button`,"aria-label":`${o.removeMaterial}: ${e.name}`,onClick:()=>g(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,z.jsx)(j,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,z.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,z.jsx)(re,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(b.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:o.unassigned,placeholder:o.unassigned,emptyLabel:o.unassigned,ariaLabel:o.assignProject,triggerIcon:(0,z.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:T,loading:a,statusMessage:ee?o.projectsLoadFailed:void 0,searchPlaceholder:o.projectSearch,searchValue:b,onSearchChange:oe})}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>C.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,z.jsx)(A,{className:`size-4`,"aria-hidden":!0}),o.addMaterials]}),(0,z.jsx)(`input`,{ref:C,type:`file`,multiple:!0,className:`hidden`,"aria-label":o.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);g(e=>[...e,...t]),e.target.value=``}})]})]}),(0,z.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,z.jsxs)(`button`,{type:`submit`,disabled:_||!x.current&&!D,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[_?(0,z.jsx)(ce,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),_?o.creating:v?o.retry:o.agentCreate]})})]}),v?(0,z.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,z.jsx)(`p`,{children:v}),x.current?.note?(0,z.jsx)(`p`,{className:`mt-1`,children:o.partialFailure}):null,(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[x.current?.note?(0,z.jsx)(`button`,{type:`button`,onClick:()=>s(`/notes/${encodeURIComponent(x.current.note.id)}?edit=1`),className:`underline`,children:o.openSavedDraft}):null,(0,z.jsx)(`button`,{type:`button`,onClick:se,className:`underline`,children:o.newRequest})]})]}):null,(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,z.jsxs)(`button`,{type:`button`,disabled:T,"aria-expanded":f,"aria-controls":`notes-home-templates`,onClick:()=>p(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[o.templates,(0,z.jsx)(ne,{className:M(`size-3.5 transition-transform`,f&&`rotate-180`),"aria-hidden":!0})]})}),(0,z.jsxs)(_e,{id:`notes-home-templates`,hidden:!f,className:M(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,f?`flex`:`hidden`),role:`group`,"aria-label":o.templates,indicatorClassName:`rounded-md bg-accent-soft`,children:[Object.keys(B).map(e=>{let t=B[e];return(0,z.jsxs)(`button`,{type:`button`,disabled:T,"aria-pressed":u===e,onClick:()=>{d(u===e?null:e),w.current?.focus()},className:M(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,u===e&&`bg-accent-soft text-accent-fg`),children:[(0,z.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),o.templateOptions[e].label]},e)}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:i.discussionCapture.recoveredTitle})]})]})}function Oe(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`||void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function ke(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function Ae(e,t,n){return e.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(e.title??``)?n:e.title?.trim()||ke(e).slice(0,48)||t}var V=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`;function je(){let e=c(e=>e.language),t=l(e).notes,n=t.home,r=s(e=>e.conversationId),i=ge(e=>e.setPageHeader),h=ge(e=>e.clearPageHeader),_=te(),{pathname:y,search:b}=a(),[x,D]=ee(),k=x.get(`projectId`)||``,A=x.get(`view`)||`all`,j=x.get(`unassigned`)===`true`||A===`unassigned`,F=x.get(`search`)||``,[L]=ye(F,250),[Ee,R]=(0,I.useState)(k),[B,je]=(0,I.useState)(``),[Me,H]=(0,I.useState)(null),[Ne,Pe]=(0,I.useState)(!1),[U,Fe]=(0,I.useState)(!1),[Ie,Le]=(0,I.useState)(new Set),[Re,ze]=(0,I.useState)(null),[Be,Ve]=(0,I.useState)(null),W=(0,I.useRef)(new Set),G=(0,I.useRef)(null),He=(0,I.useRef)(!1),Ue=(0,I.useRef)(null),We=Oe(x,L),K=(We.offset??0)/12,{data:Ge,error:Ke,isLoading:qe,mutate:Je}=me(r?[`notes-home`,r,We]:null,()=>S(We)),{data:Ye,error:Xe,isLoading:q,mutate:Ze}=me(r?[`notes-home-projects`,r]:null,w),J=Ye?.items??[],Qe=J.filter(e=>e.noteCount>0).slice(0,2),$e=J.find(e=>e.id===k)?.name??n.projectNotes,et=Ge?.items??[],Y=Ge?.total??0,X=qe||F!==L,tt=(0,I.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:o(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[nt,rt]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{R(k)},[k]),(0,I.useEffect)(()=>{let e=window.setInterval(()=>rt(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Z=(0,I.useCallback)(()=>{Je().catch(()=>void 0),Ze().catch(()=>void 0)},[Je,Ze]);(0,I.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,Z)),()=>e.forEach(e=>window.removeEventListener(e,Z))},[Z]);let it=(0,I.useCallback)((e,t=!1)=>{let n=`${y}${b}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),_(`/notes/${encodeURIComponent(e)}?${r}`)},[y,b,_]),Q=(0,I.useCallback)(async()=>{if(!(He.current||!r)){He.current=!0,Pe(!0),H(null),G.current??={key:crypto.randomUUID(),projectId:k||void 0};try{let e=await C({markdown:``,kind:`thought`,projectId:G.current.projectId},G.current.key);G.current=null,Z(),it(e.id,!0)}catch(e){H(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{He.current=!1,Pe(!1)}}},[k,t.createBlankFailed,t.createBlankFailedHint,it,Z,r]),at=(0,I.useCallback)(e=>{D(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[D]);function $(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),R(e),D(n)}function ot(e){D(t=>{let n=new URLSearchParams(t);return j&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function st(e,n){if(!W.current.has(e)){W.current.add(e),Le(new Set(W.current)),H(null);try{await oe(e,{pinned:n}),Z()}catch(e){H(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{W.current.delete(e),Le(new Set(W.current))}}}async function ct(){let e=Re;if(!(!e||Be)){ze(null),Ve(e.id),H(null);try{await T(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Z()}catch(e){H(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Ve(null)}}}if((0,I.useLayoutEffect)(()=>{if(!r){h();return}return i({startExtra:null,main:(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,z.jsx)(`div`,{className:M(`flex min-w-0 items-center gap-2`,he),children:(0,z.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,z.jsx)(de,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsx)(`input`,{ref:Ue,type:`search`,value:F,onChange:e=>at(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>h()},[h,Q,Ne,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,F,i,at,r]),(0,I.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),Q()),e.key.toLowerCase()===`f`&&(e.preventDefault(),Ue.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Q]),!r)return(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let lt=[{id:`all`,label:n.homeNav,Icon:O},{id:`favorites`,label:n.favorites,Icon:se},{id:`unassigned`,label:n.unassigned,Icon:E},{id:`archived`,label:t.filterArchived,Icon:u}],ut=k?`project:${k}`:j?`unassigned`:`all`,dt=!X&&!Ke&&Y===0&&!k&&!j&&!F&&A===`all`;return(0,z.jsxs)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-7xl flex-1 overflow-hidden bg-surface-panel px-4 sm:px-6 lg:px-8`,children:[(0,z.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto py-6 xl:flex`,"aria-label":n.homeNav,children:[lt.map(({id:e,label:t,Icon:n})=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$(``,e),"aria-current":!k&&(e===`unassigned`?j:!j&&A===e)?`page`:void 0,className:M(V,`justify-start px-2 text-left text-xs`,!k&&(e===`unassigned`?j:!j&&A===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,z.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,z.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),q?[0,1,2].map(e=>(0,z.jsx)(N,{className:`mb-2 h-8 w-full`},e)):J.slice(0,8).map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),"aria-current":k===e.id?`page`:void 0,className:M(V,`justify-start px-2 text-left text-xs`,k===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,z.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>_(`/projects`),className:M(V,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,z.jsx)(m,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,z.jsxs)(`div`,{className:`flex w-full flex-col pb-4 pt-3 sm:pb-7 lg:pb-9 lg:pt-4 xl:pl-8`,children:[(0,z.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:k?$e:j?n.unassigned:dt?n.firstNoteTitle:n.continueTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:k?n.projectDescription:dt?n.firstNoteDescription:n.continueDescription})]}),k?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>_(`/projects/${encodeURIComponent(k)}`),className:M(V,`text-xs`),children:[n.openProject,(0,z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),Me?(0,z.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:Me}):null,(0,z.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>void Q(),disabled:Ne,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[Ne?(0,z.jsx)(ce,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,z.jsx)(ue,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,z.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>d(k||void 0),className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsx)(le,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]}),(0,z.jsx)(Te,{projectId:k||void 0})]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{Fe(e=>!e),U||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":U,"aria-controls":`notes-home-agent-composer`,title:n.agentActionHint,className:`touch-target mt-2 inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsx)(fe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,z.jsx)(ne,{className:M(`size-4 transition-transform`,U&&`rotate-180`),"aria-hidden":!0})]}),(0,z.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!U,className:M(`mt-3`,!U&&`hidden`),children:(0,z.jsx)(De,{projects:J,projectId:Ee,onProjectChange:R,onCreated:Z,labels:t,projectsLoading:q,projectsError:!!Xe})})]}),Xe?(0,z.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,z.jsx)(`span`,{children:n.projectsLoadFailed}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Ze().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,dt?null:(0,z.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:A===`favorites`?n.favorites:A===`archived`?t.filterArchived:k?n.projectNotes:n.recentNotes}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":A===`agent`,onClick:()=>ot(A===`agent`?`all`:`agent`),className:M(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,A===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,z.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,z.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,z.jsx)(re,{value:ut,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...J.filter(e=>e.name.toLowerCase().includes(B.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:k?$e:j?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:q,searchPlaceholder:n.projectSearch,searchValue:B,onSearchChange:je,onChange:e=>$(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,z.jsxs)(_e,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,role:`group`,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,z.jsx)(`button`,{type:`button`,"aria-pressed":A===e||e===`all`&&A===`unassigned`,onClick:()=>ot(e),className:M(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(A===e||e===`all`&&A===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,z.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Ke?(0,z.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,z.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Je().catch(()=>void 0),className:M(V,`mt-2`),children:n.retry})]}):X?(0,z.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,z.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,z.jsx)(N,{className:`h-10 w-8 shrink-0`}),(0,z.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,z.jsx)(N,{className:`h-4 w-2/3`}),(0,z.jsx)(N,{className:`h-3 w-1/2`})]})]},e))}):et.length===0?(0,z.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,z.jsx)(O,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:F||A!==`all`&&A!==`unassigned`?n.noMatches:k?n.projectEmpty:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:F||A!==`all`&&A!==`unassigned`?n.noMatchesHint:k?n.projectEmptyHint:n.emptyDescription})]}):(0,z.jsx)(`ul`,{className:`divide-y divide-edge`,children:et.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?g:e.kind===`bookmark`?f:v,i=Ae(e,t.titlePlaceholder,n.voiceNote),a=ke(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,z.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,z.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,z.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,z.jsx)(fe,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,z.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,z.jsx)(`span`,{className:`truncate`,children:a})]}),(0,z.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:P(e.updatedAt,nt,tt)})]})]}),(0,z.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,z.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:P(e.updatedAt,nt,tt)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void st(e.id,!e.pinned),disabled:Ie.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${i}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,z.jsx)(se,{className:M(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,z.jsxs)(be,{children:[(0,z.jsx)(xe,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,disabled:Be===e.id,"aria-label":`${t.noteActions}: ${i}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:Be===e.id?(0,z.jsx)(ce,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(ie,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(Se,{children:(0,z.jsx)(we,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,z.jsxs)(Ce,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>ze(e),children:[(0,z.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!X&&!Ke&&Y>0?(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,z.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Y))}),Y>12||K>0?(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:K===0,className:V,onClick:()=>D(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K-1)),t}),children:(0,z.jsx)(p,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{children:[K+1,` / `,Math.max(1,Math.ceil(Y/12))]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(K+1)*12>=Y,className:V,onClick:()=>D(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K+1)),t}),children:(0,z.jsx)(m,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!k&&!j&&(q||Qe.length>0)?(0,z.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>_(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:q?[0,1].map(e=>(0,z.jsx)(N,{className:`h-28 w-full`},e)):Qe.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,z.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,z.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,z.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,z.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,z.jsx)(`span`,{children:e.updatedAt?P(e.updatedAt,nt,tt):n.emptyProject})]})]},e.id))})]}):null]})}),(0,z.jsx)(ve,{open:Re!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,Re?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void ct(),onCancel:()=>ze(null)})]})}function Me(){let e=(0,L.c)(12),{noteId:t}=i(),n=te(),[r]=ee(),a;e[0]===r?a=e[1]:(a=k(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=a);let o=a,s;e[2]!==n||e[3]!==o?(s=()=>{n(o)},e[2]=n,e[3]=o,e[4]=s):s=e[4];let c=s;if(!t)return null;let l=r.get(`edit`)===`1`?`wysiwyg`:`preview`,u;e[5]===r?u=e[6]:(u=r.get(`edit`),e[5]=r,e[6]=u);let d=u===`1`,f;return e[7]!==c||e[8]!==t||e[9]!==l||e[10]!==d?(f=(0,z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-1 flex-col`,children:(0,z.jsx)(F,{noteId:t,onBack:c,initialMode:l,autoFocus:d},t)}),e[7]=c,e[8]=t,e[9]=l,e[10]=d,e[11]=f):f=e[11],f}function H(){let e=(0,L.c)(2),{noteId:t}=i(),n;return e[0]===t?n=e[1]:(n=t?(0,z.jsx)(Me,{}):(0,z.jsx)(je,{}),e[0]=t,e[1]=n),n}export{H as NotesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-DIBIYLnI.js";var t={startExtra:null,main:null,end:null},n=e(e=>({...t,setPageHeader:t=>e(t),clearPageHeader:()=>e(t)}));export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
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-BO1bqKlR.js";var i=e(),a=t(),o={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`};function s(e){let t=(0,i.c)(8),{appearance:s,agentId:c,className:l}=e,u=l===void 0?``:l;if(s===`custom`&&c){let e;return t[0]!==c||t[1]!==u?(e=(0,a.jsx)(r,{agentId:c,avatar:`xopc:custom`,className:u}),t[0]=c,t[1]=u,t[2]=e):e=t[2],e}let d=s===`custom`?`idle`:o[s],f=`personal-avatar-motion inline-flex items-center justify-center ${u}`,p;t[3]===d?p=t[4]:(p=(0,a.jsx)(n,{variant:`avatar`,mood:d,className:`size-full`}),t[3]=d,t[4]=p);let m;return t[5]!==f||t[6]!==p?(m=(0,a.jsx)(`span`,{className:f,"aria-hidden":`true`,children:p}),t[5]=f,t[6]=p,t[7]=m):m=t[7],m}export{s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.personal-avatar-motion{transform-origin:50% 58%;animation:4.4s ease-in-out infinite personal-avatar-breathe}@keyframes personal-avatar-breathe{0%,to{transform:translateY(0)rotate(0)}50%{transform:translateY(-2px)rotate(1.5deg)}}@media (prefers-reduced-motion:reduce){.personal-avatar-motion{animation:none}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-DIBIYLnI.js";import{t as u}from"./messages-BDBGlBKh.js";import{t as d}from"./chat-page-BtMkdtxJ.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./arrow-right-DSSvoX71.js";import{a as m}from"./video-generation-D08uZbsu.js";import{t as h}from"./check-DUBLcKHA.js";import{t as g}from"./list-todo-CTVRto8O.js";import{I as ee}from"./markdown-view-C30KvTaE.js";import{n as _,s as v,t as y}from"./install-connector-dialog-QkJMw_uW.js";import{t as b}from"./phone-DdhTnt6X.js";import{t as x}from"./play-kxZvpBg8.js";import{t as te}from"./settings-2-D-csvaET.js";import{t as ne}from"./upload-rrb46c3c.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{a as w,i as T,o as re,r as E,s as ie,t as D}from"./dist-GJ8-1PAx.js";import{a as O,r as k}from"./connectors-api-so2a7xrD.js";import{u as A}from"./use-realtime-voice-RQW5KnIN.js";import{n as ae}from"./voice-call-context-BM2A4bLz.js";import{t as oe}from"./page-header-store-C2ydtnXa.js";import{s as j}from"./agent-avatar-display-BO1bqKlR.js";import{t as M}from"./personal-avatar-BPQpvC34.js";import{d as se,i as N,r as P}from"./voice-config-api-vbBoKnqd.js";import{t as F}from"./date-formatters-DukWSVwc.js";import{t as ce}from"./personal-profile-settings-DwMdjQ6H.js";var I=n(),L=e(t(),1),R=r(),z=[`intro`,`identity`,`voice`,`connections`],B=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function le(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function V(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 l(s(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),j(e)}function H({modelsAvailable:e,onCreated:t}){let n=c(e=>e.language)===`zh`,r=c(e=>e.language),[i,o]=(0,L.useState)(`intro`),[d,m]=(0,L.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,ee]=(0,L.useState)(!1),[b,te]=(0,L.useState)(!1),[S,w]=(0,L.useState)(null),[T,re]=(0,L.useState)(null),[E,ie]=(0,L.useState)(null),[D,ae]=(0,L.useState)(null),[oe,j]=(0,L.useState)(!0),[F,ce]=(0,L.useState)([]),[I,H]=(0,L.useState)(null),U=(0,L.useRef)(null),W=(0,L.useRef)(null),[G,ue]=(0,L.useState)([]),[K,q]=(0,L.useState)(!0),[J,Y]=(0,L.useState)([]),[X,Z]=(0,L.useState)(null);(0,L.useEffect)(()=>{let e=!1;return l(s(`/api/personal-agent/onboarding`)).then(t=>{e||(o(t.payload.step),m(t.payload.draft))}).catch(t=>{e||w(t instanceof Error?t.message:String(t))}).finally(()=>{e||ee(!0)}),()=>{e=!0}},[]),(0,L.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:i,draft:d})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[d,g,i]),(0,L.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?ae({provider:t.tts.provider,model:t.tts.model,enabled:!0}):j(!1))}).catch(()=>{e||j(!1)}),()=>{e=!0}},[]),(0,L.useEffect)(()=>{if(!D?.enabled)return;let e=!1;return N(D.provider,D.model,`realtime`).then(t=>{e||ce(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||j(!1)}),()=>{e=!0}},[D]),(0,L.useEffect)(()=>{if(i!==`connections`)return;let e=!1;return q(!0),Promise.allSettled([k({page:1,pageSize:24,verification:`verified`}),O()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];ue(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`&&Y(n.value),q(!1)}}),()=>{e=!0}},[i]),(0,L.useEffect)(()=>()=>{W.current?.abort(),U.current?.close()},[]),(0,L.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let Q=async(e,t=d)=>{await l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),o(e)},de=async e=>{w(null);let t=z[Math.max(0,Math.min(z.length-1,z.indexOf(i)+e))];try{await Q(t)}catch(e){w(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||b)){te(!0),w(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:d,r=e.voice&&D?.enabled&&F.some(t=>t.id===e.voice)?{provider:D.provider,model:D.model,voice:e.voice}:void 0,i=(await l(s(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&T)try{await V(i.agentId,T),i=(await l(s(`/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){w(e instanceof Error?e.message:String(e))}finally{te(!1)}}},pe=(0,L.useCallback)(async e=>{W.current?.abort(),U.current?.close();let t=new AbortController;W.current=t,H(e),w(null);try{let n=new A;U.current=n,await n.start();let r=await se(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>H(null))}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e)),H(null)}},[]);if(!g)return(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,R.jsx)(C,{className:`h-10 w-2/3`}),(0,R.jsx)(C,{className:`h-64 w-full rounded-2xl`}),(0,R.jsx)(C,{className:`h-12 w-full rounded-xl`})]});let $=z.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,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,R.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,R.jsxs)(`button`,{type:`button`,disabled:b,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,R.jsx)(f,{className:`size-4`}),n?`上一步`:`Back`]}):(0,R.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,R.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,R.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":z.length,children:z.map((e,t)=>(0,R.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,R.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,R.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,R.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,R.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,R.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,R.jsx)(M,{appearance:d.appearance,className:`size-14`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,R.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:d.displayName||`Ada`})]})]}),(0,R.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${z.length} 步`:`Step ${$+1} of ${z.length}`}),(0,R.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),i===`intro`&&(0,R.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,R.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,R.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,R.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),i===`identity`&&(0,R.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,R.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,R.jsx)(`input`,{value:d.displayName,maxLength:60,onChange:e=>m(t=>({...t,displayName:e.target.value})),onBlur:()=>m(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,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[B.map(e=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":!T&&d.appearance===e.id,onClick:()=>{re(null),ie(null),m(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 ${!T&&d.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,R.jsx)(M,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,R.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 ${T?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,R.jsx)(ne,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,R.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)){w(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}re(t),ie(URL.createObjectURL(t))}}})]})]}),(0,R.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,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.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,R.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsx)(C,{className:`h-20 rounded-xl`}),(0,R.jsx)(C,{className:`h-20 rounded-xl`})]}):D?.enabled&&F.length>0?(0,R.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-pressed":!d.voice,onClick:()=>m(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 ${d.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`}),F.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${d.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,R.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":d.voice===e.id,onClick:()=>m(t=>({...t,voice:e.id})),children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,R.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,R.jsx)(x,{className:`size-4 ${I===e.id?`text-accent`:``}`})})]},e.id))]}):(0,R.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,R.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,R.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,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.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.`}),K?(0,R.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,R.jsx)(C,{className:`h-18 rounded-xl`}),(0,R.jsx)(C,{className:`h-18 rounded-xl`})]}):(0,R.jsx)(`div`,{className:`mt-5 space-y-2`,children:G.length?G.map(e=>{let t=le(J.find(t=>t.connectorId===e.id));return(0,R.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,R.jsx)(_,{connector:e,size:`sm`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,R.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,R.jsx)(h,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>Z(v(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,R.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,R.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,R.jsx)(a,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},i)}),(0,R.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,R.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,R.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[i===`intro`&&(0,R.jsx)(`button`,{type:`button`,disabled:!e||b,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,R.jsx)(`button`,{type:`button`,onClick:()=>{let e={...d,voice:null};m(e),w(null),Q(`connections`,e).catch(e=>w(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,R.jsxs)(`button`,{type:`button`,disabled:b||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:[b?n?`正在创建…`:`Creating…`:i===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!b&&(0,R.jsx)(p,{className:`size-4`})]})]})]})}),X&&(0,R.jsx)(y,{draft:X,onChange:Z,onClose:()=>Z(null),t:u(r).connectorsSettings,onInstalled:async()=>{Y(await O()),Z(null)}})]})}var U=5;function W(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function G(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function ue(e){let t=(0,I.c)(30),{item:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=G(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===n.id?s=t[4]:(s=ee(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,R.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=W(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,R.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,R.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=F(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,R.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==f?(v=(0,R.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_]}),t[19]=_,t[20]=f,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==d?(y=(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,v]}),t[22]=v,t[23]=d,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,R.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==s||t[28]!==l?(x=(0,R.jsxs)(a,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,y,b]}),t[26]=y,t[27]=s,t[28]=l,t[29]=x):x=t[29],x}function K(){let e=o(),t=i(),n=ae(),r=(0,L.useRef)(n);r.current=n;let a=c(e=>e.language)===`zh`,u=oe(e=>e.setPageHeader),f=oe(e=>e.clearPageHeader),[p,m]=(0,L.useState)(null),[h,ee]=(0,L.useState)([]),[_,v]=(0,L.useState)(!0),[y,x]=(0,L.useState)(null),[ne,O]=(0,L.useState)(!1),[k,A]=(0,L.useState)(!1),j=(0,L.useRef)(null),se=(0,L.useRef)(null),N=(0,L.useRef)(null),[P,F]=(0,L.useState)(!1),[I,z]=(0,L.useState)(null),[B,le]=(0,L.useState)(!1),[V,W]=(0,L.useState)(!1),[G,K]=(0,L.useState)(!1),[q,J]=(0,L.useState)(0),Y=(0,L.useRef)(0),X=(0,L.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),Z=(0,L.useRef)(null),Q=(0,L.useRef)(null),de=(0,L.useCallback)(e=>{let t=Q.current;Q.current=e,(e||Z.current===t)&&(Z.current=e,r.current.setMiniAnchor(e))},[]),fe=(0,L.useCallback)(e=>{let t=N.current;N.current=e,(e||Z.current===t)&&(Z.current=e,r.current.setMiniAnchor(e))},[]);(0,L.useLayoutEffect)(()=>{let e=k?N.current:P?Q.current:null;Z.current=e,r.current.setMiniAnchor(e)},[k,P]),(0,L.useEffect)(()=>()=>r.current.setMiniAnchor(null),[]);let pe=(0,L.useCallback)(()=>{r.current.minimize(),F(!1),A(e=>!e)},[]);(0,L.useEffect)(()=>{n.expanded&&(A(!1),F(!1))},[n.expanded]),(0,L.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 $=(0,L.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(s(`/api/personal-agent`)),l(s(`/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`)),ee(t.payload)}catch(e){x(e instanceof Error?e.message:String(e))}finally{v(!1)}},[]);(0,L.useEffect)(()=>{$()},[$]);let me=(0,L.useCallback)(async()=>{r.current.minimize(),A(!1);let e=++Y.current;F(!0),z(null),le(!1),W(!1),K(!1),J(0);try{let t=await l(s(`/api/personal-agent/activity?limit=${U}&offset=0`));if(e!==Y.current)return;z(t.payload),J(t.payload.items.length)}catch{e===Y.current&&le(!0)}},[]),he=(0,L.useCallback)(async()=>{if(!I||V||q>=I.total)return;let e=Y.current;W(!0),K(!1);try{let t=await l(s(`/api/personal-agent/activity?limit=${U}&offset=${q}`));if(e!==Y.current)return;z(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),J(e=>e+t.payload.items.length)}catch{e===Y.current&&K(!0)}finally{e===Y.current&&W(!1)}},[I,q,V]);return(0,L.useEffect)(()=>{if(!P||!I||V)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=Y.current;try{let t=await l(s(`/api/personal-agent/activity?limit=${Math.max(U,Math.min(100,q))}&offset=0`));if(e!==Y.current)return;z(t.payload),J(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[I,q,V,P]),(0,L.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=a?`语音通话`:`Voice call`,i=()=>{A(!1),F(!1),e&&r.current.open({conversationId:p.conversationId,name:p.displayName})},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return u({startExtra:null,main:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[e?(0,R.jsx)(`button`,{ref:se,type:`button`,onClick:pe,"aria-expanded":k,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`编辑${s}的资料`:`Edit ${s}'s profile`,title:a?`设置`:`Settings`,children:(0,R.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,R.jsx)(M,{appearance:o,agentId:p?.agentId,className:`size-8`})})}):(0,R.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,R.jsx)(M,{appearance:o,agentId:p?.agentId,className:`size-8`})}),(0,R.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:e?(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-pressed":n.expanded,onClick:i,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":t,title:t,children:(0,R.jsx)(b,{className:`size-5`})}),(0,R.jsxs)(re,{open:P,onOpenChange:e=>{e?me():F(!1)},children:[(0,R.jsx)(ie,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"aria-pressed":P,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`正在做的事`:`Activity`,children:(0,R.jsx)(g,{className:`size-5`})})}),(0,R.jsx)(w,{children:(0,R.jsxs)(T,{ref:de,onInteractOutside:e=>{e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`)&&e.preventDefault()},side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`派发的任务`:`Delegated tasks`,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)]`} w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我推进的事`:`Delegated work`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:I?a?`最近更新 · 共 ${I.total} 项`:`Recently updated · ${I.total} total`:a?`查看任务进展与结果`:`Follow progress and results`})]}),(0,R.jsx)(E,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭活动`:`Close activity`,children:(0,R.jsx)(S,{className:`size-4`})})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 pb-5 pt-3`,children:[!I&&!B&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(C,{className:`h-18 rounded-2xl`}),(0,R.jsx)(C,{className:`h-18 rounded-2xl`}),(0,R.jsx)(C,{className:`h-18 rounded-2xl`})]}),B&&(0,R.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`暂时无法读取任务`:`Could not load tasks`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:a?`重试`:`Try again`})]}),I?.items.length===0&&(0,R.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,R.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:a?`还没有派发的任务`:`No delegated work yet`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),I&&I.items.length>0&&(0,R.jsx)(`div`,{className:`space-y-2`,children:I.items.map(e=>(0,R.jsx)(ue,{item:e,zh:a},e.id))}),I&&q<I.total&&(0,R.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void he(),disabled:V,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:V?a?`正在加载…`:`Loading…`:a?`加载更多`:`Load more`}),G&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,R.jsx)(`button`,{ref:j,type:`button`,onClick:pe,"aria-expanded":k,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`Ada 设置`:`Ada settings`,children:(0,R.jsx)(te,{className:`size-5`})})]}):null}),()=>f()},[I,B,q,V,G,f,he,me,p,u,P,k,pe,de,n.active,n.expanded,a]),_?(0,R.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,R.jsx)(C,{className:`h-20 w-20 rounded-full`}),(0,R.jsx)(C,{className:`h-9 w-72`}),(0,R.jsx)(C,{className:`h-44 w-full rounded-2xl`})]}):y&&!p?(0,R.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,R.jsx)(`p`,{children:y}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void $(),className:`text-accent hover:underline`,children:a?`重试`:`Retry`})]}):p?.state===`ready`?(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ne&&(0,R.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,R.jsx)(`span`,{children:a?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{O(!1),X()},className:`shrink-0 text-accent hover:underline`,children:a?`打开设置`:`Open settings`})]}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(d,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,avatar:(0,R.jsx)(M,{appearance:p.appearance,agentId:p.agentId,className:`size-14`}),opening:a?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,R.jsxs)(re,{open:k,onOpenChange:A,children:[(0,R.jsx)(D,{virtualRef:j}),(0,R.jsx)(w,{children:(0,R.jsxs)(T,{ref:fe,side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`Ada 快捷设置`:`Ada quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(j.current?.contains(e.target)||se.current?.contains(e.target)||N.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(22rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`快捷设置`:`Quick settings`}),(0,R.jsx)(E,{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":a?`关闭设置`:`Close settings`,children:(0,R.jsx)(S,{className:`size-4`})})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:(0,R.jsx)(ce,{zh:a,onOpenVoiceServices:X})}),(0,R.jsx)(`button`,{type:`button`,onClick:X,className:`shrink-0 border-t border-edge px-4 py-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:a?`更多设置`:`More settings`})]})})]})]}):(0,R.jsx)(H,{modelsAvailable:h.length>0,onCreated:(e,t)=>{m(e),O(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{K as PersonalPage};
|