@xopcai/xopc 0.0.460 → 0.0.462
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/assets/{pcm-capture-worklet-CGN9Mlhg.js → pcm-capture-worklet-Df5TcFw4.js} +4 -2
- package/dist/browser-ext/dist/sidepanel.js +3 -2
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-CGUdvmIT.js → agents-DC0lHtl5.js} +3 -3
- package/dist/gateway/static/root/assets/{apps-page-M2XD1Pzu.js → apps-page-QLOYw2QR.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CiJmJ7_h.js → automation-task-card-CJbIHRxN.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CVjgENMO.js → automations-page-DpKnqajR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CGPWyL0P.js → automations-workspace-BXT_EDON.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-CmnkluMF.js → block-editor-DrZyRQQ0.js} +5 -5
- package/dist/gateway/static/root/assets/{capabilities-DDqDvCBs.js → capabilities-Dr-vvMez.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-hSb-qEgL.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-CnU0htlO.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CvF8VRTv.js → capabilities-settings-panel-B08mjrGB.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BDVQ6Z7A.js → channels-B--IHNs4.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-stPJEZ90.js → chat-chart-block-ClCZyIi0.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-U2a7d6wP.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B4uA_W6R.js → chat-terminal-dock-eneTvxV3.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DyzDVVfz.js → connectors-page-Bs29RvXz.js} +1 -1
- package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +1 -0
- package/dist/gateway/static/root/assets/diagnostics-Bo0Z42P_.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BPwRrP3L.js → extension-debug-page-Bn_5xu_M.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-DIH4TcdH.js → extension-iframe-host-Vs6USa0c.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-C9JDpo_7.js → extension-message-router-GIekDj_w.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CLDoL5N8.js → extension-page-C_3bIjSB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BPIoHw4r.js → extension-provider-D-LolObs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BO_UKeG8.js → extension-settings-page-BV51dk16.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DefKShSW.js +8 -0
- package/dist/gateway/static/root/assets/index-CChzK_5b.css +1 -0
- package/dist/gateway/static/root/assets/index-CEBDMkde.js +11 -0
- package/dist/gateway/static/root/assets/{local-app-workbench-page-D8oqDDAn.js → local-app-workbench-page-CfnixDO3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BlxIaCCQ.js → markdown-view-CNJaAdNN.js} +39 -39
- package/dist/gateway/static/root/assets/note-detail-panel-D_l5jkV9.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D6mvMSKr.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CdXA-g9r.js → notes-api-BOIM9Q_D.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-R4uJroeD.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-Dibmspef.js → page-context-capture-button-B_Vdo2Ai.js} +1 -1
- package/dist/gateway/static/root/assets/pcm-capture-worklet-CpXsv44v.js +1 -0
- package/dist/gateway/static/root/assets/{personal-page-BwfyW7Hx.js → personal-page-BsONyPfQ.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-CQhZjoK6.js → personal-profile-settings-C4CxmQLQ.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-peD05ktj.js → personal-settings-panel-CnxI2TL0.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-D51I7Lg3.js → product-automation-feedback-CGso8wGv.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-WkF2j_c-.js → product-preview-content-Dgtb4LF7.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-modal-C35EWUps.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-xNSy6SAv.js +7 -0
- package/dist/gateway/static/root/assets/recording-upload-CFX7CANT.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-Dwb_N8L-.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-KH1VaEdC.js +2 -0
- package/dist/gateway/static/root/assets/session-manager-63NaXb1s.js +25 -0
- package/dist/gateway/static/root/assets/{settings-page-BHImcF1q.js → settings-page-8MiJzbbl.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-fV5USZb1.js → share-preview-page-Cqy-7-rd.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-sl40lqND.js → shares-settings-BDr50uTV.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-FTd0Z7Ey.js → skills-page-DReUQ4Ug.js} +1 -1
- package/dist/gateway/static/root/assets/star-CnYNmpLd.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DxKXoBbE.js +3 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-CSJeB9AH.js → task-result-evidence-CW_tN93T.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-CO7XLI4x.js → use-composer-attachments-Xn6eUus2.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BXXeXnT0.js → use-file-preview-expanded-D0IBFhM9.js} +1 -1
- package/dist/gateway/static/root/assets/use-realtime-voice-B5IsKrRW.js +1 -0
- package/dist/gateway/static/root/assets/{use-workspace-tree-D27u-eoX.js → use-workspace-tree-7X2ydgS8.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-BiqJ0tlf.js → voice-settings-57pwZeKD.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-Dd_UDfeo.js +2 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-NffP-UXC.js → workspace-file-preview-dialog-Clj9hMj5.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-Do31QQH5.js → workspace-preview-store-imhtuEIP.js} +1 -1
- package/dist/gateway/static/root/index.html +27 -26
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/follow-ups.js +97 -0
- package/dist/packages/gateway-contract/src/home.js +1 -0
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/observation-starters.js +95 -0
- package/dist/packages/gateway-contract/src/observation.js +7 -0
- package/dist/packages/gateway-contract/src/task-research-result.js +3 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +1 -0
- package/dist/src/agent/background-review/prompts.js +7 -1
- package/dist/src/agent/background-review/run-background-review.js +85 -7
- package/dist/src/agent/coding/run-verification.d.ts +14 -7
- package/dist/src/agent/coding/run-verification.js +28 -6
- package/dist/src/agent/context/coordinator.js +1 -1
- package/dist/src/agent/context/deep-recall.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +4 -2
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
- package/dist/src/agent/embedded/run-for-session.js +9 -0
- package/dist/src/agent/embedded/run-turn.js +63 -14
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +17 -2
- package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -0
- package/dist/src/agent/service.d.ts +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +1 -0
- package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
- package/dist/src/agent/tool-manuals/browser.js +3 -1
- package/dist/src/agent/tools/factory.d.ts +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +36 -4
- package/dist/src/agent/tools/personal-task-tool.d.ts +7 -1
- package/dist/src/agent/tools/personal-task-tool.js +68 -3
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.d.ts +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +54 -3
- package/dist/src/agent/tools/task-result-tool.js +31 -0
- package/dist/src/agent/tools/xopc-use-tool.js +50 -19
- package/dist/src/automations/capabilities/write.d.ts +2 -2
- package/dist/src/automations/domain/validation.d.ts +4 -4
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/browser/drivers/browser-driver.d.ts +1 -0
- package/dist/src/browser/drivers/create-driver.js +2 -11
- package/dist/src/browser/drivers/playwright-driver.d.ts +5 -2
- package/dist/src/browser/drivers/playwright-driver.js +83 -38
- package/dist/src/browser/runtime/browser-runtime.d.ts +5 -0
- package/dist/src/browser/runtime/browser-runtime.js +71 -9
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +4 -4
- package/dist/src/computer/errors.d.ts +4 -4
- package/dist/src/computer/evaluation.d.ts +3 -3
- package/dist/src/computer/flows.d.ts +1 -1
- package/dist/src/computer/runtime.d.ts +3 -3
- package/dist/src/config/schema.d.ts +6 -2
- package/dist/src/config/schema.js +3 -0
- package/dist/src/connectors/connected-source-understanding.js +11 -3
- package/dist/src/connectors/learning-coordinator.js +45 -11
- package/dist/src/discussions/recording.js +13 -6
- package/dist/src/endpoint-tools/device-host.d.ts +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -0
- package/dist/src/gateway/hono/routes/home.js +52 -1
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/session-command-handler.js +15 -1
- package/dist/src/gateway/hono/routes/user-model.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +2 -8
- package/dist/src/gateway/service/agent-runner.js +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +5 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +13 -8
- package/dist/src/gateway/service/run-gateway-agent.js +5 -2
- package/dist/src/gateway/service/session-input-coordinator.d.ts +4 -0
- package/dist/src/gateway/service/session-input-coordinator.js +6 -1
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +8 -1
- package/dist/src/home-intelligence/follow-ups.d.ts +36 -0
- package/dist/src/home-intelligence/follow-ups.js +496 -0
- package/dist/src/home-intelligence/host.d.ts +80 -4
- package/dist/src/home-intelligence/host.js +122 -2
- package/dist/src/home-intelligence/observation-starters.d.ts +3 -0
- package/dist/src/home-intelligence/observation-starters.js +27 -0
- package/dist/src/home-intelligence/observation.d.ts +1 -1
- package/dist/src/home-intelligence/observation.js +16 -4
- package/dist/src/local-apps/automation-proposals.d.ts +4 -4
- package/dist/src/local-apps/capabilities/projections.d.ts +38 -38
- package/dist/src/memory-learning/choice-observations.d.ts +9 -0
- package/dist/src/memory-learning/choice-observations.js +155 -0
- package/dist/src/memory-learning/evidence-repair.d.ts +12 -0
- package/dist/src/memory-learning/evidence-repair.js +31 -0
- package/dist/src/memory-learning/repository.d.ts +1 -0
- package/dist/src/memory-learning/repository.js +43 -5
- package/dist/src/memory-learning/source-learning.js +52 -7
- package/dist/src/memory-learning/task-receipts.js +19 -10
- package/dist/src/memory-learning/transcript-source.js +7 -0
- package/dist/src/memory-learning/work-candidate.d.ts +14 -0
- package/dist/src/memory-learning/work-candidate.js +17 -2
- package/dist/src/memory-learning/work-capture.d.ts +1 -0
- package/dist/src/memory-learning/work-capture.js +28 -10
- package/dist/src/memory-learning/work-review.d.ts +46 -0
- package/dist/src/memory-learning/work-review.js +209 -0
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/personal-agent/communication.d.ts +1 -1
- package/dist/src/personal-agent/communication.js +1 -1
- package/dist/src/personal-agent/default-style.d.ts +1 -1
- package/dist/src/personal-agent/default-style.js +1 -1
- package/dist/src/personal-agent/proactivity/repository.d.ts +1 -1
- package/dist/src/personal-agent/prompts.js +4 -4
- package/dist/src/personal-agent/reply-composer.d.ts +1 -1
- package/dist/src/personal-agent/reply-composer.js +52 -34
- package/dist/src/personal-agent/reply-style.d.ts +2 -2
- package/dist/src/personal-agent/reply-style.js +3 -2
- package/dist/src/personal-agent/request-repository.d.ts +3 -0
- package/dist/src/personal-agent/request-service.d.ts +2 -0
- package/dist/src/personal-agent/request-service.js +8 -2
- package/dist/src/phone/contracts.d.ts +1 -1
- package/dist/src/projects/capabilities/write.js +1 -1
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +22 -0
- package/dist/src/storage/sqlite/upgrades/274_home_followups.sql +21 -0
- package/dist/src/tasks/capabilities/management.d.ts +3 -3
- package/dist/src/tasks/capabilities/relations.d.ts +3 -3
- package/dist/src/tasks/capabilities/write.d.ts +4 -4
- package/dist/src/tasks/capabilities/write.js +2 -0
- package/dist/src/tasks/home-query-service.js +4 -2
- package/dist/src/tasks/task-allocation-service.js +10 -2
- package/dist/src/tasks/task-application-service.d.ts +4 -0
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-context-assembler.js +7 -2
- package/dist/src/tasks/task-contract-planner.js +3 -3
- package/dist/src/tasks/task-conversation-summary.d.ts +64 -0
- package/dist/src/tasks/task-conversation-summary.js +105 -0
- package/dist/src/tasks/task-delay-notice.d.ts +4 -0
- package/dist/src/tasks/task-delay-notice.js +113 -0
- package/dist/src/tasks/task-deletion-service.js +6 -1
- package/dist/src/tasks/task-handoff.d.ts +21 -0
- package/dist/src/tasks/task-handoff.js +77 -1
- package/dist/src/tasks/task-json-acceptance.d.ts +22 -0
- package/dist/src/tasks/task-json-acceptance.js +96 -0
- package/dist/src/tasks/task-main-update-decision-service.js +17 -21
- package/dist/src/tasks/task-main-update-delivery.js +34 -7
- package/dist/src/tasks/task-notification-preference.d.ts +16 -0
- package/dist/src/tasks/task-notification-preference.js +42 -0
- package/dist/src/tasks/task-origin-repository.d.ts +1 -0
- package/dist/src/tasks/task-origin-repository.js +3 -0
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-repository.js +1 -0
- package/dist/src/tasks/task-research-repair.d.ts +19 -1
- package/dist/src/tasks/task-research-repair.js +14 -4
- package/dist/src/tasks/task-research-result.d.ts +12 -0
- package/dist/src/tasks/task-research-result.js +5 -0
- package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -1
- package/dist/src/tasks/task-result-delivery-repository.js +8 -5
- package/dist/src/tasks/task-result-delivery-service.js +9 -1
- package/dist/src/tasks/task-run-coordinator.js +45 -10
- package/dist/src/usage/cloud-wire.d.ts +1 -0
- package/dist/src/user-context/config.d.ts +8 -0
- package/dist/src/user-context/config.js +10 -0
- package/dist/src/user-model/capture/evidence-policy.d.ts +2 -0
- package/dist/src/user-model/capture/evidence-policy.js +8 -1
- package/dist/src/user-model/capture/executor.js +16 -4
- package/dist/src/user-model/capture/semantic.d.ts +4 -0
- package/dist/src/user-model/capture/semantic.js +3 -0
- package/dist/src/user-model/index.js +1 -1
- package/dist/src/user-model/observation-repository.d.ts +6 -0
- package/dist/src/user-model/observation-repository.js +12 -0
- package/dist/src/user-model/repository.js +10 -1
- package/dist/src/voice/realtime/agentEngine.js +29 -7
- package/dist/src/voice/realtime/pcmPlaybackEcho.d.ts +10 -0
- package/dist/src/voice/realtime/pcmPlaybackEcho.js +56 -0
- package/dist/src/voice/realtime/playback-echo.d.ts +3 -0
- package/dist/src/voice/realtime/playback-echo.js +35 -5
- package/dist/src/voice/realtime/runtime.js +6 -1
- package/dist/src/voice/realtime/turnPolicy.js +1 -1
- package/package.json +14 -8
- package/dist/gateway/static/root/assets/capabilities-DB713nRi.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-D2hq4cgE.js +0 -2
- package/dist/gateway/static/root/assets/chat-page-BhPw56Vc.js +0 -71
- package/dist/gateway/static/root/assets/constants-DpkUgykJ.js +0 -1
- package/dist/gateway/static/root/assets/discussion-annotation-sync-fwPPMPv9.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BPPe4JXB.js +0 -7
- package/dist/gateway/static/root/assets/index-DjzrnmBA.js +0 -11
- package/dist/gateway/static/root/assets/index-YQxumvaS.css +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-BbHlfAju.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-CqK_uJ6Y.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-8w2Stfak.js +0 -8
- package/dist/gateway/static/root/assets/pcm-capture-worklet-uW_SEACy.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-modal-DMHOKocl.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-CNFuzmRr.js +0 -7
- package/dist/gateway/static/root/assets/recording-upload-CyZSl2DJ.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-CuxNu-LB.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-CXs4PjW0.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-D2LaQymu.js +0 -25
- package/dist/gateway/static/root/assets/task-detail-page-_5TEldtl.js +0 -3
- package/dist/gateway/static/root/assets/use-realtime-voice-C7iWQuUv.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-LghfbP5g.js +0 -2
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CmnkluMF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-CdXA-g9r.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-BlxIaCCQ.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-DImAfVs5.js","assets/product-delivery-BFfqdKLe.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-stPJEZ90.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/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-CqK_uJ6Y.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js","assets/chat-page-BhPw56Vc.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/arrow-up-right-T72JbQ1Q.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-D51I7Lg3.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-DxBmyzp0.js","assets/earth-C9Z4bTTG.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-BGZduAXV.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/new-chat-navigation-B6NPQ4h4.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-BXXeXnT0.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-DpkUgykJ.js","assets/session-api-BFiIYodK.js","assets/gateway-startup-retry-D6WPS0RW.js","assets/attachment-utils-core-BIOUBrpT.js","assets/composer-notifications-CqV6Xj-H.js","assets/activity-store-CQHh48Zf.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-LghfbP5g.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-DxSv1wS2.js","assets/secret-input-DsjfQmDn.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CTuVWwBf.js","assets/gateway-config-swr-1Rk0LeEM.js","assets/oauth-provider-connect-D63M8Iv7.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-Bgh3Gfgl.js","assets/registry-api-DuDIthjL.js","assets/oauth-api-B560CHeD.js","assets/connection-usage-guide-Cibh2lrV.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/share-link-dialog-C1t_HB6f.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/api-B4FJ51EC.js","assets/session-manager-D2LaQymu.js","assets/local-session-drafts-BIBHRkpM.js","assets/tool-activity-BtJkgjFf.js","assets/gateway-realtime-DIs1pjkQ.js","assets/gateway-realtime-store-sx7B8kdC.js","assets/agents-admin-api-D0N09mqJ.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-DAagrRx_.js","assets/model-selector-C-CqPBao.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/workspace-preview-store-Do31QQH5.js","assets/capabilities-DB713nRi.js","assets/capabilities-DDqDvCBs.js","assets/right-workspace-store-HPw7Gw0n.js","assets/phone-workspace-store-Ltrevdsx.js","assets/workspace-editor-agent-store-DVPJcbuE.js","assets/chat-agents-api-CjlzCSmC.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-Dc43dgSg.js","assets/voice-input-shortcut-events-CEeFBhp3.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/tool-friendly-title-CP35P4VA.js","assets/use-realtime-voice-C7iWQuUv.js","assets/voice-CDlC6XMH.js","assets/voice-call-context-BM2A4bLz.js","assets/page-header-store-Bm8oxpFR.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-BPIoHw4r.js","assets/theme-store-BaWep_o7.js","assets/extension-message-router-C9JDpo_7.js","assets/agent-avatar-display-loBdGw_i.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/use-composer-attachments-CO7XLI4x.js","assets/chevron-left-DqFhpbvK.js","assets/file-preview-surface-i5UOFnQF.js","assets/shares-api-Dm07CnXw.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-DrA5mTQp.js","assets/command-palette-api-CP0F6sIm.js","assets/skill-list-api-1o_YRCu9.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-CiJmJ7_h.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-XnE3iFhG.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-C1PXAXZF.js","assets/dev-view-store-B8fGILny.js","assets/extension-iframe-host-DIH4TcdH.js","assets/extension-authoritative-grants-BfL8dMBf.js","assets/runtime-health-zDkHcOZO.js","assets/api-B1J5ajiP.js","assets/terminal-panel-store-Du53Upr2.js","assets/agents-app-path-ciChvpCS.js","assets/agent-display-names-Bje7vfSn.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Cr5GqS2D.js","assets/management-api-B5w5DdXH.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-Dy1EByeG.js";import{t as h}from"./messages-BAnhwALN.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{E as w,b as T,d as E,h as D,i as O,n as k,o as A,r as j,t as M,w as N,x as P}from"./discussion-annotation-sync-fwPPMPv9.js";import{t as F}from"./arrow-left-D880xG-P.js";import{a as I,c as L,d as ee,i as R,l as z,n as B,o as V,r as te,s as ne,t as re,u as ie}from"./product-automation-feedback-D51I7Lg3.js";import{t as ae}from"./check-DUBLcKHA.js";import{t as oe}from"./chevron-down-ccbiQQz_.js";import{n as se,r as H}from"./popover-select-CLsphyzA.js";import{t as ce}from"./circle-check-C23XjkUj.js";import{t as le}from"./code-xml-DJtYhZUF.js";import{t as U}from"./copy-Dv6d4Dvw.js";import{t as ue}from"./download-Dk-ZjtO6.js";import{t as de}from"./ellipsis-0k4rZLoy.js";import{t as fe}from"./external-link-DjqjBmc3.js";import{t as pe}from"./eye-CABVeTq0.js";import{t as me}from"./file-text-D12HbeVy.js";import{t as he}from"./history-DXH_9jsE.js";import{C as ge,E as W,F as _e,O as ve,P as ye,S as be,T as xe,_ as Se,a as Ce,c as we,d as Te,f as Ee,h as De,l as G,m as Oe,n as ke,r as Ae,s as je,u as Me,w as Ne,x as Pe}from"./notes-api-CdXA-g9r.js";import{t as Fe}from"./loader-circle-CifKLtgG.js";import{P as Ie}from"./markdown-view-BlxIaCCQ.js";import{t as Le}from"./message-circle-Badhj-4D.js";import{t as Re}from"./pencil-DmIY3Oa-.js";import{t as ze}from"./play-kxZvpBg8.js";import{t as Be}from"./refresh-cw-BRlGaq2w.js";import{t as Ve}from"./search-DA7gz22f.js";import{t as He}from"./sliders-horizontal-DqsYor6I.js";import{t as Ue}from"./sparkles-DHlfQFAF.js";import{t as We}from"./square-pen-B8FsvqNu.js";import{t as Ge}from"./square-DMK_fB-3.js";import{t as Ke}from"./trash-2-DusmjVPV.js";import{t as qe}from"./x-B_N4OPjy.js";import{t as K}from"./cn-0WouolD0.js";import{t as q}from"./skeleton-DzdOeGYz.js";import{t as Je}from"./session-manager-D2LaQymu.js";import{i as Ye}from"./vendor-swr-CdRzEUwF.js";import{t as J}from"./button-Cc4hUNTt.js";import{t as Xe}from"./copy-to-clipboard-HOJ79TWv.js";import{r as Y}from"./app-chrome-BeB4KgOf.js";import{i as Ze}from"./theme-store-BaWep_o7.js";import{t as Qe}from"./page-header-store-Bm8oxpFR.js";import{t as X}from"./automation-api-DxBmyzp0.js";import{t as $e}from"./confirm-dialog-DrA5mTQp.js";import{b as et,d as tt,o as nt,s as rt,v as it}from"./shares-api-Dm07CnXw.js";import{l as at,m as ot,o as st,r as ct,t as lt,u as ut}from"./dist-ZrL34Ps4.js";import{t as Z}from"./oauth-provider-connect-D63M8Iv7.js";import{n as dt,t as ft}from"./page-context-draft-Cr5GqS2D.js";import"./note-image-lightbox-CqK_uJ6Y.js";import{t as pt}from"./page-context-capture-button-Dibmspef.js";var Q=e(t(),1),mt=r(),$=i(),ht=6e4,gt=36e5,_t=864e5;function vt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function yt(e,t,n){let r=t-e;if(r<ht)return n.justNow;if(r<gt){let e=Math.floor(r/ht);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=vt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-_t)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*_t){let e=Math.floor(r/_t);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function bt(e,t,n){let r=vt(t);if(e>=r)return n.today;if(e>=r-_t)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 xt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function St(e){let t=(0,mt.c)(45),{title:n,description:r,prompt:i,coverage:a,className:o,variant:s}=e,l=s===void 0?`card`:s,u=f(Tt),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:_}=Ye(a?`automation-suggestion-coverage`:null,wt,g),v=a?_?.automations.find(e=>R(e,a)):void 0,y=v?B(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===o?e=t[2]:(e=K(`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)(ce,{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)(J,{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=K(`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)(N,{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)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(J,{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=K(`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)(ce,{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)(J,{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:te(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(Ct)})]}),i]})}let b;t[24]===o?b=t[25]:(b=K(`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)(N,{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 E;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t[37]=E):E=t[37];let D;t[38]!==d.create||t[39]!==T?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(J,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:T,children:[E,d.create]})}),t[38]=d.create,t[39]=T,t[40]=D):D=t[40];let O;return t[41]!==D||t[42]!==b||t[43]!==w?(O=(0,$.jsxs)(`section`,{className:b,children:[w,D]}),t[41]=D,t[42]=b,t[43]=w,t[44]=O):O=t[44],O}function Ct(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 wt(){return X.list()}function Tt(e){return e.language}var Et=`z-[140] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 text-sm text-fg shadow-popover`,Dt=`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 Ot(e){let t=(0,mt.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)(Le,{className:`size-4`,"aria-hidden":!0}),r?`AI 对话`:`AI chat`]}),(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)(ee,{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)(ue,{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)(ot,{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)(ct,{asChild:!0,children:(0,$.jsx)(`a`,{className:Dt,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)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsx)(ct,{asChild:!0,children:(0,$.jsxs)(`a`,{className:Dt,href:u(`${l}/audio`),download:!0,children:[(0,$.jsx)(ue,{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)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,collisionPadding:12,className:Et,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)(at,{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)(de,{className:`size-5`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(ot,{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)(ct,{className:Dt,disabled:c.busy,onSelect:c.onAnalyze,children:[(0,$.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),r?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(ct,{className:Dt,onSelect:c.onHistory,children:[(0,$.jsx)(he,{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)(pt,{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)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(ct,{className:`${Dt} text-danger`,disabled:c.busy,onSelect:c.onDelete,children:[(0,$.jsx)(Ke,{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)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,collisionPadding:12,className:Et,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)(at,{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 kt(e){let t=(0,mt.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)(He,{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)(qe,{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`,ee;t[18]===L?ee=t[19]:(ee=(0,$.jsx)(H,{value:`general`,children:L}),t[18]=L,t[19]=ee);let R=a?`项目例会`:`Project`,z;t[20]===R?z=t[21]:(z=(0,$.jsx)(H,{value:`project`,children:R}),t[20]=R,t[21]=z);let B=a?`需求评审`:`Review`,V;t[22]===B?V=t[23]:(V=(0,$.jsx)(H,{value:`review`,children:B}),t[22]=B,t[23]=V);let te=a?`客户访谈`:`Interview`,ne;t[24]===te?ne=t[25]:(ne=(0,$.jsx)(H,{value:`interview`,children:te}),t[24]=te,t[25]=ne);let re;t[26]!==F||t[27]!==I||t[28]!==ee||t[29]!==z||t[30]!==V||t[31]!==ne||t[32]!==r?(re=(0,$.jsxs)(se,{value:r,"aria-label":F,onChange:I,children:[ee,z,V,ne]}),t[26]=F,t[27]=I,t[28]=ee,t[29]=z,t[30]=V,t[31]=ne,t[32]=r,t[33]=re):re=t[33];let ie;t[34]!==P||t[35]!==re?(ie=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[P,re]}),t[34]=P,t[35]=re,t[36]=ie):ie=t[36];let ae;t[37]!==f||t[38]!==o||t[39]!==n.discussion.status||t[40]!==l||t[41]!==s||t[42]!==a?(ae=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)(J,{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]=ae):ae=t[43];let oe;t[44]!==M||t[45]!==ie||t[46]!==ae?(oe=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M,ie,ae]}),t[44]=M,t[45]=ie,t[46]=ae,t[47]=oe):oe=t[47];let ce=a?`取消`:`Cancel`,le;t[48]===ce?le=t[49]:(le=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(J,{children:ce})}),t[48]=ce,t[49]=le);let U=o||s||!n.discussion.canonicalTranscript,ue;t[50]===c?ue=t[51]:(ue=()=>{d(!1),c()},t[50]=c,t[51]=ue);let de;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),t[52]=de):de=t[52];let fe=a?`重新整理纪要`:`Regenerate summary`,pe;t[53]!==U||t[54]!==ue||t[55]!==fe?(pe=(0,$.jsxs)(J,{variant:`primary`,disabled:U,onClick:ue,children:[de,fe]}),t[53]=U,t[54]=ue,t[55]=fe,t[56]=pe):pe=t[56];let me;t[57]!==le||t[58]!==pe?(me=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[le,pe]}),t[57]=le,t[58]=pe,t[59]=me):me=t[59];let he;t[60]!==A||t[61]!==oe||t[62]!==me?(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,oe,me]})]}),t[60]=A,t[61]=oe,t[62]=me,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 At(e){return JSON.stringify([e.transcript.revision,e.transcript.segments.map(e=>[e.sequence,e.revision,e.status]),e.organization?.revision])}function jt(e,t,n,r){let i=(0,mt.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!==At(t))&&(o?.noteId===e&&n(),s({noteId:e,version:At(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:At(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!==At(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 Mt(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 Nt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Pt({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=Mt(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`,ee=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?``:`${Nt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${Nt(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:[Nt(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)(J,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,Nt(e.startedAtMs),`–`,Nt(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(J,{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)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`})]}):null,_&&(!l||w!==M||O!==t)?(0,$.jsx)(q,{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)(J,{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":`${Nt(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(ee)]}):(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(ee)})]}):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(ee)]}):null]}),l.hasMore?(0,$.jsx)(J,{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`,` `,Nt(l.coverage.processedMs),` / `,Nt(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,Nt(l.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${Nt(e.startedAtMs)}–${Nt(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 Ft({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=Ye(`/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 j(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await M(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 A(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)(J,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`录音时标重点,或在原文中标记整段。标记先保存在本机。`:`Highlight while recording or mark a transcript segment. Highlights save locally first.`}),[...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)(J,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(J,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(J,{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)(J,{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)(J,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&k(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)(se,{value:f.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...f,kind:e.target.value}),children:[(0,$.jsx)(H,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(H,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(H,{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)(J,{onClick:()=>void b(f,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(J,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var It={tab:`summary`,query:``,page:1,positionMs:0},Lt=m((e,t)=>({notes:{},update:(n,r)=>{let i={...zt(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Rt=new Map;function zt(e,t){if(t)return t;if(Rt.has(e))return Rt.get(e);let n=It;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={...It,...t})}catch{}return Rt.set(e,n),n}function Bt(e){let t=(0,mt.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)(J,{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)(J,{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 Vt(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 Ht=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Ut({noteId:e,onPersonalNotes:t,onMeetingContent:n,personalNotes:r,personalNotesActive:i=!1,noteActions:a}){let c=o(),l=f(e=>e.language)===`zh`,{data:d,mutate:m,isLoading:h}=Ye([`note-discussion-document`,e],()=>E(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),[_,v]=(0,Q.useState)(null),[y,w]=(0,Q.useState)(null),k=(0,Q.useRef)(null),{detail:j,hasUpdates:N,publish:F}=jt(e,d,Mt(k),!!_||!!y),I=j?.discussion.id,L=`/api/discussions/${encodeURIComponent(I??``)}`,{data:ee=[],mutate:R}=Ye(I?`${L}/actions`:null,e=>p(u(e)),{refreshInterval:1e4}),z=Lt(t=>zt(e,t.notes[e])),B=Lt(e=>e.update),V=z.tab,te=t=>B(e,{tab:t}),ne=z.query,re=t=>B(e,{query:t}),[ie,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{ie&&se.current?.focus()},[ie]);let[H,ce]=(0,Q.useState)(`general`),le=(0,Q.useRef)(null),U=(0,Q.useRef)(null),[ue,de]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(!1),me=(0,Q.useRef)(!1),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),[W,_e]=(0,Q.useState)(null),[ve,ye]=(0,Q.useState)(!1),[be,xe]=(0,Q.useState)([]),[Se,Ce]=(0,Q.useState)(null),[we,Te]=(0,Q.useState)(!1),Ee=z.page,De=t=>B(e,{page:t}),G=(0,Q.useRef)(null),[Oe,ke]=(0,Q.useState)([]),Ae=(0,Q.useRef)(0),je=(0,Q.useRef)(0),Me=(0,Q.useRef)(d?.transcript.revision);Me.current=d?.transcript.revision;let Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(d?.discussion.audioDeletedAt);Pe.current=d?.discussion.audioDeletedAt;let Fe=(0,Q.useRef)(null),[,Le]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let t=()=>{m(),R()},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)}},[m,R,e]),(0,Q.useEffect)(()=>{j?.discussion.template&&ce(j.discussion.template)},[j?.discussion.template]);async function Re(e){if(!we){Te(!0),Ce(null);try{await e();let t=await m();F(t),await R()}catch(e){Ce(e instanceof Error?e.message:String(e))}finally{Te(!1)}}}function Be(e,t){Ne.current&&(G.current=t??null,Ne.current.readyState===0?(Fe.current=e/1e3,Ne.current.load()):(Ne.current.currentTime=e/1e3,Ne.current.play().catch(()=>void 0)))}function He(){if(U.current)return;let e=ge.current??(document.activeElement instanceof HTMLElement?document.activeElement:null);U.current={element:e,triggerIndex:Array.from(k.current?.querySelectorAll(`button`)??[]).findIndex(t=>t===e),scrollTop:k.current?.scrollTop??0,review:z}}function Ue(){je.current++,de(!1),_e(null),he.current=U.current?.element??null,fe||(U.current=null)}function Ge(){let t=U.current;if(!t)return;let{tab:n,query:r,page:i,anchor:a,anchorRevision:o}=t.review;B(e,{tab:n,query:r,page:i,anchor:a,anchorRevision:o}),ke([]),_e(null),pe(!1),me.current=!0}(0,Q.useLayoutEffect)(()=>{if(!W&&!ue&&he.current&&(he.current.focus({preventScroll:!0}),he.current=null),!me.current)return;me.current=!1;let e=U.current;e&&k.current&&(k.current.scrollTop=e.scrollTop),(e?.element?.isConnected?e.element:e&&e.triggerIndex>=0?k.current?.querySelectorAll(`button`)[e.triggerIndex]:null)?.focus({preventScroll:!0}),U.current=null}),(0,Q.useEffect)(()=>{(W||ue)&&le.current?.focus({preventScroll:!0})},[W,ue]);function Ke(e){He();let t=e.stale||e.transcriptRevision!==Me.current,n=Pe.current?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:e;_e({...n,stale:t}),t||ke(e.segments.map(e=>e.sequence))}async function K(e,t,n=!1){if(!j)return;let r=Ae.current,i=++je.current;He(),de(!0),_e(null),Ce(null);try{let a=await p(u(`${L}/evidence?revision=${t??j.organization?.transcriptRevision??j.transcript.revision}&segments=${e.join(`,`)}`));if(r!==Ae.current||i!==je.current)return;if(Ke(a),n&&!Pe.current&&a.segments[0]?.playback[0]){let e=a.segments[0].playback[0];Be(e.startedAtMs,e.endedAtMs)}}catch(e){r===Ae.current&&i===je.current&&(Ce(e instanceof Error?e.message:String(e)),Ue())}finally{i===je.current&&de(!1)}}async function Je(e){j&&await Re(async()=>{await A(j.discussion.clientRequestId,O({type:`transcript`,capturedAt:Date.now(),transcriptRevision:j.transcript.revision,segmentIds:[e.sequence]})),te(`marks`),M(j.discussion.clientRequestId,j.discussion.id).catch(e=>Ce(String(e)))})}(0,Q.useEffect)(()=>(Ae.current++,je.current++,U.current=null,pe(!1),de(!1),_e(null),ke([]),v(null),w(null),xe([]),Ce(null),G.current=null,()=>{Ae.current++}),[e]),(0,Q.useEffect)(()=>{let t=j?.discussion.audioSha256??j?.discussion.audioAttachmentId;if(!t)return;let n=zt(e,Lt.getState().notes[e]);n.source&&n.source!==t?(Ae.current++,je.current++,de(!1),_e(null),ke([]),Ne.current?.pause(),B(e,{positionMs:0,source:t}),Fe.current=0,G.current=null):B(e,{source:t})},[e,j?.discussion.audioSha256,j?.discussion.audioAttachmentId,B]),(0,Q.useEffect)(()=>{j?.discussion.audioDeletedAt&&(Ne.current?.pause(),Fe.current=null,G.current=null,_e(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[j?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{z.tab===`transcript`&&z.anchor!==void 0&&z.anchorRevision===j?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${z.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[z.tab,z.anchor,z.anchorRevision,j?.transcript.revision]),(0,Q.useEffect)(()=>{ke([]),_e(e=>e&&e.transcriptRevision!==d?.transcript.revision?{...e,stale:!0}:e)},[d?.transcript.revision]);let Xe=(e,t,n)=>t.some(e=>ve||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>ve||!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:l?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:l?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:we||N,onClick:()=>w({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:l?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:we,className:`shrink-0 text-accent-fg`,onClick:()=>void K(e.evidenceSegmentIds,e.evidenceRevision),children:l?`原话`:`Source`}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:l?`暂无定位`:`No source timing`})]},e.id))]}):null;if(h)return(0,$.jsx)(q,{className:`h-48 w-full`});if(!j)return null;let{discussion:Y,transcript:Ze,organization:Qe}=j,X=Qe?.organization,$e=[`stopping`,`sealing`,`organizing`].includes(Y.status),et=!N&&[`recording`,`completed`,`needs_attention`].includes(Y.status),tt=Ze.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(ne.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(ne.toLocaleLowerCase())),nt=i?j.note.markdown:V===`marks`||ne.trim()?``:Vt(j,V,{query:ne,page:Ee,showIgnored:ve});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=>{ge.current=e.target instanceof Element?e.target.closest(`button`):null},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),oe(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-start gap-x-3 gap-y-1 px-5 pb-2 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-40 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-2xl font-semibold leading-snug tracking-tight`,children:!j.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(j.note.title)?l?`语音笔记`:`Voice note`:j.note.title}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[l?`录音`:`Recording`,` · `,Ht(Y.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":l?`搜索此 Note`:`Search this Note`,"aria-expanded":ie||!!ne,onClick:()=>{oe(e=>!e),ie&&re(``)},className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ve,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Ot,{noteActions:a,detail:j,zh:l,busy:we,processing:$e,pageText:nt,editing:!!y||!!_})]}),(0,$.jsx)(`nav`,{"aria-label":l?`笔记内容`:`Note content`,className:`mx-5 mb-2 flex shrink-0 gap-6 border-b border-edge-subtle sm:mx-7`,children:[`summary`,`transcript`,`personal`].map(e=>{let r=e===`personal`?i:!i&&(e===`transcript`?V===`transcript`||V===`marks`:V===e);return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":r,className:`min-h-11 border-b-2 px-1 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${r?`border-accent font-medium text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,onClick:()=>{e===`personal`?(Ue(),t?.()):(n?.(),te(e))},children:e===`summary`?l?`纪要`:`Summary`:e===`personal`?l?`我的笔记`:`My notes`:l?`原文`:`Transcript`},e)})}),Se?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:l?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:Se})]}):null,!i&&(ie||ne)?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 flex shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7`,children:[(0,$.jsx)(Ve,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:se,"aria-label":l?`搜索此 Note`:`Search this Note`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:l?`搜索这篇笔记`:`Search this note`,value:ne,onChange:e=>{re(e.target.value),De(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":l?`关闭搜索`:`Close search`,onClick:()=>{re(``),oe(!1)},children:(0,$.jsx)(qe,{className:`size-4`})})]}):null,fe?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 px-5 pb-2 text-xs text-fg-muted sm:px-7`,children:[(0,$.jsx)(`span`,{children:U.current?.review.tab===`summary`?l?`正在查看结论依据`:`Viewing supporting transcript`:l?`正在查看原文依据`:`Viewing source transcript`}),(0,$.jsx)(J,{variant:`ghost`,onClick:Ge,children:U.current?.review.tab===`summary`?l?`返回结论`:`Back to conclusion`:l?`返回阅读位置`:`Back to reading`})]}):null,(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,$.jsxs)(`main`,{ref:k,className:`min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-1 sm:px-7 ${i||W||ue?`hidden`:`flex`} ${!i&&(W||ue)?`@min-[58rem]/discussion:flex`:``}`,children:[V===`summary`?(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[46rem] items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:l?`会议纪要`:`Meeting summary`}),(0,$.jsx)(kt,{detail:j,template:H,onTemplate:ce,zh:l,busy:we,processing:$e,onOrganize:()=>void Re(()=>p(u(`${L}/organize`),{method:`POST`,body:JSON.stringify({template:H})})),onRegenerate:()=>void Re(()=>D(Y.id,`from_audio`))})]}):(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[46rem] gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,"aria-pressed":V===`transcript`,onClick:()=>te(`transcript`),children:l?`全部原文`:`All transcript`}),(0,$.jsx)(J,{variant:`ghost`,"aria-pressed":V===`marks`,onClick:()=>te(`marks`),children:l?`我的标记`:`My highlights`})]}),(Y.status!==`completed`||!X||Qe?.transcriptRevision!==Ze.revision)&&(Y.status!==`recording`||j.recordingJob)?(0,$.jsx)(T,{context:`note`,nextAttemptAt:j.processing?.nextAttemptAt,input:P(j),zh:l,busy:we,onRetry:e=>void Re(()=>e===`analyze`?p(u(`${L}/organize`),{method:`POST`,body:JSON.stringify({template:H})}):D(Y.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,hidden:!!ne.trim(),children:V===`marks`?(0,$.jsx)(Ft,{recordingId:Y.clientRequestId,discussionId:Y.id,zh:l,onEvidence:Ke,onPlay:e=>Be(e.startedAtMs,e.endedAtMs)},Y.id):V===`summary`?X?(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:l?`摘要`:`Summary`}),(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":l?`编辑概要`:`Edit overview`,title:l?`编辑概要`:`Edit overview`,disabled:we||$e||N,onClick:()=>w({kind:`summary`,itemId:`summary`,text:X.summary}),children:(0,$.jsx)(We,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{"data-reading-anchor":`summary`,className:`whitespace-pre-wrap text-[15px] leading-7`,children:X.summary}),X.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`已由你编辑`:`Edited by you`}):null,X.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(X.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(J,{onClick:()=>void K(X.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[l?`查看原话`:`View source`,X.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,X.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:l?`重点结论`:`Key points`}),X.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(J,{onClick:()=>void K(e.evidenceSegmentIds,e.evidenceRevision),children:l?`原话`:`Source`})]},e.id))]}):X.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:l?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:X.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...X.decisions,...X.actionItems,...X.risks,...X.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:ve,onChange:e=>ye(e.target.checked)}),l?`显示已忽略项`:`Show ignored items`]}):null,be.length?(0,$.jsx)(J,{disabled:we||N,onClick:()=>void Re(async()=>{for(let e of be)await p(u(`${L}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Qe.revision})});xe([])}),children:l?`加入所选 ${be.length} 项任务`:`Add ${be.length} selected tasks`}):null,Xe(l?`已决定事项`:`Decisions`,X.decisions,`decisions`),X.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:l?`下一步行动`:`Next actions`}),X.actionItems.filter(e=>ve||!e.ignored).map(e=>{let t=ee.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":`${l?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:be.includes(e.id),onChange:t=>xe(t.target.checked?[...be,e.id]:be.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:l?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:l?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:we||$e||N,onClick:()=>w({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:l?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(l?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(l?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:we,className:`text-accent-fg`,onClick:()=>void K(e.evidenceSegmentIds,e.evidenceRevision),children:l?`查看原话`:`Source`}):null,t?t.deleted?(0,$.jsx)(`span`,{children:l?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(s,{className:`text-accent-fg`,to:Ie(`${c.pathname}${c.search}`,t.taskId),children:t.resolution===`done`?l?`已完成 · 查看任务`:`Done · View task`:l?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(J,{disabled:we||N||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void Re(()=>p(u(`${L}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Qe.revision})})),children:l?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,Xe(l?`风险`:`Risks`,X.risks,`risks`),Xe(l?`尚未确定`:`Open questions`,X.openQuestions,`openQuestions`),X.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:l?`前后变更`:`Changes during the meeting`}),X.changes.map(e=>{let t=[...X.decisions,...X.actionItems,...X.risks,...X.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`?l?`后续撤销或替代`:`Later superseded`:l?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void K(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 K(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)(`h3`,{className:`text-base font-medium`,children:Ze.text?l?`录音摘录`:`From your recording`:Y.status===`needs_attention`?l?`纪要暂未生成`:`Summary unavailable`:l?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${Ze.text?`text-fg`:`text-fg-muted`}`,children:Ze.text?Ze.text.slice(0,400)+(Ze.text.length>400?`…`:``):l?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),Ze.text?(0,$.jsx)(J,{className:`min-h-11`,onClick:()=>te(`transcript`),children:l?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[tt.slice(0,Ee*50).map(e=>(0,$.jsxs)(`article`,{"data-reading-anchor":`segment:${e.sequence}`,id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${Oe.includes(e.sequence)||z.anchor===e.sequence&&z.anchorRevision===Ze.revision?`border-accent`:`border-edge-subtle`}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,disabled:!Y.audioAttachmentId||!!Y.audioDeletedAt,onClick:()=>void K([e.sequence],Ze.revision,!0),children:[(0,$.jsx)(ze,{className:`size-3`}),Ht(e.startedAtMs)]}),e.status===`confirmed`&&!N?(0,$.jsx)(`button`,{onClick:()=>void Je(e),children:l?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(l?`未区分说话人`:`Speaker unknown`)}),et&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>v({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:l?`校对`:`Edit`}):null]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(l?`等待转写`:`Awaiting transcription`)})]},e.sequence)),tt.length>Ee*50?(0,$.jsx)(J,{onClick:()=>De(Ee+1),children:l?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,children:(0,$.jsx)(Pt,{id:Y.id,query:ne.trim(),zh:l,sourceKey:`${Y.audioSha256}:${Y.audioDeletedAt}`,active:$e||Y.status===`recording`,tab:V,refreshKey:`${Y.updatedAt}:${Ze.revision}:${Qe?.revision}`,onEvidence:Ke,onPlay:Be},Y.id)})]}),(0,$.jsx)(`div`,{className:i?`min-h-0 min-w-0 flex-1 overflow-hidden`:`hidden`,children:r}),W||ue?(0,$.jsxs)(`aside`,{ref:le,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),Ue())},"aria-label":l?`原话证据`:`Source evidence`,className:`flex min-h-0 w-full min-w-0 flex-col border-edge bg-surface-panel outline-none @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:[l?`原话证据`:`Source evidence`,` `,W?`· v${W.transcriptRevision}`:``]}),(0,$.jsx)(`button`,{"aria-label":l?`关闭`:`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:Ue,children:(0,$.jsx)(qe,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[ue?(0,$.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,$.jsx)(q,{className:`h-4 w-1/3`}),(0,$.jsx)(q,{className:`h-24 w-full`})]}):null,W?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),W.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!W.audioAvailable||!W.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`原文仍可查看;原音不可用或时间定位待核实。`:`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:[Ht(t.startedAtMs),`–`,Ht(t.endedAtMs),` · `,t.speakerLabel??(l?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(J,{onClick:()=>Be(e.startedAtMs,e.endedAtMs),children:[l?`播放原话`:`Play source`,` `,Ht(e.startedAtMs),`–`,Ht(e.endedAtMs)]},t)),!W.stale&&W.transcriptRevision===d?.transcript.revision&&W.transcriptRevision!==Ze.revision?(0,$.jsx)(J,{onClick:()=>F(),children:l?`查看最新原文`:`View latest transcript`}):null,!W.stale&&W.transcriptRevision===d?.transcript.revision&&W.transcriptRevision===Ze.revision?(0,$.jsx)(J,{onClick:()=>{re(``),De(Math.max(Ee,Math.ceil((Ze.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),te(`transcript`),ke([t.sequence]),_e(null),pe(!0),B(e,{anchor:t.sequence,anchorRevision:Ze.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:l?`定位原文`:`Locate transcript`}):null]},t.sequence))]}):null]})]}):null]}),Y.audioAttachmentId&&!Y.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:Ne,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:u(`${L}/audio`),onTimeUpdate:()=>{let t=(Ne.current?.currentTime??0)*1e3;Le(t),B(e,{positionMs:t}),G.current!==null&&t>=G.current&&(Ne.current?.pause(),G.current=null)},onLoadedMetadata:()=>{Fe.current!==null&&Ne.current?(Ne.current.currentTime=Fe.current,Fe.current=null,Ne.current.play().catch(()=>void 0)):Ne.current&&(Ne.current.currentTime=z.positionMs/1e3)},onError:()=>Ce(l?`录音暂不可播放`:`Recording unavailable`)})}):null,y&&Qe?(0,$.jsx)(Bt,{initial:y,zh:l,busy:we,onClose:()=>w(null),onSave:e=>Re(async()=>{await p(u(`${L}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:Qe.revision})}),w(null)})},`${y.kind}:${y.itemId}:${Qe.revision}`):null,_?(0,$.jsx)(C,{open:!0,onOpenChange:e=>{e||v(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:l?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":l?`关闭校对`:`Close editor`,onClick:()=>v(null),children:(0,$.jsx)(qe,{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:[l?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:_.speaker,onChange:e=>v({..._,speaker:e.target.value})})]}),_.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!_.applyToSpeakerGroup,onChange:e=>v({..._,applyToSpeakerGroup:e.target.checked})}),l?`同时更名所有同标签片段;输入已有标签可合并说话人`:`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:_.text,onChange:e=>v({..._,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(J,{variant:`primary`,disabled:we||!_.text.trim(),onClick:()=>void Re(async()=>{await p(u(`${L}/segments/${_.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:_.text,speakerLabel:_.speaker,expectedRevision:_.segment.revision,applyToSpeakerGroup:_.applyToSpeakerGroup,expectedTranscriptRevision:Ze.revision})}),v(null)}),children:[(0,$.jsx)(ae,{className:`size-4`}),l?`保存修订`:`Save revision`]})})]})]})}):null]})}var Wt={edit:Re,ai_edit:Ue,sync:Be,restore:w};function Gt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Kt({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}=Ye(e?[`note-history`,e]:null,()=>Ee(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 xe(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)(he,{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)(qe,{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=Wt[e.trigger]??Re,i=t===e.timestamp,a=p===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:K(`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:Gt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:yt(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 qt({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}=Ye(e?[`note-agent-context-status`,e]:null,()=>G(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>Pe(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 be(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)(Ue,{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)(F,{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:K(`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:K(`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)(z,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:K(`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)(ie,{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)(Le,{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 Jt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Yt({open:e,onOpenChange:t,note:n}){let r=f(e=>e.language)===`zh`,i=r?$t:en,{data:a,mutate:o}=Ye(e?[`note-shares`,n.id]:null,()=>Oe(n.id)),s=Ye(e?`hosted-share-auth-status`:null,tt),c=s.data===!0,l=Ye(e&&c?`hosted-publication-capabilities`:null,rt),u=l.data?.publishing.allowed===!0,d=Ye(e&&c?[`hosted-note-publications`,n.id]:null,()=>Te(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,z]=(0,Q.useState)(null),B=(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(B.map(e=>e.id))),F(null),L(!1),z(null))},[e,B]);let V=async()=>{j(!0),z(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 Ae(n.id,e);F(t.shareUrl),await d.mutate()}else{let t=await Ce(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},te=async(e,t)=>{N(e.id),z(null);try{t===`refresh`?await ge(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await it(e.id),await d.mutate()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(null)}},ne=async(e,t)=>{N(e.id),z(null);try{t===`refresh`?await Ne(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await nt(e.id,864e5):await et(e.id),await o()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(null)}},re=async e=>{z(null);try{if(!await Xe(e)){L(!1),z(i.copyFailed);return}L(!0),window.setTimeout(()=>L(!1),1500)}catch{L(!1),z(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)(ee,{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)(qe,{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})]}),B.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:B.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:Qt(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)(se,{value:O,onChange:e=>k(e.target.value),children:[(0,$.jsx)(H,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(H,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(Z,{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)(se,{value:h,onChange:e=>_(e.target.value),children:Jt.map(e=>(0,$.jsx)(H,{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)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void re(P),children:[I?(0,$.jsx)(ae,{className:`size-4`}):(0,$.jsx)(U,{className:`size-4`}),I?i.copied:i.copy]}),(0,$.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(fe,{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)(Zt,{share:e,busy:M===e.id,t:i,onCopy:re,onAction:ne},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)(Xt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:re,onAction:te},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)(J,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(J,{type:`button`,onClick:()=>void V(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,$.jsx)(Fe,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function Xt(e){let t=(0,mt.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=K(`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)(Fe,{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)(U,{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)(J,{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)(fe,{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)(J,{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)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(Be,{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)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(Ke,{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 Zt(e){let t=(0,mt.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=K(`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)(Fe,{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)(U,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,$.jsxs)(J,{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)(fe,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,$.jsxs)(J,{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)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Be,{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)(J,{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)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(Ke,{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 Qt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var $t={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:`撤销`},en={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`},tn=e(n(),1);function nn({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,tn.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)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`summary`),children:n?`摘要预览`:`Summary`}),(0,$.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`todo`),children:n?`提取待办`:`Extract to-dos`}),(0,$.jsx)(J,{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)(qe,{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)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{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)(J,{variant:`ghost`,onClick:()=>void Xe(a).then(e=>{m(e),e||d(n?`复制失败,请重试。`:`Copy failed. Try again.`)}),children:f?n?`已复制`:`Copied`:n?`复制结果`:`Copy`}),(0,$.jsx)(J,{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 rn(e){let t=(0,mt.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=V(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=V(u),f=V(an),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(I,{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)(Ge,{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 an(e){return e.stop}function on(e,t){let n=ne(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=ne(e);return!r||n.split(`
|
|
5
|
-
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
6
|
-
|
|
7
|
-
`)}var sn=()=>a(()=>import(`./block-editor-CmnkluMF.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])),cn=()=>a(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([46,1,2,42,47,17])),ln=(0,Q.lazy)(()=>a(()=>import(`./chat-page-BhPw56Vc.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([48,1,2,17,16,3,4,11,12,13,6,49,50,51,52,53,54,55,56,57,58,59,9,10,14,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,7,8,32,34,60,36,38,61,62,63,64,65,66,39,67,68,69,70,71,72,73,74,75,76,77,78,79,40,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,37,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,33,123,35,124,125,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,41,171,172,173,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]))),un=(0,Q.lazy)(()=>sn().then(e=>({default:e.BlockEditor}))),dn=(0,Q.lazy)(()=>cn().then(e=>({default:e.MarkdownEditor})));function fn(){let e=(0,mt.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 pn(e){let t=(0,mt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:me},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:le},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:pe},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=mn,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)(oe,{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)(ot,{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)(st,{children:(0,$.jsx)(lt,{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)(ct,{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)(ae,{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)(at,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function mn(e){e===`wysiwyg`&&sn(),e===`source`&&cn()}function hn(e){let t=(0,mt.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(gn),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)(_n,{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)(ye,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function gn(e){return e.language}function _n({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}=Ye([`note-discussion-document`,e],()=>E(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=Ze(e=>e.resolved)===`dark`,{openImage:D}=_e(),[O,k]=(0,Q.useState)(l);(0,Q.useEffect)(()=>{S(null)},[O,y]);let[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(null),[P,I]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(``),[B,te]=(0,Q.useState)(360),[ne,ie]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(!1),[H,ce]=(0,Q.useState)(!1),[le,U]=(0,Q.useState)(!1),[ue,fe]=(0,Q.useState)(null),pe=(0,Q.useRef)(0),[ge,ye]=(0,Q.useState)(null),be=d(e=>e.baseUrl),xe=d(e=>e.conversationId),Ce=ue?.noteId===e&&ue.gatewayUrl===be&&ue.gatewayToken===xe?ue.conversationId:null;(0,Q.useEffect)(()=>(pe.current++,U(!1),fe(null),ce(!1),ye(null),b(!0),()=>{pe.current++}),[e,be,xe]);let Te=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{Te.current+=1},[e]);let[Ee,G]=(0,Q.useState)(null),[Oe,Ae]=(0,Q.useState)(!1),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(!1),[Re,ze]=(0,Q.useState)(!1),Be=(0,Q.useRef)(!1),He=(0,Q.useRef)(null),We=(0,Q.useRef)(null),Ge=(0,Q.useRef)(null),q=(0,Q.useRef)(null),J=(0,Q.useRef)(void 0),Xe=(0,Q.useRef)(null),X=(0,Q.useRef)(null),et=(0,Q.useRef)(null),tt=(0,Q.useRef)(null),nt=(0,Q.useRef)(null),rt=Qe(e=>e.setPageHeader),it=Qe(e=>e.clearPageHeader),{data:Z,mutate:pt,error:mt}=Ye(e?[`note-detail`,e]:null,()=>we(e)),{data:ht=[],mutate:gt}=Ye(e?[`note-threads`,e]:null,()=>De(e),{revalidateOnFocus:!1}),_t=M!==null,vt=(0,Q.useCallback)(e=>{G(`${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&&pt().catch(vt)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[pt,e,vt]),(0,Q.useEffect)(()=>{z(``),N(null),j(null),Be.current=!1,nt.current=null},[e]),(0,Q.useEffect)(()=>{!Z||P||q.current!==null||Be.current||z(Z.title??``)},[Z,P]),(0,Q.useEffect)(()=>{if(!s||!Z||_t||nt.current===e)return;let t=window.requestAnimationFrame(()=>{tt.current?.focus(),u?.()});return nt.current=e,()=>window.cancelAnimationFrame(t)},[s,_t,Z,e,u]);let yt=Z?new Date(Z.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,bt=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:K(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Y,i),children:(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),xt=(0,Q.useCallback)(()=>{let t=V.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Ct=(0,Q.useCallback)(e=>{e!==`preview`&&xt(),k(e)},[xt]);(0,Q.useEffect)(()=>{!P&&Ge.current===null&&q.current===null&&(J.current=Z?.remoteVersion??1)},[e,Z?.remoteVersion,P]);let wt=(0,Q.useCallback)(async t=>{let n=J.current??Z?.remoteVersion??1,r=await W(e,t,n);return J.current===n&&(J.current=r.remoteVersion??n+1),r},[e,Z?.remoteVersion]),Tt=(0,Q.useCallback)(t=>{xt(),z(t),e&&(q.current=t,We.current&&clearTimeout(We.current),We.current=setTimeout(async()=>{let e=q.current;if(q.current=null,e!==null){I(!0);try{await wt({title:e}),await pt(),n?.()}catch(t){q.current===null&&(q.current=e),G(`${m.saveFailed}: ${t instanceof Error?t.message:m.saveFailedHint}`)}finally{I(!1)}}},600))},[xt,e,pt,n,wt,m.saveFailed,m.saveFailedHint]),Et=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:K(`flex min-w-0 items-center gap-2`,Y),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:R||yt||void 0,children:R||yt}),P?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:m.saving}):null]}),[m.saving,P,yt,R]),Dt=(0,Q.useCallback)(async()=>{se(!0),G(null);try{await ke(e),await pt()}catch(e){G(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{se(!1)}},[pt,e]),Ot=(0,Q.useCallback)(()=>{U(!1),j(A===`breakdown`?null:`breakdown`),!Z?.aiDeep?.catalysis?.report&&!oe&&Dt()},[A,oe,Dt,Z?.aiDeep?.catalysis?.report]),kt=(0,Q.useCallback)(()=>{let t=M?M.markdown??``:Ge.current??Z?.markdown??``,n=M?M.title??``:R,r=on(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:L(r,p)}},[p,m.titlePlaceholder,Z?.markdown,e,M,R]),At=(0,Q.useCallback)(async()=>{He.current&&clearTimeout(He.current),We.current&&clearTimeout(We.current),He.current=null,We.current=null;let e=Ge.current,t=q.current;Ge.current=null,q.current=null;let r={};if(e!==null&&(r.markdown=e),t!==null&&(r.title=t),Object.keys(r).length===0)return Z??null;I(!0);try{let e=await wt(r);return await pt(e,{revalidate:!1}),n?.(),e}catch(n){return Ge.current===null&&(Ge.current=e),q.current===null&&(q.current=t),G(`${m.saveFailed}: ${n instanceof Error?n.message:m.saveFailedHint}`),null}finally{I(!1)}},[pt,m.saveFailed,m.saveFailedHint,Z,n,wt]),jt=(0,Q.useCallback)(async()=>P?(G(p===`zh`?`笔记正在保存,请稍后发送。`:`The note is saving. Please send again shortly.`),!1):!!await At()&&Ge.current===null&&q.current===null,[P,p,At]),Mt=(0,Q.useCallback)(async(t=!1)=>{if(j(null),U(!0),H||!t&&Ce)return;let n=++pe.current;ce(!0),G(null);try{if(!await jt())return;let r=await Se(e,{forceNew:t});if(n!==pe.current)return;fe({noteId:e,gatewayUrl:be,gatewayToken:xe,conversationId:r.conversationId}),await pt(),await gt()}catch(e){n===pe.current&&G(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{n===pe.current&&ce(!1)}},[H,Ce,jt,pt,gt,e,be,xe,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),Nt=(0,Q.useCallback)(async e=>{if(!Z||H||P)return;ce(!0),G(null);let t=d.getState(),n=++Te.current,r=()=>Te.current===n&&d.getState().baseUrl===t.baseUrl&&d.getState().conversationId===t.conversationId;try{let n=window.getSelection(),i=e??(n?.anchorNode&&n.focusNode&&Xe.current?.contains(n.anchorNode)&&Xe.current.contains(n.focusNode)?n.toString():``),a=await At();if(!a||!r())return;if(Ge.current!==null||q.current!==null)throw Error(g.unavailable);let o=dt.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 Je().createSession();if(!r())return;if(Ge.current!==null||q.current!==null)throw Error(g.unavailable);let c=ft(t.baseUrl,t.conversationId,s.key);if(!dt.put(c,o))throw Error(g.unavailable);w(`/chat/${encodeURIComponent(s.key)}`)}catch{r()&&G(g.unavailable)}finally{Te.current===n&&ce(!1)}},[Z,H,P,At,w,g.unavailable]),Pt=(0,Q.useCallback)(async()=>{G(null);let e=await At();e&&(Pe(e),Ae(!0))},[At]),Ft=(0,Q.useCallback)(async()=>{if(!(Re||P)){Ie(!1),ze(!0),G(null),xt(),He.current&&clearTimeout(He.current),We.current&&clearTimeout(We.current),He.current=null,We.current=null,Ge.current=null,q.current=null;try{await je(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){G(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{ze(!1)}}},[Re,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,P,xt]),It=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:K(`flex min-w-0 items-center gap-1 sm:gap-2`,Y),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)(Ve,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(rn,{input:kt,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:Ot,disabled:oe,"aria-label":m.catalysisSectionTitle,className:K(`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)(Ue,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:oe?m.catalyzing:m.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Mt(!1),"aria-label":m.openChatButton,disabled:H,className:K(`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)(Le,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:H?m.openingChat:m.openChatButton})]}),(0,$.jsx)(pn,{mode:O,onModeChange:Ct,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Nt(),disabled:H||P||!Z||!!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)(me,{className:`size-3.5`,"aria-hidden":!0}),g.capture]}),(0,$.jsxs)(at,{modal:!1,children:[(0,$.jsx)(ot,{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)(de,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(st,{children:(0,$.jsxs)(lt,{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)(ct,{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)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(ct,{onSelect:()=>{U(!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)(he,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,$.jsx)(ae,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(ct,{disabled:Re||P,onSelect:()=>Ie(!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)(Ke,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[oe,Ot,Mt,Nt,g.capture,Z,M,O,m.history,m.modeEdit,m.modePreview,m.modeSource,H,A,o,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,Ct,kt,Pt,Re,P,p,m.delete,Ie]);(0,Q.useLayoutEffect)(()=>(rt({startExtra:bt,main:Z&&!v?Et:null,end:Z&&!v?It:null}),()=>{a&&it()}),[a,it,It,Et,bt,v,y,Z,rt]);let Lt=(0,Q.useCallback)(t=>{e&&(xt(),Ge.current=t,He.current&&clearTimeout(He.current),He.current=setTimeout(async()=>{let e=Ge.current;if(Ge.current=null,e!==null){I(!0),G(null);try{await wt({markdown:e}),await pt(),n?.()}catch(t){Ge.current===null&&(Ge.current=e),G(`${m.saveFailed}: ${t instanceof Error?t.message:m.saveFailedHint}`)}finally{I(!1)}}},600))},[xt,e,pt,m.saveFailed,m.saveFailedHint,n,wt]),Rt=(0,Q.useCallback)(t=>{Me(e,t.timestamp).then(e=>{e&&(xt(),N(e))})},[e,xt]),zt=(0,Q.useCallback)(()=>{xt(),j(null),N(null)},[xt]),Bt=(0,Q.useCallback)(()=>{xt(),j(null),N(null),pt().catch(vt),n?.()},[pt,n,vt,xt]);if((0,Q.useEffect)(()=>()=>{He.current&&clearTimeout(He.current),We.current&&clearTimeout(We.current);let t=Ge.current,n=q.current;Ge.current=null,q.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&W(e,r,J.current).catch(()=>void 0)},[e]),Z===void 0)return mt?(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 pt().catch(vt),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)(fn,{});if(Z===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=_t?M.title??``:R,Ht=_t?M.markdown??``:Ge.current??Z.markdown??``,Wt=new Date(Z.createdAt).getTime(),Gt=Number.isFinite(Wt)&&Date.now()-Wt<3600*1e3?(0,$.jsx)(St,{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,Jt=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[v?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center justify-end px-4 py-1`,children:(0,$.jsx)(pn,{mode:O,onModeChange:Ct,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:_t?(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)(ve,{noteId:e,content:Ht,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[O===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:tt,type:`text`,value:R,onChange:e=>Tt(e.target.value),onCompositionStart:()=>{Be.current=!0},onCompositionEnd:()=>{Be.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Be.current&&!t.isComposing&&(e.preventDefault(),(Xe.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`}),Gt]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(fn,{}),children:(0,$.jsx)(un,{initialContent:Z.markdown??``,onChange:Lt,noteId:e,onTextSelection:S},`wysiwyg-${e}`)})})]}),O===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:tt,type:`text`,value:R,onChange:e=>Tt(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`}),Gt]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(fn,{}),children:(0,$.jsx)(dn,{initialContent:Z.markdown??``,onChange:Lt,isDark:T,onTextSelection:S},`source-${e}`)})})]}),O===`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&&D(t.currentSrc||t.src,t.alt)},children:[R&&!Z.markdown.trimStart().startsWith(`# ${R.trim()}\n`)&&Z.markdown.trim()!==`# ${R.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:R}),Z.markdown?(0,$.jsx)(ve,{noteId:e,content:Z.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]});return(0,$.jsxs)($.Fragment,{children:[x&&!_t&&!(v&&y)&&O!==`preview`?(0,$.jsx)(nn,{noteId:e,selection:x,zh:p===`zh`,onDismiss:C,onAsk:e=>{ye({id:Date.now(),text:p===`zh`?`请帮我分析或改写下面这段笔记:\n\n${e}`:`Help me analyze or rewrite this note selection:\n\n${e}`}),C(),Mt()}},`${e}:${O}`):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:K(`mx-auto min-h-0 min-w-0 w-full flex-1 flex-col`,le||A?`hidden @min-[56rem]/note:flex`:`flex`,!v&&`max-w-[60rem]`),children:[Ee?(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:Ee}):null,(0,$.jsx)(re,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(re,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:Xe,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)(Ut,{personalNotes:Jt,personalNotesActive:!y,onMeetingContent:()=>b(!0),noteId:e,noteActions:{onAnalyze:Ot,chatOpen:le,onChat:()=>{le?U(!1):Mt(!1)},onShare:()=>{Pt()},onHistory:()=>{U(!1),j(A===`history`?null:`history`)},onDelete:()=>Ie(!0),busy:Re||P||oe||H},onPersonalNotes:()=>{b(!1),window.setTimeout(()=>tt.current?.focus(),0)}}):null,v?null:Jt]})]}),le||Ce?(0,$.jsxs)(`aside`,{id:`note-assistant-${e}`,"aria-label":p===`zh`?`笔记 AI 对话`:`Note AI chat`,className:K(`min-h-0 min-w-0 shrink-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,le?`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)(Le,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children: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:()=>{U(!1),window.requestAnimationFrame(()=>document.querySelector(`[aria-controls="note-assistant-${e}"]`)?.focus({preventScroll:!0}))},children:(0,$.jsx)(qe,{className:`size-4`})})]}),(0,$.jsx)(`p`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 text-xs leading-5 text-fg-muted`,children:p===`zh`?`已关联当前笔记。可提问、改写我的笔记,也可将回答保存回笔记。`:`Linked to this note. Ask questions, edit My notes, or save an answer to the note.`}),Ee&&Ce?(0,$.jsx)(`p`,{role:`alert`,className:`shrink-0 px-4 py-2 text-xs text-danger`,children:Ee}):null,(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:Ce?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(fn,{}),children:(0,$.jsx)(ln,{embedded:!0,sourceNoteInView:!0,conversationId:Ce,draftSeed:ge,beforeSend:jt},`${e}:${Ce}`)}):H?(0,$.jsx)(fn,{}):(0,$.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:Ee||(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 Mt(),children:p===`zh`?`重新打开`:`Try again`})]})})]}):null,(0,$.jsx)(`div`,{ref:X,className:K(`relative min-h-0 max-w-full shrink-0 flex-col overflow-hidden`,A?`flex`:`hidden`,!ne&&`transition-[width] duration-300 ease-in-out`),style:{width:A?B:0},children:(0,$.jsxs)(`div`,{ref:et,className:`flex min-h-0 flex-1 flex-col`,style:{width:B},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ie(!0);let n=e.clientX,r=B,i=e.pointerId,a=0,o=B,s=B,c=()=>{a=0,s=o,A&&X.current?.style.setProperty(`width`,`${s}px`),et.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{}ie(!1),te(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:K(`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`,ne&&`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)(Kt,{noteId:e,activeTimestamp:M?.timestamp??null,onSelect:Rt,onClose:zt,onRestored:Bt}):A===`breakdown`?(0,$.jsx)(qt,{noteId:e,note:Z??null,catalyzing:oe,onCatalyze:Dt,onClose:()=>j(null),noteThreads:ht,openingChat:H,onOpenChat:()=>Mt(!1),onOpenNewChat:()=>Mt(!0)}):null})]})})]}),Ne?(0,$.jsx)(Yt,{open:Oe,onOpenChange:Ae,note:Ne}):null,(0,$.jsx)($e,{open:Fe,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,Z.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void Ft(),onCancel:()=>Ie(!1)})]})}export{yt as i,xt as n,bt as r,hn as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./notes-api-CdXA-g9r.js";
|
|
@@ -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 o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,l,n as u}from"./locale-store-Dy1EByeG.js";import{t as d}from"./messages-BAnhwALN.js";import{t as f}from"./archive-Dz0hferG.js";import{C as p,T as m,c as h,s as g,u as _}from"./discussion-annotation-sync-fwPPMPv9.js";import{t as v}from"./arrow-left-D880xG-P.js";import{t as y}from"./arrow-right-DSSvoX71.js";import{t as ee}from"./arrow-up-D5ZtR1QT.js";import{f as b}from"./product-automation-feedback-D51I7Lg3.js";import{t as x}from"./calendar-days-hw_Y-g-s.js";import{t as te}from"./chevron-down-ccbiQQz_.js";import{t as ne}from"./popover-select-CLsphyzA.js";import{t as re}from"./ellipsis-0k4rZLoy.js";import{t as ie}from"./file-text-D12HbeVy.js";import{t as ae}from"./folder-CN-pC3XL.js";import{A as S,D as C,E as w,_ as T,g as E,i as D,p as oe,s as se}from"./notes-api-CdXA-g9r.js";import{b as ce,l as O,n as k,r as le,t as ue,v as de,x as fe,y as A}from"./recording-upload-CyZSl2DJ.js";import{t as pe}from"./loader-circle-CifKLtgG.js";import{z as me}from"./markdown-view-BlxIaCCQ.js";import{t as he}from"./mic-CuUb7zc-.js";import{t as ge}from"./paperclip-f1HujQY1.js";import{t as _e}from"./plus-Q2yW6OE7.js";import{t as ve}from"./search-DA7gz22f.js";import{t as ye}from"./sparkles-DHlfQFAF.js";import{t as be}from"./trash-2-DusmjVPV.js";import{t as xe}from"./upload-rrb46c3c.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 Se}from"./vendor-swr-CdRzEUwF.js";import{r as Ce}from"./app-chrome-BeB4KgOf.js";import{t as we}from"./page-header-store-Bm8oxpFR.js";import{t as Te}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ee}from"./confirm-dialog-DrA5mTQp.js";import{n as De}from"./index.module-Cd9ENXfk.js";import{l as Oe,m as ke,o as Ae,r as je,t as Me}from"./dist-ZrL34Ps4.js";import{i as Ne,t as P}from"./note-detail-panel-BbHlfAju.js";var F=n(),I=e(t(),1),L=r();function R({projectId:e}){let t=u(e=>e.language)===`zh`,n=s(),r=(0,I.useRef)(null),i=(0,I.useRef)(null),[a,o]=(0,I.useState)(null),[c,l]=(0,I.useState)(null),[d,f]=(0,I.useState)(null);async function p(){let t=i.current;if(!(!t||a!==null)){o(0),l(null);try{let r=await _();if(r.consentAcknowledgedAt==null){f(r.consentPolicyVersion);return}let a=await ue(t.file,t.requestId),s=await h({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=s.discussion.id,await O({...a,serverDiscussionId:s.discussion.id,projectId:e}),s.discussion.audioAttachmentId||await k(a,s.discussion.id,o),await le(t.requestId),i.current=null,n(`/notes/${encodeURIComponent(s.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(null)}}}return(0,L.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,L.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}i.current={file:n,requestId:crypto.randomUUID()},p()}}}),(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:a!==null,onClick:()=>c&&i.current?void p():r.current?.click(),children:[(0,L.jsx)(xe,{className:`size-3.5`}),a===null?c&&i.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${a}%`]}),d===null?null:(0,L.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,L.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void g(d).then(()=>(f(null),p())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,L.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Pe(e){e.note??=await D({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 C(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,` `)}](${S(t,e.id)})`);e.note=await w(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
|
-
|
|
3
|
-
`)}`})}return{noteId:t,conversationId:(await T(t,{projectId:e.projectId})).conversationId}}function Fe(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var z={meeting:b,requirements:ie,research:A,weekly:x};function Ie({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:o}){let c=i.home,l=s(),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)([]),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(null),[re,ie]=(0,I.useState)(``),S=(0,I.useRef)(null),C=(0,I.useRef)(!1),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=v||!!S.current,D=f?c.templateOptions[f]:null,oe=!!(u.trim()||g.length);async function se(){if(!(C.current||!oe&&!S.current)){C.current=!0,y(!0),x(null),S.current??={requestId:crypto.randomUUID(),title:u.trim().split(`
|
|
4
|
-
`)[0]?.slice(0,80)||D?.label||i.titlePlaceholder,markdown:`## ${c.requestHeading}\n\n${D?`${D.prompt}\n`:``}${u.trim()}`,projectId:t||void 0,files:[...g],attachments:[],materialHeading:c.materialsHeading};try{let e=await Pe(S.current);r(),l(Fe(e.conversationId,e.noteId,c.agentPrompt))}catch(e){S.current.note&&r(),x(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{C.current=!1,y(!1)}}}function ce(){S.current=null,x(null),d(``),_([]),p(null),h(!1),T.current?.focus()}return(0,L.jsxs)(`section`,{"aria-label":c.askLabel,children:[(0,L.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,L.jsxs)(`fieldset`,{disabled:E,className:`min-w-0`,children:[(0,L.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,L.jsx)(ye,{className:`size-4`,"aria-hidden":!0}),c.askLabel]}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.agentResultHint}),D?(0,L.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,L.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[D.label,` · `]}),D.prompt.split(`
|
|
5
|
-
|
|
6
|
-
`)[0]]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>p(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,L.jsx)(j,{className:`size-3.5`})})]}):null,(0,L.jsx)(`textarea`,{ref:T,id:`notes-home-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:D?D.prompt.split(`
|
|
7
|
-
|
|
8
|
-
`).at(-1):c.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),se())},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`}),g.length?(0,L.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:g.map((e,t)=>(0,L.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,L.jsx)(ge,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`${c.removeMaterial}: ${e.name}`,onClick:()=>_(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,L.jsx)(j,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,L.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,L.jsx)(ne,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(re.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:c.unassigned,placeholder:c.unassigned,emptyLabel:c.unassigned,ariaLabel:c.assignProject,triggerIcon:(0,L.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:E,loading:a,statusMessage:o?c.projectsLoadFailed:void 0,searchPlaceholder:c.projectSearch,searchValue:re,onSearchChange:ie})}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>w.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,L.jsx)(ge,{className:`size-4`,"aria-hidden":!0}),c.addMaterials]}),(0,L.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,"aria-label":c.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);_(e=>[...e,...t]),e.target.value=``}})]})]}),(0,L.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,L.jsxs)(`button`,{type:`submit`,disabled:v||!S.current&&!oe,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:[v?(0,L.jsx)(pe,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,L.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),v?c.creating:b?c.retry:c.agentCreate]})})]}),b?(0,L.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,L.jsx)(`p`,{children:b}),S.current?.note?(0,L.jsx)(`p`,{className:`mt-1`,children:c.partialFailure}):null,(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[S.current?.note?(0,L.jsx)(`button`,{type:`button`,onClick:()=>l(`/notes/${encodeURIComponent(S.current.note.id)}?edit=1`),className:`underline`,children:c.openSavedDraft}):null,(0,L.jsx)(`button`,{type:`button`,onClick:ce,className:`underline`,children:c.newRequest})]})]}):null,(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,L.jsxs)(`button`,{type:`button`,disabled:E,"aria-expanded":m,"aria-controls":`notes-home-templates`,onClick:()=>h(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[c.templates,(0,L.jsx)(te,{className:M(`size-3.5 transition-transform`,m&&`rotate-180`),"aria-hidden":!0})]})}),(0,L.jsxs)(Te,{id:`notes-home-templates`,hidden:!m,className:M(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,m?`flex`:`hidden`),role:`group`,"aria-label":c.templates,indicatorClassName:`rounded-md bg-accent-soft`,children:[Object.keys(z).map(e=>{let t=z[e];return(0,L.jsxs)(`button`,{type:`button`,disabled:E,"aria-pressed":f===e,onClick:()=>{p(f===e?null:e),T.current?.focus()},className:M(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,f===e&&`bg-accent-soft text-accent-fg`),children:[(0,L.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),c.templateOptions[e].label]},e)}),(0,L.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:i.discussionCapture.recoveredTitle}),(0,L.jsx)(R,{})]})]})}function Le(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 Re(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function ze(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()||Re(e).slice(0,48)||t}var B=`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 V(){let e=u(e=>e.language),t=d(e).notes,n=t.home,r=l(e=>e.conversationId),i=we(e=>e.setPageHeader),h=we(e=>e.clearPageHeader),g=s(),{pathname:_,search:ee}=a(),[x,S]=o(),C=x.get(`projectId`)||``,T=x.get(`view`)||`all`,O=x.get(`unassigned`)===`true`||T===`unassigned`,k=x.get(`search`)||``,[le]=De(k,250),[ue,A]=(0,I.useState)(C),[me,ge]=(0,I.useState)(``),[xe,j]=(0,I.useState)(null),[P,F]=(0,I.useState)(!1),[R,Pe]=(0,I.useState)(!1),[Fe,z]=(0,I.useState)(new Set),[V,H]=(0,I.useState)(null),[U,Be]=(0,I.useState)(null),W=(0,I.useRef)(new Set),G=(0,I.useRef)(null),Ve=(0,I.useRef)(!1),He=(0,I.useRef)(null),Ue=Le(x,le),K=(Ue.offset??0)/12,{data:We,error:Ge,isLoading:Ke,mutate:qe}=Se(r?[`notes-home`,r,Ue]:null,()=>E(Ue)),{data:Je,error:Ye,isLoading:q,mutate:J}=Se(r?[`notes-home-projects`,r]:null,oe),Y=Je?.items??[],Xe=Y.filter(e=>e.noteCount>0).slice(0,2),Ze=Y.find(e=>e.id===C)?.name??n.projectNotes,Qe=We?.items??[],X=We?.total??0,$e=Ke||k!==le,et=(0,I.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:c(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[tt,nt]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{A(C)},[C]),(0,I.useEffect)(()=>{let e=window.setInterval(()=>nt(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Z=(0,I.useCallback)(()=>{qe().catch(()=>void 0),J().catch(()=>void 0)},[qe,J]);(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 rt=(0,I.useCallback)((e,t=!1)=>{let n=`${_}${ee}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),g(`/notes/${encodeURIComponent(e)}?${r}`)},[_,ee,g]),Q=(0,I.useCallback)(async()=>{if(!(Ve.current||!r)){Ve.current=!0,F(!0),j(null),G.current??={key:crypto.randomUUID(),projectId:C||void 0};try{let e=await D({markdown:``,kind:`thought`,projectId:G.current.projectId},G.current.key);G.current=null,Z(),rt(e.id,!0)}catch(e){j(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Ve.current=!1,F(!1)}}},[C,t.createBlankFailed,t.createBlankFailedHint,rt,Z,r]),it=(0,I.useCallback)(e=>{S(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[S]);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),A(e),S(n)}function at(e){S(t=>{let n=new URLSearchParams(t);return O&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function ot(e,n){if(!W.current.has(e)){W.current.add(e),z(new Set(W.current)),j(null);try{await w(e,{pinned:n}),Z()}catch(e){j(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{W.current.delete(e),z(new Set(W.current))}}}async function st(){let e=V;if(!(!e||U)){H(null),Be(e.id),j(null);try{await se(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Z()}catch(e){j(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Be(null)}}}if((0,I.useLayoutEffect)(()=>{if(!r){h();return}return i({startExtra:null,main:(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,L.jsx)(`div`,{className:M(`flex min-w-0 items-center gap-2`,Ce),children:(0,L.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,L.jsx)(ve,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,L.jsx)(`input`,{ref:He,type:`search`,value:k,onChange:e=>it(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>h()},[h,Q,P,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,k,i,it,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(),He.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Q]),!r)return(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let ct=[{id:`all`,label:n.homeNav,Icon:ce},{id:`favorites`,label:n.favorites,Icon:de},{id:`unassigned`,label:n.unassigned,Icon:fe},{id:`archived`,label:t.filterArchived,Icon:f}],lt=C?`project:${C}`:O?`unassigned`:`all`,ut=!$e&&!Ge&&X===0&&!C&&!O&&!k&&T===`all`;return(0,L.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,L.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto py-6 xl:flex`,"aria-label":n.homeNav,children:[ct.map(({id:e,label:t,Icon:n})=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>$(``,e),"aria-current":!C&&(e===`unassigned`?O:!O&&T===e)?`page`:void 0,className:M(B,`justify-start px-2 text-left text-xs`,!C&&(e===`unassigned`?O:!O&&T===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,L.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,L.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),q?[0,1,2].map(e=>(0,L.jsx)(N,{className:`mb-2 h-8 w-full`},e)):Y.slice(0,8).map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),"aria-current":C===e.id?`page`:void 0,className:M(B,`justify-start px-2 text-left text-xs`,C===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,L.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>g(`/projects`),className:M(B,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,L.jsx)(y,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,L.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,L.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:C?Ze:O?n.unassigned:ut?n.firstNoteTitle:n.continueTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C?n.projectDescription:ut?n.firstNoteDescription:n.continueDescription})]}),C?(0,L.jsxs)(`button`,{type:`button`,onClick:()=>g(`/projects/${encodeURIComponent(C)}`),className:M(B,`text-xs`),children:[n.openProject,(0,L.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),xe?(0,L.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:xe}):null,(0,L.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void Q(),disabled:P,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:[P?(0,L.jsx)(pe,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,L.jsx)(_e,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,L.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>p(C||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,L.jsx)(he,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{Pe(e=>!e),R||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":R,"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,L.jsx)(ye,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,L.jsx)(te,{className:M(`size-4 transition-transform`,R&&`rotate-180`),"aria-hidden":!0})]}),(0,L.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!R,className:M(`mt-3`,!R&&`hidden`),children:(0,L.jsx)(Ie,{projects:Y,projectId:ue,onProjectChange:A,onCreated:Z,labels:t,projectsLoading:q,projectsError:!!Ye})})]}),Ye?(0,L.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,L.jsx)(`span`,{children:n.projectsLoadFailed}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void J().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,ut?null:(0,L.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:T===`favorites`?n.favorites:T===`archived`?t.filterArchived:C?n.projectNotes:n.recentNotes}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":T===`agent`,onClick:()=>at(T===`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`,T===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,L.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,L.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,L.jsx)(ne,{value:lt,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...Y.filter(e=>e.name.toLowerCase().includes(me.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:C?Ze:O?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:q,searchPlaceholder:n.projectSearch,searchValue:me,onSearchChange:ge,onChange:e=>$(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,L.jsxs)(Te,{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,L.jsx)(`button`,{type:`button`,"aria-pressed":T===e||e===`all`&&T===`unassigned`,onClick:()=>at(e),className:M(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(T===e||e===`all`&&T===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,L.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Ge?(0,L.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,L.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void qe().catch(()=>void 0),className:M(B,`mt-2`),children:n.retry})]}):$e?(0,L.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,L.jsx)(N,{className:`h-10 w-8 shrink-0`}),(0,L.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,L.jsx)(N,{className:`h-4 w-2/3`}),(0,L.jsx)(N,{className:`h-3 w-1/2`})]})]},e))}):Qe.length===0?(0,L.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,L.jsx)(ce,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,L.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:k||T!==`all`&&T!==`unassigned`?n.noMatches:C?n.projectEmpty:n.emptyTitle}),(0,L.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:k||T!==`all`&&T!==`unassigned`?n.noMatchesHint:C?n.projectEmptyHint:n.emptyDescription})]}):(0,L.jsx)(`ul`,{className:`divide-y divide-edge`,children:Qe.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?b:e.kind===`bookmark`?m:ie,i=ze(e,t.titlePlaceholder,n.voiceNote),a=Re(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,L.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>rt(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,L.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,L.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,L.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,L.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,L.jsx)(ye,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,L.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,L.jsx)(`span`,{className:`truncate`,children:a})]}),(0,L.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:Ne(e.updatedAt,tt,et)})]})]}),(0,L.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,L.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:Ne(e.updatedAt,tt,et)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void ot(e.id,!e.pinned),disabled:Fe.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,L.jsx)(de,{className:M(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,L.jsxs)(Oe,{children:[(0,L.jsx)(ke,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,disabled:U===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:U===e.id?(0,L.jsx)(pe,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,L.jsx)(re,{className:`size-4`,"aria-hidden":!0})})}),(0,L.jsx)(Ae,{children:(0,L.jsx)(Me,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,L.jsxs)(je,{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:()=>H(e),children:[(0,L.jsx)(be,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!$e&&!Ge&&X>0?(0,L.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,L.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(X))}),X>12||K>0?(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:K===0,className:B,onClick:()=>S(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K-1)),t}),children:(0,L.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),(0,L.jsxs)(`span`,{children:[K+1,` / `,Math.max(1,Math.ceil(X/12))]}),(0,L.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(K+1)*12>=X,className:B,onClick:()=>S(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K+1)),t}),children:(0,L.jsx)(y,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!C&&!O&&(q||Xe.length>0)?(0,L.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>g(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:q?[0,1].map(e=>(0,L.jsx)(N,{className:`h-28 w-full`},e)):Xe.map(e=>(0,L.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,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,L.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,L.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,L.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,L.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,L.jsx)(`span`,{children:e.updatedAt?Ne(e.updatedAt,tt,et):n.emptyProject})]})]},e.id))})]}):null]})}),(0,L.jsx)(Ee,{open:V!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,V?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void st(),onCancel:()=>H(null)})]})}function H(){let e=(0,F.c)(12),{noteId:t}=i(),n=s(),[r]=o(),a;e[0]===r?a=e[1]:(a=me(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=a);let c=a,l;e[2]!==n||e[3]!==c?(l=()=>{n(c)},e[2]=n,e[3]=c,e[4]=l):l=e[4];let u=l;if(!t)return null;let d=r.get(`edit`)===`1`?`wysiwyg`:`preview`,f;e[5]===r?f=e[6]:(f=r.get(`edit`),e[5]=r,e[6]=f);let p=f===`1`,m;return e[7]!==u||e[8]!==t||e[9]!==d||e[10]!==p?(m=(0,L.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-1 flex-col`,children:(0,L.jsx)(P,{noteId:t,onBack:u,initialMode:d,autoFocus:p},t)}),e[7]=u,e[8]=t,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function U(){let e=(0,F.c)(2),{noteId:t}=i(),n;return e[0]===t?n=e[1]:(n=t?(0,L.jsx)(H,{}):(0,L.jsx)(V,{}),e[0]=t,e[1]=n),n}export{U as NotesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){var e=class extends AudioWorkletProcessor{buffer=new Float32Array(2048);offset=0;constructor(){super(),this.port.onmessage=e=>{e.data===`flush`&&(this.flush(),this.port.postMessage({type:`flushed`}))}}flush(){if(!this.offset)return;let e=this.buffer.slice(0,this.offset);this.offset=0,this.port.postMessage({type:`samples`,buffer:e.buffer},[e.buffer])}process(e){let t=e[0]?.[0];if(!t)return!0;let n=0;for(;n<t.length;){let e=Math.min(t.length-n,this.buffer.length-this.offset);this.buffer.set(t.subarray(n,n+e),this.offset),this.offset+=e,n+=e,this.offset===this.buffer.length&&this.flush()}return!0}};registerProcessor(`xopc-pcm-capture`,e)})();
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/product-preview-content-WkF2j_c-.js","assets/vendor-react-BOUWij0V.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/automation-display-DaVDNZz8.js","assets/createLucideIcon-DPHK1VkS.js","assets/markdown-view-BlxIaCCQ.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.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-DImAfVs5.js","assets/product-delivery-BFfqdKLe.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/skeleton-DzdOeGYz.js","assets/api-B4FJ51EC.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/files-BNL4kkSB.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-DxBmyzp0.js","assets/automation-task-card-CiJmJ7_h.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/popover-select-CLsphyzA.js","assets/check-DUBLcKHA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/message-circle-Badhj-4D.js","assets/pencil-DmIY3Oa-.js","assets/chat-agents-api-CjlzCSmC.js","assets/gateway-config-swr-1Rk0LeEM.js","assets/model-selector-C-CqPBao.js","assets/settings-2-D-csvaET.js","assets/registry-api-DuDIthjL.js","assets/gateway-startup-retry-D6WPS0RW.js","assets/open-capability-settings-DQsmJxI7.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/model-sort-_Tz8s_4N.js","assets/date-picker-XnE3iFhG.js","assets/calendar-days-hw_Y-g-s.js","assets/chevron-left-DqFhpbvK.js","assets/time-picker-C1PXAXZF.js","assets/clock-3-DnrAnuyZ.js","assets/api-B1J5ajiP.js","assets/open-route-MyZ2sB9C.js","assets/automation-result-state-CAsqgMNR.js","assets/project-overview-model-DrLXaO-t.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-Dy1EByeG.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./external-link-DjqjBmc3.js";import{V as h}from"./markdown-view-BlxIaCCQ.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-Cc4hUNTt.js";import{t as b}from"./automation-api-DxBmyzp0.js";import{r as x}from"./automation-task-card-CiJmJ7_h.js";var S=n(),C=e(t(),1),w=r(),T=(0,C.lazy)(()=>i(()=>import(`./product-preview-content-WkF2j_c-.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,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64]))),E={project:[`项目预览`,`Project preview`],automation:[`自动化详情`,`Automation details`],local_app:[`应用预览`,`App preview`]};function D(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,w.jsx)(_,{className:`h-7 w-2/3`}),(0,w.jsx)(_,{className:`h-4 w-full`}),(0,w.jsx)(_,{className:`h-4 w-4/5`}),(0,w.jsx)(_,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function O(e){let t=(0,S.c)(8),{target:n,backgroundPath:r,onClose:i}=e;if(n.kind===`automation`&&n.view!==`run`){let e;return t[0]!==r||t[1]!==i||t[2]!==n?(e=(0,w.jsx)(k,{target:n,backgroundPath:r,onClose:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=e):e=t[3],e}let a;return t[4]!==r||t[5]!==i||t[6]!==n?(a=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=a):a=t[7],a}function k(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,a=o(A),l,m;t[0]===n.id?(l=t[1],m=t[2]):(l=[`automation-card`,n.id],m=()=>b.get(n.id),t[0]=n.id,t[1]=l,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,shouldRetryOnError:!1},t[3]=h):h=t[3];let{data:g,error:_,mutate:C}=v(l,m,h);if(g?.automation){if(g.automation.action.kind===`agent`&&!g.automation.management){let e;return t[4]!==g.automation||t[5]!==a||t[6]!==i?(e=(0,w.jsx)(x,{automation:g.automation,language:a,onClose:i}),t[4]=g.automation,t[5]=a,t[6]=i,t[7]=e):e=t[7],e}let e;return t[8]!==r||t[9]!==i||t[10]!==n?(e=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[8]=r,t[9]=i,t[10]=n,t[11]=e):e=t[11],e}let T=a===`zh`,E;t[12]===i?E=t[13]:(E=e=>{e||i()},t[12]=i,t[13]=E);let O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,w.jsx)(s,{className:`fixed inset-0 z-65 bg-scrim`}),t[14]=O):O=t[14];let k=T?`定时任务详情`:`Scheduled task details`,M;t[15]===k?M=t[16]:(M=(0,w.jsx)(f,{className:`mb-5 font-medium`,children:k}),t[15]=k,t[16]=M);let N=T?`查看和编辑定时任务。`:`View and edit the scheduled task.`,P;t[17]===N?P=t[18]:(P=(0,w.jsx)(c,{className:`sr-only`,children:N}),t[17]=N,t[18]=P);let F;t[19]!==_||t[20]!==C||t[21]!==T?(F=_?(0,w.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[(0,w.jsx)(`p`,{children:T?`任务已不存在或暂时无法读取。`:`This task is unavailable.`}),(0,w.jsx)(y,{variant:`secondary`,onClick:()=>void C(),children:T?`重试`:`Retry`})]}):(0,w.jsx)(D,{}),t[19]=_,t[20]=C,t[21]=T,t[22]=F):F=t[22];let I=T?`关闭`:`Close`,L;t[23]!==i||t[24]!==I?(L=(0,w.jsx)(y,{className:`mt-auto self-end`,variant:`ghost`,onClick:i,children:I}),t[23]=i,t[24]=I,t[25]=L):L=t[25];let R;t[26]!==F||t[27]!==L||t[28]!==M||t[29]!==P?(R=(0,w.jsxs)(u,{children:[O,(0,w.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-70 flex h-[min(600px,calc(100dvh-2rem))] w-[min(680px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5`,children:[M,P,F,L]})]}),t[26]=F,t[27]=L,t[28]=M,t[29]=P,t[30]=R):R=t[30];let z;return t[31]!==R||t[32]!==E?(z=(0,w.jsx)(p,{open:!0,onOpenChange:E,children:R}),t[31]=R,t[32]=E,t[33]=z):z=t[33],z}function A(e){return e.language}function j(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,_=o(M)===`zh`,v=n.kind===`project`?`w-[min(55rem,calc(100vw-2rem))]`:`w-[min(52rem,calc(100vw-2rem))]`,y=n.kind===`automation`&&n.view===`run`?_?`运行情况`:`Run progress`:E[n.kind][+!_],b;t[0]===i?b=t[1]:(b=e=>{e||i()},t[0]=i,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=x):x=t[2];let O=`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(48rem,calc(100dvh-2rem))] ${v} -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,k;t[3]===y?k=t[4]:(k=(0,w.jsx)(f,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:y}),t[3]=y,t[4]=k);let A=_?`查看关联内容,或打开独立页面。`:`Preview related content or open its full page.`,j;t[5]===A?j=t[6]:(j=(0,w.jsx)(c,{className:`sr-only`,children:A}),t[5]=A,t[6]=j);let N;t[7]!==r||t[8]!==n.href||t[9]!==n.view||t[10]!==_?(N=n.view!==`run`&&(0,w.jsxs)(a,{to:h(n.href,r),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-accent hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,w.jsx)(m,{className:`size-4`,"aria-hidden":!0}),_?`打开独立页面`:`Open full page`]}),t[7]=r,t[8]=n.href,t[9]=n.view,t[10]=_,t[11]=N):N=t[11];let P=_?`关闭预览`:`Close preview`,F=_?`关闭预览`:`Close preview`,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[12]=I):I=t[12];let L;t[13]!==P||t[14]!==F?(L=(0,w.jsx)(l,{title:P,"aria-label":F,className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:I}),t[13]=P,t[14]=F,t[15]=L):L=t[15];let R;t[16]!==L||t[17]!==k||t[18]!==j||t[19]!==N?(R=(0,w.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge bg-surface-panel px-5 py-3.5`,children:[k,j,N,L]}),t[16]=L,t[17]=k,t[18]=j,t[19]=N,t[20]=R):R=t[20];let z=`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5 ${n.kind===`project`?`sm:p-6`:`sm:p-8`}`,B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,w.jsx)(D,{}),t[21]=B):B=t[21];let V;t[22]===n?V=t[23]:(V=(0,w.jsx)(C.Suspense,{fallback:B,children:(0,w.jsx)(T,{target:n},n.href)}),t[22]=n,t[23]=V);let H;t[24]!==z||t[25]!==V?(H=(0,w.jsx)(`div`,{className:z,children:V}),t[24]=z,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==R||t[28]!==H||t[29]!==O?(U=(0,w.jsxs)(u,{children:[x,(0,w.jsxs)(d,{className:O,children:[R,H]})]}),t[27]=R,t[28]=H,t[29]=O,t[30]=U):U=t[30];let W;return t[31]!==b||t[32]!==U?(W=(0,w.jsx)(p,{open:!0,onOpenChange:b,children:U}),t[31]=b,t[32]=U,t[33]=W):W=t[33],W}function M(e){return e.language}export{D as n,O as t};
|