@xopcai/xopc 0.0.324 → 0.0.329
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/README.md +4 -3
- package/README.zh-CN.md +4 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B-Gczr_A.js → agent-avatar-dicebear-Bs1qnnhD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHJyAT7t.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DLKj_iIh.js +1 -0
- package/dist/gateway/static/root/assets/agents-SXZ5O0g4.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BwWdVRlb.js → app-management-settings-panel-BrIji9B5.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-EoXNDO1j.js → appearance-settings-Uts-MQ7K.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DcclVdxW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-B_T0uMvL.js → archive-plugin-_EzRfBuI.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D9DDwxd2.js → attachment-load-CHg7_XFl.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-jI9vNr2r.js → automations-page-CGMErk_w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Cc4yqiF6.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Dzsxh9OL.js → binary-plugins-D3WB-tVn.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CWUUgWWk.js → block-editor-Cm1W-14I.js} +53 -53
- package/dist/gateway/static/root/assets/box-DvYoGszj.js +1 -0
- package/dist/gateway/static/root/assets/braces-Cfmtagno.js +1 -0
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DSWXq9lI.js → browser-automation-inputs-VnvK-GQP.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CZYCvSSU.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-DDz9PE6m.js +3 -0
- package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-DH3aDk53.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C8jMZAJl.js +8 -0
- package/dist/gateway/static/root/assets/capability-discover-page-CgGvsf3t.js +1 -0
- package/dist/gateway/static/root/assets/capability-header-actions-C3chJDQu.js +1 -0
- package/dist/gateway/static/root/assets/capability-icon-BYm2-nS-.js +1 -0
- package/dist/gateway/static/root/assets/channels-CuVS_KsY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-WXZrEB3K.js → chat-terminal-dock-ClbmjCL2.js} +2 -2
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-BfZaf516.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-F-fYNIx8.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-B4SLpvSL.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DXQTsUJn.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-B_z3zihW.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DPVPqFlh.js → desktop-pet-C1TZzKS3.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-B5JGIfqn.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DFYK_Ywf.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-BfxaNwMB.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-cuG5Lnwf.js → extension-debug-page-Bs8_FYCm.js} +1 -1
- package/dist/gateway/static/root/assets/extension-marketplace-api-DqV4YRYs.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-BCTAXdyE.js → extension-page-DH5vFbBw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-kadW_icu.js → extension-settings-page-hGKovxxC.js} +1 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-CoQVulMd.js → gateway-config-swr-BYMrbKZE.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BIsiP-JI.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B5GJ-CQV.js → gateway-startup-retry-DMqYXHAn.js} +1 -1
- package/dist/gateway/static/root/assets/gauge-C78eD2BA.js +1 -0
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +1 -0
- package/dist/gateway/static/root/assets/home-page-CoBivEvx.js +1 -0
- package/dist/gateway/static/root/assets/image-Cwyalflz.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DvWDkbk1.js → image-generation-api-D1sQGaJz.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-rssb4rjP.js +1 -0
- package/dist/gateway/static/root/assets/inbox-DNoSz682.js +1 -0
- package/dist/gateway/static/root/assets/index-C4QN4gCi.css +1 -0
- package/dist/gateway/static/root/assets/index-Cr4SINLG.js +121 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C1fKIjz4.js → keyboard-shortcuts-settings-CMitbles.js} +1 -1
- package/dist/gateway/static/root/assets/layout-grid-CEVZdVFU.js +1 -0
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
- package/dist/gateway/static/root/assets/list-BBGUdmkF.js +1 -0
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-Di82Oacm.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-CCvA9d9L.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-BPZR8x9b.js → locale-store-BSkKhYkc.js} +1 -1
- package/dist/gateway/static/root/assets/lock-keyhole-DEK5kH0u.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-BK8ol1q0.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-CebXkEtB.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-Dft8ASFD.js → markdown-view-DXubGEic.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-Cjj-fidX.js → media-plugins-DLJrmU9J.js} +1 -1
- package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +1 -0
- package/dist/gateway/static/root/assets/messages-D0G_sZvA.js +3 -0
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-B0EUPwTv.js +1 -0
- package/dist/gateway/static/root/assets/network-BUQLY1BV.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-xsKDIJdK.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-1qg2v-9j.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-BFm7XnWH.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-C3JiQEKD.js +1 -0
- package/dist/gateway/static/root/assets/paperclip-f1HujQY1.js +1 -0
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +1 -0
- package/dist/gateway/static/root/assets/power-ZI-pBczI.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-buk_gdip.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DlpCi5zT.js → product-open-page-DwEEO0Ak.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CRQGCRSU.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DcqylysA.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DWWO6ajd.js → registry-api-tx8XCHOs.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cq5MaiRW.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BT_ANpaT.js → runtime-tools-settings-panel-De7HmmBu.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-GXJ-b3dO.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-BcqsqSsV.js → schema-form-DPMEuj5D.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/server-BlHCBjiE.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-C6FwYIRA.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BEyQiZs0.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DM0D-BQ_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-B65vii9U.js → settings-page-CWS9yOH3.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-BhGKiTPf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BS8o58NJ.js → share-preview-page-CcRi2yGy.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DNmcCBfX.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-BCAV_F1P.js +1 -0
- package/dist/gateway/static/root/assets/skill-card-icon-BrrpZ3Mw.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BEV2WXGk.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C8zOGpKw.js +2 -0
- package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +1 -0
- package/dist/gateway/static/root/assets/stethoscope-DRqTAtjD.js +1 -0
- package/dist/gateway/static/root/assets/store-SzD1Jvgm.js +1 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C_lajq9u.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-Dk8Bmlhw.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-CYvKiE_f.js +1 -0
- package/dist/gateway/static/root/assets/upload-rrb46c3c.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-ZTHe1zCM.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-C_SPNZbP.js +2 -0
- package/dist/gateway/static/root/assets/user-round-C9jxPhMR.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DJV-qERt.js → voice-api-key-field-C8Kpkct-.js} +1 -1
- package/dist/gateway/static/root/assets/voice-config-api-BvzxINUk.js +1 -0
- package/dist/gateway/static/root/assets/wand-sparkles-DWuJz5ya.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DcHhy54L.js → work-discovery-overlay-ClB6T-dm.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-X0Cyh2AR.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BrL6dzf0.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +1 -0
- package/dist/gateway/static/root/connector-icons/wecom.svg +9 -0
- package/dist/gateway/static/root/index.html +26 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
- package/dist/src/agent/agent-manager.d.ts +4 -2
- package/dist/src/agent/agent-manager.js +58 -19
- package/dist/src/agent/background-review/coordinator.d.ts +2 -7
- package/dist/src/agent/background-review/coordinator.js +17 -34
- package/dist/src/agent/background-review/prompts.d.ts +13 -5
- package/dist/src/agent/background-review/prompts.js +17 -12
- package/dist/src/agent/background-review/run-background-review.d.ts +3 -3
- package/dist/src/agent/background-review/run-background-review.js +58 -43
- package/dist/src/agent/context/execution-context.js +5 -2
- package/dist/src/agent/mcp/index.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +2 -2
- package/dist/src/agent/mcp/oauth/index.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +2 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +12 -0
- package/dist/src/agent/tools/user-context-tool.js +29 -4
- package/dist/src/automations/domain/types.d.ts +7 -1
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +36 -13
- package/dist/src/automations/service/automation-service.js +2 -1
- package/dist/src/browser/automations/index.js +2 -2
- package/dist/src/browser/automations/service.d.ts +11 -2
- package/dist/src/browser/automations/service.js +19 -5
- package/dist/src/capabilities/readiness/from-config.d.ts +0 -1
- package/dist/src/capabilities/readiness/from-config.js +2 -4
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +2 -1
- package/dist/src/config/schema.js +4 -4
- package/dist/src/connectors/china-catalog.js +5 -1
- package/dist/src/connectors/connected-source-ingestion.js +6 -1
- package/dist/src/connectors/connected-source-observations.d.ts +10 -0
- package/dist/src/connectors/connected-source-observations.js +80 -0
- package/dist/src/connectors/connected-source-understanding.js +198 -8
- package/dist/src/connectors/learning-coordinator.js +63 -26
- package/dist/src/connectors/learning-recipes.js +19 -2
- package/dist/src/discussions/audio-repair.d.ts +1 -1
- package/dist/src/discussions/live-worker.js +1 -3
- package/dist/src/discussions/recording.js +2 -2
- package/dist/src/discussions/sealer.js +2 -2
- package/dist/src/extensions/agent-plugins/auth.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/auth.js +6 -35
- package/dist/src/extensions/agent-plugins/credentials.d.ts +2 -0
- package/dist/src/extensions/agent-plugins/credentials.js +37 -0
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +1 -0
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +8 -0
- package/dist/src/extensions/marketplace.d.ts +4 -0
- package/dist/src/extensions/marketplace.js +4 -0
- package/dist/src/gateway/file-space-service.d.ts +9 -2
- package/dist/src/gateway/hono/routes/agent-plugins.js +2 -1
- package/dist/src/gateway/hono/routes/config.js +0 -3
- package/dist/src/gateway/hono/routes/connectors.js +3 -10
- package/dist/src/gateway/hono/routes/context-sources.d.ts +0 -1
- package/dist/src/gateway/hono/routes/context-sources.js +12 -15
- package/dist/src/gateway/hono/routes/status.js +0 -1
- package/dist/src/gateway/hono/routes/user-model.js +21 -3
- package/dist/src/gateway/hono/routes/voice.js +0 -67
- package/dist/src/gateway/service.js +6 -4
- package/dist/src/media-understanding/types.d.ts +1 -1
- package/dist/src/memory-maintenance/service.d.ts +1 -0
- package/dist/src/memory-maintenance/service.js +13 -0
- package/dist/src/migrations/retired-local-stt.d.ts +2 -0
- package/dist/src/migrations/retired-local-stt.js +52 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/storage/sqlite/connection.js +1 -0
- package/dist/src/storage/sqlite/migrations/207_user_model_policy_contract.sql +121 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/sql-assets.d.ts +1 -0
- package/dist/src/storage/sqlite/sql-assets.js +7 -4
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +4 -2
- package/dist/src/tasks/task-context-assembler.js +10 -1
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
- package/dist/src/tasks/task-run-dispatcher.js +15 -2
- package/dist/src/user-context/sources/consent-repository.d.ts +7 -0
- package/dist/src/user-context/sources/consent-repository.js +81 -0
- package/dist/src/user-context/sources/index.d.ts +1 -0
- package/dist/src/user-context/sources/index.js +2 -1
- package/dist/src/user-context/sources/repository.js +73 -1
- package/dist/src/user-context/sources/types.d.ts +16 -0
- package/dist/src/user-model/action-rule-suggestions.d.ts +11 -0
- package/dist/src/user-model/action-rule-suggestions.js +29 -0
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +83 -7
- package/dist/src/user-model/capture/semantic.d.ts +5 -2
- package/dist/src/user-model/capture/semantic.js +27 -11
- package/dist/src/user-model/domain.d.ts +26 -0
- package/dist/src/user-model/domain.js +40 -2
- package/dist/src/user-model/index.d.ts +2 -0
- package/dist/src/user-model/index.js +6 -4
- package/dist/src/user-model/maintenance-policy.d.ts +1 -0
- package/dist/src/user-model/maintenance-policy.js +13 -0
- package/dist/src/user-model/observation-repository.d.ts +48 -0
- package/dist/src/user-model/observation-repository.js +100 -0
- package/dist/src/user-model/repository.d.ts +5 -0
- package/dist/src/user-model/repository.js +121 -10
- package/dist/src/user-model/usage-policy.d.ts +5 -2
- package/dist/src/user-model/usage-policy.js +2 -2
- package/dist/src/voice/audio/normalize.d.ts +1 -1
- package/dist/src/voice/audio/normalize.js +1 -1
- package/dist/src/voice/{local → audio}/wav.js +1 -1
- package/dist/src/voice/language-profile.js +10 -16
- package/dist/src/voice/metadata/builtin.js +0 -46
- package/dist/src/voice/stt/providers/index.d.ts +0 -1
- package/dist/src/voice/stt/providers/index.js +1 -2
- package/dist/src/voice/stt/types.js +3 -4
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/speech-registry.d.ts +1 -1
- package/dist/src/voice/tts/types.d.ts +1 -1
- package/dist/src/work-discovery/analyzer.js +6 -5
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/work-discovery/types.d.ts +1 -1
- package/dist/src/workflows/context/workflow-context.js +5 -1
- package/dist/src/workflows/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +13 -4
- package/package.json +13 -17
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CxcIHW_Z.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CNuqJcHQ.js +0 -1
- package/dist/gateway/static/root/assets/agents-CPpmkx7O.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-6xEgLDv8.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-rztQnZDk.js +0 -7
- package/dist/gateway/static/root/assets/browser-automations-page-D96o3bDY.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-DUQzQ3ic.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CKWtXof8.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-C8ducWB7.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-uy9YDwxJ.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-BpF0SjB9.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-eZTfIMWI.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-Do1dl0La.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-BhS8s080.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Dv3vG9HZ.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DdvO1O6W.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CLZyN-u9.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BSqg-JE9.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-_pddpuej.js +0 -1
- package/dist/gateway/static/root/assets/index-BKL5tg2f.css +0 -1
- package/dist/gateway/static/root/assets/index-CJuypaNt.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-DXFnYiA0.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-CkXKS5xe.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-C33z-ife.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-8eDZb0uS.js +0 -1
- package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C95RtLuL.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-kFxknjMR.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-OUL3fEYh.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-CVbY7_N5.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-CKiIby0r.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-LPAxUszX.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-Cbyb4hyy.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BtDFZc6g.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-CJlc-mg1.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-CUo6-iV2.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-XeSxPjP7.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-Dol9j_pF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-eqTUTW2L.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BCt__prc.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BsjSqEnw.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-evN7gs0S.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BifYwEhe.js +0 -2
- package/dist/gateway/static/root/assets/skills-page.utils-DOk-iOvN.js +0 -1
- package/dist/gateway/static/root/assets/system-settings-panel-CcSvoHfY.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-pCRG7Jb3.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-DDGMf44u.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DiIkxIq7.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CvYeM0Ml.js +0 -2
- package/dist/gateway/static/root/assets/voice-config-api-BaxITrwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DbVtLh0R.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-CT8ouKcB.js +0 -6
- package/dist/src/voice/local/model-files.d.ts +0 -14
- package/dist/src/voice/local/model-files.js +0 -92
- package/dist/src/voice/local/model-manager.d.ts +0 -18
- package/dist/src/voice/local/model-manager.js +0 -133
- package/dist/src/voice/local/models.d.ts +0 -28
- package/dist/src/voice/local/models.js +0 -99
- package/dist/src/voice/local/provider-switch.d.ts +0 -4
- package/dist/src/voice/local/provider-switch.js +0 -36
- package/dist/src/voice/local/runtime-client.d.ts +0 -28
- package/dist/src/voice/local/runtime-client.js +0 -183
- package/dist/src/voice/local/runtime-worker.d.ts +0 -1
- package/dist/src/voice/local/runtime-worker.js +0 -271
- package/dist/src/voice/stt/providers/local-transcription.d.ts +0 -2
- package/dist/src/voice/stt/providers/local-transcription.js +0 -53
- /package/dist/src/voice/{local → audio}/wav.d.ts +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a,g as o,t as s,u as c}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as l}from"./popover-select-DcsFzD_i.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./markdown-view-Dft8ASFD.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{c as h,n as g}from"./locale-store-BPZR8x9b.js";import{t as _}from"./messages-kFWhF6_t.js";import{a as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{t as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CS04eWY9.js";import{i as E}from"./gateway-config-swr-CoQVulMd.js";import{Ac as D,Bc as O,Fi as k,Fo as A,Fu as j,Gc as M,Io as N,Ma as P,Mi as F,Ni as I,Nu as L,Ul as R,jc as ee,nl as z,od as B,qa as V,qs as H,ya as U}from"./index-CJuypaNt.js";import{t as te}from"./page-tabs-CVbY7_N5.js";import{t as W}from"./skill-reload-api-evN7gs0S.js";import{_ as G,a as K,c as q,d as ne,f as re,g as J,h as Y,i as ie,l as ae,m as oe,n as se,o as ce,p as le,r as X,s as ue,t as de,u as fe}from"./skills-page.utils-DOk-iOvN.js";var Z=e(t(),1),pe=n(),Q=r();function me(e){let t=(0,pe.c)(12),{sk:n,findingSkills:r,onFindSkills:i,secondary:a}=e,o=a===void 0?!1:a,s=r?R:M,c=o?`secondary`:`primary`,l;t[0]===i?l=t[1]:(l=()=>void i(),t[0]=i,t[1]=l);let u=r?`size-4 animate-spin`:`size-4`,d;t[2]!==s||t[3]!==u?(d=(0,Q.jsx)(s,{className:u,"aria-hidden":!0}),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f;return t[5]!==r||t[6]!==n.findCta||t[7]!==n.findHint||t[8]!==c||t[9]!==l||t[10]!==d?(f=(0,Q.jsxs)(T,{variant:c,className:`shrink-0`,title:n.findHint,disabled:r,"aria-busy":r,onClick:l,children:[d,n.findCta]}),t[5]=r,t[6]=n.findCta,t[7]=n.findHint,t[8]=c,t[9]=l,t[10]=d,t[11]=f):f=t[11],f}var he=(0,Z.memo)(function(e){let t=(0,pe.c)(33),{findingSkills:n,onFindSkills:r,loading:i,onReloadClick:a,searchQuery:o,setSearchQuery:c,mainTab:l,sk:u,setPendingFile:d,setInstallOpen:p}=e,m=g(ge),h;t[0]===m?h=t[1]:(h=_(m),t[0]=m,t[1]=h);let v=h.imports.title,y;t[2]===v?y=t[3]:(y=(0,Q.jsx)(s,{to:`/settings/imports`,className:`text-sm text-accent hover:underline`,children:v}),t[2]=v,t[3]=y);let b;t[4]!==i||t[5]!==a||t[6]!==u.reloadDiskAria||t[7]!==u.reloadRuntime?(b=(0,Q.jsx)(U,{className:`size-9 shrink-0 p-0`,loading:i,label:u.reloadDiskAria,title:u.reloadRuntime,onClick:a}),t[4]=i,t[5]=a,t[6]=u.reloadDiskAria,t[7]=u.reloadRuntime,t[8]=b):b=t[8];let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=x):x=t[9];let S;t[10]===c?S=t[11]:(S=e=>c(e.target.value),t[10]=c,t[11]=S);let C=l===`marketplace`?u.marketplaceSearchPackages:u.searchPlaceholder,w;t[12]!==o||t[13]!==S||t[14]!==C?(w=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[x,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:o,onChange:S,placeholder:C,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[12]=o,t[13]=S,t[14]=C,t[15]=w):w=t[15];let E;t[16]!==p||t[17]!==d?(E=()=>{d(null),p(!0)},t[16]=p,t[17]=d,t[18]=E):E=t[18];let D;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(f,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[19]=D):D=t[19];let O;t[20]!==u.installCta||t[21]!==E?(O=(0,Q.jsxs)(T,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,onClick:E,children:[D,u.installCta]}),t[20]=u.installCta,t[21]=E,t[22]=O):O=t[22];let k;t[23]!==n||t[24]!==r||t[25]!==u?(k=(0,Q.jsx)(me,{sk:u,findingSkills:n,onFindSkills:r}),t[23]=n,t[24]=r,t[25]=u,t[26]=k):k=t[26];let A;return t[27]!==O||t[28]!==k||t[29]!==y||t[30]!==b||t[31]!==w?(A=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[y,b,w,O,k]}),t[27]=O,t[28]=k,t[29]=y,t[30]=b,t[31]=w,t[32]=A):A=t[32],A});function ge(e){return e.language}var _e=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ve(){let e=(0,pe.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:m(`h-4 min-w-0 flex-1`,_e)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(`div`,{className:m(`size-8 shrink-0 rounded-lg`,_e)}),(0,Q.jsx)(`div`,{className:m(`h-8 w-[4.5rem] shrink-0 rounded-lg`,_e)})]})]}),r=(0,Q.jsx)(`div`,{className:m(`h-3 w-full`,_e)}),i=(0,Q.jsx)(`div`,{className:m(`h-3 w-[92%]`,_e)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,Q.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,Q.jsx)(`div`,{className:m(`h-3 w-full`,_e)}),(0,Q.jsx)(`div`,{className:m(`h-2.5 w-4/5`,_e)})]})]})})}),e[4]=a):a=e[4],a}function ye(){let e=(0,pe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(ve,{}),e[0]=t):t=e[0],t}var be=new Set([`installed`,`marketplace`]),xe=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),Se=new Set([`all`,`enabled`,`disabled`]),Ce=`mprov`,we=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],Te=[`business`,`creative`,`documents`,`engineering`,`tools`];function Ee(e){let t=(0,pe.c)(42),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:c,catalogDisplayRows:l,skillPresentation:d,catalogStatusFilter:f,resolveSkillEnabled:p,categoryLabel:h,sourceLabel:g,openSkillDetail:_,onSkillToggle:v,onUseSkillInChat:y,usingSkillInChatName:b,togglingSkillName:x}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=we.map(De),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let r;t[3]===n.empty?r=t[4]:(r=(0,Q.jsx)(`p`,{className:`mb-3`,children:n.empty}),t[3]=n.empty,t[4]=r);let i;t[5]!==e.findingSkills||t[6]!==e.onFindSkills||t[7]!==n?(i=(0,Q.jsx)(me,{sk:n,findingSkills:e.findingSkills,onFindSkills:e.onFindSkills,secondary:!0}),t[5]=e.findingSkills,t[6]=e.onFindSkills,t[7]=n,t[8]=i):i=t[8];let a;return t[9]!==r||t[10]!==i?(a=(0,Q.jsxs)(`div`,{className:`py-16 text-center text-sm text-fg-muted`,children:[r,i]}),t[9]=r,t[10]=i,t[11]=a):a=t[11],a}if(a.length===0){let r;t[12]===n.noSearchResults?r=t[13]:(r=(0,Q.jsx)(`p`,{className:`mb-3`,children:n.noSearchResults}),t[12]=n.noSearchResults,t[13]=r);let i;t[14]!==e.findingSkills||t[15]!==e.onFindSkills||t[16]!==n?(i=(0,Q.jsx)(me,{sk:n,findingSkills:e.findingSkills,onFindSkills:e.onFindSkills,secondary:!0}),t[14]=e.findingSkills,t[15]=e.onFindSkills,t[16]=n,t[17]=i):i=t[17];let a;return t[18]!==r||t[19]!==i?(a=(0,Q.jsxs)(`div`,{className:`py-16 text-center text-sm text-fg-muted`,children:[r,i]}),t[18]=r,t[19]=i,t[20]=a):a=t[20],a}let S;t[21]!==o||t[22]!==s||t[23]!==h||t[24]!==c||t[25]!==n?(S=o.length>1?(0,Q.jsx)(te,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:h(e),title:h(e)}))],activeTab:s,onChange:c,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[21]=o,t[22]=s,t[23]=h,t[24]=c,t[25]=n,t[26]=S):S=t[26];let C;t[27]!==l||t[28]!==f||t[29]!==v||t[30]!==y||t[31]!==_||t[32]!==p||t[33]!==n||t[34]!==d||t[35]!==g||t[36]!==x||t[37]!==b?(C=l.length===0?(0,Q.jsx)(`div`,{className:`py-16 text-center text-sm text-fg-muted`,children:f===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>{let t=p(e),r=d(e);return(0,Q.jsxs)(`article`,{className:m(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:m(`min-w-0 flex-1 cursor-pointer rounded-lg text-left outline-none`,H.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void _(e),children:(0,Q.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`truncate text-[15px] font-semibold leading-8 tracking-tight text-fg`,children:r.displayName})}),t?(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name||x===e.name,onClick:()=>void y({name:e.name,source:`catalog`}),children:b===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,Q.jsx)(T,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===e.name,onClick:()=>void v(e.name,!0),children:x===e.name?n.uploading:n.detailModalEnable})]}),(0,Q.jsx)(`button`,{type:`button`,className:m(`mt-2 flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,H.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void _(e),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:r.description||void 0,children:r.description||`—`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:g(e)}),(0,Q.jsxs)(`span`,{className:m(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,Q.jsx)(u,{className:`size-3`,"aria-hidden":!0}):(0,Q.jsx)(B,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]}),e.managed?(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,Q.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})})]},`${e.directoryId}-${e.path}`)})}),t[27]=l,t[28]=f,t[29]=v,t[30]=y,t[31]=_,t[32]=p,t[33]=n,t[34]=d,t[35]=g,t[36]=x,t[37]=b,t[38]=C):C=t[38];let w;return t[39]!==S||t[40]!==C?(w=(0,Q.jsxs)(Q.Fragment,{children:[S,C]}),t[39]=S,t[40]=C,t[41]=w):w=t[41],w}function De(e){return(0,Q.jsx)(ye,{},e)}function Oe(e){let t=(0,pe.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,Q.jsx)(S,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?X(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,Q.jsx)(T,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let h;t[16]===s?h=t[17]:(h=()=>void s(),t[16]=s,t[17]=h);let g;t[18]!==n.deleteConfirm||t[19]!==h?(g=(0,Q.jsx)(T,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:h,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=h,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==g?(_=(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,g]}),t[21]=m,t[22]=g,t[23]=_):_=t[23];let y;t[24]!==_||t[25]!==u||t[26]!==f?(y=(0,Q.jsxs)(b,{children:[l,(0,Q.jsxs)(x,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,children:[u,f,_]})]}),t[24]=_,t[25]=u,t[26]=f,t[27]=y):y=t[27];let w;return t[28]!==r||t[29]!==c||t[30]!==y?(w=(0,Q.jsx)(C,{open:r,onOpenChange:c,children:y}),t[28]=r,t[29]=c,t[30]=y,t[31]=w):w=t[31],w}function ke(e){let t=(0,pe.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ae(e){let t=(0,pe.c)(119),{preview:n,description:r,sk:i}=e,a=n.metadata,o=n.toolConditions,s=!!o&&(o.requiresTools.length>0||o.requiresToolsets.length>0||o.fallbackForTools.length>0||o.fallbackForToolsets.length>0),c=a.requires,l=c&&((c.bins?.length??0)>0||(c.env?.length??0)>0||(c.anyBins?.length??0)>0),u,f,p,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==o||t[2]!==l||t[3]!==s||t[4]!==a.emoji||t[5]!==a.homepage||t[6]!==a.install||t[7]!==a.os||t[8]!==n.description||t[9]!==n.disableModelInvocation||t[10]!==n.requiredEnvVarNames||t[11]!==c||t[12]!==i.detailEnvVarsLabel||t[13]!==i.detailHomepageLabel||t[14]!==i.detailInstallLabel||t[15]!==i.detailNotInjectedNote||t[16]!==i.detailPlatformsLabel||t[17]!==i.detailRequiresAnyBins||t[18]!==i.detailRequiresBins||t[19]!==i.detailRequiresEnv||t[20]!==i.detailRequiresLabel||t[21]!==i.detailSummaryHeading||t[22]!==i.detailToolGatingLabel||t[23]!==i.detailToolsFallbackList||t[24]!==i.detailToolsRequiresList||t[25]!==i.detailToolsetsFallbackList||t[26]!==i.detailToolsetsRequiresList){let e=a.install?.filter(Ne)??[],d=n.requiredEnvVarNames?.filter(Me)??[];v=`space-y-6`,g=`skill-detail-summary-heading`,t[42]===i.detailSummaryHeading?_=t[43]:(_=(0,Q.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:i.detailSummaryHeading}),t[42]=i.detailSummaryHeading,t[43]=_),b=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[44]===a.emoji?x=t[45]:(x=a.emoji?.trim()?(0,Q.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:a.emoji.trim()}):null,t[44]=a.emoji,t[45]=x);let D;t[46]===a.emoji?D=t[47]:(D=a.emoji?.trim()?`mt-2`:``,t[46]=a.emoji,t[47]=D);let O;t[48]===D?O=t[49]:(O=m(`text-sm leading-relaxed text-fg`,D),t[48]=D,t[49]=O);let k=r??n.description;t[50]!==O||t[51]!==k?(S=(0,Q.jsx)(`p`,{className:O,children:k}),t[50]=O,t[51]=k,t[52]=S):S=t[52],t[53]!==n.disableModelInvocation||t[54]!==i.detailNotInjectedNote?(C=n.disableModelInvocation?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:i.detailNotInjectedNote}):null,t[53]=n.disableModelInvocation,t[54]=i.detailNotInjectedNote,t[55]=C):C=t[55];let A;t[56]===a.homepage?A=t[57]:(A=a.homepage?.trim()?(0,Q.jsx)(`a`,{href:a.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:a.homepage.trim()}):null,t[56]=a.homepage,t[57]=A),t[58]!==i.detailHomepageLabel||t[59]!==A?(w=(0,Q.jsx)(ke,{label:i.detailHomepageLabel,children:A}),t[58]=i.detailHomepageLabel,t[59]=A,t[60]=w):w=t[60];let j;t[61]===a.os?j=t[62]:(j=a.os&&a.os.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:a.os.join(`, `)}):null,t[61]=a.os,t[62]=j),t[63]!==i.detailPlatformsLabel||t[64]!==j?(T=(0,Q.jsx)(ke,{label:i.detailPlatformsLabel,children:j}),t[63]=i.detailPlatformsLabel,t[64]=j,t[65]=T):T=t[65];let M;t[66]!==l||t[67]!==c||t[68]!==i.detailRequiresAnyBins||t[69]!==i.detailRequiresBins||t[70]!==i.detailRequiresEnv?(M=l&&c?(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[c.bins&&c.bins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[i.detailRequiresBins,`: `]}),c.bins.join(`, `)]}):null,c.env&&c.env.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[i.detailRequiresEnv,`: `]}),(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:c.env.join(`, `)})]}):null,c.anyBins&&c.anyBins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[i.detailRequiresAnyBins,`: `]}),c.anyBins.join(`, `)]}):null]}):null,t[66]=l,t[67]=c,t[68]=i.detailRequiresAnyBins,t[69]=i.detailRequiresBins,t[70]=i.detailRequiresEnv,t[71]=M):M=t[71],t[72]!==i.detailRequiresLabel||t[73]!==M?(E=(0,Q.jsx)(ke,{label:i.detailRequiresLabel,children:M}),t[72]=i.detailRequiresLabel,t[73]=M,t[74]=E):E=t[74];let N=e.length>0?(0,Q.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(je)}):null;t[75]!==i.detailInstallLabel||t[76]!==N?(p=(0,Q.jsx)(ke,{label:i.detailInstallLabel,children:N}),t[75]=i.detailInstallLabel,t[76]=N,t[77]=p):p=t[77];let P;t[78]!==o||t[79]!==s||t[80]!==i.detailToolsFallbackList||t[81]!==i.detailToolsRequiresList||t[82]!==i.detailToolsetsFallbackList||t[83]!==i.detailToolsetsRequiresList?(P=s&&o?(0,Q.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[o.requiresTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[i.detailToolsRequiresList,`: `]}),o.requiresTools.join(`, `)]}):null,o.requiresToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[i.detailToolsetsRequiresList,`: `]}),o.requiresToolsets.join(`, `)]}):null,o.fallbackForTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[i.detailToolsFallbackList,`: `]}),o.fallbackForTools.join(`, `)]}):null,o.fallbackForToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[i.detailToolsetsFallbackList,`: `]}),o.fallbackForToolsets.join(`, `)]}):null]}):null,t[78]=o,t[79]=s,t[80]=i.detailToolsFallbackList,t[81]=i.detailToolsRequiresList,t[82]=i.detailToolsetsFallbackList,t[83]=i.detailToolsetsRequiresList,t[84]=P):P=t[84],t[85]!==i.detailToolGatingLabel||t[86]!==P?(h=(0,Q.jsx)(ke,{label:i.detailToolGatingLabel,children:P}),t[85]=i.detailToolGatingLabel,t[86]=P,t[87]=h):h=t[87],u=ke,f=i.detailEnvVarsLabel,y=d.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:d.join(`, `)}):null,t[0]=r,t[1]=o,t[2]=l,t[3]=s,t[4]=a.emoji,t[5]=a.homepage,t[6]=a.install,t[7]=a.os,t[8]=n.description,t[9]=n.disableModelInvocation,t[10]=n.requiredEnvVarNames,t[11]=c,t[12]=i.detailEnvVarsLabel,t[13]=i.detailHomepageLabel,t[14]=i.detailInstallLabel,t[15]=i.detailNotInjectedNote,t[16]=i.detailPlatformsLabel,t[17]=i.detailRequiresAnyBins,t[18]=i.detailRequiresBins,t[19]=i.detailRequiresEnv,t[20]=i.detailRequiresLabel,t[21]=i.detailSummaryHeading,t[22]=i.detailToolGatingLabel,t[23]=i.detailToolsFallbackList,t[24]=i.detailToolsRequiresList,t[25]=i.detailToolsetsFallbackList,t[26]=i.detailToolsetsRequiresList,t[27]=u,t[28]=f,t[29]=p,t[30]=h,t[31]=g,t[32]=_,t[33]=v,t[34]=y,t[35]=b,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=E}else u=t[27],f=t[28],p=t[29],h=t[30],g=t[31],_=t[32],v=t[33],y=t[34],b=t[35],x=t[36],S=t[37],C=t[38],w=t[39],T=t[40],E=t[41];let D;t[88]!==u||t[89]!==f||t[90]!==y?(D=(0,Q.jsx)(u,{label:f,children:y}),t[88]=u,t[89]=f,t[90]=y,t[91]=D):D=t[91];let O;t[92]!==p||t[93]!==h||t[94]!==D||t[95]!==b||t[96]!==x||t[97]!==S||t[98]!==C||t[99]!==w||t[100]!==T||t[101]!==E?(O=(0,Q.jsxs)(`div`,{className:b,children:[x,S,C,w,T,E,p,h,D]}),t[92]=p,t[93]=h,t[94]=D,t[95]=b,t[96]=x,t[97]=S,t[98]=C,t[99]=w,t[100]=T,t[101]=E,t[102]=O):O=t[102];let k;t[103]!==g||t[104]!==_||t[105]!==O?(k=(0,Q.jsxs)(`section`,{"aria-labelledby":g,children:[_,O]}),t[103]=g,t[104]=_,t[105]=O,t[106]=k):k=t[106];let A;t[107]===i.detailInstructionsHeading?A=t[108]:(A=(0,Q.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:i.detailInstructionsHeading}),t[107]=i.detailInstructionsHeading,t[108]=A);let j;t[109]!==n.bodyMarkdown||t[110]!==i.detailNoInstructionsBody?(j=n.bodyMarkdown.trim()?(0,Q.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,Q.jsx)(d,{content:n.bodyMarkdown})}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:i.detailNoInstructionsBody}),t[109]=n.bodyMarkdown,t[110]=i.detailNoInstructionsBody,t[111]=j):j=t[111];let M;t[112]!==A||t[113]!==j?(M=(0,Q.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[A,j]}),t[112]=A,t[113]=j,t[114]=M):M=t[114];let N;return t[115]!==v||t[116]!==k||t[117]!==M?(N=(0,Q.jsxs)(`div`,{className:v,children:[k,M]}),t[115]=v,t[116]=k,t[117]=M,t[118]=N):N=t[118],N}function je(e,t){return(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,Q.jsx)(`span`,{className:`text-fg`,children:se(e)})},e.id||`${e.kind}-${t}`)}function Me(e){return e.trim()}function Ne(e){return e&&typeof e.kind==`string`}var Pe=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function Fe(e){let t=(0,pe.c)(78),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:l,setDetailCatalogPreview:u,detailMarketplacePreview:d,setDetailMarketplacePreview:f,detailLoading:h,detailError:g,setDetailError:_,detailEnabled:w,detailPresentation:E,detailDirectoryId:O,detailManaged:k,detailExternalUrl:A,usingSkillInChatName:M,installingMarketName:N,togglingSkillName:P,isSkillInstalledByName:F,onUseSkillInChat:I,onMarketInstall:L,onSkillToggle:R,setConfirmId:z,setConfirmOpen:B}=e,V;t[0]!==u||t[1]!==_||t[2]!==f||t[3]!==i||t[4]!==o||t[5]!==c?(V=e=>{i(e),e||(o(`catalog`),u(null),f(null),_(null),c(``))},t[0]=u,t[1]=_,t[2]=f,t[3]=i,t[4]=o,t[5]=c,t[6]=V):V=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=U):U=t[7];let te;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(te=m(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),t[8]=te):te=t[8];let W=s||`?`,G;t[9]===W?G=t[10]:(G=(0,Q.jsx)(ue,{name:W}),t[9]=W,t[10]=G);let K=E?.displayName||s||`—`,q;t[11]===K?q=t[12]:(q=(0,Q.jsx)(S,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:K}),t[11]=K,t[12]=q);let ne;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ne=m(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),t[13]=ne):ne=t[13];let re;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(p,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=re):re=t[14];let J;t[15]===n.detailCloseAria?J=t[16]:(J=(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ne,"aria-label":n.detailCloseAria,children:re})}),t[15]=n.detailCloseAria,t[16]=J);let Y;t[17]!==G||t[18]!==q||t[19]!==J?(Y=(0,Q.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[G,q,J]}),t[17]=G,t[18]=q,t[19]=J,t[20]=Y):Y=t[20];let ie;t[21]!==l||t[22]!==w||t[23]!==g||t[24]!==h||t[25]!==d||t[26]!==E?.description||t[27]!==a||t[28]!==n?(ie=(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:h?(0,Q.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Pe.map(Ie)}):g?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:g}):a===`catalog`&&l?(0,Q.jsxs)(Q.Fragment,{children:[w?null:(0,Q.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,Q.jsx)(D,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,Q.jsx)(Ae,{preview:l,description:E?.description,sk:n})]}):a===`store`&&d?(0,Q.jsx)(Ae,{preview:d,sk:n}):(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[21]=l,t[22]=w,t[23]=g,t[24]=h,t[25]=d,t[26]=E?.description,t[27]=a,t[28]=n,t[29]=ie):ie=t[29];let ae;t[30]!==A||t[31]!==a||t[32]!==n.marketplaceOpenExternal||t[33]!==n.marketplaceOpenExternalAria?(ae=a===`store`&&A?(0,Q.jsxs)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:m(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,H.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[30]=A,t[31]=a,t[32]=n.marketplaceOpenExternal,t[33]=n.marketplaceOpenExternalAria,t[34]=ae):ae=t[34];let oe;t[35]!==O||t[36]!==k||t[37]!==a||t[38]!==z||t[39]!==B||t[40]!==n.delete?(oe=a===`catalog`&&k&&O?(0,Q.jsxs)(T,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{z(O),B(!0)},children:[(0,Q.jsx)(ee,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[35]=O,t[36]=k,t[37]=a,t[38]=z,t[39]=B,t[40]=n.delete,t[41]=oe):oe=t[41];let se;t[42]!==ae||t[43]!==oe?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ae,oe]}),t[42]=ae,t[43]=oe,t[44]=se):se=t[44];let ce;t[45]!==w||t[46]!==h||t[47]!==a||t[48]!==s||t[49]!==N||t[50]!==F||t[51]!==L||t[52]!==R||t[53]!==I||t[54]!==i||t[55]!==n.cancel||t[56]!==n.detailModalDisable||t[57]!==n.detailModalEnable||t[58]!==n.marketplaceInstall||t[59]!==n.marketplaceReinstall||t[60]!==n.previewUseInChat||t[61]!==n.previewUseInChatBusy||t[62]!==n.uploading||t[63]!==n.useRequiresEnabled||t[64]!==P||t[65]!==M?(ce=(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:!s||h||M===s||N===s,onClick:()=>void I(),children:M===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,Q.jsx)(T,{type:`button`,variant:F(s)?`secondary`:`primary`,disabled:!s||N===s,onClick:()=>{s&&L(s,{useDetailProvider:!0})},children:N===s?n.uploading:F(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,Q.jsxs)(Q.Fragment,{children:[w?(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:!s||P===s,onClick:()=>{s&&R(s,!1)},children:P===s?n.uploading:n.detailModalDisable}):(0,Q.jsx)(T,{type:`button`,variant:`primary`,disabled:!s||P===s,onClick:()=>{s&&R(s,!0)},children:P===s?n.uploading:n.detailModalEnable}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:!s||!w||h||M===s||P===s,title:w?void 0:n.useRequiresEnabled,onClick:()=>void I(),children:M===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[45]=w,t[46]=h,t[47]=a,t[48]=s,t[49]=N,t[50]=F,t[51]=L,t[52]=R,t[53]=I,t[54]=i,t[55]=n.cancel,t[56]=n.detailModalDisable,t[57]=n.detailModalEnable,t[58]=n.marketplaceInstall,t[59]=n.marketplaceReinstall,t[60]=n.previewUseInChat,t[61]=n.previewUseInChatBusy,t[62]=n.uploading,t[63]=n.useRequiresEnabled,t[64]=P,t[65]=M,t[66]=ce):ce=t[66];let le;t[67]!==se||t[68]!==ce?(le=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[se,ce]}),t[67]=se,t[68]=ce,t[69]=le):le=t[69];let X;t[70]!==Y||t[71]!==ie||t[72]!==le?(X=(0,Q.jsxs)(b,{children:[U,(0,Q.jsxs)(x,{className:te,children:[Y,ie,le]})]}),t[70]=Y,t[71]=ie,t[72]=le,t[73]=X):X=t[73];let de;return t[74]!==r||t[75]!==V||t[76]!==X?(de=(0,Q.jsx)(C,{open:r,onOpenChange:V,children:X}),t[74]=r,t[75]=V,t[76]=X,t[77]=de):de=t[77],de}function Ie(e){return(0,Q.jsx)(`div`,{className:m(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function Le(e){let t=(0,pe.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:l,onModalDragOver:u,onModalDragLeave:d,onModalDrop:f,onFileInputChange:h,onInstallSubmit:g}=e,_;t[0]!==c||t[1]!==i||t[2]!==o?(_=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=_):_=t[3];let w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=w):w=t[4];let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-overlay p-6 shadow-float dark:border-edge`),t[5]=T):T=t[5];let E;t[6]===n.installModalTitle?E=t[7]:(E=(0,Q.jsx)(S,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=E);let D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=m(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(p,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=O):O=t[9];let k;t[10]===n.installClose?k=t[11]:(k=(0,Q.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=k);let A;t[12]!==n.installClose||t[13]!==k?(A=(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:D,"aria-label":n.installClose,children:[O,k]})}),t[12]=n.installClose,t[13]=k,t[14]=A):A=t[14];let j;t[15]!==E||t[16]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,A]}),t[15]=E,t[16]=A,t[17]=j):j=t[17];let M=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,N;t[18]===M?N=t[19]:(N=m(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,M),t[18]=M,t[19]=N);let P;t[20]!==h||t[21]!==n.installModalDropHint||t[22]!==l?(P=(0,Q.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:l,onChange:h}),t[20]=h,t[21]=n.installModalDropHint,t[22]=l,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(L,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=F):F=t[24];let I;t[25]===n.installModalDropHint?I=t[26]:(I=(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=I);let R;t[27]===a?R=t[28]:(R=a?(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=R);let ee;t[29]!==d||t[30]!==u||t[31]!==f||t[32]!==N||t[33]!==P||t[34]!==I||t[35]!==R?(ee=(0,Q.jsxs)(`label`,{className:N,onDragLeave:d,onDragOver:u,onDrop:f,children:[P,F,I,R]}),t[29]=d,t[30]=u,t[31]=f,t[32]=N,t[33]=P,t[34]=I,t[35]=R,t[36]=ee):ee=t[36];let z;t[37]===n.installModalReqTitle?z=t[38]:(z=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=z);let B;t[39]===n.installModalReq1?B=t[40]:(B=(0,Q.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=B);let V;t[41]===n.installModalReq2?V=t[42]:(V=(0,Q.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=V);let U;t[43]!==B||t[44]!==V?(U=(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[B,V]}),t[43]=B,t[44]=V,t[45]=U):U=t[45];let te;t[46]!==z||t[47]!==U?(te=(0,Q.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[z,U]}),t[46]=z,t[47]=U,t[48]=te):te=t[48];let W=!a||l,G=!a||l?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-on-accent hover:bg-accent-hover`,K;t[49]===G?K=t[50]:(K=m(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,G,H.focusRingPanel),t[49]=G,t[50]=K);let q;t[51]===g?q=t[52]:(q=()=>void g(),t[51]=g,t[52]=q);let ne=l?n.uploading:n.installAction,re;t[53]!==W||t[54]!==K||t[55]!==q||t[56]!==ne?(re=(0,Q.jsx)(`button`,{type:`button`,disabled:W,className:K,onClick:q,children:ne}),t[53]=W,t[54]=K,t[55]=q,t[56]=ne,t[57]=re):re=t[57];let J;t[58]!==ee||t[59]!==te||t[60]!==re||t[61]!==j?(J=(0,Q.jsxs)(b,{children:[w,(0,Q.jsxs)(x,{className:T,children:[j,ee,te,re]})]}),t[58]=ee,t[59]=te,t[60]=re,t[61]=j,t[62]=J):J=t[62];let Y;return t[63]!==r||t[64]!==_||t[65]!==J?(Y=(0,Q.jsx)(C,{open:r,onOpenChange:_,children:J}),t[63]=r,t[64]=_,t[65]=J,t[66]=Y):Y=t[66],Y}function Re(e){let t=(0,pe.c)(30),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:l,setMarketCategoryId:d,mpHasMore:f,onLoadMoreMarket:p,onRetryMarket:h,isSkillInstalledByName:g,openMarketplaceDetail:_,onMarketInstall:v,installingMarketName:y,onUseSkillInChat:b,usingSkillInChatName:x,searchInputActive:S,searchQuery:C,setSearchQuery:w,registeredProviders:E,marketplacePresentation:D,marketBrowseProvider:k,setMarketBrowseProvider:A}=e,j=!S,M;t[0]===k?M=t[1]:(M=e=>e.id!==k,t[0]=k,t[1]=M);let N=E.filter(M),P=C.trim(),F;t[2]===n.marketplaceCategoryAll?F=t[3]:(F={id:``,label:n.marketplaceCategoryAll},t[2]=n.marketplaceCategoryAll,t[3]=F);let I;t[4]!==r||t[5]!==F?(I=[F,...r.map(We)],t[4]=r,t[5]=F,t[6]=I):I=t[6];let L=I,R;t[7]===r?R=t[8]:(R=new Map(r.map(Ue)),t[7]=r,t[8]=R);let ee=R,z=(0,Z.useRef)(null),B,V;t[9]!==c||t[10]!==f||t[11]!==s||t[12]!==p?(B=()=>{let e=z.current;if(!e||!f||s||c)return;let t=new IntersectionObserver(e=>{e.some(He)&&p()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},V=[f,s,c,p],t[9]=c,t[10]=f,t[11]=s,t[12]=p,t[13]=B,t[14]=V):(B=t[13],V=t[14]),(0,Z.useEffect)(B,V);let U;t[15]!==L||t[16]!==l||t[17]!==r.length||t[18]!==i||t[19]!==d||t[20]!==j||t[21]!==n.marketplaceCategoriesAria?(U=j?r.length>0?(0,Q.jsx)(te,{items:L,activeTab:l,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,Q.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Ve)}):null:null,t[15]=L,t[16]=l,t[17]=r.length,t[18]=i,t[19]=d,t[20]=j,t[21]=n.marketplaceCategoriesAria,t[22]=U):U=t[22];let W;t[23]!==a||t[24]!==j?(W=j&&a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[23]=a,t[24]=j,t[25]=W):W=t[25];let G=!o&&!c?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:we.map(Be)}):c&&!o?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:[(0,Q.jsx)(`p`,{children:c}),(0,Q.jsx)(T,{className:`mt-2`,onClick:h,children:n.marketplaceRetry})]}):o?(0,Q.jsxs)(`div`,{className:`relative`,children:[o.items.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{className:`px-4`,children:S&&P?X(n.marketplaceEmptySearch,{query:P}):n.marketplaceEmpty}),(0,Q.jsx)(me,{sk:n,findingSkills:e.findingSkills,onFindSkills:e.onFindSkills,secondary:!0}),S?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[N.map(e=>(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>A(e.id),children:X(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>w(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,Q.jsx)(`div`,{className:m(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`),children:o.items.map(e=>{let t=D(e),r=ie(e,e.providerId??k),i=g(r),a=e.category??e.categories?.[0],o=a?ee.get(a)??a:null;return(0,Q.jsxs)(`article`,{className:m(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover [content-visibility:auto] [contain-intrinsic-size:auto_220px]`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:m(`min-w-0 flex-1 rounded-lg text-left outline-none`,H.focusRingPanel),onClick:()=>void _(r,e.name,e.providerId??void 0),children:(0,Q.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:t.displayName})}),i?(0,Q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(u,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:y===r,onClick:()=>void v(r,{providerOverride:e.providerId??null}),children:y===r?n.uploading:n.marketplaceInstall})]}),(0,Q.jsx)(`button`,{type:`button`,className:m(`mt-2 flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,H.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void _(r,e.name,e.providerId??void 0),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:t.description||void 0,children:t.description||`—`}),o?(0,Q.jsx)(`span`,{className:`w-fit max-w-full truncate rounded-full bg-surface-inset px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:o}):null,(0,Q.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,Q.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${i?` · ${n.marketplaceInstalled}`:``}`,children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,Q.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,Q.jsx)(O,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,Q.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),i?(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===r,onClick:()=>void b({name:r,source:`store`,providerOverride:e.providerId??null}),children:x===r?n.previewUseInChatBusy:n.previewUseInChat})}):null]},e.id)})}),(0,Q.jsx)(`div`,{ref:z,className:`h-1`,"aria-hidden":!0}),s?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:we.slice(0,3).map(ze)}):c?(0,Q.jsxs)(`div`,{className:`mt-4 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-sm text-fg-muted`,children:c}),(0,Q.jsx)(T,{onClick:h,children:n.marketplaceRetry})]}):!f&&o.items.length>0?(0,Q.jsx)(`p`,{className:`mt-4 text-center text-xs text-fg-subtle`,children:S?n.marketplaceSearchEnd:n.marketplaceEnd}):null]}):null,K;return t[26]!==U||t[27]!==W||t[28]!==G?(K=(0,Q.jsxs)(Q.Fragment,{children:[U,W,G]}),t[26]=U,t[27]=W,t[28]=G,t[29]=K):K=t[29],K}function ze(e){return(0,Q.jsx)(ve,{},e)}function Be(e){return(0,Q.jsx)(ve,{},e)}function Ve(e){return(0,Q.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function He(e){return e.isIntersecting}function Ue(e){return[e.id,e.label]}function We(e){return{id:e.id,label:e.label,title:e.label}}function Ge(e){let t=(0,pe.c)(145),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:c,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:h,catalogDisabledCount:g,catalogStatusFilter:_,setCatalogStatusFilter:v,marketSort:y,setMarketSort:b,marketBrowseProvider:x,setMarketBrowseProvider:S,registeredProviders:C,inSettingsShell:w,searchInputActive:E,resultTab:D,setResultTab:O,aggregatedTabCounts:k,aggregatedProviderStatus:A,recoveryReturnPath:j}=n,M,N,P,F,I,L,R,ee,z;if(t[0]!==o||t[1]!==A||t[2]!==k||t[3]!==p||t[4]!==a||t[5]!==i||t[6]!==j||t[7]!==C||t[8]!==r.diagnosticsTitle||t[9]!==r.marketplaceLoadFailed||t[10]!==r.marketplaceResultsTabAll||t[11]!==r.needToken||t[12]!==r.recoveryDone||t[13]!==r.recoveryHint||t[14]!==r.recoveryTitle||t[15]!==r.tabDiscover||t[16]!==r.tabInstalled||t[17]!==s||t[18]!==h||t[19]!==n){z=Symbol.for(`react.early_return_sentinel`);bb0:{let e=de(s);if(!i){let e;t[29]===n?e=t[30]:(e=(0,Q.jsx)(Ye,{vm:n}),t[29]=n,t[30]=e);let i;t[31]===r.needToken?i=t[32]:(i=(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[31]=r.needToken,t[32]=i);let a;t[33]!==e||t[34]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[e,i]}),t[33]=e,t[34]=i,t[35]=a):a=t[35],z=a;break bb0}let c=p.total+h.total,l;t[36]!==c||t[37]!==r.tabInstalled?(l={id:`installed`,label:r.tabInstalled,count:c},t[36]=c,t[37]=r.tabInstalled,t[38]=l):l=t[38];let u;t[39]===r.tabDiscover?u=t[40]:(u={id:`marketplace`,label:r.tabDiscover},t[39]=r.tabDiscover,t[40]=u);let d;t[41]!==l||t[42]!==u?(d=[l,u],t[41]=l,t[42]=u,t[43]=d):d=t[43],M=d;let f;t[44]===C?f=t[45]:(f=[`all`,...C.map(Je)],t[44]=C,t[45]=f);let g=f,_;t[46]!==A||t[47]!==k||t[48]!==C||t[49]!==r.marketplaceLoadFailed||t[50]!==r.marketplaceResultsTabAll||t[51]!==g?(_=g.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:C.find(t=>t.id===e)?.displayName??e,n=k[e]??0,i=e===`all`?null:A[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[46]=A,t[47]=k,t[48]=C,t[49]=r.marketplaceLoadFailed,t[50]=r.marketplaceResultsTabAll,t[51]=g,t[52]=_):_=t[52],N=_,t[53]===n?ee=t[54]:(ee=(0,Q.jsx)(Ye,{vm:n}),t[53]=n,t[54]=ee),R=`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,P=`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,t[55]!==j||t[56]!==r.recoveryDone||t[57]!==r.recoveryHint||t[58]!==r.recoveryTitle||t[59]!==n.onRecoveryDone?(F=j?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.recoveryTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.recoveryHint})]}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`min-h-11 shrink-0`,onClick:n.onRecoveryDone,children:r.recoveryDone})]}):null,t[55]=j,t[56]=r.recoveryDone,t[57]=r.recoveryHint,t[58]=r.recoveryTitle,t[59]=n.onRecoveryDone,t[60]=F):F=t[60],t[61]!==o||t[62]!==a?(I=o?(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:m(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:a}):null,t[61]=o,t[62]=a,t[63]=I):I=t[63],L=e.length>0?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,Q.jsx)(`div`,{className:`font-medium`,children:X(r.diagnosticsTitle,{count:e.length})}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.slice(0,3).map(qe)})]}):null}t[0]=o,t[1]=A,t[2]=k,t[3]=p,t[4]=a,t[5]=i,t[6]=j,t[7]=C,t[8]=r.diagnosticsTitle,t[9]=r.marketplaceLoadFailed,t[10]=r.marketplaceResultsTabAll,t[11]=r.needToken,t[12]=r.recoveryDone,t[13]=r.recoveryHint,t[14]=r.recoveryTitle,t[15]=r.tabDiscover,t[16]=r.tabInstalled,t[17]=s,t[18]=h,t[19]=n,t[20]=M,t[21]=N,t[22]=P,t[23]=F,t[24]=I,t[25]=L,t[26]=R,t[27]=ee,t[28]=z}else M=t[20],N=t[21],P=t[22],F=t[23],I=t[24],L=t[25],R=t[26],ee=t[27],z=t[28];if(z!==Symbol.for(`react.early_return_sentinel`))return z;let B;t[64]!==w||t[65]!==n.findingSkills||t[66]!==n.loading||t[67]!==n.mainTab||t[68]!==n.onFindSkills||t[69]!==n.onReloadClick||t[70]!==n.searchQuery||t[71]!==n.setInstallOpen||t[72]!==n.setPendingFile||t[73]!==n.setSearchQuery||t[74]!==n.sk?(B=w?(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,Q.jsx)(he,{findingSkills:n.findingSkills,onFindSkills:n.onFindSkills,loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[64]=w,t[65]=n.findingSkills,t[66]=n.loading,t[67]=n.mainTab,t[68]=n.onFindSkills,t[69]=n.onReloadClick,t[70]=n.searchQuery,t[71]=n.setInstallOpen,t[72]=n.setPendingFile,t[73]=n.setSearchQuery,t[74]=n.sk,t[75]=B):B=t[75];let V;t[76]!==c||t[77]!==M||t[78]!==u||t[79]!==r.skillsNavAria?(V=(0,Q.jsx)(te,{items:M,activeTab:c,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`}),t[76]=c,t[77]=M,t[78]=u,t[79]=r.skillsNavAria,t[80]=V):V=t[80];let H;t[81]!==g||t[82]!==_||t[83]!==c||t[84]!==x||t[85]!==y||t[86]!==C||t[87]!==E||t[88]!==v||t[89]!==S||t[90]!==b||t[91]!==f||t[92]!==r.filterAll||t[93]!==r.filterDisabledOnly||t[94]!==r.filterEnabled||t[95]!==r.filterExtra||t[96]!==r.filterGlobal||t[97]!==r.filterInstalled||t[98]!==r.filterWorkspace||t[99]!==r.marketplaceBrowseSwitchAria||t[100]!==r.marketplaceSortDownloads||t[101]!==r.marketplaceSortLabel||t[102]!==r.marketplaceSortNewest||t[103]!==r.sourceFilterAria||t[104]!==r.statusFilterAria||t[105]!==r.tabBuiltin||t[106]!==d?(H=(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:c===`installed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{value:d,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>f(e)}),(0,Q.jsx)(l,{value:_,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:X(r.filterDisabledOnly,{count:g})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>v(e)})]}):(0,Q.jsxs)(Q.Fragment,{children:[E?null:(0,Q.jsx)(l,{value:x??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:C.map(Ke),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:S}),(0,Q.jsx)(l,{value:y,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>b(e)})]})}),t[81]=g,t[82]=_,t[83]=c,t[84]=x,t[85]=y,t[86]=C,t[87]=E,t[88]=v,t[89]=S,t[90]=b,t[91]=f,t[92]=r.filterAll,t[93]=r.filterDisabledOnly,t[94]=r.filterEnabled,t[95]=r.filterExtra,t[96]=r.filterGlobal,t[97]=r.filterInstalled,t[98]=r.filterWorkspace,t[99]=r.marketplaceBrowseSwitchAria,t[100]=r.marketplaceSortDownloads,t[101]=r.marketplaceSortLabel,t[102]=r.marketplaceSortNewest,t[103]=r.sourceFilterAria,t[104]=r.statusFilterAria,t[105]=r.tabBuiltin,t[106]=d,t[107]=H):H=t[107];let U;t[108]!==H||t[109]!==V?(U=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 dark:border-edge-subtle sm:flex-row sm:items-center sm:justify-between`,children:[V,H]}),t[108]=H,t[109]=V,t[110]=U):U=t[110];let W;t[111]!==c||t[112]!==D||t[113]!==N||t[114]!==E||t[115]!==O||t[116]!==r.marketplaceResultsTabsAria?(W=c===`marketplace`&&E?(0,Q.jsx)(te,{items:N,activeTab:D,onChange:O,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null,t[111]=c,t[112]=D,t[113]=N,t[114]=E,t[115]=O,t[116]=r.marketplaceResultsTabsAria,t[117]=W):W=t[117];let G;t[118]!==c||t[119]!==n?(G=c===`marketplace`?(0,Q.jsx)(Re,{...n}):(0,Q.jsx)(Ee,{...n}),t[118]=c,t[119]=n,t[120]=G):G=t[120];let K;t[121]!==U||t[122]!==W||t[123]!==G?(K=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[U,W,G]}),t[121]=U,t[122]=W,t[123]=G,t[124]=K):K=t[124];let q;t[125]!==P||t[126]!==K||t[127]!==F||t[128]!==I||t[129]!==L||t[130]!==B?(q=(0,Q.jsxs)(`div`,{className:P,children:[F,I,L,B,K]}),t[125]=P,t[126]=K,t[127]=F,t[128]=I,t[129]=L,t[130]=B,t[131]=q):q=t[131];let ne,re,J;t[132]===n?(ne=t[133],re=t[134],J=t[135]):(ne=(0,Q.jsx)(Fe,{...n}),re=(0,Q.jsx)(Le,{...n}),J=(0,Q.jsx)(Oe,{...n}),t[132]=n,t[133]=ne,t[134]=re,t[135]=J);let Y;t[136]!==q||t[137]!==ne||t[138]!==re||t[139]!==J||t[140]!==R?(Y=(0,Q.jsxs)(`div`,{className:R,children:[q,ne,re,J]}),t[136]=q,t[137]=ne,t[138]=re,t[139]=J,t[140]=R,t[141]=Y):Y=t[141];let ie;return t[142]!==Y||t[143]!==ee?(ie=(0,Q.jsxs)(Q.Fragment,{children:[ee,Y]}),t[142]=Y,t[143]=ee,t[144]=ie):ie=t[144],ie}function Ke(e){return{value:e.id,label:e.displayName}}function qe(e,t){return(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function Je(e){return e.id}function Ye(e){let t=(0,pe.c)(19),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=N(Ze),m=N(Xe),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r||t[8]!==n.findingSkills||t[9]!==n.onFindSkills?(h=(0,Q.jsx)(he,{findingSkills:n.findingSkills,onFindSkills:n.onFindSkills,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=n.findingSkills,t[9]=n.onFindSkills,t[10]=h):h=t[10];let g=h,_,v;return t[11]!==m||t[12]!==i||t[13]!==f||t[14]!==p||t[15]!==r.title||t[16]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[11]=m,t[12]=i,t[13]=f,t[14]=p,t[15]=r.title,t[16]=g,t[17]=_,t[18]=v):(_=t[17],v=t[18]),(0,Z.useLayoutEffect)(_,v),null}function Xe(e){return e.clearPageHeader}function Ze(e){return e.setPageHeader}async function Qe(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function $e(e){let t=(0,pe.c)(33),n=h($),r=h(rt),i;t[0]!==n||t[1]!==e.category||t[2]!==e.enabled||t[3]!==e.provider||t[4]!==e.sort||t[5]!==r?(i=(t,i)=>!e.enabled||!e.provider||i&&(!i.items.length||i.meta.page>=i.meta.totalPages)?null:[`skills-feed`,n,r,e.provider,e.category,e.sort,t+1],t[0]=n,t[1]=e.category,t[2]=e.enabled,t[3]=e.provider,t[4]=e.sort,t[5]=r,t[6]=i):i=t[6];let a=i,o;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateFirstPage:!1,revalidateOnFocus:!1,shouldRetryOnError:!1,persistSize:!1},t[7]=o):o=t[7];let{data:s,error:c,size:l,setSize:u,isValidating:d,mutate:f}=w(a,nt,o),p=(0,Z.useRef)(null),m;t[8]===a?m=t[9]:(m=JSON.stringify(a(0,null)),t[8]=a,t[9]=m);let g=m,_;t[10]===s?_=t[11]:(_=s?.at(-1),t[10]=s,t[11]=_);let v=_,y;t[12]===s?y=t[13]:(y=[...new Map((s??[]).flatMap(tt).map(et)).values()],t[12]=s,t[13]=y);let b=y,x=e.enabled&&!c&&(d||!s||l>s.length),S=!!(v?.items.length&&v.meta.page<v.meta.totalPages),C;t[14]!==b||t[15]!==v?(C=v?{...v,items:b}:null,t[14]=b,t[15]=v,t[16]=C):C=t[16];let T;t[17]!==c||t[18]!==S||t[19]!==x||t[20]!==g||t[21]!==u||t[22]!==l?(T=()=>{if(x||c||!S||p.current?.scope===g)return;let e=u(l+1);p.current={scope:g,request:e},e.finally(()=>{p.current?.request===e&&(p.current=null)})},t[17]=c,t[18]=S,t[19]=x,t[20]=g,t[21]=u,t[22]=l,t[23]=T):T=t[23];let E;t[24]===f?E=t[25]:(E=()=>{f()},t[24]=f,t[25]=E);let D;return t[26]!==c||t[27]!==S||t[28]!==x||t[29]!==C||t[30]!==T||t[31]!==E?(D={payload:C,loading:x,error:c,hasMore:S,loadMore:T,retry:E},t[26]=c,t[27]=S,t[28]=x,t[29]=C,t[30]=T,t[31]=E,t[32]=D):D=t[32],D}function et(e){return[e.id,e]}function tt(e){return e.items}function nt(e){let[,,,t,n,r,i]=e;return le({provider:t,category:n,sort:r,page:i,pageSize:20})}function rt(e){return e.conversationId}function $(e){return e.baseUrl}function it(){let e=g(e=>e.language),t=_(e).skills,n=!!h(e=>e.conversationId),r=a(),[i,s]=o(),l=(()=>{let e=i.get(`returnTo`);return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:null})(),u=i.get(`mprov`)?.trim()||null,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),b=i.get(`q`)??``,x=i.get(`tab`),S=i.get(`source`),C=i.get(`status`),w=be.has(x)?x:`installed`,T=xe.has(S)?S:`all`,D=Se.has(C)?C:`all`,[O,j]=(0,Z.useState)(b),[M]=V(O,250),N=M.trim(),L=O.trim().length>0,R=N.length>0,[ee,z]=(0,Z.useState)(null),[B,H]=(0,Z.useState)(w),[U,te]=(0,Z.useState)(T),[ie,se]=(0,Z.useState)(``),[X,ue]=(0,Z.useState)(D),[de,pe]=(0,Z.useState)(!1),[Q,me]=(0,Z.useState)(null),[he,ge]=(0,Z.useState)(!1),[_e,ve]=(0,Z.useState)(!1),[ye,we]=(0,Z.useState)(null),[Ee,De]=(0,Z.useState)(null),[Oe,ke]=(0,Z.useState)({}),[Ae,je]=(0,Z.useState)(!1),[Me,Ne]=(0,Z.useState)(`catalog`),[Pe,Fe]=(0,Z.useState)(``),[Ie,Le]=(0,Z.useState)(null),[Re,ze]=(0,Z.useState)(null),[Be,Ve]=(0,Z.useState)(!1),[He,Ue]=(0,Z.useState)(null),[We,Ge]=(0,Z.useState)(`downloads`),[Ke,qe]=(0,Z.useState)(1),[Je,Ye]=(0,Z.useState)(0),[Xe,Ze]=(0,Z.useState)(null),[et,tt]=(0,Z.useState)(null),[nt,rt]=(0,Z.useState)(``),[$,it]=(0,Z.useState)(()=>u),[at,ot]=(0,Z.useState)(0),[st,ct]=(0,Z.useState)(0),[lt,ut]=(0,Z.useState)([]),dt=(0,Z.useRef)(null),ft=(0,Z.useRef)(u),pt=(0,Z.useRef)(null),mt=(0,Z.useRef)(``),ht=(0,Z.useRef)(null),gt=(0,Z.useRef)(!1),[_t,vt]=(0,Z.useState)({query:``,byProvider:{}}),[yt,bt]=(0,Z.useState)(`all`),xt=(0,Z.useRef)(0),St=(0,Z.useRef)(N);St.current!==N&&(St.current=N,bt(e=>e===`all`?e:`all`));let Ct=A(()=>I().then(e=>(ut(e.diagnostics??[]),e.catalog.map(ce))),[n,st],{enabled:n,initial:[],errorData:[]}),{data:wt,loading:Tt,setData:Et}=Ct,Dt=A(async()=>{try{let{providers:e,current:t}=await re();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await ne()).provider}}catch{return{providers:[],current:`store`}}}},[n,at],{enabled:n,initial:{providers:[],current:null}}),Ot=d||Tt,kt=Dt.data.providers;(0,Z.useEffect)(()=>{let e=e=>{if(E(e.detail)===`skills`){if(gt.current){gt.current=!1;return}ct(e=>e+1)}else ot(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let At=i.toString(),jt=(0,Z.useRef)(At);if(jt.current!==At){jt.current=At;let e=i.get(`q`)??``,t=i.get(`tab`),n=i.get(`source`),r=i.get(`status`),a=be.has(t)?t:`installed`,o=xe.has(n)?n:`all`,s=Se.has(r)?r:`all`;j(t=>t===e?t:e),H(e=>e===a?e:a),te(e=>e===o?e:o),ue(e=>e===s?e:s);let c=i.get(`mcat`)??``;rt(a===`marketplace`?e=>e===c?e:c:``)}let Mt=(0,Z.useRef)(n);!n&&Mt.current&&(it(null),dt.current=null),Mt.current=n,n&&u&&ft.current!==u&&(ft.current=u,it(u)),n&&u==null&&Dt.data.current&&Dt.data.current!==pt.current&&(pt.current=Dt.data.current,it(e=>e??Dt.data.current));let Nt=`${N}|${We}|${B}|${nt}|${$??``}|${yt}`;mt.current!==Nt&&(mt.current=Nt,qe(1)),B===`marketplace`&&$&&ht.current!=null&&ht.current!==$&&rt(``),ht.current=$;let Pt=$e({enabled:n&&B===`marketplace`&&!!$&&!L,provider:$,category:nt.trim(),sort:We});(0,Z.useEffect)(()=>{if(!n||!R||B!==`marketplace`||kt.length===0)return;let e=++xt.current,r={};for(let e of kt)r[e.id]={status:`loading`,rows:[]};vt({query:N,byProvider:r});let i=[],a=[];for(let n of kt){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),le({provider:n.id,q:N,page:1,pageSize:40,sort:We,signal:r.signal}).then(t=>{if(window.clearTimeout(o),e!==xt.current)return;let r=t.items.map(e=>({...e,providerId:n.id}));vt(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),e!==xt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?t.marketplaceLoadFailed:r instanceof Error?r.message:t.marketplaceLoadFailed;vt(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{xt.current+=1;for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[n,B,R,N,kt,We,Je,t.marketplaceLoadFailed]);let Ft=A(()=>ae({provider:$,locale:e}).then(e=>e.items),[n,B,$,e],{enabled:n&&B===`marketplace`&&!!$,initial:[],errorData:[]}),It=(0,Z.useMemo)(()=>{if(!R||_t.query!==N)return[];let e=kt.map(e=>({id:e.id,rows:[..._t.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[R,N,_t,kt]),Lt=(0,Z.useMemo)(()=>{if(!R)return{};let e={all:It.length};for(let t of kt)e[t.id]=It.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[R,It,kt]),Rt=(0,Z.useMemo)(()=>R?yt===`all`?It:It.filter(e=>e.providerId===yt||(e.additionalSources??[]).some(e=>e.providerId===yt)):[],[R,It,yt]),zt=(0,Z.useMemo)(()=>{if(!R)return{};let e={};for(let t of kt)e[t.id]=_t.byProvider[t.id]?.status??`loading`;return e},[R,_t,kt]),Bt=(0,Z.useMemo)(()=>Object.values(zt).some(e=>e===`loading`),[zt]),Vt=(0,Z.useMemo)(()=>{if(!R)return!1;let e=Object.values(zt);return e.length>0&&e.every(e=>e===`error`)},[R,zt]),Ht=(0,Z.useMemo)(()=>{if(!R||It.length===0&&Bt)return null;let e=Rt.length;return{items:Rt.slice(0,Ke*20),meta:{page:Ke,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:yt}},[R,It,Bt,Rt,Ke,yt]),Ut=B===`marketplace`?L?R?Ht:null:Pt.payload:null,Wt=B===`marketplace`?L?R?Bt:!0:Pt.loading:!1,Gt=R?Vt?t.marketplaceLoadFailed:null:Pt.error instanceof Error?Pt.error.message:Pt.error?t.marketplaceLoadFailed:null,Kt=B===`marketplace`?Ft.data:[],qt=B===`marketplace`?Ft.loading:!1,Jt=Ft.error instanceof Error?Ft.error.message:Ft.error?t.marketplaceCategoriesFailed:null;nt.trim()&&Kt.length>0&&!Kt.some(e=>e.id===nt)&&rt(``);let Yt=(0,Z.useCallback)(async e=>{let n=e?.silent===!0;n||f(!0),m(null);try{let e=await I();return ut(e.diagnostics??[]),Et(e.catalog.map(ce)),{ok:!0}}catch(e){let n=e instanceof Error?e.message:t.loadFailed;return m(n),{ok:!1,message:n}}finally{n||f(!1)}},[Et,t.loadFailed]),Xt=!d&&Ct.error?Ct.error instanceof Error?Ct.error.message:t.loadFailed:null,Zt=p??Xt;(0,Z.useEffect)(()=>{s(e=>{let t=new URLSearchParams(e);return N?t.set(`q`,N):t.delete(`q`),B===`marketplace`?t.set(`tab`,B):t.delete(`tab`),U===`all`?t.delete(`source`):t.set(`source`,U),B===`installed`&&X!==`all`?t.set(`status`,X):t.delete(`status`),B===`marketplace`&&nt.trim()?t.set(`mcat`,nt.trim()):t.delete(`mcat`),B===`marketplace`&&$?t.set(Ce,$):t.delete(Ce),t.toString()===e.toString()?e:t},{replace:!0})},[B,nt,$,N,X,s,U]);let Qt=(0,Z.useCallback)((e,t,n=5e3)=>{z({kind:e,message:t}),window.setTimeout(()=>z(null),n)},[]),$t=(0,Z.useCallback)(e=>{let n=e.availability;if(!n)return t.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[t.installSuccess]),en=(0,Z.useCallback)(async e=>{Ne(`catalog`),je(!0),Fe(e.name),Le(null),ze(null),Ue(null),Ve(!0);try{let t=await oe(e.name);Le(t),Fe(t.name)}catch(e){Le(null),Ue(e instanceof Error?e.message:t.detailLoadFailed)}finally{Ve(!1)}},[t.detailLoadFailed]),tn=(0,Z.useCallback)(async e=>{let n=e.trim();if(n){Ne(`catalog`),je(!0),Fe(n),Le(null),ze(null),Ue(null),Ve(!0);try{let e=await oe(n);Le(e),Fe(e.name)}catch(e){Le(null),Ue(e instanceof Error?e.message:t.detailLoadFailed)}finally{Ve(!1)}}},[t.detailLoadFailed]),nn=(0,Z.useCallback)(async(e,n,r)=>{let i=r?.trim()||$;if(i){dt.current=i,Ne(`store`),je(!0),Fe(n?.trim()||e),Le(null),ze(null),Ue(null),Ve(!0);try{let t=await fe(e,{provider:i});Fe(t.name),ze(t.skillDocPreview)}catch(e){ze(null),Ue(e instanceof Error?e.message:t.detailLoadFailed)}finally{Ve(!1)}}},[$,t.detailLoadFailed]),rn=(0,Z.useCallback)(async(e,n)=>{De(e),ke(t=>({...t,[e]:n})),z(null);try{return await J(e,n),await Yt({silent:!0}),!0}catch(n){return ke(t=>{let{[e]:n,...r}=t;return r}),Qt(`error`,n instanceof Error?n.message:t.skillToggleFailed),!1}finally{De(null),ke(t=>{let{[e]:n,...r}=t;return r})}},[Yt,Qt,t.skillToggleFailed]),an=(0,Z.useCallback)(async()=>{z(null),f(!0),m(null);try{await W()}catch(e){m(e instanceof Error?e.message:t.reloadFailed),f(!1);return}await Yt()},[Yt,t.reloadFailed]),on=(0,Z.useMemo)(()=>{let e=O.trim().toLowerCase();return e?wt.filter(t=>[t.name,t.description,...Object.values(t.localizations??{}).flatMap(e=>e?[e.displayName,e.description]:[]),t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):wt},[wt,O]),sn=(0,Z.useCallback)(t=>k(t,e),[e]),cn=(0,Z.useMemo)(()=>{let e=wt.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Oe[e.name]??e.enabled).length}},[wt,Oe]),ln=(0,Z.useMemo)(()=>{let e=wt.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Oe[e.name]??e.enabled).length}},[wt,Oe]),un=(0,Z.useMemo)(()=>Pe?wt.find(e=>e.name===Pe):void 0,[wt,Pe]),dn=un?sn(un):null,fn=un==null?!0:Oe[Pe]??un.enabled,pn=un?.directoryId??null,mn=un?.managed??!1,hn=(0,Z.useMemo)(()=>Me!==`store`||!Pe?null:K(dt.current??$,Pe),[Me,Pe,$]),gn=(0,Z.useMemo)(()=>{let e=on;return B===`installed`&&U!==`all`&&(e=U===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===U)),e},[on,B,U]),_n=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of gn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=Te.indexOf(e),r=Te.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[gn]),vn=(0,Z.useCallback)(e=>t.categoryLabel?.[e]||e,[t.categoryLabel]),yn=(0,Z.useMemo)(()=>ie?gn.filter(e=>e.category===ie):gn,[gn,ie]);(0,Z.useEffect)(()=>{se(``)},[U]);let bn=(0,Z.useCallback)(e=>Oe[e.name]??e.enabled,[Oe]),xn=(0,Z.useMemo)(()=>yn.filter(e=>!bn(e)).length,[yn,bn]),Sn=(0,Z.useMemo)(()=>{let t=yn;return X===`disabled`&&(t=t.filter(e=>!bn(e))),X===`enabled`&&(t=t.filter(e=>bn(e))),[...t].toSorted((t,n)=>{let r=bn(t);return r===bn(n)?sn(t).displayName.localeCompare(sn(n).displayName,e,{sensitivity:`base`}):r?-1:1})},[yn,X,e,bn,sn]),Cn=async e=>{z(null),y(!0),m(null);try{let n;try{n=await Qe(e)}catch{m(t.invalidFile),Qt(`error`,t.invalidFile);return}let r=await G(n,{overwrite:!0});gt.current=!0,await Yt(),Qt(`success`,$t(r)),pe(!1),me(null),H(`installed`),te(`installed`),await tn(r.availability?.skillName||r.skillId)}catch(e){m(e instanceof Error?e.message:t.uploadFailed),Qt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{y(!1)}},wn=()=>{Q&&Cn(Q)},Tn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&me(t)},En=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(ge(!0),e.dataTransfer.dropEffect=`copy`)},Dn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||ge(!1)},On=e=>{e.preventDefault(),e.stopPropagation(),ge(!1);let t=e.dataTransfer?.files?.[0];t&&me(t)},kn=e=>{if(e.origin===`agents-global`)return t.source.agentsGlobal;if(e.origin===`agents-workspace`)return t.source.agentsWorkspace;switch(e.source){case`builtin`:return t.source.builtin;case`workspace`:return t.source.workspace;case`global`:return t.source.global;case`extra`:return t.source.extra;default:return e.source}},An=async()=>{let e=ye,n=Ae&&Me===`catalog`&&pn===e;if(ve(!1),we(null),e){z(null);try{await q(e),gt.current=!0,await Yt(),n&&(je(!1),Ne(`catalog`),Fe(``),Le(null),ze(null),Ue(null))}catch(e){m(e instanceof Error?e.message:t.deleteFailed)}}},jn=(0,Z.useCallback)(e=>wt.some(t=>t.name===e),[wt]),Mn=(0,Z.useRef)(!1),[Nn,Pn]=(0,Z.useState)(!1),Fn=(0,Z.useCallback)(async()=>{if(!Mn.current){Mn.current=!0,Pn(!0),z(null);try{let{defaultId:e}=await P(),{skills:n}=await F(e,void 0,!0);if(!n.some(e=>e.name===`find-skills`&&e.availableForCurrentAgent))throw Error(t.findUnavailable);let i=new URLSearchParams({projectScope:`none`,scene:`find-skills`,skill:`find-skills`});O.trim()&&i.set(`draft`,t.findQuery.replace(`{{query}}`,O.trim())),r(`/chat/new?${i}`,{state:{forceNewChat:!0,agentId:e}})}catch(e){Qt(`error`,e instanceof Error?e.message:t.findFailed)}finally{Mn.current=!1,Pn(!1)}}},[r,O,Qt,t.findUnavailable,t.findFailed,t.findQuery]),In=(0,Z.useCallback)(async e=>{let n=(e?.name??Pe).trim();if(!n)return;let i=e?.source??Me;if(i===`catalog`){let e=wt.find(e=>e.name===n);if(e&&!(Oe[e.name]??e.enabled))return}z(null);let a=i===`store`&&!jn(n);tt(n);try{if(a){let t=e?.providerOverride?.trim()||dt.current||$;await Y({name:n,overwrite:!1,...t?{provider:t}:{}}),gt.current=!0,await Yt({silent:!0})}je(!1),r(`/chat/new?skill=${encodeURIComponent(n)}`)}catch(e){Qt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{tt(null)}},[wt,Pe,Me,Oe,jn,Yt,r,Qt,t.uploadFailed,$]),Ln=(0,Z.useCallback)(async(e,n)=>{let r=jn(e);if(!(r&&!window.confirm(t.marketplaceReinstallConfirm))){z(null),Ze(e);try{let t=n?.providerOverride?.trim()||(n?.useDetailProvider?dt.current??$:$),i=await Y({name:e,overwrite:r,...t?{provider:t}:{}});gt.current=!0,await Yt({silent:!0}),Qt(`success`,$t(i)),H(`installed`),te(`installed`),await tn(i.availability?.skillName||i.skillId||e)}catch(e){Qt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{Ze(null)}}},[jn,$t,Yt,$,tn,Qt,t.marketplaceReinstallConfirm,t.uploadFailed]),{pathname:Rn}=c(),zn=Rn.startsWith(`/settings/`);return{sk:t,hasToken:n,catalog:wt,loading:Ot,error:Zt,uploading:v,searchQuery:O,setSearchQuery:j,actionFeedback:ee,skillDiagnostics:lt,mainTab:B,setMainTab:H,sourceFilter:U,setSourceFilter:te,builtinCategoryFilter:ie,setBuiltinCategoryFilter:se,installOpen:de,setInstallOpen:pe,pendingFile:Q,setPendingFile:me,dropActive:he,setDropActive:ge,confirmOpen:_e,setConfirmOpen:ve,confirmId:ye,setConfirmId:we,togglingSkillName:Ee,enabledOverride:Oe,detailOpen:Ae,setDetailOpen:je,detailSource:Me,setDetailSource:Ne,detailTitle:Pe,setDetailTitle:Fe,detailCatalogPreview:Ie,setDetailCatalogPreview:Le,detailMarketplacePreview:Re,setDetailMarketplacePreview:ze,detailLoading:Be,detailError:He,setDetailError:Ue,marketSort:We,setMarketSort:Ge,mpHasMore:L?!!(Ht&&Ht.items.length<Ht.meta.total):Pt.hasMore,onLoadMoreMarket:()=>{L?Wt||qe(e=>e+1):Pt.loadMore()},onRetryMarket:()=>{L?Ye(e=>e+1):Pt.retry()},mpLoading:Wt,mpError:Gt,mpPayload:Ut,searchActive:R,searchInputActive:L,resultTab:yt,setResultTab:bt,aggregatedTabCounts:Lt,aggregatedProviderStatus:zt,aggregatedAllFailed:Vt,installingMarketName:Xe,usingSkillInChatName:et,onUseSkillInChat:In,onFindSkills:Fn,findingSkills:Nn,marketCategoryId:nt,setMarketCategoryId:rt,mpCategories:Kt,mpCategoriesError:Jt,mpCategoriesLoading:qt,marketBrowseProvider:$,setMarketBrowseProvider:it,registeredProviders:kt,builtinTabStats:cn,userTabStats:ln,detailEnabled:fn,detailPresentation:dn,detailDirectoryId:pn,detailManaged:mn,detailExternalUrl:hn,filteredCatalog:gn,builtinCategories:_n,categoryFilteredCatalog:yn,catalogDisplayRows:Sn,skillPresentation:sn,marketplacePresentation:t=>k(t,e),catalogDisabledCount:xn,catalogStatusFilter:X,setCatalogStatusFilter:ue,resolveSkillEnabled:bn,inSettingsShell:zn,recoveryReturnPath:l,onRecoveryDone:()=>l&&r(l),categoryLabel:vn,onReloadClick:an,openSkillDetail:en,openMarketplaceDetail:nn,onSkillToggle:rn,onInstallSubmit:wn,onFileInputChange:Tn,onModalDragOver:En,onModalDragLeave:Dn,onModalDrop:On,sourceLabel:kn,runDelete:An,onMarketInstall:Ln,isSkillInstalledByName:jn}}function at(){let e=(0,pe.c)(2),t=it(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(Ge,{vm:t}),e[0]=t,e[1]=n),n}export{at as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{c as r,i,r as a}from"./locale-store-BPZR8x9b.js";import{Pi as o}from"./index-CJuypaNt.js";import"./skill-reload-api-evN7gs0S.js";async function s(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`global`);let i=new Headers,o=await fetch(a(`/api/skills/upload`),{method:`POST`,headers:i,body:n});o.status===401&&r.getState().onUnauthorized();let s=await o.json().catch(()=>({}));if(!o.ok)throw Error(s.error||`HTTP ${o.status}`);if(!s.payload?.skillId)throw Error(`Invalid response`);return s.payload}async function c(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await i(a(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await o(r))}async function l(e,t){let n=await i(a(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await o(n))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider),e?.locale?.trim()&&t.set(`locale`,e.locale.trim());let n=t.toString(),r=await i(a(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),u(t,e.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;u(r,t?.provider);let s=r.toString(),c=await i(a(`/api/skills/marketplace/packages/${n}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await i(a(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function h(e){let t=await i(a(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function g(){let e=await i(a(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await i(a(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function x(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function S(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function C(e){let t=(0,v.c)(9),{name:r,className:i}=e,a;t[0]===r?a=t[1]:(a=S(r),t[0]=r,t[1]=a);let o=a,s=b[x(r)%b.length],c;t[2]!==i||t[3]!==s.dark||t[4]!==s.light?(c=n(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,i),t[2]=i,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){return e.filter(e=>e.type!==`collision`)}function M(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function N(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{s as _,O as a,c,g as d,_ as f,l as g,m as h,k as i,d as l,h as m,M as n,N as o,f as p,A as r,C as s,j as t,p as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{n as i}from"./locale-store-BPZR8x9b.js";import{t as a}from"./messages-kFWhF6_t.js";import{n as o}from"./electron-env-Dit0bHgy.js";import{$t as s,Fu as c,Jc as l,Qt as u,Zt as d,en as f,qs as p,sl as m,wa as h,xd as g}from"./index-CJuypaNt.js";import{n as _,r as v}from"./settings-page-layout-eqTUTW2L.js";import{r as y,t as b}from"./settings-form-section-Dol9j_pF.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!o()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=a(i(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(s),[r,o]=(0,x.useState)(null),[c,l]=(0,x.useState)(!1),p=async t=>{if(!t){n(f({enabled:!1})),o(null);return}l(!0);try{let t=await d();if(t!==`granted`){o(t===`unsupported`?e.unsupported:e.denied);return}n(f({enabled:!0})),o(await u(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{l(!1)}},m=e=>{n(f(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:c||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?p(t.target.checked):m({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=a(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=a(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=i(e=>e.language),t=a(e),n=t.systemSettings,[s,u]=(0,x.useReducer)(h,L),{behavior:d,perms:f,loadError:g,permFeedback:A,permBusy:N,refreshing:R}=s,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){u({type:`patch`,patch:{loadError:null}});try{u({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){u({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){u({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{u({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{u({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{o()&&z&&B()},[z,B]),!o()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);u({type:`patch`,patch:{behavior:t}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}u({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){u({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){u({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){u({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{u({type:`patch`,patch:{permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?u({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):u({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},Y=d?d.platform===`win32`?n.permissionsHintWin:d.platform===`linux`?n.permissionsHintLinux:d.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),g?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:g}):null,A?(0,C.jsx)(`p`,{className:r(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(l,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.deviceAccess.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.deviceAccess.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d?.backgroundSupported,checked:!!d?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d||N,checked:!!d?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),d&&f?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),d.platform===`darwin`&&!d.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,p.press),onClick:()=>void V(),children:[(0,C.jsx)(m,{className:r(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(d.platform).map(({key:t,pane:i})=>{let a=F(e,f[t]),o=n.perm[t],s=f[t]===`unknown`?I(e,t,d.platform):null;return o?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),s?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,f[t],d.platform)?(0,C.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,p.press),onClick:()=>void W(i),children:[n.openSettings,(0,C.jsx)(c,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R as SystemSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{f as a,g as o,m as s,t as c}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as l,r as u}from"./popover-select-DcsFzD_i.js";import{t as d}from"./circle-check-C23XjkUj.js";import{f,m as p,t as m}from"./markdown-view-Dft8ASFD.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-JdwAhgNB.js";import{c as _,n as ee}from"./locale-store-BPZR8x9b.js";import{i as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./dist-BGTk37IG.js";import{u as se}from"./tasks-CDR_RVbQ.js";import{t as v}from"./button-CS04eWY9.js";import{t as y}from"./skeleton-BwbyijEw.js";import{$u as b,Ed as x,Fl as ce,Fn as le,Fu as ue,In as de,Io as fe,Iu as pe,Js as me,Jt as S,Ki as C,Li as he,Ln as w,Ma as ge,Pn as T,Qs as E,Qu as D,R as _e,Ri as O,Rn as k,Tu as A,Zi as j,Zs as M,_c as N,ac as P,ba as F,ci as I,cs as ve,ec as ye,fc as be,gc as xe,hl as Se,ku as Ce,mc as we,mr as Te,n as Ee,no as De,uc as Oe,vc as ke,wu as Ae,xl as je,zn as Me}from"./index-CJuypaNt.js";import{t as Ne}from"./page-context-capture-button-OUL3fEYh.js";import{t as L}from"./date-picker-Do1dl0La.js";import{t as R}from"./dependency-picker-BhS8s080.js";var z=r(),B=e(t(),1),V=i();function Pe({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function h(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await E(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),ve({tone:`success`,title:p?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,V.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),h()},children:[p?(0,V.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,V.jsx)(`p`,{children:e.reason}),(0,V.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(v,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void h(`approve`),children:n?`批准`:`Approve`}),(0,V.jsx)(v,{type:`button`,disabled:o||u,onClick:()=>void h(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,V.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),m.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,V.jsx)(v,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,V.jsx)(v,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}var Fe=e(n(),1);function Ie(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function Le({uri:e,zh:t}){let[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``);async function p(){a(!0),u(``);try{let n=Ie(e,(await j()).payload.shares);r(n),s(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{a(!1)}}async function m(){if(!(!n||i)){a(!0),u(``);try{let e=await C(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{a(!1)}}}return(0,V.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(v,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),o&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,V.jsx)(v,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,V.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,V.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),o&&(0,V.jsx)(c,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function Re(e){let t=(0,z.c)(14),{evidence:n,projectId:r,conversationId:i,language:a}=e,o=he(ze);if(!n.length)return null;let s=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,c;if(t[0]!==i||t[1]!==n||t[2]!==a||t[3]!==r||t[4]!==o){let e;t[6]!==i||t[7]!==a||t[8]!==r||t[9]!==o?(e=(e,t)=>{let n=e.uri?.trim(),s=n&&/^https?:\/\//i.test(n),c=n&&!s&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),l=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,V.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[s?(0,V.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(ue,{className:`size-4 shrink-0`}),l]}):c&&(r||i)?(0,V.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,onClick:()=>o(n,null,r,i),children:[(0,V.jsx)(Ce,{className:`size-4 shrink-0`}),l]}):(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l}),s&&e.kind===`artifact`&&(0,V.jsx)(Le,{uri:n,zh:a===`zh`},n),e.summary?(0,V.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:e.summary}):null,(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[6]=i,t[7]=a,t[8]=r,t[9]=o,t[10]=e):e=t[10],c=n.map(e),t[0]=i,t[1]=n,t[2]=a,t[3]=r,t[4]=o,t[5]=c}else c=t[5];let l;return t[11]!==s||t[12]!==c?(l=(0,V.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":s,children:c}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function ze(e){return e.setPath}function Be(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ve(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function He(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Ue(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(y,{className:`h-32 rounded-2xl`}),(0,V.jsx)(y,{className:`h-52 rounded-2xl`}),(0,V.jsx)(y,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function We(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ge(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ke=[`backlog`,`ready`,`active`,`review`,`closed`],qe=[`low`,`normal`,`high`,`critical`],Je=(0,B.memo)(function(e){let t=(0,z.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===c?m=t[6]:(m=(0,V.jsx)(`span`,{children:c}),t[5]=c,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=Ke.map(e=>(0,V.jsx)(u,{value:e,disabled:p(e),children:He(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let ee;return t[17]!==m||t[18]!==_?(ee=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=ee):ee=t[19],ee}),Ye=(0,B.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let d;t[4]===a?d=t[5]:(d=qe.map(e=>(0,V.jsx)(u,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==c||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:d}),t[6]=r,t[7]=c,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Xe=(0,B.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(L,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Ze=(0,B.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(u,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(ht),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==c||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16],h}),Qe=(0,B.memo)(function(e){let t=(0,z.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(gt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),$e=`xopc.taskDetail.chatPanelPercent`,et=42;function tt(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?et:Math.min(r,Math.max(n,e))}function nt(){try{let e=Number(window.localStorage.getItem($e));return Number.isFinite(e)&&e>=30&&e<=60?e:et}catch{return et}}function rt(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.waits.some(e=>e.kind===`paused`)?`paused`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`ready`:e.operationalState}function it(e){return e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function H(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?d:t===`failed`?b:D,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function at({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),s=a(),l=ee(e=>e.language),u=_(e=>e.conversationId),h=(0,B.useMemo)(()=>ke(l),[l]),te=fe(e=>e.setPageHeader),ne=fe(e=>e.clearPageHeader),re=O(e=>e.open),ie=O(e=>e.conversationIdOverride),ae=O(e=>e.openForSession),oe=Te(e=>e.setOpen),{data:y,error:b,mutate:S,lastChange:C,conversationLoading:he,conversationError:D}=me(e),[j,ve]=(0,B.useState)(null),[Ce,L]=(0,B.useState)(null),[R,z]=(0,B.useState)(()=>new Set),[Ie,Le]=(0,B.useState)([]),[ze,He]=(0,B.useState)(null),[Ke,qe]=(0,B.useState)([]),[at,U]=(0,B.useState)(!1),[ot,st]=(0,B.useState)(``),[ct,W]=(0,B.useState)(!1),[lt,ut]=(0,B.useState)(``),[G,dt]=(0,B.useState)(nt),[ft,pt]=(0,B.useState)(!1),mt=(0,B.useRef)(null),ht=(0,B.useRef)(!1),gt=(0,B.useRef)(!1),_t=(0,B.useRef)(``),vt=(0,B.useRef)(null),yt=(0,B.useRef)(null),bt=(0,B.useRef)(null),xt=(0,B.useRef)(y),[St,K]=(0,B.useState)(null),[Ct,wt]=(0,B.useState)(null),[Tt,Et]=(0,B.useState)(!1),Dt=(0,B.useMemo)(()=>({link:h.linkDependencies,linked:h.linkedDependencies,searchPlaceholder:h.dependencySearchPlaceholder,noMatches:h.noDependencyMatches,noCandidates:h.noDependencyCandidates,remove:h.removeDependency}),[h.dependencySearchPlaceholder,h.linkDependencies,h.linkedDependencies,h.noDependencyCandidates,h.noDependencyMatches,h.removeDependency]),Ot=y?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,kt=(0,B.useMemo)(()=>f(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]),At=(0,B.useCallback)(e=>t===`modal`&&n?N(n,e):p(`/tasks/${encodeURIComponent(e)}`,kt),[n,t,kt]);xt.current=y;let q=(0,B.useCallback)((e,t)=>{z(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,B.useEffect)(()=>{L(null),K(null),U(!1),W(!1),wt(null),Et(!1)},[e]),(0,B.useEffect)(()=>{let e=!0;return ge().then(t=>{e&&qe(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,B.useEffect)(()=>{if(!C||C.source===`user`)return;wt(C);let e=window.setTimeout(()=>wt(null),3500);return()=>window.clearTimeout(e)},[C]),(0,B.useEffect)(()=>{let t=y?.task.projectId,n=y?.dependencies??[];if(!t){bt.current=null,He(null),Le(n);return}bt.current!==t&&(bt.current=t,He(null));let r=!0;return De(t).then(t=>{if(!r)return;He(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Le([...i.values()])}).catch(()=>{r&&Le(n)}),()=>{r=!1}},[Ot,y?.task.projectId,e]);let J=(0,B.useCallback)(async(t,n=`command`)=>{let r=xt.current;if(r){q(n,!0),L(null);try{await S(await E(e,t,r.task.version),{revalidate:!1})}catch{L(h.actionFailed)}finally{q(n,!1)}}},[h.actionFailed,S,q,e]),Y=(0,B.useCallback)(async(t,n)=>{let r=xt.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await S(be(e,t,r.task.version),{optimisticData:Ve(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(h.actionFailed),!1}finally{n&&q(n,!1)}},[h.actionFailed,S,q,e]),jt=async()=>{if(!y)return;if(ht.current){ht.current=!1;return}let e=ot.trim(),t=vt.current;if(Be(t,y.task.version,y.task.title,e)){K(`title`);return}if(!e||e===y.task.title){st(y.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},Mt=async()=>{if(!y)return;if(gt.current){gt.current=!1;return}let e=lt.trim(),t=yt.current;if(Be(t,y.task.version,y.task.body??``,e)){K(`description`);return}if(lt===_t.current||e===(y.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},Nt=(0,B.useCallback)(async e=>{let t=xt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),Pt=(0,B.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),Ft=(0,B.useCallback)(e=>{Y({dueAt:Ge(e)},`dueAt`)},[Y]),It=(0,B.useCallback)(e=>{dt(e);try{window.localStorage.setItem($e,String(e))}catch{}},[]),Lt=(0,B.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=mt.current?.clientWidth??0;It(tt(e.key===`Home`?et:G+(e.key===`ArrowLeft`?2:-2),t))},[G,It]),Rt=(0,B.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=mt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),pt(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=tt((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}pt(!1),It(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[G,It]),zt=(0,B.useCallback)(async t=>{let n=xt.current;if(n){q(`dependencies`,!0),L(null);try{await S(await we(e,t,n.task.version),{revalidate:!1})}catch{L(h.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[h.dependencyUpdateFailed,S,q,e]),Bt=(0,B.useCallback)(async t=>{let n=xt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await S(await P(e,t,n.task.version),{revalidate:!1})}catch{L(h.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[h.actionFailed,S,q,e]),Vt=(0,B.useCallback)(async()=>{q(`delete`,!0),L(null);try{await ye(e),r?r():s(kt,{replace:!0})}catch(e){L(e instanceof Error?e.message:h.actionFailed)}finally{q(`delete`,!1)}},[h.actionFailed,s,r,kt,q,e]);if((0,B.useLayoutEffect)(()=>{if(t!==`modal`)return te({startExtra:(0,V.jsx)(c,{to:kt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":h.backToWork,children:(0,V.jsx)(x,{className:`size-4`})}),main:y?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:ze?`${ze} / ${h.taskLabel}`:h.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h.detailStatuses[rt(y)]})]}):null,end:(0,V.jsx)(`div`,{ref:ve,className:`flex min-w-0 items-center justify-end`})}),ne},[ne,h.backToWork,h.detailStatuses,h.taskLabel,y,t,ze,kt,te]),b&&!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:h.taskNotFound});if(!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(Ue,{})});let Ht=y.waits[0],Ut=y.waits.find(e=>e.kind===`paused`),X=y.receipts[0],Wt=rt(y),Gt=h.detailStatuses[Wt],Kt=y.task.body?.trim()||y.task.contract?.objective.trim(),qt=y.runs.find(e=>e.id===X?.runId)?.contractVersion===y.task.latestContractVersion?X:void 0,Jt=se(qt),Yt=new Map(qt?.verification.checks.map(e=>[e.criterion,e.status===`passed`&&!Jt.has(e.criterion)?`unverified`:e.status])),Xt=y.allowedCommands.includes(`mark_ready`),Zt=y.allowedCommands.includes(`start`),Qt=y.allowedCommands.includes(`add_wait`),$t=!Ht&&y.task.phase===`review`&&y.allowedCommands.includes(`close`),en=y.allowedCommands.includes(`reopen`),Z=y.conversation.activeConversationId,tn=y.conversation.currentExecutorAgentId??y.task.delegateAgentId??y.task.ownerId,nn=Ke.find(e=>e.id===tn),rn=!!(Z&&re&&ie===Z),an=y.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),on=y.task.contract?.acceptanceCriteria??[],sn=on.filter(e=>Yt.get(e)===`passed`).length,cn=y.task.contract?.expectedOutputs??[],ln=y.task.contract?.constraints??[],un=y.task.contract?.approvalRequired??[],dn=y.task.contract?.assumptions??[],fn=y.task.contract?.risks??[],Q=(...e)=>!!Ct?.changedFields.some(t=>e.includes(t)),pn=y.allowedCommands.includes(`move`),$=R.has(`command`),mn=R.has(`delete`),hn=y.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),gn=hn!==void 0,_n=(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Xt?(0,V.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,V.jsx)(Se,{className:`size-4`}),h.scheduleTask]}):null,Ut&&y.allowedCommands.includes(`resolve_wait`)?(0,V.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Ut.id}),children:[(0,V.jsx)(Se,{className:`size-4`}),h.resumeTask]}):null,!Ht&&Zt&&tn?(0,V.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:tn}}),children:[(0,V.jsx)(Se,{className:`size-4`}),h.runTask]}):null,$t?(0,V.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,V.jsx)(d,{className:`size-4`}),h.approveTask]}):null,en?(0,V.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(Se,{className:`size-4`}),h.reopenTask]}):null,!Ut&&Qt?(0,V.jsxs)(v,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(je,{className:`size-4`}),h.pauseTask]}):null,(0,V.jsxs)(w,{children:[(0,V.jsx)(Me,{asChild:!0,children:(0,V.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||mn,"aria-label":h.moreActions,children:(0,V.jsx)(pe,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(de,{children:(0,V.jsxs)(T,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[hn?(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),L(null),S(M(e,hn.id,hn.version),{revalidate:!1}).catch(()=>L(h.actionFailed)).finally(()=>q(`command`,!1))},children:h.cancelActiveRun}):null,hn?(0,V.jsx)(k,{className:`my-1 h-px bg-edge`}):null,y.task.phase===`closed`?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:h.cancelTask}),(0,V.jsx)(k,{className:`my-1 h-px bg-edge`})]}),(0,V.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(gn){L(h.deleteActiveTaskBlocked);return}Et(!0)},children:h.deleteTask})]})})]})]}),vn=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,V.jsx)(Ne,{resource:{kind:`task`,id:y.task.id,revision:String(y.task.version)},disabled:at||ct||R.size>0}),_n,Z&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(v,{type:`button`,variant:`ghost`,className:g(`h-8 shrink-0 px-2 text-xs`,rn&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":rn,onClick:()=>{oe(Z,!1),ae(Z)},children:[(0,V.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,V.jsx)(v,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(c,{to:xe(e),children:[(0,V.jsx)(ue,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,V.jsxs)(`div`,{ref:mt,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${ft?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[t===`page`&&j?(0,Fe.createPortal)(vn,j):null,(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:g(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[ze?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),ze]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:h.taskLabel}),(0,V.jsx)(`span`,{className:g(`rounded-full px-2 py-0.5 text-[11px] font-medium`,it(Wt)),children:Gt}),(0,V.jsx)(`span`,{className:`text-fg-subtle`,children:h.updatedAt.replace(`{{date}}`,I(y.task.updatedAt,l))}),Ct?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:Ct.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),at?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:ot,onChange:e=>st(e.target.value),onBlur:()=>void jt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ht.current=!0,st(y.task.title),U(!1),queueMicrotask(()=>{ht.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{vt.current={value:y.task.title,version:y.task.version},K(null),st(y.task.title),U(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:y.task.title})}),St===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{st(y.task.title),K(null),U(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:ot.trim()}).then(e=>{e&&(K(null),U(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Ce?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Ce}):null]}),y.attention.length>0?(0,V.jsxs)(`section`,{className:g(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:an?h.needsAttention:h.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:y.attention.map((t,n)=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1`,children:t.summary}),t.kind===`input_required`||t.kind===`approval_required`?(0,V.jsx)(c,{className:`inline-flex min-h-11 items-center rounded-lg bg-surface-panel px-3 text-sm font-medium text-accent`,to:xe(e),children:l===`zh`?t.kind===`approval_required`?`查看并决定`:`补充信息`:t.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${t.kind}-${n}`))})]}):null,y.task.phase!==`closed`&&!Ut&&y.waits.filter(e=>(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`).map(e=>(0,V.jsx)(Pe,{wait:e,detail:y,zh:l===`zh`,onUpdated:e=>{S(e,{revalidate:!1})}},e.id)),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:g(`p-5`,Q(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.taskDescription}),ct?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:lt,onChange:e=>ut(e.target.value),onBlur:()=>void Mt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),gt.current=!0,ut(y.task.body??y.task.contract?.objective??``),W(!1),queueMicrotask(()=>{gt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=y.task.body??y.task.contract?.objective??``;_t.current=e,yt.current={value:y.task.body??``,version:y.task.version},K(null),ut(e),W(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Kt&&Kt!==y.task.title?Kt:h.noTaskDescription})}),St===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{ut(y.task.body??``),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:lt.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,V.jsxs)(`section`,{className:g(`p-5`,Q(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:h.successDefinition}),on.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:h.criteriaProgress.replace(`{{verified}}`,String(sn)).replace(`{{total}}`,String(on.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:on,empty:h.noDefinition,verificationByCriterion:Yt})})]}),cn.length>0?(0,V.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:h.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:cn,empty:h.noDefinition})})]}):null,ln.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:h.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:ln,empty:h.noDefinition})})]}):null,un.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:h.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:un,empty:h.noDefinition})})]}):null,dn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:h.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:dn,empty:h.noDefinition})})]}):null,fn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:h.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:fn,empty:h.noDefinition})})]}):null]}),X?(0,V.jsxs)(`section`,{className:g(`p-5`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.latestResult}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?X.completionVerdict===`achieved`?`本次执行报告目标已达成,请结合下方验证依据验收。`:`这是阶段性结果,尚不能代表任务全部完成。`:X.completionVerdict===`achieved`?`The run reports the goal achieved. Review the evidence below.`:`This is a partial result; the task is not yet fully complete.`}),(0,V.jsx)(m,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[h.receiptStatuses[X.status],` · `,h.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:X.remainingWork,empty:h.noRemainingWork})})]}):null,X.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:h.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(v,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void Oe(X.runId,`helpful`),children:h.doneWell}),(0,V.jsx)(v,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void Oe(X.runId,`not_helpful`),children:h.needsFix})]}),(0,V.jsx)(Re,{evidence:X.evidence,projectId:y.task.projectId,conversationId:Z??void 0,language:l}),y.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:h.executionHistory.replace(`{{count}}`,String(y.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:y.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:h.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,y.context.length>0?(0,V.jsxs)(`section`,{className:g(`p-5`,Q(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:y.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[h.contextRoleLabels[e.role],` · `,h.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:g(`p-5`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(Je,{value:y.task.phase,disabled:R.has(`phase`),canMove:pn,canApprove:$t,canReopen:en,language:l,label:h.taskPhase,onChange:Nt}),(0,V.jsx)(Ye,{value:y.task.priority,disabled:R.has(`priority`),label:h.priority,labels:h.priorityLabels,onChange:Pt}),(0,V.jsx)(Xe,{value:We(y.task.dueAt),disabled:R.has(`dueAt`),label:h.dueDate,onChange:Ft}),(0,V.jsx)(Ze,{value:y.conversation.currentExecutorAgentId??``,disabled:R.has(`delegateAgentId`),label:h.executorLabel,unassignedLabel:h.unassigned,agents:Ke,onChange:Bt})]})]}),(0,V.jsxs)(`section`,{className:g(`p-5`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:h.dependencies}),(0,V.jsx)(Qe,{candidates:Ie,selected:y.dependencies,disabled:R.has(`dependencies`),labels:Dt,getTaskHref:At,onChange:zt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:h.dependents}),y.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:y.dependents.map(e=>(0,V.jsx)(c,{to:At(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:h.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:Rt,onKeyDown:Lt,onDoubleClick:()=>It(et),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${ft?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-inset px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[tn?(0,V.jsx)(_e,{agentId:tn,avatar:nn?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[nn?.name??tn??h.unassigned,` · `,Gt]})]})]})}),t===`modal`?vn:null]}),Z?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(Ee,{embedded:!0,conversationId:Z,taskId:e})}):he?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(ce,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):D?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(ce,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:D instanceof Error?D.message:String(D)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(ce,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,V.jsx)(F,{open:Tt,title:h.deleteTaskTitle,description:h.deleteTaskDescription.replace(`{{title}}`,y.task.title),confirmLabel:h.confirmDeleteTask,cancelLabel:h.keepTask,destructive:!0,onConfirm:()=>{Et(!1),Vt()},onCancel:()=>Et(!1)})]})}function U(){let e=(0,z.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(at,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function ot(e){let t=(0,z.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=ee(mt),{data:o}=me(n),s=o?.conversation.activeConversationId??null,l=O(pt),u=O(ft),d=O(dt),f=O(G),p=Te(ut),m=he(lt),_=he(W),se=l?u:0,v;t[0]!==i||t[1]!==_?(v=e=>{e||(_(null),i())},t[0]=i,t[1]=_,t[2]=v):v=t[2];let y=a===`zh`?`关闭任务详情`:`Close task details`,b;t[3]!==i||t[4]!==_?(b=()=>{_(null),i()},t[3]=i,t[4]=_,t[5]=b):b=t[5];let x;t[6]!==y||t[7]!==b?(x=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":y,onClick:b}),t[6]=y,t[7]=b,t[8]=x):x=t[8];let ce=l?`true`:`false`,le=`${se/2}px`,de=`${se}px`,fe;t[9]!==le||t[10]!==de?(fe={"--task-detail-workspace-offset":le,"--task-detail-workspace-width":de},t[9]=le,t[10]=de,t[11]=fe):fe=t[11];let pe=fe,C=a===`zh`?`任务详情`:`Task details`,w;t[12]===C?w=t[13]:(w=(0,V.jsx)(ae,{className:`font-medium text-fg`,children:C}),t[12]=C,t[13]=w);let ge=a===`zh`?`查看并操作任务详情`:`View and manage task details`,T;t[14]===ge?T=t[15]:(T=(0,V.jsx)(te,{className:`sr-only`,children:ge}),t[14]=ge,t[15]=T);let E;t[16]!==s||t[17]!==a||t[18]!==f||t[19]!==p||t[20]!==n||t[21]!==d||t[22]!==l?(E=s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:g(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===s,onClick:()=>{p(s,!1),f(s)},children:(0,V.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(c,{to:xe(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=f,t[19]=p,t[20]=n,t[21]=d,t[22]=l,t[23]=E):E=t[23];let D=a===`zh`?`关闭任务详情`:`Close task details`,_e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,V.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[24]=_e):_e=t[24];let k;t[25]===D?k=t[26]:(k=(0,V.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":D,children:_e}),t[25]=D,t[26]=k);let A;t[27]!==E||t[28]!==k?(A=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[E,k]}),t[27]=E,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==w||t[31]!==T||t[32]!==A?(j=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,T,A]}),t[30]=w,t[31]=T,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==i||t[35]!==_?(M=()=>{_(null),i()},t[34]=i,t[35]=_,t[36]=M):M=t[36];let N;t[37]!==r||t[38]!==M||t[39]!==n?(N=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(at,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:M})}),t[37]=r,t[38]=M,t[39]=n,t[40]=N):N=t[40];let P;t[41]!==j||t[42]!==N||t[43]!==ce||t[44]!==pe?(P=(0,V.jsxs)(ie,{className:`xopc-dialog-content task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,"data-workspace-panel-open":ce,style:pe,onEscapeKeyDown:ct,onInteractOutside:st,children:[j,N]}),t[41]=j,t[42]=N,t[43]=ce,t[44]=pe,t[45]=P):P=t[45];let F;t[46]!==m||t[47]!==d||t[48]!==l||t[49]!==u?(F=m?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,V.jsx)(S,{allowOutsideChat:!0,conversationId:d??void 0})}):null,t[46]=m,t[47]=d,t[48]=l,t[49]=u,t[50]=F):F=t[50];let I;t[51]!==P||t[52]!==F||t[53]!==x?(I=(0,V.jsxs)(re,{children:[x,P,F]}),t[51]=P,t[52]=F,t[53]=x,t[54]=I):I=t[54];let ve;return t[55]!==v||t[56]!==I?(ve=(0,V.jsx)(oe,{modal:!1,open:!0,onOpenChange:v,children:I}),t[55]=v,t[56]=I,t[57]=ve):ve=t[57],ve}function st(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function ct(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function lt(e){return e.path}function ut(e){return e.setOpen}function G(e){return e.openForSession}function dt(e){return e.conversationIdOverride}function ft(e){return e.widthPx}function pt(e){return e.open}function mt(e){return e.language}function ht(e){return(0,V.jsx)(u,{value:e.id,children:e.name||e.id},e.id)}function gt(e){return e.id}export{ot as TaskDetailModal,U as TaskDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{a,c as o,i as s,n as c,r as l}from"./locale-store-BPZR8x9b.js";import{t as u}from"./messages-kFWhF6_t.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-CS04eWY9.js";import{n as p,r as m}from"./gateway-config-swr-CoQVulMd.js";import{t as h}from"./skeleton-BwbyijEw.js";import{Bo as g,Fu as _,Ul as ee,Zo as v,aa as y,fl as b,yu as te}from"./index-CJuypaNt.js";import{n as ne,t as re}from"./settings-form-section-Dol9j_pF.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=g(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=i(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,C.jsx)(_,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==s||t[8]!==c?(u=(0,C.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=s,t[8]=c,t[9]=u):u=t[9],u}async function T(){let e=await s(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await s(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await s(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=c(e=>e.language),n=u(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:u(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!o(e=>e.conversationId),[a,s]=(0,x.useState)(!1),[l,p]=(0,x.useState)(null),{data:m,mutate:g,isLoading:_}=d(i?`exposure-status`:null,T,{refreshInterval:3e4}),v=m?.tailscale.hostname,S=m?.tailscale.active===!0,O=m?.tailscale.cliAvailable!==!1,A=v?`https://${v}/`:null,ie=(0,x.useCallback)(async()=>{s(!0),p(null);try{await E(`serve`),await g()}catch(e){p(e instanceof Error?e.message:String(e))}finally{s(!1)}},[g]),ae=(0,x.useCallback)(async()=>{s(!0),p(null);try{await D(),await g()}catch(e){p(e instanceof Error?e.message:String(e))}finally{s(!1)}},[g]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&m?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,_&&!m?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(h,{className:`h-20 rounded-lg`}),(0,C.jsx)(h,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(y,{text:A,labels:r})}):null,l?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:l}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(f,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void ae(),children:[a?(0,C.jsx)(ee,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(f,{type:`button`,disabled:a||!O,onClick:()=>void ie(),children:[a?(0,C.jsx)(ee,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(b,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:te,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await s(l(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await a(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,v,`dark:border-edge`)}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=c(ue),n;e[0]===t?n=e[1]:(n=u(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,a=!!o(le),s=oe(),l=m(a).data?.payload?.config,d;e[2]===l?d=e[3]:(d=ce(l),e[2]=l,e[3]=d);let h=d,[g,_]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==h||e[7]!==s||e[8]!==g?(D=()=>{g||(h?_(h):s&&_(s))},O=[h,s,g],e[6]=h,e[7]=s,e[8]=g,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===g?t=e[12]:(t=g.trim(),e[11]=g,e[12]=t);let n=t;if(n){k=n;break bb0}k=h??s??``}let A=k,j=!h&&!!s&&A===s,M;e[13]!==g||e[14]!==A?(M=async()=>{let e=g.trim()||A;if(e){b({busy:!0,result:null});try{b({busy:!1,result:await ie(e)})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=g,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await p(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await p(),_(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!a)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:te,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=i(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{_(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==g||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:g,onChange:R}),e[26]=g,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==g||e[33]!==y.busy?(V=y.busy||!g.trim(),e[32]=g,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(ee,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(f,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==s||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&s?(0,C.jsxs)(`div`,{className:`rounded-lg bg-accent-soft/60 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:s}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=s,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==h||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&h!==A?(0,C.jsxs)(f,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(ee,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=h,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==h||e[63]!==r.clear||e[64]!==T.busy?(Y=h?(0,C.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=h,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.conversationId}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-xs text-red-900 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){let e=await a(l(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function N(e){try{return{kind:`ready`,setup:(await a(l(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function pe(e){return a(l(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function P(e){await a(l(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function me(e,t){await a(l(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function F(){let e=await s(l(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var I=`https://console.xopc.ai/access/client`;function L(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function R(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(L(e)??``)}async function z(){return a(l(`/api/tunnel/status`))}async function B(){await a(l(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function V(){await a(l(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function H(){return a(l(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function he(e){return a(l(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function U(){let e=(await a(l(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function W(e){await a(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{M as _,B as a,w as b,he as c,P as d,N as f,pe as g,fe as h,V as i,L as l,F as m,z as n,U as o,me as p,W as r,H as s,I as t,R as u,A as v,T as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./cn-JdwAhgNB.js";import{n as o}from"./locale-store-BPZR8x9b.js";import{Ul as s,od as c}from"./index-CJuypaNt.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=o(f)===`zh`;if(n===`idle`)return null;let m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:``,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=a(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(s,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),(0,p.useEffect)(()=>{if(s!==`saved`)return;let e=window.setTimeout(()=>c(`idle`),1600);return()=>window.clearTimeout(e)},[s]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i,u as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c,t as l}from"./popover-select-DcsFzD_i.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./cn-JdwAhgNB.js";import{n as m}from"./locale-store-BPZR8x9b.js";import{a as h,c as g,i as _,n as v,o as y,r as b,s as ee,t as x}from"./dist-BGTk37IG.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{t as C}from"./button-CS04eWY9.js";import{t as w}from"./skeleton-BwbyijEw.js";import{$o as T,Bl as E,Ec as D,Fn as O,Gc as k,Hu as A,In as j,Io as M,Iu as N,J as P,Ju as F,Kl as I,Ln as L,Pn as R,Rc as z,Rl as B,Tc as V,Ul as H,at as U,au as W,bu as G,ct as K,dt as q,fd as te,ft as ne,it as re,jc as ie,ju as J,ld as Y,lt as ae,nl as oe,od as se,ot as ce,pd as le,pt as ue,rt as de,sd as fe,sl as pe,st as me,ud as he,ut as ge,vu as _e,wu as ve,yd as ye,yl as be,zl as xe,zn as Se,zu as Ce}from"./index-CJuypaNt.js";import{t as we}from"./page-tabs-CVbY7_N5.js";import{t as Te}from"./date-picker-Do1dl0La.js";var X=e(t(),1),Z=n(),Q=r();function Ee(e){let t=(0,Z.c)(15),{sourceId:n,disabled:r}=e,i=r===void 0?!1:r,a=m(ke)===`zh`,{sources:o,starting:s,start:c}=P(),l;t[0]!==n||t[1]!==o?(l=n?o.filter(e=>e.grantId===n):o,t[0]=n,t[1]=o,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=u.some(Oe),t[3]=u,t[4]=d);let f=d,p=n&&u.some(De),h=f?a?`更新中`:`Updating`:p?a?`重试`:`Retry`:n?a?`更新理解`:`Update understanding`:a?`更新全部`:`Update all`,g=i||s||f,_;t[5]!==n||t[6]!==c?(_=()=>void c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]===f?v=t[9]:(v=f?(0,Q.jsx)(H,{className:`size-3.5 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(pe,{className:`size-3.5`}),t[8]=f,t[9]=v);let y;return t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v?(y=(0,Q.jsxs)(C,{variant:`ghost`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs`,disabled:g,onClick:_,children:[v,h]}),t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function De(e){return e.status===`failed`||e.status===`partial`||e.status===`canceled`}function Oe(e){return e.status===`queued`||e.status===`running`}function ke(e){return e.language}function Ae(e){let t=(0,Z.c)(22),{sourceId:n,lastCollectedAt:r}=e,i=m(je),a=i===`zh`,o;t[0]===n?o=t[1]:(o=e=>e.sources.find(e=>e.grantId===n),t[0]=n,t[1]=o);let s=P(o);if(!s){let e;t[2]!==i||t[3]!==r||t[4]!==a?(e=r?`${a?`上次更新:`:`Last updated: `}${new Date(r).toLocaleString(i)}`:a?`尚未分析`:`Not analyzed yet`,t[2]=i,t[3]=r,t[4]=a,t[5]=e):e=t[5];let n;return t[6]===e?n=t[7]:(n=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e}),t[6]=e,t[7]=n),n}let c;t[8]===a?c=t[9]:(c=a?{queued:`等待更新`,waiting_desktop:`等待桌面端读取资料`,reading:`正在读取资料`,analyzing:`正在更新理解`}:{queued:`Queued`,waiting_desktop:`Waiting for desktop collection`,reading:`Reading source`,analyzing:`Updating understanding`},t[8]=a,t[9]=c);let l=c,u=s.status===`running`||s.status===`queued`,d=s.status===`failed`||s.status===`partial`||s.status===`canceled`,f=s.metadata.added,p=u?l[s.metadata.phase??`queued`]??l.queued:d?a?`更新未完成,可重试`:`Update incomplete; retry available`:f===0?a?`更新完成,暂无新增理解`:`Updated; no new understanding`:f===void 0?a?`更新完成`:`Updated`:a?`更新完成,新增 ${f} 条`:`Updated; ${f} added`,h;t[10]===p?h=t[11]:(h=(0,Q.jsx)(`p`,{children:p}),t[10]=p,t[11]=h);let g;t[12]!==i||t[13]!==s.completedAt?(g=s.completedAt?(0,Q.jsx)(`p`,{children:new Date(s.completedAt).toLocaleString(i)}):null,t[12]=i,t[13]=s.completedAt,t[14]=g):g=t[14];let _;t[15]!==d||t[16]!==s.errorMessage?(_=d&&s.errorMessage?(0,Q.jsx)(`p`,{className:`text-danger`,children:s.errorMessage}):null,t[15]=d,t[16]=s.errorMessage,t[17]=_):_=t[17];let v;return t[18]!==h||t[19]!==g||t[20]!==_?(v=(0,Q.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,"aria-live":`polite`,children:[h,g,_]}),t[18]=h,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function je(e){return e.language}function Me(e){let t=(0,Z.c)(49),{language:n,busy:r,statement:i,onEdit:a,onDelete:o}=e,[s,c]=(0,X.useState)(!1),l=n===`zh`,u=l?`修改或删除这条内容`:`Edit or delete this item`,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":`true`}),t[0]=d):d=t[0];let f;t[1]!==r||t[2]!==u?(f=(0,Q.jsx)(Se,{asChild:!0,children:(0,Q.jsx)(C,{variant:`ghost`,className:`size-11 shrink-0 p-0`,disabled:r,"aria-label":u,children:d})}),t[1]=r,t[2]=u,t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(be,{className:`size-4`,"aria-hidden":`true`}),t[4]=p):p=t[4];let m=l?`修改`:`Edit`,g;t[5]!==r||t[6]!==a||t[7]!==m?(g=(0,Q.jsxs)(O,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:a,children:[p,m]}),t[5]=r,t[6]=a,t[7]=m,t[8]=g):g=t[8];let S,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>c(!0),w=(0,Q.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),t[9]=S,t[10]=w):(S=t[9],w=t[10]);let T=l?`删除`:`Delete`,E;t[11]!==r||t[12]!==T?(E=(0,Q.jsxs)(O,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:S,children:[w,T]}),t[11]=r,t[12]=T,t[13]=E):E=t[13];let D;t[14]!==E||t[15]!==g?(D=(0,Q.jsx)(j,{children:(0,Q.jsxs)(R,{align:`end`,sideOffset:4,className:`z-[100] min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[g,E]})}),t[14]=E,t[15]=g,t[16]=D):D=t[16];let k;t[17]!==D||t[18]!==f?(k=(0,Q.jsxs)(L,{modal:!1,children:[f,D]}),t[17]=D,t[18]=f,t[19]=k):k=t[19];let A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(h,{className:`fixed inset-0 z-[110] bg-scrim`}),t[20]=A):A=t[20];let M=l?`删除这条内容?`:`Delete this item?`,P;t[21]===M?P=t[22]:(P=(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:M}),t[21]=M,t[22]=P);let F=l?`删除后将不再使用这条记忆,原始对话和文件会保留。`:`This memory will no longer be used. Original conversations and files are kept.`,I;t[23]===F?I=t[24]:(I=(0,Q.jsx)(_,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:F}),t[23]=F,t[24]=I);let z;t[25]!==P||t[26]!==I?(z=(0,Q.jsxs)(`header`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[P,I]}),t[25]=P,t[26]=I,t[27]=z):z=t[27];let B;t[28]===i?B=t[29]:(B=(0,Q.jsx)(`p`,{className:`min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words px-5 py-4 text-sm leading-6 text-fg`,children:i}),t[28]=i,t[29]=B);let V=l?`取消`:`Cancel`,H;t[30]===V?H=t[31]:(H=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(C,{variant:`ghost`,children:V})}),t[30]=V,t[31]=H);let U;t[32]===o?U=t[33]:(U=()=>{c(!1),o()},t[32]=o,t[33]=U);let W=l?`删除`:`Delete`,G;t[34]!==r||t[35]!==U||t[36]!==W?(G=(0,Q.jsx)(C,{disabled:r,onClick:U,children:W}),t[34]=r,t[35]=U,t[36]=W,t[37]=G):G=t[37];let K;t[38]!==H||t[39]!==G?(K=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[H,G]}),t[38]=H,t[39]=G,t[40]=K):K=t[40];let q;t[41]!==z||t[42]!==B||t[43]!==K?(q=(0,Q.jsxs)(y,{children:[A,(0,Q.jsxs)(b,{className:`fixed left-1/2 top-1/2 z-[120] flex h-[min(22rem,calc(100dvh-2rem))] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[z,B,K]})]}),t[41]=z,t[42]=B,t[43]=K,t[44]=q):q=t[44];let te;return t[45]!==s||t[46]!==k||t[47]!==q?(te=(0,Q.jsxs)(x,{open:s,onOpenChange:c,children:[k,q]}),t[45]=s,t[46]=k,t[47]=q,t[48]=te):te=t[48],te}function Ne(e,t){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}).format(e):null}function Pe(e,t,n=new Date){let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r);i.setDate(r.getDate()-1);let a=new Map;for(let n of[...e].sort((e,t)=>t.recordedAt-e.recordedAt)){let e=n.recordedAt>=r.getTime()?t===`zh`?`今天`:`Today`:n.recordedAt>=i.getTime()?t===`zh`?`昨天`:`Yesterday`:Ne(n.recordedAt,t)??(t===`zh`?`更早`:`Earlier`),o=a.get(e)??[];o.push(n),a.set(e,o)}return[...a].map(([e,t])=>({label:e,items:t}))}function Fe(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function Ie(e,t){if(e.validTo){let n=Ne(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`相对稳定`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Relatively stable`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function Le(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`证据较少`:`Limited evidence`}function Re(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function ze(e){let t=(0,Z.c)(23),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onDelete:u,onCorrect:d}=e,f=(0,X.useId)(),p=r===`zh`,m;t[0]!==n||t[1]!==r?(m=Le(n,r),t[0]=n,t[1]=r,t[2]=m):m=t[2];let h=m,g;t[3]===n.sources?g=t[4]:(g=new Set(n.sources?.map(Ve).filter(Boolean)),t[3]=n.sources,t[4]=g);let _;t[5]===g?_=t[6]:(_=[...g],t[5]=g,t[6]=_);let v=_,y=p?`修改`:`Edit`,b;return t[7]!==i||t[8]!==h||t[9]!==o||t[10]!==y||t[11]!==a||t[12]!==f||t[13]!==n||t[14]!==r||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==c||t[20]!==v||t[21]!==p?(b=(0,Q.jsx)(`article`,{className:`border-t border-edge-subtle px-4 py-3 first:border-t-0 sm:px-5 [content-visibility:auto] [contain-intrinsic-size:auto_100px]`,children:a?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:f,children:p?`修改这条理解`:`Edit this understanding`}),(0,Q.jsx)(`textarea`,{id:f,value:o,disabled:i,onChange:e=>s(e.target.value),className:`mt-2 min-h-28 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-base leading-7 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(C,{variant:`ghost`,disabled:i,onClick:l,children:p?`取消`:`Cancel`}),(0,Q.jsx)(C,{variant:`primary`,disabled:!o.trim()||i,onClick:d,children:i?p?`保存中…`:`Saving…`:p?`保存修改`:`Save changes`})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-1.5`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Fe(n,r)}),n.usable===!1?(0,Q.jsx)(`span`,{children:p?`暂不使用`:`Not in use`}):null,n.validTo?(0,Q.jsx)(`span`,{children:Ie(n,r)}):null,n.authority!==`user_explicit`&&n.confidence<.65?(0,Q.jsx)(`span`,{children:h}):null,(0,Q.jsxs)(`details`,{className:`open:basis-full`,children:[(0,Q.jsx)(`summary`,{className:`w-fit cursor-pointer rounded-md py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p?`查看依据`:`View sources`}),(0,Q.jsxs)(`div`,{className:`my-2 space-y-1 border-l-2 border-edge pl-3 text-sm leading-6`,children:[(0,Q.jsx)(`p`,{children:n.usable?p?`按需用于当前协作`:`Used when relevant`:p?`暂不使用,后台继续复核`:`Not in use; reviewed automatically`}),(0,Q.jsxs)(`p`,{children:[Ie(n,r),` · `,Re(n.scope,r),h?` · ${h}`:``]}),(0,Q.jsxs)(`p`,{children:[p?`最近观察:`:`Last observed: `,Ne(n.observedAt,r)]}),v.length?v.map(Be):(0,Q.jsx)(`p`,{children:p?`暂无更详细的来源记录`:`No further source details available`}),(0,Q.jsx)(C,{variant:`ghost`,className:`-ml-2 px-2`,disabled:i,onClick:c,children:y})]})]})]})]}),(0,Q.jsx)(Me,{language:r,busy:i,statement:n.statement,onEdit:c,onDelete:u})]})}),t[7]=i,t[8]=h,t[9]=o,t[10]=y,t[11]=a,t[12]=f,t[13]=n,t[14]=r,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=c,t[20]=v,t[21]=p,t[22]=b):b=t[22],b}function Be(e){return(0,Q.jsx)(`p`,{className:`break-words`,children:e},e)}function Ve(e){return e.label}var He={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`查看来源及其最近更新。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条暂不使用`,noUnderstanding:`暂无来自此渠道的全局理解`,pending:`最近更新`,pendingHint:`自动整理并按需使用,你可以随时修改或删除。`,nothingPending:`尚未形成全局理解。`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`}},en:{eyebrow:`Global user understanding`,title:`How xopc forms its understanding of you`,subtitle:`This brings together understanding formed across projects and conversations, with the channel behind each item. Project facts stay out of your personal portrait.`,channels:`Understanding channels`,channelHint:`View sources and their latest updates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} not in use`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Recent updates`,pendingHint:`Organized automatically and used when relevant. Edit or delete anytime.`,nothingPending:`No understanding has formed yet.`,showAll:`View all {{count}}`,showLess:`Show less`,done:`Done`,updating:`Updating from authorized channels. You can review existing understanding now.`,sourceKinds:{user:`You told me`,conversation:`Conversations and work`,connector:`Connected services`,work_folder:`Work folders`,local_source:`On-device sources`,inference:`Synthesized understanding`}}},Ue={"local-recent-files":{en:`Recent files`,zh:`最近文件`},"chromium-bookmarks":{en:`Recent bookmarks`,zh:`最近书签`},"apple-notes":{en:`Apple Notes`,zh:`Apple 备忘录`},"apple-mail":{en:`Apple Mail`,zh:`Apple 邮件`},"apple-calendar":{en:`Apple Calendar`,zh:`Apple 日历`},"apple-reminders":{en:`Apple Reminders`,zh:`Apple 提醒事项`},"windows-recent-documents":{en:`Recent documents`,zh:`最近文档`},"linux-recent-documents":{en:`Recent documents`,zh:`最近文档`}},We={user:V,conversation:B,connector:Ce,work_folder:ve,local_source:J,inference:Ce},Ge={files:ve,recent_documents:J,calendar:he,tasks:I,notes:z,mail:E,messages:B,code_activity:G};function Ke(e){let t=e.authority===`user_explicit`?`user`:e.authority===`user_observed`?`conversation`:e.authority===`external_untrusted`?`connector`:`inference`;return{id:t,kind:t,observedAt:e.observedAt}}function qe(e,t){return e.kind===`local_source`&&e.label?Ue[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:He[t].sourceKinds[e.kind]}function $(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function Je(e){let t=(0,Z.c)(91),{assertions:n,configuredSources:r,activityRunning:i,language:a,busy:s,error:c,onReviewAssertion:l,onCompleted:d}=e,f=He[a],[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(``),b;t[0]===n?b=t[1]:(b=n.filter(tt),t[0]=n,t[1]=b);let ee=b,x;t[2]===ee?x=t[3]:(x=[...ee].sort(et),t[2]=ee,t[3]=x);let S=x,w;if(t[4]!==r||t[5]!==ee||t[6]!==a){let e=new Map;for(let t of r){let n=t.kind===`local_source`?Ue[t.adapterId]?.[a]??t.displayName:t.displayName,r=$(t);e.set(r,{key:r,grantId:t.id,kind:t.kind,category:t.category,label:t.kind===`work_folder`?a===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of ee)for(let n of t.sources?.length?t.sources:[Ke(t)]){let r=qe(n,a),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),o=i?.key??`${n.kind}:${r}`,s=i??e.get(o)??{key:o,kind:n.kind,category:n.category,label:r,assertions:[],lastObservedAt:n.observedAt};s.assertions.some(e=>e.id===t.id)||s.assertions.push(t),s.lastObservedAt=Math.max(s.lastObservedAt??0,n.observedAt),e.set(o,s)}w=[...e.values()].sort($e),t[4]=r,t[5]=ee,t[6]=a,t[7]=w}else w=t[7];let T=w,E;t[8]===l?E=t[9]:(E=async(e,t,n)=>{await l(e,t,n)&&_(null)},t[8]=l,t[9]=E);let D=E,O,k,A,j,M,N,P,F,I;if(t[10]!==i||t[11]!==s||t[12]!==v||t[13]!==g||t[14]!==a||t[15]!==S||t[16]!==D||t[17]!==m||t[18]!==f.eyebrow||t[19]!==f.nothingPending||t[20]!==f.pending||t[21]!==f.pendingHint||t[22]!==f.showAll||t[23]!==f.showLess||t[24]!==f.subtitle||t[25]!==f.title||t[26]!==f.updating){let e=m?S:S.slice(0,5);O=`mx-auto w-full max-w-[42rem] pb-2`,k=`polite`;let n;t[36]===f.eyebrow?n=t[37]:(n=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:f.eyebrow}),t[36]=f.eyebrow,t[37]=n);let r;t[38]===f.title?r=t[39]:(r=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:f.title}),t[38]=f.title,t[39]=r);let o;t[40]===f.subtitle?o=t[41]:(o=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:f.subtitle}),t[40]=f.subtitle,t[41]=o),t[42]!==n||t[43]!==r||t[44]!==o?(A=(0,Q.jsxs)(`div`,{className:`text-center`,children:[n,r,o]}),t[42]=n,t[43]=r,t[44]=o,t[45]=A):A=t[45],t[46]!==i||t[47]!==f.updating?(j=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(H,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:f.updating})]}):null,t[46]=i,t[47]=f.updating,t[48]=j):j=t[48],M=`mt-8`,N=`understanding-updates-title`;let c=S.length?` · ${S.length}`:``;t[49]!==f.pending||t[50]!==c?(P=(0,Q.jsxs)(`h3`,{id:`understanding-updates-title`,className:`text-sm font-semibold text-fg`,children:[f.pending,c]}),t[49]=f.pending,t[50]=c,t[51]=P):P=t[51],t[52]===f.pendingHint?F=t[53]:(F=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.pendingHint}),t[52]=f.pendingHint,t[53]=F),I=S.length?(0,Q.jsxs)(`div`,{className:`mt-3`,children:[Pe(e,a).map(e=>{let{label:t,items:n}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`border-b border-edge-subtle px-4 pb-2 pt-3 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{children:n.map(e=>(0,Q.jsx)(ze,{item:e,language:a,busy:s,editing:g===e.id,draft:v,onDraftChange:y,onEdit:()=>{_(e.id),y(e.statement)},onCancel:()=>_(null),onCorrect:()=>void D(e,`edited`,v.trim()),onDelete:()=>void D(e,`deleted`)},e.id))})]},t)}),S.length>5?(0,Q.jsxs)(`button`,{type:`button`,className:`mx-auto flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>h(Qe),children:[m?f.showLess:f.showAll.replace(`{{count}}`,String(S.length)),(0,Q.jsx)(Y,{className:p(`size-3.5 transition-transform`,m&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:f.nothingPending})]}),t[10]=i,t[11]=s,t[12]=v,t[13]=g,t[14]=a,t[15]=S,t[16]=D,t[17]=m,t[18]=f.eyebrow,t[19]=f.nothingPending,t[20]=f.pending,t[21]=f.pendingHint,t[22]=f.showAll,t[23]=f.showLess,t[24]=f.subtitle,t[25]=f.title,t[26]=f.updating,t[27]=O,t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=N,t[33]=P,t[34]=F,t[35]=I}else O=t[27],k=t[28],A=t[29],j=t[30],M=t[31],N=t[32],P=t[33],F=t[34],I=t[35];let L;t[54]!==M||t[55]!==N||t[56]!==P||t[57]!==F||t[58]!==I?(L=(0,Q.jsxs)(`section`,{className:M,"aria-labelledby":N,children:[P,F,I]}),t[54]=M,t[55]=N,t[56]=P,t[57]=F,t[58]=I,t[59]=L):L=t[59];let R;t[60]!==T.length||t[61]!==f.channels?(R=(0,Q.jsxs)(`summary`,{className:`w-fit cursor-pointer rounded-md py-2 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f.channels,` · `,T.length]}),t[60]=T.length,t[61]=f.channels,t[62]=R):R=t[62];let z;t[63]===f.channelHint?z=t[64]:(z=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.channelHint}),t[63]=f.channelHint,t[64]=z);let B;t[65]!==T||t[66]!==f.activeCount||t[67]!==f.noChannels||t[68]!==f.noUnderstanding||t[69]!==f.pendingCount?(B=T.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.map(e=>{let t=e.category?Ge[e.category]??We[e.kind]:We[e.kind],n=e.assertions.filter(Ze).length,r=e.assertions.filter(Xe).length;return(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge bg-surface-base/55 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),e.grantId?(0,Q.jsx)(Ae,{sourceId:e.grantId,lastCollectedAt:e.lastObservedAt}):null,e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?f.activeCount.replace(`{{count}}`,String(n)):``,r?f.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.noUnderstanding})]}),e.grantId?(0,Q.jsx)(Ee,{sourceId:e.grantId}):null]}),e.assertions.length?(0,Q.jsx)(`ul`,{className:`ml-12 mt-3 space-y-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.assertions.slice(0,5).map(Ye)}):null]},e.key)})}):(0,Q.jsx)(`p`,{className:`mt-3 rounded-xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:f.noChannels}),t[65]=T,t[66]=f.activeCount,t[67]=f.noChannels,t[68]=f.noUnderstanding,t[69]=f.pendingCount,t[70]=B):B=t[70];let V;t[71]!==R||t[72]!==z||t[73]!==B?(V=(0,Q.jsxs)(`details`,{className:`mt-6 border-t border-edge pt-4`,children:[R,z,B]}),t[71]=R,t[72]=z,t[73]=B,t[74]=V):V=t[74];let U;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(o,{className:`size-4`}),t[75]=U):U=t[75];let W;t[76]!==s||t[77]!==d||t[78]!==f.done?(W=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(C,{variant:`primary`,disabled:s,onClick:d,children:[U,f.done]})}),t[76]=s,t[77]=d,t[78]=f.done,t[79]=W):W=t[79];let G;t[80]===c?G=t[81]:(G=c?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:c}):null,t[80]=c,t[81]=G);let K;return t[82]!==O||t[83]!==k||t[84]!==A||t[85]!==j||t[86]!==L||t[87]!==V||t[88]!==W||t[89]!==G?(K=(0,Q.jsxs)(`section`,{className:O,"aria-live":k,children:[A,j,L,V,W,G]}),t[82]=O,t[83]=k,t[84]=A,t[85]=j,t[86]=L,t[87]=V,t[88]=W,t[89]=G,t[90]=K):K=t[90],K}function Ye(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent/60`}),(0,Q.jsx)(`span`,{children:e.statement})]},e.id)}function Xe(e){return!e.usable}function Ze(e){return e.usable}function Qe(e){return!e}function $e(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function et(e,t){return t.recordedAt-e.recordedAt}function tt(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function nt(){let{pathname:e,search:t}=a(),n=m(e=>e.language),r=de(),[i,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),l=e===`/user-model`,{data:u,mutate:d}=S(l?`/api/user-model`:null,ae),E=P(e=>e.error),D=P(e=>e.sources.some(e=>e.status===`running`||e.status===`queued`)),O=n===`zh`;if((0,X.useEffect)(()=>{l&&new URLSearchParams(t).get(`workDiscovery`)===`review`&&de.getState().setDrawerOpen(!0)},[l,t]),(0,X.useEffect)(()=>{l&&r.status!==`running`&&d()},[d,l,r.directoryRun?.id,r.status]),!l)return null;let A=r.status===`running`||D,j=async(e,t,n)=>{o(!0),c(null);try{return t===`edited`&&n?await re(e.id,n):t===`deleted`&&await ce(e.id),await d(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},M=e=>{if(!e&&u&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(x,{open:r.drawerOpen,onOpenChange:M,children:[(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsx)(C,{type:`button`,variant:`ghost`,className:p(`relative size-8 rounded-xl p-0`,T),title:O?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":O?`查看 xopc 对你的理解`:`Review what xopc understands`,children:A?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(k,{className:`size-4 text-accent-fg`})})}),(0,Q.jsxs)(y,{children:[(0,Q.jsx)(h,{className:`fixed inset-0 z-[60] bg-scrim backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:backdrop-blur-none`}),(0,Q.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[61] flex items-center justify-center p-3 sm:p-6`,children:(0,Q.jsxs)(b,{className:`xopc-understanding-center pointer-events-auto flex h-[min(42rem,calc(100dvh-1.5rem))] w-[min(44rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float outline-none sm:h-[min(42rem,calc(100dvh-3rem))] sm:w-[min(44rem,calc(100vw-3rem))]`,children:[(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center justify-between border-b border-edge-subtle px-5 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ee,{className:`text-sm font-semibold text-fg`,children:A?O?`正在更新用户理解`:`Updating user understanding`:O?`用户理解`:`User understanding`}),(0,Q.jsx)(_,{className:`mt-0.5 text-xs text-fg-muted`,children:A?O?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:O?`自动更新,可随时修改或删除`:`Updated automatically. Edit or delete anytime`})]}),(0,Q.jsx)(Ee,{disabled:!u?.sources?.length}),(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(C,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":O?`关闭`:`Close`,children:(0,Q.jsx)(f,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-7 sm:px-9 sm:py-9`,children:u?(0,Q.jsx)(Je,{assertions:u.assertions,configuredSources:u.sources??[],activityRunning:A,language:n,busy:i,error:s??E??null,onReviewAssertion:j,onCompleted:()=>{M(!1)}}):(0,Q.jsxs)(`section`,{className:`space-y-4`,"aria-label":O?`正在加载用户理解`:`Loading user understanding`,children:[(0,Q.jsx)(w,{className:`h-8 w-2/3`}),(0,Q.jsx)(w,{className:`h-32 w-full`}),(0,Q.jsx)(w,{className:`h-32 w-full`})]})})]})})]})]})}function rt(e){let t=e.get(`tab`);return t===`understanding`||t===`knowledge`?t:`overview`}var it={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,timezoneSearch:`Search timezones…`,timezoneNoMatch:`No matching timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`Not in use`,pendingHint:`Reviewed automatically as evidence changes`,allUnderstanding:`All understanding`,understandingFilterHint:`Filter this view by how each item was formed or whether it is currently in use.`,importantNow:`What matters now`,prioritySourceGoal:`From a goal you confirmed`,prioritySourceWork:`From your current work`,editPriority:`Edit focus`,addPriority:`Set current focus`,priorityTitle:`Current focus`,priorityTitlePlaceholder:`What matters most right now?`,priorityOutcome:`What a good outcome looks like`,priorityOutcomePlaceholder:`Describe the result you want…`,priorityUntil:`Focus through`,savePriority:`Save focus`,endPriority:`End focus`,endingPriority:`Ending…`,priorityHint:`This is used to keep xopc aligned with what deserves attention now.`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`Recent understanding from our work. You can edit any item.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,refreshing:`Refreshing…`,refreshComplete:`Refreshed`,refreshFailed:`Refresh failed`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryFilterHint:`Filter by memory type`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,timezoneSearch:`搜索时区…`,timezoneNoMatch:`没有匹配的时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`暂不使用`,pendingHint:`随新证据自动复核`,allUnderstanding:`全部理解`,understandingFilterHint:`按内容来源和当前是否使用筛选这份理解。`,importantNow:`此刻重要`,prioritySourceGoal:`来自你确认的当前目标`,prioritySourceWork:`来自当前工作上下文`,editPriority:`编辑`,addPriority:`设置当前关注`,priorityTitle:`当前关注`,priorityTitlePlaceholder:`现在最重要的是什么?`,priorityOutcome:`期待结果`,priorityOutcomePlaceholder:`描述你希望达成的结果…`,priorityUntil:`关注至`,savePriority:`保存关注`,endPriority:`结束关注`,endingPriority:`正在结束…`,priorityHint:`这项内容会帮助 xopc 在协作中优先关注当前最重要的事情。`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最近在协作中形成的认识,你可以随时修改。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,refreshing:`正在刷新…`,refreshComplete:`已刷新`,refreshFailed:`刷新失败`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryFilterHint:`按记忆类型筛选`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},at=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),ot=[`work_thread`,`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`],st=`UTC.Africa/Cairo.Africa/Johannesburg.America/Chicago.America/Denver.America/Los_Angeles.America/Mexico_City.America/New_York.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Kolkata.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Berlin.Europe/London.Europe/Madrid.Europe/Paris.Europe/Rome.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function ct(){try{let e=Intl.supportedValuesOf(`timeZone`);return[...new Set([`UTC`,...e])]}catch{return[...st]}}var lt=ct();function ut(e){return e.map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.includes(`/`)?e.split(`/`)[0]:`UTC`}))}function dt(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function ft(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function pt(e){return{callName:ft(e.profile.callName)??``,role:ft(e.profile.role)??``,pronouns:ft(e.profile.pronouns)??``,timezone:ft(e.profile.timezone)??``,locale:ft(e.profile.locale)??``}}function mt(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function ht(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function gt(e,t){let n=dt(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function _t(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function vt(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function yt(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function bt(e,t){return(t===`zh`?{work_thread:`工作主线`,project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{work_thread:`Work threads`,project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function xt(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function St(e){let t=(0,Z.c)(16),{title:n,hint:r,action:i,children:a,className:o}=e,s=o===void 0?``:o,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Q.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,Q.jsxs)(`header`,{className:`flex items-end justify-between gap-4 px-1 pb-3`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;t[10]===a?f=t[11]:(f=(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:a}),t[10]=a,t[11]=f);let p;return t[12]!==s||t[13]!==d||t[14]!==f?(p=(0,Q.jsxs)(`section`,{className:s,children:[d,f]}),t[12]=s,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Ct(e){let t=(0,Z.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-5 text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function wt({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let o=it[n],[u,d]=(0,X.useState)(t),[p,m]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(t),m(``))},[e,t]);let g=e=>{e.preventDefault(),a({callName:u.callName.trim(),role:u.role.trim(),pronouns:u.pronouns.trim(),timezone:u.timezone.trim(),locale:u.locale.trim()})},S=(e,t,n)=>(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,Q.jsx)(`input`,{value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),w=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];u.locale&&!w.includes(u.locale)&&w.push(u.locale);let T=K(),E=(0,X.useMemo)(()=>[...new Set([...lt,T,u.timezone].filter(Boolean))].sort(),[T,u.timezone]),D=p.trim().toLocaleLowerCase(),O=(0,X.useMemo)(()=>ut(E.filter(e=>!D||e.toLocaleLowerCase().includes(D)||e.replaceAll(`_`,` `).toLocaleLowerCase().includes(D))),[E,D]);return(0,Q.jsx)(x,{open:e,onOpenChange:i,children:(0,Q.jsxs)(y,{children:[(0,Q.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(b,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:g,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:o.editProfile}),(0,Q.jsx)(_,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.editProfileHint})]}),(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(C,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:(0,Q.jsx)(f,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,Q.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[S(`callName`,o.callName,o.callNamePlaceholder),S(`role`,o.role,o.rolePlaceholder),S(`pronouns`,o.pronouns,o.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:o.locale}),(0,Q.jsxs)(s,{value:u.locale,onChange:e=>d(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(c,{value:``,children:o.notProvided}),w.map(e=>(0,Q.jsx)(c,{value:e,children:mt(e,n)},e))]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:o.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(l,{value:u.timezone,options:O,placeholder:K(),emptyLabel:o.notProvided,ariaLabel:o.timezone,selectedLabel:u.timezone||o.notProvided,searchPlaceholder:o.timezoneSearch,searchValue:p,onSearchChange:m,statusMessage:O.length?void 0:o.timezoneNoMatch,triggerClassName:`min-w-0 flex-1 rounded-xl bg-surface-base`,onChange:e=>{d(t=>({...t,timezone:e})),m(``)}}),(0,Q.jsx)(C,{className:`shrink-0 whitespace-nowrap`,onClick:()=>d(e=>({...e,timezone:T})),children:o.useDeviceTimezone})]})]})]})}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(C,{disabled:r,children:o.cancel})}),(0,Q.jsxs)(C,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(H,{className:`size-4 animate-spin`}):null,r?o.saving:o.saveProfile]})]})]})})]})})}function Tt(e){let t=(0,Z.c)(94),{open:n,priority:r,title:i,outcome:a,language:o,saving:s,onOpenChange:c,onSave:l,onEnd:u}=e,d=it[o],[p,m]=(0,X.useState)(i),[g,S]=(0,X.useState)(a??``),w=r?.validTo??Date.now()+6048e5,T;t[0]===w?T=t[1]:(T=_t(w),t[0]=w,t[1]=T);let E=T,[D,O]=(0,X.useState)(E),k,A;t[2]!==E||t[3]!==n||t[4]!==a||t[5]!==i?(k=()=>{n&&(m(i),S(a??``),O(E))},A=[E,n,a,i],t[2]=E,t[3]=n,t[4]=a,t[5]=i,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,X.useEffect)(k,A);let j;t[8]!==g||t[9]!==p||t[10]!==D||t[11]!==l||t[12]!==r?.targetType?(j=e=>{e.preventDefault(),l({title:p.trim(),...r?.targetType===`goal`?{desiredOutcome:g.trim()}:{},validTo:vt(D)})},t[8]=g,t[9]=p,t[10]=D,t[11]=l,t[12]=r?.targetType,t[13]=j):j=t[13];let M=j,N;t[14]!==g||t[15]!==p||t[16]!==D||t[17]!==r?.targetType?(N=p.trim()&&D&&(r?.targetType!==`goal`||g.trim()),t[14]=g,t[15]=p,t[16]=D,t[17]=r?.targetType,t[18]=N):N=t[18];let P=!!N,F;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[19]=F):F=t[19];let I=r?d.editPriority:d.addPriority,L;t[20]===I?L=t[21]:(L=(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:I}),t[20]=I,t[21]=L);let R;t[22]===d.priorityHint?R=t[23]:(R=(0,Q.jsx)(_,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.priorityHint}),t[22]=d.priorityHint,t[23]=R);let z;t[24]!==R||t[25]!==L?(z=(0,Q.jsxs)(`div`,{children:[L,R]}),t[24]=R,t[25]=L,t[26]=z):z=t[26];let B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(f,{className:`size-4`}),t[27]=B):B=t[27];let V;t[28]===d.cancel?V=t[29]:(V=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(C,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":d.cancel,children:B})}),t[28]=d.cancel,t[29]=V);let U;t[30]!==z||t[31]!==V?(U=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[z,V]}),t[30]=z,t[31]=V,t[32]=U):U=t[32];let W;t[33]===d.priorityTitle?W=t[34]:(W=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityTitle}),t[33]=d.priorityTitle,t[34]=W);let G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>m(e.target.value),t[35]=G):G=t[35];let K;t[36]!==p||t[37]!==d.priorityTitlePlaceholder?(K=(0,Q.jsx)(`input`,{autoFocus:!0,value:p,onChange:G,placeholder:d.priorityTitlePlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),t[36]=p,t[37]=d.priorityTitlePlaceholder,t[38]=K):K=t[38];let q;t[39]!==W||t[40]!==K?(q=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[W,K]}),t[39]=W,t[40]=K,t[41]=q):q=t[41];let te;t[42]!==g||t[43]!==r?.targetType||t[44]!==d.priorityOutcome||t[45]!==d.priorityOutcomePlaceholder?(te=r?.targetType===`goal`?(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityOutcome}),(0,Q.jsx)(`textarea`,{value:g,onChange:e=>S(e.target.value),placeholder:d.priorityOutcomePlaceholder,className:`min-h-28 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}):null,t[42]=g,t[43]=r?.targetType,t[44]=d.priorityOutcome,t[45]=d.priorityOutcomePlaceholder,t[46]=te):te=t[46];let ne;t[47]===d.priorityUntil?ne=t[48]:(ne=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityUntil}),t[47]=d.priorityUntil,t[48]=ne);let re;t[49]===r?.validFrom?re=t[50]:(re=r?.validFrom??Date.now(),t[49]=r?.validFrom,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=_t(re),t[51]=re,t[52]=ie);let J;t[53]!==D||t[54]!==d.priorityUntil||t[55]!==ie?(J=(0,Q.jsx)(Te,{min:ie,value:D,onChange:O,ariaLabel:d.priorityUntil,className:`rounded-xl border border-edge bg-surface-base hover:border-edge-strong hover:bg-surface-base`}),t[53]=D,t[54]=d.priorityUntil,t[55]=ie,t[56]=J):J=t[56];let Y;t[57]!==ne||t[58]!==J?(Y=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[ne,J]}),t[57]=ne,t[58]=J,t[59]=Y):Y=t[59];let ae;t[60]!==q||t[61]!==te||t[62]!==Y?(ae=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5 sm:p-6`,children:[q,te,Y]}),t[60]=q,t[61]=te,t[62]=Y,t[63]=ae):ae=t[63];let oe;t[64]!==u||t[65]!==r||t[66]!==s||t[67]!==d.endPriority||t[68]!==d.endingPriority?(oe=r&&u?(0,Q.jsxs)(C,{variant:`ghost`,className:`text-danger hover:text-danger`,disabled:s,onClick:u,children:[s?(0,Q.jsx)(H,{className:`size-4 animate-spin`}):null,s?d.endingPriority:d.endPriority]}):(0,Q.jsx)(`span`,{}),t[64]=u,t[65]=r,t[66]=s,t[67]=d.endPriority,t[68]=d.endingPriority,t[69]=oe):oe=t[69];let se;t[70]!==s||t[71]!==d.cancel?(se=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(C,{disabled:s,children:d.cancel})}),t[70]=s,t[71]=d.cancel,t[72]=se):se=t[72];let ce=!P||s,le;t[73]===s?le=t[74]:(le=s?(0,Q.jsx)(H,{className:`size-4 animate-spin`}):null,t[73]=s,t[74]=le);let ue;t[75]!==d.savePriority||t[76]!==ce||t[77]!==le?(ue=(0,Q.jsxs)(C,{type:`submit`,variant:`primary`,disabled:ce,children:[le,d.savePriority]}),t[75]=d.savePriority,t[76]=ce,t[77]=le,t[78]=ue):ue=t[78];let de;t[79]!==se||t[80]!==ue?(de=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[se,ue]}),t[79]=se,t[80]=ue,t[81]=de):de=t[81];let fe;t[82]!==oe||t[83]!==de?(fe=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[oe,de]}),t[82]=oe,t[83]=de,t[84]=fe):fe=t[84];let pe;t[85]!==M||t[86]!==U||t[87]!==ae||t[88]!==fe?(pe=(0,Q.jsxs)(y,{children:[F,(0,Q.jsx)(b,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:M,children:[U,ae,fe]})})]}),t[85]=M,t[86]=U,t[87]=ae,t[88]=fe,t[89]=pe):pe=t[89];let me;return t[90]!==c||t[91]!==n||t[92]!==pe?(me=(0,Q.jsx)(x,{open:n,onOpenChange:c,children:pe}),t[90]=c,t[91]=n,t[92]=pe,t[93]=me):me=t[93],me}function Et(e){let t=(0,Z.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=it[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(_e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,Q.jsx)(C,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Dt(e){let t=(0,Z.c)(22),{item:n,language:r,busy:i,expanded:a,onToggle:o,editing:s,draft:c,onDraftChange:l,onEdit:u,onCancel:d,onReview:f,onDelete:p}=e,m=it[r],h=n.updatedAt??n.createdAt,g;t[0]!==r||t[1]!==h?(g=dt(h,r),t[0]=r,t[1]=h,t[2]=g):g=t[2];let _=g,v;t[3]===n.content?v=t[4]:(v=n.content.length>96||n.content.includes(`
|
|
2
|
-
`),t[3]=n.content,t[4]=v);let y=v,b;return t[5]!==i||t[6]!==y||t[7]!==_||t[8]!==c||t[9]!==s||t[10]!==a||t[11]!==n.content||t[12]!==n.scope||t[13]!==r||t[14]!==d||t[15]!==p||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==o||t[20]!==m?(b=(0,Q.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:s?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`textarea`,{"aria-label":m.correctionPlaceholder,disabled:i,value:c,onChange:e=>l(e.target.value),className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(C,{variant:`ghost`,className:`h-8`,onClick:d,children:m.cancel}),(0,Q.jsx)(C,{variant:`primary`,className:`h-8`,disabled:!c.trim()||i,onClick:()=>f(`edit_and_approve`,c.trim()),children:m.save})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(ye,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg ${a?``:`line-clamp-2`}`,children:n.content}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:yt(n.scope,r)}),_?(0,Q.jsx)(`span`,{children:_}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[y?(0,Q.jsx)(C,{variant:`ghost`,className:`size-11 p-0`,"aria-expanded":a,"aria-label":a?m.collapse:m.expand,onClick:o,children:(0,Q.jsx)(Y,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})}):null,(0,Q.jsx)(Me,{language:r,busy:i,statement:n.content,onEdit:u,onDelete:p})]})]})}),t[5]=i,t[6]=y,t[7]=_,t[8]=c,t[9]=s,t[10]=a,t[11]=n.content,t[12]=n.scope,t[13]=r,t[14]=d,t[15]=p,t[16]=l,t[17]=u,t[18]=f,t[19]=o,t[20]=m,t[21]=b):b=t[21],b}function Ot(){let e=m(e=>e.language),t=it[e],n=M(e=>e.setPageHeader),r=M(e=>e.clearPageHeader),[a,s]=i(),{data:c,error:l,isLoading:u,isValidating:p,mutate:h}=S(`/api/user-model`,ae),g=rt(a),[_,v]=(0,X.useState)(),[y,b]=(0,X.useState)(),[ee,x]=(0,X.useState)(``),[T,E]=(0,X.useState)(),[O,j]=(0,X.useState)(``),[N,P]=(0,X.useState)(``),[I,L]=(0,X.useState)(24),[R,z]=(0,X.useState)(),[G,K]=(0,X.useState)(!1),[ie,J]=(0,X.useState)(!1),[Y,de]=(0,X.useState)(`all`),[ve,Se]=(0,X.useState)(`all`),[Te,Z]=(0,X.useState)(`idle`),Ee=(0,X.useRef)(void 0),De=e=>{e!==g&&s(t=>{let n=new URLSearchParams(t);return e===`overview`?n.delete(`tab`):n.set(`tab`,e),n})},Oe=(0,X.useCallback)(async()=>{if(!(Te===`refreshing`||p)){Ee.current&&window.clearTimeout(Ee.current),Z(`refreshing`),b(void 0),x(t.refreshing);try{await h(),Z(`success`),x(t.refreshComplete)}catch{Z(`error`),x(``),b(t.refreshFailed)}finally{Ee.current=window.setTimeout(()=>Z(`idle`),1600)}}},[p,h,Te,t]);(0,X.useEffect)(()=>()=>{Ee.current&&window.clearTimeout(Ee.current)},[]);let ke=p||Te===`refreshing`,Ae=ke?t.refreshing:Te===`success`?t.refreshComplete:Te===`error`?t.refreshFailed:t.refresh;(0,X.useEffect)(()=>(n({startExtra:null,main:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,Q.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(nt,{}),(0,Q.jsx)(C,{variant:`secondary`,className:`size-9 p-0 ${Te===`success`?`text-success`:Te===`error`?`text-danger`:``}`,disabled:ke,"aria-label":Ae,title:Ae,onClick:()=>void Oe(),children:ke?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):Te===`success`?(0,Q.jsx)(o,{className:`size-4`,"aria-hidden":`true`}):Te===`error`?(0,Q.jsx)(se,{className:`size-4`,"aria-hidden":`true`}):(0,Q.jsx)(pe,{className:`size-4`,"aria-hidden":`true`})})]})}),r),[r,ke,Te,Ae,Oe,n,t]);let je=async(n,r)=>{v(n),b(void 0),x(``);try{await r(),await h(),x(e===`zh`?`已更新`:`Updated`)}catch{b(t.actionFailed)}finally{v(void 0)}},Me=e=>{je(e.id,async()=>{await re(e.id,O.trim()),E(void 0),j(``)})},Ne=async e=>{v(`profile`),b(void 0),x(``);try{await ue(e),await h(),K(!1)}catch{b(t.actionFailed)}finally{v(void 0)}},Fe=async(n,r)=>{v(`priority:${n.id}`),b(void 0),x(``);try{await ne(n.id,r),await h(),J(!1),x(e===`zh`?`当前关注已更新`:`Current focus updated`)}catch{b(t.actionFailed)}finally{v(void 0)}},Ie=async n=>{v(`priority:create`),b(void 0),x(``);try{await U(n),await h(),J(!1),x(e===`zh`?`当前关注已设置`:`Current focus set`)}catch{b(t.actionFailed)}finally{v(void 0)}},Le=async n=>{v(`priority:${n.id}`),b(void 0),x(``);try{await ne(n.id,{status:`completed`}),await h(),J(!1),x(e===`zh`?`当前关注已结束`:`Current focus ended`)}catch{b(t.actionFailed)}finally{v(void 0)}};if(u)return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Q.jsx)(w,{className:`h-10 w-72 rounded-xl`}),(0,Q.jsx)(w,{className:`h-72 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,Q.jsx)(w,{className:`h-80 rounded-xl`}),(0,Q.jsx)(w,{className:`h-80 rounded-xl`})]})]});if(l||!c)return(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-72 max-w-xl flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,Q.jsx)(le,{className:`size-6 text-fg-subtle`}),(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,Q.jsx)(C,{onClick:()=>void h(),children:t.tryAgain})]});let Re=[...c.assertions].sort((e,t)=>{let n=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-n||t.recordedAt-e.recordedAt}).filter(e=>e.scope.type===`global`&&!at.has(e.predicate)),Be=pt(c),Ve=Be.callName||(e===`zh`?`你`:`You`),He=Re.filter(e=>!e.usable),Ue=Re.filter(e=>e.usable),We=Ue.filter(e=>e.authority===`user_explicit`).length,Ge=Ue.length-We,Ke=Re.filter(e=>Y===`explicit`?e.usable&&e.authority===`user_explicit`:Y===`learned`?e.usable&&e.authority!==`user_explicit`:Y===`pending`?!e.usable:!0),qe=c.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),$=qe.find(e=>e.rank===`primary`)??qe[0],Je=xt($,c.goals,e),Ye=$?.targetType===`goal`?c.goals.find(e=>e.id===$.targetId):void 0,Xe=c.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>$?.targetType!==`goal`||e.id!==$.targetId),Ze=c.rules.filter(e=>e.status!==`archived`),Qe=[...Re].sort((e,t)=>t.recordedAt-e.recordedAt),$e=c.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),et=N.trim().toLocaleLowerCase(),tt=$e.filter(e=>ve===`all`||e.kind===ve),st=tt.filter(t=>!et||t.content.toLocaleLowerCase().includes(et)||bt(t.kind,e).toLocaleLowerCase().includes(et)),ct=[{key:`identity`,title:t.identity,icon:V,items:Ke.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:A,items:Ke.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:_e,items:Ke.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:F,items:Ke.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:k,items:Ke.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),lt=ot.map(e=>({kind:e,count:$e.filter(t=>t.kind===e).length})).filter(e=>e.count>0),ut=lt.slice(0,4),ft=ut.length===1?`grid-cols-1`:ut.length===2?`sm:grid-cols-2`:ut.length===3?`sm:grid-cols-3`:`sm:grid-cols-2 lg:grid-cols-4`,_t=st.slice(0,I),vt=ot.map(e=>({kind:e,items:_t.filter(t=>t.kind===e),totalCount:st.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),yt=[{id:`all`,label:t.allUnderstanding,count:Re.length},{id:`explicit`,label:t.explicit,count:We},{id:`learned`,label:t.learned,count:Ge},{id:`pending`,label:t.pending,count:He.length}],Ot=e=>{de(e),De(`understanding`)},kt=e=>{Se(e),P(``),L(24),De(`knowledge`)},At=t=>(0,Q.jsx)(ze,{item:t,language:e,busy:!!_,editing:T===t.id,draft:T===t.id?O:``,onDraftChange:j,onEdit:()=>{E(t.id),j(t.statement)},onCancel:()=>{E(void 0),j(``)},onDelete:()=>void je(t.id,()=>ce(t.id)),onCorrect:()=>Me(t)},t.id),jt=c.maintenance.lastRun?dt(c.maintenance.lastRun.finishedAt??c.maintenance.lastRun.startedAt,e,!0):null,Mt=c.maintenance.lastRun?c.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${jt}`:t.maintenanceFailed:t.maintenanceReady;return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-8 px-4 py-7 sm:px-6 lg:px-8 lg:py-10`,children:[(0,Q.jsx)(we,{items:[{id:`overview`,label:t.overview,icon:k},{id:`understanding`,label:t.understanding,icon:V,count:Re.length},{id:`knowledge`,label:t.knowledge,icon:ye,count:$e.length}],activeTab:g,onChange:De,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`,className:`w-fit max-w-full gap-1 rounded-full bg-surface-panel p-1 shadow-surface`,buttonClassName:`rounded-full px-3.5 py-2`,selectedClassName:`bg-surface-active text-fg`,unselectedClassName:`text-fg-muted hover:bg-surface-hover hover:text-fg`}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:ee}),y?(0,Q.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-3 rounded-xl border border-danger bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:y}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(void 0),"aria-label":t.cancel,children:(0,Q.jsx)(f,{className:`size-4`})})]}):null,g===`overview`?(0,Q.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-10`,children:[(0,Q.jsxs)(`section`,{"data-testid":`overview-hero`,className:`grid gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,24rem)] lg:gap-12`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 px-1 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-5`,children:[(0,Q.jsx)(`div`,{className:`flex size-20 shrink-0 items-center justify-center rounded-[1.4rem] bg-surface-active text-xl font-semibold text-fg`,children:ht(Ve)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-3xl font-semibold tracking-tight text-fg`,children:Ve}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg-muted`,children:Be.role||t.notProvided})]}),(0,Q.jsxs)(C,{variant:`ghost`,className:`shrink-0`,onClick:()=>K(!0),children:[(0,Q.jsx)(D,{className:`size-4`,"aria-hidden":`true`}),t.editProfile]})]}),(0,Q.jsx)(`p`,{className:`mt-5 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,Q.jsx)(`dl`,{className:`mt-7 grid gap-x-8 gap-y-5 sm:grid-cols-3`,children:[{icon:W,label:t.locale,value:Be.locale?mt(Be.locale,e):t.notProvided},{icon:xe,label:t.timezone,value:Be.timezone||t.notProvided},{icon:V,label:t.pronouns,value:Be.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsx)(e,{className:`size-3.5`,"aria-hidden":`true`}),t]}),(0,Q.jsx)(`dd`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})]}),(0,Q.jsxs)(`aside`,{"data-testid":`priority-panel`,className:`flex min-h-64 flex-col rounded-[1.4rem] bg-surface-panel p-6 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),$?(0,Q.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Q.jsx)(te,{className:`size-3.5`,"aria-hidden":`true`}),$.targetType===`goal`?t.prioritySourceGoal:t.prioritySourceWork]}):null]}),$&&Je?(0,Q.jsxs)(C,{variant:`ghost`,className:`h-8 shrink-0 px-2.5`,onClick:()=>J(!0),children:[(0,Q.jsx)(be,{className:`size-3.5`,"aria-hidden":`true`}),t.editPriority]}):null]}),Je?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-3 text-lg font-semibold leading-7 tracking-tight text-fg`,children:Je}),Ye?.desiredOutcome?(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Ye.desiredOutcome}):null,$?(0,Q.jsxs)(`p`,{className:`mt-auto flex items-center gap-1.5 pt-4 text-xs text-fg-subtle`,children:[(0,Q.jsx)(he,{className:`size-3.5`,"aria-hidden":`true`}),gt($.validTo,e)]}):null]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-6 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(te,{className:`size-5 text-fg-subtle`}),(0,Q.jsx)(`span`,{children:t.noPriority}),(0,Q.jsxs)(C,{variant:`primary`,className:`mt-2`,onClick:()=>J(!0),children:[(0,Q.jsx)(d,{className:`size-4`,"aria-hidden":`true`}),t.addPriority]})]}),Xe.length?(0,Q.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,Q.jsx)(`div`,{className:`mt-2 space-y-2`,children:Xe.slice(0,3).map(e=>(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,Q.jsx)(`section`,{"aria-label":t.understanding,className:`grid gap-2 sm:grid-cols-3`,children:[{icon:B,label:t.explicit,hint:t.explicitHint,count:We},{icon:le,label:t.learned,hint:t.learnedHint,count:Ge},{icon:o,label:t.pending,hint:t.pendingHint,count:He.length}].map(({icon:e,label:t,hint:n,count:r},i)=>(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-24 w-full cursor-pointer items-start gap-3 rounded-2xl px-4 py-4 text-left transition-colors hover:bg-surface-panel focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:px-5`,onClick:()=>Ot(i===0?`explicit`:i===1?`learned`:`pending`),"aria-label":`${t}: ${r}`,children:[(0,Q.jsx)(e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{className:`mr-1.5 text-lg tabular-nums`,children:r}),t]}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:n})]}),(0,Q.jsx)(fe,{className:`mt-1 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted motion-reduce:transform-none`,"aria-hidden":`true`})]},t))}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-10 lg:grid-cols-2 lg:gap-8`,children:[(0,Q.jsx)(St,{title:t.recent,hint:t.recentHint,action:(0,Q.jsx)(C,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>De(`understanding`),children:t.seeAll}),children:Qe.length?(0,Q.jsx)(`div`,{children:Pe(Qe.slice(0,3),e).map(({label:e,items:t})=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`px-5 pb-1 pt-4 text-xs font-medium text-fg-muted`,children:e}),(0,Q.jsx)(`div`,{children:t.map(At)})]},e))}):(0,Q.jsx)(Ct,{icon:(0,Q.jsx)(le,{className:`size-5`}),children:t.emptyGroup})}),(0,Q.jsx)(St,{title:t.howWeWork,hint:t.howWeWorkHint,children:Ze.length?Ze.slice(0,3).map(t=>(0,Q.jsx)(Et,{rule:t,language:e,busy:_===t.id,onToggle:()=>void je(t.id,()=>q(t.id,t.status===`active`?`disabled`:`active`))},t.id)):(0,Q.jsx)(Ct,{icon:(0,Q.jsx)(_e,{className:`size-5`}),children:t.noRules})})]}),(0,Q.jsx)(St,{title:t.workMemory,hint:t.workMemoryHint,action:(0,Q.jsx)(C,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>De(`knowledge`),children:t.seeAll}),children:lt.length?(0,Q.jsx)(`div`,{"data-testid":`memory-summary-grid`,className:`grid gap-3 bg-surface-base ${ft}`,children:ut.map(({kind:t,count:n})=>(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-28 cursor-pointer items-start justify-between rounded-2xl bg-surface-panel px-5 py-5 text-left transition-colors hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>kt(t),"aria-label":`${bt(t,e)}: ${n}`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,Q.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:bt(t,e)})]}),(0,Q.jsx)(fe,{className:`mt-1 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted motion-reduce:transform-none`,"aria-hidden":`true`})]},t))}):(0,Q.jsx)(Ct,{icon:(0,Q.jsx)(Ce,{className:`size-5`}),children:t.noKnowledge})}),(0,Q.jsx)(`footer`,{className:`flex items-center gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(pe,{className:`size-3.5`,"aria-hidden":`true`}),Mt]})})]}):null,g===`understanding`?(0,Q.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-10`,children:[(0,Q.jsxs)(`div`,{className:`px-1 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(le,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":t.understandingFilterHint,children:yt.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":Y===e.id,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${Y===e.id?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>de(e.id),children:[e.label,(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:e.count})]},e.id))})]}),ct.length?ct.map(({key:e,title:t,icon:n,items:r})=>(0,Q.jsx)(St,{title:t,action:(0,Q.jsx)(n,{className:`size-4 text-fg-subtle`,"aria-hidden":`true`}),children:(0,Q.jsx)(`div`,{children:r.map(At)})},e)):(0,Q.jsx)(`div`,{className:`rounded-2xl bg-surface-panel`,children:(0,Q.jsx)(Ct,{icon:(0,Q.jsx)(le,{className:`size-5`}),children:t.emptyGroup})})]}):null,g===`knowledge`?(0,Q.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-8`,children:[(0,Q.jsxs)(`div`,{className:`px-1 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:ve===`all`?t.allMemory:bt(ve,e)}),(0,Q.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[tt.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,Q.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,Q.jsx)(oe,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,Q.jsx)(`input`,{type:`search`,value:N,onChange:e=>{P(e.target.value),L(24)},placeholder:t.searchPlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":t.memoryFilterHint,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":ve===`all`,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${ve===`all`?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>Se(`all`),children:[t.allMemory,(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:$e.length})]}),lt.map(({kind:t,count:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":ve===t,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${ve===t?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>Se(t),children:[bt(t,e),(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:n})]},t))]})]}),st.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`space-y-8`,children:vt.map(({kind:t,items:n,totalCount:r})=>(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between px-5 pb-1 pt-4 sm:px-6`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:bt(t,e)}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,Q.jsx)(`div`,{children:n.map(t=>(0,Q.jsx)(Dt,{item:t,language:e,busy:!!_,expanded:R===t.id,onToggle:()=>z(e=>e===t.id?void 0:t.id),editing:T===`knowledge:${t.id}`,draft:O,onDraftChange:j,onEdit:()=>{E(`knowledge:${t.id}`),j(t.content)},onCancel:()=>{E(void 0),j(``)},onDelete:()=>void je(t.id,()=>me(t.id)),onReview:(e,n)=>void je(t.id,async()=>{await ge(t,e,n),E(void 0),j(``)})},t.id))})]},t))}),st.length>I?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(C,{onClick:()=>L(e=>e+24),children:t.showMore})}):null]}):(0,Q.jsx)(`div`,{className:`rounded-2xl bg-surface-panel`,children:(0,Q.jsx)(Ct,{icon:(0,Q.jsx)(oe,{className:`size-5`}),children:N.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,Q.jsx)(wt,{open:G,profile:Be,language:e,saving:_===`profile`,onOpenChange:K,onSave:e=>void Ne(e)}),(0,Q.jsx)(Tt,{open:ie,priority:$,title:Je??``,outcome:Ye?.desiredOutcome,language:e,saving:_===($?`priority:${$.id}`:`priority:create`),onOpenChange:J,onSave:e=>$?void Fe($,e):void Ie(e),onEnd:$?()=>void Le($):void 0})]})}export{Ot as UserModelPage};
|