@xopcai/xopc 0.0.99 → 0.0.100
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/manifest.json +1 -1
- package/dist/extensions/telegram/src/account-manager.d.ts +3 -3
- package/dist/extensions/telegram/src/account-manager.js +8 -8
- package/dist/extensions/telegram/src/account-manager.js.map +1 -1
- package/dist/extensions/telegram/src/actions/message-actions.d.ts +4 -0
- package/dist/extensions/telegram/src/actions/message-actions.js +71 -0
- package/dist/extensions/telegram/src/actions/message-actions.js.map +1 -0
- package/dist/extensions/telegram/src/adapters/config-adapter.js +9 -1
- package/dist/extensions/telegram/src/adapters/config-adapter.js.map +1 -1
- package/dist/extensions/telegram/src/adapters/config-surface.js +1 -1
- package/dist/extensions/telegram/src/adapters/config-surface.js.map +1 -1
- package/dist/extensions/telegram/src/adapters/outbound-adapter.d.ts +2 -1
- package/dist/extensions/telegram/src/adapters/outbound-adapter.js +18 -4
- package/dist/extensions/telegram/src/adapters/outbound-adapter.js.map +1 -1
- package/dist/extensions/telegram/src/adapters/security-adapter.js +2 -1
- package/dist/extensions/telegram/src/adapters/security-adapter.js.map +1 -1
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +90 -6
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js.map +1 -1
- package/dist/extensions/telegram/src/adapters/types.d.ts +9 -1
- package/dist/extensions/telegram/src/api-root.d.ts +4 -0
- package/dist/extensions/telegram/src/api-root.js +42 -0
- package/dist/extensions/telegram/src/api-root.js.map +1 -0
- package/dist/extensions/telegram/src/approval-delivery.d.ts +9 -0
- package/dist/extensions/telegram/src/approval-delivery.js +36 -0
- package/dist/extensions/telegram/src/approval-delivery.js.map +1 -0
- package/dist/extensions/telegram/src/approval-store.d.ts +25 -0
- package/dist/extensions/telegram/src/approval-store.js +61 -0
- package/dist/extensions/telegram/src/approval-store.js.map +1 -0
- package/dist/extensions/telegram/src/config-schema.d.ts +185 -35
- package/dist/extensions/telegram/src/config-schema.js +67 -45
- package/dist/extensions/telegram/src/config-schema.js.map +1 -1
- package/dist/extensions/telegram/src/conversation-id.d.ts +6 -0
- package/dist/extensions/telegram/src/conversation-id.js +18 -0
- package/dist/extensions/telegram/src/conversation-id.js.map +1 -0
- package/dist/extensions/telegram/src/doctor.d.ts +5 -0
- package/dist/extensions/telegram/src/doctor.js +80 -0
- package/dist/extensions/telegram/src/doctor.js.map +1 -0
- package/dist/extensions/telegram/src/exec-approval-handler.d.ts +7 -0
- package/dist/extensions/telegram/src/exec-approval-handler.js +36 -0
- package/dist/extensions/telegram/src/exec-approval-handler.js.map +1 -0
- package/dist/extensions/telegram/src/exec-approvals.d.ts +8 -0
- package/dist/extensions/telegram/src/exec-approvals.js +20 -0
- package/dist/extensions/telegram/src/exec-approvals.js.map +1 -0
- package/dist/extensions/telegram/src/focus-handler.d.ts +12 -0
- package/dist/extensions/telegram/src/focus-handler.js +55 -0
- package/dist/extensions/telegram/src/focus-handler.js.map +1 -0
- package/dist/extensions/telegram/src/group-config-resolver.d.ts +12 -0
- package/dist/extensions/telegram/src/group-config-resolver.js +17 -0
- package/dist/extensions/telegram/src/group-config-resolver.js.map +1 -0
- package/dist/extensions/telegram/src/inbound-coalescer.d.ts +15 -0
- package/dist/extensions/telegram/src/inbound-coalescer.js +107 -0
- package/dist/extensions/telegram/src/inbound-coalescer.js.map +1 -0
- package/dist/extensions/telegram/src/inbound-processor.d.ts +1 -0
- package/dist/extensions/telegram/src/inbound-processor.js +41 -4
- package/dist/extensions/telegram/src/inbound-processor.js.map +1 -1
- package/dist/extensions/telegram/src/network-errors.d.ts +2 -0
- package/dist/extensions/telegram/src/network-errors.js +23 -0
- package/dist/extensions/telegram/src/network-errors.js.map +1 -0
- package/dist/extensions/telegram/src/plugin.d.ts +11 -0
- package/dist/extensions/telegram/src/plugin.js +191 -57
- package/dist/extensions/telegram/src/plugin.js.map +1 -1
- package/dist/extensions/telegram/src/polling-session.d.ts +17 -0
- package/dist/extensions/telegram/src/polling-session.js +112 -0
- package/dist/extensions/telegram/src/polling-session.js.map +1 -0
- package/dist/extensions/telegram/src/proxy-fetch.d.ts +2 -0
- package/dist/extensions/telegram/src/proxy-fetch.js +14 -0
- package/dist/extensions/telegram/src/proxy-fetch.js.map +1 -0
- package/dist/extensions/telegram/src/reactions.d.ts +14 -0
- package/dist/extensions/telegram/src/reactions.js +48 -0
- package/dist/extensions/telegram/src/reactions.js.map +1 -0
- package/dist/extensions/telegram/src/reply-params.d.ts +15 -0
- package/dist/extensions/telegram/src/reply-params.js +28 -0
- package/dist/extensions/telegram/src/reply-params.js.map +1 -0
- package/dist/extensions/telegram/src/startup-errors.d.ts +3 -0
- package/dist/extensions/telegram/src/startup-errors.js +27 -0
- package/dist/extensions/telegram/src/startup-errors.js.map +1 -0
- package/dist/extensions/telegram/src/telegram-actions.d.ts +25 -0
- package/dist/extensions/telegram/src/telegram-actions.js +65 -0
- package/dist/extensions/telegram/src/telegram-actions.js.map +1 -0
- package/dist/extensions/telegram/src/thread-bindings.d.ts +15 -0
- package/dist/extensions/telegram/src/thread-bindings.js +22 -0
- package/dist/extensions/telegram/src/thread-bindings.js.map +1 -0
- package/dist/extensions/telegram/src/token-resolver.d.ts +8 -0
- package/dist/extensions/telegram/src/token-resolver.js +34 -0
- package/dist/extensions/telegram/src/token-resolver.js.map +1 -0
- package/dist/extensions/telegram/src/update-offset-store.d.ts +9 -0
- package/dist/extensions/telegram/src/update-offset-store.js +66 -0
- package/dist/extensions/telegram/src/update-offset-store.js.map +1 -0
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-4KTK-Ku7.js → agents-C5jtBK-H.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DkgInY2w.js → apps-page-smJl-qf_.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CH6KgFK6.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CV70xvY7.js +8 -0
- package/dist/gateway/static/root/assets/{cron-api-BRDli2Mm.js → cron-api-CgBO8B7I.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-BzEr5Za8.js → cron-page-Be0cW1cR.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-BsHh1vX0.js → dist-P8HRGUuh.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-TWt5q_ef.js → extension-debug-page-BowuycYu.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C3kV8ZvZ.js → extension-page-27-Zpv8O.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Csy9LNC6.js → extension-settings-page-DDFa_rIq.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-BLLOP2CM.js → fetch-drJUxxKP.js} +1 -1
- package/dist/gateway/static/root/assets/{field-primitives-MXbM8HvY.js → field-primitives-BWLssxEb.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-CkoyqfRx.js → heartbeat-config-api-BVuYNYT_.js} +1 -1
- package/dist/gateway/static/root/assets/index-CRDAmr3W.js +4840 -0
- package/dist/gateway/static/root/assets/index-DjNDHzwG.css +1 -0
- package/dist/gateway/static/root/assets/{logs-page-B2vY41ph.js → logs-page-BDX8IrDQ.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-page-B7qE5pkO.js → note-detail-page-BmQ9KeiA.js} +1 -1
- package/dist/gateway/static/root/assets/{note-time-NBBReVR4.js → note-time-14I9Sgqh.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CsWYaqYM.js → notes-page-BMfP0FFf.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BPGY3SCT.js → sessions-page-C3scyChq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-advanced-gate-DtA451RM.js → settings-advanced-gate-2ODuCjHP.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DYR_SPlX.js → settings-form-section-DUoGKAiW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BJUgZQzN.js → settings-page-CttAfOWV.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-3u8VFmdo.js → share-preview-page-B77xqiiI.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DuyhcH4U.js → skills-page-B_bAZGzB.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-e2q2yjs4.js → theme-store-BgCPrmxU.js} +1 -1
- package/dist/gateway/static/root/assets/url-q28QhI7l.js +3 -0
- package/dist/gateway/static/root/assets/{utils-B4Vw3fnc.js → utils-CCGejlcX.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BFY67Hhp.js → voice-api-key-field-DZzzihcY.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-page.utils-yUJ5jexd.js → workflow-page.utils-D5RMAmT4.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DIMHCpNt.js → workflows-page-DEYpC6Bv.js} +1 -1
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +4 -0
- package/dist/src/agent/agent-manager.js +68 -4
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +1 -0
- package/dist/src/agent/child-agent-factory.js +13 -10
- package/dist/src/agent/child-agent-factory.js.map +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-for-session.js.map +1 -1
- package/dist/src/agent/embedded/run-turn.js +1 -17
- package/dist/src/agent/embedded/run-turn.js.map +1 -1
- package/dist/src/agent/embedded/session-runner.js +3 -1
- package/dist/src/agent/embedded/session-runner.js.map +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.d.ts +1 -0
- package/dist/src/agent/embedded/session-tool-result-guard.js +1 -0
- package/dist/src/agent/embedded/session-tool-result-guard.js.map +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.d.ts +37 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +169 -0
- package/dist/src/agent/inbound/attachment-pipeline.js.map +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -5
- package/dist/src/agent/inbound/turn-dispatcher.js +1 -2
- package/dist/src/agent/inbound/turn-dispatcher.js.map +1 -1
- package/dist/src/agent/memory/index.d.ts +2 -0
- package/dist/src/agent/memory/index.js +2 -1
- package/dist/src/agent/memory/memory-flush.d.ts +27 -0
- package/dist/src/agent/memory/memory-flush.js +124 -0
- package/dist/src/agent/memory/memory-flush.js.map +1 -0
- package/dist/src/agent/messaging/outbound-coordinator.js +2 -1
- package/dist/src/agent/messaging/outbound-coordinator.js.map +1 -1
- package/dist/src/agent/messaging/stream-manager.d.ts +2 -0
- package/dist/src/agent/messaging/stream-manager.js +3 -0
- package/dist/src/agent/messaging/stream-manager.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +40 -107
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/prompt/contribution.d.ts +9 -0
- package/dist/src/agent/prompt/contribution.js +1 -0
- package/dist/src/agent/prompt/safety.js +0 -10
- package/dist/src/agent/prompt/safety.js.map +1 -1
- package/dist/src/agent/prompt/sanitize-for-prompt.d.ts +6 -0
- package/dist/src/agent/prompt/sanitize-for-prompt.js +13 -0
- package/dist/src/agent/prompt/sanitize-for-prompt.js.map +1 -0
- package/dist/src/agent/prompt/sections/behavior.d.ts +5 -0
- package/dist/src/agent/prompt/sections/behavior.js +50 -0
- package/dist/src/agent/prompt/sections/behavior.js.map +1 -0
- package/dist/src/agent/prompt/sections/memory-skills.d.ts +9 -0
- package/dist/src/agent/prompt/sections/memory-skills.js +59 -0
- package/dist/src/agent/prompt/sections/memory-skills.js.map +1 -0
- package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +16 -0
- package/dist/src/agent/prompt/sections/messaging-runtime.js +69 -0
- package/dist/src/agent/prompt/sections/messaging-runtime.js.map +1 -0
- package/dist/src/agent/prompt/sections/project-context.d.ts +16 -0
- package/dist/src/agent/prompt/sections/project-context.js +58 -0
- package/dist/src/agent/prompt/sections/project-context.js.map +1 -0
- package/dist/src/agent/prompt/sections/tooling.d.ts +5 -0
- package/dist/src/agent/prompt/sections/tooling.js +119 -0
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -0
- package/dist/src/agent/prompt/sections/workspace-runtime.d.ts +11 -0
- package/dist/src/agent/prompt/sections/workspace-runtime.js +32 -0
- package/dist/src/agent/prompt/sections/workspace-runtime.js.map +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +13 -0
- package/dist/src/agent/prompt/service-prompt-builder.js +54 -13
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/subagent-context.d.ts +15 -0
- package/dist/src/agent/prompt/subagent-context.js +68 -0
- package/dist/src/agent/prompt/subagent-context.js.map +1 -0
- package/dist/src/agent/prompt/system-prompt-params.d.ts +53 -0
- package/dist/src/agent/prompt/system-prompt-params.js +74 -0
- package/dist/src/agent/prompt/system-prompt-params.js.map +1 -0
- package/dist/src/agent/prompt/system-prompt.d.ts +22 -11
- package/dist/src/agent/prompt/system-prompt.js +79 -193
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/prompt/types.d.ts +3 -0
- package/dist/src/agent/service/build-direct-message-content.d.ts +5 -21
- package/dist/src/agent/service/build-direct-message-content.js +11 -64
- package/dist/src/agent/service/build-direct-message-content.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +7 -0
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -3
- package/dist/src/agent/service/process-direct-one-shot.js +22 -17
- package/dist/src/agent/service/process-direct-one-shot.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +6 -20
- package/dist/src/agent/service/process-direct-streaming.js +39 -40
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service/webchat-tts.d.ts +4 -9
- package/dist/src/agent/service/webchat-tts.js +9 -20
- package/dist/src/agent/service/webchat-tts.js.map +1 -1
- package/dist/src/agent/service.d.ts +8 -19
- package/dist/src/agent/service.js +53 -11
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/media-read-tool.d.ts +2 -0
- package/dist/src/agent/tools/media-read-tool.js +89 -0
- package/dist/src/agent/tools/media-read-tool.js.map +1 -0
- package/dist/src/channels/attachments/attachment-classifiers.d.ts +8 -0
- package/dist/src/channels/attachments/attachment-classifiers.js +11 -0
- package/dist/src/channels/attachments/attachment-classifiers.js.map +1 -0
- package/dist/src/channels/attachments/inbound-persist.d.ts +13 -34
- package/dist/src/channels/attachments/inbound-persist.js +34 -102
- package/dist/src/channels/attachments/inbound-persist.js.map +1 -1
- package/dist/src/channels/attachments/inbound-types.d.ts +13 -0
- package/dist/src/channels/attachments/inbound-types.js +30 -0
- package/dist/src/channels/attachments/inbound-types.js.map +1 -0
- package/dist/src/channels/attachments/outbound-tts-persist.d.ts +3 -12
- package/dist/src/channels/attachments/outbound-tts-persist.js +28 -48
- package/dist/src/channels/attachments/outbound-tts-persist.js.map +1 -1
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +3 -3
- package/dist/src/channels/attachments/voice-stt-webchat.js +8 -14
- package/dist/src/channels/attachments/voice-stt-webchat.js.map +1 -1
- package/dist/src/channels/channel-domain.d.ts +30 -2
- package/dist/src/channels/exec-approval-runtime.d.ts +29 -0
- package/dist/src/channels/exec-approval-runtime.js +30 -0
- package/dist/src/channels/exec-approval-runtime.js.map +1 -0
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/plugin-types.d.ts +1 -0
- package/dist/src/channels/transport-types.d.ts +2 -2
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +62 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js.map +1 -0
- package/dist/src/cli/commands/doctor/flow.js +2 -0
- package/dist/src/cli/commands/doctor/flow.js.map +1 -1
- package/dist/src/cli/commands/init.js +2 -57
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/setup.js +6 -5
- package/dist/src/cli/commands/setup.js.map +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -2
- package/dist/src/cli/utils/init-workspace-core.js.map +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/paths.d.ts +0 -13
- package/dist/src/config/paths.js +1 -20
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/config/rules.js +1 -1
- package/dist/src/config/schema.d.ts +24 -0
- package/dist/src/config/schema.js +33 -2
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/cron/executor.js +2 -2
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/channels.js +3 -3
- package/dist/src/gateway/hono/routes/config-patch/channels.js.map +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
- package/dist/src/gateway/hono/routes/media.d.ts +3 -0
- package/dist/src/gateway/hono/routes/media.js +50 -0
- package/dist/src/gateway/hono/routes/media.js.map +1 -0
- package/dist/src/gateway/hono/routes/sessions.js +6 -0
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +1 -87
- package/dist/src/gateway/hono/routes/workspace.js.map +1 -1
- package/dist/src/gateway/service/sessions-api.js +3 -0
- package/dist/src/gateway/service/sessions-api.js.map +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/media/index.d.ts +5 -0
- package/dist/src/media/index.js +5 -0
- package/dist/src/media/media-reference.d.ts +23 -0
- package/dist/src/media/media-reference.js +34 -0
- package/dist/src/media/media-reference.js.map +1 -0
- package/dist/src/media/paths.d.ts +5 -0
- package/dist/src/media/paths.js +20 -0
- package/dist/src/media/paths.js.map +1 -0
- package/dist/src/media/session-references.d.ts +8 -0
- package/dist/src/media/session-references.js +45 -0
- package/dist/src/media/session-references.js.map +1 -0
- package/dist/src/media/store.d.ts +19 -0
- package/dist/src/media/store.js +131 -0
- package/dist/src/media/store.js.map +1 -0
- package/dist/src/media/types.d.ts +34 -0
- package/dist/src/media/types.js +1 -0
- package/dist/src/media/uri.d.ts +15 -0
- package/dist/src/media/uri.js +51 -0
- package/dist/src/media/uri.js.map +1 -0
- package/dist/src/session/session-title.js +6 -3
- package/dist/src/session/session-title.js.map +1 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/session/types.d.ts +12 -7
- package/dist/src/session/types.js.map +1 -1
- package/dist/src/storage/sqlite/index.d.ts +4 -1
- package/dist/src/storage/sqlite/index.js +6 -2
- package/dist/src/storage/sqlite/migrations/002_add_flush_columns.sql +3 -0
- package/dist/src/storage/sqlite/migrations/discover.d.ts +4 -0
- package/dist/src/storage/sqlite/migrations/discover.js +38 -0
- package/dist/src/storage/sqlite/migrations/discover.js.map +1 -0
- package/dist/src/storage/sqlite/migrations/discover.ts +52 -0
- package/dist/src/storage/sqlite/migrations/errors.d.ts +11 -0
- package/dist/src/storage/sqlite/migrations/errors.js +27 -0
- package/dist/src/storage/sqlite/migrations/errors.js.map +1 -0
- package/dist/src/storage/sqlite/migrations/errors.ts +32 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +22 -0
- package/dist/src/storage/sqlite/migrations/runner.js +97 -0
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -0
- package/dist/src/storage/sqlite/migrations/runner.ts +153 -0
- package/dist/src/storage/sqlite/migrations/types.d.ts +12 -0
- package/dist/src/storage/sqlite/migrations/types.js +1 -0
- package/dist/src/storage/sqlite/migrations/types.ts +13 -0
- package/dist/src/storage/sqlite/row-mappers.d.ts +4 -0
- package/dist/src/storage/sqlite/row-mappers.js +4 -0
- package/dist/src/storage/sqlite/row-mappers.js.map +1 -1
- package/dist/src/storage/sqlite/schema-version.d.ts +6 -0
- package/dist/src/storage/sqlite/schema-version.js +29 -0
- package/dist/src/storage/sqlite/schema-version.js.map +1 -0
- package/dist/src/storage/sqlite/schema.d.ts +5 -3
- package/dist/src/storage/sqlite/schema.js +24 -28
- package/dist/src/storage/sqlite/schema.js.map +1 -1
- package/dist/src/storage/sqlite/schema.sql +2 -0
- package/dist/src/storage/sqlite/session-metadata.js +1 -0
- package/dist/src/storage/sqlite/session-metadata.js.map +1 -1
- package/dist/src/storage/sqlite/session-repository.js +7 -3
- package/dist/src/storage/sqlite/session-repository.js.map +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BxW1Xio4.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Cxm6AvQO.js +0 -8
- package/dist/gateway/static/root/assets/index-BJDmBCSl.css +0 -1
- package/dist/gateway/static/root/assets/index-Cbg5TS5m.js +0 -4707
- package/dist/gateway/static/root/assets/url-DpFBIyN9.js +0 -3
- package/dist/src/cli/commands/onboard/workspace.d.ts +0 -14
- package/dist/src/cli/commands/onboard/workspace.js +0 -33
- package/dist/src/cli/commands/onboard/workspace.js.map +0 -1
- package/dist/src/cli/utils/workspace.d.ts +0 -35
- package/dist/src/cli/utils/workspace.js +0 -72
- package/dist/src/cli/utils/workspace.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-DpFBIyN9.js";import{a as s,n as c}from"./fetch-BLLOP2CM.js";import{$o as l,Ar as u,Cr as d,Dr as f,Er as p,Ma as m,Mo as h,Mr as g,Nr as _,Oi as v,Or as y,Qr as b,Yi as x,ao as S,bn as C,ci as w,di as T,fo as E,fr as D,jr as O,kr as k,na as A,pi as j,ri as M,ro as N,to as P,ui as F,wr as I,xn as L,xo as R,yn as z}from"./index-Cbg5TS5m.js";var B=e(t(),1),V=n();function ee(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.sessionId&&t.set(`sessionId`,e.sessionId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function H(e){return c(o(`/api/logs${ee(e)}`))}async function U(){return(await c(o(`/api/logs/files`))).files??[]}async function W(){return(await c(o(`/api/logs/modules`))).modules??[]}async function G(){let e=await c(o(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function K(){return(await c(o(`/api/logs/dir`))).dir??``}async function q(){return(await c(o(`/api/logs/level`))).level??`info`}async function J(e,t){return c(o(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function Y(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await c(o(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var X=500,te=class{_token;_callbacks;_eventSource;constructor(e,t){this._token=e,this._callbacks=t}connect(e,t){this.disconnect();let n=new URL(o(`/api/logs/stream`));this._token&&n.searchParams.set(`token`,this._token),e?.length?n.searchParams.set(`levels`,e.join(`,`)):n.searchParams.set(`levels`,`trace,debug,info,warn,error,fatal`),t&&n.searchParams.set(`module`,t),this._eventSource=new EventSource(n.toString()),this._eventSource.onmessage=e=>{try{let t=JSON.parse(String(e.data));if(t.type===`connected`){this._callbacks.onConnected();return}if(t.type===`heartbeat`)return;this._callbacks.onEntry(t)}catch{}},this._eventSource.onerror=()=>{this._eventSource?.readyState===EventSource.CLOSED&&this._callbacks.onError(`Log stream disconnected`)}}disconnect(){this._eventSource?.close(),this._eventSource=void 0}};function Z(e,t){let n=`${t.timestamp}-${t.requestId??``}-${t.message}`;return[t,...e.filter(e=>`${e.timestamp}-${e.requestId??``}-${e.message}`!==n)].slice(0,X)}var Q=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function ne(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function re(e){return e.toSorted((e,t)=>ne(t)-ne(e))}var ie=new Set(Q),ae=[`error`,`fatal`],oe=[`warn`,`error`,`fatal`],se=[`info`,`warn`,`error`,`fatal`];function ce(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();ie.has(e)&&t.add(e)}return t}function le(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ue(e,t){return e.size===t.length?t.every(t=>e.has(t)):!1}function de(e){return e.size===0?`all`:ue(e,ae)?`errors`:ue(e,oe)?`warnPlus`:ue(e,se)?`infoPlus`:e.size===Q.length&&Q.every(t=>e.has(t))?`verbose`:`custom`}function fe(e){let t=de(e);return t===`custom`?`other`:t}function pe(e){switch(e){case`all`:return new Set;case`errors`:return new Set(ae);case`warnPlus`:return new Set(oe);case`infoPlus`:return new Set(se);case`verbose`:return new Set(Q)}}function me(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function he(e){return String(e.module||e.service||e.extension||`—`)}function ge(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function _e(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function ve(e){try{return new Date(e).toLocaleString()}catch{return e}}function ye(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function be(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function xe(e){return String(e).toLowerCase()}function Se(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function Ce(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function we(e){let t=e.err??e.meta?.err;if(!t||typeof t!=`object`)return null;let n=t;return{name:typeof n.name==`string`?n.name:void 0,message:typeof n.message==`string`?n.message:void 0,stack:typeof n.stack==`string`?n.stack:void 0}}function Te(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&he(e)!==t.moduleFilter||t.requestIdFilter&&e.requestId!==t.requestIdFilter||t.sessionIdFilter&&e.sessionId!==t.sessionIdFilter)return!1;if(t.dateFrom){let n=new Date(t.dateFrom).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r<n)return!1}if(t.dateTo){let n=new Date(t.dateTo).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r>n)return!1}if(t.debouncedSearch){let n=t.debouncedSearch.toLowerCase();if(![e.message,he(e),Se(e),e.requestId,e.sessionId,we(e)?.message,we(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function Ee(e,t){let n=[];for(let r of Q){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function De(e,t){switch(t.type){case`setSearchInput`:return e.searchInput===t.value?e:{...e,searchInput:t.value};case`setDebouncedSearch`:return e.debouncedSearch===t.value?e:{...e,debouncedSearch:t.value};case`setLevels`:return le(e.selectedLevels,t.value)?e:{...e,selectedLevels:t.value};case`toggleLevel`:{let n=new Set(e.selectedLevels);return n.has(t.level)?n.delete(t.level):n.add(t.level),{...e,selectedLevels:n}}case`setModule`:return e.moduleFilter===t.value?e:{...e,moduleFilter:t.value};case`setRequestIdFilter`:return e.requestIdFilter===t.value?e:{...e,requestIdFilter:t.value};case`setSessionIdFilter`:return e.sessionIdFilter===t.value?e:{...e,sessionIdFilter:t.value};case`setDateFrom`:return e.dateFrom===t.value?e:{...e,dateFrom:t.value};case`setDateTo`:return e.dateTo===t.value?e:{...e,dateTo:t.value};case`setAutoRefresh`:return e.autoRefresh===t.value?e:{...e,autoRefresh:t.value};case`syncFromUrl`:{let n=t.payload;return e.searchInput===n.searchInput&&e.debouncedSearch===n.debouncedSearch&&le(e.selectedLevels,n.selectedLevels)&&e.moduleFilter===n.moduleFilter&&e.requestIdFilter===n.requestIdFilter&&e.sessionIdFilter===n.sessionIdFilter&&e.dateFrom===n.dateFrom&&e.dateTo===n.dateTo&&e.autoRefresh===n.autoRefresh?e:{...e,...n}}case`clearAll`:return{searchInput:``,debouncedSearch:``,selectedLevels:new Set,moduleFilter:``,requestIdFilter:``,sessionIdFilter:``,dateFrom:``,dateTo:``,autoRefresh:e.autoRefresh}}}var Oe={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function ke(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:re(t.logs),hasMore:t.hasMore};case`queryError`:return t.resetLogs?{...e,loading:!1,error:t.message,logs:[],hasMore:!1}:{...e,loading:!1,error:t.message};case`appendSuccess`:return{...e,loading:!1,logs:re([...e.logs,...t.logs]),hasMore:t.hasMore};case`metaSuccess`:return{...e,modules:t.modules,stats:t.stats,files:t.files};case`filesSuccess`:return{...e,files:t.files,logDir:t.logDir};case`filesClear`:return{...e,files:[]};case`liveTick`:return{...e,logs:re(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:re(Z(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:re(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Ae(e){let t=a(e).logs,n=s(e=>e.token),r=!!n,[i,o]=l(),c=(0,B.useRef)(i),[u,d]=(0,B.useReducer)(De,void 0,()=>{let e=c.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:ce(e.get(`level`)),moduleFilter:e.get(`module`)??``,requestIdFilter:e.get(`requestId`)??``,sessionIdFilter:e.get(`sessionId`)??``,dateFrom:e.get(`from`)??``,dateTo:e.get(`to`)??``,autoRefresh:e.get(`live`)===`1`}}),[f,p]=(0,B.useReducer)(ke,Oe),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(null),[S,C]=(0,B.useState)([]),[w,T]=(0,B.useState)(!1),{searchInput:E,debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,dateTo:N,autoRefresh:P}=u,{logs:F,loading:I,error:L,hasMore:R,modules:z,files:V,stats:ee,logDir:q}=f,J=(0,B.useCallback)(e=>d({type:`setSearchInput`,value:e}),[]),X=(0,B.useCallback)(e=>d({type:`setLevels`,value:e}),[]),Z=(0,B.useCallback)(e=>d({type:`setModule`,value:e}),[]),Q=(0,B.useCallback)(e=>d({type:`setRequestIdFilter`,value:e}),[]),ne=(0,B.useCallback)(e=>d({type:`setSessionIdFilter`,value:e}),[]),re=(0,B.useCallback)(e=>d({type:`setDateFrom`,value:e}),[]),ie=(0,B.useCallback)(e=>d({type:`setDateTo`,value:e}),[]),ae=(0,B.useCallback)(e=>d({type:`setAutoRefresh`,value:e}),[]),oe=(0,B.useMemo)(()=>fe(O),[O]),se=e=>{if(e===`other`){y(!0);return}d({type:`setLevels`,value:pe(e)})},le=D.length>0||O.size>0||!!k||!!A||!!j||!!M||!!N,ue=+(D.length>0)+ +(O.size>0)+ +!!k+ +!!A+ +!!j+(M||N?1:0);(0,B.useEffect)(()=>{let e=setTimeout(()=>d({type:`setDebouncedSearch`,value:E.trim()}),300);return()=>clearTimeout(e)},[E]),(0,B.useEffect)(()=>{let e=i.get(`q`)??``;d({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:ce(i.get(`level`)),moduleFilter:i.get(`module`)??``,requestIdFilter:i.get(`requestId`)??``,sessionIdFilter:i.get(`sessionId`)??``,dateFrom:i.get(`from`)??``,dateTo:i.get(`to`)??``,autoRefresh:i.get(`live`)===`1`}})},[i]),(0,B.useEffect)(()=>{let e=new URLSearchParams(i),t=D.trim();t?e.set(`q`,t):e.delete(`q`),O.size>0?e.set(`level`,Array.from(O).sort().join(`,`)):e.delete(`level`),k?e.set(`module`,k):e.delete(`module`),A?e.set(`requestId`,A):e.delete(`requestId`),j?e.set(`sessionId`,j):e.delete(`sessionId`),M?e.set(`from`,M):e.delete(`from`),N?e.set(`to`,N):e.delete(`to`),P?e.set(`live`,`1`):e.delete(`live`),e.toString()!==i.toString()&&o(e,{replace:!0})},[P,M,N,D,k,A,j,i,O,o]);let de=(0,B.useMemo)(()=>({q:D||void 0,level:O.size>0?Array.from(O):void 0,module:k||void 0,requestId:A||void 0,sessionId:j||void 0,from:M||void 0,to:N||void 0,limit:50}),[D,O,k,A,j,M,N]),me=(0,B.useMemo)(()=>({debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,dateTo:N}),[D,O,k,A,j,M,N]),he=(0,B.useRef)(me);return he.current=me,(0,B.useEffect)(()=>{if(!r)return;let e=!1;return T(!0),Y({from:M||void 0,to:N||void 0,limit:12}).then(t=>{e||C(t)}).catch(()=>{e||C([])}).finally(()=>{e||T(!1)}),()=>{e=!0}},[r,M,N]),(0,B.useEffect)(()=>{if(!r)return;let e=!1;return p({type:`queryStart`}),(async()=>{try{let t=await H({...de,offset:0});if(e)return;p({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||p({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,B.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([W(),G(),U()]);e||p({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,B.useEffect)(()=>{if(!r||!g)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([U(),K()]);e||p({type:`filesSuccess`,files:t,logDir:n})}catch{e||p({type:`filesClear`})}})(),()=>{e=!0}},[r,g]),(0,B.useEffect)(()=>{if(!P||!r)return;let e=new te(n??void 0,{onConnected:()=>{},onEntry:e=>{Te(e,he.current)&&p({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(O.size>0?Array.from(O):void 0,k||void 0);let t=window.setInterval(()=>{G().then(e=>{p({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[P,r,n,O,k]),(0,B.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>x(null),2e3);return()=>clearTimeout(e)},[b]),{L:t,hasToken:r,logs:F,loading:I,error:L,hasMore:R,searchInput:E,setSearchInput:J,selectedLevels:O,setSelectedLevels:X,moduleFilter:k,setModuleFilter:Z,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,setDateFrom:re,dateTo:N,setDateTo:ie,modules:z,files:V,stats:ee,selectedLog:m,setSelectedLog:h,filesOpen:g,setFilesOpen:_,filtersOpen:v,setFiltersOpen:y,logDir:q,autoRefresh:P,setAutoRefresh:ae,copiedDetail:b,setCopiedDetail:x,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>d({type:`clearAll`}),toggleDialogLevel:e=>d({type:`toggleLevel`,level:e}),handleLoadMore:()=>{I||!R||(async()=>{p({type:`queryStart`});try{let e=await H({...de,offset:F.length});p({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{p({type:`queryStart`});try{let e=await H({...de,offset:0}),[t,n]=await Promise.all([G(),U()]);p({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:oe,handleLevelSegment:se,filterByRequestId:(0,B.useCallback)(e=>{h(null),Q(e)},[Q]),filterBySessionId:(0,B.useCallback)(e=>{h(null),ne(e)},[ne]),filterByErrorSummary:(0,B.useCallback)(e=>{d({type:`setSearchInput`,value:e.errName}),d({type:`setDebouncedSearch`,value:e.errName}),e.module&&d({type:`setModule`,value:e.module}),d({type:`setLevels`,value:pe(`errors`)})},[]),openChatForSession:(0,B.useCallback)(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e}}))},[]),errorSummary:S,errorSummaryLoading:w}}var $=r();function je(e){let t=(0,V.c)(37),{L:n,items:r,loading:i,onSelectItem:a}=e,[o,s]=(0,B.useState)(!1);if(!i&&r.length===0)return null;let c;t[0]===r?c=t[1]:(c=r.reduce(Ne,0),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(Me),t[2]=u):u=t[2];let d;t[3]===n.errorSummaryTitle?d=t[4]:(d=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=d);let f;t[5]===n.errorSummaryHint?f=t[6]:(f=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==n.loading||t[11]!==r.length||t[12]!==i||t[13]!==l?(m=i?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n.loading}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:r.length}),(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-hover px-2 py-0.5 text-xs tabular-nums text-fg-muted`,children:[`×`,l]})]}),t[10]=n.loading,t[11]=r.length,t[12]=i,t[13]=l,t[14]=m):m=t[14];let g=o&&`rotate-180`,_;t[15]===g?_=t[16]:(_=T(`size-4 text-fg-muted transition-transform duration-150 ease-out motion-reduce:transition-none`,g),t[15]=g,t[16]=_);let v;t[17]===_?v=t[18]:(v=(0,$.jsx)(h,{className:_,strokeWidth:1.75,"aria-hidden":!0}),t[17]=_,t[18]=v);let y;t[19]!==m||t[20]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[m,v]}),t[19]=m,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==o||t[23]!==y||t[24]!==p?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:u,"aria-expanded":o,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset`,children:[p,y]}),t[22]=o,t[23]=y,t[24]=p,t[25]=b):b=t[25];let x;t[26]!==n.module||t[27]!==n.phase||t[28]!==n.time||t[29]!==o||t[30]!==r||t[31]!==i||t[32]!==a?(x=o&&!i&&r.length>0?(0,$.jsx)(`ul`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle dark:divide-edge dark:border-edge`,children:r.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a?.(e),className:T(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,a&&`cursor-pointer`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.errName}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:[`×`,e.count]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[e.phase?(0,$.jsxs)(`span`,{children:[n.phase,`: `,e.phase]}):null,e.module?(0,$.jsxs)(`span`,{children:[n.module,`: `,e.module]}):null,(0,$.jsxs)(`span`,{children:[n.time,`: `,_e(e.lastSeen)]})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.sampleMessage})]})},e.key))}):null,t[26]=n.module,t[27]=n.phase,t[28]=n.time,t[29]=o,t[30]=r,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;return t[34]!==b||t[35]!==x?(S=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel dark:border-edge`,children:[b,x]}),t[34]=b,t[35]=x,t[36]=S):S=t[36],S}function Me(e){return!e}function Ne(e,t){return e+t.count}function Pe(e){let t=(0,V.c)(69),{log:n,labels:r,onFilterByRequestId:i,onFilterBySessionId:a,onOpenChat:o}=e,s=n.level??`info`,c=typeof n.requestId==`string`?n.requestId:``,l=typeof n.sessionId==`string`?n.sessionId:``,u;t[0]===n?u=t[1]:(u=Se(n),t[0]=n,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=we(n),t[2]=n,t[3]=f);let p=f,m=s===`error`||s===`fatal`,h;t[4]===r.message?h=t[5]:(h=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=h);let g=m&&`border-red-500/40`,_;t[6]===g?_=t[7]:(_=T(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,g),t[6]=g,t[7]=_);let v=n.message||`—`,y;t[8]!==_||t[9]!==v?(y=(0,$.jsx)(`pre`,{className:_,children:v}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let b;t[11]!==h||t[12]!==y?(b=(0,$.jsxs)(`div`,{children:[h,y]}),t[11]=h,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==p||t[15]!==r.stackTrace?(x=p?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),p.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:p.name}):null,(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-red-500/30 bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-red-500/30`,children:p.stack})]}):null,t[14]=p,t[15]=r.stackTrace,t[16]=x):x=t[16];let S;t[17]===r.time?S=t[18]:(S=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=S);let C;t[19]===n.timestamp?C=t[20]:(C=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=C);let w;t[21]===r.level?w=t[22]:(w=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=w);let E=m&&`font-medium text-red-600 dark:text-red-400`,D;t[23]===E?D=t[24]:(D=T(`text-fg`,E),t[23]=E,t[24]=D);let O;t[25]===s?O=t[26]:(O=xe(s),t[25]=s,t[26]=O);let k;t[27]!==D||t[28]!==O?(k=(0,$.jsx)(`span`,{className:D,children:O}),t[27]=D,t[28]=O,t[29]=k):k=t[29];let A;t[30]===r.module?A=t[31]:(A=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=A);let j;t[32]===n?j=t[33]:(j=he(n),t[32]=n,t[33]=j);let M;t[34]===j?M=t[35]:(M=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:j}),t[34]=j,t[35]=M);let N;t[36]!==r.phase||t[37]!==d?(N=d===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.phase}),(0,$.jsx)(`code`,{className:`break-all text-fg`,children:d})]}),t[36]=r.phase,t[37]=d,t[38]=N):N=t[38];let P;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==c?(P=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.requestId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:c}),i?(0,$.jsx)(F,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(c),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=c,t[43]=P):P=t[43];let I;t[44]!==r.filterBySessionId||t[45]!==r.openChat||t[46]!==r.sessionId||t[47]!==a||t[48]!==o||t[49]!==l?(I=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.sessionId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:l}),a?(0,$.jsx)(F,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>a(l),children:r.filterBySessionId}):null,o?(0,$.jsx)(F,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o(l),children:r.openChat}):null]})]}):null,t[44]=r.filterBySessionId,t[45]=r.openChat,t[46]=r.sessionId,t[47]=a,t[48]=o,t[49]=l,t[50]=I):I=t[50];let L;t[51]!==S||t[52]!==C||t[53]!==w||t[54]!==k||t[55]!==A||t[56]!==M||t[57]!==N||t[58]!==P||t[59]!==I?(L=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[S,C,w,k,A,M,N,P,I]}),t[51]=S,t[52]=C,t[53]=w,t[54]=k,t[55]=A,t[56]=M,t[57]=N,t[58]=P,t[59]=I,t[60]=L):L=t[60];let R;t[61]!==r.metadata||t[62]!==n.meta?(R=n.meta&&Object.keys(n.meta).length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.metadata}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,children:JSON.stringify(n.meta,null,2)})]}):null,t[61]=r.metadata,t[62]=n.meta,t[63]=R):R=t[63];let z;return t[64]!==L||t[65]!==R||t[66]!==b||t[67]!==x?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[b,x,L,R]}),t[64]=L,t[65]=R,t[66]=b,t[67]=x,t[68]=z):z=t[68],z}function Fe(e){let t=(0,V.c)(49),{L:n,log:r,onClose:i,copiedDetail:a,onCopiedMessage:o,onCopiedJson:s,onFilterByRequestId:c,onFilterBySessionId:l,onOpenChat:u}=e,m=r!==null,h;t[0]===i?h=t[1]:(h=e=>!e&&i(),t[0]=i,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(p,{className:T(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=T(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,z,`dark:border-edge`),t[3]=_):_=t[3];let v;t[4]===n.details?v=t[5]:(v=(0,$.jsx)(k,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=v);let x;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==a||t[10]!==r||t[11]!==s||t[12]!==o?(x=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{b(typeof r.message==`string`?r.message:``).then(e=>{e&&o()})},children:[(0,$.jsx)(R,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{b(JSON.stringify(r,null,2)).then(e=>{e&&s()})},children:[(0,$.jsx)(R,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=a,t[10]=r,t[11]=s,t[12]=o,t[13]=x):x=t[13];let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[14]=S):S=t[14];let w;t[15]===n.close?w=t[16]:(w=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:S})}),t[15]=n.close,t[16]=w);let E;t[17]!==x||t[18]!==w?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[x,w]}),t[17]=x,t[18]=w,t[19]=E):E=t[19];let D;t[20]!==v||t[21]!==E?(D=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[v,E]}),t[20]=v,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==n.filterByRequestId||t[24]!==n.filterBySessionId||t[25]!==n.level||t[26]!==n.message||t[27]!==n.metadata||t[28]!==n.module||t[29]!==n.openChat||t[30]!==n.phase||t[31]!==n.requestId||t[32]!==n.sessionId||t[33]!==n.stackTrace||t[34]!==n.time||t[35]!==r||t[36]!==c||t[37]!==l||t[38]!==u?(O=r?(0,$.jsx)(Pe,{log:r,labels:{time:n.time,level:n.level,module:n.module,message:n.message,metadata:n.metadata,requestId:n.requestId,sessionId:n.sessionId,phase:n.phase,stackTrace:n.stackTrace,filterByRequestId:n.filterByRequestId,filterBySessionId:n.filterBySessionId,openChat:n.openChat},onFilterByRequestId:c,onFilterBySessionId:l,onOpenChat:u}):null,t[23]=n.filterByRequestId,t[24]=n.filterBySessionId,t[25]=n.level,t[26]=n.message,t[27]=n.metadata,t[28]=n.module,t[29]=n.openChat,t[30]=n.phase,t[31]=n.requestId,t[32]=n.sessionId,t[33]=n.stackTrace,t[34]=n.time,t[35]=r,t[36]=c,t[37]=l,t[38]=u,t[39]=O):O=t[39];let A;t[40]===O?A=t[41]:(A=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:O}),t[40]=O,t[41]=A);let M;t[42]!==D||t[43]!==A?(M=(0,$.jsxs)(f,{children:[g,(0,$.jsxs)(I,{className:_,"aria-describedby":void 0,children:[D,A]})]}),t[42]=D,t[43]=A,t[44]=M):M=t[44];let N;return t[45]!==m||t[46]!==M||t[47]!==h?(N=(0,$.jsx)(y,{open:m,onOpenChange:h,children:M}),t[45]=m,t[46]=M,t[47]=h,t[48]=N):N=t[48],N}function Ie(e){let t=(0,V.c)(25),{L:n,open:r,onOpenChange:i,files:a,logDir:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(p,{className:T(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=T(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,85vh)] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,z,`dark:border-edge`),t[1]=c):c=t[1];let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(N,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=l):l=t[2];let u;t[3]===n.logFiles?u=t[4]:(u=(0,$.jsxs)(k,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[l,n.logFiles]}),t[3]=n.logFiles,t[4]=u);let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[5]=m):m=t[5];let h;t[6]===n.close?h=t[7]:(h=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:m})}),t[6]=n.close,t[7]=h);let g;t[8]!==u||t[9]!==h?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[u,h]}),t[8]=u,t[9]=h,t[10]=g):g=t[10];let _;t[11]!==n.filesEmpty||t[12]!==a?(_=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:a.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(Le)})}),t[11]=n.filesEmpty,t[12]=a,t[13]=_):_=t[13];let v;t[14]!==n.logDir||t[15]!==o?(v=o?(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2 text-xs text-fg-subtle dark:border-edge`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[n.logDir,`: `]}),(0,$.jsx)(`code`,{className:`break-all text-fg-subtle`,children:o})]}):null,t[14]=n.logDir,t[15]=o,t[16]=v):v=t[16];let b;t[17]!==g||t[18]!==_||t[19]!==v?(b=(0,$.jsxs)(f,{children:[s,(0,$.jsxs)(I,{className:c,children:[g,_,v]})]}),t[17]=g,t[18]=_,t[19]=v,t[20]=b):b=t[20];let x;return t[21]!==i||t[22]!==r||t[23]!==b?(x=(0,$.jsx)(y,{open:r,onOpenChange:i,children:b}),t[21]=i,t[22]=r,t[23]=b,t[24]=x):x=t[24],x}function Le(e){return(0,$.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-xs text-fg`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ye(e.size)}),(0,$.jsx)(`span`,{children:ve(e.modified)})]})]},e.name)}function Re(e){let t=(0,V.c)(68),{L:n,open:r,onOpenChange:i,dateFrom:a,onDateFromChange:o,dateTo:s,onDateToChange:c,selectedLevels:l,onToggleLevel:u}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(p,{className:T(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=T(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,90vh)] w-[min(100%-2rem,22rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,z,`dark:border-edge`),t[1]=h):h=t[1];let g;t[2]===n.filtersDialogTitle?g=t[3]:(g=(0,$.jsx)(k,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=g);let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[4]=_):_=t[4];let v;t[5]===n.close?v=t[6]:(v=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:_})}),t[5]=n.close,t[6]=v);let b;t[7]!==g||t[8]!==v?(b=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[g,v]}),t[7]=g,t[8]=v,t[9]=b):b=t[9];let x;t[10]===n.filtersDialogDesc?x=t[11]:(x=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=x);let S;t[12]===n.timeRange?S=t[13]:(S=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=S);let w;t[14]===n.from?w=t[15]:(w=(0,$.jsx)(`label`,{htmlFor:`log-from-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.from}),t[14]=n.from,t[15]=w);let E;t[16]===o?E=t[17]:(E=e=>o(e.target.value),t[16]=o,t[17]=E);let D;t[18]!==a||t[19]!==E?(D=(0,$.jsx)(`input`,{id:`log-from-d`,type:`datetime-local`,value:a,onChange:E,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[18]=a,t[19]=E,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==w?(O=(0,$.jsxs)(`div`,{children:[w,D]}),t[21]=D,t[22]=w,t[23]=O):O=t[23];let A;t[24]===n.to?A=t[25]:(A=(0,$.jsx)(`label`,{htmlFor:`log-to-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.to}),t[24]=n.to,t[25]=A);let M;t[26]===c?M=t[27]:(M=e=>c(e.target.value),t[26]=c,t[27]=M);let N;t[28]!==s||t[29]!==M?(N=(0,$.jsx)(`input`,{id:`log-to-d`,type:`datetime-local`,value:s,onChange:M,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[28]=s,t[29]=M,t[30]=N):N=t[30];let P;t[31]!==A||t[32]!==N?(P=(0,$.jsxs)(`div`,{children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let L;t[34]!==O||t[35]!==P?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[O,P]}),t[34]=O,t[35]=P,t[36]=L):L=t[36];let R;t[37]===n.levelCustom?R=t[38]:(R=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[37]=n.levelCustom,t[38]=R);let B;t[39]===n.levelCustomHint?B=t[40]:(B=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[39]=n.levelCustomHint,t[40]=B);let ee=n.level,H;t[41]!==n.levelNames||t[42]!==u||t[43]!==l?(H=Q.map(e=>(0,$.jsx)(`button`,{type:`button`,className:T(`rounded-full border px-3 py-1.5 text-xs font-medium capitalize transition-[color,background-color,border-color] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,l.has(e)?`border-edge bg-surface-active text-fg dark:border-edge`:`border-edge-subtle bg-surface-base text-fg-muted hover:bg-surface-hover dark:border-edge`),onClick:()=>u(e),children:n.levelNames[e]},e)),t[41]=n.levelNames,t[42]=u,t[43]=l,t[44]=H):H=t[44];let U;t[45]!==n.level||t[46]!==H?(U=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":ee,children:H}),t[45]=n.level,t[46]=H,t[47]=U):U=t[47];let W;t[48]!==L||t[49]!==R||t[50]!==B||t[51]!==U||t[52]!==S?(W=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[S,L,R,B,U]}),t[48]=L,t[49]=R,t[50]=B,t[51]=U,t[52]=S,t[53]=W):W=t[53];let G;t[54]===i?G=t[55]:(G=()=>i(!1),t[54]=i,t[55]=G);let K;t[56]!==n.filtersDone||t[57]!==G?(K=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(F,{type:`button`,className:`w-full rounded-xl`,onClick:G,children:n.filtersDone})}),t[56]=n.filtersDone,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==W||t[60]!==K||t[61]!==b||t[62]!==x?(q=(0,$.jsxs)(f,{children:[m,(0,$.jsxs)(I,{className:h,"aria-describedby":`log-filters-desc`,children:[b,x,W,K]})]}),t[59]=W,t[60]=K,t[61]=b,t[62]=x,t[63]=q):q=t[63];let J;return t[64]!==i||t[65]!==r||t[66]!==q?(J=(0,$.jsx)(y,{open:r,onOpenChange:i,children:q}),t[64]=i,t[65]=r,t[66]=q,t[67]=J):J=t[67],J}function ze(e){let t=(0,V.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:a,onSearchInputChange:o,moduleFilter:s,onModuleFilterChange:c,modules:l,onOpenFilters:u,activeFilterCount:d,hasActiveFilters:f,onClearFilters:p,autoRefresh:h}=e,g=n.filters,_;t[0]===n.presetAll?_=t[1]:(_={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=_);let v;t[2]===n.presetErrors?v=t[3]:(v={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=v);let y;t[4]===n.presetWarnPlus?y=t[5]:(y={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=y);let b;t[6]===n.presetInfoPlus?b=t[7]:(b={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=b);let S;t[8]===n.presetVerbose?S=t[9]:(S={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=S);let C;t[10]===n.presetOther?C=t[11]:(C={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=C);let E;t[12]!==_||t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==S||t[17]!==C?(E=[_,v,y,b,S,C],t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=S,t[17]=C,t[18]=E):E=t[18];let O;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==E?(O=(0,$.jsx)(`div`,{className:`overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsx)(`div`,{className:`min-w-[min(100%,36rem)]`,children:(0,$.jsx)(D,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:E,buttonClassName:`h-8 px-1.5 text-[11px] sm:px-2 sm:text-xs`})})}),t[19]=n.levelPresetAria,t[20]=r,t[21]=i,t[22]=E,t[23]=O):O=t[23];let k;t[24]===n.searchPlaceholder?k=t[25]:(k=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[26]=A):A=t[26];let N;t[27]===o?N=t[28]:(N=e=>o(e.target.value),t[27]=o,t[28]=N);let P=n.searchPlaceholder,I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=T(`h-10 w-full rounded-md border border-edge bg-surface-panel py-0 pl-10 pr-3 text-sm leading-5 text-fg placeholder:text-fg-subtle dark:border-edge`,M),t[29]=I):I=t[29];let L;t[30]!==n.searchPlaceholder||t[31]!==a||t[32]!==N?(L=(0,$.jsx)(`input`,{type:`search`,value:a,onChange:N,placeholder:P,autoComplete:`off`,spellCheck:!1,className:I}),t[30]=n.searchPlaceholder,t[31]=a,t[32]=N,t[33]=L):L=t[33];let R;t[34]!==k||t[35]!==L?(R=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[k,A,L]}),t[34]=k,t[35]=L,t[36]=R):R=t[36];let z;t[37]===c?z=t[38]:(z=e=>c(e.target.value),t[37]=c,t[38]=z);let B=n.module,ee=n.module,H;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=T(w,`h-10 w-full min-w-0 rounded-md py-0 sm:w-[min(100%,14rem)] sm:shrink-0`),t[39]=H):H=t[39];let U;t[40]===n.allModules?U=t[41]:(U=(0,$.jsx)(`option`,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=U);let W;t[42]===l?W=t[43]:(W=l.map(Be),t[42]=l,t[43]=W);let G;t[44]!==n.module||t[45]!==s||t[46]!==z||t[47]!==U||t[48]!==W?(G=(0,$.jsxs)(`select`,{id:`log-module`,value:s,onChange:z,"aria-label":B,title:ee,className:H,children:[U,W]}),t[44]=n.module,t[45]=s,t[46]=z,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(m,{className:`size-4`,strokeWidth:1.75}),t[50]=K):K=t[50];let q;t[51]===d?q=t[52]:(q=d>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:d}):null,t[51]=d,t[52]=q);let J;t[53]!==n.filtersMore||t[54]!==u||t[55]!==q?(J=(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:u,children:[K,n.filtersMore,q]}),t[53]=n.filtersMore,t[54]=u,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==f||t[59]!==p?(Y=f?(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:p,children:[(0,$.jsx)(j,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=f,t[59]=p,t[60]=Y):Y=t[60];let X;t[61]!==J||t[62]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[J,Y]}),t[61]=J,t[62]=Y,t[63]=X):X=t[63];let te;t[64]!==R||t[65]!==G||t[66]!==X?(te=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[R,G,X]}),t[64]=R,t[65]=G,t[66]=X,t[67]=te):te=t[67];let Z;t[68]!==n.liveHint||t[69]!==h?(Z=h?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=h,t[70]=Z):Z=t[70];let Q;return t[71]!==n.filters||t[72]!==te||t[73]!==Z||t[74]!==O?(Q=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,"aria-label":g,children:[O,te,Z]}),t[71]=n.filters,t[72]=te,t[73]=Z,t[74]=O,t[75]=Q):Q=t[75],Q}function Be(e){return(0,$.jsx)(`option`,{value:e,children:e},e)}function Ve(e){let t=(0,V.c)(20),{L:n,logs:r,loading:i,hasMore:a,onSelectLog:o,onLoadMore:s,onRefreshAll:c,onFilterByRequestId:l}=e,u;t[0]!==i||t[1]!==r.length?(u=i&&r.length===0?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-panel dark:divide-edge dark:border-edge`,"aria-busy":`true`,children:Array.from({length:8}).map(He)}):null,t[0]=i,t[1]=r.length,t[2]=u):u=t[2];let d;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==c?(d=!i&&r.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-edge-subtle bg-surface-base py-16 text-center dark:border-edge`,children:[(0,$.jsx)(S,{className:`size-12 text-fg-subtle`,strokeWidth:1.5,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.noLogs}),(0,$.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:n.noLogsDescription}),(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:c,children:[(0,$.jsx)(A,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=c,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==a||t[10]!==i||t[11]!==r||t[12]!==l||t[13]!==s||t[14]!==o?(f=r.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:[me(n.showingCount,{count:String(r.length)}),a?(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,n.moreAvailable]}):null]}),(0,$.jsx)(`ul`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-panel font-mono text-sm leading-6 dark:divide-edge dark:border-edge`,children:r.map(e=>{let t=e.level??`info`,r=typeof e.requestId==`string`?e.requestId.trim():``,i=Se(e),a=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:T(`flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,a&&`border-l-2 border-l-red-500/70`),children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0 tabular-nums text-fg-subtle`,children:_e(e.timestamp)}),(0,$.jsx)(`span`,{className:T(`w-[4.5rem] shrink-0 truncate`,a?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:xe(t)}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 truncate sm:w-[5.25rem]`,children:r?l?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),l(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l(r))},children:be(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:be(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 truncate text-fg-subtle xl:inline`,title:i===`—`?void 0:i,children:i===`—`?`—`:i}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 truncate text-fg-muted lg:inline`,title:he(e),children:he(e)}),(0,$.jsx)(`span`,{className:T(`min-w-0 flex-1 truncate`,`text-fg`),children:ge(e)})]})},Ce(e))})}),a?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:s,children:[i?(0,$.jsx)(A,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(h,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=a,t[10]=i,t[11]=r,t[12]=l,t[13]=s,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==u||t[17]!==d||t[18]!==f?(p=(0,$.jsxs)($.Fragment,{children:[u,d,f]}),t[16]=u,t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function He(e,t){return(0,$.jsxs)(`div`,{className:`flex gap-3 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`h-4 w-16 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-12 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-20 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 min-w-0 flex-1 bg-surface-hover motion-reduce:animate-none animate-pulse`})]},t)}function Ue(e){let t=(0,V.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=r):r=t[0];let i;t[1]===n.title?i=t[2]:(i=(0,$.jsx)(`h1`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.title}),t[1]=n.title,t[2]=i);let a;t[3]===n.needToken?a=t[4]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.needToken}),t[3]=n.needToken,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-10`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-edge-subtle bg-surface-base p-6 dark:border-edge`,children:[r,(0,$.jsxs)(`div`,{children:[i,a]})]})}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function We(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Ge(e){let t=[`timestamp`,`level`,`module`,`phase`,`requestId`,`sessionId`,`message`],n=e.map(e=>{let t=String(e.module||``),n=String(e.phase??e.meta?.phase??``);return[e.timestamp,e.level,t,n,e.requestId??``,e.sessionId??``,e.message??``].map(e=>We(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-q28QhI7l.js";import{a as s,n as c}from"./fetch-drJUxxKP.js";import{$o as l,Ar as u,Cr as d,Dr as f,Er as p,Ma as m,Mo as h,Mr as g,Nr as _,Oi as v,Or as y,Qr as b,Yi as x,ao as S,bn as C,ci as w,di as T,fo as E,fr as D,jr as O,kr as k,na as A,pi as j,ri as M,ro as N,to as P,ui as F,wr as I,xn as L,xo as R,yn as z}from"./index-CRDAmr3W.js";var B=e(t(),1),V=n();function ee(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.sessionId&&t.set(`sessionId`,e.sessionId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function H(e){return c(o(`/api/logs${ee(e)}`))}async function U(){return(await c(o(`/api/logs/files`))).files??[]}async function W(){return(await c(o(`/api/logs/modules`))).modules??[]}async function G(){let e=await c(o(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function K(){return(await c(o(`/api/logs/dir`))).dir??``}async function q(){return(await c(o(`/api/logs/level`))).level??`info`}async function J(e,t){return c(o(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function Y(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await c(o(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var X=500,te=class{_token;_callbacks;_eventSource;constructor(e,t){this._token=e,this._callbacks=t}connect(e,t){this.disconnect();let n=new URL(o(`/api/logs/stream`));this._token&&n.searchParams.set(`token`,this._token),e?.length?n.searchParams.set(`levels`,e.join(`,`)):n.searchParams.set(`levels`,`trace,debug,info,warn,error,fatal`),t&&n.searchParams.set(`module`,t),this._eventSource=new EventSource(n.toString()),this._eventSource.onmessage=e=>{try{let t=JSON.parse(String(e.data));if(t.type===`connected`){this._callbacks.onConnected();return}if(t.type===`heartbeat`)return;this._callbacks.onEntry(t)}catch{}},this._eventSource.onerror=()=>{this._eventSource?.readyState===EventSource.CLOSED&&this._callbacks.onError(`Log stream disconnected`)}}disconnect(){this._eventSource?.close(),this._eventSource=void 0}};function Z(e,t){let n=`${t.timestamp}-${t.requestId??``}-${t.message}`;return[t,...e.filter(e=>`${e.timestamp}-${e.requestId??``}-${e.message}`!==n)].slice(0,X)}var Q=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function ne(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function re(e){return e.toSorted((e,t)=>ne(t)-ne(e))}var ie=new Set(Q),ae=[`error`,`fatal`],oe=[`warn`,`error`,`fatal`],se=[`info`,`warn`,`error`,`fatal`];function ce(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();ie.has(e)&&t.add(e)}return t}function le(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ue(e,t){return e.size===t.length?t.every(t=>e.has(t)):!1}function de(e){return e.size===0?`all`:ue(e,ae)?`errors`:ue(e,oe)?`warnPlus`:ue(e,se)?`infoPlus`:e.size===Q.length&&Q.every(t=>e.has(t))?`verbose`:`custom`}function fe(e){let t=de(e);return t===`custom`?`other`:t}function pe(e){switch(e){case`all`:return new Set;case`errors`:return new Set(ae);case`warnPlus`:return new Set(oe);case`infoPlus`:return new Set(se);case`verbose`:return new Set(Q)}}function me(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function he(e){return String(e.module||e.service||e.extension||`—`)}function ge(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function _e(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function ve(e){try{return new Date(e).toLocaleString()}catch{return e}}function ye(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function be(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function xe(e){return String(e).toLowerCase()}function Se(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function Ce(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function we(e){let t=e.err??e.meta?.err;if(!t||typeof t!=`object`)return null;let n=t;return{name:typeof n.name==`string`?n.name:void 0,message:typeof n.message==`string`?n.message:void 0,stack:typeof n.stack==`string`?n.stack:void 0}}function Te(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&he(e)!==t.moduleFilter||t.requestIdFilter&&e.requestId!==t.requestIdFilter||t.sessionIdFilter&&e.sessionId!==t.sessionIdFilter)return!1;if(t.dateFrom){let n=new Date(t.dateFrom).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r<n)return!1}if(t.dateTo){let n=new Date(t.dateTo).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r>n)return!1}if(t.debouncedSearch){let n=t.debouncedSearch.toLowerCase();if(![e.message,he(e),Se(e),e.requestId,e.sessionId,we(e)?.message,we(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function Ee(e,t){let n=[];for(let r of Q){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function De(e,t){switch(t.type){case`setSearchInput`:return e.searchInput===t.value?e:{...e,searchInput:t.value};case`setDebouncedSearch`:return e.debouncedSearch===t.value?e:{...e,debouncedSearch:t.value};case`setLevels`:return le(e.selectedLevels,t.value)?e:{...e,selectedLevels:t.value};case`toggleLevel`:{let n=new Set(e.selectedLevels);return n.has(t.level)?n.delete(t.level):n.add(t.level),{...e,selectedLevels:n}}case`setModule`:return e.moduleFilter===t.value?e:{...e,moduleFilter:t.value};case`setRequestIdFilter`:return e.requestIdFilter===t.value?e:{...e,requestIdFilter:t.value};case`setSessionIdFilter`:return e.sessionIdFilter===t.value?e:{...e,sessionIdFilter:t.value};case`setDateFrom`:return e.dateFrom===t.value?e:{...e,dateFrom:t.value};case`setDateTo`:return e.dateTo===t.value?e:{...e,dateTo:t.value};case`setAutoRefresh`:return e.autoRefresh===t.value?e:{...e,autoRefresh:t.value};case`syncFromUrl`:{let n=t.payload;return e.searchInput===n.searchInput&&e.debouncedSearch===n.debouncedSearch&&le(e.selectedLevels,n.selectedLevels)&&e.moduleFilter===n.moduleFilter&&e.requestIdFilter===n.requestIdFilter&&e.sessionIdFilter===n.sessionIdFilter&&e.dateFrom===n.dateFrom&&e.dateTo===n.dateTo&&e.autoRefresh===n.autoRefresh?e:{...e,...n}}case`clearAll`:return{searchInput:``,debouncedSearch:``,selectedLevels:new Set,moduleFilter:``,requestIdFilter:``,sessionIdFilter:``,dateFrom:``,dateTo:``,autoRefresh:e.autoRefresh}}}var Oe={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function ke(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:re(t.logs),hasMore:t.hasMore};case`queryError`:return t.resetLogs?{...e,loading:!1,error:t.message,logs:[],hasMore:!1}:{...e,loading:!1,error:t.message};case`appendSuccess`:return{...e,loading:!1,logs:re([...e.logs,...t.logs]),hasMore:t.hasMore};case`metaSuccess`:return{...e,modules:t.modules,stats:t.stats,files:t.files};case`filesSuccess`:return{...e,files:t.files,logDir:t.logDir};case`filesClear`:return{...e,files:[]};case`liveTick`:return{...e,logs:re(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:re(Z(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:re(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Ae(e){let t=a(e).logs,n=s(e=>e.token),r=!!n,[i,o]=l(),c=(0,B.useRef)(i),[u,d]=(0,B.useReducer)(De,void 0,()=>{let e=c.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:ce(e.get(`level`)),moduleFilter:e.get(`module`)??``,requestIdFilter:e.get(`requestId`)??``,sessionIdFilter:e.get(`sessionId`)??``,dateFrom:e.get(`from`)??``,dateTo:e.get(`to`)??``,autoRefresh:e.get(`live`)===`1`}}),[f,p]=(0,B.useReducer)(ke,Oe),[m,h]=(0,B.useState)(null),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)(null),[S,C]=(0,B.useState)([]),[w,T]=(0,B.useState)(!1),{searchInput:E,debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,dateTo:N,autoRefresh:P}=u,{logs:F,loading:I,error:L,hasMore:R,modules:z,files:V,stats:ee,logDir:q}=f,J=(0,B.useCallback)(e=>d({type:`setSearchInput`,value:e}),[]),X=(0,B.useCallback)(e=>d({type:`setLevels`,value:e}),[]),Z=(0,B.useCallback)(e=>d({type:`setModule`,value:e}),[]),Q=(0,B.useCallback)(e=>d({type:`setRequestIdFilter`,value:e}),[]),ne=(0,B.useCallback)(e=>d({type:`setSessionIdFilter`,value:e}),[]),re=(0,B.useCallback)(e=>d({type:`setDateFrom`,value:e}),[]),ie=(0,B.useCallback)(e=>d({type:`setDateTo`,value:e}),[]),ae=(0,B.useCallback)(e=>d({type:`setAutoRefresh`,value:e}),[]),oe=(0,B.useMemo)(()=>fe(O),[O]),se=e=>{if(e===`other`){y(!0);return}d({type:`setLevels`,value:pe(e)})},le=D.length>0||O.size>0||!!k||!!A||!!j||!!M||!!N,ue=+(D.length>0)+ +(O.size>0)+ +!!k+ +!!A+ +!!j+(M||N?1:0);(0,B.useEffect)(()=>{let e=setTimeout(()=>d({type:`setDebouncedSearch`,value:E.trim()}),300);return()=>clearTimeout(e)},[E]),(0,B.useEffect)(()=>{let e=i.get(`q`)??``;d({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:ce(i.get(`level`)),moduleFilter:i.get(`module`)??``,requestIdFilter:i.get(`requestId`)??``,sessionIdFilter:i.get(`sessionId`)??``,dateFrom:i.get(`from`)??``,dateTo:i.get(`to`)??``,autoRefresh:i.get(`live`)===`1`}})},[i]),(0,B.useEffect)(()=>{let e=new URLSearchParams(i),t=D.trim();t?e.set(`q`,t):e.delete(`q`),O.size>0?e.set(`level`,Array.from(O).sort().join(`,`)):e.delete(`level`),k?e.set(`module`,k):e.delete(`module`),A?e.set(`requestId`,A):e.delete(`requestId`),j?e.set(`sessionId`,j):e.delete(`sessionId`),M?e.set(`from`,M):e.delete(`from`),N?e.set(`to`,N):e.delete(`to`),P?e.set(`live`,`1`):e.delete(`live`),e.toString()!==i.toString()&&o(e,{replace:!0})},[P,M,N,D,k,A,j,i,O,o]);let de=(0,B.useMemo)(()=>({q:D||void 0,level:O.size>0?Array.from(O):void 0,module:k||void 0,requestId:A||void 0,sessionId:j||void 0,from:M||void 0,to:N||void 0,limit:50}),[D,O,k,A,j,M,N]),me=(0,B.useMemo)(()=>({debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,dateTo:N}),[D,O,k,A,j,M,N]),he=(0,B.useRef)(me);return he.current=me,(0,B.useEffect)(()=>{if(!r)return;let e=!1;return T(!0),Y({from:M||void 0,to:N||void 0,limit:12}).then(t=>{e||C(t)}).catch(()=>{e||C([])}).finally(()=>{e||T(!1)}),()=>{e=!0}},[r,M,N]),(0,B.useEffect)(()=>{if(!r)return;let e=!1;return p({type:`queryStart`}),(async()=>{try{let t=await H({...de,offset:0});if(e)return;p({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||p({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,B.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([W(),G(),U()]);e||p({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,B.useEffect)(()=>{if(!r||!g)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([U(),K()]);e||p({type:`filesSuccess`,files:t,logDir:n})}catch{e||p({type:`filesClear`})}})(),()=>{e=!0}},[r,g]),(0,B.useEffect)(()=>{if(!P||!r)return;let e=new te(n??void 0,{onConnected:()=>{},onEntry:e=>{Te(e,he.current)&&p({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(O.size>0?Array.from(O):void 0,k||void 0);let t=window.setInterval(()=>{G().then(e=>{p({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[P,r,n,O,k]),(0,B.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>x(null),2e3);return()=>clearTimeout(e)},[b]),{L:t,hasToken:r,logs:F,loading:I,error:L,hasMore:R,searchInput:E,setSearchInput:J,selectedLevels:O,setSelectedLevels:X,moduleFilter:k,setModuleFilter:Z,requestIdFilter:A,sessionIdFilter:j,dateFrom:M,setDateFrom:re,dateTo:N,setDateTo:ie,modules:z,files:V,stats:ee,selectedLog:m,setSelectedLog:h,filesOpen:g,setFilesOpen:_,filtersOpen:v,setFiltersOpen:y,logDir:q,autoRefresh:P,setAutoRefresh:ae,copiedDetail:b,setCopiedDetail:x,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>d({type:`clearAll`}),toggleDialogLevel:e=>d({type:`toggleLevel`,level:e}),handleLoadMore:()=>{I||!R||(async()=>{p({type:`queryStart`});try{let e=await H({...de,offset:F.length});p({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{p({type:`queryStart`});try{let e=await H({...de,offset:0}),[t,n]=await Promise.all([G(),U()]);p({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:oe,handleLevelSegment:se,filterByRequestId:(0,B.useCallback)(e=>{h(null),Q(e)},[Q]),filterBySessionId:(0,B.useCallback)(e=>{h(null),ne(e)},[ne]),filterByErrorSummary:(0,B.useCallback)(e=>{d({type:`setSearchInput`,value:e.errName}),d({type:`setDebouncedSearch`,value:e.errName}),e.module&&d({type:`setModule`,value:e.module}),d({type:`setLevels`,value:pe(`errors`)})},[]),openChatForSession:(0,B.useCallback)(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e}}))},[]),errorSummary:S,errorSummaryLoading:w}}var $=r();function je(e){let t=(0,V.c)(37),{L:n,items:r,loading:i,onSelectItem:a}=e,[o,s]=(0,B.useState)(!1);if(!i&&r.length===0)return null;let c;t[0]===r?c=t[1]:(c=r.reduce(Ne,0),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(Me),t[2]=u):u=t[2];let d;t[3]===n.errorSummaryTitle?d=t[4]:(d=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=d);let f;t[5]===n.errorSummaryHint?f=t[6]:(f=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==n.loading||t[11]!==r.length||t[12]!==i||t[13]!==l?(m=i?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n.loading}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:r.length}),(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-hover px-2 py-0.5 text-xs tabular-nums text-fg-muted`,children:[`×`,l]})]}),t[10]=n.loading,t[11]=r.length,t[12]=i,t[13]=l,t[14]=m):m=t[14];let g=o&&`rotate-180`,_;t[15]===g?_=t[16]:(_=T(`size-4 text-fg-muted transition-transform duration-150 ease-out motion-reduce:transition-none`,g),t[15]=g,t[16]=_);let v;t[17]===_?v=t[18]:(v=(0,$.jsx)(h,{className:_,strokeWidth:1.75,"aria-hidden":!0}),t[17]=_,t[18]=v);let y;t[19]!==m||t[20]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[m,v]}),t[19]=m,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==o||t[23]!==y||t[24]!==p?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:u,"aria-expanded":o,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset`,children:[p,y]}),t[22]=o,t[23]=y,t[24]=p,t[25]=b):b=t[25];let x;t[26]!==n.module||t[27]!==n.phase||t[28]!==n.time||t[29]!==o||t[30]!==r||t[31]!==i||t[32]!==a?(x=o&&!i&&r.length>0?(0,$.jsx)(`ul`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle dark:divide-edge dark:border-edge`,children:r.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a?.(e),className:T(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,a&&`cursor-pointer`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.errName}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:[`×`,e.count]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[e.phase?(0,$.jsxs)(`span`,{children:[n.phase,`: `,e.phase]}):null,e.module?(0,$.jsxs)(`span`,{children:[n.module,`: `,e.module]}):null,(0,$.jsxs)(`span`,{children:[n.time,`: `,_e(e.lastSeen)]})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.sampleMessage})]})},e.key))}):null,t[26]=n.module,t[27]=n.phase,t[28]=n.time,t[29]=o,t[30]=r,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;return t[34]!==b||t[35]!==x?(S=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel dark:border-edge`,children:[b,x]}),t[34]=b,t[35]=x,t[36]=S):S=t[36],S}function Me(e){return!e}function Ne(e,t){return e+t.count}function Pe(e){let t=(0,V.c)(69),{log:n,labels:r,onFilterByRequestId:i,onFilterBySessionId:a,onOpenChat:o}=e,s=n.level??`info`,c=typeof n.requestId==`string`?n.requestId:``,l=typeof n.sessionId==`string`?n.sessionId:``,u;t[0]===n?u=t[1]:(u=Se(n),t[0]=n,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=we(n),t[2]=n,t[3]=f);let p=f,m=s===`error`||s===`fatal`,h;t[4]===r.message?h=t[5]:(h=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=h);let g=m&&`border-red-500/40`,_;t[6]===g?_=t[7]:(_=T(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,g),t[6]=g,t[7]=_);let v=n.message||`—`,y;t[8]!==_||t[9]!==v?(y=(0,$.jsx)(`pre`,{className:_,children:v}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let b;t[11]!==h||t[12]!==y?(b=(0,$.jsxs)(`div`,{children:[h,y]}),t[11]=h,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==p||t[15]!==r.stackTrace?(x=p?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),p.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:p.name}):null,(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-red-500/30 bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-red-500/30`,children:p.stack})]}):null,t[14]=p,t[15]=r.stackTrace,t[16]=x):x=t[16];let S;t[17]===r.time?S=t[18]:(S=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=S);let C;t[19]===n.timestamp?C=t[20]:(C=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=C);let w;t[21]===r.level?w=t[22]:(w=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=w);let E=m&&`font-medium text-red-600 dark:text-red-400`,D;t[23]===E?D=t[24]:(D=T(`text-fg`,E),t[23]=E,t[24]=D);let O;t[25]===s?O=t[26]:(O=xe(s),t[25]=s,t[26]=O);let k;t[27]!==D||t[28]!==O?(k=(0,$.jsx)(`span`,{className:D,children:O}),t[27]=D,t[28]=O,t[29]=k):k=t[29];let A;t[30]===r.module?A=t[31]:(A=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=A);let j;t[32]===n?j=t[33]:(j=he(n),t[32]=n,t[33]=j);let M;t[34]===j?M=t[35]:(M=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:j}),t[34]=j,t[35]=M);let N;t[36]!==r.phase||t[37]!==d?(N=d===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.phase}),(0,$.jsx)(`code`,{className:`break-all text-fg`,children:d})]}),t[36]=r.phase,t[37]=d,t[38]=N):N=t[38];let P;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==c?(P=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.requestId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:c}),i?(0,$.jsx)(F,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(c),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=c,t[43]=P):P=t[43];let I;t[44]!==r.filterBySessionId||t[45]!==r.openChat||t[46]!==r.sessionId||t[47]!==a||t[48]!==o||t[49]!==l?(I=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.sessionId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:l}),a?(0,$.jsx)(F,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>a(l),children:r.filterBySessionId}):null,o?(0,$.jsx)(F,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o(l),children:r.openChat}):null]})]}):null,t[44]=r.filterBySessionId,t[45]=r.openChat,t[46]=r.sessionId,t[47]=a,t[48]=o,t[49]=l,t[50]=I):I=t[50];let L;t[51]!==S||t[52]!==C||t[53]!==w||t[54]!==k||t[55]!==A||t[56]!==M||t[57]!==N||t[58]!==P||t[59]!==I?(L=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[S,C,w,k,A,M,N,P,I]}),t[51]=S,t[52]=C,t[53]=w,t[54]=k,t[55]=A,t[56]=M,t[57]=N,t[58]=P,t[59]=I,t[60]=L):L=t[60];let R;t[61]!==r.metadata||t[62]!==n.meta?(R=n.meta&&Object.keys(n.meta).length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.metadata}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,children:JSON.stringify(n.meta,null,2)})]}):null,t[61]=r.metadata,t[62]=n.meta,t[63]=R):R=t[63];let z;return t[64]!==L||t[65]!==R||t[66]!==b||t[67]!==x?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[b,x,L,R]}),t[64]=L,t[65]=R,t[66]=b,t[67]=x,t[68]=z):z=t[68],z}function Fe(e){let t=(0,V.c)(49),{L:n,log:r,onClose:i,copiedDetail:a,onCopiedMessage:o,onCopiedJson:s,onFilterByRequestId:c,onFilterBySessionId:l,onOpenChat:u}=e,m=r!==null,h;t[0]===i?h=t[1]:(h=e=>!e&&i(),t[0]=i,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(p,{className:T(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[2]=g):g=t[2];let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=T(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,z,`dark:border-edge`),t[3]=_):_=t[3];let v;t[4]===n.details?v=t[5]:(v=(0,$.jsx)(k,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=v);let x;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==a||t[10]!==r||t[11]!==s||t[12]!==o?(x=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{b(typeof r.message==`string`?r.message:``).then(e=>{e&&o()})},children:[(0,$.jsx)(R,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{b(JSON.stringify(r,null,2)).then(e=>{e&&s()})},children:[(0,$.jsx)(R,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=a,t[10]=r,t[11]=s,t[12]=o,t[13]=x):x=t[13];let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[14]=S):S=t[14];let w;t[15]===n.close?w=t[16]:(w=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:S})}),t[15]=n.close,t[16]=w);let E;t[17]!==x||t[18]!==w?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[x,w]}),t[17]=x,t[18]=w,t[19]=E):E=t[19];let D;t[20]!==v||t[21]!==E?(D=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[v,E]}),t[20]=v,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==n.filterByRequestId||t[24]!==n.filterBySessionId||t[25]!==n.level||t[26]!==n.message||t[27]!==n.metadata||t[28]!==n.module||t[29]!==n.openChat||t[30]!==n.phase||t[31]!==n.requestId||t[32]!==n.sessionId||t[33]!==n.stackTrace||t[34]!==n.time||t[35]!==r||t[36]!==c||t[37]!==l||t[38]!==u?(O=r?(0,$.jsx)(Pe,{log:r,labels:{time:n.time,level:n.level,module:n.module,message:n.message,metadata:n.metadata,requestId:n.requestId,sessionId:n.sessionId,phase:n.phase,stackTrace:n.stackTrace,filterByRequestId:n.filterByRequestId,filterBySessionId:n.filterBySessionId,openChat:n.openChat},onFilterByRequestId:c,onFilterBySessionId:l,onOpenChat:u}):null,t[23]=n.filterByRequestId,t[24]=n.filterBySessionId,t[25]=n.level,t[26]=n.message,t[27]=n.metadata,t[28]=n.module,t[29]=n.openChat,t[30]=n.phase,t[31]=n.requestId,t[32]=n.sessionId,t[33]=n.stackTrace,t[34]=n.time,t[35]=r,t[36]=c,t[37]=l,t[38]=u,t[39]=O):O=t[39];let A;t[40]===O?A=t[41]:(A=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:O}),t[40]=O,t[41]=A);let M;t[42]!==D||t[43]!==A?(M=(0,$.jsxs)(f,{children:[g,(0,$.jsxs)(I,{className:_,"aria-describedby":void 0,children:[D,A]})]}),t[42]=D,t[43]=A,t[44]=M):M=t[44];let N;return t[45]!==m||t[46]!==M||t[47]!==h?(N=(0,$.jsx)(y,{open:m,onOpenChange:h,children:M}),t[45]=m,t[46]=M,t[47]=h,t[48]=N):N=t[48],N}function Ie(e){let t=(0,V.c)(25),{L:n,open:r,onOpenChange:i,files:a,logDir:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(p,{className:T(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=T(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,85vh)] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,z,`dark:border-edge`),t[1]=c):c=t[1];let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(N,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=l):l=t[2];let u;t[3]===n.logFiles?u=t[4]:(u=(0,$.jsxs)(k,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[l,n.logFiles]}),t[3]=n.logFiles,t[4]=u);let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[5]=m):m=t[5];let h;t[6]===n.close?h=t[7]:(h=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:m})}),t[6]=n.close,t[7]=h);let g;t[8]!==u||t[9]!==h?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[u,h]}),t[8]=u,t[9]=h,t[10]=g):g=t[10];let _;t[11]!==n.filesEmpty||t[12]!==a?(_=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:a.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(Le)})}),t[11]=n.filesEmpty,t[12]=a,t[13]=_):_=t[13];let v;t[14]!==n.logDir||t[15]!==o?(v=o?(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2 text-xs text-fg-subtle dark:border-edge`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[n.logDir,`: `]}),(0,$.jsx)(`code`,{className:`break-all text-fg-subtle`,children:o})]}):null,t[14]=n.logDir,t[15]=o,t[16]=v):v=t[16];let b;t[17]!==g||t[18]!==_||t[19]!==v?(b=(0,$.jsxs)(f,{children:[s,(0,$.jsxs)(I,{className:c,children:[g,_,v]})]}),t[17]=g,t[18]=_,t[19]=v,t[20]=b):b=t[20];let x;return t[21]!==i||t[22]!==r||t[23]!==b?(x=(0,$.jsx)(y,{open:r,onOpenChange:i,children:b}),t[21]=i,t[22]=r,t[23]=b,t[24]=x):x=t[24],x}function Le(e){return(0,$.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-xs text-fg`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ye(e.size)}),(0,$.jsx)(`span`,{children:ve(e.modified)})]})]},e.name)}function Re(e){let t=(0,V.c)(68),{L:n,open:r,onOpenChange:i,dateFrom:a,onDateFromChange:o,dateTo:s,onDateToChange:c,selectedLevels:l,onToggleLevel:u}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(p,{className:T(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=T(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,90vh)] w-[min(100%-2rem,22rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,z,`dark:border-edge`),t[1]=h):h=t[1];let g;t[2]===n.filtersDialogTitle?g=t[3]:(g=(0,$.jsx)(k,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=g);let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[4]=_):_=t[4];let v;t[5]===n.close?v=t[6]:(v=(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:_})}),t[5]=n.close,t[6]=v);let b;t[7]!==g||t[8]!==v?(b=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[g,v]}),t[7]=g,t[8]=v,t[9]=b):b=t[9];let x;t[10]===n.filtersDialogDesc?x=t[11]:(x=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=x);let S;t[12]===n.timeRange?S=t[13]:(S=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=S);let w;t[14]===n.from?w=t[15]:(w=(0,$.jsx)(`label`,{htmlFor:`log-from-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.from}),t[14]=n.from,t[15]=w);let E;t[16]===o?E=t[17]:(E=e=>o(e.target.value),t[16]=o,t[17]=E);let D;t[18]!==a||t[19]!==E?(D=(0,$.jsx)(`input`,{id:`log-from-d`,type:`datetime-local`,value:a,onChange:E,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[18]=a,t[19]=E,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==w?(O=(0,$.jsxs)(`div`,{children:[w,D]}),t[21]=D,t[22]=w,t[23]=O):O=t[23];let A;t[24]===n.to?A=t[25]:(A=(0,$.jsx)(`label`,{htmlFor:`log-to-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.to}),t[24]=n.to,t[25]=A);let M;t[26]===c?M=t[27]:(M=e=>c(e.target.value),t[26]=c,t[27]=M);let N;t[28]!==s||t[29]!==M?(N=(0,$.jsx)(`input`,{id:`log-to-d`,type:`datetime-local`,value:s,onChange:M,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[28]=s,t[29]=M,t[30]=N):N=t[30];let P;t[31]!==A||t[32]!==N?(P=(0,$.jsxs)(`div`,{children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let L;t[34]!==O||t[35]!==P?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[O,P]}),t[34]=O,t[35]=P,t[36]=L):L=t[36];let R;t[37]===n.levelCustom?R=t[38]:(R=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[37]=n.levelCustom,t[38]=R);let B;t[39]===n.levelCustomHint?B=t[40]:(B=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[39]=n.levelCustomHint,t[40]=B);let ee=n.level,H;t[41]!==n.levelNames||t[42]!==u||t[43]!==l?(H=Q.map(e=>(0,$.jsx)(`button`,{type:`button`,className:T(`rounded-full border px-3 py-1.5 text-xs font-medium capitalize transition-[color,background-color,border-color] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,l.has(e)?`border-edge bg-surface-active text-fg dark:border-edge`:`border-edge-subtle bg-surface-base text-fg-muted hover:bg-surface-hover dark:border-edge`),onClick:()=>u(e),children:n.levelNames[e]},e)),t[41]=n.levelNames,t[42]=u,t[43]=l,t[44]=H):H=t[44];let U;t[45]!==n.level||t[46]!==H?(U=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":ee,children:H}),t[45]=n.level,t[46]=H,t[47]=U):U=t[47];let W;t[48]!==L||t[49]!==R||t[50]!==B||t[51]!==U||t[52]!==S?(W=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[S,L,R,B,U]}),t[48]=L,t[49]=R,t[50]=B,t[51]=U,t[52]=S,t[53]=W):W=t[53];let G;t[54]===i?G=t[55]:(G=()=>i(!1),t[54]=i,t[55]=G);let K;t[56]!==n.filtersDone||t[57]!==G?(K=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(F,{type:`button`,className:`w-full rounded-xl`,onClick:G,children:n.filtersDone})}),t[56]=n.filtersDone,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==W||t[60]!==K||t[61]!==b||t[62]!==x?(q=(0,$.jsxs)(f,{children:[m,(0,$.jsxs)(I,{className:h,"aria-describedby":`log-filters-desc`,children:[b,x,W,K]})]}),t[59]=W,t[60]=K,t[61]=b,t[62]=x,t[63]=q):q=t[63];let J;return t[64]!==i||t[65]!==r||t[66]!==q?(J=(0,$.jsx)(y,{open:r,onOpenChange:i,children:q}),t[64]=i,t[65]=r,t[66]=q,t[67]=J):J=t[67],J}function ze(e){let t=(0,V.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:a,onSearchInputChange:o,moduleFilter:s,onModuleFilterChange:c,modules:l,onOpenFilters:u,activeFilterCount:d,hasActiveFilters:f,onClearFilters:p,autoRefresh:h}=e,g=n.filters,_;t[0]===n.presetAll?_=t[1]:(_={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=_);let v;t[2]===n.presetErrors?v=t[3]:(v={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=v);let y;t[4]===n.presetWarnPlus?y=t[5]:(y={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=y);let b;t[6]===n.presetInfoPlus?b=t[7]:(b={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=b);let S;t[8]===n.presetVerbose?S=t[9]:(S={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=S);let C;t[10]===n.presetOther?C=t[11]:(C={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=C);let E;t[12]!==_||t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==S||t[17]!==C?(E=[_,v,y,b,S,C],t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=S,t[17]=C,t[18]=E):E=t[18];let O;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==E?(O=(0,$.jsx)(`div`,{className:`overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsx)(`div`,{className:`min-w-[min(100%,36rem)]`,children:(0,$.jsx)(D,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:E,buttonClassName:`h-8 px-1.5 text-[11px] sm:px-2 sm:text-xs`})})}),t[19]=n.levelPresetAria,t[20]=r,t[21]=i,t[22]=E,t[23]=O):O=t[23];let k;t[24]===n.searchPlaceholder?k=t[25]:(k=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[26]=A):A=t[26];let N;t[27]===o?N=t[28]:(N=e=>o(e.target.value),t[27]=o,t[28]=N);let P=n.searchPlaceholder,I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=T(`h-10 w-full rounded-md border border-edge bg-surface-panel py-0 pl-10 pr-3 text-sm leading-5 text-fg placeholder:text-fg-subtle dark:border-edge`,M),t[29]=I):I=t[29];let L;t[30]!==n.searchPlaceholder||t[31]!==a||t[32]!==N?(L=(0,$.jsx)(`input`,{type:`search`,value:a,onChange:N,placeholder:P,autoComplete:`off`,spellCheck:!1,className:I}),t[30]=n.searchPlaceholder,t[31]=a,t[32]=N,t[33]=L):L=t[33];let R;t[34]!==k||t[35]!==L?(R=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[k,A,L]}),t[34]=k,t[35]=L,t[36]=R):R=t[36];let z;t[37]===c?z=t[38]:(z=e=>c(e.target.value),t[37]=c,t[38]=z);let B=n.module,ee=n.module,H;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=T(w,`h-10 w-full min-w-0 rounded-md py-0 sm:w-[min(100%,14rem)] sm:shrink-0`),t[39]=H):H=t[39];let U;t[40]===n.allModules?U=t[41]:(U=(0,$.jsx)(`option`,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=U);let W;t[42]===l?W=t[43]:(W=l.map(Be),t[42]=l,t[43]=W);let G;t[44]!==n.module||t[45]!==s||t[46]!==z||t[47]!==U||t[48]!==W?(G=(0,$.jsxs)(`select`,{id:`log-module`,value:s,onChange:z,"aria-label":B,title:ee,className:H,children:[U,W]}),t[44]=n.module,t[45]=s,t[46]=z,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(m,{className:`size-4`,strokeWidth:1.75}),t[50]=K):K=t[50];let q;t[51]===d?q=t[52]:(q=d>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:d}):null,t[51]=d,t[52]=q);let J;t[53]!==n.filtersMore||t[54]!==u||t[55]!==q?(J=(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:u,children:[K,n.filtersMore,q]}),t[53]=n.filtersMore,t[54]=u,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==f||t[59]!==p?(Y=f?(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:p,children:[(0,$.jsx)(j,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=f,t[59]=p,t[60]=Y):Y=t[60];let X;t[61]!==J||t[62]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[J,Y]}),t[61]=J,t[62]=Y,t[63]=X):X=t[63];let te;t[64]!==R||t[65]!==G||t[66]!==X?(te=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[R,G,X]}),t[64]=R,t[65]=G,t[66]=X,t[67]=te):te=t[67];let Z;t[68]!==n.liveHint||t[69]!==h?(Z=h?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=h,t[70]=Z):Z=t[70];let Q;return t[71]!==n.filters||t[72]!==te||t[73]!==Z||t[74]!==O?(Q=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,"aria-label":g,children:[O,te,Z]}),t[71]=n.filters,t[72]=te,t[73]=Z,t[74]=O,t[75]=Q):Q=t[75],Q}function Be(e){return(0,$.jsx)(`option`,{value:e,children:e},e)}function Ve(e){let t=(0,V.c)(20),{L:n,logs:r,loading:i,hasMore:a,onSelectLog:o,onLoadMore:s,onRefreshAll:c,onFilterByRequestId:l}=e,u;t[0]!==i||t[1]!==r.length?(u=i&&r.length===0?(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-panel dark:divide-edge dark:border-edge`,"aria-busy":`true`,children:Array.from({length:8}).map(He)}):null,t[0]=i,t[1]=r.length,t[2]=u):u=t[2];let d;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==c?(d=!i&&r.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-edge-subtle bg-surface-base py-16 text-center dark:border-edge`,children:[(0,$.jsx)(S,{className:`size-12 text-fg-subtle`,strokeWidth:1.5,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.noLogs}),(0,$.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:n.noLogsDescription}),(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:c,children:[(0,$.jsx)(A,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=c,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==a||t[10]!==i||t[11]!==r||t[12]!==l||t[13]!==s||t[14]!==o?(f=r.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:[me(n.showingCount,{count:String(r.length)}),a?(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,n.moreAvailable]}):null]}),(0,$.jsx)(`ul`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge bg-surface-panel font-mono text-sm leading-6 dark:divide-edge dark:border-edge`,children:r.map(e=>{let t=e.level??`info`,r=typeof e.requestId==`string`?e.requestId.trim():``,i=Se(e),a=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:T(`flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,a&&`border-l-2 border-l-red-500/70`),children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0 tabular-nums text-fg-subtle`,children:_e(e.timestamp)}),(0,$.jsx)(`span`,{className:T(`w-[4.5rem] shrink-0 truncate`,a?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:xe(t)}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 truncate sm:w-[5.25rem]`,children:r?l?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),l(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l(r))},children:be(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:be(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 truncate text-fg-subtle xl:inline`,title:i===`—`?void 0:i,children:i===`—`?`—`:i}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 truncate text-fg-muted lg:inline`,title:he(e),children:he(e)}),(0,$.jsx)(`span`,{className:T(`min-w-0 flex-1 truncate`,`text-fg`),children:ge(e)})]})},Ce(e))})}),a?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:s,children:[i?(0,$.jsx)(A,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(h,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=a,t[10]=i,t[11]=r,t[12]=l,t[13]=s,t[14]=o,t[15]=f):f=t[15];let p;return t[16]!==u||t[17]!==d||t[18]!==f?(p=(0,$.jsxs)($.Fragment,{children:[u,d,f]}),t[16]=u,t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function He(e,t){return(0,$.jsxs)(`div`,{className:`flex gap-3 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`h-4 w-16 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-12 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-20 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 min-w-0 flex-1 bg-surface-hover motion-reduce:animate-none animate-pulse`})]},t)}function Ue(e){let t=(0,V.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=r):r=t[0];let i;t[1]===n.title?i=t[2]:(i=(0,$.jsx)(`h1`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.title}),t[1]=n.title,t[2]=i);let a;t[3]===n.needToken?a=t[4]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.needToken}),t[3]=n.needToken,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-10`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-edge-subtle bg-surface-base p-6 dark:border-edge`,children:[r,(0,$.jsxs)(`div`,{children:[i,a]})]})}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function We(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Ge(e){let t=[`timestamp`,`level`,`module`,`phase`,`requestId`,`sessionId`,`message`],n=e.map(e=>{let t=String(e.module||``),n=String(e.phase??e.meta?.phase??``);return[e.timestamp,e.level,t,n,e.requestId??``,e.sessionId??``,e.message??``].map(e=>We(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
|
|
2
2
|
`)}function Ke(e,t,n){let r=new Blob([e],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,a.click(),URL.revokeObjectURL(i)}function qe(e,t){let n=new Date().toISOString().replace(/[:.]/g,`-`);if(t===`json`){Ke(JSON.stringify(e,null,2),`xopc-logs-${n}.json`,`application/json`);return}Ke(Ge(e),`xopc-logs-${n}.csv`,`text/csv;charset=utf-8`)}function Je(e){let t=(0,V.c)(32),{L:n,logs:r,disabled:i}=e,a=i||r.length===0,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(E,{className:`size-4`,strokeWidth:1.75}),t[0]=o):o=t[0];let s;t[1]===n.exportLogs?s=t[2]:(s=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.exportLogs}),t[1]=n.exportLogs,t[2]=s);let c;t[3]!==n.exportLogs||t[4]!==a||t[5]!==s?(c=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`h-9 gap-2 px-3 text-xs`,disabled:a,title:n.exportLogs,children:[o,s]})}),t[3]=n.exportLogs,t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=T(`w-52 rounded-xl border border-edge bg-surface-panel p-2 shadow-popover outline-none`,L,`dark:border-edge`),t[7]=l):l=t[7];let d;t[8]===n.exportLogs?d=t[9]:(d=(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-fg`,children:n.exportLogs}),t[8]=n.exportLogs,t[9]=d);let f;t[10]===n.exportHint?f=t[11]:(f=(0,$.jsx)(`p`,{className:`px-2 pb-2 text-xs leading-5 text-fg-muted`,children:n.exportHint}),t[10]=n.exportHint,t[11]=f);let p;t[12]===r?p=t[13]:(p=()=>qe(r,`json`),t[12]=r,t[13]=p);let m;t[14]!==n.exportJson||t[15]!==p?(m=(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:p,children:n.exportJson}),t[14]=n.exportJson,t[15]=p,t[16]=m):m=t[16];let h;t[17]===r?h=t[18]:(h=()=>qe(r,`csv`),t[17]=r,t[18]=h);let v;t[19]!==n.exportCsv||t[20]!==h?(v=(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:h,children:n.exportCsv}),t[19]=n.exportCsv,t[20]=h,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==m?(y=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[m,v]}),t[22]=v,t[23]=m,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==d||t[27]!==f?(b=(0,$.jsx)(O,{children:(0,$.jsxs)(u,{side:`bottom`,align:`end`,sideOffset:6,className:l,children:[d,f,y]})}),t[25]=y,t[26]=d,t[27]=f,t[28]=b):b=t[28];let x;return t[29]!==b||t[30]!==c?(x=(0,$.jsxs)(g,{children:[c,b]}),t[29]=b,t[30]=c,t[31]=x):x=t[31],x}function Ye(e){let t=(0,V.c)(38),{L:n}=e,[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(`info`),[s,c]=(0,B.useState)(!1),[l,d]=(0,B.useState)(null),f,p;t[0]!==n.logLevelLoadError||t[1]!==r?(f=()=>{if(!r)return;let e=!1;return q().then(t=>{e||o(t)}).catch(t=>{e||d(t instanceof Error?t.message:n.logLevelLoadError)}),()=>{e=!0}},p=[r,n.logLevelLoadError],t[0]=n.logLevelLoadError,t[1]=r,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,B.useEffect)(f,p);let m;t[4]===n.logLevelSaveError?m=t[5]:(m=e=>{c(!0),d(null),J(e).then(e=>{o(e.current),i(!1)}).catch(e=>{d(e instanceof Error?e.message:n.logLevelSaveError)}).finally(()=>c(!1))},t[4]=n.logLevelSaveError,t[5]=m);let h=m,v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(P,{className:`size-4`,strokeWidth:1.75}),t[6]=v):v=t[6];let y;t[7]===n.logLevelTitle?y=t[8]:(y=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.logLevelTitle}),t[7]=n.logLevelTitle,t[8]=y);let b;t[9]===a?b=t[10]:(b=(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:a}),t[9]=a,t[10]=b);let x;t[11]!==n.logLevelTitle||t[12]!==y||t[13]!==b?(x=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(F,{type:`button`,variant:`secondary`,className:`h-9 gap-2 px-3 text-xs`,title:n.logLevelTitle,children:[v,y,b]})}),t[11]=n.logLevelTitle,t[12]=y,t[13]=b,t[14]=x):x=t[14];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=T(`w-56 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,L,`dark:border-edge`),t[15]=S):S=t[15];let C;t[16]===n.logLevelTitle?C=t[17]:(C=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.logLevelTitle}),t[16]=n.logLevelTitle,t[17]=C);let w;t[18]===n.logLevelHint?w=t[19]:(w=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.logLevelHint}),t[18]=n.logLevelHint,t[19]=w);let E;t[20]!==n.levelNames||t[21]!==h||t[22]!==a||t[23]!==s?(E=Q.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>h(e),className:T(`flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs transition-colors`,a===e?`bg-accent/10 font-medium text-accent`:`text-fg hover:bg-surface-hover`),children:[(0,$.jsx)(`span`,{children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] uppercase text-fg-subtle`,children:e})]})},e)),t[20]=n.levelNames,t[21]=h,t[22]=a,t[23]=s,t[24]=E):E=t[24];let D;t[25]===E?D=t[26]:(D=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1`,children:E}),t[25]=E,t[26]=D);let k;t[27]===l?k=t[28]:(k=l?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:l}):null,t[27]=l,t[28]=k);let A;t[29]!==w||t[30]!==D||t[31]!==k||t[32]!==C?(A=(0,$.jsx)(O,{children:(0,$.jsxs)(u,{side:`bottom`,align:`end`,sideOffset:6,className:S,children:[C,w,D,k]})}),t[29]=w,t[30]=D,t[31]=k,t[32]=C,t[33]=A):A=t[33];let j;return t[34]!==r||t[35]!==A||t[36]!==x?(j=(0,$.jsxs)(g,{open:r,onOpenChange:i,children:[x,A]}),t[34]=r,t[35]=A,t[36]=x,t[37]=j):j=t[37],j}function Xe(e){let t=(0,V.c)(53),{L:n,autoRefresh:r,onAutoRefreshChange:i,fileCount:a,onOpenFiles:o,loading:s,onRefreshAll:c,logs:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,$.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d;t[2]===n.subtitle?d=t[3]:(d=(0,$.jsx)(`p`,{className:`mt-0.5 text-sm leading-relaxed text-fg-muted`,children:n.subtitle}),t[2]=n.subtitle,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=r?`live`:`paused`,m;t[7]===i?m=t[8]:(m=e=>i(e===`live`),t[7]=i,t[8]=m);let h;t[9]===n.refreshManual?h=t[10]:(h={value:`paused`,label:n.refreshManual},t[9]=n.refreshManual,t[10]=h);let g;t[11]===n.refreshLive?g=t[12]:(g={value:`live`,label:n.refreshLive},t[11]=n.refreshLive,t[12]=g);let _;t[13]!==h||t[14]!==g?(_=[h,g],t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==n.refreshModeAria||t[17]!==p||t[18]!==m||t[19]!==_?(v=(0,$.jsx)(`div`,{className:`w-full sm:w-48`,children:(0,$.jsx)(D,{"aria-label":n.refreshModeAria,value:p,onChange:m,options:_,buttonClassName:`h-8`})}),t[16]=n.refreshModeAria,t[17]=p,t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]===n?y=t[22]:(y=(0,$.jsx)(Ye,{L:n}),t[21]=n,t[22]=y);let b;t[23]!==n||t[24]!==s||t[25]!==l?(b=(0,$.jsx)(Je,{L:n,logs:l,disabled:s}),t[23]=n,t[24]=s,t[25]=l,t[26]=b):b=t[26];let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(N,{className:`size-4`,strokeWidth:1.75}),t[27]=x):x=t[27];let S;t[28]===a?S=t[29]:(S=a>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-1.5 text-xs text-fg-muted`,children:a}):null,t[28]=a,t[29]=S);let C;t[30]!==n.logFiles||t[31]!==o||t[32]!==S?(C=(0,$.jsxs)(F,{type:`button`,variant:`ghost`,className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,title:n.logFiles,"aria-label":n.logFiles,onClick:o,children:[x,S]}),t[30]=n.logFiles,t[31]=o,t[32]=S,t[33]=C):C=t[33];let w=n.refresh,E=n.refresh,O=s&&`animate-spin motion-reduce:animate-none`,k;t[34]===O?k=t[35]:(k=T(`size-4 transition-transform duration-150 ease-out motion-reduce:transition-none`,O),t[34]=O,t[35]=k);let j;t[36]===k?j=t[37]:(j=(0,$.jsx)(A,{className:k,strokeWidth:1.75}),t[36]=k,t[37]=j);let M;t[38]!==n.refresh||t[39]!==c||t[40]!==j?(M=(0,$.jsx)(F,{type:`button`,variant:`ghost`,className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,title:w,"aria-label":E,onClick:c,children:j}),t[38]=n.refresh,t[39]=c,t[40]=j,t[41]=M):M=t[41];let P;t[42]!==y||t[43]!==b||t[44]!==C||t[45]!==M?(P=(0,$.jsxs)(`div`,{className:`flex items-center gap-1 self-end sm:self-center`,children:[y,b,C,M]}),t[42]=y,t[43]=b,t[44]=C,t[45]=M,t[46]=P):P=t[46];let I;t[47]!==P||t[48]!==v?(I=(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:max-w-md sm:flex-row sm:items-center sm:justify-end`,children:[v,P]}),t[47]=P,t[48]=v,t[49]=I):I=t[49];let L;return t[50]!==I||t[51]!==f?(L=(0,$.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[f,I]}),t[50]=I,t[51]=f,t[52]=L):L=t[52],L}function Ze(e){let t=(0,V.c)(33),{L:n,stats:r}=e,i;t[0]===r.byLevel?i=t[1]:(i=r.byLevel??{},t[0]=r.byLevel,t[1]=i);let a;t[2]!==n.levelNames||t[3]!==i?(a=Ee(i,n.levelNames),t[2]=n.levelNames,t[3]=i,t[4]=a):a=t[4];let o=a,s=r.runtime?.errorsLast24h;if(!o&&s==null)return null;let c;t[5]===n.statsRegion?c=t[6]:(c=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.statsRegion}),t[5]=n.statsRegion,t[6]=c);let l;t[7]===o?l=t[8]:(l=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null,t[7]=o,t[8]=l);let d;t[9]!==n.runtimeErrors||t[10]!==s?(d=s!=null&&s>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsxs)(`span`,{className:`tabular-nums text-red-600 dark:text-red-400`,children:[n.runtimeErrors,` `,s]})]}):null,t[9]=n.runtimeErrors,t[10]=s,t[11]=d):d=t[11];let f;t[12]!==c||t[13]!==l||t[14]!==d?(f=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`max-w-full truncate rounded-lg border border-transparent px-1 py-0.5 text-left text-xs leading-5 text-fg-subtle transition-colors duration-150 ease-out hover:border-edge-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel dark:hover:border-edge`,children:[c,l,d]})}),t[12]=c,t[13]=l,t[14]=d,t[15]=f):f=t[15];let p;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(p=T(`w-[min(calc(100vw-2rem),20rem)] rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,L,`dark:border-edge`),t[16]=p):p=t[16];let m;t[17]===n.statsDetailTitle?m=t[18]:(m=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.statsDetailTitle}),t[17]=n.statsDetailTitle,t[18]=m);let h;t[19]===n.statsHint?h=t[20]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.statsHint}),t[19]=n.statsHint,t[20]=h);let v;t[21]!==n.levelNames||t[22]!==r.byLevel?(v=Q.map(e=>{let t=r.byLevel?.[e]??0;return t===0?null:(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`font-medium capitalize text-fg`,children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:t})]},e)}),t[21]=n.levelNames,t[22]=r.byLevel,t[23]=v):v=t[23];let y;t[24]===v?y=t[25]:(y=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1.5`,children:v}),t[24]=v,t[25]=y);let b;t[26]!==y||t[27]!==m||t[28]!==h?(b=(0,$.jsx)(O,{children:(0,$.jsxs)(u,{side:`bottom`,align:`start`,sideOffset:6,className:p,children:[m,h,y]})}),t[26]=y,t[27]=m,t[28]=h,t[29]=b):b=t[29];let x;return t[30]!==b||t[31]!==f?(x=(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(g,{children:[f,b]})}),t[30]=b,t[31]=f,t[32]=x):x=t[32],x}function Qe(){let e=(0,V.c)(89),{L:t,hasToken:n,logs:r,loading:a,error:o,hasMore:s,searchInput:c,setSearchInput:l,selectedLevels:u,moduleFilter:d,setModuleFilter:f,dateFrom:p,setDateFrom:m,dateTo:h,setDateTo:g,modules:_,files:v,stats:y,selectedLog:b,setSelectedLog:x,filesOpen:S,setFilesOpen:C,filtersOpen:w,setFiltersOpen:T,logDir:E,autoRefresh:D,setAutoRefresh:O,copiedDetail:k,setCopiedDetail:A,hasActiveFilters:j,activeFilterCount:M,clearFilters:N,toggleDialogLevel:P,handleLoadMore:F,refreshAll:I,levelSegment:L,handleLevelSegment:R,filterByRequestId:z,filterBySessionId:B,filterByErrorSummary:ee,openChatForSession:H,errorSummary:U,errorSummaryLoading:W}=Ae(i($e));if(!n){let n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Ue,{L:t}),e[0]=t,e[1]=n),n}let G;e[2]===C?G=e[3]:(G=()=>C(!0),e[2]=C,e[3]=G);let K;e[4]!==t||e[5]!==D||e[6]!==v.length||e[7]!==a||e[8]!==r||e[9]!==I||e[10]!==O||e[11]!==G?(K=(0,$.jsx)(Xe,{L:t,autoRefresh:D,onAutoRefreshChange:O,fileCount:v.length,onOpenFiles:G,loading:a,onRefreshAll:I,logs:r}),e[4]=t,e[5]=D,e[6]=v.length,e[7]=a,e[8]=r,e[9]=I,e[10]=O,e[11]=G,e[12]=K):K=e[12];let q;e[13]===o?q=e[14]:(q=o?(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg dark:border-edge`,role:`alert`,children:o}):null,e[13]=o,e[14]=q);let J;e[15]!==t||e[16]!==y?(J=y?(0,$.jsx)(Ze,{L:t,stats:y}):null,e[15]=t,e[16]=y,e[17]=J):J=e[17];let Y;e[18]!==t||e[19]!==U||e[20]!==W||e[21]!==ee?(Y=(0,$.jsx)(je,{L:t,items:U,loading:W,onSelectItem:ee}),e[18]=t,e[19]=U,e[20]=W,e[21]=ee,e[22]=Y):Y=e[22];let X;e[23]===T?X=e[24]:(X=()=>T(!0),e[23]=T,e[24]=X);let te;e[25]!==t||e[26]!==M||e[27]!==D||e[28]!==N||e[29]!==R||e[30]!==j||e[31]!==L||e[32]!==d||e[33]!==_||e[34]!==c||e[35]!==f||e[36]!==l||e[37]!==X?(te=(0,$.jsx)(ze,{L:t,levelSegment:L,onLevelSegment:R,searchInput:c,onSearchInputChange:l,moduleFilter:d,onModuleFilterChange:f,modules:_,onOpenFilters:X,activeFilterCount:M,hasActiveFilters:j,onClearFilters:N,autoRefresh:D}),e[25]=t,e[26]=M,e[27]=D,e[28]=N,e[29]=R,e[30]=j,e[31]=L,e[32]=d,e[33]=_,e[34]=c,e[35]=f,e[36]=l,e[37]=X,e[38]=te):te=e[38];let Z;e[39]!==t||e[40]!==z||e[41]!==F||e[42]!==s||e[43]!==a||e[44]!==r||e[45]!==I||e[46]!==x?(Z=(0,$.jsx)(Ve,{L:t,logs:r,loading:a,hasMore:s,onSelectLog:x,onLoadMore:F,onRefreshAll:I,onFilterByRequestId:z}),e[39]=t,e[40]=z,e[41]=F,e[42]=s,e[43]=a,e[44]=r,e[45]=I,e[46]=x,e[47]=Z):Z=e[47];let Q;e[48]!==t||e[49]!==p||e[50]!==h||e[51]!==w||e[52]!==u||e[53]!==m||e[54]!==g||e[55]!==T||e[56]!==P?(Q=(0,$.jsx)(Re,{L:t,open:w,onOpenChange:T,dateFrom:p,onDateFromChange:m,dateTo:h,onDateToChange:g,selectedLevels:u,onToggleLevel:P}),e[48]=t,e[49]=p,e[50]=h,e[51]=w,e[52]=u,e[53]=m,e[54]=g,e[55]=T,e[56]=P,e[57]=Q):Q=e[57];let ne;e[58]===x?ne=e[59]:(ne=()=>x(null),e[58]=x,e[59]=ne);let re,ie;e[60]===A?(re=e[61],ie=e[62]):(re=()=>A(`message`),ie=()=>A(`json`),e[60]=A,e[61]=re,e[62]=ie);let ae;e[63]!==t||e[64]!==k||e[65]!==z||e[66]!==B||e[67]!==H||e[68]!==b||e[69]!==re||e[70]!==ie||e[71]!==ne?(ae=(0,$.jsx)(Fe,{L:t,log:b,onClose:ne,copiedDetail:k,onCopiedMessage:re,onCopiedJson:ie,onFilterByRequestId:z,onFilterBySessionId:B,onOpenChat:H}),e[63]=t,e[64]=k,e[65]=z,e[66]=B,e[67]=H,e[68]=b,e[69]=re,e[70]=ie,e[71]=ne,e[72]=ae):ae=e[72];let oe;e[73]!==t||e[74]!==v||e[75]!==S||e[76]!==E||e[77]!==C?(oe=(0,$.jsx)(Ie,{L:t,open:S,onOpenChange:C,files:v,logDir:E}),e[73]=t,e[74]=v,e[75]=S,e[76]=E,e[77]=C,e[78]=oe):oe=e[78];let se;return e[79]!==K||e[80]!==ae||e[81]!==oe||e[82]!==q||e[83]!==J||e[84]!==Y||e[85]!==te||e[86]!==Z||e[87]!==Q?(se=(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6`,children:[K,q,J,Y,te,Z,Q,ae,oe]}),e[79]=K,e[80]=ae,e[81]=oe,e[82]=q,e[83]=J,e[84]=Y,e[85]=te,e[86]=Z,e[87]=Q,e[88]=se):se=e[88],se}function $e(e){return e.language}export{Qe as LogsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{i as s,o as c}from"./url-DpFBIyN9.js";import{i as l,s as u}from"./vendor-swr-BIWyz7Rc.js";import{i as d}from"./theme-store-e2q2yjs4.js";import{r as f}from"./toast-z0toXu32.js";import{C as p,S as m}from"./vendor-codemirror-DYoKfS8f.js";import{Aa as h,Cr as g,Ct as _,Di as v,Dr as y,Ei as b,Er as x,Fn as S,Ho as C,Hr as w,Ja as T,Ka as ee,Na as te,Oa as ne,Or as re,Qa as ie,Qo as E,Ri as D,Sa as ae,Si as oe,Ta as se,Ua as ce,Uo as le,Xa as ue,Za as de,Zo as fe,_o as pe,_t as me,ao as he,at as ge,di as O,go as k,gt as A,ht as _e,ia as ve,it as ye,ja as be,ji as xe,ka as Se,kr as Ce,la as we,lt as Te,ma as Ee,mt as De,na as Oe,nt as ke,ot as Ae,pa as je,pi as Me,pt as Ne,ra as Pe,so as Fe,st as Ie,vt as Le,wr as Re,xa as ze,xt as Be,zo as Ve,zr as He}from"./index-Cbg5TS5m.js";import{i as Ue,r as We}from"./note-time-NBBReVR4.js";var j=e(r(),1),Ge=e(i(),1),Ke=u(),qe=a(),M=o();function N(e){this.content=e}N.prototype={constructor:N,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new N(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new N(n)},addToStart:function(e,t){return new N([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new N(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new N(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=N.from(e),e.size?new N(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=N.from(e),e.size?new N(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=N.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},N.from=function(e){if(e instanceof N)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new N(t)};function Je(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Je(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ye(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Ye(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var P=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Je(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ye(this,e,t,n)}findIndex(e){if(e==0)return Ze(0,e);if(e==this.size)return Ze(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ze(t+1,i):Ze(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};P.empty=new P([],0);var Xe={index:0,offset:0};function Ze(e,t){return Xe.index=e,Xe.offset=t,Xe}function Qe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Qe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Qe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var F=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};F.none=[];var $e=class extends Error{},I=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=tt(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(et(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(P.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};I.empty=new I(P.empty,0,0);function et(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(et(a.content,t-i-1,n-i-1)))}function tt(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=tt(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function nt(e,t,n){if(n.openStart>e.depth)throw new $e(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new $e(`Inconsistent open depths`);return rt(e,t,n,0)}function rt(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=rt(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ct(a,ut(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ct(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=dt(n,e);return ct(a,lt(e,i,o,t,r))}}function it(e,t){if(!t.type.compatibleContent(e.type))throw new $e(`Cannot join `+t.type.name+` onto `+e.type.name)}function at(e,t,n){let r=e.node(n);return it(r,t.node(n)),r}function ot(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function st(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ot(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ot(i.child(e),r);t&&t.depth==n&&t.textOffset&&ot(t.nodeBefore,r)}function ct(e,t){return e.type.checkContent(t),e.copy(t)}function lt(e,t,n,r,i){let a=e.depth>i&&at(e,t,i+1),o=r.depth>i&&at(n,r,i+1),s=[];return st(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(it(a,o),ot(ct(a,lt(e,t,n,r,i+1)),s)):(a&&ot(ct(a,ut(e,t,i+1)),s),st(t,n,i,s),o&&ot(ct(o,ut(n,r,i+1)),s)),st(r,null,i,s),new P(s)}function ut(e,t,n){let r=[];return st(null,e,n,r),e.depth>n&&ot(ct(at(e,t,n+1),ut(e,t,n+1)),r),st(t,null,n,r),new P(r)}function dt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(P.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ft=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return F.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new gt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ht.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ht.set(t,r=new pt);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%mt,i}},pt=class{constructor(){this.elts=[],this.i=0}},mt=12,ht=new WeakMap,gt=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},_t=Object.create(null),vt=class e{constructor(e,t,n,r=F.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||P.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Qe(this.attrs,t||e.defaultAttrs||_t)&&F.sameSet(this.marks,n||F.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return I.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new I(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return nt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ft.resolveCached(this,e)}resolveNoCache(e){return ft.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),bt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=P.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=F.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!F.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=P.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};vt.prototype.text=void 0;var yt=class e extends vt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function bt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var xt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new St(t,n);if(r.next==null)return e.empty;let i=Ct(r);r.next&&r.err(`Unexpected trailing text`);let a=Nt(At(i));return Pt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return P.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{i as s,o as c}from"./url-q28QhI7l.js";import{i as l,s as u}from"./vendor-swr-BIWyz7Rc.js";import{i as d}from"./theme-store-BgCPrmxU.js";import{r as f}from"./toast-z0toXu32.js";import{C as p,S as m}from"./vendor-codemirror-DYoKfS8f.js";import{Aa as h,Cr as g,Ct as _,Di as v,Dr as y,Ei as b,Er as x,Fn as S,Ho as C,Hr as w,Ja as T,Ka as ee,Na as te,Oa as ne,Or as re,Qa as ie,Qo as E,Ri as D,Sa as ae,Si as oe,Ta as se,Ua as ce,Uo as le,Xa as ue,Za as de,Zo as fe,_o as pe,_t as me,ao as he,at as ge,di as O,go as k,gt as A,ht as _e,ia as ve,it as ye,ja as be,ji as xe,ka as Se,kr as Ce,la as we,lt as Te,ma as Ee,mt as De,na as Oe,nt as ke,ot as Ae,pa as je,pi as Me,pt as Ne,ra as Pe,so as Fe,st as Ie,vt as Le,wr as Re,xa as ze,xt as Be,zo as Ve,zr as He}from"./index-CRDAmr3W.js";import{i as Ue,r as We}from"./note-time-14I9Sgqh.js";var j=e(r(),1),Ge=e(i(),1),Ke=u(),qe=a(),M=o();function N(e){this.content=e}N.prototype={constructor:N,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new N(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new N(n)},addToStart:function(e,t){return new N([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new N(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new N(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=N.from(e),e.size?new N(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=N.from(e),e.size?new N(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=N.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},N.from=function(e){if(e instanceof N)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new N(t)};function Je(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Je(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ye(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Ye(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var P=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Je(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ye(this,e,t,n)}findIndex(e){if(e==0)return Ze(0,e);if(e==this.size)return Ze(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ze(t+1,i):Ze(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};P.empty=new P([],0);var Xe={index:0,offset:0};function Ze(e,t){return Xe.index=e,Xe.offset=t,Xe}function Qe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Qe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Qe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var F=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};F.none=[];var $e=class extends Error{},I=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=tt(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(et(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(P.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};I.empty=new I(P.empty,0,0);function et(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(et(a.content,t-i-1,n-i-1)))}function tt(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=tt(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function nt(e,t,n){if(n.openStart>e.depth)throw new $e(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new $e(`Inconsistent open depths`);return rt(e,t,n,0)}function rt(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=rt(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ct(a,ut(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ct(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=dt(n,e);return ct(a,lt(e,i,o,t,r))}}function it(e,t){if(!t.type.compatibleContent(e.type))throw new $e(`Cannot join `+t.type.name+` onto `+e.type.name)}function at(e,t,n){let r=e.node(n);return it(r,t.node(n)),r}function ot(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function st(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ot(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ot(i.child(e),r);t&&t.depth==n&&t.textOffset&&ot(t.nodeBefore,r)}function ct(e,t){return e.type.checkContent(t),e.copy(t)}function lt(e,t,n,r,i){let a=e.depth>i&&at(e,t,i+1),o=r.depth>i&&at(n,r,i+1),s=[];return st(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(it(a,o),ot(ct(a,lt(e,t,n,r,i+1)),s)):(a&&ot(ct(a,ut(e,t,i+1)),s),st(t,n,i,s),o&&ot(ct(o,ut(n,r,i+1)),s)),st(r,null,i,s),new P(s)}function ut(e,t,n){let r=[];return st(null,e,n,r),e.depth>n&&ot(ct(at(e,t,n+1),ut(e,t,n+1)),r),st(t,null,n,r),new P(r)}function dt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(P.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ft=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return F.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new gt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ht.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ht.set(t,r=new pt);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%mt,i}},pt=class{constructor(){this.elts=[],this.i=0}},mt=12,ht=new WeakMap,gt=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},_t=Object.create(null),vt=class e{constructor(e,t,n,r=F.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||P.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Qe(this.attrs,t||e.defaultAttrs||_t)&&F.sameSet(this.marks,n||F.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return I.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new I(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return nt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ft.resolveCached(this,e)}resolveNoCache(e){return ft.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),bt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=P.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=F.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!F.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=P.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};vt.prototype.text=void 0;var yt=class e extends vt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function bt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var xt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new St(t,n);if(r.next==null)return e.empty;let i=Ct(r);r.next&&r.err(`Unexpected trailing text`);let a=Nt(At(i));return Pt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return P.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
2
2
|
`)}};xt.empty=new xt(!0);var St=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ct(e){let t=[];do t.push(wt(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function wt(e){let t=[];do t.push(Tt(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Tt(e){let t=kt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Dt(e,t);else break;return t}function Et(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Dt(e,t){let n=Et(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Et(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ot(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function kt(e){if(e.eat(`(`)){let t=Ct(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ot(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function At(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function jt(e,t){return t-e}function Mt(e,t){let n=[];return r(t),n.sort(jt);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Nt(e){let t=Object.create(null);return n(Mt(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Mt(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new xt(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(jt);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Pt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ft(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function It(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Lt(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Rt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Vt(e,r,t[r]);return n}var zt=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Rt(e,n.attrs),this.defaultAttrs=Ft(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:It(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new vt(this,this.computeAttrs(e),P.from(t),F.setFrom(n))}createChecked(e=null,t,n){return t=P.from(t),this.checkContent(t),new vt(this,this.computeAttrs(e),t,F.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=P.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(P.empty,!0);return i?new vt(this,e,t.append(i),F.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Lt(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:F.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Bt(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Vt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Bt(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ht=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Rt(e,r.attrs),this.excluded=null;let i=Ft(this.attrs);this.instance=i?new F(this,i):null}create(e=null){return!e&&this.instance?this.instance:new F(this,It(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Lt(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ut=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=N.from(e.nodes),t.marks=N.from(e.marks||{}),this.nodes=zt.compile(this.spec.nodes,this),this.marks=Ht.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=xt.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Wt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Wt(this,n.split(` `))}this.nodeFromJSON=e=>vt.fromJSON(this,e),this.markFromJSON=e=>F.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof zt))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new yt(n,n.defaultAttrs,e,F.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Wt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Gt(e){return e.tag!=null}function Kt(e){return e.style!=null}var qt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Gt(e))this.tags.push(e);else if(Kt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new nn(this,t,!1);return n.addAll(e,F.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new nn(this,t,!0);return n.addAll(e,F.none,t.from,t.to),I.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(an(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=on(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=on(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Jt={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Yt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xt={ol:!0,ul:!0},Zt=1,Qt=2,$t=4;function en(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Zt:0)|(t===`full`?Qt:0)}var tn=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=F.none,this.match=i||(a&$t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(P.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Zt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=P.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(P.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},nn=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=en(null,t.preserveWhitespace,0)|(n?$t:0);i=r?new tn(r.type,r.attrs,F.none,!0,t.topMatch||r.type.contentMatch,a):n?new tn(null,null,F.none,!0,null,a):new tn(e.schema.topNodeType,null,F.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Qt?`full`:this.localPreserveWS||(r.options&Zt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Xt.hasOwnProperty(a)&&this.parser.normalizeLists&&rn(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Yt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Jt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=F.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):sn(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=en(e,i,a.options);a.options&$t&&a.content.length==0&&(o|=$t);let s=F.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):sn(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new tn(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Zt);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function rn(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Xt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function an(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function on(e){let t={};for(let n in e)t[n]=e[n];return t}function sn(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var cn=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=un(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return un(t).createTextNode(e.text);let{dom:n,contentDOM:r}=mn(un(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&mn(un(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:mn(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=ln(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return ln(e.marks)}};function ln(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function un(e){return e.document||window.document}var dn=new WeakMap;function fn(e){let t=dn.get(e);return t===void 0&&dn.set(e,t=pn(e)),t}function pn(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function mn(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=fn(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=mn(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var hn=65535,gn=2**16;function _n(e,t){return e+t*gn}function vn(e){return e&hn}function yn(e){return(e-(e&hn))/gn}var bn=1,xn=2,Sn=4,Cn=8,wn=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Cn)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Sn)>0}},Tn=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=vn(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+yn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:_n(o/3,e-s),f=e==s?xn:e==u?bn:Sn;return(t<0?e!=s:e!=u)&&(f|=Cn),new wn(a,f,d)}r+=l-c}return n?e+r:new wn(e+r,0,null)}touches(e,t){let n=0,r=vn(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Tn.empty=new Tn([]);var En=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new wn(e,r,null)}},Dn=Object.create(null),On=class{getMap(){return Tn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Dn[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Dn)throw RangeError(`Duplicate use of step JSON ID `+e);return Dn[e]=t,t.prototype.jsonID=e,t}},kn=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof $e)return e.fail(t.message);throw t}}};function An(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(An(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return P.fromArray(r)}var jn=class e extends On{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new I(An(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return kn.fromReplace(e,this.from,this.to,i)}invert(){return new Mn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};On.jsonID(`addMark`,jn);var Mn=class e extends On{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new I(An(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return kn.fromReplace(e,this.from,this.to,n)}invert(){return new jn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};On.jsonID(`removeMark`,Mn);var Nn=class e extends On{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return kn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return kn.fromReplace(e,this.pos,this.pos+1,new I(P.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Pn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};On.jsonID(`addNodeMark`,Nn);var Pn=class e extends On{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return kn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return kn.fromReplace(e,this.pos,this.pos+1,new I(P.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Nn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};On.jsonID(`removeNodeMark`,Pn);var Fn=class e extends On{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ln(e,this.from,this.to)?kn.fail(`Structure replace would overwrite content`):kn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Tn([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?I.empty:new I(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?I.empty:new I(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,I.fromJSON(t,n.slice),!!n.structure)}};Fn.MAP_BIAS=1,On.jsonID(`replace`,Fn);var In=class e extends On{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Ln(e,this.from,this.gapFrom)||Ln(e,this.gapTo,this.to)))return kn.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return kn.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?kn.fromReplace(e,this.from,this.to,n):kn.fail(`Content does not fit in gap`)}getMap(){return new Tn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,I.fromJSON(t,n.slice),n.insert,!!n.structure)}};On.jsonID(`replaceAround`,In);function Ln(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Rn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Mn(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new jn(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function zn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Ht){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Mn(t.from,t.to,t.style)))}function Bn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Fn(s,l,I.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Mn(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new I(P.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Fn(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(P.empty,!0);e.replace(s,s,new I(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Vn(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Hn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Vn(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Un(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=P.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=P.from(r.node(e).copy(u)),d++):c--;let f=P.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=P.from(i.node(e).copy(f)),p++):l++;e.step(new In(c,l,o,s,new I(u.append(f),d,p),u.size-d,!0))}function Wn(e,t,n=null,r=e){let i=Kn(e,t),a=i&&qn(r,t);return a?i.map(Gn).concat({type:t,attrs:n}).concat(a.map(Gn)):null}function Gn(e){return{type:e,attrs:null}}function Kn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function qn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Jn(e,t,n){let r=P.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=P.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new In(i,a,i,a,new I(r,0,0),n.length,!0))}function Yn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Qn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Zn(e,t,n,a),Bn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new In(c,l,c+1,l-1,new I(P.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Xn(e,t,n,a),!1}})}function Xn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Zn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./url-
|
|
1
|
+
import{a as e}from"./url-q28QhI7l.js";import{bt as t,yt as n}from"./index-CRDAmr3W.js";var r={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},i=null,a=null,o=null,s=null;function c(){return i||(i=new Audio,i.addEventListener(`timeupdate`,()=>{u.setState({currentTime:i.currentTime})}),i.addEventListener(`loadedmetadata`,()=>{let e=i.duration;Number.isFinite(e)&&u.setState({duration:e})}),i.addEventListener(`ended`,()=>{u.setState({playing:!1,currentTime:0}),i.currentTime=0}),i.addEventListener(`pause`,()=>{u.setState({playing:!1})}),i.addEventListener(`play`,()=>{u.setState({playing:!0})})),i}function l(){o&&s&&t(o,s),a=null,o=null,s=null}var u=e()((e,t)=>({...r,play:async(r,i,u)=>{let d=c(),f=t();if(f.noteId===r&&f.attachmentId===i&&a){d.play();return}d.pause(),l(),e({noteId:r,attachmentId:i,playing:!1,currentTime:0,duration:u??0,loading:!0});try{let t=await n(r,i);a=t,o=r,s=i,d.src=t,await d.play(),e({loading:!1})}catch{e({loading:!1,playing:!1}),l()}},pause:()=>{c().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=c();n.currentTime=t,e({currentTime:t})},reset:()=>{c().pause(),c().src=``,l(),e(r)}})),d=6e4,f=36e5,p=864e5;function m(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function h(e,t,n){let r=t-e;if(r<d)return n.justNow;if(r<f){let e=Math.floor(r/d);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=m(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-p)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*p){let e=Math.floor(r/p);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function g(e,t,n){let r=m(t);if(e>=r)return n.today;if(e>=r-p)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function _(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}export{u as i,g as n,h as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a}from"./url-DpFBIyN9.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s}from"./fetch-BLLOP2CM.js";import{r as c}from"./toast-z0toXu32.js";import{Fa as l,Fi as u,Ga as d,Hr as f,Ji as p,Li as m,Lo as h,N as g,Ni as _,Oa as v,Sa as y,St as b,Wo as x,Yi as S,Zo as C,ct as w,da as T,di as E,do as D,dt as O,fa as k,ft as A,ht as j,la as M,ma as N,qa as P,rt as F,ut as I,vt as L,wi as R,zr as z}from"./index-Cbg5TS5m.js";import{i as B,n as V,r as ee,t as te}from"./note-time-NBBReVR4.js";import{a as ne,i as re,n as H,o as ie,r as ae,t as oe}from"./dist-BsHh1vX0.js";var se=n(),U=e(t(),1),W=r();function ce(e){let t=(0,se.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,U.useState)(!1),s;t[0]!==r||t[1]!==n?(s=b(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=E(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(P,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,W.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=E(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,W.jsx)(L,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function G(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function le(e){let t=(0,se.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=B(),f=B(q),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,y=_>0?Math.min(g/_*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=E(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===T?D=t[13]:(D=E(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,W.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}):m?(0,W.jsx)(N,{className:`h-3.5 w-3.5`}):(0,W.jsx)(M,{className:`h-3.5 w-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,W.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${y}%`,P;t[23]===j?P=t[24]:(P=(0,W.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=P);let F;t[25]!==_||t[26]!==p||t[27]!==g?(F=G(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=F):F=t[28];let I;t[29]===F?I=t[30]:(I=(0,W.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:F}),t[29]=F,t[30]=I);let L;t[31]!==P||t[32]!==I?(L=(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==w||t[36]!==A?(R=(0,W.jsxs)(`div`,{className:w,onClick:K,children:[A,L]}),t[34]=L,t[35]=w,t[36]=A,t[37]=R):R=t[37],R}function K(e){return e.stopPropagation()}function q(e){return e.toggle}var ue={thought:l,todo:m,voice:y,media:d,bookmark:h,mixed:l,task:m};function de(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function J(e){let t=(0,se.c)(78),{note:n,onPress:r,onPin:i,onArchive:a,onDelete:o,labels:s,timeLabels:c}=e,u=ue[n.kind]||l,d;t[0]!==s||t[1]!==n?(d=de(n,s),t[0]=s,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,U.useState)(Y),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==c?(h=ee(n.createdAt,m,c),t[3]=n.createdAt,t[4]=m,t[5]=c,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==r?(_=()=>r(n.id),v=e=>{(e.key===`Enter`||e.key===` `)&&r(n.id)},t[7]=n.id,t[8]=r,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=E(`group relative flex cursor-pointer flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(b=n.coverAttachmentId?(0,W.jsx)(ce,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,W.jsx)(le,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-32 shrink-0`}):(0,W.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`}),t[12]=u,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=b):b=t[18];let S;t[19]===n.title?S=t[20]:(S=n.title&&(0,W.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=S);let C=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,w;t[21]===C?w=t[22]:(w=E(`text-sm line-clamp-3`,C),t[21]=C,t[22]=w);let O;t[23]!==f||t[24]!==w?(O=(0,W.jsx)(`p`,{className:w,children:f}),t[23]=f,t[24]=w,t[25]=O):O=t[25];let A;t[26]!==O||t[27]!==S?(A=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,O]}),t[26]=O,t[27]=S,t[28]=A):A=t[28];let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,W.jsx)(D,{className:`h-4 w-4`})})}),t[29]=j):j=t[29];let M;t[30]!==n.id||t[31]!==n.pinned||t[32]!==i?(M=()=>i(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=i,t[33]=M):M=t[33];let N;t[34]===n.pinned?N=t[35]:(N=n.pinned?(0,W.jsx)(T,{className:`h-4 w-4`}):(0,W.jsx)(k,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=N);let P=n.pinned?s.unpin:s.pin,F;t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,W.jsxs)(H,{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`,onSelect:M,children:[N,P]}),t[36]=M,t[37]=N,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==n.id||t[41]!==a?(I=()=>a(n.id),t[40]=n.id,t[41]=a,t[42]=I):I=t[42];let L;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,W.jsx)(x,{className:`h-4 w-4`}),t[43]=L):L=t[43];let z;t[44]!==s.archive||t[45]!==I?(z=(0,W.jsxs)(H,{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`,onSelect:I,children:[L,s.archive]}),t[44]=s.archive,t[45]=I,t[46]=z):z=t[46];let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,W.jsx)(ne,{className:`my-1 h-px bg-edge-subtle`}),t[47]=B):B=t[47];let V;t[48]!==n.id||t[49]!==o?(V=()=>o(n.id),t[48]=n.id,t[49]=o,t[50]=V):V=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,W.jsx)(R,{className:`h-4 w-4`}),t[51]=te):te=t[51];let G;t[52]!==s.delete||t[53]!==V?(G=(0,W.jsxs)(H,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:V,children:[te,s.delete]}),t[52]=s.delete,t[53]=V,t[54]=G):G=t[54];let K;t[55]!==F||t[56]!==z||t[57]!==G?(K=(0,W.jsxs)(re,{children:[j,(0,W.jsx)(ae,{children:(0,W.jsxs)(oe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:pe,children:[F,z,B,G]})})]}),t[55]=F,t[56]=z,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==A||t[60]!==K||t[61]!==b?(q=(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,A,K]}),t[59]=A,t[60]=K,t[61]=b,t[62]=q):q=t[62];let J;t[63]===n.pinned?J=t[64]:(J=n.pinned&&(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,W.jsx)(k,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=J);let X;t[65]===n.tags?X=t[66]:(X=n.tags?.map(fe),t[65]=n.tags,t[66]=X);let Z;t[67]===g?Z=t[68]:(Z=(0,W.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[67]=g,t[68]=Z);let Q;t[69]!==J||t[70]!==X||t[71]!==Z?(Q=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[J,X,Z]}),t[69]=J,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72];let he;return t[73]!==q||t[74]!==Q||t[75]!==_||t[76]!==v?(he=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:y,children:[q,Q]}),t[73]=q,t[74]=Q,t[75]=_,t[76]=v,t[77]=he):he=t[77],he}function fe(e){return(0,W.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function pe(e){return e.stopPropagation()}function me(e){return e.stopPropagation()}function Y(){return Date.now()}var X=3e4;function Z(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Q({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1}){let[c,l]=(0,U.useState)(``),[f,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(null),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)([]),D=(0,U.useRef)(0),O=(0,U.useRef)(null),k=(0,U.useRef)(null),A=(0,U.useCallback)(()=>{O.current&&=(clearInterval(O.current),null),k.current&&=(clearTimeout(k.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],g(!1),v(0)},[]);(0,U.useEffect)(()=>()=>A(),[A]);let j=(0,U.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-D.current)/1e3)),n=e.mimeType||Z()||`audio/webm`,r=new Blob(T.current,{type:n});if(A(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{x(!1)}return}x(!1)},[A,i]),M=(0,U.useCallback)(async()=>{if(!(!i||b||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Z(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],D.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),g(!0),v(0),O.current=setInterval(()=>{v(Math.round((Date.now()-D.current)/1e3))},250),k.current=setTimeout(()=>{j()},X)}catch{A()}},[A,i,h,j,b]),N=(0,U.useCallback)(()=>{if(h){j();return}M()},[h,M,j]),P=(0,U.useCallback)(async e=>{let t=c.trim();if(!(!t||f)){m(!0),l(``);try{await n(t,e)}catch{l(t)}finally{m(!1),S.current?.focus()}}},[c,f,n]),F=(0,U.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),P({navigate:!1}))},[P]),I=f||b;return(0,W.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel px-2 py-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:I||o||h,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,W.jsx)(d,{className:`h-4 w-4`})}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:N,disabled:I||s||f,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,W.jsx)(u,{className:`h-4 w-4 fill-current`}):(0,W.jsx)(y,{className:`h-4 w-4`})}),h?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,W.jsx)(`textarea`,{ref:S,value:c,onChange:e=>l(e.target.value),onKeyDown:F,placeholder:e,rows:1,disabled:I,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,W.jsx)(`button`,{type:`button`,disabled:!c.trim()||I||h,onClick:e=>void P({navigate:!e.shiftKey}),"aria-label":t,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,c.trim()&&!I&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,W.jsx)(p,{className:`h-4 w-4`})})]})}var he={statusFilter:`all`,kindFilter:`all`,search:``};function $(){let e=(0,se.c)(107),t=a(i(xe)).notes,n=!!s(be),[r,l]=(0,U.useReducer)(g,he),[u]=(0,U.useState)(ye),d=C(),p;e[0]!==n||e[1]!==r.kindFilter||e[2]!==r.search||e[3]!==r.statusFilter?(p=n?[`notes-list`,r.statusFilter,r.kindFilter,r.search]:null,e[0]=n,e[1]=r.kindFilter,e[2]=r.search,e[3]=r.statusFilter,e[4]=p):p=e[4];let m=p,h;e[5]!==r.kindFilter||e[6]!==r.search||e[7]!==r.statusFilter?(h=()=>w({status:r.statusFilter===`all`?void 0:r.statusFilter,kind:r.kindFilter===`all`?void 0:r.kindFilter,search:r.search||void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),e[5]=r.kindFilter,e[6]=r.search,e[7]=r.statusFilter,e[8]=h):h=e[8];let v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={keepPreviousData:!0},e[9]=v):v=e[9];let{data:y,mutate:b,isLoading:x}=o(m,h,v),T=x&&!y,D;e[10]===y?.items?D=e[11]:(D=y?.items??[],e[10]=y?.items,e[11]=D);let k=D,M=y?.total??0,N=z(ve),P=z(_e),L=M>0?t.noteCount.replace(`{{count}}`,String(M)):null,R,B;e[12]!==P||e[13]!==n||e[14]!==t.title||e[15]!==L||e[16]!==N?(R=()=>n?(N({startExtra:null,main:(0,W.jsxs)(`div`,{className:E(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,f),children:[(0,W.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),L?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:L}):null]}),end:null}),()=>P()):(P(),()=>P()),B=[P,n,t.title,L,N],e[12]=P,e[13]=n,e[14]=t.title,e[15]=L,e[16]=N,e[17]=R,e[18]=B):(R=e[17],B=e[18]),(0,U.useLayoutEffect)(R,B);let ee;e[19]!==t.daysAgo||e[20]!==t.justNow||e[21]!==t.minutesAgo||e[22]!==t.today||e[23]!==t.yesterday?(ee={justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo},e[19]=t.daysAgo,e[20]=t.justNow,e[21]=t.minutesAgo,e[22]=t.today,e[23]=t.yesterday,e[24]=ee):ee=e[24];let ne=ee,re;e[25]!==b||e[26]!==d?(re=async(e,t)=>{let n=await I(e,`web`);await b(),t?.navigate!==!1&&d(`/notes/${n.id}`)},e[25]=b,e[26]=d,e[27]=re):re=e[27];let H=re,ie;e[28]!==b||e[29]!==t.imageUploadFailed||e[30]!==t.imageUploadFailedHint?(ie=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let n=e.files?.[0];if(n)try{await O(n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.imageUploadFailed,message:n instanceof Error?n.message:t.imageUploadFailedHint})}},e.click()},e[28]=b,e[29]=t.imageUploadFailed,e[30]=t.imageUploadFailedHint,e[31]=ie):ie=e[31];let ae=ie,oe;e[32]!==b||e[33]!==t.voiceUploadFailed||e[34]!==t.voiceUploadFailedHint?(oe=async(e,n)=>{try{await A(e,n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.voiceUploadFailed,message:n instanceof Error?n.message:t.voiceUploadFailedHint})}},e[32]=b,e[33]=t.voiceUploadFailed,e[34]=t.voiceUploadFailedHint,e[35]=oe):oe=e[35];let ce=oe,G;e[36]===b?G=e[37]:(G=async(e,t)=>{await j(e,{pinned:t}),await b()},e[36]=b,e[37]=G);let le=G,K;e[38]===b?K=e[39]:(K=async e=>{await j(e,{status:`archived`}),await b()},e[38]=b,e[39]=K);let q=K,ue;e[40]===b?ue=e[41]:(ue=async e=>{await F(e),await b()},e[40]=b,e[41]=ue);let de=ue,fe;e[42]===d?fe=e[43]:(fe=e=>{d(`/notes/${e}`)},e[42]=d,e[43]=fe);let pe=fe;if(!n){let n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(_,{className:`h-10 w-10 text-fg-muted`}),e[44]=n):n=e[44];let r;return e[45]===t.needToken?r=e[46]:(r=(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n,(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]}),e[45]=t.needToken,e[46]=r),r}let me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,W.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),e[47]=me):me=e[47];let Y;e[48]===l?Y=e[49]:(Y=e=>l({type:`patch`,patch:{search:e.target.value}}),e[48]=l,e[49]=Y);let X;e[50]!==t.searchPlaceholder||e[51]!==Y||e[52]!==r.search?(X=(0,W.jsxs)(`div`,{className:`relative`,children:[me,(0,W.jsx)(`input`,{type:`search`,value:r.search,onChange:Y,placeholder:t.searchPlaceholder,className:`w-full rounded-xl border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`})]}),e[50]=t.searchPlaceholder,e[51]=Y,e[52]=r.search,e[53]=X):X=e[53];let Z;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Z=[`all`,`inbox`,`processed`,`archived`],e[54]=Z):Z=e[54];let $;e[55]!==l||e[56]!==t.filterAll||e[57]!==t.filterArchived||e[58]!==t.filterInbox||e[59]!==t.filterProcessed||e[60]!==r.statusFilter?($=Z.map(e=>{let n=e===`all`?t.filterAll:e===`inbox`?t.filterInbox:e===`processed`?t.filterProcessed:t.filterArchived;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{statusFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.statusFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[55]=l,e[56]=t.filterAll,e[57]=t.filterArchived,e[58]=t.filterInbox,e[59]=t.filterProcessed,e[60]=r.statusFilter,e[61]=$):$=e[61];let Se,Ce;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,W.jsx)(`div`,{className:`mx-1 h-4 w-px bg-edge-subtle`}),Ce=[`all`,`thought`,`todo`,`voice`,`media`,`bookmark`],e[62]=Se,e[63]=Ce):(Se=e[62],Ce=e[63]);let we;e[64]!==l||e[65]!==t.kindAll||e[66]!==t.kindBookmark||e[67]!==t.kindMedia||e[68]!==t.kindThought||e[69]!==t.kindTodo||e[70]!==t.kindVoice||e[71]!==r.kindFilter?(we=Ce.map(e=>{let n=e===`all`?t.kindAll:e===`thought`?t.kindThought:e===`todo`?t.kindTodo:e===`voice`?t.kindVoice:e===`media`?t.kindMedia:t.kindBookmark;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{kindFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.kindFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[64]=l,e[65]=t.kindAll,e[66]=t.kindBookmark,e[67]=t.kindMedia,e[68]=t.kindThought,e[69]=t.kindTodo,e[70]=t.kindVoice,e[71]=r.kindFilter,e[72]=we):we=e[72];let Te;e[73]!==$||e[74]!==we?(Te=(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[$,Se,we]}),e[73]=$,e[74]=we,e[75]=Te):Te=e[75];let Ee;e[76]!==X||e[77]!==Te?(Ee=(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 p-4 pb-2`,children:[X,Te]}),e[76]=X,e[77]=Te,e[78]=Ee):Ee=e[78];let De;e[79]!==q||e[80]!==de||e[81]!==pe||e[82]!==le||e[83]!==t.archive||e[84]!==t.delete||e[85]!==t.imageNote||e[86]!==t.noNotes||e[87]!==t.noNotesDescription||e[88]!==t.noText||e[89]!==t.pin||e[90]!==t.unpin||e[91]!==k||e[92]!==u||e[93]!==T||e[94]!==ne?(De=(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-3 pb-24 [scrollbar-gutter:stable]`,children:T?(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:[1,2,3].map(ge)}):k.length===0?(0,W.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 py-16 text-center`,children:[(0,W.jsx)(_,{className:`h-8 w-8 text-fg-muted`}),(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:t.noNotes}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.noNotesDescription})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:k.map((e,n)=>{let r=n>0?te(k[n-1].createdAt):null;return(0,W.jsxs)(`div`,{children:[te(e.createdAt)!==r&&(0,W.jsx)(`div`,{className:E(`pb-2 text-xs font-medium text-fg-muted`,n>0&&`pt-2`),children:V(e.createdAt,u,ne)}),(0,W.jsx)(J,{note:e,onPress:pe,onPin:le,onArchive:q,onDelete:de,timeLabels:ne,labels:{pin:t.pin,unpin:t.unpin,archive:t.archive,delete:t.delete,imageNote:t.imageNote,noText:t.noText}})]},e.id)})})}),e[79]=q,e[80]=de,e[81]=pe,e[82]=le,e[83]=t.archive,e[84]=t.delete,e[85]=t.imageNote,e[86]=t.noNotes,e[87]=t.noNotesDescription,e[88]=t.noText,e[89]=t.pin,e[90]=t.unpin,e[91]=k,e[92]=u,e[93]=T,e[94]=ne,e[95]=De):De=e[95];let Oe;e[96]!==H||e[97]!==ae||e[98]!==ce||e[99]!==t.quickCapturePlaceholder||e[100]!==t.recording||e[101]!==t.send?(Oe=(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-surface-panel from-60% via-surface-panel/90 to-transparent px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-6`,children:(0,W.jsx)(`div`,{className:`pointer-events-auto`,children:(0,W.jsx)(Q,{placeholder:t.quickCapturePlaceholder,sendLabel:t.send,onCapture:H,onImagePick:ae,onVoiceCapture:ce,recordingLabel:t.recording})})}),e[96]=H,e[97]=ae,e[98]=ce,e[99]=t.quickCapturePlaceholder,e[100]=t.recording,e[101]=t.send,e[102]=Oe):Oe=e[102];let ke;return e[103]!==Ee||e[104]!==De||e[105]!==Oe?(ke=(0,W.jsxs)(`div`,{className:`relative mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col overflow-hidden`,children:[Ee,De,Oe]}),e[103]=Ee,e[104]=De,e[105]=Oe,e[106]=ke):ke=e[106],ke}function ge(e){return(0,W.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl bg-surface-hover`},e)}function _e(e){return e.clearPageHeader}function ve(e){return e.setPageHeader}function ye(){return Date.now()}function be(e){return e.token}function xe(e){return e.language}export{$ as NotesPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a}from"./url-q28QhI7l.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s}from"./fetch-drJUxxKP.js";import{r as c}from"./toast-z0toXu32.js";import{Fa as l,Fi as u,Ga as d,Hr as f,Ji as p,Li as m,Lo as h,N as g,Ni as _,Oa as v,Sa as y,St as b,Wo as x,Yi as S,Zo as C,ct as w,da as T,di as E,do as D,dt as O,fa as k,ft as A,ht as j,la as M,ma as N,qa as P,rt as F,ut as I,vt as L,wi as R,zr as z}from"./index-CRDAmr3W.js";import{i as B,n as V,r as ee,t as te}from"./note-time-14I9Sgqh.js";import{a as ne,i as re,n as H,o as ie,r as ae,t as oe}from"./dist-P8HRGUuh.js";var se=n(),U=e(t(),1),W=r();function ce(e){let t=(0,se.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,U.useState)(!1),s;t[0]!==r||t[1]!==n?(s=b(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=E(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(P,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,W.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=E(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,W.jsx)(L,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function G(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function le(e){let t=(0,se.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=B(),f=B(q),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,y=_>0?Math.min(g/_*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=E(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===T?D=t[13]:(D=E(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,W.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}):m?(0,W.jsx)(N,{className:`h-3.5 w-3.5`}):(0,W.jsx)(M,{className:`h-3.5 w-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,W.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${y}%`,P;t[23]===j?P=t[24]:(P=(0,W.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=P);let F;t[25]!==_||t[26]!==p||t[27]!==g?(F=G(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=F):F=t[28];let I;t[29]===F?I=t[30]:(I=(0,W.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:F}),t[29]=F,t[30]=I);let L;t[31]!==P||t[32]!==I?(L=(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==w||t[36]!==A?(R=(0,W.jsxs)(`div`,{className:w,onClick:K,children:[A,L]}),t[34]=L,t[35]=w,t[36]=A,t[37]=R):R=t[37],R}function K(e){return e.stopPropagation()}function q(e){return e.toggle}var ue={thought:l,todo:m,voice:y,media:d,bookmark:h,mixed:l,task:m};function de(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function J(e){let t=(0,se.c)(78),{note:n,onPress:r,onPin:i,onArchive:a,onDelete:o,labels:s,timeLabels:c}=e,u=ue[n.kind]||l,d;t[0]!==s||t[1]!==n?(d=de(n,s),t[0]=s,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,U.useState)(Y),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==c?(h=ee(n.createdAt,m,c),t[3]=n.createdAt,t[4]=m,t[5]=c,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==r?(_=()=>r(n.id),v=e=>{(e.key===`Enter`||e.key===` `)&&r(n.id)},t[7]=n.id,t[8]=r,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=E(`group relative flex cursor-pointer flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(b=n.coverAttachmentId?(0,W.jsx)(ce,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,W.jsx)(le,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-32 shrink-0`}):(0,W.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`}),t[12]=u,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=b):b=t[18];let S;t[19]===n.title?S=t[20]:(S=n.title&&(0,W.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=S);let C=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,w;t[21]===C?w=t[22]:(w=E(`text-sm line-clamp-3`,C),t[21]=C,t[22]=w);let O;t[23]!==f||t[24]!==w?(O=(0,W.jsx)(`p`,{className:w,children:f}),t[23]=f,t[24]=w,t[25]=O):O=t[25];let A;t[26]!==O||t[27]!==S?(A=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,O]}),t[26]=O,t[27]=S,t[28]=A):A=t[28];let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,W.jsx)(D,{className:`h-4 w-4`})})}),t[29]=j):j=t[29];let M;t[30]!==n.id||t[31]!==n.pinned||t[32]!==i?(M=()=>i(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=i,t[33]=M):M=t[33];let N;t[34]===n.pinned?N=t[35]:(N=n.pinned?(0,W.jsx)(T,{className:`h-4 w-4`}):(0,W.jsx)(k,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=N);let P=n.pinned?s.unpin:s.pin,F;t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,W.jsxs)(H,{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`,onSelect:M,children:[N,P]}),t[36]=M,t[37]=N,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==n.id||t[41]!==a?(I=()=>a(n.id),t[40]=n.id,t[41]=a,t[42]=I):I=t[42];let L;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,W.jsx)(x,{className:`h-4 w-4`}),t[43]=L):L=t[43];let z;t[44]!==s.archive||t[45]!==I?(z=(0,W.jsxs)(H,{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`,onSelect:I,children:[L,s.archive]}),t[44]=s.archive,t[45]=I,t[46]=z):z=t[46];let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,W.jsx)(ne,{className:`my-1 h-px bg-edge-subtle`}),t[47]=B):B=t[47];let V;t[48]!==n.id||t[49]!==o?(V=()=>o(n.id),t[48]=n.id,t[49]=o,t[50]=V):V=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,W.jsx)(R,{className:`h-4 w-4`}),t[51]=te):te=t[51];let G;t[52]!==s.delete||t[53]!==V?(G=(0,W.jsxs)(H,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:V,children:[te,s.delete]}),t[52]=s.delete,t[53]=V,t[54]=G):G=t[54];let K;t[55]!==F||t[56]!==z||t[57]!==G?(K=(0,W.jsxs)(re,{children:[j,(0,W.jsx)(ae,{children:(0,W.jsxs)(oe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:pe,children:[F,z,B,G]})})]}),t[55]=F,t[56]=z,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==A||t[60]!==K||t[61]!==b?(q=(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,A,K]}),t[59]=A,t[60]=K,t[61]=b,t[62]=q):q=t[62];let J;t[63]===n.pinned?J=t[64]:(J=n.pinned&&(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,W.jsx)(k,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=J);let X;t[65]===n.tags?X=t[66]:(X=n.tags?.map(fe),t[65]=n.tags,t[66]=X);let Z;t[67]===g?Z=t[68]:(Z=(0,W.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[67]=g,t[68]=Z);let Q;t[69]!==J||t[70]!==X||t[71]!==Z?(Q=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[J,X,Z]}),t[69]=J,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72];let he;return t[73]!==q||t[74]!==Q||t[75]!==_||t[76]!==v?(he=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:y,children:[q,Q]}),t[73]=q,t[74]=Q,t[75]=_,t[76]=v,t[77]=he):he=t[77],he}function fe(e){return(0,W.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function pe(e){return e.stopPropagation()}function me(e){return e.stopPropagation()}function Y(){return Date.now()}var X=3e4;function Z(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Q({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1}){let[c,l]=(0,U.useState)(``),[f,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(null),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)([]),D=(0,U.useRef)(0),O=(0,U.useRef)(null),k=(0,U.useRef)(null),A=(0,U.useCallback)(()=>{O.current&&=(clearInterval(O.current),null),k.current&&=(clearTimeout(k.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],g(!1),v(0)},[]);(0,U.useEffect)(()=>()=>A(),[A]);let j=(0,U.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-D.current)/1e3)),n=e.mimeType||Z()||`audio/webm`,r=new Blob(T.current,{type:n});if(A(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{x(!1)}return}x(!1)},[A,i]),M=(0,U.useCallback)(async()=>{if(!(!i||b||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Z(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],D.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),g(!0),v(0),O.current=setInterval(()=>{v(Math.round((Date.now()-D.current)/1e3))},250),k.current=setTimeout(()=>{j()},X)}catch{A()}},[A,i,h,j,b]),N=(0,U.useCallback)(()=>{if(h){j();return}M()},[h,M,j]),P=(0,U.useCallback)(async e=>{let t=c.trim();if(!(!t||f)){m(!0),l(``);try{await n(t,e)}catch{l(t)}finally{m(!1),S.current?.focus()}}},[c,f,n]),F=(0,U.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),P({navigate:!1}))},[P]),I=f||b;return(0,W.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel px-2 py-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:I||o||h,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,W.jsx)(d,{className:`h-4 w-4`})}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:N,disabled:I||s||f,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,W.jsx)(u,{className:`h-4 w-4 fill-current`}):(0,W.jsx)(y,{className:`h-4 w-4`})}),h?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,W.jsx)(`textarea`,{ref:S,value:c,onChange:e=>l(e.target.value),onKeyDown:F,placeholder:e,rows:1,disabled:I,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,W.jsx)(`button`,{type:`button`,disabled:!c.trim()||I||h,onClick:e=>void P({navigate:!e.shiftKey}),"aria-label":t,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,c.trim()&&!I&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,W.jsx)(p,{className:`h-4 w-4`})})]})}var he={statusFilter:`all`,kindFilter:`all`,search:``};function $(){let e=(0,se.c)(107),t=a(i(xe)).notes,n=!!s(be),[r,l]=(0,U.useReducer)(g,he),[u]=(0,U.useState)(ye),d=C(),p;e[0]!==n||e[1]!==r.kindFilter||e[2]!==r.search||e[3]!==r.statusFilter?(p=n?[`notes-list`,r.statusFilter,r.kindFilter,r.search]:null,e[0]=n,e[1]=r.kindFilter,e[2]=r.search,e[3]=r.statusFilter,e[4]=p):p=e[4];let m=p,h;e[5]!==r.kindFilter||e[6]!==r.search||e[7]!==r.statusFilter?(h=()=>w({status:r.statusFilter===`all`?void 0:r.statusFilter,kind:r.kindFilter===`all`?void 0:r.kindFilter,search:r.search||void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),e[5]=r.kindFilter,e[6]=r.search,e[7]=r.statusFilter,e[8]=h):h=e[8];let v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={keepPreviousData:!0},e[9]=v):v=e[9];let{data:y,mutate:b,isLoading:x}=o(m,h,v),T=x&&!y,D;e[10]===y?.items?D=e[11]:(D=y?.items??[],e[10]=y?.items,e[11]=D);let k=D,M=y?.total??0,N=z(ve),P=z(_e),L=M>0?t.noteCount.replace(`{{count}}`,String(M)):null,R,B;e[12]!==P||e[13]!==n||e[14]!==t.title||e[15]!==L||e[16]!==N?(R=()=>n?(N({startExtra:null,main:(0,W.jsxs)(`div`,{className:E(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,f),children:[(0,W.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),L?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:L}):null]}),end:null}),()=>P()):(P(),()=>P()),B=[P,n,t.title,L,N],e[12]=P,e[13]=n,e[14]=t.title,e[15]=L,e[16]=N,e[17]=R,e[18]=B):(R=e[17],B=e[18]),(0,U.useLayoutEffect)(R,B);let ee;e[19]!==t.daysAgo||e[20]!==t.justNow||e[21]!==t.minutesAgo||e[22]!==t.today||e[23]!==t.yesterday?(ee={justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo},e[19]=t.daysAgo,e[20]=t.justNow,e[21]=t.minutesAgo,e[22]=t.today,e[23]=t.yesterday,e[24]=ee):ee=e[24];let ne=ee,re;e[25]!==b||e[26]!==d?(re=async(e,t)=>{let n=await I(e,`web`);await b(),t?.navigate!==!1&&d(`/notes/${n.id}`)},e[25]=b,e[26]=d,e[27]=re):re=e[27];let H=re,ie;e[28]!==b||e[29]!==t.imageUploadFailed||e[30]!==t.imageUploadFailedHint?(ie=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let n=e.files?.[0];if(n)try{await O(n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.imageUploadFailed,message:n instanceof Error?n.message:t.imageUploadFailedHint})}},e.click()},e[28]=b,e[29]=t.imageUploadFailed,e[30]=t.imageUploadFailedHint,e[31]=ie):ie=e[31];let ae=ie,oe;e[32]!==b||e[33]!==t.voiceUploadFailed||e[34]!==t.voiceUploadFailedHint?(oe=async(e,n)=>{try{await A(e,n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.voiceUploadFailed,message:n instanceof Error?n.message:t.voiceUploadFailedHint})}},e[32]=b,e[33]=t.voiceUploadFailed,e[34]=t.voiceUploadFailedHint,e[35]=oe):oe=e[35];let ce=oe,G;e[36]===b?G=e[37]:(G=async(e,t)=>{await j(e,{pinned:t}),await b()},e[36]=b,e[37]=G);let le=G,K;e[38]===b?K=e[39]:(K=async e=>{await j(e,{status:`archived`}),await b()},e[38]=b,e[39]=K);let q=K,ue;e[40]===b?ue=e[41]:(ue=async e=>{await F(e),await b()},e[40]=b,e[41]=ue);let de=ue,fe;e[42]===d?fe=e[43]:(fe=e=>{d(`/notes/${e}`)},e[42]=d,e[43]=fe);let pe=fe;if(!n){let n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(_,{className:`h-10 w-10 text-fg-muted`}),e[44]=n):n=e[44];let r;return e[45]===t.needToken?r=e[46]:(r=(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n,(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]}),e[45]=t.needToken,e[46]=r),r}let me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,W.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),e[47]=me):me=e[47];let Y;e[48]===l?Y=e[49]:(Y=e=>l({type:`patch`,patch:{search:e.target.value}}),e[48]=l,e[49]=Y);let X;e[50]!==t.searchPlaceholder||e[51]!==Y||e[52]!==r.search?(X=(0,W.jsxs)(`div`,{className:`relative`,children:[me,(0,W.jsx)(`input`,{type:`search`,value:r.search,onChange:Y,placeholder:t.searchPlaceholder,className:`w-full rounded-xl border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`})]}),e[50]=t.searchPlaceholder,e[51]=Y,e[52]=r.search,e[53]=X):X=e[53];let Z;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Z=[`all`,`inbox`,`processed`,`archived`],e[54]=Z):Z=e[54];let $;e[55]!==l||e[56]!==t.filterAll||e[57]!==t.filterArchived||e[58]!==t.filterInbox||e[59]!==t.filterProcessed||e[60]!==r.statusFilter?($=Z.map(e=>{let n=e===`all`?t.filterAll:e===`inbox`?t.filterInbox:e===`processed`?t.filterProcessed:t.filterArchived;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{statusFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.statusFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[55]=l,e[56]=t.filterAll,e[57]=t.filterArchived,e[58]=t.filterInbox,e[59]=t.filterProcessed,e[60]=r.statusFilter,e[61]=$):$=e[61];let Se,Ce;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,W.jsx)(`div`,{className:`mx-1 h-4 w-px bg-edge-subtle`}),Ce=[`all`,`thought`,`todo`,`voice`,`media`,`bookmark`],e[62]=Se,e[63]=Ce):(Se=e[62],Ce=e[63]);let we;e[64]!==l||e[65]!==t.kindAll||e[66]!==t.kindBookmark||e[67]!==t.kindMedia||e[68]!==t.kindThought||e[69]!==t.kindTodo||e[70]!==t.kindVoice||e[71]!==r.kindFilter?(we=Ce.map(e=>{let n=e===`all`?t.kindAll:e===`thought`?t.kindThought:e===`todo`?t.kindTodo:e===`voice`?t.kindVoice:e===`media`?t.kindMedia:t.kindBookmark;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{kindFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.kindFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[64]=l,e[65]=t.kindAll,e[66]=t.kindBookmark,e[67]=t.kindMedia,e[68]=t.kindThought,e[69]=t.kindTodo,e[70]=t.kindVoice,e[71]=r.kindFilter,e[72]=we):we=e[72];let Te;e[73]!==$||e[74]!==we?(Te=(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[$,Se,we]}),e[73]=$,e[74]=we,e[75]=Te):Te=e[75];let Ee;e[76]!==X||e[77]!==Te?(Ee=(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 p-4 pb-2`,children:[X,Te]}),e[76]=X,e[77]=Te,e[78]=Ee):Ee=e[78];let De;e[79]!==q||e[80]!==de||e[81]!==pe||e[82]!==le||e[83]!==t.archive||e[84]!==t.delete||e[85]!==t.imageNote||e[86]!==t.noNotes||e[87]!==t.noNotesDescription||e[88]!==t.noText||e[89]!==t.pin||e[90]!==t.unpin||e[91]!==k||e[92]!==u||e[93]!==T||e[94]!==ne?(De=(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-3 pb-24 [scrollbar-gutter:stable]`,children:T?(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:[1,2,3].map(ge)}):k.length===0?(0,W.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 py-16 text-center`,children:[(0,W.jsx)(_,{className:`h-8 w-8 text-fg-muted`}),(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:t.noNotes}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.noNotesDescription})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:k.map((e,n)=>{let r=n>0?te(k[n-1].createdAt):null;return(0,W.jsxs)(`div`,{children:[te(e.createdAt)!==r&&(0,W.jsx)(`div`,{className:E(`pb-2 text-xs font-medium text-fg-muted`,n>0&&`pt-2`),children:V(e.createdAt,u,ne)}),(0,W.jsx)(J,{note:e,onPress:pe,onPin:le,onArchive:q,onDelete:de,timeLabels:ne,labels:{pin:t.pin,unpin:t.unpin,archive:t.archive,delete:t.delete,imageNote:t.imageNote,noText:t.noText}})]},e.id)})})}),e[79]=q,e[80]=de,e[81]=pe,e[82]=le,e[83]=t.archive,e[84]=t.delete,e[85]=t.imageNote,e[86]=t.noNotes,e[87]=t.noNotesDescription,e[88]=t.noText,e[89]=t.pin,e[90]=t.unpin,e[91]=k,e[92]=u,e[93]=T,e[94]=ne,e[95]=De):De=e[95];let Oe;e[96]!==H||e[97]!==ae||e[98]!==ce||e[99]!==t.quickCapturePlaceholder||e[100]!==t.recording||e[101]!==t.send?(Oe=(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-surface-panel from-60% via-surface-panel/90 to-transparent px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-6`,children:(0,W.jsx)(`div`,{className:`pointer-events-auto`,children:(0,W.jsx)(Q,{placeholder:t.quickCapturePlaceholder,sendLabel:t.send,onCapture:H,onImagePick:ae,onVoiceCapture:ce,recordingLabel:t.recording})})}),e[96]=H,e[97]=ae,e[98]=ce,e[99]=t.quickCapturePlaceholder,e[100]=t.recording,e[101]=t.send,e[102]=Oe):Oe=e[102];let ke;return e[103]!==Ee||e[104]!==De||e[105]!==Oe?(ke=(0,W.jsxs)(`div`,{className:`relative mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col overflow-hidden`,children:[Ee,De,Oe]}),e[103]=Ee,e[104]=De,e[105]=Oe,e[106]=ke):ke=e[106],ke}function ge(e){return(0,W.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl bg-surface-hover`},e)}function _e(e){return e.clearPageHeader}function ve(e){return e.setPageHeader}function ye(){return Date.now()}function be(e){return e.token}function xe(e){return e.language}export{$ as NotesPage};
|